@gusto/embedded-react-sdk 0.10.2 → 0.10.3

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 (65) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/components/Base/Base.d.ts +3 -2
  3. package/dist/components/Base/Base.js +31 -31
  4. package/dist/components/Base/Base.js.map +1 -1
  5. package/dist/components/Company/BankAccount/BankAccountComponents.js +16 -9
  6. package/dist/components/Company/BankAccount/BankAccountComponents.js.map +1 -1
  7. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +22 -8
  8. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  9. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.d.ts +1 -0
  10. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +23 -25
  11. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js.map +1 -1
  12. package/dist/components/Company/BankAccount/BankAccountForm/context.d.ts +4 -0
  13. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  14. package/dist/components/Company/BankAccount/BankAccountList/AccountView.js +14 -13
  15. package/dist/components/Company/BankAccount/BankAccountList/AccountView.js.map +1 -1
  16. package/dist/components/Company/BankAccount/stateMachine.d.ts +1 -1
  17. package/dist/components/Company/BankAccount/stateMachine.js +13 -5
  18. package/dist/components/Company/BankAccount/stateMachine.js.map +1 -1
  19. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +41 -42
  20. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  21. package/dist/components/Company/Industry/Industry.js +30 -31
  22. package/dist/components/Company/Industry/Industry.js.map +1 -1
  23. package/dist/components/Company/Locations/LocationForm/LocationForm.js +34 -37
  24. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  25. package/dist/components/Company/Locations/LocationsList/List.js +4 -1
  26. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  27. package/dist/components/Company/PaySchedule/PaySchedule.js +70 -71
  28. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  29. package/dist/components/Contractor/Address/Address.js +37 -38
  30. package/dist/components/Contractor/Address/Address.js.map +1 -1
  31. package/dist/components/Contractor/NewHireReport/NewHireReport.js +57 -58
  32. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  33. package/dist/components/Employee/Compensation/Compensation.js +123 -132
  34. package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
  35. package/dist/components/Employee/Deductions/Deductions.js +74 -79
  36. package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
  37. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +36 -42
  38. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  39. package/dist/components/Employee/EmployeeList/EmployeeList.js +57 -58
  40. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  41. package/dist/components/Employee/PaymentMethod/PaymentMethod.js +95 -97
  42. package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
  43. package/dist/components/Employee/Profile/Profile.js +118 -124
  44. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  45. package/dist/components/Employee/Taxes/FederalForm.js +4 -4
  46. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  47. package/dist/components/Employee/Taxes/Taxes.js +59 -60
  48. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  49. package/dist/contexts/ApiProvider/ApiProvider.js +16 -14
  50. package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
  51. package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +5 -0
  52. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +2 -0
  53. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +19 -17
  54. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  55. package/dist/contexts/LoadingIndicatorProvider/LoadingIndicatorProvider.d.ts +7 -0
  56. package/dist/contexts/LoadingIndicatorProvider/LoadingIndicatorProvider.js +10 -0
  57. package/dist/contexts/LoadingIndicatorProvider/LoadingIndicatorProvider.js.map +1 -0
  58. package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.d.ts +6 -0
  59. package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.js +11 -0
  60. package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.js.map +1 -0
  61. package/dist/shared/constants.d.ts +2 -0
  62. package/dist/shared/constants.js +10 -9
  63. package/dist/shared/constants.js.map +1 -1
  64. package/dist/style.css +1 -1
  65. package/package.json +5 -1
@@ -1,72 +1,71 @@
1
- import { jsx as o, jsxs as A, Fragment as v } from "react/jsx-runtime";
2
- import { useCompanyFormsGetSuspense as N, invalidateAllCompanyFormsGet as _ } from "@gusto/embedded-api/react-query/companyFormsGet";
3
- import { useCompanyFormsSignMutation as B } from "@gusto/embedded-api/react-query/companyFormsSign";
4
- import { useCompanyFormsGetPdfSuspense as G, invalidateAllCompanyFormsGetPdf as M } from "@gusto/embedded-api/react-query/companyFormsGetPdf";
5
- import { useQueryClient as O } from "@tanstack/react-query";
6
- import { Head as s } from "./Head.js";
7
- import { Preview as u } from "./Preview.js";
8
- import { Form as c } from "./Form.js";
9
- import { Actions as f } from "./Actions.js";
10
- import { SignatureFormProvider as b } from "./useSignatureForm.js";
11
- import { useComponentDictionary as w, useI18n as x } from "../../../../i18n/I18n.js";
12
- import { BaseComponent as R } from "../../../Base/Base.js";
13
- import { useBase as k } from "../../../Base/useBase.js";
14
- import { SignatureForm as q } from "../../../Common/SignatureForm/SignatureForm.js";
15
- import { Flex as D } from "../../../Common/Flex/Flex.js";
1
+ import { jsx as o, jsxs as P, Fragment as N } from "react/jsx-runtime";
2
+ import { useCompanyFormsGetSuspense as _ } from "@gusto/embedded-api/react-query/companyFormsGet";
3
+ import { useCompanyFormsSignMutation as A } from "@gusto/embedded-api/react-query/companyFormsSign";
4
+ import { useCompanyFormsGetPdfSuspense as B } from "@gusto/embedded-api/react-query/companyFormsGetPdf";
5
+ import { Head as a } from "./Head.js";
6
+ import { Preview as s } from "./Preview.js";
7
+ import { Form as u } from "./Form.js";
8
+ import { Actions as c } from "./Actions.js";
9
+ import { SignatureFormProvider as M } from "./useSignatureForm.js";
10
+ import { useComponentDictionary as O, useI18n as b } from "../../../../i18n/I18n.js";
11
+ import { BaseComponent as v } from "../../../Base/Base.js";
12
+ import { useBase as x } from "../../../Base/useBase.js";
13
+ import { SignatureForm as G } from "../../../Common/SignatureForm/SignatureForm.js";
14
+ import { Flex as R } from "../../../Common/Flex/Flex.js";
16
15
  import { companyEvents as t } from "../../../../shared/constants.js";
17
16
  function n(r) {
18
- return /* @__PURE__ */ o(R, { ...r, children: /* @__PURE__ */ o(E, { ...r, children: r.children }) });
17
+ return /* @__PURE__ */ o(v, { ...r, children: /* @__PURE__ */ o(w, { ...r, children: r.children }) });
19
18
  }
20
- function E({ formId: r, children: m, dictionary: l }) {
21
- w("Company.SignatureForm", l), x("Company.SignatureForm");
22
- const { onEvent: e, baseSubmitHandler: p } = k(), i = O(), {
19
+ function w({ formId: r, children: m, dictionary: f }) {
20
+ O("Company.SignatureForm", f), b("Company.SignatureForm");
21
+ const { onEvent: e, baseSubmitHandler: p } = x(), {
23
22
  data: { form: d }
24
- } = N({
23
+ } = _({
25
24
  formId: r
26
- }), F = d, { isPending: S, mutateAsync: g } = B(), {
27
- data: { formPdf: C }
28
- } = G({
25
+ }), l = d, { isPending: F, mutateAsync: S } = A(), {
26
+ data: { formPdf: g }
27
+ } = B({
29
28
  formId: r
30
- }), y = C.documentUrl;
29
+ }), C = g.documentUrl;
31
30
  return /* @__PURE__ */ o(
32
- b,
31
+ M,
33
32
  {
34
33
  value: {
35
- form: F,
36
- pdfUrl: y,
37
- isPending: S,
34
+ form: l,
35
+ pdfUrl: C,
36
+ isPending: F,
38
37
  onBack: () => {
39
38
  e(t.COMPANY_SIGN_FORM_BACK);
40
39
  }
41
40
  },
42
- children: /* @__PURE__ */ o(q, { onSubmit: async (h) => {
43
- await p(h, async (a) => {
44
- const P = await g({
41
+ children: /* @__PURE__ */ o(G, { onSubmit: async (h) => {
42
+ await p(h, async (i) => {
43
+ const y = await S({
45
44
  request: {
46
45
  formId: r,
47
46
  requestBody: {
48
- signatureText: a.signature,
49
- agree: a.confirmSignature
47
+ signatureText: i.signature,
48
+ agree: i.confirmSignature
50
49
  }
51
50
  }
52
51
  });
53
- await _(i), await M(i), e(t.COMPANY_SIGN_FORM, P.form), e(t.COMPANY_SIGN_FORM_DONE);
52
+ e(t.COMPANY_SIGN_FORM, y.form), e(t.COMPANY_SIGN_FORM_DONE);
54
53
  });
55
- }, children: /* @__PURE__ */ o(D, { flexDirection: "column", gap: 32, children: m || /* @__PURE__ */ A(v, { children: [
54
+ }, children: /* @__PURE__ */ o(R, { flexDirection: "column", gap: 32, children: m || /* @__PURE__ */ P(N, { children: [
55
+ /* @__PURE__ */ o(a, {}),
56
56
  /* @__PURE__ */ o(s, {}),
57
57
  /* @__PURE__ */ o(u, {}),
58
- /* @__PURE__ */ o(c, {}),
59
- /* @__PURE__ */ o(f, {})
58
+ /* @__PURE__ */ o(c, {})
60
59
  ] }) }) })
61
60
  }
62
61
  );
63
62
  }
64
- n.Head = s;
65
- n.Preview = u;
66
- n.Form = c;
67
- n.Actions = f;
63
+ n.Head = a;
64
+ n.Preview = s;
65
+ n.Form = u;
66
+ n.Actions = c;
68
67
  export {
69
- E as Root,
68
+ w as Root,
70
69
  n as SignatureForm
71
70
  };
72
71
  //# sourceMappingURL=SignatureForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SignatureForm.js","sources":["../../../../../src/components/Company/DocumentSigner/SignatureForm/SignatureForm.tsx"],"sourcesContent":["import {\n useCompanyFormsGetSuspense,\n invalidateAllCompanyFormsGet,\n} from '@gusto/embedded-api/react-query/companyFormsGet'\nimport { useCompanyFormsSignMutation } from '@gusto/embedded-api/react-query/companyFormsSign'\nimport {\n useCompanyFormsGetPdfSuspense,\n invalidateAllCompanyFormsGetPdf,\n} from '@gusto/embedded-api/react-query/companyFormsGetPdf'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { Head } from './Head'\nimport { Preview } from './Preview'\nimport { Form } from './Form'\nimport { Actions } from './Actions'\nimport { SignatureFormProvider } from './useSignatureForm'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport {\n SignatureForm as SharedSignatureForm,\n type SignatureFormInputs,\n} from '@/components/Common/SignatureForm'\nimport { Flex } from '@/components/Common'\nimport { companyEvents } from '@/shared/constants'\n\ninterface SignatureFormProps extends BaseComponentInterface<'Company.SignatureForm'> {\n formId: string\n companyId: string\n}\n\nexport function SignatureForm(props: SignatureFormProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nexport function Root({ formId, children, dictionary }: SignatureFormProps) {\n useComponentDictionary('Company.SignatureForm', dictionary)\n useI18n('Company.SignatureForm')\n const { onEvent, baseSubmitHandler } = useBase()\n const queryClient = useQueryClient()\n\n const {\n data: { form: formNullable },\n } = useCompanyFormsGetSuspense({\n formId,\n })\n const form = formNullable!\n\n const { isPending, mutateAsync: signForm } = useCompanyFormsSignMutation()\n\n const {\n data: { formPdf },\n } = useCompanyFormsGetPdfSuspense({\n formId,\n })\n const pdfUrl = formPdf!.documentUrl!\n\n const handleSubmit = async (data: SignatureFormInputs) => {\n await baseSubmitHandler(data, async payload => {\n const signFormResponse = await signForm({\n request: {\n formId,\n requestBody: {\n signatureText: payload.signature,\n agree: payload.confirmSignature,\n },\n },\n })\n await invalidateAllCompanyFormsGet(queryClient)\n await invalidateAllCompanyFormsGetPdf(queryClient)\n\n onEvent(companyEvents.COMPANY_SIGN_FORM, signFormResponse.form)\n\n onEvent(companyEvents.COMPANY_SIGN_FORM_DONE)\n })\n }\n\n const handleBack = () => {\n onEvent(companyEvents.COMPANY_SIGN_FORM_BACK)\n }\n\n return (\n <SignatureFormProvider\n value={{\n form,\n pdfUrl,\n isPending,\n onBack: handleBack,\n }}\n >\n <SharedSignatureForm onSubmit={handleSubmit}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Preview />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </SharedSignatureForm>\n </SignatureFormProvider>\n )\n}\n\nSignatureForm.Head = Head\nSignatureForm.Preview = Preview\nSignatureForm.Form = Form\nSignatureForm.Actions = Actions\n"],"names":["SignatureForm","props","jsx","BaseComponent","Root","formId","children","dictionary","useComponentDictionary","useI18n","onEvent","baseSubmitHandler","useBase","queryClient","useQueryClient","formNullable","useCompanyFormsGetSuspense","form","isPending","signForm","useCompanyFormsSignMutation","formPdf","useCompanyFormsGetPdfSuspense","pdfUrl","SignatureFormProvider","companyEvents","SharedSignatureForm","data","payload","signFormResponse","invalidateAllCompanyFormsGet","invalidateAllCompanyFormsGetPdf","Flex","jsxs","Fragment","Head","Preview","Form","Actions"],"mappings":";;;;;;;;;;;;;;;;AA+BO,SAASA,EAAcC,GAA2B;AAErD,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEO,SAASG,EAAK,EAAE,QAAAC,GAAQ,UAAAC,GAAU,YAAAC,KAAkC;AACzE,EAAAC,EAAuB,yBAAyBD,CAAU,GAC1DE,EAAQ,uBAAuB;AAC/B,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAkB,IAAIC,EAAQ,GACzCC,IAAcC,EAAe,GAE7B;AAAA,IACJ,MAAM,EAAE,MAAMC,EAAa;AAAA,MACzBC,EAA2B;AAAA,IAC7B,QAAAX;AAAA,EAAA,CACD,GACKY,IAAOF,GAEP,EA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UAAUsC;"}
1
+ {"version":3,"file":"SignatureForm.js","sources":["../../../../../src/components/Company/DocumentSigner/SignatureForm/SignatureForm.tsx"],"sourcesContent":["import { useCompanyFormsGetSuspense } from '@gusto/embedded-api/react-query/companyFormsGet'\nimport { useCompanyFormsSignMutation } from '@gusto/embedded-api/react-query/companyFormsSign'\nimport { useCompanyFormsGetPdfSuspense } from '@gusto/embedded-api/react-query/companyFormsGetPdf'\nimport { Head } from './Head'\nimport { Preview } from './Preview'\nimport { Form } from './Form'\nimport { Actions } from './Actions'\nimport { SignatureFormProvider } from './useSignatureForm'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport {\n SignatureForm as SharedSignatureForm,\n type SignatureFormInputs,\n} from '@/components/Common/SignatureForm'\nimport { Flex } from '@/components/Common'\nimport { companyEvents } from '@/shared/constants'\n\ninterface SignatureFormProps extends BaseComponentInterface<'Company.SignatureForm'> {\n formId: string\n companyId: string\n}\n\nexport function SignatureForm(props: SignatureFormProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nexport function Root({ formId, children, dictionary }: SignatureFormProps) {\n useComponentDictionary('Company.SignatureForm', dictionary)\n useI18n('Company.SignatureForm')\n const { onEvent, baseSubmitHandler } = useBase()\n\n const {\n data: { form: formNullable },\n } = useCompanyFormsGetSuspense({\n formId,\n })\n const form = formNullable!\n\n const { isPending, mutateAsync: signForm } = useCompanyFormsSignMutation()\n\n const {\n data: { formPdf },\n } = useCompanyFormsGetPdfSuspense({\n formId,\n })\n const pdfUrl = formPdf!.documentUrl!\n\n const handleSubmit = async (data: SignatureFormInputs) => {\n await baseSubmitHandler(data, async payload => {\n const signFormResponse = await signForm({\n request: {\n formId,\n requestBody: {\n signatureText: payload.signature,\n agree: payload.confirmSignature,\n },\n },\n })\n\n onEvent(companyEvents.COMPANY_SIGN_FORM, signFormResponse.form)\n\n onEvent(companyEvents.COMPANY_SIGN_FORM_DONE)\n })\n }\n\n const handleBack = () => {\n onEvent(companyEvents.COMPANY_SIGN_FORM_BACK)\n }\n\n return (\n <SignatureFormProvider\n value={{\n form,\n pdfUrl,\n isPending,\n onBack: handleBack,\n }}\n >\n <SharedSignatureForm onSubmit={handleSubmit}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Preview />\n <Form />\n <Actions />\n </>\n )}\n </Flex>\n </SharedSignatureForm>\n </SignatureFormProvider>\n )\n}\n\nSignatureForm.Head = Head\nSignatureForm.Preview = Preview\nSignatureForm.Form = Form\nSignatureForm.Actions = Actions\n"],"names":["SignatureForm","props","jsx","BaseComponent","Root","formId","children","dictionary","useComponentDictionary","useI18n","onEvent","baseSubmitHandler","useBase","formNullable","useCompanyFormsGetSuspense","form","isPending","signForm","useCompanyFormsSignMutation","formPdf","useCompanyFormsGetPdfSuspense","pdfUrl","SignatureFormProvider","companyEvents","SharedSignatureForm","data","payload","signFormResponse","Flex","jsxs","Fragment","Head","Preview","Form","Actions"],"mappings":";;;;;;;;;;;;;;;AAwBO,SAASA,EAAcC,GAA2B;AAErD,SAAA,gBAAAC,EAACC,GAAe,EAAA,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAMA,EAAA,SAAA,CAAS,EACnC,CAAA;AAEJ;AAEO,SAASG,EAAK,EAAE,QAAAC,GAAQ,UAAAC,GAAU,YAAAC,KAAkC;AACzE,EAAAC,EAAuB,yBAAyBD,CAAU,GAC1DE,EAAQ,uBAAuB;AAC/B,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAkB,IAAIC,EAAQ,GAEzC;AAAA,IACJ,MAAM,EAAE,MAAMC,EAAa;AAAA,MACzBC,EAA2B;AAAA,IAC7B,QAAAT;AAAA,EAAA,CACD,GACKU,IAAOF,GAEP,EAAE,WAAAG,GAAW,a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as C } from "react";
3
- import { useIndustrySelectionGetSuspense as I, invalidateAllIndustrySelectionGet as S } from "@gusto/embedded-api/react-query/industrySelectionGet";
4
- import { useIndustrySelectionUpdateMutation as E } from "@gusto/embedded-api/react-query/industrySelectionUpdate";
5
- import { useQueryClient as A } from "@tanstack/react-query";
6
- import { Actions as v } from "./Actions.js";
7
- import { Head as b } from "./Head.js";
8
- import { Edit as h } from "./Edit.js";
9
- import { IndustryApiStateProvider as q } from "./Context.js";
10
- import { IndustrySelect as w } from "./IndustrySelect.js";
11
- import { componentEvents as B } from "../../../shared/constants.js";
12
- import { BaseComponent as D } from "../../Base/Base.js";
13
- import { useBase as H } from "../../Base/useBase.js";
14
- import { useI18n as P, useComponentDictionary as _ } from "../../../i18n/I18n.js";
15
- function x({ children: o, className: u, companyId: n, dictionary: a }) {
16
- _("Company.Industry", a);
17
- const { baseSubmitHandler: r, onEvent: i } = H(), s = A(), {
18
- data: { industry: d }
19
- } = I({ companyId: n }), { isPending: c, mutateAsync: m } = E(), p = C(
20
- async (y) => {
21
- await r(y, async ({ naics_code: l }) => {
22
- const f = await m({
23
- request: { companyId: n, requestBody: { naicsCode: l } }
2
+ import { useCallback as l } from "react";
3
+ import { useIndustrySelectionGetSuspense as C } from "@gusto/embedded-api/react-query/industrySelectionGet";
4
+ import { useIndustrySelectionUpdateMutation as I } from "@gusto/embedded-api/react-query/industrySelectionUpdate";
5
+ import { Actions as S } from "./Actions.js";
6
+ import { Head as E } from "./Head.js";
7
+ import { Edit as A } from "./Edit.js";
8
+ import { IndustryApiStateProvider as v } from "./Context.js";
9
+ import { IndustrySelect as b } from "./IndustrySelect.js";
10
+ import { componentEvents as h } from "../../../shared/constants.js";
11
+ import { BaseComponent as B } from "../../Base/Base.js";
12
+ import { useBase as D } from "../../Base/useBase.js";
13
+ import { useI18n as H, useComponentDictionary as P } from "../../../i18n/I18n.js";
14
+ function _({ children: o, className: m, companyId: n, dictionary: u }) {
15
+ P("Company.Industry", u);
16
+ const { baseSubmitHandler: e, onEvent: i } = D(), {
17
+ data: { industry: a }
18
+ } = C({ companyId: n }), { isPending: d, mutateAsync: s } = I(), c = l(
19
+ async (p) => {
20
+ await e(p, async ({ naics_code: f }) => {
21
+ const y = await s({
22
+ request: { companyId: n, requestBody: { naicsCode: f } }
24
23
  });
25
- await S(s), i(B.COMPANY_INDUSTRY_SELECTED, f.industry);
24
+ i(h.COMPANY_INDUSTRY_SELECTED, y.industry);
26
25
  });
27
26
  },
28
- [r, n, m, i, s]
27
+ [e, n, s, i]
29
28
  );
30
- return /* @__PURE__ */ t("section", { className: u, children: /* @__PURE__ */ t(q, { value: { isPending: c }, children: /* @__PURE__ */ t(w, { naics_code: d?.naicsCode, onValid: p, children: o }) }) });
29
+ return /* @__PURE__ */ t("section", { className: m, children: /* @__PURE__ */ t(v, { value: { isPending: d }, children: /* @__PURE__ */ t(b, { naics_code: a?.naicsCode, onValid: c, children: o }) }) });
31
30
  }
32
- function e(o) {
33
- return P("Company.Industry"), /* @__PURE__ */ t(D, { ...o, children: /* @__PURE__ */ t(x, { ...o }) });
31
+ function r(o) {
32
+ return H("Company.Industry"), /* @__PURE__ */ t(B, { ...o, children: /* @__PURE__ */ t(_, { ...o }) });
34
33
  }
35
- e.Actions = v;
36
- e.Edit = h;
37
- e.Head = b;
34
+ r.Actions = S;
35
+ r.Edit = A;
36
+ r.Head = E;
38
37
  export {
39
- e as Industry
38
+ r as Industry
40
39
  };
41
40
  //# sourceMappingURL=Industry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Industry.js","sources":["../../../../src/components/Company/Industry/Industry.tsx"],"sourcesContent":["import { useCallback, type HTMLAttributes } from 'react'\nimport {\n useIndustrySelectionGetSuspense,\n invalidateAllIndustrySelectionGet,\n} from '@gusto/embedded-api/react-query/industrySelectionGet'\nimport { useIndustrySelectionUpdateMutation } from '@gusto/embedded-api/react-query/industrySelectionUpdate'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { Actions } from './Actions'\nimport { Head } from './Head'\nimport type { IndustryFormFields } from './Edit'\nimport { Edit } from './Edit'\nimport { IndustryApiStateProvider } from './Context'\nimport { IndustrySelect } from './IndustrySelect'\nimport { componentEvents } from '@/shared/constants'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport { useI18n, useComponentDictionary } from '@/i18n'\n\nexport type IndustryProps<T> = Pick<\n BaseComponentInterface<'Company.Industry'>,\n 'onEvent' | 'dictionary'\n> &\n Partial<Pick<HTMLAttributes<T>, 'children' | 'className'>> & {\n companyId: string\n }\n\nfunction Root<T>({ children, className, companyId, dictionary }: IndustryProps<T>) {\n useComponentDictionary('Company.Industry', dictionary)\n const { baseSubmitHandler, onEvent } = useBase()\n const queryClient = useQueryClient()\n\n const {\n data: { industry },\n } = useIndustrySelectionGetSuspense({ companyId })\n\n const { isPending, mutateAsync: mutateIndustry } = useIndustrySelectionUpdateMutation()\n\n const onValid = useCallback(\n async (data: IndustryFormFields) => {\n await baseSubmitHandler(data, async ({ naics_code }) => {\n const response = await mutateIndustry({\n request: { companyId, requestBody: { naicsCode: naics_code } },\n })\n await invalidateAllIndustrySelectionGet(queryClient)\n onEvent(componentEvents.COMPANY_INDUSTRY_SELECTED, response.industry)\n })\n },\n [baseSubmitHandler, companyId, mutateIndustry, onEvent, queryClient],\n )\n\n return (\n <section className={className}>\n <IndustryApiStateProvider value={{ isPending }}>\n <IndustrySelect naics_code={industry?.naicsCode} onValid={onValid}>\n {children}\n </IndustrySelect>\n </IndustryApiStateProvider>\n </section>\n )\n}\n\nexport function Industry<T>(props: IndustryProps<T>) {\n useI18n('Company.Industry')\n\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nIndustry.Actions = Actions\nIndustry.Edit = Edit\nIndustry.Head = Head\n"],"names":["Root","children","className","companyId","dictionary","useComponentDictionary","baseSubmitHandler","onEvent","useBase","queryClient","useQueryClient","industry","useIndustrySelectionGetSuspense","isPending","mutateIndustry","useIndustrySelectionUpdateMutation","onValid","useCallback","data","naics_code","response","invalidateAllIndustrySelectionGet","componentEvents","jsx","IndustryApiStateProvider","IndustrySelect","Industry","props","useI18n","BaseComponent","Actions","Edit","Head"],"mappings":";;;;;;;;;;;;;;AAyBA,SAASA,EAAQ,EAAE,UAAAC,GAAU,WAAAC,GAAW,WAAAC,GAAW,YAAAC,KAAgC;AACjF,EAAAC,EAAuB,oBAAoBD,CAAU;AACrD,QAAM,EAAE,mBAAAE,GAAmB,SAAAC,EAAQ,IAAIC,EAAQ,GACzCC,IAAcC,EAAe,GAE7B;AAAA,IACJ,MAAM,EAAE,UAAAC,EAAS;AAAA,EAAA,IACfC,EAAgC,EAAE,WAAAT,GAAW,GAE3C,EAAE,WAAAU,GAAW,aAAaC,EAAA,IAAmBC,EAAmC,GAEhFC,IAAUC;AAAA,IACd,OAAOC,MAA6B;AAClC,YAAMZ,EAAkBY,GAAM,OAAO,EAAE,YAAAC,QAAiB;AAChD,cAAAC,IAAW,MAAMN,EAAe;AAAA,UACpC,SAAS,EAAE,WAAAX,GAAW,aAAa,EAAE,WAAWgB,EAAa,EAAA;AAAA,QAAA,CAC9D;AACD,cAAME,EAAkCZ,CAAW,GAC3CF,EAAAe,EAAgB,2BAA2BF,EAAS,QAAQ;AAAA,MAAA,CACrE;AAAA,IACH;AAAA,IACA,CAACd,GAAmBH,GAAWW,GAAgBP,GAASE,CAAW;AAAA,EACrE;AAEA,2BACG,WAAQ,EAAA,WAAAP,GACP,UAAC,gBAAAqB,EAAAC,GAAA,EAAyB,OAAO,EAAE,WAAAX,EACjC,GAAA,UAAA,gBAAAU,EAACE,KAAe,YAAYd,GAAU,WAAW,SAAAK,GAC9C,UAAAf,EAAA,CACH,EACF,CAAA,GACF;AAEJ;AAEO,SAASyB,EAAYC,GAAyB;AACnD,SAAAC,EAAQ,kBAAkB,GAGxB,gBAAAL,EAACM,KAAe,GAAGF,GACjB,4BAAC3B,GAAM,EAAA,GAAG2B,GAAO,EACnB,CAAA;AAEJ;AAEAD,EAAS,UAAUI;AACnBJ,EAAS,OAAOK;AAChBL,EAAS,OAAOM;"}
1
+ {"version":3,"file":"Industry.js","sources":["../../../../src/components/Company/Industry/Industry.tsx"],"sourcesContent":["import { useCallback, type HTMLAttributes } from 'react'\nimport { useIndustrySelectionGetSuspense } from '@gusto/embedded-api/react-query/industrySelectionGet'\nimport { useIndustrySelectionUpdateMutation } from '@gusto/embedded-api/react-query/industrySelectionUpdate'\nimport { Actions } from './Actions'\nimport { Head } from './Head'\nimport type { IndustryFormFields } from './Edit'\nimport { Edit } from './Edit'\nimport { IndustryApiStateProvider } from './Context'\nimport { IndustrySelect } from './IndustrySelect'\nimport { componentEvents } from '@/shared/constants'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport { useI18n, useComponentDictionary } from '@/i18n'\n\nexport type IndustryProps<T> = Pick<\n BaseComponentInterface<'Company.Industry'>,\n 'onEvent' | 'dictionary'\n> &\n Partial<Pick<HTMLAttributes<T>, 'children' | 'className'>> & {\n companyId: string\n }\n\nfunction Root<T>({ children, className, companyId, dictionary }: IndustryProps<T>) {\n useComponentDictionary('Company.Industry', dictionary)\n const { baseSubmitHandler, onEvent } = useBase()\n\n const {\n data: { industry },\n } = useIndustrySelectionGetSuspense({ companyId })\n\n const { isPending, mutateAsync: mutateIndustry } = useIndustrySelectionUpdateMutation()\n\n const onValid = useCallback(\n async (data: IndustryFormFields) => {\n await baseSubmitHandler(data, async ({ naics_code }) => {\n const response = await mutateIndustry({\n request: { companyId, requestBody: { naicsCode: naics_code } },\n })\n onEvent(componentEvents.COMPANY_INDUSTRY_SELECTED, response.industry)\n })\n },\n [baseSubmitHandler, companyId, mutateIndustry, onEvent],\n )\n\n return (\n <section className={className}>\n <IndustryApiStateProvider value={{ isPending }}>\n <IndustrySelect naics_code={industry?.naicsCode} onValid={onValid}>\n {children}\n </IndustrySelect>\n </IndustryApiStateProvider>\n </section>\n )\n}\n\nexport function Industry<T>(props: IndustryProps<T>) {\n useI18n('Company.Industry')\n\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nIndustry.Actions = Actions\nIndustry.Edit = Edit\nIndustry.Head = Head\n"],"names":["Root","children","className","companyId","dictionary","useComponentDictionary","baseSubmitHandler","onEvent","useBase","industry","useIndustrySelectionGetSuspense","isPending","mutateIndustry","useIndustrySelectionUpdateMutation","onValid","useCallback","data","naics_code","response","componentEvents","jsx","IndustryApiStateProvider","IndustrySelect","Industry","props","useI18n","BaseComponent","Actions","Edit","Head"],"mappings":";;;;;;;;;;;;;AAqBA,SAASA,EAAQ,EAAE,UAAAC,GAAU,WAAAC,GAAW,WAAAC,GAAW,YAAAC,KAAgC;AACjF,EAAAC,EAAuB,oBAAoBD,CAAU;AACrD,QAAM,EAAE,mBAAAE,GAAmB,SAAAC,EAAQ,IAAIC,EAAQ,GAEzC;AAAA,IACJ,MAAM,EAAE,UAAAC,EAAS;AAAA,EAAA,IACfC,EAAgC,EAAE,WAAAP,GAAW,GAE3C,EAAE,WAAAQ,GAAW,aAAaC,EAAA,IAAmBC,EAAmC,GAEhFC,IAAUC;AAAA,IACd,OAAOC,MAA6B;AAClC,YAAMV,EAAkBU,GAAM,OAAO,EAAE,YAAAC,QAAiB;AAChD,cAAAC,IAAW,MAAMN,EAAe;AAAA,UACpC,SAAS,EAAE,WAAAT,GAAW,aAAa,EAAE,WAAWc,EAAa,EAAA;AAAA,QAAA,CAC9D;AACO,QAAAV,EAAAY,EAAgB,2BAA2BD,EAAS,QAAQ;AAAA,MAAA,CACrE;AAAA,IACH;AAAA,IACA,CAACZ,GAAmBH,GAAWS,GAAgBL,CAAO;AAAA,EACxD;AAEA,2BACG,WAAQ,EAAA,WAAAL,GACP,UAAC,gBAAAkB,EAAAC,GAAA,EAAyB,OAAO,EAAE,WAAAV,EACjC,GAAA,UAAA,gBAAAS,EAACE,KAAe,YAAYb,GAAU,WAAW,SAAAK,GAC9C,UAAAb,EAAA,CACH,EACF,CAAA,GACF;AAEJ;AAEO,SAASsB,EAAYC,GAAyB;AACnD,SAAAC,EAAQ,kBAAkB,GAGxB,gBAAAL,EAACM,KAAe,GAAGF,GACjB,4BAACxB,GAAM,EAAA,GAAGwB,GAAO,EACnB,CAAA;AAEJ;AAEAD,EAAS,UAAUI;AACnBJ,EAAS,OAAOK;AAChBL,EAAS,OAAOM;"}
@@ -1,36 +1,34 @@
1
- import { jsx as o, jsxs as O, Fragment as S } from "react/jsx-runtime";
2
- import { useForm as q, FormProvider as x } from "react-hook-form";
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
3
  import { zodResolver as R } from "@hookform/resolvers/zod";
4
- import { useLocationsUpdateMutation as w } from "@gusto/embedded-api/react-query/locationsUpdate";
4
+ import { useLocationsUpdateMutation as q } from "@gusto/embedded-api/react-query/locationsUpdate";
5
5
  import { useLocationsRetrieveSuspense as B } from "@gusto/embedded-api/react-query/locationsRetrieve";
6
- import { invalidateAllLocationsGet as I } from "@gusto/embedded-api/react-query/locationsGet";
7
- import { useLocationsCreateMutation as M } from "@gusto/embedded-api/react-query/locationsCreate";
8
- import { useQueryClient as _ } from "@tanstack/react-query";
6
+ import { useLocationsCreateMutation as I } from "@gusto/embedded-api/react-query/locationsCreate";
9
7
  import { Head as f } from "./Head.js";
10
- import { LocationFormSchema as z, Form as l } from "./Form.js";
8
+ import { LocationFormSchema as M, Form as l } from "./Form.js";
11
9
  import { Actions as A } from "./Actions.js";
12
- import { LocationsFormProvider as H } from "./useLocationForm.js";
13
- import { Form as U } from "../../../Common/Form/Form.js";
14
- import { Flex as j } from "../../../Common/Flex/Flex.js";
15
- import { BaseComponent as Y } from "../../../Base/Base.js";
16
- import { useBase as G } from "../../../Base/useBase.js";
17
- import { useI18n as Q } from "../../../../i18n/I18n.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";
14
+ import { useBase as U } from "../../../Base/useBase.js";
15
+ import { useI18n as j } from "../../../../i18n/I18n.js";
18
16
  import { componentEvents as a } from "../../../../shared/constants.js";
19
- function V(t) {
17
+ function Y(t) {
20
18
  const {
21
19
  data: { location: e }
22
20
  } = B({ locationId: t.locationId });
23
- return /* @__PURE__ */ o(y, { ...t, location: e });
21
+ return /* @__PURE__ */ o(g, { ...t, location: e });
24
22
  }
25
- function y({
23
+ function g({
26
24
  companyId: t,
27
25
  location: e,
28
- className: s,
26
+ className: n,
29
27
  children: r
30
28
  }) {
31
- Q("Company.Locations");
32
- const { onEvent: i, baseSubmitHandler: C } = G(), { mutateAsync: L, isPending: g } = M(), { mutateAsync: v, isPending: h } = w(), F = _(), P = ["mailingAddress", "filingAddress"], { control: T, ...c } = q({
33
- resolver: R(z),
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),
34
32
  defaultValues: {
35
33
  city: e?.city ?? "",
36
34
  phoneNumber: e?.phoneNumber ?? "",
@@ -38,14 +36,14 @@ function y({
38
36
  street2: e?.street2 ?? "",
39
37
  state: e?.state ?? "",
40
38
  zip: e?.zip ?? "",
41
- addressType: P.filter((n) => e?.[n] ?? !1)
39
+ addressType: F.filter((i) => e?.[i] ?? !1)
42
40
  }
43
- }), b = () => {
44
- i(a.CANCEL);
45
- }, D = async (n) => {
46
- await C(n, async (E) => {
47
- const { addressType: u, ...N } = E, p = {
48
- ...N,
41
+ }), T = () => {
42
+ s(a.CANCEL);
43
+ }, b = async (i) => {
44
+ await y(i, async (D) => {
45
+ const { addressType: u, ...E } = D, p = {
46
+ ...E,
49
47
  mailingAddress: u?.includes("mailingAddress"),
50
48
  filingAddress: u?.includes("filingAddress")
51
49
  };
@@ -56,7 +54,7 @@ function y({
56
54
  requestBody: { ...p, version: e.version }
57
55
  }
58
56
  });
59
- i(a.COMPANY_LOCATION_UPDATED, m);
57
+ s(a.COMPANY_LOCATION_UPDATED, m);
60
58
  } else {
61
59
  const { location: m } = await L({
62
60
  request: {
@@ -64,16 +62,15 @@ function y({
64
62
  requestBody: p
65
63
  }
66
64
  });
67
- i(a.COMPANY_LOCATION_CREATED, m);
65
+ s(a.COMPANY_LOCATION_CREATED, m);
68
66
  }
69
- await I(F);
70
67
  });
71
68
  };
72
- return /* @__PURE__ */ o("section", { className: s, children: /* @__PURE__ */ o(x, { ...c, control: T, children: /* @__PURE__ */ o(U, { onSubmit: c.handleSubmit(D), children: /* @__PURE__ */ o(
73
- H,
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
+ _,
74
71
  {
75
- value: { handleCancel: b, isPending: g || h },
76
- children: /* @__PURE__ */ o(j, { flexDirection: "column", gap: 32, children: r || /* @__PURE__ */ O(S, { children: [
72
+ value: { handleCancel: T, isPending: h || C },
73
+ children: /* @__PURE__ */ o(z, { flexDirection: "column", gap: 32, children: r || /* @__PURE__ */ N(O, { children: [
77
74
  /* @__PURE__ */ o(f, {}),
78
75
  /* @__PURE__ */ o(l, {}),
79
76
  /* @__PURE__ */ o(A, {})
@@ -84,11 +81,11 @@ function y({
84
81
  function d({
85
82
  companyId: t,
86
83
  locationId: e,
87
- className: s,
84
+ className: n,
88
85
  children: r,
89
- ...i
86
+ ...s
90
87
  }) {
91
- return /* @__PURE__ */ o(Y, { ...i, children: e ? /* @__PURE__ */ o(V, { companyId: t, locationId: e, className: s, children: r }) : /* @__PURE__ */ o(y, { companyId: t, className: s, children: r }) });
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 }) });
92
89
  }
93
90
  d.Head = f;
94
91
  d.Form = l;
@@ -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 { invalidateAllLocationsGet } from '@gusto/embedded-api/react-query/locationsGet'\nimport { useLocationsCreateMutation } from '@gusto/embedded-api/react-query/locationsCreate'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { useQueryClient } from '@tanstack/react-query'\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 queryClient = useQueryClient()\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 // Invalidate cache after mutation\n await invalidateAllLocationsGet(queryClient)\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","queryClient","useQueryClient","addressType","control","methods","useForm","zodResolver","LocationFormSchema","key","handleCancel","componentEvents","onSubmit","data","innerData","payload","requestBody","responseData","invalidateAllLocationsGet","FormProvider","HtmlForm","LocationsFormProvider","Flex","jsxs","Fragment","Head","Form","Actions","LocationForm","locationId","BaseComponent"],"mappings":";;;;;;;;;;;;;;;;;;AA2BA,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,IAAcC,EAAe,GAC7BC,IAAc,CAAC,kBAAkB,eAAe,GAEhD,EAAE,SAAAC,GAAS,GAAGC,EAAA,IAAYC,EAA4B;AAAA,IAC1D,UAAUC,EAAYC,CAAkB;AAAA,IACxC,eAAe;AAAA,MACb,MAAMxB,GAAU,QAAQ;AAAA,MACxB,aAAaA,GAAU,eAAe;AAAA,MACtC,SAASA,GAAU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A,gBAAA1B;AAAA,IAACmC;AAAA,IAAA;AAAA,MACC,OAAO,EAAE,cAAAX,GAAc,WAAWd,KAAmBG,EAAgB;AAAA,MAErE,UAAA,gBAAAb,EAACoC,KAAK,eAAc,UAAS,KAAK,IAC/B,UAAAhC,KAIG,gBAAAiC,EAAAC,GAAA,EAAA,UAAA;AAAA,QAAA,gBAAAtC,EAACuC,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,EAAa;AAAA,EAC3B,WAAAxC;AAAA,EACA,YAAAyC;AAAA,EACA,WAAAxC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGP;AACL,GAA+C;AAC7C,2BACG+C,GAAe,EAAA,GAAG/C,GAChB,UAAA8C,sBACE/C,GAAiB,EAAA,WAAAM,GAAsB,YAAAyC,GAAwB,WAAAxC,GAC7D,UAAAC,GACH,IAEA,gBAAAJ,EAACC,KAAK,WAAAC,GAAsB,WAAAC,GACzB,UAAAC,EACH,CAAA,GAEJ;AAEJ;AAEAsC,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\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,CAA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zB,UAAAC,EACH,CAAA,GAEJ;AAEJ;AAEAmC,EAAa,OAAOH;AACpBG,EAAa,OAAOF;AACpBE,EAAa,UAAUD;"}
@@ -38,7 +38,10 @@ const Z = () => {
38
38
  title: /* @__PURE__ */ t(k, { children: e("locationListCol2") }),
39
39
  render: (i) => /* @__PURE__ */ n(r, { children: [
40
40
  i.mailingAddress && /* @__PURE__ */ t(a.Badge, { status: "info", children: e("mailingAddress") }),
41
- i.filingAddress && /* @__PURE__ */ t(a.Badge, { status: "info", children: e("filingAddress") })
41
+ i.filingAddress && /* @__PURE__ */ n(r, { children: [
42
+ " ",
43
+ /* @__PURE__ */ t(a.Badge, { status: "info", children: e("filingAddress") })
44
+ ] })
42
45
  ] })
43
46
  }
44
47
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"List.js","sources":["../../../../../src/components/Company/Locations/LocationsList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useLocationsList } from './useLocationsList'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport { DataView, EmptyData, useDataView, VisuallyHidden } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { getCityStateZip, getStreet } from '@/helpers/formattedStrings'\n\n/**List of employees slot for EmployeeList component */\nexport const List = () => {\n const Components = useComponentContext()\n const {\n locationList,\n handleEditLocation,\n currentPage,\n totalPages,\n handleFirstPage,\n handleItemsPerPageChange,\n handleLastPage,\n handleNextPage,\n handlePreviousPage,\n handleAddLocation,\n } = useLocationsList()\n\n const { t } = useTranslation('Company.Locations')\n const { ...dataViewProps } = useDataView({\n data: locationList,\n columns: [\n {\n key: 'name',\n title: t('locationListCol1'),\n render: location => {\n return (\n <>\n <address>\n {getStreet(location)}\n <br />\n <small>{getCityStateZip(location)}</small>\n </address>\n </>\n )\n },\n },\n {\n key: 'status',\n title: <VisuallyHidden>{t('locationListCol2')}</VisuallyHidden>,\n render: location => {\n return (\n <>\n {location.mailingAddress && (\n <Components.Badge status={'info'}>{t('mailingAddress')}</Components.Badge>\n )}\n {location.filingAddress && (\n <Components.Badge status={'info'}>{t('filingAddress')}</Components.Badge>\n )}\n </>\n )\n },\n },\n ],\n itemMenu: location => {\n return (\n <HamburgerMenu\n items={[\n {\n label: t('editCta'),\n onClick: () => {\n handleEditLocation(location.uuid)\n },\n icon: <PencilSvg aria-hidden />,\n 'data-testid': 'edit-location',\n },\n ]}\n data-testid=\"location-hamburger\"\n triggerLabel={t('hamburgerTitle')}\n />\n )\n },\n pagination: {\n handleNextPage,\n handleFirstPage,\n handleLastPage,\n handlePreviousPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n },\n emptyState: () => (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')}>\n <Components.Button variant=\"secondary\" onClick={handleAddLocation}>\n {t('addFirstLicationCta')}\n </Components.Button>\n </EmptyData>\n ),\n })\n return <DataView label={t('locationListLabel')} {...dataViewProps} />\n}\n"],"names":["List","Components","useComponentContext","locationList","handleEditLocation","currentPage","totalPages","handleFirstPage","handleItemsPerPageChange","handleLastPage","handleNextPage","handlePreviousPage","handleAddLocation","useLocationsList","t","useTranslation","dataViewProps","useDataView","location","jsx","Fragment","getStreet","getCityStateZip","VisuallyHidden","jsxs","HamburgerMenu","PencilSvg","EmptyData","DataView"],"mappings":";;;;;;;;;;;AASO,MAAMA,IAAO,MAAM;AACxB,QAAMC,IAAaC,EAAoB,GACjC;AAAA,IACJ,cAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,mBAAAC;AAAA,MACEC,EAAiB,GAEf,EAAE,GAAAC,EAAA,IAAMC,EAAe,mBAAmB,GAC1C,EAAE,GAAGC,EAAc,IAAIC,EAAY;AAAA,I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,MACA,0BAAAH;AAAA,MACA,aAAAH;AAAA,MACA,YAAAC;AAAA,IACF;AAAA,IACA,YAAY,MACT,gBAAAa,EAAAQ,GAAA,EAAU,OAAOb,EAAE,iBAAiB,GAAG,aAAaA,EAAE,uBAAuB,GAC5E,UAAC,gBAAAK,EAAAlB,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASW,GAC7C,UAAAE,EAAE,qBAAqB,EAC1B,CAAA,EACF,CAAA;AAAA,EAAA,CAEH;AACD,2BAAQc,GAAS,EAAA,OAAOd,EAAE,mBAAmB,GAAI,GAAGE,GAAe;AACrE;"}
1
+ {"version":3,"file":"List.js","sources":["../../../../../src/components/Company/Locations/LocationsList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useLocationsList } from './useLocationsList'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport { DataView, EmptyData, useDataView, VisuallyHidden } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { getCityStateZip, getStreet } from '@/helpers/formattedStrings'\n\n/**List of employees slot for EmployeeList component */\nexport const List = () => {\n const Components = useComponentContext()\n const {\n locationList,\n handleEditLocation,\n currentPage,\n totalPages,\n handleFirstPage,\n handleItemsPerPageChange,\n handleLastPage,\n handleNextPage,\n handlePreviousPage,\n handleAddLocation,\n } = useLocationsList()\n\n const { t } = useTranslation('Company.Locations')\n const { ...dataViewProps } = useDataView({\n data: locationList,\n columns: [\n {\n key: 'name',\n title: t('locationListCol1'),\n render: location => {\n return (\n <>\n <address>\n {getStreet(location)}\n <br />\n <small>{getCityStateZip(location)}</small>\n </address>\n </>\n )\n },\n },\n {\n key: 'status',\n title: <VisuallyHidden>{t('locationListCol2')}</VisuallyHidden>,\n render: location => {\n return (\n <>\n {location.mailingAddress && (\n <Components.Badge status={'info'}>{t('mailingAddress')}</Components.Badge>\n )}\n {location.filingAddress && (\n <>\n {' '}\n <Components.Badge status={'info'}>{t('filingAddress')}</Components.Badge>\n </>\n )}\n </>\n )\n },\n },\n ],\n itemMenu: location => {\n return (\n <HamburgerMenu\n items={[\n {\n label: t('editCta'),\n onClick: () => {\n handleEditLocation(location.uuid)\n },\n icon: <PencilSvg aria-hidden />,\n 'data-testid': 'edit-location',\n },\n ]}\n data-testid=\"location-hamburger\"\n triggerLabel={t('hamburgerTitle')}\n />\n )\n },\n pagination: {\n handleNextPage,\n handleFirstPage,\n handleLastPage,\n handlePreviousPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n },\n emptyState: () => (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')}>\n <Components.Button variant=\"secondary\" onClick={handleAddLocation}>\n {t('addFirstLicationCta')}\n </Components.Button>\n </EmptyData>\n ),\n })\n return <DataView label={t('locationListLabel')} {...dataViewProps} />\n}\n"],"names":["List","Components","useComponentContext","locationList","handleEditLocation","currentPage","totalPages","handleFirstPage","handleItemsPerPageChange","handleLastPage","handleNextPage","handlePreviousPage","handleAddLocation","useLocationsList","t","useTranslation","dataViewProps","useDataView","location","jsx","Fragment","getStreet","getCityStateZip","VisuallyHidden","jsxs","HamburgerMenu","PencilSvg","EmptyData","DataView"],"mappings":";;;;;;;;;;;AASO,MAAMA,IAAO,MAAM;AACxB,QAAMC,IAAaC,EAAoB,GACjC;AAAA,IACJ,cAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,mBAAAC;AAAA,MACEC,EAAiB,GAEf,EAAE,GAAAC,EAAA,IAAMC,EAAe,mBAAmB,GAC1C,EAAE,GAAGC,EAAc,IAAIC,EAAY;AAAA,IACvC,MAAMd;AAAA,IACN,SAAS;AAAA,MACP;AAAA,QACE,KAAK;AAAA,QACL,OAAOW,EAAE,kBAAkB;A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