@salla.sa/twilight-components 2.14.294 → 2.14.296
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/{filepond-CGGCjN56.js → filepond-E7NOvLwV.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-CSZViO2Z.js → filepond-plugin-file-poster-D3bKYBq5.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-E6Gv15oF.js → filepond-plugin-file-validate-size-D4sJa2nT.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-CPyu8pxB.js → filepond-plugin-file-validate-type-DDz99ei0.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-CSNer-A5.js → filepond-plugin-image-edit-yDHuyk0R.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-DEzwTEOc.js → filepond-plugin-image-exif-orientation-hj89JJI_.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-CFGHrSPe.js → filepond-plugin-image-preview-UoTioUkG.js} +1 -1
- package/dist/cjs/{index-COQqEmIG.js → index-BZQAN2JT.js} +1 -1
- package/dist/cjs/{index-BKN6oqfk.js → index-BfEIQrIk.js} +6 -2
- package/dist/cjs/interfaces-CX9-6aLf.js +24 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-accordion_62.cjs.entry.js +66 -117
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-item-offers.cjs.entry.js +1 -1
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-custom-fields.cjs.entry.js +135 -0
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-reviews-page.cjs.entry.js +1 -1
- package/dist/cjs/salla-reviews.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/salla-custom-fields/salla-custom-fields.css +3 -0
- package/dist/collection/components/salla-custom-fields/salla-custom-fields.js +313 -0
- package/dist/collection/components/salla-file-upload/salla-file-upload.js +36 -3
- package/dist/collection/components/salla-product-options/salla-product-options.js +1 -1
- package/dist/collection/components/salla-user-menu/salla-user-menu.js +25 -14
- package/dist/collection/components/salla-user-profile/salla-user-profile.js +15 -132
- package/dist/components/index.js +2 -2
- package/dist/components/interfaces.js +15 -0
- package/dist/components/salla-custom-fields.d.ts +11 -0
- package/dist/components/salla-custom-fields.js +174 -0
- package/dist/components/salla-file-upload2.js +13 -3
- package/dist/components/salla-product-options2.js +1 -1
- package/dist/components/salla-user-menu.js +31 -14
- package/dist/components/salla-user-profile.js +19 -97
- package/dist/esm/{filepond-9s_hrH-T.js → filepond-BEN4Pt87.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-B0Eow32y.js → filepond-plugin-file-poster-B7t9aVVy.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-Cqzs4jCA.js → filepond-plugin-file-validate-size-DFkfdHfo.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-uJfZLwRE.js → filepond-plugin-file-validate-type-CU-RnplM.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-Ck70H3zM.js → filepond-plugin-image-edit-Dz3oYXef.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-BB-xgO8T.js → filepond-plugin-image-exif-orientation-DJrUnj97.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-CO4zuhvC.js → filepond-plugin-image-preview-BCWlifYd.js} +1 -1
- package/dist/esm/{index-BzYM6G5p.js → index-bXg2F_NN.js} +6 -2
- package/dist/esm/{index-CTrhtRUR.js → index-fxSENfiU.js} +1 -1
- package/dist/esm/interfaces-CBT_Nxny.js +22 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion_62.entry.js +65 -116
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-cart-item-offers.entry.js +1 -1
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-custom-fields.entry.js +133 -0
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty-program.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-notification-item.entry.js +1 -1
- package/dist/esm/salla-notifications.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-order-details-options.entry.js +1 -1
- package/dist/esm/salla-order-details.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-review-card.entry.js +1 -1
- package/dist/esm/salla-reviews-page.entry.js +1 -1
- package/dist/esm/salla-reviews.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/twilight.js +3 -3
- package/dist/twilight/{p-4e11facd.entry.js → p-0645c8e3.entry.js} +1 -1
- package/dist/twilight/{p-5a86632d.entry.js → p-0b970445.entry.js} +1 -1
- package/dist/twilight/{p-394506f0.entry.js → p-193bea42.entry.js} +1 -1
- package/dist/twilight/{p-B86wiAo3.js → p-1Xk7fjpB.js} +1 -1
- package/dist/twilight/{p-9757dde8.entry.js → p-1b7cfbae.entry.js} +1 -1
- package/dist/twilight/{p-03c963db.entry.js → p-22f479da.entry.js} +1 -1
- package/dist/twilight/{p-97dc4af6.entry.js → p-32512487.entry.js} +1 -1
- package/dist/twilight/{p-e0414354.entry.js → p-4dd68813.entry.js} +1 -1
- package/dist/twilight/{p-d267acaf.entry.js → p-4fb7f400.entry.js} +1 -1
- package/dist/twilight/{p-f494e503.entry.js → p-51ef83f7.entry.js} +1 -1
- package/dist/twilight/{p-2c65b54d.entry.js → p-56dde07a.entry.js} +1 -1
- package/dist/twilight/p-5dd1b37c.entry.js +4 -0
- package/dist/twilight/{p-3c2fd683.entry.js → p-5f247331.entry.js} +1 -1
- package/dist/twilight/{p-dce21b0f.entry.js → p-67ed25a4.entry.js} +1 -1
- package/dist/twilight/{p-7bc8f5f2.entry.js → p-7012bda9.entry.js} +1 -1
- package/dist/twilight/{p-5e2486f2.entry.js → p-732c5190.entry.js} +1 -1
- package/dist/twilight/{p-a887c4e9.entry.js → p-76657684.entry.js} +1 -1
- package/dist/twilight/{p-cda63906.entry.js → p-8220b125.entry.js} +1 -1
- package/dist/twilight/{p-ce99c462.entry.js → p-8d3f2028.entry.js} +1 -1
- package/dist/twilight/{p-bf81d2cb.entry.js → p-988ea6cb.entry.js} +1 -1
- package/dist/twilight/{p-a2e4c4e9.entry.js → p-9f42e27b.entry.js} +1 -1
- package/dist/twilight/{p-uGfP8-tV.js → p-BIRmkG1d.js} +1 -1
- package/dist/twilight/{p-DZjKCWKU.js → p-BW8LVXVp.js} +2 -2
- package/dist/twilight/p-CBT_Nxny.js +4 -0
- package/dist/twilight/{p-CDmVMECr.js → p-CD5i_50p.js} +1 -1
- package/dist/twilight/{p-CczoUZzK.js → p-CP2LDZCD.js} +1 -1
- package/dist/twilight/{p-5M19N20S.js → p-CWkLySV3.js} +1 -1
- package/dist/twilight/{p-CZPa2uSm.js → p-CoLlt5es.js} +1 -1
- package/dist/twilight/{p-3de1d08f.entry.js → p-a6ebba30.entry.js} +1 -1
- package/dist/twilight/p-bXg2F_NN.js +5 -0
- package/dist/twilight/{p-4ef533e4.entry.js → p-c5afe02a.entry.js} +1 -1
- package/dist/twilight/{p-881a41b7.entry.js → p-c691fd39.entry.js} +1 -1
- package/dist/twilight/{p-0d5c3afe.entry.js → p-c848e1d3.entry.js} +1 -1
- package/dist/twilight/{p-5c3aacf5.entry.js → p-c88d32f0.entry.js} +1 -1
- package/dist/twilight/p-d08cedb0.entry.js +11 -0
- package/dist/twilight/{p-bb15a2d4.entry.js → p-dcd9e688.entry.js} +1 -1
- package/dist/twilight/{p-823202a3.entry.js → p-dd84065f.entry.js} +1 -1
- package/dist/twilight/{p-f3b2d756.entry.js → p-e4418e6f.entry.js} +1 -1
- package/dist/twilight/{p-d35d16fd.entry.js → p-ef3a4d3e.entry.js} +1 -1
- package/dist/twilight/{p-e4e3ed35.entry.js → p-ef9ac6cb.entry.js} +1 -1
- package/dist/twilight/{p-f7c29e31.entry.js → p-f4549e2e.entry.js} +1 -1
- package/dist/twilight/{p-454504b2.entry.js → p-fa379f1e.entry.js} +1 -1
- package/dist/twilight/{p-2b23018d.entry.js → p-fcd1344e.entry.js} +1 -1
- package/dist/twilight/{p-Ie0stZTt.js → p-k3nBgoPC.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-custom-fields/salla-custom-fields.d.ts +39 -0
- package/dist/types/components/salla-file-upload/salla-file-upload.d.ts +4 -0
- package/dist/types/components/salla-user-menu/salla-user-menu.d.ts +4 -1
- package/dist/types/components/salla-user-profile/interfaces.d.ts +1 -0
- package/dist/types/components/salla-user-profile/salla-user-profile.d.ts +1 -20
- package/dist/types/components.d.ts +74 -25
- package/package.json +5 -5
- package/dist/twilight/p-29f0ab1e.entry.js +0 -11
- package/dist/twilight/p-BzYM6G5p.js +0 -5
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
4
|
import { h } from "@stencil/core";
|
|
5
|
-
import { Genders
|
|
6
|
-
import CameraIcon from "../../assets/svg/camera.svg";
|
|
5
|
+
import { Genders } from "./interfaces";
|
|
7
6
|
/**
|
|
8
7
|
* The SallaUserProfile is a versatile user profile form
|
|
9
8
|
* generator within the Salla platform, offering localization support,
|
|
10
9
|
* customizable fields, and seamless integration with the Salla API.
|
|
11
10
|
* It dynamically fetches translated strings for labels and messages from the
|
|
12
11
|
* Salla localization object, allowing for a multilingual user interface. Users
|
|
13
|
-
* can extend the default form with custom fields through the `customFields`
|
|
14
|
-
* property and the setCustomFields method. The component manages user data
|
|
15
12
|
* retrieval from the Salla configuration and includes fields for first name,
|
|
16
13
|
* last name, birthday, gender, email, mobile, and custom additions. Form
|
|
17
14
|
* validation and submission are handled through various event handlers, ensuring
|
|
@@ -28,7 +25,6 @@ export class SallaUserProfile {
|
|
|
28
25
|
/**
|
|
29
26
|
* The minimum allowed age for a user. Users with a birthdate indicating an age less than this value will be considered invalid.
|
|
30
27
|
* Defaults to 10.
|
|
31
|
-
* @type {number}
|
|
32
28
|
*/
|
|
33
29
|
this.minAge = 10;
|
|
34
30
|
this.isEditable = true;
|
|
@@ -75,20 +71,13 @@ export class SallaUserProfile {
|
|
|
75
71
|
});
|
|
76
72
|
});
|
|
77
73
|
}
|
|
78
|
-
/**
|
|
79
|
-
* Sets custom fields for the component. Can be handy for non HTML usage.
|
|
80
|
-
*
|
|
81
|
-
* @param fields - An array of custom fields.
|
|
82
|
-
*/
|
|
83
|
-
async setCustomFields(fields) {
|
|
84
|
-
this.userDefinedFields = fields;
|
|
85
|
-
}
|
|
86
74
|
// Event handler for phone number field changes
|
|
87
75
|
phoneNumberFieldEventHandler(data) {
|
|
88
76
|
if (!data.detail.number) {
|
|
89
|
-
|
|
77
|
+
this.disableAction = true;
|
|
78
|
+
return;
|
|
90
79
|
}
|
|
91
|
-
this.userData.phone.number = parseInt(data.detail.number);
|
|
80
|
+
this.userData.phone.number = Number.parseInt(data.detail.number);
|
|
92
81
|
this.userData.phone.country = data.detail.country_code;
|
|
93
82
|
this.disableAction = false;
|
|
94
83
|
}
|
|
@@ -104,74 +93,34 @@ export class SallaUserProfile {
|
|
|
104
93
|
}
|
|
105
94
|
}
|
|
106
95
|
}
|
|
107
|
-
// Event handler for file upload changes
|
|
108
|
-
handleOnFileAdded(key, data) {
|
|
109
|
-
// TODO: the key in here, shall be not have whitespace. or the key for
|
|
110
|
-
// the field shall be provided with one of the properties of the custom field
|
|
111
|
-
if (!data.detail.error) {
|
|
112
|
-
this.userData[key] = data.detail.file;
|
|
113
|
-
this.disableAction = false;
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
this.disableAction = true;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
96
|
// Event handler for email input changes
|
|
120
97
|
handleEmailInput(key, event) {
|
|
121
98
|
const emailErrorDisplaySection = document.getElementById('email-error');
|
|
122
99
|
const email = event.target.value;
|
|
123
100
|
if (!email) {
|
|
124
101
|
this.disableAction = true;
|
|
125
|
-
|
|
102
|
+
emailErrorDisplaySection.textContent = this.email_required_trans;
|
|
103
|
+
return;
|
|
126
104
|
}
|
|
127
105
|
const emailPattern = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
|
|
128
106
|
if (!emailPattern.test(email)) {
|
|
129
107
|
this.disableAction = true;
|
|
130
|
-
|
|
108
|
+
emailErrorDisplaySection.textContent = this.invalid_email_trans;
|
|
131
109
|
}
|
|
132
110
|
emailErrorDisplaySection.textContent = '';
|
|
133
111
|
this.userData[key] = email;
|
|
134
112
|
this.disableAction = false;
|
|
135
113
|
}
|
|
136
|
-
// Helper method to trim language code from URL
|
|
137
|
-
trimLanguageCodeFromUrl(url, languageCode) {
|
|
138
|
-
const pattern = new RegExp(`^(https?://[^/]+)\\/${languageCode}(.*)`, 'i');
|
|
139
|
-
const match = url.replace(/\/+$/, '').match(pattern);
|
|
140
|
-
if (match && match.length >= 2) {
|
|
141
|
-
const [, baseUrl, restOfUrl] = match;
|
|
142
|
-
return baseUrl + restOfUrl;
|
|
143
|
-
}
|
|
144
|
-
return url;
|
|
145
|
-
}
|
|
146
|
-
// Helper method to get file upload URL
|
|
147
|
-
getFileUploadUrl() {
|
|
148
|
-
return `${this.trimLanguageCodeFromUrl(salla.config.get('store.url'), salla.config.get('user.language_code'))}/upload-image`;
|
|
149
|
-
}
|
|
150
|
-
// Render custom fields based on user-defined fields
|
|
151
|
-
renderCustomFields() {
|
|
152
|
-
if (!this.userDefinedFields) {
|
|
153
|
-
return '';
|
|
154
|
-
}
|
|
155
|
-
return this.userDefinedFields.map((field) => {
|
|
156
|
-
return (h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: `${field.id}`, class: "s-user-profile-field-label" }, field.label), this.renderCustomField(field)));
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
renderCustomField(field) {
|
|
160
|
-
if (field.type !== FormFieldTypes.Photo) {
|
|
161
|
-
return (h("input", { type: field.type, id: `${field.id}`, value: field.value, onChange: event => this.handleFieldChange(`custom_fields[${field.id}]`, event), name: `custom_fields[${field.id}]`, class: "form-input", required: field.required }));
|
|
162
|
-
}
|
|
163
|
-
return (h("salla-file-upload", { "instant-upload": true, value: field.value, url: this.getFileUploadUrl(), name: `custom_fields[${field.id}]`, "payload-name": "image", height: "120px", onAdded: data => this.handleOnFileAdded(`custom_fields[${field.id}]`, data) }, h("div", { class: "s-user-profile-filepond-placeholder" }, h("span", { class: "s-user-profile-filepond-placeholder-icon" }, h("i", { innerHTML: CameraIcon })), h("p", { class: "s-user-profile-filepond-placeholder-text" }, this.drag_and_drop_trans), h("span", { class: "filepond--label-action" }, this.browse_trans))));
|
|
164
|
-
}
|
|
165
114
|
// Submit form method
|
|
166
115
|
submitForm(event) {
|
|
167
116
|
event.preventDefault();
|
|
168
117
|
this.disableAction = true;
|
|
169
|
-
|
|
170
|
-
|
|
118
|
+
const payload = Object.assign({}, this.userData);
|
|
119
|
+
payload.phone = undefined;
|
|
171
120
|
//@ts-ignore
|
|
172
|
-
payload
|
|
173
|
-
payload
|
|
174
|
-
|
|
121
|
+
payload.phone = this.userData.phone.number;
|
|
122
|
+
payload.country_code = this.userData.phone.country;
|
|
123
|
+
salla.api.profile.update(payload).finally(() => { this.disableAction = false; });
|
|
175
124
|
}
|
|
176
125
|
getBirthDateRestriction() {
|
|
177
126
|
const now = new Date();
|
|
@@ -180,19 +129,9 @@ export class SallaUserProfile {
|
|
|
180
129
|
return now;
|
|
181
130
|
}
|
|
182
131
|
fetchData() {
|
|
183
|
-
let customFields = null;
|
|
184
|
-
// Load user-defined fields and initial user data
|
|
185
|
-
if (this.customFields) {
|
|
186
|
-
customFields = typeof this.customFields === 'string'
|
|
187
|
-
? JSON.parse(this.customFields)
|
|
188
|
-
: this.customFields;
|
|
189
|
-
}
|
|
190
|
-
if (customFields && Array.isArray(customFields)) {
|
|
191
|
-
this.userDefinedFields = customFields;
|
|
192
|
-
}
|
|
193
132
|
return salla.api.profile
|
|
194
133
|
.info()
|
|
195
|
-
.then(resp =>
|
|
134
|
+
.then(resp => { this.userData = resp.data; })
|
|
196
135
|
.finally(() => {
|
|
197
136
|
this.isLoading = false;
|
|
198
137
|
this.isEditable = !Salla.config.get('store.features').includes('sso-login');
|
|
@@ -208,7 +147,7 @@ export class SallaUserProfile {
|
|
|
208
147
|
if (this.isLoading) {
|
|
209
148
|
return this.renderLoadingSection();
|
|
210
149
|
}
|
|
211
|
-
return (h("form", { onSubmit: event => this.submitForm(event) }, h("div", { class: "s-user-profile-wrapper" }, h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "first-name", class: "s-user-profile-field-label" }, this.first_name_trans), h("input", { disabled: !this.isEditable, type: "text", name: "first_name", value: this.userData.first_name, id: "first-name", required: true, autocomplete: "first_name", class: "form-input", onChange: event => this.handleFieldChange('first_name', event) })), h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "last-name", class: "s-user-profile-field-label" }, this.last_name_trans), h("input", { disabled: !this.isEditable, type: "text", name: "last_name", value: this.userData.last_name, id: "last-name", required: true, autocomplete: "last_name", class: "form-input", onChange: event => this.handleFieldChange('last_name', event) })), h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "birthday", class: "s-user-profile-field-label" }, this.birthday_trans), h("salla-datetime-picker", { disabled: !this.isEditable, dateFormat: "Y-m-d", value: this.userData.birthday, placeholder: this.birthday_placeholder_trans, required: true, maxDate: this.getBirthDateRestriction(), name: "birthday", onPicked: event => this.handleFieldChange('birthday', event) })), h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "gender", class: "s-user-profile-field-label" }, this.gender_trans), h("select", { disabled: !this.isEditable, class: "form-input", name: "gender", required: true, onChange: event => this.handleFieldChange('gender', event) }, h("option", { value: "" }, this.gender_placeholder_trans), h("option", { value: Genders.Male, selected: this.userData.gender
|
|
150
|
+
return (h("form", { onSubmit: event => this.submitForm(event) }, h("div", { class: "s-user-profile-wrapper" }, h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "first-name", class: "s-user-profile-field-label" }, this.first_name_trans), h("input", { disabled: !this.isEditable, type: "text", name: "first_name", value: this.userData.first_name, id: "first-name", required: true, autocomplete: "first_name", class: "form-input", onChange: event => this.handleFieldChange('first_name', event) })), h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "last-name", class: "s-user-profile-field-label" }, this.last_name_trans), h("input", { disabled: !this.isEditable, type: "text", name: "last_name", value: this.userData.last_name, id: "last-name", required: true, autocomplete: "last_name", class: "form-input", onChange: event => this.handleFieldChange('last_name', event) })), h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "birthday", class: "s-user-profile-field-label" }, this.birthday_trans), h("salla-datetime-picker", { disabled: !this.isEditable, dateFormat: "Y-m-d", value: this.userData.birthday, placeholder: this.birthday_placeholder_trans, required: true, maxDate: this.getBirthDateRestriction(), name: "birthday", onPicked: event => this.handleFieldChange('birthday', event) })), h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "gender", class: "s-user-profile-field-label" }, this.gender_trans), h("select", { disabled: !this.isEditable, class: "form-input", name: "gender", required: true, onChange: event => this.handleFieldChange('gender', event) }, h("option", { value: "" }, this.gender_placeholder_trans), h("option", { value: Genders.Male, selected: this.userData.gender === Genders.Male }, this.male_trans), h("option", { value: Genders.Female, selected: this.userData.gender === Genders.Female }, this.female_trans))), h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "email", class: "s-user-profile-field-label" }, this.email_trans), h("input", { disabled: !this.isEditable, type: "email", name: "email", value: this.userData.email, id: "email", class: "form-input", required: true, onInput: event => this.handleEmailInput('email', event) }), h("p", { id: "email-error", class: "s-user-profile-field-error" })), h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "international-mobile", class: "s-user-profile-field-label" }, this.mobile_trans), h("salla-tel-input", { disabled: !this.isEditable, name: "international-mobile", "country-code": this.userData.phone.country, phone: `${this.userData.phone.number}`, onPhoneEntered: data => this.phoneNumberFieldEventHandler(data) }))), h("salla-button", { type: "submit", loading: this.disableAction, disabled: this.disableAction || !this.isEditable, "loader-position": "end", class: "s-user-profile-submit" }, this.save_btn_trans)));
|
|
212
151
|
}
|
|
213
152
|
static get is() { return "salla-user-profile"; }
|
|
214
153
|
static get originalStyleUrls() {
|
|
@@ -223,25 +162,6 @@ export class SallaUserProfile {
|
|
|
223
162
|
}
|
|
224
163
|
static get properties() {
|
|
225
164
|
return {
|
|
226
|
-
"customFields": {
|
|
227
|
-
"type": "string",
|
|
228
|
-
"attribute": "custom-fields",
|
|
229
|
-
"mutable": false,
|
|
230
|
-
"complexType": {
|
|
231
|
-
"original": "string",
|
|
232
|
-
"resolved": "string",
|
|
233
|
-
"references": {}
|
|
234
|
-
},
|
|
235
|
-
"required": false,
|
|
236
|
-
"optional": false,
|
|
237
|
-
"docs": {
|
|
238
|
-
"tags": [],
|
|
239
|
-
"text": "Custome fields to be rendered in addition to the default ones."
|
|
240
|
-
},
|
|
241
|
-
"getter": false,
|
|
242
|
-
"setter": false,
|
|
243
|
-
"reflect": false
|
|
244
|
-
},
|
|
245
165
|
"minAge": {
|
|
246
166
|
"type": "number",
|
|
247
167
|
"attribute": "min-age",
|
|
@@ -254,10 +174,7 @@ export class SallaUserProfile {
|
|
|
254
174
|
"required": false,
|
|
255
175
|
"optional": false,
|
|
256
176
|
"docs": {
|
|
257
|
-
"tags": [
|
|
258
|
-
"name": "type",
|
|
259
|
-
"text": "{number}"
|
|
260
|
-
}],
|
|
177
|
+
"tags": [],
|
|
261
178
|
"text": "The minimum allowed age for a user. Users with a birthdate indicating an age less than this value will be considered invalid.\nDefaults to 10."
|
|
262
179
|
},
|
|
263
180
|
"getter": false,
|
|
@@ -271,7 +188,6 @@ export class SallaUserProfile {
|
|
|
271
188
|
return {
|
|
272
189
|
"userData": {},
|
|
273
190
|
"isEditable": {},
|
|
274
|
-
"userDefinedFields": {},
|
|
275
191
|
"disableAction": {},
|
|
276
192
|
"isLoading": {},
|
|
277
193
|
"first_name_trans": {},
|
|
@@ -291,37 +207,4 @@ export class SallaUserProfile {
|
|
|
291
207
|
"invalid_email_trans": {}
|
|
292
208
|
};
|
|
293
209
|
}
|
|
294
|
-
static get methods() {
|
|
295
|
-
return {
|
|
296
|
-
"setCustomFields": {
|
|
297
|
-
"complexType": {
|
|
298
|
-
"signature": "(fields: CustomField[]) => Promise<void>",
|
|
299
|
-
"parameters": [{
|
|
300
|
-
"name": "fields",
|
|
301
|
-
"type": "CustomField[]",
|
|
302
|
-
"docs": "- An array of custom fields."
|
|
303
|
-
}],
|
|
304
|
-
"references": {
|
|
305
|
-
"Promise": {
|
|
306
|
-
"location": "global",
|
|
307
|
-
"id": "global::Promise"
|
|
308
|
-
},
|
|
309
|
-
"CustomField": {
|
|
310
|
-
"location": "import",
|
|
311
|
-
"path": "./interfaces",
|
|
312
|
-
"id": "src/components/salla-user-profile/interfaces.ts::CustomField"
|
|
313
|
-
}
|
|
314
|
-
},
|
|
315
|
-
"return": "Promise<void>"
|
|
316
|
-
},
|
|
317
|
-
"docs": {
|
|
318
|
-
"text": "Sets custom fields for the component. Can be handy for non HTML usage.",
|
|
319
|
-
"tags": [{
|
|
320
|
-
"name": "param",
|
|
321
|
-
"text": "fields - An array of custom fields."
|
|
322
|
-
}]
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
210
|
}
|