@gusto/embedded-react-sdk 0.8.2 → 0.9.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.
Files changed (100) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/components/Common/DataView/DataCards/DataCards.js +21 -21
  3. package/dist/components/Common/DataView/DataCards/DataCards.js.map +1 -1
  4. package/dist/components/Common/UI/ComboBox/ComboBox.js +28 -27
  5. package/dist/components/Common/UI/ComboBox/ComboBox.js.map +1 -1
  6. package/dist/components/Common/UI/ComboBox/ComboBox.module.scss.js +6 -6
  7. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +5 -3
  8. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  9. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +5 -3
  10. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  11. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +7 -5
  12. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  13. package/dist/components/Company/BankAccount/BankAccountForm/context.js +5 -3
  14. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  15. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +5 -3
  16. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  17. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +5 -3
  18. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  19. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +13 -11
  20. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  21. package/dist/components/Company/Industry/Context.js +8 -6
  22. package/dist/components/Company/Industry/Context.js.map +1 -1
  23. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +5 -3
  24. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  25. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +5 -3
  26. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  27. package/dist/components/Company/OnboardingOverview/context.js +5 -3
  28. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  29. package/dist/components/Company/PaySchedule/usePaySchedule.js +7 -5
  30. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  31. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +10 -10
  32. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  33. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js +1 -1
  34. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js.map +1 -1
  35. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +29 -29
  36. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  37. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +5 -3
  38. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  39. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +5 -3
  40. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  41. package/dist/components/Contractor/Address/Actions.d.ts +1 -0
  42. package/dist/components/Contractor/Address/Actions.js +13 -0
  43. package/dist/components/Contractor/Address/Actions.js.map +1 -0
  44. package/dist/components/Contractor/Address/Address.d.ts +16 -0
  45. package/dist/components/Contractor/Address/Address.js +74 -0
  46. package/dist/components/Contractor/Address/Address.js.map +1 -0
  47. package/dist/components/Contractor/Address/Form.d.ts +1 -0
  48. package/dist/components/Contractor/Address/Form.js +57 -0
  49. package/dist/components/Contractor/Address/Form.js.map +1 -0
  50. package/dist/components/Contractor/Address/Head.d.ts +1 -0
  51. package/dist/components/Contractor/Address/Head.js +15 -0
  52. package/dist/components/Contractor/Address/Head.js.map +1 -0
  53. package/dist/components/Contractor/Address/index.d.ts +2 -0
  54. package/dist/components/Contractor/Address/useAddress.d.ts +33 -0
  55. package/dist/components/Contractor/Address/useAddress.js +28 -0
  56. package/dist/components/Contractor/Address/useAddress.js.map +1 -0
  57. package/dist/components/Contractor/index.d.ts +2 -0
  58. package/dist/components/Contractor/index.js +5 -0
  59. package/dist/components/Contractor/index.js.map +1 -0
  60. package/dist/components/Employee/Compensation/Compensation.js +1 -1
  61. package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
  62. package/dist/components/Employee/Deductions/useDeductions.js +8 -6
  63. package/dist/components/Employee/Deductions/useDeductions.js.map +1 -1
  64. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +5 -3
  65. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  66. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +5 -3
  67. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  68. package/dist/components/Employee/EmployeeList/EmployeeList.js +1 -1
  69. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  70. package/dist/components/Employee/EmployeeList/List.js +9 -9
  71. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  72. package/dist/components/Employee/EmployeeList/useEmployeeList.d.ts +2 -1
  73. package/dist/components/Employee/EmployeeList/useEmployeeList.js +5 -3
  74. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  75. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +10 -8
  76. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  77. package/dist/components/Employee/Profile/Profile.js +92 -88
  78. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  79. package/dist/components/Employee/Profile/useProfile.js +5 -3
  80. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  81. package/dist/components/Employee/Taxes/StateForm.js +1 -1
  82. package/dist/components/Employee/Taxes/StateForm.js.map +1 -1
  83. package/dist/components/Employee/Taxes/Taxes.js +78 -75
  84. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  85. package/dist/components/Employee/Taxes/useTaxes.d.ts +2 -2
  86. package/dist/components/Employee/Taxes/useTaxes.js +5 -3
  87. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  88. package/dist/components/index.d.ts +1 -0
  89. package/dist/i18n/I18n.js +11 -11
  90. package/dist/i18n/I18n.js.map +1 -1
  91. package/dist/i18n/en/Contractor.Address.json.js +35 -0
  92. package/dist/i18n/en/Contractor.Address.json.js.map +1 -0
  93. package/dist/index.js +9 -7
  94. package/dist/index.js.map +1 -1
  95. package/dist/shared/constants.d.ts +6 -0
  96. package/dist/shared/constants.js +51 -45
  97. package/dist/shared/constants.js.map +1 -1
  98. package/dist/style.css +1 -1
  99. package/dist/types/i18next.d.ts +20 -1
  100. package/package.json +5 -2
@@ -7,9 +7,11 @@ import "@gusto/embedded-api/models/errors/apierror";
7
7
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
8
8
  import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
9
9
  import "../../Base/useBase.js";
10
+ import "../../../shared/constants.js";
10
11
  import "dompurify";
12
+ import "../../../contexts/ComponentAdapter/useComponentContext.js";
11
13
  import { createCompoundContext as e } from "../../Base/createCompoundContext.js";
12
- const l = o.object({
14
+ const P = o.object({
13
15
  frequency: o.enum(["Every week", "Every other week", "Twice per month", "Monthly"]),
14
16
  anchorPayDate: o.date().optional(),
15
17
  anchorEndOfPayPeriod: o.date().optional(),
@@ -18,10 +20,10 @@ const l = o.object({
18
20
  customName: o.string().optional(),
19
21
  customTwicePerMonth: o.string().optional(),
20
22
  payPeriodPreviewRange: o.number().optional()
21
- }), [h, P] = e("PayScheduleContext");
23
+ }), [s, w] = e("PayScheduleContext");
22
24
  export {
23
- P as PayScheduleProvider,
24
- l as PayScheduleSchema,
25
- h as usePaySchedule
25
+ w as PayScheduleProvider,
26
+ P as PayScheduleSchema,
27
+ s as usePaySchedule
26
28
  };
27
29
  //# sourceMappingURL=usePaySchedule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePaySchedule.js","sources":["../../../../src/components/Company/PaySchedule/usePaySchedule.ts"],"sourcesContent":["import type { PayScheduleCreateUpdate } from '@gusto/embedded-api/models/components/payschedulecreateupdate'\nimport type { PayScheduleList } from '@gusto/embedded-api/models/components/payschedulelist'\nimport type { PayScheduleObject as PayScheduleType } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { PayPeriods } from '@gusto/embedded-api/models/operations/getv1companiescompanyidpayschedulespreview'\nimport { z } from 'zod'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\nimport { createCompoundContext } from '@/components/Base'\n\nexport type MODE =\n | 'LIST_PAY_SCHEDULES'\n | 'ADD_PAY_SCHEDULE'\n | 'EDIT_PAY_SCHEDULE'\n | 'PREVIEW_PAY_SCHEDULE'\n\ntype PayScheduleContextType = {\n companyId: string\n handleAdd: () => void\n handleEdit: (schedule: PayScheduleType) => void\n handleCancel: () => void\n handleContinue: () => void\n mode: MODE\n paySchedules: PayScheduleList[] | undefined | null\n currentPaySchedule: PayScheduleType | undefined | null\n payPeriodPreview?: PayPeriods[]\n payPreviewLoading?: boolean\n}\n\nexport const PayScheduleSchema = z.object({\n frequency: z.enum(['Every week', 'Every other week', 'Twice per month', 'Monthly']),\n anchorPayDate: z.date().optional(),\n anchorEndOfPayPeriod: z.date().optional(),\n day1: z.number().min(1).max(31).optional(),\n day2: z.number().min(1).max(31).optional(),\n customName: z.string().optional(),\n customTwicePerMonth: z.string().optional(),\n payPeriodPreviewRange: z.number().optional(),\n})\n\nexport type PayScheduleInputs = z.input<typeof PayScheduleSchema>\nexport type PayScheduleOutputs = z.output<typeof PayScheduleSchema>\n\nexport type PayScheduleDefaultValues = RequireAtLeastOne<\n Partial<\n Pick<\n PayScheduleCreateUpdate,\n 'anchorPayDate' | 'anchorEndOfPayPeriod' | 'day1' | 'day2' | 'customName' | 'frequency'\n >\n >\n>\n\nconst [usePaySchedule, PayScheduleProvider] =\n createCompoundContext<PayScheduleContextType>('PayScheduleContext')\nexport { usePaySchedule, PayScheduleProvider }\n"],"names":["PayScheduleSchema","z","usePaySchedule","PayScheduleProvider","createCompoundContext"],"mappings":";;;;;;;;;;;AA2Ba,MAAAA,IAAoBC,EAAE,OAAO;AAAA,EACxC,WAAWA,EAAE,KAAK,CAAC,cAAc,oBAAoB,mBAAmB,SAAS,CAAC;AAAA,EAClF,eAAeA,EAAE,KAAK,EAAE,SAAS;AAAA,EACjC,sBAAsBA,EAAE,KAAK,EAAE,SAAS;AAAA,EACxC,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EACzC,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EACzC,YAAYA,EAAE,OAAO,EAAE,SAAS;AAAA,EAChC,qBAAqBA,EAAE,OAAO,EAAE,SAAS;AAAA,EACzC,uBAAuBA,EAAE,OAAO,EAAE,SAAS;AAC7C,CAAC,GAcK,CAACC,GAAgBC,CAAmB,IACxCC,EAA8C,oBAAoB;"}
1
+ {"version":3,"file":"usePaySchedule.js","sources":["../../../../src/components/Company/PaySchedule/usePaySchedule.ts"],"sourcesContent":["import type { PayScheduleCreateUpdate } from '@gusto/embedded-api/models/components/payschedulecreateupdate'\nimport type { PayScheduleList } from '@gusto/embedded-api/models/components/payschedulelist'\nimport type { PayScheduleObject as PayScheduleType } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { PayPeriods } from '@gusto/embedded-api/models/operations/getv1companiescompanyidpayschedulespreview'\nimport { z } from 'zod'\nimport type { RequireAtLeastOne } from '@/types/Helpers'\nimport { createCompoundContext } from '@/components/Base'\n\nexport type MODE =\n | 'LIST_PAY_SCHEDULES'\n | 'ADD_PAY_SCHEDULE'\n | 'EDIT_PAY_SCHEDULE'\n | 'PREVIEW_PAY_SCHEDULE'\n\ntype PayScheduleContextType = {\n companyId: string\n handleAdd: () => void\n handleEdit: (schedule: PayScheduleType) => void\n handleCancel: () => void\n handleContinue: () => void\n mode: MODE\n paySchedules: PayScheduleList[] | undefined | null\n currentPaySchedule: PayScheduleType | undefined | null\n payPeriodPreview?: PayPeriods[]\n payPreviewLoading?: boolean\n}\n\nexport const PayScheduleSchema = z.object({\n frequency: z.enum(['Every week', 'Every other week', 'Twice per month', 'Monthly']),\n anchorPayDate: z.date().optional(),\n anchorEndOfPayPeriod: z.date().optional(),\n day1: z.number().min(1).max(31).optional(),\n day2: z.number().min(1).max(31).optional(),\n customName: z.string().optional(),\n customTwicePerMonth: z.string().optional(),\n payPeriodPreviewRange: z.number().optional(),\n})\n\nexport type PayScheduleInputs = z.input<typeof PayScheduleSchema>\nexport type PayScheduleOutputs = z.output<typeof PayScheduleSchema>\n\nexport type PayScheduleDefaultValues = RequireAtLeastOne<\n Partial<\n Pick<\n PayScheduleCreateUpdate,\n 'anchorPayDate' | 'anchorEndOfPayPeriod' | 'day1' | 'day2' | 'customName' | 'frequency'\n >\n >\n>\n\nconst [usePaySchedule, PayScheduleProvider] =\n createCompoundContext<PayScheduleContextType>('PayScheduleContext')\nexport { usePaySchedule, PayScheduleProvider }\n"],"names":["PayScheduleSchema","z","usePaySchedule","PayScheduleProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;AA2Ba,MAAAA,IAAoBC,EAAE,OAAO;AAAA,EACxC,WAAWA,EAAE,KAAK,CAAC,cAAc,oBAAoB,mBAAmB,SAAS,CAAC;AAAA,EAClF,eAAeA,EAAE,KAAK,EAAE,SAAS;AAAA,EACjC,sBAAsBA,EAAE,KAAK,EAAE,SAAS;AAAA,EACxC,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EACzC,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,SAAS;AAAA,EACzC,YAAYA,EAAE,OAAO,EAAE,SAAS;AAAA,EAChC,qBAAqBA,EAAE,OAAO,EAAE,SAAS;AAAA,EACzC,uBAAuBA,EAAE,OAAO,EAAE,SAAS;AAC7C,CAAC,GAcK,CAACC,GAAgBC,CAAmB,IACxCC,EAA8C,oBAAoB;"}
@@ -1,16 +1,16 @@
1
- import { jsxs as e, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as i, jsx as n } from "react/jsx-runtime";
2
2
  import { useTranslation as a } from "react-i18next";
3
- import { useStateTaxesForm as i } from "./context.js";
4
- import { ActionsLayout as s } from "../../../Common/ActionsLayout/ActionsLayout.js";
5
- import { useComponentContext as m } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
6
- function C() {
7
- const { t } = a("Company.StateTaxes", { keyPrefix: "form" }), { handleCancel: r } = i(), o = m();
8
- return /* @__PURE__ */ e(s, { children: [
9
- /* @__PURE__ */ n(o.Button, { variant: "secondary", onClick: r, children: t("cancelCta") }),
10
- /* @__PURE__ */ n(o.Button, { variant: "primary", type: "submit", children: t("saveCta") })
3
+ import { useStateTaxesForm as s } from "./context.js";
4
+ import { ActionsLayout as m } from "../../../Common/ActionsLayout/ActionsLayout.js";
5
+ import { useComponentContext as c } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
6
+ function d() {
7
+ const { t } = a("Company.StateTaxes", { keyPrefix: "form" }), { handleCancel: e, isPending: r } = s(), o = c();
8
+ return /* @__PURE__ */ i(m, { children: [
9
+ /* @__PURE__ */ n(o.Button, { variant: "secondary", onClick: e, children: t("cancelCta") }),
10
+ /* @__PURE__ */ n(o.Button, { variant: "primary", type: "submit", isDisabled: r, children: t("saveCta") })
11
11
  ] });
12
12
  }
13
13
  export {
14
- C as Actions
14
+ d as Actions
15
15
  };
16
16
  //# sourceMappingURL=Actions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useStateTaxesForm } from './context'\nimport { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport function Actions() {\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const { handleCancel } = useStateTaxesForm()\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" type=\"submit\">\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","useTranslation","handleCancel","useStateTaxesForm","Components","useComponentContext","ActionsLayout","jsx"],"mappings":";;;;;AAKO,SAASA,IAAU;AAClB,QAAA,EAAE,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClE,EAAE,cAAAC,EAAa,IAAIC,EAAkB,GACrCC,IAAaC,EAAoB;AAEvC,2BACGC,GACC,EAAA,UAAA;AAAA,IAAC,gBAAAC,EAAAH,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASF,GAC7C,UAAE,EAAA,WAAW,EAChB,CAAA;AAAA,IACA,gBAAAK,EAACH,EAAW,QAAX,EAAkB,SAAQ,WAAU,MAAK,UACvC,UAAE,EAAA,SAAS,EACd,CAAA;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"Actions.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useStateTaxesForm } from './context'\nimport { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport function Actions() {\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const { handleCancel, isPending } = useStateTaxesForm()\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" type=\"submit\" isDisabled={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","useTranslation","handleCancel","isPending","useStateTaxesForm","Components","useComponentContext","ActionsLayout","jsx"],"mappings":";;;;;AAKO,SAASA,IAAU;AAClB,QAAA,EAAE,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClE,EAAE,cAAAC,GAAc,WAAAC,EAAU,IAAIC,EAAkB,GAChDC,IAAaC,EAAoB;AAEvC,2BACGC,GACC,EAAA,UAAA;AAAA,IAAC,gBAAAC,EAAAH,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASH,GAC7C,UAAE,EAAA,WAAW,EAChB,CAAA;AAAA,IACC,gBAAAM,EAAAH,EAAW,QAAX,EAAkB,SAAQ,WAAU,MAAK,UAAS,YAAYF,GAC5D,UAAE,EAAA,SAAS,EACd,CAAA;AAAA,EAAA,GACF;AAEJ;"}
@@ -11,7 +11,7 @@ function w() {
11
11
  return p.requirementSets?.map(
12
12
  ({ requirements: c, label: d, effectiveFrom: n, key: a }) => /* @__PURE__ */ m(f, { children: [
13
13
  /* @__PURE__ */ m("div", { children: [
14
- /* @__PURE__ */ o(r.Heading, { as: "h4", children: d }),
14
+ /* @__PURE__ */ o(r.Heading, { as: "h3", children: d }),
15
15
  n && /* @__PURE__ */ o(r.Text, { className: "lightText", children: s("effectiveFromLabel", { date: i.format(new Date(n)) }) })
16
16
  ] }),
17
17
  c?.map((e) => /* @__PURE__ */ o(
@@ -1 +1 @@
1
- {"version":3,"file":"Form.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/Form.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useTranslation } from 'react-i18next'\nimport { Fragment } from 'react/jsx-runtime'\nimport { useStateTaxesForm } from './context'\nimport { QuestionInput } from '@/components/Common/TaxInputs/TaxInputs'\nimport { useLocaleDateFormatter } from '@/contexts/LocaleProvider/useLocale'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const StateFormSchema = z.record(z.string(), z.record(z.string(), z.unknown()))\n\nexport type StateFormInputs = z.infer<typeof StateFormSchema>\n\nexport function Form() {\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const dateFormatter = useLocaleDateFormatter()\n const { stateTaxRequirements } = useStateTaxesForm()\n const Components = useComponentContext()\n\n return stateTaxRequirements.requirementSets?.map(\n ({ requirements, label, effectiveFrom, key }) => (\n <Fragment key={key}>\n <div>\n <Components.Heading as=\"h4\">{label}</Components.Heading>\n {effectiveFrom && (\n <Components.Text className=\"lightText\">\n {t('effectiveFromLabel', { date: dateFormatter.format(new Date(effectiveFrom)) })}\n </Components.Text>\n )}\n </div>\n {requirements?.map(requirement => {\n return (\n <QuestionInput\n requirement={{\n ...requirement,\n key: `${key}.${requirement.key as string}`,\n }}\n questionType={requirement.metadata?.type ?? 'Text'}\n key={requirement.key}\n />\n )\n })}\n </Fragment>\n ),\n )\n}\n"],"names":["z","Form","t","useTranslation","dateFormatter","useLocaleDateFormatter","stateTaxRequirements","useStateTaxesForm","Components","useComponentContext","requirements","label","effectiveFrom","key","Fragment","jsxs","jsx","requirement","QuestionInput"],"mappings":";;;;;;;AAQ+BA,EAAE,OAAOA,EAAE,UAAUA,EAAE,OAAOA,EAAE,OAAO,GAAGA,EAAE,QAAA,CAAS,CAAC;AAI9E,SAASC,IAAO;AACf,QAAA,EAAE,GAAAC,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClEC,IAAgBC,EAAuB,GACvC,EAAE,sBAAAC,EAAqB,IAAIC,EAAkB,GAC7CC,IAAaC,EAAoB;AAEvC,SAAOH,EAAqB,iBAAiB;AAAA,IAC3C,CAAC,EAAE,cAAAI,GAAc,OAAAC,GAAO,eAAAC,GAAe,KAAAC,EAAI,wBACxCC,GACC,EAAA,UAAA;AAAA,MAAA,gBAAAC,EAAC,OACC,EAAA,UAAA;AAAA,QAAA,gBAAAC,EAACR,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAMG,GAAA;AAAA,QAClCC,KACE,gBAAAI,EAAAR,EAAW,MAAX,EAAgB,WAAU,aACxB,UAAEN,EAAA,sBAAsB,EAAE,MAAME,EAAc,OAAO,IAAI,KAAKQ,CAAa,CAAC,EAAA,CAAG,EAClF,CAAA;AAAA,MAAA,GAEJ;AAAA,MACCF,GAAc,IAAI,CAAeO,MAE9B,gBAAAD;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,aAAa;AAAA,YACX,GAAGD;AAAA,YACH,KAAK,GAAGJ,CAAG,IAAII,EAAY,GAAa;AAAA,UAC1C;AAAA,UACA,cAAcA,EAAY,UAAU,QAAQ;AAAA,QAAA;AAAA,QACvCA,EAAY;AAAA,MACnB,CAEH;AAAA,IAAA,EAAA,GApBYJ,CAqBf;AAAA,EAEJ;AACF;"}
1
+ {"version":3,"file":"Form.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/Form.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useTranslation } from 'react-i18next'\nimport { Fragment } from 'react/jsx-runtime'\nimport { useStateTaxesForm } from './context'\nimport { QuestionInput } from '@/components/Common/TaxInputs/TaxInputs'\nimport { useLocaleDateFormatter } from '@/contexts/LocaleProvider/useLocale'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const StateFormSchema = z.record(z.string(), z.record(z.string(), z.unknown()))\n\nexport type StateFormInputs = z.infer<typeof StateFormSchema>\n\nexport function Form() {\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const dateFormatter = useLocaleDateFormatter()\n const { stateTaxRequirements } = useStateTaxesForm()\n const Components = useComponentContext()\n\n return stateTaxRequirements.requirementSets?.map(\n ({ requirements, label, effectiveFrom, key }) => (\n <Fragment key={key}>\n <div>\n <Components.Heading as=\"h3\">{label}</Components.Heading>\n {effectiveFrom && (\n <Components.Text className=\"lightText\">\n {t('effectiveFromLabel', { date: dateFormatter.format(new Date(effectiveFrom)) })}\n </Components.Text>\n )}\n </div>\n {requirements?.map(requirement => {\n return (\n <QuestionInput\n requirement={{\n ...requirement,\n key: `${key}.${requirement.key as string}`,\n }}\n questionType={requirement.metadata?.type ?? 'Text'}\n key={requirement.key}\n />\n )\n })}\n </Fragment>\n ),\n )\n}\n"],"names":["z","Form","t","useTranslation","dateFormatter","useLocaleDateFormatter","stateTaxRequirements","useStateTaxesForm","Components","useComponentContext","requirements","label","effectiveFrom","key","Fragment","jsxs","jsx","requirement","QuestionInput"],"mappings":";;;;;;;AAQ+BA,EAAE,OAAOA,EAAE,UAAUA,EAAE,OAAOA,EAAE,OAAO,GAAGA,EAAE,QAAA,CAAS,CAAC;AAI9E,SAASC,IAAO;AACf,QAAA,EAAE,GAAAC,MAAMC,EAAe,sBAAsB,EAAE,WAAW,QAAQ,GAClEC,IAAgBC,EAAuB,GACvC,EAAE,sBAAAC,EAAqB,IAAIC,EAAkB,GAC7CC,IAAaC,EAAoB;AAEvC,SAAOH,EAAqB,iBAAiB;AAAA,IAC3C,CAAC,EAAE,cAAAI,GAAc,OAAAC,GAAO,eAAAC,GAAe,KAAAC,EAAI,wBACxCC,GACC,EAAA,UAAA;AAAA,MAAA,gBAAAC,EAAC,OACC,EAAA,UAAA;AAAA,QAAA,gBAAAC,EAACR,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAMG,GAAA;AAAA,QAClCC,KACE,gBAAAI,EAAAR,EAAW,MAAX,EAAgB,WAAU,aACxB,UAAEN,EAAA,sBAAsB,EAAE,MAAME,EAAc,OAAO,IAAI,KAAKQ,CAAa,CAAC,EAAA,CAAG,EAClF,CAAA;AAAA,MAAA,GAEJ;AAAA,MACCF,GAAc,IAAI,CAAeO,MAE9B,gBAAAD;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,aAAa;AAAA,YACX,GAAGD;AAAA,YACH,KAAK,GAAGJ,CAAG,IAAII,EAAY,GAAa;AAAA,UAC1C;AAAA,UACA,cAAcA,EAAY,UAAU,QAAQ;AAAA,QAAA;AAAA,QACvCA,EAAY;AAAA,MACnB,CAEH;AAAA,IAAA,EAAA,GApBYJ,CAqBf;AAAA,EAEJ;AACF;"}
@@ -3,52 +3,52 @@ import { useForm as K, FormProvider as M } from "react-hook-form";
3
3
  import { zodResolver as w } from "@hookform/resolvers/zod";
4
4
  import { useTaxRequirementsUpdateStateMutation as z } from "@gusto/embedded-api/react-query/taxRequirementsUpdateState";
5
5
  import { useTaxRequirementsGetSuspense as G } from "@gusto/embedded-api/react-query/taxRequirementsGet";
6
- import { z as r } from "zod";
6
+ import { z as n } from "zod";
7
7
  import { useMemo as L } from "react";
8
8
  import { useTranslation as X } from "react-i18next";
9
- import { Head as q } from "./Head.js";
9
+ import { Head as A } from "./Head.js";
10
10
  import { StateTaxesFormProvider as Y } from "./context.js";
11
- import { Form as A } from "./Form.js";
12
- import { Actions as P } from "./Actions.js";
11
+ import { Form as P } from "./Form.js";
12
+ import { Actions as j } from "./Actions.js";
13
13
  import { BaseComponent as $ } from "../../../Base/Base.js";
14
14
  import { useI18n as I } from "../../../../i18n/I18n.js";
15
15
  import { Flex as J } from "../../../Common/Flex/Flex.js";
16
16
  import { Form as Q } from "../../../Common/Form/Form.js";
17
17
  import { componentEvents as k } from "../../../../shared/constants.js";
18
18
  import { useBase as W } from "../../../Base/useBase.js";
19
- function x(n) {
20
- return /* @__PURE__ */ t($, { ...n, children: /* @__PURE__ */ t(Z, { ...n, children: n.children }) });
19
+ function x(a) {
20
+ return /* @__PURE__ */ t($, { ...a, children: /* @__PURE__ */ t(Z, { ...a, children: a.children }) });
21
21
  }
22
- function Z({ companyId: n, state: S, className: j, children: v }) {
22
+ function Z({ companyId: a, state: S, className: q, children: v }) {
23
23
  I("Company.StateTaxes");
24
- const { onEvent: F, baseSubmitHandler: C } = W(), { t: l } = X("Company.StateTaxes", { keyPrefix: "form" }), { data: E } = G({ companyUuid: n, state: S }), f = E.taxRequirementsState, { mutateAsync: N, isPending: R } = z(), { dynamicSchema: V, defaultValues: O } = L(() => {
24
+ const { onEvent: F, baseSubmitHandler: C } = W(), { t: l } = X("Company.StateTaxes", { keyPrefix: "form" }), { data: E } = G({ companyUuid: a, state: S }), f = E.taxRequirementsState, { mutateAsync: N, isPending: R } = z(), { dynamicSchema: V, defaultValues: O } = L(() => {
25
25
  const d = {}, i = {};
26
26
  return f.requirementSets?.forEach((e) => {
27
27
  if (!e.key) return;
28
28
  const m = e.key, s = {}, p = {};
29
29
  e.requirements?.forEach((o) => {
30
30
  if (!o.key) return;
31
- const b = o.key;
32
- p[b] = String(o.value ?? "");
33
- let y = r.string().min(1);
31
+ const g = o.key;
32
+ p[g] = String(o.value ?? "");
33
+ let y = n.string().min(1);
34
34
  const c = o.metadata?.validation;
35
35
  if (c && o.metadata?.type === "tax_rate")
36
36
  if (c.type === "min_max") {
37
- const a = parseFloat(c.min), u = parseFloat(c.max);
38
- !isNaN(a) && !isNaN(u) && (y = r.preprocess(
37
+ const r = parseFloat(c.min), u = parseFloat(c.max);
38
+ !isNaN(r) && !isNaN(u) && (y = n.preprocess(
39
39
  (h) => Number(h),
40
- r.number().min(a, l("validations.minValue", { min: a })).max(u, l("validations.maxValue", { max: u })).transform((h) => String(h))
40
+ n.number().min(r, l("validations.minValue", { min: r })).max(u, l("validations.maxValue", { max: u })).transform((h) => String(h))
41
41
  ));
42
42
  } else {
43
- const a = c.rates;
44
- y = r.string().min(1).refine((u) => a.includes(u), {
45
- message: l("validations.oneOf", { values: a.join(", ") })
43
+ const r = c.rates;
44
+ y = n.string().min(1).refine((u) => r.includes(u), {
45
+ message: l("validations.oneOf", { values: r.join(", ") })
46
46
  });
47
47
  }
48
- s[b] = y;
49
- }), Object.keys(s).length > 0 && (d[m] = r.object(s), i[m] = p);
48
+ o.metadata?.type === "radio" && (y = n.boolean()), s[g] = y;
49
+ }), Object.keys(s).length > 0 && (d[m] = n.object(s), i[m] = p);
50
50
  }), {
51
- dynamicSchema: r.object(d),
51
+ dynamicSchema: n.object(d),
52
52
  defaultValues: i
53
53
  };
54
54
  }, [f, l]), { control: U, ...T } = K({
@@ -56,7 +56,7 @@ function Z({ companyId: n, state: S, className: j, children: v }) {
56
56
  defaultValues: O
57
57
  }), _ = async (d) => {
58
58
  await C(d, async (i) => {
59
- const g = f.requirementSets?.filter((e) => e.key && i[e.key]).map((e) => {
59
+ const b = f.requirementSets?.filter((e) => e.key && i[e.key]).map((e) => {
60
60
  const m = e.key, s = i[m];
61
61
  return {
62
62
  state: e.state,
@@ -70,8 +70,8 @@ function Z({ companyId: n, state: S, className: j, children: v }) {
70
70
  });
71
71
  await N({
72
72
  request: {
73
- companyUuid: n,
74
- requestBody: { requirementSets: g },
73
+ companyUuid: a,
74
+ requestBody: { requirementSets: b },
75
75
  state: S
76
76
  }
77
77
  }), F(k.COMPANY_STATE_TAX_UPDATED);
@@ -79,21 +79,21 @@ function Z({ companyId: n, state: S, className: j, children: v }) {
79
79
  }, B = () => {
80
80
  F(k.CANCEL);
81
81
  };
82
- return /* @__PURE__ */ t("section", { className: j, children: /* @__PURE__ */ t(M, { ...T, control: U, children: /* @__PURE__ */ t(Q, { onSubmit: T.handleSubmit(_), children: /* @__PURE__ */ t(
82
+ return /* @__PURE__ */ t("section", { className: q, children: /* @__PURE__ */ t(M, { ...T, control: U, children: /* @__PURE__ */ t(Q, { onSubmit: T.handleSubmit(_), children: /* @__PURE__ */ t(
83
83
  Y,
84
84
  {
85
85
  value: { stateTaxRequirements: f, isPending: R, state: S, handleCancel: B },
86
86
  children: /* @__PURE__ */ t(J, { flexDirection: "column", gap: 32, children: v || /* @__PURE__ */ D(H, { children: [
87
- /* @__PURE__ */ t(q, {}),
88
87
  /* @__PURE__ */ t(A, {}),
89
- /* @__PURE__ */ t(P, {})
88
+ /* @__PURE__ */ t(P, {}),
89
+ /* @__PURE__ */ t(j, {})
90
90
  ] }) })
91
91
  }
92
92
  ) }) }) });
93
93
  }
94
- x.Head = q;
95
- x.Form = A;
96
- x.Actions = P;
94
+ x.Head = A;
95
+ x.Form = P;
96
+ x.Actions = j;
97
97
  export {
98
98
  x as StateTaxesForm
99
99
  };
@@ -1 +1 @@
1
- {"version":3,"file":"StateTaxesForm.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.tsx"],"sourcesContent":["import { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTaxRequirementsUpdateStateMutation } from '@gusto/embedded-api/react-query/taxRequirementsUpdateState'\nimport { useTaxRequirementsGetSuspense } from '@gusto/embedded-api/react-query/taxRequirementsGet'\nimport { z } from 'zod'\nimport { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { Head } from './Head'\nimport { StateTaxesFormProvider } from './context'\nimport { Form } from './Form'\nimport { Actions } from './Actions'\nimport type { BaseComponentInterface, CommonComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useI18n } from '@/i18n/I18n'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { componentEvents } from '@/shared/constants'\nimport { useBase } from '@/components/Base'\n\ninterface StateTaxesFormProps extends CommonComponentInterface {\n companyId: string\n state: string\n}\n\nexport function StateTaxesForm(props: StateTaxesFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, state, className, children }: StateTaxesFormProps) {\n useI18n('Company.StateTaxes')\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const { data } = useTaxRequirementsGetSuspense({ companyUuid: companyId, state })\n const stateTaxRequirements = data.taxRequirementsState!\n\n const { mutateAsync: updateStateTax, isPending: isPendingUpdate } =\n useTaxRequirementsUpdateStateMutation()\n\n // Schema and default value generation\n const { dynamicSchema, defaultValues } = useMemo(() => {\n const schemaShape: Record<string, z.ZodObject<Record<string, z.ZodTypeAny>>> = {}\n const values: Partial<Record<string, Record<string, string>>> = {}\n\n //Looping through each requirement set\n stateTaxRequirements.requirementSets?.forEach(requirementSet => {\n if (!requirementSet.key) return\n\n const requirementSetKey = requirementSet.key\n const requirementShape: Record<string, z.ZodTypeAny> = {}\n const requirementValues: Record<string, string> = {}\n\n requirementSet.requirements?.forEach(requirement => {\n if (!requirement.key) return\n\n const requirementKey = requirement.key\n\n // --- Default Value Logic ---\n requirementValues[requirementKey] = String(requirement.value ?? '')\n\n // --- Schema Logic ---\n // Start with a basic string schema\n let fieldSchema: z.ZodTypeAny = z.string().min(1)\n\n const validation = requirement.metadata?.validation\n // Not all requirements have validation\n if (validation) {\n if (requirement.metadata?.type === 'tax_rate') {\n if (validation.type === 'min_max') {\n const min = parseFloat(validation.min as string)\n const max = parseFloat(validation.max as string)\n\n if (!isNaN(min) && !isNaN(max)) {\n fieldSchema = z.preprocess(\n val => Number(val),\n z\n .number()\n .min(min, t('validations.minValue', { min }))\n .max(max, t('validations.maxValue', { max }))\n .transform(num => String(num)),\n )\n }\n } else {\n //Type is one_of\n const oneOfValues = validation.rates as string[]\n fieldSchema = z\n .string()\n .min(1)\n .refine(val => oneOfValues.includes(val), {\n message: t('validations.oneOf', { values: oneOfValues.join(', ') }),\n })\n }\n }\n }\n requirementShape[requirementKey] = fieldSchema\n // --- End Schema Logic ---\n })\n\n if (Object.keys(requirementShape).length > 0) {\n schemaShape[requirementSetKey] = z.object(requirementShape)\n values[requirementSetKey] = requirementValues\n }\n })\n\n const finalSchema = z.object(schemaShape)\n\n // Return both the schema and the default values\n return {\n dynamicSchema: finalSchema,\n defaultValues: values as z.infer<typeof finalSchema>,\n }\n }, [stateTaxRequirements, t])\n\n // Infer the type from the schema\n type InferredFormInputs = z.infer<typeof dynamicSchema>\n\n const { control, ...methods } = useForm<InferredFormInputs>({\n resolver: zodResolver(dynamicSchema),\n defaultValues,\n })\n\n const onSubmit = async (formData: InferredFormInputs) => {\n await baseSubmitHandler(formData, async payload => {\n const requirementSets = stateTaxRequirements.requirementSets\n ?.filter(rs => rs.key && payload[rs.key])\n .map(requirementSet => {\n const requirementSetKey = requirementSet.key as string\n const payloadSet = payload[requirementSetKey] as Record<string, unknown>\n return {\n state: requirementSet.state,\n key: requirementSetKey,\n effectiveFrom: requirementSet.effectiveFrom,\n requirements: Object.entries(payloadSet).map(([key, value]) => ({\n key,\n value: String(value),\n })),\n }\n })\n await updateStateTax({\n request: {\n companyUuid: companyId,\n requestBody: { requirementSets },\n state,\n },\n })\n onEvent(componentEvents.COMPANY_STATE_TAX_UPDATED)\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n return (\n <section className={className}>\n <FormProvider {...methods} control={control}>\n <HtmlForm onSubmit={methods.handleSubmit(onSubmit)}>\n <StateTaxesFormProvider\n value={{ stateTaxRequirements, isPending: isPendingUpdate, state, handleCancel }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </StateTaxesFormProvider>\n </HtmlForm>\n </FormProvider>\n </section>\n )\n}\n\nStateTaxesForm.Head = Head\nStateTaxesForm.Form = Form\nStateTaxesForm.Actions = Actions\n"],"names":["StateTaxesForm","props","jsx","BaseComponent","Root","companyId","state","className","children","useI18n","onEvent","baseSubmitHandler","useBase","t","useTranslation","data","useTaxRequirementsGetSuspense","stateTaxRequirements","updateStateTax","isPendingUpdate","useTaxRequirementsUpdateStateMutation","dynamicSchema","defaultValues","useMemo","schemaShape","values","requirementSet","requirementSetKey","requirementShape","requirementValues","requirement","requirementKey","fieldSchema","z","validation","min","max","val","num","oneOfValues","control","methods","useForm","zodResolver","onSubmit","formData","payload","requirementSets","rs","payloadSet","key","value","componentEvents","handleCancel","FormProvider","HtmlForm","StateTaxesFormProvider","Flex","jsxs","Fragment","Head","Form","Actions"],"mappings":";;;;;;;;;;;;;;;;;;AAwBO,SAASA,EAAeC,GAAqD;AAEhF,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAA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AO,QAAQuB,CAAU,EAAE,IAAI,CAAC,CAACC,GAAKC,CAAK,OAAO;AAAA,YAC9D,KAAAD;AAAA,YACA,OAAO,OAAOC,CAAK;AAAA,UAAA,EACnB;AAAA,QACJ;AAAA,MAAA,CACD;AACH,YAAMjC,EAAe;AAAA,QACnB,SAAS;AAAA,UACP,aAAab;AAAA,UACb,aAAa,EAAE,iBAAA0C,EAAgB;AAAA,UAC/B,OAAAzC;AAAA,QAAA;AAAA,MACF,CACD,GACDI,EAAQ0C,EAAgB,yBAAyB;AAAA,IAAA,CAClD;AAAA,EACH,GAEMC,IAAe,MAAM;AACzB,IAAA3C,EAAQ0C,EAAgB,MAAM;AAAA,EAChC;AAEA,SACG,gBAAAlD,EAAA,WAAA,EAAQ,WAAAK,GACP,UAAA,gBAAAL,EAACoD,KAAc,GAAGb,GAAS,SAAAD,GACzB,UAAA,gBAAAtC,EAACqD,GAAS,EAAA,UAAUd,EAAQ,aAAaG,CAAQ,GAC/C,UAAA,gBAAA1C;AAAA,IAACsD;AAAA,IAAA;AAAA,MACC,OAAO,EAAE,sBAAAvC,GAAsB,WAAWE,GAAiB,OAAAb,GAAO,cAAA+C,EAAa;AAAA,MAE/E,UAAA,gBAAAnD,EAACuD,KAAK,eAAc,UAAS,KAAK,IAC/B,UAAAjD,KAIG,gBAAAkD,EAAAC,GAAA,EAAA,UAAA;AAAA,QAAA,gBAAAzD,EAAC0D,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,EAAA,CACX,EAEJ,CAAA;AAAA,IAAA;AAAA,EAAA,EAEJ,CAAA,EACF,CAAA,GACF;AAEJ;AAEA9D,EAAe,OAAO4D;AACtB5D,EAAe,OAAO6D;AACtB7D,EAAe,UAAU8D;"}
1
+ {"version":3,"file":"StateTaxesForm.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.tsx"],"sourcesContent":["import { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTaxRequirementsUpdateStateMutation } from '@gusto/embedded-api/react-query/taxRequirementsUpdateState'\nimport { useTaxRequirementsGetSuspense } from '@gusto/embedded-api/react-query/taxRequirementsGet'\nimport { z } from 'zod'\nimport { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { Head } from './Head'\nimport { StateTaxesFormProvider } from './context'\nimport { Form } from './Form'\nimport { Actions } from './Actions'\nimport type { BaseComponentInterface, CommonComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useI18n } from '@/i18n/I18n'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { componentEvents } from '@/shared/constants'\nimport { useBase } from '@/components/Base'\n\ninterface StateTaxesFormProps extends CommonComponentInterface {\n companyId: string\n state: string\n}\n\nexport function StateTaxesForm(props: StateTaxesFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, state, className, children }: StateTaxesFormProps) {\n useI18n('Company.StateTaxes')\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Company.StateTaxes', { keyPrefix: 'form' })\n const { data } = useTaxRequirementsGetSuspense({ companyUuid: companyId, state })\n const stateTaxRequirements = data.taxRequirementsState!\n\n const { mutateAsync: updateStateTax, isPending: isPendingUpdate } =\n useTaxRequirementsUpdateStateMutation()\n\n // Schema and default value generation\n const { dynamicSchema, defaultValues } = useMemo(() => {\n const schemaShape: Record<string, z.ZodObject<Record<string, z.ZodTypeAny>>> = {}\n const values: Partial<Record<string, Record<string, string>>> = {}\n\n //Looping through each requirement set\n stateTaxRequirements.requirementSets?.forEach(requirementSet => {\n if (!requirementSet.key) return\n\n const requirementSetKey = requirementSet.key\n const requirementShape: Record<string, z.ZodTypeAny> = {}\n const requirementValues: Record<string, string> = {}\n\n requirementSet.requirements?.forEach(requirement => {\n if (!requirement.key) return\n\n const requirementKey = requirement.key\n\n // --- Default Value Logic ---\n requirementValues[requirementKey] = String(requirement.value ?? '')\n\n // --- Schema Logic ---\n // Start with a basic string schema\n let fieldSchema: z.ZodTypeAny = z.string().min(1)\n\n const validation = requirement.metadata?.validation\n // Not all requirements have validation\n if (validation) {\n if (requirement.metadata?.type === 'tax_rate') {\n if (validation.type === 'min_max') {\n const min = parseFloat(validation.min as string)\n const max = parseFloat(validation.max as string)\n\n if (!isNaN(min) && !isNaN(max)) {\n fieldSchema = z.preprocess(\n val => Number(val),\n z\n .number()\n .min(min, t('validations.minValue', { min }))\n .max(max, t('validations.maxValue', { max }))\n .transform(num => String(num)),\n )\n }\n } else {\n //Type is one_of\n const oneOfValues = validation.rates as string[]\n fieldSchema = z\n .string()\n .min(1)\n .refine(val => oneOfValues.includes(val), {\n message: t('validations.oneOf', { values: oneOfValues.join(', ') }),\n })\n }\n }\n }\n if (requirement.metadata?.type === 'radio') {\n fieldSchema = z.boolean()\n }\n requirementShape[requirementKey] = fieldSchema\n // --- End Schema Logic ---\n })\n\n if (Object.keys(requirementShape).length > 0) {\n schemaShape[requirementSetKey] = z.object(requirementShape)\n values[requirementSetKey] = requirementValues\n }\n })\n\n const finalSchema = z.object(schemaShape)\n\n // Return both the schema and the default values\n return {\n dynamicSchema: finalSchema,\n defaultValues: values as z.infer<typeof finalSchema>,\n }\n }, [stateTaxRequirements, t])\n\n // Infer the type from the schema\n type InferredFormInputs = z.infer<typeof dynamicSchema>\n\n const { control, ...methods } = useForm<InferredFormInputs>({\n resolver: zodResolver(dynamicSchema),\n defaultValues,\n })\n\n const onSubmit = async (formData: InferredFormInputs) => {\n await baseSubmitHandler(formData, async payload => {\n const requirementSets = stateTaxRequirements.requirementSets\n ?.filter(rs => rs.key && payload[rs.key])\n .map(requirementSet => {\n const requirementSetKey = requirementSet.key as string\n const payloadSet = payload[requirementSetKey] as Record<string, unknown>\n return {\n state: requirementSet.state,\n key: requirementSetKey,\n effectiveFrom: requirementSet.effectiveFrom,\n requirements: Object.entries(payloadSet).map(([key, value]) => ({\n key,\n value: String(value),\n })),\n }\n })\n await updateStateTax({\n request: {\n companyUuid: companyId,\n requestBody: { requirementSets },\n state,\n },\n })\n onEvent(componentEvents.COMPANY_STATE_TAX_UPDATED)\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n return (\n <section className={className}>\n <FormProvider {...methods} control={control}>\n <HtmlForm onSubmit={methods.handleSubmit(onSubmit)}>\n <StateTaxesFormProvider\n value={{ stateTaxRequirements, isPending: isPendingUpdate, state, handleCancel }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </StateTaxesFormProvider>\n </HtmlForm>\n </FormProvider>\n </section>\n )\n}\n\nStateTaxesForm.Head = Head\nStateTaxesForm.Form = Form\nStateTaxesForm.Actions = Actions\n"],"names":["StateTaxesForm","props","jsx","BaseComponent","Root","companyId","state","className","children","useI18n","onEvent","baseSubmitHandler","useBase","t","useTranslation","data","useTaxRequirementsGetSuspense","stateTaxRequirements","updateStateTax","isPendingUpdate","useTaxRequirementsUpdateStateMutation","dynamicSchema","defaultValues","useMemo","schemaShape","values","requirementSet","requirementSetKey","requirementShape","requirementValues","requirement","requirementKey","fieldSchema","z","validation","min","max","val","num","oneOfValues","control","methods","useForm","zodResolver","onSubmit","formData","payload","requirementSets","rs","payloadSet","key","value","componentEvents","handleCancel","FormProvider","HtmlForm","StateTaxesFormProvider","Flex","jsxs","Fragment","Head","Form","Actions"],"mappings":";;;;;;;;;;;;;;;;;;AAwBO,SAASA,EAAeC,GAAqD;AAEhF,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,SAASG,EAAK,EAAE,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EAAE,IAAI,CAAC,CAACC,GAAKC,CAAK,OAAO;AAAA,YAC9D,KAAAD;AAAA,YACA,OAAO,OAAOC,CAAK;AAAA,UAAA,EACnB;AAAA,QACJ;AAAA,MAAA,CACD;AACH,YAAMjC,EAAe;AAAA,QACnB,SAAS;AAAA,UACP,aAAab;AAAA,UACb,aAAa,EAAE,iBAAA0C,EAAgB;AAAA,UAC/B,OAAAzC;AAAA,QAAA;AAAA,MACF,CACD,GACDI,EAAQ0C,EAAgB,yBAAyB;AAAA,IAAA,CAClD;AAAA,EACH,GAEMC,IAAe,MAAM;AACzB,IAAA3C,EAAQ0C,EAAgB,MAAM;AAAA,EAChC;AAEA,SACG,gBAAAlD,EAAA,WAAA,EAAQ,WAAAK,GACP,UAAA,gBAAAL,EAACoD,KAAc,GAAGb,GAAS,SAAAD,GACzB,UAAA,gBAAAtC,EAACqD,GAAS,EAAA,UAAUd,EAAQ,aAAaG,CAAQ,GAC/C,UAAA,gBAAA1C;AAAA,IAACsD;AAAA,IAAA;AAAA,MACC,OAAO,EAAE,sBAAAvC,GAAsB,WAAWE,GAAiB,OAAAb,GAAO,cAAA+C,EAAa;AAAA,MAE/E,UAAA,gBAAAnD,EAACuD,KAAK,eAAc,UAAS,KAAK,IAC/B,UAAAjD,KAIG,gBAAAkD,EAAAC,GAAA,EAAA,UAAA;AAAA,QAAA,gBAAAzD,EAAC0D,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,EAAA,CACX,EAEJ,CAAA;AAAA,IAAA;AAAA,EAAA,EAEJ,CAAA,EACF,CAAA,GACF;AAEJ;AAEA9D,EAAe,OAAO4D;AACtB5D,EAAe,OAAO6D;AACtB7D,EAAe,UAAU8D;"}
@@ -6,11 +6,13 @@ import "@gusto/embedded-api/models/errors/apierror";
6
6
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
7
7
  import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
8
8
  import "../../../Base/useBase.js";
9
+ import "../../../../shared/constants.js";
9
10
  import "dompurify";
11
+ import "../../../../contexts/ComponentAdapter/useComponentContext.js";
10
12
  import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
11
- const [C, F] = t("StateTaxesFormContext");
13
+ const [S, T] = t("StateTaxesFormContext");
12
14
  export {
13
- F as StateTaxesFormProvider,
14
- C as useStateTaxesForm
15
+ T as StateTaxesFormProvider,
16
+ S as useStateTaxesForm
15
17
  };
16
18
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/context.ts"],"sourcesContent":["import type { TaxRequirementsState } from '@gusto/embedded-api/models/components/taxrequirementsstate'\nimport { createCompoundContext } from '@/components/Base'\n\ninterface StateTaxFormContext {\n isPending: boolean\n state: string\n stateTaxRequirements: TaxRequirementsState\n handleCancel: () => void\n}\n\nconst [useStateTaxesForm, StateTaxesFormProvider] =\n createCompoundContext<StateTaxFormContext>('StateTaxesFormContext')\n\nexport { useStateTaxesForm, StateTaxesFormProvider }\n"],"names":["useStateTaxesForm","StateTaxesFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;AAUA,MAAM,CAACA,GAAmBC,CAAsB,IAC9CC,EAA2C,uBAAuB;"}
1
+ {"version":3,"file":"context.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesForm/context.ts"],"sourcesContent":["import type { TaxRequirementsState } from '@gusto/embedded-api/models/components/taxrequirementsstate'\nimport { createCompoundContext } from '@/components/Base'\n\ninterface StateTaxFormContext {\n isPending: boolean\n state: string\n stateTaxRequirements: TaxRequirementsState\n handleCancel: () => void\n}\n\nconst [useStateTaxesForm, StateTaxesFormProvider] =\n createCompoundContext<StateTaxFormContext>('StateTaxesFormContext')\n\nexport { useStateTaxesForm, StateTaxesFormProvider }\n"],"names":["useStateTaxesForm","StateTaxesFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;AAUA,MAAM,CAACA,GAAmBC,CAAsB,IAC9CC,EAA2C,uBAAuB;"}
@@ -6,11 +6,13 @@ import "@gusto/embedded-api/models/errors/apierror";
6
6
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
7
7
  import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
8
8
  import "../../../Base/useBase.js";
9
+ import "../../../../shared/constants.js";
9
10
  import "dompurify";
11
+ import "../../../../contexts/ComponentAdapter/useComponentContext.js";
10
12
  import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
11
- const [C, L] = t("StateTaxesListContext");
13
+ const [S, T] = t("StateTaxesListContext");
12
14
  export {
13
- L as StateTaxesListProvider,
14
- C as useStateTaxesList
15
+ T as StateTaxesListProvider,
16
+ S as useStateTaxesList
15
17
  };
16
18
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesList/context.ts"],"sourcesContent":["import type { ResponseBody } from '@gusto/embedded-api/models/operations/getv1companiescompanyuuidtaxrequirements'\nimport { createCompoundContext } from '@/components/Base'\n\ntype StateTaxesListContextType = {\n isPending: boolean\n stateTaxRequirements: ResponseBody[]\n handleContinue: () => void\n handleChange: (state: string) => void\n}\n\nconst [useStateTaxesList, StateTaxesListProvider] =\n createCompoundContext<StateTaxesListContextType>('StateTaxesListContext')\n\nexport { useStateTaxesList, StateTaxesListProvider }\n"],"names":["useStateTaxesList","StateTaxesListProvider","createCompoundContext"],"mappings":";;;;;;;;;;AAUA,MAAM,CAACA,GAAmBC,CAAsB,IAC9CC,EAAiD,uBAAuB;"}
1
+ {"version":3,"file":"context.js","sources":["../../../../../src/components/Company/StateTaxes/StateTaxesList/context.ts"],"sourcesContent":["import type { ResponseBody } from '@gusto/embedded-api/models/operations/getv1companiescompanyuuidtaxrequirements'\nimport { createCompoundContext } from '@/components/Base'\n\ntype StateTaxesListContextType = {\n isPending: boolean\n stateTaxRequirements: ResponseBody[]\n handleContinue: () => void\n handleChange: (state: string) => void\n}\n\nconst [useStateTaxesList, StateTaxesListProvider] =\n createCompoundContext<StateTaxesListContextType>('StateTaxesListContext')\n\nexport { useStateTaxesList, StateTaxesListProvider }\n"],"names":["useStateTaxesList","StateTaxesListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;AAUA,MAAM,CAACA,GAAmBC,CAAsB,IAC9CC,EAAiD,uBAAuB;"}
@@ -0,0 +1 @@
1
+ export declare function Actions(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { useTranslation as s } from "react-i18next";
3
+ import { useAddress as i } from "./useAddress.js";
4
+ import { ActionsLayout as e } from "../../Common/ActionsLayout/ActionsLayout.js";
5
+ import { useComponentContext as m } from "../../../contexts/ComponentAdapter/useComponentContext.js";
6
+ function a() {
7
+ const { t } = s("Contractor.Address"), n = m(), { isPending: r } = i();
8
+ return /* @__PURE__ */ o(e, { children: /* @__PURE__ */ o(n.Button, { type: "submit", isLoading: r, children: t("submit") }) });
9
+ }
10
+ export {
11
+ a as Actions
12
+ };
13
+ //# sourceMappingURL=Actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Actions.js","sources":["../../../../src/components/Contractor/Address/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useAddress } from './useAddress'\nimport { ActionsLayout } from '@/components/Common/ActionsLayout/ActionsLayout'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport function Actions() {\n const { t } = useTranslation('Contractor.Address')\n const Components = useComponentContext()\n const { isPending } = useAddress()\n\n return (\n <ActionsLayout>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('submit')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","useTranslation","Components","useComponentContext","isPending","useAddress","jsx","ActionsLayout"],"mappings":";;;;;AAKO,SAASA,IAAU;AACxB,QAAM,EAAE,EAAA,IAAMC,EAAe,oBAAoB,GAC3CC,IAAaC,EAAoB,GACjC,EAAE,WAAAC,EAAU,IAAIC,EAAW;AAEjC,SACG,gBAAAC,EAAAC,GAAA,EACC,UAAC,gBAAAD,EAAAJ,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWE,GACzC,UAAE,EAAA,QAAQ,EACb,CAAA,GACF;AAEJ;"}
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from 'react';
2
+ import { AddressDefaultValues } from './useAddress';
3
+ import { BaseComponentInterface } from '../../Base/Base';
4
+ export interface AddressProps extends BaseComponentInterface<'Contractor.Address'> {
5
+ contractorId: string;
6
+ defaultValues?: AddressDefaultValues;
7
+ children?: ReactNode;
8
+ className?: string;
9
+ }
10
+ export declare function Address(props: AddressProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare namespace Address {
12
+ var Head: typeof import("./Head").Head;
13
+ var Form: typeof import("./Form").Form;
14
+ var Actions: typeof import("./Actions").Actions;
15
+ }
16
+ export default Address;
@@ -0,0 +1,74 @@
1
+ import { jsx as t, jsxs as P, Fragment as T } from "react/jsx-runtime";
2
+ import { useContractorsGetSuspense as U } from "@gusto/embedded-api/react-query/contractorsGet";
3
+ import { useContractorsGetAddressSuspense as b, invalidateContractorsGetAddress as x } from "@gusto/embedded-api/react-query/contractorsGetAddress";
4
+ import { useContractorsUpdateAddressMutation as O } from "@gusto/embedded-api/react-query/contractorsUpdateAddress";
5
+ import { useQueryClient as _ } from "@tanstack/react-query";
6
+ import { useForm as q, FormProvider as w } from "react-hook-form";
7
+ import { zodResolver as B } from "@hookform/resolvers/zod";
8
+ import { AddressFormSchema as G, AddressProvider as H } from "./useAddress.js";
9
+ import { Head as u } from "./Head.js";
10
+ import { Form as p } from "./Form.js";
11
+ import { Actions as f } from "./Actions.js";
12
+ import { Form as N } from "../../Common/Form/Form.js";
13
+ import { useComponentDictionary as j, useI18n as M } from "../../../i18n/I18n.js";
14
+ import { Flex as Q } from "../../Common/Flex/Flex.js";
15
+ import { BaseComponent as $ } from "../../Base/Base.js";
16
+ import { useBase as k } from "../../Base/useBase.js";
17
+ import { contractorEvents as a } from "../../../shared/constants.js";
18
+ function n(r) {
19
+ return /* @__PURE__ */ t($, { ...r, children: /* @__PURE__ */ t(J, { ...r, children: r.children }) });
20
+ }
21
+ function J({ contractorId: r, defaultValues: o, children: i, className: A, dictionary: C }) {
22
+ j("Contractor.Address", C), M("Contractor.Address");
23
+ const l = _(), { onEvent: c, baseSubmitHandler: D } = k(), { data: m } = U({ contractorUuid: r }), { data: h } = b({ contractorUuid: r }), { mutateAsync: S, isPending: v } = O(), y = m.contractor, F = m.contractor?.type, e = h.contractorAddress, R = {
24
+ street1: e?.street1 || o?.street1 || "",
25
+ street2: e?.street2 || o?.street2 || "",
26
+ city: e?.city || o?.city || "",
27
+ state: e?.state || o?.state || "",
28
+ zip: e?.zip || o?.zip || ""
29
+ }, d = q({
30
+ resolver: B(G),
31
+ defaultValues: R
32
+ }), g = async (z) => {
33
+ await D(z, async (s) => {
34
+ const { contractorAddress: E } = await S({
35
+ request: {
36
+ contractorUuid: r,
37
+ requestBody: {
38
+ version: e?.version,
39
+ street1: s.street1,
40
+ street2: s.street2,
41
+ city: s.city,
42
+ state: s.state,
43
+ zip: s.zip
44
+ }
45
+ }
46
+ });
47
+ await x(l, [r]), c(a.CONTRACTOR_ADDRESS_UPDATED, E), c(a.CONTRACTOR_ADDRESS_DONE);
48
+ });
49
+ };
50
+ return /* @__PURE__ */ t("section", { className: A, children: /* @__PURE__ */ t(
51
+ H,
52
+ {
53
+ value: {
54
+ contractor: y,
55
+ contractorType: F,
56
+ address: e,
57
+ isPending: v
58
+ },
59
+ children: /* @__PURE__ */ t(w, { ...d, children: /* @__PURE__ */ t(N, { onSubmit: d.handleSubmit(g), children: /* @__PURE__ */ t(Q, { flexDirection: "column", gap: 32, children: i || /* @__PURE__ */ P(T, { children: [
60
+ /* @__PURE__ */ t(u, {}),
61
+ /* @__PURE__ */ t(p, {}),
62
+ /* @__PURE__ */ t(f, {})
63
+ ] }) }) }) })
64
+ }
65
+ ) });
66
+ }
67
+ n.Head = u;
68
+ n.Form = p;
69
+ n.Actions = f;
70
+ export {
71
+ n as Address,
72
+ n as default
73
+ };
74
+ //# sourceMappingURL=Address.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Address.js","sources":["../../../../src/components/Contractor/Address/Address.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useContractorsGetSuspense } from '@gusto/embedded-api/react-query/contractorsGet'\nimport {\n useContractorsGetAddressSuspense,\n invalidateContractorsGetAddress,\n} from '@gusto/embedded-api/react-query/contractorsGetAddress'\nimport { useContractorsUpdateAddressMutation } from '@gusto/embedded-api/react-query/contractorsUpdateAddress'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { AddressFormSchema, AddressProvider } from './useAddress'\nimport { Head } from './Head'\nimport { Form } from './Form'\nimport { Actions } from './Actions'\nimport type { AddressDefaultValues, AddressFormValues } from './useAddress'\nimport { Form as HtmlForm } from '@/components/Common/Form/Form'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { Flex } from '@/components/Common'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { contractorEvents } from '@/shared/constants'\n\nexport interface AddressProps extends BaseComponentInterface<'Contractor.Address'> {\n contractorId: string\n defaultValues?: AddressDefaultValues\n children?: ReactNode\n className?: string\n}\n\nexport function Address(props: AddressProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ contractorId, defaultValues, children, className, dictionary }: AddressProps) {\n useComponentDictionary('Contractor.Address', dictionary)\n useI18n('Contractor.Address')\n const queryClient = useQueryClient()\n\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { data: contractorData } = useContractorsGetSuspense({ contractorUuid: contractorId })\n const { data: addressData } = useContractorsGetAddressSuspense({ contractorUuid: contractorId })\n\n const { mutateAsync: updateAddress, isPending: isUpdatingAddressPending } =\n useContractorsUpdateAddressMutation()\n\n const contractor = contractorData.contractor\n const contractorType = contractorData.contractor?.type\n const address = addressData.contractorAddress\n\n const formDefaultValues = {\n street1: address?.street1 || defaultValues?.street1 || '',\n street2: address?.street2 || defaultValues?.street2 || '',\n city: address?.city || defaultValues?.city || '',\n state: address?.state || defaultValues?.state || '',\n zip: address?.zip || defaultValues?.zip || '',\n }\n\n const formMethods = useForm<AddressFormValues>({\n resolver: zodResolver(AddressFormSchema),\n defaultValues: formDefaultValues,\n })\n\n const onSubmit = async (data: AddressFormValues) => {\n await baseSubmitHandler(data, async payload => {\n const { contractorAddress } = await updateAddress({\n request: {\n contractorUuid: contractorId,\n requestBody: {\n version: address?.version as string,\n street1: payload.street1,\n street2: payload.street2,\n city: payload.city,\n state: payload.state,\n zip: payload.zip,\n },\n },\n })\n\n await invalidateContractorsGetAddress(queryClient, [contractorId])\n\n onEvent(contractorEvents.CONTRACTOR_ADDRESS_UPDATED, contractorAddress)\n onEvent(contractorEvents.CONTRACTOR_ADDRESS_DONE)\n })\n }\n\n return (\n <section className={className}>\n <AddressProvider\n value={{\n contractor,\n contractorType,\n address,\n isPending: isUpdatingAddressPending,\n }}\n >\n <FormProvider {...formMethods}>\n <HtmlForm onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </HtmlForm>\n </FormProvider>\n </AddressProvider>\n </section>\n )\n}\n\nAddress.Head = Head\nAddress.Form = Form\nAddress.Actions = Actions\n\nexport default Address\n"],"names":["Address","props","jsx","BaseComponent","Root","contractorId","defaultValues","children","className","dictionary","useComponentDictionary","useI18n","queryClient","useQueryClient","onEvent","baseSubmitHandler","useBase","contractorData","useContractorsGetSuspense","addressData","useContractorsGetAddressSuspense","updateAddress","isUpdatingAddressPending","useContractorsUpdateAddressMutation","contractor","contractorType","address","formDefaultValues","formMethods","useForm","zodResolver","AddressFormSchema","onSubmit","data","payload","contractorAddress","invalidateContractorsGetAddress","contractorEvents","AddressProvider","FormProvider","HtmlForm","Flex","jsxs","Fragment","Head","Form","Actions"],"mappings":";;;;;;;;;;;;;;;;;AA8BO,SAASA,EAAQC,GAAqB;AAEzC,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,SAASG,EAAK,EAAE,cAAAC,GAAc,eAAAC,GAAe,UAAAC,GAAU,WAAAC,GAAW,YAAAC,KAA4B;AAC5F,EAAAC,EAAuB,sBAAsBD,CAAU,GACvDE,EAAQ,oBAAoB;AAC5B,QAAMC,IAAcC,EAAe,GAE7B,EAAE,SAAAC,GAAS,mBAAAC,EAAkB,IAAIC,EAAQ,GAEzC,EAAE,MAAMC,EAAe,IAAIC,EAA0B,EAAE,gBAAgBb,GAAc,GACrF,EAAE,MAAMc,EAAY,IAAIC,EAAiC,EAAE,gBAAgBf,GAAc,GAEzF,EAAE,aAAagB,GAAe,WAAWC,EAAA,IAC7CC,EAAoC,GAEhCC,IAAaP,EAAe,YAC5BQ,IAAiBR,EAAe,YAAY,MAC5CS,IAAUP,EAAY,mBAEtBQ,IAAoB;AAAA,IACxB,SAASD,GAAS,WAAWpB,GAAe,WAAW;AAAA,IACvD,SAASoB,GAAS,WAAWpB,GAAe,WAAW;AAAA,IACvD,MAAMoB,GAAS,QAAQpB,GAAe,QAAQ;AAAA,IAC9C,OAAOoB,GAAS,SAASpB,GAAe,SAAS;AAAA,IACjD,KAAKoB,GAAS,OAAOpB,GAAe,OAAO;AAAA,EAC7C,GAEMsB,IAAcC,EAA2B;AAAA,IAC7C,UAAUC,EAAYC,CAAiB;AAAA,IACvC,eAAeJ;AAAA,EAAA,CAChB,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Element;
@@ -0,0 +1,57 @@
1
+ import { jsxs as s, jsx as r } from "react/jsx-runtime";
2
+ import { useTranslation as i } from "react-i18next";
3
+ import { Grid as o } from "../../Common/Grid/Grid.js";
4
+ import { STATES_ABBR as l } from "../../../shared/constants.js";
5
+ import { TextInputField as t } from "../../Common/Fields/TextInputField/TextInputField.js";
6
+ import { SelectField as m } from "../../Common/Fields/SelectField/SelectField.js";
7
+ function g() {
8
+ const { t: e } = i("Contractor.Address");
9
+ return /* @__PURE__ */ s(o, { gridTemplateColumns: { base: "1fr", small: ["1fr", "1fr"] }, gap: 20, children: [
10
+ /* @__PURE__ */ r(
11
+ t,
12
+ {
13
+ name: "street1",
14
+ label: e("street1"),
15
+ isRequired: !0,
16
+ errorMessage: e("validations.street1")
17
+ }
18
+ ),
19
+ /* @__PURE__ */ r(t, { name: "street2", label: e("street2", "Street 2") }),
20
+ /* @__PURE__ */ r(
21
+ t,
22
+ {
23
+ name: "city",
24
+ label: e("city", "City"),
25
+ isRequired: !0,
26
+ errorMessage: e("validations.city")
27
+ }
28
+ ),
29
+ /* @__PURE__ */ r(
30
+ m,
31
+ {
32
+ name: "state",
33
+ options: l.map((a) => ({
34
+ label: e(`statesHash.${a}`, { ns: "common", defaultValue: a }),
35
+ value: a
36
+ })),
37
+ label: e("state", "State"),
38
+ placeholder: e("statePlaceholder"),
39
+ errorMessage: e("validations.state"),
40
+ isRequired: !0
41
+ }
42
+ ),
43
+ /* @__PURE__ */ r(
44
+ t,
45
+ {
46
+ name: "zip",
47
+ label: e("zip", "Zip"),
48
+ isRequired: !0,
49
+ errorMessage: e("validations.zip")
50
+ }
51
+ )
52
+ ] });
53
+ }
54
+ export {
55
+ g as Form
56
+ };
57
+ //# sourceMappingURL=Form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Form.js","sources":["../../../../src/components/Contractor/Address/Form.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { TextInputField, SelectField, Grid } from '@/components/Common'\nimport { STATES_ABBR } from '@/shared/constants'\n\nexport function Form() {\n const { t } = useTranslation('Contractor.Address')\n\n return (\n <Grid gridTemplateColumns={{ base: '1fr', small: ['1fr', '1fr'] }} gap={20}>\n <TextInputField\n name=\"street1\"\n label={t('street1')}\n isRequired\n errorMessage={t('validations.street1')}\n />\n <TextInputField name=\"street2\" label={t('street2', 'Street 2')} />\n <TextInputField\n name=\"city\"\n label={t('city', 'City')}\n isRequired\n errorMessage={t('validations.city')}\n />\n <SelectField\n name=\"state\"\n options={STATES_ABBR.map(stateAbbr => ({\n label: t(`statesHash.${stateAbbr}`, { ns: 'common', defaultValue: stateAbbr }),\n value: stateAbbr,\n }))}\n label={t('state', 'State')}\n placeholder={t('statePlaceholder')}\n errorMessage={t('validations.state')}\n isRequired\n />\n <TextInputField\n name=\"zip\"\n label={t('zip', 'Zip')}\n isRequired\n errorMessage={t('validations.zip')}\n />\n </Grid>\n )\n}\n"],"names":["Form","t","useTranslation","jsxs","Grid","jsx","TextInputField","SelectField","STATES_ABBR","stateAbbr"],"mappings":";;;;;;AAIO,SAASA,IAAO;AACrB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,oBAAoB;AAEjD,SACG,gBAAAC,EAAAC,GAAA,EAAK,qBAAqB,EAAE,MAAM,OAAO,OAAO,CAAC,OAAO,KAAK,EAAE,GAAG,KAAK,IACtE,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOL,EAAE,SAAS;AAAA,QAClB,YAAU;AAAA,QACV,cAAcA,EAAE,qBAAqB;AAAA,MAAA;AAAA,IACvC;AAAA,IACA,gBAAAI,EAACC,KAAe,MAAK,WAAU,OAAOL,EAAE,WAAW,UAAU,GAAG;AAAA,IAChE,gBAAAI;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOL,EAAE,QAAQ,MAAM;AAAA,QACvB,YAAU;AAAA,QACV,cAAcA,EAAE,kBAAkB;AAAA,MAAA;AAAA,IACpC;AAAA,IACA,gBAAAI;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,SAASC,EAAY,IAAI,CAAcC,OAAA;AAAA,UACrC,OAAOR,EAAE,cAAcQ,CAAS,IAAI,EAAE,IAAI,UAAU,cAAcA,GAAW;AAAA,UAC7E,OAAOA;AAAA,QAAA,EACP;AAAA,QACF,OAAOR,EAAE,SAAS,OAAO;AAAA,QACzB,aAAaA,EAAE,kBAAkB;AAAA,QACjC,cAAcA,EAAE,mBAAmB;AAAA,QACnC,YAAU;AAAA,MAAA;AAAA,IACZ;AAAA,IACA,gBAAAI;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOL,EAAE,OAAO,KAAK;AAAA,QACrB,YAAU;AAAA,QACV,cAAcA,EAAE,iBAAiB;AAAA,MAAA;AAAA,IAAA;AAAA,EACnC,GACF;AAEJ;"}
@@ -0,0 +1 @@
1
+ export declare function Head(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { jsxs as n, jsx as o } from "react/jsx-runtime";
2
+ import { useTranslation as t } from "react-i18next";
3
+ import { useAddress as i } from "./useAddress.js";
4
+ import { useComponentContext as d } from "../../../contexts/ComponentAdapter/useComponentContext.js";
5
+ function a() {
6
+ const { t: s } = t("Contractor.Address"), { contractorType: e } = i(), r = d();
7
+ return /* @__PURE__ */ n("header", { children: [
8
+ /* @__PURE__ */ o(r.Heading, { as: "h2", children: s(e === "Business" ? "businessAddressTitle" : "homeAddressTitle") }),
9
+ /* @__PURE__ */ o(r.Text, { children: s(e === "Business" ? "businessAddressDescription" : "homeAddressDescription") })
10
+ ] });
11
+ }
12
+ export {
13
+ a as Head
14
+ };
15
+ //# sourceMappingURL=Head.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Head.js","sources":["../../../../src/components/Contractor/Address/Head.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useAddress } from './useAddress'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport function Head() {\n const { t } = useTranslation('Contractor.Address')\n const { contractorType } = useAddress()\n const Components = useComponentContext()\n\n return (\n <header>\n <Components.Heading as=\"h2\">\n {contractorType === 'Business' ? t('businessAddressTitle') : t('homeAddressTitle')}\n </Components.Heading>\n <Components.Text>\n {contractorType === 'Business'\n ? t('businessAddressDescription')\n : t('homeAddressDescription')}\n </Components.Text>\n </header>\n )\n}\n"],"names":["Head","t","useTranslation","contractorType","useAddress","Components","useComponentContext","jsx"],"mappings":";;;;AAIO,SAASA,IAAO;AACrB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,oBAAoB,GAC3C,EAAE,gBAAAC,EAAe,IAAIC,EAAW,GAChCC,IAAaC,EAAoB;AAEvC,2BACG,UACC,EAAA,UAAA;AAAA,IAAA,gBAAAC,EAACF,EAAW,SAAX,EAAmB,IAAG,MACpB,UAAgCJ,EAAhCE,MAAmB,aAAe,yBAA4B,kBAAN,EAC3D,CAAA;AAAA,IACA,gBAAAI,EAACF,EAAW,MAAX,EACE,UACGJ,EADHE,MAAmB,aACd,+BACA,wBAD4B,EAEpC,CAAA;AAAA,EAAA,GACF;AAEJ;"}
@@ -0,0 +1,2 @@
1
+ import "./types/i18next.d.ts"
2
+ export { Address } from './Address';