@saasquatch/mint-components 1.15.4-0 → 1.15.4-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/cjs/sqm-banking-info-form_17.cjs.entry.js +17 -35
  2. package/dist/cjs/{sqm-base-registration-form-view-8029d30e.js → sqm-base-registration-form-view-66f99821.js} +9 -4
  3. package/dist/cjs/{sqm-invoice-table-view-3f60fba9.js → sqm-invoice-table-view-5c74607f.js} +0 -1
  4. package/dist/cjs/sqm-portal-google-registration-form.cjs.entry.js +29 -19
  5. package/dist/cjs/sqm-stencilbook.cjs.entry.js +4 -4
  6. package/dist/collection/components/sqm-base-registration/BaseRegistrationForm.stories.js +2 -2
  7. package/dist/collection/components/sqm-base-registration/sqm-base-registration-form-view.js +9 -4
  8. package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field.js +1 -1
  9. package/dist/collection/components/sqm-dropdown-field/sqm-dropdown-field.js +1 -1
  10. package/dist/collection/components/sqm-input-field/sqm-input-field.js +1 -1
  11. package/dist/collection/components/sqm-marketing-emails-checkbox/sqm-marketing-emails-checkbox.js +1 -1
  12. package/dist/collection/components/sqm-password-field/sqm-password-field.js +2 -2
  13. package/dist/collection/components/sqm-portal-google-registration-form/sqm-portal-google-registration-form.js +7 -5
  14. package/dist/collection/components/sqm-portal-google-registration-form/usePortalGoogleRegistrationForm.js +23 -15
  15. package/dist/collection/components/tax-and-cash/TaxForm.stories.js +0 -1
  16. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +12 -23
  17. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form.js +1 -1
  18. package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +4 -18
  19. package/dist/esm/sqm-banking-info-form_17.entry.js +17 -35
  20. package/dist/esm/{sqm-base-registration-form-view-dafba287.js → sqm-base-registration-form-view-d81e316a.js} +9 -4
  21. package/dist/esm/{sqm-invoice-table-view-01453fa3.js → sqm-invoice-table-view-3491dd80.js} +0 -1
  22. package/dist/esm/sqm-portal-google-registration-form.entry.js +29 -19
  23. package/dist/esm/sqm-stencilbook.entry.js +4 -4
  24. package/dist/esm-es5/sqm-banking-info-form_17.entry.js +1 -1
  25. package/dist/esm-es5/sqm-base-registration-form-view-d81e316a.js +1 -0
  26. package/dist/esm-es5/sqm-invoice-table-view-3491dd80.js +1 -0
  27. package/dist/esm-es5/sqm-portal-google-registration-form.entry.js +1 -1
  28. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  29. package/dist/mint-components/mint-components.esm.js +1 -1
  30. package/dist/mint-components/{p-4a731079.entry.js → p-268fad47.entry.js} +2 -2
  31. package/dist/mint-components/p-37996351.system.js +1 -1
  32. package/dist/mint-components/{p-6f6cd994.entry.js → p-3d73cd84.entry.js} +2 -2
  33. package/dist/mint-components/p-49932f12.system.js +1 -0
  34. package/dist/mint-components/p-7176a952.entry.js +1 -0
  35. package/dist/mint-components/p-8d0393d9.system.entry.js +1 -0
  36. package/dist/mint-components/p-9308221f.js +1 -0
  37. package/dist/mint-components/p-bc021969.system.js +1 -0
  38. package/dist/mint-components/{p-02832118.system.entry.js → p-e5186714.system.entry.js} +1 -1
  39. package/dist/mint-components/{p-2ba713d6.system.entry.js → p-e64e8354.system.entry.js} +1 -1
  40. package/dist/mint-components/p-e8e48982.js +1 -0
  41. package/dist/types/components/sqm-base-registration/sqm-base-registration-form-view.d.ts +2 -1
  42. package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field.d.ts +1 -1
  43. package/dist/types/components/sqm-dropdown-field/sqm-dropdown-field.d.ts +1 -1
  44. package/dist/types/components/sqm-input-field/sqm-input-field.d.ts +1 -1
  45. package/dist/types/components/sqm-marketing-emails-checkbox/sqm-marketing-emails-checkbox.d.ts +1 -1
  46. package/dist/types/components/sqm-password-field/sqm-password-field.d.ts +1 -1
  47. package/dist/types/components/sqm-portal-google-registration-form/usePortalGoogleRegistrationForm.d.ts +2 -1
  48. package/dist/types/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.d.ts +0 -2
  49. package/dist/types/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.d.ts +0 -1
  50. package/dist/types/components.d.ts +0 -13
  51. package/dist/types/global/android.d.ts +7 -0
  52. package/dist/types/global/demo.d.ts +2 -0
  53. package/dist/types/stories/features.d.ts +4 -0
  54. package/dist/types/stories/templates.d.ts +4 -0
  55. package/docs/docs.docx +0 -0
  56. package/docs/raisins.json +1 -1
  57. package/package.json +1 -1
  58. package/dist/esm-es5/sqm-base-registration-form-view-dafba287.js +0 -1
  59. package/dist/esm-es5/sqm-invoice-table-view-01453fa3.js +0 -1
  60. package/dist/mint-components/p-2651ef99.system.js +0 -1
  61. package/dist/mint-components/p-35701119.js +0 -1
  62. package/dist/mint-components/p-59fe6066.js +0 -1
  63. package/dist/mint-components/p-86a5db85.system.js +0 -1
  64. package/dist/mint-components/p-9c4f4cd6.entry.js +0 -1
  65. package/dist/mint-components/p-a3647f70.system.entry.js +0 -1
@@ -18,7 +18,7 @@ const luxon = require('./luxon-2926d85f.js');
18
18
  const useReferralTable = require('./useReferralTable-7c3f9600.js');
19
19
  const sqmTextSpanView = require('./sqm-text-span-view-0aa82125.js');
20
20
  const ErrorView = require('./ErrorView-b2fcf954.js');
21
- const sqmInvoiceTableView = require('./sqm-invoice-table-view-3f60fba9.js');
21
+ const sqmInvoiceTableView = require('./sqm-invoice-table-view-5c74607f.js');
22
22
  const extractProps = require('./extractProps-fd93ba62.js');
23
23
  const keys = require('./keys-cff24974.js');
24
24
  const usePayoutStatus = require('./usePayoutStatus-733ef29a.js');
@@ -7751,12 +7751,6 @@ const UserInfoFormView = (props) => {
7751
7751
  default:
7752
7752
  regionLabel = text.state;
7753
7753
  }
7754
- function isDisabledInput(field) {
7755
- var _a;
7756
- if (states.isPartner && !!((_a = data.partnerData) === null || _a === void 0 ? void 0 : _a[field]))
7757
- return true;
7758
- return false;
7759
- }
7760
7754
  return (index.h("sl-form", { class: classes.FormWrapper, "onSl-submit": callbacks.onSubmit, ref: (el) => (refs.formRef.current = el), novalidate: true },
7761
7755
  index.h("style", { type: "text/css" },
7762
7756
  styleString$6,
@@ -7804,22 +7798,18 @@ const UserInfoFormView = (props) => {
7804
7798
  }))),
7805
7799
  index.h("div", null,
7806
7800
  index.h("div", { class: classes.InputContainer },
7807
- index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", value: formState.firstName, label: text.firstName, disabled: states.disabled ||
7808
- states.isUser ||
7809
- isDisabledInput("firstName") }, (((_b = formState.errors) === null || _b === void 0 ? void 0 : _b.firstName) ? {
7801
+ index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", value: formState.firstName, label: text.firstName, disabled: states.disabled || states.isUser || states.isPartner }, (((_b = formState.errors) === null || _b === void 0 ? void 0 : _b.firstName) ? {
7810
7802
  class: classes.ErrorInput,
7811
7803
  helpText: sqmInvoiceTableView.formatErrorMessage(text.firstName, formState.errors.firstName),
7812
7804
  }
7813
7805
  : {}), { id: "firstName", name: "/firstName", required: true })),
7814
- index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", value: formState.lastName, label: text.lastName, disabled: states.disabled ||
7815
- states.isUser ||
7816
- isDisabledInput("lastName") }, (((_c = formState.errors) === null || _c === void 0 ? void 0 : _c.lastName) ? {
7806
+ index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", value: formState.lastName, label: text.lastName, disabled: states.disabled || states.isUser || states.isPartner }, (((_c = formState.errors) === null || _c === void 0 ? void 0 : _c.lastName) ? {
7817
7807
  class: classes.ErrorInput,
7818
7808
  helpText: sqmInvoiceTableView.formatErrorMessage(text.lastName, formState.errors.lastName),
7819
7809
  }
7820
7810
  : {}), { id: "lastName", name: "/lastName", required: true })),
7821
7811
  index.h("sl-input", { exportparts: "label: input-label, base: input-base", value: formState.email, label: text.email, disabled: true, id: "email", name: "/email", required: true }),
7822
- index.h("sl-select", Object.assign({ id: "countryCode", exportparts: "label: input-label, base: input-base", name: "/countryCode", label: text.country, value: formState.countryCode, disabled: states.disabled || isDisabledInput("countryCode") }, (((_d = formState.errors) === null || _d === void 0 ? void 0 : _d.countryCode) ? {
7812
+ index.h("sl-select", Object.assign({ id: "countryCode", exportparts: "label: input-label, base: input-base", name: "/countryCode", label: text.country, value: formState.countryCode, disabled: states.disabled || states.isPartner }, (((_d = formState.errors) === null || _d === void 0 ? void 0 : _d.countryCode) ? {
7823
7813
  class: classes.ErrorInput,
7824
7814
  helpText: sqmInvoiceTableView.formatErrorMessage(text.country, formState.errors.countryCode),
7825
7815
  }
@@ -7835,8 +7825,7 @@ const UserInfoFormView = (props) => {
7835
7825
  index.h("div", { class: classes.PhoneInputsSection },
7836
7826
  index.h("p", null, text.phoneNumber),
7837
7827
  index.h("div", { class: classes.PhoneInputsContainer },
7838
- index.h("sl-select", Object.assign({ id: "phoneNumberCountryCode", exportparts: "label: input-label, base: input-base", name: "/phoneNumberCountryCode", value: formState.phoneNumberCountryCode, disabled: states.disabled ||
7839
- isDisabledInput("phoneNumberCountryCode"), ref: (el) => (refs.phoneCountryRef.current = el) }, (((_g = formState.errors) === null || _g === void 0 ? void 0 : _g.phoneNumberCountryCode) ? {
7828
+ index.h("sl-select", Object.assign({ id: "phoneNumberCountryCode", exportparts: "label: input-label, base: input-base", name: "/phoneNumberCountryCode", value: formState.phoneNumberCountryCode, disabled: states.disabled || states.isPartner, ref: (el) => (refs.phoneCountryRef.current = el) }, (((_g = formState.errors) === null || _g === void 0 ? void 0 : _g.phoneNumberCountryCode) ? {
7840
7829
  class: classes.ErrorInput,
7841
7830
  }
7842
7831
  : {}), { required: true, "onSl-select": (e) => callbacks.onFormChange("phoneCountry", e) }),
@@ -7862,7 +7851,7 @@ const UserInfoFormView = (props) => {
7862
7851
  // Naive phone number validation
7863
7852
  sqmInvoiceTableView.validateBillingField(/[a-zA-Z]+/, value) &&
7864
7853
  sqmInvoiceTableView.formatErrorMessage(text.phoneNumber, text.error.fieldInvalidError);
7865
- }, disabled: states.disabled || isDisabledInput("phoneNumber") }, (((_k = formState.errors) === null || _k === void 0 ? void 0 : _k.phoneNumber) ? {
7854
+ }, disabled: states.disabled || states.isPartner }, (((_k = formState.errors) === null || _k === void 0 ? void 0 : _k.phoneNumber) ? {
7866
7855
  class: classes.ErrorInput,
7867
7856
  helpText: sqmInvoiceTableView.formatErrorMessage(text.phoneNumber, formState.errors.phoneNumber),
7868
7857
  }
@@ -7870,7 +7859,7 @@ const UserInfoFormView = (props) => {
7870
7859
  index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", label: text.address, id: "address", name: "/address", value: formState.address, validationError: ({ value }) =>
7871
7860
  // Checks for non-ASCII characters
7872
7861
  !sqmInvoiceTableView.validateBillingField(/^[\x20-\xFF]+$/, value) &&
7873
- sqmInvoiceTableView.formatErrorMessage(text.address, text.error.invalidCharacterError), disabled: states.disabled || isDisabledInput("address") }, (((_l = formState.errors) === null || _l === void 0 ? void 0 : _l.address) ? {
7862
+ sqmInvoiceTableView.formatErrorMessage(text.address, text.error.invalidCharacterError), disabled: states.disabled || states.isPartner }, (((_l = formState.errors) === null || _l === void 0 ? void 0 : _l.address) ? {
7874
7863
  class: classes.ErrorInput,
7875
7864
  helpText: sqmInvoiceTableView.formatErrorMessage(text.address, formState.errors.address),
7876
7865
  }
@@ -7878,22 +7867,22 @@ const UserInfoFormView = (props) => {
7878
7867
  index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", label: text.city, id: "city", name: "/city", value: formState.city, validationError: ({ value }) =>
7879
7868
  // Checks for non-ASCII characters
7880
7869
  !sqmInvoiceTableView.validateBillingField(/^[\x20-\xFF]+$/, value) &&
7881
- sqmInvoiceTableView.formatErrorMessage(text.city, text.error.invalidCharacterError), disabled: states.disabled || isDisabledInput("city") }, (((_m = formState.errors) === null || _m === void 0 ? void 0 : _m.city) ? {
7870
+ sqmInvoiceTableView.formatErrorMessage(text.city, text.error.invalidCharacterError), disabled: states.disabled || states.isPartner }, (((_m = formState.errors) === null || _m === void 0 ? void 0 : _m.city) ? {
7882
7871
  class: classes.ErrorInput,
7883
7872
  helpText: sqmInvoiceTableView.formatErrorMessage(text.city, formState.errors.city),
7884
7873
  }
7885
7874
  : {}), { required: true })),
7886
- !states.hideState && (index.h("sl-select", Object.assign({ label: regionLabel, exportparts: "label: input-label, base: input-base", id: "state", name: "/state", value: formState.state, disabled: states.disabled || isDisabledInput("state") }, (((_o = formState.errors) === null || _o === void 0 ? void 0 : _o.state) ? {
7875
+ !states.hideState && (index.h("sl-select", Object.assign({ label: regionLabel, exportparts: "label: input-label, base: input-base", id: "state", name: "/state", value: formState.state, disabled: states.disabled || states.isPartner }, (((_o = formState.errors) === null || _o === void 0 ? void 0 : _o.state) ? {
7887
7876
  class: classes.ErrorInput,
7888
7877
  helpText: sqmInvoiceTableView.formatErrorMessage(text.state, formState.errors.state),
7889
7878
  }
7890
7879
  : {}), { required: true }), (_p = data.regions) === null || _p === void 0 ? void 0 : _p.map((r) => (index.h("sl-menu-item", { value: r.value }, r.label))))),
7891
- index.h("sl-input", Object.assign({ label: text.postalCode, exportparts: "label: input-label, base: input-base", id: "postalCode", name: "/postalCode", value: formState.postalCode, disabled: states.disabled || isDisabledInput("postalCode") }, (((_q = formState.errors) === null || _q === void 0 ? void 0 : _q.postalCode) ? {
7880
+ index.h("sl-input", Object.assign({ label: text.postalCode, exportparts: "label: input-label, base: input-base", id: "postalCode", name: "/postalCode", value: formState.postalCode, disabled: states.disabled || states.isPartner }, (((_q = formState.errors) === null || _q === void 0 ? void 0 : _q.postalCode) ? {
7892
7881
  class: classes.ErrorInput,
7893
7882
  helpText: sqmInvoiceTableView.formatErrorMessage(text.postalCode, formState.errors.postalCode),
7894
7883
  }
7895
7884
  : {}), { required: true })),
7896
- index.h("sl-select", Object.assign({ id: "currency", exportparts: "label: input-label, base: input-base", name: "/currency", label: text.currency, menu: true, value: formState.currency, disabled: states.disabled || isDisabledInput("currency"), helpText: text.currencyHelpText }, (((_r = formState.errors) === null || _r === void 0 ? void 0 : _r.currency) ? {
7885
+ index.h("sl-select", Object.assign({ id: "currency", exportparts: "label: input-label, base: input-base", name: "/currency", label: text.currency, menu: true, value: formState.currency, disabled: states.disabled || states.isPartner, helpText: text.currencyHelpText }, (((_r = formState.errors) === null || _r === void 0 ? void 0 : _r.currency) ? {
7897
7886
  class: classes.ErrorInput,
7898
7887
  helpText: sqmInvoiceTableView.formatErrorMessage(text.currency, formState.errors.currency),
7899
7888
  }
@@ -7915,13 +7904,13 @@ const UserInfoFormView = (props) => {
7915
7904
  index.h("div", { class: classes.CheckboxWrapper },
7916
7905
  index.h("sl-checkbox", { exportparts: "label: input-label, base: input-base", checked: formState.allowBankingCollection === true, "onSl-change": (e) => {
7917
7906
  e.target.value = e.target.checked;
7918
- }, disabled: states.disabled, required: true, value: formState.allowBankingCollection, id: "allowBankingCollection", name: "/allowBankingCollection" }, bankingCollectionText),
7907
+ }, disabled: states.isPartner ? false : states.disabled, required: true, value: formState.allowBankingCollection, id: "allowBankingCollection", name: "/allowBankingCollection" }, bankingCollectionText),
7919
7908
  ((_u = formState.errors) === null || _u === void 0 ? void 0 : _u.allowBankingCollection) && (index.h("p", { class: classes.ErrorText }, sqmInvoiceTableView.formatErrorMessage(text.termsAndConditionsLabel, formState.errors.allowBankingCollection))))),
7920
- index.h("sl-button", { type: "primary", disabled: states.disabled, submit: true, exportparts: "base: primarybutton-base" }, text.continueButton))))));
7909
+ index.h("sl-button", { type: "primary", disabled: states.isPartner ? false : states.disabled, submit: true, exportparts: "base: primarybutton-base" }, text.continueButton))))));
7921
7910
  };
7922
7911
 
7923
7912
  function useUserInfoForm(props) {
7924
- var _a, _b, _c, _d, _e, _f;
7913
+ var _a, _b, _c, _d;
7925
7914
  const currencyRef = stencilHooks_module.useRef(undefined);
7926
7915
  const phoneCountryRef = stencilHooks_module.useRef(undefined);
7927
7916
  const formRef = stencilHooks_module.useRef(null);
@@ -8073,15 +8062,9 @@ function useUserInfoForm(props) {
8073
8062
  postalCode: userData.postalCode,
8074
8063
  currency: userData.currency,
8075
8064
  });
8076
- const skipNextStep = getSkipNextStep(userData);
8077
- const nextStep = context.overrideNextStep || skipNextStep ? "/3" : "/2";
8065
+ const nextStep = context.overrideNextStep || "/2";
8078
8066
  setStep(nextStep);
8079
8067
  }
8080
- function getSkipNextStep(userData) {
8081
- if (userData.countryCode === "US")
8082
- return true;
8083
- return true;
8084
- }
8085
8068
  const hasStates = ["ES", "AU", "US", "CA"].includes(userFormContext.countryCode);
8086
8069
  const regionObj = hasStates
8087
8070
  ? sqmInvoiceTableView.ADDRESS_REGIONS[userFormContext === null || userFormContext === void 0 ? void 0 : userFormContext.countryCode]
@@ -8109,7 +8092,6 @@ function useUserInfoForm(props) {
8109
8092
  allCountries: countries,
8110
8093
  regionLabelEnum: regionObj === null || regionObj === void 0 ? void 0 : regionObj.labelEnum,
8111
8094
  regions: (regionObj === null || regionObj === void 0 ? void 0 : regionObj.regions) || [],
8112
- partnerData: (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher,
8113
8095
  },
8114
8096
  states: {
8115
8097
  step: step === null || step === void 0 ? void 0 : step.replace("/", ""),
@@ -8118,8 +8100,8 @@ function useUserInfoForm(props) {
8118
8100
  disabled: loading,
8119
8101
  loadingError: !!(userError === null || userError === void 0 ? void 0 : userError.message),
8120
8102
  loading: loading,
8121
- isPartner: !!((_d = (_c = data === null || data === void 0 ? void 0 : data.user) === null || _c === void 0 ? void 0 : _c.impactConnection) === null || _d === void 0 ? void 0 : _d.publisher),
8122
- isUser: !!((_f = (_e = data === null || data === void 0 ? void 0 : data.user) === null || _e === void 0 ? void 0 : _e.impactConnection) === null || _f === void 0 ? void 0 : _f.user),
8103
+ isPartner: !!((_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher),
8104
+ isUser: !!((_d = (_c = data === null || data === void 0 ? void 0 : data.user) === null || _c === void 0 ? void 0 : _c.impactConnection) === null || _d === void 0 ? void 0 : _d.user),
8123
8105
  formState: {
8124
8106
  ...userFormContext,
8125
8107
  errors: formErrors,
@@ -40,6 +40,7 @@ sqm-portal-register {
40
40
  const sheet = JSS.createStyleSheet(style);
41
41
  const styleString = sheet.toString();
42
42
  function BaseRegistrationFormView(props) {
43
+ var _a, _b;
43
44
  const { states, content, callbacks } = props;
44
45
  return (index.h("div", { class: sheet.classes.Wrapper },
45
46
  index.h("style", { type: "text/css" },
@@ -47,10 +48,8 @@ function BaseRegistrationFormView(props) {
47
48
  styleString),
48
49
  index.h(sqmTextSpanView.TextSpanView, { type: "h3" }, content.pageLabel),
49
50
  index.h("sl-form", { class: sheet.classes.Column, "onSl-submit": callbacks.handleEmailSubmit, novalidate: true },
50
- states.error && (index.h("sqm-form-message", { type: "error", exportparts: "erroralert-icon" },
51
- index.h("div", { part: "erroralert-text" }, props.states.error))),
52
51
  content.formData,
53
- index.h("sl-input", { exportparts: "label: input-label, base: input-base", type: "email", name: "/email", label: content.emailLabel || "Email", required: true, validationError: ({ value }) => {
52
+ index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", type: "email", name: "/email", label: content.emailLabel || "Email", required: true, validationError: ({ value }) => {
54
53
  if (!value) {
55
54
  return content.requiredFieldErrorMessage;
56
55
  }
@@ -58,7 +57,13 @@ function BaseRegistrationFormView(props) {
58
57
  if (!value.includes("@")) {
59
58
  return content.invalidEmailErrorMessage;
60
59
  }
61
- } }),
60
+ } }, (((_a = states === null || states === void 0 ? void 0 : states.validationErrors) === null || _a === void 0 ? void 0 : _a.email) ? {
61
+ class: sheet.classes.ErrorStyle,
62
+ helpText: ((_b = states === null || states === void 0 ? void 0 : states.validationErrors) === null || _b === void 0 ? void 0 : _b.email) ||
63
+ content.requiredFieldErrorMessage,
64
+ }
65
+ : []))),
66
+ content.terms,
62
67
  index.h("div", { class: sheet.classes.ButtonsContainer },
63
68
  index.h("sl-button", { submit: true, exportparts: "base: primarybutton-base", type: "primary", style: { margin: "0" } }, content.submitLabel || "Register"),
64
69
  index.h("sl-menu-divider", { style: { margin: "0" } }),
@@ -508,7 +508,6 @@ const stepOneProps = {
508
508
  },
509
509
  },
510
510
  data: {
511
- partnerData: {},
512
511
  regionLabelEnum: "STATE",
513
512
  regions: [],
514
513
  phoneCountries: [
@@ -11,7 +11,7 @@ const JSS = require('./JSS-8503a151.js');
11
11
  require('./mixins-f7e0377a.js');
12
12
  require('./sqm-text-span-view-0aa82125.js');
13
13
  const useRegistrationFormState = require('./useRegistrationFormState-7b820f0c.js');
14
- const sqmBaseRegistrationFormView = require('./sqm-base-registration-form-view-8029d30e.js');
14
+ const sqmBaseRegistrationFormView = require('./sqm-base-registration-form-view-66f99821.js');
15
15
  const sqmPortalRegistrationFormView = require('./sqm-portal-registration-form-view-637a4bf4.js');
16
16
  require('./AsYouType-6788393a.js');
17
17
  const usePortalRegistrationForm = require('./usePortalRegistrationForm-f25d89e7.js');
@@ -75,7 +75,6 @@ function jwtDecode(token, options) {
75
75
  }
76
76
 
77
77
  function usePortalGoogleRegistrationForm(props) {
78
- const [emailValidationError, setEmailValidationError] = stencilHooks_module.useState(null);
79
78
  const [registrationFormState, setRegistrationFormState] = useRegistrationFormState.useRegistrationForm();
80
79
  const [showRegistrationForm, setShowRegistrationForm] = stencilHooks_module.useState({
81
80
  mode: "base",
@@ -83,33 +82,41 @@ function usePortalGoogleRegistrationForm(props) {
83
82
  const handleEmailSubmit = async (event) => {
84
83
  const formControls = event.target.getFormControls();
85
84
  let formData = {};
86
- let errorMessage = null;
85
+ let validationErrors = {};
87
86
  formControls.forEach((control) => {
88
87
  if (!control.name)
89
88
  return;
90
- jsonpointer.jsonpointer.set(formData, control.name, control.value);
91
- // only validate email field
92
- if (control.name !== "/email")
93
- return;
94
- if (control.required && !control.value)
95
- errorMessage = props.requiredFieldErrorMessage;
89
+ const key = control.name;
90
+ const value = control.value;
91
+ jsonpointer.jsonpointer.set(formData, key, value);
92
+ if (control.required && !value) {
93
+ jsonpointer.jsonpointer.set(validationErrors, key, props.requiredFieldErrorMessage);
94
+ }
95
+ // errorMessage = props.requiredFieldErrorMessage;
96
96
  if (typeof control.validationError === "function") {
97
97
  const validate = control.validationError;
98
98
  const validationError = validate({
99
99
  control,
100
- key: "email",
101
- value: control.value,
100
+ key,
101
+ value,
102
102
  });
103
103
  if (validationError)
104
- errorMessage = validationError;
104
+ jsonpointer.jsonpointer.set(validationErrors, key, validationError);
105
105
  }
106
106
  });
107
- if (errorMessage) {
108
- setEmailValidationError(errorMessage);
107
+ if (Object.keys(validationErrors).length) {
108
+ // early return for validation errors
109
+ setRegistrationFormState({
110
+ ...registrationFormState,
111
+ loading: false,
112
+ error: "",
113
+ validationErrors,
114
+ });
109
115
  return;
110
116
  }
111
117
  setRegistrationFormState({
112
118
  ...registrationFormState,
119
+ validationErrors: {},
113
120
  initialData: {
114
121
  ...registrationFormState === null || registrationFormState === void 0 ? void 0 : registrationFormState.initialData,
115
122
  ...formData,
@@ -139,8 +146,9 @@ function usePortalGoogleRegistrationForm(props) {
139
146
  }
140
147
  };
141
148
  return {
149
+ registrationFormState,
142
150
  showRegistrationForm,
143
- emailValidationError,
151
+ validationErrors: registrationFormState.validationErrors,
144
152
  handleGoogleInit,
145
153
  handleEmailSubmit,
146
154
  };
@@ -296,7 +304,7 @@ const PortalGoogleRegistrationForm = class {
296
304
  };
297
305
  const sheet = JSS.createStyleSheet(styles);
298
306
  const styleString = sheet.toString();
299
- const { handleGoogleInit, handleEmailSubmit, showRegistrationForm, emailValidationError, } = index_module.isDemo() ? useGoogleDemo(this) : usePortalGoogleRegistrationForm(this);
307
+ const { handleGoogleInit, handleEmailSubmit, showRegistrationForm, validationErrors, } = index_module.isDemo() ? useGoogleDemo(this) : usePortalGoogleRegistrationForm(this);
300
308
  const content = {
301
309
  formData: index.h("slot", { name: "formData" }),
302
310
  googleButton: (index.h("sqm-google-sign-in", { text: this.googleButtonText, onInitComplete: handleGoogleInit })),
@@ -321,14 +329,16 @@ const PortalGoogleRegistrationForm = class {
321
329
  };
322
330
  if (showRegistrationForm.mode === "base") {
323
331
  return (index.h(sqmBaseRegistrationFormView.BaseRegistrationFormView, { states: {
324
- error: emailValidationError,
332
+ validationErrors,
325
333
  }, callbacks: { handleEmailSubmit }, content: content }));
326
334
  }
327
335
  return (index.h(sqmPortalRegistrationFormView.PortalRegistrationFormView, { states: {
328
336
  ...states,
329
337
  emailDisabled: true,
330
338
  hidePasswords: showRegistrationForm.mode === "google",
331
- }, callbacks: callbacks, content: content, refs: refs }));
339
+ }, callbacks: callbacks,
340
+ // Show terms only on first screen
341
+ content: { ...content, terms: null }, refs: refs }));
332
342
  }
333
343
  };
334
344
  function useRegisterDemo(props) {
@@ -364,7 +374,7 @@ function useGoogleDemo(props) {
364
374
  mode: "base",
365
375
  });
366
376
  return cjs.cjs({
367
- emailValidationError: false,
377
+ validationErrors: {},
368
378
  handleEmailSubmit: () => setShowRegistrationForm({ mode: "manual" }),
369
379
  showRegistrationForm,
370
380
  handleGoogleInit: () => setShowRegistrationForm({ mode: "google" }),
@@ -28,7 +28,7 @@ const sqmNavigationSidebarItemView = require('./sqm-navigation-sidebar-item-view
28
28
  const sqmPortalEmailVerificationView = require('./sqm-portal-email-verification-view-7ebb426a.js');
29
29
  const sqmPortalForgotPasswordView = require('./sqm-portal-forgot-password-view-78f19ef9.js');
30
30
  const sqmPortalLoginView = require('./sqm-portal-login-view-761a4d8e.js');
31
- const sqmBaseRegistrationFormView = require('./sqm-base-registration-form-view-8029d30e.js');
31
+ const sqmBaseRegistrationFormView = require('./sqm-base-registration-form-view-66f99821.js');
32
32
  const sqmPortalRegistrationFormView = require('./sqm-portal-registration-form-view-637a4bf4.js');
33
33
  const sqmPortalProfileView = require('./sqm-portal-profile-view-33164798.js');
34
34
  require('./utilities-78f5e169.js');
@@ -38,7 +38,7 @@ require('./ErrorView-b2fcf954.js');
38
38
  const sqmQrCodeView = require('./sqm-qr-code-view-15dfc0b6.js');
39
39
  const ShadowViewAddon = require('./ShadowViewAddon-28865623.js');
40
40
  const sqmPortalContainerView = require('./sqm-portal-container-view-4f15143a.js');
41
- const sqmInvoiceTableView = require('./sqm-invoice-table-view-3f60fba9.js');
41
+ const sqmInvoiceTableView = require('./sqm-invoice-table-view-5c74607f.js');
42
42
  const sqmLeadInputFieldView = require('./sqm-lead-input-field-view-89308aab.js');
43
43
 
44
44
  /**
@@ -15640,7 +15640,7 @@ const BaseRegistrationForm_stories = {
15640
15640
  };
15641
15641
  const defaultProps$q = {
15642
15642
  states: {
15643
- error: "",
15643
+ validationErrors: {},
15644
15644
  },
15645
15645
  callbacks: {
15646
15646
  handleEmailSubmit: () => console.log("Submit!"),
@@ -15660,7 +15660,7 @@ const defaultProps$q = {
15660
15660
  const errorProps$a = {
15661
15661
  ...defaultProps$q,
15662
15662
  states: {
15663
- error: "Something went wrong. Please try again.",
15663
+ validationErrors: { error: "Something went wrong. Please try again." },
15664
15664
  },
15665
15665
  };
15666
15666
  const Default$o = () => {
@@ -5,7 +5,7 @@ export default {
5
5
  };
6
6
  const defaultProps = {
7
7
  states: {
8
- error: "",
8
+ validationErrors: {},
9
9
  },
10
10
  callbacks: {
11
11
  handleEmailSubmit: () => console.log("Submit!"),
@@ -25,7 +25,7 @@ const defaultProps = {
25
25
  const errorProps = {
26
26
  ...defaultProps,
27
27
  states: {
28
- error: "Something went wrong. Please try again.",
28
+ validationErrors: { error: "Something went wrong. Please try again." },
29
29
  },
30
30
  };
31
31
  export const Default = () => {
@@ -37,6 +37,7 @@ sqm-portal-register {
37
37
  const sheet = createStyleSheet(style);
38
38
  const styleString = sheet.toString();
39
39
  export function BaseRegistrationFormView(props) {
40
+ var _a, _b;
40
41
  const { states, content, callbacks } = props;
41
42
  return (h("div", { class: sheet.classes.Wrapper },
42
43
  h("style", { type: "text/css" },
@@ -44,10 +45,8 @@ export function BaseRegistrationFormView(props) {
44
45
  styleString),
45
46
  h(TextSpanView, { type: "h3" }, content.pageLabel),
46
47
  h("sl-form", { class: sheet.classes.Column, "onSl-submit": callbacks.handleEmailSubmit, novalidate: true },
47
- states.error && (h("sqm-form-message", { type: "error", exportparts: "erroralert-icon" },
48
- h("div", { part: "erroralert-text" }, props.states.error))),
49
48
  content.formData,
50
- h("sl-input", { exportparts: "label: input-label, base: input-base", type: "email", name: "/email", label: content.emailLabel || "Email", required: true, validationError: ({ value }) => {
49
+ h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", type: "email", name: "/email", label: content.emailLabel || "Email", required: true, validationError: ({ value }) => {
51
50
  if (!value) {
52
51
  return content.requiredFieldErrorMessage;
53
52
  }
@@ -55,7 +54,13 @@ export function BaseRegistrationFormView(props) {
55
54
  if (!value.includes("@")) {
56
55
  return content.invalidEmailErrorMessage;
57
56
  }
58
- } }),
57
+ } }, (((_a = states === null || states === void 0 ? void 0 : states.validationErrors) === null || _a === void 0 ? void 0 : _a.email) ? {
58
+ class: sheet.classes.ErrorStyle,
59
+ helpText: ((_b = states === null || states === void 0 ? void 0 : states.validationErrors) === null || _b === void 0 ? void 0 : _b.email) ||
60
+ content.requiredFieldErrorMessage,
61
+ }
62
+ : []))),
63
+ content.terms,
59
64
  h("div", { class: sheet.classes.ButtonsContainer },
60
65
  h("sl-button", { submit: true, exportparts: "base: primarybutton-base", type: "primary", style: { margin: "0" } }, content.submitLabel || "Register"),
61
66
  h("sl-menu-divider", { style: { margin: "0" } }),
@@ -8,7 +8,7 @@ import { CheckboxFieldView, } from "./sqm-checkbox-field-view";
8
8
  import { useCheckboxField } from "./useCheckboxField";
9
9
  /**
10
10
  * @uiName Form Checkbox Field
11
- * @validParents ["sqm-portal-register","sqm-portal-registration-form"]
11
+ * @validParents ["sqm-portal-register","sqm-portal-registration-form", "sqm-portal-google-registration-form"]
12
12
  * @exampleGroup Microsite Components
13
13
  * @example Form Checkbox Field - <sqm-checkbox-field checkbox-name="terms" checkbox-label="By signing up you agree to the {labelLink}" checkbox-label-link="https://example.com" checkbox-label-link-text="Terms and Conditions" error-message="Must be checked" ></sqm-checkbox-field>
14
14
  */
@@ -8,7 +8,7 @@ import { DropdownFieldView, } from "./sqm-dropdown-field-view";
8
8
  import { useDropdownField } from "./useDropdownField";
9
9
  /**
10
10
  * @uiName Form Dropdown Field
11
- * @validParents ["sqm-portal-register","sqm-portal-registration-form"]
11
+ * @validParents ["sqm-portal-register","sqm-portal-registration-form", "sqm-portal-google-registration-form"]
12
12
  * @slots [{"name":"", "title":"Drop Down Option"}]
13
13
  * @exampleGroup Microsite Components
14
14
  * @example Form Dropdown Field - <sqm-dropdown-field dropdown-label="Select an option" error-message="Select an option"><sl-menu-item value="option-1">Option 1</sl-menu-item><sl-menu-item value="option-2">Option 2</sl-menu-item><sl-menu-item value="option-3">Option 3</sl-menu-item></sqm-dropdown-field>
@@ -8,7 +8,7 @@ import { InputFieldView } from "./sqm-input-field-view";
8
8
  import { useInputField } from "./useInputField";
9
9
  /**
10
10
  * @uiName Form Input Field
11
- * @validParents ["sqm-portal-register","sqm-portal-registration-form"]
11
+ * @validParents ["sqm-portal-register","sqm-portal-registration-form", "sqm-portal-google-registration-form"]
12
12
  * @exampleGroup Microsite Components
13
13
  * @example Form Input Field - <sqm-input-field input-label="Field Label" field-type="text" error-message="Cannot be empty"></sqm-input-field>
14
14
  */
@@ -7,7 +7,7 @@ import { CheckboxFieldView, } from "../sqm-checkbox-field/sqm-checkbox-field-vie
7
7
  import { useCheckboxField } from "../sqm-checkbox-field/useCheckboxField";
8
8
  /**
9
9
  * @uiName Marketing Emails Checkbox Field
10
- * @validParents ["sqm-portal-register","sqm-portal-registration-form"]
10
+ * @validParents ["sqm-portal-register","sqm-portal-registration-form", "sqm-portal-google-registration-form"]
11
11
  * @requiredFeatures ["MARKETING_EMAILS"]
12
12
  */
13
13
  export class MarketingEmailsCheckbox {
@@ -3,13 +3,13 @@ import { withHooks } from "@saasquatch/stencil-hooks";
3
3
  import { useState } from "@saasquatch/universal-hooks";
4
4
  import { Component, h, Prop, State } from "@stencil/core";
5
5
  import deepmerge from "deepmerge";
6
+ import { getProps } from "../../utils/utils";
6
7
  import { validateNewPassword } from "./passwordValidation";
7
8
  import { PortalResetPasswordView, } from "./sqm-password-field-view";
8
9
  import { usePasswordField } from "./usePasswordField";
9
- import { getProps } from "../../utils/utils";
10
10
  /**
11
11
  * @uiName Form Password Field
12
- * @validParents ["sqm-portal-register","sqm-portal-registration-form"]
12
+ * @validParents ["sqm-portal-register","sqm-portal-registration-form", "sqm-portal-google-registration-form"]
13
13
  * @exampleGroup Microsite Components
14
14
  * @example Form Password Field - <sqm-password-field field-label="Password"></sqm-password-field>
15
15
  */
@@ -2,11 +2,11 @@ import { isDemo, navigation } from "@saasquatch/component-boilerplate";
2
2
  import { useState, withHooks } from "@saasquatch/stencil-hooks";
3
3
  import { Component, h, Prop, State } from "@stencil/core";
4
4
  import deepmerge from "deepmerge";
5
+ import { createStyleSheet } from "../../styling/JSS";
5
6
  import { BaseRegistrationFormView } from "../sqm-base-registration/sqm-base-registration-form-view";
6
7
  import { PortalRegistrationFormView, } from "../sqm-portal-registration-form/sqm-portal-registration-form-view";
7
8
  import { usePortalRegistrationForm } from "../sqm-portal-registration-form/usePortalRegistrationForm";
8
9
  import { usePortalGoogleRegistrationForm } from "./usePortalGoogleRegistrationForm";
9
- import { createStyleSheet } from "../../styling/JSS";
10
10
  /**
11
11
  * @uiName Google Registration
12
12
  * @canvasRenderer always-replace
@@ -161,7 +161,7 @@ export class PortalGoogleRegistrationForm {
161
161
  };
162
162
  const sheet = createStyleSheet(styles);
163
163
  const styleString = sheet.toString();
164
- const { handleGoogleInit, handleEmailSubmit, showRegistrationForm, emailValidationError, } = isDemo() ? useGoogleDemo(this) : usePortalGoogleRegistrationForm(this);
164
+ const { handleGoogleInit, handleEmailSubmit, showRegistrationForm, validationErrors, } = isDemo() ? useGoogleDemo(this) : usePortalGoogleRegistrationForm(this);
165
165
  const content = {
166
166
  formData: h("slot", { name: "formData" }),
167
167
  googleButton: (h("sqm-google-sign-in", { text: this.googleButtonText, onInitComplete: handleGoogleInit })),
@@ -192,14 +192,16 @@ export class PortalGoogleRegistrationForm {
192
192
  };
193
193
  if (showRegistrationForm.mode === "base") {
194
194
  return (h(BaseRegistrationFormView, { states: {
195
- error: emailValidationError,
195
+ validationErrors,
196
196
  }, callbacks: { handleEmailSubmit }, content: content }));
197
197
  }
198
198
  return (h(PortalRegistrationFormView, { states: {
199
199
  ...states,
200
200
  emailDisabled: true,
201
201
  hidePasswords: showRegistrationForm.mode === "google",
202
- }, callbacks: callbacks, content: content, refs: refs }));
202
+ }, callbacks: callbacks,
203
+ // Show terms only on first screen
204
+ content: { ...content, terms: null }, refs: refs }));
203
205
  }
204
206
  static get is() { return "sqm-portal-google-registration-form"; }
205
207
  static get encapsulation() { return "shadow"; }
@@ -874,7 +876,7 @@ function useGoogleDemo(props) {
874
876
  mode: "base",
875
877
  });
876
878
  return deepmerge({
877
- emailValidationError: false,
879
+ validationErrors: {},
878
880
  handleEmailSubmit: () => setShowRegistrationForm({ mode: "manual" }),
879
881
  showRegistrationForm,
880
882
  handleGoogleInit: () => setShowRegistrationForm({ mode: "google" }),
@@ -1,9 +1,8 @@
1
1
  import { useState } from "@saasquatch/universal-hooks";
2
2
  import jsonpointer from "jsonpointer";
3
- import { useRegistrationForm } from "../sqm-portal-registration-form/useRegistrationFormState";
4
3
  import { jwtDecode } from "jwt-decode";
4
+ import { useRegistrationForm } from "../sqm-portal-registration-form/useRegistrationFormState";
5
5
  export function usePortalGoogleRegistrationForm(props) {
6
- const [emailValidationError, setEmailValidationError] = useState(null);
7
6
  const [registrationFormState, setRegistrationFormState] = useRegistrationForm();
8
7
  const [showRegistrationForm, setShowRegistrationForm] = useState({
9
8
  mode: "base",
@@ -11,33 +10,41 @@ export function usePortalGoogleRegistrationForm(props) {
11
10
  const handleEmailSubmit = async (event) => {
12
11
  const formControls = event.target.getFormControls();
13
12
  let formData = {};
14
- let errorMessage = null;
13
+ let validationErrors = {};
15
14
  formControls.forEach((control) => {
16
15
  if (!control.name)
17
16
  return;
18
- jsonpointer.set(formData, control.name, control.value);
19
- // only validate email field
20
- if (control.name !== "/email")
21
- return;
22
- if (control.required && !control.value)
23
- errorMessage = props.requiredFieldErrorMessage;
17
+ const key = control.name;
18
+ const value = control.value;
19
+ jsonpointer.set(formData, key, value);
20
+ if (control.required && !value) {
21
+ jsonpointer.set(validationErrors, key, props.requiredFieldErrorMessage);
22
+ }
23
+ // errorMessage = props.requiredFieldErrorMessage;
24
24
  if (typeof control.validationError === "function") {
25
25
  const validate = control.validationError;
26
26
  const validationError = validate({
27
27
  control,
28
- key: "email",
29
- value: control.value,
28
+ key,
29
+ value,
30
30
  });
31
31
  if (validationError)
32
- errorMessage = validationError;
32
+ jsonpointer.set(validationErrors, key, validationError);
33
33
  }
34
34
  });
35
- if (errorMessage) {
36
- setEmailValidationError(errorMessage);
35
+ if (Object.keys(validationErrors).length) {
36
+ // early return for validation errors
37
+ setRegistrationFormState({
38
+ ...registrationFormState,
39
+ loading: false,
40
+ error: "",
41
+ validationErrors,
42
+ });
37
43
  return;
38
44
  }
39
45
  setRegistrationFormState({
40
46
  ...registrationFormState,
47
+ validationErrors: {},
41
48
  initialData: {
42
49
  ...registrationFormState === null || registrationFormState === void 0 ? void 0 : registrationFormState.initialData,
43
50
  ...formData,
@@ -67,8 +74,9 @@ export function usePortalGoogleRegistrationForm(props) {
67
74
  }
68
75
  };
69
76
  return {
77
+ registrationFormState,
70
78
  showRegistrationForm,
71
- emailValidationError,
79
+ validationErrors: registrationFormState.validationErrors,
72
80
  handleGoogleInit,
73
81
  handleEmailSubmit,
74
82
  };
@@ -32,7 +32,6 @@ const stepOneProps = {
32
32
  },
33
33
  },
34
34
  data: {
35
- partnerData: {},
36
35
  regionLabelEnum: "STATE",
37
36
  regions: [],
38
37
  phoneCountries: [