@gusto/embedded-react-sdk 0.10.7-rc.2 → 0.11.0-rc.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.
Files changed (135) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/Common/HamburgerMenu/HamburgerMenu.js +20 -19
  3. package/dist/components/Common/HamburgerMenu/HamburgerMenu.js.map +1 -1
  4. package/dist/components/Common/ReorderableList/ReorderableItem.js +1 -1
  5. package/dist/components/Common/ReorderableList/ReorderableItem.js.map +1 -1
  6. package/dist/components/Common/UI/Button/Button.d.ts +1 -1
  7. package/dist/components/Common/UI/Button/Button.js +4 -4
  8. package/dist/components/Common/UI/Button/Button.js.map +1 -1
  9. package/dist/components/Common/UI/Button/ButtonTypes.d.ts +1 -1
  10. package/dist/components/Company/AssignSignatory/AssignSignatory.d.ts +0 -5
  11. package/dist/components/Company/AssignSignatory/AssignSignatory.js +39 -42
  12. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  13. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.d.ts +0 -4
  14. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +51 -53
  15. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
  16. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.d.ts +0 -4
  17. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +40 -42
  18. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
  19. package/dist/components/Company/AssignSignatory/index.d.ts +0 -1
  20. package/dist/components/Company/BankAccount/BankAccount.d.ts +0 -5
  21. package/dist/components/Company/BankAccount/BankAccount.js +17 -23
  22. package/dist/components/Company/BankAccount/BankAccount.js.map +1 -1
  23. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.d.ts +0 -5
  24. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +28 -31
  25. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js.map +1 -1
  26. package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.d.ts +0 -5
  27. package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js +25 -28
  28. package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js.map +1 -1
  29. package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.d.ts +0 -5
  30. package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js +33 -36
  31. package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js.map +1 -1
  32. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.d.ts +0 -6
  33. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +37 -41
  34. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  35. package/dist/components/Company/DocumentSigner/DocumentSigner.d.ts +0 -4
  36. package/dist/components/Company/DocumentSigner/DocumentSigner.js +23 -26
  37. package/dist/components/Company/DocumentSigner/DocumentSigner.js.map +1 -1
  38. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.d.ts +0 -6
  39. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +40 -44
  40. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  41. package/dist/components/Company/Industry/Industry.d.ts +0 -5
  42. package/dist/components/Company/Industry/Industry.js +23 -29
  43. package/dist/components/Company/Industry/Industry.js.map +1 -1
  44. package/dist/components/Company/Locations/LocationForm/LocationForm.d.ts +0 -5
  45. package/dist/components/Company/Locations/LocationForm/LocationForm.js +41 -44
  46. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  47. package/dist/components/Company/Locations/Locations.d.ts +0 -4
  48. package/dist/components/Company/Locations/Locations.js +14 -18
  49. package/dist/components/Company/Locations/Locations.js.map +1 -1
  50. package/dist/components/Company/Locations/LocationsList/LocationsList.d.ts +0 -5
  51. package/dist/components/Company/Locations/LocationsList/LocationsList.js +28 -31
  52. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  53. package/dist/components/Company/PaySchedule/PaySchedule.d.ts +1 -7
  54. package/dist/components/Company/PaySchedule/PaySchedule.js +67 -71
  55. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  56. package/dist/components/Company/StateTaxes/StateTaxes.d.ts +0 -4
  57. package/dist/components/Company/StateTaxes/StateTaxes.js +39 -22
  58. package/dist/components/Company/StateTaxes/StateTaxes.js.map +1 -1
  59. package/dist/components/Company/StateTaxes/StateTaxesComponents.d.ts +8 -6
  60. package/dist/components/Company/StateTaxes/StateTaxesComponents.js +16 -15
  61. package/dist/components/Company/StateTaxes/StateTaxesComponents.js.map +1 -1
  62. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.d.ts +0 -5
  63. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +44 -47
  64. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  65. package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.d.ts +0 -5
  66. package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js +26 -29
  67. package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js.map +1 -1
  68. package/dist/components/Company/StateTaxes/stateTaxesReducer.d.ts +20 -0
  69. package/dist/components/Company/StateTaxes/stateTaxesReducer.js +40 -0
  70. package/dist/components/Company/StateTaxes/stateTaxesReducer.js.map +1 -0
  71. package/dist/components/Contractor/Address/Address.d.ts +0 -5
  72. package/dist/components/Contractor/Address/Address.js +35 -38
  73. package/dist/components/Contractor/Address/Address.js.map +1 -1
  74. package/dist/components/Contractor/Profile/ContractorProfile.d.ts +11 -0
  75. package/dist/components/Contractor/Profile/ContractorProfile.js +24 -0
  76. package/dist/components/Contractor/Profile/ContractorProfile.js.map +1 -0
  77. package/dist/components/Contractor/Profile/ContractorProfileForm.d.ts +5 -0
  78. package/dist/components/Contractor/Profile/ContractorProfileForm.js +140 -0
  79. package/dist/components/Contractor/Profile/ContractorProfileForm.js.map +1 -0
  80. package/dist/components/Contractor/Profile/index.d.ts +3 -0
  81. package/dist/components/Contractor/Profile/useContractorProfile.d.ts +254 -0
  82. package/dist/components/Contractor/Profile/useContractorProfile.js +223 -0
  83. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -0
  84. package/dist/components/Contractor/Submit/ContractorSubmitWithApi.d.ts +6 -0
  85. package/dist/components/Contractor/Submit/ContractorSubmitWithApi.js +27 -0
  86. package/dist/components/Contractor/Submit/ContractorSubmitWithApi.js.map +1 -0
  87. package/dist/components/Contractor/Submit/SubmitDone.d.ts +5 -0
  88. package/dist/components/Contractor/Submit/SubmitDone.js +18 -0
  89. package/dist/components/Contractor/Submit/SubmitDone.js.map +1 -0
  90. package/dist/components/Contractor/Submit/index.d.ts +6 -0
  91. package/dist/components/Contractor/Submit/index.js +18 -0
  92. package/dist/components/Contractor/Submit/index.js.map +1 -0
  93. package/dist/components/Contractor/Submit/index.module.scss.js +8 -0
  94. package/dist/components/Contractor/Submit/index.module.scss.js.map +1 -0
  95. package/dist/components/Contractor/index.d.ts +2 -0
  96. package/dist/components/Contractor/index.js +10 -6
  97. package/dist/components/Contractor/index.js.map +1 -1
  98. package/dist/components/Employee/Compensation/Compensation.d.ts +0 -6
  99. package/dist/components/Employee/Compensation/Compensation.js +97 -102
  100. package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
  101. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.d.ts +0 -5
  102. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +25 -28
  103. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  104. package/dist/components/Employee/DocumentSigner/DocumentSigner.d.ts +1 -7
  105. package/dist/components/Employee/DocumentSigner/DocumentSigner.js +16 -20
  106. package/dist/components/Employee/DocumentSigner/DocumentSigner.js.map +1 -1
  107. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.d.ts +0 -7
  108. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +40 -44
  109. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  110. package/dist/components/Employee/EmployeeList/EmployeeList.d.ts +0 -5
  111. package/dist/components/Employee/EmployeeList/EmployeeList.js +56 -59
  112. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  113. package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +3 -3
  114. package/dist/components/Employee/Profile/PersonalDetailsInputs.d.ts +2 -2
  115. package/dist/components/Employee/Profile/Profile.d.ts +0 -8
  116. package/dist/components/Employee/Profile/Profile.js +131 -138
  117. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  118. package/dist/components/Employee/Taxes/Taxes.d.ts +0 -6
  119. package/dist/components/Employee/Taxes/Taxes.js +76 -81
  120. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  121. package/dist/i18n/I18n.js +1 -1
  122. package/dist/i18n/I18n.js.map +1 -1
  123. package/dist/i18n/en/Contractor.ContractorSubmit.json.js +22 -0
  124. package/dist/i18n/en/Contractor.ContractorSubmit.json.js.map +1 -0
  125. package/dist/i18n/en/Contractor.Profile.json.js +73 -0
  126. package/dist/i18n/en/Contractor.Profile.json.js.map +1 -0
  127. package/dist/shared/constants.d.ts +14 -0
  128. package/dist/shared/constants.js +33 -26
  129. package/dist/shared/constants.js.map +1 -1
  130. package/dist/style.css +1 -1
  131. package/dist/types/i18next.d.ts +77 -1
  132. package/package.json +2 -2
  133. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.d.ts +0 -5
  134. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js +0 -48
  135. package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js.map +0 -1
@@ -1,34 +1,34 @@
1
- import { jsx as o, jsxs as N, Fragment as O } from "react/jsx-runtime";
2
- import { useForm as S, FormProvider as x } from "react-hook-form";
3
- import { zodResolver as R } from "@hookform/resolvers/zod";
4
- import { useLocationsUpdateMutation as q } from "@gusto/embedded-api/react-query/locationsUpdate";
5
- import { useLocationsRetrieveSuspense as B } from "@gusto/embedded-api/react-query/locationsRetrieve";
6
- import { useLocationsCreateMutation as I } from "@gusto/embedded-api/react-query/locationsCreate";
7
- import { Head as f } from "./Head.js";
8
- import { LocationFormSchema as M, Form as l } from "./Form.js";
9
- import { Actions as A } from "./Actions.js";
10
- import { LocationsFormProvider as _ } from "./useLocationForm.js";
11
- import { Form as w } from "../../../Common/Form/Form.js";
12
- import { Flex as z } from "../../../Common/Flex/Flex.js";
13
- import { BaseComponent as H } from "../../../Base/Base.js";
1
+ import { jsx as o, jsxs as T, Fragment as b } from "react/jsx-runtime";
2
+ import { useForm as D, FormProvider as E } from "react-hook-form";
3
+ import { zodResolver as N } from "@hookform/resolvers/zod";
4
+ import { useLocationsUpdateMutation as O } from "@gusto/embedded-api/react-query/locationsUpdate";
5
+ import { useLocationsRetrieveSuspense as S } from "@gusto/embedded-api/react-query/locationsRetrieve";
6
+ import { useLocationsCreateMutation as x } from "@gusto/embedded-api/react-query/locationsCreate";
7
+ import { Head as R } from "./Head.js";
8
+ import { LocationFormSchema as q, Form as B } from "./Form.js";
9
+ import { Actions as I } from "./Actions.js";
10
+ import { LocationsFormProvider as M } from "./useLocationForm.js";
11
+ import { Form as _ } from "../../../Common/Form/Form.js";
12
+ import { Flex as w } from "../../../Common/Flex/Flex.js";
13
+ import { BaseComponent as z } from "../../../Base/Base.js";
14
14
  import { useBase as U } from "../../../Base/useBase.js";
15
15
  import { useI18n as j } from "../../../../i18n/I18n.js";
16
16
  import { componentEvents as a } from "../../../../shared/constants.js";
17
- function Y(t) {
17
+ function H(t) {
18
18
  const {
19
19
  data: { location: e }
20
- } = B({ locationId: t.locationId });
21
- return /* @__PURE__ */ o(g, { ...t, location: e });
20
+ } = S({ locationId: t.locationId });
21
+ return /* @__PURE__ */ o(p, { ...t, location: e });
22
22
  }
23
- function g({
23
+ function p({
24
24
  companyId: t,
25
25
  location: e,
26
26
  className: n,
27
27
  children: r
28
28
  }) {
29
29
  j("Company.Locations");
30
- const { onEvent: s, baseSubmitHandler: y } = U(), { mutateAsync: L, isPending: h } = I(), { mutateAsync: v, isPending: C } = q(), F = ["mailingAddress", "filingAddress"], { control: P, ...c } = S({
31
- resolver: R(M),
30
+ const { onEvent: s, baseSubmitHandler: f } = U(), { mutateAsync: l, isPending: A } = x(), { mutateAsync: g, isPending: y } = O(), L = ["mailingAddress", "filingAddress"], { control: h, ...d } = D({
31
+ resolver: N(q),
32
32
  defaultValues: {
33
33
  city: e?.city ?? "",
34
34
  phoneNumber: e?.phoneNumber ?? "",
@@ -36,61 +36,58 @@ function g({
36
36
  street2: e?.street2 ?? "",
37
37
  state: e?.state ?? "",
38
38
  zip: e?.zip ?? "",
39
- addressType: F.filter((i) => e?.[i] ?? !1)
39
+ addressType: L.filter((i) => e?.[i] ?? !1)
40
40
  }
41
- }), T = () => {
41
+ }), v = () => {
42
42
  s(a.CANCEL);
43
- }, b = async (i) => {
44
- await y(i, async (D) => {
45
- const { addressType: u, ...E } = D, p = {
46
- ...E,
47
- mailingAddress: u?.includes("mailingAddress"),
48
- filingAddress: u?.includes("filingAddress")
43
+ }, C = async (i) => {
44
+ await f(i, async (F) => {
45
+ const { addressType: c, ...P } = F, u = {
46
+ ...P,
47
+ mailingAddress: c?.includes("mailingAddress"),
48
+ filingAddress: c?.includes("filingAddress")
49
49
  };
50
50
  if (e && e.version !== void 0) {
51
- const { location: m } = await v({
51
+ const { location: m } = await g({
52
52
  request: {
53
53
  locationId: e.uuid,
54
- requestBody: { ...p, version: e.version }
54
+ requestBody: { ...u, version: e.version }
55
55
  }
56
56
  });
57
57
  s(a.COMPANY_LOCATION_UPDATED, m);
58
58
  } else {
59
- const { location: m } = await L({
59
+ const { location: m } = await l({
60
60
  request: {
61
61
  companyId: t,
62
- requestBody: p
62
+ requestBody: u
63
63
  }
64
64
  });
65
65
  s(a.COMPANY_LOCATION_CREATED, m);
66
66
  }
67
67
  });
68
68
  };
69
- return /* @__PURE__ */ o("section", { className: n, children: /* @__PURE__ */ o(x, { ...c, control: P, children: /* @__PURE__ */ o(w, { onSubmit: c.handleSubmit(b), children: /* @__PURE__ */ o(
70
- _,
69
+ return /* @__PURE__ */ o("section", { className: n, children: /* @__PURE__ */ o(E, { ...d, control: h, children: /* @__PURE__ */ o(_, { onSubmit: d.handleSubmit(C), children: /* @__PURE__ */ o(
70
+ M,
71
71
  {
72
- value: { handleCancel: T, isPending: h || C },
73
- children: /* @__PURE__ */ o(z, { flexDirection: "column", gap: 32, children: r || /* @__PURE__ */ N(O, { children: [
74
- /* @__PURE__ */ o(f, {}),
75
- /* @__PURE__ */ o(l, {}),
76
- /* @__PURE__ */ o(A, {})
72
+ value: { handleCancel: v, isPending: A || y },
73
+ children: /* @__PURE__ */ o(w, { flexDirection: "column", gap: 32, children: r || /* @__PURE__ */ T(b, { children: [
74
+ /* @__PURE__ */ o(R, {}),
75
+ /* @__PURE__ */ o(B, {}),
76
+ /* @__PURE__ */ o(I, {})
77
77
  ] }) })
78
78
  }
79
79
  ) }) }) });
80
80
  }
81
- function d({
81
+ function ne({
82
82
  companyId: t,
83
83
  locationId: e,
84
84
  className: n,
85
85
  children: r,
86
86
  ...s
87
87
  }) {
88
- return /* @__PURE__ */ o(H, { ...s, children: e ? /* @__PURE__ */ o(Y, { companyId: t, locationId: e, className: n, children: r }) : /* @__PURE__ */ o(g, { companyId: t, className: n, children: r }) });
88
+ return /* @__PURE__ */ o(z, { ...s, children: e ? /* @__PURE__ */ o(H, { companyId: t, locationId: e, className: n, children: r }) : /* @__PURE__ */ o(p, { companyId: t, className: n, children: r }) });
89
89
  }
90
- d.Head = f;
91
- d.Form = l;
92
- d.Actions = A;
93
90
  export {
94
- d as LocationForm
91
+ ne as LocationForm
95
92
  };
96
93
  //# sourceMappingURL=LocationForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LocationForm.js","sources":["../../../../../src/components/Company/Locations/LocationForm/LocationForm.tsx"],"sourcesContent":["import { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useLocationsUpdateMutation } from '@gusto/embedded-api/react-query/locationsUpdate'\nimport { useLocationsRetrieveSuspense } from '@gusto/embedded-api/react-query/locationsRetrieve'\nimport { useLocationsCreateMutation } from '@gusto/embedded-api/react-query/locationsCreate'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { Head } from './Head'\nimport type { LocationFormInputs } from './Form'\nimport { Form, LocationFormSchema } from './Form'\nimport { Actions } from './Actions'\nimport { LocationsFormProvider } from './useLocationForm'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { Flex } from '@/components/Common'\nimport type { BaseComponentInterface, CommonComponentInterface } from '@/components/Base'\nimport { BaseComponent, useBase } from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport type { WithRequired } from '@/types/Helpers'\n\ninterface LocationFormProps extends CommonComponentInterface {\n companyId: string\n locationId?: string\n}\n\n/**Accounting for conditional logic where location data needs to be fetched only if locationId is present */\nfunction RootWithLocation(props: WithRequired<LocationFormProps, 'locationId'>) {\n const {\n data: { location },\n } = useLocationsRetrieveSuspense({ locationId: props.locationId })\n return <Root {...props} location={location} />\n}\n\nfunction Root({\n companyId,\n location,\n className,\n children,\n}: LocationFormProps & { location?: Location }) {\n useI18n('Company.Locations')\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { mutateAsync: createLocation, isPending: isPendingCreate } = useLocationsCreateMutation()\n const { mutateAsync: updateLocation, isPending: isPendingUpdate } = useLocationsUpdateMutation()\n const addressType = ['mailingAddress', 'filingAddress'] as const\n\n const { control, ...methods } = useForm<LocationFormInputs>({\n resolver: zodResolver(LocationFormSchema),\n defaultValues: {\n city: location?.city ?? '',\n phoneNumber: location?.phoneNumber ?? '',\n street1: location?.street1 ?? '',\n street2: location?.street2 ?? '',\n state: location?.state ?? '',\n zip: location?.zip ?? '',\n addressType: addressType.filter(key => location?.[key] ?? false),\n },\n })\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n const onSubmit = async (data: LocationFormInputs) => {\n await baseSubmitHandler(data, async innerData => {\n const { addressType, ...payload } = innerData\n\n const requestBody = {\n ...payload,\n mailingAddress: addressType?.includes('mailingAddress'),\n filingAddress: addressType?.includes('filingAddress'),\n }\n\n if (location && location.version !== undefined) {\n // Edit existing location\n const { location: responseData } = await updateLocation({\n request: {\n locationId: location.uuid,\n requestBody: { ...requestBody, version: location.version },\n },\n })\n onEvent(componentEvents.COMPANY_LOCATION_UPDATED, responseData)\n } else {\n // Add new location\n const { location: responseData } = await createLocation({\n request: {\n companyId,\n requestBody,\n },\n })\n onEvent(componentEvents.COMPANY_LOCATION_CREATED, responseData)\n }\n })\n }\n\n return (\n <section className={className}>\n <FormProvider {...methods} control={control}>\n <HtmlForm onSubmit={methods.handleSubmit(onSubmit)}>\n <LocationsFormProvider\n value={{ handleCancel, isPending: isPendingCreate || isPendingUpdate }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </LocationsFormProvider>\n </HtmlForm>\n </FormProvider>\n </section>\n )\n}\n\nexport function LocationForm({\n companyId,\n locationId,\n className,\n children,\n ...props\n}: LocationFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n {locationId ? (\n <RootWithLocation companyId={companyId} locationId={locationId} className={className}>\n {children}\n </RootWithLocation>\n ) : (\n <Root companyId={companyId} className={className}>\n {children}\n </Root>\n )}\n </BaseComponent>\n )\n}\n\nLocationForm.Head = Head\nLocationForm.Form = Form\nLocationForm.Actions = Actions\n"],"names":["RootWithLocation","props","location","useLocationsRetrieveSuspense","jsx","Root","companyId","className","children","useI18n","onEvent","baseSubmitHandler","useBase","createLocation","isPendingCreate","useLocationsCreateMutation","updateLocation","isPendingUpdate","useLocationsUpdateMutation","addressType","control","methods","useForm","zodResolver","LocationFormSchema","key","handleCancel","componentEvents","onSubmit","data","innerData","payload","requestBody","responseData","FormProvider","HtmlForm","LocationsFormProvider","Flex","jsxs","Fragment","Head","Form","Actions","LocationForm","locationId","BaseComponent"],"mappings":";;;;;;;;;;;;;;;;AAyBA,SAASA,EAAiBC,GAAsD;AACxE,QAAA;AAAA,IACJ,MAAM,EAAE,UAAAC,EAAS;AAAA,MACfC,EAA6B,EAAE,YAAYF,EAAM,YAAY;AACjE,SAAQ,gBAAAG,EAAAC,GAAA,EAAM,GAAGJ,GAAO,UAAAC,EAAoB,CAAA;AAC9C;AAEA,SAASG,EAAK;AAAA,EACZ,WAAAC;AAAA,EACA,UAAAJ;AAAA,EACA,WAAAK;AAAA,EACA,UAAAC;AACF,GAAgD;AAC9C,EAAAC,EAAQ,mBAAmB;AAC3B,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAkB,IAAIC,EAAQ,GAEzC,EAAE,aAAaC,GAAgB,WAAWC,EAAA,IAAoBC,EAA2B,GACzF,EAAE,aAAaC,GAAgB,WAAWC,EAAA,IAAoBC,EAA2B,GACzFC,IAAc,CAAC,kBAAkB,eAAe,GAEhD,EAAE,SAAAC,GAAS,GAAGC,EAAA,IAAYC,EAA4B;AAAA,IAC1D,UAAUC,EAAYC,CAAkB;AAAA,IACxC,eAAe;AAAA,MACb,MAAMtB,GAAU,QAAQ;AAAA,MACxB,aAAaA,GAAU,eAAe;AAAA,MACtC,SAASA,GAAU,WAAW;AAAA,MAC9B,SAASA,GAAU,WAAW;AAAA,MAC9B,OAAOA,GAAU,SAAS;AAAA,MAC1B,KAAKA,GAAU,OAAO;AAAA,MACtB,aAAaiB,EAAY,OAAO,OAAOjB,IAAWuB,CAAG,KAAK,EAAK;AAAA,IAAA;AAAA,EACjE,CACD,GAEKC,IAAe,MAAM;AACzB,IAAAhB,EAAQiB,EAAgB,MAAM;AAAA,EAChC,GACMC,IAAW,OAAOC,MAA6B;AAC7C,UAAAlB,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AEJ,CAAA;AAAA,IAAA;AAAA,EAAA,EAEJ,CAAA,EACF,CAAA,GACF;AAEJ;AAEO,SAASC,EAAa;AAAA,EAC3B,WAAArC;AAAA,EACA,YAAAsC;AAAA,EACA,WAAArC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGP;AACL,GAA+C;AAC7C,2BACG4C,GAAe,EAAA,GAAG5C,GAChB,UAAA2C,sBACE5C,GAAiB,EAAA,WAAAM,GAAsB,YAAAsC,GAAwB,WAAArC,GAC7D,UAAAC,GACH,IAEA,gBAAAJ,EAACC,KAAK,WAAAC,GAAsB,WAAAC,GACzB,UAAAC,EACH,CAAA,GAEJ;AAEJ;AAEAmC,EAAa,OAAOH;AACpBG,EAAa,OAAOF;AACpBE,EAAa,UAAUD;"}
1
+ {"version":3,"file":"LocationForm.js","sources":["../../../../../src/components/Company/Locations/LocationForm/LocationForm.tsx"],"sourcesContent":["import { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useLocationsUpdateMutation } from '@gusto/embedded-api/react-query/locationsUpdate'\nimport { useLocationsRetrieveSuspense } from '@gusto/embedded-api/react-query/locationsRetrieve'\nimport { useLocationsCreateMutation } from '@gusto/embedded-api/react-query/locationsCreate'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { Head } from './Head'\nimport type { LocationFormInputs } from './Form'\nimport { Form, LocationFormSchema } from './Form'\nimport { Actions } from './Actions'\nimport { LocationsFormProvider } from './useLocationForm'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { Flex } from '@/components/Common'\nimport type { BaseComponentInterface, CommonComponentInterface } from '@/components/Base'\nimport { BaseComponent, useBase } from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport type { WithRequired } from '@/types/Helpers'\n\ninterface LocationFormProps extends CommonComponentInterface {\n companyId: string\n locationId?: string\n}\n\n/**Accounting for conditional logic where location data needs to be fetched only if locationId is present */\nfunction RootWithLocation(props: WithRequired<LocationFormProps, 'locationId'>) {\n const {\n data: { location },\n } = useLocationsRetrieveSuspense({ locationId: props.locationId })\n return <Root {...props} location={location} />\n}\n\nfunction Root({\n companyId,\n location,\n className,\n children,\n}: LocationFormProps & { location?: Location }) {\n useI18n('Company.Locations')\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { mutateAsync: createLocation, isPending: isPendingCreate } = useLocationsCreateMutation()\n const { mutateAsync: updateLocation, isPending: isPendingUpdate } = useLocationsUpdateMutation()\n const addressType = ['mailingAddress', 'filingAddress'] as const\n\n const { control, ...methods } = useForm<LocationFormInputs>({\n resolver: zodResolver(LocationFormSchema),\n defaultValues: {\n city: location?.city ?? '',\n phoneNumber: location?.phoneNumber ?? '',\n street1: location?.street1 ?? '',\n street2: location?.street2 ?? '',\n state: location?.state ?? '',\n zip: location?.zip ?? '',\n addressType: addressType.filter(key => location?.[key] ?? false),\n },\n })\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n const onSubmit = async (data: LocationFormInputs) => {\n await baseSubmitHandler(data, async innerData => {\n const { addressType, ...payload } = innerData\n\n const requestBody = {\n ...payload,\n mailingAddress: addressType?.includes('mailingAddress'),\n filingAddress: addressType?.includes('filingAddress'),\n }\n\n if (location && location.version !== undefined) {\n // Edit existing location\n const { location: responseData } = await updateLocation({\n request: {\n locationId: location.uuid,\n requestBody: { ...requestBody, version: location.version },\n },\n })\n onEvent(componentEvents.COMPANY_LOCATION_UPDATED, responseData)\n } else {\n // Add new location\n const { location: responseData } = await createLocation({\n request: {\n companyId,\n requestBody,\n },\n })\n onEvent(componentEvents.COMPANY_LOCATION_CREATED, responseData)\n }\n })\n }\n\n return (\n <section className={className}>\n <FormProvider {...methods} control={control}>\n <HtmlForm onSubmit={methods.handleSubmit(onSubmit)}>\n <LocationsFormProvider\n value={{ handleCancel, isPending: isPendingCreate || isPendingUpdate }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </LocationsFormProvider>\n </HtmlForm>\n </FormProvider>\n </section>\n )\n}\n\nexport function LocationForm({\n companyId,\n locationId,\n className,\n children,\n ...props\n}: LocationFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n {locationId ? (\n <RootWithLocation companyId={companyId} locationId={locationId} className={className}>\n {children}\n </RootWithLocation>\n ) : (\n <Root companyId={companyId} className={className}>\n {children}\n </Root>\n )}\n </BaseComponent>\n )\n}\n"],"names":["RootWithLocation","props","location","useLocationsRetrieveSuspense","jsx","Root","companyId","className","children","useI18n","onEvent","baseSubmitHandler","useBase","createLocation","isPendingCreate","useLocationsCreateMutation","updateLocation","isPendingUpdate","useLocationsUpdateMutation","addressType","control","methods","useForm","zodResolver","LocationFormSchema","key","handleCancel","componentEvents","onSubmit","data","innerData","payload","requestBody","responseData","FormProvider","HtmlForm","LocationsFormProvider","Flex","jsxs","Fragment","Head","Form","Actions","LocationForm","locationId","BaseComponent"],"mappings":";;;;;;;;;;;;;;;;AAyBA,SAASA,EAAiBC,GAAsD;AACxE,QAAA;AAAA,IACJ,MAAM,EAAE,UAAAC,EAAS;AAAA,MACfC,EAA6B,EAAE,YAAYF,EAAM,YAAY;AACjE,SAAQ,gBAAAG,EAAAC,GAAA,EAAM,GAAGJ,GAAO,UAAAC,EAAoB,CAAA;AAC9C;AAEA,SAASG,EAAK;AAAA,EACZ,WAAAC;AAAA,EACA,UAAAJ;AAAA,EACA,WAAAK;AAAA,EACA,UAAAC;AACF,GAAgD;AAC9C,EAAAC,EAAQ,mBAAmB;AAC3B,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAkB,IAAIC,EAAQ,GAEzC,EAAE,aAAaC,GAAgB,WAAWC,EAAA,IAAoBC,EAA2B,GACzF,EAAE,aAAaC,GAAgB,WAAWC,EAAA,IAAoBC,EAA2B,GACzFC,IAAc,CAAC,kBAAkB,eAAe,GAEhD,EAAE,SAAAC,GAAS,GAAGC,EA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,UAAA,gBAAAH,EAAC8B,KAAc,GAAGb,GAAS,SAAAD,GACzB,UAAA,gBAAAhB,EAAC+B,GAAS,EAAA,UAAUd,EAAQ,aAAaO,CAAQ,GAC/C,UAAA,gBAAAxB;AAAA,IAACgC;AAAA,IAAA;AAAA,MACC,OAAO,EAAE,cAAAV,GAAc,WAAWZ,KAAmBG,EAAgB;AAAA,MAErE,UAAA,gBAAAb,EAACiC,KAAK,eAAc,UAAS,KAAK,IAC/B,UAAA7B,KAIG,gBAAA8B,EAAAC,GAAA,EAAA,UAAA;AAAA,QAAA,gBAAAnC,EAACoC,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;AAEO,SAASC,GAAa;AAAA,EAC3B,WAAArC;AAAA,EACA,YAAAsC;AAAA,EACA,WAAArC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGP;AACL,GAA+C;AAC7C,2BACG4C,GAAe,EAAA,GAAG5C,GAChB,UAAA2C,sBACE5C,GAAiB,EAAA,WAAAM,GAAsB,YAAAsC,GAAwB,WAAArC,GAC7D,UAAAC,GACH,IAEA,gBAAAJ,EAACC,KAAK,WAAAC,GAAsB,WAAAC,GACzB,UAAAC,EACH,CAAA,GAEJ;AAEJ;"}
@@ -3,7 +3,3 @@ export interface LocationsProps extends BaseComponentInterface<'Company.Location
3
3
  companyId: string;
4
4
  }
5
5
  export declare function Locations({ companyId, onEvent, dictionary }: LocationsProps): import("react/jsx-runtime").JSX.Element;
6
- export declare namespace Locations {
7
- var LocationsList: typeof import("./LocationsList").LocationsList;
8
- var LocationForm: typeof import("./LocationForm/LocationForm").LocationForm;
9
- }
@@ -1,27 +1,23 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import { createMachine as c } from "robot3";
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { createMachine as a } from "robot3";
3
3
  import { locationsStateMachine as e } from "./stateMachine.js";
4
- import { LocationsListContextual as s } from "./locationsStateMachine.js";
5
- import { LocationForm as p } from "./LocationForm/LocationForm.js";
6
- import { Flow as L } from "../../Flow/Flow.js";
7
- import { useComponentDictionary as f } from "../../../i18n/I18n.js";
8
- import { LocationsList as u } from "./LocationsList/LocationsList.js";
9
- function o({ companyId: t, onEvent: i, dictionary: n }) {
10
- f("Company.Locations", n);
11
- const m = c(
4
+ import { LocationsListContextual as c } from "./locationsStateMachine.js";
5
+ import { Flow as p } from "../../Flow/Flow.js";
6
+ import { useComponentDictionary as s } from "../../../i18n/I18n.js";
7
+ function C({ companyId: o, onEvent: t, dictionary: n }) {
8
+ s("Company.Locations", n);
9
+ const i = a(
12
10
  "index",
13
11
  e,
14
- (r) => ({
15
- ...r,
16
- component: s,
17
- companyId: t
12
+ (m) => ({
13
+ ...m,
14
+ component: c,
15
+ companyId: o
18
16
  })
19
17
  );
20
- return /* @__PURE__ */ a(L, { machine: m, onEvent: i });
18
+ return /* @__PURE__ */ r(p, { machine: i, onEvent: t });
21
19
  }
22
- o.LocationsList = u;
23
- o.LocationForm = p;
24
20
  export {
25
- o as Locations
21
+ C as Locations
26
22
  };
27
23
  //# sourceMappingURL=Locations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Locations.js","sources":["../../../../src/components/Company/Locations/Locations.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { type LocationsContextInterface } from './locationsStateMachine'\nimport { locationsStateMachine } from './stateMachine'\nimport { LocationsListContextual } from './locationsStateMachine'\nimport { LocationsList } from './LocationsList'\nimport { LocationForm } from './LocationForm/LocationForm'\nimport { Flow } from '@/components/Flow/Flow'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nexport interface LocationsProps extends BaseComponentInterface<'Company.Locations'> {\n companyId: string\n}\n\nexport function Locations({ companyId, onEvent, dictionary }: LocationsProps) {\n useComponentDictionary('Company.Locations', dictionary)\n\n const manageLocations = createMachine(\n 'index',\n locationsStateMachine,\n (initialContext: LocationsContextInterface) => ({\n ...initialContext,\n component: LocationsListContextual,\n companyId,\n }),\n )\n return <Flow machine={manageLocations} onEvent={onEvent} />\n}\n\nLocations.LocationsList = LocationsList\nLocations.LocationForm = LocationForm\n"],"names":["Locations","companyId","onEvent","dictionary","useComponentDictionary","manageLocations","createMachine","locationsStateMachine","initialContext","LocationsListContextual","jsx","Flow","LocationsList","LocationForm"],"mappings":";;;;;;;;AAcO,SAASA,EAAU,EAAE,WAAAC,GAAW,SAAAC,GAAS,YAAAC,KAA8B;AAC5E,EAAAC,EAAuB,qBAAqBD,CAAU;AAEtD,QAAME,IAAkBC;AAAA,IACtB;AAAA,IACAC;AAAA,IACA,CAACC,OAA+C;AAAA,MAC9C,GAAGA;AAAA,MACH,WAAWC;AAAA,MACX,WAAAR;AAAA,IACF;AAAA,EACF;AACA,SAAQ,gBAAAS,EAAAC,GAAA,EAAK,SAASN,GAAiB,SAAAH,EAAkB,CAAA;AAC3D;AAEAF,EAAU,gBAAgBY;AAC1BZ,EAAU,eAAea;"}
1
+ {"version":3,"file":"Locations.js","sources":["../../../../src/components/Company/Locations/Locations.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { type LocationsContextInterface } from './locationsStateMachine'\nimport { locationsStateMachine } from './stateMachine'\nimport { LocationsListContextual } from './locationsStateMachine'\nimport { Flow } from '@/components/Flow/Flow'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nexport interface LocationsProps extends BaseComponentInterface<'Company.Locations'> {\n companyId: string\n}\n\nexport function Locations({ companyId, onEvent, dictionary }: LocationsProps) {\n useComponentDictionary('Company.Locations', dictionary)\n\n const manageLocations = createMachine(\n 'index',\n locationsStateMachine,\n (initialContext: LocationsContextInterface) => ({\n ...initialContext,\n component: LocationsListContextual,\n companyId,\n }),\n )\n return <Flow machine={manageLocations} onEvent={onEvent} />\n}\n"],"names":["Locations","companyId","onEvent","dictionary","useComponentDictionary","manageLocations","createMachine","locationsStateMachine","initialContext","LocationsListContextual","jsx","Flow"],"mappings":";;;;;;AAYO,SAASA,EAAU,EAAE,WAAAC,GAAW,SAAAC,GAAS,YAAAC,KAA8B;AAC5E,EAAAC,EAAuB,qBAAqBD,CAAU;AAEtD,QAAME,IAAkBC;AAAA,IACtB;AAAA,IACAC;AAAA,IACA,CAACC,OAA+C;AAAA,MAC9C,GAAGA;AAAA,MACH,WAAWC;AAAA,MACX,WAAAR;AAAA,IACF;AAAA,EACF;AACA,SAAQ,gBAAAS,EAAAC,GAAA,EAAK,SAASN,GAAiB,SAAAH,EAAkB,CAAA;AAC3D;"}
@@ -3,9 +3,4 @@ interface LocationsListProps extends BaseComponentInterface {
3
3
  companyId: string;
4
4
  }
5
5
  export declare function LocationsList(props: LocationsListProps): import("react/jsx-runtime").JSX.Element;
6
- export declare namespace LocationsList {
7
- var Head: typeof import("./Head").Head;
8
- var List: () => import("react/jsx-runtime").JSX.Element;
9
- var Actions: typeof import("./Actions").Actions;
10
- }
11
6
  export {};
@@ -1,29 +1,29 @@
1
- import { jsx as e, jsxs as C, Fragment as A } from "react/jsx-runtime";
2
- import { useLocationsGetSuspense as N } from "@gusto/embedded-api/react-query/locationsGet";
3
- import { useState as d } from "react";
4
- import { Head as l } from "./Head.js";
5
- import { List as h } from "./List.js";
6
- import { Actions as P } from "./Actions.js";
7
- import { LocationsListProvider as O } from "./useLocationsList.js";
8
- import { useI18n as x } from "../../../../i18n/I18n.js";
9
- import { BaseComponent as E } from "../../../Base/Base.js";
10
- import { useBase as I } from "../../../Base/useBase.js";
11
- import { Flex as v } from "../../../Common/Flex/Flex.js";
1
+ import { jsx as e, jsxs as p, Fragment as u } from "react/jsx-runtime";
2
+ import { useLocationsGetSuspense as L } from "@gusto/embedded-api/react-query/locationsGet";
3
+ import { useState as m } from "react";
4
+ import { Head as f } from "./Head.js";
5
+ import { List as C } from "./List.js";
6
+ import { Actions as A } from "./Actions.js";
7
+ import { LocationsListProvider as N } from "./useLocationsList.js";
8
+ import { useI18n as O } from "../../../../i18n/I18n.js";
9
+ import { BaseComponent as x } from "../../../Base/Base.js";
10
+ import { useBase as E } from "../../../Base/useBase.js";
11
+ import { Flex as I } from "../../../Common/Flex/Flex.js";
12
12
  import { companyEvents as s } from "../../../../shared/constants.js";
13
- function i(o) {
14
- return /* @__PURE__ */ e(E, { ...o, children: /* @__PURE__ */ e(M, { ...o, children: o.children }) });
13
+ function Q(o) {
14
+ return /* @__PURE__ */ e(x, { ...o, children: /* @__PURE__ */ e(v, { ...o, children: o.children }) });
15
15
  }
16
- function M({ companyId: o, className: g, children: c }) {
17
- x("Company.Locations");
18
- const { onEvent: a } = I(), [m, n] = d(1), [p, L] = d(5), {
19
- data: { locationList: u, httpMeta: f }
20
- } = N({ companyId: o, page: m, per: p }), r = Number(f.response.headers.get("x-total-pages") ?? 1);
21
- return /* @__PURE__ */ e("section", { className: g, children: /* @__PURE__ */ e(
22
- O,
16
+ function v({ companyId: o, className: d, children: i }) {
17
+ O("Company.Locations");
18
+ const { onEvent: a } = E(), [c, n] = m(1), [l, h] = m(5), {
19
+ data: { locationList: P, httpMeta: g }
20
+ } = L({ companyId: o, page: c, per: l }), r = Number(g.response.headers.get("x-total-pages") ?? 1);
21
+ return /* @__PURE__ */ e("section", { className: d, children: /* @__PURE__ */ e(
22
+ N,
23
23
  {
24
24
  value: {
25
- locationList: u ?? [],
26
- currentPage: m,
25
+ locationList: P ?? [],
26
+ currentPage: c,
27
27
  totalPages: r,
28
28
  handleFirstPage: () => {
29
29
  n(1);
@@ -38,7 +38,7 @@ function M({ companyId: o, className: g, children: c }) {
38
38
  n(r);
39
39
  },
40
40
  handleItemsPerPageChange: (t) => {
41
- L(t);
41
+ h(t);
42
42
  },
43
43
  handleAddLocation: () => {
44
44
  a(s.COMPANY_LOCATION_CREATE);
@@ -50,18 +50,15 @@ function M({ companyId: o, className: g, children: c }) {
50
50
  a(s.COMPANY_LOCATION_DONE);
51
51
  }
52
52
  },
53
- children: /* @__PURE__ */ e(v, { flexDirection: "column", gap: 32, children: c || /* @__PURE__ */ C(A, { children: [
54
- /* @__PURE__ */ e(l, {}),
55
- /* @__PURE__ */ e(h, {}),
56
- /* @__PURE__ */ e(P, {})
53
+ children: /* @__PURE__ */ e(I, { flexDirection: "column", gap: 32, children: i || /* @__PURE__ */ p(u, { children: [
54
+ /* @__PURE__ */ e(f, {}),
55
+ /* @__PURE__ */ e(C, {}),
56
+ /* @__PURE__ */ e(A, {})
57
57
  ] }) })
58
58
  }
59
59
  ) });
60
60
  }
61
- i.Head = l;
62
- i.List = h;
63
- i.Actions = P;
64
61
  export {
65
- i as LocationsList
62
+ Q as LocationsList
66
63
  };
67
64
  //# sourceMappingURL=LocationsList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LocationsList.js","sources":["../../../../../src/components/Company/Locations/LocationsList/LocationsList.tsx"],"sourcesContent":["import { useLocationsGetSuspense } from '@gusto/embedded-api/react-query/locationsGet'\nimport { useState } from 'react'\nimport { Head } from './Head'\nimport { List } from './List'\nimport { Actions } from './Actions'\nimport { LocationsListProvider } from './useLocationsList'\nimport { useI18n } from '@/i18n'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { Flex } from '@/components/Common'\nimport { companyEvents } from '@/shared/constants'\n\ninterface LocationsListProps extends BaseComponentInterface {\n companyId: string\n}\n\nexport function LocationsList(props: LocationsListProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, className, children }: LocationsListProps) {\n useI18n('Company.Locations')\n const { onEvent } = useBase()\n\n const [currentPage, setCurrentPage] = useState(1)\n const [itemsPerPage, setItemsPerPage] = useState(5)\n\n const {\n data: { locationList, httpMeta },\n } = useLocationsGetSuspense({ companyId, page: currentPage, per: itemsPerPage })\n\n const totalPages = Number(httpMeta.response.headers.get('x-total-pages') ?? 1)\n\n const handleItemsPerPageChange = (newCount: number) => {\n setItemsPerPage(newCount)\n }\n const handleFirstPage = () => {\n setCurrentPage(1)\n }\n const handlePreviousPage = () => {\n setCurrentPage(prevPage => Math.max(prevPage - 1, 1))\n }\n const handleNextPage = () => {\n setCurrentPage(prevPage => Math.min(prevPage + 1, totalPages))\n }\n const handleLastPage = () => {\n setCurrentPage(totalPages)\n }\n\n const handleContinue = () => {\n onEvent(companyEvents.COMPANY_LOCATION_DONE)\n }\n const handleAddLocation = () => {\n onEvent(companyEvents.COMPANY_LOCATION_CREATE)\n }\n const handleEditLocation = (uuid: string) => {\n onEvent(companyEvents.COMPANY_LOCATION_EDIT, { uuid })\n }\n\n return (\n <section className={className}>\n <LocationsListProvider\n value={{\n locationList: locationList ?? [],\n currentPage,\n totalPages,\n handleFirstPage,\n handlePreviousPage,\n handleNextPage,\n handleLastPage,\n handleItemsPerPageChange,\n handleAddLocation,\n handleEditLocation,\n handleContinue,\n }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <List />\n <Actions />\n </>\n )}\n </Flex>\n </LocationsListProvider>\n </section>\n )\n}\n\nLocationsList.Head = Head\nLocationsList.List = List\nLocationsList.Actions = Actions\n"],"names":["LocationsList","props","jsx","BaseComponent","Root","companyId","className","children","useI18n","onEvent","useBase","currentPage","setCurrentPage","useState","itemsPerPage","setItemsPerPage","locationList","httpMeta","useLocationsGetSuspense","totalPages","LocationsListProvider","prevPage","newCount","companyEvents","uuid","Flex","jsxs","Fragment","Head","List","Actions"],"mappings":";;;;;;;;;;;;AAgBO,SAASA,EAAcC,GAA2B;AAErD,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,WAAAC,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c,qBAAqB;AAAA,QAC7C;AAAA,MAuBM;AAAA,MAEA,UAAA,gBAAArB,EAACuB,KAAK,eAAc,UAAS,KAAK,IAC/B,UAAAlB,KAIG,gBAAAmB,EAAAC,GAAA,EAAA,UAAA;AAAA,QAAA,gBAAAzB,EAAC0B,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,EAAA,CACX,EAEJ,CAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;AAEA9B,EAAc,OAAO4B;AACrB5B,EAAc,OAAO6B;AACrB7B,EAAc,UAAU8B;"}
1
+ {"version":3,"file":"LocationsList.js","sources":["../../../../../src/components/Company/Locations/LocationsList/LocationsList.tsx"],"sourcesContent":["import { useLocationsGetSuspense } from '@gusto/embedded-api/react-query/locationsGet'\nimport { useState } from 'react'\nimport { Head } from './Head'\nimport { List } from './List'\nimport { Actions } from './Actions'\nimport { LocationsListProvider } from './useLocationsList'\nimport { useI18n } from '@/i18n'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { Flex } from '@/components/Common'\nimport { companyEvents } from '@/shared/constants'\n\ninterface LocationsListProps extends BaseComponentInterface {\n companyId: string\n}\n\nexport function LocationsList(props: LocationsListProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, className, children }: LocationsListProps) {\n useI18n('Company.Locations')\n const { onEvent } = useBase()\n\n const [currentPage, setCurrentPage] = useState(1)\n const [itemsPerPage, setItemsPerPage] = useState(5)\n\n const {\n data: { locationList, httpMeta },\n } = useLocationsGetSuspense({ companyId, page: currentPage, per: itemsPerPage })\n\n const totalPages = Number(httpMeta.response.headers.get('x-total-pages') ?? 1)\n\n const handleItemsPerPageChange = (newCount: number) => {\n setItemsPerPage(newCount)\n }\n const handleFirstPage = () => {\n setCurrentPage(1)\n }\n const handlePreviousPage = () => {\n setCurrentPage(prevPage => Math.max(prevPage - 1, 1))\n }\n const handleNextPage = () => {\n setCurrentPage(prevPage => Math.min(prevPage + 1, totalPages))\n }\n const handleLastPage = () => {\n setCurrentPage(totalPages)\n }\n\n const handleContinue = () => {\n onEvent(companyEvents.COMPANY_LOCATION_DONE)\n }\n const handleAddLocation = () => {\n onEvent(companyEvents.COMPANY_LOCATION_CREATE)\n }\n const handleEditLocation = (uuid: string) => {\n onEvent(companyEvents.COMPANY_LOCATION_EDIT, { uuid })\n }\n\n return (\n <section className={className}>\n <LocationsListProvider\n value={{\n locationList: locationList ?? [],\n currentPage,\n totalPages,\n handleFirstPage,\n handlePreviousPage,\n handleNextPage,\n handleLastPage,\n handleItemsPerPageChange,\n handleAddLocation,\n handleEditLocation,\n handleContinue,\n }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <List />\n <Actions />\n </>\n )}\n </Flex>\n </LocationsListProvider>\n </section>\n )\n}\n"],"names":["LocationsList","props","jsx","BaseComponent","Root","companyId","className","children","useI18n","onEvent","useBase","currentPage","setCurrentPage","useState","itemsPerPage","setItemsPerPage","locationList","httpMeta","useLocationsGetSuspense","totalPages","LocationsListProvider","prevPage","newCount","companyEvents","uuid","Flex","jsxs","Fragment","Head","List","Actions"],"mappings":";;;;;;;;;;;;AAgBO,SAASA,EAAcC,GAA2B;AAErD,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,WAAAC,GAAW,UAAAC,KAAgC;AACpE,EAAAC,EAAQ,mBAAmB;AACrB,QAAA,EAAE,SAAAC,EAAQ,IAAIC,EAAQ,GAEtB,CAACC,GAAaC,CAAc,IAAIC,EAAS,CAAC,GAC1C,CAACC,GAAcC,CAAe,IAAIF,EAA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B,GAAK,EAAA;AAAA,0BACLC,GAAK,EAAA;AAAA,0BACLC,GAAQ,CAAA,CAAA;AAAA,MAAA,EAAA,CACX,EAEJ,CAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
@@ -4,11 +4,5 @@ interface PayScheduleProps extends CommonComponentInterface<'Company.PaySchedule
4
4
  companyId: string;
5
5
  defaultValues?: PayScheduleDefaultValues;
6
6
  }
7
- export declare const PaySchedule: {
8
- ({ companyId, defaultValues, dictionary, ...props }: PayScheduleProps & BaseComponentInterface): import("react/jsx-runtime").JSX.Element;
9
- Head: () => import("react/jsx-runtime").JSX.Element;
10
- List: () => import("react/jsx-runtime").JSX.Element | null;
11
- Edit: () => import("react/jsx-runtime").JSX.Element | null;
12
- Actions: () => import("react/jsx-runtime").JSX.Element;
13
- };
7
+ export declare const PaySchedule: ({ companyId, defaultValues, dictionary, ...props }: PayScheduleProps & BaseComponentInterface) => import("react/jsx-runtime").JSX.Element;
14
8
  export {};
@@ -1,30 +1,30 @@
1
- import { jsx as t, jsxs as J } from "react/jsx-runtime";
2
- import { useForm as K, FormProvider as Q } from "react-hook-form";
3
- import { zodResolver as W } from "@hookform/resolvers/zod";
4
- import { useState as A, useEffect as _ } from "react";
5
- import { usePaySchedulesGetPreview as X } from "@gusto/embedded-api/react-query/paySchedulesGetPreview";
6
- import { usePaySchedulesUpdateMutation as Z } from "@gusto/embedded-api/react-query/paySchedulesUpdate";
7
- import { usePaySchedulesGetAllSuspense as $ } from "@gusto/embedded-api/react-query/paySchedulesGetAll";
8
- import { usePaySchedulesCreateMutation as V } from "@gusto/embedded-api/react-query/paySchedulesCreate";
9
- import { PayScheduleSchema as ee, PayScheduleProvider as oe } from "./usePaySchedule.js";
10
- import { Form as re } from "../../Common/Form/Form.js";
11
- import { BaseComponent as ae } from "../../Base/Base.js";
12
- import { useBase as te } from "../../Base/useBase.js";
13
- import { Flex as ne } from "../../Common/Flex/Flex.js";
14
- import { useI18n as ce, useComponentDictionary as ie } from "../../../i18n/I18n.js";
15
- import { componentEvents as l } from "../../../shared/constants.js";
16
- import { formatDateToStringDate as p } from "../../../helpers/dateFormatting.js";
17
- import { Head as w } from "./_parts/Head.js";
18
- import { List as C } from "./_parts/List.js";
19
- import { Edit as L } from "./_parts/Edit.js";
20
- import { Actions as q } from "./_parts/Actions.js";
21
- const u = ({
1
+ import { jsx as t, jsxs as I } from "react/jsx-runtime";
2
+ import { useForm as j, FormProvider as k } from "react-hook-form";
3
+ import { zodResolver as G } from "@hookform/resolvers/zod";
4
+ import { useState as v, useEffect as A } from "react";
5
+ import { usePaySchedulesGetPreview as z } from "@gusto/embedded-api/react-query/paySchedulesGetPreview";
6
+ import { usePaySchedulesUpdateMutation as J } from "@gusto/embedded-api/react-query/paySchedulesUpdate";
7
+ import { usePaySchedulesGetAllSuspense as K } from "@gusto/embedded-api/react-query/paySchedulesGetAll";
8
+ import { usePaySchedulesCreateMutation as Q } from "@gusto/embedded-api/react-query/paySchedulesCreate";
9
+ import { PayScheduleSchema as W, PayScheduleProvider as X } from "./usePaySchedule.js";
10
+ import { Form as Z } from "../../Common/Form/Form.js";
11
+ import { BaseComponent as $ } from "../../Base/Base.js";
12
+ import { useBase as V } from "../../Base/useBase.js";
13
+ import { Flex as ee } from "../../Common/Flex/Flex.js";
14
+ import { useI18n as oe, useComponentDictionary as re } from "../../../i18n/I18n.js";
15
+ import { componentEvents as S } from "../../../shared/constants.js";
16
+ import { formatDateToStringDate as l } from "../../../helpers/dateFormatting.js";
17
+ import { Head as ae } from "./_parts/Head.js";
18
+ import { List as te } from "./_parts/List.js";
19
+ import { Edit as ne } from "./_parts/Edit.js";
20
+ import { Actions as ce } from "./_parts/Actions.js";
21
+ const Te = ({
22
22
  companyId: n,
23
23
  defaultValues: s,
24
24
  dictionary: a,
25
25
  ...P
26
- }) => (ce("Company.PaySchedule"), ie("Company.PaySchedule", a), /* @__PURE__ */ t(ae, { ...P, children: /* @__PURE__ */ t(de, { companyId: n, defaultValues: s, children: P.children }) })), de = ({ companyId: n, children: s, defaultValues: a }) => {
27
- const { baseSubmitHandler: P, onEvent: h, fieldErrors: f, setError: T } = te(), [i, y] = A("LIST_PAY_SCHEDULES"), [E, O] = A(null), H = {
26
+ }) => (oe("Company.PaySchedule"), re("Company.PaySchedule", a), /* @__PURE__ */ t($, { ...P, children: /* @__PURE__ */ t(ie, { companyId: n, defaultValues: s, children: P.children }) })), ie = ({ companyId: n, children: s, defaultValues: a }) => {
27
+ const { baseSubmitHandler: P, onEvent: u, fieldErrors: h, setError: _ } = V(), [i, y] = v("LIST_PAY_SCHEDULES"), [f, w] = v(null), C = {
28
28
  frequency: a?.frequency ?? "Every week",
29
29
  anchorPayDate: a?.anchorPayDate ? new Date(a.anchorPayDate) : void 0,
30
30
  anchorEndOfPayPeriod: a?.anchorEndOfPayPeriod ? new Date(a.anchorEndOfPayPeriod) : void 0,
@@ -33,23 +33,23 @@ const u = ({
33
33
  customName: a?.customName ?? "",
34
34
  customTwicePerMonth: "false",
35
35
  payPeriodPreviewRange: 0
36
- }, { data: U } = $({
36
+ }, { data: L } = K({
37
37
  companyId: n
38
- }), M = V(), Y = Z(), D = K({
39
- resolver: W(ee),
40
- defaultValues: H
41
- }), { watch: N, setValue: S, reset: d, clearErrors: b, setError: v } = D;
42
- _(() => {
43
- f && f.forEach((o) => {
44
- v(o.key, { message: o.message });
38
+ }), q = Q(), T = J(), E = j({
39
+ resolver: G(W),
40
+ defaultValues: C
41
+ }), { watch: O, setValue: D, reset: d, clearErrors: H, setError: p } = E;
42
+ A(() => {
43
+ h && h.forEach((o) => {
44
+ p(o.key, { message: o.message });
45
45
  });
46
- }, [v, f]);
47
- const e = N(), g = e.anchorPayDate && p(e.anchorPayDate) || "", B = e.anchorEndOfPayPeriod && p(e.anchorEndOfPayPeriod) || "", { data: R, isLoading: x } = X(
46
+ }, [p, h]);
47
+ const e = O(), U = e.anchorPayDate && l(e.anchorPayDate) || "", M = e.anchorEndOfPayPeriod && l(e.anchorEndOfPayPeriod) || "", { data: Y, isLoading: N } = z(
48
48
  {
49
49
  companyId: n,
50
50
  frequency: e.frequency,
51
- anchorPayDate: g,
52
- anchorEndOfPayPeriod: B,
51
+ anchorPayDate: U,
52
+ anchorEndOfPayPeriod: M,
53
53
  day1: e.day1 ?? void 0,
54
54
  day2: e.day2 ?? void 0
55
55
  },
@@ -57,14 +57,14 @@ const u = ({
57
57
  enabled: !!(e.anchorPayDate && e.anchorEndOfPayPeriod && (i === "ADD_PAY_SCHEDULE" || i === "EDIT_PAY_SCHEDULE"))
58
58
  }
59
59
  );
60
- _(() => {
61
- e.frequency === "Twice per month" && e.day1 === 15 && e.day2 === 31 && e.customTwicePerMonth === void 0 ? S("customTwicePerMonth", "1st15th") : e.frequency === "Twice per month" && e.customTwicePerMonth === void 0 && S("customTwicePerMonth", "custom");
62
- }, [e.frequency, e.day1, e.day2, S, e.customTwicePerMonth]);
63
- const F = () => {
60
+ A(() => {
61
+ e.frequency === "Twice per month" && e.day1 === 15 && e.day2 === 31 && e.customTwicePerMonth === void 0 ? D("customTwicePerMonth", "1st15th") : e.frequency === "Twice per month" && e.customTwicePerMonth === void 0 && D("customTwicePerMonth", "custom");
62
+ }, [e.frequency, e.day1, e.day2, D, e.customTwicePerMonth]);
63
+ const b = () => {
64
64
  y("ADD_PAY_SCHEDULE"), d({});
65
- }, I = () => {
66
- y("LIST_PAY_SCHEDULES"), d({}), b(), T(null);
67
- }, j = (o) => {
65
+ }, g = () => {
66
+ y("LIST_PAY_SCHEDULES"), d({}), H(), _(null);
67
+ }, B = (o) => {
68
68
  d({
69
69
  frequency: o.frequency,
70
70
  anchorPayDate: o.anchorPayDate ? new Date(o.anchorPayDate) : void 0,
@@ -72,14 +72,14 @@ const u = ({
72
72
  day1: o.day1 ?? void 0,
73
73
  day2: o.day2 ?? void 0,
74
74
  customName: o.customName ?? ""
75
- }), O(o), y("EDIT_PAY_SCHEDULE");
76
- }, k = () => {
77
- h(l.PAY_SCHEDULE_DONE);
78
- }, G = async (o) => {
75
+ }), w(o), y("EDIT_PAY_SCHEDULE");
76
+ }, R = () => {
77
+ u(S.PAY_SCHEDULE_DONE);
78
+ }, x = async (o) => {
79
79
  await P(o, async (r) => {
80
- const m = (c) => c && p(c) || "";
80
+ const m = (c) => c && l(c) || "";
81
81
  if (i === "ADD_PAY_SCHEDULE") {
82
- const c = await M.mutateAsync({
82
+ const c = await q.mutateAsync({
83
83
  request: {
84
84
  companyId: n,
85
85
  requestBody: {
@@ -92,11 +92,11 @@ const u = ({
92
92
  }
93
93
  }
94
94
  });
95
- h(l.PAY_SCHEDULE_CREATED, c), d();
95
+ u(S.PAY_SCHEDULE_CREATED, c), d();
96
96
  } else if (i === "EDIT_PAY_SCHEDULE") {
97
- const c = E?.version, z = await Y.mutateAsync({
97
+ const c = f?.version, F = await T.mutateAsync({
98
98
  request: {
99
- payScheduleId: E?.uuid,
99
+ payScheduleId: f?.uuid,
100
100
  companyId: n,
101
101
  requestBody: {
102
102
  frequency: r.frequency,
@@ -109,40 +109,36 @@ const u = ({
109
109
  }
110
110
  }
111
111
  });
112
- h(l.PAY_SCHEDULE_UPDATED, z), d();
112
+ u(S.PAY_SCHEDULE_UPDATED, F), d();
113
113
  }
114
114
  y("LIST_PAY_SCHEDULES");
115
115
  });
116
116
  };
117
117
  return /* @__PURE__ */ t(
118
- oe,
118
+ X,
119
119
  {
120
120
  value: {
121
121
  companyId: n,
122
- handleAdd: F,
123
- handleEdit: j,
124
- handleCancel: I,
125
- handleContinue: k,
122
+ handleAdd: b,
123
+ handleEdit: B,
124
+ handleCancel: g,
125
+ handleContinue: R,
126
126
  mode: i,
127
- paySchedules: U.payScheduleList,
128
- payPeriodPreview: R?.object?.payPeriods,
129
- payPreviewLoading: x,
130
- currentPaySchedule: E
127
+ paySchedules: L.payScheduleList,
128
+ payPeriodPreview: Y?.object?.payPeriods,
129
+ payPreviewLoading: N,
130
+ currentPaySchedule: f
131
131
  },
132
- children: /* @__PURE__ */ t("span", { "data-testid": "pay-schedule-edit-form", children: /* @__PURE__ */ t(Q, { ...D, children: /* @__PURE__ */ t(re, { onSubmit: D.handleSubmit(G), children: s || /* @__PURE__ */ J(ne, { flexDirection: "column", children: [
133
- /* @__PURE__ */ t(w, {}),
134
- /* @__PURE__ */ t(C, {}),
135
- /* @__PURE__ */ t(L, {}),
136
- /* @__PURE__ */ t(q, {})
132
+ children: /* @__PURE__ */ t("span", { "data-testid": "pay-schedule-edit-form", children: /* @__PURE__ */ t(k, { ...E, children: /* @__PURE__ */ t(Z, { onSubmit: E.handleSubmit(x), children: s || /* @__PURE__ */ I(ee, { flexDirection: "column", children: [
133
+ /* @__PURE__ */ t(ae, {}),
134
+ /* @__PURE__ */ t(te, {}),
135
+ /* @__PURE__ */ t(ne, {}),
136
+ /* @__PURE__ */ t(ce, {})
137
137
  ] }) }) }) })
138
138
  }
139
139
  );
140
140
  };
141
- u.Head = w;
142
- u.List = C;
143
- u.Edit = L;
144
- u.Actions = q;
145
141
  export {
146
- u as PaySchedule
142
+ Te as PaySchedule
147
143
  };
148
144
  //# sourceMappingURL=PaySchedule.js.map