@remoteoss/remote-flows 0.17.0 → 0.18.0
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/dist/chunk-2VS6B3PC.js +2 -0
- package/dist/chunk-2VS6B3PC.js.map +1 -0
- package/dist/{chunk-AYJ63EZH.js → chunk-3AEKPMIN.js} +2 -2
- package/dist/{chunk-5GYCZAL7.js → chunk-3O2RD3RK.js} +2 -2
- package/dist/{chunk-HWNHP6LW.js → chunk-4B36XRKA.js} +2 -2
- package/dist/{chunk-CWTERQ45.js → chunk-53NFLDRX.js} +2 -2
- package/dist/{chunk-4ZOKJJZC.js → chunk-56DXHJNR.js} +2 -2
- package/dist/{chunk-AUZQY3AO.js → chunk-5BQOPJTQ.js} +2 -2
- package/dist/{chunk-O4F6PGGV.js → chunk-73H6SO2E.js} +2 -2
- package/dist/{chunk-C4RJTN2F.js → chunk-7C2Z2EE5.js} +2 -2
- package/dist/{chunk-O4OZANFQ.js → chunk-A522V6XF.js} +2 -2
- package/dist/{chunk-3JTDGPXD.js → chunk-A6EYY3FO.js} +2 -2
- package/dist/{chunk-JUGNVM2R.js → chunk-ALYKEN3E.js} +2 -2
- package/dist/{chunk-WQIPP2C3.js → chunk-BF2D5O5H.js} +2 -2
- package/dist/{chunk-DTGFQMCE.js → chunk-BFOGH4SF.js} +2 -2
- package/dist/{chunk-CNOIGOQQ.js → chunk-CEUBVUKV.js} +2 -2
- package/dist/{chunk-I52TUBVO.js → chunk-CYKK3LPJ.js} +2 -2
- package/dist/{chunk-HEKQK6TK.js → chunk-DBDVBJDV.js} +2 -2
- package/dist/{chunk-4YXQJD3M.js → chunk-JB55FFG6.js} +2 -2
- package/dist/{chunk-R6JC4SUO.js → chunk-MRMVBBVZ.js} +2 -2
- package/dist/{chunk-4WCT2ZCS.js → chunk-NGJXBBXW.js} +2 -2
- package/dist/chunk-NTEIOU72.js +2 -0
- package/dist/chunk-NTEIOU72.js.map +1 -0
- package/dist/{chunk-XCZYKOZU.js → chunk-OT2DXWYZ.js} +2 -2
- package/dist/chunk-PAQW5BFW.js +2 -0
- package/dist/chunk-PAQW5BFW.js.map +1 -0
- package/dist/{chunk-JQDP6SAT.js → chunk-PHN4XMPV.js} +2 -2
- package/dist/{chunk-LWAS3Y4S.js → chunk-QKKEFL4Z.js} +2 -2
- package/dist/{chunk-DHT7HDHC.js → chunk-QXPWESEW.js} +2 -2
- package/dist/{chunk-BPK3J436.js → chunk-RZTT3MEP.js} +2 -2
- package/dist/{chunk-Z7CHDOVN.js → chunk-TLC5WQY2.js} +2 -2
- package/dist/chunk-U4NWXPI5.js +2 -0
- package/dist/chunk-U4NWXPI5.js.map +1 -0
- package/dist/{chunk-N7DP4HY4.js → chunk-VFRHMNLJ.js} +2 -2
- package/dist/{chunk-N7DP4HY4.js.map → chunk-VFRHMNLJ.js.map} +1 -1
- package/dist/{chunk-DSTM5RRQ.js → chunk-ZOKSYPOP.js} +2 -2
- package/dist/chunk-ZSDJZMQW.js +2 -0
- package/dist/{chunk-KHNAQRGE.js.map → chunk-ZSDJZMQW.js.map} +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.js +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentForm.js +1 -1
- package/dist/flows/ContractAmendment/context.d.ts +1 -1
- package/dist/flows/ContractAmendment/hooks.js +1 -1
- package/dist/flows/ContractAmendment/index.js +1 -1
- package/dist/flows/ContractAmendment/utils.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
- package/dist/flows/CostCalculator/components/SalaryField.d.ts +1 -1
- package/dist/flows/CostCalculator/components/SalaryField.js +1 -1
- package/dist/flows/CostCalculator/context.d.ts +1 -1
- package/dist/flows/CostCalculator/hooks.js +1 -1
- package/dist/flows/CostCalculator/index.d.ts +1 -1
- package/dist/flows/CostCalculator/index.js +1 -1
- package/dist/flows/CostCalculator/jsonSchema.d.ts +8 -0
- package/dist/flows/CostCalculator/jsonSchema.js +1 -1
- package/dist/flows/CostCalculator/utils.d.ts +1 -1
- package/dist/flows/CostCalculator/utils.js +1 -1
- package/dist/flows/Onboarding/OnboardingFlow.d.ts +1 -1
- package/dist/flows/Onboarding/OnboardingFlow.js +1 -1
- package/dist/flows/Onboarding/api.d.ts +1 -1
- package/dist/flows/Onboarding/api.js +1 -1
- package/dist/flows/Onboarding/components/AnnualGrossSalary.d.ts +1 -1
- package/dist/flows/Onboarding/components/AnnualGrossSalary.js +1 -1
- package/dist/flows/Onboarding/components/BasicInformationStep.js +1 -1
- package/dist/flows/Onboarding/components/BenefitsStep.d.ts +1 -1
- package/dist/flows/Onboarding/components/BenefitsStep.js +1 -1
- package/dist/flows/Onboarding/components/ContractDetailsStep.js +1 -1
- package/dist/flows/Onboarding/components/OnboardingForm.d.ts +1 -1
- package/dist/flows/Onboarding/components/OnboardingForm.js +1 -1
- package/dist/flows/Onboarding/components/OnboardingInvite.js +1 -1
- package/dist/flows/Onboarding/components/SelectCountryStep.js +1 -1
- package/dist/flows/Onboarding/context.d.ts +1 -1
- package/dist/flows/Onboarding/hooks.d.ts +1 -1
- package/dist/flows/Onboarding/hooks.js +1 -1
- package/dist/flows/Onboarding/index.d.ts +1 -1
- package/dist/flows/Onboarding/index.js +1 -1
- package/dist/flows/Termination/AdditionalDetailsForm.js +1 -1
- package/dist/flows/Termination/EmployeeComunicationForm.js +1 -1
- package/dist/flows/Termination/PaidTimeOffForm.js +1 -1
- package/dist/flows/Termination/TerminationDetailsForm.js +1 -1
- package/dist/flows/Termination/TerminationFlow.js +1 -1
- package/dist/flows/Termination/TerminationForm.js +1 -1
- package/dist/flows/Termination/context.d.ts +1 -1
- package/dist/flows/Termination/hooks.js +1 -1
- package/dist/flows/Termination/index.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internals.js +1 -1
- package/dist/internals.js.map +1 -1
- package/dist/{remoteFlows-CBNrcwGZ.d.ts → remoteFlows-BLMhusyP.d.ts} +11 -1
- package/package.json +1 -1
- package/dist/chunk-4W2RKQYM.js +0 -2
- package/dist/chunk-4W2RKQYM.js.map +0 -1
- package/dist/chunk-KHNAQRGE.js +0 -2
- package/dist/chunk-MXFDOIUA.js +0 -2
- package/dist/chunk-MXFDOIUA.js.map +0 -1
- package/dist/chunk-O6SRXXVZ.js +0 -2
- package/dist/chunk-O6SRXXVZ.js.map +0 -1
- /package/dist/{chunk-AYJ63EZH.js.map → chunk-3AEKPMIN.js.map} +0 -0
- /package/dist/{chunk-5GYCZAL7.js.map → chunk-3O2RD3RK.js.map} +0 -0
- /package/dist/{chunk-HWNHP6LW.js.map → chunk-4B36XRKA.js.map} +0 -0
- /package/dist/{chunk-CWTERQ45.js.map → chunk-53NFLDRX.js.map} +0 -0
- /package/dist/{chunk-4ZOKJJZC.js.map → chunk-56DXHJNR.js.map} +0 -0
- /package/dist/{chunk-AUZQY3AO.js.map → chunk-5BQOPJTQ.js.map} +0 -0
- /package/dist/{chunk-O4F6PGGV.js.map → chunk-73H6SO2E.js.map} +0 -0
- /package/dist/{chunk-C4RJTN2F.js.map → chunk-7C2Z2EE5.js.map} +0 -0
- /package/dist/{chunk-O4OZANFQ.js.map → chunk-A522V6XF.js.map} +0 -0
- /package/dist/{chunk-3JTDGPXD.js.map → chunk-A6EYY3FO.js.map} +0 -0
- /package/dist/{chunk-JUGNVM2R.js.map → chunk-ALYKEN3E.js.map} +0 -0
- /package/dist/{chunk-WQIPP2C3.js.map → chunk-BF2D5O5H.js.map} +0 -0
- /package/dist/{chunk-DTGFQMCE.js.map → chunk-BFOGH4SF.js.map} +0 -0
- /package/dist/{chunk-CNOIGOQQ.js.map → chunk-CEUBVUKV.js.map} +0 -0
- /package/dist/{chunk-I52TUBVO.js.map → chunk-CYKK3LPJ.js.map} +0 -0
- /package/dist/{chunk-HEKQK6TK.js.map → chunk-DBDVBJDV.js.map} +0 -0
- /package/dist/{chunk-4YXQJD3M.js.map → chunk-JB55FFG6.js.map} +0 -0
- /package/dist/{chunk-R6JC4SUO.js.map → chunk-MRMVBBVZ.js.map} +0 -0
- /package/dist/{chunk-4WCT2ZCS.js.map → chunk-NGJXBBXW.js.map} +0 -0
- /package/dist/{chunk-XCZYKOZU.js.map → chunk-OT2DXWYZ.js.map} +0 -0
- /package/dist/{chunk-JQDP6SAT.js.map → chunk-PHN4XMPV.js.map} +0 -0
- /package/dist/{chunk-LWAS3Y4S.js.map → chunk-QKKEFL4Z.js.map} +0 -0
- /package/dist/{chunk-DHT7HDHC.js.map → chunk-QXPWESEW.js.map} +0 -0
- /package/dist/{chunk-BPK3J436.js.map → chunk-RZTT3MEP.js.map} +0 -0
- /package/dist/{chunk-Z7CHDOVN.js.map → chunk-TLC5WQY2.js.map} +0 -0
- /package/dist/{chunk-DSTM5RRQ.js.map → chunk-ZOKSYPOP.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./chunk-M22FKNEY.js";import{a as lr}from"./chunk-
|
|
1
|
+
import"./chunk-M22FKNEY.js";import{a as lr}from"./chunk-QKKEFL4Z.js";import"./chunk-53NFLDRX.js";import"./chunk-DCRLPAJL.js";import"./chunk-QQ7KPOLK.js";import"./chunk-OT2DXWYZ.js";import"./chunk-XFD3ULUF.js";import"./chunk-WWANHPT7.js";import"./chunk-HSW5HMHH.js";import"./chunk-VX2UC3HG.js";import"./chunk-XSHHMBMT.js";import"./chunk-JODJFARP.js";import"./chunk-W5DG5WWJ.js";import"./chunk-S4XU4SE7.js";import"./chunk-GULCZWSK.js";import"./chunk-A6EYY3FO.js";import"./chunk-CYKK3LPJ.js";import"./chunk-RZTT3MEP.js";import"./chunk-MRMVBBVZ.js";import"./chunk-XGEKV3FC.js";import"./chunk-MRYRNB7Y.js";import"./chunk-Z3BMF4BO.js";import{a as N}from"./chunk-MLB2I27G.js";import"./chunk-E5YN6OT3.js";import{a as D}from"./chunk-R2UI3WAJ.js";import{a as j}from"./chunk-6ZPISRAG.js";import"./chunk-4RULC3AZ.js";import"./chunk-H4KE45NG.js";import"./chunk-6NKUEDYP.js";import"./chunk-I2A4EFDY.js";import"./chunk-4R3ITKOA.js";import"./chunk-ZE3YT3Q6.js";import"./chunk-NVMZDPMF.js";import"./chunk-XJVYASHX.js";import{a as dr}from"./chunk-5BQOPJTQ.js";import"./chunk-4B36XRKA.js";import"./chunk-BF2D5O5H.js";import"./chunk-63HVO7J5.js";import"./chunk-73H6SO2E.js";import"./chunk-7JQPHRUK.js";import"./chunk-Z7WBY27D.js";import"./chunk-5KHLOGTR.js";import"./chunk-TLC5WQY2.js";import"./chunk-CEUBVUKV.js";import"./chunk-56DXHJNR.js";import"./chunk-ZOKSYPOP.js";import"./chunk-VAIBLWOY.js";import"./chunk-7C2Z2EE5.js";import"./chunk-F66G33YT.js";import"./chunk-PGWKJ6FK.js";import{a as _}from"./chunk-NGJXBBXW.js";import{b as F,d as T}from"./chunk-NTEIOU72.js";import"./chunk-ALYKEN3E.js";import{a as z}from"./chunk-NBCZF2FO.js";import"./chunk-VFRHMNLJ.js";import"./chunk-PHN4XMPV.js";import"./chunk-BFOGH4SF.js";import"./chunk-WVJDCDGZ.js";import{a as B}from"./chunk-3O2RD3RK.js";import{a as S}from"./chunk-OZ63OC3N.js";import{a as E}from"./chunk-A4KEKMEQ.js";import{d as R}from"./chunk-V2YORDAL.js";import"./chunk-HN5HLFTB.js";import"./chunk-KSHK3ZPX.js";import"./chunk-A7ZJQCNU.js";import{a as A}from"./chunk-HQI6W7PR.js";import{a as I}from"./chunk-DYB3RWP7.js";import"./chunk-CRXPRR3R.js";import"./chunk-UHS3QRA3.js";import"./chunk-N5I33LIN.js";import"./chunk-LBUNJ5J3.js";import"./chunk-ANXYPRBG.js";import"./chunk-Z5WMKCRJ.js";import{a as sr}from"./chunk-JB55FFG6.js";import{a as er}from"./chunk-A522V6XF.js";import"./chunk-CFIJKJXD.js";import"./chunk-2VS6B3PC.js";import"./chunk-U4NWXPI5.js";import"./chunk-ZTDKPUB5.js";import{a as or}from"./chunk-ITSQE6EW.js";import{a as cr}from"./chunk-QXPWESEW.js";import{a as ir,b as nr}from"./chunk-GGBEM452.js";import"./chunk-QW4JPW6J.js";import"./chunk-3AEKPMIN.js";import"./chunk-ZSDJZMQW.js";import"./chunk-GP237GUO.js";import"./chunk-TXSJL3HC.js";import{a as v}from"./chunk-EGQJ7UBR.js";import"./chunk-PJBAQZ6G.js";import"./chunk-7P5B6XHM.js";import{a as u,c as h}from"./chunk-3ZWDIEEM.js";import"./chunk-7VUILYZ3.js";import{a as tr}from"./chunk-DBDVBJDV.js";import"./chunk-3BREUYLG.js";import{b as C}from"./chunk-PAQW5BFW.js";import"./chunk-BI6U55BD.js";import"./chunk-TVZAFTPT.js";import{c as P,d as m}from"./chunk-3LOVCTCN.js";import{a as t}from"./chunk-P37U34EQ.js";import{QueryClient as $,QueryClientProvider as G}from"@tanstack/react-query";function d(r){let a=document.documentElement;Object.keys(r).forEach(e=>{let o=r[e];o&&a.style.setProperty(e,o)})}t(d,"setCssProperties");function O(r){let a={};return Object.keys(r).forEach(e=>{a[`--${e}`]=r[e]}),a}t(O,"mapThemeColors");function K(r){return{"--spacing":r}}t(K,"mapThemeSpacing");function V(r){return{"--radius":r}}t(V,"mapThemeBorderRadius");function U(r){return{"--fontSizeBase":r.fontSizeBase}}t(U,"mapThemeFont");function w(r){r?.colors&&d(O(r.colors)),r?.spacing&&d(K(r.spacing)),r?.borderRadius&&d(V(r.borderRadius)),r?.font&&d(U(r.font))}t(w,"applyTheme");import{createContext as W,useEffect as M,useMemo as L}from"react";import{jsx as Q}from"react/jsx-runtime";var q=W({theme:{}});function f(r){M(()=>{r.theme&&Object.keys(r.theme).length>0&&w(r.theme)},[r.theme]);let a=L(()=>({theme:r.theme}),[r.theme]);return Q(q.Provider,{value:a,children:r.children})}t(f,"ThemeProvider");var x={local:"http://localhost:4000/api/eor",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 X}from"@hey-api/client-fetch";import{useQuery as Y}from"@tanstack/react-query";import{useRef as b}from"react";function Z(r){try{return new URL(r),!0}catch{return!1}}t(Z,"isValidUrl");var y=t(({auth:r,options:a,authId:e="default"})=>{let o=b(null),{refetch:c}=Y({queryKey:["auth",e],queryFn:r,enabled:!1}),s=a?.environment?x[a?.environment]:"https://gateway.remote.com",l=v.getConfig(),g="0.18.0";a?.environment&&a?.environment!=="production"&&m(g);let p=!!a?.proxy&&Z(a.proxy.url);return a?.proxy&&!p&&console.error("Invalid proxy URL provided. Using default base URL."),b(X({...l,headers:{...l.headers,...p?a?.proxy?.headers:{},"X-Client-Name":"remote-flows-sdk","X-Client-Version":g},baseUrl:p?a.proxy?.url:s,auth:t(async()=>{function k(i){return!i||Date.now()+6e4>i}if(t(k,"hasTokenExpired"),!o.current||k(o.current.expiresAt)){let{data:i}=await c();i&&(o.current={accessToken:i.accessToken,expiresAt:Date.now()+i.expiresIn*1e3})}return o.current?.accessToken},"auth")}))},"useAuth");import{jsx as n}from"react/jsx-runtime";var H=new $;function J({children:r,auth:a,authId:e,proxy:o,environment:c}){let s=y({auth:a,authId:e,options:{proxy:o,environment:c}});return n(h.Provider,{value:{client:s.current},children:r})}t(J,"RemoteFlowContextWrapper");function rr({children:r,components:a}){return n(u.Provider,{value:a?{components:a}:{components:{}},children:r})}t(rr,"FormFieldsProvider");function ar({auth:r,authId:a,children:e,components:o,theme:c,proxy:s,environment:l}){return n(G,{client:H,children:n(rr,{components:o,children:n(J,{auth:r,authId:a,proxy:s,environment:l,children:n(f,{theme:c,children:e})})})})}t(ar,"RemoteFlows");export{tr as ContractAmendmentConfirmationForm,sr as ContractAmendmentFlow,er as ContractAmendmentForm,or as ContractAmendmentSubmit,A as CostCalculatorDisclaimer,_ as CostCalculatorFlow,B as CostCalculatorForm,S as CostCalculatorResetButton,N as CostCalculatorResults,E as CostCalculatorSubmitButton,j as EstimationResults,dr as OnboardingFlow,ar as RemoteFlows,D as SummaryResults,lr as TerminationFlow,F as buildCostCalculatorEstimationPayload,C as convertFromCents,I as disclaimerData,P as transformYupErrorsIntoObject,cr as useContractAmendment,T as useCostCalculator,R as useCostCalculatorEstimationPdf,ir as useEmploymentQuery,nr as useTimeOffQuery,z as zendeskArticles};
|
|
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 environment?: RemoteFlowsSDKProps['environment'];\n proxy?: RemoteFlowsSDKProps['proxy'];\n authId?: RemoteFlowsSDKProps['authId'];\n};\n\nfunction RemoteFlowContextWrapper({\n children,\n auth,\n authId,\n proxy,\n environment,\n}: RemoteFlowContextWrapperProps) {\n const remoteApiClient = useAuth({\n auth,\n authId,\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 authId,\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 authId={authId}\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 local: 'http://localhost:4000/api/eor',\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';\nimport { debug } from './lib/utils';\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 authId = 'default',\n}: {\n auth: () => Promise<AuthResponse>;\n options?: Options;\n authId?: 'default' | 'client';\n}) => {\n const session = useRef<{ accessToken: string; expiresAt: number } | null>(\n null,\n );\n const { refetch } = useQuery({\n queryKey: ['auth', authId],\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 || 'unknown';\n\n if (options?.environment && options?.environment !== 'production') {\n debug(npmPackageVersion);\n }\n\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":"ygGAAA,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,EAAAS,EAAA,gBAMF,SAASE,EAAWC,EAA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,OAAQF,EAAgB,OAAQ,EAClE,SAAAL,EACH,CAEJ,CApBSQ,EAAAT,EAAA,4BAsBF,SAASU,GAAmB,CACjC,SAAAT,EACA,WAAAU,CACF,EAEI,CACF,OACEd,EAACe,EAAkB,SAAlB,CACC,MAAOD,EAAa,CAAE,WAAAA,CAAW,EAAI,CAAE,WAAY,CAAC,CAAE,EAErD,SAAAV,EACH,CAEJ,CAbgBQ,EAAAC,GAAA,sBAeT,SAASG,GAAY,CAC1B,KAAAX,EACA,OAAAC,EACA,SAAAF,EACA,WAAAU,EACA,MAAAG,EACA,MAAAV,EACA,YAAAC,CACF,EAA2C,CACzC,OACER,EAACkB,EAAA,CAAoB,OAAQjB,EAC3B,SAAAD,EAACa,GAAA,CAAmB,WAAYC,EAC9B,SAAAd,EAACG,EAAA,CACC,KAAME,EACN,OAAQC,EACR,MAAOC,EACP,YAAaC,EAEb,SAAAR,EAACmB,EAAA,CAAc,MAAOF,EAAQ,SAAAb,EAAS,EACzC,EACF,EACF,CAEJ,CAvBgBQ,EAAAI,GAAA","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","authId","session","useRef","refetch","useQuery","baseUrl","ENVIRONMENTS","clientConfig","client","npmPackageVersion","debug","isValidProxy","createClient","hasTokenExpired","expiresAt","data","jsx","queryClient","QueryClient","RemoteFlowContextWrapper","children","auth","authId","proxy","environment","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 authId?: RemoteFlowsSDKProps['authId'];\n};\n\nfunction RemoteFlowContextWrapper({\n children,\n auth,\n authId,\n proxy,\n environment,\n}: RemoteFlowContextWrapperProps) {\n const remoteApiClient = useAuth({\n auth,\n authId,\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 authId,\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 authId={authId}\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 local: 'http://localhost:4000/api/eor',\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';\nimport { debug } from './lib/utils';\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 authId = 'default',\n}: {\n auth: () => Promise<AuthResponse>;\n options?: Options;\n authId?: 'default' | 'client';\n}) => {\n const session = useRef<{ accessToken: string; expiresAt: number } | null>(\n null,\n );\n const { refetch } = useQuery({\n queryKey: ['auth', authId],\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 || 'unknown';\n\n if (options?.environment && options?.environment !== 'production') {\n debug(npmPackageVersion);\n }\n\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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YC,EAC9B,SAAAd,EAACG,EAAA,CACC,KAAME,EACN,OAAQC,EACR,MAAOC,EACP,YAAaC,EAEb,SAAAR,EAACmB,EAAA,CAAc,MAAOF,EAAQ,SAAAb,EAAS,EACzC,EACF,EACF,CAEJ,CAvBgBQ,EAAAI,GAAA","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","authId","session","useRef","refetch","useQuery","baseUrl","ENVIRONMENTS","clientConfig","client","npmPackageVersion","debug","isValidProxy","createClient","hasTokenExpired","expiresAt","data","jsx","queryClient","QueryClient","RemoteFlowContextWrapper","children","auth","authId","proxy","environment","remoteApiClient","useAuth","RemoteFlowContext","__name","FormFieldsProvider","components","FormFieldsContext","RemoteFlows","theme","QueryClientProvider","ThemeProvider"]}
|
package/dist/internals.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as y,b as z,c as E,d as J}from"./chunk-CRXPRR3R.js";import{a as G,b as L,c as h,d as k,e as j,f as q}from"./chunk-UHS3QRA3.js";import{a as O}from"./chunk-N5I33LIN.js";import{a as F}from"./chunk-LBUNJ5J3.js";import{a as l,b as i,d as a,e as p,f as n}from"./chunk-ANXYPRBG.js";import{a as C,b as g,c as b,d as x,
|
|
1
|
+
import{a as y,b as z,c as E,d as J}from"./chunk-CRXPRR3R.js";import{a as G,b as L,c as h,d as k,e as j,f as q}from"./chunk-UHS3QRA3.js";import{a as O}from"./chunk-N5I33LIN.js";import{a as F}from"./chunk-LBUNJ5J3.js";import{a as l,b as i,d as a,e as p,f as n}from"./chunk-ANXYPRBG.js";import{a as C,b as g,c as b,d as x,f,g as D,h as T,i as c,j as S,k as w,l as v,m as A,n as P,o as H,p as I,q as R,r as V,s as B}from"./chunk-ZSDJZMQW.js";import{a as d,b as u}from"./chunk-GP237GUO.js";import{a as t}from"./chunk-TXSJL3HC.js";import"./chunk-EGQJ7UBR.js";import"./chunk-3ZWDIEEM.js";import{a as s,b as m}from"./chunk-7VUILYZ3.js";import{a as o}from"./chunk-BI6U55BD.js";import{a as r}from"./chunk-3LOVCTCN.js";import"./chunk-P37U34EQ.js";import*as e from"@radix-ui/react-collapsible";var K=e.Root,M=e.CollapsibleTrigger,N=e.CollapsibleContent;export{R as Alert,B as AlertDescription,V as AlertTitle,u as Badge,m as Button,G as Card,j as CardContent,k as CardDescription,q as CardFooter,L as CardHeader,h as CardTitle,C as Checkbox,K as Collapsible,N as CollapsibleContent,M as CollapsibleTrigger,S as Dialog,v as DialogContent,I as DialogDescription,P as DialogFooter,A as DialogHeader,H as DialogTitle,w as DialogTrigger,l as Drawer,a as DrawerContent,p as DrawerHeader,n as DrawerTitle,i as DrawerTrigger,t as Input,o as Label,g as RadioGroup,b as RadioGroupItem,F as ScrollArea,x as Select,T as SelectContent,c as SelectItem,D as SelectTrigger,f as SelectValue,y as Tabs,J as TabsContent,z as TabsList,E as TabsTrigger,O as ZendeskTriggerButton,d as badgeVariants,s as buttonVariants,r as cn};
|
|
2
2
|
//# sourceMappingURL=internals.js.map
|
package/dist/internals.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ui/collapsible.tsx"],"sourcesContent":["import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';\n\nconst Collapsible = CollapsiblePrimitive.Root;\n\nconst CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;\n\nconst CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent };\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/ui/collapsible.tsx"],"sourcesContent":["import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';\n\nconst Collapsible = CollapsiblePrimitive.Root;\n\nconst CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;\n\nconst CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent };\n"],"mappings":"guBAAA,UAAYA,MAA0B,8BAEtC,IAAMC,EAAmC,OAEnCC,EAA0C,qBAE1CC,EAA0C","names":["CollapsiblePrimitive","Collapsible","CollapsibleTrigger","CollapsibleContent"]}
|
|
@@ -129,11 +129,21 @@ type ZendeskDrawerComponentProps = {
|
|
|
129
129
|
type StatementComponentProps = {
|
|
130
130
|
data: StatementProps;
|
|
131
131
|
};
|
|
132
|
+
type FieldSetToggleComponentProps = {
|
|
133
|
+
isExpanded: boolean;
|
|
134
|
+
onToggle: () => void;
|
|
135
|
+
'aria-expanded': boolean;
|
|
136
|
+
'aria-controls': string;
|
|
137
|
+
'aria-label': string;
|
|
138
|
+
className?: string;
|
|
139
|
+
children?: React.ReactNode;
|
|
140
|
+
};
|
|
132
141
|
type Components = {
|
|
133
142
|
[K in SupportedTypes]?: React.ComponentType<FieldComponentProps>;
|
|
134
143
|
} & {
|
|
135
144
|
statement?: React.ComponentType<StatementComponentProps>;
|
|
136
145
|
button?: React.ComponentType<ButtonComponentProps>;
|
|
146
|
+
fieldsetToggle?: React.ComponentType<FieldSetToggleComponentProps>;
|
|
137
147
|
zendeskDrawer?: React.ComponentType<ZendeskDrawerComponentProps>;
|
|
138
148
|
};
|
|
139
149
|
type RemoteFlowsSDKProps = Omit<ThemeProviderProps, 'children'> & {
|
|
@@ -179,4 +189,4 @@ declare global {
|
|
|
179
189
|
}
|
|
180
190
|
}
|
|
181
191
|
|
|
182
|
-
export type { $TSFixMe as $, ButtonComponentProps as B, Components as C, FieldComponentProps as F, JSFFieldset as J, RemoteFlowsSDKProps as R, StatementComponentProps as S, ZendeskDrawerComponentProps as Z, JSFField as a };
|
|
192
|
+
export type { $TSFixMe as $, ButtonComponentProps as B, Components as C, FieldComponentProps as F, JSFFieldset as J, RemoteFlowsSDKProps as R, StatementComponentProps as S, ZendeskDrawerComponentProps as Z, JSFField as a, FieldSetToggleComponentProps as b };
|
package/package.json
CHANGED
package/dist/chunk-4W2RKQYM.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as H}from"./chunk-ZTDKPUB5.js";import{a as ge,b as Be,c as Ae,d as Ve,e as Ue,f as Je,g as ze,h as Ge,i as qe,j as Ke,k as Ye,l as je,m as he,n as Qe,o as _e,p as ve,r as Ce}from"./chunk-KHNAQRGE.js";import{b as Xe}from"./chunk-GP237GUO.js";import{b as S}from"./chunk-3ZWDIEEM.js";import{a as ye,b as L}from"./chunk-7VUILYZ3.js";import{a as ee,b as te,c as v,d as $e,e as We,f as Ee,g as Oe,h as b,i as N,j as k,k as w,l as P,m as R}from"./chunk-3BREUYLG.js";import{e as Le,g as He}from"./chunk-MXFDOIUA.js";import{a as _,e as oe}from"./chunk-3LOVCTCN.js";import{a}from"./chunk-P37U34EQ.js";import{Fragment as ko}from"react";import{Fragment as Wt,jsx as O,jsxs as re}from"react/jsx-runtime";function ne({name:e,defaultValue:t,description:n,label:o,onChange:i,multiple:r,options:c,component:f,...g}){let{components:m}=S(),{control:s}=v(),u=a((d,l,y)=>{let F=y.value?[...y.value]:[];l?F.includes(d)||y.onChange([...F,d]):y.onChange(F.filter(p=>p!==d))},"handleCheckboxChange");return O(b,{control:s,name:e,defaultValue:t,render:({field:d,fieldState:l})=>{let y=f||m?.checkbox;if(y){let F={name:e,description:n,label:o,defaultValue:t,multiple:r,options:c,...g};return O(y,{field:{...d,onChange:a(p=>{if(r){let{checked:C,value:x}=p.target;u(x,C,d),i?.(C);return}d.onChange(p),i?.(p)},"onChange")},fieldState:l,fieldData:F})}return re(N,{"data-field":e,className:_(`RemoteFlows__CheckBoxField__Item__${e}`),children:[O(w,{children:re(Wt,{children:[c&&r?O(k,{children:o}):null,c&&r?c.map(F=>re("div",{className:"flex space-x-2",children:[O(ge,{id:F.value,onCheckedChange:p=>{u(F.value,p===!0,d),i?.(p,F.value)},checked:d.value?.includes(F.value),className:"RemoteFlows__CheckBox__Input"}),O(k,{htmlFor:F.value,className:"mb-0 RemoteFlows__CheckBox__Label",children:F.label})]},F.value)):re("div",{className:"flex space-x-2",children:[O(ge,{id:e,onCheckedChange:F=>{d.onChange(F),i?.(F)},checked:d.value,className:"RemoteFlows__CheckBox__Input"}),O(k,{htmlFor:e,className:"mb-0 RemoteFlows__CheckBox__Label",children:o})]})]})}),n&&O(P,{children:n}),l.error&&O(R,{})]})}})}a(ne,"CheckBoxField");import{CalendarIcon as Ot}from"lucide-react";import{PopoverClose as Bt}from"@radix-ui/react-popover";import{ChevronLeft as Et,ChevronRight as Lt}from"lucide-react";import{DayPicker as Ht}from"react-day-picker";import{jsx as xe}from"react/jsx-runtime";function Ze({className:e,classNames:t,showOutsideDays:n=!0,...o}){return xe(Ht,{showOutsideDays:n,className:_("p-3",e),classNames:{months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",nav_button:_(ye({variant:"outline"}),"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:_("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",o.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:_(ye({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:a(({className:i,...r})=>xe(Et,{className:_("size-4",i),...r}),"IconLeft"),IconRight:a(({className:i,...r})=>xe(Lt,{className:_("size-4",i),...r}),"IconRight")},...o})}a(Ze,"Calendar");import*as B from"@radix-ui/react-popover";import{jsx as ae}from"react/jsx-runtime";function se({...e}){return ae(B.Root,{"data-slot":"popover",...e})}a(se,"Popover");function ie({...e}){return ae(B.Trigger,{"data-slot":"popover-trigger",...e})}a(ie,"PopoverTrigger");function le({className:e,align:t="center",sideOffset:n=4,...o}){return ae(B.Portal,{children:ae(B.Content,{"data-slot":"popover-content",align:t,sideOffset:n,className:_("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...o})})}a(le,"PopoverContent");import{format as et}from"date-fns";import{Fragment as At,jsx as I,jsxs as Se}from"react/jsx-runtime";function tt({description:e,label:t,name:n,minDate:o,onChange:i,component:r,...c}){let{components:f}=S(),{control:g}=v(),m;return c.meta?.mot&&typeof c.meta.mot=="number"?m=He(c.meta.mot):o&&(m=new Date(o)),I(b,{control:g,name:n,render:({field:s,fieldState:u})=>{let d=r||f?.date;if(d){let l={description:e,label:t,name:n,onChange:i,...m&&{minDate:m.toISOString()},...c};return I(d,{field:{...s,onChange:a(y=>{s.onChange(y),i?.(y)},"onChange")},fieldState:u,fieldData:l})}return Se(N,{"data-field":n,className:`flex flex-col RemoteFlows__DatePickerField__Item__${n}`,children:[I(k,{className:"RemoteFlows__DatePickerField__Label",children:t}),Se(se,{children:[I(ie,{asChild:!0,children:I(w,{children:I("div",{children:Se(L,{type:"button",variant:"outline",className:_("w-full pl-3 text-left font-normal",!s.value&&"text-muted-foreground"),"data-testid":`date-picker-button-${n}`,children:[s.value&&I(At,{children:et(s.value,"yyyy-MM-dd")}),I(Ot,{className:"ml-auto h-4 w-4 opacity-50"})]})})})}),I(le,{className:"w-auto p-0 RemoteFlows__DatepickerField__PopoverContent",align:"start",children:I(Ze,{mode:"single",className:"RemoteFlows__DatepickerField__Calendar",selected:s.value?new Date(s.value):void 0,onSelect:l=>{s.onChange(l?et(l,"yyyy-MM-dd"):null),i?.(l)},defaultMonth:m,components:{DayContent:a(l=>I(Bt,{children:l.date.getDate()}),"DayContent")},...m&&{disabled:a(l=>l<m,"disabled")}})})]}),e?I(P,{children:e}):null,u.error&&I(R,{className:"RemoteFlows__DatePickerField__Error"})]})}})}a(tt,"DatePickerField");import{AlertCircle as Vt}from"lucide-react";import{jsx as me,jsxs as Ut}from"react/jsx-runtime";function ce({title:e,description:t,severity:n}){let{components:o}=S();if(o?.statement){let i=o?.statement;return me(i,{data:{title:e,description:t,severity:n}})}return Ut(Be,{variant:"warning",children:[me(Vt,{className:"h-4 w-4"}),e&&me(Ae,{children:e}),me(Ve,{children:t})]})}a(ce,"Statement");import{Fragment as Jt,useEffect as zt,useRef as ot}from"react";import{jsx as J,jsxs as be}from"react/jsx-runtime";function ke({label:e,name:t,fields:n,description:o,components:i,statement:r,isFlatFieldset:c,extra:f,variant:g="outset"}){let{watch:m,trigger:s,formState:u}=v(),d=n.map(({name:p})=>`${t}.${p}`),l=m(d),y=ot(l),F=ot(null);return zt(()=>{let p=l,C=y.current,x=u.isSubmitted||u.submitCount>0,D=!1;for(let U=0;U<p.length;U++)if(p[U]!==void 0&&C[U]!==p[U]){D=!0;break}return D&&x&&(F.current&&clearTimeout(F.current),F.current=setTimeout(()=>{s()},50)),y.current=[...p],()=>{F.current&&clearTimeout(F.current)}},[l,s,u.isSubmitted,u.submitCount]),be("fieldset",{className:_("border-1 border-input p-4 rounded-xl","RemoteFlows__FieldSetField",`RemoteFlows__FieldSetField__${t}`),children:[J("legend",{className:_("text-sm font-semibold px-2",g==="inset"&&"hidden"),children:e}),g==="inset"&&J("div",{className:"RemoteFlows__FieldSetField__Header",children:J("h3",{className:_("RemoteFlows__FieldSetField__Title"),children:e})}),o?J("div",{className:"mb-5 RemoteFlows__FieldSetField__Description",dangerouslySetInnerHTML:{__html:o}}):null,be("div",{className:"grid gap-4",children:[n.map(p=>{p.calculateDynamicProperties&&(p={...p,...p.calculateDynamicProperties(l,p)||{}});let C=Y[p.type];if(p.isVisible===!1||p.deprecated)return null;if(p.Component){let{Component:x}=p;return J(x,{...p},p.name)}return p.type==="select"&&p.multiple&&(C=Y["multi-select"]),be(Jt,{children:[J(C,{...p,name:`${c?p.name:`${t}.${p.name}`}`,component:i?.[p.type]}),p.extra?p.extra:null]},`${c?p.name:`${t}.${p.name}`}`)}),f||null,r?J(ce,{...r}):null]})]})}a(ke,"FieldSetField");import{useState as Gt,useRef as qt}from"react";import{Upload as Kt,X as Yt}from"lucide-react";import{jsx as A,jsxs as Ne}from"react/jsx-runtime";function rt({onChange:e,className:t,multiple:n}){let[o,i]=Gt([]),r=qt(null),c=a(m=>{m.preventDefault(),r.current?.click()},"handleClick"),f=a(m=>{if(m.target.files&&m.target.files.length>0){let s=Array.from(m.target.files);i(s),e(m)}},"handleChange"),g=a(m=>{i(s=>s.filter(u=>u!==m))},"onRemoveFile");return Ne("div",{className:_("flex flex-col items-start gap-4",t),children:[A("input",{type:"file",ref:r,onChange:f,className:"hidden","aria-label":"File upload",multiple:n}),Ne(L,{type:"button",onClick:c,className:"gap-2",children:[A(Kt,{className:"h-4 w-4"}),"Choose File"]}),o.length===0&&A("div",{className:"text-sm",children:n?A("span",{className:"font-medium",children:"No files selected. You can select multiple files"}):A("span",{className:"font-medium",children:"No file selected."})}),o.length>0&&o.map((m,s)=>Ne("div",{className:"text-sm flex items-center gap-2",children:["Selected file: ",A("span",{className:"font-medium",children:m.name})," (",Math.round(m.size/1024)," KB)",A(L,{variant:"ghost",onClick:()=>g(m),children:A(Yt,{})})]},s))]})}a(rt,"FileUploader");import{jsx as V,jsxs as Xt}from"react/jsx-runtime";var jt=a(e=>new Promise((t,n)=>{let o=new FileReader;o.readAsDataURL(e),o.onload=()=>t(o.result),o.onerror=i=>n(i)}),"toBase64"),nt=a(async e=>{let t=e.target.files?Array.from(e.target.files):[];return await Promise.all(t.map(async o=>{let i=await jt(o);return{name:o.name,content:i.split(",")[1]}}))},"convertFilesToBase64");function at({name:e,description:t,label:n,multiple:o,onChange:i,component:r,...c}){let{components:f}=S(),{control:g}=v();return V(b,{control:g,name:e,render:({field:m,fieldState:s})=>{let u=r||f?.file;if(u){let d={name:e,description:t,label:n,multiple:o,...c};return V(u,{field:{...m,value:null,onChange:a(async l=>{let y=await nt(l);m.onChange(y),i?.(y)},"onChange")},fieldState:s,fieldData:d})}return Xt(N,{"data-field":e,className:`RemoteFlows__FileUpload__Item__${e}`,children:[V(k,{className:"RemoteFlows__FileUpload__Label",children:n}),V(w,{children:V(rt,{onChange:async d=>{let l=await nt(d);m.onChange(l),i?.(l)},multiple:o,className:_("RemoteFlows__FileUpload__Input")})}),t&&V("div",{className:"flex items-center justify-between",children:V(P,{className:"RemoteFlows__FileUpload__Description",children:t})}),s.error&&V(R,{className:"RemoteFlows__FileUpload__Error"})]})}})}a(at,"FileUploadField");import{jsx as we}from"react/jsx-runtime";function de(e){let{components:t}=S(),{control:n}=v(),o=e.component||t?.number;return o?we(b,{control:n,name:e.name,render:({field:i,fieldState:r})=>we(o,{field:{...i,onChange:a(c=>{i.onChange(c),e.onChange?.(c)},"onChange")},fieldState:r,fieldData:e})}):we(H,{...e,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$"})}a(de,"NumberField");import{Fragment as Qt}from"react";import{jsx as $,jsxs as Pe}from"react/jsx-runtime";function st({name:e,defaultValue:t,description:n,label:o,options:i,onChange:r,component:c,...f}){let{components:g}=S(),{control:m}=v();return $(b,{control:m,name:e,defaultValue:t,render:({field:s,fieldState:u})=>{let d=c||g?.radio;if(d){let l={name:e,defaultValue:t,description:n,label:o,options:i,...f};return $(d,{field:{...s,onChange:a(y=>{s.onChange(y),r?.(y)},"onChange")},fieldState:u,fieldData:l})}return Pe(N,{className:_("space-y-3",`RemoteFlows__RadioGroupField__Item__${e}`),"data-field":e,children:[$(k,{children:o}),$(w,{children:$(Ue,{"aria-label":o||e,onValueChange:l=>{s.onChange(l),r?.(l)},value:s.value,className:"flex flex-col space-y-3",children:i?.map(l=>$(Qt,{children:Pe(N,{"data-field":e,className:"flex items-start space-x-3 space-y-0 gap-0 RemoteFlows__RadioField__Item",children:[$(w,{children:$(Je,{value:l.value,className:"RemoteFlows__RadioField__Input",disabled:l.disabled})}),Pe("div",{children:[$(k,{className:"font-normal mb-0 RemoteFlows__RadioField__Label",children:l.label}),l.description&&$(P,{className:"mt-2",children:l.description})]})]})},l.value))})}),n&&$(P,{children:n}),u.error&&$(R,{})]})}})}a(st,"RadioGroupField");import{jsx as M,jsxs as it}from"react/jsx-runtime";function lt({label:e,name:t,options:n,defaultValue:o,description:i,onChange:r,component:c,...f}){let{control:g}=v(),{components:m}=S();return M(b,{defaultValue:o,control:g,name:t,render:({field:s,fieldState:u})=>{let d=c||m?.select;if(d){let l={label:e,name:t,options:n,defaultValue:o,description:i,onChange:r,...f};return M(d,{field:{...s,onChange:a(y=>{let F=f.jsonType==="number"?Number(y):y;s.onChange(F),r?.(F)},"onChange")},fieldState:u,fieldData:l})}return it(N,{"data-field":t,className:`RemoteFlows__SelectField__Item__${t}`,children:[M(k,{className:"RemoteFlows__SelectField__Label",children:e}),M(w,{children:M("div",{className:"relative",children:it(ze,{value:s.value||"",onValueChange:l=>{let y=f.jsonType==="number"?Number(l):l;s.onChange(y),r?.(y)},children:[M(Ke,{className:"RemoteFlows__SelectField__Trigger","aria-invalid":!!u.error,"aria-label":e,children:M("span",{className:"absolute",children:M(qe,{placeholder:e})})}),M(Ye,{className:"RemoteFlows__SelectField__Content",children:M(Ge,{className:"RemoteFlows__SelectField__Group",children:n.map(l=>M(je,{value:l.value,className:"RemoteFlows__SelectField__SelectItem",children:l.label},l.value))})})]})})}),i&&M(P,{children:i}),u.error&&M(R,{})]})}})}a(lt,"SelectField");import{useState as no}from"react";import{Fragment as Zt,useState as eo}from"react";import{Check as to,ChevronDownIcon as oo,X as ro}from"lucide-react";import{Command as j}from"cmdk";import{SearchIcon as Fn}from"lucide-react";import{jsx as X,jsxs as hn}from"react/jsx-runtime";function mt({className:e,...t}){return X(j,{"data-slot":"command",className:_("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}a(mt,"Command");function ct({className:e,...t}){return X(j.List,{"data-slot":"command-list",className:_("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}a(ct,"CommandList");function dt({...e}){return X(j.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}a(dt,"CommandEmpty");function pt({className:e,...t}){return X(j.Group,{"data-slot":"command-group",className:_("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}a(pt,"CommandGroup");function ut({className:e,...t}){return X(j.Separator,{"data-slot":"command-separator",className:_("bg-border -mx-1 h-px",e),...t})}a(ut,"CommandSeparator");function Ft({className:e,...t}){return X(j.Item,{"data-slot":"command-item",className:_("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}a(Ft,"CommandItem");import{jsx as W,jsxs as Q}from"react/jsx-runtime";function pe({options:e,selected:t,onChange:n,placeholder:o,...i}){let[r,c]=eo(!1),f=a(s=>{n(t.filter(u=>u.value!==s.value))},"handleUnselect"),g=e.some(s=>s.category),m=e.reduce((s,u)=>{let d=u.category||"Uncategorized";return s[d]||(s[d]=[]),s[d].push(u),s},{});return Q(se,{open:r,onOpenChange:c,...i,children:[W(ie,{children:Q(L,{variant:"outline",role:"combobox","aria-expanded":r,className:"w-full justify-between font-normal",type:"button",children:[W("div",{className:"flex gap-1 flex-wrap overflow-x-auto max-h-[2.5rem] items-center",children:t.length>0?t.map(s=>Q(Xe,{variant:"secondary",className:"mr-1 mb-1",children:[s.label,W("div",{role:"button",tabIndex:0,"aria-label":`remove ${s.label}`,className:"ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer",onKeyDown:u=>{u.key==="Enter"&&f(s)},onMouseDown:u=>{u.preventDefault(),u.stopPropagation()},onClick:()=>f(s),children:W(ro,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},s.label)):W("span",{className:"text-foreground",children:o})}),W(oo,{className:"size-4"})]})}),W(le,{align:"start",className:"w-full p-0",children:W(mt,{children:Q(ct,{children:[W(dt,{children:"No item found."}),Object.entries(m).map(([s,u],d)=>Q(Zt,{children:[d>0&&W(ut,{}),W(pt,{heading:g?s:void 0,children:u.map(l=>{let y=t.some(F=>F.value===l.value);return Q(Ft,{onSelect:()=>{n(y?t.filter(F=>F.value!==l.value):[...t,l])},children:[W(to,{className:_("mr-2 h-4 w-4",y?"opacity-100":"opacity-0")}),l.label]},l.label)})})]},s))]})})})]})}a(pe,"MultiSelect");import{jsx as z,jsxs as ao}from"react/jsx-runtime";function ft({label:e,name:t,options:n,defaultValue:o,description:i,onChange:r,$meta:c,component:f,...g}){let{control:m}=v(),{components:s}=S(),[u,d]=no([]);return z(b,{defaultValue:o,control:m,name:t,render:({field:l,fieldState:y})=>{let F=f||s?.countries;if(F){let x={label:e,name:t,options:n,defaultValue:o,description:i,onChange:r,$meta:c,...g};return z(F,{field:{...l,onChange:a(D=>{l.onChange(D),r?.(D)},"onChange")},fieldState:y,fieldData:x})}let p=[...Object.entries(c?.regions||{}).map(([x,D])=>({value:D,label:x,category:"Regions"})),...Object.entries(c?.subregions||{}).map(([x,D])=>({value:D,label:x,category:"Subregions"})),...n.map(x=>({...x,value:x.value,label:x.label,category:"Countries"}))],C=a(x=>{let D=x.map(({value:U})=>U);l.onChange(D),r?.(D),d(x)},"handleChange");return ao(N,{"data-field":t,className:`RemoteFlows__CountryField__Item__${t}`,children:[z(k,{className:"RemoteFlows__CountryField__Label",children:e}),z(w,{children:z(pe,{options:p,selected:u,onChange:C,...g})}),i&&z(P,{children:i}),y.error&&z(R,{})]})}})}a(ft,"CountryField");import*as gt from"react";import{jsx as so}from"react/jsx-runtime";var Re=gt.forwardRef(({className:e,...t},n)=>so("textarea",{className:_("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));Re.displayName="Textarea";import{jsx as G,jsxs as De}from"react/jsx-runtime";function yt({name:e,description:t,label:n,onChange:o,maxLength:i,component:r,...c}){let{components:f}=S(),{control:g}=v();return G(b,{control:g,name:e,render:({field:m,fieldState:s})=>{let u=r||f?.textarea;if(u){let l={name:e,description:t,label:n,maxLength:i,...c};return G(u,{field:{...m,onChange:a(y=>{m.onChange(y),o?.(y)},"onChange")},fieldState:s,fieldData:l})}let d=m.value?.length??0;return De(N,{"data-field":e,className:`RemoteFlows__TextArea__Item__${e}`,children:[G(k,{className:"RemoteFlows__TextArea__Label",children:n}),G(w,{children:G(Re,{...m,value:m.value??"",onChange:l=>{m.onChange(l),o?.(l)},className:_(s.error&&"border-red-500 focus-visible:ring-red-500","RemoteFlows__TextArea__Input"),placeholder:n})}),(t||i)&&De("div",{className:"flex items-center justify-between",children:[t&&G(P,{className:"RemoteFlows__TextArea__Description",children:t}),i&&De("span",{className:"text-sm ml-auto RemoteFlows__TextArea__MaxLength",children:[d,"/",i]})]}),s.error&&G(R,{className:"RemoteFlows__TextArea__Error"})]})}})}a(yt,"TextAreaField");import{jsx as Te}from"react/jsx-runtime";function ht(e){let{components:t}=S(),{control:n}=v(),o=e.component||t?.email;return o?Te(b,{control:n,name:e.name,render:({field:i,fieldState:r})=>Te(o,{field:{...i,onChange:a(c=>{i.onChange(c),e.onChange?.(c)},"onChange")},fieldState:r,fieldData:e})}):Te(H,{...e,type:"email"})}a(ht,"EmailField");import{jsx as _t}from"react/jsx-runtime";function vt(e){let{control:t}=v();return _t(b,{control:t,name:e.name,render:({field:n})=>_t("input",{...n,type:"hidden"})})}a(vt,"HiddenField");import Fo,{useEffect as fo,useState as Rt}from"react";var Ct=a((e,t,n)=>{if(e&&"reportValidity"in e){let o=ee(n,t);e.setCustomValidity(o&&o.message||""),e.reportValidity()}},"r"),Ie=a((e,t)=>{for(let n in t.fields){let o=t.fields[n];o&&o.ref&&"reportValidity"in o.ref?Ct(o.ref,n,e):o&&o.refs&&o.refs.forEach(i=>Ct(i,n,e))}},"o"),St=a((e,t)=>{t.shouldUseNativeValidation&&Ie(e,t);let n={};for(let o in e){let i=ee(t.fields,o),r=Object.assign(e[o]||{},{ref:i&&i.ref});if(io(t.names||Object.keys(e),o)){let c=Object.assign({},ee(n,o));te(c,"root",r),te(n,o,c)}else te(n,o,r)}return n},"s"),io=a((e,t)=>{let n=xt(t);return e.some(o=>xt(o).match(`^${n}\\.\\d+`))},"i");function xt(e){return e.replace(/\]|\[/g,"")}a(xt,"n");function bt(e,t,n){return t===void 0&&(t={}),n===void 0&&(n={}),function(o,i,r){try{return Promise.resolve(function(c,f){try{var g=(t.context&&process.env.NODE_ENV==="development"&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(e[n.mode==="sync"?"validateSync":"validate"](o,Object.assign({abortEarly:!1},t,{context:i}))).then(function(m){return r.shouldUseNativeValidation&&Ie({},r),{values:n.raw?Object.assign({},o):m,errors:{}}}))}catch(m){return f(m)}return g&&g.then?g.then(void 0,f):g}(0,function(c){if(!c.inner)throw c;return{values:{},errors:St((f=c,g=!r.shouldUseNativeValidation&&r.criteriaMode==="all",(f.inner||[]).reduce(function(m,s){if(m[s.path]||(m[s.path]={message:s.message,type:s.type}),g){var u=m[s.path].types,d=u&&u[s.type];m[s.path]=$e(s.path,g,m,s.type,d?[].concat(d,s.message):s.message)}return m},{})),r)};var f,g}))}catch(c){return Promise.reject(c)}}}a(bt,"o");import*as T from"yup";import kt from"lodash.groupby";import Z from"lodash.capitalize";var Nt=60,ue=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];function lo(e){if(e<60)return`${e}m`;let t=Math.floor(e/Nt),n=e%Nt;return n>0?`${t}h${n}m`:`${t}h`}a(lo,"convertBreakDurationToHours");function wt(e){let t=e.reduce((n,o)=>o.hours+n,0);return Number(t.toFixed(2))}a(wt,"calculateTotalWorkHours");function mo(e,t){let n=t.map(({day:r})=>r.toLowerCase()),o=n.indexOf(e),i=null;for(;o<n.length&&!i;){let r=n[o],c=n[o+1],f=ue.indexOf(r)+1;ue[f]===c||(i=r),o+=1}return i}a(mo,"findLastConsecutiveDay");function co(e){return e.start_time&&e.end_time&&(typeof e.hours=="number"?e.hours:Number.parseInt(e.hours))>0}a(co,"shouldSummarizeSchedule");function po(e){return Number.parseInt(e.break_duration_minutes)>0}a(po,"shouldSummarizeBreaks");function Pt(e){let t=e.filter(co),n=kt(t,f=>`${f.start_time}|${f.end_time}`),o=e.filter(po),i=kt(o,"break_duration_minutes"),r=Object.keys(n).map(f=>{let g=n[f],m=g[0].day,[s,u]=f.split("|"),d=`from <span>${s.replace(":","h")}</span> to <span>${u.replace(":","h")}</span>`,l=mo(m,g),F=(l?g.findIndex(p=>p.day===l):-1)===g.length-1;return g.length===1?`${Z(m)}, ${d}`:!F||!l?g.reduce((p,C,x)=>{let D=Z(C.day);return x===g.length-1?`${p}and ${D}, ${d}`:`${p}<span>${D}</span>, `},""):`<span>${Z(m)}</span> to <span>${Z(l)}</span>, ${d}`}),c=Object.keys(i).reverse().map((f,g)=>{let m=g===0,s=i[f],u=lo(parseInt(f,10));if(Object.keys(i).length===1)return`With ${u} daily breaks`;if(s.length===1){let d=`${u} break on ${Z(s[0].day)}.`;return m?`With ${d}`:d}return s.reduce((d,l,y)=>{let F=Z(l.day);return y===0?`${d} ${F}`:y===s.length-1?`${d}, and ${F}.`:`${d}, ${F}`},m?`With ${u} break on`:`${u} break on`)});return{workHoursSummary:r,breakSummary:c}}a(Pt,"buildWorkScheduleSummary");function Me(e){let{checked:t,start_time:n,end_time:o,break_duration_minutes:i}=e;if(!t)return 0;let[r,c]=n.split(":").map(Number),[f,g]=o.split(":").map(Number),m=r*60+c,d=(f*60+g-m-Number.parseInt(i||"0"))/60;return d===Math.floor(d)?d:Number(d.toFixed(2))}a(Me,"calculateHours");var uo={monday:"Mon",tuesday:"Tue",wednesday:"Wed",thursday:"Thu",friday:"Fri",saturday:"Sat",sunday:"Sun"};function Fe(e){return uo[e]}a(Fe,"getShortWeekday");import{jsx as h,jsxs as E}from"react/jsx-runtime";var go=T.object({day:T.string().required(),checked:T.boolean().required(),start_time:T.string().matches(/^([01]\d|2[0-3]):([0-5]\d)$/,"Invalid time format (HH:mm)").when("checked",{is:!0,then:a(e=>e.required("Required"),"then"),otherwise:a(e=>e.optional().nullable(),"otherwise")}),end_time:T.string().matches(/^([01]\d|2[0-3]):([0-5]\d)$/,"Invalid time format (HH:mm)").when("checked",{is:!0,then:a(e=>e.required("Required"),"then"),otherwise:a(e=>e.optional().nullable(),"otherwise")}),hours:T.number().default(0),break_duration_minutes:T.string().default("0")}),yo=T.object({schedule:T.array(go)});function ho({defaultSchedule:e,onSubmit:t}){let[n,o]=Rt(!1),i=ue.map(F=>{let p=e.find(C=>C.day.toLowerCase()===Fe(F).toLowerCase()||C.day.toLowerCase()===F.toLowerCase());return p?{...p,day:Fe(F),checked:!0}:{...e[0],checked:!1,day:Fe(F)}}),r=Ee({defaultValues:{schedule:i},resolver:bt(yo)}),{handleSubmit:c,watch:f,reset:g,control:m,formState:s}=r,{fields:u}=We({name:"schedule",control:m}),d=f("schedule");function l(F){let p=F.schedule.filter(({checked:C})=>C).map(C=>({...C,hours:Me(C)}));t(p),o(!1)}a(l,"handleSubmitWorkingHours");function y(){g(),o(!1)}return a(y,"handleCancel"),h("div",{className:"flex items-center justify-between",children:E(he,{open:n,onOpenChange:o,children:[h(Qe,{asChild:!0,children:h(L,{variant:"link",className:"flex items-center p-0 RemoteFlows__WorkScheduleSelectionForm__Trigger",children:"Edit Schedule"})}),E(_e,{className:"max-w-5xl max-h-[90vh] overflow-y-auto px-8 py-4 RemoteFlows__WorkScheduleSelectionForm__Content",children:[h(ve,{children:h(Ce,{className:"RemoteFlows__WorkScheduleSelectionForm__Title",children:"Edit employee working hours"})}),h(Oe,{...r,children:E("form",{className:"space-y-4 RemoteFlows__WorkScheduleSelectionForm__Form",children:[E("div",{className:"rounded-lg",children:[h("p",{className:"text-gray-600 text-sm mb-4 RemoteFlows__WorkScheduleSelectionForm__Description",children:"The times displayed are in the employee's time zone in the 24-hour format."}),E("div",{className:"grid grid-cols-12 gap-4 text-sm font-medium text-gray-500 uppercase tracking-wide RemoteFlows__WorkScheduleSelectionForm__Header",children:[h("div",{className:"col-span-2"}),h("div",{className:"col-span-3 text-center",children:"START"}),h("div",{className:"col-span-1 text-center"}),h("div",{className:"col-span-3 text-center",children:"END"}),h("div",{className:"col-span-2 text-center",children:"HOURS"})]}),h("div",{className:"RemoteFlows__WorkScheduleSelectionForm__Rows",children:u.map((F,p)=>{let C=d[p],x=Me(C);return E(Fo.Fragment,{children:[E("div",{className:"grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Hours",children:[h("div",{className:"col-span-2 flex items-center gap-3",children:h(ne,{label:F.day,name:`schedule.${p}.checked`})}),h("div",{className:"col-span-3",children:h(H,{name:`schedule.${p}.start_time`,includeErrorMessage:!1})}),h("div",{className:"col-span-1 text-center text-gray-500",children:"to"}),h("div",{className:"col-span-3",children:h(H,{name:`schedule.${p}.end_time`,includeErrorMessage:!1})}),h("div",{className:"col-span-2 text-center text-gray-600",children:isNaN(x)?"-":`${x} hours`})]}),E("div",{className:"grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Break",children:[h("div",{className:"col-span-2 text-gray-500",children:"Break"}),h("div",{className:"col-span-2",children:h(H,{name:`schedule.${p}.break_duration_minutes`,includeErrorMessage:!1})}),h("div",{className:"col-span-2 text-gray-500",children:"minutes"}),h("div",{className:"col-span-4"})]})]},F.id)})})]}),Object.keys(s.errors).length>0&&h("p",{className:"text-destructive text-sm mb-0",children:"Invalid time format (HH:mm)"}),E("div",{className:"flex gap-4 pt-4",children:[h(L,{type:"button",className:"reset-button",variant:"outline",onClick:y,children:"Cancel"}),h(L,{type:"button",className:"submit-button",onClick:c(l),children:"Save Schedule"})]})]})})]})]})})}a(ho,"WorkScheduleSelectionForm");function Dt(e){let{components:t}=S(),{setValue:n,control:o,watch:i}=v(),r=i(e.name),[c,f]=Rt(r),{workHoursSummary:g,breakSummary:m}=Pt(c),s=wt(c);fo(()=>{n(e.name,c)},[c,e.name,n]);function u(l){f(l)}a(u,"onSubmit");let d=e.component||t?.["work-schedule"];return d?h(b,{control:o,name:e.name,render:({field:l,fieldState:y})=>h(d,{field:{...l,onChange:a(F=>{l.onChange(F),e.onChange?.(F)},"onChange")},fieldState:y,fieldData:{...e,defaultFormattedValue:{workHoursSummary:g,breakSummary:m,totalWorkHours:s}}})}):E("div",{className:"flex flex-col gap-3 RemoteFlows__WorkScheduleField",children:[h("p",{className:"text-sm RemoteFlows__WorkScheduleField__Title",children:"Work hours"}),E("div",{className:"flex flex-col gap-1 RemoteFlows__WorkScheduleField__Summary",children:[h("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__WorkHours",dangerouslySetInnerHTML:{__html:g.join(", ")}}),h("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Break",children:m.join()}),E("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Total",children:["Total of ",h("span",{children:s})," hours per week"]}),h(ho,{defaultSchedule:c,onSubmit:u})]})]})}a(Dt,"WorkScheduleField");import{useState as _o}from"react";import{jsx as q,jsxs as vo}from"react/jsx-runtime";function Tt({label:e,name:t,options:n,defaultValue:o,description:i,onChange:r,component:c,...f}){let{control:g}=v(),{components:m}=S(),[s,u]=_o();return q(b,{defaultValue:o,control:g,name:t,render:({field:d,fieldState:l})=>{let y=c||m?.["multi-select"];if(y){let p={label:e,name:t,options:n,defaultValue:o,description:i,onChange:r,...f};return q(y,{field:{...d,onChange:a(C=>{d.onChange(C),r?.(C)},"onChange")},fieldState:l,fieldData:p})}let F=s||n.filter(p=>d.value.includes(p.value));return vo(N,{"data-field":t,className:`RemoteFlows__SelectField__Item__${t}`,children:[q(k,{className:"RemoteFlows__SelectField__Label",children:e}),q(w,{children:q(pe,{options:n,selected:F,onChange:p=>{let C=p.map(({value:x})=>x);d.onChange(C),r?.(C),u(p)},...f})}),i&&q(P,{children:i}),l.error&&q(R,{})]})}})}a(Tt,"MultiSelectField");import{jsx as Co}from"react/jsx-runtime";var It=a(e=>Co(de,{maxLength:15,...e}),"MoneyField");var Y={checkbox:ne,text:H,email:ht,money:It,select:lt,"multi-select":Tt,radio:st,number:de,file:at,fieldset:ke,"fieldset-flat":ke,date:tt,textarea:yt,countries:ft,hidden:vt,"work-schedule":Dt};import{useEffect as xo}from"react";import{Fragment as So,jsx as fe,jsxs as bo}from"react/jsx-runtime";function Mt({name:e,value:t,description:n,statement:o,label:i}){let{setValue:r}=v();return xo(()=>{r(e,t)},[]),fe("div",{children:o?bo(So,{children:[fe("p",{className:`text-sm RemoteFlows__ForcedValue__Title__${e}`,dangerouslySetInnerHTML:{__html:oe(o?.title||i)}}),fe("p",{className:`text-xs RemoteFlows__ForcedValue__Description__${e}`,dangerouslySetInnerHTML:{__html:oe(o?.description||n)}})]}):fe("p",{className:`text-xs RemoteFlows__ForcedValue__Description__${e}`,dangerouslySetInnerHTML:{__html:oe(n)}})})}a(Mt,"ForcedValueField");import{Fragment as wo,jsx as K,jsxs as $t}from"react/jsx-runtime";function No(e){return e.const!==void 0&&e.const===e.default&&e.inputType!=="checkbox"&&e.inputType!=="hidden"}a(No,"checkFieldHasForcedValue");var xs=a(({fields:e,fieldsets:t,fieldValues:n,components:o})=>{if(!e||e.length===0)return null;let i=t&&n?Le({fields:e,fieldsets:t,values:n}):e;return K(wo,{children:i.map(r=>{if(r.calculateDynamicProperties&&(r={...r,...r.calculateDynamicProperties(n,r)||{}}),r.isVisible===!1||r.deprecated||r.hidden)return null;if(No(r))return K(Mt,{name:r.name,description:r.description,value:r.const,statement:r.statement,label:r.label},r.name);if(r.Component){let{Component:f}=r;return K(f,{...r},r.name)}let c=Y[r.type];return r.type==="select"&&r.multiple&&(c=Y["multi-select"]),r.type==="fieldset"?K(c,{...r,components:o},r.name):r.type==="fieldset-flat"?K(c,{...r,components:o,isFlatFieldset:!0},r.name):c?$t(ko,{children:[K(c,{...r,component:o&&o[r.type]}),r.statement?K(ce,{...r.statement}):null,r.extra?r.extra:null]},r.name):$t("p",{className:"error",children:["Field type ",r.type," not supported"]})})})},"JSONSchemaFormFields");export{xs as a};
|
|
2
|
-
//# sourceMappingURL=chunk-4W2RKQYM.js.map
|