@gusto/embedded-react-sdk 0.10.1 → 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 (120) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/components/Base/Base.d.ts +3 -2
  3. package/dist/components/Base/Base.js +56 -50
  4. package/dist/components/Base/Base.js.map +1 -1
  5. package/dist/components/Common/InternalError/InternalError.js.map +1 -1
  6. package/dist/components/Common/UI/ComboBox/ComboBox.js +31 -33
  7. package/dist/components/Common/UI/ComboBox/ComboBox.js.map +1 -1
  8. package/dist/components/Common/UI/ComboBox/ComboBox.module.scss.js +1 -1
  9. package/dist/components/Common/UI/Text/TextTypes.d.ts +1 -1
  10. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -3
  11. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  12. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -3
  13. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  14. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -5
  15. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  16. package/dist/components/Company/BankAccount/BankAccount.d.ts +2 -2
  17. package/dist/components/Company/BankAccount/BankAccount.js +25 -20
  18. package/dist/components/Company/BankAccount/BankAccount.js.map +1 -1
  19. package/dist/components/Company/BankAccount/BankAccountComponents.js +16 -9
  20. package/dist/components/Company/BankAccount/BankAccountComponents.js.map +1 -1
  21. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +22 -8
  22. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  23. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.d.ts +1 -0
  24. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +30 -30
  25. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js.map +1 -1
  26. package/dist/components/Company/BankAccount/BankAccountForm/context.d.ts +4 -0
  27. package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -3
  28. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  29. package/dist/components/Company/BankAccount/BankAccountList/AccountView.js +14 -13
  30. package/dist/components/Company/BankAccount/BankAccountList/AccountView.js.map +1 -1
  31. package/dist/components/Company/BankAccount/stateMachine.d.ts +1 -1
  32. package/dist/components/Company/BankAccount/stateMachine.js +13 -5
  33. package/dist/components/Company/BankAccount/stateMachine.js.map +1 -1
  34. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -3
  35. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  36. package/dist/components/Company/DocumentSigner/DocumentSigner.d.ts +5 -7
  37. package/dist/components/Company/DocumentSigner/DocumentSigner.js +24 -24
  38. package/dist/components/Company/DocumentSigner/DocumentSigner.js.map +1 -1
  39. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +41 -42
  40. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  41. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
  42. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  43. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +6 -5
  44. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  45. package/dist/components/Company/Industry/Context.js +7 -6
  46. package/dist/components/Company/Industry/Context.js.map +1 -1
  47. package/dist/components/Company/Industry/Industry.js +30 -31
  48. package/dist/components/Company/Industry/Industry.js.map +1 -1
  49. package/dist/components/Company/Locations/LocationForm/LocationForm.js +34 -37
  50. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  51. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -3
  52. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  53. package/dist/components/Company/Locations/LocationsList/List.js +4 -1
  54. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  55. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -3
  56. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  57. package/dist/components/Company/OnboardingOverview/context.js +4 -3
  58. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  59. package/dist/components/Company/PaySchedule/PaySchedule.js +70 -71
  60. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  61. package/dist/components/Company/PaySchedule/usePaySchedule.js +6 -5
  62. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  63. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
  64. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  65. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -3
  66. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  67. package/dist/components/Contractor/Address/Address.js +37 -38
  68. package/dist/components/Contractor/Address/Address.js.map +1 -1
  69. package/dist/components/Contractor/Address/useAddress.js +6 -5
  70. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  71. package/dist/components/Contractor/NewHireReport/NewHireReport.js +57 -58
  72. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  73. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
  74. package/dist/components/Employee/Compensation/Compensation.js +123 -132
  75. package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
  76. package/dist/components/Employee/Deductions/Deductions.js +74 -79
  77. package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
  78. package/dist/components/Employee/Deductions/useDeductions.js +6 -5
  79. package/dist/components/Employee/Deductions/useDeductions.js.map +1 -1
  80. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +4 -3
  81. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  82. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +36 -42
  83. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  84. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
  85. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  86. package/dist/components/Employee/EmployeeList/EmployeeList.js +57 -58
  87. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  88. package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -3
  89. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  90. package/dist/components/Employee/PaymentMethod/PaymentMethod.js +95 -97
  91. package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
  92. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +6 -5
  93. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  94. package/dist/components/Employee/Profile/Profile.js +118 -124
  95. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  96. package/dist/components/Employee/Profile/useProfile.js +4 -3
  97. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  98. package/dist/components/Employee/Taxes/FederalForm.js +4 -4
  99. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  100. package/dist/components/Employee/Taxes/Taxes.js +59 -60
  101. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  102. package/dist/components/Employee/Taxes/useTaxes.js +4 -3
  103. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  104. package/dist/contexts/ApiProvider/ApiProvider.js +16 -14
  105. package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
  106. package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +5 -0
  107. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +2 -0
  108. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +19 -17
  109. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  110. package/dist/contexts/LoadingIndicatorProvider/LoadingIndicatorProvider.d.ts +7 -0
  111. package/dist/contexts/LoadingIndicatorProvider/LoadingIndicatorProvider.js +10 -0
  112. package/dist/contexts/LoadingIndicatorProvider/LoadingIndicatorProvider.js.map +1 -0
  113. package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.d.ts +6 -0
  114. package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.js +11 -0
  115. package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.js.map +1 -0
  116. package/dist/shared/constants.d.ts +2 -0
  117. package/dist/shared/constants.js +10 -9
  118. package/dist/shared/constants.js.map +1 -1
  119. package/dist/style.css +1 -1
  120. package/package.json +5 -1
@@ -7,12 +7,13 @@ import "react-i18next";
7
7
  import "@gusto/embedded-api/models/errors/apierror";
8
8
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
9
9
  import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
10
+ import "@tanstack/react-query";
10
11
  import "../../Base/useBase.js";
11
12
  import "../../../shared/constants.js";
12
13
  import "dompurify";
13
14
  import "../../../contexts/ComponentAdapter/useComponentContext.js";
14
15
  import { createCompoundContext as a } from "../../Base/createCompoundContext.js";
15
- const j = t.union([
16
+ const B = t.union([
16
17
  l.extend({
17
18
  type: t.literal("Direct Deposit"),
18
19
  isSplit: t.literal(!1)
@@ -52,10 +53,10 @@ const j = t.union([
52
53
  remainder: t.string()
53
54
  })
54
55
  ])
55
- ]), [B, x] = a("PaymentMethodContext");
56
+ ]), [x, S] = a("PaymentMethodContext");
56
57
  export {
57
- j as CombinedSchema,
58
- x as PaymentMethodProvider,
59
- B as usePaymentMethod
58
+ B as CombinedSchema,
59
+ S as PaymentMethodProvider,
60
+ x as usePaymentMethod
60
61
  };
61
62
  //# sourceMappingURL=usePaymentMethod.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePaymentMethod.js","sources":["../../../../src/components/Employee/PaymentMethod/usePaymentMethod.ts"],"sourcesContent":["import type { EmployeeBankAccount } from '@gusto/embedded-api/models/components/employeebankaccount'\nimport type { EmployeePaymentMethod } from '@gusto/embedded-api/models/components/employeepaymentmethod'\nimport { z } from 'zod'\nimport { BankAccountSchema } from './BankAccount'\nimport { createCompoundContext } from '@/components/Base'\n\nexport const CombinedSchema = z.union([\n BankAccountSchema.extend({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(false),\n }),\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(false),\n hasBankPayload: z.literal(false),\n }),\n z.object({\n type: z.literal('Check'),\n }),\n z.discriminatedUnion('splitBy', [\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(true),\n hasBankPayload: z.literal(false),\n splitBy: z.literal('Percentage'),\n splitAmount: z.record(z.string(), z.number().max(100).min(0)).refine(\n input => Object.values(input).reduce((acc, curr) => acc + curr, 0) === 100,\n input => {\n const total = Object.values(input).reduce((acc, curr) => acc + curr, 0)\n return {\n message: `percentage_split_total_error:${total}`,\n }\n },\n ),\n priority: z.record(z.string(), z.number()),\n }),\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(true),\n hasBankPayload: z.literal(false),\n splitBy: z.literal('Amount'),\n priority: z.record(z.string(), z.number()).refine(input => {\n const arr = Object.values(input)\n return arr.filter((item, index) => arr.indexOf(item) !== index).length === 0\n }),\n splitAmount: z.record(z.string(), z.number().min(0).nullable()),\n remainder: z.string(),\n }),\n ]),\n])\n\nexport type CombinedSchemaInputs = z.input<typeof CombinedSchema>\nexport type CombinedSchemaOutputs = z.output<typeof CombinedSchema>\n\ntype PaymentMethodContextType = {\n bankAccounts: EmployeeBankAccount[]\n isPending: boolean\n watchedType?: string\n mode: MODE\n paymentMethod: EmployeePaymentMethod\n handleAdd: () => void\n handleSplit: () => void\n handleCancel: () => void\n handleDelete: (uuid: string) => void\n}\n\nexport type MODE = 'ADD' | 'LIST' | 'SPLIT' | 'INITIAL'\n\nconst [usePaymentMethod, PaymentMethodProvider] =\n createCompoundContext<PaymentMethodContextType>('PaymentMethodContext')\nexport { usePaymentMethod, PaymentMethodProvider }\n"],"names":["CombinedSchema","z","BankAccountSchema","input","acc","curr","arr","item","index","usePaymentMethod","PaymentMethodProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAMa,MAAAA,IAAiBC,EAAE,MAAM;AAAA,EACpCC,EAAkB,OAAO;AAAA,IACvB,MAAMD,EAAE,QAAQ,gBAAgB;AAAA,IAChC,SAASA,EAAE,QAAQ,EAAK;AAAA,EAAA,CACzB;AAAA,EACDA,EAAE,OAAO;AAAA,IACP,MAAMA,EAAE,QAAQ,gBAAgB;AAAA,IAChC,SAASA,EAAE,QAAQ,EAAK;AAAA,IACxB,gBAAgBA,EAAE,QAAQ,EAAK;AAAA,EAAA,CAChC;AAAA,EACDA,EAAE,OAAO;AAAA,IACP,MAAMA,EAAE,QAAQ,OAAO;AAAA,EAAA,CACxB;AAAA,EACDA,EAAE,mBAAmB,WAAW;AAAA,IAC9BA,EAAE,OAAO;AAAA,MACP,MAAMA,EAAE,QAAQ,gBAAgB;AAAA,MAChC,SAASA,EAAE,QAAQ,EAAI;AAAA,MACvB,gBAAgBA,EAAE,QAAQ,EAAK;AAAA,MAC/B,SAASA,EAAE,QAAQ,YAAY;AAAA,MAC/B,aAAaA,EAAE,OAAOA,EAAE,OAAU,GAAAA,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE;AAAA,QAC5D,CAASE,MAAA,OAAO,OAAOA,CAAK,EAAE,OAAO,CAACC,GAAKC,MAASD,IAAMC,GAAM,CAAC,MAAM;AAAA,QACvE,CAASF,OAEA;AAAA,UACL,SAAS,gCAFG,OAAO,OAAOA,CAAK,EAAE,OAAO,CAACC,GAAKC,MAASD,IAAMC,GAAM,CAAC,CAEtB;AAAA,QAChD;AAAA,MAEJ;AAAA,MACA,UAAUJ,EAAE,OAAOA,EAAE,OAAU,GAAAA,EAAE,OAAQ,CAAA;AAAA,IAAA,CAC1C;AAAA,IACDA,EAAE,OAAO;AAAA,MACP,MAAMA,EAAE,QAAQ,gBAAgB;AAAA,MAChC,SAASA,EAAE,QAAQ,EAAI;AAAA,MACvB,gBAAgBA,EAAE,QAAQ,EAAK;AAAA,MAC/B,SAASA,EAAE,QAAQ,QAAQ;AAAA,MAC3B,UAAUA,EAAE,OAAOA,EAAE,OAAA,GAAUA,EAAE,OAAQ,CAAA,EAAE,OAAO,CAASE,MAAA;AACnD,cAAAG,IAAM,OAAO,OAAOH,CAAK;AACxB,eAAAG,EAAI,OAAO,CAACC,GAAMC,MAAUF,EAAI,QAAQC,CAAI,MAAMC,CAAK,EAAE,WAAW;AAAA,MAAA,CAC5E;AAAA,MACD,aAAaP,EAAE,OAAOA,EAAE,OAAO,GAAGA,EAAE,OAAS,EAAA,IAAI,CAAC,EAAE,UAAU;AAAA,MAC9D,WAAWA,EAAE,OAAO;AAAA,IACrB,CAAA;AAAA,EACF,CAAA;AACH,CAAC,GAmBK,CAACQ,GAAkBC,CAAqB,IAC5CC,EAAgD,sBAAsB;"}
1
+ {"version":3,"file":"usePaymentMethod.js","sources":["../../../../src/components/Employee/PaymentMethod/usePaymentMethod.ts"],"sourcesContent":["import type { EmployeeBankAccount } from '@gusto/embedded-api/models/components/employeebankaccount'\nimport type { EmployeePaymentMethod } from '@gusto/embedded-api/models/components/employeepaymentmethod'\nimport { z } from 'zod'\nimport { BankAccountSchema } from './BankAccount'\nimport { createCompoundContext } from '@/components/Base'\n\nexport const CombinedSchema = z.union([\n BankAccountSchema.extend({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(false),\n }),\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(false),\n hasBankPayload: z.literal(false),\n }),\n z.object({\n type: z.literal('Check'),\n }),\n z.discriminatedUnion('splitBy', [\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(true),\n hasBankPayload: z.literal(false),\n splitBy: z.literal('Percentage'),\n splitAmount: z.record(z.string(), z.number().max(100).min(0)).refine(\n input => Object.values(input).reduce((acc, curr) => acc + curr, 0) === 100,\n input => {\n const total = Object.values(input).reduce((acc, curr) => acc + curr, 0)\n return {\n message: `percentage_split_total_error:${total}`,\n }\n },\n ),\n priority: z.record(z.string(), z.number()),\n }),\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(true),\n hasBankPayload: z.literal(false),\n splitBy: z.literal('Amount'),\n priority: z.record(z.string(), z.number()).refine(input => {\n const arr = Object.values(input)\n return arr.filter((item, index) => arr.indexOf(item) !== index).length === 0\n }),\n splitAmount: z.record(z.string(), z.number().min(0).nullable()),\n remainder: z.string(),\n }),\n ]),\n])\n\nexport type CombinedSchemaInputs = z.input<typeof CombinedSchema>\nexport type CombinedSchemaOutputs = z.output<typeof CombinedSchema>\n\ntype PaymentMethodContextType = {\n bankAccounts: EmployeeBankAccount[]\n isPending: boolean\n watchedType?: string\n mode: MODE\n paymentMethod: EmployeePaymentMethod\n handleAdd: () => void\n handleSplit: () => void\n handleCancel: () => void\n handleDelete: (uuid: string) => void\n}\n\nexport type MODE = 'ADD' | 'LIST' | 'SPLIT' | 'INITIAL'\n\nconst [usePaymentMethod, PaymentMethodProvider] =\n createCompoundContext<PaymentMethodContextType>('PaymentMethodContext')\nexport { usePaymentMethod, PaymentMethodProvider }\n"],"names":["CombinedSchema","z","BankAccountSchema","input","acc","curr","arr","item","index","usePaymentMethod","PaymentMethodProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;AAMa,MAAAA,IAAiBC,EAAE,MAAM;AAAA,EACpCC,EAAkB,OAAO;AAAA,IACvB,MAAMD,EAAE,QAAQ,gBAAgB;AAAA,IAChC,SAASA,EAAE,QAAQ,EAAK;AAAA,EAAA,CACzB;AAAA,EACDA,EAAE,OAAO;AAAA,IACP,MAAMA,EAAE,QAAQ,gBAAgB;AAAA,IAChC,SAASA,EAAE,QAAQ,EAAK;AAAA,IACxB,gBAAgBA,EAAE,QAAQ,EAAK;AAAA,EAAA,CAChC;AAAA,EACDA,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IAAI,CAAC,EAAE,UAAU;AAAA,MAC9D,WAAWA,EAAE,OAAO;AAAA,IACrB,CAAA;AAAA,EACF,CAAA;AACH,CAAC,GAmBK,CAACQ,GAAkBC,CAAqB,IAC5CC,EAAgD,sBAAsB;"}
@@ -1,82 +1,78 @@
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";
1
+ import { jsx as t, jsxs as fe, Fragment as Ee } from "react/jsx-runtime";
2
+ import { zodResolver as he } from "@hookform/resolvers/zod";
3
+ import { useState as De, useRef as Oe, useEffect as Se } from "react";
4
+ import { useForm as Pe, useWatch as ge, FormProvider as be } from "react-hook-form";
5
+ import { useLocationsGetSuspense as Ne } from "@gusto/embedded-api/react-query/locationsGet";
6
+ import { useEmployeesCreateMutation as Ie } from "@gusto/embedded-api/react-query/employeesCreate";
7
+ import { useEmployeesGetSuspense as _e } from "@gusto/embedded-api/react-query/employeesGet";
8
+ import { useEmployeeAddressesGetSuspense as we } from "@gusto/embedded-api/react-query/employeeAddressesGet";
9
+ import { useEmployeeAddressesCreateMutation as ke } from "@gusto/embedded-api/react-query/employeeAddressesCreate";
10
+ import { useEmployeeAddressesUpdateMutation as Me } from "@gusto/embedded-api/react-query/employeeAddressesUpdate";
11
+ import { useEmployeeAddressesUpdateWorkAddressMutation as Be } from "@gusto/embedded-api/react-query/employeeAddressesUpdateWorkAddress";
12
+ import { useEmployeesUpdateMutation as Re } from "@gusto/embedded-api/react-query/employeesUpdate";
13
+ import { useEmployeeAddressesGetWorkAddressesSuspense as Le } from "@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses";
14
+ import { useEmployeeAddressesCreateWorkAddressMutation as ve } from "@gusto/embedded-api/react-query/employeeAddressesCreateWorkAddress";
15
+ import { RFCDate as R } from "@gusto/embedded-api/types/rfcdate";
16
+ import { useEmployeesUpdateOnboardingStatusMutation as We } from "@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus";
17
+ import { AdminPersonalDetailsSchema as L, AdminSelfOnboardingPersonalDetailsSchema as Ce, AdminPersonalDetails as W } from "./AdminPersonalDetails.js";
18
+ import { SelfPersonalDetailsSchema as Ue, SelfPersonalDetails as C } from "./SelfPersonalDetails.js";
19
+ import { Head as U } from "./Head.js";
20
+ import { Actions as q } from "./Actions.js";
21
+ import { HomeAddressSchema as qe, HomeAddress as T } from "./HomeAddress.js";
24
22
  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 }) });
23
+ import { ProfileProvider as Te } from "./useProfile.js";
24
+ import { getEmployeeAddressForProfile as He } from "./getEmployeeAddressForProfile.js";
25
+ import { Form as Ge } from "../../Common/Form/Form.js";
26
+ import { BaseComponent as Fe } from "../../Base/Base.js";
27
+ import { useBase as Ve } from "../../Base/useBase.js";
28
+ import { useI18n as v, useComponentDictionary as Ye } from "../../../i18n/I18n.js";
29
+ import { EmployeeOnboardingStatus as l, EmployeeSelfOnboardingStatuses as xe, componentEvents as d } from "../../../shared/constants.js";
30
+ import { useFlow as ze } from "../../Flow/useFlow.js";
31
+ import { ensureRequired as je } from "../../../helpers/ensureRequired.js";
32
+ function i(r) {
33
+ return /* @__PURE__ */ t(Fe, { ...r, children: r.employeeId ? /* @__PURE__ */ t(Ke, { ...r, employeeId: r.employeeId, children: r.children }) : /* @__PURE__ */ t(G, { ...r, children: r.children }) });
36
34
  }
37
- function Ze({ employeeId: r, ...m }) {
35
+ function Ke({ employeeId: r, ...a }) {
38
36
  const {
39
37
  data: { employee: u }
40
- } = we({ employeeId: r }), {
38
+ } = _e({ employeeId: r }), {
41
39
  data: { employeeAddressList: c }
42
- } = ke({ employeeId: r }), {
43
- data: { employeeWorkAddressesList: i }
40
+ } = we({ employeeId: r }), {
41
+ data: { employeeWorkAddressesList: m }
44
42
  } = Le({ employeeId: r });
45
43
  return /* @__PURE__ */ t(
46
- F,
44
+ G,
47
45
  {
48
- ...m,
46
+ ...a,
49
47
  employee: u,
50
48
  homeAddresses: c,
51
- workAddresses: i
49
+ workAddresses: m
52
50
  }
53
51
  );
54
52
  }
55
- const F = ({
53
+ const G = ({
56
54
  isAdmin: r = !1,
57
- isSelfOnboardingEnabled: m = !0,
55
+ isSelfOnboardingEnabled: a = !0,
58
56
  dictionary: u,
59
57
  ...c
60
58
  }) => {
61
- C("Employee.Profile"), C("Employee.HomeAddress"), Ke("Employee.Profile", u);
59
+ v("Employee.Profile"), v("Employee.HomeAddress"), Ye("Employee.Profile", u);
62
60
  const {
63
- companyId: i,
61
+ companyId: m,
64
62
  employee: D,
65
- homeAddresses: V,
63
+ homeAddresses: F,
66
64
  workAddresses: g,
67
65
  children: b,
68
- className: Y = "",
66
+ className: V = "",
69
67
  defaultValues: s
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 = {
68
+ } = c, { onEvent: n, baseSubmitHandler: Y } = Ve(), [x, N] = De(L), { data: z } = Ne({ companyId: m }), j = z.locationList, { mutateAsync: K, isPending: J } = Ie(), { mutateAsync: Q, isPending: X } = Re(), { mutateAsync: Z, isPending: $ } = ve(), { mutateAsync: ee, isPending: re } = Be(), { mutateAsync: te, isPending: oe } = ke(), { mutateAsync: se, isPending: ne } = Me(), {
69
+ mutateAsync: de,
70
+ isPending: ie
71
+ } = We(), I = { employee: D, workAddresses: g }, ae = He(F), me = I.workAddresses?.find((P) => P.active), e = Oe({
72
+ employee: I.employee,
73
+ homeAddress: ae,
74
+ workAddress: me
75
+ }), O = {
80
76
  firstName: e.current.employee?.firstName ?? s?.employee?.firstName ?? "",
81
77
  middleInitial: e.current.employee?.middleInitial ?? s?.employee?.middleInitial ?? "",
82
78
  lastName: e.current.employee?.lastName ?? s?.employee?.lastName ?? "",
@@ -91,33 +87,33 @@ const F = ({
91
87
  zip: e.current.homeAddress?.zip ?? s?.homeAddress?.zip ?? "",
92
88
  state: e.current.homeAddress?.state ?? s?.homeAddress?.state ?? "",
93
89
  courtesyWithholding: e.current.homeAddress?.courtesyWithholding ?? !1
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 ? (
90
+ }, le = 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 ? { ...O, enableSsn: !1, selfOnboarding: !0 } : {
91
+ ...O,
92
+ selfOnboarding: a && e.current.employee?.onboardingStatus ? (
97
93
  // @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses
98
- Qe.has(e.current.employee.onboarding_status)
94
+ xe.has(e.current.employee.onboarding_status)
99
95
  ) : !1,
100
96
  enableSsn: !e.current.employee?.hasSsn,
101
97
  ssn: ""
102
- }, ce = {
103
- ...S,
98
+ }, ue = {
99
+ ...O,
104
100
  enableSsn: !e.current.employee?.hasSsn,
105
101
  ssn: ""
106
- }, O = ge({
107
- resolver: De(
108
- (r ? z : He).and(Fe)
102
+ }, S = Pe({
103
+ resolver: he(
104
+ (r ? x : Ue).and(qe)
109
105
  ),
110
- defaultValues: r ? ue : ce
111
- }), { handleSubmit: pe } = O, A = be({ control: O.control, name: "selfOnboarding" });
112
- Pe(() => {
113
- r && I(A ? Ge : L);
106
+ defaultValues: r ? le : ue
107
+ }), { handleSubmit: ce } = S, A = ge({ control: S.control, name: "selfOnboarding" });
108
+ Se(() => {
109
+ r && N(A ? Ce : L);
114
110
  }, [A, r]);
115
- const ye = async (P) => {
116
- await x(P, async (f) => {
117
- const { workAddress: w, startDate: fe, selfOnboarding: E, ...h } = f;
111
+ const pe = async (P) => {
112
+ await Y(P, async (f) => {
113
+ const { workAddress: _, startDate: Ae, selfOnboarding: E, ...h } = f;
118
114
  if (e.current.employee) {
119
115
  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({
116
+ const { employeeOnboardingStatus: p } = await de({
121
117
  request: {
122
118
  employeeId: e.current.employee.uuid,
123
119
  requestBody: {
@@ -130,7 +126,7 @@ const F = ({
130
126
  onboardingStatus: p.onboardingStatus
131
127
  }, n(d.EMPLOYEE_ONBOARDING_STATUS_UPDATED, p);
132
128
  }
133
- const { employee: o } = await X({
129
+ const { employee: o } = await Q({
134
130
  request: {
135
131
  employeeId: e.current.employee.uuid,
136
132
  requestBody: { ...h, version: e.current.employee.version }
@@ -138,13 +134,13 @@ const F = ({
138
134
  });
139
135
  e.current = { ...e.current, employee: o }, n(d.EMPLOYEE_UPDATED, o);
140
136
  } else {
141
- const { employee: o } = await Q({
137
+ const { employee: o } = await K({
142
138
  request: {
143
- companyId: i,
139
+ companyId: m,
144
140
  requestBody: {
145
141
  ...h,
146
142
  selfOnboarding: E,
147
- dateOfBirth: h.dateOfBirth ? new v(h.dateOfBirth) : void 0
143
+ dateOfBirth: h.dateOfBirth ? new R(h.dateOfBirth) : void 0
148
144
  }
149
145
  }
150
146
  });
@@ -153,120 +149,118 @@ const F = ({
153
149
  if (typeof e.current.employee?.uuid != "string")
154
150
  throw new Error("Employee id is not available");
155
151
  if ((!A || !r) && !f.selfOnboarding) {
156
- const { street1: o, street2: p, city: k, state: M, zip: B, courtesyWithholding: R } = f;
152
+ const { street1: o, street2: p, city: w, state: k, zip: M, courtesyWithholding: B } = f;
157
153
  if (e.current.homeAddress) {
158
- const { employeeAddress: y } = await ne({
154
+ const { employeeAddress: y } = await se({
159
155
  request: {
160
156
  homeAddressUuid: e.current.homeAddress.uuid,
161
157
  requestBody: {
162
158
  version: e.current.homeAddress.version,
163
159
  street1: o,
164
160
  street2: p,
165
- city: k,
166
- state: M,
167
- zip: B,
168
- courtesyWithholding: R
161
+ city: w,
162
+ state: k,
163
+ zip: M,
164
+ courtesyWithholding: B
169
165
  }
170
166
  }
171
167
  });
172
168
  e.current = { ...e.current, homeAddress: y }, n(d.EMPLOYEE_HOME_ADDRESS_UPDATED, y);
173
169
  } else {
174
- const { employeeAddress: y } = await oe({
170
+ const { employeeAddress: y } = await te({
175
171
  request: {
176
172
  employeeId: e.current.employee.uuid,
177
173
  requestBody: {
178
174
  street1: o,
179
175
  street2: p,
180
- city: k,
181
- state: M,
182
- zip: B,
183
- courtesyWithholding: R
176
+ city: w,
177
+ state: k,
178
+ zip: M,
179
+ courtesyWithholding: B
184
180
  }
185
181
  }
186
182
  });
187
183
  e.current = { ...e.current, homeAddress: y }, n(d.EMPLOYEE_HOME_ADDRESS_CREATED, y);
188
184
  }
189
185
  }
190
- if (r) {
186
+ if (r)
191
187
  if (e.current.workAddress) {
192
- const { employeeWorkAddress: o } = await re({
188
+ const { employeeWorkAddress: o } = await ee({
193
189
  request: {
194
190
  workAddressUuid: e.current.workAddress.uuid,
195
191
  requestBody: {
196
192
  version: e.current.workAddress.version,
197
- locationUuid: w
193
+ locationUuid: _
198
194
  }
199
195
  }
200
196
  });
201
197
  e.current = { ...e.current, workAddress: o }, n(d.EMPLOYEE_WORK_ADDRESS_UPDATED, o);
202
198
  } else {
203
- const { employeeWorkAddress: o } = await $({
199
+ const { employeeWorkAddress: o } = await Z({
204
200
  request: {
205
201
  employeeId: e.current.employee?.uuid,
206
202
  requestBody: {
207
- locationUuid: w,
208
- effectiveDate: new v(f.startDate || /* @__PURE__ */ new Date())
203
+ locationUuid: _,
204
+ effectiveDate: new R(f.startDate || /* @__PURE__ */ new Date())
209
205
  }
210
206
  }
211
207
  });
212
208
  e.current = { ...e.current, workAddress: o }, n(d.EMPLOYEE_WORK_ADDRESS_CREATED, o);
213
209
  }
214
- await Ce(N);
215
- }
216
210
  n(d.EMPLOYEE_PROFILE_DONE, {
217
211
  ...e.current.employee,
218
- startDate: fe
212
+ startDate: Ae
219
213
  });
220
214
  });
221
- }, Ae = () => {
215
+ }, ye = () => {
222
216
  n(d.CANCEL);
223
217
  };
224
- return /* @__PURE__ */ t("section", { className: Y, children: /* @__PURE__ */ t(
225
- Ve,
218
+ return /* @__PURE__ */ t("section", { className: V, children: /* @__PURE__ */ t(
219
+ Te,
226
220
  {
227
221
  value: {
228
- companyLocations: K,
222
+ companyLocations: j,
229
223
  workAddresses: g,
230
224
  employee: e.current.employee ?? void 0,
231
225
  isSelfOnboardingIntended: A,
232
- handleCancel: Ae,
226
+ handleCancel: ye,
233
227
  isAdmin: r,
234
- isSelfOnboardingEnabled: m,
235
- isPending: Z || te || se || de || J || ee || ae
228
+ isSelfOnboardingEnabled: a,
229
+ isPending: X || re || oe || ne || J || $ || ie
236
230
  },
237
- children: /* @__PURE__ */ t(Ne, { ...O, children: /* @__PURE__ */ t(xe, { onSubmit: pe(ye), children: b || /* @__PURE__ */ Ee(he, { children: [
238
- /* @__PURE__ */ t(q, {}),
239
- /* @__PURE__ */ t(W, {}),
231
+ children: /* @__PURE__ */ t(be, { ...S, children: /* @__PURE__ */ t(Ge, { onSubmit: ce(pe), children: b || /* @__PURE__ */ fe(Ee, { children: [
240
232
  /* @__PURE__ */ t(U, {}),
241
- /* @__PURE__ */ t(G, {}),
233
+ /* @__PURE__ */ t(W, {}),
234
+ /* @__PURE__ */ t(C, {}),
235
+ /* @__PURE__ */ t(T, {}),
242
236
  /* @__PURE__ */ t(H, {}),
243
- /* @__PURE__ */ t(T, {})
237
+ /* @__PURE__ */ t(q, {})
244
238
  ] }) }) })
245
239
  }
246
240
  ) });
247
241
  };
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();
242
+ i.Head = U;
243
+ i.Actions = q;
244
+ i.AdminPersonalDetails = W;
245
+ i.SelfPersonalDetails = C;
246
+ i.HomeAddress = T;
247
+ i.WorkAddress = H;
248
+ const Ir = () => {
249
+ const { companyId: r, employeeId: a, onEvent: u, isAdmin: c, defaultValues: m, isSelfOnboardingEnabled: D } = ze();
256
250
  return /* @__PURE__ */ t(
257
- a,
251
+ i,
258
252
  {
259
- companyId: Xe(r),
260
- employeeId: m,
253
+ companyId: je(r),
254
+ employeeId: a,
261
255
  onEvent: u,
262
256
  isAdmin: c,
263
- defaultValues: i?.profile,
257
+ defaultValues: m?.profile,
264
258
  isSelfOnboardingEnabled: D
265
259
  }
266
260
  );
267
261
  };
268
262
  export {
269
- a as Profile,
270
- Rr as ProfileContextual
263
+ i as Profile,
264
+ Ir as ProfileContextual
271
265
  };
272
266
  //# sourceMappingURL=Profile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Profile.js","sources":["../../../../src/components/Employee/Profile/Profile.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { useRef, useState, useEffect } from 'react'\nimport type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useLocationsGetSuspense } from '@gusto/embedded-api/react-query/locationsGet'\nimport { useEmployeesCreateMutation } from '@gusto/embedded-api/react-query/employeesCreate'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { type Employee } from '@gusto/embedded-api/models/components/employee'\nimport { useEmployeeAddressesGetSuspense } from '@gusto/embedded-api/react-query/employeeAddressesGet'\nimport { type EmployeeAddress } from '@gusto/embedded-api/models/components/employeeaddress'\nimport { useEmployeeAddressesCreateMutation } from '@gusto/embedded-api/react-query/employeeAddressesCreate'\nimport { useEmployeeAddressesUpdateMutation } from '@gusto/embedded-api/react-query/employeeAddressesUpdate'\nimport { useEmployeeAddressesUpdateWorkAddressMutation } from '@gusto/embedded-api/react-query/employeeAddressesUpdateWorkAddress'\nimport { useEmployeesUpdateMutation } from '@gusto/embedded-api/react-query/employeesUpdate'\nimport {\n invalidateAllEmployeeAddressesGetWorkAddresses,\n useEmployeeAddressesGetWorkAddressesSuspense,\n} from '@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport { useEmployeeAddressesCreateWorkAddressMutation } from '@gusto/embedded-api/react-query/employeeAddressesCreateWorkAddress'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport { useEmployeesUpdateOnboardingStatusMutation } from '@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus'\nimport { invalidateEmployeesList } from '@gusto/embedded-api/react-query/employeesList'\nimport { useQueryClient } from '@tanstack/react-query'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport {\n AdminPersonalDetails,\n AdminPersonalDetailsSchema,\n AdminSelfOnboardingPersonalDetailsSchema,\n} from './AdminPersonalDetails'\nimport { SelfPersonalDetails, SelfPersonalDetailsSchema } from './SelfPersonalDetails'\nimport { type PersonalDetailsPayload, type PersonalDetailsInputs } from './PersonalDetailsInputs'\nimport { Head } from './Head'\nimport { Actions } from './Actions'\nimport { HomeAddress, HomeAddressSchema, type HomeAddressInputs } from './HomeAddress'\nimport { WorkAddress } from './WorkAddress'\nimport { ProfileProvider } from './useProfile'\nimport { getEmployeeAddressForProfile } from './getEmployeeAddressForProfile'\nimport { Form } from '@/components/Common/Form'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport {\n componentEvents,\n EmployeeOnboardingStatus,\n EmployeeSelfOnboardingStatuses,\n} from '@/shared/constants'\nimport type { RequireAtLeastOne, WithRequired } from '@/types/Helpers'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { ensureRequired } from '@/helpers/ensureRequired'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nexport type ProfileDefaultValues = RequireAtLeastOne<{\n employee?: RequireAtLeastOne<{\n firstName?: string\n middleInitial?: string\n lastName?: string\n email?: string\n dateOfBirth?: string\n }>\n homeAddress?: RequireAtLeastOne<{\n street1?: string\n street2?: string\n city?: string\n state?: string\n zip?: string\n }>\n}>\ninterface ProfileProps extends CommonComponentInterface<'Employee.Profile'> {\n employeeId?: string\n companyId: string\n defaultValues?: ProfileDefaultValues\n isAdmin?: boolean\n isSelfOnboardingEnabled?: boolean\n}\n\ninterface ProfileConditionalProps {\n employee?: Employee\n homeAddresses?: EmployeeAddress[]\n workAddresses?: EmployeeWorkAddress[]\n}\n\nexport function Profile(props: ProfileProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n {props.employeeId ? (\n <RootWithEmployee {...props} employeeId={props.employeeId}>\n {props.children}\n </RootWithEmployee>\n ) : (\n <Root {...props}>{props.children}</Root>\n )}\n </BaseComponent>\n )\n}\n\n/**Accounting for conditional logic where employee data needs to be fetched only if employeeId is present */\nfunction RootWithEmployee({ employeeId, ...props }: WithRequired<ProfileProps, 'employeeId'>) {\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n const {\n data: { employeeAddressList },\n } = useEmployeeAddressesGetSuspense({ employeeId })\n const {\n data: { employeeWorkAddressesList },\n } = useEmployeeAddressesGetWorkAddressesSuspense({ employeeId })\n return (\n <Root\n {...props}\n employee={employee}\n homeAddresses={employeeAddressList}\n workAddresses={employeeWorkAddressesList}\n />\n )\n}\n\nconst Root = ({\n isAdmin = false,\n isSelfOnboardingEnabled = true,\n dictionary,\n ...props\n}: ProfileProps & ProfileConditionalProps) => {\n useI18n('Employee.Profile')\n useI18n('Employee.HomeAddress')\n useComponentDictionary('Employee.Profile', dictionary)\n const {\n companyId,\n employee,\n homeAddresses,\n workAddresses,\n children,\n className = '',\n defaultValues,\n } = props\n const { onEvent, baseSubmitHandler } = useBase()\n const queryClient = useQueryClient()\n\n const [AdminSchema, setAdminSchema] = useState<\n typeof AdminPersonalDetailsSchema | typeof AdminSelfOnboardingPersonalDetailsSchema\n >(AdminPersonalDetailsSchema)\n\n const { data } = useLocationsGetSuspense({ companyId })\n const companyLocations = data.locationList!\n\n const { mutateAsync: createEmployee, isPending: isPendingCreateEmployee } =\n useEmployeesCreateMutation()\n const { mutateAsync: mutateEmployee, isPending: isPendingEmployeeUpdate } =\n useEmployeesUpdateMutation()\n\n const { mutateAsync: createEmployeeWorkAddress, isPending: isPendingCreateWA } =\n useEmployeeAddressesCreateWorkAddressMutation()\n const { mutateAsync: mutateEmployeeWorkAddress, isPending: isPendingWorkAddressUpdate } =\n useEmployeeAddressesUpdateWorkAddressMutation()\n\n const { mutateAsync: createEmployeeHomeAddress, isPending: isPendingAddHA } =\n useEmployeeAddressesCreateMutation()\n const { mutateAsync: mutateEmployeeHomeAddress, isPending: isPendingUpdateHA } =\n useEmployeeAddressesUpdateMutation()\n\n const {\n mutateAsync: updateEmployeeOnboardingStatus,\n isPending: isPendingUpdateOnboardingStatus,\n } = useEmployeesUpdateOnboardingStatusMutation({\n onSettled: () => invalidateEmployeesList(queryClient, [companyId]),\n })\n\n const existingData = { employee, workAddresses, homeAddresses }\n\n const currentHomeAddress = getEmployeeAddressForProfile(homeAddresses)\n\n const currentWorkAddress = existingData.workAddresses?.find(address => address.active)\n const mergedData = useRef({\n employee: existingData.employee,\n homeAddress: currentHomeAddress,\n workAddress: currentWorkAddress,\n })\n const initialValues = {\n firstName: mergedData.current.employee?.firstName ?? defaultValues?.employee?.firstName ?? '',\n middleInitial:\n mergedData.current.employee?.middleInitial ?? defaultValues?.employee?.middleInitial ?? '',\n lastName: mergedData.current.employee?.lastName ?? defaultValues?.employee?.lastName ?? '',\n workAddress: mergedData.current.workAddress?.locationUuid,\n startDate: mergedData.current.employee?.jobs?.[0]?.hireDate\n ? new Date(mergedData.current.employee.jobs[0].hireDate)\n : null, // By default employee response contains only current job - therefore jobs[0]\n email: mergedData.current.employee?.email ?? defaultValues?.employee?.email ?? '',\n dateOfBirth: mergedData.current.employee?.dateOfBirth\n ? new Date(mergedData.current.employee.dateOfBirth)\n : defaultValues?.employee?.dateOfBirth\n ? new Date(defaultValues.employee.dateOfBirth)\n : null,\n\n street1: mergedData.current.homeAddress?.street1 ?? defaultValues?.homeAddress?.street1 ?? '',\n street2: mergedData.current.homeAddress?.street2 ?? defaultValues?.homeAddress?.street2 ?? '',\n city: mergedData.current.homeAddress?.city ?? defaultValues?.homeAddress?.city ?? '',\n zip: mergedData.current.homeAddress?.zip ?? defaultValues?.homeAddress?.zip ?? '',\n state: mergedData.current.homeAddress?.state ?? defaultValues?.homeAddress?.state ?? '',\n courtesyWithholding: mergedData.current.homeAddress?.courtesyWithholding ?? false,\n }\n\n const adminDefaultValues =\n mergedData.current.employee?.onboarded ||\n mergedData.current.employee?.onboardingStatus ===\n EmployeeOnboardingStatus.ONBOARDING_COMPLETED ||\n (mergedData.current.employee?.onboardingStatus !== undefined &&\n mergedData.current.employee.onboardingStatus !==\n EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE)\n ? { ...initialValues, enableSsn: false, selfOnboarding: true }\n : {\n ...initialValues,\n selfOnboarding: isSelfOnboardingEnabled\n ? mergedData.current.employee?.onboardingStatus\n ? // @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses\n EmployeeSelfOnboardingStatuses.has(mergedData.current.employee.onboarding_status)\n : false\n : false,\n enableSsn: !mergedData.current.employee?.hasSsn,\n ssn: '',\n } // In edit mode ssn is submitted only if it has been modified\n\n const selfDetaultValues = {\n ...initialValues,\n enableSsn: !mergedData.current.employee?.hasSsn,\n ssn: '',\n }\n\n const formMethods = useForm<\n PersonalDetailsInputs & HomeAddressInputs,\n unknown,\n PersonalDetailsPayload & HomeAddressInputs\n >({\n resolver: zodResolver(\n (isAdmin ? AdminSchema : SelfPersonalDetailsSchema).and(HomeAddressSchema),\n ),\n defaultValues: isAdmin ? adminDefaultValues : selfDetaultValues,\n })\n\n const { handleSubmit } = formMethods\n const watchedSelfOnboarding = useWatch({ control: formMethods.control, name: 'selfOnboarding' })\n\n useEffect(() => {\n if (isAdmin) {\n if (watchedSelfOnboarding) {\n setAdminSchema(AdminSelfOnboardingPersonalDetailsSchema)\n } else {\n setAdminSchema(AdminPersonalDetailsSchema)\n }\n }\n }, [watchedSelfOnboarding, isAdmin])\n\n const onSubmit: SubmitHandler<PersonalDetailsPayload & HomeAddressInputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { workAddress, startDate, selfOnboarding, ...body } = payload\n //create or update employee\n if (!mergedData.current.employee) {\n const { employee: employeeData } = await createEmployee({\n request: {\n companyId,\n requestBody: {\n ...body,\n selfOnboarding,\n dateOfBirth: body.dateOfBirth ? new RFCDate(body.dateOfBirth) : undefined,\n },\n },\n })\n mergedData.current = { ...mergedData.current, employee: employeeData }\n onEvent(componentEvents.EMPLOYEE_CREATED, employeeData)\n } else {\n // Updating self-onboarding status\n if (\n (selfOnboarding &&\n mergedData.current.employee.onboardingStatus ===\n EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE) ||\n (!selfOnboarding &&\n mergedData.current.employee.onboardingStatus ===\n EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE)\n ) {\n const { employeeOnboardingStatus } = await updateEmployeeOnboardingStatus({\n request: {\n employeeId: mergedData.current.employee.uuid,\n requestBody: {\n onboardingStatus: selfOnboarding\n ? EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE\n : EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE,\n },\n },\n })\n mergedData.current.employee = {\n ...mergedData.current.employee,\n onboardingStatus: employeeOnboardingStatus!\n .onboardingStatus as (typeof EmployeeOnboardingStatus)[keyof typeof EmployeeOnboardingStatus],\n }\n onEvent(componentEvents.EMPLOYEE_ONBOARDING_STATUS_UPDATED, employeeOnboardingStatus)\n }\n const { employee: employeeData } = await mutateEmployee({\n request: {\n employeeId: mergedData.current.employee.uuid,\n requestBody: { ...body, version: mergedData.current.employee.version as string },\n },\n })\n mergedData.current = { ...mergedData.current, employee: employeeData }\n onEvent(componentEvents.EMPLOYEE_UPDATED, employeeData)\n }\n if (typeof mergedData.current.employee?.uuid !== 'string') {\n throw new Error('Employee id is not available')\n }\n //create or update home address - only if not intended for self onboarding\n if (!watchedSelfOnboarding || !isAdmin) {\n //typeguard: in this scenario payload will contain address information\n if (!payload.selfOnboarding) {\n const { street1, street2, city, state, zip, courtesyWithholding } = payload\n if (!mergedData.current.homeAddress) {\n // Creating home address - for new employee effective_date is the same as work start date\n const { employeeAddress } = await createEmployeeHomeAddress({\n request: {\n employeeId: mergedData.current.employee.uuid,\n requestBody: {\n street1,\n street2,\n city,\n state,\n zip,\n courtesyWithholding,\n },\n },\n })\n mergedData.current = { ...mergedData.current, homeAddress: employeeAddress }\n onEvent(componentEvents.EMPLOYEE_HOME_ADDRESS_CREATED, employeeAddress)\n } else {\n const { employeeAddress } = await mutateEmployeeHomeAddress({\n request: {\n homeAddressUuid: mergedData.current.homeAddress.uuid,\n requestBody: {\n version: mergedData.current.homeAddress.version,\n street1,\n street2,\n city,\n state,\n zip,\n courtesyWithholding,\n },\n },\n })\n mergedData.current = { ...mergedData.current, homeAddress: employeeAddress }\n onEvent(componentEvents.EMPLOYEE_HOME_ADDRESS_UPDATED, employeeAddress)\n }\n }\n }\n\n if (isAdmin) {\n //create or update workaddress\n if (!mergedData.current.workAddress) {\n const { employeeWorkAddress } = await createEmployeeWorkAddress({\n request: {\n employeeId: mergedData.current.employee?.uuid as string,\n requestBody: {\n locationUuid: workAddress,\n effectiveDate: new RFCDate(payload.startDate || new Date()),\n },\n },\n })\n\n mergedData.current = { ...mergedData.current, workAddress: employeeWorkAddress }\n onEvent(componentEvents.EMPLOYEE_WORK_ADDRESS_CREATED, employeeWorkAddress)\n } else {\n //effective_date is excluded from update operation since it cannot be changed on initial work address\n const { employeeWorkAddress } = await mutateEmployeeWorkAddress({\n request: {\n workAddressUuid: mergedData.current.workAddress.uuid,\n requestBody: {\n version: mergedData.current.workAddress.version,\n locationUuid: workAddress,\n },\n },\n })\n mergedData.current = { ...mergedData.current, workAddress: employeeWorkAddress }\n onEvent(componentEvents.EMPLOYEE_WORK_ADDRESS_UPDATED, employeeWorkAddress)\n }\n\n await invalidateAllEmployeeAddressesGetWorkAddresses(queryClient)\n }\n\n onEvent(componentEvents.EMPLOYEE_PROFILE_DONE, {\n ...mergedData.current.employee,\n startDate,\n })\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n return (\n <section className={className}>\n <ProfileProvider\n value={{\n companyLocations,\n workAddresses,\n employee: mergedData.current.employee ?? undefined,\n isSelfOnboardingIntended: watchedSelfOnboarding,\n handleCancel,\n isAdmin,\n isSelfOnboardingEnabled,\n isPending:\n isPendingEmployeeUpdate ||\n isPendingWorkAddressUpdate ||\n isPendingAddHA ||\n isPendingUpdateHA ||\n isPendingCreateEmployee ||\n isPendingCreateWA ||\n isPendingUpdateOnboardingStatus,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <AdminPersonalDetails />\n <SelfPersonalDetails />\n <HomeAddress />\n <WorkAddress />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </ProfileProvider>\n </section>\n )\n}\n\nProfile.Head = Head\nProfile.Actions = Actions\nProfile.AdminPersonalDetails = AdminPersonalDetails\nProfile.SelfPersonalDetails = SelfPersonalDetails\nProfile.HomeAddress = HomeAddress\nProfile.WorkAddress = WorkAddress\n\nexport const ProfileContextual = () => {\n const { companyId, employeeId, onEvent, isAdmin, defaultValues, isSelfOnboardingEnabled } =\n useFlow<OnboardingContextInterface>()\n\n return (\n <Profile\n companyId={ensureRequired(companyId)}\n employeeId={employeeId}\n onEvent={onEvent}\n isAdmin={isAdmin}\n defaultValues={defaultValues?.profile}\n isSelfOnboardingEnabled={isSelfOnboardingEnabled}\n />\n )\n}\n"],"names":["Profile","props","jsx","BaseComponent","RootWithEmployee","Root","employeeId","employee","useEmployeesGetSuspense","employeeAddressList","useEmployeeAddressesGetSuspense","employeeWorkAddressesList","useEmployeeAddressesGetWorkAddressesSuspense","isAdmin","isSelfOnboardingEnabled","dictionary","useI18n","useComponentDictionary","companyId","homeAddresses","workAddresses","children","className","defaultValues","onEvent","baseSubmitHandler","useBase","queryClient","useQueryClient","AdminSchema","setAdminSchema","useState","AdminPersonalDetailsSchema","data","useLocationsGetSuspense","companyLocations","createEmployee","isPendingCreateEmployee","useEmployeesCreateMutation","mutateEmployee","isPendingEmployeeUpdate","useEmployeesUpdateMutation","createEmployeeWorkAddress","isPendingCreateWA","useEmployeeAddressesCreateWorkAddressMutation","mutateEmployeeWorkAddress","isPendingWorkAddressUpdate","useEmployeeAddressesUpdateWorkAddressMutation","createEmployeeHomeAddress","isPendingAddHA","useEmployeeAddressesCreateMutation","mutateEmployeeHomeAddress","isPendingUpdateHA","useEmployeeAddressesUpdateMutation","updateEmployeeOnboardingStatus","isPendingUpdateOnboardingStatus","useEmployeesUpdateOnboardingStatusMutation","invalidateEmployeesList","existingData","currentHomeAddress","getEmployeeAddressForProfile","currentWorkAddress","address","mergedData","useRef","initialValues","adminDefaultValues","EmployeeOnboardingStatus","EmployeeSelfOnboardingStatuses","selfDetaultValues","formMethods","useForm","zodResolver","SelfPersonalDetailsSchema","HomeAddressSchema","handleSubmit","watchedSelfOnboarding","useWatch","useEffect","AdminSelfOnboardingPersonalDetailsSchema","onSubmit","payload","workAddress","startDate","selfOnboarding","body","employeeOnboardingStatus","componentEvents","employeeData","RFCDate","street1","street2","city","state","zip","courtesyWithholding","employeeAddress","employeeWorkAddress","invalidateAllEmployeeAddressesGetWorkAddresses","handleCancel","ProfileProvider","FormProvider","Form","jsxs","Fragment","Head","AdminPersonalDetails","SelfPersonalDetails","HomeAddress","WorkAddress","Actions","ProfileContextual","useFlow","ensureRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFO,SAASA,EAAQC,GAA8C;AAElE,SAAA,gBAAAC,EAACC,MAAe,GAAGF,GAChB,YAAM,aACL,gBAAAC,EAACE,IAAkB,EAAA,GAAGH,GAAO,YAAYA,EAAM,YAC5C,UAAAA,EAAM,SACT,CAAA,IAEA,gBAAAC,EAACG,KAAM,GAAGJ,GAAQ,UAAMA,EAAA,SAAA,CAAS,EAErC,CAAA;AAEJ;AAGA,SAASG,GAAiB,EAAE,YAAAE,GAAY,GAAGL,KAAmD;AACtF,QAAA;AAAA,IACJ,MAAM,EAAE,UAAAM,EAAS;AAAA,EAAA,IACf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AAtF;AAAA,QACA,yBAAAC;AAAA,QACA,WACE0B,KACAM,MACAG,MACAG,MACAf,KACAM,MACAY;AAAA,MACJ;AAAA,MAEA,UAAC,gBAAArD,EAAAmG,IAAA,EAAc,GAAG/B,GAChB,UAAC,gBAAApE,EAAAoG,IAAA,EAAK,UAAU3B,GAAaK,EAAQ,GAClC,UACC3D,KAGE,gBAAAkF,GAAAC,IAAA,EAAA,UAAA;AAAA,QAAA,gBAAAtG,EAACuG,GAAK,EAAA;AAAA,0BACLC,GAAqB,EAAA;AAAA,0BACrBC,GAAoB,EAAA;AAAA,0BACpBC,GAAY,EAAA;AAAA,0BACZC,GAAY,EAAA;AAAA,0BACZC,GAAQ,CAAA,CAAA;AAAA,MAAA,EACX,CAAA,EAEJ,CAAA,EACF,CAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;AAEA9G,EAAQ,OAAOyG;AACfzG,EAAQ,UAAU8G;AAClB9G,EAAQ,uBAAuB0G;AAC/B1G,EAAQ,sBAAsB2G;AAC9B3G,EAAQ,cAAc4G;AACtB5G,EAAQ,cAAc6G;AAEf,MAAME,KAAoB,MAAM;AAC/B,QAAA,EAAE,WAAA7F,GAAW,YAAAZ,GAAY,SAAAkB,GAAS,SAAAX,GAAS,eAAAU,GAAe,yBAAAT,MAC9DkG,GAAoC;AAGpC,SAAA,gBAAA9G;AAAA,IAACF;AAAA,IAAA;AAAA,MACC,WAAWiH,GAAe/F,CAAS;AAAA,MACnC,YAAAZ;AAAA,MACA,SAAAkB;AAAA,MACA,SAAAX;AAAA,MACA,eAAeU,GAAe;AAAA,MAC9B,yBAAAT;AAAA,IAAA;AAAA,EACF;AAEJ;"}
1
+ {"version":3,"file":"Profile.js","sources":["../../../../src/components/Employee/Profile/Profile.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { useRef, useState, useEffect } from 'react'\nimport type { SubmitHandler } from 'react-hook-form'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useLocationsGetSuspense } from '@gusto/embedded-api/react-query/locationsGet'\nimport { useEmployeesCreateMutation } from '@gusto/embedded-api/react-query/employeesCreate'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { type Employee } from '@gusto/embedded-api/models/components/employee'\nimport { useEmployeeAddressesGetSuspense } from '@gusto/embedded-api/react-query/employeeAddressesGet'\nimport { type EmployeeAddress } from '@gusto/embedded-api/models/components/employeeaddress'\nimport { useEmployeeAddressesCreateMutation } from '@gusto/embedded-api/react-query/employeeAddressesCreate'\nimport { useEmployeeAddressesUpdateMutation } from '@gusto/embedded-api/react-query/employeeAddressesUpdate'\nimport { useEmployeeAddressesUpdateWorkAddressMutation } from '@gusto/embedded-api/react-query/employeeAddressesUpdateWorkAddress'\nimport { useEmployeesUpdateMutation } from '@gusto/embedded-api/react-query/employeesUpdate'\nimport { useEmployeeAddressesGetWorkAddressesSuspense } from '@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport { useEmployeeAddressesCreateWorkAddressMutation } from '@gusto/embedded-api/react-query/employeeAddressesCreateWorkAddress'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport { useEmployeesUpdateOnboardingStatusMutation } from '@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport {\n AdminPersonalDetails,\n AdminPersonalDetailsSchema,\n AdminSelfOnboardingPersonalDetailsSchema,\n} from './AdminPersonalDetails'\nimport { SelfPersonalDetails, SelfPersonalDetailsSchema } from './SelfPersonalDetails'\nimport { type PersonalDetailsPayload, type PersonalDetailsInputs } from './PersonalDetailsInputs'\nimport { Head } from './Head'\nimport { Actions } from './Actions'\nimport { HomeAddress, HomeAddressSchema, type HomeAddressInputs } from './HomeAddress'\nimport { WorkAddress } from './WorkAddress'\nimport { ProfileProvider } from './useProfile'\nimport { getEmployeeAddressForProfile } from './getEmployeeAddressForProfile'\nimport { Form } from '@/components/Common/Form'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useI18n } from '@/i18n'\nimport {\n componentEvents,\n EmployeeOnboardingStatus,\n EmployeeSelfOnboardingStatuses,\n} from '@/shared/constants'\nimport type { RequireAtLeastOne, WithRequired } from '@/types/Helpers'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { ensureRequired } from '@/helpers/ensureRequired'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nexport type ProfileDefaultValues = RequireAtLeastOne<{\n employee?: RequireAtLeastOne<{\n firstName?: string\n middleInitial?: string\n lastName?: string\n email?: string\n dateOfBirth?: string\n }>\n homeAddress?: RequireAtLeastOne<{\n street1?: string\n street2?: string\n city?: string\n state?: string\n zip?: string\n }>\n}>\ninterface ProfileProps extends CommonComponentInterface<'Employee.Profile'> {\n employeeId?: string\n companyId: string\n defaultValues?: ProfileDefaultValues\n isAdmin?: boolean\n isSelfOnboardingEnabled?: boolean\n}\n\ninterface ProfileConditionalProps {\n employee?: Employee\n homeAddresses?: EmployeeAddress[]\n workAddresses?: EmployeeWorkAddress[]\n}\n\nexport function Profile(props: ProfileProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n {props.employeeId ? (\n <RootWithEmployee {...props} employeeId={props.employeeId}>\n {props.children}\n </RootWithEmployee>\n ) : (\n <Root {...props}>{props.children}</Root>\n )}\n </BaseComponent>\n )\n}\n\n/**Accounting for conditional logic where employee data needs to be fetched only if employeeId is present */\nfunction RootWithEmployee({ employeeId, ...props }: WithRequired<ProfileProps, 'employeeId'>) {\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n const {\n data: { employeeAddressList },\n } = useEmployeeAddressesGetSuspense({ employeeId })\n const {\n data: { employeeWorkAddressesList },\n } = useEmployeeAddressesGetWorkAddressesSuspense({ employeeId })\n return (\n <Root\n {...props}\n employee={employee}\n homeAddresses={employeeAddressList}\n workAddresses={employeeWorkAddressesList}\n />\n )\n}\n\nconst Root = ({\n isAdmin = false,\n isSelfOnboardingEnabled = true,\n dictionary,\n ...props\n}: ProfileProps & ProfileConditionalProps) => {\n useI18n('Employee.Profile')\n useI18n('Employee.HomeAddress')\n useComponentDictionary('Employee.Profile', dictionary)\n const {\n companyId,\n employee,\n homeAddresses,\n workAddresses,\n children,\n className = '',\n defaultValues,\n } = props\n const { onEvent, baseSubmitHandler } = useBase()\n\n const [AdminSchema, setAdminSchema] = useState<\n typeof AdminPersonalDetailsSchema | typeof AdminSelfOnboardingPersonalDetailsSchema\n >(AdminPersonalDetailsSchema)\n\n const { data } = useLocationsGetSuspense({ companyId })\n const companyLocations = data.locationList!\n\n const { mutateAsync: createEmployee, isPending: isPendingCreateEmployee } =\n useEmployeesCreateMutation()\n const { mutateAsync: mutateEmployee, isPending: isPendingEmployeeUpdate } =\n useEmployeesUpdateMutation()\n\n const { mutateAsync: createEmployeeWorkAddress, isPending: isPendingCreateWA } =\n useEmployeeAddressesCreateWorkAddressMutation()\n const { mutateAsync: mutateEmployeeWorkAddress, isPending: isPendingWorkAddressUpdate } =\n useEmployeeAddressesUpdateWorkAddressMutation()\n\n const { mutateAsync: createEmployeeHomeAddress, isPending: isPendingAddHA } =\n useEmployeeAddressesCreateMutation()\n const { mutateAsync: mutateEmployeeHomeAddress, isPending: isPendingUpdateHA } =\n useEmployeeAddressesUpdateMutation()\n\n const {\n mutateAsync: updateEmployeeOnboardingStatus,\n isPending: isPendingUpdateOnboardingStatus,\n } = useEmployeesUpdateOnboardingStatusMutation()\n\n const existingData = { employee, workAddresses, homeAddresses }\n\n const currentHomeAddress = getEmployeeAddressForProfile(homeAddresses)\n\n const currentWorkAddress = existingData.workAddresses?.find(address => address.active)\n const mergedData = useRef({\n employee: existingData.employee,\n homeAddress: currentHomeAddress,\n workAddress: currentWorkAddress,\n })\n const initialValues = {\n firstName: mergedData.current.employee?.firstName ?? defaultValues?.employee?.firstName ?? '',\n middleInitial:\n mergedData.current.employee?.middleInitial ?? defaultValues?.employee?.middleInitial ?? '',\n lastName: mergedData.current.employee?.lastName ?? defaultValues?.employee?.lastName ?? '',\n workAddress: mergedData.current.workAddress?.locationUuid,\n startDate: mergedData.current.employee?.jobs?.[0]?.hireDate\n ? new Date(mergedData.current.employee.jobs[0].hireDate)\n : null, // By default employee response contains only current job - therefore jobs[0]\n email: mergedData.current.employee?.email ?? defaultValues?.employee?.email ?? '',\n dateOfBirth: mergedData.current.employee?.dateOfBirth\n ? new Date(mergedData.current.employee.dateOfBirth)\n : defaultValues?.employee?.dateOfBirth\n ? new Date(defaultValues.employee.dateOfBirth)\n : null,\n\n street1: mergedData.current.homeAddress?.street1 ?? defaultValues?.homeAddress?.street1 ?? '',\n street2: mergedData.current.homeAddress?.street2 ?? defaultValues?.homeAddress?.street2 ?? '',\n city: mergedData.current.homeAddress?.city ?? defaultValues?.homeAddress?.city ?? '',\n zip: mergedData.current.homeAddress?.zip ?? defaultValues?.homeAddress?.zip ?? '',\n state: mergedData.current.homeAddress?.state ?? defaultValues?.homeAddress?.state ?? '',\n courtesyWithholding: mergedData.current.homeAddress?.courtesyWithholding ?? false,\n }\n\n const adminDefaultValues =\n mergedData.current.employee?.onboarded ||\n mergedData.current.employee?.onboardingStatus ===\n EmployeeOnboardingStatus.ONBOARDING_COMPLETED ||\n (mergedData.current.employee?.onboardingStatus !== undefined &&\n mergedData.current.employee.onboardingStatus !==\n EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE)\n ? { ...initialValues, enableSsn: false, selfOnboarding: true }\n : {\n ...initialValues,\n selfOnboarding: isSelfOnboardingEnabled\n ? mergedData.current.employee?.onboardingStatus\n ? // @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses\n EmployeeSelfOnboardingStatuses.has(mergedData.current.employee.onboarding_status)\n : false\n : false,\n enableSsn: !mergedData.current.employee?.hasSsn,\n ssn: '',\n } // In edit mode ssn is submitted only if it has been modified\n\n const selfDetaultValues = {\n ...initialValues,\n enableSsn: !mergedData.current.employee?.hasSsn,\n ssn: '',\n }\n\n const formMethods = useForm<\n PersonalDetailsInputs & HomeAddressInputs,\n unknown,\n PersonalDetailsPayload & HomeAddressInputs\n >({\n resolver: zodResolver(\n (isAdmin ? AdminSchema : SelfPersonalDetailsSchema).and(HomeAddressSchema),\n ),\n defaultValues: isAdmin ? adminDefaultValues : selfDetaultValues,\n })\n\n const { handleSubmit } = formMethods\n const watchedSelfOnboarding = useWatch({ control: formMethods.control, name: 'selfOnboarding' })\n\n useEffect(() => {\n if (isAdmin) {\n if (watchedSelfOnboarding) {\n setAdminSchema(AdminSelfOnboardingPersonalDetailsSchema)\n } else {\n setAdminSchema(AdminPersonalDetailsSchema)\n }\n }\n }, [watchedSelfOnboarding, isAdmin])\n\n const onSubmit: SubmitHandler<PersonalDetailsPayload & HomeAddressInputs> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { workAddress, startDate, selfOnboarding, ...body } = payload\n //create or update employee\n if (!mergedData.current.employee) {\n const { employee: employeeData } = await createEmployee({\n request: {\n companyId,\n requestBody: {\n ...body,\n selfOnboarding,\n dateOfBirth: body.dateOfBirth ? new RFCDate(body.dateOfBirth) : undefined,\n },\n },\n })\n mergedData.current = { ...mergedData.current, employee: employeeData }\n onEvent(componentEvents.EMPLOYEE_CREATED, employeeData)\n } else {\n // Updating self-onboarding status\n if (\n (selfOnboarding &&\n mergedData.current.employee.onboardingStatus ===\n EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE) ||\n (!selfOnboarding &&\n mergedData.current.employee.onboardingStatus ===\n EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE)\n ) {\n const { employeeOnboardingStatus } = await updateEmployeeOnboardingStatus({\n request: {\n employeeId: mergedData.current.employee.uuid,\n requestBody: {\n onboardingStatus: selfOnboarding\n ? EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE\n : EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE,\n },\n },\n })\n mergedData.current.employee = {\n ...mergedData.current.employee,\n onboardingStatus: employeeOnboardingStatus!\n .onboardingStatus as (typeof EmployeeOnboardingStatus)[keyof typeof EmployeeOnboardingStatus],\n }\n onEvent(componentEvents.EMPLOYEE_ONBOARDING_STATUS_UPDATED, employeeOnboardingStatus)\n }\n const { employee: employeeData } = await mutateEmployee({\n request: {\n employeeId: mergedData.current.employee.uuid,\n requestBody: { ...body, version: mergedData.current.employee.version as string },\n },\n })\n mergedData.current = { ...mergedData.current, employee: employeeData }\n onEvent(componentEvents.EMPLOYEE_UPDATED, employeeData)\n }\n if (typeof mergedData.current.employee?.uuid !== 'string') {\n throw new Error('Employee id is not available')\n }\n //create or update home address - only if not intended for self onboarding\n if (!watchedSelfOnboarding || !isAdmin) {\n //typeguard: in this scenario payload will contain address information\n if (!payload.selfOnboarding) {\n const { street1, street2, city, state, zip, courtesyWithholding } = payload\n if (!mergedData.current.homeAddress) {\n // Creating home address - for new employee effective_date is the same as work start date\n const { employeeAddress } = await createEmployeeHomeAddress({\n request: {\n employeeId: mergedData.current.employee.uuid,\n requestBody: {\n street1,\n street2,\n city,\n state,\n zip,\n courtesyWithholding,\n },\n },\n })\n mergedData.current = { ...mergedData.current, homeAddress: employeeAddress }\n onEvent(componentEvents.EMPLOYEE_HOME_ADDRESS_CREATED, employeeAddress)\n } else {\n const { employeeAddress } = await mutateEmployeeHomeAddress({\n request: {\n homeAddressUuid: mergedData.current.homeAddress.uuid,\n requestBody: {\n version: mergedData.current.homeAddress.version,\n street1,\n street2,\n city,\n state,\n zip,\n courtesyWithholding,\n },\n },\n })\n mergedData.current = { ...mergedData.current, homeAddress: employeeAddress }\n onEvent(componentEvents.EMPLOYEE_HOME_ADDRESS_UPDATED, employeeAddress)\n }\n }\n }\n\n if (isAdmin) {\n //create or update workaddress\n if (!mergedData.current.workAddress) {\n const { employeeWorkAddress } = await createEmployeeWorkAddress({\n request: {\n employeeId: mergedData.current.employee?.uuid as string,\n requestBody: {\n locationUuid: workAddress,\n effectiveDate: new RFCDate(payload.startDate || new Date()),\n },\n },\n })\n\n mergedData.current = { ...mergedData.current, workAddress: employeeWorkAddress }\n onEvent(componentEvents.EMPLOYEE_WORK_ADDRESS_CREATED, employeeWorkAddress)\n } else {\n //effective_date is excluded from update operation since it cannot be changed on initial work address\n const { employeeWorkAddress } = await mutateEmployeeWorkAddress({\n request: {\n workAddressUuid: mergedData.current.workAddress.uuid,\n requestBody: {\n version: mergedData.current.workAddress.version,\n locationUuid: workAddress,\n },\n },\n })\n mergedData.current = { ...mergedData.current, workAddress: employeeWorkAddress }\n onEvent(componentEvents.EMPLOYEE_WORK_ADDRESS_UPDATED, employeeWorkAddress)\n }\n }\n\n onEvent(componentEvents.EMPLOYEE_PROFILE_DONE, {\n ...mergedData.current.employee,\n startDate,\n })\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n return (\n <section className={className}>\n <ProfileProvider\n value={{\n companyLocations,\n workAddresses,\n employee: mergedData.current.employee ?? undefined,\n isSelfOnboardingIntended: watchedSelfOnboarding,\n handleCancel,\n isAdmin,\n isSelfOnboardingEnabled,\n isPending:\n isPendingEmployeeUpdate ||\n isPendingWorkAddressUpdate ||\n isPendingAddHA ||\n isPendingUpdateHA ||\n isPendingCreateEmployee ||\n isPendingCreateWA ||\n isPendingUpdateOnboardingStatus,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <Head />\n <AdminPersonalDetails />\n <SelfPersonalDetails />\n <HomeAddress />\n <WorkAddress />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </ProfileProvider>\n </section>\n )\n}\n\nProfile.Head = Head\nProfile.Actions = Actions\nProfile.AdminPersonalDetails = AdminPersonalDetails\nProfile.SelfPersonalDetails = SelfPersonalDetails\nProfile.HomeAddress = HomeAddress\nProfile.WorkAddress = WorkAddress\n\nexport const ProfileContextual = () => {\n const { companyId, employeeId, onEvent, isAdmin, defaultValues, isSelfOnboardingEnabled } =\n useFlow<OnboardingContextInterface>()\n\n return (\n <Profile\n companyId={ensureRequired(companyId)}\n employeeId={employeeId}\n onEvent={onEvent}\n isAdmin={isAdmin}\n defaultValues={defaultValues?.profile}\n isSelfOnboardingEnabled={isSelfOnboardingEnabled}\n />\n )\n}\n"],"names":["Profile","props","jsx","BaseComponent","RootWithEmployee","Root","employeeId","employee","useEmployeesGetSuspense","employeeAddressList","useEmployeeAddressesGetSuspense","employeeWorkAddressesList","useEmployeeAddressesGetWorkAddressesSuspense","isAdmin","isSelfOnboardingEnabled","dictionary","useI18n","useComponentDictionary","companyId","homeAddresses","workAddresses","children","className","defaultValues","onEvent","baseSubmitHandler","useBase","AdminSchema","setAdminSchema","useState","AdminPersonalDetailsSchema","data","useLocationsGetSuspense","companyLocations","createEmployee","isPendingCreateEmployee","useEmployeesCreateMutation","mutateEmployee","isPendingEmployeeUpdate","useEmployeesUpdateMutation","createEmployeeWorkAddress","isPendingCreateWA","useEmployeeAddressesCreateWorkAddressMutation","mutateEmployeeWorkAddress","isPendingWorkAddressUpdate","useEmployeeAddressesUpdateWorkAddressMutation","createEmployeeHomeAddress","isPendingAddHA","useEmployeeAddressesCreateMutation","mutateEmployeeHomeAddress","isPendingUpdateHA","useEmployeeAddressesUpdateMutation","updateEmployeeOnboardingStatus","isPendingUpdateOnboardingStatus","useEmployeesUpdateOnboardingStatusMutation","existingData","currentHomeAddress","getEmployeeAddressForProfile","currentWorkAddress","address","mergedData","useRef","initialValues","adminDefaultValues","EmployeeOnboardingStatus","EmployeeSelfOnboardingStatuses","selfDetaultValues","formMethods","useForm","zodResolver","SelfPersonalDetailsSchema","HomeAddressSchema","handleSubmit","watchedSelfOnboarding","useWatch","useEffect","AdminSelfOnboardingPersonalDetailsSchema","onSubmit","payload","workAddress","startDate","selfOnboarding","body","employeeOnboardingStatus","componentEvents","employeeData","RFCDate","street1","street2","city","state","zip","courtesyWithholding","employeeAddress","employeeWorkAddress","handleCancel","ProfileProvider","FormProvider","Form","jsxs","Fragment","Head","AdminPersonalDetails","SelfPersonalDetails","HomeAddress","WorkAddress","Actions","ProfileContextual","useFlow","ensureRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFO,SAASA,EAAQC,GAA8C;AAElE,SAAA,gBAAAC,EAACC,MAAe,GAAGF,GAChB,YAAM,aACL,gBAAAC,EAACE,IAAkB,EAAA,GAAGH,GAAO,YAAYA,EAAM,YAC5C,UAAAA,EAAM,SACT,CAAA,IAEA,gBAAAC,EAACG,KAAM,GAAGJ,GAAQ,UAAMA,EAAA,SAAA,CAAS,EAErC,CAAA;AAEJ;AAGA,SAASG,GAAiB,EAAE,YAAAE,GAAY,GAAGL,KAAmD;AACtF,QAAA;AAAA,IACJ,MAAM,EAAE,UAAAM,EAAS;AAAA,EAAA,IACfC,GAAwB,EAAE,YAAAF,GAAY,GACpC;AAAA,IACJ,MAAM,EAAE,qBAAAG,EAAoB;AAAA,EAAA,IAC1BC,GAAgC,EAAE,YAAAJ,GAAY,GAC5C;AAAA,IACJ,MAAM,EAAE,2BAAAK,EAA0B;AAAA,EAAA,IAChCC,GAA6C,EAAE,YAAAN,GAAY;AAE7D,SAAA,gBAAAJ;AAAA,IAACG;AAAA,IAAA;AAAA,MACE,GAAGJ;AAAA,MACJ,UAAAM;AAAA,MACA,eAAeE;AAAA,MACf,eAAeE;AAAA,IAAA;AAAA,EACjB;AAEJ;AAEA,MAAMN,IAAO,CAAC;AAAA,EACZ,SAAAQ,IAAU;AAAA,EACV,yBAAAC,IAA0B;AAAA,EAC1B,YAAAC;AAAA,EACA,GAAGd;AACL,MAA8C;AAC5C,EAAAe,EAAQ,kBAAkB,GAC1BA,EAAQ,sBAAsB,GAC9BC,GAAuB,oBAAoBF,CAAU;AAC/C,QAAA;AAAA,IACJ,WAAAG;AAAA,IACA,UAAAX;AAAA,IACA,eAAAY;AAAA,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AT,MAC9D8F,GAAoC;AAGpC,SAAA,gBAAA1G;AAAA,IAACF;AAAA,IAAA;AAAA,MACC,WAAW6G,GAAe3F,CAAS;AAAA,MACnC,YAAAZ;AAAA,MACA,SAAAkB;AAAA,MACA,SAAAX;AAAA,MACA,eAAeU,GAAe;AAAA,MAC9B,yBAAAT;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -5,14 +5,15 @@ import "react-i18next";
5
5
  import "@gusto/embedded-api/models/errors/apierror";
6
6
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
7
7
  import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
8
+ import "@tanstack/react-query";
8
9
  import "../../Base/useBase.js";
9
10
  import "../../../shared/constants.js";
10
11
  import "dompurify";
11
12
  import "../../../contexts/ComponentAdapter/useComponentContext.js";
12
13
  import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
13
- const [c, d] = o("ProfileContext");
14
+ const [d, s] = o("ProfileContext");
14
15
  export {
15
- d as ProfileProvider,
16
- c as useProfile
16
+ s as ProfileProvider,
17
+ d as useProfile
17
18
  };
18
19
  //# sourceMappingURL=useProfile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useProfile.js","sources":["../../../../src/components/Employee/Profile/useProfile.ts"],"sourcesContent":["import type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { createCompoundContext } from '@/components/Base'\n\n//Interface for context passed down to component slots\ntype ProfileContextType = {\n companyLocations: Location[]\n workAddresses?: EmployeeWorkAddress[]\n employee?: Employee\n isSelfOnboardingIntended?: boolean\n isPending: boolean\n isAdmin: boolean\n handleCancel: () => void\n isSelfOnboardingEnabled: boolean\n}\n\nconst [useProfile, ProfileProvider] = createCompoundContext<ProfileContextType>('ProfileContext')\nexport { useProfile, ProfileProvider }\n"],"names":["useProfile","ProfileProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;AAiBA,MAAM,CAACA,GAAYC,CAAe,IAAIC,EAA0C,gBAAgB;"}
1
+ {"version":3,"file":"useProfile.js","sources":["../../../../src/components/Employee/Profile/useProfile.ts"],"sourcesContent":["import type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { createCompoundContext } from '@/components/Base'\n\n//Interface for context passed down to component slots\ntype ProfileContextType = {\n companyLocations: Location[]\n workAddresses?: EmployeeWorkAddress[]\n employee?: Employee\n isSelfOnboardingIntended?: boolean\n isPending: boolean\n isAdmin: boolean\n handleCancel: () => void\n isSelfOnboardingEnabled: boolean\n}\n\nconst [useProfile, ProfileProvider] = createCompoundContext<ProfileContextType>('ProfileContext')\nexport { useProfile, ProfileProvider }\n"],"names":["useProfile","ProfileProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;AAiBA,MAAM,CAACA,GAAYC,CAAe,IAAIC,EAA0C,gBAAgB;"}