@remoteoss/remote-flows 0.3.0 → 0.4.0-alpha.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 (178) hide show
  1. package/dist/chunk-2PXGLWCY.js +2 -0
  2. package/dist/chunk-2PXGLWCY.js.map +1 -0
  3. package/dist/{chunk-G4R7TPQL.js → chunk-6TYJC6YS.js} +2 -2
  4. package/dist/{chunk-THCM2G6C.js → chunk-ABR3B66K.js} +2 -2
  5. package/dist/chunk-ALRU77S5.js +2 -0
  6. package/dist/chunk-ALRU77S5.js.map +1 -0
  7. package/dist/chunk-CFRYIKSR.js +2 -0
  8. package/dist/chunk-CFRYIKSR.js.map +1 -0
  9. package/dist/{chunk-KQEIZSUS.js → chunk-CKEVRQRG.js} +2 -2
  10. package/dist/{chunk-VZM3HYXN.js → chunk-D3SD6MMV.js} +2 -2
  11. package/dist/{chunk-4APN5ST6.js → chunk-DE5FSFYL.js} +2 -2
  12. package/dist/chunk-DHRIURRT.js +2 -0
  13. package/dist/{chunk-AG27JG4N.js.map → chunk-DHRIURRT.js.map} +1 -1
  14. package/dist/{chunk-WDV5ZDXL.js → chunk-DZSZOC2G.js} +2 -2
  15. package/dist/chunk-ED3CBUQL.js +2 -0
  16. package/dist/chunk-ED3CBUQL.js.map +1 -0
  17. package/dist/chunk-GFBF55NR.js +2 -0
  18. package/dist/chunk-GFBF55NR.js.map +1 -0
  19. package/dist/{chunk-4C45VY6F.js → chunk-GGAS4ZNQ.js} +2 -2
  20. package/dist/chunk-GOLOL2V6.js +2 -0
  21. package/dist/chunk-GOLOL2V6.js.map +1 -0
  22. package/dist/{chunk-P3N4X5KU.js → chunk-GRYAM4FZ.js} +2 -2
  23. package/dist/chunk-GULCZWSK.js +1 -0
  24. package/dist/chunk-GULCZWSK.js.map +1 -0
  25. package/dist/{chunk-U3TYUMTJ.js → chunk-HEPL5WDF.js} +2 -2
  26. package/dist/chunk-HSW5HMHH.js +2 -0
  27. package/dist/{chunk-LLA3Z2PK.js → chunk-JBG4RVXQ.js} +2 -2
  28. package/dist/{chunk-GGZV4QYL.js → chunk-KQH5HLN5.js} +2 -2
  29. package/dist/chunk-LNKYOAKF.js +2 -0
  30. package/dist/chunk-LNKYOAKF.js.map +1 -0
  31. package/dist/chunk-M7WCW7WD.js +2 -0
  32. package/dist/chunk-M7WCW7WD.js.map +1 -0
  33. package/dist/chunk-MHKNAQLP.js +2 -0
  34. package/dist/chunk-MHKNAQLP.js.map +1 -0
  35. package/dist/chunk-MIHU6CEZ.js +2 -0
  36. package/dist/chunk-MIHU6CEZ.js.map +1 -0
  37. package/dist/chunk-NE547PW4.js +2 -0
  38. package/dist/chunk-NE547PW4.js.map +1 -0
  39. package/dist/{chunk-BDCIVWHR.js → chunk-PNXZHV6W.js} +2 -2
  40. package/dist/chunk-PWKM2R6V.js +2 -0
  41. package/dist/chunk-PWKM2R6V.js.map +1 -0
  42. package/dist/{chunk-L3E32MJU.js → chunk-Q64URAIN.js} +2 -2
  43. package/dist/{chunk-WJPC4J3U.js → chunk-QOMUXX6W.js} +2 -2
  44. package/dist/chunk-QSHYMFMY.js +2 -0
  45. package/dist/chunk-QSHYMFMY.js.map +1 -0
  46. package/dist/chunk-S4FKLPBB.js +2 -0
  47. package/dist/chunk-S4FKLPBB.js.map +1 -0
  48. package/dist/{chunk-QJGFU4YO.js → chunk-SLD7DFLW.js} +2 -2
  49. package/dist/{chunk-RCX4JUI3.js → chunk-UECSVYQ5.js} +2 -2
  50. package/dist/chunk-VRQXHCFR.js +2 -0
  51. package/dist/chunk-VRQXHCFR.js.map +1 -0
  52. package/dist/chunk-WS3C3WIJ.js +2 -0
  53. package/dist/chunk-WS3C3WIJ.js.map +1 -0
  54. package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.d.ts +1 -1
  55. package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.js +1 -1
  56. package/dist/flows/ContractAmendment/ContractAmendmentFlow.d.ts +3 -1
  57. package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
  58. package/dist/flows/ContractAmendment/ContractAmendmentForm.d.ts +1 -1
  59. package/dist/flows/ContractAmendment/ContractAmendmentForm.js +1 -1
  60. package/dist/flows/ContractAmendment/context.d.ts +3 -1
  61. package/dist/flows/ContractAmendment/hooks.d.ts +3 -1
  62. package/dist/flows/ContractAmendment/hooks.js +1 -1
  63. package/dist/flows/ContractAmendment/index.d.ts +4 -2
  64. package/dist/flows/ContractAmendment/index.js +1 -1
  65. package/dist/flows/ContractAmendment/types.d.ts +6 -8
  66. package/dist/flows/ContractAmendment/utils.d.ts +1 -1
  67. package/dist/flows/ContractAmendment/utils.js +1 -1
  68. package/dist/flows/CostCalculator/CostCalculatorFlow.d.ts +1 -1
  69. package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
  70. package/dist/flows/CostCalculator/CostCalculatorForm.d.ts +1 -1
  71. package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
  72. package/dist/flows/CostCalculator/Results/CostCalculatorResults.d.ts +1 -1
  73. package/dist/flows/CostCalculator/Results/CostCalculatorResults.js +1 -1
  74. package/dist/flows/CostCalculator/context.d.ts +1 -1
  75. package/dist/flows/CostCalculator/hooks.d.ts +1 -1
  76. package/dist/flows/CostCalculator/hooks.js +1 -1
  77. package/dist/flows/CostCalculator/index.d.ts +1 -1
  78. package/dist/flows/CostCalculator/index.js +1 -1
  79. package/dist/flows/CostCalculator/types.d.ts +1 -1
  80. package/dist/flows/CostCalculator/utils.d.ts +1 -1
  81. package/dist/flows/CostCalculator/utils.js +1 -1
  82. package/dist/flows/Onboarding/BasicInformationStep.d.ts +15 -0
  83. package/dist/flows/Onboarding/BasicInformationStep.js +2 -0
  84. package/dist/flows/Onboarding/BasicInformationStep.js.map +1 -0
  85. package/dist/flows/Onboarding/BenefitsStep.d.ts +37 -0
  86. package/dist/flows/Onboarding/BenefitsStep.js +2 -0
  87. package/dist/flows/Onboarding/BenefitsStep.js.map +1 -0
  88. package/dist/flows/Onboarding/ContractDetailsStep.d.ts +15 -0
  89. package/dist/flows/Onboarding/ContractDetailsStep.js +2 -0
  90. package/dist/flows/Onboarding/ContractDetailsStep.js.map +1 -0
  91. package/dist/flows/Onboarding/OnboardingBack.d.ts +5 -0
  92. package/dist/flows/Onboarding/OnboardingBack.js +2 -0
  93. package/dist/flows/Onboarding/OnboardingBack.js.map +1 -0
  94. package/dist/flows/Onboarding/OnboardingFlow.d.ts +52 -0
  95. package/dist/flows/Onboarding/OnboardingFlow.js +2 -0
  96. package/dist/flows/Onboarding/OnboardingFlow.js.map +1 -0
  97. package/dist/flows/Onboarding/OnboardingForm.d.ts +19 -0
  98. package/dist/flows/Onboarding/OnboardingForm.js +2 -0
  99. package/dist/flows/Onboarding/OnboardingForm.js.map +1 -0
  100. package/dist/flows/Onboarding/OnboardingInvite.d.ts +11 -0
  101. package/dist/flows/Onboarding/OnboardingInvite.js +2 -0
  102. package/dist/flows/Onboarding/OnboardingInvite.js.map +1 -0
  103. package/dist/flows/Onboarding/OnboardingSubmit.d.ts +5 -0
  104. package/dist/flows/Onboarding/OnboardingSubmit.js +2 -0
  105. package/dist/flows/Onboarding/OnboardingSubmit.js.map +1 -0
  106. package/dist/flows/Onboarding/context.d.ts +78 -0
  107. package/dist/flows/Onboarding/context.js +2 -0
  108. package/dist/flows/Onboarding/context.js.map +1 -0
  109. package/dist/flows/Onboarding/hooks.d.ts +133 -0
  110. package/dist/flows/Onboarding/hooks.js +2 -0
  111. package/dist/flows/Onboarding/hooks.js.map +1 -0
  112. package/dist/flows/Onboarding/index.d.ts +20 -0
  113. package/dist/flows/Onboarding/index.js +2 -0
  114. package/dist/flows/Onboarding/index.js.map +1 -0
  115. package/dist/flows/Onboarding/types.d.ts +36 -0
  116. package/dist/flows/Onboarding/types.js +1 -0
  117. package/dist/flows/Onboarding/types.js.map +1 -0
  118. package/dist/flows/Onboarding/utils.d.ts +8 -0
  119. package/dist/flows/Onboarding/utils.js +2 -0
  120. package/dist/flows/Onboarding/utils.js.map +1 -0
  121. package/dist/flows/Termination/AdditionalDetailsForm.d.ts +1 -1
  122. package/dist/flows/Termination/AdditionalDetailsForm.js +1 -1
  123. package/dist/flows/Termination/EmployeeComunicationForm.d.ts +1 -1
  124. package/dist/flows/Termination/EmployeeComunicationForm.js +1 -1
  125. package/dist/flows/Termination/PaidTimeOffForm.d.ts +1 -1
  126. package/dist/flows/Termination/PaidTimeOffForm.js +1 -1
  127. package/dist/flows/Termination/TerminationDetailsForm.d.ts +1 -1
  128. package/dist/flows/Termination/TerminationDetailsForm.js +1 -1
  129. package/dist/flows/Termination/TerminationFlow.d.ts +1 -1
  130. package/dist/flows/Termination/TerminationFlow.js +1 -1
  131. package/dist/flows/Termination/TerminationForm.d.ts +1 -1
  132. package/dist/flows/Termination/TerminationForm.js +1 -1
  133. package/dist/flows/Termination/TimeOff.d.ts +1 -1
  134. package/dist/flows/Termination/TimeOff.js +1 -1
  135. package/dist/flows/Termination/context.d.ts +1 -1
  136. package/dist/flows/Termination/hooks.d.ts +1 -1
  137. package/dist/flows/Termination/hooks.js +1 -1
  138. package/dist/flows/Termination/index.d.ts +1 -1
  139. package/dist/flows/Termination/index.js +1 -1
  140. package/dist/flows/Termination/json-schemas/schema.js +1 -1
  141. package/dist/flows/Termination/types.d.ts +1 -1
  142. package/dist/flows/types.d.ts +16 -1
  143. package/dist/flows/utils.d.ts +3 -0
  144. package/dist/index.css +1 -1
  145. package/dist/index.css.map +1 -1
  146. package/dist/index.d.ts +14 -115
  147. package/dist/index.js +1 -1
  148. package/dist/index.js.map +1 -1
  149. package/dist/remoteFlows-CswYencu.d.ts +116 -0
  150. package/dist/{types.gen-Dta9Iy5C.d.ts → types.gen-CsMdyQkb.d.ts} +169 -1
  151. package/package.json +3 -2
  152. package/dist/chunk-2Y22JKVE.js +0 -2
  153. package/dist/chunk-3MAYMGXF.js +0 -2
  154. package/dist/chunk-3MAYMGXF.js.map +0 -1
  155. package/dist/chunk-6YO6XWPH.js +0 -2
  156. package/dist/chunk-6YO6XWPH.js.map +0 -1
  157. package/dist/chunk-AG27JG4N.js +0 -2
  158. package/dist/chunk-VTPDBEHE.js +0 -2
  159. package/dist/chunk-VTPDBEHE.js.map +0 -1
  160. package/dist/chunk-YBACB5A6.js +0 -2
  161. package/dist/chunk-YBACB5A6.js.map +0 -1
  162. /package/dist/{chunk-G4R7TPQL.js.map → chunk-6TYJC6YS.js.map} +0 -0
  163. /package/dist/{chunk-THCM2G6C.js.map → chunk-ABR3B66K.js.map} +0 -0
  164. /package/dist/{chunk-KQEIZSUS.js.map → chunk-CKEVRQRG.js.map} +0 -0
  165. /package/dist/{chunk-VZM3HYXN.js.map → chunk-D3SD6MMV.js.map} +0 -0
  166. /package/dist/{chunk-4APN5ST6.js.map → chunk-DE5FSFYL.js.map} +0 -0
  167. /package/dist/{chunk-WDV5ZDXL.js.map → chunk-DZSZOC2G.js.map} +0 -0
  168. /package/dist/{chunk-4C45VY6F.js.map → chunk-GGAS4ZNQ.js.map} +0 -0
  169. /package/dist/{chunk-P3N4X5KU.js.map → chunk-GRYAM4FZ.js.map} +0 -0
  170. /package/dist/{chunk-U3TYUMTJ.js.map → chunk-HEPL5WDF.js.map} +0 -0
  171. /package/dist/{chunk-2Y22JKVE.js.map → chunk-HSW5HMHH.js.map} +0 -0
  172. /package/dist/{chunk-LLA3Z2PK.js.map → chunk-JBG4RVXQ.js.map} +0 -0
  173. /package/dist/{chunk-GGZV4QYL.js.map → chunk-KQH5HLN5.js.map} +0 -0
  174. /package/dist/{chunk-BDCIVWHR.js.map → chunk-PNXZHV6W.js.map} +0 -0
  175. /package/dist/{chunk-L3E32MJU.js.map → chunk-Q64URAIN.js.map} +0 -0
  176. /package/dist/{chunk-WJPC4J3U.js.map → chunk-QOMUXX6W.js.map} +0 -0
  177. /package/dist/{chunk-QJGFU4YO.js.map → chunk-SLD7DFLW.js.map} +0 -0
  178. /package/dist/{chunk-RCX4JUI3.js.map → chunk-UECSVYQ5.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/form/utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Field } from '@/src/flows/types';\nimport { $TSFixMe, Fields } from '@remoteoss/json-schema-form';\nimport get from 'lodash/get';\n\nconst textInputTypes = {\n TEXT: 'text',\n TEXTAREA: 'textarea',\n NUMBER: 'number',\n SELECT: 'select',\n COUNTRIES: 'countries',\n TEL: 'tel',\n EMAIL: 'email',\n MONEY: 'money',\n DATE: 'date',\n DATE_RANGE: 'date-range',\n CURRENCIES: 'currencies',\n TIME: 'time',\n} as const;\n\nconst checkboxTypes = {\n CHECKBOX: 'checkbox',\n ACK_CHECK: 'ack-check',\n} as const;\n\nconst supportedTypes = {\n FILE: 'file',\n RADIO: 'radio',\n /** @deprecated */\n RADIO_CARD: 'radio-card',\n GROUP_ARRAY: 'group-array',\n EXTRA: 'extra',\n STATEMENT: 'statement',\n HIDDEN: 'hidden',\n FIELDSET: 'fieldset',\n FIELDSET_FLAT: 'fieldset-flat',\n WORK_SCHEDULE: 'work-schedule',\n WORK_WEEK_SCHEDULE: 'work-week-schedule',\n /** @deprecated we still display benefits in read-only contract details view, but never in any form */\n BENEFITS: 'benefits',\n SIGNATURE: 'signature',\n SELECT_MULTIPLE: 'select-multiple',\n ...textInputTypes,\n ...checkboxTypes,\n} as const;\n\nfunction round(value: number): number {\n return Math.round((value + Number.EPSILON) * 100) / 100;\n}\n\nfunction convertToValidCost(value: string) {\n return parseFloat(value.replace(/,/g, ''));\n}\n\nexport function convertToCents(\n amount?: number | string | string[] | null | boolean,\n) {\n if (\n amount == null ||\n amount === '' ||\n Number.isNaN(amount) ||\n Array.isArray(amount) ||\n typeof amount === 'boolean'\n ) {\n return null;\n }\n\n let validAmount: number;\n\n if (typeof amount === 'string') {\n validAmount = convertToValidCost(amount);\n } else {\n validAmount = amount;\n }\n\n return round(validAmount * 100);\n}\n\nexport function convertFromCents(amount?: number | string | null) {\n if (amount == null || Number.isNaN(amount)) return null;\n\n let normalizedValue: number;\n\n if (typeof amount === 'string') {\n normalizedValue = convertToValidCost(amount || '0');\n } else {\n normalizedValue = amount;\n }\n\n return round(normalizedValue / 100);\n}\n\nconst trimStringValues = (values: Record<string, any>) =>\n Object.entries(values || {}).reduce<Record<string, any>>(\n (result, [key, value]) => {\n if (Array.isArray(value)) {\n // If the value is an array, recursively process each element\n result[key] = value.map((item) =>\n typeof item === 'object' && item !== null\n ? trimStringValues(item)\n : typeof item === 'string'\n ? item.trim()\n : item,\n );\n } else if (typeof value === 'object' && value !== null) {\n // If the value is an object, recursively process it\n result[key] = trimStringValues(value);\n } else {\n // Otherwise, trim the string or keep the value as is\n result[key] = typeof value === 'string' ? value.trim() : value;\n }\n return result;\n },\n {},\n );\n\nfunction convertEmptyStringsToNull(values: Record<string, any>) {\n const result: Record<string, any> = {};\n\n Object.entries(values).forEach(([key, value]) => {\n if (Array.isArray(value)) {\n // If the value is an array, recursively process each element\n result[key] = value.map((item) =>\n typeof item === 'object' && item !== null\n ? convertEmptyStringsToNull(item)\n : item === ''\n ? null\n : item,\n );\n } else if (typeof value === 'object' && value !== null) {\n // If the value is an object, recursively process it\n result[key] = convertEmptyStringsToNull(value);\n } else {\n // Otherwise, convert empty strings to null or keep the value as is\n result[key] = value === '' ? null : value;\n }\n });\n\n return result;\n}\n\n/**\n * Given a list of form values, modify the ones that are readOnly,\n * based on their field config, by adding its defaultValue.\n * This is needed to support readOnly fields that are also conditional\n * based on the \"pivotName\" workaround.\n * @param {Object} values - List with form values { name: value }.\n * @param {Array} fields - Respective form fields configuration.\n */\nfunction prefillReadOnlyFields(values: Record<string, any>, fields: any[]) {\n const newValues: Record<string, any> = {};\n\n fields.forEach((field) => {\n const fieldName = field.name;\n\n if (\n !Object.prototype.hasOwnProperty.call(values, fieldName!) &&\n !(field.type === supportedTypes.FIELDSET && field.valueGroupingDisabled)\n )\n return;\n\n if (field.type === supportedTypes.FIELDSET && field.valueGroupingDisabled) {\n Object.assign(newValues, prefillReadOnlyFields(values, field.fields));\n return;\n }\n\n if (field.readOnly && field.defaultValue) {\n newValues[fieldName!] = field.defaultValue;\n } else {\n newValues[fieldName!] = values[fieldName!];\n }\n });\n\n return newValues;\n}\n/**\n * Recursively extracts fieldsets' fields values and maps them to the field name\n * For nested fields that are fieldsets with valueGroupingDisabled, the values\n * are extracted one level up\n *\n * @param {Array} fields - Fieldset fields configuration.\n * @param {Object} formValues - List with form values { name: value }.\n * @return {Object} – Raw form values mapped to the field name\n */\nfunction extractFieldsetFieldsValues(\n fields: any[],\n formValues: Record<string, unknown>,\n) {\n return fields.reduce<Record<string, any>>((nestedAcc, subField) => {\n const isFieldsetValueGroupingDisabled =\n subField.type === supportedTypes.FIELDSET &&\n subField.valueGroupingDisabled;\n\n if (isFieldsetValueGroupingDisabled) {\n Object.assign(\n nestedAcc,\n extractFieldsetFieldsValues(subField.fields, formValues),\n );\n } else if (\n Object.prototype.hasOwnProperty.call(formValues, subField.name!)\n ) {\n nestedAcc[subField.name!] = formValues[subField.name!];\n }\n\n return nestedAcc;\n }, {});\n}\n\nexport const fieldTypesTransformations: Record<string, any> = {\n [supportedTypes.COUNTRIES]: {\n /**\n * @param {String[] | { name: String }[]} value\n * - Excepted: array of strings.\n * - Edge cases: array of objects. (when using dangerousTransformValue)\n * @returns {String[]} - List of countries\n * @example expected: ['Peru', 'Germany'] -> ['Peru', 'Germany']\n * @example edge cases: [{name: 'Peru'}, {name: 'Germany'}] -> ['Peru', 'Germany']\n */\n transformValueToAPI:\n (field: any) => (selectedCountries: string[] | { name: string }[]) => {\n if (!field.multiple || typeof selectedCountries === 'string') {\n return selectedCountries;\n }\n // NOTE: The value should be an array of strings, however legacy data can come as\n // an array of country objects. So, we always send an array of strings to normalize\n // the data (eg old form values being modified) until DB migration is done !5667\n return selectedCountries.map((option) =>\n typeof option === 'string' ? option : option.name,\n );\n },\n /**\n * Used for react-select, where the country selected is transformed\n * before saving on Formik state. Supports both solo and multi select\n * @param {Object|Object[]} selectedCountry[] - Current selected options\n * @param {String} selectedCountry[].value\n * @param {String} selectedCountry[].name\n * @param {String} selectedCountry[].label\n * @returns {String[]} - List of countries selected\n * @example\n * [{ value: 'Hungria' }] -> ['Hungria']\n */\n transformValue: (selectedCountry: any | any[]) => {\n // name or label are used in dragon. value is used in json-schema-form\n // TODO: it should be the same everywhere — read more at !5667\n const getCountryValue = (opt: any) =>\n opt?.name || opt?.value || opt?.label;\n return Array.isArray(selectedCountry)\n ? selectedCountry.map(getCountryValue) // support multi countries\n : getCountryValue(selectedCountry) || ''; // Fallback to '' in case user removes all countries\n },\n },\n [supportedTypes.NUMBER]: {\n transformValueToAPI: () => (value: string) => {\n // this prevents values with letters such as \"2r\" from being considered valid\n // if the input is invalid, number().cast will return NaN\n const castValue = Number(value);\n\n if (Number.isNaN(castValue)) {\n return value;\n }\n\n return castValue;\n },\n },\n [supportedTypes.MONEY]: {\n transformValueFromAPI: () => (value: string | number) =>\n convertFromCents(value) ?? '',\n transformValueToAPI: () => convertToCents,\n },\n [supportedTypes.RADIO]: {\n transformValueToAPI: (field: any) => (value: string) => {\n if (field.transformToBool) {\n return value === 'yes';\n }\n return value;\n },\n },\n [supportedTypes.CHECKBOX]: {\n transformValueToAPI: (field: any) => (value: string | boolean) => {\n if (value === undefined) {\n return false;\n }\n\n if (field.const && value === true) {\n return field.const;\n }\n return value;\n },\n },\n [supportedTypes.SELECT]: {\n /**\n * Used for react-select, where the value is transformed\n * before saving on Formik state.\n * @param {Object | Object[]} option - Object structure with options config\n * @param {String} option[].value - Key for the API\n * @param {Array} this.options[].label - Friendly label\n * @example\n * [{ value: '1', label: 'One' }, { value: '2', label: 'Two' }] -> [\"One\", \"Two\"]\n * { value: '1', label: 'One' } -> \"One\"\n * {} -> \"\"\n */\n transformValue: (option: any | any[]) =>\n Array.isArray(option)\n ? option.map((opt) => opt.value) // multi-options\n : (option?.value ?? ''), // Fallback to '' in case user removes all options,\n },\n};\n\nexport function parseFormValuesToAPI(\n formValues: Record<string, any> = {},\n fields: any[],\n) {\n const filteredFields = fields.filter(\n (field) =>\n formValues[field.name!] ||\n (field.type === supportedTypes.FIELDSET && field.valueGroupingDisabled),\n );\n\n const parsedFormValues = filteredFields.reduce(\n (acc, field) => {\n switch (field.type) {\n case supportedTypes.FIELDSET: {\n const fieldset = field;\n if (fieldset.valueGroupingDisabled) {\n const nestedFormValues = extractFieldsetFieldsValues(\n fieldset.fields,\n formValues,\n );\n\n Object.assign(\n acc,\n parseFormValuesToAPI(nestedFormValues, fieldset.fields),\n );\n } else {\n acc[field.name!] = parseFormValuesToAPI(\n formValues[field.name!],\n fieldset.fields,\n );\n }\n break;\n }\n\n case supportedTypes.TEXTAREA:\n case supportedTypes.TEXT: {\n // Attempt to remove null bytes from form values - https://gitlab.com/remote-com/employ-starbase/tracker/-/issues/10670\n acc[field.name] = formValues[field.name].replace(/\\0/g, '');\n break;\n }\n\n case supportedTypes.GROUP_ARRAY: {\n // NOTE: The field `name` in group arrays represents a path, but we only\n // need the last part of it which is represented by `nameKey`.\n\n const transformedFields = field?.fields?.().map((subField: any) => ({\n ...subField,\n name: subField.nameKey || '',\n }));\n\n // Null check necessary for case where no fields are set due to optional check\n const parsedFieldValues = formValues[field.name]?.map(\n (fieldValues: Record<string, any>) =>\n parseFormValuesToAPI(fieldValues, transformedFields),\n );\n\n acc[field.name] = parsedFieldValues;\n break;\n }\n case supportedTypes.EXTRA: {\n const extraField = field;\n if (extraField.includeValueToApi !== false) {\n const formValue = formValues[extraField.name];\n const fieldTransformValueToAPI =\n extraField?.transformValueToAPI ||\n fieldTypesTransformations[extraField.type]?.transformValueToAPI;\n\n // logErrorOnMissingComplimentaryParams(field);\n\n if (fieldTransformValueToAPI) {\n acc[extraField.name] = fieldTransformValueToAPI(field)(formValue);\n break;\n }\n\n acc[extraField.name] = formValue;\n break;\n }\n acc[extraField.name] = undefined;\n break;\n }\n default: {\n const formValue = formValues[field.name];\n const fieldTransformValueToAPI =\n field?.transformValueToAPI ||\n fieldTypesTransformations[field.type]?.transformValueToAPI;\n // logErrorOnMissingComplimentaryParams(field);\n if (fieldTransformValueToAPI) {\n acc[field.name] = fieldTransformValueToAPI(field)(formValue);\n break;\n }\n acc[field.name] = formValue;\n break;\n }\n }\n\n // this occurs when const === default in a JSON Schema for a given field.\n // without this, values such as money types won't use the correct value.\n if (field.forcedValue !== undefined) {\n acc[field.name!] = field.forcedValue;\n }\n\n return acc;\n },\n { ...formValues },\n );\n\n return parsedFormValues;\n}\n\nfunction isFieldVisible(field: any, formValues: Record<string, unknown>) {\n if (field.visibilityCondition) {\n return field.visibilityCondition(formValues);\n }\n\n if (typeof field.isVisible !== 'undefined') {\n return Boolean(field.isVisible);\n }\n\n return true;\n}\n\nfunction applyFieldDynamicProperties(\n field: any,\n values: Record<string, unknown> | Record<string, unknown>[],\n) {\n if (field.calculateDynamicProperties) {\n return {\n ...field,\n ...(field.calculateDynamicProperties(values) || {}),\n };\n }\n\n return field;\n}\n\nfunction excludeValuesInvisible(\n values: any,\n fields: any[],\n keepTruthyInvisibleValues?: boolean,\n parentFieldKeyPath?: string,\n) {\n const valuesAsked: Record<string, any> = {};\n\n fields\n .map((field) => applyFieldDynamicProperties(field, values))\n .forEach((field) => {\n let fieldKeyPath = field.name;\n if (parentFieldKeyPath) {\n fieldKeyPath = fieldKeyPath\n ? `${parentFieldKeyPath}.${field.name}`\n : parentFieldKeyPath;\n }\n\n const valueOfField = get(values, fieldKeyPath!);\n\n // keepTruthyInvisibleValues: false/undefined -> remove invisible field\n // keepTruthyInvisibleValues: true -> keep invisible field if it has a value\n if (\n !isFieldVisible(field, values) &&\n !(keepTruthyInvisibleValues && !!valueOfField)\n ) {\n return;\n }\n\n if (field.meta?.ignoreValue) {\n return;\n }\n\n if (field.type === 'fieldset' && field.valueGroupingDisabled) {\n Object.assign(\n valuesAsked,\n excludeValuesInvisible(\n values,\n field.fields,\n keepTruthyInvisibleValues,\n fieldKeyPath,\n ),\n );\n } else if (Array.isArray(field.fields)) {\n valuesAsked[field.name!] = excludeValuesInvisible(\n values,\n field.fields,\n keepTruthyInvisibleValues,\n fieldKeyPath,\n );\n } else {\n if (valueOfField === undefined) {\n return;\n }\n valuesAsked[field.name!] = valueOfField;\n }\n });\n\n return valuesAsked;\n}\n\nexport function parseSubmitValues(\n formValues: Record<string, any>,\n fields: any[],\n config?: { keepInvisibleValues?: boolean },\n) {\n const visibleFormValues = config?.keepInvisibleValues\n ? formValues\n : excludeValuesInvisible(formValues, fields);\n const convertedFormValues = parseFormValuesToAPI(visibleFormValues, fields);\n const formValuesWithTrimmedStrings = trimStringValues(convertedFormValues);\n const formValuesWithUndefined = convertEmptyStringsToNull(\n formValuesWithTrimmedStrings,\n );\n const valuesWithReadOnly = prefillReadOnlyFields(\n formValuesWithUndefined,\n fields,\n );\n return valuesWithReadOnly;\n}\n\nexport function parseJSFToValidate(\n formValues: Record<string, any>,\n fields: Fields,\n config: { isPartialValidation: boolean } = {\n isPartialValidation: false,\n },\n) {\n const valuesParsed = parseSubmitValues(formValues, fields, {\n /* We cannot exclude invisible fields (excludeValuesInvisible) because\n they are needed for conditional fields validations */\n keepInvisibleValues: config?.isPartialValidation,\n });\n return valuesParsed;\n}\n\nfunction castFieldTo<T>(field: Field) {\n return field as unknown as T;\n}\n\nfunction getDefaultValueForType(type: string) {\n switch (type) {\n case supportedTypes.FILE:\n return undefined; // Allows fallback values in function declarations to be used\n default:\n return '';\n }\n}\n\nfunction getInitialDefaultValue(\n defaultValues: Record<string, any>,\n field: Field,\n) {\n // lodash get is needed because some values could be nested object, like billing address\n // use camelCase to support forms with fields in snake_case or kebab_case.\n const defaultFieldValue = get(defaultValues, field.name);\n const fieldTransformValueFromAPI =\n field?.transformValueFromAPI ||\n fieldTypesTransformations[field.type]?.transformValueFromAPI;\n\n if (fieldTransformValueFromAPI) {\n return fieldTransformValueFromAPI(field)(defaultFieldValue);\n }\n\n // TODO: We need to get rid of value as fn for json-schema. Related !5560\n const generatedValue =\n typeof field.value === 'function'\n ? field.value(defaultFieldValue, defaultValues)\n : null;\n\n // field.value is deprecated. should use \"default\" instead.\n const defaultValueDeprecated =\n typeof field.value !== 'function' ? field.value : null;\n const initialValueForCheckboxAsBool =\n castFieldTo<$TSFixMe>(field).checkboxValue === true\n ? defaultFieldValue || false\n : null;\n\n // nullish coalescing but excluding empty strings. (to support 0 (zero) as valid numbers)\n const excludeString = (val: any) => (val === '' ? undefined : val);\n\n return (\n excludeString(generatedValue) ??\n excludeString(defaultFieldValue) ??\n excludeString(defaultValueDeprecated) ??\n excludeString(field.default) ??\n initialValueForCheckboxAsBool ??\n getDefaultValueForType(field.type)\n );\n}\n\n/**\n * Get initial values for sub fields within fieldsets\n * @param {Object} field The form field\n * @param {Object} defaultValues The form default values\n * @param {String=} parentFieldKeyPath The path to the parent field using dot-notation\n * @returns {Object} The initial values for a fieldset\n */\nfunction getInitialSubFieldValues(\n field: $TSFixMe,\n defaultValues: Record<string, unknown>,\n parentFieldKeyPath?: string,\n) {\n const initialValue: Record<string, Record<string, unknown>> = {};\n\n let fieldKeyPath = field.name;\n\n if (parentFieldKeyPath) {\n fieldKeyPath = fieldKeyPath\n ? `${parentFieldKeyPath}.${fieldKeyPath}`\n : parentFieldKeyPath;\n }\n\n const subFields = field.fields;\n\n if (Array.isArray(subFields)) {\n const subFieldValues = {};\n\n subFields.forEach((subField) => {\n Object.assign(\n subFieldValues,\n getInitialSubFieldValues(subField, defaultValues, fieldKeyPath),\n );\n });\n\n if (field.type === supportedTypes.FIELDSET && field.valueGroupingDisabled) {\n Object.assign(initialValue, subFieldValues);\n } else {\n initialValue[field.name!] = subFieldValues;\n }\n } else {\n initialValue[field.name!] = getInitialDefaultValue(defaultValues, {\n ...field,\n // NOTE: To utilize the `get` function from `lodash` in `getInitialDefaultValue` correctly\n // we need to use the field path instead of just its name.\n name: fieldKeyPath,\n });\n }\n\n return initialValue;\n}\n\nexport function getInitialValues(\n fields: Fields,\n defaultValues: Record<string, unknown>,\n) {\n const initialValues: Record<string, unknown> = {};\n const defaultFieldValues = defaultValues;\n\n // loop over fields array\n // if prop does not exit in the initialValues object,\n // pluck off the name and value props and add it to the initialValues object;\n fields\n .map((field) => applyFieldDynamicProperties(field, defaultFieldValues))\n .forEach((field) => {\n switch (field.type) {\n case supportedTypes.FIELDSET: {\n if (field.valueGroupingDisabled) {\n Object.assign(\n initialValues,\n getInitialValues(field.fields, defaultFieldValues),\n );\n } else {\n const subFieldValues = getInitialSubFieldValues(\n field,\n defaultFieldValues,\n );\n Object.assign(initialValues, subFieldValues);\n }\n break;\n }\n default: {\n if (!initialValues[field.name]) {\n initialValues[field.name] = getInitialDefaultValue(\n defaultFieldValues,\n field,\n );\n }\n break;\n }\n }\n });\n\n return initialValues;\n}\n"],"mappings":"wCAGA,OAAOA,MAAS,aAEhB,IAAMC,EAAiB,CACrB,KAAM,OACN,SAAU,WACV,OAAQ,SACR,OAAQ,SACR,UAAW,YACX,IAAK,MACL,MAAO,QACP,MAAO,QACP,KAAM,OACN,WAAY,aACZ,WAAY,aACZ,KAAM,MACR,EAEMC,EAAgB,CACpB,SAAU,WACV,UAAW,WACb,EAEMC,EAAiB,CACrB,KAAM,OACN,MAAO,QAEP,WAAY,aACZ,YAAa,cACb,MAAO,QACP,UAAW,YACX,OAAQ,SACR,SAAU,WACV,cAAe,gBACf,cAAe,gBACf,mBAAoB,qBAEpB,SAAU,WACV,UAAW,YACX,gBAAiB,kBACjB,GAAGF,EACH,GAAGC,CACL,EAEA,SAASE,EAAMC,EAAuB,CACpC,OAAO,KAAK,OAAOA,EAAQ,OAAO,SAAW,GAAG,EAAI,GACtD,CAFSC,EAAAF,EAAA,SAIT,SAASG,EAAmBF,EAAe,CACzC,OAAO,WAAWA,EAAM,QAAQ,KAAM,EAAE,CAAC,CAC3C,CAFSC,EAAAC,EAAA,sBAIF,SAASC,EACdC,EACA,CACA,GACEA,GAAU,MACVA,IAAW,IACX,OAAO,MAAMA,CAAM,GACnB,MAAM,QAAQA,CAAM,GACpB,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AASE,GAAa,CAC9B,OAAO,OACLD,EACAL,EAAyBM,EAAUjB,EAAec,CAAY,CAChE,CACF,CAAC,EAEGb,EAAM,OAASJ,EAAe,UAAYI,EAAM,sBAClD,OAAO,OAAOY,EAAcG,CAAc,EAE1CH,EAAaZ,EAAM,IAAK,EAAIe,CAEhC,MACEH,EAAaZ,EAAM,IAAK,EAAIF,EAAuBC,EAAe,CAChE,GAAGC,EAGH,KAAMa,CACR,CAAC,EAGH,OAAOD,CACT,CA1CSf,EAAAa,EAAA,4BA4CF,SAASO,EACdC,EACAnB,EACA,CACA,IAAMoB,EAAyC,CAAC,EAC1CC,EAAqBrB,EAK3B,OAAAmB,EACG,IAAKlB,GAAUqB,EAA4BrB,EAAOoB,CAAkB,CAAC,EACrE,QAASpB,GAAU,CAClB,OAAQA,EAAM,KAAM,CAClB,KAAKJ,EAAe,SAAU,CAC5B,GAAII,EAAM,sBACR,OAAO,OACLmB,EACAF,EAAiBjB,EAAM,OAAQoB,CAAkB,CACnD,MACK,CACL,IAAML,EAAiBL,EACrBV,EACAoB,CACF,EACA,OAAO,OAAOD,EAAeJ,CAAc,CAC7C,CACA,KACF,CACA,QAAS,CACFI,EAAcnB,EAAM,IAAI,IAC3BmB,EAAcnB,EAAM,IAAI,EAAIF,EAC1BsB,EACApB,CACF,GAEF,KACF,CACF,CACF,CAAC,EAEImB,CACT,CA1CgBtB,EAAAoB,EAAA","names":["get","textInputTypes","checkboxTypes","supportedTypes","round","value","__name","convertToValidCost","convertToCents","amount","validAmount","convertFromCents","normalizedValue","trimStringValues","values","result","key","item","convertEmptyStringsToNull","prefillReadOnlyFields","fields","newValues","field","fieldName","extractFieldsetFieldsValues","formValues","nestedAcc","subField","fieldTypesTransformations","selectedCountries","option","selectedCountry","getCountryValue","opt","castValue","parseFormValuesToAPI","acc","fieldset","nestedFormValues","transformedFields","parsedFieldValues","fieldValues","extraField","formValue","fieldTransformValueToAPI","isFieldVisible","applyFieldDynamicProperties","excludeValuesInvisible","keepTruthyInvisibleValues","parentFieldKeyPath","valuesAsked","fieldKeyPath","valueOfField","get","parseSubmitValues","config","visibleFormValues","convertedFormValues","formValuesWithTrimmedStrings","formValuesWithUndefined","parseJSFToValidate","getDefaultValueForType","type","supportedTypes","__name","getInitialDefaultValue","defaultValues","field","defaultFieldValue","get","fieldTransformValueFromAPI","fieldTypesTransformations","generatedValue","defaultValueDeprecated","initialValueForCheckboxAsBool","excludeString","val","getInitialSubFieldValues","parentFieldKeyPath","initialValue","fieldKeyPath","subFields","subFieldValues","subField","getInitialValues","fields","initialValues","defaultFieldValues","applyFieldDynamicProperties"]}
@@ -0,0 +1,2 @@
1
+ import{a as o}from"./chunk-AYDF3IFZ.js";import{createContext as r,useContext as t}from"react";var e=r({formId:void 0,onboardingBag:null}),i=o(()=>{let n=t(e);if(!n.formId||!n.onboardingBag)throw new Error("useOnboardingContext must be used within a OnboardingContextProvider");return{formId:n.formId,onboardingBag:n.onboardingBag}},"useOnboardingContext");export{e as a,i as b};
2
+ //# sourceMappingURL=chunk-WS3C3WIJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flows/Onboarding/context.ts"],"sourcesContent":["import type { useOnboarding } from '@/src/flows/Onboarding/hooks';\nimport { createContext, useContext } from 'react';\n\nexport const OnboardingContext = createContext<{\n formId: string | undefined;\n onboardingBag: ReturnType<typeof useOnboarding> | null;\n}>({\n formId: undefined,\n onboardingBag: null,\n});\n\nexport const useOnboardingContext = () => {\n const context = useContext(OnboardingContext);\n if (!context.formId || !context.onboardingBag) {\n throw new Error(\n 'useOnboardingContext must be used within a OnboardingContextProvider',\n );\n }\n\n return {\n formId: context.formId,\n onboardingBag: context.onboardingBag,\n } as const;\n};\n"],"mappings":"wCACA,OAAS,iBAAAA,EAAe,cAAAC,MAAkB,QAEnC,IAAMC,EAAoBC,EAG9B,CACD,OAAQ,OACR,cAAe,IACjB,CAAC,EAEYC,EAAuBC,EAAA,IAAM,CACxC,IAAMC,EAAUC,EAAWL,CAAiB,EAC5C,GAAI,CAACI,EAAQ,QAAU,CAACA,EAAQ,cAC9B,MAAM,IAAI,MACR,sEACF,EAGF,MAAO,CACL,OAAQA,EAAQ,OAChB,cAAeA,EAAQ,aACzB,CACF,EAZoC","names":["createContext","useContext","OnboardingContext","createContext","useOnboardingContext","__name","context","useContext"]}
@@ -1,4 +1,4 @@
1
- import { b as PostCreateContractAmendmentError, a as ContractAmendmentResponse } from '../../types.gen-Dta9Iy5C.js';
1
+ import { b as PostCreateContractAmendmentError, a as ContractAmendmentResponse } from '../../types.gen-CsMdyQkb.js';
2
2
  import React__default from 'react';
3
3
  import { FieldValues } from 'react-hook-form';
4
4
 
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-THCM2G6C.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-YBACB5A6.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentConfirmationForm};
1
+ import{a}from"../../chunk-ABR3B66K.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentConfirmationForm};
2
2
  //# sourceMappingURL=ContractAmendmentConfirmationForm.js.map
@@ -5,11 +5,13 @@ import { ContractAmendmentForm } from './ContractAmendmentForm.js';
5
5
  import { ContractAmendmentSubmit } from './ContractAmendmentSubmit.js';
6
6
  import { useContractAmendment } from './hooks.js';
7
7
  import { ContractAmendmentParams } from './types.js';
8
- import '../../types.gen-Dta9Iy5C.js';
8
+ import '../../types.gen-CsMdyQkb.js';
9
9
  import 'react-hook-form';
10
10
  import '../../mutations-v9H353tz.js';
11
11
  import '@remoteoss/json-schema-form';
12
12
  import '../useStepState.js';
13
+ import '../types.js';
14
+ import '../CostCalculator/types.js';
13
15
 
14
16
  type TUseContractAmendment = ReturnType<typeof useContractAmendment>;
15
17
  type ContractAmendmentRenderProps = {
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-GGZV4QYL.js";import"../../chunk-XLFHHYVS.js";import"../../chunk-3MAYMGXF.js";import"../../chunk-WJPC4J3U.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-RCX4JUI3.js";import"../../chunk-AG27JG4N.js";import"../../chunk-S56EWAS4.js";import"../../chunk-FMT2OTOL.js";import"../../chunk-THCM2G6C.js";import"../../chunk-U3TYUMTJ.js";import"../../chunk-VTPDBEHE.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-YBACB5A6.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentFlow};
1
+ import{a}from"../../chunk-KQH5HLN5.js";import"../../chunk-XLFHHYVS.js";import"../../chunk-GOLOL2V6.js";import"../../chunk-QOMUXX6W.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-DHRIURRT.js";import"../../chunk-UECSVYQ5.js";import"../../chunk-S56EWAS4.js";import"../../chunk-FMT2OTOL.js";import"../../chunk-ABR3B66K.js";import"../../chunk-HEPL5WDF.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-MIHU6CEZ.js";import"../../chunk-GFBF55NR.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentFlow};
2
2
  //# sourceMappingURL=ContractAmendmentFlow.js.map
@@ -1,4 +1,4 @@
1
- import { P as PostAutomatableContractAmendmentError, C as ContractAmendmentAutomatableResponse } from '../../types.gen-Dta9Iy5C.js';
1
+ import { P as PostAutomatableContractAmendmentError, C as ContractAmendmentAutomatableResponse } from '../../types.gen-CsMdyQkb.js';
2
2
  import React__default from 'react';
3
3
  import { FieldValues } from 'react-hook-form';
4
4
 
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-U3TYUMTJ.js";import"../../chunk-VTPDBEHE.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-YBACB5A6.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentForm};
1
+ import{a}from"../../chunk-HEPL5WDF.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-MIHU6CEZ.js";import"../../chunk-GFBF55NR.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentForm};
2
2
  //# sourceMappingURL=ContractAmendmentForm.js.map
@@ -1,11 +1,13 @@
1
1
  import { S as SuccessResponse, E as ErrorResponse } from '../../mutations-v9H353tz.js';
2
- import { C as ContractAmendmentAutomatableResponse, P as PostAutomatableContractAmendmentError, a as ContractAmendmentResponse, b as PostCreateContractAmendmentError } from '../../types.gen-Dta9Iy5C.js';
2
+ import { C as ContractAmendmentAutomatableResponse, P as PostAutomatableContractAmendmentError, a as ContractAmendmentResponse, b as PostCreateContractAmendmentError } from '../../types.gen-CsMdyQkb.js';
3
3
  import * as _remoteoss_json_schema_form from '@remoteoss/json-schema-form';
4
4
  import * as React from 'react';
5
5
  import * as react_hook_form from 'react-hook-form';
6
6
  import { useContractAmendment } from './hooks.js';
7
7
  import { Step } from '../useStepState.js';
8
8
  import './types.js';
9
+ import '../types.js';
10
+ import '../CostCalculator/types.js';
9
11
 
10
12
  declare const ContractAmendmentContext: React.Context<{
11
13
  formId: string | undefined;
@@ -1,10 +1,12 @@
1
1
  import { S as SuccessResponse, E as ErrorResponse } from '../../mutations-v9H353tz.js';
2
- import { C as ContractAmendmentAutomatableResponse, P as PostAutomatableContractAmendmentError, a as ContractAmendmentResponse, b as PostCreateContractAmendmentError } from '../../types.gen-Dta9Iy5C.js';
2
+ import { C as ContractAmendmentAutomatableResponse, P as PostAutomatableContractAmendmentError, a as ContractAmendmentResponse, b as PostCreateContractAmendmentError } from '../../types.gen-CsMdyQkb.js';
3
3
  import * as React from 'react';
4
4
  import * as _remoteoss_json_schema_form from '@remoteoss/json-schema-form';
5
5
  import { Step } from '../useStepState.js';
6
6
  import { ContractAmendmentParams } from './types.js';
7
7
  import { FieldValues } from 'react-hook-form';
8
+ import '../types.js';
9
+ import '../CostCalculator/types.js';
8
10
 
9
11
  declare const useContractAmendment: ({ employmentId, countryCode, options, }: ContractAmendmentParams) => {
10
12
  /**
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-3MAYMGXF.js";import"../../chunk-WJPC4J3U.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-RCX4JUI3.js";import"../../chunk-AG27JG4N.js";import"../../chunk-S56EWAS4.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-YBACB5A6.js";import"../../chunk-AYDF3IFZ.js";export{a as useContractAmendment};
1
+ import{a}from"../../chunk-GOLOL2V6.js";import"../../chunk-QOMUXX6W.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-DHRIURRT.js";import"../../chunk-UECSVYQ5.js";import"../../chunk-S56EWAS4.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-AYDF3IFZ.js";export{a as useContractAmendment};
2
2
  //# sourceMappingURL=hooks.js.map
@@ -3,11 +3,13 @@ export { ContractAmendmentFlow, ContractAmendmentRenderProps } from './ContractA
3
3
  export { ContractAmendmentForm } from './ContractAmendmentForm.js';
4
4
  export { ContractAmendmentSubmit } from './ContractAmendmentSubmit.js';
5
5
  export { useContractAmendment } from './hooks.js';
6
- import '../../types.gen-Dta9Iy5C.js';
6
+ import '../../types.gen-CsMdyQkb.js';
7
7
  import 'react';
8
8
  import 'react-hook-form';
9
9
  import './ContractAmendmentBack.js';
10
10
  import './types.js';
11
- import '../../mutations-v9H353tz.js';
11
+ import '../types.js';
12
+ import '../CostCalculator/types.js';
12
13
  import '@remoteoss/json-schema-form';
14
+ import '../../mutations-v9H353tz.js';
13
15
  import '../useStepState.js';
@@ -1,2 +1,2 @@
1
- import"../../chunk-A7ZJQCNU.js";import{a as e}from"../../chunk-GGZV4QYL.js";import{a as c}from"../../chunk-XLFHHYVS.js";import{a as d}from"../../chunk-3MAYMGXF.js";import"../../chunk-WJPC4J3U.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-RCX4JUI3.js";import"../../chunk-AG27JG4N.js";import"../../chunk-S56EWAS4.js";import"../../chunk-FMT2OTOL.js";import{a}from"../../chunk-THCM2G6C.js";import{a as b}from"../../chunk-U3TYUMTJ.js";import"../../chunk-VTPDBEHE.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-YBACB5A6.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentConfirmationForm,e as ContractAmendmentFlow,b as ContractAmendmentForm,c as ContractAmendmentSubmit,d as useContractAmendment};
1
+ import"../../chunk-A7ZJQCNU.js";import{a as e}from"../../chunk-KQH5HLN5.js";import{a as c}from"../../chunk-XLFHHYVS.js";import{a as d}from"../../chunk-GOLOL2V6.js";import"../../chunk-QOMUXX6W.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-DHRIURRT.js";import"../../chunk-UECSVYQ5.js";import"../../chunk-S56EWAS4.js";import"../../chunk-FMT2OTOL.js";import{a}from"../../chunk-ABR3B66K.js";import{a as b}from"../../chunk-HEPL5WDF.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-MIHU6CEZ.js";import"../../chunk-GFBF55NR.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-6HGUGIYJ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractAmendmentConfirmationForm,e as ContractAmendmentFlow,b as ContractAmendmentForm,c as ContractAmendmentSubmit,d as useContractAmendment};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,14 +1,12 @@
1
+ import { FlowOptions } from '../types.js';
2
+ import '../CostCalculator/types.js';
3
+ import '../../types.gen-CsMdyQkb.js';
4
+ import '@remoteoss/json-schema-form';
5
+
1
6
  type ContractAmendmentParams = {
2
7
  employmentId: string;
3
8
  countryCode: string;
4
- options?: {
5
- jsfModify?: {
6
- [K in 'fields' | 'allFields' | 'create' | 'pick' | 'orderRoot']?: any;
7
- };
8
- jsonSchemaVersion?: {
9
- contract_amendments?: number;
10
- };
11
- };
9
+ options?: FlowOptions;
12
10
  };
13
11
 
14
12
  export type { ContractAmendmentParams };
@@ -1,4 +1,4 @@
1
- import { E as EmploymentShowResponse } from '../../types.gen-Dta9Iy5C.js';
1
+ import { E as EmploymentShowResponse } from '../../types.gen-CsMdyQkb.js';
2
2
  import { Fields } from '@remoteoss/json-schema-form';
3
3
  import { Step } from '../useStepState.js';
4
4
  import 'react';
@@ -1,2 +1,2 @@
1
- import{a,b}from"../../chunk-RCX4JUI3.js";import"../../chunk-YBACB5A6.js";import"../../chunk-AYDF3IFZ.js";export{a as STEPS,b as buildInitialValues};
1
+ import{a,b}from"../../chunk-UECSVYQ5.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-AYDF3IFZ.js";export{a as STEPS,b as buildInitialValues};
2
2
  //# sourceMappingURL=utils.js.map
@@ -3,7 +3,7 @@ import { CostCalculatorEstimationOptions, JSFModify } from './types.js';
3
3
  import React__default from 'react';
4
4
  import 'yup';
5
5
  import '@tanstack/react-query';
6
- import '../../types.gen-Dta9Iy5C.js';
6
+ import '../../types.gen-CsMdyQkb.js';
7
7
  import '../types.js';
8
8
  import '@remoteoss/json-schema-form';
9
9
 
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-4APN5ST6.js";import"../../chunk-OLJ2S6A6.js";import"../../chunk-P3N4X5KU.js";import"../../chunk-UPRUP24B.js";import"../../chunk-AG27JG4N.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-YBACB5A6.js";import"../../chunk-AYDF3IFZ.js";export{a as CostCalculatorFlow};
1
+ import{a}from"../../chunk-DE5FSFYL.js";import"../../chunk-GRYAM4FZ.js";import"../../chunk-UPRUP24B.js";import"../../chunk-OLJ2S6A6.js";import"../../chunk-DHRIURRT.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-AYDF3IFZ.js";export{a as CostCalculatorFlow};
2
2
  //# sourceMappingURL=CostCalculatorFlow.js.map
@@ -1,4 +1,4 @@
1
- import { c as CostCalculatorEstimateResponse } from '../../types.gen-Dta9Iy5C.js';
1
+ import { j as CostCalculatorEstimateResponse } from '../../types.gen-CsMdyQkb.js';
2
2
  import { EstimationError } from './hooks.js';
3
3
  import { CostCalculatorEstimationFormValues } from './types.js';
4
4
  import React__default from 'react';
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-BDCIVWHR.js";import"../../chunk-OLJ2S6A6.js";import"../../chunk-VTPDBEHE.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as CostCalculatorForm};
1
+ import{a}from"../../chunk-PNXZHV6W.js";import"../../chunk-OLJ2S6A6.js";import"../../chunk-MIHU6CEZ.js";import"../../chunk-GFBF55NR.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as CostCalculatorForm};
2
2
  //# sourceMappingURL=CostCalculatorForm.js.map
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { c as CostCalculatorEstimateResponse } from '../../../types.gen-Dta9Iy5C.js';
2
+ import { j as CostCalculatorEstimateResponse } from '../../../types.gen-CsMdyQkb.js';
3
3
 
4
4
  interface CostCalculatorResultProps {
5
5
  employmentData: CostCalculatorEstimateResponse['data'];
@@ -1,2 +1,2 @@
1
- import{a}from"../../../chunk-6YO6XWPH.js";import"../../../chunk-KH6QS5OU.js";import"../../../chunk-J55S4SEH.js";import"../../../chunk-3FVI5JIC.js";import"../../../chunk-6A3F6JG6.js";import"../../../chunk-MESREYTZ.js";import"../../../chunk-GMGKIQLI.js";import"../../../chunk-WQHKB5T7.js";import"../../../chunk-56BNVYTD.js";import"../../../chunk-5ETXP2QF.js";import"../../../chunk-AYDF3IFZ.js";export{a as CostCalculatorResults};
1
+ import{a}from"../../../chunk-S4FKLPBB.js";import"../../../chunk-GMGKIQLI.js";import"../../../chunk-WQHKB5T7.js";import"../../../chunk-KH6QS5OU.js";import"../../../chunk-J55S4SEH.js";import"../../../chunk-3FVI5JIC.js";import"../../../chunk-6A3F6JG6.js";import"../../../chunk-MESREYTZ.js";import"../../../chunk-GFBF55NR.js";import"../../../chunk-56BNVYTD.js";import"../../../chunk-5ETXP2QF.js";import"../../../chunk-AYDF3IFZ.js";export{a as CostCalculatorResults};
2
2
  //# sourceMappingURL=CostCalculatorResults.js.map
@@ -2,7 +2,7 @@ import { Result } from '../types.js';
2
2
  import { useCostCalculator, EstimationError } from './hooks.js';
3
3
  import { CostCalculatorEstimationFormValues } from './types.js';
4
4
  import * as React from 'react';
5
- import { c as CostCalculatorEstimateResponse } from '../../types.gen-Dta9Iy5C.js';
5
+ import { j as CostCalculatorEstimateResponse } from '../../types.gen-CsMdyQkb.js';
6
6
  import { $TSFixMe } from '@remoteoss/json-schema-form';
7
7
  import * as yup from 'yup';
8
8
  import { UseFormReturn } from 'react-hook-form';
@@ -1,7 +1,7 @@
1
1
  import * as yup from 'yup';
2
2
  import { ValidationError } from 'yup';
3
3
  import * as _tanstack_react_query from '@tanstack/react-query';
4
- import { c as CostCalculatorEstimateResponse, d as PostCreateEstimationError, e as CostCalculatorEstimatePdfResponse, f as PostCreateEstimationPdfError, g as CostCalculatorEstimateParams } from '../../types.gen-Dta9Iy5C.js';
4
+ import { j as CostCalculatorEstimateResponse, k as PostCreateEstimationError, l as CostCalculatorEstimatePdfResponse, m as PostCreateEstimationPdfError, n as CostCalculatorEstimateParams } from '../../types.gen-CsMdyQkb.js';
5
5
  import { CostCalculatorEstimationOptions, JSFModify, CostCalculatorEstimationFormValues } from './types.js';
6
6
  import { Result } from '../types.js';
7
7
  import '@remoteoss/json-schema-form';
@@ -1,2 +1,2 @@
1
- import{c as a,d as b,e as c}from"../../chunk-P3N4X5KU.js";import"../../chunk-UPRUP24B.js";import"../../chunk-AG27JG4N.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-YBACB5A6.js";import"../../chunk-AYDF3IFZ.js";export{b as defaultEstimationOptions,c as useCostCalculator,a as useCostCalculatorEstimationPdf};
1
+ import{c as a,d as b,e as c}from"../../chunk-GRYAM4FZ.js";import"../../chunk-UPRUP24B.js";import"../../chunk-DHRIURRT.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-AYDF3IFZ.js";export{b as defaultEstimationOptions,c as useCostCalculator,a as useCostCalculatorEstimationPdf};
2
2
  //# sourceMappingURL=hooks.js.map
@@ -8,7 +8,7 @@ export { disclaimerData } from './disclaimerUtils.js';
8
8
  export { CostCalculatorResults } from './Results/CostCalculatorResults.js';
9
9
  export { buildPayload as buildCostCalculatorEstimationPayload } from './utils.js';
10
10
  import './types.js';
11
- import '../../types.gen-Dta9Iy5C.js';
11
+ import '../../types.gen-CsMdyQkb.js';
12
12
  import '@remoteoss/json-schema-form';
13
13
  import 'react';
14
14
  import 'yup';
@@ -1,2 +1,2 @@
1
- import"../../chunk-FGBEOUQK.js";import{a as j}from"../../chunk-6YO6XWPH.js";import"../../chunk-KH6QS5OU.js";import"../../chunk-J55S4SEH.js";import"../../chunk-3FVI5JIC.js";import"../../chunk-6A3F6JG6.js";import"../../chunk-MESREYTZ.js";import"../../chunk-GMGKIQLI.js";import"../../chunk-WQHKB5T7.js";import{a as e}from"../../chunk-BDCIVWHR.js";import{a as g}from"../../chunk-7CYG2RHP.js";import{a as f}from"../../chunk-EAAIAMTY.js";import{a as i}from"../../chunk-DGPRFQYK.js";import{a as h}from"../../chunk-DYB3RWP7.js";import{a as d}from"../../chunk-4APN5ST6.js";import"../../chunk-OLJ2S6A6.js";import{b as a,c as b,e as c}from"../../chunk-P3N4X5KU.js";import"../../chunk-UPRUP24B.js";import"../../chunk-AG27JG4N.js";import"../../chunk-VTPDBEHE.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-YBACB5A6.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{i as CostCalculatorDisclaimer,d as CostCalculatorFlow,e as CostCalculatorForm,g as CostCalculatorResetButton,j as CostCalculatorResults,f as CostCalculatorSubmitButton,a as buildCostCalculatorEstimationPayload,h as disclaimerData,c as useCostCalculator,b as useCostCalculatorEstimationPdf};
1
+ import"../../chunk-FGBEOUQK.js";import{a as j}from"../../chunk-S4FKLPBB.js";import"../../chunk-GMGKIQLI.js";import"../../chunk-WQHKB5T7.js";import"../../chunk-KH6QS5OU.js";import"../../chunk-J55S4SEH.js";import"../../chunk-3FVI5JIC.js";import"../../chunk-6A3F6JG6.js";import"../../chunk-MESREYTZ.js";import{a as i}from"../../chunk-DGPRFQYK.js";import{a as h}from"../../chunk-DYB3RWP7.js";import{a as d}from"../../chunk-DE5FSFYL.js";import{b as a,c as b,e as c}from"../../chunk-GRYAM4FZ.js";import"../../chunk-UPRUP24B.js";import{a as e}from"../../chunk-PNXZHV6W.js";import{a as g}from"../../chunk-7CYG2RHP.js";import{a as f}from"../../chunk-EAAIAMTY.js";import"../../chunk-OLJ2S6A6.js";import"../../chunk-DHRIURRT.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-MIHU6CEZ.js";import"../../chunk-GFBF55NR.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{i as CostCalculatorDisclaimer,d as CostCalculatorFlow,e as CostCalculatorForm,g as CostCalculatorResetButton,j as CostCalculatorResults,f as CostCalculatorSubmitButton,a as buildCostCalculatorEstimationPayload,h as disclaimerData,c as useCostCalculator,b as useCostCalculatorEstimationPdf};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { h as EmploymentTermType } from '../../types.gen-Dta9Iy5C.js';
1
+ import { o as EmploymentTermType } from '../../types.gen-CsMdyQkb.js';
2
2
  import { modify } from '@remoteoss/json-schema-form';
3
3
 
4
4
  type CostCalculatorEstimationFormValues = {
@@ -1,4 +1,4 @@
1
- import { g as CostCalculatorEstimateParams } from '../../types.gen-Dta9Iy5C.js';
1
+ import { n as CostCalculatorEstimateParams } from '../../types.gen-CsMdyQkb.js';
2
2
  import { $TSFixMe } from '@remoteoss/json-schema-form';
3
3
  import { AnyObjectSchema } from 'yup';
4
4
  import { CostCalculatorEstimationFormValues, CostCalculatorEstimationOptions } from './types.js';
@@ -1,2 +1,2 @@
1
- import{a,b}from"../../chunk-P3N4X5KU.js";import"../../chunk-UPRUP24B.js";import"../../chunk-AG27JG4N.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-YBACB5A6.js";import"../../chunk-AYDF3IFZ.js";export{b as buildPayload,a as buildValidationSchema};
1
+ import{a,b}from"../../chunk-GRYAM4FZ.js";import"../../chunk-UPRUP24B.js";import"../../chunk-DHRIURRT.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-AYDF3IFZ.js";export{b as buildPayload,a as buildValidationSchema};
2
2
  //# sourceMappingURL=utils.js.map
@@ -0,0 +1,15 @@
1
+ import React__default from 'react';
2
+ import { BasicInformationFormPayload } from './types.js';
3
+ import { c as EmploymentCreationResponse } from '../../types.gen-CsMdyQkb.js';
4
+ import '../types.js';
5
+ import '../CostCalculator/types.js';
6
+ import '@remoteoss/json-schema-form';
7
+
8
+ type BasicInformationStepProps = {
9
+ onSubmit?: (payload: BasicInformationFormPayload) => void | Promise<void>;
10
+ onSuccess?: (data: EmploymentCreationResponse) => void;
11
+ onError?: (error: Error) => void;
12
+ };
13
+ declare function BasicInformationStep({ onSubmit, onSuccess, onError, }: BasicInformationStepProps): React__default.JSX.Element;
14
+
15
+ export { BasicInformationStep };
@@ -0,0 +1,2 @@
1
+ import{a}from"../../chunk-CFRYIKSR.js";import"../../chunk-LNKYOAKF.js";import"../../chunk-WS3C3WIJ.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-MIHU6CEZ.js";import"../../chunk-GFBF55NR.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as BasicInformationStep};
2
+ //# sourceMappingURL=BasicInformationStep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,37 @@
1
+ import React__default from 'react';
2
+ import { C as Components } from '../../remoteFlows-CswYencu.js';
3
+ import { S as SuccessResponse } from '../../types.gen-CsMdyQkb.js';
4
+ import { BenefitsFormPayload } from './types.js';
5
+ import 'react-hook-form';
6
+ import 'yup';
7
+ import '../types.js';
8
+ import '../CostCalculator/types.js';
9
+ import '@remoteoss/json-schema-form';
10
+
11
+ type BenefitsStepProps = {
12
+ components: Components;
13
+ /**
14
+ * Callback function to be called when the benefits form is submitted.
15
+ * It can be used to perform any additional validation or processing before
16
+ * the onboarding moves to the last step.
17
+ * @param values
18
+ * @returns
19
+ */
20
+ onSubmit?: (values: BenefitsFormPayload) => void | Promise<void>;
21
+ /**
22
+ * Callback function to be called when the submitting benefits form fails.
23
+ * @param error
24
+ * @returns
25
+ */
26
+ onError?: (error: Error) => void;
27
+ /**
28
+ * Callback function to be called when benefits form is successfully submitted.
29
+ * This function is called after the submitting benefits form is submitted.
30
+ * @param data
31
+ * @returns
32
+ */
33
+ onSuccess?: (data: SuccessResponse) => void;
34
+ };
35
+ declare function BenefitsStep({ components, onSubmit, onError, onSuccess, }: BenefitsStepProps): React__default.JSX.Element;
36
+
37
+ export { BenefitsStep };
@@ -0,0 +1,2 @@
1
+ import{a}from"../../chunk-ED3CBUQL.js";import"../../chunk-LNKYOAKF.js";import"../../chunk-WS3C3WIJ.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-MIHU6CEZ.js";import"../../chunk-GFBF55NR.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as BenefitsStep};
2
+ //# sourceMappingURL=BenefitsStep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,15 @@
1
+ import React__default from 'react';
2
+ import { e as EmploymentResponse } from '../../types.gen-CsMdyQkb.js';
3
+ import { ContractDetailsFormPayload } from './types.js';
4
+ import '../types.js';
5
+ import '../CostCalculator/types.js';
6
+ import '@remoteoss/json-schema-form';
7
+
8
+ type ContractDetailsStepProps = {
9
+ onSubmit?: (payload: ContractDetailsFormPayload) => void | Promise<void>;
10
+ onSuccess?: (response: EmploymentResponse) => void | Promise<void>;
11
+ onError?: (error: Error) => void;
12
+ };
13
+ declare function ContractDetailsStep({ onSubmit, onError, onSuccess, }: ContractDetailsStepProps): React__default.JSX.Element;
14
+
15
+ export { ContractDetailsStep };
@@ -0,0 +1,2 @@
1
+ import{a}from"../../chunk-QSHYMFMY.js";import"../../chunk-LNKYOAKF.js";import"../../chunk-WS3C3WIJ.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-MIHU6CEZ.js";import"../../chunk-GFBF55NR.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as ContractDetailsStep};
2
+ //# sourceMappingURL=ContractDetailsStep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,5 @@
1
+ import React__default, { PropsWithChildren, ButtonHTMLAttributes } from 'react';
2
+
3
+ declare function OnboardingBack({ children, ...props }: PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>>): React__default.JSX.Element;
4
+
5
+ export { OnboardingBack };
@@ -0,0 +1,2 @@
1
+ import{a}from"../../chunk-M7WCW7WD.js";import"../../chunk-WS3C3WIJ.js";import"../../chunk-56BNVYTD.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as OnboardingBack};
2
+ //# sourceMappingURL=OnboardingBack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,52 @@
1
+ import React__default from 'react';
2
+ import { useOnboarding } from './hooks.js';
3
+ import { BasicInformationStep } from './BasicInformationStep.js';
4
+ import { OnboardingSubmit } from './OnboardingSubmit.js';
5
+ import { OnboardingBack } from './OnboardingBack.js';
6
+ import { OnboardingFlowParams } from './types.js';
7
+ import { OnboardingInvite } from './OnboardingInvite.js';
8
+ import { ContractDetailsStep } from './ContractDetailsStep.js';
9
+ import { BenefitsStep } from './BenefitsStep.js';
10
+ import '../../mutations-v9H353tz.js';
11
+ import '@remoteoss/json-schema-form';
12
+ import '../useStepState.js';
13
+ import 'react-hook-form';
14
+ import '@tanstack/react-query';
15
+ import '../../types.gen-CsMdyQkb.js';
16
+ import '../types.js';
17
+ import '../CostCalculator/types.js';
18
+ import '../../remoteFlows-CswYencu.js';
19
+ import 'yup';
20
+
21
+ type OnboardingRenderProps = {
22
+ /**
23
+ * The onboarding bag returned by the useOnboarding hook.
24
+ * This bag contains all the methods and properties needed to handle the onboarding flow.
25
+ * @see {@link useOnboarding}
26
+ */
27
+ onboardingBag: ReturnType<typeof useOnboarding>;
28
+ /**
29
+ * The components used in the onboarding flow.
30
+ * This includes different steps, submit button, back button.
31
+ * @see {@link BasicInformationStep}
32
+ * @see {@link ContractDetailsStep}
33
+ * @see {@link OnboardingSubmit}
34
+ * @see {@link OnboardingBack}
35
+ * @see {@link OnboardingInvite}
36
+ * @see {@link BenefitsStep}
37
+ */
38
+ components: {
39
+ SubmitButton: typeof OnboardingSubmit;
40
+ BackButton: typeof OnboardingBack;
41
+ BasicInformationStep: typeof BasicInformationStep;
42
+ OnboardingInvite: typeof OnboardingInvite;
43
+ ContractDetailsStep: typeof ContractDetailsStep;
44
+ BenefitsStep: typeof BenefitsStep;
45
+ };
46
+ };
47
+ type OnboardingFlowProps = OnboardingFlowParams & {
48
+ render: ({ onboardingBag, components, }: OnboardingRenderProps) => React__default.ReactNode;
49
+ };
50
+ declare const OnboardingFlow: ({ employmentId, countryCode, type, render, options, }: OnboardingFlowProps) => React__default.JSX.Element;
51
+
52
+ export { OnboardingFlow, type OnboardingRenderProps };
@@ -0,0 +1,2 @@
1
+ import{a}from"../../chunk-PWKM2R6V.js";import"../../chunk-QSHYMFMY.js";import"../../chunk-M7WCW7WD.js";import"../../chunk-ALRU77S5.js";import"../../chunk-MHKNAQLP.js";import"../../chunk-NE547PW4.js";import"../../chunk-2PXGLWCY.js";import"../../chunk-CFRYIKSR.js";import"../../chunk-ED3CBUQL.js";import"../../chunk-LNKYOAKF.js";import"../../chunk-WS3C3WIJ.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-DHRIURRT.js";import"../../chunk-S56EWAS4.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-MIHU6CEZ.js";import"../../chunk-GFBF55NR.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as OnboardingFlow};
2
+ //# sourceMappingURL=OnboardingFlow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,19 @@
1
+ import React__default from 'react';
2
+ import { Fields } from '@remoteoss/json-schema-form';
3
+ import { BasicInformationFormPayload, BenefitsFormPayload, ContractDetailsFormPayload } from './types.js';
4
+ import { C as Components } from '../../remoteFlows-CswYencu.js';
5
+ import '../../types.gen-CsMdyQkb.js';
6
+ import '../types.js';
7
+ import '../CostCalculator/types.js';
8
+ import 'react-hook-form';
9
+ import 'yup';
10
+
11
+ type OnboardingFormProps = {
12
+ onSubmit: (payload: BasicInformationFormPayload | BenefitsFormPayload | ContractDetailsFormPayload) => void;
13
+ components?: Components;
14
+ fields?: Fields;
15
+ defaultValues: Record<string, unknown>;
16
+ };
17
+ declare function OnboardingForm({ defaultValues, onSubmit, components, }: OnboardingFormProps): React__default.JSX.Element;
18
+
19
+ export { OnboardingForm };
@@ -0,0 +1,2 @@
1
+ import{a}from"../../chunk-LNKYOAKF.js";import"../../chunk-WS3C3WIJ.js";import"../../chunk-A4RX3KRZ.js";import"../../chunk-MIHU6CEZ.js";import"../../chunk-GFBF55NR.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-IDSJI7KQ.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as OnboardingForm};
2
+ //# sourceMappingURL=OnboardingForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,11 @@
1
+ import React__default, { PropsWithChildren, ButtonHTMLAttributes } from 'react';
2
+ import { S as SuccessResponse } from '../../types.gen-CsMdyQkb.js';
3
+
4
+ type OnboardingInviteProps = PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement> & {
5
+ onSuccess?: (data: SuccessResponse) => void;
6
+ onError?: (error: unknown) => void;
7
+ onSubmit?: () => void;
8
+ }>;
9
+ declare function OnboardingInvite({ onSubmit, onSuccess, onError, ...props }: OnboardingInviteProps): React__default.JSX.Element;
10
+
11
+ export { OnboardingInvite };
@@ -0,0 +1,2 @@
1
+ import{a}from"../../chunk-ALRU77S5.js";import"../../chunk-NE547PW4.js";import"../../chunk-2PXGLWCY.js";import"../../chunk-WS3C3WIJ.js";import"../../chunk-JRQSZHUU.js";import"../../chunk-DHRIURRT.js";import"../../chunk-S56EWAS4.js";import"../../chunk-WRDKLT4N.js";import"../../chunk-56BNVYTD.js";import"../../chunk-VRQXHCFR.js";import"../../chunk-5ETXP2QF.js";import"../../chunk-AYDF3IFZ.js";export{a as OnboardingInvite};
2
+ //# sourceMappingURL=OnboardingInvite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}