@remoteoss/remote-flows 0.4.0-alpha.12 → 0.4.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/dist/flows/CostCalculator/context.d.ts +1 -1
- package/dist/flows/CostCalculator/index.d.ts +1 -1
- package/dist/flows/CostCalculator/utils.d.ts +1 -1
- package/dist/flows/Onboarding/AnnualGrossSalary.d.ts +1 -1
- package/dist/flows/Onboarding/BenefitsStep.d.ts +1 -1
- package/dist/flows/Onboarding/OnboardingFlow.d.ts +1 -1
- package/dist/flows/Onboarding/OnboardingForm.d.ts +1 -1
- package/dist/flows/Onboarding/index.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{remoteFlows-lYAFzyXi.d.ts → remoteFlows--lO1UtNJ.d.ts} +10 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,8 +44,8 @@ npm install
|
|
|
44
44
|
CLIENT_ID=your_client_id
|
|
45
45
|
CLIENT_SECRET=your_client_secret
|
|
46
46
|
REFRESH_TOKEN=your_refresh_token
|
|
47
|
-
|
|
48
|
-
#
|
|
47
|
+
VITE_REMOTE_GATEWAY=partners # for sandbox
|
|
48
|
+
# VITE_REMOTE_GATEWAY=production # for production
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
3. Start the development server:
|
|
@@ -63,13 +63,13 @@ The example app will be available at `http://localhost:3001`. The server handles
|
|
|
63
63
|
|
|
64
64
|
The `RemoteFlows` component serves as a provider for authentication and theming.
|
|
65
65
|
|
|
66
|
-
| Prop
|
|
67
|
-
|
|
|
68
|
-
| `auth`
|
|
69
|
-
| `
|
|
70
|
-
| `theme`
|
|
71
|
-
| `components`
|
|
72
|
-
| `proxy`
|
|
66
|
+
| Prop | Type | Required | Description |
|
|
67
|
+
| ------------- | ----------------------------------------------------------- | -------- | --------------------------------------------------------- |
|
|
68
|
+
| `auth` | `() => Promise<{ accessToken: string, expiresIn: number }>` | Yes | Function to fetch authentication token |
|
|
69
|
+
| `environment` | `'partners' \| 'production' \| 'sandbox' \| 'staging'` | No | Environment to use for API calls (defaults to production) |
|
|
70
|
+
| `theme` | `ThemeOptions` | No | Custom theme configuration |
|
|
71
|
+
| `components` | `Components` | No | Custom field components for form rendering |
|
|
72
|
+
| `proxy` | `{ url: string, headers?: Record<string, string> }` | No | Configuration for API request proxy with optional headers |
|
|
73
73
|
|
|
74
74
|
### Custom Field Components
|
|
75
75
|
|
|
@@ -3,7 +3,7 @@ import { useCostCalculator, EstimationError } from './hooks.js';
|
|
|
3
3
|
import { CostCalculatorEstimationFormValues, CostCalculatorEstimationSubmitValues } from './types.js';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { c as CostCalculatorEstimateResponse } from '../../types.gen-D_v539E_.js';
|
|
6
|
-
import { $ as $TSFixMe } from '../../remoteFlows
|
|
6
|
+
import { $ as $TSFixMe } from '../../remoteFlows--lO1UtNJ.js';
|
|
7
7
|
import * as yup from 'yup';
|
|
8
8
|
import { UseFormReturn } from 'react-hook-form';
|
|
9
9
|
import '@remoteoss/json-schema-form';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as CostCalculatorEstimateParams } from '../../types.gen-D_v539E_.js';
|
|
2
|
-
import { $ as $TSFixMe } from '../../remoteFlows
|
|
2
|
+
import { $ as $TSFixMe } from '../../remoteFlows--lO1UtNJ.js';
|
|
3
3
|
import { AnyObjectSchema } from 'yup';
|
|
4
4
|
import { CostCalculatorEstimationSubmitValues, CostCalculatorEstimationOptions } from './types.js';
|
|
5
5
|
import 'react';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { C as Components } from '../../remoteFlows
|
|
2
|
+
import { C as Components } from '../../remoteFlows--lO1UtNJ.js';
|
|
3
3
|
import { S as SuccessResponse } from '../../types.gen-D_v539E_.js';
|
|
4
4
|
import { BenefitsFormPayload } from './types.js';
|
|
5
5
|
import { N as NormalizedFieldError } from '../../mutations-B6HWH-rZ.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { Fields } from '@remoteoss/json-schema-form';
|
|
3
3
|
import { BasicInformationFormPayload, BenefitsFormPayload, ContractDetailsFormPayload } from './types.js';
|
|
4
|
-
import { C as Components } from '../../remoteFlows
|
|
4
|
+
import { C as Components } from '../../remoteFlows--lO1UtNJ.js';
|
|
5
5
|
import '../../types.gen-D_v539E_.js';
|
|
6
6
|
import '../types.js';
|
|
7
7
|
import 'react';
|
|
@@ -17,7 +17,7 @@ import './OnboardingSubmit.js';
|
|
|
17
17
|
import './OnboardingBack.js';
|
|
18
18
|
import './ContractDetailsStep.js';
|
|
19
19
|
import './BenefitsStep.js';
|
|
20
|
-
import '../../remoteFlows
|
|
20
|
+
import '../../remoteFlows--lO1UtNJ.js';
|
|
21
21
|
import 'yup';
|
|
22
22
|
import '../../types-CxSFjQw5.js';
|
|
23
23
|
import './SelectCountryStep.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -25,8 +25,8 @@ import { ContractAmendmentParams } from './flows/ContractAmendment/types.js';
|
|
|
25
25
|
import { ValidationError } from 'yup';
|
|
26
26
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
27
27
|
import { PropsWithChildren } from 'react';
|
|
28
|
-
import { R as RemoteFlowsSDKProps } from './remoteFlows
|
|
29
|
-
export { $ as $TSFixMe, B as ButtonComponentProps, C as Components, F as FieldComponentProps, S as StatementComponentProps } from './remoteFlows
|
|
28
|
+
import { R as RemoteFlowsSDKProps } from './remoteFlows--lO1UtNJ.js';
|
|
29
|
+
export { $ as $TSFixMe, B as ButtonComponentProps, C as Components, F as FieldComponentProps, S as StatementComponentProps } from './remoteFlows--lO1UtNJ.js';
|
|
30
30
|
export { F as FieldError, N as NormalizedFieldError } from './mutations-B6HWH-rZ.js';
|
|
31
31
|
import './flows/types.js';
|
|
32
32
|
import '@remoteoss/json-schema-form';
|
|
@@ -94,6 +94,6 @@ type YupError = Pick<ValidationError, 'type' | 'errors'> & {
|
|
|
94
94
|
*/
|
|
95
95
|
declare const transformYupErrorsIntoObject: (errors: ValidationError) => Record<string, YupError>;
|
|
96
96
|
|
|
97
|
-
declare function RemoteFlows({ auth, children, components,
|
|
97
|
+
declare function RemoteFlows({ auth, children, components, theme, proxy, environment, }: PropsWithChildren<RemoteFlowsSDKProps>): react_jsx_runtime.JSX.Element;
|
|
98
98
|
|
|
99
|
-
export { RemoteFlows, transformYupErrorsIntoObject, useEmploymentQuery, useTimeOffQuery };
|
|
99
|
+
export { RemoteFlows, RemoteFlowsSDKProps, transformYupErrorsIntoObject, useEmploymentQuery, useTimeOffQuery };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./chunk-M22FKNEY.js";import{a as tr}from"./chunk-QUM7V5EP.js";import"./chunk-LLIGZSYY.js";import"./chunk-JXCJLQRA.js";import"./chunk-OS3QI7CV.js";import"./chunk-XFD3ULUF.js";import"./chunk-WWANHPT7.js";import"./chunk-DR7VGNO2.js";import"./chunk-XSHHMBMT.js";import"./chunk-JODJFARP.js";import"./chunk-W5DG5WWJ.js";import"./chunk-VX2UC3HG.js";import"./chunk-S4XU4SE7.js";import"./chunk-GULCZWSK.js";import"./chunk-KGSIUWBI.js";import"./chunk-4BOE6EEO.js";import"./chunk-O4PJ6GWS.js";import"./chunk-BF7QENCN.js";import"./chunk-OP4QGFLS.js";import"./chunk-U6OPL6WG.js";import"./chunk-MRYRNB7Y.js";import{a as or}from"./chunk-XQXFQ7LM.js";import"./chunk-BYFO5OB6.js";import"./chunk-C3HJSV4T.js";import"./chunk-GPAE53HO.js";import"./chunk-ASFAGLQI.js";import"./chunk-7N7ND6Z4.js";import"./chunk-7JHIPWS7.js";import"./chunk-RDAO365M.js";import"./chunk-AN7L3GVL.js";import"./chunk-WVJDCDGZ.js";import"./chunk-D53FKWGJ.js";import"./chunk-X6DRD2I4.js";import"./chunk-AOJAZ4FT.js";import"./chunk-QKTDO33H.js";import"./chunk-VN4HDCRB.js";import"./chunk-PGWKJ6FK.js";import"./chunk-FGBEOUQK.js";import{a as E}from"./chunk-DKIWM2PT.js";import"./chunk-WIRFNWEU.js";import"./chunk-3NZ6PO4D.js";import"./chunk-YO4OQIFP.js";import"./chunk-32RYPLZK.js";import"./chunk-PJCUSCO4.js";import"./chunk-EEAMZPP6.js";import"./chunk-FB5J7SRP.js";import{a as
|
|
1
|
+
import"./chunk-M22FKNEY.js";import{a as tr}from"./chunk-QUM7V5EP.js";import"./chunk-LLIGZSYY.js";import"./chunk-JXCJLQRA.js";import"./chunk-OS3QI7CV.js";import"./chunk-XFD3ULUF.js";import"./chunk-WWANHPT7.js";import"./chunk-DR7VGNO2.js";import"./chunk-XSHHMBMT.js";import"./chunk-JODJFARP.js";import"./chunk-W5DG5WWJ.js";import"./chunk-VX2UC3HG.js";import"./chunk-S4XU4SE7.js";import"./chunk-GULCZWSK.js";import"./chunk-KGSIUWBI.js";import"./chunk-4BOE6EEO.js";import"./chunk-O4PJ6GWS.js";import"./chunk-BF7QENCN.js";import"./chunk-OP4QGFLS.js";import"./chunk-U6OPL6WG.js";import"./chunk-MRYRNB7Y.js";import{a as or}from"./chunk-XQXFQ7LM.js";import"./chunk-BYFO5OB6.js";import"./chunk-C3HJSV4T.js";import"./chunk-GPAE53HO.js";import"./chunk-ASFAGLQI.js";import"./chunk-7N7ND6Z4.js";import"./chunk-7JHIPWS7.js";import"./chunk-RDAO365M.js";import"./chunk-AN7L3GVL.js";import"./chunk-WVJDCDGZ.js";import"./chunk-D53FKWGJ.js";import"./chunk-X6DRD2I4.js";import"./chunk-AOJAZ4FT.js";import"./chunk-QKTDO33H.js";import"./chunk-VN4HDCRB.js";import"./chunk-PGWKJ6FK.js";import"./chunk-FGBEOUQK.js";import{a as E}from"./chunk-DKIWM2PT.js";import"./chunk-WIRFNWEU.js";import"./chunk-3NZ6PO4D.js";import"./chunk-YO4OQIFP.js";import"./chunk-32RYPLZK.js";import"./chunk-PJCUSCO4.js";import"./chunk-EEAMZPP6.js";import"./chunk-FB5J7SRP.js";import{a as R}from"./chunk-H4BI3LJD.js";import{a as z}from"./chunk-3HPG2L62.js";import{a as T}from"./chunk-KM4XVL2X.js";import"./chunk-A7ZJQCNU.js";import{a as B}from"./chunk-EV5YPN4F.js";import{a as _}from"./chunk-DYB3RWP7.js";import{a as P}from"./chunk-ZOG52VVG.js";import"./chunk-KSHK3ZPX.js";import{b as y,c as k,e as C}from"./chunk-SUS7UBI5.js";import"./chunk-UPRUP24B.js";import"./chunk-PWUYHFON.js";import{a as er}from"./chunk-IEZAM2XO.js";import{a as H}from"./chunk-RXK4RLF6.js";import{a as ar}from"./chunk-NIOH7TNP.js";import{a as J,b as rr}from"./chunk-LX7QBDSF.js";import"./chunk-WRKHWEZA.js";import"./chunk-5SMMQQXP.js";import{a as p}from"./chunk-WKK63LAY.js";import"./chunk-PJBAQZ6G.js";import"./chunk-CTTXXEWI.js";import{a as G}from"./chunk-CSU6IQX3.js";import{a as Z}from"./chunk-RFYJGH2X.js";import"./chunk-Z3HWTDRE.js";import"./chunk-XO3JWN33.js";import"./chunk-GFMFGU7A.js";import"./chunk-CFIJKJXD.js";import"./chunk-GEYFQVQI.js";import{a as g,c as v}from"./chunk-3ZWDIEEM.js";import"./chunk-VNSF5IOL.js";import"./chunk-MH6KKP6K.js";import"./chunk-TVZAFTPT.js";import{c as F}from"./chunk-KPHSEIR3.js";import{a as e}from"./chunk-P37U34EQ.js";import{QueryClient as L,QueryClientProvider as q}from"@tanstack/react-query";function l(r){let a=document.documentElement;Object.keys(r).forEach(t=>{let o=r[t];o&&a.style.setProperty(t,o)})}e(l,"setCssProperties");function S(r){let a={};return Object.keys(r).forEach(t=>{a[`--${t}`]=r[t]}),a}e(S,"mapThemeColors");function N(r){return{"--spacing":r}}e(N,"mapThemeSpacing");function O(r){return{"--radius":r}}e(O,"mapThemeBorderRadius");function j(r){return{"--fontSizeBase":r.fontSizeBase}}e(j,"mapThemeFont");function h(r){r?.colors&&l(S(r.colors)),r?.spacing&&l(N(r.spacing)),r?.borderRadius&&l(O(r.borderRadius)),r?.font&&l(j(r.font))}e(h,"applyTheme");import{createContext as D,useEffect as I,useMemo as A}from"react";import{jsx as V}from"react/jsx-runtime";var K=D({theme:{}});function u(r){I(()=>{r.theme&&Object.keys(r.theme).length>0&&h(r.theme)},[r.theme]);let a=A(()=>({theme:r.theme}),[r.theme]);return V(K.Provider,{value:a,children:r.children})}e(u,"ThemeProvider");var m={partners:"https://gateway.partners.remote-sandbox.com",production:"https://gateway.remote.com",sandbox:"https://gateway.remote-sandbox.com",staging:"https://gateway.niceremote.com"};import{createClient as U}from"@hey-api/client-fetch";import{useQuery as W}from"@tanstack/react-query";import{useRef as w}from"react";function M(r){try{return new URL(r),!0}catch{return!1}}e(M,"isValidUrl");var f=e(({auth:r,options:a})=>{let t=w(null),{refetch:o}=W({queryKey:["auth"],queryFn:r,enabled:!1}),c=a?.environment?m[a?.environment]:"https://gateway.remote.com",s=p.getConfig(),x="0.4.0-alpha.13",d=!!a?.proxy&&M(a.proxy.url);return a?.proxy&&!d&&console.error("Invalid proxy URL provided. Using default base URL."),w(U({...s,headers:{...s.headers,...d?a?.proxy?.headers:{},"X-Client-Name":"remote-flows-sdk","X-Client-Version":x},baseUrl:d?a.proxy?.url:c,auth:e(async()=>{function b(i){return!i||Date.now()+6e4>i}if(e(b,"hasTokenExpired"),!t.current||b(t.current.expiresAt)){let{data:i}=await o();i&&(t.current={accessToken:i.accessToken,expiresAt:Date.now()+i.expiresIn*1e3})}return t.current?.accessToken},"auth")}))},"useAuth");import{jsx as n}from"react/jsx-runtime";var Q=new L;function X({children:r,auth:a,proxy:t,environment:o}){let c=f({auth:a,options:{proxy:t,environment:o}});return n(v.Provider,{value:{client:c.current},children:r})}e(X,"RemoteFlowContextWrapper");function Y({children:r,components:a}){return n(g.Provider,{value:a?{components:a}:{components:{}},children:r})}e(Y,"FormFieldsProvider");function $({auth:r,children:a,components:t,theme:o,proxy:c,environment:s}){return n(q,{client:Q,children:n(Y,{components:t,children:n(X,{auth:r,proxy:c,environment:s,children:n(u,{theme:o,children:a})})})})}e($,"RemoteFlows");export{G as ContractAmendmentConfirmationForm,er as ContractAmendmentFlow,Z as ContractAmendmentForm,H as ContractAmendmentSubmit,B as CostCalculatorDisclaimer,P as CostCalculatorFlow,R as CostCalculatorForm,z as CostCalculatorResetButton,E as CostCalculatorResults,T as CostCalculatorSubmitButton,or as OnboardingFlow,$ as RemoteFlows,tr as TerminationFlow,y as buildCostCalculatorEstimationPayload,_ as disclaimerData,F as transformYupErrorsIntoObject,ar as useContractAmendment,C as useCostCalculator,k as useCostCalculatorEstimationPdf,J as useEmploymentQuery,rr as useTimeOffQuery};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/RemoteFlowsProvider.tsx","../src/lib/applyTheme.ts","../src/theme.tsx","../src/environments.ts","../src/useAuth.ts"],"sourcesContent":["import { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport type { PropsWithChildren } from 'react';\nimport React from 'react';\n\nimport { ThemeProvider } from '@/src/theme';\nimport { FormFieldsContext, RemoteFlowContext } from './context';\nimport { Components, RemoteFlowsSDKProps } from './types/remoteFlows';\nimport { useAuth } from './useAuth';\n\nconst queryClient = new QueryClient();\n\ntype RemoteFlowContextWrapperProps = {\n auth: RemoteFlowsSDKProps['auth'];\n children: React.ReactNode;\n isTestingMode?: RemoteFlowsSDKProps['isTestingMode'];\n proxy?: RemoteFlowsSDKProps['proxy'];\n};\n\nfunction RemoteFlowContextWrapper({\n children,\n auth,\n isTestingMode,\n proxy,\n}: RemoteFlowContextWrapperProps) {\n const remoteApiClient = useAuth({\n auth,\n options: {\n isTestingMode: !!isTestingMode,\n proxy,\n },\n });\n return (\n <RemoteFlowContext.Provider value={{ client: remoteApiClient.current }}>\n {children}\n </RemoteFlowContext.Provider>\n );\n}\n\nexport function FormFieldsProvider({\n children,\n components,\n}: PropsWithChildren<{\n components?: Components;\n}>) {\n return (\n <FormFieldsContext.Provider\n value={components ? { components } : { components: {} }}\n >\n {children}\n </FormFieldsContext.Provider>\n );\n}\n\nexport function RemoteFlows({\n auth,\n children,\n components,\n isTestingMode = false,\n theme,\n proxy,\n}: PropsWithChildren<RemoteFlowsSDKProps>) {\n return (\n <QueryClientProvider client={queryClient}>\n <FormFieldsProvider components={components}>\n <RemoteFlowContextWrapper\n isTestingMode={isTestingMode}\n auth={auth}\n proxy={proxy}\n >\n <ThemeProvider theme={theme}>{children}</ThemeProvider>\n </RemoteFlowContextWrapper>\n </FormFieldsProvider>\n </QueryClientProvider>\n );\n}\n","import {\n CssThemeBorder,\n CssThemeColors,\n CssThemeFont,\n CssThemeSpacing,\n ThemeColors,\n ThemeFont,\n ThemeProviderProps,\n} from '@/src/types/theme';\n\nfunction setCssProperties(variables: Record<string, string>) {\n const root = document.documentElement;\n Object.keys(variables).forEach((v) => {\n const propertyVal = variables[v];\n if (propertyVal) {\n root.style.setProperty(v, propertyVal);\n }\n });\n}\n\nfunction mapThemeColors(colors: ThemeColors): CssThemeColors {\n const result: CssThemeColors = {};\n Object.keys(colors).forEach((key) => {\n result[`--${key}` as keyof CssThemeColors] =\n colors[key as keyof ThemeColors];\n });\n return result;\n}\n\nfunction mapThemeSpacing(spacing: string): CssThemeSpacing {\n return {\n '--spacing': spacing,\n };\n}\n\nfunction mapThemeBorderRadius(borderRadius: string): CssThemeBorder {\n return {\n '--radius': borderRadius,\n };\n}\n\nfunction mapThemeFont(font: ThemeFont): CssThemeFont {\n return {\n '--fontSizeBase': font.fontSizeBase,\n };\n}\n\nexport function applyTheme(theme: ThemeProviderProps['theme']) {\n if (theme?.colors) {\n setCssProperties(mapThemeColors(theme.colors));\n }\n\n if (theme?.spacing) {\n setCssProperties(mapThemeSpacing(theme.spacing));\n }\n\n if (theme?.borderRadius) {\n setCssProperties(mapThemeBorderRadius(theme.borderRadius));\n }\n\n if (theme?.font) {\n setCssProperties(mapThemeFont(theme.font));\n }\n}\n","import { applyTheme } from '@/src/lib/applyTheme';\nimport { createContext, useEffect, useMemo } from 'react';\nimport { ThemeProviderProps } from './types/theme';\n\nconst ThemeContext = createContext<Omit<ThemeProviderProps, 'children'>>({\n theme: {},\n});\n\nexport function ThemeProvider(props: ThemeProviderProps) {\n useEffect(() => {\n if (props.theme && Object.keys(props.theme).length > 0) {\n applyTheme(props.theme);\n }\n }, [props.theme]);\n\n const value = useMemo(() => {\n return { theme: props.theme };\n }, [props.theme]);\n\n return (\n <ThemeContext.Provider value={value}>\n {props.children}\n </ThemeContext.Provider>\n );\n}\n","export const ENVIRONMENTS = {\n staging: 'https://gateway.niceremote.com',\n partners: 'https://gateway.partners.remote-sandbox.com',\n production: 'https://gateway.remote.com',\n};\n","import { client } from '@/src/client/client.gen';\nimport { ENVIRONMENTS } from '@/src/environments';\nimport { createClient } from '@hey-api/client-fetch';\nimport { useQuery } from '@tanstack/react-query';\nimport { useRef } from 'react';\nimport { RemoteFlowsSDKProps } from './types/remoteFlows';\n\ntype AuthResponse = {\n accessToken: string;\n expiresIn: number;\n};\n\ntype Options = {\n isTestingMode: boolean;\n proxy?: RemoteFlowsSDKProps['proxy'];\n};\n\nfunction isValidUrl(url: string) {\n try {\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\nexport const useAuth = ({\n auth,\n options,\n}: {\n auth: () => Promise<AuthResponse>;\n options: Options;\n}) => {\n const session = useRef<{ accessToken: string; expiresAt: number } | null>(\n null,\n );\n const { refetch } = useQuery({\n queryKey: ['auth'],\n queryFn: auth,\n enabled: false,\n });\n\n const baseUrl = options.isTestingMode\n ? ENVIRONMENTS.partners\n : process.env.REMOTE_GATEWAY_URL;\n\n const clientConfig = client.getConfig();\n const npmPackageVersion = process.env.VERSION;\n const isValidProxy = !!options.proxy && isValidUrl(options.proxy.url);\n\n if (options.proxy && !isValidProxy) {\n console.error('Invalid proxy URL provided. Using default base URL.');\n }\n\n return useRef(\n createClient({\n ...clientConfig,\n headers: {\n ...clientConfig.headers,\n ...(isValidProxy ? options.proxy?.headers : {}),\n 'X-Client-Name': 'remote-flows-sdk',\n 'X-Client-Version': npmPackageVersion,\n },\n baseUrl: isValidProxy ? options.proxy?.url : baseUrl,\n auth: async () => {\n function hasTokenExpired(expiresAt: number | undefined) {\n return !expiresAt || Date.now() + 60000 > expiresAt;\n }\n if (!session.current || hasTokenExpired(session.current.expiresAt)) {\n const { data } = await refetch();\n if (data) {\n session.current = {\n accessToken: data.accessToken,\n expiresAt: Date.now() + data.expiresIn * 1000,\n };\n }\n }\n return session.current?.accessToken;\n },\n }),\n );\n};\n"],"mappings":"q7EAAA,OAAS,eAAAA,EAAa,uBAAAC,MAA2B,wBCUjD,SAASC,EAAiBC,EAAmC,CAC3D,IAAMC,EAAO,SAAS,gBACtB,OAAO,KAAKD,CAAS,EAAE,QAASE,GAAM,CACpC,IAAMC,EAAcH,EAAUE,CAAC,EAC3BC,GACFF,EAAK,MAAM,YAAYC,EAAGC,CAAW,CAEzC,CAAC,CACH,CARSC,EAAAL,EAAA,oBAUT,SAASM,EAAeC,EAAqC,CAC3D,IAAMC,EAAyB,CAAC,EAChC,cAAO,KAAKD,CAAM,EAAE,QAASE,GAAQ,CACnCD,EAAO,KAAKC,CAAG,EAA0B,EACvCF,EAAOE,CAAwB,CACnC,CAAC,EACMD,CACT,CAPSH,EAAAC,EAAA,kBAST,SAASI,EAAgBC,EAAkC,CACzD,MAAO,CACL,YAAaA,CACf,CACF,CAJSN,EAAAK,EAAA,mBAMT,SAASE,EAAqBC,EAAsC,CAClE,MAAO,CACL,WAAYA,CACd,CACF,CAJSR,EAAAO,EAAA,wBAMT,SAASE,EAAaC,EAA+B,CACnD,MAAO,CACL,iBAAkBA,EAAK,YACzB,CACF,CAJSV,E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EACA,WAAAS,CACF,EAEI,CACF,OACEb,EAACc,EAAkB,SAAlB,CACC,MAAOD,EAAa,CAAE,WAAAA,CAAW,EAAI,CAAE,WAAY,CAAC,CAAE,EAErD,SAAAT,EACH,CAEJ,CAbgBO,EAAAC,EAAA,sBAeT,SAASG,EAAY,CAC1B,KAAAV,EACA,SAAAD,EACA,WAAAS,EACA,cAAAP,EAAgB,GAChB,MAAAU,EACA,MAAAT,CACF,EAA2C,CACzC,OACEP,EAACiB,EAAA,CAAoB,OAAQhB,EAC3B,SAAAD,EAACY,EAAA,CAAmB,WAAYC,EAC9B,SAAAb,EAACG,EAAA,CACC,cAAeG,EACf,KAAMD,EACN,MAAOE,EAEP,SAAAP,EAACkB,EAAA,CAAc,MAAOF,EAAQ,SAAAZ,EAAS,EACzC,EACF,EACF,CAEJ,CArBgBO,EAAAI,EAAA","names":["QueryClient","QueryClientProvider","setCssProperties","variables","root","v","propertyVal","__name","mapThemeColors","colors","result","key","mapThemeSpacing","spacing","mapThemeBorderRadius","borderRadius","mapThemeFont","font","applyTheme","theme","createContext","useEffect","useMemo","jsx","ThemeContext","createContext","ThemeProvider","props","useEffect","applyTheme","value","useMemo","__name","ENVIRONMENTS","createClient","useQuery","useRef","isValidUrl","url","__name","useAuth","auth","options","session","useRef","refetch","useQuery","baseUrl","ENVIRONMENTS","clientConfig","client","npmPackageVersion","isValidProxy","createClient","hasTokenExpired","expiresAt","data","jsx","queryClient","QueryClient","RemoteFlowContextWrapper","children","auth","isTestingMode","proxy","remoteApiClient","useAuth","RemoteFlowContext","__name","FormFieldsProvider","components","FormFieldsContext","RemoteFlows","theme","QueryClientProvider","ThemeProvider"]}
|
|
1
|
+
{"version":3,"sources":["../src/RemoteFlowsProvider.tsx","../src/lib/applyTheme.ts","../src/theme.tsx","../src/environments.ts","../src/useAuth.ts"],"sourcesContent":["import { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport type { PropsWithChildren } from 'react';\nimport React from 'react';\n\nimport { ThemeProvider } from '@/src/theme';\nimport { FormFieldsContext, RemoteFlowContext } from './context';\nimport { Components, RemoteFlowsSDKProps } from './types/remoteFlows';\nimport { useAuth } from './useAuth';\n\nconst queryClient = new QueryClient();\n\ntype RemoteFlowContextWrapperProps = {\n auth: RemoteFlowsSDKProps['auth'];\n children: React.ReactNode;\n environment?: RemoteFlowsSDKProps['environment'];\n proxy?: RemoteFlowsSDKProps['proxy'];\n};\n\nfunction RemoteFlowContextWrapper({\n children,\n auth,\n proxy,\n environment,\n}: RemoteFlowContextWrapperProps) {\n const remoteApiClient = useAuth({\n auth,\n options: {\n proxy,\n environment,\n },\n });\n return (\n <RemoteFlowContext.Provider value={{ client: remoteApiClient.current }}>\n {children}\n </RemoteFlowContext.Provider>\n );\n}\n\nexport function FormFieldsProvider({\n children,\n components,\n}: PropsWithChildren<{\n components?: Components;\n}>) {\n return (\n <FormFieldsContext.Provider\n value={components ? { components } : { components: {} }}\n >\n {children}\n </FormFieldsContext.Provider>\n );\n}\n\nexport function RemoteFlows({\n auth,\n children,\n components,\n theme,\n proxy,\n environment,\n}: PropsWithChildren<RemoteFlowsSDKProps>) {\n return (\n <QueryClientProvider client={queryClient}>\n <FormFieldsProvider components={components}>\n <RemoteFlowContextWrapper\n auth={auth}\n proxy={proxy}\n environment={environment}\n >\n <ThemeProvider theme={theme}>{children}</ThemeProvider>\n </RemoteFlowContextWrapper>\n </FormFieldsProvider>\n </QueryClientProvider>\n );\n}\n","import {\n CssThemeBorder,\n CssThemeColors,\n CssThemeFont,\n CssThemeSpacing,\n ThemeColors,\n ThemeFont,\n ThemeProviderProps,\n} from '@/src/types/theme';\n\nfunction setCssProperties(variables: Record<string, string>) {\n const root = document.documentElement;\n Object.keys(variables).forEach((v) => {\n const propertyVal = variables[v];\n if (propertyVal) {\n root.style.setProperty(v, propertyVal);\n }\n });\n}\n\nfunction mapThemeColors(colors: ThemeColors): CssThemeColors {\n const result: CssThemeColors = {};\n Object.keys(colors).forEach((key) => {\n result[`--${key}` as keyof CssThemeColors] =\n colors[key as keyof ThemeColors];\n });\n return result;\n}\n\nfunction mapThemeSpacing(spacing: string): CssThemeSpacing {\n return {\n '--spacing': spacing,\n };\n}\n\nfunction mapThemeBorderRadius(borderRadius: string): CssThemeBorder {\n return {\n '--radius': borderRadius,\n };\n}\n\nfunction mapThemeFont(font: ThemeFont): CssThemeFont {\n return {\n '--fontSizeBase': font.fontSizeBase,\n };\n}\n\nexport function applyTheme(theme: ThemeProviderProps['theme']) {\n if (theme?.colors) {\n setCssProperties(mapThemeColors(theme.colors));\n }\n\n if (theme?.spacing) {\n setCssProperties(mapThemeSpacing(theme.spacing));\n }\n\n if (theme?.borderRadius) {\n setCssProperties(mapThemeBorderRadius(theme.borderRadius));\n }\n\n if (theme?.font) {\n setCssProperties(mapThemeFont(theme.font));\n }\n}\n","import { applyTheme } from '@/src/lib/applyTheme';\nimport { createContext, useEffect, useMemo } from 'react';\nimport { ThemeProviderProps } from './types/theme';\n\nconst ThemeContext = createContext<Omit<ThemeProviderProps, 'children'>>({\n theme: {},\n});\n\nexport function ThemeProvider(props: ThemeProviderProps) {\n useEffect(() => {\n if (props.theme && Object.keys(props.theme).length > 0) {\n applyTheme(props.theme);\n }\n }, [props.theme]);\n\n const value = useMemo(() => {\n return { theme: props.theme };\n }, [props.theme]);\n\n return (\n <ThemeContext.Provider value={value}>\n {props.children}\n </ThemeContext.Provider>\n );\n}\n","export const ENVIRONMENTS = {\n partners: 'https://gateway.partners.remote-sandbox.com',\n production: 'https://gateway.remote.com',\n sandbox: 'https://gateway.remote-sandbox.com',\n staging: 'https://gateway.niceremote.com',\n};\n","import { client } from '@/src/client/client.gen';\nimport { ENVIRONMENTS } from '@/src/environments';\nimport { createClient } from '@hey-api/client-fetch';\nimport { useQuery } from '@tanstack/react-query';\nimport { useRef } from 'react';\nimport { RemoteFlowsSDKProps } from './types/remoteFlows';\n\ntype AuthResponse = {\n accessToken: string;\n expiresIn: number;\n};\n\ntype Options = Partial<{\n environment: keyof typeof ENVIRONMENTS;\n proxy: RemoteFlowsSDKProps['proxy'];\n}>;\n\nfunction isValidUrl(url: string) {\n try {\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\nexport const useAuth = ({\n auth,\n options,\n}: {\n auth: () => Promise<AuthResponse>;\n options?: Options;\n}) => {\n const session = useRef<{ accessToken: string; expiresAt: number } | null>(\n null,\n );\n const { refetch } = useQuery({\n queryKey: ['auth'],\n queryFn: auth,\n enabled: false,\n });\n\n const baseUrl = options?.environment\n ? ENVIRONMENTS[options?.environment]\n : process.env.REMOTE_GATEWAY_URL;\n\n const clientConfig = client.getConfig();\n const npmPackageVersion = process.env.VERSION;\n const isValidProxy = !!options?.proxy && isValidUrl(options.proxy.url);\n\n if (options?.proxy && !isValidProxy) {\n console.error('Invalid proxy URL provided. Using default base URL.');\n }\n\n return useRef(\n createClient({\n ...clientConfig,\n headers: {\n ...clientConfig.headers,\n ...(isValidProxy ? options?.proxy?.headers : {}),\n 'X-Client-Name': 'remote-flows-sdk',\n 'X-Client-Version': npmPackageVersion,\n },\n baseUrl: isValidProxy ? options.proxy?.url : baseUrl,\n auth: async () => {\n function hasTokenExpired(expiresAt: number | undefined) {\n return !expiresAt || Date.now() + 60000 > expiresAt;\n }\n if (!session.current || hasTokenExpired(session.current.expiresAt)) {\n const { data } = await refetch();\n if (data) {\n session.current = {\n accessToken: data.accessToken,\n expiresAt: Date.now() + data.expiresIn * 1000,\n };\n }\n }\n return session.current?.accessToken;\n },\n }),\n );\n};\n"],"mappings":"q7EAAA,OAAS,eAAAA,EAAa,uBAAAC,MAA2B,wBCUjD,SAASC,EAAiBC,EAAmC,CAC3D,IAAMC,EAAO,SAAS,gBACtB,OAAO,KAAKD,CAAS,EAAE,QAASE,GAAM,CACpC,IAAMC,EAAcH,EAAUE,CAAC,EAC3BC,GACFF,EAAK,MAAM,YAAYC,EAAGC,CAAW,CAEzC,CAAC,CACH,CARSC,EAAAL,EAAA,oBAUT,SAASM,EAAeC,EAAqC,CAC3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B,EAdM,OAeR,CAAC,CACH,CACF,EAvDuB,WJMnB,cAAAc,MAAA,oBAvBJ,IAAMC,EAAc,IAAIC,EASxB,SAASC,EAAyB,CAChC,SAAAC,EACA,KAAAC,EACA,MAAAC,EACA,YAAAC,CACF,EAAkC,CAChC,IAAMC,EAAkBC,EAAQ,CAC9B,KAAAJ,EACA,QAAS,CACP,MAAAC,EACA,YAAAC,CACF,CACF,CAAC,EACD,OACEP,EAACU,EAAkB,SAAlB,CAA2B,MAAO,CAAE,OAAQF,EAAgB,OAAQ,EAClE,SAAAJ,EACH,CAEJ,CAlBSO,EAAAR,EAAA,4BAoBF,SAASS,EAAmB,CACjC,SAAAR,EACA,WAAAS,CACF,EAEI,CACF,OACEb,EAACc,EAAkB,SAAlB,CACC,MAAOD,EAAa,CAAE,WAAAA,CAAW,EAAI,CAAE,WAAY,CAAC,CAAE,EAErD,SAAAT,EACH,CAEJ,CAbgBO,EAAAC,EAAA,sBAeT,SAASG,EAAY,CAC1B,KAAAV,EACA,SAAAD,EACA,WAAAS,EACA,MAAAG,EACA,MAAAV,EACA,YAAAC,CACF,EAA2C,CACzC,OACEP,EAACiB,EAAA,CAAoB,OAAQhB,EAC3B,SAAAD,EAACY,EAAA,CAAmB,WAAYC,EAC9B,SAAAb,EAACG,EAAA,CACC,KAAME,EACN,MAAOC,EACP,YAAaC,EAEb,SAAAP,EAACkB,EAAA,CAAc,MAAOF,EAAQ,SAAAZ,EAAS,EACzC,EACF,EACF,CAEJ,CArBgBO,EAAAI,EAAA","names":["QueryClient","QueryClientProvider","setCssProperties","variables","root","v","propertyVal","__name","mapThemeColors","colors","result","key","mapThemeSpacing","spacing","mapThemeBorderRadius","borderRadius","mapThemeFont","font","applyTheme","theme","createContext","useEffect","useMemo","jsx","ThemeContext","createContext","ThemeProvider","props","useEffect","applyTheme","value","useMemo","__name","ENVIRONMENTS","createClient","useQuery","useRef","isValidUrl","url","__name","useAuth","auth","options","session","useRef","refetch","useQuery","baseUrl","ENVIRONMENTS","clientConfig","client","npmPackageVersion","isValidProxy","createClient","hasTokenExpired","expiresAt","data","jsx","queryClient","QueryClient","RemoteFlowContextWrapper","children","auth","proxy","environment","remoteApiClient","useAuth","RemoteFlowContext","__name","FormFieldsProvider","components","FormFieldsContext","RemoteFlows","theme","QueryClientProvider","ThemeProvider"]}
|
|
@@ -31,6 +31,13 @@ type StatementProps = {
|
|
|
31
31
|
severity: 'warning' | 'error' | 'success' | 'info' | 'neutral' | 'time';
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
declare const ENVIRONMENTS: {
|
|
35
|
+
partners: string;
|
|
36
|
+
production: string;
|
|
37
|
+
sandbox: string;
|
|
38
|
+
staging: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
34
41
|
type AuthResponse = {
|
|
35
42
|
accessToken: string;
|
|
36
43
|
expiresIn: number;
|
|
@@ -118,10 +125,10 @@ type RemoteFlowsSDKProps = Omit<ThemeProviderProps, 'children'> & {
|
|
|
118
125
|
*/
|
|
119
126
|
components?: Components;
|
|
120
127
|
/**
|
|
121
|
-
*
|
|
122
|
-
* If
|
|
128
|
+
* Environment to use for API calls.
|
|
129
|
+
* If not provided, the SDK will use production environment.
|
|
123
130
|
*/
|
|
124
|
-
|
|
131
|
+
environment?: keyof typeof ENVIRONMENTS;
|
|
125
132
|
proxy?: {
|
|
126
133
|
/**
|
|
127
134
|
* URL of the proxy server to use for API calls.
|
package/package.json
CHANGED