Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions example/e2e/invoice-schedule.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ const currenciesResponse = {
* reverse registration order, so the specific stubs below take precedence over it.
*/
async function stubInvoiceScheduleApi(page: Page) {
await page.route('**/api/fetch-refresh-token', (route) =>
route.fulfill({
json: { access_token: 'e2e-access-token', expires_in: 3600 },
}),
);

await page.route(
/\/v1\/contractors\/employments\/[^/]+\/contractor-currencies/,
(route) => route.fulfill({ json: currenciesResponse }),
Expand Down
5 changes: 1 addition & 4 deletions example/src/ContractorOnboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -745,10 +745,7 @@ export const ContractorOnboardingWithProps = ({
}: ContractorOnboardingFormData) => {
return (
<div className='contractor-onboarding-container'>
<RemoteFlows
authType='company-manager'
proxy={{ url: window.location.origin }}
>
<RemoteFlows proxy={{ url: window.location.origin }}>
<div className='contractor-onboarding-content'>
<ContractorOnboardingFlow
render={OnBoardingRender}
Expand Down
5 changes: 1 addition & 4 deletions example/src/CreateCompany.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,7 @@ export const CreateCompanyWithProps = ({
}: CreateCompanyWithPropsData) => {
return (
<div className='contractor-onboarding-container'>
<RemoteFlows
authType='company-manager'
proxy={{ url: window.location.origin }}
>
<RemoteFlows proxy={{ url: window.location.origin }}>
<div className='contractor-onboarding-content'>
<Header />
<Card className='px-0 py-0'>
Expand Down
5 changes: 1 addition & 4 deletions example/src/JsonSchemaComparisonDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import { RemoteFlows } from './RemoteFlows';

export const JsonSchemaComparisonDemo = () => {
return (
<RemoteFlows
authType='company-manager'
proxy={{ url: window.location.origin }}
>
<RemoteFlows proxy={{ url: window.location.origin }}>
<JsonSchemaComparison />
</RemoteFlows>
);
Expand Down
10 changes: 6 additions & 4 deletions example/src/RemoteFlows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ type RemoteFlowsProps = Omit<RemoteFlowsSDKProps, 'auth'> & {
auth?: RemoteFlowsSDKProps['auth'];
isClientToken?: boolean;
/**
* `'none'` skips the FE-side auth callback entirely — use it when the proxy
* mints tokens server-side and the FE never needs to hold one.
* `'none'` skips the FE-side auth callback entirely. It's the default when
* `proxy` is passed, since the example proxy mints tokens server-side and
* the FE never needs to hold one.
*/
authType?: 'refresh-token' | 'company-manager' | 'client' | 'none';
};
Expand All @@ -59,8 +60,9 @@ export const RemoteFlows = ({
authType,
...props
}: RemoteFlowsProps) => {
const hasProxy = !!props.proxy;
const auth = useMemo(() => {
if (authType === 'none') {
if (authType === 'none' || (!authType && !isClientToken && hasProxy)) {
return undefined;
}
if (authType === 'company-manager') {
Expand All @@ -71,7 +73,7 @@ export const RemoteFlows = ({
}

return fetchCompanyToken;
}, [authType, isClientToken]);
}, [authType, isClientToken, hasProxy]);
return (
<ErrorBoundary>
<RemoteFlowsAuth
Expand Down
2 changes: 1 addition & 1 deletion example/src/Termination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export const TerminationWithProps = ({
}) => {
const proxyURL = window.location.origin;
return (
<RemoteFlows proxy={{ url: proxyURL }} authType='company-manager'>
<RemoteFlows proxy={{ url: proxyURL }}>
<TerminationFlow
employmentId={employmentId}
render={TerminationRender}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ export const JsonSchemaPlayground = () => {
}, []);

return (
<RemoteFlows
authType='company-manager'
proxy={{ url: window.location.origin }}
>
<RemoteFlows proxy={{ url: window.location.origin }}>
<JsonSchemaPlaygroundFlow
defaultSchema={selectedSchema}
schemas={SCHEMAS}
Expand Down
Loading