@tesouro/embedded-components-react 0.7.73 → 0.8.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 (69) hide show
  1. package/README.md +14 -17
  2. package/dist/index.css +18 -17
  3. package/dist/index.d.ts +178 -49
  4. package/dist/index.js +51 -50
  5. package/dist/lib/BankAccountOnboardingWidget.d.ts +178 -49
  6. package/dist/lib/BankAccountOnboardingWidget.js +8 -7
  7. package/dist/lib/WidgetSuite.d.ts +177 -48
  8. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index.js +5 -4
  9. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/AdditionalOwnersStep.js +131 -96
  10. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/BankAccountOnboardingWidget.js +509 -496
  11. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/BusinessDetailsStep.js +47 -78
  12. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/PersonalDetailsStep.js +47 -49
  13. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/ReviewStep.js +103 -0
  14. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/TermsStep.js +35 -0
  15. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/additionalOwnerDraft.js +49 -28
  16. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/apiMapping.js +35 -42
  17. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/applicationStatusView.js +2 -3
  18. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/buildOnboardingPrefill.js +4 -10
  19. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/businessDetailsPanelMapping.js +4 -2
  20. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/draftApplicationMapping.js +3 -3
  21. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/fieldInput/formatPhoneNumberInput.js +6 -2
  22. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/fieldInput/maxBirthDate.js +4 -1
  23. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/labels.js +22 -9
  24. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/personalDetailsPanelMapping.js +8 -5
  25. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/stepSchemas.js +59 -60
  26. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/testIds.js +17 -9
  27. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index.js +19 -18
  28. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index10.js +344 -6
  29. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index11.js +59 -58
  30. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index12.js +40 -33
  31. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index13.js +7 -40
  32. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index14.js +57 -37
  33. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index15.js +30 -93
  34. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index16.js +40 -12
  35. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index17.js +36 -269
  36. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index18.js +93 -25
  37. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index19.js +10 -19
  38. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index2.js +61 -78
  39. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index20.js +270 -61
  40. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index21.js +25 -338
  41. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index22.js +23 -29
  42. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index23.js +53 -26
  43. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index24.js +342 -66
  44. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index25.js +26 -82
  45. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index26.js +27 -6
  46. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index27.js +56 -54
  47. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index28.js +123 -9
  48. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index29.js +5 -62
  49. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index30.js +82 -0
  50. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index31.js +11 -0
  51. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index32.js +64 -0
  52. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index4.js +256 -311
  53. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index5.js +81 -2
  54. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index6.js +83 -53
  55. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index7.js +2 -147
  56. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index8.js +69 -46
  57. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index9.js +5 -35
  58. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/labels.js +1 -2
  59. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/policyViewModel.js +8 -9
  60. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApprovalPolicyRules.js +127 -141
  61. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/util/dist/lib/validatePolicyDraft.js +1 -1
  62. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  63. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +4 -4
  64. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/OnboardingShell.js +122 -165
  65. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/OnboardingShellOverlayPortal.js +12 -27
  66. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/labels.js +0 -1
  67. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/WidgetSuite.js +0 -1
  68. package/dist/packages/shared-ui-shadcn/dist/index.js +81 -23
  69. package/package.json +1 -1
@@ -339,6 +339,48 @@ type EmbeddedClient = Client;
339
339
  type ExtractLiterals<T> = T extends string ? string extends T ? never : T : never;
340
340
  type BaseUrl = ExtractLiterals<ClientOptions['baseUrl']>;
341
341
 
342
+ /**
343
+ * Why the onboarding entry point is hidden from the signed-in user.
344
+ *
345
+ * Offer and bank-account onboarding both self-suppress from this, and
346
+ * "nothing rendered" is indistinguishable between the reasons from the outside
347
+ * — which makes a support question ("why doesn't this user see onboarding?")
348
+ * unanswerable without a signal. Every onboarding suppression therefore emits
349
+ * its reason (analytics event + `console.debug`), so the answer is a query
350
+ * rather than a guess.
351
+ */
352
+ declare const OnboardingSuppressionReason: {
353
+ /** This user already has an account: their own widget-init status is ACTIVE or INACTIVE. */
354
+ readonly UserAlreadyOnboarded: "user_already_onboarded";
355
+ /**
356
+ * This user was invited to an organization that already exists (widget-init
357
+ * status INVITED), so the business is not theirs to apply for. Kept separate
358
+ * from `UserAlreadyOnboarded` because it is not true that they are onboarded —
359
+ * their account is pending disclosure acceptance — and conflating the two
360
+ * would misreport why onboarding is hidden.
361
+ */
362
+ readonly UserInvitedToOrganization: "user_invited_to_organization";
363
+ /** The organization's bank-account application is COMPLETE — the business is onboarded. */
364
+ readonly OrganizationApplicationComplete: "organization_application_complete";
365
+ /**
366
+ * Another member of the organization has a bank-account application in
367
+ * progress. The backend allows one application per organization, so a
368
+ * colleague must not start a second one.
369
+ */
370
+ readonly OrganizationApplicationStartedByOther: "organization_application_started_by_other";
371
+ /**
372
+ * The organization's bank-account application was denied more than 30 days
373
+ * ago, so the denial notice has stopped showing (EMBD-6174).
374
+ */
375
+ readonly OrganizationApplicationDenialExpired: "organization_application_denial_expired";
376
+ /**
377
+ * The organization's bank-account application is in a status this widget
378
+ * has no copy for, so it hides rather than offer a second application.
379
+ */
380
+ readonly OrganizationApplicationStatusUnrecognized: "organization_application_status_unrecognized";
381
+ };
382
+ type OnboardingSuppressionReason = (typeof OnboardingSuppressionReason)[keyof typeof OnboardingSuppressionReason];
383
+
342
384
  type LinkComponentProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
343
385
  children?: ReactNode;
344
386
  };
@@ -780,6 +822,13 @@ interface AdditionalOwner {
780
822
  mobilePhoneNumber: string;
781
823
  ownsOver25Percent: boolean | null;
782
824
  ownershipPercentage: number | null;
825
+ /**
826
+ * Client-only, never sent. False (or absent) for an owner the application
827
+ * prefilled from what the API already holds: the applicant has to read it
828
+ * back and confirm it before the step can continue. Entering or editing an
829
+ * owner sets it, since the applicant has then seen every field.
830
+ */
831
+ reviewed?: boolean;
783
832
  }
784
833
 
785
834
  /**
@@ -799,11 +848,44 @@ interface DisclosureLinks {
799
848
  interface AdditionalOwnersLabels {
800
849
  heading: string;
801
850
  subheading: string;
851
+ /** Replaces `subheading` while nobody is listed, beside the empty state. */
852
+ emptySubheading: string;
853
+ /** The owners section title on the Review step. */
854
+ reviewSectionTitle: string;
802
855
  primaryOwnerShareLabel: string;
856
+ /** Empty-state title, shown while nobody is listed. */
803
857
  emptyOwnersText: string;
858
+ /** The empty state's own add button, which stands in for `addOwner`. */
859
+ emptyOwnersAddOwner: string;
804
860
  addOwner: string;
805
861
  edit: string;
862
+ /** Replaces the edit icon on an owner row whose details are incomplete. */
863
+ completeDetails: string;
806
864
  remove: string;
865
+ /** The applicant's own row: they are removed from the Personal step instead. */
866
+ removePrimaryOwnerDisabled: string;
867
+ /** The applicant's own row: their details are edited on the Personal step. */
868
+ editPrimaryOwnerDisabled: string;
869
+ /** Hover/focus tooltip on the applicant's disabled pencil: where to edit. */
870
+ editPrimaryOwnerTooltip: string;
871
+ /** Hover/focus tooltip on the applicant's disabled trash: why it is locked. */
872
+ removePrimaryOwnerTooltip: string;
873
+ /** Opens the read-only review of an owner the applicant has not confirmed. */
874
+ startReview: string;
875
+ deleteOwner: string;
876
+ editOwner: string;
877
+ confirmDetails: string;
878
+ /** Screen-reader text for each row's status icon. */
879
+ statusComplete: string;
880
+ statusMissing: string;
881
+ statusUnreviewed: string;
882
+ inlineEditHeadingTemplate: (name: string) => string;
883
+ missingFieldsAlert: string;
884
+ allFieldsRequiredNote: string;
885
+ reviewDateOfBirth: string;
886
+ reviewSsn: string;
887
+ reviewPhone: string;
888
+ reviewHomeAddress: string;
807
889
  cancel: string;
808
890
  save: string;
809
891
  close: string;
@@ -813,12 +895,19 @@ interface AdditionalOwnersLabels {
813
895
  ownerShareColumn: string;
814
896
  ownerActionsColumn: string;
815
897
  formHeadingAdd: string;
898
+ /**
899
+ * @deprecated Unused since a saved owner is edited in its own row, under
900
+ * `inlineEditHeadingTemplate`. Kept so existing overrides still type-check.
901
+ */
816
902
  formHeadingEdit: string;
817
903
  firstName: string;
818
904
  lastName: string;
819
905
  dateOfBirth: string;
820
906
  dateOfBirthPlaceholder: string;
821
- dateOfBirthMinAgeError: string;
907
+ /** Shown under the date of birth field until it has an error. */
908
+ dateOfBirthHint: string;
909
+ /** A complete date that cannot be a birth date: in the future, or before 1900. */
910
+ dateOfBirthInvalidError: string;
822
911
  ssn: string;
823
912
  /** Shown when an SSN is already stored and need not be retyped. */
824
913
  ssnOnFileTemplate: (last4: string) => string;
@@ -843,6 +932,8 @@ interface AdditionalOwnersLabels {
843
932
  invalidFieldError: string;
844
933
  /** Shown on an owners-list row whose saved details are incomplete or invalid. */
845
934
  ownerIncompleteError: string;
935
+ /** Shown above the owner table when Next is pressed with the owner editor open. */
936
+ ownerEditorOpenError: string;
846
937
  /** Required-field marker appended to field labels (e.g. ` *`). */
847
938
  requiredFieldMarker: string;
848
939
  /** Suffix shown after ownership percentage inputs (e.g. `%`). */
@@ -858,6 +949,10 @@ interface AdditionalOwnersLabels {
858
949
  interface BusinessDetailsLabels {
859
950
  heading: string;
860
951
  subheading: string;
952
+ /** Shown at the top of the edit form, explaining `requiredFieldMarker`. */
953
+ requiredFieldsNote: string;
954
+ /** Appended to each required field's label. */
955
+ requiredFieldMarker: string;
861
956
  companyLegalName: string;
862
957
  companyDbaName: string;
863
958
  businessAddress: string;
@@ -885,6 +980,11 @@ interface BusinessDetailsLabels {
885
980
  isAuthorizedQuestion: string;
886
981
  isAuthorizedYes: string;
887
982
  isAuthorizedNo: string;
983
+ /** Heading above the attestation checkboxes on the terms step. */
984
+ disclosuresHeading: string;
985
+ disclosuresSubheading: string;
986
+ /** Bold lead-in naming the disclosure checkbox, before its agreement copy. */
987
+ disclosureAgreementLead: string;
888
988
  /** Use `{bankName}` for the sponsoring bank (e.g. "Zenith Bank"). */
889
989
  acceptDisclosuresPrefix: string;
890
990
  termsOfUse: string;
@@ -894,6 +994,8 @@ interface BusinessDetailsLabels {
894
994
  electronicCommunication: string;
895
995
  acceptDisclosuresAfterElectronic: string;
896
996
  patriotAct: string;
997
+ /** Shown under an unticked attestation once Next has been pressed. */
998
+ consentRequiredError: string;
897
999
  companyStructureOptions: Record<'CORPORATION_PUBLIC' | 'CORPORATION_PRIVATE' | 'CORPORATION_NOT_FOR_PROFIT' | 'LLC' | 'LLP' | 'PARTNERSHIP' | 'SOLE_PROPRIETORSHIP' | 'GOVERNMENT' | 'COOPERATIVE' | 'ASSOCIATION' | 'OTHER', string>;
898
1000
  naicsTitles?: Record<string, string>;
899
1001
  stateTitles?: Partial<Record<USStateAbbreviation, string>>;
@@ -902,10 +1004,18 @@ interface BusinessDetailsLabels {
902
1004
  interface PersonalDetailsLabels {
903
1005
  heading: string;
904
1006
  subheading: string;
1007
+ /** Shown at the top of the edit form, explaining `requiredFieldMarker`. */
1008
+ requiredFieldsNote: string;
1009
+ /** Appended to each required field's label. */
1010
+ requiredFieldMarker: string;
905
1011
  firstName: string;
906
1012
  lastName: string;
907
1013
  dateOfBirth: string;
908
1014
  dateOfBirthPlaceholder: string;
1015
+ /** Shown under the date of birth field until it has an error. */
1016
+ dateOfBirthHint: string;
1017
+ /** A complete date that cannot be a birth date: in the future, or before 1900. */
1018
+ dateOfBirthInvalidError: string;
909
1019
  dateOfBirthMinAgeError: string;
910
1020
  ssn: string;
911
1021
  /** Shown when an SSN is already stored and need not be retyped. */
@@ -953,15 +1063,11 @@ interface ResultLabels {
953
1063
  fdicDisclaimer: string;
954
1064
  }
955
1065
 
956
- interface UnsavedApplicationDialogLabels {
957
- title: string;
958
- description: string;
959
- /** Saves the work in progress as a draft, then closes onboarding. */
960
- saveDraftButton: string;
961
- /** Closes onboarding and throws the unsaved edits away. */
962
- discardButton: string;
963
- /** Screen-reader name for the corner close control; returns to the form. */
964
- closeButton: string;
1066
+ interface ApplicationReviewLabels {
1067
+ /** Visible text of each section's edit button. */
1068
+ editButton: string;
1069
+ /** Shown in a section that has no rows to list (e.g. no other owners). */
1070
+ emptySection: string;
965
1071
  }
966
1072
 
967
1073
  interface DeleteApplicationDialogLabels {
@@ -1017,8 +1123,6 @@ interface ApplicationStatusLabels {
1017
1123
  title: string;
1018
1124
  /** Sponsor line opposite the title. Use `{bankName}` for the bank. */
1019
1125
  bankDisclosure: string;
1020
- /** Screen-reader name of the dialog's close control, in modal mode. */
1021
- close: string;
1022
1126
  /**
1023
1127
  * The re-check control under the card, shown only when the host opts in with
1024
1128
  * `showApplicationStatusRefresh`.
@@ -1042,26 +1146,45 @@ interface ApplicationStatusLabels {
1042
1146
  unavailable: ApplicationStatusNoticeLabels;
1043
1147
  }
1044
1148
  interface BankAccountOnboardingWidgetLabels {
1149
+ /** In flow order (EMBD-5910): personal, business and owners, review, terms. */
1045
1150
  stepIndicator: {
1046
- business: string;
1047
1151
  personal: string;
1048
- ownership: string;
1152
+ business: string;
1153
+ review: string;
1154
+ terms: string;
1049
1155
  done: string;
1050
1156
  };
1051
1157
  businessDetails: PartialDeep<BusinessDetailsLabels>;
1052
1158
  personalDetails: Partial<PersonalDetailsLabels>;
1053
1159
  additionalOwners: Partial<AdditionalOwnersLabels>;
1160
+ /** The review step's summary cards. Section titles reuse each step's own. */
1161
+ applicationReview: Partial<ApplicationReviewLabels>;
1054
1162
  result: ResultLabels;
1055
- /** The prompt shown when closing with unsaved changes. */
1056
- unsavedApplicationDialog: Partial<UnsavedApplicationDialogLabels>;
1057
1163
  /**
1058
- * The prompt confirming "Delete". Its bold run
1164
+ * The prompt confirming "Delete application". Its bold run
1059
1165
  * defaults to `saveAndClose`, so it names the footer's save control.
1060
1166
  */
1061
1167
  deleteApplicationDialog: Partial<DeleteApplicationDialogLabels>;
1168
+ /** Visible text of the footer's Back control on every step. */
1062
1169
  back: string;
1063
- cancel: string;
1064
- next: string;
1170
+ /**
1171
+ * The footer's Next control, naming the step it leads to. Keyed by the step
1172
+ * Next lands on; the terms step shows `submit` instead.
1173
+ */
1174
+ nextToStep: {
1175
+ business: string;
1176
+ review: string;
1177
+ terms: string;
1178
+ };
1179
+ /**
1180
+ * The Back control's accessible name, naming the step it returns to. Its
1181
+ * visible text stays `back`. Keyed by the step Back lands on.
1182
+ */
1183
+ backToStepAriaLabel: {
1184
+ personal: string;
1185
+ business: string;
1186
+ review: string;
1187
+ };
1065
1188
  submit: string;
1066
1189
  saveAndClose: string;
1067
1190
  /** The destructive footer control that opens the delete prompt. */
@@ -1074,8 +1197,14 @@ interface BankAccountOnboardingWidgetLabels {
1074
1197
  businessReviewSubtitle: string;
1075
1198
  personalReviewTitle: string;
1076
1199
  personalReviewSubtitle: string;
1077
- /** Accessible title for the onboarding modal. */
1078
- modalTitle: string;
1200
+ reviewTitle: string;
1201
+ reviewSubtitle: string;
1202
+ /** Names the review step's owners edit button for assistive tech. */
1203
+ reviewOwnersEditAriaLabel: string;
1204
+ termsTitle: string;
1205
+ termsSubtitle: string;
1206
+ /** Shown when Next is pressed while an owner still needs reviewing. */
1207
+ ownersNeedReviewError: string;
1079
1208
  /** Shown when submitting the application fails. */
1080
1209
  submitFailedError: string;
1081
1210
  /** Shown when saving the application fails. */
@@ -1110,6 +1239,33 @@ type HostSuppliedOwner = Omit<AdditionalOwner, StoredIdentifierMarker | 'id'>;
1110
1239
  interface BankAccountOnboardingWidgetInnerProps {
1111
1240
  onEmbeddedOnboardingCompletedSuccessfully: () => void;
1112
1241
  onNavigateToDashboard: () => void;
1242
+ /**
1243
+ * Notified once the widget determines it will render nothing, with why. A
1244
+ * host that mounts this widget based on its own copy of the same status (to
1245
+ * avoid a network round trip per widget instance, say) can end up
1246
+ * disagreeing with the widget's own live check — its request could still be
1247
+ * in flight, retrying, or have failed independently. This is the widget's
1248
+ * own resolution of "should I show anything, and why", so a host can use it
1249
+ * to swap to its real content instead of leaving this widget's empty render
1250
+ * in place.
1251
+ *
1252
+ * Only two reasons mean an account is provisioned, which matters for a host
1253
+ * deciding whether to also unlock account-scoped navigation:
1254
+ * - `UserAlreadyOnboarded`: the signed-in user already has an account.
1255
+ * - `OrganizationApplicationComplete`: the organization's application is
1256
+ * complete.
1257
+ *
1258
+ * The rest mean no account yet:
1259
+ * - `UserInvitedToOrganization`: invited to an organization that has an
1260
+ * account, but has not yet accepted its disclosures.
1261
+ * - `OrganizationApplicationStartedByOther`: another member's application is
1262
+ * still in flight.
1263
+ * - `OrganizationApplicationDenialExpired`: the application was denied more
1264
+ * than 30 days ago.
1265
+ * - `OrganizationApplicationStatusUnrecognized`: the application has a status
1266
+ * the widget does not recognize.
1267
+ */
1268
+ onSuppressed?: (reason: OnboardingSuppressionReason) => void;
1113
1269
  labels?: PartialDeep<BankAccountOnboardingWidgetLabels>;
1114
1270
  initialBusinessDetails?: Partial<BusinessDetailsValues>;
1115
1271
  initialPersonalDetails?: Partial<PersonalDetailsValues>;
@@ -1150,33 +1306,6 @@ interface BankAccountOnboardingWidgetInnerProps {
1150
1306
  * The published widget does not look up white-label/bank maps itself.
1151
1307
  */
1152
1308
  disclosureLinks?: DisclosureLinks;
1153
- /**
1154
- * Controlled open state for the onboarding modal. When provided, the host
1155
- * application owns the open/close state and must update it via
1156
- * `onOpenChange`. Defaults to uncontrolled mode (`defaultOpen` is honoured).
1157
- */
1158
- open?: boolean;
1159
- /**
1160
- * Initial open state when uncontrolled. Defaults to `false` so the onboarding
1161
- * modal stays hidden until the host opens it.
1162
- */
1163
- defaultOpen?: boolean;
1164
- /**
1165
- * Notified whenever the modal opens or closes — both from internal gestures
1166
- * (overlay click, escape key, close button) and external state updates.
1167
- * Also fires in uncontrolled mode (`open` omitted) so hosts can run analytics
1168
- * or other side effects without owning the open state.
1169
- */
1170
- onOpenChange?: (open: boolean) => void;
1171
- /**
1172
- * Renders the widget inline — filling the width/height of its host
1173
- * container — instead of in a modal dialog. `open`/`defaultOpen` play no
1174
- * part in whether the widget's content is shown in this mode; the widget
1175
- * always renders once mounted, and the host controls mounting instead.
1176
- * `onOpenChange` still fires for gestures like Cancel, so hosts can react
1177
- * to them (e.g. by unmounting the widget).
1178
- */
1179
- isFullScreenInline?: boolean;
1180
1309
  /**
1181
1310
  * Puts a "Check again" control under the application status card, which
1182
1311
  * re-reads the organization's application.
@@ -1,4 +1,5 @@
1
- import { APPLICATION_STATUS_LABELS_EN as e } from "./lib/BankAccountOnboardingWidget/labels.js";
2
- import { OnboardingApplicationView as t, onboardingApplicationViewFor as n } from "./lib/BankAccountOnboardingWidget/applicationStatusView.js";
3
- import { BankAccountOnboardingWidget as r } from "./lib/BankAccountOnboardingWidget/BankAccountOnboardingWidget.js";
4
- export { e as APPLICATION_STATUS_LABELS_EN, r as BankAccountOnboardingWidget, t as OnboardingApplicationView, n as onboardingApplicationViewFor };
1
+ import { OnboardingSuppressionReason as e } from "../../../shared/data-access/dist/lib/onboardingSuppressionReason.js";
2
+ import { APPLICATION_STATUS_LABELS_EN as t } from "./lib/BankAccountOnboardingWidget/labels.js";
3
+ import { OnboardingApplicationView as n, onboardingApplicationViewFor as r } from "./lib/BankAccountOnboardingWidget/applicationStatusView.js";
4
+ import { BankAccountOnboardingWidget as i } from "./lib/BankAccountOnboardingWidget/BankAccountOnboardingWidget.js";
5
+ export { t as APPLICATION_STATUS_LABELS_EN, i as BankAccountOnboardingWidget, n as OnboardingApplicationView, e as OnboardingSuppressionReason, r as onboardingApplicationViewFor };
@@ -2,18 +2,19 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { ADDITIONAL_OWNERS_LABELS_EN as e } from "../../../../ui/dist/index6.js";
6
- import { AdditionalOwnersForm as t } from "../../../../ui/dist/index7.js";
5
+ import { ADDITIONAL_OWNERS_LABELS_EN as e } from "../../../../ui/dist/index8.js";
6
+ import { AdditionalOwnerRowStatus as t } from "../../../../ui/dist/index9.js";
7
+ import { AdditionalOwnersForm as n } from "../../../../ui/dist/index10.js";
7
8
  import "../../../../ui/dist/index.js";
8
- import { bankAccountOnboardingTestIds as n } from "./testIds.js";
9
9
  import { buildAdditionalOwnerSchema as r } from "./stepSchemas.js";
10
- import { fieldErrorsFromIssues as i, fieldsToFlagOnOpen as ee, labelOwnedFallback as a, useTouchedFields as te, withFieldFeedback as o } from "./fieldErrors.js";
11
- import { valuesKey as s } from "./valuesKey.js";
12
- import { EMPTY_ADDITIONAL_OWNER as c, buildAdditionalOwnerEditDisplay as l, buildAdditionalOwnerEditFields as u, normalizeAdditionalOwnerDraft as d } from "./additionalOwnerDraft.js";
10
+ import { bankAccountOnboardingTestIds as i } from "./testIds.js";
11
+ import { fieldErrorsFromIssues as a, fieldsToFlagOnOpen as o, labelOwnedFallback as ee, useTouchedFields as s, withFieldFeedback as c } from "./fieldErrors.js";
12
+ import { valuesKey as l } from "./valuesKey.js";
13
+ import { EMPTY_ADDITIONAL_OWNER as u, buildAdditionalOwnerEditDisplay as te, buildAdditionalOwnerEditFields as ne, buildAdditionalOwnerReviewRows as re, normalizeAdditionalOwnerDraft as d } from "./additionalOwnerDraft.js";
13
14
  import { useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
14
- import { jsx as g } from "react/jsx-runtime";
15
+ import { jsx as ie } from "react/jsx-runtime";
15
16
  //#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/AdditionalOwnersStep.js
16
- var _ = [
17
+ var g = [
17
18
  "firstName",
18
19
  "lastName",
19
20
  "dateOfBirth",
@@ -25,111 +26,145 @@ var _ = [
25
26
  "mobilePhoneNumber",
26
27
  "ownershipPercentage"
27
28
  ];
28
- function v(e) {
29
+ function _(e) {
29
30
  return e.ownershipPercentage !== null && e.ownershipPercentage >= 25 ? e.ownershipPercentage : 0;
30
31
  }
31
- function y(e) {
32
- return `${e.ownershipPercentage ?? 0}%`;
32
+ function v(e, t) {
33
+ return `${e.ownershipPercentage ?? 0}${t}`;
33
34
  }
34
- function b(e, t) {
35
+ function y(e, n, r) {
35
36
  return {
36
37
  name: `${e.firstName} ${e.lastName}`.trim(),
37
- shareDisplay: y(e),
38
- error: t
38
+ shareDisplay: v(e, r),
39
+ status: n === void 0 ? e.reviewed ? t.Complete : t.Unreviewed : t.Missing,
40
+ error: n
39
41
  };
40
42
  }
41
- function x({ owners: y, onOwnersChange: x, primaryOwnerName: S, primaryOwnerPercentage: C, stateOptions: w, onSnapshotChange: T, onPendingOwnerChange: E, isSubmitting: ne, labels: D }) {
42
- let O = p(() => ({
43
+ var ae = new Set(g);
44
+ function b({ owners: t, onOwnersChange: v, primaryOwnerName: b, primaryOwnerPercentage: x, stateOptions: oe, onSnapshotChange: S, onPendingOwnerChange: C, isSubmitting: se, showAllErrors: ce = !1, revealErrorsAttempt: w = 0, reviewError: T = null, labels: E }) {
45
+ let D = p(() => ({
43
46
  ...e,
44
- ...D
45
- }), [D]), k = p(() => r(O), [O]), A = a(O.invalidFieldError), [j, M] = h(null), [N, P] = h(null), [re, F] = h(null), [I, L] = h(null), [R, z] = h(!1), B = te(() => []), V = (e) => {
46
- M(d(e));
47
- }, H = C + y.reduce((e, t) => e + v(t), 0), U = H > 100 ? O.totalOwnershipExceedsTemplate(H) : null, W = H > 75, G = `${C}%`, K = C >= 25, q = y.map((e) => {
48
- let t = k.safeParse(e, A);
47
+ ...E
48
+ }), [E]), O = p(() => r(D), [D]), k = ee(D.invalidFieldError), [A, j] = h(null), [M, N] = h(null), [le, P] = h(0), F = ce && w > le, ue = F && A !== null ? D.ownerEditorOpenError : T, [de, I] = h(null), [L, R] = h(null), [z, B] = h(null), [V, H] = h(!1), U = s(() => []), fe = (e) => {
49
+ j(d(e));
50
+ }, W = x + t.reduce((e, t) => e + _(t), 0), G = W > 100 ? D.totalOwnershipExceedsTemplate(W) : null, pe = W > 75, me = `${x}${D.percentSuffix}`, he = x >= 25, K = t.map((e) => {
51
+ let t = O.safeParse(e, k);
49
52
  if (t.success) return;
50
53
  let n = t.error.issues.find((e) => e.path[0] === "ownershipPercentage");
51
- return n ? e.ownershipPercentage === null ? O.ownershipPercentageMinError : n.message : O.ownerIncompleteError;
52
- }), J = q.every((e) => e === void 0), Y = j === null ? null : k.safeParse(j, A), ie = Y?.success ?? !1, X = J && U === null && j === null && I === null ? y : null, ae = JSON.stringify({ snapshot: X?.map((e) => ({
54
+ return n ? e.ownershipPercentage === null ? D.ownershipPercentageMinError : n.message : D.ownerIncompleteError;
55
+ }), ge = K.every((e) => e === void 0), q = t.every((e) => e.reviewed), J = A === null ? null : O.safeParse(A, k), _e = J?.success ?? !1, Y = ge && q && G === null && A === null && z === null && L === null ? t : null, ve = JSON.stringify({ snapshot: Y?.map((e) => ({
53
56
  ...e,
54
57
  dateOfBirth: e.dateOfBirth?.toISOString()
55
- })) }), Z = m(T);
56
- Z.current = T, f(() => {
57
- Z.current(X);
58
- }, [ae]);
59
- let Q = j !== null && N !== null && s(j) !== s(re) ? {
60
- owner: j,
61
- index: N
62
- } : null, oe = s(Q), $ = m(E);
63
- $.current = E, f(() => {
64
- $.current?.(Q);
65
- }, [oe]), f(() => () => $.current?.(null), []);
66
- let se = () => {
67
- P(null), z(!1), M({ ...c }), F({ ...c }), B.reset([]);
68
- }, ce = (e) => {
69
- P(e), z(!1);
70
- let t = d({ ...y[e] });
71
- M(t), F(t);
72
- let n = k.safeParse(t, A);
73
- B.reset(ee(_, t, i(_, t, n.error?.issues, O.requiredFieldError)));
74
- }, le = (e) => {
75
- let t = y[e];
76
- L({
77
- index: e,
78
- displayName: `${t.firstName} ${t.lastName}`.trim()
79
- });
80
- }, ue = () => {
81
- I && (x(y.filter((e, t) => t !== I.index)), L(null));
82
- }, de = () => {
83
- L(null);
84
- }, fe = j ? {
85
- fields: o(u(j, V, { stateOptions: w }), i(_, j, Y?.error?.issues, O.requiredFieldError), B.touched, B.touch),
86
- display: l(j, O),
87
- isExisting: N !== null,
88
- isValid: ie,
89
- ssnRevealed: R,
90
- ssnToggleAriaLabel: R ? O.ssnHide : O.ssnShow,
91
- onToggleSsnVisibility: () => z((e) => !e),
92
- onSubmit: () => {
93
- if (!j) return;
94
- let e = k.safeParse(j);
95
- if (e.success) {
96
- if (N === null) x([...y, e.data]);
97
- else {
98
- let t = [...y];
99
- t[N] = e.data, x(t);
100
- }
101
- M(null), P(null), z(!1);
102
- }
103
- },
104
- onCancel: () => {
105
- M(null), P(null), z(!1);
58
+ })) }), X = m(S);
59
+ X.current = S, f(() => {
60
+ X.current(Y);
61
+ }, [ve]);
62
+ let Z = A !== null && l(A) !== l(de) ? {
63
+ owner: A,
64
+ index: M
65
+ } : null, ye = l(Z), Q = m(C);
66
+ Q.current = C, f(() => {
67
+ Q.current?.(Z);
68
+ }, [ye]), f(() => () => Q.current?.(null), []);
69
+ let be = () => {
70
+ B(null), N(null), H(!1), j({ ...u }), I({ ...u }), P(w), U.reset([]);
71
+ }, $ = (e) => {
72
+ B(null), N(e), H(!1);
73
+ let n = d({ ...t[e] });
74
+ j(n), I(n), P(w);
75
+ let r = O.safeParse(n, k);
76
+ U.reset(o(g, n, a(g, n, r.error?.issues, D.requiredFieldError)));
77
+ }, xe = (e) => {
78
+ R(e);
79
+ }, Se = () => {
80
+ L !== null && (v(t.filter((e, t) => t !== L)), R(null), B(null), j(null), N(null), H(!1));
81
+ }, Ce = () => {
82
+ R(null);
83
+ }, we = () => {
84
+ if (!A) return;
85
+ let e = O.safeParse(A);
86
+ if (!e.success) return;
87
+ let n = {
88
+ ...e.data,
89
+ reviewed: !0
90
+ };
91
+ if (M === null) v([...t, n]);
92
+ else {
93
+ let e = [...t];
94
+ e[M] = n, v(e);
106
95
  }
96
+ j(null), N(null), H(!1);
97
+ }, Te = () => {
98
+ j(null), N(null), H(!1);
99
+ }, Ee = (e) => {
100
+ B(e);
101
+ }, De = z !== null && t[z] ? {
102
+ rowIndex: z,
103
+ rows: re(t[z], D),
104
+ onConfirm: () => {
105
+ if (z === null) return;
106
+ let e = [...t];
107
+ e[z] = {
108
+ ...t[z],
109
+ reviewed: !0
110
+ }, v(e), B(null);
111
+ },
112
+ onEdit: () => $(z)
113
+ } : null, Oe = A ? {
114
+ fields: c(ne(A, fe, { stateOptions: oe }), a(g, A, J?.error?.issues, D.requiredFieldError), F ? ae : U.touched, U.touch),
115
+ display: te(A, D),
116
+ rowIndex: M,
117
+ showMissingFieldsAlert: M !== null && K[M] !== void 0,
118
+ isExisting: M !== null,
119
+ isValid: _e,
120
+ ssnRevealed: V,
121
+ ssnToggleAriaLabel: V ? D.ssnHide : D.ssnShow,
122
+ onToggleSsnVisibility: () => H((e) => !e),
123
+ onSubmit: we,
124
+ onCancel: Te
107
125
  } : null;
108
- return /* @__PURE__ */ g(t, {
109
- ownerRows: y.map((e, t) => b(e, q[t])),
110
- primaryOwnerName: S,
111
- primaryOwnerShareDisplay: G,
112
- showPrimaryOwner: K,
113
- totalOwnershipError: U,
114
- addOwnerDisabled: W,
115
- onAddOwner: se,
116
- onEditOwner: ce,
117
- onDeleteOwnerRequest: le,
118
- deletingOwnerName: I?.displayName ?? null,
119
- onDeleteOwnerConfirm: ue,
120
- onDeleteOwnerCancel: de,
121
- editingOverlay: fe,
122
- isSubmitting: ne,
123
- labels: D,
126
+ return /* @__PURE__ */ ie(n, {
127
+ ownerRows: t.map((e, t) => y(e, K[t], D.percentSuffix)),
128
+ primaryOwnerName: b,
129
+ primaryOwnerShareDisplay: me,
130
+ showPrimaryOwner: he,
131
+ totalOwnershipError: G,
132
+ reviewError: ue,
133
+ addOwnerDisabled: pe,
134
+ onAddOwner: be,
135
+ onEditOwner: $,
136
+ onStartReview: Ee,
137
+ onDeleteOwnerRequest: xe,
138
+ deletingOwnerIndex: L,
139
+ onDeleteOwnerConfirm: Se,
140
+ onDeleteOwnerCancel: Ce,
141
+ editingOverlay: Oe,
142
+ reviewingOwner: De,
143
+ isSubmitting: se,
144
+ labels: E,
124
145
  testIds: {
125
- addOwnerButton: n.addOwnerButton,
126
- overlay: { root: n.shellOverlay },
127
- deleteOverlay: {
128
- root: n.ownerDeleteOverlay,
129
- content: n.ownerDeleteContent
146
+ addOwnerButton: i.addOwnerButton,
147
+ addOwnerEditor: {
148
+ root: i.ownerAddEditor,
149
+ saveButton: i.ownerAddEditorSave
150
+ },
151
+ deleteConfirmation: {
152
+ root: i.ownerDeleteConfirmation,
153
+ content: i.ownerDeleteContent
154
+ },
155
+ startReviewButton: i.ownerStartReviewButton,
156
+ completeDetailsButton: i.ownerCompleteDetailsButton,
157
+ inlineEditor: {
158
+ root: i.ownerInlineEditor,
159
+ saveButton: i.ownerInlineEditorSave
160
+ },
161
+ reviewCard: {
162
+ root: i.ownerReviewCard,
163
+ editButton: i.ownerReviewCardEdit,
164
+ confirmButton: i.ownerReviewCardConfirm
130
165
  }
131
166
  }
132
167
  });
133
168
  }
134
169
  //#endregion
135
- export { x as AdditionalOwnersStep, v as getAdditionalOwnerShare };
170
+ export { b as AdditionalOwnersStep, _ as getAdditionalOwnerShare };