@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
|
@@ -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-bXg2F_NN.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-BEN4Pt87.js').then(function (n) { return n.f; }),
|
|
3528
|
+
import('./filepond-plugin-file-validate-size-DFkfdHfo.js').then(function (n) { return n.f; }),
|
|
3529
|
+
import('./filepond-plugin-image-exif-orientation-DJrUnj97.js').then(function (n) { return n.f; }),
|
|
3530
|
+
import('./filepond-plugin-image-preview-BCWlifYd.js').then(function (n) { return n.f; }),
|
|
3531
|
+
import('./filepond-plugin-image-edit-Dz3oYXef.js').then(function (n) { return n.f; }),
|
|
3532
|
+
import('./filepond-plugin-file-validate-type-CU-RnplM.js').then(function (n) { return n.f; }),
|
|
3533
|
+
import('./filepond-plugin-file-poster-B7t9aVVy.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>
|
|
@@ -8119,7 +8122,7 @@ const SallaProductOptions = class {
|
|
|
8119
8122
|
*/
|
|
8120
8123
|
handlePaste(event) {
|
|
8121
8124
|
const target = event.target;
|
|
8122
|
-
if (!Salla.helpers.
|
|
8125
|
+
if (!Salla.helpers.isAppleDevice()
|
|
8123
8126
|
|| !(target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement)
|
|
8124
8127
|
|| !target.classList.contains('s-form-control')) {
|
|
8125
8128
|
return;
|
|
@@ -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-fxSENfiU.js').then(function (n) { return n.i; });
|
|
12508
12511
|
this.TelInput = telInputModule.default;
|
|
12509
12512
|
}
|
|
12510
12513
|
catch (error) {
|
|
@@ -12655,6 +12658,13 @@ 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 {
|
|
@@ -12665,9 +12675,10 @@ const SallaUserMenu = class {
|
|
|
12665
12675
|
orders: OrderIcon,
|
|
12666
12676
|
pending_orders: PendingOrdersIcon,
|
|
12667
12677
|
wishlist: WishListIcon,
|
|
12668
|
-
profile: UserCircle,
|
|
12669
12678
|
wallet: WalletIcon,
|
|
12670
12679
|
loyalty_program: GiftIcon,
|
|
12680
|
+
profile: UserCircle,
|
|
12681
|
+
settings: SettingstIcon,
|
|
12671
12682
|
};
|
|
12672
12683
|
this.accountLoading = false;
|
|
12673
12684
|
this.opened = false;
|
|
@@ -12678,6 +12689,7 @@ const SallaUserMenu = class {
|
|
|
12678
12689
|
this.profile = salla.lang.get('common.titles.profile');
|
|
12679
12690
|
this.rating = salla.lang.get('common.titles.rating');
|
|
12680
12691
|
this.wallet = salla.lang.get('common.titles.wallet');
|
|
12692
|
+
this.settings = salla.lang.get('common.titles.settings');
|
|
12681
12693
|
this.loyalty_program = salla.lang.get('pages.loyalty_program.loyalty_points');
|
|
12682
12694
|
this.logout = salla.lang.get('blocks.header.logout');
|
|
12683
12695
|
this.hello = salla.lang.get('pages.checkout.hello');
|
|
@@ -12722,6 +12734,7 @@ const SallaUserMenu = class {
|
|
|
12722
12734
|
this.hello = salla.lang.get('pages.checkout.hello');
|
|
12723
12735
|
this.rating = salla.lang.get('common.titles.rating');
|
|
12724
12736
|
this.wallet = salla.lang.get('common.titles.wallet');
|
|
12737
|
+
this.settings = salla.lang.get('common.titles.settings');
|
|
12725
12738
|
this.loyalty_program = salla.lang.get('pages.loyalty_program.loyalty_points');
|
|
12726
12739
|
this.logout = salla.lang.get('blocks.header.logout');
|
|
12727
12740
|
});
|
|
@@ -12763,8 +12776,9 @@ const SallaUserMenu = class {
|
|
|
12763
12776
|
});
|
|
12764
12777
|
}
|
|
12765
12778
|
componentWillLoad() {
|
|
12766
|
-
return
|
|
12767
|
-
|
|
12779
|
+
return salla.onReady().then(() => {
|
|
12780
|
+
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')}`;
|
|
12781
|
+
const trigger = this.host.querySelector('[slot="trigger"]');
|
|
12768
12782
|
this.triggerSlot =
|
|
12769
12783
|
'<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
12784
|
if (!trigger) {
|
|
@@ -12801,8 +12815,8 @@ const SallaUserMenu = class {
|
|
|
12801
12815
|
window.addEventListener('click', this.onClickOutside);
|
|
12802
12816
|
}
|
|
12803
12817
|
}
|
|
12804
|
-
menuItemClicked(event,
|
|
12805
|
-
if (
|
|
12818
|
+
menuItemClicked(event, itemKey) {
|
|
12819
|
+
if (itemKey !== 'logout') {
|
|
12806
12820
|
return;
|
|
12807
12821
|
}
|
|
12808
12822
|
event.preventDefault();
|
|
@@ -12821,18 +12835,23 @@ const SallaUserMenu = class {
|
|
|
12821
12835
|
's-user-menu-trigger-slot': true,
|
|
12822
12836
|
's-user-menu-red-dot': this.hasBadges,
|
|
12823
12837
|
's-user-menu-trigger-avatar-only': this.avatarOnly,
|
|
12824
|
-
}, id: "trigger-slot", onClick: e => this.open(e), innerHTML: this.replaceParams(this.triggerSlot) }));
|
|
12838
|
+
}, id: "trigger-slot", onClick: e => this.open(e), onKeyUp: e => this.open(e), innerHTML: this.replaceParams(this.triggerSlot) }));
|
|
12839
|
+
}
|
|
12840
|
+
getItemAnchorLinkAttrs(itemKey) {
|
|
12841
|
+
// Fix loyalty program URL mapping from master
|
|
12842
|
+
const urlKey = itemKey === 'loyalty_program' ? 'loyalty' : itemKey;
|
|
12843
|
+
return { href: salla.url.get(urlKey) };
|
|
12825
12844
|
}
|
|
12826
|
-
getMenuItem(
|
|
12845
|
+
getMenuItem([itemKey, itemValue], i) {
|
|
12827
12846
|
//todo:: enhancement support slot here
|
|
12828
|
-
if (
|
|
12847
|
+
if (itemKey === 'wallet' && !window.can_access_wallet)
|
|
12829
12848
|
return;
|
|
12830
|
-
if (
|
|
12849
|
+
if (itemKey === 'loyalty_program' && !salla.config.get('store.features').includes('loyalty-system'))
|
|
12831
12850
|
return;
|
|
12832
12851
|
return (h("li", { class: {
|
|
12833
12852
|
's-user-menu-dropdown-item': true,
|
|
12834
|
-
's-user-menu-dropdown-item-logout': i + 1
|
|
12835
|
-
} }, h("a", {
|
|
12853
|
+
's-user-menu-dropdown-item-logout': i + 1 === Object.entries(this.items).length,
|
|
12854
|
+
} }, 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
12855
|
}
|
|
12837
12856
|
componentShouldUpdate() {
|
|
12838
12857
|
if (!this.opened) {
|
|
@@ -12841,7 +12860,7 @@ const SallaUserMenu = class {
|
|
|
12841
12860
|
}
|
|
12842
12861
|
render() {
|
|
12843
12862
|
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 }))));
|
|
12863
|
+
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
12864
|
}
|
|
12846
12865
|
if (this.inline) {
|
|
12847
12866
|
return (h(Host, null, h("ul", { class: "s-user-menu-inline" }, Object.entries(this.items).map((item, i) => this.getMenuItem(item, i)))));
|
|
@@ -12849,27 +12868,15 @@ const SallaUserMenu = class {
|
|
|
12849
12868
|
return (h(Host, null, h("div", { class: {
|
|
12850
12869
|
's-user-menu-wrapper': true,
|
|
12851
12870
|
'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: () =>
|
|
12871
|
+
} }, 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
12872
|
}
|
|
12854
12873
|
componentDidLoad() {
|
|
12855
|
-
//make sure to load the avatar if it's lazy, we use it in Y
|
|
12856
12874
|
document.lazyLoadInstance?.update(this.host.querySelectorAll('.lazy'));
|
|
12857
12875
|
}
|
|
12858
12876
|
get host() { return getElement(this); }
|
|
12859
12877
|
};
|
|
12860
12878
|
SallaUserMenu.style = sallaUserMenuCss;
|
|
12861
12879
|
|
|
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
12880
|
const sallaUserProfileCss = ":host{display:block}";
|
|
12874
12881
|
|
|
12875
12882
|
const SallaUserProfile = class {
|
|
@@ -12879,7 +12886,6 @@ const SallaUserProfile = class {
|
|
|
12879
12886
|
/**
|
|
12880
12887
|
* The minimum allowed age for a user. Users with a birthdate indicating an age less than this value will be considered invalid.
|
|
12881
12888
|
* Defaults to 10.
|
|
12882
|
-
* @type {number}
|
|
12883
12889
|
*/
|
|
12884
12890
|
this.minAge = 10;
|
|
12885
12891
|
this.isEditable = true;
|
|
@@ -12926,20 +12932,13 @@ const SallaUserProfile = class {
|
|
|
12926
12932
|
});
|
|
12927
12933
|
});
|
|
12928
12934
|
}
|
|
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
12935
|
// Event handler for phone number field changes
|
|
12938
12936
|
phoneNumberFieldEventHandler(data) {
|
|
12939
12937
|
if (!data.detail.number) {
|
|
12940
|
-
|
|
12938
|
+
this.disableAction = true;
|
|
12939
|
+
return;
|
|
12941
12940
|
}
|
|
12942
|
-
this.userData.phone.number = parseInt(data.detail.number);
|
|
12941
|
+
this.userData.phone.number = Number.parseInt(data.detail.number);
|
|
12943
12942
|
this.userData.phone.country = data.detail.country_code;
|
|
12944
12943
|
this.disableAction = false;
|
|
12945
12944
|
}
|
|
@@ -12955,74 +12954,34 @@ const SallaUserProfile = class {
|
|
|
12955
12954
|
}
|
|
12956
12955
|
}
|
|
12957
12956
|
}
|
|
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
12957
|
// Event handler for email input changes
|
|
12971
12958
|
handleEmailInput(key, event) {
|
|
12972
12959
|
const emailErrorDisplaySection = document.getElementById('email-error');
|
|
12973
12960
|
const email = event.target.value;
|
|
12974
12961
|
if (!email) {
|
|
12975
12962
|
this.disableAction = true;
|
|
12976
|
-
|
|
12963
|
+
emailErrorDisplaySection.textContent = this.email_required_trans;
|
|
12964
|
+
return;
|
|
12977
12965
|
}
|
|
12978
12966
|
const emailPattern = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
|
|
12979
12967
|
if (!emailPattern.test(email)) {
|
|
12980
12968
|
this.disableAction = true;
|
|
12981
|
-
|
|
12969
|
+
emailErrorDisplaySection.textContent = this.invalid_email_trans;
|
|
12982
12970
|
}
|
|
12983
12971
|
emailErrorDisplaySection.textContent = '';
|
|
12984
12972
|
this.userData[key] = email;
|
|
12985
12973
|
this.disableAction = false;
|
|
12986
12974
|
}
|
|
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
12975
|
// Submit form method
|
|
13017
12976
|
submitForm(event) {
|
|
13018
12977
|
event.preventDefault();
|
|
13019
12978
|
this.disableAction = true;
|
|
13020
|
-
|
|
13021
|
-
|
|
12979
|
+
const payload = Object.assign({}, this.userData);
|
|
12980
|
+
payload.phone = undefined;
|
|
13022
12981
|
//@ts-ignore
|
|
13023
|
-
payload
|
|
13024
|
-
payload
|
|
13025
|
-
|
|
12982
|
+
payload.phone = this.userData.phone.number;
|
|
12983
|
+
payload.country_code = this.userData.phone.country;
|
|
12984
|
+
salla.api.profile.update(payload).finally(() => { this.disableAction = false; });
|
|
13026
12985
|
}
|
|
13027
12986
|
getBirthDateRestriction() {
|
|
13028
12987
|
const now = new Date();
|
|
@@ -13031,19 +12990,9 @@ const SallaUserProfile = class {
|
|
|
13031
12990
|
return now;
|
|
13032
12991
|
}
|
|
13033
12992
|
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
12993
|
return salla.api.profile
|
|
13045
12994
|
.info()
|
|
13046
|
-
.then(resp =>
|
|
12995
|
+
.then(resp => { this.userData = resp.data; })
|
|
13047
12996
|
.finally(() => {
|
|
13048
12997
|
this.isLoading = false;
|
|
13049
12998
|
this.isEditable = !Salla.config.get('store.features').includes('sso-login');
|
|
@@ -13059,7 +13008,7 @@ const SallaUserProfile = class {
|
|
|
13059
13008
|
if (this.isLoading) {
|
|
13060
13009
|
return this.renderLoadingSection();
|
|
13061
13010
|
}
|
|
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
|
|
13011
|
+
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
13012
|
}
|
|
13064
13013
|
};
|
|
13065
13014
|
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-bXg2F_NN.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-bXg2F_NN.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-bXg2F_NN.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-bXg2F_NN.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-bXg2F_NN.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-bXg2F_NN.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-bXg2F_NN.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-bXg2F_NN.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';
|
|
@@ -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-bXg2F_NN.js';
|
|
5
5
|
|
|
6
6
|
const sallaInstallmentCss = "salla-installment:empty{display:none}#tabbyPromoWrapper{background:white;border-radius:0.375rem;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);margin-bottom:20px;border:unset !important;font-weight:500}.salla-y #tabbyPromoWrapper{border:1px solid var(--color-grey-dark);border-radius:12px}#tabbyPromoWrapper:hover{box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}#tabbyPromoWrapper #tabbyPromo *{font-family:var(--font-main)}#tabbyPromoWrapper #tabbyPromo>div>div{max-width:none;box-shadow:none;border:none}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet{max-width:100%;min-height:100px;padding:18px 20px;border:none !important}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__text,#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-size:var(--font-sm);color:var(--color-text) !important}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-weight:bold}.tabby-promo-wrapper #tabby-promo{font-family:var(--font-main) !important}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-title{font-size:var(--font-md)}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-desc{font-size:var(--font-sm);line-height:20px}.tamara-product-widget{margin-bottom:20px}.tamara-product-widget,.spotii-wrapper{min-height:100px;position:relative;color:var(--main-text-color);font-size:var(--font-sm);line-height:1.25;padding:20px 20px 20px 115px !important;background:white;border-radius:0.375rem;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);border:unset !important;font-family:inherit !important;font-weight:500}.salla-y .tamara-product-widget,.salla-y .spotii-wrapper{border-radius:12px;border:1px solid var(--color-grey-dark)}.tamara-product-widget:hover,.spotii-wrapper:hover{box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}.tamara-product-widget .spotii-logo,.spotii-wrapper .spotii-logo{float:left;margin:0 0 0 -75px}.ltr .tamara-product-widget,.ltr .spotii-wrapper{text-align:left;padding:18px 100px 18px 20px !important}.ltr .tamara-product-widget .spotii-logo,.ltr .spotii-wrapper .spotii-logo{float:right;margin:0 -75px 0 0}.ltr .tamara-product-widget .spotii-product-widget,.ltr .spotii-wrapper .spotii-product-widget{text-align:left !important}.spotii-wrapper{margin-bottom:20px}.spotii-wrapper .spotii-promo{font-size:var(--font-md)}.spotii-wrapper .spotii-product-widget{font-size:var(--font-sm) !important;margin-top:10px}.tamara-product-widget .tamara-logo{position:absolute;left:20px !important;top:35px !important;margin:0 !important;height:24px !important}.ltr .tamara-product-widget .tamara-logo{right:20px !important;left:auto !important}.tamara-product-widget span{font-family:var(--font-main);font-size:var(--font-sm);color:var(--color-text)}.tamara-product-widget span:last-child{display:block;position:relative;margin-top:8px}.tamara-popup__wrap{overflow:auto !important}.s-installment-mispay-wrapper,.s-installment-madfu-wrapper,.s-installment-emkan-wrapper,.s-installment-rajehi-wrapper{font-size:14px;text-align:right;padding:20px;gap:42px;line-height:22px;color:rgb(0, 0, 0);min-width:100%;box-sizing:border-box;position:relative;background-color:white;border-radius:10px;margin:15px 0;display:flex;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1)}.s-installment-mispay-wrapper:hover,.s-installment-madfu-wrapper:hover,.s-installment-emkan-wrapper:hover,.s-installment-rajehi-wrapper:hover{box-shadow:0 0 rgba(0, 0, 0, 0), 0 0 rgba(0, 0, 0, 0), 5px 10px 30px rgba(43, 45, 52, 0.0509803922)}.s-installment-mispay-content,.s-installment-madfu-content,.s-installment-emkan-content,.s-installment-rajehi-content{display:flex;flex-direction:row-reverse;width:100%;justify-content:space-between;align-items:center;gap:1rem}.s-installment-mispay-content-text,.s-installment-madfu-content-text,.s-installment-emkan-content-text,.s-installment-rajehi-content-text{color:var(--main-text-color);font-size:14px;font-weight:500;margin:0 16px 0 0;width:80%;left:14px;text-align:left}.s-installment-mispay-content img,.s-installment-madfu-content img,.s-installment-emkan-content img,.s-installment-rajehi-content img{height:28px;width:70px;display:inline-block;max-height:100%;vertical-align:middle;fill:none;stroke:unset;width:auto}.rtl .s-installment-mispay-content-text,.rtl .s-installment-madfu-content-text,.rtl .s-installment-emkan-content-text,.rtl .s-installment-rajehi-content-text{right:14px;text-align:right;margin:0 0 0 16px}.rtl .s-installment-mispay-content img,.rtl .s-installment-madfu-content img,.rtl .s-installment-emkan-content img,.rtl .s-installment-rajehi-content img{left:14px !important}.ltr .s-installment-mispay-content img,.ltr .s-installment-madfu-content img,.ltr .s-installment-emkan-content img,.ltr .s-installment-rajehi-content img{right:14px !important}.s-installment-rajehi-content img{width:70px !important;height:40px !important}.s-installment-emkan-content img{height:35px !important}";
|
|
7
7
|
|