@saasquatch/mint-components 2.3.0-12 → 2.3.0-14

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 (60) hide show
  1. package/dist/cjs/sqm-banking-info-form_10.cjs.entry.js +43 -30
  2. package/dist/cjs/sqm-big-stat_47.cjs.entry.js +15 -8
  3. package/dist/cjs/sqm-email-verification_2.cjs.entry.js +4 -7
  4. package/dist/cjs/{sqm-partner-info-modal-view-2b6fee0f.js → sqm-partner-info-modal-view-b0e8044f.js} +5 -6
  5. package/dist/cjs/sqm-stencilbook.cjs.entry.js +57 -3
  6. package/dist/cjs/{sqm-user-info-form-view-c2cad72c.js → sqm-user-info-form-view-60e09262.js} +11 -1
  7. package/dist/cjs/{useIndirectTaxForm-64c0231c.js → useIndirectTaxForm-c439eb81.js} +3 -1
  8. package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal-view.js +5 -6
  9. package/dist/collection/components/sqm-partner-info-modal/usePartnerInfoModal.js +3 -6
  10. package/dist/collection/components/sqm-widget-verification/useWidgetVerification.js +2 -0
  11. package/dist/collection/components/tax-and-cash/TaxForm.stories.js +3 -0
  12. package/dist/collection/components/tax-and-cash/sqm-banking-info-form/useBankingInfoForm.js +3 -3
  13. package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form-view.js +8 -0
  14. package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form.js +2 -1
  15. package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.js +3 -1
  16. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/useTaxAndCash.js +12 -7
  17. package/dist/collection/components/tax-and-cash/sqm-user-info-form/UserInfoFormView.stories.js +51 -1
  18. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +11 -1
  19. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form.js +3 -1
  20. package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +27 -25
  21. package/dist/esm/sqm-banking-info-form_10.entry.js +43 -30
  22. package/dist/esm/sqm-big-stat_47.entry.js +15 -8
  23. package/dist/esm/sqm-email-verification_2.entry.js +4 -7
  24. package/dist/esm/{sqm-partner-info-modal-view-bc843d7d.js → sqm-partner-info-modal-view-6b9c512f.js} +5 -6
  25. package/dist/esm/sqm-stencilbook.entry.js +57 -3
  26. package/dist/esm/{sqm-user-info-form-view-5051c1d0.js → sqm-user-info-form-view-647a2bd5.js} +11 -1
  27. package/dist/esm/{useIndirectTaxForm-d7d6be39.js → useIndirectTaxForm-38cd984e.js} +3 -1
  28. package/dist/esm-es5/sqm-banking-info-form_10.entry.js +1 -1
  29. package/dist/esm-es5/sqm-big-stat_47.entry.js +1 -1
  30. package/dist/esm-es5/sqm-email-verification_2.entry.js +1 -1
  31. package/dist/esm-es5/{sqm-partner-info-modal-view-bc843d7d.js → sqm-partner-info-modal-view-6b9c512f.js} +1 -1
  32. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  33. package/dist/esm-es5/{sqm-user-info-form-view-5051c1d0.js → sqm-user-info-form-view-647a2bd5.js} +1 -1
  34. package/dist/esm-es5/{useIndirectTaxForm-d7d6be39.js → useIndirectTaxForm-38cd984e.js} +1 -1
  35. package/dist/mint-components/mint-components.esm.js +1 -1
  36. package/dist/mint-components/{p-0c6bd136.system.entry.js → p-1e6b92d0.system.entry.js} +1 -1
  37. package/dist/mint-components/p-1f387c7b.system.js +1 -1
  38. package/dist/mint-components/{p-5959ebdb.system.js → p-34179541.system.js} +1 -1
  39. package/dist/mint-components/{p-d0ed1c1b.entry.js → p-3970cbf5.entry.js} +6 -6
  40. package/dist/mint-components/{p-24a867ab.system.js → p-3caa6a0e.system.js} +1 -1
  41. package/dist/mint-components/{p-aed3c69d.entry.js → p-4b449def.entry.js} +2 -2
  42. package/dist/mint-components/{p-1e699fb8.entry.js → p-6afa9d3a.entry.js} +2 -2
  43. package/dist/mint-components/p-6b1c9506.system.entry.js +1 -0
  44. package/dist/mint-components/{p-13e439bc.js → p-8ab30adc.js} +1 -1
  45. package/dist/mint-components/{p-5f8fa87c.js → p-8d30945a.js} +1 -1
  46. package/dist/mint-components/p-9c4a5b43.system.entry.js +1 -0
  47. package/dist/mint-components/{p-1e1b03fa.js → p-aa2c6585.js} +4 -4
  48. package/dist/mint-components/{p-d67f8e0f.system.js → p-aab8a207.system.js} +2 -2
  49. package/dist/mint-components/{p-29b267a9.system.entry.js → p-b617ffe0.system.entry.js} +1 -1
  50. package/dist/mint-components/{p-b3e1f2fa.entry.js → p-ff476ab5.entry.js} +2 -2
  51. package/dist/types/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form-view.d.ts +1 -0
  52. package/dist/types/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.d.ts +1 -0
  53. package/dist/types/components/tax-and-cash/sqm-user-info-form/UserInfoFormView.stories.d.ts +1 -0
  54. package/dist/types/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.d.ts +2 -0
  55. package/dist/types/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.d.ts +2 -0
  56. package/docs/docs.docx +0 -0
  57. package/grapesjs/grapesjs.js +1 -1
  58. package/package.json +3 -1
  59. package/dist/mint-components/p-6c9f7515.system.entry.js +0 -1
  60. package/dist/mint-components/p-b7188d47.system.entry.js +0 -1
@@ -18,11 +18,11 @@ const reRender = require('./re-render-72a0ef45.js');
18
18
  const useChildElements = require('./useChildElements-041127d7.js');
19
19
  const luxon = require('./luxon-c1ad356a.js');
20
20
  const useReferralTable = require('./useReferralTable-6e9de0d5.js');
21
- const sqmUserInfoFormView = require('./sqm-user-info-form-view-c2cad72c.js');
21
+ const sqmUserInfoFormView = require('./sqm-user-info-form-view-60e09262.js');
22
22
  const data = require('./data-89ac73dd.js');
23
23
  const keys = require('./keys-5a2c9ed2.js');
24
24
  const eventKeys = require('./eventKeys-7af4df4d.js');
25
- const useIndirectTaxForm = require('./useIndirectTaxForm-64c0231c.js');
25
+ const useIndirectTaxForm = require('./useIndirectTaxForm-c439eb81.js');
26
26
 
27
27
  function getFormMap({ props, getValidationErrorMessage, bankCountry, }) {
28
28
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76;
@@ -870,10 +870,10 @@ const API_FIELD_TO_FORM_FIELD = {
870
870
  bankProvinceState: "bankState",
871
871
  };
872
872
  /**
873
- * Maps Impact API error code paths (from validationErrors[].errorPath) to short,
873
+ * Maps Impact API error codes (from validationErrors[].code) to short,
874
874
  * readable frontend error codes used in the ICU select props.
875
875
  */
876
- const API_ERROR_PATH_TO_FRONTEND = {
876
+ const API_ERROR_CODE_TO_FRONTEND = {
877
877
  // Beneficiary account name
878
878
  "withdrawal.settings.error.empty_beneficiaryname": "empty",
879
879
  "withdrawal.settings.error.invalid_character_beneficiaryname": "invalidCharacters",
@@ -1164,7 +1164,7 @@ function useBankingInfoForm(props) {
1164
1164
  console.error("Validation failed: ", validationErrors);
1165
1165
  const mappedValidationErrors = validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors.reduce((agg, error) => {
1166
1166
  const formField = API_FIELD_TO_FORM_FIELD[error.field] || error.field;
1167
- const errorCode = API_ERROR_PATH_TO_FRONTEND[error.errorPath] || error.errorPath;
1167
+ const errorCode = API_ERROR_CODE_TO_FRONTEND[error.code] || error.code;
1168
1168
  return {
1169
1169
  ...agg,
1170
1170
  [formField]: {
@@ -2840,6 +2840,14 @@ const IndirectTaxFormView = (props) => {
2840
2840
  }, {
2841
2841
  supportLink: (index.h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
2842
2842
  }))),
2843
+ states.isPartnerLegacy && (index.h("sqm-form-message", { loading: states.loading, type: "info" },
2844
+ index.h("p", { part: "alert-title" }, text.isPartnerAlertHeader),
2845
+ global.intl.formatMessage({
2846
+ id: "isPartnerAlertDescription",
2847
+ defaultMessage: text.isPartnerAlertDescription,
2848
+ }, {
2849
+ supportLink: (index.h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
2850
+ }))),
2843
2851
  index.h("div", null,
2844
2852
  index.h("h4", null, text.indirectTaxDetails))),
2845
2853
  states.loading ? (index.h("sl-spinner", { style: { fontSize: "50px", margin: "40px" } })) : (index.h("div", null,
@@ -3079,6 +3087,7 @@ function useDemoIndirectTaxForm(props) {
3079
3087
  disabled: false,
3080
3088
  loading: false,
3081
3089
  isPartner: false,
3090
+ isPartnerLegacy: false,
3082
3091
  loadingError: false,
3083
3092
  errors: {},
3084
3093
  formState: {
@@ -4436,7 +4445,7 @@ const GET_INDIRECT_TAX_COUNTRY_CODE = index_module.dist.gql `
4436
4445
  }
4437
4446
  `;
4438
4447
  function useUserInfoForm(props) {
4439
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
4448
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
4440
4449
  const currencyRef = domContextHooks_module.useRef(undefined);
4441
4450
  const phoneCountryRef = domContextHooks_module.useRef(undefined);
4442
4451
  const formRef = domContextHooks_module.useRef(null);
@@ -4542,7 +4551,9 @@ function useUserInfoForm(props) {
4542
4551
  setFilteredPhoneCountries(countries || []);
4543
4552
  }
4544
4553
  else {
4545
- setFilteredPhoneCountries(countries.filter((c) => c.displayName.toLowerCase().includes(phoneCountrySearch.toLowerCase())) || []);
4554
+ setFilteredPhoneCountries(countries.filter((c) => c.displayName
4555
+ .toLowerCase()
4556
+ .includes(phoneCountrySearch.toLowerCase())) || []);
4546
4557
  }
4547
4558
  }, [phoneCountrySearch, countries]);
4548
4559
  domContextHooks_module.useEffect(() => {
@@ -4556,7 +4567,7 @@ function useUserInfoForm(props) {
4556
4567
  }
4557
4568
  }, [currencySearch, currencies]);
4558
4569
  async function connectPartner(formData) {
4559
- var _a, _b, _c, _d;
4570
+ var _a, _b, _c, _d, _e, _f;
4560
4571
  const vars = {
4561
4572
  user: {
4562
4573
  id: user.id,
@@ -4573,36 +4584,31 @@ function useUserInfoForm(props) {
4573
4584
  phoneNumber: subregions.toDomesticNumber(formData.phoneNumberCountryCode, formData.phoneNumber),
4574
4585
  phoneNumberCountryCode: formData.phoneNumberCountryCode,
4575
4586
  };
4576
- // If the partner has already been started call completeImpactPartner to
4577
- // update the remaining details. Otherwise create a new connection.
4578
- // const userData = data?.user;
4587
+ // if user went through early partner creation, connectionStatus === "STARTED"
4588
+ // otherwise trigger legacy partner creation
4589
+ const userData = data$1 === null || data$1 === void 0 ? void 0 : data$1.user;
4579
4590
  let result = null;
4580
4591
  let connectionResult;
4581
- result = await completeImpactPartner({
4582
- vars,
4583
- });
4584
- connectionResult = (_a = result) === null || _a === void 0 ? void 0 : _a.completeImpactConnection;
4585
- // if (userData?.impactConnection?.connectionStatus === "STARTED") {
4586
- // result = await completeImpactPartner({
4587
- // vars,
4588
- // });
4589
- // connectionResult = (result as CompletePartnerResult)
4590
- // ?.completeImpactConnection;
4591
- // } else {
4592
- // result = await connectImpactPartner({
4593
- // vars,
4594
- // });
4595
- // connectionResult = (result as ConnectPartnerResult)
4596
- // ?.createImpactConnection;
4597
- // }
4598
- if (!result || ((_b = result) === null || _b === void 0 ? void 0 : _b.message))
4592
+ if (((_a = userData === null || userData === void 0 ? void 0 : userData.impactConnection) === null || _a === void 0 ? void 0 : _a.connectionStatus) === "STARTED") {
4593
+ result = await completeImpactPartner({
4594
+ vars,
4595
+ });
4596
+ connectionResult = (_b = result) === null || _b === void 0 ? void 0 : _b.completeImpactConnection;
4597
+ }
4598
+ else {
4599
+ result = await connectImpactPartner({
4600
+ vars,
4601
+ });
4602
+ connectionResult = (_c = result) === null || _c === void 0 ? void 0 : _c.createImpactConnection;
4603
+ }
4604
+ if (!result || ((_d = result) === null || _d === void 0 ? void 0 : _d.message))
4599
4605
  throw new Error();
4600
4606
  if (!(connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.success)) {
4601
4607
  console.error("Failed to create Impact connection: ", connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.validationErrors);
4602
4608
  throw new Error();
4603
4609
  }
4604
4610
  await refetch();
4605
- const resultPublisher = (_d = (_c = connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.user) === null || _c === void 0 ? void 0 : _c.impactConnection) === null || _d === void 0 ? void 0 : _d.publisher;
4611
+ const resultPublisher = (_f = (_e = connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.user) === null || _e === void 0 ? void 0 : _e.impactConnection) === null || _f === void 0 ? void 0 : _f.publisher;
4606
4612
  const hasValidCurrentDocument = subregions.validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
4607
4613
  // Fire form change event
4608
4614
  window.dispatchEvent(new Event(eventKeys.TAX_FORM_UPDATED_EVENT_KEY));
@@ -4736,6 +4742,11 @@ function useUserInfoForm(props) {
4736
4742
  loading: loading || connectLoading || completeLoading,
4737
4743
  isPartner: !!((_g = (_f = data$1 === null || data$1 === void 0 ? void 0 : data$1.user) === null || _f === void 0 ? void 0 : _f.impactConnection) === null || _g === void 0 ? void 0 : _g.publisher),
4738
4744
  isUser: !!((_j = (_h = data$1 === null || data$1 === void 0 ? void 0 : data$1.user) === null || _h === void 0 ? void 0 : _h.impactConnection) === null || _j === void 0 ? void 0 : _j.user),
4745
+ // Show banner when pre-existing partner is created with legacy mutation createImpactConnection
4746
+ isUserLegacy: !!((_l = (_k = data$1 === null || data$1 === void 0 ? void 0 : data$1.user) === null || _k === void 0 ? void 0 : _k.impactConnection) === null || _l === void 0 ? void 0 : _l.user) &&
4747
+ ((_o = (_m = data$1 === null || data$1 === void 0 ? void 0 : data$1.user) === null || _m === void 0 ? void 0 : _m.impactConnection) === null || _o === void 0 ? void 0 : _o.connectionStatus) !== "STARTED",
4748
+ isPartnerLegacy: !!((_q = (_p = data$1 === null || data$1 === void 0 ? void 0 : data$1.user) === null || _p === void 0 ? void 0 : _p.impactConnection) === null || _q === void 0 ? void 0 : _q.publisher) &&
4749
+ ((_s = (_r = data$1 === null || data$1 === void 0 ? void 0 : data$1.user) === null || _r === void 0 ? void 0 : _r.impactConnection) === null || _s === void 0 ? void 0 : _s.connectionStatus) !== "STARTED",
4739
4750
  formState: {
4740
4751
  ...userFormContext,
4741
4752
  errors: formErrors,
@@ -4953,6 +4964,8 @@ function useDemoUserInfoForm(props) {
4953
4964
  loading: false,
4954
4965
  isPartner: false,
4955
4966
  isUser: false,
4967
+ isPartnerLegacy: false,
4968
+ isUserLegacy: false,
4956
4969
  loadingError: false,
4957
4970
  formState: {
4958
4971
  errors: {
@@ -34,7 +34,7 @@ require('./sqm-portal-container-view-757f921b.js');
34
34
  const data = require('./data-89ac73dd.js');
35
35
  const keys = require('./keys-5a2c9ed2.js');
36
36
  require('./eventKeys-7af4df4d.js');
37
- const useIndirectTaxForm = require('./useIndirectTaxForm-64c0231c.js');
37
+ const useIndirectTaxForm = require('./useIndirectTaxForm-c439eb81.js');
38
38
  const parseStates = require('./parseStates-d1effc19.js');
39
39
 
40
40
  /**
@@ -6801,7 +6801,6 @@ function useTaxAndCash() {
6801
6801
  setCurrenciesContext(supportedCurrencies);
6802
6802
  }, [supportedCurrencies]);
6803
6803
  domContextHooks_module.useEffect(() => {
6804
- var _a;
6805
6804
  if (errors) {
6806
6805
  setStep("/error");
6807
6806
  return;
@@ -6845,13 +6844,19 @@ function useTaxAndCash() {
6845
6844
  const user = data$1 === null || data$1 === void 0 ? void 0 : data$1.user;
6846
6845
  if (!user || step !== "/loading")
6847
6846
  return;
6848
- if (((_a = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher) &&
6849
- (user === null || user === void 0 ? void 0 : user.impactConnection.connectionStatus) === "STARTED") {
6850
- completeConnection(user);
6851
- refetch();
6847
+ async function routeAfterMaybeCompleting() {
6848
+ var _a;
6849
+ if (((_a = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher) &&
6850
+ (user === null || user === void 0 ? void 0 : user.impactConnection.connectionStatus) === "STARTED") {
6851
+ // Finish the early-created connection before routing so the next
6852
+ // step sees the completed status
6853
+ await completeConnection(user);
6854
+ await refetch();
6855
+ }
6856
+ const currentStep = getCurrentStep(user);
6857
+ setStep(currentStep);
6852
6858
  }
6853
- const currentStep = getCurrentStep(user);
6854
- setStep(currentStep);
6859
+ routeAfterMaybeCompleting();
6855
6860
  }
6856
6861
  }, [host, user, (_e = data$1 === null || data$1 === void 0 ? void 0 : data$1.user) === null || _e === void 0 ? void 0 : _e.email, errors]);
6857
6862
  function getFinanceNetworkFilter() {
@@ -8396,9 +8401,11 @@ function useWidgetVerification() {
8396
8401
  };
8397
8402
  const onPartnerModalComplete = () => {
8398
8403
  setShowPartnerModal(false);
8404
+ // Reset the latch so a later partner creation can re-trigger this effect
8399
8405
  setPartnerCreated(false);
8400
8406
  setContext(true);
8401
8407
  };
8408
+ // The modal signals completion by flipping partnerCreated; advance the flow here
8402
8409
  domContextHooks_module.useEffect(() => {
8403
8410
  if (partnerCreated)
8404
8411
  onPartnerModalComplete();
@@ -11,7 +11,7 @@ const utils = require('./utils-6847bc06.js');
11
11
  const JSS = require('./JSS-8503a151.js');
12
12
  const sqmTextSpanView = require('./sqm-text-span-view-b9e10f5d.js');
13
13
  const data = require('./data-89ac73dd.js');
14
- const sqmPartnerInfoModalView = require('./sqm-partner-info-modal-view-2b6fee0f.js');
14
+ const sqmPartnerInfoModalView = require('./sqm-partner-info-modal-view-b0e8044f.js');
15
15
  const keys = require('./keys-5a2c9ed2.js');
16
16
  const eventKeys = require('./eventKeys-7af4df4d.js');
17
17
  const parseStates = require('./parseStates-d1effc19.js');
@@ -506,7 +506,8 @@ function usePartnerInfoModal(props) {
506
506
  const { data: currenciesData, loading: currenciesLoading } = index_module.wn(GET_CURRENCIES, { variables: { locale } });
507
507
  const { data: countriesData, loading: countriesLoading } = index_module.wn(GET_COUNTRIES, {});
508
508
  // No pre-filled country, use locale to determine countryCode instead
509
- const [countryCode, setCountryCode] = domContextHooks_module.useState(((_b = (_a = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher) === null || _b === void 0 ? void 0 : _b.countryCode) || locale.replace(/^.*_/, ""));
509
+ const [countryCode, setCountryCode] = domContextHooks_module.useState(((_b = (_a = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher) === null || _b === void 0 ? void 0 : _b.countryCode) ||
510
+ locale.replace(/^.*_/, ""));
510
511
  const [currency, setCurrency] = domContextHooks_module.useState(((_d = (_c = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _c === void 0 ? void 0 : _c.publisher) === null || _d === void 0 ? void 0 : _d.currency) || "");
511
512
  const { data: financeNetworkData } = index_module.wn(data.GET_FINANCE_NETWORK_SETTINGS, {
512
513
  variables: { filter: countryCode ? { countryCode_eq: countryCode } : {} },
@@ -605,11 +606,7 @@ function usePartnerInfoModal(props) {
605
606
  }
606
607
  async function onSubmit() {
607
608
  var _a, _b;
608
- if (!allowBankingCollection) {
609
- setError(props.missingFieldsErrorText);
610
- return;
611
- }
612
- if (!countryCode || !currency) {
609
+ if (!allowBankingCollection || !countryCode || !currency) {
613
610
  setError(props.missingFieldsErrorText);
614
611
  return;
615
612
  }
@@ -131,13 +131,14 @@ function PartnerInfoModalView(props) {
131
131
  const styleString = sheet.toString();
132
132
  if (!states.open)
133
133
  return index.h("div", null);
134
+ const modalHeader = states.isExistingPartner
135
+ ? text.modalHeaderExistingPartner
136
+ : text.modalHeader;
134
137
  return (index.h("div", null,
135
138
  index.h("style", { type: "text/css" },
136
139
  " ",
137
140
  styleString),
138
- index.h("sl-dialog", { class: sheet.classes.Dialog, open: states.open, noHeader: true, label: states.isExistingPartner
139
- ? text.modalHeaderExistingPartner
140
- : text.modalHeader, "onSl-request-close": (e) => {
141
+ index.h("sl-dialog", { class: sheet.classes.Dialog, open: states.open, noHeader: true, label: modalHeader, "onSl-request-close": (e) => {
141
142
  e.preventDefault();
142
143
  }, "onSl-hide": (e) => {
143
144
  var _a;
@@ -145,9 +146,7 @@ function PartnerInfoModalView(props) {
145
146
  e.preventDefault();
146
147
  }
147
148
  }, "onSl-initial-focus": callbacks.onInitialFocus },
148
- index.h("h2", { class: sheet.classes.DialogTitle }, states.isExistingPartner
149
- ? text.modalHeaderExistingPartner
150
- : text.modalHeader),
149
+ index.h("h2", { class: sheet.classes.DialogTitle }, modalHeader),
151
150
  index.h(PartnerInfoModalContentView, Object.assign({}, props)))));
152
151
  }
153
152
 
@@ -37,10 +37,10 @@ require('./ErrorView-ee7b0f36.js');
37
37
  const sqmQrCodeView = require('./sqm-qr-code-view-1f2daa76.js');
38
38
  const ShadowViewAddon = require('./ShadowViewAddon-3b477e58.js');
39
39
  const sqmPortalContainerView = require('./sqm-portal-container-view-757f921b.js');
40
- const sqmUserInfoFormView = require('./sqm-user-info-form-view-c2cad72c.js');
40
+ const sqmUserInfoFormView = require('./sqm-user-info-form-view-60e09262.js');
41
41
  const sqmLeadInputFieldView = require('./sqm-lead-input-field-view-0cd7ebdb.js');
42
42
  require('./data-89ac73dd.js');
43
- const sqmPartnerInfoModalView = require('./sqm-partner-info-modal-view-2b6fee0f.js');
43
+ const sqmPartnerInfoModalView = require('./sqm-partner-info-modal-view-b0e8044f.js');
44
44
 
45
45
  /**
46
46
  * lodash (Custom Build) <https://lodash.com/>
@@ -16703,6 +16703,8 @@ const stepOneProps = {
16703
16703
  disabled: false,
16704
16704
  isPartner: false,
16705
16705
  isUser: false,
16706
+ isPartnerLegacy: false,
16707
+ isUserLegacy: false,
16706
16708
  loadingError: false,
16707
16709
  formState: {
16708
16710
  firstName: "Bob",
@@ -16823,6 +16825,7 @@ const stepTwoProps = {
16823
16825
  disabled: false,
16824
16826
  loading: false,
16825
16827
  isPartner: false,
16828
+ isPartnerLegacy: false,
16826
16829
  loadingError: false,
16827
16830
  formState: {
16828
16831
  checked: undefined,
@@ -18885,7 +18888,10 @@ const mockCountries = [
18885
18888
  { countryCode: "FR", displayName: "France" },
18886
18889
  { countryCode: "ES", displayName: "Spain" },
18887
18890
  // Show handling of long country names
18888
- { countryCode: "CD", displayName: "Congo, The Democratic Republic of the Congo" },
18891
+ {
18892
+ countryCode: "CD",
18893
+ displayName: "Congo, The Democratic Republic of the Congo",
18894
+ },
18889
18895
  ];
18890
18896
  const mockCurrencies = [
18891
18897
  { currencyCode: "USD", displayName: "US Dollar" },
@@ -18976,6 +18982,8 @@ const baseProps = {
18976
18982
  loading: false,
18977
18983
  isPartner: false,
18978
18984
  isUser: false,
18985
+ isPartnerLegacy: false,
18986
+ isUserLegacy: false,
18979
18987
  formState: {
18980
18988
  firstName: "",
18981
18989
  lastName: "",
@@ -19088,6 +19096,7 @@ const PartnerAccount = () => {
19088
19096
  return (index.h(sqmUserInfoFormView.UserInfoFormView, Object.assign({}, baseProps, { states: {
19089
19097
  ...baseProps.states,
19090
19098
  isPartner: true,
19099
+ isPartnerLegacy: true,
19091
19100
  formState: {
19092
19101
  ...baseProps.states.formState,
19093
19102
  firstName: "Jane",
@@ -19107,10 +19116,53 @@ const PartnerAccount = () => {
19107
19116
  partnerData: mockPartnerData,
19108
19117
  } })));
19109
19118
  };
19119
+ // Early partner created via <sqm-partner-info-modal>: connectionStatus is "STARTED",
19120
+ // publisher has only countryCode + currency populated. Banner must NOT show; only
19121
+ // country + currency disabled; firstName/lastName disabled via userData; everything
19122
+ // else (phone, address, city, state, postalCode) stays editable.
19123
+ const EarlyPartnerFromModal = () => {
19124
+ return (index.h(sqmUserInfoFormView.UserInfoFormView, Object.assign({}, baseProps, { states: {
19125
+ ...baseProps.states,
19126
+ isPartner: true,
19127
+ isUser: true,
19128
+ isPartnerLegacy: false,
19129
+ isUserLegacy: false,
19130
+ formState: {
19131
+ ...baseProps.states.formState,
19132
+ firstName: "Jane",
19133
+ lastName: "Smith",
19134
+ email: "jane.smith@example.com",
19135
+ countryCode: "US",
19136
+ currency: "USD",
19137
+ phoneNumberCountryCode: undefined,
19138
+ phoneNumber: undefined,
19139
+ address: undefined,
19140
+ city: undefined,
19141
+ state: undefined,
19142
+ postalCode: undefined,
19143
+ },
19144
+ }, data: {
19145
+ ...baseProps.data,
19146
+ partnerData: {
19147
+ ...mockPartnerData,
19148
+ billingAddress: undefined,
19149
+ billingCity: undefined,
19150
+ billingState: undefined,
19151
+ billingPostalCode: undefined,
19152
+ phoneNumber: undefined,
19153
+ phoneNumberCountryCode: undefined,
19154
+ },
19155
+ userData: {
19156
+ firstName: "Jane",
19157
+ lastName: "Smith",
19158
+ },
19159
+ } })));
19160
+ };
19110
19161
  const UserAccount = () => {
19111
19162
  return (index.h(sqmUserInfoFormView.UserInfoFormView, Object.assign({}, baseProps, { states: {
19112
19163
  ...baseProps.states,
19113
19164
  isUser: true,
19165
+ isUserLegacy: true,
19114
19166
  formState: {
19115
19167
  ...baseProps.states.formState,
19116
19168
  firstName: "Bob",
@@ -19129,6 +19181,7 @@ const UserAccountMissingLastName = () => {
19129
19181
  return (index.h(sqmUserInfoFormView.UserInfoFormView, Object.assign({}, baseProps, { states: {
19130
19182
  ...baseProps.states,
19131
19183
  isUser: true,
19184
+ isUserLegacy: true,
19132
19185
  formState: {
19133
19186
  ...baseProps.states.formState,
19134
19187
  firstName: "Bob",
@@ -19208,6 +19261,7 @@ const UserInfoFormView = /*#__PURE__*/Object.freeze({
19208
19261
  WithValidationErrors: WithValidationErrors,
19209
19262
  WithGeneralError: WithGeneralError,
19210
19263
  PartnerAccount: PartnerAccount,
19264
+ EarlyPartnerFromModal: EarlyPartnerFromModal,
19211
19265
  UserAccount: UserAccount,
19212
19266
  UserAccountMissingLastName: UserAccountMissingLastName,
19213
19267
  CanadianAddress: CanadianAddress,
@@ -2287,6 +2287,14 @@ const UserInfoFormView = (props) => {
2287
2287
  }, {
2288
2288
  supportLink: (index.h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
2289
2289
  })))),
2290
+ (states.isPartnerLegacy || states.isUserLegacy) && (index.h("sqm-form-message", { loading: states.loading, type: "info" },
2291
+ index.h("p", { part: "alert-title" }, text.isPartnerAlertHeader),
2292
+ index.h("p", { part: "alert-description" }, global.intl.formatMessage({
2293
+ id: "isPartnerAlertDescription",
2294
+ defaultMessage: text.isPartnerAlertDescription,
2295
+ }, {
2296
+ supportLink: (index.h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
2297
+ })))),
2290
2298
  index.h("div", null,
2291
2299
  index.h("div", { class: classes.InputContainer },
2292
2300
  index.h("sl-input", Object.assign({ class: "ErrorInput", exportparts: "label: input-label, base: input-base", value: formState.firstName, label: text.firstName, disabled: states.disabled || isDisabledUserInput("firstName") }, (((_b = formState.errors) === null || _b === void 0 ? void 0 : _b.firstName) ? {
@@ -2339,7 +2347,9 @@ const UserInfoFormView = (props) => {
2339
2347
  index.h("div", { slot: "prefix" }, `${(_a = PHONE_EXTENSIONS[c.countryCode]) === null || _a === void 0 ? void 0 : _a.name} `), (_b = PHONE_EXTENSIONS[c.countryCode]) === null || _b === void 0 ? void 0 :
2340
2348
  _b.dial_code));
2341
2349
  })),
2342
- index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", id: "phoneNumber", name: "/phoneNumber", value: formState.phoneNumber, "onSl-input": (e) => {
2350
+ index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", id: "phoneNumber", name: "/phoneNumber", value: formState.phoneNumber !== null
2351
+ ? formState.phoneNumber
2352
+ : "", "onSl-input": (e) => {
2343
2353
  var _a;
2344
2354
  const target = e.target;
2345
2355
  const country = (((_a = refs.phoneCountryRef.current) === null || _a === void 0 ? void 0 : _a.value) || "US");
@@ -1176,7 +1176,7 @@ function getOption(countries, countryCode) {
1176
1176
  }
1177
1177
  }
1178
1178
  function useIndirectTaxForm(props) {
1179
- var _a, _b, _c, _d, _e;
1179
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1180
1180
  const user = index_module.J();
1181
1181
  const locale = index_module.L();
1182
1182
  const formRef = domContextHooks_module.useRef(null);
@@ -1361,6 +1361,8 @@ function useIndirectTaxForm(props) {
1361
1361
  disabled: loading || countriesLoading || connectLoading || completeLoading,
1362
1362
  loading: loading || connectLoading || countriesLoading || completeLoading,
1363
1363
  isPartner: !!((_e = (_d = userData === null || userData === void 0 ? void 0 : userData.user) === null || _d === void 0 ? void 0 : _d.impactConnection) === null || _e === void 0 ? void 0 : _e.publisher),
1364
+ isPartnerLegacy: !!((_g = (_f = userData === null || userData === void 0 ? void 0 : userData.user) === null || _f === void 0 ? void 0 : _f.impactConnection) === null || _g === void 0 ? void 0 : _g.publisher) &&
1365
+ ((_j = (_h = userData === null || userData === void 0 ? void 0 : userData.user) === null || _h === void 0 ? void 0 : _h.impactConnection) === null || _j === void 0 ? void 0 : _j.connectionStatus) !== "STARTED",
1364
1366
  loadingError: !!(userError === null || userError === void 0 ? void 0 : userError.message),
1365
1367
  formState: {
1366
1368
  checked: option,
@@ -128,13 +128,14 @@ export function PartnerInfoModalView(props) {
128
128
  const styleString = sheet.toString();
129
129
  if (!states.open)
130
130
  return h("div", null);
131
+ const modalHeader = states.isExistingPartner
132
+ ? text.modalHeaderExistingPartner
133
+ : text.modalHeader;
131
134
  return (h("div", null,
132
135
  h("style", { type: "text/css" },
133
136
  " ",
134
137
  styleString),
135
- h("sl-dialog", { class: sheet.classes.Dialog, open: states.open, noHeader: true, label: states.isExistingPartner
136
- ? text.modalHeaderExistingPartner
137
- : text.modalHeader, "onSl-request-close": (e) => {
138
+ h("sl-dialog", { class: sheet.classes.Dialog, open: states.open, noHeader: true, label: modalHeader, "onSl-request-close": (e) => {
138
139
  e.preventDefault();
139
140
  }, "onSl-hide": (e) => {
140
141
  var _a;
@@ -142,8 +143,6 @@ export function PartnerInfoModalView(props) {
142
143
  e.preventDefault();
143
144
  }
144
145
  }, "onSl-initial-focus": callbacks.onInitialFocus },
145
- h("h2", { class: sheet.classes.DialogTitle }, states.isExistingPartner
146
- ? text.modalHeaderExistingPartner
147
- : text.modalHeader),
146
+ h("h2", { class: sheet.classes.DialogTitle }, modalHeader),
148
147
  h(PartnerInfoModalContentView, Object.assign({}, props)))));
149
148
  }
@@ -83,7 +83,8 @@ export function usePartnerInfoModal(props) {
83
83
  const { data: currenciesData, loading: currenciesLoading } = useQuery(GET_CURRENCIES, { variables: { locale } });
84
84
  const { data: countriesData, loading: countriesLoading } = useQuery(GET_COUNTRIES, {});
85
85
  // No pre-filled country, use locale to determine countryCode instead
86
- const [countryCode, setCountryCode] = useState(((_b = (_a = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher) === null || _b === void 0 ? void 0 : _b.countryCode) || locale.replace(/^.*_/, ""));
86
+ const [countryCode, setCountryCode] = useState(((_b = (_a = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher) === null || _b === void 0 ? void 0 : _b.countryCode) ||
87
+ locale.replace(/^.*_/, ""));
87
88
  const [currency, setCurrency] = useState(((_d = (_c = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _c === void 0 ? void 0 : _c.publisher) === null || _d === void 0 ? void 0 : _d.currency) || "");
88
89
  const { data: financeNetworkData } = useQuery(GET_FINANCE_NETWORK_SETTINGS, {
89
90
  variables: { filter: countryCode ? { countryCode_eq: countryCode } : {} },
@@ -182,11 +183,7 @@ export function usePartnerInfoModal(props) {
182
183
  }
183
184
  async function onSubmit() {
184
185
  var _a, _b;
185
- if (!allowBankingCollection) {
186
- setError(props.missingFieldsErrorText);
187
- return;
188
- }
189
- if (!countryCode || !currency) {
186
+ if (!allowBankingCollection || !countryCode || !currency) {
190
187
  setError(props.missingFieldsErrorText);
191
188
  return;
192
189
  }
@@ -75,9 +75,11 @@ export function useWidgetVerification() {
75
75
  };
76
76
  const onPartnerModalComplete = () => {
77
77
  setShowPartnerModal(false);
78
+ // Reset the latch so a later partner creation can re-trigger this effect
78
79
  setPartnerCreated(false);
79
80
  setContext(true);
80
81
  };
82
+ // The modal signals completion by flipping partnerCreated; advance the flow here
81
83
  useEffect(() => {
82
84
  if (partnerCreated)
83
85
  onPartnerModalComplete();
@@ -14,6 +14,8 @@ const stepOneProps = {
14
14
  disabled: false,
15
15
  isPartner: false,
16
16
  isUser: false,
17
+ isPartnerLegacy: false,
18
+ isUserLegacy: false,
17
19
  loadingError: false,
18
20
  formState: {
19
21
  firstName: "Bob",
@@ -134,6 +136,7 @@ const stepTwoProps = {
134
136
  disabled: false,
135
137
  loading: false,
136
138
  isPartner: false,
139
+ isPartnerLegacy: false,
137
140
  loadingError: false,
138
141
  formState: {
139
142
  checked: undefined,
@@ -33,10 +33,10 @@ const API_FIELD_TO_FORM_FIELD = {
33
33
  bankProvinceState: "bankState",
34
34
  };
35
35
  /**
36
- * Maps Impact API error code paths (from validationErrors[].errorPath) to short,
36
+ * Maps Impact API error codes (from validationErrors[].code) to short,
37
37
  * readable frontend error codes used in the ICU select props.
38
38
  */
39
- const API_ERROR_PATH_TO_FRONTEND = {
39
+ const API_ERROR_CODE_TO_FRONTEND = {
40
40
  // Beneficiary account name
41
41
  "withdrawal.settings.error.empty_beneficiaryname": "empty",
42
42
  "withdrawal.settings.error.invalid_character_beneficiaryname": "invalidCharacters",
@@ -327,7 +327,7 @@ export function useBankingInfoForm(props) {
327
327
  console.error("Validation failed: ", validationErrors);
328
328
  const mappedValidationErrors = validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors.reduce((agg, error) => {
329
329
  const formField = API_FIELD_TO_FORM_FIELD[error.field] || error.field;
330
- const errorCode = API_ERROR_PATH_TO_FRONTEND[error.errorPath] || error.errorPath;
330
+ const errorCode = API_ERROR_CODE_TO_FRONTEND[error.code] || error.code;
331
331
  return {
332
332
  ...agg,
333
333
  [formField]: {
@@ -157,6 +157,14 @@ export const IndirectTaxFormView = (props) => {
157
157
  }, {
158
158
  supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
159
159
  }))),
160
+ states.isPartnerLegacy && (h("sqm-form-message", { loading: states.loading, type: "info" },
161
+ h("p", { part: "alert-title" }, text.isPartnerAlertHeader),
162
+ intl.formatMessage({
163
+ id: "isPartnerAlertDescription",
164
+ defaultMessage: text.isPartnerAlertDescription,
165
+ }, {
166
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
167
+ }))),
160
168
  h("div", null,
161
169
  h("h4", null, text.indirectTaxDetails))),
162
170
  states.loading ? (h("sl-spinner", { style: { fontSize: "50px", margin: "40px" } })) : (h("div", null,
@@ -887,7 +887,7 @@ export class IndirectTaxForm {
887
887
  "mutable": false,
888
888
  "complexType": {
889
889
  "original": "DemoData<UseIndirectTaxFormResult>",
890
- "resolved": "{ states?: { step: string; hideSteps: boolean; disabled: boolean; loading: boolean; isPartner: boolean; loadingError: boolean; formState: { checked: \"hstCanada\" | \"otherRegion\" | \"notRegistered\"; errors: {}; }; }; refs?: { formRef: Ref<HTMLFormElement>; }; data?: { esRegions: { regionCode: string; taxType: string; displayName: string; }[]; countries: { countryCode: string; displayName: any; }[]; allCountries: { countryCode: string; displayName: any; }[]; provinces: { regionCode: string; taxType: string; displayName: string; }[]; }; slotProps?: { formState: { selectedRegion?: string; subRegion?: string; subRegionTaxNumber?: string; qstNumber?: string; province?: string; indirectTaxNumber?: string; hasQst?: boolean; hasSubRegionTaxNumber?: boolean; errors?: any; error?: string; }; }; }",
890
+ "resolved": "{ states?: { step: string; hideSteps: boolean; disabled: boolean; loading: boolean; isPartner: boolean; isPartnerLegacy: boolean; loadingError: boolean; formState: { checked: \"hstCanada\" | \"otherRegion\" | \"notRegistered\"; errors: {}; }; }; refs?: { formRef: Ref<HTMLFormElement>; }; data?: { esRegions: { regionCode: string; taxType: string; displayName: string; }[]; countries: { countryCode: string; displayName: any; }[]; allCountries: { countryCode: string; displayName: any; }[]; provinces: { regionCode: string; taxType: string; displayName: string; }[]; }; slotProps?: { formState: { selectedRegion?: string; subRegion?: string; subRegionTaxNumber?: string; qstNumber?: string; province?: string; indirectTaxNumber?: string; hasQst?: boolean; hasSubRegionTaxNumber?: boolean; errors?: any; error?: string; }; }; }",
891
891
  "references": {
892
892
  "DemoData": {
893
893
  "location": "import",
@@ -921,6 +921,7 @@ function useDemoIndirectTaxForm(props) {
921
921
  disabled: false,
922
922
  loading: false,
923
923
  isPartner: false,
924
+ isPartnerLegacy: false,
924
925
  loadingError: false,
925
926
  errors: {},
926
927
  formState: {
@@ -71,7 +71,7 @@ function getOption(countries, countryCode) {
71
71
  }
72
72
  }
73
73
  export function useIndirectTaxForm(props) {
74
- var _a, _b, _c, _d, _e;
74
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
75
75
  const user = useUserIdentity();
76
76
  const locale = useLocale();
77
77
  const formRef = useRef(null);
@@ -256,6 +256,8 @@ export function useIndirectTaxForm(props) {
256
256
  disabled: loading || countriesLoading || connectLoading || completeLoading,
257
257
  loading: loading || connectLoading || countriesLoading || completeLoading,
258
258
  isPartner: !!((_e = (_d = userData === null || userData === void 0 ? void 0 : userData.user) === null || _d === void 0 ? void 0 : _d.impactConnection) === null || _e === void 0 ? void 0 : _e.publisher),
259
+ isPartnerLegacy: !!((_g = (_f = userData === null || userData === void 0 ? void 0 : userData.user) === null || _f === void 0 ? void 0 : _f.impactConnection) === null || _g === void 0 ? void 0 : _g.publisher) &&
260
+ ((_j = (_h = userData === null || userData === void 0 ? void 0 : userData.user) === null || _h === void 0 ? void 0 : _h.impactConnection) === null || _j === void 0 ? void 0 : _j.connectionStatus) !== "STARTED",
259
261
  loadingError: !!(userError === null || userError === void 0 ? void 0 : userError.message),
260
262
  formState: {
261
263
  checked: option,
@@ -147,7 +147,6 @@ export function useTaxAndCash() {
147
147
  setCurrenciesContext(supportedCurrencies);
148
148
  }, [supportedCurrencies]);
149
149
  useEffect(() => {
150
- var _a;
151
150
  if (errors) {
152
151
  setStep("/error");
153
152
  return;
@@ -191,13 +190,19 @@ export function useTaxAndCash() {
191
190
  const user = data === null || data === void 0 ? void 0 : data.user;
192
191
  if (!user || step !== "/loading")
193
192
  return;
194
- if (((_a = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher) &&
195
- (user === null || user === void 0 ? void 0 : user.impactConnection.connectionStatus) === "STARTED") {
196
- completeConnection(user);
197
- refetch();
193
+ async function routeAfterMaybeCompleting() {
194
+ var _a;
195
+ if (((_a = user === null || user === void 0 ? void 0 : user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher) &&
196
+ (user === null || user === void 0 ? void 0 : user.impactConnection.connectionStatus) === "STARTED") {
197
+ // Finish the early-created connection before routing so the next
198
+ // step sees the completed status
199
+ await completeConnection(user);
200
+ await refetch();
201
+ }
202
+ const currentStep = getCurrentStep(user);
203
+ setStep(currentStep);
198
204
  }
199
- const currentStep = getCurrentStep(user);
200
- setStep(currentStep);
205
+ routeAfterMaybeCompleting();
201
206
  }
202
207
  }, [host, user, (_e = data === null || data === void 0 ? void 0 : data.user) === null || _e === void 0 ? void 0 : _e.email, errors]);
203
208
  function getFinanceNetworkFilter() {