@voplus/morpho-csp 11.2.8 → 11.3.0-dev.0

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 (212) hide show
  1. package/es/components/LegalContactSelect/index.d.ts +7 -0
  2. package/es/components/LegalContactSelect/index.js +127 -12
  3. package/es/components/LegalContactSelect/index.js.map +1 -1
  4. package/es/data/clda-form/conversion.d.ts +9 -6
  5. package/es/data/clda-form/conversion.js +11 -18
  6. package/es/data/clda-form/conversion.js.map +1 -1
  7. package/es/data/clda-form/identityAdapter.d.ts +60 -0
  8. package/es/data/clda-form/identityAdapter.js +196 -0
  9. package/es/data/clda-form/identityAdapter.js.map +1 -0
  10. package/es/data/clda-form/interfaces.d.ts +20 -1
  11. package/es/data/clda-form/saveFormDraft.d.ts +4 -0
  12. package/es/data/clda-form/saveFormDraft.js +21 -0
  13. package/es/data/clda-form/saveFormDraft.js.map +1 -0
  14. package/es/data/clda-form/types.d.ts +31 -2
  15. package/es/modules/corporate/background-investigation/risk-profile/components/IdentityProperties/IdentityShapeFields.d.ts +35 -0
  16. package/es/modules/corporate/background-investigation/risk-profile/components/IdentityProperties/IdentityShapeFields.js +53 -0
  17. package/es/modules/corporate/background-investigation/risk-profile/components/IdentityProperties/IdentityShapeFields.js.map +1 -0
  18. package/es/modules/corporate/background-investigation/risk-profile/components/IdentityProperties/index.js +41 -15
  19. package/es/modules/corporate/background-investigation/risk-profile/components/IdentityProperties/index.js.map +1 -1
  20. package/es/modules/corporate/background-investigation/risk-profile/components/IdentityProperties/state.d.ts +59 -1
  21. package/es/modules/corporate/background-investigation/risk-profile/components/IdentityProperties/state.js +244 -15
  22. package/es/modules/corporate/background-investigation/risk-profile/components/IdentityProperties/state.js.map +1 -1
  23. package/es/modules/corporate/company/components/CorporateOfficerSelect/index.d.ts +5 -0
  24. package/es/modules/corporate/company/components/CorporateOfficerSelect/index.js +13 -7
  25. package/es/modules/corporate/company/components/CorporateOfficerSelect/index.js.map +1 -1
  26. package/es/modules/corporate/company/identity/components/NewLegalContactDialog/Step3.d.ts +2 -2
  27. package/es/modules/corporate/company/identity/components/NewLegalContactDialog/Step3.js +20 -24
  28. package/es/modules/corporate/company/identity/components/NewLegalContactDialog/Step3.js.map +1 -1
  29. package/es/modules/corporate/company/identity/components/NewLegalContactDialog/Step4.d.ts +2 -2
  30. package/es/modules/corporate/company/identity/components/NewLegalContactDialog/Step4.js +38 -11
  31. package/es/modules/corporate/company/identity/components/NewLegalContactDialog/Step4.js.map +1 -1
  32. package/es/modules/corporate/company/identity/components/NewLegalContactDialog/index.d.ts +3 -3
  33. package/es/modules/corporate/company/identity/components/NewLegalContactDialog/index.js.map +1 -1
  34. package/es/modules/corporate/company/identity/components/NewLegalContactDialog/state.d.ts +25 -4
  35. package/es/modules/corporate/company/identity/components/NewLegalContactDialog/state.js +88 -5
  36. package/es/modules/corporate/company/identity/components/NewLegalContactDialog/state.js.map +1 -1
  37. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/DialogShell.d.ts +13 -0
  38. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/DialogShell.js +20 -0
  39. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/DialogShell.js.map +1 -0
  40. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page1.js +28 -28
  41. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page1.js.map +1 -1
  42. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page2.js +3 -4
  43. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page2.js.map +1 -1
  44. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page3.js +16 -9
  45. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page3.js.map +1 -1
  46. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page4.d.ts +2 -2
  47. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page4.js +128 -61
  48. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page4.js.map +1 -1
  49. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page5.d.ts +2 -2
  50. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page5.js +119 -24
  51. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/Page5.js.map +1 -1
  52. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/index.d.ts +0 -1
  53. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/index.js +16 -8
  54. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/index.js.map +1 -1
  55. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/state.d.ts +274 -23
  56. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/state.js +560 -210
  57. package/es/modules/corporate/company/identity/components/SelectLegalContactDialog/state.js.map +1 -1
  58. package/es/modules/corporate/components/CorporateSelect/index.d.ts +12 -1
  59. package/es/modules/corporate/components/CorporateSelect/index.js +19 -5
  60. package/es/modules/corporate/components/CorporateSelect/index.js.map +1 -1
  61. package/es/modules/corporate/filing-record/filing-type/components/FilingTypeReminderScheduleList/index.js +9 -6
  62. package/es/modules/corporate/filing-record/filing-type/components/FilingTypeReminderScheduleList/index.js.map +1 -1
  63. package/es/modules/corporate/legal-generation/components/AppointOfficer/index.d.ts +6 -1
  64. package/es/modules/corporate/legal-generation/components/AppointOfficer/index.js +3 -2
  65. package/es/modules/corporate/legal-generation/components/AppointOfficer/index.js.map +1 -1
  66. package/es/modules/corporate/legal-generation/components/CorporateRepresentative/index.d.ts +6 -1
  67. package/es/modules/corporate/legal-generation/components/CorporateRepresentative/index.js +3 -2
  68. package/es/modules/corporate/legal-generation/components/CorporateRepresentative/index.js.map +1 -1
  69. package/es/modules/corporate/legal-generation/components/IssueShares/Fields.js +3 -3
  70. package/es/modules/corporate/legal-generation/components/IssueShares/Fields.js.map +1 -1
  71. package/es/modules/corporate/legal-generation/components/IssueShares/interface.d.ts +1 -1
  72. package/es/modules/corporate/legal-generation/components/PowerOfAttroney/Fields.d.ts +16 -1
  73. package/es/modules/corporate/legal-generation/components/PowerOfAttroney/Fields.js +27 -9
  74. package/es/modules/corporate/legal-generation/components/PowerOfAttroney/Fields.js.map +1 -1
  75. package/es/modules/corporate/legal-generation/components/PowerOfAttroney/interface.d.ts +5 -2
  76. package/es/modules/corporate/legal-generation/components/ResignationLetter/Fields.js +1 -1
  77. package/es/modules/corporate/legal-generation/components/ResignationLetter/Fields.js.map +1 -1
  78. package/es/modules/corporate/legal-generation/components/ShareTransfer/Fields.d.ts +13 -1
  79. package/es/modules/corporate/legal-generation/components/ShareTransfer/Fields.js +24 -6
  80. package/es/modules/corporate/legal-generation/components/ShareTransfer/Fields.js.map +1 -1
  81. package/es/modules/corporate/legal-generation/components/ShareTransfer/interface.d.ts +5 -2
  82. package/es/modules/corporate/legal-generation/components/SubmitButton/index.d.ts +11 -3
  83. package/es/modules/corporate/legal-generation/components/SubmitButton/index.js +9 -3
  84. package/es/modules/corporate/legal-generation/components/SubmitButton/index.js.map +1 -1
  85. package/es/modules/corporate/legal-generation/fields/AppointOfficerFields.d.ts +31 -2
  86. package/es/modules/corporate/legal-generation/fields/AppointOfficerFields.js +52 -37
  87. package/es/modules/corporate/legal-generation/fields/AppointOfficerFields.js.map +1 -1
  88. package/es/modules/corporate/legal-generation/fields/CorporateRepresentativeFields.d.ts +27 -2
  89. package/es/modules/corporate/legal-generation/fields/CorporateRepresentativeFields.js +78 -21
  90. package/es/modules/corporate/legal-generation/fields/CorporateRepresentativeFields.js.map +1 -1
  91. package/es/modules/corporate/legal-generation/fields/ParentCompanyDetailsFields.d.ts +17 -0
  92. package/es/modules/corporate/legal-generation/fields/ParentCompanyDetailsFields.js +36 -0
  93. package/es/modules/corporate/legal-generation/fields/ParentCompanyDetailsFields.js.map +1 -0
  94. package/es/modules/corporate/legal-generation/fields/renderCapturedIdentityColumn.d.ts +11 -0
  95. package/es/modules/corporate/legal-generation/fields/renderCapturedIdentityColumn.js +25 -0
  96. package/es/modules/corporate/legal-generation/fields/renderCapturedIdentityColumn.js.map +1 -0
  97. package/es/modules/corporate/legal-generation/fields/state/index.d.ts +7 -0
  98. package/es/modules/corporate/legal-generation/fields/state/index.js +5 -0
  99. package/es/modules/corporate/legal-generation/fields/state/index.js.map +1 -0
  100. package/es/modules/corporate/legal-generation/fields/state/types.d.ts +37 -0
  101. package/es/modules/corporate/legal-generation/fields/state/types.js +27 -0
  102. package/es/modules/corporate/legal-generation/fields/state/types.js.map +1 -0
  103. package/es/modules/corporate/legal-generation/fields/state/useCapturedIdentityField.d.ts +28 -0
  104. package/es/modules/corporate/legal-generation/fields/state/useCapturedIdentityField.js +45 -0
  105. package/es/modules/corporate/legal-generation/fields/state/useCapturedIdentityField.js.map +1 -0
  106. package/es/modules/corporate/legal-generation/fields/state/useIdentityShapeCapture.d.ts +31 -0
  107. package/es/modules/corporate/legal-generation/fields/state/useIdentityShapeCapture.js +47 -0
  108. package/es/modules/corporate/legal-generation/fields/state/useIdentityShapeCapture.js.map +1 -0
  109. package/es/modules/corporate/legal-generation/fields/state/useLegalGenerationIdentityCapture.d.ts +35 -0
  110. package/es/modules/corporate/legal-generation/fields/state/useLegalGenerationIdentityCapture.js +36 -0
  111. package/es/modules/corporate/legal-generation/fields/state/useLegalGenerationIdentityCapture.js.map +1 -0
  112. package/es/modules/corporate/legal-generation/fields/state/useOperateField.d.ts +15 -0
  113. package/es/modules/corporate/legal-generation/fields/state/useOperateField.js +27 -0
  114. package/es/modules/corporate/legal-generation/fields/state/useOperateField.js.map +1 -0
  115. package/es/modules/corporate/legal-generation/form/AppointOfficerForm.d.ts +18 -9
  116. package/es/modules/corporate/legal-generation/form/AppointOfficerForm.js +130 -28
  117. package/es/modules/corporate/legal-generation/form/AppointOfficerForm.js.map +1 -1
  118. package/es/modules/corporate/legal-generation/form/CorporateRepresentativeForm.d.ts +27 -17
  119. package/es/modules/corporate/legal-generation/form/CorporateRepresentativeForm.js +112 -24
  120. package/es/modules/corporate/legal-generation/form/CorporateRepresentativeForm.js.map +1 -1
  121. package/es/modules/corporate/legal-generation/form/legalGenerationSubmit.d.ts +637 -0
  122. package/es/modules/corporate/legal-generation/form/legalGenerationSubmit.js +840 -0
  123. package/es/modules/corporate/legal-generation/form/legalGenerationSubmit.js.map +1 -0
  124. package/es/modules/corporate/legal-generation/form/useLegalGenerationDocument.d.ts +23 -0
  125. package/es/modules/corporate/legal-generation/form/useLegalGenerationDocument.js +55 -0
  126. package/es/modules/corporate/legal-generation/form/useLegalGenerationDocument.js.map +1 -0
  127. package/es/modules/corporate/legal-generation/pages/CorporateLegalGeneration/index.js +38 -8
  128. package/es/modules/corporate/legal-generation/pages/CorporateLegalGeneration/index.js.map +1 -1
  129. package/es/modules/self-registration/clda-form/components/CLDAContactList/index.js +50 -33
  130. package/es/modules/self-registration/clda-form/components/CLDAContactList/index.js.map +1 -1
  131. package/es/modules/self-registration/clda-form/components/ContactFields/index.d.ts +5 -2
  132. package/es/modules/self-registration/clda-form/components/ContactFields/index.js +6 -3
  133. package/es/modules/self-registration/clda-form/components/ContactFields/index.js.map +1 -1
  134. package/es/modules/self-registration/clda-form/components/DataProtectionOfficer/NewDPODialog/index.d.ts +1 -2
  135. package/es/modules/self-registration/clda-form/components/DataProtectionOfficer/NewDPODialog/index.js +7 -18
  136. package/es/modules/self-registration/clda-form/components/DataProtectionOfficer/NewDPODialog/index.js.map +1 -1
  137. package/es/modules/self-registration/clda-form/components/NewDirectorDialog/index.d.ts +1 -2
  138. package/es/modules/self-registration/clda-form/components/NewDirectorDialog/index.js +7 -18
  139. package/es/modules/self-registration/clda-form/components/NewDirectorDialog/index.js.map +1 -1
  140. package/es/modules/self-registration/clda-form/components/NewSecretaryDialog/index.d.ts +1 -2
  141. package/es/modules/self-registration/clda-form/components/NewSecretaryDialog/index.js +7 -18
  142. package/es/modules/self-registration/clda-form/components/NewSecretaryDialog/index.js.map +1 -1
  143. package/es/modules/self-registration/clda-form/components/NewShareholderDialog/index.d.ts +1 -2
  144. package/es/modules/self-registration/clda-form/components/NewShareholderDialog/index.js +7 -18
  145. package/es/modules/self-registration/clda-form/components/NewShareholderDialog/index.js.map +1 -1
  146. package/es/modules/self-registration/clda-form/components/useContactEditSession.d.ts +35 -0
  147. package/es/modules/self-registration/clda-form/components/useContactEditSession.js +51 -0
  148. package/es/modules/self-registration/clda-form/components/useContactEditSession.js.map +1 -0
  149. package/es/modules/self-registration/clda-form/incorporation/appoint-representative/components/NewOfficerDetailItem/index.d.ts +2 -3
  150. package/es/modules/self-registration/clda-form/incorporation/appoint-representative/components/NewOfficerDetailItem/index.js +60 -12
  151. package/es/modules/self-registration/clda-form/incorporation/appoint-representative/components/NewOfficerDetailItem/index.js.map +1 -1
  152. package/es/modules/self-registration/clda-form/incorporation/appoint-representative/components/NewOfficerDetailList/index.d.ts +1 -2
  153. package/es/modules/self-registration/clda-form/incorporation/appoint-representative/components/NewOfficerDetailList/index.js +3 -5
  154. package/es/modules/self-registration/clda-form/incorporation/appoint-representative/components/NewOfficerDetailList/index.js.map +1 -1
  155. package/es/modules/self-registration/clda-form/incorporation/appoint-representative/index.js +7 -21
  156. package/es/modules/self-registration/clda-form/incorporation/appoint-representative/index.js.map +1 -1
  157. package/es/modules/self-registration/clda-form/incorporation/company-general/CompanyGeneralForm.js +6 -5
  158. package/es/modules/self-registration/clda-form/incorporation/company-general/CompanyGeneralForm.js.map +1 -1
  159. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddAllotmentDialog/index.d.ts +1 -2
  160. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddAllotmentDialog/index.js +23 -28
  161. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddAllotmentDialog/index.js.map +1 -1
  162. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddBankOpeningDialog/index.d.ts +1 -2
  163. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddBankOpeningDialog/index.js +11 -24
  164. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddBankOpeningDialog/index.js.map +1 -1
  165. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddDivideDialog/index.d.ts +1 -2
  166. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddDivideDialog/index.js +13 -8
  167. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddDivideDialog/index.js.map +1 -1
  168. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddOfficerDialog/index.d.ts +1 -2
  169. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddOfficerDialog/index.js +11 -24
  170. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddOfficerDialog/index.js.map +1 -1
  171. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddRedonminationDialog/index.d.ts +1 -2
  172. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddRedonminationDialog/index.js +18 -9
  173. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddRedonminationDialog/index.js.map +1 -1
  174. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddRemoveOfficerDialog/index.d.ts +1 -2
  175. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddRemoveOfficerDialog/index.js +11 -24
  176. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddRemoveOfficerDialog/index.js.map +1 -1
  177. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddTransferDialog/index.d.ts +1 -2
  178. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddTransferDialog/index.js +23 -28
  179. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AddTransferDialog/index.js.map +1 -1
  180. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AllotmentItem/index.d.ts +2 -3
  181. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AllotmentItem/index.js +81 -14
  182. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AllotmentItem/index.js.map +1 -1
  183. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AllotmentList/index.d.ts +1 -2
  184. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AllotmentList/index.js +11 -15
  185. package/es/modules/self-registration/clda-form/incorporation/company-general/components/AllotmentList/index.js.map +1 -1
  186. package/es/modules/self-registration/clda-form/incorporation/company-general/components/BankOpeningContactItem/index.d.ts +2 -3
  187. package/es/modules/self-registration/clda-form/incorporation/company-general/components/BankOpeningContactItem/index.js +34 -5
  188. package/es/modules/self-registration/clda-form/incorporation/company-general/components/BankOpeningContactItem/index.js.map +1 -1
  189. package/es/modules/self-registration/clda-form/incorporation/company-general/components/BankOpeningList/index.d.ts +1 -2
  190. package/es/modules/self-registration/clda-form/incorporation/company-general/components/BankOpeningList/index.js +4 -5
  191. package/es/modules/self-registration/clda-form/incorporation/company-general/components/BankOpeningList/index.js.map +1 -1
  192. package/es/modules/self-registration/clda-form/incorporation/company-general/components/CapitalReceiptSelect/index.d.ts +1 -2
  193. package/es/modules/self-registration/clda-form/incorporation/company-general/components/CapitalReceiptSelect/index.js +5 -4
  194. package/es/modules/self-registration/clda-form/incorporation/company-general/components/CapitalReceiptSelect/index.js.map +1 -1
  195. package/es/modules/self-registration/clda-form/incorporation/company-general/components/OfficerDetailItem/index.d.ts +1 -2
  196. package/es/modules/self-registration/clda-form/incorporation/company-general/components/OfficerDetailItem/index.js +32 -12
  197. package/es/modules/self-registration/clda-form/incorporation/company-general/components/OfficerDetailItem/index.js.map +1 -1
  198. package/es/modules/self-registration/clda-form/incorporation/company-general/components/TransferItem/index.d.ts +2 -3
  199. package/es/modules/self-registration/clda-form/incorporation/company-general/components/TransferItem/index.js +80 -13
  200. package/es/modules/self-registration/clda-form/incorporation/company-general/components/TransferItem/index.js.map +1 -1
  201. package/es/modules/self-registration/clda-form/incorporation/company-general/components/TransferList/index.d.ts +1 -2
  202. package/es/modules/self-registration/clda-form/incorporation/company-general/components/TransferList/index.js +7 -9
  203. package/es/modules/self-registration/clda-form/incorporation/company-general/components/TransferList/index.js.map +1 -1
  204. package/es/modules/self-registration/clda-form/incorporation/components/FormContactEditor/index.d.ts +3 -0
  205. package/es/modules/self-registration/clda-form/incorporation/components/FormContactEditor/index.js +4 -2
  206. package/es/modules/self-registration/clda-form/incorporation/components/FormContactEditor/index.js.map +1 -1
  207. package/es/modules/self-registration/clda-form/pages/CLDAFormDefaultView/Content.js +16 -1
  208. package/es/modules/self-registration/clda-form/pages/CLDAFormDefaultView/Content.js.map +1 -1
  209. package/es/routes.d.ts +1 -1
  210. package/es/routes.js +4 -2
  211. package/es/routes.js.map +1 -1
  212. package/package.json +4 -4
@@ -1,217 +1,567 @@
1
- import { __esDecorate, __runInitializers } from "tslib";
2
- import { computed, observable } from "mobx";
3
1
  import { createContext, useContext } from "react";
4
- let State = (() => {
5
- let _instanceExtraInitializers = [];
6
- let _step_decorators;
7
- let _step_initializers = [];
8
- let _step_extraInitializers = [];
9
- let _operate_decorators;
10
- let _operate_initializers = [];
11
- let _operate_extraInitializers = [];
12
- let _unitType_decorators;
13
- let _unitType_initializers = [];
14
- let _unitType_extraInitializers = [];
15
- let _identityId_decorators;
16
- let _identityId_initializers = [];
17
- let _identityId_extraInitializers = [];
18
- let _unitId_decorators;
19
- let _unitId_initializers = [];
20
- let _unitId_extraInitializers = [];
21
- let _fistName_decorators;
22
- let _fistName_initializers = [];
23
- let _fistName_extraInitializers = [];
24
- let _lastName_decorators;
25
- let _lastName_initializers = [];
26
- let _lastName_extraInitializers = [];
27
- let _middleName_decorators;
28
- let _middleName_initializers = [];
29
- let _middleName_extraInitializers = [];
30
- let _number_decorators;
31
- let _number_initializers = [];
32
- let _number_extraInitializers = [];
33
- let _country_decorators;
34
- let _country_initializers = [];
35
- let _country_extraInitializers = [];
36
- let _type_decorators;
37
- let _type_initializers = [];
38
- let _type_extraInitializers = [];
39
- let _expiryDate_decorators;
40
- let _expiryDate_initializers = [];
41
- let _expiryDate_extraInitializers = [];
42
- let _email_decorators;
43
- let _email_initializers = [];
44
- let _email_extraInitializers = [];
45
- let _phone_decorators;
46
- let _phone_initializers = [];
47
- let _phone_extraInitializers = [];
48
- let _address_decorators;
49
- let _address_initializers = [];
50
- let _address_extraInitializers = [];
51
- let _contactList_decorators;
52
- let _contactList_initializers = [];
53
- let _contactList_extraInitializers = [];
54
- let _orderName_decorators;
55
- let _orderName_initializers = [];
56
- let _orderName_extraInitializers = [];
57
- let _tabKey_decorators;
58
- let _tabKey_initializers = [];
59
- let _tabKey_extraInitializers = [];
60
- let _loading_decorators;
61
- let _loading_initializers = [];
62
- let _loading_extraInitializers = [];
63
- let _saving_decorators;
64
- let _saving_initializers = [];
65
- let _saving_extraInitializers = [];
66
- let _get_fullName_decorators;
67
- return class State {
68
- static {
69
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
70
- _step_decorators = [observable];
71
- _operate_decorators = [observable];
72
- _unitType_decorators = [observable];
73
- _identityId_decorators = [observable];
74
- _unitId_decorators = [observable];
75
- _fistName_decorators = [observable];
76
- _lastName_decorators = [observable];
77
- _middleName_decorators = [observable];
78
- _number_decorators = [observable];
79
- _country_decorators = [observable];
80
- _type_decorators = [observable];
81
- _expiryDate_decorators = [observable];
82
- _email_decorators = [observable];
83
- _phone_decorators = [observable];
84
- _address_decorators = [observable];
85
- _contactList_decorators = [observable];
86
- _orderName_decorators = [observable];
87
- _tabKey_decorators = [observable];
88
- _loading_decorators = [observable];
89
- _saving_decorators = [observable];
90
- _get_fullName_decorators = [computed];
91
- __esDecorate(this, null, _step_decorators, { kind: "accessor", name: "step", static: false, private: false, access: { has: obj => "step" in obj, get: obj => obj.step, set: (obj, value) => { obj.step = value; } }, metadata: _metadata }, _step_initializers, _step_extraInitializers);
92
- __esDecorate(this, null, _operate_decorators, { kind: "accessor", name: "operate", static: false, private: false, access: { has: obj => "operate" in obj, get: obj => obj.operate, set: (obj, value) => { obj.operate = value; } }, metadata: _metadata }, _operate_initializers, _operate_extraInitializers);
93
- __esDecorate(this, null, _unitType_decorators, { kind: "accessor", name: "unitType", static: false, private: false, access: { has: obj => "unitType" in obj, get: obj => obj.unitType, set: (obj, value) => { obj.unitType = value; } }, metadata: _metadata }, _unitType_initializers, _unitType_extraInitializers);
94
- __esDecorate(this, null, _identityId_decorators, { kind: "accessor", name: "identityId", static: false, private: false, access: { has: obj => "identityId" in obj, get: obj => obj.identityId, set: (obj, value) => { obj.identityId = value; } }, metadata: _metadata }, _identityId_initializers, _identityId_extraInitializers);
95
- __esDecorate(this, null, _unitId_decorators, { kind: "accessor", name: "unitId", static: false, private: false, access: { has: obj => "unitId" in obj, get: obj => obj.unitId, set: (obj, value) => { obj.unitId = value; } }, metadata: _metadata }, _unitId_initializers, _unitId_extraInitializers);
96
- __esDecorate(this, null, _fistName_decorators, { kind: "accessor", name: "fistName", static: false, private: false, access: { has: obj => "fistName" in obj, get: obj => obj.fistName, set: (obj, value) => { obj.fistName = value; } }, metadata: _metadata }, _fistName_initializers, _fistName_extraInitializers);
97
- __esDecorate(this, null, _lastName_decorators, { kind: "accessor", name: "lastName", static: false, private: false, access: { has: obj => "lastName" in obj, get: obj => obj.lastName, set: (obj, value) => { obj.lastName = value; } }, metadata: _metadata }, _lastName_initializers, _lastName_extraInitializers);
98
- __esDecorate(this, null, _middleName_decorators, { kind: "accessor", name: "middleName", static: false, private: false, access: { has: obj => "middleName" in obj, get: obj => obj.middleName, set: (obj, value) => { obj.middleName = value; } }, metadata: _metadata }, _middleName_initializers, _middleName_extraInitializers);
99
- __esDecorate(this, null, _number_decorators, { kind: "accessor", name: "number", static: false, private: false, access: { has: obj => "number" in obj, get: obj => obj.number, set: (obj, value) => { obj.number = value; } }, metadata: _metadata }, _number_initializers, _number_extraInitializers);
100
- __esDecorate(this, null, _country_decorators, { kind: "accessor", name: "country", static: false, private: false, access: { has: obj => "country" in obj, get: obj => obj.country, set: (obj, value) => { obj.country = value; } }, metadata: _metadata }, _country_initializers, _country_extraInitializers);
101
- __esDecorate(this, null, _type_decorators, { kind: "accessor", name: "type", static: false, private: false, access: { has: obj => "type" in obj, get: obj => obj.type, set: (obj, value) => { obj.type = value; } }, metadata: _metadata }, _type_initializers, _type_extraInitializers);
102
- __esDecorate(this, null, _expiryDate_decorators, { kind: "accessor", name: "expiryDate", static: false, private: false, access: { has: obj => "expiryDate" in obj, get: obj => obj.expiryDate, set: (obj, value) => { obj.expiryDate = value; } }, metadata: _metadata }, _expiryDate_initializers, _expiryDate_extraInitializers);
103
- __esDecorate(this, null, _email_decorators, { kind: "accessor", name: "email", static: false, private: false, access: { has: obj => "email" in obj, get: obj => obj.email, set: (obj, value) => { obj.email = value; } }, metadata: _metadata }, _email_initializers, _email_extraInitializers);
104
- __esDecorate(this, null, _phone_decorators, { kind: "accessor", name: "phone", static: false, private: false, access: { has: obj => "phone" in obj, get: obj => obj.phone, set: (obj, value) => { obj.phone = value; } }, metadata: _metadata }, _phone_initializers, _phone_extraInitializers);
105
- __esDecorate(this, null, _address_decorators, { kind: "accessor", name: "address", static: false, private: false, access: { has: obj => "address" in obj, get: obj => obj.address, set: (obj, value) => { obj.address = value; } }, metadata: _metadata }, _address_initializers, _address_extraInitializers);
106
- __esDecorate(this, null, _contactList_decorators, { kind: "accessor", name: "contactList", static: false, private: false, access: { has: obj => "contactList" in obj, get: obj => obj.contactList, set: (obj, value) => { obj.contactList = value; } }, metadata: _metadata }, _contactList_initializers, _contactList_extraInitializers);
107
- __esDecorate(this, null, _orderName_decorators, { kind: "accessor", name: "orderName", static: false, private: false, access: { has: obj => "orderName" in obj, get: obj => obj.orderName, set: (obj, value) => { obj.orderName = value; } }, metadata: _metadata }, _orderName_initializers, _orderName_extraInitializers);
108
- __esDecorate(this, null, _tabKey_decorators, { kind: "accessor", name: "tabKey", static: false, private: false, access: { has: obj => "tabKey" in obj, get: obj => obj.tabKey, set: (obj, value) => { obj.tabKey = value; } }, metadata: _metadata }, _tabKey_initializers, _tabKey_extraInitializers);
109
- __esDecorate(this, null, _loading_decorators, { kind: "accessor", name: "loading", static: false, private: false, access: { has: obj => "loading" in obj, get: obj => obj.loading, set: (obj, value) => { obj.loading = value; } }, metadata: _metadata }, _loading_initializers, _loading_extraInitializers);
110
- __esDecorate(this, null, _saving_decorators, { kind: "accessor", name: "saving", static: false, private: false, access: { has: obj => "saving" in obj, get: obj => obj.saving, set: (obj, value) => { obj.saving = value; } }, metadata: _metadata }, _saving_initializers, _saving_extraInitializers);
111
- __esDecorate(this, null, _get_fullName_decorators, { kind: "getter", name: "fullName", static: false, private: false, access: { has: obj => "fullName" in obj, get: obj => obj.fullName }, metadata: _metadata }, null, _instanceExtraInitializers);
112
- if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2
+ import { useStore } from "zustand";
3
+ import { createStore } from "zustand/vanilla";
4
+ import { message } from "antd";
5
+ import { FIELD_LABELS, HIDABLE_FIELDS, } from "@voplus/morpho-compliance/es/components/CapturedShapeFields";
6
+ /** Fresh values when changing between search and create; errors never share an object. */
7
+ const emptyIdentityCapture = () => ({
8
+ shape: undefined,
9
+ alias: "",
10
+ issuingCountry: "",
11
+ expiryDate: undefined,
12
+ shapeErrors: {},
13
+ });
14
+ /** A fresh wizard run: the initial value of every field, and what `reset` puts back. */
15
+ const initialLegalState = () => ({
16
+ step: 1,
17
+ operate: "Search",
18
+ unitType: "Person",
19
+ identityId: "",
20
+ unitId: "",
21
+ fistName: "",
22
+ lastName: "",
23
+ middleName: "",
24
+ number: "",
25
+ country: "",
26
+ ...emptyIdentityCapture(),
27
+ email: "",
28
+ phone: "",
29
+ address: {
30
+ line1: "",
31
+ line2: "",
32
+ city: "",
33
+ state: "",
34
+ postalCode: "",
35
+ country: "",
36
+ },
37
+ contactList: [],
38
+ orderName: "Western",
39
+ tabKey: "Contact",
40
+ loading: true,
41
+ saving: false,
42
+ catalogStatus: "loading",
43
+ disclosureOpen: false,
44
+ createdOwner: null,
45
+ detailsSaved: false,
46
+ savingStep: null,
47
+ failedOperation: null,
48
+ leaveConfirmOpen: false,
49
+ });
50
+ /** The contact's display name in the picked Western or Eastern order. */
51
+ export const fullNameOf = (state) => state.orderName === "Western"
52
+ ? (state.fistName ? state.fistName + " " : "") +
53
+ (state.middleName ? state.middleName + " " : "") +
54
+ (state.lastName ? state.lastName + " " : "")
55
+ : (state.lastName ? state.lastName + " " : "") + (state.fistName ? state.fistName + " " : "");
56
+ /** The captured values projected onto the keys the shape policies are keyed by. */
57
+ export const capturedValuesOf = (state) => ({
58
+ alias: state.alias,
59
+ issuingCountry: state.issuingCountry,
60
+ expiryDate: state.expiryDate,
61
+ });
62
+ /** Whether a captured definition applies to the wizard's current owner kind. */
63
+ export const isShapeApplicableTo = (shape, unitType) => shape.subject === "Both" || shape.subject === unitType;
64
+ /**
65
+ * spec:3851 — what the identity step still needs: a picked shape (its `source` is the number the
66
+ * identity is created with), and a value for every captured field that shape's policies mark
67
+ * mandatory. A field the shape omits or leaves optional is never required.
68
+ */
69
+ export const identityStepErrorsOf = (state) => {
70
+ const errors = {};
71
+ if (!state.shape) {
72
+ errors.shape = "Identity type is required";
73
+ return errors;
74
+ }
75
+ if (!isShapeApplicableTo(state.shape, state.unitType)) {
76
+ errors.shape = `Identity type is not available for ${state.unitType.toLowerCase()} contacts`;
77
+ return errors;
78
+ }
79
+ const captured = capturedValuesOf(state);
80
+ for (const field of HIDABLE_FIELDS) {
81
+ if (state.shape.policies[field] === "mandatory" && !captured[field]?.trim())
82
+ errors[field] = `${FIELD_LABELS[field]} is required`;
83
+ }
84
+ return errors;
85
+ };
86
+ /** spec:3851 — what leaving now keeps in the contact directory, so the confirmation can say it exactly. */
87
+ export const leaveDescriptionOf = (state) => {
88
+ const name = state.createdOwner?.name ?? fullNameOf(state);
89
+ const kept = state.detailsSaved
90
+ ? `${name} and the contact details already saved for it stay in the contact directory`
91
+ : `${name} stays in the contact directory`;
92
+ return `${kept}. Its identity is still missing — you can find it there and finish it later.`;
93
+ };
94
+ /**
95
+ * The dialog state's store. A pure UI store, so it is a Zustand store and not a MobX one: every
96
+ * wizard step goes through it — the facade below for the property-shaped reads and writes the
97
+ * steps have always used, and `useLegalContext` for a re-render on each write.
98
+ */
99
+ export const createLegalStore = () => {
100
+ /** Private ownership generation: leaving, unmounting or resetting revokes any pending sequence. */
101
+ let submissionGeneration = 0;
102
+ /** spec:3851 — Detached values certified by the retained owner's last successful detail write. */
103
+ /** Raw draft baseline avoids treating server capitalization as a user rename. */
104
+ let draftNameBaseline = null;
105
+ let savedDetails = null;
106
+ return createStore()((set, get) => ({
107
+ ...initialLegalState(),
108
+ /** spec:3851 — a fresh run; the one place besides a finished identity where the retained owner is dropped. */
109
+ reset: () => {
110
+ submissionGeneration += 1;
111
+ savedDetails = null;
112
+ draftNameBaseline = null;
113
+ set(initialLegalState());
114
+ },
115
+ /** spec:3851 — Abandon result delivery without deleting the retained owner or saved details. */
116
+ invalidateSubmission: () => {
117
+ submissionGeneration += 1;
118
+ set({ saving: false, savingStep: null });
119
+ },
120
+ /** spec:3851 — the disclosure that has to be accepted before the contact is written. */
121
+ openDisclosure: () => set({ disclosureOpen: true }),
122
+ /** spec:3851 — dismissing the disclosure writes nothing, so the wizard is still on the review. */
123
+ closeDisclosure: () => set({ disclosureOpen: false }),
124
+ /** spec:3851 — leaving an unfinished contact asks first: the contact stays in the directory. */
125
+ requestLeave: () => set({ leaveConfirmOpen: true }),
126
+ /** spec:3851 — keep editing: the confirmation goes away and the wizard keeps every value for a retry. */
127
+ cancelLeave: () => set({ leaveConfirmOpen: false }),
128
+ /**
129
+ * spec:3851 — the identity step refuses to advance while the picked shape's captured mandatory
130
+ * fields are empty: what is still missing comes back (and is written to `shapeErrors`, which the
131
+ * step renders inline) and the step does not move. Only a satisfied selection advances.
132
+ */
133
+ advanceFromIdentityStep: () => {
134
+ const errors = identityStepErrorsOf(get());
135
+ set({ shapeErrors: errors });
136
+ const missing = Object.values(errors);
137
+ if (missing.length === 0)
138
+ set({ step: get().step + 1 });
139
+ return missing;
140
+ },
141
+ /**
142
+ * spec:3851 — the create sequence, in order: create owner → save entered contact details →
143
+ * create identity from that owner and the picked shape's `source`. Each write is named while
144
+ * it runs (`savingStep`), and the first one that fails is named afterwards
145
+ * (`failedOperation`) with the wizard left open on the review.
146
+ *
147
+ * A retry resumes against the retained `createdOwner` and never issues a second owner-create;
148
+ * the retained id is cleared only by a completed identity or by an explicit reset.
149
+ */
150
+ submitCreate: async (writes, onComplete) => {
151
+ if (get().saving)
152
+ return { status: "busy" };
153
+ const generation = submissionGeneration;
154
+ /** spec:3851 — Only the current review owns state writes, error messages and result delivery. */
155
+ const isCurrent = () => generation === submissionGeneration;
156
+ if (!fullNameOf(get()).trim()) {
157
+ message.warning("Name is required");
158
+ return { status: "blocked" };
159
+ }
160
+ const currentErrors = identityStepErrorsOf(get());
161
+ const blocked = Object.values(currentErrors);
162
+ const shape = get().shape;
163
+ if (!shape || blocked.length > 0) {
164
+ set({ shapeErrors: currentErrors });
165
+ message.warning(blocked[0] ?? "Identity type is required");
166
+ return { status: "blocked" };
167
+ }
168
+ /** Stop the sequence on `step`, naming it for the review to report it against the contact. */
169
+ const stop = (step, e) => {
170
+ if (!isCurrent())
171
+ return { status: "abandoned" };
172
+ set({ failedOperation: step });
173
+ message.error(e instanceof Error ? e.message : String(e));
174
+ return { status: "failed", step };
175
+ };
176
+ set({ saving: true, failedOperation: null });
177
+ try {
178
+ // spec:3851 — create the owner, unless a previous attempt already did
179
+ let owner = get().createdOwner;
180
+ if (!owner) {
181
+ set({ savingStep: "contact" });
182
+ try {
183
+ const creationName = fullNameOf(get()).trim();
184
+ const created = await writes.createOwner();
185
+ if (!isCurrent())
186
+ return { status: "abandoned" };
187
+ owner = { id: created.id, name: created.name || fullNameOf(get()) };
188
+ draftNameBaseline = creationName;
189
+ set({ createdOwner: owner });
190
+ }
191
+ catch (e) {
192
+ return stop("contact", e);
193
+ }
194
+ }
195
+ // spec:3851 — save the entered contact details onto it. `UnitStore.edit` reports a
196
+ // failure through its error callback and nowhere else, so the write it is bound to
197
+ // rejects instead of resolving: that rejection is what halts the sequence here.
198
+ const current = get();
199
+ const details = {
200
+ name: fullNameOf(current),
201
+ email: current.email,
202
+ phone: current.phone,
203
+ address: { ...current.address },
204
+ };
205
+ const addressFields = ["line1", "line2", "city", "state", "postalCode", "country"];
206
+ // spec:3851 — A prior save only certifies those values; edits require a new write on this owner.
207
+ if (!current.detailsSaved ||
208
+ !savedDetails ||
209
+ details.name !== savedDetails.name ||
210
+ details.email !== savedDetails.email ||
211
+ details.phone !== savedDetails.phone ||
212
+ addressFields.some((field) => details.address[field] !== savedDetails?.address[field])) {
213
+ set({ savingStep: "details" });
214
+ try {
215
+ const rename = details.name.trim() !== (draftNameBaseline ?? details.name.trim())
216
+ ? details.name : undefined;
217
+ await writes.saveDetails(owner.id, rename);
218
+ if (!isCurrent())
219
+ return { status: "abandoned" };
220
+ }
221
+ catch (e) {
222
+ return stop("details", e);
223
+ }
224
+ if (details.name.trim() !== (draftNameBaseline ?? details.name.trim()))
225
+ owner = { ...owner, name: details.name };
226
+ draftNameBaseline = details.name.trim();
227
+ savedDetails = details;
228
+ set({ detailsSaved: true, createdOwner: owner });
229
+ }
230
+ // spec:3851 — create the identity from the created owner and the picked shape's source
231
+ set({ savingStep: "identity" });
232
+ try {
233
+ await writes.createIdentity(owner.id, shape);
234
+ if (!isCurrent())
235
+ return { status: "abandoned" };
236
+ }
237
+ catch (e) {
238
+ return stop("identity", e);
239
+ }
240
+ // The identity exists, so the wizard is finished with this contact: the retained owner
241
+ // (and the fact that its details were saved) belongs to a retry, not to the next run.
242
+ savedDetails = null;
243
+ set({ failedOperation: null, createdOwner: null, detailsSaved: false });
244
+ // spec:3851 — Deliver the result while ownership is still current, before yielding again.
245
+ onComplete?.(owner.id);
246
+ return { status: "completed", ownerId: owner.id };
247
+ }
248
+ finally {
249
+ if (isCurrent())
250
+ set({ saving: false, savingStep: null });
251
+ }
252
+ },
253
+ }));
254
+ };
255
+ /**
256
+ * The wizard's dialog state. The state itself lives in a Zustand store (`createLegalStore`); this
257
+ * facade keeps the property-shaped reads and writes the steps have always used — `legal.email =
258
+ * value`, `legal.step += 1` — writing straight through to the store, and owns the two things that
259
+ * belong to the dialog's host rather than to the state: its props, and the callback a finished
260
+ * contact is reported to.
261
+ */
262
+ export class State {
263
+ /** The store every read and write of this dialog state goes through. */
264
+ store;
265
+ /** The dialog's host props: whether it is open, and the channel it reports back through. */
266
+ props;
267
+ /** @param store - the store to drive. The default is a whole fresh wizard, so `new State()` is one. */
268
+ constructor(store = createLegalStore()) {
269
+ this.store = store;
270
+ }
271
+ /** The current state, read for every property below. */
272
+ get snapshot() {
273
+ return this.store.getState();
274
+ }
275
+ /** step of Add Legal Contact */
276
+ get step() {
277
+ return this.snapshot.step;
278
+ }
279
+ set step(value) {
280
+ this.store.setState({ step: value });
281
+ }
282
+ /** Search an existing contact or Create a new contact */
283
+ get operate() {
284
+ return this.snapshot.operate;
285
+ }
286
+ set operate(value) {
287
+ if (value !== this.snapshot.operate) {
288
+ // spec:1807 — Changing mode must not reuse a capture admitted for the other branch.
289
+ this.store.setState({
290
+ operate: value,
291
+ ...emptyIdentityCapture(),
292
+ });
293
+ return;
113
294
  }
114
- props = __runInitializers(this, _instanceExtraInitializers);
115
- #step_accessor_storage = __runInitializers(this, _step_initializers, 1);
116
- /** step of Add Legal Contact */
117
- get step() { return this.#step_accessor_storage; }
118
- set step(value) { this.#step_accessor_storage = value; }
119
- #operate_accessor_storage = (__runInitializers(this, _step_extraInitializers), __runInitializers(this, _operate_initializers, "Search"));
120
- /** Search an existing contact or Create a new contact */
121
- get operate() { return this.#operate_accessor_storage; }
122
- set operate(value) { this.#operate_accessor_storage = value; }
123
- #unitType_accessor_storage = (__runInitializers(this, _operate_extraInitializers), __runInitializers(this, _unitType_initializers, "Person"));
124
- /** type of unit of the new officer */
125
- get unitType() { return this.#unitType_accessor_storage; }
126
- set unitType(value) { this.#unitType_accessor_storage = value; }
127
- #identityId_accessor_storage = (__runInitializers(this, _unitType_extraInitializers), __runInitializers(this, _identityId_initializers, ""));
128
- /** id of identity */
129
- get identityId() { return this.#identityId_accessor_storage; }
130
- set identityId(value) { this.#identityId_accessor_storage = value; }
131
- #unitId_accessor_storage = (__runInitializers(this, _identityId_extraInitializers), __runInitializers(this, _unitId_initializers, ""));
132
- /** id of unit of the new officer */
133
- get unitId() { return this.#unitId_accessor_storage; }
134
- set unitId(value) { this.#unitId_accessor_storage = value; }
135
- #fistName_accessor_storage = (__runInitializers(this, _unitId_extraInitializers), __runInitializers(this, _fistName_initializers, ""));
136
- /** */
137
- get fistName() { return this.#fistName_accessor_storage; }
138
- set fistName(value) { this.#fistName_accessor_storage = value; }
139
- #lastName_accessor_storage = (__runInitializers(this, _fistName_extraInitializers), __runInitializers(this, _lastName_initializers, ""));
140
- /** last name */
141
- get lastName() { return this.#lastName_accessor_storage; }
142
- set lastName(value) { this.#lastName_accessor_storage = value; }
143
- #middleName_accessor_storage = (__runInitializers(this, _lastName_extraInitializers), __runInitializers(this, _middleName_initializers, ""));
144
- /** */
145
- get middleName() { return this.#middleName_accessor_storage; }
146
- set middleName(value) { this.#middleName_accessor_storage = value; }
147
- #number_accessor_storage = (__runInitializers(this, _middleName_extraInitializers), __runInitializers(this, _number_initializers, ""));
148
- /** number of identity of the new officer */
149
- get number() { return this.#number_accessor_storage; }
150
- set number(value) { this.#number_accessor_storage = value; }
151
- #country_accessor_storage = (__runInitializers(this, _number_extraInitializers), __runInitializers(this, _country_initializers, ""));
152
- /** country of identity of the new officer */
153
- get country() { return this.#country_accessor_storage; }
154
- set country(value) { this.#country_accessor_storage = value; }
155
- #type_accessor_storage = (__runInitializers(this, _country_extraInitializers), __runInitializers(this, _type_initializers, "Passport"));
156
- /** type of identity of the new officer */
157
- get type() { return this.#type_accessor_storage; }
158
- set type(value) { this.#type_accessor_storage = value; }
159
- #expiryDate_accessor_storage = (__runInitializers(this, _type_extraInitializers), __runInitializers(this, _expiryDate_initializers, void 0));
160
- /** expiryDate of identity(Passport required) */
161
- get expiryDate() { return this.#expiryDate_accessor_storage; }
162
- set expiryDate(value) { this.#expiryDate_accessor_storage = value; }
163
- #email_accessor_storage = (__runInitializers(this, _expiryDate_extraInitializers), __runInitializers(this, _email_initializers, ""));
164
- /** email of unit of the new officer */
165
- get email() { return this.#email_accessor_storage; }
166
- set email(value) { this.#email_accessor_storage = value; }
167
- #phone_accessor_storage = (__runInitializers(this, _email_extraInitializers), __runInitializers(this, _phone_initializers, ""));
168
- /** phone of unit of the new officer */
169
- get phone() { return this.#phone_accessor_storage; }
170
- set phone(value) { this.#phone_accessor_storage = value; }
171
- #address_accessor_storage = (__runInitializers(this, _phone_extraInitializers), __runInitializers(this, _address_initializers, {
172
- line1: "",
173
- line2: "",
174
- city: "",
175
- state: "",
176
- postalCode: "",
177
- country: "",
178
- }));
179
- /** address of unit of the new officer */
180
- get address() { return this.#address_accessor_storage; }
181
- set address(value) { this.#address_accessor_storage = value; }
182
- #contactList_accessor_storage = (__runInitializers(this, _address_extraInitializers), __runInitializers(this, _contactList_initializers, []));
183
- /** list of unit */
184
- get contactList() { return this.#contactList_accessor_storage; }
185
- set contactList(value) { this.#contactList_accessor_storage = value; }
186
- #orderName_accessor_storage = (__runInitializers(this, _contactList_extraInitializers), __runInitializers(this, _orderName_initializers, "Western"));
187
- /** order name by Western or Eastern */
188
- get orderName() { return this.#orderName_accessor_storage; }
189
- set orderName(value) { this.#orderName_accessor_storage = value; }
190
- #tabKey_accessor_storage = (__runInitializers(this, _orderName_extraInitializers), __runInitializers(this, _tabKey_initializers, "Contact"));
191
- /** key of tabPane of Page4 */
192
- get tabKey() { return this.#tabKey_accessor_storage; }
193
- set tabKey(value) { this.#tabKey_accessor_storage = value; }
194
- #loading_accessor_storage = (__runInitializers(this, _tabKey_extraInitializers), __runInitializers(this, _loading_initializers, true));
195
- /** loading of load identity list */
196
- get loading() { return this.#loading_accessor_storage; }
197
- set loading(value) { this.#loading_accessor_storage = value; }
198
- #saving_accessor_storage = (__runInitializers(this, _loading_extraInitializers), __runInitializers(this, _saving_initializers, false));
199
- /** loading of save identity item */
200
- get saving() { return this.#saving_accessor_storage; }
201
- set saving(value) { this.#saving_accessor_storage = value; }
202
- get fullName() {
203
- return this.orderName === "Western"
204
- ? (this.fistName ? this.fistName + " " : "") +
205
- (this.middleName ? this.middleName + " " : "") +
206
- (this.lastName ? this.lastName + " " : "")
207
- : (this.lastName ? this.lastName + " " : "") + (this.fistName ? this.fistName + " " : "");
295
+ this.store.setState({ operate: value });
296
+ }
297
+ /** type of unit of the new officer */
298
+ get unitType() {
299
+ return this.snapshot.unitType;
300
+ }
301
+ set unitType(value) {
302
+ // spec:3851 — A retained owner's kind cannot change; a pre-create incompatible capture is reset.
303
+ if (this.snapshot.createdOwner)
304
+ return;
305
+ const shape = this.snapshot.shape;
306
+ if (shape && !isShapeApplicableTo(shape, value)) {
307
+ this.store.setState({
308
+ unitType: value,
309
+ ...emptyIdentityCapture(),
310
+ });
311
+ return;
208
312
  }
209
- constructor() {
210
- __runInitializers(this, _saving_extraInitializers);
313
+ this.store.setState({ unitType: value });
314
+ }
315
+ /** id of identity */
316
+ get identityId() {
317
+ return this.snapshot.identityId;
318
+ }
319
+ set identityId(value) {
320
+ this.store.setState({ identityId: value });
321
+ }
322
+ /** id of unit of the new officer */
323
+ get unitId() {
324
+ return this.snapshot.unitId;
325
+ }
326
+ set unitId(value) {
327
+ this.store.setState({ unitId: value });
328
+ }
329
+ /** */
330
+ get fistName() {
331
+ return this.snapshot.fistName;
332
+ }
333
+ set fistName(value) {
334
+ this.store.setState({ fistName: value });
335
+ }
336
+ /** last name */
337
+ get lastName() {
338
+ return this.snapshot.lastName;
339
+ }
340
+ set lastName(value) {
341
+ this.store.setState({ lastName: value });
342
+ }
343
+ /** */
344
+ get middleName() {
345
+ return this.snapshot.middleName;
346
+ }
347
+ set middleName(value) {
348
+ this.store.setState({ middleName: value });
349
+ }
350
+ /** number of identity of the new officer */
351
+ get number() {
352
+ return this.snapshot.number;
353
+ }
354
+ set number(value) {
355
+ this.store.setState({ number: value });
356
+ }
357
+ /** country of identity of the new officer */
358
+ get country() {
359
+ return this.snapshot.country;
360
+ }
361
+ set country(value) {
362
+ this.store.setState({ country: value });
363
+ }
364
+ /** issuing country captured under the picked shape's policy */
365
+ get issuingCountry() {
366
+ return this.snapshot.issuingCountry;
367
+ }
368
+ set issuingCountry(value) {
369
+ this.store.setState({ issuingCountry: value });
370
+ }
371
+ /** alias captured under the picked shape's policy */
372
+ get alias() {
373
+ return this.snapshot.alias;
374
+ }
375
+ set alias(value) {
376
+ this.store.setState({ alias: value });
377
+ }
378
+ /** expiryDate of identity of the new officer, when the picked shape captures it */
379
+ get expiryDate() {
380
+ return this.snapshot.expiryDate;
381
+ }
382
+ set expiryDate(value) {
383
+ this.store.setState({ expiryDate: value });
384
+ }
385
+ /** email of unit of the new officer */
386
+ get email() {
387
+ return this.snapshot.email;
388
+ }
389
+ set email(value) {
390
+ this.store.setState({ email: value });
391
+ }
392
+ /** phone of unit of the new officer */
393
+ get phone() {
394
+ return this.snapshot.phone;
395
+ }
396
+ set phone(value) {
397
+ this.store.setState({ phone: value });
398
+ }
399
+ /** address of unit of the new officer */
400
+ get address() {
401
+ return this.snapshot.address;
402
+ }
403
+ set address(value) {
404
+ this.store.setState({ address: value });
405
+ }
406
+ /** list of unit */
407
+ get contactList() {
408
+ return this.snapshot.contactList;
409
+ }
410
+ set contactList(value) {
411
+ this.store.setState({ contactList: value });
412
+ }
413
+ /** order name by Western or Eastern */
414
+ get orderName() {
415
+ return this.snapshot.orderName;
416
+ }
417
+ set orderName(value) {
418
+ this.store.setState({ orderName: value });
419
+ }
420
+ /** key of tabPane of Page4 */
421
+ get tabKey() {
422
+ return this.snapshot.tabKey;
423
+ }
424
+ set tabKey(value) {
425
+ this.store.setState({ tabKey: value });
426
+ }
427
+ /** loading of load identity list */
428
+ get loading() {
429
+ return this.snapshot.loading;
430
+ }
431
+ set loading(value) {
432
+ this.store.setState({ loading: value });
433
+ }
434
+ /** loading of save identity item, and of the create sequence while it runs */
435
+ get saving() {
436
+ return this.snapshot.saving;
437
+ }
438
+ set saving(value) {
439
+ this.store.setState({ saving: value });
440
+ }
441
+ /** the shape picked for the new identity — its `source` is the number the identity is created with */
442
+ get shape() {
443
+ return this.snapshot.shape;
444
+ }
445
+ set shape(value) {
446
+ this.store.setState({ shape: value });
447
+ }
448
+ /** spec:3717 — the picker's catalog status; the identity step is blocked until it is "ready". */
449
+ get catalogStatus() {
450
+ return this.snapshot.catalogStatus;
451
+ }
452
+ set catalogStatus(value) {
453
+ this.store.setState({ catalogStatus: value });
454
+ }
455
+ /** spec:3713 — the identity-step messages a blocked step shows for the picked shape's policies. */
456
+ get shapeErrors() {
457
+ return this.snapshot.shapeErrors;
458
+ }
459
+ set shapeErrors(value) {
460
+ this.store.setState({ shapeErrors: value });
461
+ }
462
+ /** spec:3851 — the pre-create disclosure the user accepts before the contact is written. */
463
+ get disclosureOpen() {
464
+ return this.snapshot.disclosureOpen;
465
+ }
466
+ set disclosureOpen(value) {
467
+ this.store.setState({ disclosureOpen: value });
468
+ }
469
+ /** spec:3851 — the owner the create sequence already created; a retry reuses it. */
470
+ get createdOwner() {
471
+ return this.snapshot.createdOwner;
472
+ }
473
+ set createdOwner(value) {
474
+ this.store.setState({ createdOwner: value });
475
+ }
476
+ /** spec:3851 — whether the entered contact details were saved onto the created owner. */
477
+ get detailsSaved() {
478
+ return this.snapshot.detailsSaved;
479
+ }
480
+ set detailsSaved(value) {
481
+ this.store.setState({ detailsSaved: value });
482
+ }
483
+ /** spec:3851 — the step of the create sequence in flight, named while it runs. */
484
+ get savingStep() {
485
+ return this.snapshot.savingStep;
486
+ }
487
+ set savingStep(value) {
488
+ this.store.setState({ savingStep: value });
489
+ }
490
+ /** spec:3851 — the step that failed after the owner was created; the wizard stays open. */
491
+ get failedOperation() {
492
+ return this.snapshot.failedOperation;
493
+ }
494
+ set failedOperation(value) {
495
+ this.store.setState({ failedOperation: value });
496
+ }
497
+ /** spec:3851 — the confirmation shown when the user tries to leave an unfinished contact. */
498
+ get leaveConfirmOpen() {
499
+ return this.snapshot.leaveConfirmOpen;
500
+ }
501
+ set leaveConfirmOpen(value) {
502
+ this.store.setState({ leaveConfirmOpen: value });
503
+ }
504
+ /** The contact's display name in the picked Western or Eastern order. */
505
+ get fullName() {
506
+ return fullNameOf(this.snapshot);
507
+ }
508
+ /** The captured values projected onto the keys the shape policies are keyed by. */
509
+ get capturedValues() {
510
+ return capturedValuesOf(this.snapshot);
511
+ }
512
+ /** What leaving now keeps in the contact directory, so the confirmation can say it exactly. */
513
+ get leaveDescription() {
514
+ return leaveDescriptionOf(this.snapshot);
515
+ }
516
+ /** Start a fresh wizard run. */
517
+ reset = () => this.snapshot.reset();
518
+ /** spec:3851 — Revoke an abandoned review's pending result without discarding saved directory data. */
519
+ invalidateSubmission = () => this.snapshot.invalidateSubmission();
520
+ /** Open the pre-create disclosure. */
521
+ openDisclosure = () => this.snapshot.openDisclosure();
522
+ /** Dismiss the pre-create disclosure without writing anything. */
523
+ closeDisclosure = () => this.snapshot.closeDisclosure();
524
+ /** spec:3851 — ask to leave: with nothing created the dialog just closes, with a contact
525
+ * already created the user confirms first, because that contact stays in the directory. */
526
+ requestLeave = () => {
527
+ if (!this.snapshot.createdOwner) {
528
+ this.leave();
529
+ return;
211
530
  }
531
+ this.snapshot.requestLeave();
212
532
  };
213
- })();
214
- export { State };
533
+ /** spec:3851 — keep editing: drop the leave confirmation so the wizard stays open for a retry. */
534
+ cancelLeave = () => this.snapshot.cancelLeave();
535
+ /** spec:3851 — leave the unfinished contact behind: it stays in the directory with whatever was
536
+ * saved for it, and no identity is selected for the calling workflow. */
537
+ leave = () => {
538
+ this.invalidateSubmission();
539
+ this.snapshot.cancelLeave();
540
+ this.props?.updateVisible?.();
541
+ };
542
+ /** spec:3851 — gate the identity step on the picked shape's captured-field policies. */
543
+ advanceFromIdentityStep = () => this.snapshot.advanceFromIdentityStep();
544
+ /**
545
+ * spec:3851 — run the ordered create sequence, then report a finished contact back through the
546
+ * dialog's own result channel. Only a created identity advances the calling workflow; a contact
547
+ * left behind by a failure or by leaving is never reported as a selection.
548
+ */
549
+ submitCreate = async (writes) => {
550
+ const updateVisible = this.props?.updateVisible;
551
+ return this.snapshot.submitCreate(writes, (ownerId) => {
552
+ void updateVisible?.(ownerId);
553
+ });
554
+ };
555
+ }
215
556
  export const LegalContext = createContext(null);
216
- export const useLegalContext = () => useContext(LegalContext);
557
+ /**
558
+ * The dialog state for the calling step. The same hook subscribes the step to every write of that
559
+ * state, so a step re-renders when the wizard advances, when the shape catalog answers, or when a
560
+ * create sequence reports the step it is on — no observable wrapper required.
561
+ */
562
+ export const useLegalContext = () => {
563
+ const state = useContext(LegalContext);
564
+ useStore(state.store, (snapshot) => snapshot);
565
+ return state;
566
+ };
217
567
  //# sourceMappingURL=state.js.map