@saasquatch/mint-components 1.15.4-0 → 1.15.4-2
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.
- package/dist/cjs/{ShadowViewAddon-28865623.js → ShadowViewAddon-e9dc77e3.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/sqm-banking-info-form_17.cjs.entry.js +17 -35
- package/dist/cjs/{sqm-base-registration-form-view-8029d30e.js → sqm-base-registration-form-view-66f99821.js} +9 -4
- package/dist/cjs/sqm-big-stat_43.cjs.entry.js +8 -1
- package/dist/cjs/{sqm-invoice-table-view-3f60fba9.js → sqm-invoice-table-view-5c74607f.js} +0 -1
- package/dist/cjs/sqm-portal-google-registration-form.cjs.entry.js +29 -19
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +8 -5
- package/dist/collection/components/sqm-base-registration/BaseRegistrationForm.stories.js +2 -2
- package/dist/collection/components/sqm-base-registration/sqm-base-registration-form-view.js +9 -4
- package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field.js +1 -1
- package/dist/collection/components/sqm-dropdown-field/sqm-dropdown-field.js +1 -1
- package/dist/collection/components/sqm-input-field/sqm-input-field.js +1 -1
- package/dist/collection/components/sqm-marketing-emails-checkbox/sqm-marketing-emails-checkbox.js +1 -1
- package/dist/collection/components/sqm-name-fields/NameFields.stories.js +2 -0
- package/dist/collection/components/sqm-name-fields/sqm-name-fields-view.js +3 -3
- package/dist/collection/components/sqm-name-fields/sqm-name-fields.js +31 -1
- package/dist/collection/components/sqm-name-fields/useNameFields.js +1 -0
- package/dist/collection/components/sqm-password-field/sqm-password-field.js +2 -2
- package/dist/collection/components/sqm-portal-google-registration-form/PortalGoogleRegistrationForm.stories.js +1 -0
- package/dist/collection/components/sqm-portal-google-registration-form/sqm-portal-google-registration-form.js +7 -5
- package/dist/collection/components/sqm-portal-google-registration-form/usePortalGoogleRegistrationForm.js +23 -15
- package/dist/collection/components/tax-and-cash/TaxForm.stories.js +0 -1
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +12 -23
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form.js +1 -1
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +4 -18
- package/dist/esm/{ShadowViewAddon-f2176779.js → ShadowViewAddon-e0d5f1c9.js} +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/sqm-banking-info-form_17.entry.js +17 -35
- package/dist/esm/{sqm-base-registration-form-view-dafba287.js → sqm-base-registration-form-view-d81e316a.js} +9 -4
- package/dist/esm/sqm-big-stat_43.entry.js +8 -1
- package/dist/esm/{sqm-invoice-table-view-01453fa3.js → sqm-invoice-table-view-3491dd80.js} +0 -1
- package/dist/esm/sqm-portal-google-registration-form.entry.js +29 -19
- package/dist/esm/sqm-stencilbook.entry.js +8 -5
- package/dist/esm-es5/{ShadowViewAddon-f2176779.js → ShadowViewAddon-e0d5f1c9.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/sqm-banking-info-form_17.entry.js +1 -1
- package/dist/esm-es5/sqm-base-registration-form-view-d81e316a.js +1 -0
- package/dist/esm-es5/sqm-big-stat_43.entry.js +1 -1
- package/dist/esm-es5/sqm-invoice-table-view-3491dd80.js +1 -0
- package/dist/esm-es5/sqm-portal-google-registration-form.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/{p-4a731079.entry.js → p-1edebab1.entry.js} +2 -2
- package/dist/mint-components/p-37996351.system.js +1 -1
- package/dist/mint-components/{p-02832118.system.entry.js → p-3ac8613d.system.entry.js} +1 -1
- package/dist/mint-components/{p-c1b074b6.js → p-3b6dccec.js} +1 -1
- package/dist/mint-components/{p-6f6cd994.entry.js → p-3d73cd84.entry.js} +2 -2
- package/dist/mint-components/p-49932f12.system.js +1 -0
- package/dist/mint-components/p-7176a952.entry.js +1 -0
- package/dist/mint-components/p-8d0393d9.system.entry.js +1 -0
- package/dist/mint-components/p-9308221f.js +1 -0
- package/dist/mint-components/p-959c42b2.system.entry.js +1 -0
- package/dist/mint-components/p-bc021969.system.js +1 -0
- package/dist/mint-components/{p-945a5883.entry.js → p-c78e6066.entry.js} +2 -2
- package/dist/mint-components/{p-0d939b73.system.js → p-d15b642f.system.js} +1 -1
- package/dist/mint-components/{p-2ba713d6.system.entry.js → p-e64e8354.system.entry.js} +1 -1
- package/dist/mint-components/p-e8e48982.js +1 -0
- package/dist/types/components/sqm-base-registration/sqm-base-registration-form-view.d.ts +2 -1
- package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field.d.ts +1 -1
- package/dist/types/components/sqm-dropdown-field/sqm-dropdown-field.d.ts +1 -1
- package/dist/types/components/sqm-input-field/sqm-input-field.d.ts +1 -1
- package/dist/types/components/sqm-marketing-emails-checkbox/sqm-marketing-emails-checkbox.d.ts +1 -1
- package/dist/types/components/sqm-name-fields/sqm-name-fields-view.d.ts +1 -0
- package/dist/types/components/sqm-name-fields/sqm-name-fields.d.ts +5 -0
- package/dist/types/components/sqm-name-fields/useNameFields.d.ts +1 -0
- package/dist/types/components/sqm-password-field/sqm-password-field.d.ts +1 -1
- package/dist/types/components/sqm-portal-google-registration-form/usePortalGoogleRegistrationForm.d.ts +2 -1
- package/dist/types/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.d.ts +0 -2
- package/dist/types/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.d.ts +0 -1
- package/dist/types/components.d.ts +10 -13
- package/dist/types/global/android.d.ts +7 -0
- package/dist/types/global/demo.d.ts +2 -0
- package/dist/types/stories/features.d.ts +4 -0
- package/dist/types/stories/templates.d.ts +4 -0
- package/docs/docs.docx +0 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/sqm-base-registration-form-view-dafba287.js +0 -1
- package/dist/esm-es5/sqm-invoice-table-view-01453fa3.js +0 -1
- package/dist/mint-components/p-2651ef99.system.js +0 -1
- package/dist/mint-components/p-35701119.js +0 -1
- package/dist/mint-components/p-59fe6066.js +0 -1
- package/dist/mint-components/p-86a5db85.system.js +0 -1
- package/dist/mint-components/p-9c4f4cd6.entry.js +0 -1
- package/dist/mint-components/p-a3647f70.system.entry.js +0 -1
- package/dist/mint-components/p-c1fc4838.system.entry.js +0 -1
|
@@ -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" } }),
|
|
@@ -24,7 +24,7 @@ const sqmPortalLoginView = require('./sqm-portal-login-view-761a4d8e.js');
|
|
|
24
24
|
const usePortalLogin = require('./usePortalLogin-63d896d1.js');
|
|
25
25
|
const AsYouType = require('./AsYouType-6788393a.js');
|
|
26
26
|
const utilities = require('./utilities-78f5e169.js');
|
|
27
|
-
const ShadowViewAddon = require('./ShadowViewAddon-
|
|
27
|
+
const ShadowViewAddon = require('./ShadowViewAddon-e9dc77e3.js');
|
|
28
28
|
require('./sqm-portal-container-view-4f15143a.js');
|
|
29
29
|
const usePayoutStatus = require('./usePayoutStatus-733ef29a.js');
|
|
30
30
|
|
|
@@ -2029,6 +2029,7 @@ function useNameFields(props) {
|
|
|
2029
2029
|
const registrationFormState = stencilHooks_module.d(useRegistrationFormState.REGISTRATION_FORM_STATE_CONTEXT);
|
|
2030
2030
|
return {
|
|
2031
2031
|
states: {
|
|
2032
|
+
optional: props.optional,
|
|
2032
2033
|
registrationFormState,
|
|
2033
2034
|
content: {
|
|
2034
2035
|
lastNameLabel: props.lastNameLabel,
|
|
@@ -2050,6 +2051,11 @@ const NameFields = class {
|
|
|
2050
2051
|
* @uiName Last name label
|
|
2051
2052
|
*/
|
|
2052
2053
|
this.lastNameLabel = "Last Name";
|
|
2054
|
+
/**
|
|
2055
|
+
* @uiName Optional
|
|
2056
|
+
* @uiWidget
|
|
2057
|
+
*/
|
|
2058
|
+
this.optional = false;
|
|
2053
2059
|
stencilHooks_module.h$1(this);
|
|
2054
2060
|
}
|
|
2055
2061
|
disconnectedCallback() { }
|
|
@@ -2061,6 +2067,7 @@ const NameFields = class {
|
|
|
2061
2067
|
function useNameFieldsDemo(props) {
|
|
2062
2068
|
return cjs.cjs({
|
|
2063
2069
|
states: {
|
|
2070
|
+
optional: props.optional,
|
|
2064
2071
|
validationErrors: [],
|
|
2065
2072
|
content: {
|
|
2066
2073
|
firstNameLabel: props.firstNameLabel,
|
|
@@ -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-
|
|
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
|
|
85
|
+
let validationErrors = {};
|
|
87
86
|
formControls.forEach((control) => {
|
|
88
87
|
if (!control.name)
|
|
89
88
|
return;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
|
101
|
-
value
|
|
100
|
+
key,
|
|
101
|
+
value,
|
|
102
102
|
});
|
|
103
103
|
if (validationError)
|
|
104
|
-
|
|
104
|
+
jsonpointer.jsonpointer.set(validationErrors, key, validationError);
|
|
105
105
|
}
|
|
106
106
|
});
|
|
107
|
-
if (
|
|
108
|
-
|
|
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
|
-
|
|
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,
|
|
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
|
-
|
|
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,
|
|
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
|
-
|
|
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-
|
|
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');
|
|
@@ -36,9 +36,9 @@ const sqmPortalResetPasswordView = require('./sqm-portal-reset-password-view-fe6
|
|
|
36
36
|
const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-7b678f34.js');
|
|
37
37
|
require('./ErrorView-b2fcf954.js');
|
|
38
38
|
const sqmQrCodeView = require('./sqm-qr-code-view-15dfc0b6.js');
|
|
39
|
-
const ShadowViewAddon = require('./ShadowViewAddon-
|
|
39
|
+
const ShadowViewAddon = require('./ShadowViewAddon-e9dc77e3.js');
|
|
40
40
|
const sqmPortalContainerView = require('./sqm-portal-container-view-4f15143a.js');
|
|
41
|
-
const sqmInvoiceTableView = require('./sqm-invoice-table-view-
|
|
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
|
/**
|
|
@@ -10833,6 +10833,7 @@ const NameFields_stories = {
|
|
|
10833
10833
|
};
|
|
10834
10834
|
const props$1 = {
|
|
10835
10835
|
states: {
|
|
10836
|
+
optional: false,
|
|
10836
10837
|
registrationFormState: {
|
|
10837
10838
|
validationErrors: undefined,
|
|
10838
10839
|
},
|
|
@@ -10844,6 +10845,7 @@ const props$1 = {
|
|
|
10844
10845
|
};
|
|
10845
10846
|
const errorProps$9 = {
|
|
10846
10847
|
states: {
|
|
10848
|
+
optional: false,
|
|
10847
10849
|
registrationFormState: {
|
|
10848
10850
|
validationErrors: {
|
|
10849
10851
|
firstName: "Cannot be empty",
|
|
@@ -15640,7 +15642,7 @@ const BaseRegistrationForm_stories = {
|
|
|
15640
15642
|
};
|
|
15641
15643
|
const defaultProps$q = {
|
|
15642
15644
|
states: {
|
|
15643
|
-
|
|
15645
|
+
validationErrors: {},
|
|
15644
15646
|
},
|
|
15645
15647
|
callbacks: {
|
|
15646
15648
|
handleEmailSubmit: () => console.log("Submit!"),
|
|
@@ -15660,7 +15662,7 @@ const defaultProps$q = {
|
|
|
15660
15662
|
const errorProps$a = {
|
|
15661
15663
|
...defaultProps$q,
|
|
15662
15664
|
states: {
|
|
15663
|
-
error: "Something went wrong. Please try again.",
|
|
15665
|
+
validationErrors: { error: "Something went wrong. Please try again." },
|
|
15664
15666
|
},
|
|
15665
15667
|
};
|
|
15666
15668
|
const Default$o = () => {
|
|
@@ -15707,6 +15709,7 @@ const defaultProps$r = {
|
|
|
15707
15709
|
formData: (index.h("div", null,
|
|
15708
15710
|
" ",
|
|
15709
15711
|
index.h(ShadowViewAddon.NameFieldsView, { states: {
|
|
15712
|
+
optional: false,
|
|
15710
15713
|
registrationFormState: {
|
|
15711
15714
|
validationErrors: undefined,
|
|
15712
15715
|
disabled: true,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
};
|
|
6
6
|
const defaultProps = {
|
|
7
7
|
states: {
|
|
8
|
-
|
|
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
|
*/
|
package/dist/collection/components/sqm-marketing-emails-checkbox/sqm-marketing-emails-checkbox.js
CHANGED
|
@@ -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 {
|
|
@@ -9,6 +9,7 @@ export default {
|
|
|
9
9
|
};
|
|
10
10
|
const props = {
|
|
11
11
|
states: {
|
|
12
|
+
optional: false,
|
|
12
13
|
registrationFormState: {
|
|
13
14
|
validationErrors: undefined,
|
|
14
15
|
},
|
|
@@ -20,6 +21,7 @@ const props = {
|
|
|
20
21
|
};
|
|
21
22
|
const errorProps = {
|
|
22
23
|
states: {
|
|
24
|
+
optional: false,
|
|
23
25
|
registrationFormState: {
|
|
24
26
|
validationErrors: {
|
|
25
27
|
firstName: "Cannot be empty",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
-
import { createStyleSheet } from "../../styling/JSS";
|
|
3
2
|
import { ErrorStyles } from "../../global/mixins";
|
|
3
|
+
import { createStyleSheet } from "../../styling/JSS";
|
|
4
4
|
const style = {
|
|
5
5
|
ErrorStyle: ErrorStyles,
|
|
6
6
|
FieldsContainer: {
|
|
@@ -31,7 +31,7 @@ export function NameFieldsView(props) {
|
|
|
31
31
|
h("style", { type: "text/css" },
|
|
32
32
|
vanillaStyle,
|
|
33
33
|
styleString),
|
|
34
|
-
h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: "/firstName", type: "text", label: states.content.firstNameLabel, required:
|
|
34
|
+
h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: "/firstName", type: "text", label: states.content.firstNameLabel, required: !states.optional, disabled: ((_b = states.registrationFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.registrationFormState) === null || _c === void 0 ? void 0 : _c.disabled) }, (((_e = (_d = states.registrationFormState) === null || _d === void 0 ? void 0 : _d.initialData) === null || _e === void 0 ? void 0 : _e.firstName) ? {
|
|
35
35
|
value: (_g = (_f = states.registrationFormState) === null || _f === void 0 ? void 0 : _f.initialData) === null || _g === void 0 ? void 0 : _g.firstName,
|
|
36
36
|
}
|
|
37
37
|
: {}), ((validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors.firstName) ? {
|
|
@@ -39,7 +39,7 @@ export function NameFieldsView(props) {
|
|
|
39
39
|
helpText: (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors.firstName) || "Cannot be empty",
|
|
40
40
|
}
|
|
41
41
|
: []))),
|
|
42
|
-
h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: "/lastName", type: "text", label: states.content.lastNameLabel, required:
|
|
42
|
+
h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: "/lastName", type: "text", label: states.content.lastNameLabel, required: !states.optional, disabled: ((_h = states.registrationFormState) === null || _h === void 0 ? void 0 : _h.loading) || ((_j = states.registrationFormState) === null || _j === void 0 ? void 0 : _j.disabled) }, (((_l = (_k = states.registrationFormState) === null || _k === void 0 ? void 0 : _k.initialData) === null || _l === void 0 ? void 0 : _l.lastName) ? {
|
|
43
43
|
value: (_o = (_m = states.registrationFormState) === null || _m === void 0 ? void 0 : _m.initialData) === null || _o === void 0 ? void 0 : _o.lastName,
|
|
44
44
|
}
|
|
45
45
|
: {}), ((validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors.lastName) ? {
|
|
@@ -21,6 +21,11 @@ export class NameFields {
|
|
|
21
21
|
* @uiName Last name label
|
|
22
22
|
*/
|
|
23
23
|
this.lastNameLabel = "Last Name";
|
|
24
|
+
/**
|
|
25
|
+
* @uiName Optional
|
|
26
|
+
* @uiWidget
|
|
27
|
+
*/
|
|
28
|
+
this.optional = false;
|
|
24
29
|
withHooks(this);
|
|
25
30
|
}
|
|
26
31
|
disconnectedCallback() { }
|
|
@@ -72,12 +77,36 @@ export class NameFields {
|
|
|
72
77
|
"reflect": false,
|
|
73
78
|
"defaultValue": "\"Last Name\""
|
|
74
79
|
},
|
|
80
|
+
"optional": {
|
|
81
|
+
"type": "boolean",
|
|
82
|
+
"mutable": false,
|
|
83
|
+
"complexType": {
|
|
84
|
+
"original": "boolean",
|
|
85
|
+
"resolved": "boolean",
|
|
86
|
+
"references": {}
|
|
87
|
+
},
|
|
88
|
+
"required": false,
|
|
89
|
+
"optional": false,
|
|
90
|
+
"docs": {
|
|
91
|
+
"tags": [{
|
|
92
|
+
"text": "Optional",
|
|
93
|
+
"name": "uiName"
|
|
94
|
+
}, {
|
|
95
|
+
"text": undefined,
|
|
96
|
+
"name": "uiWidget"
|
|
97
|
+
}],
|
|
98
|
+
"text": ""
|
|
99
|
+
},
|
|
100
|
+
"attribute": "optional",
|
|
101
|
+
"reflect": false,
|
|
102
|
+
"defaultValue": "false"
|
|
103
|
+
},
|
|
75
104
|
"demoData": {
|
|
76
105
|
"type": "unknown",
|
|
77
106
|
"mutable": false,
|
|
78
107
|
"complexType": {
|
|
79
108
|
"original": "DemoData<NameFieldsViewProps>",
|
|
80
|
-
"resolved": "{ states?: { registrationFormState?: RegistrationFormState; content: { firstNameLabel: string; lastNameLabel: string; }; }; }",
|
|
109
|
+
"resolved": "{ states?: { optional: boolean; registrationFormState?: RegistrationFormState; content: { firstNameLabel: string; lastNameLabel: string; }; }; }",
|
|
81
110
|
"references": {
|
|
82
111
|
"DemoData": {
|
|
83
112
|
"location": "import",
|
|
@@ -110,6 +139,7 @@ export class NameFields {
|
|
|
110
139
|
function useNameFieldsDemo(props) {
|
|
111
140
|
return deepmerge({
|
|
112
141
|
states: {
|
|
142
|
+
optional: props.optional,
|
|
113
143
|
validationErrors: [],
|
|
114
144
|
content: {
|
|
115
145
|
firstNameLabel: props.firstNameLabel,
|
|
@@ -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,
|
|
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
|
-
|
|
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,
|
|
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
|
-
|
|
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
|
|
13
|
+
let validationErrors = {};
|
|
15
14
|
formControls.forEach((control) => {
|
|
16
15
|
if (!control.name)
|
|
17
16
|
return;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
|
29
|
-
value
|
|
28
|
+
key,
|
|
29
|
+
value,
|
|
30
30
|
});
|
|
31
31
|
if (validationError)
|
|
32
|
-
|
|
32
|
+
jsonpointer.set(validationErrors, key, validationError);
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
|
-
if (
|
|
36
|
-
|
|
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
|
-
|
|
79
|
+
validationErrors: registrationFormState.validationErrors,
|
|
72
80
|
handleGoogleInit,
|
|
73
81
|
handleEmailSubmit,
|
|
74
82
|
};
|