@gusto/embedded-react-sdk 0.9.0 → 0.10.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 (96) hide show
  1. package/CHANGELOG.md +86 -2
  2. package/dist/components/Base/Base.d.ts +1 -1
  3. package/dist/components/Base/Base.js +39 -40
  4. package/dist/components/Base/Base.js.map +1 -1
  5. package/dist/components/Common/OnboardingStatusBadge/index.d.ts +21 -0
  6. package/dist/components/Common/OnboardingStatusBadge/index.js +17 -0
  7. package/dist/components/Common/OnboardingStatusBadge/index.js.map +1 -0
  8. package/dist/components/Common/TaxInputs/TaxInputs.js +42 -36
  9. package/dist/components/Common/TaxInputs/TaxInputs.js.map +1 -1
  10. package/dist/components/Contractor/Address/Form.js +4 -12
  11. package/dist/components/Contractor/Address/Form.js.map +1 -1
  12. package/dist/components/Contractor/List/index.d.ts +25 -0
  13. package/dist/components/Contractor/List/index.js +84 -0
  14. package/dist/components/Contractor/List/index.js.map +1 -0
  15. package/dist/components/Contractor/List/useContractorList.d.ts +20 -0
  16. package/dist/components/Contractor/List/useContractorList.js +31 -0
  17. package/dist/components/Contractor/List/useContractorList.js.map +1 -0
  18. package/dist/components/Contractor/NewHireReport/NewHireReport.d.ts +21 -0
  19. package/dist/components/Contractor/NewHireReport/NewHireReport.js +111 -0
  20. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -0
  21. package/dist/components/Contractor/NewHireReport/types.d.ts +4 -0
  22. package/dist/components/Contractor/PaymentMethod/BankAccountForm.d.ts +2 -0
  23. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +52 -0
  24. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -0
  25. package/dist/components/Contractor/PaymentMethod/PaymentMethod.d.ts +31 -0
  26. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +116 -0
  27. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -0
  28. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.d.ts +11 -0
  29. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +35 -0
  30. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -0
  31. package/dist/components/Contractor/PaymentMethod/types.d.ts +8 -0
  32. package/dist/components/Contractor/index.d.ts +3 -0
  33. package/dist/components/Contractor/index.js +8 -2
  34. package/dist/components/Contractor/index.js.map +1 -1
  35. package/dist/components/Employee/Compensation/Edit.js +59 -56
  36. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  37. package/dist/components/Employee/Compensation/useCompensation.d.ts +2 -0
  38. package/dist/components/Employee/Compensation/useCompensation.js +16 -14
  39. package/dist/components/Employee/Compensation/useCompensation.js.map +1 -1
  40. package/dist/components/Employee/Deductions/DeductionForm.js +11 -3
  41. package/dist/components/Employee/Deductions/DeductionForm.js.map +1 -1
  42. package/dist/components/Employee/Deductions/Deductions.js +25 -25
  43. package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
  44. package/dist/components/Employee/EmployeeList/List.js +56 -51
  45. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  46. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +48 -43
  47. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
  48. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +1 -1
  49. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  50. package/dist/components/Employee/PaymentMethod/PaymentMethod.js +3 -4
  51. package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
  52. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
  53. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  54. package/dist/components/Employee/PaymentMethod/Split.js +88 -76
  55. package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
  56. package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +2 -2
  57. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +29 -25
  58. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  59. package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +49 -20
  60. package/dist/components/Employee/Profile/AdminPersonalDetails.js +27 -25
  61. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  62. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +1 -1
  63. package/dist/components/Employee/Profile/Profile.js +135 -129
  64. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  65. package/dist/components/Employee/Taxes/StateForm.d.ts +1 -1
  66. package/dist/components/Employee/Taxes/StateForm.js +27 -25
  67. package/dist/components/Employee/Taxes/StateForm.js.map +1 -1
  68. package/dist/components/Employee/Taxes/Taxes.d.ts +1 -1
  69. package/dist/components/Employee/Taxes/Taxes.js +77 -73
  70. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  71. package/dist/components/index.d.ts +1 -1
  72. package/dist/i18n/I18n.js +17 -17
  73. package/dist/i18n/I18n.js.map +1 -1
  74. package/dist/i18n/en/Contractor.ContractorList.json.js +25 -0
  75. package/dist/i18n/en/Contractor.ContractorList.json.js.map +1 -0
  76. package/dist/i18n/en/Contractor.NewHireReport.json.js +24 -0
  77. package/dist/i18n/en/Contractor.NewHireReport.json.js.map +1 -0
  78. package/dist/i18n/en/Contractor.PaymentMethod.json.js +35 -0
  79. package/dist/i18n/en/Contractor.PaymentMethod.json.js.map +1 -0
  80. package/dist/i18n/en/Employee.Compensation.json.js +22 -20
  81. package/dist/i18n/en/Employee.Compensation.json.js.map +1 -1
  82. package/dist/i18n/en/Employee.PaymentMethod.json.js +18 -17
  83. package/dist/i18n/en/Employee.PaymentMethod.json.js.map +1 -1
  84. package/dist/i18n/en/common.json.d.ts +21 -9
  85. package/dist/i18n/en/common.json.js +35 -23
  86. package/dist/i18n/en/common.json.js.map +1 -1
  87. package/dist/index.js +4 -4
  88. package/dist/shared/constants.d.ts +18 -0
  89. package/dist/shared/constants.js +28 -15
  90. package/dist/shared/constants.js.map +1 -1
  91. package/dist/style.css +1 -1
  92. package/dist/types/i18next.d.ts +64 -1
  93. package/package.json +4 -3
  94. package/dist/components/Employee/PaymentMethod/Constants.d.ts +0 -8
  95. package/dist/components/Employee/PaymentMethod/Constants.js +0 -6
  96. package/dist/components/Employee/PaymentMethod/Constants.js.map +0 -1
@@ -1,69 +1,98 @@
1
1
  import { z } from 'zod';
2
- export declare const AdminPersonalDetailsSchema: z.ZodDiscriminatedUnion<"selfOnboarding", [z.ZodObject<{
2
+ export declare const AdminSelfOnboardingPersonalDetailsSchema: z.ZodObject<{
3
+ workAddress: z.ZodString;
4
+ startDate: z.ZodEffects<z.ZodDate, string | undefined, Date>;
5
+ email: z.ZodString;
6
+ } & {
3
7
  firstName: z.ZodString;
4
8
  middleInitial: z.ZodOptional<z.ZodString>;
5
9
  lastName: z.ZodString;
6
10
  } & {
11
+ selfOnboarding: z.ZodBoolean;
12
+ }, "strip", z.ZodTypeAny, {
13
+ email: string;
14
+ firstName: string;
15
+ lastName: string;
16
+ workAddress: string;
17
+ selfOnboarding: boolean;
18
+ middleInitial?: string | undefined;
19
+ startDate?: string | undefined;
20
+ }, {
21
+ email: string;
22
+ firstName: string;
23
+ lastName: string;
24
+ workAddress: string;
25
+ startDate: Date;
26
+ selfOnboarding: boolean;
27
+ middleInitial?: string | undefined;
28
+ }>;
29
+ export declare const AdminPersonalDetailsSchema: z.ZodDiscriminatedUnion<"enableSsn", [z.ZodObject<{
7
30
  workAddress: z.ZodString;
8
31
  startDate: z.ZodEffects<z.ZodDate, string | undefined, Date>;
9
32
  email: z.ZodString;
33
+ firstName: z.ZodString;
34
+ middleInitial: z.ZodOptional<z.ZodString>;
35
+ lastName: z.ZodString;
36
+ selfOnboarding: z.ZodBoolean;
37
+ ssn: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
38
+ dateOfBirth: z.ZodEffects<z.ZodDate, string | undefined, Date>;
10
39
  } & {
11
- selfOnboarding: z.ZodLiteral<true>;
12
- enableSsn: z.ZodOptional<z.ZodBoolean>;
40
+ enableSsn: z.ZodLiteral<true>;
13
41
  }, "strip", z.ZodTypeAny, {
14
42
  email: string;
43
+ ssn: string;
15
44
  firstName: string;
16
45
  lastName: string;
17
46
  workAddress: string;
18
- selfOnboarding: true;
47
+ enableSsn: true;
48
+ selfOnboarding: boolean;
19
49
  middleInitial?: string | undefined;
20
50
  startDate?: string | undefined;
21
- enableSsn?: boolean | undefined;
51
+ dateOfBirth?: string | undefined;
22
52
  }, {
23
53
  email: string;
54
+ ssn: string;
24
55
  firstName: string;
25
56
  lastName: string;
26
57
  workAddress: string;
27
58
  startDate: Date;
28
- selfOnboarding: true;
59
+ enableSsn: true;
60
+ dateOfBirth: Date;
61
+ selfOnboarding: boolean;
29
62
  middleInitial?: string | undefined;
30
- enableSsn?: boolean | undefined;
31
63
  }>, z.ZodObject<{
32
- firstName: z.ZodString;
33
- middleInitial: z.ZodOptional<z.ZodString>;
34
- lastName: z.ZodString;
35
- } & {
36
64
  workAddress: z.ZodString;
37
65
  startDate: z.ZodEffects<z.ZodDate, string | undefined, Date>;
38
66
  email: z.ZodString;
39
67
  } & {
40
- ssn: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
41
- enableSsn: z.ZodBoolean;
68
+ firstName: z.ZodString;
69
+ middleInitial: z.ZodOptional<z.ZodString>;
70
+ lastName: z.ZodString;
71
+ } & {
72
+ selfOnboarding: z.ZodBoolean;
42
73
  } & {
43
74
  dateOfBirth: z.ZodEffects<z.ZodDate, string | undefined, Date>;
44
75
  } & {
45
- selfOnboarding: z.ZodLiteral<false>;
76
+ enableSsn: z.ZodLiteral<false>;
46
77
  }, "strip", z.ZodTypeAny, {
47
78
  email: string;
48
- ssn: string;
49
79
  firstName: string;
50
80
  lastName: string;
51
81
  workAddress: string;
52
- enableSsn: boolean;
53
- selfOnboarding: false;
82
+ enableSsn: false;
83
+ selfOnboarding: boolean;
54
84
  middleInitial?: string | undefined;
55
85
  startDate?: string | undefined;
56
86
  dateOfBirth?: string | undefined;
57
87
  }, {
58
88
  email: string;
59
- ssn: string;
60
89
  firstName: string;
61
90
  lastName: string;
62
91
  workAddress: string;
63
92
  startDate: Date;
64
- enableSsn: boolean;
93
+ enableSsn: false;
65
94
  dateOfBirth: Date;
66
- selfOnboarding: false;
95
+ selfOnboarding: boolean;
67
96
  middleInitial?: string | undefined;
68
97
  }>]>;
69
98
  export declare const AdminPersonalDetails: () => import("react/jsx-runtime").JSX.Element | null;
@@ -1,45 +1,47 @@
1
1
  import { jsxs as a, Fragment as s, jsx as n } from "react/jsx-runtime";
2
- import { useEffect as p } from "react";
3
- import { useFormContext as g } from "react-hook-form";
2
+ import { useEffect as g } from "react";
3
+ import { useFormContext as h } from "react-hook-form";
4
4
  import { useTranslation as O } from "react-i18next";
5
- import { z as o } from "zod";
6
- import { NameInputsSchema as h, SocialSecurityNumberSchema as D, DateOfBirthSchema as I, NameInputs as A, AdminInputs as N, SocialSecurityNumberInput as E, DateOfBirthInput as y, AdminInputsSchema as x } from "./PersonalDetailsInputs.js";
5
+ import { z as t } from "zod";
6
+ import { AdminInputsSchema as D, SocialSecurityNumberSchema as I, DateOfBirthSchema as l, NameInputsSchema as A, NameInputs as N, AdminInputs as E, SocialSecurityNumberInput as x, DateOfBirthInput as y } from "./PersonalDetailsInputs.js";
7
7
  import { useProfile as P } from "./useProfile.js";
8
- import { EmployeeOnboardingStatus as l } from "../../../shared/constants.js";
9
- import { CheckboxField as B } from "../../Common/Fields/CheckboxField/CheckboxField.js";
10
- const m = h.merge(x), M = o.discriminatedUnion("selfOnboarding", [
11
- // Case 1: Self onboarding is true - only base fields required
12
- m.extend({
13
- selfOnboarding: o.literal(!0),
14
- enableSsn: o.boolean().optional()
8
+ import { EmployeeOnboardingStatus as m } from "../../../shared/constants.js";
9
+ import { CheckboxField as F } from "../../Common/Fields/CheckboxField/CheckboxField.js";
10
+ const d = D.merge(
11
+ A
12
+ ).extend({
13
+ selfOnboarding: t.boolean()
14
+ }), M = t.discriminatedUnion("enableSsn", [
15
+ d.merge(I).merge(l).extend({
16
+ enableSsn: t.literal(!0)
15
17
  }),
16
- // Case 2: Self onboarding is false - additional fields required
17
- m.merge(D).merge(I).extend({
18
- selfOnboarding: o.literal(!1)
18
+ d.merge(l).extend({
19
+ enableSsn: t.literal(!1)
19
20
  })
20
21
  ]), V = () => {
21
- const { companyLocations: d, employee: e, isAdmin: c, isSelfOnboardingEnabled: f } = P(), { t: b } = O("Employee.Profile"), { watch: u, setValue: t, getFieldState: S } = g(), r = u("selfOnboarding"), { isDirty: i } = S("ssn");
22
- return p(() => {
23
- r ? t("enableSsn", !1) : t("enableSsn", i ? !0 : !e?.hasSsn);
24
- }, [r, e?.hasSsn, i, t]), c ? /* @__PURE__ */ a(s, { children: [
25
- /* @__PURE__ */ n(A, {}),
26
- /* @__PURE__ */ n(N, { companyLocations: d }),
27
- f && /* @__PURE__ */ n(
28
- B,
22
+ const { companyLocations: c, employee: e, isAdmin: f, isSelfOnboardingEnabled: S } = P(), { t: b } = O("Employee.Profile"), { watch: u, setValue: o, getFieldState: p } = h(), r = u("selfOnboarding"), { isDirty: i } = p("ssn");
23
+ return g(() => {
24
+ r ? o("enableSsn", !1) : o("enableSsn", i ? !0 : !e?.hasSsn);
25
+ }, [r, e?.hasSsn, i, o]), f ? /* @__PURE__ */ a(s, { children: [
26
+ /* @__PURE__ */ n(N, {}),
27
+ /* @__PURE__ */ n(E, { companyLocations: c }),
28
+ S && /* @__PURE__ */ n(
29
+ F,
29
30
  {
30
31
  name: "selfOnboarding",
31
32
  label: b("selfOnboardingLabel"),
32
- isDisabled: e?.onboarded || e?.onboardingStatus === l.ONBOARDING_COMPLETED || e?.onboardingStatus === l.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW
33
+ isDisabled: e?.onboarded || e?.onboardingStatus === m.ONBOARDING_COMPLETED || e?.onboardingStatus === m.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW
33
34
  }
34
35
  ),
35
36
  !r && /* @__PURE__ */ a(s, { children: [
36
- /* @__PURE__ */ n(E, { employee: e }),
37
+ /* @__PURE__ */ n(x, { employee: e }),
37
38
  /* @__PURE__ */ n(y, {})
38
39
  ] })
39
40
  ] }) : null;
40
41
  };
41
42
  export {
42
43
  V as AdminPersonalDetails,
43
- M as AdminPersonalDetailsSchema
44
+ M as AdminPersonalDetailsSchema,
45
+ d as AdminSelfOnboardingPersonalDetailsSchema
44
46
  };
45
47
  //# sourceMappingURL=AdminPersonalDetails.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AdminPersonalDetails.js","sources":["../../../../src/components/Employee/Profile/AdminPersonalDetails.tsx"],"sourcesContent":["import { useEffect } from 'react'\nimport { useFormContext } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport {\n AdminInputs,\n AdminInputsSchema,\n NameInputs,\n NameInputsSchema,\n SocialSecurityNumberInput,\n SocialSecurityNumberSchema,\n DateOfBirthInput,\n DateOfBirthSchema,\n type PersonalDetailsInputs,\n} from './PersonalDetailsInputs'\nimport { useProfile } from './useProfile'\nimport { EmployeeOnboardingStatus } from '@/shared/constants'\nimport { CheckboxField } from '@/components/Common'\n\n// Base schema with common fields\nconst PersonalDetailsBaseSchema = NameInputsSchema.merge(AdminInputsSchema)\n\n// Use Zod's discriminated union with proper composition\nexport const AdminPersonalDetailsSchema = z.discriminatedUnion('selfOnboarding', [\n // Case 1: Self onboarding is true - only base fields required\n PersonalDetailsBaseSchema.extend({\n selfOnboarding: z.literal(true),\n enableSsn: z.boolean().optional(),\n }),\n // Case 2: Self onboarding is false - additional fields required\n PersonalDetailsBaseSchema.merge(SocialSecurityNumberSchema)\n .merge(DateOfBirthSchema)\n .extend({\n selfOnboarding: z.literal(false),\n }),\n])\n\nexport const AdminPersonalDetails = () => {\n const { companyLocations, employee, isAdmin, isSelfOnboardingEnabled } = useProfile()\n const { t } = useTranslation('Employee.Profile')\n const { watch, setValue, getFieldState } = useFormContext<PersonalDetailsInputs>()\n\n const isSelfOnboardingChecked = watch('selfOnboarding')\n const { isDirty: isSsnDirty } = getFieldState('ssn')\n\n useEffect(() => {\n if (isSelfOnboardingChecked) {\n setValue('enableSsn', false)\n } else {\n setValue('enableSsn', isSsnDirty ? true : !employee?.hasSsn)\n }\n }, [isSelfOnboardingChecked, employee?.hasSsn, isSsnDirty, setValue])\n\n if (!isAdmin) {\n return null\n }\n\n return (\n <>\n <NameInputs />\n <AdminInputs companyLocations={companyLocations} />\n {isSelfOnboardingEnabled && (\n <CheckboxField\n name=\"selfOnboarding\"\n label={t('selfOnboardingLabel')}\n isDisabled={\n employee?.onboarded ||\n employee?.onboardingStatus === EmployeeOnboardingStatus.ONBOARDING_COMPLETED ||\n employee?.onboardingStatus ===\n EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW\n }\n />\n )}\n\n {!isSelfOnboardingChecked && (\n <>\n <SocialSecurityNumberInput employee={employee} />\n <DateOfBirthInput />\n </>\n )}\n </>\n )\n}\n"],"names":["PersonalDetailsBaseSchema","NameInputsSchema","AdminInputsSchema","AdminPersonalDetailsSchema","z","SocialSecurityNumberSchema","DateOfBirthSchema","AdminPersonalDetails","companyLocations","employee","isAdmin","isSelfOnboardingEnabled","useProfile","t","useTranslation","watch","setValue","getFieldState","useFormContext","isSelfOnboardingChecked","isSsnDirty","useEffect","jsxs","Fragment","jsx","NameInputs","AdminInputs","CheckboxField","EmployeeOnboardingStatus","SocialSecurityNumberInput","DateOfBirthInput"],"mappings":";;;;;;;;;AAoBA,MAAMA,IAA4BC,EAAiB,MAAMC,CAAiB,GAG7DC,IAA6BC,EAAE,mBAAmB,kBAAkB;AAAA;AAAA,EAE/EJ,EAA0B,OAAO;AAAA,IAC/B,gBAAgBI,EAAE,QAAQ,EAAI;AAAA,IAC9B,WAAWA,EAAE,QAAQ,EAAE,SAAS;AAAA,EAAA,CACjC;AAAA;AAAA,EAEDJ,EAA0B,MAAMK,CAA0B,EACvD,MAAMC,CAAiB,EACvB,OAAO;AAAA,IACN,gBAAgBF,EAAE,QAAQ,EAAK;AAAA,EAChC,CAAA;AACL,CAAC,GAEYG,IAAuB,MAAM;AACxC,QAAM,EAAE,kBAAAC,GAAkB,UAAAC,GAAU,SAAAC,GAAS,yBAAAC,EAAA,IAA4BC,EAAW,GAC9E,EAAE,GAAAC,EAAA,IAAMC,EAAe,kBAAkB,GACzC,EAAE,OAAAC,GAAO,UAAAC,GAAU,eAAAC,EAAA,IAAkBC,EAAsC,GAE3EC,IAA0BJ,EAAM,gBAAgB,GAChD,EAAE,SAASK,MAAeH,EAAc,KAAK;AAUnD,SARAI,EAAU,MAAM;AACd,IAAIF,IACFH,EAAS,aAAa,EAAK,IAE3BA,EAAS,aAAaI,IAAa,KAAO,CAACX,GAAU,MAAM;AAAA,EAC7D,GACC,CAACU,GAAyBV,GAAU,QAAQW,GAAYJ,CAAQ,CAAC,GAE/DN,IAMD,gBAAAY,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAW,EAAA;AAAA,IACZ,gBAAAD,EAACE,KAAY,kBAAAlB,GAAoC;AAAA,IAChDG,KACC,gBAAAa;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOd,EAAE,qBAAqB;AAAA,QAC9B,YACEJ,GAAU,aACVA,GAAU,qBAAqBmB,EAAyB,wBACxDnB,GAAU,qBACRmB,EAAyB;AAAA,MAAA;AAAA,IAE/B;AAAA,IAGD,CAACT,KAEE,gBAAAG,EAAAC,GAAA,EAAA,UAAA;AAAA,MAAA,gBAAAC,EAACK,KAA0B,UAAApB,GAAoB;AAAA,wBAC9CqB,GAAiB,CAAA,CAAA;AAAA,IAAA,EACpB,CAAA;AAAA,EAAA,GAEJ,IA1BO;AA4BX;"}
1
+ {"version":3,"file":"AdminPersonalDetails.js","sources":["../../../../src/components/Employee/Profile/AdminPersonalDetails.tsx"],"sourcesContent":["import { useEffect } from 'react'\nimport { useFormContext } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport {\n AdminInputs,\n AdminInputsSchema,\n NameInputs,\n NameInputsSchema,\n SocialSecurityNumberInput,\n SocialSecurityNumberSchema,\n DateOfBirthInput,\n DateOfBirthSchema,\n type PersonalDetailsInputs,\n} from './PersonalDetailsInputs'\nimport { useProfile } from './useProfile'\nimport { EmployeeOnboardingStatus } from '@/shared/constants'\nimport { CheckboxField } from '@/components/Common'\n\nexport const AdminSelfOnboardingPersonalDetailsSchema = AdminInputsSchema.merge(\n NameInputsSchema,\n).extend({\n selfOnboarding: z.boolean(),\n})\n\nexport const AdminPersonalDetailsSchema = z.discriminatedUnion('enableSsn', [\n AdminSelfOnboardingPersonalDetailsSchema.merge(SocialSecurityNumberSchema)\n .merge(DateOfBirthSchema)\n .extend({\n enableSsn: z.literal(true),\n }),\n AdminSelfOnboardingPersonalDetailsSchema.merge(DateOfBirthSchema).extend({\n enableSsn: z.literal(false),\n }),\n])\n\nexport const AdminPersonalDetails = () => {\n const { companyLocations, employee, isAdmin, isSelfOnboardingEnabled } = useProfile()\n const { t } = useTranslation('Employee.Profile')\n const { watch, setValue, getFieldState } = useFormContext<PersonalDetailsInputs>()\n\n const isSelfOnboardingChecked = watch('selfOnboarding')\n const { isDirty: isSsnDirty } = getFieldState('ssn')\n\n useEffect(() => {\n if (isSelfOnboardingChecked) {\n setValue('enableSsn', false)\n } else {\n setValue('enableSsn', isSsnDirty ? true : !employee?.hasSsn)\n }\n }, [isSelfOnboardingChecked, employee?.hasSsn, isSsnDirty, setValue])\n\n if (!isAdmin) {\n return null\n }\n\n return (\n <>\n <NameInputs />\n <AdminInputs companyLocations={companyLocations} />\n {isSelfOnboardingEnabled && (\n <CheckboxField\n name=\"selfOnboarding\"\n label={t('selfOnboardingLabel')}\n isDisabled={\n employee?.onboarded ||\n employee?.onboardingStatus === EmployeeOnboardingStatus.ONBOARDING_COMPLETED ||\n employee?.onboardingStatus ===\n EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW\n }\n />\n )}\n\n {!isSelfOnboardingChecked && (\n <>\n <SocialSecurityNumberInput employee={employee} />\n <DateOfBirthInput />\n </>\n )}\n </>\n )\n}\n"],"names":["AdminSelfOnboardingPersonalDetailsSchema","AdminInputsSchema","NameInputsSchema","z","AdminPersonalDetailsSchema","SocialSecurityNumberSchema","DateOfBirthSchema","AdminPersonalDetails","companyLocations","employee","isAdmin","isSelfOnboardingEnabled","useProfile","t","useTranslation","watch","setValue","getFieldState","useFormContext","isSelfOnboardingChecked","isSsnDirty","useEffect","jsxs","Fragment","jsx","NameInputs","AdminInputs","CheckboxField","EmployeeOnboardingStatus","SocialSecurityNumberInput","DateOfBirthInput"],"mappings":";;;;;;;;;AAmBO,MAAMA,IAA2CC,EAAkB;AAAA,EACxEC;AACF,EAAE,OAAO;AAAA,EACP,gBAAgBC,EAAE,QAAQ;AAC5B,CAAC,GAEYC,IAA6BD,EAAE,mBAAmB,aAAa;AAAA,EAC1EH,EAAyC,MAAMK,CAA0B,EACtE,MAAMC,CAAiB,EACvB,OAAO;AAAA,IACN,WAAWH,EAAE,QAAQ,EAAI;AAAA,EAAA,CAC1B;AAAA,EACHH,EAAyC,MAAMM,CAAiB,EAAE,OAAO;AAAA,IACvE,WAAWH,EAAE,QAAQ,EAAK;AAAA,EAC3B,CAAA;AACH,CAAC,GAEYI,IAAuB,MAAM;AACxC,QAAM,EAAE,kBAAAC,GAAkB,UAAAC,GAAU,SAAAC,GAAS,yBAAAC,EAAA,IAA4BC,EAAW,GAC9E,EAAE,GAAAC,EAAA,IAAMC,EAAe,kBAAkB,GACzC,EAAE,OAAAC,GAAO,UAAAC,GAAU,eAAAC,EAAA,IAAkBC,EAAsC,GAE3EC,IAA0BJ,EAAM,gBAAgB,GAChD,EAAE,SAASK,MAAeH,EAAc,KAAK;AAUnD,SARAI,EAAU,MAAM;AACd,IAAIF,IACFH,EAAS,aAAa,EAAK,IAE3BA,EAAS,aAAaI,IAAa,KAAO,CAACX,GAAU,MAAM;AAAA,EAC7D,GACC,CAACU,GAAyBV,GAAU,QAAQW,GAAYJ,CAAQ,CAAC,GAE/DN,IAMD,gBAAAY,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAA,gBAAAC,EAACC,GAAW,EAAA;AAAA,IACZ,gBAAAD,EAACE,KAAY,kBAAAlB,GAAoC;AAAA,IAChDG,KACC,gBAAAa;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOd,EAAE,qBAAqB;AAAA,QAC9B,YACEJ,GAAU,aACVA,GAAU,qBAAqBmB,EAAyB,wBACxDnB,GAAU,qBACRmB,EAAyB;AAAA,MAAA;AAAA,IAE/B;AAAA,IAGD,CAACT,KAEE,gBAAAG,EAAAC,GAAA,EAAA,UAAA;AAAA,MAAA,gBAAAC,EAACK,KAA0B,UAAApB,GAAoB;AAAA,wBAC9CqB,GAAiB,CAAA,CAAA;AAAA,IAAA,EACpB,CAAA;AAAA,EAAA,GAEJ,IA1BO;AA4BX;"}
@@ -5,7 +5,7 @@ import { useTranslation as i } from "react-i18next";
5
5
  import { Grid as b } from "../../Common/Grid/Grid.js";
6
6
  import { removeNonDigits as S, addressInline as g } from "../../../helpers/formattedStrings.js";
7
7
  import { usePlaceholderSSN as h, normalizeSSN as N } from "../../../helpers/ssn.js";
8
- import { nameValidation as m, SSN_REGEX as D } from "../../../helpers/validations.js";
8
+ import { SSN_REGEX as D, nameValidation as m } from "../../../helpers/validations.js";
9
9
  import { TextInputField as s } from "../../Common/Fields/TextInputField/TextInputField.js";
10
10
  import { SelectField as I } from "../../Common/Fields/SelectField/SelectField.js";
11
11
  import { DatePickerField as p } from "../../Common/Fields/DatePickerField/DatePickerField.js";
@@ -1,82 +1,82 @@
1
- import { jsx as t, jsxs as ye, Fragment as Ae } from "react/jsx-runtime";
2
- import { zodResolver as fe } from "@hookform/resolvers/zod";
3
- import { useRef as Ee } from "react";
4
- import { useForm as he, useWatch as De, FormProvider as Oe } from "react-hook-form";
5
- import { useLocationsGetSuspense as Se } from "@gusto/embedded-api/react-query/locationsGet";
6
- import { useEmployeesCreateMutation as Pe } from "@gusto/embedded-api/react-query/employeesCreate";
7
- import { useEmployeesGetSuspense as ge } from "@gusto/embedded-api/react-query/employeesGet";
8
- import { useEmployeeAddressesGetSuspense as be } from "@gusto/embedded-api/react-query/employeeAddressesGet";
9
- import { useEmployeeAddressesCreateMutation as Ne } from "@gusto/embedded-api/react-query/employeeAddressesCreate";
10
- import { useEmployeeAddressesUpdateMutation as Ie } from "@gusto/embedded-api/react-query/employeeAddressesUpdate";
11
- import { useEmployeeAddressesUpdateWorkAddressMutation as _e } from "@gusto/embedded-api/react-query/employeeAddressesUpdateWorkAddress";
12
- import { useEmployeesUpdateMutation as we } from "@gusto/embedded-api/react-query/employeesUpdate";
13
- import { useEmployeeAddressesGetWorkAddressesSuspense as ke } from "@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses";
14
- import { useEmployeeAddressesCreateWorkAddressMutation as Me } from "@gusto/embedded-api/react-query/employeeAddressesCreateWorkAddress";
15
- import { RFCDate as B } from "@gusto/embedded-api/types/rfcdate";
16
- import { useEmployeesUpdateOnboardingStatusMutation as Be } from "@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus";
17
- import { invalidateEmployeesList as Re } from "@gusto/embedded-api/react-query/employeesList";
18
- import { useQueryClient as Le } from "@tanstack/react-query";
19
- import { AdminPersonalDetailsSchema as ve, AdminPersonalDetails as L } from "./AdminPersonalDetails.js";
20
- import { SelfPersonalDetailsSchema as Ce, SelfPersonalDetails as v } from "./SelfPersonalDetails.js";
21
- import { Head as C } from "./Head.js";
22
- import { Actions as W } from "./Actions.js";
23
- import { HomeAddressSchema as We, HomeAddress as U } from "./HomeAddress.js";
24
- import { WorkAddress as q } from "./WorkAddress.js";
25
- import { ProfileProvider as Ue } from "./useProfile.js";
26
- import { getEmployeeAddressForProfile as qe } from "./getEmployeeAddressForProfile.js";
27
- import { Form as Te } from "../../Common/Form/Form.js";
28
- import { BaseComponent as He } from "../../Base/Base.js";
29
- import { useBase as Ge } from "../../Base/useBase.js";
30
- import { useI18n as R, useComponentDictionary as Fe } from "../../../i18n/I18n.js";
31
- import { EmployeeOnboardingStatus as l, EmployeeSelfOnboardingStatuses as Ve, componentEvents as d } from "../../../shared/constants.js";
32
- import { useFlow as Ye } from "../../Flow/useFlow.js";
33
- import { ensureRequired as xe } from "../../../helpers/ensureRequired.js";
34
- function m(r) {
35
- return /* @__PURE__ */ t(He, { ...r, children: r.employeeId ? /* @__PURE__ */ t(ze, { ...r, employeeId: r.employeeId, children: r.children }) : /* @__PURE__ */ t(T, { ...r, children: r.children }) });
1
+ import { jsx as t, jsxs as Ee, Fragment as he } from "react/jsx-runtime";
2
+ import { zodResolver as De } from "@hookform/resolvers/zod";
3
+ import { useState as Se, useRef as Oe, useEffect as Pe } from "react";
4
+ import { useForm as ge, useWatch as be, FormProvider as Ne } from "react-hook-form";
5
+ import { useLocationsGetSuspense as Ie } from "@gusto/embedded-api/react-query/locationsGet";
6
+ import { useEmployeesCreateMutation as _e } from "@gusto/embedded-api/react-query/employeesCreate";
7
+ import { useEmployeesGetSuspense as we } from "@gusto/embedded-api/react-query/employeesGet";
8
+ import { useEmployeeAddressesGetSuspense as ke } from "@gusto/embedded-api/react-query/employeeAddressesGet";
9
+ import { useEmployeeAddressesCreateMutation as Me } from "@gusto/embedded-api/react-query/employeeAddressesCreate";
10
+ import { useEmployeeAddressesUpdateMutation as Be } from "@gusto/embedded-api/react-query/employeeAddressesUpdate";
11
+ import { useEmployeeAddressesUpdateWorkAddressMutation as Re } from "@gusto/embedded-api/react-query/employeeAddressesUpdateWorkAddress";
12
+ import { useEmployeesUpdateMutation as ve } from "@gusto/embedded-api/react-query/employeesUpdate";
13
+ import { useEmployeeAddressesGetWorkAddressesSuspense as Le, invalidateAllEmployeeAddressesGetWorkAddresses as Ce } from "@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses";
14
+ import { useEmployeeAddressesCreateWorkAddressMutation as We } from "@gusto/embedded-api/react-query/employeeAddressesCreateWorkAddress";
15
+ import { RFCDate as v } from "@gusto/embedded-api/types/rfcdate";
16
+ import { useEmployeesUpdateOnboardingStatusMutation as Ue } from "@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus";
17
+ import { invalidateEmployeesList as qe } from "@gusto/embedded-api/react-query/employeesList";
18
+ import { useQueryClient as Te } from "@tanstack/react-query";
19
+ import { AdminPersonalDetailsSchema as L, AdminSelfOnboardingPersonalDetailsSchema as Ge, AdminPersonalDetails as W } from "./AdminPersonalDetails.js";
20
+ import { SelfPersonalDetailsSchema as He, SelfPersonalDetails as U } from "./SelfPersonalDetails.js";
21
+ import { Head as q } from "./Head.js";
22
+ import { Actions as T } from "./Actions.js";
23
+ import { HomeAddressSchema as Fe, HomeAddress as G } from "./HomeAddress.js";
24
+ import { WorkAddress as H } from "./WorkAddress.js";
25
+ import { ProfileProvider as Ve } from "./useProfile.js";
26
+ import { getEmployeeAddressForProfile as Ye } from "./getEmployeeAddressForProfile.js";
27
+ import { Form as xe } from "../../Common/Form/Form.js";
28
+ import { BaseComponent as ze } from "../../Base/Base.js";
29
+ import { useBase as je } from "../../Base/useBase.js";
30
+ import { useI18n as C, useComponentDictionary as Ke } from "../../../i18n/I18n.js";
31
+ import { EmployeeOnboardingStatus as l, EmployeeSelfOnboardingStatuses as Qe, componentEvents as d } from "../../../shared/constants.js";
32
+ import { useFlow as Je } from "../../Flow/useFlow.js";
33
+ import { ensureRequired as Xe } from "../../../helpers/ensureRequired.js";
34
+ function a(r) {
35
+ return /* @__PURE__ */ t(ze, { ...r, children: r.employeeId ? /* @__PURE__ */ t(Ze, { ...r, employeeId: r.employeeId, children: r.children }) : /* @__PURE__ */ t(F, { ...r, children: r.children }) });
36
36
  }
37
- function ze({ employeeId: r, ...a }) {
37
+ function Ze({ employeeId: r, ...m }) {
38
38
  const {
39
39
  data: { employee: u }
40
- } = ge({ employeeId: r }), {
40
+ } = we({ employeeId: r }), {
41
41
  data: { employeeAddressList: c }
42
- } = be({ employeeId: r }), {
42
+ } = ke({ employeeId: r }), {
43
43
  data: { employeeWorkAddressesList: i }
44
- } = ke({ employeeId: r });
44
+ } = Le({ employeeId: r });
45
45
  return /* @__PURE__ */ t(
46
- T,
46
+ F,
47
47
  {
48
- ...a,
48
+ ...m,
49
49
  employee: u,
50
50
  homeAddresses: c,
51
51
  workAddresses: i
52
52
  }
53
53
  );
54
54
  }
55
- const T = ({
55
+ const F = ({
56
56
  isAdmin: r = !1,
57
- isSelfOnboardingEnabled: a = !0,
57
+ isSelfOnboardingEnabled: m = !0,
58
58
  dictionary: u,
59
59
  ...c
60
60
  }) => {
61
- R("Employee.Profile"), R("Employee.HomeAddress"), Fe("Employee.Profile", u);
61
+ C("Employee.Profile"), C("Employee.HomeAddress"), Ke("Employee.Profile", u);
62
62
  const {
63
63
  companyId: i,
64
- employee: h,
65
- homeAddresses: H,
66
- workAddresses: P,
67
- children: g,
68
- className: G = "",
64
+ employee: D,
65
+ homeAddresses: V,
66
+ workAddresses: g,
67
+ children: b,
68
+ className: Y = "",
69
69
  defaultValues: s
70
- } = c, { onEvent: n, baseSubmitHandler: F } = Ge(), V = Le(), { data: Y } = Se({ companyId: i }), x = Y.locationList, { mutateAsync: z, isPending: j } = Pe(), { mutateAsync: K, isPending: Q } = we(), { mutateAsync: J, isPending: X } = Me(), { mutateAsync: Z, isPending: $ } = _e(), { mutateAsync: ee, isPending: re } = Ne(), { mutateAsync: te, isPending: oe } = Ie(), {
71
- mutateAsync: se,
72
- isPending: ne
73
- } = Be({
74
- onSettled: () => Re(V, [i])
75
- }), b = { employee: h, workAddresses: P }, de = qe(H), ie = b.workAddresses?.find((S) => S.active), e = Ee({
76
- employee: b.employee,
77
- homeAddress: de,
78
- workAddress: ie
79
- }), D = {
70
+ } = c, { onEvent: n, baseSubmitHandler: x } = je(), N = Te(), [z, I] = Se(L), { data: j } = Ie({ companyId: i }), K = j.locationList, { mutateAsync: Q, isPending: J } = _e(), { mutateAsync: X, isPending: Z } = ve(), { mutateAsync: $, isPending: ee } = We(), { mutateAsync: re, isPending: te } = Re(), { mutateAsync: oe, isPending: se } = Me(), { mutateAsync: ne, isPending: de } = Be(), {
71
+ mutateAsync: ie,
72
+ isPending: ae
73
+ } = Ue({
74
+ onSettled: () => qe(N, [i])
75
+ }), _ = { employee: D, workAddresses: g }, me = Ye(V), le = _.workAddresses?.find((P) => P.active), e = Oe({
76
+ employee: _.employee,
77
+ homeAddress: me,
78
+ workAddress: le
79
+ }), S = {
80
80
  firstName: e.current.employee?.firstName ?? s?.employee?.firstName ?? "",
81
81
  middleInitial: e.current.employee?.middleInitial ?? s?.employee?.middleInitial ?? "",
82
82
  lastName: e.current.employee?.lastName ?? s?.employee?.lastName ?? "",
@@ -91,33 +91,37 @@ const T = ({
91
91
  zip: e.current.homeAddress?.zip ?? s?.homeAddress?.zip ?? "",
92
92
  state: e.current.homeAddress?.state ?? s?.homeAddress?.state ?? "",
93
93
  courtesyWithholding: e.current.homeAddress?.courtesyWithholding ?? !1
94
- }, me = e.current.employee?.onboarded || e.current.employee?.onboardingStatus === l.ONBOARDING_COMPLETED || e.current.employee?.onboardingStatus !== void 0 && e.current.employee.onboardingStatus !== l.ADMIN_ONBOARDING_INCOMPLETE ? { ...D, enableSsn: !1, selfOnboarding: !0 } : {
95
- ...D,
96
- selfOnboarding: a && e.current.employee?.onboardingStatus ? (
94
+ }, ue = e.current.employee?.onboarded || e.current.employee?.onboardingStatus === l.ONBOARDING_COMPLETED || e.current.employee?.onboardingStatus !== void 0 && e.current.employee.onboardingStatus !== l.ADMIN_ONBOARDING_INCOMPLETE ? { ...S, enableSsn: !1, selfOnboarding: !0 } : {
95
+ ...S,
96
+ selfOnboarding: m && e.current.employee?.onboardingStatus ? (
97
97
  // @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses
98
- Ve.has(e.current.employee.onboarding_status)
98
+ Qe.has(e.current.employee.onboarding_status)
99
99
  ) : !1,
100
100
  enableSsn: !e.current.employee?.hasSsn,
101
101
  ssn: ""
102
- }, ae = {
103
- ...D,
102
+ }, ce = {
103
+ ...S,
104
104
  enableSsn: !e.current.employee?.hasSsn,
105
105
  ssn: ""
106
- }, O = he({
107
- resolver: fe(
108
- (r ? ve : Ce).and(We)
106
+ }, O = ge({
107
+ resolver: De(
108
+ (r ? z : He).and(Fe)
109
109
  ),
110
- defaultValues: r ? me : ae
111
- }), { handleSubmit: le } = O, N = De({ control: O.control, name: "selfOnboarding" }), ue = async (S) => {
112
- await F(S, async (A) => {
113
- const { workAddress: I, startDate: pe, selfOnboarding: f, ...E } = A;
110
+ defaultValues: r ? ue : ce
111
+ }), { handleSubmit: pe } = O, A = be({ control: O.control, name: "selfOnboarding" });
112
+ Pe(() => {
113
+ r && I(A ? Ge : L);
114
+ }, [A, r]);
115
+ const ye = async (P) => {
116
+ await x(P, async (f) => {
117
+ const { workAddress: w, startDate: fe, selfOnboarding: E, ...h } = f;
114
118
  if (e.current.employee) {
115
- if (f && e.current.employee.onboardingStatus === l.ADMIN_ONBOARDING_INCOMPLETE || !f && e.current.employee.onboardingStatus === l.SELF_ONBOARDING_PENDING_INVITE) {
116
- const { employeeOnboardingStatus: p } = await se({
119
+ if (E && e.current.employee.onboardingStatus === l.ADMIN_ONBOARDING_INCOMPLETE || !E && e.current.employee.onboardingStatus === l.SELF_ONBOARDING_PENDING_INVITE) {
120
+ const { employeeOnboardingStatus: p } = await ie({
117
121
  request: {
118
122
  employeeId: e.current.employee.uuid,
119
123
  requestBody: {
120
- onboardingStatus: f ? l.SELF_ONBOARDING_PENDING_INVITE : l.ADMIN_ONBOARDING_INCOMPLETE
124
+ onboardingStatus: E ? l.SELF_ONBOARDING_PENDING_INVITE : l.ADMIN_ONBOARDING_INCOMPLETE
121
125
  }
122
126
  }
123
127
  });
@@ -126,21 +130,21 @@ const T = ({
126
130
  onboardingStatus: p.onboardingStatus
127
131
  }, n(d.EMPLOYEE_ONBOARDING_STATUS_UPDATED, p);
128
132
  }
129
- const { employee: o } = await K({
133
+ const { employee: o } = await X({
130
134
  request: {
131
135
  employeeId: e.current.employee.uuid,
132
- requestBody: { ...E, version: e.current.employee.version }
136
+ requestBody: { ...h, version: e.current.employee.version }
133
137
  }
134
138
  });
135
139
  e.current = { ...e.current, employee: o }, n(d.EMPLOYEE_UPDATED, o);
136
140
  } else {
137
- const { employee: o } = await z({
141
+ const { employee: o } = await Q({
138
142
  request: {
139
143
  companyId: i,
140
144
  requestBody: {
141
- ...E,
142
- selfOnboarding: f,
143
- dateOfBirth: E.dateOfBirth ? new B(E.dateOfBirth) : void 0
145
+ ...h,
146
+ selfOnboarding: E,
147
+ dateOfBirth: h.dateOfBirth ? new v(h.dateOfBirth) : void 0
144
148
  }
145
149
  }
146
150
  });
@@ -148,119 +152,121 @@ const T = ({
148
152
  }
149
153
  if (typeof e.current.employee?.uuid != "string")
150
154
  throw new Error("Employee id is not available");
151
- if ((!N || !r) && !A.selfOnboarding) {
152
- const { street1: o, street2: p, city: _, state: w, zip: k, courtesyWithholding: M } = A;
155
+ if ((!A || !r) && !f.selfOnboarding) {
156
+ const { street1: o, street2: p, city: k, state: M, zip: B, courtesyWithholding: R } = f;
153
157
  if (e.current.homeAddress) {
154
- const { employeeAddress: y } = await te({
158
+ const { employeeAddress: y } = await ne({
155
159
  request: {
156
160
  homeAddressUuid: e.current.homeAddress.uuid,
157
161
  requestBody: {
158
162
  version: e.current.homeAddress.version,
159
163
  street1: o,
160
164
  street2: p,
161
- city: _,
162
- state: w,
163
- zip: k,
164
- courtesyWithholding: M
165
+ city: k,
166
+ state: M,
167
+ zip: B,
168
+ courtesyWithholding: R
165
169
  }
166
170
  }
167
171
  });
168
172
  e.current = { ...e.current, homeAddress: y }, n(d.EMPLOYEE_HOME_ADDRESS_UPDATED, y);
169
173
  } else {
170
- const { employeeAddress: y } = await ee({
174
+ const { employeeAddress: y } = await oe({
171
175
  request: {
172
176
  employeeId: e.current.employee.uuid,
173
177
  requestBody: {
174
178
  street1: o,
175
179
  street2: p,
176
- city: _,
177
- state: w,
178
- zip: k,
179
- courtesyWithholding: M
180
+ city: k,
181
+ state: M,
182
+ zip: B,
183
+ courtesyWithholding: R
180
184
  }
181
185
  }
182
186
  });
183
187
  e.current = { ...e.current, homeAddress: y }, n(d.EMPLOYEE_HOME_ADDRESS_CREATED, y);
184
188
  }
185
189
  }
186
- if (r)
190
+ if (r) {
187
191
  if (e.current.workAddress) {
188
- const { employeeWorkAddress: o } = await Z({
192
+ const { employeeWorkAddress: o } = await re({
189
193
  request: {
190
194
  workAddressUuid: e.current.workAddress.uuid,
191
195
  requestBody: {
192
196
  version: e.current.workAddress.version,
193
- locationUuid: I
197
+ locationUuid: w
194
198
  }
195
199
  }
196
200
  });
197
201
  e.current = { ...e.current, workAddress: o }, n(d.EMPLOYEE_WORK_ADDRESS_UPDATED, o);
198
202
  } else {
199
- const { employeeWorkAddress: o } = await J({
203
+ const { employeeWorkAddress: o } = await $({
200
204
  request: {
201
205
  employeeId: e.current.employee?.uuid,
202
206
  requestBody: {
203
- locationUuid: I,
204
- effectiveDate: new B(A.startDate || /* @__PURE__ */ new Date())
207
+ locationUuid: w,
208
+ effectiveDate: new v(f.startDate || /* @__PURE__ */ new Date())
205
209
  }
206
210
  }
207
211
  });
208
212
  e.current = { ...e.current, workAddress: o }, n(d.EMPLOYEE_WORK_ADDRESS_CREATED, o);
209
213
  }
214
+ await Ce(N);
215
+ }
210
216
  n(d.EMPLOYEE_PROFILE_DONE, {
211
217
  ...e.current.employee,
212
- startDate: pe
218
+ startDate: fe
213
219
  });
214
220
  });
215
- }, ce = () => {
221
+ }, Ae = () => {
216
222
  n(d.CANCEL);
217
223
  };
218
- return /* @__PURE__ */ t("section", { className: G, children: /* @__PURE__ */ t(
219
- Ue,
224
+ return /* @__PURE__ */ t("section", { className: Y, children: /* @__PURE__ */ t(
225
+ Ve,
220
226
  {
221
227
  value: {
222
- companyLocations: x,
223
- workAddresses: P,
228
+ companyLocations: K,
229
+ workAddresses: g,
224
230
  employee: e.current.employee ?? void 0,
225
- isSelfOnboardingIntended: N,
226
- handleCancel: ce,
231
+ isSelfOnboardingIntended: A,
232
+ handleCancel: Ae,
227
233
  isAdmin: r,
228
- isSelfOnboardingEnabled: a,
229
- isPending: Q || $ || re || oe || j || X || ne
234
+ isSelfOnboardingEnabled: m,
235
+ isPending: Z || te || se || de || J || ee || ae
230
236
  },
231
- children: /* @__PURE__ */ t(Oe, { ...O, children: /* @__PURE__ */ t(Te, { onSubmit: le(ue), children: g || /* @__PURE__ */ ye(Ae, { children: [
232
- /* @__PURE__ */ t(C, {}),
233
- /* @__PURE__ */ t(L, {}),
234
- /* @__PURE__ */ t(v, {}),
235
- /* @__PURE__ */ t(U, {}),
237
+ children: /* @__PURE__ */ t(Ne, { ...O, children: /* @__PURE__ */ t(xe, { onSubmit: pe(ye), children: b || /* @__PURE__ */ Ee(he, { children: [
236
238
  /* @__PURE__ */ t(q, {}),
237
- /* @__PURE__ */ t(W, {})
239
+ /* @__PURE__ */ t(W, {}),
240
+ /* @__PURE__ */ t(U, {}),
241
+ /* @__PURE__ */ t(G, {}),
242
+ /* @__PURE__ */ t(H, {}),
243
+ /* @__PURE__ */ t(T, {})
238
244
  ] }) }) })
239
245
  }
240
246
  ) });
241
247
  };
242
- m.Head = C;
243
- m.Actions = W;
244
- m.AdminPersonalDetails = L;
245
- m.SelfPersonalDetails = v;
246
- m.HomeAddress = U;
247
- m.WorkAddress = q;
248
- const Ir = () => {
249
- const { companyId: r, employeeId: a, onEvent: u, isAdmin: c, defaultValues: i, isSelfOnboardingEnabled: h } = Ye();
248
+ a.Head = q;
249
+ a.Actions = T;
250
+ a.AdminPersonalDetails = W;
251
+ a.SelfPersonalDetails = U;
252
+ a.HomeAddress = G;
253
+ a.WorkAddress = H;
254
+ const Rr = () => {
255
+ const { companyId: r, employeeId: m, onEvent: u, isAdmin: c, defaultValues: i, isSelfOnboardingEnabled: D } = Je();
250
256
  return /* @__PURE__ */ t(
251
- m,
257
+ a,
252
258
  {
253
- companyId: xe(r),
254
- employeeId: a,
259
+ companyId: Xe(r),
260
+ employeeId: m,
255
261
  onEvent: u,
256
262
  isAdmin: c,
257
263
  defaultValues: i?.profile,
258
- isSelfOnboardingEnabled: h
264
+ isSelfOnboardingEnabled: D
259
265
  }
260
266
  );
261
267
  };
262
268
  export {
263
- m as Profile,
264
- Ir as ProfileContextual
269
+ a as Profile,
270
+ Rr as ProfileContextual
265
271
  };
266
272
  //# sourceMappingURL=Profile.js.map