@gusto/embedded-react-sdk 0.12.3 → 0.13.1
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/CHANGELOG.md +12 -0
- package/dist/_virtual/dynamic-import-helper.js +8 -1
- package/dist/_virtual/dynamic-import-helper.js.map +1 -1
- package/dist/assets/icons/spinner_small.svg.js +10 -0
- package/dist/assets/icons/spinner_small.svg.js.map +1 -0
- package/dist/components/Base/Base.js +28 -27
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Base/useBase.d.ts +2 -0
- package/dist/components/Base/useBase.js.map +1 -1
- package/dist/components/Common/DataView/DataView.d.ts +2 -1
- package/dist/components/Common/DataView/DataView.js +20 -19
- package/dist/components/Common/DataView/DataView.js.map +1 -1
- package/dist/components/Common/DataView/useDataView.d.ts +3 -1
- package/dist/components/Common/DataView/useDataView.js +13 -11
- package/dist/components/Common/DataView/useDataView.js.map +1 -1
- package/dist/components/Common/EmptyData/EmptyData.module.scss.js +1 -1
- package/dist/components/Common/FieldDescription/FieldDescription.js +7 -14
- package/dist/components/Common/FieldDescription/FieldDescription.js.map +1 -1
- package/dist/components/Common/Fields/hooks/useField.d.ts +4 -1
- package/dist/components/Common/Fields/hooks/useField.js +31 -24
- package/dist/components/Common/Fields/hooks/useField.js.map +1 -1
- package/dist/components/Common/InlineSpinner/InlineSpinner.d.ts +6 -0
- package/dist/components/Common/InlineSpinner/InlineSpinner.js +25 -0
- package/dist/components/Common/InlineSpinner/InlineSpinner.js.map +1 -0
- package/dist/components/Common/InlineSpinner/InlineSpinner.module.scss.js +10 -0
- package/dist/components/Common/InlineSpinner/InlineSpinner.module.scss.js.map +1 -0
- package/dist/components/Common/InlineSpinner/index.d.ts +2 -0
- package/dist/components/Common/PaginationControl/PaginationControl.js +31 -28
- package/dist/components/Common/PaginationControl/PaginationControl.js.map +1 -1
- package/dist/components/Common/PaginationControl/PaginationControlTypes.d.ts +1 -0
- package/dist/components/Common/SignatureForm/SignatureForm.js +1 -1
- package/dist/components/Common/UI/CalendarPreview/CalendarPreview.js +1 -1
- package/dist/components/Common/UI/DatePicker/DatePicker.js +1 -1
- package/dist/components/Common/UI/Table/Table.module.scss.js +1 -1
- package/dist/components/Common/UI/Tabs/Tabs.d.ts +7 -0
- package/dist/components/Common/UI/Tabs/Tabs.js +25 -0
- package/dist/components/Common/UI/Tabs/Tabs.js.map +1 -0
- package/dist/components/Common/UI/Tabs/Tabs.module.scss.js +8 -0
- package/dist/components/Common/UI/Tabs/Tabs.module.scss.js.map +1 -0
- package/dist/components/Common/UI/Tabs/TabsTypes.d.ts +51 -0
- package/dist/components/Common/UI/Tabs/index.d.ts +3 -0
- package/dist/components/Common/hooks/useNumberFormatter.js +1 -1
- package/dist/components/Common/index.d.ts +1 -0
- package/dist/components/Company/AssignSignatory/AssignSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +5 -5
- package/dist/components/Company/AssignSignatory/CreateSignatory/Schema.d.ts +2 -2
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +9 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +4 -4
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +9 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +11 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccount.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +2 -2
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +9 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js +2 -2
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +2 -2
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +9 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentSigner.js +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +3 -3
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +9 -3
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/FederalTaxes.js +3 -3
- package/dist/components/Company/FederalTaxes/Form.js +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +18 -12
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +12 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Industry.js +2 -2
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +4 -4
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +9 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +9 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +9 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +5 -5
- package/dist/components/Company/PaySchedule/usePaySchedule.js +12 -6
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +3 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +9 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +9 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/Address.js +4 -4
- package/dist/components/Contractor/Address/useAddress.js +11 -5
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/ContractorList/index.js +1 -1
- package/dist/components/Contractor/ContractorList/useContractorList.js +1 -1
- package/dist/components/Contractor/NewHireReport/NewHireReport.js +52 -50
- package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
- package/dist/components/Contractor/NewHireReport/types.d.ts +1 -0
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js +19 -12
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js.map +1 -1
- package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js +6 -5
- package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.d.ts +4 -4
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +7 -7
- package/dist/components/Contractor/Profile/ContractorProfile.js +1 -1
- package/dist/components/Contractor/Profile/useContractorProfile.d.ts +19 -19
- package/dist/components/Contractor/Profile/useContractorProfile.js +40 -35
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Contractor/Submit/Submit.js +25 -25
- package/dist/components/Contractor/Submit/Submit.js.map +1 -1
- package/dist/components/Employee/Compensation/Compensation.js +10 -10
- package/dist/components/Employee/Deductions/Deductions.js +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +4 -4
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +2 -2
- package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +9 -3
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +3 -3
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +9 -3
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.js +75 -62
- package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +27 -25
- package/dist/components/Employee/EmployeeList/List.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.d.ts +1 -0
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +9 -3
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalTaxes.js +3 -3
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +9 -3
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Employee/Landing/Landing.js +2 -2
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +2 -2
- package/dist/components/Employee/PaymentMethod/BankAccount.d.ts +2 -2
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js +8 -8
- package/dist/components/Employee/PaymentMethod/Split.js +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +8 -8
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +15 -9
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +2 -2
- package/dist/components/Employee/Profile/PersonalDetailsInputs.d.ts +2 -2
- package/dist/components/Employee/Profile/Profile.js +15 -13
- package/dist/components/Employee/Profile/Profile.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +9 -3
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/StateTaxes/StateTaxes.js +3 -3
- package/dist/components/Employee/StateTaxes/useStateTaxes.js +9 -3
- package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
- package/dist/components/Employee/Taxes/Taxes.js +5 -5
- package/dist/components/Employee/Taxes/useTaxes.js +9 -3
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.d.ts +4 -2
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +69 -33
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +10 -5
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +119 -50
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.d.ts +5 -2
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +64 -13
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +18 -2
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +117 -18
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.d.ts +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js +24 -11
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +8 -6
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +35 -26
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +42 -35
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/RunPayrollFlow/RunPayroll.d.ts +2 -1
- package/dist/components/Payroll/RunPayrollFlow/RunPayroll.js +4 -4
- package/dist/components/Payroll/RunPayrollFlow/RunPayroll.js.map +1 -1
- package/dist/components/Payroll/helpers.d.ts +21 -0
- package/dist/components/Payroll/helpers.js +209 -0
- package/dist/components/Payroll/helpers.js.map +1 -0
- package/dist/components/Payroll/helpers.test.d.ts +1 -0
- package/dist/components/Payroll/usePreparedPayrollData.d.ts +14 -0
- package/dist/components/Payroll/usePreparedPayrollData.js +39 -0
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -0
- package/dist/contexts/ApiProvider/ApiProvider.js +4 -4
- package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +28 -26
- package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
- package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
- package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +3 -2
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/helpers/formattedStrings.d.ts +9 -0
- package/dist/helpers/formattedStrings.js +55 -16
- package/dist/helpers/formattedStrings.js.map +1 -1
- package/dist/i18n/I18n.js +15 -15
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +32 -0
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js.map +1 -0
- package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js +20 -0
- package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js.map +1 -0
- package/dist/i18n/en/Payroll.PayrollList.json.js +14 -0
- package/dist/i18n/en/Payroll.PayrollList.json.js.map +1 -0
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +18 -0
- package/dist/i18n/en/Payroll.PayrollOverview.json.js.map +1 -0
- package/dist/i18n/en/common.json.d.ts +8 -0
- package/dist/i18n/en/common.json.js +15 -13
- package/dist/i18n/en/common.json.js.map +1 -1
- package/dist/shared/constants.d.ts +6 -0
- package/dist/shared/constants.js +43 -34
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +96 -1
- package/package.json +27 -26
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { useReducer as i } from "react";
|
|
3
3
|
const P = () => ({
|
|
4
4
|
currentPayrollId: void 0,
|
|
@@ -44,10 +44,10 @@ const P = () => ({
|
|
|
44
44
|
const [{ isCalculated: s, currentPayrollId: e }, y] = i(
|
|
45
45
|
p,
|
|
46
46
|
P()
|
|
47
|
-
), a = (
|
|
48
|
-
y({ type:
|
|
47
|
+
), a = (o, u) => {
|
|
48
|
+
y({ type: o, payload: u }), c(o, u);
|
|
49
49
|
};
|
|
50
|
-
return e ? s ? /* @__PURE__ */
|
|
50
|
+
return e ? s ? /* @__PURE__ */ t(d, { companyId: r, onEvent: a, payrollId: e }) : /* @__PURE__ */ t(l, { onEvent: a, payrollId: e, companyId: r }) : /* @__PURE__ */ t(n, { companyId: r, onEvent: a });
|
|
51
51
|
};
|
|
52
52
|
export {
|
|
53
53
|
v as RunPayroll
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RunPayroll.js","sources":["../../../../src/components/Payroll/RunPayrollFlow/RunPayroll.tsx"],"sourcesContent":["import { useReducer } from 'react'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { EventType, runPayrollEvents } from '@/shared/constants'\n\ntype PayrollFlowEvent = (typeof runPayrollEvents)[keyof typeof runPayrollEvents]\ntype PayrollFlowAction =\n | {\n type: Extract<\n PayrollFlowEvent,\n 'runPayroll/back' | 'runPayroll/edited' | 'runPayroll/calculated' | 'runPayroll/submitted'\n >\n }\n | {\n type: Extract<PayrollFlowEvent, 'runPayroll/selected'>\n payload: { payrollId: string }\n }\n\ninterface PayrollFlowState {\n currentPayrollId?: string\n isCalculated: boolean\n}\nconst createInitialPayrollFlowState: () => PayrollFlowState = () => ({\n currentPayrollId: undefined,\n isCalculated: false,\n})\n\nconst runPayrollFlowReducer: (\n state: PayrollFlowState,\n action: PayrollFlowAction,\n) => PayrollFlowState = (state, action) => {\n switch (action.type) {\n case 'runPayroll/back':\n return {\n ...state,\n currentPayrollId: undefined,\n }\n case 'runPayroll/edited':\n return {\n ...state,\n isCalculated: false,\n }\n case 'runPayroll/calculated':\n return {\n ...state,\n isCalculated: true,\n }\n case 'runPayroll/selected': {\n return {\n ...state,\n currentPayrollId: action.payload.payrollId,\n }\n }\n case 'runPayroll/submitted': {\n return {\n ...state,\n isCalculated: false,\n currentPayrollId: undefined,\n }\n }\n default:\n return state\n }\n}\n\ninterface RunPayrollProps extends Pick<BaseComponentInterface, 'onEvent'> {\n companyId: string\n Configuration: ({\n onEvent,\n payrollId,\n }: Pick<BaseComponentInterface, 'onEvent'> & {
|
|
1
|
+
{"version":3,"file":"RunPayroll.js","sources":["../../../../src/components/Payroll/RunPayrollFlow/RunPayroll.tsx"],"sourcesContent":["import { useReducer } from 'react'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { EventType, runPayrollEvents } from '@/shared/constants'\n\ntype PayrollFlowEvent = (typeof runPayrollEvents)[keyof typeof runPayrollEvents]\ntype PayrollFlowAction =\n | {\n type: Extract<\n PayrollFlowEvent,\n 'runPayroll/back' | 'runPayroll/edited' | 'runPayroll/calculated' | 'runPayroll/submitted'\n >\n }\n | {\n type: Extract<PayrollFlowEvent, 'runPayroll/selected'>\n payload: { payrollId: string }\n }\n\ninterface PayrollFlowState {\n currentPayrollId?: string\n isCalculated: boolean\n}\nconst createInitialPayrollFlowState: () => PayrollFlowState = () => ({\n currentPayrollId: undefined,\n isCalculated: false,\n})\n\nconst runPayrollFlowReducer: (\n state: PayrollFlowState,\n action: PayrollFlowAction,\n) => PayrollFlowState = (state, action) => {\n switch (action.type) {\n case 'runPayroll/back':\n return {\n ...state,\n currentPayrollId: undefined,\n }\n case 'runPayroll/edited':\n return {\n ...state,\n isCalculated: false,\n }\n case 'runPayroll/calculated':\n return {\n ...state,\n isCalculated: true,\n }\n case 'runPayroll/selected': {\n return {\n ...state,\n currentPayrollId: action.payload.payrollId,\n }\n }\n case 'runPayroll/submitted': {\n return {\n ...state,\n isCalculated: false,\n currentPayrollId: undefined,\n }\n }\n default:\n return state\n }\n}\n\ninterface RunPayrollProps extends Pick<BaseComponentInterface, 'onEvent'> {\n companyId: string\n Configuration: ({\n onEvent,\n payrollId,\n companyId,\n }: Pick<BaseComponentInterface, 'onEvent'> & {\n payrollId: string\n companyId: string\n }) => React.JSX.Element\n List: ({\n companyId,\n onEvent,\n }: Pick<BaseComponentInterface, 'onEvent'> & { companyId: string }) => React.JSX.Element\n Overview: ({\n companyId,\n onEvent,\n payrollId,\n }: Pick<BaseComponentInterface, 'onEvent'> & {\n companyId: string\n payrollId: string\n }) => React.JSX.Element\n}\n\nexport const RunPayroll = ({\n companyId,\n Configuration,\n List,\n onEvent,\n Overview,\n}: RunPayrollProps) => {\n const [{ isCalculated, currentPayrollId }, dispatch] = useReducer(\n runPayrollFlowReducer,\n createInitialPayrollFlowState(),\n )\n\n const wrappedOnEvent: OnEventType<string, unknown> = (event, payload) => {\n dispatch({ type: event, payload } as PayrollFlowAction)\n onEvent(event as EventType, payload)\n }\n\n return currentPayrollId ? (\n isCalculated ? (\n <Overview companyId={companyId} onEvent={wrappedOnEvent} payrollId={currentPayrollId} />\n ) : (\n <Configuration onEvent={wrappedOnEvent} payrollId={currentPayrollId} companyId={companyId} />\n )\n ) : (\n <List companyId={companyId} onEvent={wrappedOnEvent} />\n )\n}\n"],"names":["createInitialPayrollFlowState","runPayrollFlowReducer","state","action","RunPayroll","companyId","Configuration","List","onEvent","Overview","isCalculated","currentPayrollId","dispatch","useReducer","wrappedOnEvent","event","payload","jsx"],"mappings":";;AAsBA,MAAMA,IAAwD,OAAO;AAAA,EACnE,kBAAkB;AAAA,EAClB,cAAc;AAChB,IAEMC,IAGkB,CAACC,GAAOC,MAAW;AACzC,UAAQA,EAAO,MAAA;AAAA,IACb,KAAK;AACH,aAAO;AAAA,QACL,GAAGD;AAAA,QACH,kBAAkB;AAAA,MAAA;AAAA,IAEtB,KAAK;AACH,aAAO;AAAA,QACL,GAAGA;AAAA,QACH,cAAc;AAAA,MAAA;AAAA,IAElB,KAAK;AACH,aAAO;AAAA,QACL,GAAGA;AAAA,QACH,cAAc;AAAA,MAAA;AAAA,IAElB,KAAK;AACH,aAAO;AAAA,QACL,GAAGA;AAAA,QACH,kBAAkBC,EAAO,QAAQ;AAAA,MAAA;AAAA,IAGrC,KAAK;AACH,aAAO;AAAA,QACL,GAAGD;AAAA,QACH,cAAc;AAAA,QACd,kBAAkB;AAAA,MAAA;AAAA,IAGtB;AACE,aAAOA;AAAA,EAAA;AAEb,GA0BaE,IAAa,CAAC;AAAA,EACzB,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AACF,MAAuB;AACrB,QAAM,CAAC,EAAE,cAAAC,GAAc,kBAAAC,EAAA,GAAoBC,CAAQ,IAAIC;AAAA,IACrDZ;AAAA,IACAD,EAAA;AAAA,EAA8B,GAG1Bc,IAA+C,CAACC,GAAOC,MAAY;AACvE,IAAAJ,EAAS,EAAE,MAAMG,GAAO,SAAAC,EAAA,CAA8B,GACtDR,EAAQO,GAAoBC,CAAO;AAAA,EACrC;AAEA,SAAOL,IACLD,IACE,gBAAAO,EAACR,GAAA,EAAS,WAAAJ,GAAsB,SAASS,GAAgB,WAAWH,EAAA,CAAkB,IAEtF,gBAAAM,EAACX,KAAc,SAASQ,GAAgB,WAAWH,GAAkB,WAAAN,EAAA,CAAsB,IAG7F,gBAAAY,EAACV,GAAA,EAAK,WAAAF,GAAsB,SAASS,EAAA,CAAgB;AAEzD;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Employee } from '@gusto/embedded-api/models/components/employee';
|
|
2
|
+
import { TFunction } from 'i18next';
|
|
3
|
+
import { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject';
|
|
4
|
+
import { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype';
|
|
5
|
+
export declare const getPrimaryJob: (employee: Employee) => import('@gusto/embedded-api/models/components/job.js').Job | null;
|
|
6
|
+
export declare const formatEmployeePayRate: ({ employee, t, locale, }: {
|
|
7
|
+
employee?: Employee;
|
|
8
|
+
t: TFunction;
|
|
9
|
+
locale?: string;
|
|
10
|
+
}) => string | null;
|
|
11
|
+
export declare const useFormatEmployeePayRate: () => (employee?: Employee) => string | null;
|
|
12
|
+
export declare const getEmployeePayRateInfo: (employee: Employee | undefined) => {
|
|
13
|
+
rate: number;
|
|
14
|
+
paymentUnit: import('@gusto/embedded-api/models/components/compensation').PaymentUnit;
|
|
15
|
+
} | null;
|
|
16
|
+
export declare const getRegularHours: (compensation: PayrollEmployeeCompensationsType) => number;
|
|
17
|
+
export declare const getTotalPtoHours: (compensation: PayrollEmployeeCompensationsType) => number;
|
|
18
|
+
export declare const getAdditionalEarnings: (compensation: PayrollEmployeeCompensationsType) => number;
|
|
19
|
+
export declare const getReimbursements: (compensation: PayrollEmployeeCompensationsType) => number;
|
|
20
|
+
export declare const formatHoursDisplay: (hours: number) => string;
|
|
21
|
+
export declare const calculateGrossPay: (compensation: PayrollEmployeeCompensationsType, employee: Employee, compensationEffectiveDateString?: string, paySchedule?: PayScheduleObject, isOffCycle?: boolean) => number;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { useCallback as C } from "react";
|
|
2
|
+
import { useTranslation as T } from "react-i18next";
|
|
3
|
+
import { formatPayRate as v } from "../../helpers/formattedStrings.js";
|
|
4
|
+
import { useLocale as b } from "../../contexts/LocaleProvider/useLocale.js";
|
|
5
|
+
const E = "regular hours", y = (t) => t.jobs?.find((e) => e.primary) || t.jobs?.[0] || null, M = (t) => Math.round(t * 1e6) / 1e6, P = (t) => Math.round(t * 100) / 100, H = (t) => t.toLowerCase() === E, j = {
|
|
6
|
+
Daily: 8,
|
|
7
|
+
"Every week": 40,
|
|
8
|
+
"Every other week": 80,
|
|
9
|
+
"Twice per month": 86.666667,
|
|
10
|
+
Monthly: 173.333333,
|
|
11
|
+
Quarterly: 520,
|
|
12
|
+
Semiannually: 1040,
|
|
13
|
+
Annually: 2080
|
|
14
|
+
}, S = ({
|
|
15
|
+
employee: t,
|
|
16
|
+
t: e,
|
|
17
|
+
locale: r = "en-US"
|
|
18
|
+
}) => {
|
|
19
|
+
if (!t?.jobs)
|
|
20
|
+
return null;
|
|
21
|
+
const n = y(t);
|
|
22
|
+
if (!n?.compensations)
|
|
23
|
+
return null;
|
|
24
|
+
const o = n.compensations[0];
|
|
25
|
+
if (!o || !o.rate || parseFloat(o.rate) === 0)
|
|
26
|
+
return null;
|
|
27
|
+
const a = parseFloat(o.rate), u = o.paymentUnit || "Hour";
|
|
28
|
+
return v({ rate: a, paymentUnit: u, t: e, locale: r });
|
|
29
|
+
}, z = () => {
|
|
30
|
+
const { t } = T("common"), { locale: e } = b();
|
|
31
|
+
return C(
|
|
32
|
+
(r) => S({ employee: r, t, locale: e }),
|
|
33
|
+
[t, e]
|
|
34
|
+
);
|
|
35
|
+
}, B = (t) => t.hourlyCompensations ? t.hourlyCompensations.filter((e) => e.name?.toLowerCase() === "regular hours").reduce((e, r) => e + parseFloat(r.hours || "0"), 0) : 0, x = (t) => t.paidTimeOff ? t.paidTimeOff.reduce((e, r) => e + parseFloat(r.hours || "0"), 0) : 0, U = (t) => t.fixedCompensations ? t.fixedCompensations.filter((e) => {
|
|
36
|
+
const r = e.name?.toLowerCase() || "", n = parseFloat(e.amount || "0");
|
|
37
|
+
return r !== "reimbursement" && r !== "minimum wage adjustment" && n > 0;
|
|
38
|
+
}).reduce((e, r) => e + parseFloat(r.amount || "0"), 0) : 0, K = (t) => {
|
|
39
|
+
if (!t.fixedCompensations)
|
|
40
|
+
return 0;
|
|
41
|
+
const e = t.fixedCompensations.find(
|
|
42
|
+
(r) => r.name?.toLowerCase() === "reimbursement"
|
|
43
|
+
);
|
|
44
|
+
return e ? parseFloat(e.amount || "0") : 0;
|
|
45
|
+
}, V = (t) => {
|
|
46
|
+
const e = P(t);
|
|
47
|
+
return e % 1 === 0 ? `${e}.0` : e.toString();
|
|
48
|
+
}, W = (t) => t.frequency && j[t.frequency] || 0, g = (t, e) => {
|
|
49
|
+
if (!t.length) return null;
|
|
50
|
+
const r = [...t].sort(
|
|
51
|
+
(n, o) => (n.effectiveDate ? new Date(n.effectiveDate).getTime() : 0) - (o.effectiveDate ? new Date(o.effectiveDate).getTime() : 0)
|
|
52
|
+
);
|
|
53
|
+
for (let n = r.length - 1; n >= 0; n--) {
|
|
54
|
+
const o = r[n]?.effectiveDate, a = o ? new Date(o) : null;
|
|
55
|
+
if (a && a <= e)
|
|
56
|
+
return r[n] || null;
|
|
57
|
+
}
|
|
58
|
+
return r[0] || null;
|
|
59
|
+
}, A = (t, e) => {
|
|
60
|
+
if (!t.length) return null;
|
|
61
|
+
const r = [...t].sort(
|
|
62
|
+
(n, o) => (n.effectiveDate ? new Date(n.effectiveDate).getTime() : 0) - (o.effectiveDate ? new Date(o.effectiveDate).getTime() : 0)
|
|
63
|
+
);
|
|
64
|
+
for (let n = r.length - 1; n >= 0; n--) {
|
|
65
|
+
const o = r[n]?.effectiveDate, a = o ? new Date(o) : null;
|
|
66
|
+
if (a && a <= e)
|
|
67
|
+
return r[n] || null;
|
|
68
|
+
}
|
|
69
|
+
return r[0] || null;
|
|
70
|
+
}, O = (t) => t.flsaStatus === "Exempt" || t.flsaStatus === "Salaried Nonexempt", L = (t) => t.length ? t.filter((e) => {
|
|
71
|
+
const r = e.name?.toLowerCase(), n = parseFloat(e.amount || "0");
|
|
72
|
+
return (r === "paycheck tips" || r === "cash tips") && n > 0;
|
|
73
|
+
}).reduce((e, r) => e + parseFloat(r.amount || "0"), 0) : 0, h = (t) => {
|
|
74
|
+
const e = parseFloat(t.rate || "0");
|
|
75
|
+
switch (t.paymentUnit || "Hour") {
|
|
76
|
+
case "Hour":
|
|
77
|
+
return e;
|
|
78
|
+
case "Year":
|
|
79
|
+
return e / 2080;
|
|
80
|
+
// 52 weeks * 40 hours
|
|
81
|
+
case "Month":
|
|
82
|
+
return e / 173.333333;
|
|
83
|
+
case "Week":
|
|
84
|
+
return e / 40;
|
|
85
|
+
case "Paycheck":
|
|
86
|
+
return 0;
|
|
87
|
+
// Paycheck rate is 0 for hourly calculation
|
|
88
|
+
default:
|
|
89
|
+
return e;
|
|
90
|
+
}
|
|
91
|
+
}, k = (t, e, r) => {
|
|
92
|
+
const n = t.jobs?.find((a) => a.uuid === e);
|
|
93
|
+
if (!n?.compensations)
|
|
94
|
+
return 0;
|
|
95
|
+
const o = g(n.compensations, r);
|
|
96
|
+
return o ? h(o) : 0;
|
|
97
|
+
}, D = (t, e) => {
|
|
98
|
+
const r = y(t);
|
|
99
|
+
if (!r?.compensations)
|
|
100
|
+
return 0;
|
|
101
|
+
const n = g(r.compensations, e);
|
|
102
|
+
return n ? h(n) : 0;
|
|
103
|
+
}, I = (t) => t.paidTimeOff ? t.paidTimeOff.reduce(
|
|
104
|
+
(e, r) => e + parseFloat(r.finalPayoutUnusedHoursInput || "0"),
|
|
105
|
+
0
|
|
106
|
+
) : 0, R = (t, e, r, n) => {
|
|
107
|
+
const o = x(t);
|
|
108
|
+
if (n) {
|
|
109
|
+
const a = I(t);
|
|
110
|
+
return o + a;
|
|
111
|
+
}
|
|
112
|
+
return e ? Math.min(r, o) : o;
|
|
113
|
+
}, J = (t, e, r) => {
|
|
114
|
+
if (!t.adjustForMinimumWage) return 0;
|
|
115
|
+
const n = A(
|
|
116
|
+
t.minimumWages || [],
|
|
117
|
+
r
|
|
118
|
+
);
|
|
119
|
+
if (!n)
|
|
120
|
+
return 0;
|
|
121
|
+
const o = e.hourlyCompensations?.reduce(
|
|
122
|
+
(m, l) => m + parseFloat(l.hours || "0"),
|
|
123
|
+
0
|
|
124
|
+
) || 0, a = h(t), u = (parseFloat(n.wage || "0") - a) * o, s = L(e.fixedCompensations || []);
|
|
125
|
+
return Math.max(0, u - s);
|
|
126
|
+
}, _ = (t, e, r, n, o, a, u) => {
|
|
127
|
+
if (!u && n)
|
|
128
|
+
return D(e, r) * (o - a);
|
|
129
|
+
if (!t.hourlyCompensations || !e.jobs)
|
|
130
|
+
return 0;
|
|
131
|
+
const s = t.hourlyCompensations.reduce((i, c) => {
|
|
132
|
+
const p = parseFloat(c.hours || "0"), d = k(e, c.jobUuid || "", r);
|
|
133
|
+
return i + p * d;
|
|
134
|
+
}, 0), m = t.hourlyCompensations.reduce((i, c) => i + parseFloat(c.hours || "0"), 0);
|
|
135
|
+
if (m === 0) return s;
|
|
136
|
+
const l = M(s / m), f = t.hourlyCompensations.filter((i) => !H(i.name || "")).reduce((i, c) => {
|
|
137
|
+
const p = parseFloat(c.hours || "0"), d = c.compensationMultiplier || 1;
|
|
138
|
+
return i + p * l * (d - 1);
|
|
139
|
+
}, 0);
|
|
140
|
+
return s + f;
|
|
141
|
+
}, G = (t, e, r, n, o, a) => {
|
|
142
|
+
const u = R(
|
|
143
|
+
t,
|
|
144
|
+
n,
|
|
145
|
+
o,
|
|
146
|
+
a
|
|
147
|
+
), s = D(e, r);
|
|
148
|
+
return u * s;
|
|
149
|
+
}, N = (t, e, r) => {
|
|
150
|
+
if (!e) return !1;
|
|
151
|
+
const n = t.hourlyCompensations?.find(
|
|
152
|
+
(a) => H(a.name || "")
|
|
153
|
+
);
|
|
154
|
+
return n ? parseFloat(n.hours || "0") === r : !1;
|
|
155
|
+
}, X = (t, e, r, n, o = !1) => {
|
|
156
|
+
if (t.excluded)
|
|
157
|
+
return 0;
|
|
158
|
+
const a = r ? new Date(r) : /* @__PURE__ */ new Date(), u = y(e);
|
|
159
|
+
if (!u?.compensations)
|
|
160
|
+
return 0;
|
|
161
|
+
const s = g(
|
|
162
|
+
u.compensations,
|
|
163
|
+
a
|
|
164
|
+
);
|
|
165
|
+
if (!s)
|
|
166
|
+
return 0;
|
|
167
|
+
const m = O(s), l = n ? W(n) : 0, f = N(
|
|
168
|
+
t,
|
|
169
|
+
m,
|
|
170
|
+
l
|
|
171
|
+
), i = R(
|
|
172
|
+
t,
|
|
173
|
+
f,
|
|
174
|
+
l,
|
|
175
|
+
o
|
|
176
|
+
), c = _(
|
|
177
|
+
t,
|
|
178
|
+
e,
|
|
179
|
+
a,
|
|
180
|
+
f,
|
|
181
|
+
l,
|
|
182
|
+
i,
|
|
183
|
+
o
|
|
184
|
+
), p = U(t), d = G(
|
|
185
|
+
t,
|
|
186
|
+
e,
|
|
187
|
+
a,
|
|
188
|
+
f,
|
|
189
|
+
l,
|
|
190
|
+
o
|
|
191
|
+
), w = J(
|
|
192
|
+
s,
|
|
193
|
+
t,
|
|
194
|
+
a
|
|
195
|
+
), F = c + p + d + w;
|
|
196
|
+
return P(F);
|
|
197
|
+
};
|
|
198
|
+
export {
|
|
199
|
+
X as calculateGrossPay,
|
|
200
|
+
S as formatEmployeePayRate,
|
|
201
|
+
V as formatHoursDisplay,
|
|
202
|
+
U as getAdditionalEarnings,
|
|
203
|
+
y as getPrimaryJob,
|
|
204
|
+
B as getRegularHours,
|
|
205
|
+
K as getReimbursements,
|
|
206
|
+
x as getTotalPtoHours,
|
|
207
|
+
z as useFormatEmployeePayRate
|
|
208
|
+
};
|
|
209
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../../src/components/Payroll/helpers.ts"],"sourcesContent":["import type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { PayrollShowFixedCompensations } from '@gusto/embedded-api/models/components/payrollshow'\nimport { useCallback } from 'react'\nimport type { TFunction } from 'i18next'\nimport { useTranslation } from 'react-i18next'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { Compensation, MinimumWages } from '@gusto/embedded-api/models/components/compensation'\nimport type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport { formatPayRate } from '@/helpers/formattedStrings'\nimport { useLocale } from '@/contexts/LocaleProvider/useLocale'\n\nconst REGULAR_HOURS_NAME = 'regular hours'\n\n// Utility to get the primary job from an employee\nexport const getPrimaryJob = (employee: Employee) => {\n return employee.jobs?.find(job => job.primary) || employee.jobs?.[0] || null\n}\n\nconst roundToSixDecimals = (value: number): number => {\n return Math.round(value * 1_000_000) / 1_000_000\n}\n\nconst roundToTwoDecimals = (value: number): number => {\n return Math.round(value * 100) / 100\n}\n\nconst isRegularHours = (compensationName: string): boolean => {\n return compensationName.toLowerCase() === REGULAR_HOURS_NAME\n}\n\nconst PAY_PERIOD_HOURS_MAPPINGS: Record<string, number> = {\n Daily: 8.0,\n 'Every week': 40.0,\n 'Every other week': 80.0,\n 'Twice per month': 86.666667,\n Monthly: 173.333333,\n Quarterly: 520.0,\n Semiannually: 1040.0,\n Annually: 2080.0,\n}\n\nexport const formatEmployeePayRate = ({\n employee,\n t,\n locale = 'en-US',\n}: {\n employee?: Employee\n t: TFunction\n locale?: string\n}) => {\n if (!employee?.jobs) {\n return null\n }\n\n const primaryJob = getPrimaryJob(employee)\n if (!primaryJob?.compensations) {\n return null\n }\n\n const jobCompensation = primaryJob.compensations[0]\n if (!jobCompensation) {\n return null\n }\n if (!jobCompensation.rate || parseFloat(jobCompensation.rate) === 0) {\n return null\n }\n\n const rate = parseFloat(jobCompensation.rate)\n const paymentUnit = jobCompensation.paymentUnit || 'Hour'\n\n return formatPayRate({ rate, paymentUnit, t, locale })\n}\n\nexport const useFormatEmployeePayRate = () => {\n const { t } = useTranslation('common')\n const { locale } = useLocale()\n\n return useCallback(\n (employee?: Employee) => {\n return formatEmployeePayRate({ employee, t, locale })\n },\n [t, locale],\n )\n}\n\nexport const getEmployeePayRateInfo = (employee: Employee | undefined) => {\n if (!employee?.jobs) {\n return null\n }\n\n const primaryJob = getPrimaryJob(employee)\n if (!primaryJob?.compensations) {\n return null\n }\n\n const jobCompensation = primaryJob.compensations[0]\n if (!jobCompensation) {\n return null\n }\n if (!jobCompensation.rate || parseFloat(jobCompensation.rate) === 0) {\n return null\n }\n\n const rate = parseFloat(jobCompensation.rate)\n const paymentUnit = jobCompensation.paymentUnit || 'Hour'\n\n return { rate, paymentUnit }\n}\n\nexport const getRegularHours = (compensation: PayrollEmployeeCompensationsType) => {\n if (!compensation.hourlyCompensations) return 0\n\n return compensation.hourlyCompensations\n .filter(hourlyCompensation => hourlyCompensation.name?.toLowerCase() === 'regular hours')\n .reduce((sum, hourlyCompensation) => sum + parseFloat(hourlyCompensation.hours || '0'), 0)\n}\n\nexport const getTotalPtoHours = (compensation: PayrollEmployeeCompensationsType) => {\n if (!compensation.paidTimeOff) {\n return 0\n }\n return compensation.paidTimeOff.reduce((sum, pto) => sum + parseFloat(pto.hours || '0'), 0)\n}\n\nexport const getAdditionalEarnings = (compensation: PayrollEmployeeCompensationsType) => {\n if (!compensation.fixedCompensations) {\n return 0\n }\n\n return compensation.fixedCompensations\n .filter(fixedCompensation => {\n const name = fixedCompensation.name?.toLowerCase() || ''\n const amount = parseFloat(fixedCompensation.amount || '0')\n return name !== 'reimbursement' && name !== 'minimum wage adjustment' && amount > 0\n })\n .reduce((sum, fixedCompensation) => sum + parseFloat(fixedCompensation.amount || '0'), 0)\n}\n\nexport const getReimbursements = (compensation: PayrollEmployeeCompensationsType) => {\n if (!compensation.fixedCompensations) {\n return 0\n }\n\n const reimbursementComp = compensation.fixedCompensations.find(\n fixedCompensation => fixedCompensation.name?.toLowerCase() === 'reimbursement',\n )\n return reimbursementComp ? parseFloat(reimbursementComp.amount || '0') : 0\n}\n\nexport const formatHoursDisplay = (hours: number): string => {\n const rounded = roundToTwoDecimals(hours)\n\n if (rounded % 1 === 0) {\n return `${rounded}.0`\n }\n\n return rounded.toString()\n}\n\nconst getHoursInPayPeriod = (paySchedule: PayScheduleObject): number => {\n if (!paySchedule.frequency) {\n return 0\n }\n\n return PAY_PERIOD_HOURS_MAPPINGS[paySchedule.frequency] || 0\n}\n\nconst getEffectiveCompensation = (\n compensations: Compensation[],\n effectiveDate: Date,\n): Compensation | null => {\n if (!compensations.length) return null\n\n const sorted = [...compensations].sort(\n (a, b) =>\n (a.effectiveDate ? new Date(a.effectiveDate).getTime() : 0) -\n (b.effectiveDate ? new Date(b.effectiveDate).getTime() : 0),\n )\n\n for (let i = sorted.length - 1; i >= 0; i--) {\n const currentDateString = sorted[i]?.effectiveDate\n const currentDate = currentDateString ? new Date(currentDateString) : null\n if (currentDate && currentDate <= effectiveDate) {\n return sorted[i] || null\n }\n }\n\n return sorted[0] || null\n}\n\nconst getEffectiveMinimumWage = (\n minimumWages: MinimumWages[],\n effectiveDate: Date,\n): MinimumWages | null => {\n if (!minimumWages.length) return null\n\n const sorted = [...minimumWages].sort(\n (a, b) =>\n (a.effectiveDate ? new Date(a.effectiveDate).getTime() : 0) -\n (b.effectiveDate ? new Date(b.effectiveDate).getTime() : 0),\n )\n\n for (let i = sorted.length - 1; i >= 0; i--) {\n const currentDateString = sorted[i]?.effectiveDate\n const currentDate = currentDateString ? new Date(currentDateString) : null\n if (currentDate && currentDate <= effectiveDate) {\n return sorted[i] || null\n }\n }\n\n return sorted[0] || null\n}\n\nconst isSalaried = (compensation: Compensation): boolean => {\n return compensation.flsaStatus === 'Exempt' || compensation.flsaStatus === 'Salaried Nonexempt'\n}\n\nconst getTotalTipCompensations = (fixedCompensations: PayrollShowFixedCompensations[]): number => {\n if (!fixedCompensations.length) return 0\n\n return fixedCompensations\n .filter(fixedCompensation => {\n const name = fixedCompensation.name?.toLowerCase()\n const amount = parseFloat(fixedCompensation.amount || '0')\n return (name === 'paycheck tips' || name === 'cash tips') && amount > 0\n })\n .reduce((sum, fixedCompensation) => sum + parseFloat(fixedCompensation.amount || '0'), 0)\n}\n\nconst calculateHourlyRate = (compensation: Compensation): number => {\n const rate = parseFloat(compensation.rate || '0')\n const paymentUnit = compensation.paymentUnit || 'Hour'\n\n switch (paymentUnit) {\n case 'Hour':\n return rate\n case 'Year':\n return rate / 2080 // 52 weeks * 40 hours\n case 'Month':\n return rate / 173.333333\n case 'Week':\n return rate / 40\n case 'Paycheck':\n return 0 // Paycheck rate is 0 for hourly calculation\n default:\n return rate\n }\n}\n\nconst getHourlyRateForJob = (employee: Employee, jobUuid: string, effectiveDate: Date): number => {\n const job = employee.jobs?.find(j => j.uuid === jobUuid)\n if (!job?.compensations) {\n return 0\n }\n\n const compensation = getEffectiveCompensation(job.compensations, effectiveDate)\n return compensation ? calculateHourlyRate(compensation) : 0\n}\n\nconst getPrimaryHourlyRate = (employee: Employee, effectiveDate: Date): number => {\n const primaryJob = getPrimaryJob(employee)\n if (!primaryJob?.compensations) {\n return 0\n }\n\n const compensation = getEffectiveCompensation(primaryJob.compensations, effectiveDate)\n return compensation ? calculateHourlyRate(compensation) : 0\n}\n\nconst getTotalOutstandingPtoHours = (compensation: PayrollEmployeeCompensationsType): number => {\n if (!compensation.paidTimeOff) {\n return 0\n }\n\n return compensation.paidTimeOff.reduce(\n (sum, paidTimeOff) => sum + parseFloat(paidTimeOff.finalPayoutUnusedHoursInput || '0'),\n 0,\n )\n}\n\nconst getPtoHours = (\n compensation: PayrollEmployeeCompensationsType,\n isSalariedWithExpectedHours: boolean,\n hoursInPayPeriod: number,\n offCycle: boolean,\n): number => {\n const regularPtoHours = getTotalPtoHours(compensation)\n\n if (offCycle) {\n const outstandingPtoHours = getTotalOutstandingPtoHours(compensation)\n return regularPtoHours + outstandingPtoHours\n }\n\n if (isSalariedWithExpectedHours) {\n return Math.min(hoursInPayPeriod, regularPtoHours)\n }\n\n return regularPtoHours\n}\n\nconst calculateMinimumWageAdjustment = (\n primaryCompensation: Compensation,\n compensation: PayrollEmployeeCompensationsType,\n effectiveDate: Date,\n): number => {\n if (!primaryCompensation.adjustForMinimumWage) return 0\n\n const effectiveMinWage = getEffectiveMinimumWage(\n primaryCompensation.minimumWages || [],\n effectiveDate,\n )\n if (!effectiveMinWage) {\n return 0\n }\n\n const totalHours =\n compensation.hourlyCompensations?.reduce(\n (sum, hourlyCompensation) => sum + parseFloat(hourlyCompensation.hours || '0'),\n 0,\n ) || 0\n\n const hourlyRate = calculateHourlyRate(primaryCompensation)\n\n const totalTipCredit = (parseFloat(effectiveMinWage.wage || '0') - hourlyRate) * totalHours\n const totalTips = getTotalTipCompensations(compensation.fixedCompensations || [])\n\n return Math.max(0, totalTipCredit - totalTips)\n}\n\nconst calculateRegularPlusOvertimePay = (\n compensation: PayrollEmployeeCompensationsType,\n employee: Employee,\n effectiveDate: Date,\n isSalariedWithExpectedHours: boolean,\n hoursInPayPeriod: number,\n ptoHours: number,\n isOffCycle: boolean,\n): number => {\n if (!isOffCycle && isSalariedWithExpectedHours) {\n const primaryHourlyRate = getPrimaryHourlyRate(employee, effectiveDate)\n return primaryHourlyRate * (hoursInPayPeriod - ptoHours)\n }\n\n if (!compensation.hourlyCompensations || !employee.jobs) {\n return 0\n }\n\n const regularRatePay = compensation.hourlyCompensations.reduce((sum, hc) => {\n const hours = parseFloat(hc.hours || '0')\n const hourlyRate = getHourlyRateForJob(employee, hc.jobUuid || '', effectiveDate)\n return sum + hours * hourlyRate\n }, 0)\n\n const totalHours = compensation.hourlyCompensations.reduce((sum, hc) => {\n return sum + parseFloat(hc.hours || '0')\n }, 0)\n\n if (totalHours === 0) return regularRatePay\n\n const overtimeWeightedRate = roundToSixDecimals(regularRatePay / totalHours)\n\n // Calculate overtime pay for non-regular hours\n const overtimePay = compensation.hourlyCompensations\n .filter(hc => !isRegularHours(hc.name || ''))\n .reduce((sum, hc) => {\n const hours = parseFloat(hc.hours || '0')\n const multiplier = hc.compensationMultiplier || 1\n return sum + hours * overtimeWeightedRate * (multiplier - 1)\n }, 0)\n\n return regularRatePay + overtimePay\n}\n\nconst calculatePtoPay = (\n compensation: PayrollEmployeeCompensationsType,\n employee: Employee,\n effectiveDate: Date,\n isSalariedWithExpectedHours: boolean,\n hoursInPayPeriod: number,\n offCycle: boolean,\n): number => {\n const ptoHours = getPtoHours(\n compensation,\n isSalariedWithExpectedHours,\n hoursInPayPeriod,\n offCycle,\n )\n const primaryHourlyRate = getPrimaryHourlyRate(employee, effectiveDate)\n return ptoHours * primaryHourlyRate\n}\n\nconst isSalariedWithPayPeriodExpectedHours = (\n compensation: PayrollEmployeeCompensationsType,\n isSalaried: boolean,\n hoursInPayPeriod: number,\n): boolean => {\n if (!isSalaried) return false\n\n const regularHourlyCompensation = compensation.hourlyCompensations?.find(hourlyCompensation =>\n isRegularHours(hourlyCompensation.name || ''),\n )\n\n if (!regularHourlyCompensation) return false\n\n const regularHours = parseFloat(regularHourlyCompensation.hours || '0')\n return regularHours === hoursInPayPeriod\n}\n\nexport const calculateGrossPay = (\n compensation: PayrollEmployeeCompensationsType,\n employee: Employee,\n compensationEffectiveDateString?: string,\n paySchedule?: PayScheduleObject,\n isOffCycle: boolean = false,\n): number => {\n if (compensation.excluded) {\n return 0\n }\n\n const compensationEffectiveDate = compensationEffectiveDateString\n ? new Date(compensationEffectiveDateString)\n : new Date()\n\n const primaryJob = getPrimaryJob(employee)\n if (!primaryJob?.compensations) {\n return 0\n }\n\n const primaryCompensation = getEffectiveCompensation(\n primaryJob.compensations,\n compensationEffectiveDate,\n )\n\n if (!primaryCompensation) {\n return 0\n }\n\n const salaried = isSalaried(primaryCompensation)\n const hoursInPayPeriod = paySchedule ? getHoursInPayPeriod(paySchedule) : 0\n\n const isSalariedWithExpectedHours = isSalariedWithPayPeriodExpectedHours(\n compensation,\n salaried,\n hoursInPayPeriod,\n )\n\n const ptoHours = getPtoHours(\n compensation,\n isSalariedWithExpectedHours,\n hoursInPayPeriod,\n isOffCycle,\n )\n\n const regularPlusOvertimePay = calculateRegularPlusOvertimePay(\n compensation,\n employee,\n compensationEffectiveDate,\n isSalariedWithExpectedHours,\n hoursInPayPeriod,\n ptoHours,\n isOffCycle,\n )\n\n const fixedPay = getAdditionalEarnings(compensation)\n const ptoPay = calculatePtoPay(\n compensation,\n employee,\n compensationEffectiveDate,\n isSalariedWithExpectedHours,\n hoursInPayPeriod,\n isOffCycle,\n )\n const minimumWageAdjustment = calculateMinimumWageAdjustment(\n primaryCompensation,\n compensation,\n compensationEffectiveDate,\n )\n\n const total = regularPlusOvertimePay + fixedPay + ptoPay + minimumWageAdjustment\n return roundToTwoDecimals(total)\n}\n"],"names":["REGULAR_HOURS_NAME","getPrimaryJob","employee","job","roundToSixDecimals","value","roundToTwoDecimals","isRegularHours","compensationName","PAY_PERIOD_HOURS_MAPPINGS","formatEmployeePayRate","t","locale","primaryJob","jobCompensation","rate","paymentUnit","formatPayRate","useFormatEmployeePayRate","useTranslation","useLocale","useCallback","getRegularHours","compensation","hourlyCompensation","sum","getTotalPtoHours","pto","getAdditionalEarnings","fixedCompensation","name","amount","getReimbursements","reimbursementComp","formatHoursDisplay","hours","rounded","getHoursInPayPeriod","paySchedule","getEffectiveCompensation","compensations","effectiveDate","sorted","a","b","i","currentDateString","currentDate","getEffectiveMinimumWage","minimumWages","isSalaried","getTotalTipCompensations","fixedCompensations","calculateHourlyRate","getHourlyRateForJob","jobUuid","j","getPrimaryHourlyRate","getTotalOutstandingPtoHours","paidTimeOff","getPtoHours","isSalariedWithExpectedHours","hoursInPayPeriod","offCycle","regularPtoHours","outstandingPtoHours","calculateMinimumWageAdjustment","primaryCompensation","effectiveMinWage","totalHours","hourlyRate","totalTipCredit","totalTips","calculateRegularPlusOvertimePay","ptoHours","isOffCycle","regularRatePay","hc","overtimeWeightedRate","overtimePay","multiplier","calculatePtoPay","primaryHourlyRate","isSalariedWithPayPeriodExpectedHours","regularHourlyCompensation","calculateGrossPay","compensationEffectiveDateString","compensationEffectiveDate","salaried","regularPlusOvertim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GAGIc,IAAyBhB;AAAA,IAC7BlD;AAAA,IACArB;AAAA,IACAqF;AAAA,IACA1B;AAAA,IACAC;AAAA,IACAY;AAAA,IACAC;AAAA,EAAA,GAGIe,IAAW9D,EAAsBL,CAAY,GAC7CoE,IAASV;AAAA,IACb1D;AAAA,IACArB;AAAA,IACAqF;AAAA,IACA1B;AAAA,IACAC;AAAA,IACAa;AAAA,EAAA,GAEIiB,IAAwB1B;AAAA,IAC5BC;AAAA,IACA5C;AAAA,IACAgE;AAAA,EAAA,GAGIM,IAAQJ,IAAyBC,IAAWC,IAASC;AAC3D,SAAOtF,EAAmBuF,CAAK;AACjC;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PayrollPrepared } from '@gusto/embedded-api/models/components/payrollprepared';
|
|
2
|
+
import { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject';
|
|
3
|
+
interface UsePreparedPayrollDataParams {
|
|
4
|
+
companyId: string;
|
|
5
|
+
payrollId: string;
|
|
6
|
+
}
|
|
7
|
+
interface UsePreparedPayrollDataReturn {
|
|
8
|
+
handlePreparePayroll: () => Promise<void>;
|
|
9
|
+
preparedPayroll: PayrollPrepared | undefined;
|
|
10
|
+
paySchedule: PayScheduleObject | undefined;
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const usePreparedPayrollData: ({ companyId, payrollId, }: UsePreparedPayrollDataParams) => UsePreparedPayrollDataReturn;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useState as n, useCallback as P, useEffect as c } from "react";
|
|
2
|
+
import { usePayrollsPrepareMutation as y } from "@gusto/embedded-api/react-query/payrollsPrepare";
|
|
3
|
+
import { usePaySchedulesGet as h } from "@gusto/embedded-api/react-query/paySchedulesGet";
|
|
4
|
+
const m = ({
|
|
5
|
+
companyId: e,
|
|
6
|
+
payrollId: l
|
|
7
|
+
}) => {
|
|
8
|
+
const { mutateAsync: o, isPending: t } = y(), [a, s] = n(), { data: d, isLoading: u } = h(
|
|
9
|
+
{
|
|
10
|
+
companyId: e,
|
|
11
|
+
payScheduleId: a?.payPeriod?.payScheduleUuid || ""
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
enabled: !!a?.payPeriod?.payScheduleUuid
|
|
15
|
+
}
|
|
16
|
+
), r = P(async () => {
|
|
17
|
+
const p = await o({
|
|
18
|
+
request: {
|
|
19
|
+
companyId: e,
|
|
20
|
+
payrollId: l
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
s(p.payrollPrepared);
|
|
24
|
+
}, [e, l, o]);
|
|
25
|
+
c(() => {
|
|
26
|
+
r();
|
|
27
|
+
}, [r]);
|
|
28
|
+
const i = t || u;
|
|
29
|
+
return {
|
|
30
|
+
handlePreparePayroll: r,
|
|
31
|
+
preparedPayroll: a,
|
|
32
|
+
paySchedule: d?.payScheduleObject,
|
|
33
|
+
isLoading: i
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
m as usePreparedPayrollData
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=usePreparedPayrollData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePreparedPayrollData.js","sources":["../../../src/components/Payroll/usePreparedPayrollData.ts"],"sourcesContent":["import { useState, useEffect, useCallback } from 'react'\nimport { usePayrollsPrepareMutation } from '@gusto/embedded-api/react-query/payrollsPrepare'\nimport { usePaySchedulesGet } from '@gusto/embedded-api/react-query/paySchedulesGet'\nimport type { PayrollPrepared } from '@gusto/embedded-api/models/components/payrollprepared'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\n\ninterface UsePreparedPayrollDataParams {\n companyId: string\n payrollId: string\n}\n\ninterface UsePreparedPayrollDataReturn {\n handlePreparePayroll: () => Promise<void>\n preparedPayroll: PayrollPrepared | undefined\n paySchedule: PayScheduleObject | undefined\n isLoading: boolean\n}\n\nexport const usePreparedPayrollData = ({\n companyId,\n payrollId,\n}: UsePreparedPayrollDataParams): UsePreparedPayrollDataReturn => {\n const { mutateAsync: preparePayroll, isPending: isPreparePayrollPending } =\n usePayrollsPrepareMutation()\n const [preparedPayroll, setPreparedPayroll] = useState<PayrollPrepared | undefined>()\n\n const { data: payScheduleData, isLoading: isPayScheduleLoading } = usePaySchedulesGet(\n {\n companyId,\n payScheduleId: preparedPayroll?.payPeriod?.payScheduleUuid || '',\n },\n {\n enabled: Boolean(preparedPayroll?.payPeriod?.payScheduleUuid),\n },\n )\n\n const handlePreparePayroll = useCallback(async () => {\n const result = await preparePayroll({\n request: {\n companyId,\n payrollId,\n },\n })\n setPreparedPayroll(result.payrollPrepared)\n }, [companyId, payrollId, preparePayroll])\n\n useEffect(() => {\n void handlePreparePayroll()\n }, [handlePreparePayroll])\n\n const isLoading = isPreparePayrollPending || isPayScheduleLoading\n\n return {\n handlePreparePayroll,\n preparedPayroll,\n paySchedule: payScheduleData?.payScheduleObject,\n isLoading,\n }\n}\n"],"names":["usePreparedPayrollData","companyId","payrollId","preparePayroll","isPreparePayrollPending","usePayrollsPrepareMutation","preparedPayroll","setPreparedPayroll","useState","payScheduleData","isPayScheduleLoading","usePaySchedulesGet","handlePreparePayroll","useCallback","result","useEffect","isLoading"],"mappings":";;;AAkBO,MAAMA,IAAyB,CAAC;AAAA,EACrC,WAAAC;AAAA,EACA,WAAAC;AACF,MAAkE;AAChE,QAAM,EAAE,aAAaC,GAAgB,WAAWC,EAAA,IAC9CC,EAAA,GACI,CAACC,GAAiBC,CAAkB,IAAIC,EAAA,GAExC,EAAE,MAAMC,GAAiB,WAAWC,MAAyBC;AAAA,IACjE;AAAA,MACE,WAAAV;AAAA,MACA,eAAeK,GAAiB,WAAW,mBAAmB;AAAA,IAAA;AAAA,IAEhE;AAAA,MACE,SAAS,EAAQA,GAAiB,WAAW;AAAA,IAAe;AAAA,EAC9D,GAGIM,IAAuBC,EAAY,YAAY;AACnD,UAAMC,IAAS,MAAMX,EAAe;AAAA,MAClC,SAAS;AAAA,QACP,WAAAF;AAAA,QACA,WAAAC;AAAA,MAAA;AAAA,IACF,CACD;AACD,IAAAK,EAAmBO,EAAO,eAAe;AAAA,EAC3C,GAAG,CAACb,GAAWC,GAAWC,CAAc,CAAC;AAEzC,EAAAY,EAAU,MAAM;AACd,IAAKH,EAAA;AAAA,EACP,GAAG,CAACA,CAAoB,CAAC;AAEzB,QAAMI,IAAYZ,KAA2BM;AAE7C,SAAO;AAAA,IACL,sBAAAE;AAAA,IACA,iBAAAN;AAAA,IACA,aAAaG,GAAiB;AAAA,IAC9B,WAAAO;AAAA,EAAA;AAEJ;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import { QueryClient as p, QueryClientProvider as E } from "
|
|
3
|
-
import { GustoEmbeddedProvider as H } from "
|
|
4
|
-
import { GustoEmbeddedCore as b } from "
|
|
5
|
-
import { SDKHooks as R } from "
|
|
2
|
+
import { QueryClient as p, QueryClientProvider as E } from "@tanstack/react-query";
|
|
3
|
+
import { GustoEmbeddedProvider as H } from "@gusto/embedded-api/react-query/_context";
|
|
4
|
+
import { GustoEmbeddedCore as b } from "@gusto/embedded-api/core";
|
|
5
|
+
import { SDKHooks as R } from "@gusto/embedded-api/hooks/hooks";
|
|
6
6
|
import { useMemo as a } from "react";
|
|
7
7
|
function Q({ url: i, headers: s, hooks: e, children: u }) {
|
|
8
8
|
const d = a(() => {
|
|
@@ -5,51 +5,53 @@ import { CheckboxGroup as e } from "../../../components/Common/UI/CheckboxGroup/
|
|
|
5
5
|
import { ComboBox as i } from "../../../components/Common/UI/ComboBox/ComboBox.js";
|
|
6
6
|
import { Checkbox as p } from "../../../components/Common/UI/Checkbox/Checkbox.js";
|
|
7
7
|
import { DatePicker as f } from "../../../components/Common/UI/DatePicker/DatePicker.js";
|
|
8
|
-
import { Radio as
|
|
9
|
-
import { RadioGroup as
|
|
8
|
+
import { Radio as a } from "../../../components/Common/UI/Radio/Radio.js";
|
|
9
|
+
import { RadioGroup as n } from "../../../components/Common/UI/RadioGroup/RadioGroup.js";
|
|
10
10
|
import { Select as d } from "../../../components/Common/UI/Select/Select.js";
|
|
11
11
|
import { Switch as u } from "../../../components/Common/UI/Switch/Switch.js";
|
|
12
12
|
import { Button as c } from "../../../components/Common/UI/Button/Button.js";
|
|
13
|
-
import { ButtonIcon as
|
|
14
|
-
import { Alert as
|
|
15
|
-
import { Card as
|
|
16
|
-
import { Badge as
|
|
13
|
+
import { ButtonIcon as s } from "../../../components/Common/UI/Button/ButtonIcon.js";
|
|
14
|
+
import { Alert as b } from "../../../components/Common/UI/Alert/Alert.js";
|
|
15
|
+
import { Card as x } from "../../../components/Common/UI/Card/Card.js";
|
|
16
|
+
import { Badge as C } from "../../../components/Common/UI/Badge/Badge.js";
|
|
17
17
|
import { Link as B } from "../../../components/Common/UI/Link/Link.js";
|
|
18
18
|
import { Menu as l } from "../../../components/Common/UI/Menu/Menu.js";
|
|
19
19
|
import { Table as k } from "../../../components/Common/UI/Table/Table.js";
|
|
20
|
-
import { OrderedList as
|
|
21
|
-
import { UnorderedList as
|
|
22
|
-
import { Heading as
|
|
23
|
-
import { Text as
|
|
24
|
-
import { CalendarPreview as
|
|
25
|
-
import { ProgressBar as
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
import { OrderedList as T } from "../../../components/Common/UI/List/OrderedList.js";
|
|
21
|
+
import { UnorderedList as g } from "../../../components/Common/UI/List/UnorderedList.js";
|
|
22
|
+
import { Heading as h } from "../../../components/Common/UI/Heading/Heading.js";
|
|
23
|
+
import { Text as I } from "../../../components/Common/UI/Text/Text.js";
|
|
24
|
+
import { CalendarPreview as L } from "../../../components/Common/UI/CalendarPreview/CalendarPreview.js";
|
|
25
|
+
import { ProgressBar as P } from "../../../components/Common/UI/ProgressBar/ProgressBar.js";
|
|
26
|
+
import { Tabs as w } from "../../../components/Common/UI/Tabs/Tabs.js";
|
|
27
|
+
const $ = {
|
|
28
|
+
Alert: (o) => /* @__PURE__ */ r(b, { ...o }),
|
|
29
|
+
Badge: (o) => /* @__PURE__ */ r(C, { ...o }),
|
|
29
30
|
Button: (o) => /* @__PURE__ */ r(c, { ...o }),
|
|
30
|
-
ButtonIcon: (o) => /* @__PURE__ */ r(
|
|
31
|
-
Card: (o) => /* @__PURE__ */ r(
|
|
31
|
+
ButtonIcon: (o) => /* @__PURE__ */ r(s, { ...o }),
|
|
32
|
+
Card: (o) => /* @__PURE__ */ r(x, { ...o }),
|
|
32
33
|
TextInput: (o) => /* @__PURE__ */ r(t, { ...o }),
|
|
33
34
|
Checkbox: (o) => /* @__PURE__ */ r(p, { ...o }),
|
|
34
35
|
CheckboxGroup: (o) => /* @__PURE__ */ r(e, { ...o }),
|
|
35
36
|
ComboBox: (o) => /* @__PURE__ */ r(i, { ...o }),
|
|
36
37
|
DatePicker: (o) => /* @__PURE__ */ r(f, { ...o }),
|
|
37
|
-
OrderedList: (o) => /* @__PURE__ */ r(
|
|
38
|
-
UnorderedList: (o) => /* @__PURE__ */ r(
|
|
38
|
+
OrderedList: (o) => /* @__PURE__ */ r(T, { ...o }),
|
|
39
|
+
UnorderedList: (o) => /* @__PURE__ */ r(g, { ...o }),
|
|
39
40
|
NumberInput: (o) => /* @__PURE__ */ r(m, { ...o }),
|
|
40
|
-
Radio: (o) => /* @__PURE__ */ r(
|
|
41
|
-
RadioGroup: (o) => /* @__PURE__ */ r(
|
|
41
|
+
Radio: (o) => /* @__PURE__ */ r(a, { ...o }),
|
|
42
|
+
RadioGroup: (o) => /* @__PURE__ */ r(n, { ...o }),
|
|
42
43
|
Select: (o) => /* @__PURE__ */ r(d, { ...o }),
|
|
43
44
|
Switch: (o) => /* @__PURE__ */ r(u, { ...o }),
|
|
44
45
|
Link: (o) => /* @__PURE__ */ r(B, { ...o }),
|
|
45
46
|
Menu: (o) => /* @__PURE__ */ r(l, { ...o }),
|
|
46
47
|
Table: (o) => /* @__PURE__ */ r(k, { ...o }),
|
|
47
|
-
Heading: (o) => /* @__PURE__ */ r(
|
|
48
|
-
Text: (o) => /* @__PURE__ */ r(
|
|
49
|
-
CalendarPreview: (o) => /* @__PURE__ */ r(
|
|
50
|
-
ProgressBar: (o) => /* @__PURE__ */ r(
|
|
48
|
+
Heading: (o) => /* @__PURE__ */ r(h, { ...o }),
|
|
49
|
+
Text: (o) => /* @__PURE__ */ r(I, { ...o }),
|
|
50
|
+
CalendarPreview: (o) => /* @__PURE__ */ r(L, { ...o }),
|
|
51
|
+
ProgressBar: (o) => /* @__PURE__ */ r(P, { ...o }),
|
|
52
|
+
Tabs: (o) => /* @__PURE__ */ r(w, { ...o })
|
|
51
53
|
};
|
|
52
54
|
export {
|
|
53
|
-
|
|
55
|
+
$ as defaultComponents
|
|
54
56
|
};
|
|
55
57
|
//# sourceMappingURL=defaultComponentAdapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultComponentAdapter.js","sources":["../../../../src/contexts/ComponentAdapter/adapters/defaultComponentAdapter.tsx"],"sourcesContent":["// This is used to set the default adapter and can already be ommitted by using the\n// `GustoProviderCustomUIAdapter` component. That means this is a safe file to use\n// non type imports from the UI directory so the lint rule is disabled for this file.\n/* eslint-disable no-restricted-imports */\nimport type { ComponentsContextType } from '../useComponentContext'\nimport type { TextInputProps } from '@/components/Common/UI/TextInput/TextInputTypes'\nimport { TextInput } from '@/components/Common/UI/TextInput'\nimport type { NumberInputProps } from '@/components/Common/UI/NumberInput/NumberInputTypes'\nimport { NumberInput } from '@/components/Common/UI/NumberInput'\nimport type { CheckboxGroupProps } from '@/components/Common/UI/CheckboxGroup/CheckboxGroupTypes'\nimport { CheckboxGroup } from '@/components/Common/UI/CheckboxGroup'\nimport type { ComboBoxProps } from '@/components/Common/UI/ComboBox/ComboBoxTypes'\nimport { ComboBox } from '@/components/Common/UI/ComboBox/ComboBox'\nimport type { CheckboxProps } from '@/components/Common/UI/Checkbox/CheckboxTypes'\nimport { Checkbox } from '@/components/Common/UI/Checkbox'\nimport type { DatePickerProps } from '@/components/Common/UI/DatePicker/DatePickerTypes'\nimport { DatePicker } from '@/components/Common/UI/DatePicker'\nimport type { RadioProps } from '@/components/Common/UI/Radio/RadioTypes'\nimport { Radio } from '@/components/Common/UI/Radio'\nimport type { RadioGroupProps } from '@/components/Common/UI/RadioGroup/RadioGroupTypes'\nimport { RadioGroup } from '@/components/Common/UI/RadioGroup'\nimport type { SelectProps } from '@/components/Common/UI/Select/SelectTypes'\nimport { Select } from '@/components/Common/UI/Select'\nimport type { SwitchProps } from '@/components/Common/UI/Switch/SwitchTypes'\nimport { Switch } from '@/components/Common/UI/Switch'\nimport type { ButtonProps, ButtonIconProps } from '@/components/Common/UI/Button/ButtonTypes'\nimport { Button } from '@/components/Common/UI/Button'\nimport { ButtonIcon } from '@/components/Common/UI/Button/ButtonIcon'\nimport type { AlertProps } from '@/components/Common/UI/Alert/AlertTypes'\nimport { Alert } from '@/components/Common/UI/Alert/Alert'\nimport type { CardProps } from '@/components/Common/UI/Card/CardTypes'\nimport { Card } from '@/components/Common/UI/Card/Card'\nimport { Badge } from '@/components/Common/UI/Badge/Badge'\nimport type { BadgeProps } from '@/components/Common/UI/Badge/BadgeTypes'\nimport type { LinkProps } from '@/components/Common/UI/Link/LinkTypes'\nimport { Link } from '@/components/Common/UI/Link'\nimport type { MenuProps } from '@/components/Common/UI/Menu/MenuTypes'\nimport { Menu } from '@/components/Common/UI/Menu'\nimport type { TableProps } from '@/components/Common/UI/Table'\nimport { Table } from '@/components/Common/UI/Table'\nimport type { OrderedListProps, UnorderedListProps } from '@/components/Common/UI/List'\nimport { OrderedList, UnorderedList } from '@/components/Common/UI/List'\nimport { Heading } from '@/components/Common/UI/Heading'\nimport type { HeadingProps } from '@/components/Common/UI/Heading/HeadingTypes'\nimport { Text } from '@/components/Common/UI/Text'\nimport type { TextProps } from '@/components/Common/UI/Text/TextTypes'\nimport { CalendarPreview } from '@/components/Common/UI/CalendarPreview'\nimport type { CalendarPreviewProps } from '@/components/Common/UI/CalendarPreview/CalendarPreviewTypes'\nimport type { ProgressBarProps } from '@/components/Common/UI/ProgressBar'\nimport { ProgressBar } from '@/components/Common/UI/ProgressBar'\n\nexport const defaultComponents: ComponentsContextType = {\n Alert: (props: AlertProps) => <Alert {...props} />,\n Badge: (props: BadgeProps) => <Badge {...props} />,\n Button: (props: ButtonProps) => <Button {...props} />,\n ButtonIcon: (props: ButtonIconProps) => <ButtonIcon {...props} />,\n Card: (props: CardProps) => <Card {...props} />,\n TextInput: (props: TextInputProps) => <TextInput {...props} />,\n Checkbox: (props: CheckboxProps) => <Checkbox {...props} />,\n CheckboxGroup: (props: CheckboxGroupProps) => <CheckboxGroup {...props} />,\n ComboBox: (props: ComboBoxProps) => <ComboBox {...props} />,\n DatePicker: (props: DatePickerProps) => <DatePicker {...props} />,\n OrderedList: (props: OrderedListProps) => <OrderedList {...props} />,\n UnorderedList: (props: UnorderedListProps) => <UnorderedList {...props} />,\n NumberInput: (props: NumberInputProps) => <NumberInput {...props} />,\n Radio: (props: RadioProps) => <Radio {...props} />,\n RadioGroup: (props: RadioGroupProps) => <RadioGroup {...props} />,\n Select: (props: SelectProps) => <Select {...props} />,\n Switch: (props: SwitchProps) => <Switch {...props} />,\n Link: (props: LinkProps) => <Link {...props} />,\n Menu: (props: MenuProps) => <Menu {...props} />,\n Table: (props: TableProps) => <Table {...props} />,\n Heading: (props: HeadingProps) => <Heading {...props} />,\n Text: (props: TextProps) => <Text {...props} />,\n CalendarPreview: (props: CalendarPreviewProps) => <CalendarPreview {...props} />,\n ProgressBar: (props: ProgressBarProps) => <ProgressBar {...props} />,\n}\n"],"names":["defaultComponents","props","jsx","Alert","Badge","Button","ButtonIcon","Card","TextInput","Checkbox","CheckboxGroup","ComboBox","DatePicker","OrderedList","UnorderedList","NumberInput","Radio","RadioGroup","Select","Switch","Link","Menu","Table","Heading","Text","CalendarPreview","ProgressBar"],"mappings":"
|
|
1
|
+
{"version":3,"file":"defaultComponentAdapter.js","sources":["../../../../src/contexts/ComponentAdapter/adapters/defaultComponentAdapter.tsx"],"sourcesContent":["// This is used to set the default adapter and can already be ommitted by using the\n// `GustoProviderCustomUIAdapter` component. That means this is a safe file to use\n// non type imports from the UI directory so the lint rule is disabled for this file.\n/* eslint-disable no-restricted-imports */\nimport type { ComponentsContextType } from '../useComponentContext'\nimport type { TextInputProps } from '@/components/Common/UI/TextInput/TextInputTypes'\nimport { TextInput } from '@/components/Common/UI/TextInput'\nimport type { NumberInputProps } from '@/components/Common/UI/NumberInput/NumberInputTypes'\nimport { NumberInput } from '@/components/Common/UI/NumberInput'\nimport type { CheckboxGroupProps } from '@/components/Common/UI/CheckboxGroup/CheckboxGroupTypes'\nimport { CheckboxGroup } from '@/components/Common/UI/CheckboxGroup'\nimport type { ComboBoxProps } from '@/components/Common/UI/ComboBox/ComboBoxTypes'\nimport { ComboBox } from '@/components/Common/UI/ComboBox/ComboBox'\nimport type { CheckboxProps } from '@/components/Common/UI/Checkbox/CheckboxTypes'\nimport { Checkbox } from '@/components/Common/UI/Checkbox'\nimport type { DatePickerProps } from '@/components/Common/UI/DatePicker/DatePickerTypes'\nimport { DatePicker } from '@/components/Common/UI/DatePicker'\nimport type { RadioProps } from '@/components/Common/UI/Radio/RadioTypes'\nimport { Radio } from '@/components/Common/UI/Radio'\nimport type { RadioGroupProps } from '@/components/Common/UI/RadioGroup/RadioGroupTypes'\nimport { RadioGroup } from '@/components/Common/UI/RadioGroup'\nimport type { SelectProps } from '@/components/Common/UI/Select/SelectTypes'\nimport { Select } from '@/components/Common/UI/Select'\nimport type { SwitchProps } from '@/components/Common/UI/Switch/SwitchTypes'\nimport { Switch } from '@/components/Common/UI/Switch'\nimport type { ButtonProps, ButtonIconProps } from '@/components/Common/UI/Button/ButtonTypes'\nimport { Button } from '@/components/Common/UI/Button'\nimport { ButtonIcon } from '@/components/Common/UI/Button/ButtonIcon'\nimport type { AlertProps } from '@/components/Common/UI/Alert/AlertTypes'\nimport { Alert } from '@/components/Common/UI/Alert/Alert'\nimport type { CardProps } from '@/components/Common/UI/Card/CardTypes'\nimport { Card } from '@/components/Common/UI/Card/Card'\nimport { Badge } from '@/components/Common/UI/Badge/Badge'\nimport type { BadgeProps } from '@/components/Common/UI/Badge/BadgeTypes'\nimport type { LinkProps } from '@/components/Common/UI/Link/LinkTypes'\nimport { Link } from '@/components/Common/UI/Link'\nimport type { MenuProps } from '@/components/Common/UI/Menu/MenuTypes'\nimport { Menu } from '@/components/Common/UI/Menu'\nimport type { TableProps } from '@/components/Common/UI/Table'\nimport { Table } from '@/components/Common/UI/Table'\nimport type { OrderedListProps, UnorderedListProps } from '@/components/Common/UI/List'\nimport { OrderedList, UnorderedList } from '@/components/Common/UI/List'\nimport { Heading } from '@/components/Common/UI/Heading'\nimport type { HeadingProps } from '@/components/Common/UI/Heading/HeadingTypes'\nimport { Text } from '@/components/Common/UI/Text'\nimport type { TextProps } from '@/components/Common/UI/Text/TextTypes'\nimport { CalendarPreview } from '@/components/Common/UI/CalendarPreview'\nimport type { CalendarPreviewProps } from '@/components/Common/UI/CalendarPreview/CalendarPreviewTypes'\nimport type { ProgressBarProps } from '@/components/Common/UI/ProgressBar'\nimport { ProgressBar } from '@/components/Common/UI/ProgressBar'\nimport type { TabsProps } from '@/components/Common/UI/Tabs/TabsTypes'\nimport { Tabs } from '@/components/Common/UI/Tabs'\n\nexport const defaultComponents: ComponentsContextType = {\n Alert: (props: AlertProps) => <Alert {...props} />,\n Badge: (props: BadgeProps) => <Badge {...props} />,\n Button: (props: ButtonProps) => <Button {...props} />,\n ButtonIcon: (props: ButtonIconProps) => <ButtonIcon {...props} />,\n Card: (props: CardProps) => <Card {...props} />,\n TextInput: (props: TextInputProps) => <TextInput {...props} />,\n Checkbox: (props: CheckboxProps) => <Checkbox {...props} />,\n CheckboxGroup: (props: CheckboxGroupProps) => <CheckboxGroup {...props} />,\n ComboBox: (props: ComboBoxProps) => <ComboBox {...props} />,\n DatePicker: (props: DatePickerProps) => <DatePicker {...props} />,\n OrderedList: (props: OrderedListProps) => <OrderedList {...props} />,\n UnorderedList: (props: UnorderedListProps) => <UnorderedList {...props} />,\n NumberInput: (props: NumberInputProps) => <NumberInput {...props} />,\n Radio: (props: RadioProps) => <Radio {...props} />,\n RadioGroup: (props: RadioGroupProps) => <RadioGroup {...props} />,\n Select: (props: SelectProps) => <Select {...props} />,\n Switch: (props: SwitchProps) => <Switch {...props} />,\n Link: (props: LinkProps) => <Link {...props} />,\n Menu: (props: MenuProps) => <Menu {...props} />,\n Table: (props: TableProps) => <Table {...props} />,\n Heading: (props: HeadingProps) => <Heading {...props} />,\n Text: (props: TextProps) => <Text {...props} />,\n CalendarPreview: (props: CalendarPreviewProps) => <CalendarPreview {...props} />,\n ProgressBar: (props: ProgressBarProps) => <ProgressBar {...props} />,\n Tabs: (props: TabsProps) => <Tabs {...props} />,\n}\n"],"names":["defaultComponents","props","jsx","Alert","Badge","Button","ButtonIcon","Card","TextInput","Checkbox","CheckboxGroup","ComboBox","DatePicker","OrderedList","UnorderedList","NumberInput","Radio","RadioGroup","Select","Switch","Link","Menu","Table","Heading","Text","CalendarPreview","ProgressBar","Tabs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAqDO,MAAMA,IAA2C;AAAA,EACtD,OAAO,CAACC,MAAsB,gBAAAC,EAACC,GAAA,EAAO,GAAGF,GAAO;AAAA,EAChD,OAAO,CAACA,MAAsB,gBAAAC,EAACE,GAAA,EAAO,GAAGH,GAAO;AAAA,EAChD,QAAQ,CAACA,MAAuB,gBAAAC,EAACG,GAAA,EAAQ,GAAGJ,GAAO;AAAA,EACnD,YAAY,CAACA,MAA2B,gBAAAC,EAACI,GAAA,EAAY,GAAGL,GAAO;AAAA,EAC/D,MAAM,CAACA,MAAqB,gBAAAC,EAACK,GAAA,EAAM,GAAGN,GAAO;AAAA,EAC7C,WAAW,CAACA,MAA0B,gBAAAC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C,gBAAAC,EAACuB,GAAA,EAAiB,GAAGxB,GAAO;AAAA,EAC9E,aAAa,CAACA,MAA4B,gBAAAC,EAACwB,GAAA,EAAa,GAAGzB,GAAO;AAAA,EAClE,MAAM,CAACA,MAAqB,gBAAAC,EAACyB,GAAA,EAAM,GAAG1B,EAAA,CAAO;AAC/C;"}
|
|
@@ -22,6 +22,7 @@ import { PaginationControlProps } from '../../components/Common/PaginationContro
|
|
|
22
22
|
import { TextProps } from '../../components/Common/UI/Text/TextTypes';
|
|
23
23
|
import { CalendarPreviewProps } from '../../components/Common/UI/CalendarPreview/CalendarPreviewTypes';
|
|
24
24
|
import { ProgressBarProps } from '../../components/Common/UI/ProgressBar/ProgressBarTypes';
|
|
25
|
+
import { TabsProps } from '../../components/Common/UI/Tabs/TabsTypes';
|
|
25
26
|
export interface ComponentsContextType {
|
|
26
27
|
Alert: (props: AlertProps) => JSX.Element | null;
|
|
27
28
|
Badge: (props: BadgeProps) => JSX.Element | null;
|
|
@@ -48,6 +49,7 @@ export interface ComponentsContextType {
|
|
|
48
49
|
Text: (props: TextProps) => JSX.Element | null;
|
|
49
50
|
CalendarPreview: (props: CalendarPreviewProps) => JSX.Element | null;
|
|
50
51
|
ProgressBar: (props: ProgressBarProps) => JSX.Element | null;
|
|
52
|
+
Tabs: (props: TabsProps) => JSX.Element | null;
|
|
51
53
|
}
|
|
52
54
|
export declare const ComponentsContext: import('react').Context<ComponentsContextType | null>;
|
|
53
55
|
export declare const useComponentContext: () => ComponentsContextType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useComponentContext.js","sources":["../../../src/contexts/ComponentAdapter/useComponentContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { JSX } from 'react'\nimport type { TextInputProps } from '@/components/Common/UI/TextInput/TextInputTypes'\nimport type { NumberInputProps } from '@/components/Common/UI/NumberInput/NumberInputTypes'\nimport type { CheckboxGroupProps } from '@/components/Common/UI/CheckboxGroup/CheckboxGroupTypes'\nimport type { ComboBoxProps } from '@/components/Common/UI/ComboBox/ComboBoxTypes'\nimport type { CheckboxProps } from '@/components/Common/UI/Checkbox/CheckboxTypes'\nimport type { DatePickerProps } from '@/components/Common/UI/DatePicker/DatePickerTypes'\nimport type { RadioProps } from '@/components/Common/UI/Radio/RadioTypes'\nimport type { RadioGroupProps } from '@/components/Common/UI/RadioGroup/RadioGroupTypes'\nimport type { SelectProps } from '@/components/Common/UI/Select/SelectTypes'\nimport type { SwitchProps } from '@/components/Common/UI/Switch/SwitchTypes'\nimport type { ButtonIconProps, ButtonProps } from '@/components/Common/UI/Button/ButtonTypes'\nimport type { AlertProps } from '@/components/Common/UI/Alert/AlertTypes'\nimport type { CardProps } from '@/components/Common/UI/Card/CardTypes'\nimport type { LinkProps } from '@/components/Common/UI/Link/LinkTypes'\nimport type { BadgeProps } from '@/components/Common/UI/Badge/BadgeTypes'\nimport type { MenuProps } from '@/components/Common/UI/Menu/MenuTypes'\nimport type { TableProps } from '@/components/Common/UI/Table/TableTypes'\nimport type { OrderedListProps, UnorderedListProps } from '@/components/Common/UI/List/ListTypes'\nimport type { HeadingProps } from '@/components/Common/UI/Heading/HeadingTypes'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport type { TextProps } from '@/components/Common/UI/Text/TextTypes'\nimport type { CalendarPreviewProps } from '@/components/Common/UI/CalendarPreview/CalendarPreviewTypes'\nimport type { ProgressBarProps } from '@/components/Common/UI/ProgressBar/ProgressBarTypes'\n\nexport interface ComponentsContextType {\n Alert: (props: AlertProps) => JSX.Element | null\n Badge: (props: BadgeProps) => JSX.Element | null\n Button: (props: ButtonProps) => JSX.Element | null\n ButtonIcon: (props: ButtonIconProps) => JSX.Element | null\n Card: (props: CardProps) => JSX.Element | null\n Checkbox: (props: CheckboxProps) => JSX.Element | null\n CheckboxGroup: (props: CheckboxGroupProps) => JSX.Element | null\n ComboBox: (props: ComboBoxProps) => JSX.Element | null\n DatePicker: (props: DatePickerProps) => JSX.Element | null\n OrderedList: (props: OrderedListProps) => JSX.Element | null\n UnorderedList: (props: UnorderedListProps) => JSX.Element | null\n NumberInput: (props: NumberInputProps) => JSX.Element | null\n Radio: (props: RadioProps) => JSX.Element | null\n RadioGroup: (props: RadioGroupProps) => JSX.Element | null\n Select: (props: SelectProps) => JSX.Element | null\n Switch: (props: SwitchProps) => JSX.Element | null\n TextInput: (props: TextInputProps) => JSX.Element | null\n Link: (props: LinkProps) => JSX.Element | null\n Menu: (props: MenuProps) => JSX.Element | null\n Table: (props: TableProps) => JSX.Element | null\n Heading: (props: HeadingProps) => JSX.Element | null\n PaginationControl?: (props: PaginationControlProps) => JSX.Element | null\n Text: (props: TextProps) => JSX.Element | null\n CalendarPreview: (props: CalendarPreviewProps) => JSX.Element | null\n ProgressBar: (props: ProgressBarProps) => JSX.Element | null\n}\n\nexport const ComponentsContext = createContext<ComponentsContextType | null>(null)\n\nexport const useComponentContext = () => {\n const context = useContext(ComponentsContext)\n if (!context) {\n throw new Error('useComponentContext must be used within a ComponentsProvider')\n }\n return context\n}\n"],"names":["ComponentsContext","createContext","useComponentContext","context","useContext"],"mappings":";
|
|
1
|
+
{"version":3,"file":"useComponentContext.js","sources":["../../../src/contexts/ComponentAdapter/useComponentContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { JSX } from 'react'\nimport type { TextInputProps } from '@/components/Common/UI/TextInput/TextInputTypes'\nimport type { NumberInputProps } from '@/components/Common/UI/NumberInput/NumberInputTypes'\nimport type { CheckboxGroupProps } from '@/components/Common/UI/CheckboxGroup/CheckboxGroupTypes'\nimport type { ComboBoxProps } from '@/components/Common/UI/ComboBox/ComboBoxTypes'\nimport type { CheckboxProps } from '@/components/Common/UI/Checkbox/CheckboxTypes'\nimport type { DatePickerProps } from '@/components/Common/UI/DatePicker/DatePickerTypes'\nimport type { RadioProps } from '@/components/Common/UI/Radio/RadioTypes'\nimport type { RadioGroupProps } from '@/components/Common/UI/RadioGroup/RadioGroupTypes'\nimport type { SelectProps } from '@/components/Common/UI/Select/SelectTypes'\nimport type { SwitchProps } from '@/components/Common/UI/Switch/SwitchTypes'\nimport type { ButtonIconProps, ButtonProps } from '@/components/Common/UI/Button/ButtonTypes'\nimport type { AlertProps } from '@/components/Common/UI/Alert/AlertTypes'\nimport type { CardProps } from '@/components/Common/UI/Card/CardTypes'\nimport type { LinkProps } from '@/components/Common/UI/Link/LinkTypes'\nimport type { BadgeProps } from '@/components/Common/UI/Badge/BadgeTypes'\nimport type { MenuProps } from '@/components/Common/UI/Menu/MenuTypes'\nimport type { TableProps } from '@/components/Common/UI/Table/TableTypes'\nimport type { OrderedListProps, UnorderedListProps } from '@/components/Common/UI/List/ListTypes'\nimport type { HeadingProps } from '@/components/Common/UI/Heading/HeadingTypes'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport type { TextProps } from '@/components/Common/UI/Text/TextTypes'\nimport type { CalendarPreviewProps } from '@/components/Common/UI/CalendarPreview/CalendarPreviewTypes'\nimport type { ProgressBarProps } from '@/components/Common/UI/ProgressBar/ProgressBarTypes'\nimport type { TabsProps } from '@/components/Common/UI/Tabs/TabsTypes'\n\nexport interface ComponentsContextType {\n Alert: (props: AlertProps) => JSX.Element | null\n Badge: (props: BadgeProps) => JSX.Element | null\n Button: (props: ButtonProps) => JSX.Element | null\n ButtonIcon: (props: ButtonIconProps) => JSX.Element | null\n Card: (props: CardProps) => JSX.Element | null\n Checkbox: (props: CheckboxProps) => JSX.Element | null\n CheckboxGroup: (props: CheckboxGroupProps) => JSX.Element | null\n ComboBox: (props: ComboBoxProps) => JSX.Element | null\n DatePicker: (props: DatePickerProps) => JSX.Element | null\n OrderedList: (props: OrderedListProps) => JSX.Element | null\n UnorderedList: (props: UnorderedListProps) => JSX.Element | null\n NumberInput: (props: NumberInputProps) => JSX.Element | null\n Radio: (props: RadioProps) => JSX.Element | null\n RadioGroup: (props: RadioGroupProps) => JSX.Element | null\n Select: (props: SelectProps) => JSX.Element | null\n Switch: (props: SwitchProps) => JSX.Element | null\n TextInput: (props: TextInputProps) => JSX.Element | null\n Link: (props: LinkProps) => JSX.Element | null\n Menu: (props: MenuProps) => JSX.Element | null\n Table: (props: TableProps) => JSX.Element | null\n Heading: (props: HeadingProps) => JSX.Element | null\n PaginationControl?: (props: PaginationControlProps) => JSX.Element | null\n Text: (props: TextProps) => JSX.Element | null\n CalendarPreview: (props: CalendarPreviewProps) => JSX.Element | null\n ProgressBar: (props: ProgressBarProps) => JSX.Element | null\n Tabs: (props: TabsProps) => JSX.Element | null\n}\n\nexport const ComponentsContext = createContext<ComponentsContextType | null>(null)\n\nexport const useComponentContext = () => {\n const context = useContext(ComponentsContext)\n if (!context) {\n throw new Error('useComponentContext must be used within a ComponentsProvider')\n }\n return context\n}\n"],"names":["ComponentsContext","createContext","useComponentContext","context","useContext"],"mappings":";AAwDO,MAAMA,IAAoBC,EAA4C,IAAI,GAEpEC,IAAsB,MAAM;AACvC,QAAMC,IAAUC,EAAWJ,CAAiB;AAC5C,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,8DAA8D;AAEhF,SAAOA;AACT;"}
|
|
@@ -10,8 +10,9 @@ import "classnames";
|
|
|
10
10
|
import "../../shared/constants.js";
|
|
11
11
|
import { InternalError as y } from "../../components/Common/InternalError/InternalError.js";
|
|
12
12
|
import { LocaleProvider as C } from "../LocaleProvider/LocaleProvider.js";
|
|
13
|
+
import "../LocaleProvider/useLocale.js";
|
|
13
14
|
import { ThemeProvider as L } from "../ThemeProvider/ThemeProvider.js";
|
|
14
|
-
const
|
|
15
|
+
const T = (a) => {
|
|
15
16
|
const {
|
|
16
17
|
children: d,
|
|
17
18
|
config: e,
|
|
@@ -40,6 +41,6 @@ const R = (a) => {
|
|
|
40
41
|
}, [n]), /* @__PURE__ */ r(P, { value: s, children: /* @__PURE__ */ r(x, { value: f, children: /* @__PURE__ */ r(h, { FallbackComponent: y, children: /* @__PURE__ */ r(L, { theme: p, children: /* @__PURE__ */ r(C, { locale: c, currency: l, children: /* @__PURE__ */ r(v, { i18n: t, children: /* @__PURE__ */ r(I, { url: e.baseUrl, headers: e.headers, hooks: e.hooks, children: d }) }, n) }) }) }) }) });
|
|
41
42
|
};
|
|
42
43
|
export {
|
|
43
|
-
|
|
44
|
+
T as GustoProviderCustomUIAdapter
|
|
44
45
|
};
|
|
45
46
|
//# sourceMappingURL=GustoProviderCustomUIAdapter.js.map
|