@saasquatch/mint-components 2.3.0-11 → 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 (85) hide show
  1. package/dist/cjs/{usePortalRegistrationForm-23ee2d62.js → AsYouType-d15caac8.js} +265 -223
  2. package/dist/cjs/sqm-banking-info-form_10.cjs.entry.js +46 -27
  3. package/dist/cjs/sqm-big-stat_47.cjs.entry.js +17 -13
  4. package/dist/cjs/sqm-portal-forgot-password_6.cjs.entry.js +3 -2
  5. package/dist/cjs/sqm-stencilbook.cjs.entry.js +59 -2
  6. package/dist/cjs/{sqm-user-info-form-view-8f7186b8.js → sqm-user-info-form-view-60e09262.js} +1004 -8
  7. package/dist/cjs/subregions-3542b0b8.js +1068 -0
  8. package/dist/cjs/{useIndirectTaxForm-112914a0.js → useIndirectTaxForm-c439eb81.js} +6 -2
  9. package/dist/cjs/usePortalRegistrationForm-8a3a14ac.js +215 -0
  10. package/dist/collection/components/tax-and-cash/TaxForm.stories.js +3 -0
  11. package/dist/collection/components/tax-and-cash/phoneExtensions.js +12 -0
  12. package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form-view.js +8 -0
  13. package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form.js +2 -1
  14. package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.js +5 -1
  15. package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/useTaxAndCash.js +12 -9
  16. package/dist/collection/components/tax-and-cash/sqm-user-info-form/UserInfoFormView.stories.js +52 -0
  17. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +18 -5
  18. package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form.js +3 -1
  19. package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +31 -27
  20. package/dist/collection/components/tax-and-cash/utils.js +30 -27
  21. package/dist/esm/{usePortalRegistrationForm-3a1f36a2.js → AsYouType-2d56519e.js} +248 -223
  22. package/dist/esm/sqm-banking-info-form_10.entry.js +46 -27
  23. package/dist/esm/sqm-big-stat_47.entry.js +16 -12
  24. package/dist/esm/sqm-portal-forgot-password_6.entry.js +2 -1
  25. package/dist/esm/sqm-stencilbook.entry.js +59 -2
  26. package/dist/esm/{sqm-user-info-form-view-599a6922.js → sqm-user-info-form-view-647a2bd5.js} +1002 -6
  27. package/dist/esm/subregions-7c5112e8.js +1055 -0
  28. package/dist/esm/{useIndirectTaxForm-a6ac7e7e.js → useIndirectTaxForm-38cd984e.js} +6 -2
  29. package/dist/esm/usePortalRegistrationForm-78fdfd93.js +213 -0
  30. package/dist/esm-es5/AsYouType-2d56519e.js +1 -0
  31. package/dist/esm-es5/sqm-banking-info-form_10.entry.js +1 -1
  32. package/dist/esm-es5/sqm-big-stat_47.entry.js +1 -1
  33. package/dist/esm-es5/sqm-portal-forgot-password_6.entry.js +1 -1
  34. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  35. package/dist/esm-es5/sqm-user-info-form-view-647a2bd5.js +1 -0
  36. package/dist/esm-es5/subregions-7c5112e8.js +1 -0
  37. package/dist/esm-es5/{useIndirectTaxForm-a6ac7e7e.js → useIndirectTaxForm-38cd984e.js} +2 -2
  38. package/dist/esm-es5/usePortalRegistrationForm-78fdfd93.js +1 -0
  39. package/dist/mint-components/mint-components.esm.js +1 -1
  40. package/dist/mint-components/p-1f387c7b.system.js +1 -1
  41. package/dist/mint-components/p-34179541.system.js +1 -0
  42. package/dist/mint-components/p-4065ae93.entry.js +9 -0
  43. package/dist/mint-components/p-5c3bff99.entry.js +1 -0
  44. package/dist/mint-components/p-6fd8981d.system.entry.js +1 -0
  45. package/dist/mint-components/p-769166a5.system.js +1 -0
  46. package/dist/mint-components/p-7c72eeb5.js +1 -0
  47. package/dist/mint-components/p-8d30945a.js +1 -0
  48. package/dist/mint-components/p-8dcd72fe.system.entry.js +1 -0
  49. package/dist/mint-components/p-a08157c4.js +1 -0
  50. package/dist/mint-components/p-a779e577.js +13 -0
  51. package/dist/mint-components/{p-2d4132fb.js → p-aa2c6585.js} +7 -5
  52. package/dist/mint-components/{p-6ef373ed.system.js → p-aab8a207.system.js} +2 -2
  53. package/dist/mint-components/p-af8b8c06.system.entry.js +1 -0
  54. package/dist/mint-components/{p-86231add.entry.js → p-b3f25c0e.entry.js} +8 -8
  55. package/dist/mint-components/p-c31966e3.system.entry.js +1 -0
  56. package/dist/mint-components/p-d463fa82.system.js +1 -0
  57. package/dist/mint-components/{p-339ce676.entry.js → p-dd5c1db9.entry.js} +11 -11
  58. package/dist/mint-components/p-ee91aeac.system.js +1 -0
  59. package/dist/types/components/tax-and-cash/phoneExtensions.d.ts +12 -0
  60. package/dist/types/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form-view.d.ts +1 -0
  61. package/dist/types/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.d.ts +1 -0
  62. package/dist/types/components/tax-and-cash/sqm-user-info-form/UserInfoFormView.stories.d.ts +1 -0
  63. package/dist/types/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.d.ts +2 -0
  64. package/dist/types/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.d.ts +2 -0
  65. package/dist/types/components/tax-and-cash/utils.d.ts +8 -2
  66. package/docs/docs.docx +0 -0
  67. package/grapesjs/grapesjs.js +1 -1
  68. package/package.json +1 -1
  69. package/dist/cjs/subregions-984e30d7.js +0 -1505
  70. package/dist/esm/subregions-7c9778d0.js +0 -1492
  71. package/dist/esm-es5/sqm-user-info-form-view-599a6922.js +0 -1
  72. package/dist/esm-es5/subregions-7c9778d0.js +0 -1
  73. package/dist/esm-es5/usePortalRegistrationForm-3a1f36a2.js +0 -1
  74. package/dist/mint-components/p-26a4ebfd.js +0 -1
  75. package/dist/mint-components/p-335a5736.entry.js +0 -1
  76. package/dist/mint-components/p-3a41b39c.js +0 -13
  77. package/dist/mint-components/p-40894343.entry.js +0 -9
  78. package/dist/mint-components/p-5fdf0286.system.js +0 -1
  79. package/dist/mint-components/p-7f29622d.js +0 -1
  80. package/dist/mint-components/p-81270b9f.system.js +0 -1
  81. package/dist/mint-components/p-b62d8b95.system.entry.js +0 -1
  82. package/dist/mint-components/p-bd03efe0.system.js +0 -1
  83. package/dist/mint-components/p-c9d2ccfc.system.entry.js +0 -1
  84. package/dist/mint-components/p-db6bf7cf.system.entry.js +0 -1
  85. package/dist/mint-components/p-f0ef09a0.system.entry.js +0 -1
@@ -1,7 +1,7 @@
1
1
  import { k as useState, f as useEffect, m as useRef, u as useMemo } from './dom-context-hooks.module-50442785.js';
2
2
  import { d as dist, J, $ as $e, g as getEnvironmentSDK, w as wn, L, F as Fn, q as Pn, r as $n } from './index.module-02cb914c.js';
3
3
  import { j as jsonpointer } from './jsonpointer-388a7082.js';
4
- import { I as INDIRECT_TAX_SPAIN_REGIONS, a as INDIRECT_TAX_PROVINCES, g as getCountryObj, b as validTaxDocument } from './subregions-7c9778d0.js';
4
+ import { I as INDIRECT_TAX_SPAIN_REGIONS, a as INDIRECT_TAX_PROVINCES, g as getCountryObj, b as validTaxDocument } from './subregions-7c5112e8.js';
5
5
  import { a as TAX_FORM_CONTEXT_NAMESPACE, U as USER_FORM_CONTEXT_NAMESPACE, d as COUNTRIES_QUERY_NAMESPACE, T as TAX_CONTEXT_NAMESPACE, c as USER_QUERY_NAMESPACE } from './data-8698cbc6.js';
6
6
  import { T as TAX_FORM_UPDATED_EVENT_KEY } from './eventKeys-f76b6a03.js';
7
7
 
@@ -1149,6 +1149,8 @@ const COMPLETE_PARTNER = dist.gql `
1149
1149
  impactConnection {
1150
1150
  connected
1151
1151
  publisher {
1152
+ phoneNumber
1153
+ phoneNumberCountryCode
1152
1154
  brandedSignup
1153
1155
  requiredTaxDocumentType
1154
1156
  currentTaxDocument {
@@ -1172,7 +1174,7 @@ function getOption(countries, countryCode) {
1172
1174
  }
1173
1175
  }
1174
1176
  function useIndirectTaxForm(props) {
1175
- var _a, _b, _c, _d, _e;
1177
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1176
1178
  const user = J();
1177
1179
  const locale = L();
1178
1180
  const formRef = useRef(null);
@@ -1357,6 +1359,8 @@ function useIndirectTaxForm(props) {
1357
1359
  disabled: loading || countriesLoading || connectLoading || completeLoading,
1358
1360
  loading: loading || connectLoading || countriesLoading || completeLoading,
1359
1361
  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),
1362
+ 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) &&
1363
+ ((_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",
1360
1364
  loadingError: !!(userError === null || userError === void 0 ? void 0 : userError.message),
1361
1365
  formState: {
1362
1366
  checked: option,
@@ -0,0 +1,213 @@
1
+ import { m as useRef, f as useEffect } from './dom-context-hooks.module-50442785.js';
2
+ import { d as dist, L, O as Oe, w as wn, j as jn, b as useCallback } from './index.module-02cb914c.js';
3
+ import { j as jsonpointer } from './jsonpointer-388a7082.js';
4
+ import { A as AsYouType } from './AsYouType-2d56519e.js';
5
+ import { u as useRegistrationFormState } from './useRegistrationFormState-aa44cfff.js';
6
+
7
+ const RegistrationFormQuery = dist.gql `
8
+ query RegistrationFormQuery($key: String!) {
9
+ form(key: $key) {
10
+ key
11
+ type
12
+ initialData {
13
+ initialData
14
+ isEnabled
15
+ isEnabledErrorMessage
16
+ }
17
+ }
18
+ }
19
+ `;
20
+ function usePortalRegistrationForm(props) {
21
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
22
+ const formRef = useRef(null);
23
+ const locale = L();
24
+ const { registrationFormState, setRegistrationFormState } = useRegistrationFormState({});
25
+ const [request, { loading, errors, data, formError }] = Oe();
26
+ const queryResponse = wn(RegistrationFormQuery, { key: props.formKey });
27
+ const formLoading = loading || queryResponse.loading;
28
+ useEffect(() => {
29
+ var _a, _b, _c;
30
+ const initialData = (_a = queryResponse === null || queryResponse === void 0 ? void 0 : queryResponse.data) === null || _a === void 0 ? void 0 : _a.form.initialData.initialData;
31
+ const disabled = ((_b = queryResponse === null || queryResponse === void 0 ? void 0 : queryResponse.data) === null || _b === void 0 ? void 0 : _b.form.initialData.isEnabled) === false;
32
+ const disabledMessage = ((_c = queryResponse === null || queryResponse === void 0 ? void 0 : queryResponse.data) === null || _c === void 0 ? void 0 : _c.form.initialData.isEnabledErrorMessage) ||
33
+ props.formDisabledErrorMessage;
34
+ const formState = {
35
+ loading: formLoading,
36
+ disabled,
37
+ disabledMessage,
38
+ initialData,
39
+ };
40
+ setRegistrationFormState(formState);
41
+ }, [(_a = queryResponse === null || queryResponse === void 0 ? void 0 : queryResponse.data) === null || _a === void 0 ? void 0 : _a.form.initialData]);
42
+ useEffect(() => {
43
+ if (!formRef.current)
44
+ return;
45
+ const form = formRef.current;
46
+ form.addEventListener("sl-input", inputFunction);
47
+ return () => {
48
+ form.removeEventListener("sl-input", inputFunction);
49
+ };
50
+ }, [formRef.current]);
51
+ const submit = async (event) => {
52
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
53
+ let formControls = event.target.getFormControls();
54
+ let formData = {};
55
+ let validationErrors = {};
56
+ formControls === null || formControls === void 0 ? void 0 : formControls.forEach((control) => {
57
+ if (!control.name)
58
+ return;
59
+ const key = control.name;
60
+ const value = control.value;
61
+ // control.value = initialData[key] || control.value;
62
+ jsonpointer.set(formData, key, value);
63
+ // required validation
64
+ if (control.required && !value) {
65
+ jsonpointer.set(validationErrors, key, props.requiredFieldErrorMessage);
66
+ }
67
+ // custom validation
68
+ if (typeof control.validationError === "function") {
69
+ const validate = control.validationError;
70
+ const validationError = validate({ control, key, value });
71
+ if (validationError)
72
+ jsonpointer.set(validationErrors, key, validationError);
73
+ }
74
+ });
75
+ if ((props.confirmPassword || formData.confirmPassword) &&
76
+ formData.password !== formData.confirmPassword) {
77
+ validationErrors = {
78
+ ...validationErrors,
79
+ confirmPassword: props.passwordMismatchErrorMessage,
80
+ };
81
+ }
82
+ if (Object.keys(validationErrors).length) {
83
+ // early return for validation errors
84
+ setRegistrationFormState({
85
+ ...registrationFormState,
86
+ loading: false,
87
+ error: "",
88
+ validationErrors,
89
+ });
90
+ return;
91
+ }
92
+ setRegistrationFormState({
93
+ ...registrationFormState,
94
+ loading: true,
95
+ error: "",
96
+ validationErrors: {},
97
+ });
98
+ const { email, password } = formData;
99
+ delete formData.email;
100
+ delete formData.password;
101
+ delete formData.confirmPassword;
102
+ const redirectPath = props.redirectPath;
103
+ const _googleOAuthIdToken = registrationFormState._googleOAuthIdToken;
104
+ const variables = {
105
+ key: props.formKey,
106
+ formData: {
107
+ ...(_googleOAuthIdToken ? { _googleOAuthIdToken } : {}),
108
+ locale,
109
+ email,
110
+ password,
111
+ redirectPath,
112
+ ...formData,
113
+ },
114
+ };
115
+ try {
116
+ const result = await request(variables);
117
+ if (result instanceof Error) {
118
+ throw result;
119
+ }
120
+ setRegistrationFormState({
121
+ ...registrationFormState,
122
+ loading: false,
123
+ error: "",
124
+ validationErrors: {},
125
+ });
126
+ const managedIdentityResponse = (_a = result.submitForm) === null || _a === void 0 ? void 0 : _a.results.find((result) => { var _a; return ((_a = result === null || result === void 0 ? void 0 : result.formHandler) === null || _a === void 0 ? void 0 : _a.namespace) === "identity"; });
127
+ if (managedIdentityResponse &&
128
+ managedIdentityResponse.result.results.length &&
129
+ managedIdentityResponse.result.results[0].success &&
130
+ managedIdentityResponse.result.results[0].data.token) {
131
+ jn.push(props.nextPage);
132
+ }
133
+ else if (
134
+ // check for blocked email error response
135
+ ((_b = result.submitForm) === null || _b === void 0 ? void 0 : _b.results.length) === 1 &&
136
+ ((_f = (_e = (_d = (_c = result.submitForm) === null || _c === void 0 ? void 0 : _c.results[0]) === null || _d === void 0 ? void 0 : _d.result) === null || _e === void 0 ? void 0 : _e.results) === null || _f === void 0 ? void 0 : _f.length) === 1 &&
137
+ ((_l = (_k = (_j = (_h = (_g = result.submitForm) === null || _g === void 0 ? void 0 : _g.results[0]) === null || _h === void 0 ? void 0 : _h.result) === null || _j === void 0 ? void 0 : _j.results) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.success) ===
138
+ false && ((_s = (_r = (_q = (_p = (_o = (_m = result.submitForm) === null || _m === void 0 ? void 0 : _m.results[0]) === null || _o === void 0 ? void 0 : _o.result) === null || _p === void 0 ? void 0 : _p.results) === null || _q === void 0 ? void 0 : _q[0]) === null || _r === void 0 ? void 0 : _r.message) === null || _s === void 0 ? void 0 : _s.startsWith("Blocked email"))) {
139
+ setRegistrationFormState({
140
+ ...registrationFormState,
141
+ loading: false,
142
+ error: "",
143
+ validationErrors: {
144
+ email: props.invalidEmailErrorMessage,
145
+ },
146
+ });
147
+ }
148
+ }
149
+ catch (error) {
150
+ // check for invalid email
151
+ if ((_t = error === null || error === void 0 ? void 0 : error.message) === null || _t === void 0 ? void 0 : _t.includes("is not a valid email address")) {
152
+ setRegistrationFormState({
153
+ ...registrationFormState,
154
+ loading: false,
155
+ error: "",
156
+ validationErrors: { email: props.invalidEmailErrorMessage },
157
+ });
158
+ }
159
+ else {
160
+ setRegistrationFormState({
161
+ ...registrationFormState,
162
+ loading: false,
163
+ error: props.networkErrorMessage,
164
+ validationErrors: {},
165
+ });
166
+ }
167
+ }
168
+ };
169
+ const inputFunction = useCallback((e) => {
170
+ var _a, _b;
171
+ const name = (_b = (_a = e.target) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.toLowerCase();
172
+ if (name !== "tel")
173
+ return;
174
+ const asYouType = new AsYouType("US");
175
+ e.target.value = asYouType.input(e.target.value);
176
+ }, []);
177
+ let errorMessage = "";
178
+ if (((_b = queryResponse === null || queryResponse === void 0 ? void 0 : queryResponse.data) === null || _b === void 0 ? void 0 : _b.form.initialData.isEnabled) === false) {
179
+ errorMessage =
180
+ ((_c = queryResponse === null || queryResponse === void 0 ? void 0 : queryResponse.data) === null || _c === void 0 ? void 0 : _c.form.initialData.isEnabledErrorMessage) ||
181
+ props.formDisabledErrorMessage;
182
+ }
183
+ else if ((_d = errors === null || errors === void 0 ? void 0 : errors.response) === null || _d === void 0 ? void 0 : _d["error"]) {
184
+ errorMessage = props.networkErrorMessage;
185
+ }
186
+ else if ((errors === null || errors === void 0 ? void 0 : errors.message) && !((_e = errors === null || errors === void 0 ? void 0 : errors.response) === null || _e === void 0 ? void 0 : _e.errors.length)) {
187
+ errorMessage = props.networkErrorMessage;
188
+ }
189
+ else {
190
+ errorMessage =
191
+ formError || ((_j = (_h = (_g = (_f = queryResponse === null || queryResponse === void 0 ? void 0 : queryResponse.errors) === null || _f === void 0 ? void 0 : _f.response) === null || _g === void 0 ? void 0 : _g.errors) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.message) || (registrationFormState === null || registrationFormState === void 0 ? void 0 : registrationFormState.error);
192
+ }
193
+ return {
194
+ states: {
195
+ loading: loading || queryResponse.loading,
196
+ error: errorMessage,
197
+ registrationFormState,
198
+ confirmPassword: props.confirmPassword,
199
+ hideInputs: props.hideInputs,
200
+ loginPath: props.loginPath,
201
+ enablePasswordValidation: !props.disablePasswordValidation,
202
+ },
203
+ callbacks: {
204
+ submit,
205
+ inputFunction,
206
+ },
207
+ refs: {
208
+ formRef,
209
+ },
210
+ };
211
+ }
212
+
213
+ export { usePortalRegistrationForm as u };