@saasquatch/mint-components 1.7.2 → 1.7.3-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 (83) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/mint-components.cjs.js +1 -1
  3. package/dist/cjs/sqm-password-field.cjs.entry.js +41 -16
  4. package/dist/cjs/{sqm-portal-email-verification-view-d6e14e8d.js → sqm-portal-email-verification-view-0bd4a2c2.js} +2 -2
  5. package/dist/cjs/sqm-portal-email-verification.cjs.entry.js +7 -1
  6. package/dist/cjs/sqm-portal-registration-form.cjs.entry.js +8 -0
  7. package/dist/cjs/{sqm-portal-verify-email-view-f6c7287e.js → sqm-portal-verify-email-view-200752cb.js} +4 -4
  8. package/dist/cjs/sqm-portal-verify-email.cjs.entry.js +27 -6
  9. package/dist/cjs/sqm-stencilbook.cjs.entry.js +2 -2
  10. package/dist/collection/components/sqm-password-field/passwordValidation.js +11 -11
  11. package/dist/collection/components/sqm-password-field/sqm-password-field.js +155 -4
  12. package/dist/collection/components/sqm-password-field/usePasswordField.js +1 -1
  13. package/dist/collection/components/sqm-portal-email-verification/sqm-portal-email-verification-view.js +2 -2
  14. package/dist/collection/components/sqm-portal-email-verification/sqm-portal-email-verification.js +31 -1
  15. package/dist/collection/components/sqm-portal-registration-form/sqm-portal-registration-form.js +27 -0
  16. package/dist/collection/components/sqm-portal-registration-form/usePortalRegistrationForm.js +3 -1
  17. package/dist/collection/components/sqm-portal-verify-email/sqm-portal-verify-email-view.js +4 -4
  18. package/dist/collection/components/sqm-portal-verify-email/sqm-portal-verify-email.js +88 -5
  19. package/dist/collection/components/sqm-portal-verify-email/usePortalVerifyEmail.js +6 -1
  20. package/dist/esm/loader.js +1 -1
  21. package/dist/esm/mint-components.js +1 -1
  22. package/dist/esm/sqm-password-field.entry.js +41 -16
  23. package/dist/esm/{sqm-portal-email-verification-view-408af676.js → sqm-portal-email-verification-view-97097335.js} +2 -2
  24. package/dist/esm/sqm-portal-email-verification.entry.js +7 -1
  25. package/dist/esm/sqm-portal-registration-form.entry.js +9 -1
  26. package/dist/esm/{sqm-portal-verify-email-view-1db4fae6.js → sqm-portal-verify-email-view-723687ca.js} +4 -4
  27. package/dist/esm/sqm-portal-verify-email.entry.js +28 -7
  28. package/dist/esm/sqm-stencilbook.entry.js +2 -2
  29. package/dist/esm-es5/loader.js +1 -1
  30. package/dist/esm-es5/mint-components.js +1 -1
  31. package/dist/esm-es5/sqm-password-field.entry.js +1 -1
  32. package/dist/esm-es5/{sqm-portal-email-verification-view-408af676.js → sqm-portal-email-verification-view-97097335.js} +1 -1
  33. package/dist/esm-es5/sqm-portal-email-verification.entry.js +1 -1
  34. package/dist/esm-es5/sqm-portal-registration-form.entry.js +1 -1
  35. package/dist/esm-es5/sqm-portal-verify-email-view-723687ca.js +1 -0
  36. package/dist/esm-es5/sqm-portal-verify-email.entry.js +1 -1
  37. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  38. package/dist/mint-components/mint-components.esm.js +1 -1
  39. package/dist/mint-components/p-0943b547.system.js +1 -1
  40. package/dist/mint-components/p-1fb7c93f.system.entry.js +1 -0
  41. package/dist/mint-components/p-4dae1dcc.system.js +1 -0
  42. package/dist/mint-components/p-4eca24af.js +1 -0
  43. package/dist/mint-components/p-59e4c214.system.entry.js +1 -0
  44. package/dist/mint-components/{p-8ed5f7e8.entry.js → p-734ab204.entry.js} +1 -1
  45. package/dist/mint-components/p-78027dd0.system.js +1 -0
  46. package/dist/mint-components/p-97519743.entry.js +1 -0
  47. package/dist/mint-components/p-97c7f794.system.entry.js +1 -0
  48. package/dist/mint-components/p-a40b01d5.js +1 -0
  49. package/dist/mint-components/p-a61bb370.entry.js +1 -0
  50. package/dist/mint-components/{p-a04f64b1.system.entry.js → p-ad5eda33.system.entry.js} +1 -1
  51. package/dist/mint-components/p-af302aa3.entry.js +1 -0
  52. package/dist/mint-components/p-ce922d94.system.entry.js +1 -0
  53. package/dist/mint-components/p-d7210c13.entry.js +13 -0
  54. package/dist/types/components/sqm-password-field/passwordValidation.d.ts +1 -1
  55. package/dist/types/components/sqm-password-field/sqm-password-field.d.ts +24 -0
  56. package/dist/types/components/sqm-portal-email-verification/sqm-portal-email-verification-view.d.ts +1 -0
  57. package/dist/types/components/sqm-portal-email-verification/sqm-portal-email-verification.d.ts +5 -0
  58. package/dist/types/components/sqm-portal-registration-form/sqm-portal-registration-form.d.ts +6 -0
  59. package/dist/types/components/sqm-portal-verify-email/sqm-portal-verify-email-view.d.ts +5 -0
  60. package/dist/types/components/sqm-portal-verify-email/sqm-portal-verify-email.d.ts +11 -0
  61. package/dist/types/components/sqm-portal-verify-email/usePortalVerifyEmail.d.ts +9 -1
  62. package/dist/types/components.d.ts +90 -0
  63. package/docs/docs.docx +0 -0
  64. package/docs/raisins.json +1 -1
  65. package/grapesjs/grapesjs.js +1 -1
  66. package/package.json +1 -1
  67. package/dist/esm-es5/sqm-portal-verify-email-view-1db4fae6.js +0 -1
  68. package/dist/mint-components/p-25ad41bd.system.entry.js +0 -1
  69. package/dist/mint-components/p-46be1518.system.js +0 -1
  70. package/dist/mint-components/p-75ddf3ca.js +0 -1
  71. package/dist/mint-components/p-84ee5462.system.entry.js +0 -1
  72. package/dist/mint-components/p-9a74f167.entry.js +0 -13
  73. package/dist/mint-components/p-a372d9cf.system.js +0 -1
  74. package/dist/mint-components/p-abfb3897.system.entry.js +0 -1
  75. package/dist/mint-components/p-b9c7b7ef.entry.js +0 -1
  76. package/dist/mint-components/p-d5e83056.entry.js +0 -1
  77. package/dist/mint-components/p-e058ba88.entry.js +0 -1
  78. package/dist/mint-components/p-f60d9f3e.system.entry.js +0 -1
  79. package/dist/mint-components/p-f71cfd64.js +0 -1
  80. package/dist/types/global/android.d.ts +0 -7
  81. package/dist/types/global/demo.d.ts +0 -1
  82. package/dist/types/stories/features.d.ts +0 -4
  83. package/dist/types/stories/templates.d.ts +0 -4
@@ -10,9 +10,9 @@ require('./mixins-fe9d4112.js');
10
10
  require('./JSS-8503a151.js');
11
11
  const utils = require('./utils-6847bc06.js');
12
12
  require('./sqm-text-span-view-e1cd9bd3.js');
13
- const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-f6c7287e.js');
13
+ const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-200752cb.js');
14
14
 
15
- function usePortalVerifyEmail({ nextPage, failedPage }) {
15
+ function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyEmailText, verifyInvalidText, }) {
16
16
  var _a, _b, _c, _d, _e, _f, _g, _h;
17
17
  const userIdent = index_module.H();
18
18
  const [request, { loading, data, errors }] = index_module.Ye();
@@ -72,6 +72,11 @@ function usePortalVerifyEmail({ nextPage, failedPage }) {
72
72
  failed,
73
73
  gotoNextPage,
74
74
  },
75
+ content: {
76
+ verifySuccessText,
77
+ verifyEmailText,
78
+ verifyInvalidText,
79
+ },
75
80
  };
76
81
  }
77
82
 
@@ -93,14 +98,25 @@ const PortalVerifyEmail = class {
93
98
  * @uiWidget pageSelect
94
99
  */
95
100
  this.failedPage = "/";
101
+ /**
102
+ * @uiName Verify email text
103
+ * @uiWidget textArea
104
+ */
105
+ this.verifyEmailText = "Verify your email";
106
+ /**
107
+ * @uiName Email verification success text
108
+ * @uiWidget textArea
109
+ */
110
+ this.verifySuccessText = "Your email has been verified and you are being redirected. If you are not redirected, please click Continue.";
111
+ this.verifyInvalidText = "The email verification code is invalid or has expired, please try again.";
96
112
  stencilHooks_module.h$1(this);
97
113
  }
98
114
  disconnectedCallback() { }
99
115
  render() {
100
- const { states, data, callbacks } = index_module.isDemo()
101
- ? usePortalVerifyEmailDemo(this)
102
- : usePortalVerifyEmail(this);
103
- return (index.h(sqmPortalVerifyEmailView.PortalVerifyEmailView, { states: states, data: data, callbacks: callbacks }));
116
+ const { states, data, callbacks, content } = index_module.isDemo()
117
+ ? usePortalVerifyEmailDemo(utils.getProps(this))
118
+ : usePortalVerifyEmail(utils.getProps(this));
119
+ return (index.h(sqmPortalVerifyEmailView.PortalVerifyEmailView, { states: states, data: data, callbacks: callbacks, content: content }));
104
120
  }
105
121
  };
106
122
  function usePortalVerifyEmailDemo(props) {
@@ -115,6 +131,11 @@ function usePortalVerifyEmailDemo(props) {
115
131
  },
116
132
  gotoNextPage: () => { },
117
133
  },
134
+ content: {
135
+ verifySuccessText: props.verifySuccessText,
136
+ verifyEmailText: props.verifyEmailText,
137
+ verifyInvalidText: props.verifyInvalidText,
138
+ },
118
139
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
119
140
  }
120
141
 
@@ -21,11 +21,11 @@ const sqmLeaderboardRankView = require('./sqm-leaderboard-rank-view-5a3d4a88.js'
21
21
  const sqmLogoutCurrentUserView = require('./sqm-logout-current-user-view-555c7729.js');
22
22
  const sqmNavigationSidebarView = require('./sqm-navigation-sidebar-view-dd53f947.js');
23
23
  const sqmNavigationSidebarItemView = require('./sqm-navigation-sidebar-item-view-21dcca39.js');
24
- const sqmPortalEmailVerificationView = require('./sqm-portal-email-verification-view-d6e14e8d.js');
24
+ const sqmPortalEmailVerificationView = require('./sqm-portal-email-verification-view-0bd4a2c2.js');
25
25
  const sqmPortalForgotPasswordView = require('./sqm-portal-forgot-password-view-0142350f.js');
26
26
  const sqmPortalProfileView = require('./sqm-portal-profile-view-13a1229f.js');
27
27
  const sqmPortalResetPasswordView = require('./sqm-portal-reset-password-view-d5bc7afc.js');
28
- const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-f6c7287e.js');
28
+ const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-200752cb.js');
29
29
  const ShadowViewAddon = require('./ShadowViewAddon-43f35e24.js');
30
30
  const sqmPortalContainerView = require('./sqm-portal-container-view-5fb2ad49.js');
31
31
 
@@ -10,21 +10,15 @@ const passwordSchema = new PasswordValidator()
10
10
  .lowercase() // Must have lowercase letters
11
11
  .has(/([\d`~\!@#\$%\^\&\*\(\)\-_\=\+\[\{\}\]\\\|;:'",<.>\/\?€£¥₹§±].*){1,}/); // Must contain at least 1 digit or symbol
12
12
  // Taken from combining https://github.com/tarunbatra/password-validator/blob/40184970e4f65efa8aed7a64185a011a3b5d0e54/src/constants.js#L9
13
- export const validateNewPassword = (password) => {
13
+ export const validateNewPassword = (password, validationText) => {
14
14
  const errors = passwordSchema.validate(password, { list: true });
15
- const message = getErrorMessage(errors, password);
15
+ const message = getErrorMessage(errors, password, validationText);
16
16
  return message;
17
17
  };
18
18
  const Valid = () => (h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 12 12", fill: "none" },
19
19
  h("path", { d: "M6 0C2.688 0 0 2.688 0 6C0 9.312 2.688 12 6 12C9.312 12 12 9.312 12 6C12 2.688 9.312 0 6 0ZM4.8 9L1.8 6L2.646 5.154L4.8 7.302L9.354 2.748L10.2 3.6L4.8 9Z", fill: "#259053" })));
20
20
  const Invalid = () => (h("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
21
21
  h("path", { d: "M6 0C2.688 0 0 2.688 0 6C0 9.312 2.688 12 6 12C9.312 12 12 9.312 12 6C12 2.688 9.312 0 6 0ZM6 10.8C3.354 10.8 1.2 8.646 1.2 6C1.2 3.354 3.354 1.2 6 1.2C8.646 1.2 10.8 3.354 10.8 6C10.8 8.646 8.646 10.8 6 10.8ZM8.754 3.348L4.8 7.302L3.246 5.754L2.4 6.6L4.8 9L9.6 4.2L8.754 3.348Z", fill: "#555555" })));
22
- const validationMessages = {
23
- min: "be a minimum of 8 characters",
24
- uppercase: "contain at least 1 uppercase character",
25
- lowercase: "contain at least 1 lowercase character",
26
- has: "contain at least 1 number or symbol",
27
- };
28
22
  const baseItem = {
29
23
  display: "flex",
30
24
  alignItems: "center",
@@ -56,16 +50,22 @@ const style = {
56
50
  };
57
51
  const sheet = createStyleSheet(style);
58
52
  const styleString = sheet.toString();
59
- const getErrorMessage = (errorKeys, password) => {
53
+ const getErrorMessage = (errorKeys, password, validationText) => {
54
+ const validationMessages = {
55
+ min: validationText.minError,
56
+ uppercase: validationText.uppercaseError,
57
+ lowercase: validationText.lowercaseError,
58
+ has: validationText.hasError,
59
+ };
60
60
  if (!errorKeys.length && password)
61
61
  return (h("div", { class: sheet.classes.ValidationItemValid, style: { paddingBottom: "var(--sl-spacing-x-large)" } },
62
62
  h("style", { type: "text/css" }, styleString),
63
63
  h(Valid, null),
64
64
  " ",
65
- h("span", null, "Password has met all requirements")));
65
+ h("span", null, validationText.meetsRequirementsText)));
66
66
  return (h("div", { class: sheet.classes.Base },
67
67
  h("style", { type: "text/css" }, styleString),
68
- "Password must meet the following requirements:",
68
+ validationText.doesNotMeetRequirementsText,
69
69
  h("ul", { class: sheet.classes.ValidationList }, Object.keys(validationMessages).map((errorKey) => errorKeys.includes(errorKey) ? (h("li", { class: sheet.classes.ValidationItemInvalid },
70
70
  h(Invalid, null),
71
71
  " ",
@@ -6,6 +6,7 @@ import deepmerge from "deepmerge";
6
6
  import { validateNewPassword } from "./passwordValidation";
7
7
  import { PortalResetPasswordView, } from "./sqm-password-field-view";
8
8
  import { usePasswordField } from "./usePasswordField";
9
+ import { getProps } from "../../utils/utils";
9
10
  /**
10
11
  * @uiName Form Password Field
11
12
  * @validParents ["sqm-portal-register","sqm-portal-registration-form"]
@@ -26,13 +27,37 @@ export class PortalPasswordField {
26
27
  * @uiName Disable validation
27
28
  */
28
29
  this.disableValidation = false;
30
+ /**
31
+ * @uiName Meets requirements text
32
+ */
33
+ this.meetsRequirementsText = "Password has met all requirements";
34
+ /**
35
+ * @uiName Fails requirements text
36
+ */
37
+ this.doesNotMeetRequirementsText = "Password must meet the following requirements:";
38
+ /**
39
+ * @uiName Minimum length text
40
+ */
41
+ this.minError = "be a minimum of 8 characters";
42
+ /**
43
+ * @uiName Missing uppercase text
44
+ */
45
+ this.uppercaseError = "contain at least 1 uppercase character";
46
+ /**
47
+ * @uiName Missing lowercase text
48
+ */
49
+ this.lowercaseError = "contain at least 1 lowercase character";
50
+ /**
51
+ * @uiName Missing number or symbol error text
52
+ */
53
+ this.hasError = "contain at least 1 number or symbol";
29
54
  withHooks(this);
30
55
  }
31
56
  disconnectedCallback() { }
32
57
  render() {
33
58
  const { states, callbacks } = isDemo()
34
- ? usePasswordFieldDemo(this)
35
- : usePasswordField(this);
59
+ ? usePasswordFieldDemo(getProps(this))
60
+ : usePasswordField(getProps(this));
36
61
  return h(PortalResetPasswordView, { states: states, callbacks: callbacks });
37
62
  }
38
63
  static get is() { return "sqm-password-field"; }
@@ -79,6 +104,132 @@ export class PortalPasswordField {
79
104
  "reflect": false,
80
105
  "defaultValue": "false"
81
106
  },
107
+ "meetsRequirementsText": {
108
+ "type": "string",
109
+ "mutable": false,
110
+ "complexType": {
111
+ "original": "string",
112
+ "resolved": "string",
113
+ "references": {}
114
+ },
115
+ "required": false,
116
+ "optional": false,
117
+ "docs": {
118
+ "tags": [{
119
+ "text": "Meets requirements text",
120
+ "name": "uiName"
121
+ }],
122
+ "text": ""
123
+ },
124
+ "attribute": "meets-requirements-text",
125
+ "reflect": false,
126
+ "defaultValue": "\"Password has met all requirements\""
127
+ },
128
+ "doesNotMeetRequirementsText": {
129
+ "type": "string",
130
+ "mutable": false,
131
+ "complexType": {
132
+ "original": "string",
133
+ "resolved": "string",
134
+ "references": {}
135
+ },
136
+ "required": false,
137
+ "optional": false,
138
+ "docs": {
139
+ "tags": [{
140
+ "text": "Fails requirements text",
141
+ "name": "uiName"
142
+ }],
143
+ "text": ""
144
+ },
145
+ "attribute": "does-not-meet-requirements-text",
146
+ "reflect": false,
147
+ "defaultValue": "\"Password must meet the following requirements:\""
148
+ },
149
+ "minError": {
150
+ "type": "string",
151
+ "mutable": false,
152
+ "complexType": {
153
+ "original": "string",
154
+ "resolved": "string",
155
+ "references": {}
156
+ },
157
+ "required": false,
158
+ "optional": false,
159
+ "docs": {
160
+ "tags": [{
161
+ "text": "Minimum length text",
162
+ "name": "uiName"
163
+ }],
164
+ "text": ""
165
+ },
166
+ "attribute": "min-error",
167
+ "reflect": false,
168
+ "defaultValue": "\"be a minimum of 8 characters\""
169
+ },
170
+ "uppercaseError": {
171
+ "type": "string",
172
+ "mutable": false,
173
+ "complexType": {
174
+ "original": "string",
175
+ "resolved": "string",
176
+ "references": {}
177
+ },
178
+ "required": false,
179
+ "optional": false,
180
+ "docs": {
181
+ "tags": [{
182
+ "text": "Missing uppercase text",
183
+ "name": "uiName"
184
+ }],
185
+ "text": ""
186
+ },
187
+ "attribute": "uppercase-error",
188
+ "reflect": false,
189
+ "defaultValue": "\"contain at least 1 uppercase character\""
190
+ },
191
+ "lowercaseError": {
192
+ "type": "string",
193
+ "mutable": false,
194
+ "complexType": {
195
+ "original": "string",
196
+ "resolved": "string",
197
+ "references": {}
198
+ },
199
+ "required": false,
200
+ "optional": false,
201
+ "docs": {
202
+ "tags": [{
203
+ "text": "Missing lowercase text",
204
+ "name": "uiName"
205
+ }],
206
+ "text": ""
207
+ },
208
+ "attribute": "lowercase-error",
209
+ "reflect": false,
210
+ "defaultValue": "\"contain at least 1 lowercase character\""
211
+ },
212
+ "hasError": {
213
+ "type": "string",
214
+ "mutable": false,
215
+ "complexType": {
216
+ "original": "string",
217
+ "resolved": "string",
218
+ "references": {}
219
+ },
220
+ "required": false,
221
+ "optional": false,
222
+ "docs": {
223
+ "tags": [{
224
+ "text": "Missing number or symbol error text",
225
+ "name": "uiName"
226
+ }],
227
+ "text": ""
228
+ },
229
+ "attribute": "has-error",
230
+ "reflect": false,
231
+ "defaultValue": "\"contain at least 1 number or symbol\""
232
+ },
82
233
  "demoData": {
83
234
  "type": "unknown",
84
235
  "mutable": false,
@@ -114,12 +265,12 @@ function usePasswordFieldDemo(props) {
114
265
  const [dynamicValidation, setDynamicValidation] = useState("");
115
266
  const [lastValidated, setLastValidated] = useState("");
116
267
  if (props.demoData && lastValidated != ((_a = props === null || props === void 0 ? void 0 : props.demoData) === null || _a === void 0 ? void 0 : _a.initValue)) {
117
- const validation = validateNewPassword(((_b = props === null || props === void 0 ? void 0 : props.demoData) === null || _b === void 0 ? void 0 : _b.initValue) || "");
268
+ const validation = validateNewPassword(((_b = props === null || props === void 0 ? void 0 : props.demoData) === null || _b === void 0 ? void 0 : _b.initValue) || "", props);
118
269
  setDynamicValidation(((_c = props === null || props === void 0 ? void 0 : props.demoData) === null || _c === void 0 ? void 0 : _c.initValue) === "" ? "" : validation);
119
270
  setLastValidated((_d = props === null || props === void 0 ? void 0 : props.demoData) === null || _d === void 0 ? void 0 : _d.initValue);
120
271
  }
121
272
  function onInput(input) {
122
- const validation = validateNewPassword(input.target.value);
273
+ const validation = validateNewPassword(input.target.value, props);
123
274
  setDynamicValidation(validation);
124
275
  }
125
276
  return deepmerge({
@@ -6,7 +6,7 @@ export function usePasswordField(props) {
6
6
  const registrationFormState = useDomContext(REGISTRATION_FORM_STATE_CONTEXT);
7
7
  const [dynamicValidation, setDynamicValidation] = useState("");
8
8
  function onInput(input) {
9
- const validation = validateNewPassword(input.target.value);
9
+ const validation = validateNewPassword(input.target.value, props);
10
10
  setDynamicValidation(validation);
11
11
  }
12
12
  return {
@@ -37,7 +37,7 @@ const vanillaStyle = `
37
37
  const sheet = createStyleSheet(style);
38
38
  const styleString = sheet.toString();
39
39
  export function PortalEmailVerificationView(props) {
40
- const { states, callbacks, content: { email, verifyMessage, emailVerificationHeader, resendEmailButtonText, verificationStatusMessage, verificationLoadingMessage, }, } = props;
40
+ const { states, callbacks, content: { email, verifyMessage, emailVerificationHeader, resendEmailButtonText, verificationStatusMessage, verificationLoadingMessage, verificationResentMessage, }, } = props;
41
41
  return (h("div", { class: sheet.classes.Wrapper },
42
42
  h("style", { type: "text/css" },
43
43
  vanillaStyle,
@@ -47,7 +47,7 @@ export function PortalEmailVerificationView(props) {
47
47
  props.states.error && (h("sqm-form-message", { type: "error", exportparts: "erroralert-icon" },
48
48
  h("div", { part: "erroralert-text" }, props.states.error))),
49
49
  props.states.success && (h("sqm-form-message", { type: "success", exportparts: "successalert-icon" },
50
- h("div", { part: "successalert-text" }, "Your verification email has been resent successfully"))),
50
+ h("div", { part: "successalert-text" }, verificationResentMessage))),
51
51
  h(TextSpanView, { type: "p" }, intl.formatMessage({
52
52
  id: "verifyMessage",
53
53
  defaultMessage: verifyMessage,
@@ -40,6 +40,11 @@ export class PortalEmailVerification {
40
40
  * @uiWidget textArea
41
41
  */
42
42
  this.verificationLoadingMessage = "Checking verification status";
43
+ /**
44
+ * @uiName Email verification resent text
45
+ * @uiWidget textArea
46
+ */
47
+ this.verificationResentMessage = "Your verification email has been resent successfully";
43
48
  withHooks(this);
44
49
  }
45
50
  disconnectedCallback() { }
@@ -190,12 +195,36 @@ export class PortalEmailVerification {
190
195
  "reflect": false,
191
196
  "defaultValue": "\"Checking verification status\""
192
197
  },
198
+ "verificationResentMessage": {
199
+ "type": "string",
200
+ "mutable": false,
201
+ "complexType": {
202
+ "original": "string",
203
+ "resolved": "string",
204
+ "references": {}
205
+ },
206
+ "required": false,
207
+ "optional": false,
208
+ "docs": {
209
+ "tags": [{
210
+ "text": "Email verification resent text",
211
+ "name": "uiName"
212
+ }, {
213
+ "text": "textArea",
214
+ "name": "uiWidget"
215
+ }],
216
+ "text": ""
217
+ },
218
+ "attribute": "verification-resent-message",
219
+ "reflect": false,
220
+ "defaultValue": "\"Your verification email has been resent successfully\""
221
+ },
193
222
  "demoData": {
194
223
  "type": "unknown",
195
224
  "mutable": false,
196
225
  "complexType": {
197
226
  "original": "DemoData<PortalEmailVerificationViewProps>",
198
- "resolved": "{ states?: { error: string; loading: boolean; success: boolean; isVerified?: boolean; loadingVerification?: boolean; countdown?: number; }; content?: { email: string; verifyMessage: string; emailVerificationHeader: string; resendEmailButtonText: string; verificationStatusMessage?: string; verificationLoadingMessage?: string; }; }",
227
+ "resolved": "{ states?: { error: string; loading: boolean; success: boolean; isVerified?: boolean; loadingVerification?: boolean; countdown?: number; }; content?: { email: string; verifyMessage: string; emailVerificationHeader: string; resendEmailButtonText: string; verificationStatusMessage?: string; verificationLoadingMessage?: string; verificationResentMessage?: string; }; }",
199
228
  "references": {
200
229
  "DemoData": {
201
230
  "location": "import",
@@ -238,6 +267,7 @@ function usePortalEmailVerificationDemo(props) {
238
267
  resendEmailButtonText: props.resendEmailButtonText,
239
268
  verificationLoadingMessage: props.verificationLoadingMessage,
240
269
  verificationStatusMessage: props.verificationStatusMessage,
270
+ verificationResentMessage: props.verificationResentMessage,
241
271
  },
242
272
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
243
273
  }
@@ -25,6 +25,12 @@ export class PortalRegistrationForm {
25
25
  * @uiWidget pageSelect
26
26
  */
27
27
  this.redirectPath = "/verifyEmail";
28
+ /**
29
+ * Saves the browser locale on the new user
30
+ *
31
+ * @uiName Use browser locale
32
+ */
33
+ this.useBrowserLocale = false;
28
34
  /**
29
35
  * @uiName Email field label
30
36
  */
@@ -181,6 +187,27 @@ export class PortalRegistrationForm {
181
187
  "reflect": false,
182
188
  "defaultValue": "\"/verifyEmail\""
183
189
  },
190
+ "useBrowserLocale": {
191
+ "type": "boolean",
192
+ "mutable": false,
193
+ "complexType": {
194
+ "original": "boolean",
195
+ "resolved": "boolean",
196
+ "references": {}
197
+ },
198
+ "required": false,
199
+ "optional": false,
200
+ "docs": {
201
+ "tags": [{
202
+ "text": "Use browser locale",
203
+ "name": "uiName"
204
+ }],
205
+ "text": "Saves the browser locale on the new user"
206
+ },
207
+ "attribute": "use-browser-locale",
208
+ "reflect": false,
209
+ "defaultValue": "false"
210
+ },
184
211
  "emailLabel": {
185
212
  "type": "string",
186
213
  "mutable": false,
@@ -1,6 +1,6 @@
1
1
  import jsonpointer from "jsonpointer";
2
2
  import { useCallback, useEffect, useRef } from "@saasquatch/universal-hooks";
3
- import { navigation, useQuery, useRegisterViaRegistrationFormMutation, } from "@saasquatch/component-boilerplate";
3
+ import { navigation, useLocale, useQuery, useRegisterViaRegistrationFormMutation, } from "@saasquatch/component-boilerplate";
4
4
  import { AsYouType } from "libphonenumber-js";
5
5
  import { gql } from "graphql-request";
6
6
  import { useRegistrationFormState, } from "./useRegistrationFormState";
@@ -20,6 +20,7 @@ const RegistrationFormQuery = gql `
20
20
  export function usePortalRegistrationForm(props) {
21
21
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
22
22
  const formRef = useRef(null);
23
+ const locale = useLocale();
23
24
  const { registrationFormState, setRegistrationFormState } = useRegistrationFormState({});
24
25
  const [request, { loading, errors, data, formError }] = useRegisterViaRegistrationFormMutation();
25
26
  const queryResponse = useQuery(RegistrationFormQuery, { key: props.formKey });
@@ -102,6 +103,7 @@ export function usePortalRegistrationForm(props) {
102
103
  const variables = {
103
104
  key: props.formKey,
104
105
  formData: {
106
+ ...(props.useBrowserLocale ? { locale } : {}),
105
107
  email,
106
108
  password,
107
109
  redirectPath,
@@ -20,15 +20,15 @@ const vanillaStyle = `
20
20
  const sheet = createStyleSheet(style);
21
21
  const styleString = sheet.toString();
22
22
  export function PortalVerifyEmailView(props) {
23
- const { states, data, callbacks } = props;
23
+ const { states, data, callbacks, content } = props;
24
24
  if (states.verified) {
25
25
  return (h("div", { class: sheet.classes.Wrapper, part: "sqm-base" },
26
26
  h("style", { type: "text/css" },
27
27
  vanillaStyle,
28
28
  styleString),
29
- h(TextSpanView, { type: "h3" }, "Verify your email"),
29
+ h(TextSpanView, { type: "h3" }, content.verifyEmailText),
30
30
  h("sqm-form-message", { exportparts: "success-icon" },
31
- h("div", { part: "successalert-text" }, "Your email has been verified and you are being redirected. If you are not redirected, please click Continue.")),
31
+ h("div", { part: "successalert-text" }, content.verifySuccessText)),
32
32
  h("sl-button", { class: sheet.classes.ContinueButton, onClick: callbacks.gotoNextPage, loading: states.loading, exportparts: "base: primarybutton-base", type: "primary" }, "Continue")));
33
33
  }
34
34
  if (states.error || !data.oobCode) {
@@ -36,7 +36,7 @@ export function PortalVerifyEmailView(props) {
36
36
  h("style", { type: "text/css" }, styleString),
37
37
  h(TextSpanView, { type: "h3" }, "Verify your email"),
38
38
  h("sqm-form-message", { type: "error", exportparts: "erroralert-icon" },
39
- h("div", { part: "erroralert-text" }, "The email verification code is invalid or has expired, please try again.")),
39
+ h("div", { part: "erroralert-text" }, content.verifyInvalidText)),
40
40
  h("sl-button", { class: sheet.classes.ContinueButton, onClick: callbacks.failed, loading: states.loading, exportparts: "base: primarybutton-base", type: "primary" }, "Continue")));
41
41
  }
42
42
  }
@@ -4,6 +4,7 @@ import { Component, h, Prop, State } from "@stencil/core";
4
4
  import deepmerge from "deepmerge";
5
5
  import { PortalVerifyEmailView, } from "./sqm-portal-verify-email-view";
6
6
  import { usePortalVerifyEmail } from "./usePortalVerifyEmail";
7
+ import { getProps } from "../../utils/utils";
7
8
  /**
8
9
  * @uiName Microsite Verify Email
9
10
  */
@@ -24,14 +25,25 @@ export class PortalVerifyEmail {
24
25
  * @uiWidget pageSelect
25
26
  */
26
27
  this.failedPage = "/";
28
+ /**
29
+ * @uiName Verify email text
30
+ * @uiWidget textArea
31
+ */
32
+ this.verifyEmailText = "Verify your email";
33
+ /**
34
+ * @uiName Email verification success text
35
+ * @uiWidget textArea
36
+ */
37
+ this.verifySuccessText = "Your email has been verified and you are being redirected. If you are not redirected, please click Continue.";
38
+ this.verifyInvalidText = "The email verification code is invalid or has expired, please try again.";
27
39
  withHooks(this);
28
40
  }
29
41
  disconnectedCallback() { }
30
42
  render() {
31
- const { states, data, callbacks } = isDemo()
32
- ? usePortalVerifyEmailDemo(this)
33
- : usePortalVerifyEmail(this);
34
- return (h(PortalVerifyEmailView, { states: states, data: data, callbacks: callbacks }));
43
+ const { states, data, callbacks, content } = isDemo()
44
+ ? usePortalVerifyEmailDemo(getProps(this))
45
+ : usePortalVerifyEmail(getProps(this));
46
+ return (h(PortalVerifyEmailView, { states: states, data: data, callbacks: callbacks, content: content }));
35
47
  }
36
48
  static get is() { return "sqm-portal-verify-email"; }
37
49
  static get encapsulation() { return "shadow"; }
@@ -84,12 +96,78 @@ export class PortalVerifyEmail {
84
96
  "reflect": false,
85
97
  "defaultValue": "\"/\""
86
98
  },
99
+ "verifyEmailText": {
100
+ "type": "string",
101
+ "mutable": false,
102
+ "complexType": {
103
+ "original": "string",
104
+ "resolved": "string",
105
+ "references": {}
106
+ },
107
+ "required": false,
108
+ "optional": false,
109
+ "docs": {
110
+ "tags": [{
111
+ "text": "Verify email text",
112
+ "name": "uiName"
113
+ }, {
114
+ "text": "textArea",
115
+ "name": "uiWidget"
116
+ }],
117
+ "text": ""
118
+ },
119
+ "attribute": "verify-email-text",
120
+ "reflect": false,
121
+ "defaultValue": "\"Verify your email\""
122
+ },
123
+ "verifySuccessText": {
124
+ "type": "string",
125
+ "mutable": false,
126
+ "complexType": {
127
+ "original": "string",
128
+ "resolved": "string",
129
+ "references": {}
130
+ },
131
+ "required": false,
132
+ "optional": false,
133
+ "docs": {
134
+ "tags": [{
135
+ "text": "Email verification success text",
136
+ "name": "uiName"
137
+ }, {
138
+ "text": "textArea",
139
+ "name": "uiWidget"
140
+ }],
141
+ "text": ""
142
+ },
143
+ "attribute": "verify-success-text",
144
+ "reflect": false,
145
+ "defaultValue": "\"Your email has been verified and you are being redirected. If you are not redirected, please click Continue.\""
146
+ },
147
+ "verifyInvalidText": {
148
+ "type": "string",
149
+ "mutable": false,
150
+ "complexType": {
151
+ "original": "string",
152
+ "resolved": "string",
153
+ "references": {}
154
+ },
155
+ "required": false,
156
+ "optional": false,
157
+ "docs": {
158
+ "tags": [],
159
+ "text": ""
160
+ },
161
+ "attribute": "verify-invalid-text",
162
+ "reflect": false,
163
+ "defaultValue": "\"The email verification code is invalid or has expired, please try again.\""
164
+ },
87
165
  "demoData": {
88
166
  "type": "unknown",
89
167
  "mutable": false,
90
168
  "complexType": {
91
169
  "original": "DemoData<PortalVerifyEmailViewProps>",
92
- "resolved": "{ states?: { error: string; loading: boolean; verified: boolean; }; data?: { oobCode: string; }; }",
170
+ "resolved": "{ states?: { error: string; loading: boolean; verified: boolean; }; data?: { oobCode: string; }; content?: { verifySuccessText?: string; verifyEmailText?: string; verifyInvalidText?: string; }; }",
93
171
  "references": {
94
172
  "DemoData": {
95
173
  "location": "import",
@@ -131,5 +209,10 @@ function usePortalVerifyEmailDemo(props) {
131
209
  },
132
210
  gotoNextPage: () => { },
133
211
  },
212
+ content: {
213
+ verifySuccessText: props.verifySuccessText,
214
+ verifyEmailText: props.verifyEmailText,
215
+ verifyInvalidText: props.verifyInvalidText,
216
+ },
134
217
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
135
218
  }
@@ -1,7 +1,7 @@
1
1
  import { useEffect } from "@saasquatch/universal-hooks";
2
2
  import { navigation, useUserIdentity, useVerifyEmailMutation, } from "@saasquatch/component-boilerplate";
3
3
  import { sanitizeUrlPath } from "../../utils/utils";
4
- export function usePortalVerifyEmail({ nextPage, failedPage }) {
4
+ export function usePortalVerifyEmail({ nextPage, failedPage, verifySuccessText, verifyEmailText, verifyInvalidText, }) {
5
5
  var _a, _b, _c, _d, _e, _f, _g, _h;
6
6
  const userIdent = useUserIdentity();
7
7
  const [request, { loading, data, errors }] = useVerifyEmailMutation();
@@ -61,5 +61,10 @@ export function usePortalVerifyEmail({ nextPage, failedPage }) {
61
61
  failed,
62
62
  gotoNextPage,
63
63
  },
64
+ content: {
65
+ verifySuccessText,
66
+ verifyEmailText,
67
+ verifyInvalidText,
68
+ },
64
69
  };
65
70
  }