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

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 (43) hide show
  1. package/dist/cjs/sqm-banking-info-form_10.cjs.entry.js +37 -26
  2. package/dist/cjs/sqm-big-stat_47.cjs.entry.js +1 -1
  3. package/dist/cjs/sqm-stencilbook.cjs.entry.js +56 -2
  4. package/dist/cjs/{sqm-user-info-form-view-c2cad72c.js → sqm-user-info-form-view-60e09262.js} +11 -1
  5. package/dist/cjs/{useIndirectTaxForm-64c0231c.js → useIndirectTaxForm-c439eb81.js} +3 -1
  6. package/dist/collection/components/tax-and-cash/TaxForm.stories.js +3 -0
  7. package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form-view.js +8 -0
  8. package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form.js +2 -1
  9. package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.js +3 -1
  10. package/dist/collection/components/tax-and-cash/sqm-user-info-form/UserInfoFormView.stories.js +51 -1
  11. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +11 -1
  12. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form.js +3 -1
  13. package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +24 -24
  14. package/dist/esm/sqm-banking-info-form_10.entry.js +37 -26
  15. package/dist/esm/sqm-big-stat_47.entry.js +1 -1
  16. package/dist/esm/sqm-stencilbook.entry.js +56 -2
  17. package/dist/esm/{sqm-user-info-form-view-5051c1d0.js → sqm-user-info-form-view-647a2bd5.js} +11 -1
  18. package/dist/esm/{useIndirectTaxForm-d7d6be39.js → useIndirectTaxForm-38cd984e.js} +3 -1
  19. package/dist/esm-es5/sqm-banking-info-form_10.entry.js +1 -1
  20. package/dist/esm-es5/sqm-big-stat_47.entry.js +1 -1
  21. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  22. package/dist/esm-es5/{sqm-user-info-form-view-5051c1d0.js → sqm-user-info-form-view-647a2bd5.js} +1 -1
  23. package/dist/esm-es5/{useIndirectTaxForm-d7d6be39.js → useIndirectTaxForm-38cd984e.js} +1 -1
  24. package/dist/mint-components/mint-components.esm.js +1 -1
  25. package/dist/mint-components/p-1f387c7b.system.js +1 -1
  26. package/dist/mint-components/{p-5959ebdb.system.js → p-34179541.system.js} +1 -1
  27. package/dist/mint-components/{p-1e699fb8.entry.js → p-4065ae93.entry.js} +2 -2
  28. package/dist/mint-components/{p-6c9f7515.system.entry.js → p-6fd8981d.system.entry.js} +1 -1
  29. package/dist/mint-components/{p-5f8fa87c.js → p-8d30945a.js} +1 -1
  30. package/dist/mint-components/{p-1e1b03fa.js → p-aa2c6585.js} +4 -4
  31. package/dist/mint-components/{p-d67f8e0f.system.js → p-aab8a207.system.js} +2 -2
  32. package/dist/mint-components/{p-0c6bd136.system.entry.js → p-af8b8c06.system.entry.js} +1 -1
  33. package/dist/mint-components/{p-d0ed1c1b.entry.js → p-b3f25c0e.entry.js} +6 -6
  34. package/dist/mint-components/{p-29b267a9.system.entry.js → p-c31966e3.system.entry.js} +1 -1
  35. package/dist/mint-components/{p-aed3c69d.entry.js → p-dd5c1db9.entry.js} +1 -1
  36. package/dist/types/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form-view.d.ts +1 -0
  37. package/dist/types/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.d.ts +1 -0
  38. package/dist/types/components/tax-and-cash/sqm-user-info-form/UserInfoFormView.stories.d.ts +1 -0
  39. package/dist/types/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.d.ts +2 -0
  40. package/dist/types/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.d.ts +2 -0
  41. package/docs/docs.docx +0 -0
  42. package/grapesjs/grapesjs.js +1 -1
  43. package/package.json +1 -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;
@@ -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);
@@ -4556,7 +4565,7 @@ function useUserInfoForm(props) {
4556
4565
  }
4557
4566
  }, [currencySearch, currencies]);
4558
4567
  async function connectPartner(formData) {
4559
- var _a, _b, _c, _d;
4568
+ var _a, _b, _c, _d, _e, _f;
4560
4569
  const vars = {
4561
4570
  user: {
4562
4571
  id: user.id,
@@ -4573,36 +4582,31 @@ function useUserInfoForm(props) {
4573
4582
  phoneNumber: subregions.toDomesticNumber(formData.phoneNumberCountryCode, formData.phoneNumber),
4574
4583
  phoneNumberCountryCode: formData.phoneNumberCountryCode,
4575
4584
  };
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;
4585
+ // if user went through early partner creation, connectionStatus === "STARTED"
4586
+ // otherwise trigger legacy partner creation
4587
+ const userData = data$1 === null || data$1 === void 0 ? void 0 : data$1.user;
4579
4588
  let result = null;
4580
4589
  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))
4590
+ if (((_a = userData === null || userData === void 0 ? void 0 : userData.impactConnection) === null || _a === void 0 ? void 0 : _a.connectionStatus) === "STARTED") {
4591
+ result = await completeImpactPartner({
4592
+ vars,
4593
+ });
4594
+ connectionResult = (_b = result) === null || _b === void 0 ? void 0 : _b.completeImpactConnection;
4595
+ }
4596
+ else {
4597
+ result = await connectImpactPartner({
4598
+ vars,
4599
+ });
4600
+ connectionResult = (_c = result) === null || _c === void 0 ? void 0 : _c.createImpactConnection;
4601
+ }
4602
+ if (!result || ((_d = result) === null || _d === void 0 ? void 0 : _d.message))
4599
4603
  throw new Error();
4600
4604
  if (!(connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.success)) {
4601
4605
  console.error("Failed to create Impact connection: ", connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.validationErrors);
4602
4606
  throw new Error();
4603
4607
  }
4604
4608
  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;
4609
+ 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
4610
  const hasValidCurrentDocument = subregions.validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
4607
4611
  // Fire form change event
4608
4612
  window.dispatchEvent(new Event(eventKeys.TAX_FORM_UPDATED_EVENT_KEY));
@@ -4736,6 +4740,11 @@ function useUserInfoForm(props) {
4736
4740
  loading: loading || connectLoading || completeLoading,
4737
4741
  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
4742
  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),
4743
+ // Show banner when pre-existing partner is created with legacy mutation createImpactConnection
4744
+ 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) &&
4745
+ ((_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",
4746
+ 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) &&
4747
+ ((_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
4748
  formState: {
4740
4749
  ...userFormContext,
4741
4750
  errors: formErrors,
@@ -4953,6 +4962,8 @@ function useDemoUserInfoForm(props) {
4953
4962
  loading: false,
4954
4963
  isPartner: false,
4955
4964
  isUser: false,
4965
+ isPartnerLegacy: false,
4966
+ isUserLegacy: false,
4956
4967
  loadingError: false,
4957
4968
  formState: {
4958
4969
  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
  /**
@@ -37,7 +37,7 @@ 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
43
  const sqmPartnerInfoModalView = require('./sqm-partner-info-modal-view-2b6fee0f.js');
@@ -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,
@@ -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,
@@ -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,
@@ -12,7 +12,10 @@ const mockCountries = [
12
12
  { countryCode: "FR", displayName: "France" },
13
13
  { countryCode: "ES", displayName: "Spain" },
14
14
  // Show handling of long country names
15
- { countryCode: "CD", displayName: "Congo, The Democratic Republic of the Congo" },
15
+ {
16
+ countryCode: "CD",
17
+ displayName: "Congo, The Democratic Republic of the Congo",
18
+ },
16
19
  ];
17
20
  const mockCurrencies = [
18
21
  { currencyCode: "USD", displayName: "US Dollar" },
@@ -103,6 +106,8 @@ const baseProps = {
103
106
  loading: false,
104
107
  isPartner: false,
105
108
  isUser: false,
109
+ isPartnerLegacy: false,
110
+ isUserLegacy: false,
106
111
  formState: {
107
112
  firstName: "",
108
113
  lastName: "",
@@ -215,6 +220,7 @@ export const PartnerAccount = () => {
215
220
  return (h(UserInfoFormView, Object.assign({}, baseProps, { states: {
216
221
  ...baseProps.states,
217
222
  isPartner: true,
223
+ isPartnerLegacy: true,
218
224
  formState: {
219
225
  ...baseProps.states.formState,
220
226
  firstName: "Jane",
@@ -234,10 +240,53 @@ export const PartnerAccount = () => {
234
240
  partnerData: mockPartnerData,
235
241
  } })));
236
242
  };
243
+ // Early partner created via <sqm-partner-info-modal>: connectionStatus is "STARTED",
244
+ // publisher has only countryCode + currency populated. Banner must NOT show; only
245
+ // country + currency disabled; firstName/lastName disabled via userData; everything
246
+ // else (phone, address, city, state, postalCode) stays editable.
247
+ export const EarlyPartnerFromModal = () => {
248
+ return (h(UserInfoFormView, Object.assign({}, baseProps, { states: {
249
+ ...baseProps.states,
250
+ isPartner: true,
251
+ isUser: true,
252
+ isPartnerLegacy: false,
253
+ isUserLegacy: false,
254
+ formState: {
255
+ ...baseProps.states.formState,
256
+ firstName: "Jane",
257
+ lastName: "Smith",
258
+ email: "jane.smith@example.com",
259
+ countryCode: "US",
260
+ currency: "USD",
261
+ phoneNumberCountryCode: undefined,
262
+ phoneNumber: undefined,
263
+ address: undefined,
264
+ city: undefined,
265
+ state: undefined,
266
+ postalCode: undefined,
267
+ },
268
+ }, data: {
269
+ ...baseProps.data,
270
+ partnerData: {
271
+ ...mockPartnerData,
272
+ billingAddress: undefined,
273
+ billingCity: undefined,
274
+ billingState: undefined,
275
+ billingPostalCode: undefined,
276
+ phoneNumber: undefined,
277
+ phoneNumberCountryCode: undefined,
278
+ },
279
+ userData: {
280
+ firstName: "Jane",
281
+ lastName: "Smith",
282
+ },
283
+ } })));
284
+ };
237
285
  export const UserAccount = () => {
238
286
  return (h(UserInfoFormView, Object.assign({}, baseProps, { states: {
239
287
  ...baseProps.states,
240
288
  isUser: true,
289
+ isUserLegacy: true,
241
290
  formState: {
242
291
  ...baseProps.states.formState,
243
292
  firstName: "Bob",
@@ -256,6 +305,7 @@ export const UserAccountMissingLastName = () => {
256
305
  return (h(UserInfoFormView, Object.assign({}, baseProps, { states: {
257
306
  ...baseProps.states,
258
307
  isUser: true,
308
+ isUserLegacy: true,
259
309
  formState: {
260
310
  ...baseProps.states.formState,
261
311
  firstName: "Bob",
@@ -334,6 +334,14 @@ export const UserInfoFormView = (props) => {
334
334
  }, {
335
335
  supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
336
336
  })))),
337
+ (states.isPartnerLegacy || states.isUserLegacy) && (h("sqm-form-message", { loading: states.loading, type: "info" },
338
+ h("p", { part: "alert-title" }, text.isPartnerAlertHeader),
339
+ h("p", { part: "alert-description" }, intl.formatMessage({
340
+ id: "isPartnerAlertDescription",
341
+ defaultMessage: text.isPartnerAlertDescription,
342
+ }, {
343
+ supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, text.supportLink)),
344
+ })))),
337
345
  h("div", null,
338
346
  h("div", { class: classes.InputContainer },
339
347
  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) ? {
@@ -386,7 +394,9 @@ export const UserInfoFormView = (props) => {
386
394
  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 :
387
395
  _b.dial_code));
388
396
  })),
389
- h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", id: "phoneNumber", name: "/phoneNumber", value: formState.phoneNumber, "onSl-input": (e) => {
397
+ h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", id: "phoneNumber", name: "/phoneNumber", value: formState.phoneNumber !== null
398
+ ? formState.phoneNumber
399
+ : "", "onSl-input": (e) => {
390
400
  var _a;
391
401
  const target = e.target;
392
402
  const country = (((_a = refs.phoneCountryRef.current) === null || _a === void 0 ? void 0 : _a.value) || "US");
@@ -864,7 +864,7 @@ export class TaxForm {
864
864
  "mutable": false,
865
865
  "complexType": {
866
866
  "original": "DemoData<UseUserInfoFormResult>",
867
- "resolved": "{ states?: { step: string; hideState: boolean; hideSteps: boolean; disabled: boolean; loadingError: boolean; loading: boolean; isPartner: boolean; isUser: boolean; formState: { errors: {}; firstName: string; lastName: string; email: string; phoneNumberCountryCode: string; phoneNumber: string; countryCode: string; currency: string; address: string; city: string; state: string; postalCode: string; }; }; refs?: { formRef: Ref<HTMLFormElement>; currencyRef: Ref<HTMLSelectElement>; phoneCountryRef: Ref<HTMLSelectElement>; }; data?: { currencies: { displayName: string; currencyCode: string; }[]; countries: TaxCountry[]; phoneCountries: TaxCountry[]; allCurrencies: { displayName: string; currencyCode: string; }[]; allCountries: TaxCountry[]; regionLabelEnum: \"STATE\" | \"PROVINCE\" | \"REGION\"; regions: { label: string; value: string; }[]; partnerData: ImpactPublisher; userData: ImpactUser; }; setStep?: (value: string) => void; onSubmit?: (event: any) => Promise<void>; }",
867
+ "resolved": "{ states?: { step: string; hideState: boolean; hideSteps: boolean; disabled: boolean; loadingError: boolean; loading: boolean; isPartner: boolean; isUser: boolean; isUserLegacy: boolean; isPartnerLegacy: boolean; formState: { errors: {}; firstName: string; lastName: string; email: string; phoneNumberCountryCode: string; phoneNumber: string; countryCode: string; currency: string; address: string; city: string; state: string; postalCode: string; }; }; refs?: { formRef: Ref<HTMLFormElement>; currencyRef: Ref<HTMLSelectElement>; phoneCountryRef: Ref<HTMLSelectElement>; }; data?: { currencies: { displayName: string; currencyCode: string; }[]; countries: TaxCountry[]; phoneCountries: TaxCountry[]; allCurrencies: { displayName: string; currencyCode: string; }[]; allCountries: TaxCountry[]; regionLabelEnum: \"STATE\" | \"PROVINCE\" | \"REGION\"; regions: { label: string; value: string; }[]; partnerData: ImpactPublisher; userData: ImpactUser; }; setStep?: (value: string) => void; onSubmit?: (event: any) => Promise<void>; }",
868
868
  "references": {
869
869
  "DemoData": {
870
870
  "location": "import",
@@ -927,6 +927,8 @@ function useDemoUserInfoForm(props) {
927
927
  loading: false,
928
928
  isPartner: false,
929
929
  isUser: false,
930
+ isPartnerLegacy: false,
931
+ isUserLegacy: false,
930
932
  loadingError: false,
931
933
  formState: {
932
934
  errors: {
@@ -16,7 +16,7 @@ const GET_INDIRECT_TAX_COUNTRY_CODE = gql `
16
16
  }
17
17
  `;
18
18
  export function useUserInfoForm(props) {
19
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
19
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
20
20
  const currencyRef = useRef(undefined);
21
21
  const phoneCountryRef = useRef(undefined);
22
22
  const formRef = useRef(null);
@@ -136,7 +136,7 @@ export function useUserInfoForm(props) {
136
136
  }
137
137
  }, [currencySearch, currencies]);
138
138
  async function connectPartner(formData) {
139
- var _a, _b, _c, _d;
139
+ var _a, _b, _c, _d, _e, _f;
140
140
  const vars = {
141
141
  user: {
142
142
  id: user.id,
@@ -153,36 +153,31 @@ export function useUserInfoForm(props) {
153
153
  phoneNumber: toDomesticNumber(formData.phoneNumberCountryCode, formData.phoneNumber),
154
154
  phoneNumberCountryCode: formData.phoneNumberCountryCode,
155
155
  };
156
- // If the partner has already been started call completeImpactPartner to
157
- // update the remaining details. Otherwise create a new connection.
158
- // const userData = data?.user;
156
+ // if user went through early partner creation, connectionStatus === "STARTED"
157
+ // otherwise trigger legacy partner creation
158
+ const userData = data === null || data === void 0 ? void 0 : data.user;
159
159
  let result = null;
160
160
  let connectionResult;
161
- result = await completeImpactPartner({
162
- vars,
163
- });
164
- connectionResult = (_a = result) === null || _a === void 0 ? void 0 : _a.completeImpactConnection;
165
- // if (userData?.impactConnection?.connectionStatus === "STARTED") {
166
- // result = await completeImpactPartner({
167
- // vars,
168
- // });
169
- // connectionResult = (result as CompletePartnerResult)
170
- // ?.completeImpactConnection;
171
- // } else {
172
- // result = await connectImpactPartner({
173
- // vars,
174
- // });
175
- // connectionResult = (result as ConnectPartnerResult)
176
- // ?.createImpactConnection;
177
- // }
178
- if (!result || ((_b = result) === null || _b === void 0 ? void 0 : _b.message))
161
+ if (((_a = userData === null || userData === void 0 ? void 0 : userData.impactConnection) === null || _a === void 0 ? void 0 : _a.connectionStatus) === "STARTED") {
162
+ result = await completeImpactPartner({
163
+ vars,
164
+ });
165
+ connectionResult = (_b = result) === null || _b === void 0 ? void 0 : _b.completeImpactConnection;
166
+ }
167
+ else {
168
+ result = await connectImpactPartner({
169
+ vars,
170
+ });
171
+ connectionResult = (_c = result) === null || _c === void 0 ? void 0 : _c.createImpactConnection;
172
+ }
173
+ if (!result || ((_d = result) === null || _d === void 0 ? void 0 : _d.message))
179
174
  throw new Error();
180
175
  if (!(connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.success)) {
181
176
  console.error("Failed to create Impact connection: ", connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.validationErrors);
182
177
  throw new Error();
183
178
  }
184
179
  await refetch();
185
- 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;
180
+ 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;
186
181
  const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
187
182
  // Fire form change event
188
183
  window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
@@ -316,6 +311,11 @@ export function useUserInfoForm(props) {
316
311
  loading: loading || connectLoading || completeLoading,
317
312
  isPartner: !!((_g = (_f = data === null || data === void 0 ? void 0 : data.user) === null || _f === void 0 ? void 0 : _f.impactConnection) === null || _g === void 0 ? void 0 : _g.publisher),
318
313
  isUser: !!((_j = (_h = data === null || data === void 0 ? void 0 : data.user) === null || _h === void 0 ? void 0 : _h.impactConnection) === null || _j === void 0 ? void 0 : _j.user),
314
+ // Show banner when pre-existing partner is created with legacy mutation createImpactConnection
315
+ isUserLegacy: !!((_l = (_k = data === null || data === void 0 ? void 0 : data.user) === null || _k === void 0 ? void 0 : _k.impactConnection) === null || _l === void 0 ? void 0 : _l.user) &&
316
+ ((_o = (_m = data === null || data === void 0 ? void 0 : data.user) === null || _m === void 0 ? void 0 : _m.impactConnection) === null || _o === void 0 ? void 0 : _o.connectionStatus) !== "STARTED",
317
+ isPartnerLegacy: !!((_q = (_p = data === null || data === void 0 ? void 0 : data.user) === null || _p === void 0 ? void 0 : _p.impactConnection) === null || _q === void 0 ? void 0 : _q.publisher) &&
318
+ ((_s = (_r = data === null || data === void 0 ? void 0 : data.user) === null || _r === void 0 ? void 0 : _r.impactConnection) === null || _s === void 0 ? void 0 : _s.connectionStatus) !== "STARTED",
319
319
  formState: {
320
320
  ...userFormContext,
321
321
  errors: formErrors,