@salla.sa/twilight-components 2.14.295 → 2.14.297
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-CEfkKwxm.js → filepond-B40UxVrp.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-U5caDeXK.js → filepond-plugin-file-poster-BJ2is-CR.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-5eUt8fIA.js → filepond-plugin-file-validate-size-jaoaOCNL.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-BdNoSu6e.js → filepond-plugin-file-validate-type-CjxCZWaY.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-DFm7eyxh.js → filepond-plugin-image-edit-JEKYuBL0.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-BfH19uNR.js → filepond-plugin-image-exif-orientation-DmK-aAfe.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-BCQL6DBC.js → filepond-plugin-image-preview-BZxhd7ci.js} +1 -1
- package/dist/cjs/{index-CMFmTYR8.js → index-Bc1Blm9E.js} +6 -2
- package/dist/cjs/{index-TCPzRuQa.js → index-CYgngxgk.js} +1 -1
- 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 +79 -124
- 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-user-menu/salla-user-menu.js +40 -22
- 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-user-menu.js +46 -22
- package/dist/components/salla-user-profile.js +19 -97
- package/dist/esm/{filepond-vl78959W.js → filepond-DjIxwPi0.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-CqR_Dwed.js → filepond-plugin-file-poster-CYvspSki.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-B6Dk56YE.js → filepond-plugin-file-validate-size-Cf09KKtA.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-P-_BDRkR.js → filepond-plugin-file-validate-type-ByZikBAG.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-DWNUa3R3.js → filepond-plugin-image-edit-DbT6_H2k.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-dnXbnCGP.js → filepond-plugin-image-exif-orientation-BhEk_QOu.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-CGT6aBAl.js → filepond-plugin-image-preview-Bsa9hzKo.js} +1 -1
- package/dist/esm/{index-DvtO64lP.js → index-CYhDRQ7q.js} +1 -1
- package/dist/esm/{index-Ziat6EbF.js → index-D8Ikl-5X.js} +6 -2
- package/dist/esm/interfaces-CBT_Nxny.js +22 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion_62.entry.js +78 -123
- 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-00042305.entry.js +4 -0
- package/dist/twilight/{p-9b480b59.entry.js → p-03907a0b.entry.js} +1 -1
- package/dist/twilight/{p-8cfd00b9.entry.js → p-067eafaf.entry.js} +1 -1
- package/dist/twilight/{p-93a27904.entry.js → p-199025a7.entry.js} +1 -1
- package/dist/twilight/{p-d107dc1a.entry.js → p-243e9c31.entry.js} +1 -1
- package/dist/twilight/{p-2b8846ae.entry.js → p-26c2b559.entry.js} +1 -1
- package/dist/twilight/{p-67038367.entry.js → p-28eae4bb.entry.js} +1 -1
- package/dist/twilight/{p-b3fafad2.entry.js → p-2a59b701.entry.js} +1 -1
- package/dist/twilight/{p-6822a113.entry.js → p-37249106.entry.js} +1 -1
- package/dist/twilight/{p-2a2a02d6.entry.js → p-3d7b61c6.entry.js} +1 -1
- package/dist/twilight/{p-f38b2e17.entry.js → p-3f2a0489.entry.js} +1 -1
- package/dist/twilight/{p-a328c3d1.entry.js → p-3fe694f7.entry.js} +1 -1
- package/dist/twilight/{p-bf70d878.entry.js → p-407a5e84.entry.js} +1 -1
- package/dist/twilight/{p-3d19d1d8.entry.js → p-4713b2c5.entry.js} +1 -1
- package/dist/twilight/{p-15d9e580.entry.js → p-5fe10b3f.entry.js} +1 -1
- package/dist/twilight/{p-415cf3e3.entry.js → p-60a1cceb.entry.js} +1 -1
- package/dist/twilight/{p-5f9bc177.entry.js → p-60aa330e.entry.js} +1 -1
- package/dist/twilight/{p-917e7e9e.entry.js → p-62b33ee4.entry.js} +1 -1
- package/dist/twilight/{p-ab6a475b.entry.js → p-66ccff79.entry.js} +1 -1
- package/dist/twilight/{p-64d30453.entry.js → p-6781caef.entry.js} +1 -1
- package/dist/twilight/{p-c9109a79.entry.js → p-747b3306.entry.js} +1 -1
- package/dist/twilight/{p-a9c627f1.entry.js → p-8713ed50.entry.js} +1 -1
- package/dist/twilight/{p-9c51b8d3.entry.js → p-87c26055.entry.js} +1 -1
- package/dist/twilight/{p-30edc8e4.entry.js → p-9bb74d00.entry.js} +1 -1
- package/dist/twilight/{p-Ez0e1PVX.js → p-BENXSP8S.js} +1 -1
- package/dist/twilight/{p-BX_7gR2g.js → p-BdPzpmIq.js} +1 -1
- package/dist/twilight/p-CBT_Nxny.js +4 -0
- package/dist/twilight/{p-hVSNpsuQ.js → p-CFX5Won9.js} +1 -1
- package/dist/twilight/{p-BXOeDpV2.js → p-CYIyfWLw.js} +1 -1
- package/dist/twilight/{p-7wg_fRFs.js → p-CdhBe5Fz.js} +1 -1
- package/dist/twilight/{p-C0j6-TqH.js → p-D7xuopBR.js} +1 -1
- package/dist/twilight/{p-Ziat6EbF.js → p-D8Ikl-5X.js} +2 -2
- package/dist/twilight/{p-ZreQEa1A.js → p-DQJu53PU.js} +1 -1
- package/dist/twilight/{p-4edf534b.entry.js → p-a608994f.entry.js} +1 -1
- package/dist/twilight/{p-ca431a2c.entry.js → p-ade5c1b4.entry.js} +1 -1
- package/dist/twilight/{p-1287dd6d.entry.js → p-c0804853.entry.js} +1 -1
- package/dist/twilight/{p-745e8f76.entry.js → p-dded0945.entry.js} +1 -1
- package/dist/twilight/p-e7b610b8.entry.js +11 -0
- package/dist/twilight/{p-e79994cc.entry.js → p-e82e0803.entry.js} +1 -1
- package/dist/twilight/{p-cd7e4279.entry.js → p-ecdb32fb.entry.js} +1 -1
- package/dist/twilight/{p-a9da8a2e.entry.js → p-f0267809.entry.js} +1 -1
- package/dist/twilight/{p-66ab7e17.entry.js → p-f30f7e03.entry.js} +1 -1
- package/dist/twilight/{p-f5a11fd5.entry.js → p-f8beff97.entry.js} +1 -1
- package/dist/twilight/{p-BBY0-pTD.js → p-fl5mSXGV.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 +6 -2
- 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-c6d04437.entry.js +0 -11
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import { r as registerInstance, h, H as Host, a as getElement, c as createEvent, d as getDefaultExportFromCjs, F as Fragment, j as axios } from './index-
|
|
4
|
+
import { r as registerInstance, h, H as Host, a as getElement, c as createEvent, d as getDefaultExportFromCjs, F as Fragment, j as axios } from './index-D8Ikl-5X.js';
|
|
5
5
|
import { a as anime } from './anime.es-CgtvEd63.js';
|
|
6
6
|
import { A as ArrowDownIcon, S as SpecialDiscountIcon } from './special-discount-yRO-ZESF.js';
|
|
7
7
|
import { I as IconVerified } from './check-uTyAzPSy.js';
|
|
8
8
|
import { H as Helper } from './Helper-B51hb0bi.js';
|
|
9
9
|
import { a as arrowLeft } from './arrow-left-BedNk7k1.js';
|
|
10
|
+
import { C as CameraIcon, G as Genders } from './interfaces-CBT_Nxny.js';
|
|
10
11
|
import { S as ShoppingBag } from './shopping-bag-DiKTtDW5.js';
|
|
11
12
|
import { M as MailIcon } from './mail-DmgxDvXL.js';
|
|
12
13
|
import { w as whatsapp$1 } from './whatsapp2-DWksgowB.js';
|
|
@@ -3523,13 +3524,13 @@ const SallaFileUpload = class {
|
|
|
3523
3524
|
return;
|
|
3524
3525
|
try {
|
|
3525
3526
|
const [FilePondModule, FilePondPluginFileValidateSize, FilePondPluginImageExifOrientation, FilePondPluginImagePreview, FilePondPluginImageEdit, FilePondPluginFileValidateType, FilePondPluginFilePoster] = await Promise.all([
|
|
3526
|
-
import('./filepond-
|
|
3527
|
-
import('./filepond-plugin-file-validate-size-
|
|
3528
|
-
import('./filepond-plugin-image-exif-orientation-
|
|
3529
|
-
import('./filepond-plugin-image-preview-
|
|
3530
|
-
import('./filepond-plugin-image-edit-
|
|
3531
|
-
import('./filepond-plugin-file-validate-type-
|
|
3532
|
-
import('./filepond-plugin-file-poster-
|
|
3527
|
+
import('./filepond-DjIxwPi0.js').then(function (n) { return n.f; }),
|
|
3528
|
+
import('./filepond-plugin-file-validate-size-Cf09KKtA.js').then(function (n) { return n.f; }),
|
|
3529
|
+
import('./filepond-plugin-image-exif-orientation-BhEk_QOu.js').then(function (n) { return n.f; }),
|
|
3530
|
+
import('./filepond-plugin-image-preview-Bsa9hzKo.js').then(function (n) { return n.f; }),
|
|
3531
|
+
import('./filepond-plugin-image-edit-DbT6_H2k.js').then(function (n) { return n.f; }),
|
|
3532
|
+
import('./filepond-plugin-file-validate-type-ByZikBAG.js').then(function (n) { return n.f; }),
|
|
3533
|
+
import('./filepond-plugin-file-poster-CYvspSki.js').then(function (n) { return n.f; })
|
|
3533
3534
|
]);
|
|
3534
3535
|
this.FilePond = FilePondModule;
|
|
3535
3536
|
// Register plugins
|
|
@@ -3558,6 +3559,10 @@ const SallaFileUpload = class {
|
|
|
3558
3559
|
* Set the component to be profile image uploader with a preview and a circular shape
|
|
3559
3560
|
*/
|
|
3560
3561
|
this.profileImage = false;
|
|
3562
|
+
/**
|
|
3563
|
+
* Allow to pass extra params to be sent with the upload request
|
|
3564
|
+
*/
|
|
3565
|
+
this.payloadParams = {};
|
|
3561
3566
|
/**
|
|
3562
3567
|
* Accepted file types
|
|
3563
3568
|
*/
|
|
@@ -3819,11 +3824,11 @@ const SallaFileUpload = class {
|
|
|
3819
3824
|
}
|
|
3820
3825
|
}
|
|
3821
3826
|
render() {
|
|
3822
|
-
return (h(Host, { key: '
|
|
3827
|
+
return (h(Host, { key: '68939496fd8cfcc89a7a5d21e7e4daedab0db536', class: {
|
|
3823
3828
|
"s-file-upload": true,
|
|
3824
3829
|
"s-file-upload-profile-image": this.profileImage,
|
|
3825
3830
|
"s-file-upload-multiple": this.allowMultiple,
|
|
3826
|
-
} }, h("input", { key: '
|
|
3831
|
+
} }, h("input", { key: 'adef3f296d759850322faf038602143a0239201d', type: "file", name: this.name, value: this.value, ref: ele => this.fileUploader = ele, required: this.required, class: "s-file-upload-wrapper s-file-upload-input", accept: this.accept }), this.allowMultiple && this.showMaxCountHint ? h("div", { class: "s-file-upload-hint s-hidden" }, this.max_count_hint(this.maxFilesCount)) : '', h("input", { key: 'dc74f8a155eeedd294548f782ed158f1a889b373', class: "s-hidden", name: 'hidden-' + this.name, required: this.required, value: this.value, ref: input => this.hiddenInput = input })));
|
|
3827
3832
|
}
|
|
3828
3833
|
componentDidLoad() {
|
|
3829
3834
|
let files = this.getFiles();
|
|
@@ -3906,7 +3911,7 @@ const SallaFileUpload = class {
|
|
|
3906
3911
|
process: {
|
|
3907
3912
|
onload: (response) => {
|
|
3908
3913
|
let responseData = JSON.parse(response).data;
|
|
3909
|
-
if (this.allowMultiple && Array.isArray(responseData) && responseData.length > 0) {
|
|
3914
|
+
if ((this.instantUpload || this.allowMultiple) && Array.isArray(responseData) && responseData.length > 0) {
|
|
3910
3915
|
const fileId = `${this.host.id}-${Math.floor(100 + Math.random() * 900)}`;
|
|
3911
3916
|
this.uploadedFiles.push({
|
|
3912
3917
|
id: fileId,
|
|
@@ -3950,6 +3955,11 @@ const SallaFileUpload = class {
|
|
|
3950
3955
|
formData.append(this.payloadName, this.filepond.getFile(0).file);
|
|
3951
3956
|
formData.delete(this.name);
|
|
3952
3957
|
}
|
|
3958
|
+
if (this.payloadParams) {
|
|
3959
|
+
for (const [k, v] of Object.entries(this.payloadParams)) {
|
|
3960
|
+
formData.append(k, v);
|
|
3961
|
+
}
|
|
3962
|
+
}
|
|
3953
3963
|
if (this.cartItemId) {
|
|
3954
3964
|
formData.append('cart_item_id', this.cartItemId);
|
|
3955
3965
|
}
|
|
@@ -7710,13 +7720,6 @@ var Currency;
|
|
|
7710
7720
|
Currency["Sar"] = "SAR";
|
|
7711
7721
|
})(Currency || (Currency = {}));
|
|
7712
7722
|
|
|
7713
|
-
var CameraIcon = `<!-- Generated by IcoMoon.io -->
|
|
7714
|
-
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
7715
|
-
<title>camera</title>
|
|
7716
|
-
<path d="M16 10.667c-4.044 0-7.333 3.289-7.333 7.333s3.289 7.333 7.333 7.333 7.333-3.289 7.333-7.333-3.289-7.333-7.333-7.333zM16 22.667c-2.573 0-4.667-2.093-4.667-4.667s2.093-4.667 4.667-4.667 4.667 2.093 4.667 4.667-2.093 4.667-4.667 4.667zM28 5.333h-3.287l-2.271-3.407c-0.248-0.371-0.664-0.593-1.109-0.593h-10.667c-0.445 0-0.861 0.223-1.109 0.593l-2.271 3.407h-3.287c-2.205 0-4 1.795-4 4v17.333c0 2.205 1.795 4 4 4h24c2.205 0 4-1.795 4-4v-17.333c0-2.205-1.795-4-4-4zM29.333 26.667c0 0.735-0.599 1.333-1.333 1.333h-24c-0.735 0-1.333-0.599-1.333-1.333v-17.333c0-0.735 0.599-1.333 1.333-1.333h4c0.445 0 0.861-0.223 1.109-0.593l2.272-3.407h9.239l2.271 3.407c0.248 0.371 0.664 0.593 1.109 0.593h4c0.735 0 1.333 0.599 1.333 1.333zM25.333 10.66c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327z"></path>
|
|
7717
|
-
</svg>
|
|
7718
|
-
`;
|
|
7719
|
-
|
|
7720
7723
|
var FileIcon = `<!-- Generated by IcoMoon.io -->
|
|
7721
7724
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
7722
7725
|
<title>file-upload</title>
|
|
@@ -12504,7 +12507,7 @@ const SallaTelInput = class {
|
|
|
12504
12507
|
if (this.TelInput)
|
|
12505
12508
|
return;
|
|
12506
12509
|
try {
|
|
12507
|
-
const telInputModule = await import('./index-
|
|
12510
|
+
const telInputModule = await import('./index-CYhDRQ7q.js').then(function (n) { return n.i; });
|
|
12508
12511
|
this.TelInput = telInputModule.default;
|
|
12509
12512
|
}
|
|
12510
12513
|
catch (error) {
|
|
@@ -12655,20 +12658,18 @@ var WalletIcon = `<!-- Generated by IcoMoon.io -->
|
|
|
12655
12658
|
</svg>
|
|
12656
12659
|
`;
|
|
12657
12660
|
|
|
12661
|
+
var SettingstIcon = `<!-- Generated by IcoMoon.io -->
|
|
12662
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
12663
|
+
<title>settings</title>
|
|
12664
|
+
<path d="M29.717 19.037l-1.817-1.499c0.067-0.512 0.1-1.028 0.1-1.539s-0.033-1.027-0.1-1.54l1.817-1.499c1.177-0.969 1.479-2.633 0.716-3.956l-1.159-2.009c-0.761-1.324-2.349-1.895-3.784-1.359l-2.212 0.829c-0.817-0.627-1.704-1.139-2.649-1.535l-0.388-2.332c-0.251-1.507-1.54-2.6-3.067-2.6h-2.319c-1.525 0-2.815 1.093-3.065 2.6l-0.388 2.332c-0.945 0.396-1.833 0.909-2.649 1.535l-2.212-0.829c-1.428-0.533-3.021 0.036-3.783 1.359l-1.16 2.011c-0.763 1.323-0.46 2.985 0.716 3.955l1.817 1.499c-0.067 0.513-0.1 1.029-0.1 1.54s0.033 1.027 0.1 1.539l-1.819 1.5c-1.176 0.971-1.476 2.635-0.715 3.955l1.159 2.011c0.763 1.324 2.356 1.899 3.784 1.36l2.212-0.831c0.816 0.625 1.703 1.139 2.649 1.535l0.388 2.332c0.251 1.507 1.54 2.6 3.067 2.6h2.319c1.527 0 2.816-1.093 3.065-2.6l0.389-2.332c0.947-0.396 1.833-0.909 2.649-1.535l2.212 0.831c1.432 0.539 3.023-0.035 3.783-1.36l1.16-2.011c0.76-1.32 0.459-2.984-0.717-3.956zM28.123 21.663l-1.16 2.011c-0.108 0.188-0.336 0.267-0.536 0.193l-2.931-1.1c-0.459-0.173-0.979-0.079-1.349 0.248-0.923 0.811-1.979 1.423-3.139 1.819-0.464 0.157-0.804 0.559-0.885 1.043l-0.515 3.087c-0.033 0.215-0.216 0.371-0.433 0.371h-2.319c-0.217 0-0.4-0.156-0.436-0.371l-0.513-3.087c-0.080-0.484-0.42-0.884-0.885-1.043-1.16-0.396-2.216-1.008-3.139-1.819-0.248-0.217-0.561-0.332-0.88-0.332-0.157 0-0.316 0.028-0.469 0.084l-2.931 1.1c-0.199 0.079-0.428-0.004-0.537-0.193l-1.159-2.011c-0.109-0.191-0.067-0.428 0.101-0.568l2.409-1.985c0.379-0.312 0.555-0.807 0.46-1.288-0.119-0.605-0.179-1.219-0.179-1.821 0-0.604 0.060-1.217 0.181-1.823 0.095-0.481-0.081-0.976-0.46-1.288l-2.409-1.985c-0.168-0.139-0.211-0.376-0.101-0.567l1.16-2.011c0.107-0.188 0.332-0.268 0.536-0.193l2.931 1.1c0.459 0.172 0.979 0.079 1.348-0.247 0.924-0.812 1.98-1.424 3.139-1.817 0.465-0.159 0.805-0.559 0.885-1.044l0.513-3.088c0.036-0.215 0.219-0.371 0.436-0.371h2.319c0.217 0 0.4 0.156 0.436 0.371l0.515 3.088c0.081 0.484 0.42 0.885 0.885 1.044 1.157 0.393 2.213 1.005 3.139 1.817 0.371 0.325 0.889 0.42 1.349 0.247l2.929-1.099c0.203-0.076 0.428 0.005 0.537 0.193l1.159 2.009c0.109 0.191 0.067 0.428-0.101 0.567l-2.409 1.985c-0.379 0.312-0.555 0.807-0.46 1.288 0.119 0.605 0.179 1.219 0.179 1.823 0 0.603-0.060 1.216-0.181 1.821-0.095 0.48 0.081 0.975 0.46 1.288l2.408 1.984c0.169 0.141 0.212 0.379 0.103 0.569zM16.016 10.667c-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333 5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM16.016 18.667c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"></path>
|
|
12665
|
+
</svg>
|
|
12666
|
+
`;
|
|
12667
|
+
|
|
12658
12668
|
const sallaUserMenuCss = "";
|
|
12659
12669
|
|
|
12660
12670
|
const SallaUserMenu = class {
|
|
12661
12671
|
constructor(hostRef) {
|
|
12662
12672
|
registerInstance(this, hostRef);
|
|
12663
|
-
this.items = {
|
|
12664
|
-
notifications: BellRing,
|
|
12665
|
-
orders: OrderIcon,
|
|
12666
|
-
pending_orders: PendingOrdersIcon,
|
|
12667
|
-
wishlist: WishListIcon,
|
|
12668
|
-
profile: UserCircle,
|
|
12669
|
-
wallet: WalletIcon,
|
|
12670
|
-
loyalty_program: GiftIcon,
|
|
12671
|
-
};
|
|
12672
12673
|
this.accountLoading = false;
|
|
12673
12674
|
this.opened = false;
|
|
12674
12675
|
this.notifications = salla.lang.get('common.titles.notifications');
|
|
@@ -12678,6 +12679,7 @@ const SallaUserMenu = class {
|
|
|
12678
12679
|
this.profile = salla.lang.get('common.titles.profile');
|
|
12679
12680
|
this.rating = salla.lang.get('common.titles.rating');
|
|
12680
12681
|
this.wallet = salla.lang.get('common.titles.wallet');
|
|
12682
|
+
this.settings = salla.lang.get('common.titles.settings');
|
|
12681
12683
|
this.loyalty_program = salla.lang.get('pages.loyalty_program.loyalty_points');
|
|
12682
12684
|
this.logout = salla.lang.get('blocks.header.logout');
|
|
12683
12685
|
this.hello = salla.lang.get('pages.checkout.hello');
|
|
@@ -12688,6 +12690,7 @@ const SallaUserMenu = class {
|
|
|
12688
12690
|
notifications: salla.helpers.number(salla.storage.get('user.notifications') || 0),
|
|
12689
12691
|
pending_orders: salla.helpers.number(salla.storage.get('user.pending_orders') || 0),
|
|
12690
12692
|
};
|
|
12693
|
+
this.sallaAccountEnabled = Salla.config.get('store.features').includes('salla-account');
|
|
12691
12694
|
this.hasBadges = Number(salla.storage.get('user.pending_orders')) > 0 ||
|
|
12692
12695
|
Number(salla.storage.get('user.notifications')) > 0;
|
|
12693
12696
|
/**
|
|
@@ -12710,6 +12713,16 @@ const SallaUserMenu = class {
|
|
|
12710
12713
|
this.opened = false;
|
|
12711
12714
|
};
|
|
12712
12715
|
this.OrderUpdate = 0;
|
|
12716
|
+
this.items = {
|
|
12717
|
+
notifications: BellRing,
|
|
12718
|
+
orders: OrderIcon,
|
|
12719
|
+
pending_orders: PendingOrdersIcon,
|
|
12720
|
+
wishlist: WishListIcon,
|
|
12721
|
+
wallet: WalletIcon,
|
|
12722
|
+
loyalty_program: GiftIcon,
|
|
12723
|
+
profile: UserCircle,
|
|
12724
|
+
...(this.sallaAccountEnabled ? { settings: SettingstIcon } : {})
|
|
12725
|
+
};
|
|
12713
12726
|
// salla.auth.event.onLoggedIn(() => {
|
|
12714
12727
|
// this.is_loggedIn = true
|
|
12715
12728
|
// })
|
|
@@ -12722,6 +12735,7 @@ const SallaUserMenu = class {
|
|
|
12722
12735
|
this.hello = salla.lang.get('pages.checkout.hello');
|
|
12723
12736
|
this.rating = salla.lang.get('common.titles.rating');
|
|
12724
12737
|
this.wallet = salla.lang.get('common.titles.wallet');
|
|
12738
|
+
this.settings = salla.lang.get('common.titles.settings');
|
|
12725
12739
|
this.loyalty_program = salla.lang.get('pages.loyalty_program.loyalty_points');
|
|
12726
12740
|
this.logout = salla.lang.get('blocks.header.logout');
|
|
12727
12741
|
});
|
|
@@ -12763,8 +12777,9 @@ const SallaUserMenu = class {
|
|
|
12763
12777
|
});
|
|
12764
12778
|
}
|
|
12765
12779
|
componentWillLoad() {
|
|
12766
|
-
return
|
|
12767
|
-
|
|
12780
|
+
return salla.onReady().then(() => {
|
|
12781
|
+
this.profileUrl = `${salla.config.get('account.url', 'https://accounts.salla.com')}/${salla.config.get('user.language_code')}/user?store=${salla.config.get('store.id')}&info=${salla.storage.get('token')}`;
|
|
12782
|
+
const trigger = this.host.querySelector('[slot="trigger"]');
|
|
12768
12783
|
this.triggerSlot =
|
|
12769
12784
|
'<div class="s-user-menu-trigger"><div class="s-user-menu-avatar-wrap"><img class="s-user-menu-trigger-avatar" src="{avatar}" alt="{first_name}{last_name}" /></div><div class="s-user-menu-trigger-content"><span class="s-user-menu-trigger-hello">{hello}</span><p class="s-user-menu-trigger-name">{first_name} {last_name}</p></div> <i class="s-user-menu-trigger-icon">{icon}</i></div>';
|
|
12770
12785
|
if (!trigger) {
|
|
@@ -12801,8 +12816,8 @@ const SallaUserMenu = class {
|
|
|
12801
12816
|
window.addEventListener('click', this.onClickOutside);
|
|
12802
12817
|
}
|
|
12803
12818
|
}
|
|
12804
|
-
menuItemClicked(event,
|
|
12805
|
-
if (
|
|
12819
|
+
menuItemClicked(event, itemKey) {
|
|
12820
|
+
if (itemKey !== 'logout') {
|
|
12806
12821
|
return;
|
|
12807
12822
|
}
|
|
12808
12823
|
event.preventDefault();
|
|
@@ -12821,18 +12836,28 @@ const SallaUserMenu = class {
|
|
|
12821
12836
|
's-user-menu-trigger-slot': true,
|
|
12822
12837
|
's-user-menu-red-dot': this.hasBadges,
|
|
12823
12838
|
's-user-menu-trigger-avatar-only': this.avatarOnly,
|
|
12824
|
-
}, id: "trigger-slot", onClick: e => this.open(e), innerHTML: this.replaceParams(this.triggerSlot) }));
|
|
12839
|
+
}, id: "trigger-slot", onClick: e => this.open(e), onKeyUp: e => this.open(e), innerHTML: this.replaceParams(this.triggerSlot) }));
|
|
12840
|
+
}
|
|
12841
|
+
getItemAnchorLinkAttrs(itemKey) {
|
|
12842
|
+
if (itemKey === 'profile' && this.profileUrl) {
|
|
12843
|
+
return this.sallaAccountEnabled ?
|
|
12844
|
+
{ href: this.profileUrl, target: '_blank', rel: 'noopener noreferrer' } :
|
|
12845
|
+
{ href: '/profile' };
|
|
12846
|
+
}
|
|
12847
|
+
// Fix loyalty program URL mapping from master
|
|
12848
|
+
const urlKey = itemKey === 'loyalty_program' ? 'loyalty' : itemKey;
|
|
12849
|
+
return { href: salla.url.get(urlKey) };
|
|
12825
12850
|
}
|
|
12826
|
-
getMenuItem(
|
|
12851
|
+
getMenuItem([itemKey, itemValue], i) {
|
|
12827
12852
|
//todo:: enhancement support slot here
|
|
12828
|
-
if (
|
|
12853
|
+
if (itemKey === 'wallet' && !window.can_access_wallet)
|
|
12829
12854
|
return;
|
|
12830
|
-
if (
|
|
12855
|
+
if (itemKey === 'loyalty_program' && !salla.config.get('store.features').includes('loyalty-system'))
|
|
12831
12856
|
return;
|
|
12832
12857
|
return (h("li", { class: {
|
|
12833
12858
|
's-user-menu-dropdown-item': true,
|
|
12834
|
-
's-user-menu-dropdown-item-logout': i + 1
|
|
12835
|
-
} }, h("a", {
|
|
12859
|
+
's-user-menu-dropdown-item-logout': i + 1 === Object.entries(this.items).length,
|
|
12860
|
+
} }, h("a", { ...this.getItemAnchorLinkAttrs(itemKey), class: "s-user-menu-dropdown-item-link", onClick: event => this.menuItemClicked(event, itemKey) }, h("i", { class: "s-user-menu-dropdown-item-prefix", innerHTML: itemValue }), h("span", { class: "s-user-menu-dropdown-item-title" }, this[itemKey]), !['٠', '0', undefined].includes(this.badges[itemKey]) ? (h("span", { class: "s-user-menu-dropdown-item-badge" }, this.badges[itemKey])) : (''))));
|
|
12836
12861
|
}
|
|
12837
12862
|
componentShouldUpdate() {
|
|
12838
12863
|
if (!this.opened) {
|
|
@@ -12841,7 +12866,7 @@ const SallaUserMenu = class {
|
|
|
12841
12866
|
}
|
|
12842
12867
|
render() {
|
|
12843
12868
|
if (!this.is_loggedIn) {
|
|
12844
|
-
return (h(Host, null, h("slot", { name: "login-btn" }, h("button", { class: "s-user-menu-login-btn", onClick: () => salla.event.dispatch('login::open'), innerHTML: UserCircle }))));
|
|
12869
|
+
return (h(Host, null, h("slot", { name: "login-btn" }, h("button", { type: "button", class: "s-user-menu-login-btn", onClick: () => salla.event.dispatch('login::open'), innerHTML: UserCircle }))));
|
|
12845
12870
|
}
|
|
12846
12871
|
if (this.inline) {
|
|
12847
12872
|
return (h(Host, null, h("ul", { class: "s-user-menu-inline" }, Object.entries(this.items).map((item, i) => this.getMenuItem(item, i)))));
|
|
@@ -12849,27 +12874,15 @@ const SallaUserMenu = class {
|
|
|
12849
12874
|
return (h(Host, null, h("div", { class: {
|
|
12850
12875
|
's-user-menu-wrapper': true,
|
|
12851
12876
|
's-user-menu-relative-dropdown': this.relativeDropdown,
|
|
12852
|
-
} }, this.getTheHeader(), h("div", { class: { 's-user-menu-toggler': true, opened: this.opened } }, h("div", { class: "s-user-menu-dropdown", onClick: e => e.stopPropagation() }, this.showHeader ? (h("div", { class: "s-user-menu-dropdown-header" }, h("img", { src: this.avatar, alt: `${this.first_name} ${this.last_name}` }), h("div", { class: "s-user-menu-dropdown-header-content" }, h("span", null, this.hello), h("p", null, this.first_name, " ", this.last_name)), h("button", { class: "s-user-menu-dropdown-header-close", innerHTML: Cancel, onClick: () =>
|
|
12877
|
+
} }, this.getTheHeader(), h("div", { class: { 's-user-menu-toggler': true, opened: this.opened } }, h("div", { class: "s-user-menu-dropdown", onClick: e => e.stopPropagation(), onKeyUp: e => e.stopPropagation() }, this.showHeader ? (h("div", { class: "s-user-menu-dropdown-header" }, h("img", { src: this.avatar, alt: `${this.first_name} ${this.last_name}` }), h("div", { class: "s-user-menu-dropdown-header-content" }, h("span", null, this.hello), h("p", null, this.first_name, " ", this.last_name)), h("button", { type: 'button', class: "s-user-menu-dropdown-header-close", innerHTML: Cancel, onClick: () => { this.opened = false; } }))) : (''), h("ul", { class: "s-user-menu-dropdown-list" }, Object.entries(this.items).map((item, i) => this.getMenuItem(item, i))))))));
|
|
12853
12878
|
}
|
|
12854
12879
|
componentDidLoad() {
|
|
12855
|
-
//make sure to load the avatar if it's lazy, we use it in Y
|
|
12856
12880
|
document.lazyLoadInstance?.update(this.host.querySelectorAll('.lazy'));
|
|
12857
12881
|
}
|
|
12858
12882
|
get host() { return getElement(this); }
|
|
12859
12883
|
};
|
|
12860
12884
|
SallaUserMenu.style = sallaUserMenuCss;
|
|
12861
12885
|
|
|
12862
|
-
var Genders;
|
|
12863
|
-
(function (Genders) {
|
|
12864
|
-
Genders["Female"] = "female";
|
|
12865
|
-
Genders["Male"] = "male";
|
|
12866
|
-
})(Genders || (Genders = {}));
|
|
12867
|
-
var FormFieldTypes;
|
|
12868
|
-
(function (FormFieldTypes) {
|
|
12869
|
-
FormFieldTypes["Photo"] = "photo";
|
|
12870
|
-
FormFieldTypes["Text"] = "Text";
|
|
12871
|
-
})(FormFieldTypes || (FormFieldTypes = {}));
|
|
12872
|
-
|
|
12873
12886
|
const sallaUserProfileCss = ":host{display:block}";
|
|
12874
12887
|
|
|
12875
12888
|
const SallaUserProfile = class {
|
|
@@ -12879,7 +12892,6 @@ const SallaUserProfile = class {
|
|
|
12879
12892
|
/**
|
|
12880
12893
|
* The minimum allowed age for a user. Users with a birthdate indicating an age less than this value will be considered invalid.
|
|
12881
12894
|
* Defaults to 10.
|
|
12882
|
-
* @type {number}
|
|
12883
12895
|
*/
|
|
12884
12896
|
this.minAge = 10;
|
|
12885
12897
|
this.isEditable = true;
|
|
@@ -12926,20 +12938,13 @@ const SallaUserProfile = class {
|
|
|
12926
12938
|
});
|
|
12927
12939
|
});
|
|
12928
12940
|
}
|
|
12929
|
-
/**
|
|
12930
|
-
* Sets custom fields for the component. Can be handy for non HTML usage.
|
|
12931
|
-
*
|
|
12932
|
-
* @param fields - An array of custom fields.
|
|
12933
|
-
*/
|
|
12934
|
-
async setCustomFields(fields) {
|
|
12935
|
-
this.userDefinedFields = fields;
|
|
12936
|
-
}
|
|
12937
12941
|
// Event handler for phone number field changes
|
|
12938
12942
|
phoneNumberFieldEventHandler(data) {
|
|
12939
12943
|
if (!data.detail.number) {
|
|
12940
|
-
|
|
12944
|
+
this.disableAction = true;
|
|
12945
|
+
return;
|
|
12941
12946
|
}
|
|
12942
|
-
this.userData.phone.number = parseInt(data.detail.number);
|
|
12947
|
+
this.userData.phone.number = Number.parseInt(data.detail.number);
|
|
12943
12948
|
this.userData.phone.country = data.detail.country_code;
|
|
12944
12949
|
this.disableAction = false;
|
|
12945
12950
|
}
|
|
@@ -12955,74 +12960,34 @@ const SallaUserProfile = class {
|
|
|
12955
12960
|
}
|
|
12956
12961
|
}
|
|
12957
12962
|
}
|
|
12958
|
-
// Event handler for file upload changes
|
|
12959
|
-
handleOnFileAdded(key, data) {
|
|
12960
|
-
// TODO: the key in here, shall be not have whitespace. or the key for
|
|
12961
|
-
// the field shall be provided with one of the properties of the custom field
|
|
12962
|
-
if (!data.detail.error) {
|
|
12963
|
-
this.userData[key] = data.detail.file;
|
|
12964
|
-
this.disableAction = false;
|
|
12965
|
-
}
|
|
12966
|
-
else {
|
|
12967
|
-
this.disableAction = true;
|
|
12968
|
-
}
|
|
12969
|
-
}
|
|
12970
12963
|
// Event handler for email input changes
|
|
12971
12964
|
handleEmailInput(key, event) {
|
|
12972
12965
|
const emailErrorDisplaySection = document.getElementById('email-error');
|
|
12973
12966
|
const email = event.target.value;
|
|
12974
12967
|
if (!email) {
|
|
12975
12968
|
this.disableAction = true;
|
|
12976
|
-
|
|
12969
|
+
emailErrorDisplaySection.textContent = this.email_required_trans;
|
|
12970
|
+
return;
|
|
12977
12971
|
}
|
|
12978
12972
|
const emailPattern = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
|
|
12979
12973
|
if (!emailPattern.test(email)) {
|
|
12980
12974
|
this.disableAction = true;
|
|
12981
|
-
|
|
12975
|
+
emailErrorDisplaySection.textContent = this.invalid_email_trans;
|
|
12982
12976
|
}
|
|
12983
12977
|
emailErrorDisplaySection.textContent = '';
|
|
12984
12978
|
this.userData[key] = email;
|
|
12985
12979
|
this.disableAction = false;
|
|
12986
12980
|
}
|
|
12987
|
-
// Helper method to trim language code from URL
|
|
12988
|
-
trimLanguageCodeFromUrl(url, languageCode) {
|
|
12989
|
-
const pattern = new RegExp(`^(https?://[^/]+)\\/${languageCode}(.*)`, 'i');
|
|
12990
|
-
const match = url.replace(/\/+$/, '').match(pattern);
|
|
12991
|
-
if (match && match.length >= 2) {
|
|
12992
|
-
const [, baseUrl, restOfUrl] = match;
|
|
12993
|
-
return baseUrl + restOfUrl;
|
|
12994
|
-
}
|
|
12995
|
-
return url;
|
|
12996
|
-
}
|
|
12997
|
-
// Helper method to get file upload URL
|
|
12998
|
-
getFileUploadUrl() {
|
|
12999
|
-
return `${this.trimLanguageCodeFromUrl(salla.config.get('store.url'), salla.config.get('user.language_code'))}/upload-image`;
|
|
13000
|
-
}
|
|
13001
|
-
// Render custom fields based on user-defined fields
|
|
13002
|
-
renderCustomFields() {
|
|
13003
|
-
if (!this.userDefinedFields) {
|
|
13004
|
-
return '';
|
|
13005
|
-
}
|
|
13006
|
-
return this.userDefinedFields.map((field) => {
|
|
13007
|
-
return (h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: `${field.id}`, class: "s-user-profile-field-label" }, field.label), this.renderCustomField(field)));
|
|
13008
|
-
});
|
|
13009
|
-
}
|
|
13010
|
-
renderCustomField(field) {
|
|
13011
|
-
if (field.type !== FormFieldTypes.Photo) {
|
|
13012
|
-
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 }));
|
|
13013
|
-
}
|
|
13014
|
-
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))));
|
|
13015
|
-
}
|
|
13016
12981
|
// Submit form method
|
|
13017
12982
|
submitForm(event) {
|
|
13018
12983
|
event.preventDefault();
|
|
13019
12984
|
this.disableAction = true;
|
|
13020
|
-
|
|
13021
|
-
|
|
12985
|
+
const payload = Object.assign({}, this.userData);
|
|
12986
|
+
payload.phone = undefined;
|
|
13022
12987
|
//@ts-ignore
|
|
13023
|
-
payload
|
|
13024
|
-
payload
|
|
13025
|
-
|
|
12988
|
+
payload.phone = this.userData.phone.number;
|
|
12989
|
+
payload.country_code = this.userData.phone.country;
|
|
12990
|
+
salla.api.profile.update(payload).finally(() => { this.disableAction = false; });
|
|
13026
12991
|
}
|
|
13027
12992
|
getBirthDateRestriction() {
|
|
13028
12993
|
const now = new Date();
|
|
@@ -13031,19 +12996,9 @@ const SallaUserProfile = class {
|
|
|
13031
12996
|
return now;
|
|
13032
12997
|
}
|
|
13033
12998
|
fetchData() {
|
|
13034
|
-
let customFields = null;
|
|
13035
|
-
// Load user-defined fields and initial user data
|
|
13036
|
-
if (this.customFields) {
|
|
13037
|
-
customFields = typeof this.customFields === 'string'
|
|
13038
|
-
? JSON.parse(this.customFields)
|
|
13039
|
-
: this.customFields;
|
|
13040
|
-
}
|
|
13041
|
-
if (customFields && Array.isArray(customFields)) {
|
|
13042
|
-
this.userDefinedFields = customFields;
|
|
13043
|
-
}
|
|
13044
12999
|
return salla.api.profile
|
|
13045
13000
|
.info()
|
|
13046
|
-
.then(resp =>
|
|
13001
|
+
.then(resp => { this.userData = resp.data; })
|
|
13047
13002
|
.finally(() => {
|
|
13048
13003
|
this.isLoading = false;
|
|
13049
13004
|
this.isEditable = !Salla.config.get('store.features').includes('sso-login');
|
|
@@ -13059,7 +13014,7 @@ const SallaUserProfile = class {
|
|
|
13059
13014
|
if (this.isLoading) {
|
|
13060
13015
|
return this.renderLoadingSection();
|
|
13061
13016
|
}
|
|
13062
|
-
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
|
|
13017
|
+
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)));
|
|
13063
13018
|
}
|
|
13064
13019
|
};
|
|
13065
13020
|
SallaUserProfile.style = sallaUserProfileCss;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import { r as registerInstance, h, a as getElement } from './index-
|
|
4
|
+
import { r as registerInstance, h, a as getElement } from './index-D8Ikl-5X.js';
|
|
5
5
|
import { a as anime } from './anime.es-CgtvEd63.js';
|
|
6
6
|
|
|
7
7
|
const sallaAdvertisementCss = ":host{display:block}";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import { r as registerInstance, h, H as Host, a as getElement } from './index-
|
|
4
|
+
import { r as registerInstance, h, H as Host, a as getElement } from './index-D8Ikl-5X.js';
|
|
5
5
|
|
|
6
6
|
const sallaAppInstallAlertCss = ":host{display:block}";
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import { r as registerInstance, h, H as Host, a as getElement } from './index-
|
|
4
|
+
import { r as registerInstance, h, H as Host, a as getElement } from './index-D8Ikl-5X.js';
|
|
5
5
|
|
|
6
6
|
const sallaAppsIconsCss = ":host{display:block}";
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import { r as registerInstance, h } from './index-
|
|
4
|
+
import { r as registerInstance, h } from './index-D8Ikl-5X.js';
|
|
5
5
|
import { S as SpecialDiscountIcon, A as ArrowDownIcon } from './special-discount-yRO-ZESF.js';
|
|
6
6
|
import { G as GiftIcon } from './gift-C0JNGIpa.js';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import { r as registerInstance, h, H as Host, a as getElement } from './index-
|
|
4
|
+
import { r as registerInstance, h, H as Host, a as getElement } from './index-D8Ikl-5X.js';
|
|
5
5
|
import { w as whatsapp } from './whatsapp2-DWksgowB.js';
|
|
6
6
|
import { M as MailIcon } from './mail-DmgxDvXL.js';
|
|
7
7
|
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import { r as registerInstance, c as createEvent, h } from './index-D8Ikl-5X.js';
|
|
5
|
+
import { C as CameraIcon, F as FormFieldTypes } from './interfaces-CBT_Nxny.js';
|
|
6
|
+
|
|
7
|
+
const sallaCustomFieldsCss = ":host{display:block}";
|
|
8
|
+
|
|
9
|
+
const SallaCustomFields = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
registerInstance(this, hostRef);
|
|
12
|
+
this.fieldChanged = createEvent(this, "fieldChanged");
|
|
13
|
+
this.fileUploaded = createEvent(this, "fileUploaded");
|
|
14
|
+
this.isEditable = true;
|
|
15
|
+
this.fieldErrors = {};
|
|
16
|
+
this.isSubmitting = false;
|
|
17
|
+
}
|
|
18
|
+
get dragAndDropText() {
|
|
19
|
+
return salla.lang.get("common.uploader.drag_and_drop");
|
|
20
|
+
}
|
|
21
|
+
get browseText() {
|
|
22
|
+
return salla.lang.get("common.uploader.browse");
|
|
23
|
+
}
|
|
24
|
+
get saveButtonText() {
|
|
25
|
+
return salla.lang.get("common.elements.save");
|
|
26
|
+
}
|
|
27
|
+
async setFields(fields) {
|
|
28
|
+
this.parsedFields = fields;
|
|
29
|
+
}
|
|
30
|
+
async getFieldValues() {
|
|
31
|
+
return this.parsedFields?.reduce((values, field) => {
|
|
32
|
+
values[`custom_fields[${field.id}]`] = field.value;
|
|
33
|
+
return values;
|
|
34
|
+
}, {}) || {};
|
|
35
|
+
}
|
|
36
|
+
async validateFields() {
|
|
37
|
+
if (!this.parsedFields)
|
|
38
|
+
return true;
|
|
39
|
+
const errors = this.parsedFields.reduce((acc, field) => {
|
|
40
|
+
if (field.required && (!field.value || field.value === "")) {
|
|
41
|
+
acc[field.id.toString()] = `${field.label} is required`;
|
|
42
|
+
}
|
|
43
|
+
return acc;
|
|
44
|
+
}, {});
|
|
45
|
+
this.fieldErrors = errors;
|
|
46
|
+
return Object.keys(errors).length === 0;
|
|
47
|
+
}
|
|
48
|
+
handleFieldChange(field, event) {
|
|
49
|
+
const value = event.target.value;
|
|
50
|
+
field.value = value;
|
|
51
|
+
this.clearFieldError(field.id);
|
|
52
|
+
const isValid = !(field.required && !value);
|
|
53
|
+
if (!isValid) {
|
|
54
|
+
this.setFieldError(field.id, `${field.label} is required`);
|
|
55
|
+
}
|
|
56
|
+
this.fieldChanged.emit({ fieldId: field.id, value, isValid });
|
|
57
|
+
}
|
|
58
|
+
handleFileUpload(field, event) {
|
|
59
|
+
const { error, file } = event.detail;
|
|
60
|
+
const isValid = !error;
|
|
61
|
+
this.clearFieldError(field.id);
|
|
62
|
+
if (isValid) {
|
|
63
|
+
field.value = file;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
this.setFieldError(field.id, "File upload failed");
|
|
67
|
+
}
|
|
68
|
+
this.fileUploaded.emit({ fieldId: field.id, file, isValid });
|
|
69
|
+
}
|
|
70
|
+
clearFieldError(fieldId) {
|
|
71
|
+
this.fieldErrors = { ...this.fieldErrors };
|
|
72
|
+
delete this.fieldErrors[fieldId];
|
|
73
|
+
}
|
|
74
|
+
setFieldError(fieldId, message) {
|
|
75
|
+
this.fieldErrors = { ...this.fieldErrors, [fieldId]: message };
|
|
76
|
+
}
|
|
77
|
+
renderTextField(field) {
|
|
78
|
+
return (h("input", { disabled: !this.isEditable, type: field.type, id: `custom-field-${field.id}`, value: field.value?.toString() || "", onChange: (e) => this.handleFieldChange(field, e), name: `${field.id}`, class: "form-input", required: field.required }));
|
|
79
|
+
}
|
|
80
|
+
renderFileField(field) {
|
|
81
|
+
return (h("salla-file-upload", { url: salla.url.api('upload'), id: `custom-field-${field.id}`, name: `${field.id}`, type: "registration", value: field.value, height: "120px", onAdded: (e) => this.handleFileUpload(field, e), required: field.required, disabled: !this.isEditable, onUploaded: e => { e.target.value = e.target.value?.url; }, allowRemove: true, onRemoved: (e) => {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
e.stopPropagation();
|
|
84
|
+
field.value = "";
|
|
85
|
+
e.target.value = "";
|
|
86
|
+
}, payloadName: "files[]", payloadParams: { type: 'registration' }, "instant-upload": true }, h("div", { class: "s-custom-fields-filepond-placeholder" }, h("span", { class: "s-custom-fields-filepond-placeholder-icon" }, h("i", { innerHTML: CameraIcon })), h("p", { class: "s-custom-fields-filepond-placeholder-text" }, this.dragAndDropText), h("span", { class: "filepond--label-action" }, this.browseText))));
|
|
87
|
+
}
|
|
88
|
+
renderField(field) {
|
|
89
|
+
return (h("div", { class: "s-custom-fields-field", key: field.id }, h("label", { class: "s-custom-fields-field-label", htmlFor: `custom-field-${field.id}` }, field.label, field.required && h("span", { class: "s-custom-fields-required" }, "*")), h("div", null, field.type === FormFieldTypes.Photo
|
|
90
|
+
? this.renderFileField(field)
|
|
91
|
+
: this.renderTextField(field), this.fieldErrors[field.id] && (h("p", { class: "s-custom-fields-error" }, this.fieldErrors[field.id])))));
|
|
92
|
+
}
|
|
93
|
+
componentWillLoad() {
|
|
94
|
+
this.parsedFields = this.parseFields(this.fields);
|
|
95
|
+
}
|
|
96
|
+
parseFields(fields) {
|
|
97
|
+
if (!fields)
|
|
98
|
+
return [];
|
|
99
|
+
return typeof fields === "string"
|
|
100
|
+
? JSON.parse(fields)
|
|
101
|
+
: Array.isArray(fields) ? fields : [];
|
|
102
|
+
}
|
|
103
|
+
async handleSubmit(e) {
|
|
104
|
+
e.preventDefault();
|
|
105
|
+
this.isSubmitting = true;
|
|
106
|
+
try {
|
|
107
|
+
const payload = {};
|
|
108
|
+
const form = e.target;
|
|
109
|
+
const elements = form.elements;
|
|
110
|
+
for (let i = 0; i < elements.length; i++) {
|
|
111
|
+
const element = elements[i];
|
|
112
|
+
if (element.name && !element.name.startsWith("hidden") && element.value) {
|
|
113
|
+
payload[element.name] = element.value;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
await salla.api.profile.updateCustomFields({
|
|
117
|
+
id: salla.config.get("store.id"),
|
|
118
|
+
fields: payload,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
finally {
|
|
122
|
+
this.isSubmitting = false;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
render() {
|
|
126
|
+
if (!this.parsedFields?.length)
|
|
127
|
+
return null;
|
|
128
|
+
return (h("form", { class: "s-custom-fields-wrapper", onSubmit: this.handleSubmit }, this.parsedFields.map(field => this.renderField(field)), h("salla-button", { type: "submit", loading: this.isSubmitting, disabled: this.isSubmitting || !this.isEditable, "loader-position": "end", class: "s-custom-fields-submit-btn" }, this.saveButtonText)));
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
SallaCustomFields.style = sallaCustomFieldsCss;
|
|
132
|
+
|
|
133
|
+
export { SallaCustomFields as salla_custom_fields };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-
|
|
4
|
+
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-D8Ikl-5X.js';
|
|
5
5
|
import { H as Helper } from './Helper-B51hb0bi.js';
|
|
6
6
|
import { F as FilterOptionTypes } from './interfaces-DL4h2bc3.js';
|
|
7
7
|
import './anime.es-CgtvEd63.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-
|
|
4
|
+
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-D8Ikl-5X.js';
|
|
5
5
|
import { F as FilterOptionTypes } from './interfaces-DL4h2bc3.js';
|
|
6
6
|
import { H as Helper } from './Helper-B51hb0bi.js';
|
|
7
7
|
import './anime.es-CgtvEd63.js';
|