@salla.sa/twilight-components 2.13.20 → 2.13.22
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/loader.cjs.js +1 -1
- package/dist/cjs/salla-add-product-button_47.cjs.entry.js +19 -6
- package/dist/cjs/salla-add-product-button_47.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +2 -2
- package/dist/cjs/salla-installment.cjs.entry.js.map +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/collection/components/salla-gifting/salla-gifting.js +5 -0
- package/dist/collection/components/salla-gifting/salla-gifting.js.map +1 -1
- package/dist/collection/components/salla-installment/salla-installment.js +2 -2
- package/dist/collection/components/salla-installment/salla-installment.js.map +1 -1
- package/dist/collection/components/salla-login-modal/salla-login-modal.js +12 -6
- package/dist/collection/components/salla-login-modal/salla-login-modal.js.map +1 -1
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +19 -0
- package/dist/collection/components/salla-tel-input/salla-tel-input.js.map +1 -1
- package/dist/components/salla-gifting.js +5 -0
- package/dist/components/salla-gifting.js.map +1 -1
- package/dist/components/salla-installment.js +2 -2
- package/dist/components/salla-installment.js.map +1 -1
- package/dist/components/salla-login-modal.js +12 -6
- package/dist/components/salla-login-modal.js.map +1 -1
- package/dist/components/salla-quick-buy2.js +1 -0
- package/dist/components/salla-quick-buy2.js.map +1 -1
- package/dist/components/salla-tel-input2.js +3 -0
- package/dist/components/salla-tel-input2.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-add-product-button_47.entry.js +19 -6
- package/dist/esm/salla-add-product-button_47.entry.js.map +1 -1
- package/dist/esm/salla-installment.entry.js +2 -2
- package/dist/esm/salla-installment.entry.js.map +1 -1
- package/dist/esm/twilight.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/esm-es5/salla-add-product-button_47.entry.js +1 -1
- package/dist/esm-es5/salla-add-product-button_47.entry.js.map +1 -1
- package/dist/esm-es5/salla-installment.entry.js +1 -1
- package/dist/esm-es5/salla-installment.entry.js.map +1 -1
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/esm-es5/twilight.js.map +1 -1
- package/dist/twilight/{p-daa1888f.entry.js → p-403d1936.entry.js} +2 -2
- package/dist/twilight/p-403d1936.entry.js.map +1 -0
- package/dist/twilight/{p-7ce64b51.entry.js → p-5775cbdb.entry.js} +2 -2
- package/dist/twilight/p-5775cbdb.entry.js.map +1 -0
- package/dist/twilight/{p-5d8d9481.system.entry.js → p-98df3e02.system.entry.js} +2 -2
- package/dist/twilight/p-98df3e02.system.entry.js.map +1 -0
- package/dist/twilight/{p-b8aec437.system.entry.js → p-a5a313ea.system.entry.js} +2 -2
- package/dist/twilight/p-a5a313ea.system.entry.js.map +1 -0
- package/dist/twilight/p-e550d2df.system.js +1 -1
- package/dist/twilight/p-e550d2df.system.js.map +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.esm.js.map +1 -1
- package/dist/types/components/salla-gifting/salla-gifting.d.ts +1 -0
- package/dist/types/components/salla-login-modal/salla-login-modal.d.ts +1 -0
- package/dist/types/components/salla-tel-input/salla-tel-input.d.ts +4 -0
- package/dist/types/components.d.ts +8 -0
- package/package.json +5 -5
- package/dist/twilight/p-5d8d9481.system.entry.js.map +0 -1
- package/dist/twilight/p-7ce64b51.entry.js.map +0 -1
- package/dist/twilight/p-b8aec437.system.entry.js.map +0 -1
- package/dist/twilight/p-daa1888f.entry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"salla-installment.js","sourceRoot":"","sources":["../../../src/components/salla-installment/salla-installment.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAOzE,MAAM,OAAO,gBAAgB;EAI3B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OACrB,CAAC;MAEF,IAAI,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;MACpD,YAAY,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC,CAAC;MAC/E,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;MACxC,gCAAgC;MAChC,oBAAoB;MACpB,IAAI;KACL;EACH,CAAC;EAGD;;;KAGG;EACH,iBAAiB;IACf,IAAI,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,sBAAsB,GAAG,CAAC,EAAE;MAC9D,OAAO;KACR;IACD,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAC9B,UAAU,CAAC,GAAG,EAAE;MACd,IAAI,KAAK,GAAQ,QAAQ,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;MAC/D,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,6CAA6C,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;MACrG,IAAI,KAAK,EAAE;QACT,KAAK,CAAC,KAAK,GAAG,yCAAyC,CAAC;QACxD,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;OAChC;WAAM;QACL,IAAI,CAAC,iBAAiB,EAAE,CAAC;OAC1B;IACH,CAAC,EAAE,IAAI,CAAC,sBAAsB,GAAG,GAAG,CAAC,CAAA;EACvC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, Prop, State, Element } from '@stencil/core';\n\n@Component({\n tag: 'salla-installment',\n styleUrl: 'salla-installment.scss',\n})\n\nexport class SallaInstallment {\n private tabbyBorderRemoved: boolean = false;\n private tabbyRemoveBorderTries: number = 0;\n @Element() host: HTMLElement;\n constructor() {\n salla.lang.onLoaded(() => {\n this.installment_sheria_text({ payment: salla.money(parseFloat(this.price)), amount: salla.money(parseFloat(this.price) / 3), installments: 3 })\n const installment = salla.config.get('store.settings.installments');\n if (installment) {\n this.tamaraIsActive = installment.includes('tamara_installment');\n this.tabbyIsActive = installment.includes('tabby_installment');\n this.spotiiIsActive = installment.includes('spotii_pay');\n this.mispayActive = installment.includes('mispay_installment');\n }\n this.renderInstallments();\n });\n\n salla.event.on('product::price.updated', ({ data }) => {\n if (!data.price || data.price == this.price) {\n return;\n }\n this.price = data.price;\n this.renderInstallments(true);\n });\n }\n\n /**\n * Current product price\n */\n @Prop() price: string;\n /**\n * Language code\n */\n @Prop() language: string = salla.config.get('user.language_code');\n /**\n * Currency code\n */\n @Prop() currency: string = salla.config.get('user.currency_code');\n\n @State() tamaraIsActive: boolean;\n @State() tabbyIsActive: boolean;\n @State() spotiiIsActive: boolean;\n @State() mispayActive: boolean;\n\n @State() installment_sheria_text: (replacement: object) => string = (replacement) => salla.lang.get(\"pages.products.installments\", replacement)\n\n render() {\n return (\n <Host>\n {this.tamaraIsActive ?\n <div class=\"tamara-product-widget\"\n data-price={this.price}\n data-currency={this.currency}\n data-lang={this.language}\n data-payment-type=\"installment\">\n </div>\n : ''}\n\n {this.tabbyIsActive ?\n <div id=\"tabbyPromoWrapper\">\n <div id=\"tabbyPromo\"></div>\n </div>\n : ''}\n\n {this.spotiiIsActive ?\n <div class=\"spotii-wrapper\">\n {/*No need for the price, the price already in the page, and also tammara & tabby doesn't have price */}\n <div class=\"spotii-promo\"></div>\n </div>\n : ''}\n {this.mispayActive ?\n <div class=\"s-installment-mispay-wrapper\">\n <div class=\"s-installment-mispay-content\">\n <img src={salla.url.cdn('images/payment/png/mispay.png')} alt=\"mispay\" />\n <span class=\"s-installment-mispay-content-text\">{this.installment_sheria_text({ payment: salla.money(parseFloat(this.price)), amount: salla.money(parseFloat(this.price) / 3), installments: 3 })}</span>\n </div>\n </div>\n : ''}\n </Host>\n );\n }\n\n renderInstallments(isUpdating: boolean = false) {\n // Tamara\n if (this.tamaraIsActive) {\n if (isUpdating) {\n var oldTamaraScript = document.querySelector('script[src=\"https://cdn.tamara.co/widget/product-widget.min.js\"]');\n if (oldTamaraScript) {\n oldTamaraScript.remove();\n }\n }\n\n var tamaraScript = document.createElement('script');\n tamaraScript.setAttribute('src', 'https://cdn.tamara.co/widget/product-widget.min.js');\n document.head.appendChild(tamaraScript);\n tamaraScript.onload = () => {\n window.TamaraProductWidget.init({ lang: this.language });\n setTimeout(() => {\n window.TamaraProductWidget.render();\n }, 300);\n };\n }\n\n // tabby\n if (this.tabbyIsActive) {\n if (isUpdating) {\n\n // remove #tabbyPromoWrapper and re append it\n var oldTabbyWrapper = this.host.querySelector('#tabbyPromoWrapper');\n if (oldTabbyWrapper) {\n oldTabbyWrapper.remove();\n }\n\n var tabbyPromoWrapper = document.createElement('div');\n tabbyPromoWrapper.setAttribute('id', 'tabbyPromoWrapper');\n var tabbyPromo = document.createElement('div');\n tabbyPromo.setAttribute('id', 'tabbyPromo');\n tabbyPromoWrapper.appendChild(tabbyPromo);\n this.host.appendChild(tabbyPromoWrapper);\n\n var oldTabbyScript = document.querySelector('script[src=\"https://checkout.tabby.ai/tabby-promo.js\"]');\n if (oldTabbyScript) {\n oldTabbyScript.remove();\n }\n }\n\n var tabbyScript = document.createElement('script');\n tabbyScript.setAttribute('src', 'https://checkout.tabby.ai/tabby-promo.js');\n document.head.appendChild(tabbyScript);\n tabbyScript.onload = () => {\n const TabbyPromo = window.TabbyPromo;\n new TabbyPromo({\n selector: '#tabbyPromo',\n currency: this.currency,\n price: this.price,\n lang: this.language,\n });\n document.querySelectorAll('.tabby-promo-snippet__logo').forEach(function (element) {\n element.setAttribute('aria-label', 'Tabby Logo');\n });\n }\n // this is a workaround to remove the default border and add margin\n this.removeTabbyBorder();\n }\n\n // Spotii\n if (this.spotiiIsActive) {\n if (isUpdating) {\n\n var oldSpotiiWrapper = this.host.querySelector('.spotii-wrapper');\n if (oldSpotiiWrapper) {\n oldSpotiiWrapper.remove();\n }\n\n var spotiiPromoWrapper = document.createElement('div');\n spotiiPromoWrapper.classList.add('spotii-wrapper');\n var spotiiPromo = document.createElement('div');\n spotiiPromo.classList.add('spotii-promo');\n spotiiPromoWrapper.appendChild(spotiiPromo);\n this.host.appendChild(spotiiPromoWrapper);\n var oldSpotiiScript = document.querySelector('script[src=\"' + salla.url.cdn('js/price-widget-ar-salla.js') + '\"]');\n if (oldSpotiiScript) {\n oldSpotiiScript.remove();\n }\n }\n\n let amount = salla.money((Number(this.price) / 3).toFixed(2));\n let isRTL = salla.config.get('theme.is_rtl', true);\n window.spotiiConfig = {\n targetXPath: ['.spotii-wrapper'],\n renderToPath: ['.spotii-promo'],\n numberOfPayment: 3,\n currency: this.currency,\n templateLine: \"${textOne} ${number} ${textTwo} \" + amount + \"${logo} ${info}\",\n //todo:: translate these\n textOne: isRTL ? \"جزء الدفع على\" : \"Split it into\",\n textTwo: isRTL ? \"أقساط متساوية بدون تكاليف اضافية بقيمة\" : \"payments of\",\n textThree: \"مع\",\n price: this.price,\n // forcedShow: false,\n // merchantID: null,\n };\n\n var spotiiScript = document.createElement('script');\n spotiiScript.setAttribute('src', salla.url.cdn('js/price-widget-ar-salla.js'));\n document.head.appendChild(spotiiScript);\n // spotiiScript.onload = () => {\n // // setTimeout()\n // }\n }\n }\n\n\n /**\n * this is workaround to remove the default border and add margin\n * we will try to remove tabby border 5 times for 7.5 seconds\n */\n removeTabbyBorder() {\n if (this.tabbyBorderRemoved || this.tabbyRemoveBorderTries > 5) {\n return;\n }\n this.tabbyRemoveBorderTries++;\n setTimeout(() => {\n let promo: any = document.querySelector('#tabbyPromo>div>div');\n promo = promo ? promo.shadowRoot.querySelector('div[class^=\"styles__tabby-promo-snippet--\"]') : null;\n if (promo) {\n promo.style = 'border: none; margin: 15px 0!important;';\n this.tabbyBorderRemoved = true;\n } else {\n this.removeTabbyBorder();\n }\n }, this.tabbyRemoveBorderTries * 500)\n }\n}\n"]}
|
|
1
|
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CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, Prop, State, Element } from '@stencil/core';\n\n@Component({\n tag: 'salla-installment',\n styleUrl: 'salla-installment.scss',\n})\n\nexport class SallaInstallment {\n private tabbyBorderRemoved: boolean = false;\n private tabbyRemoveBorderTries: number = 0;\n @Element() host: HTMLElement;\n constructor() {\n salla.lang.onLoaded(() => {\n this.installment_sheria_text({ payment: salla.money(parseFloat(this.price)), amount: salla.money((parseFloat(this.price) / 3).toFixed(2)), installments: 3 })\n const installment = salla.config.get('store.settings.installments');\n if (installment) {\n this.tamaraIsActive = installment.includes('tamara_installment');\n this.tabbyIsActive = installment.includes('tabby_installment');\n this.spotiiIsActive = installment.includes('spotii_pay');\n this.mispayActive = installment.includes('mispay_installment');\n }\n this.renderInstallments();\n });\n\n salla.event.on('product::price.updated', ({ data }) => {\n if (!data.price || data.price == this.price) {\n return;\n }\n this.price = data.price;\n this.renderInstallments(true);\n });\n }\n\n /**\n * Current product price\n */\n @Prop() price: string;\n /**\n * Language code\n */\n @Prop() language: string = salla.config.get('user.language_code');\n /**\n * Currency code\n */\n @Prop() currency: string = salla.config.get('user.currency_code');\n\n @State() tamaraIsActive: boolean;\n @State() tabbyIsActive: boolean;\n @State() spotiiIsActive: boolean;\n @State() mispayActive: boolean;\n\n @State() installment_sheria_text: (replacement: object) => string = (replacement) => salla.lang.get(\"pages.products.installments\", replacement)\n\n render() {\n return (\n <Host>\n {this.tamaraIsActive ?\n <div class=\"tamara-product-widget\"\n data-price={this.price}\n data-currency={this.currency}\n data-lang={this.language}\n data-payment-type=\"installment\">\n </div>\n : ''}\n\n {this.tabbyIsActive ?\n <div id=\"tabbyPromoWrapper\">\n <div id=\"tabbyPromo\"></div>\n </div>\n : ''}\n\n {this.spotiiIsActive ?\n <div class=\"spotii-wrapper\">\n {/*No need for the price, the price already in the page, and also tammara & tabby doesn't have price */}\n <div class=\"spotii-promo\"></div>\n </div>\n : ''}\n {this.mispayActive ?\n <div class=\"s-installment-mispay-wrapper\">\n <div class=\"s-installment-mispay-content\">\n <img src={salla.url.cdn('images/payment/png/mispay.png')} alt=\"mispay\" />\n <span class=\"s-installment-mispay-content-text\">{this.installment_sheria_text({ payment: salla.money(parseFloat(this.price)), amount: salla.money((parseFloat(this.price) / 3).toFixed(2)), installments: 3 })}</span>\n </div>\n </div>\n : ''}\n </Host>\n );\n }\n\n renderInstallments(isUpdating: boolean = false) {\n // Tamara\n if (this.tamaraIsActive) {\n if (isUpdating) {\n var oldTamaraScript = document.querySelector('script[src=\"https://cdn.tamara.co/widget/product-widget.min.js\"]');\n if (oldTamaraScript) {\n oldTamaraScript.remove();\n }\n }\n\n var tamaraScript = document.createElement('script');\n tamaraScript.setAttribute('src', 'https://cdn.tamara.co/widget/product-widget.min.js');\n document.head.appendChild(tamaraScript);\n tamaraScript.onload = () => {\n window.TamaraProductWidget.init({ lang: this.language });\n setTimeout(() => {\n window.TamaraProductWidget.render();\n }, 300);\n };\n }\n\n // tabby\n if (this.tabbyIsActive) {\n if (isUpdating) {\n\n // remove #tabbyPromoWrapper and re append it\n var oldTabbyWrapper = this.host.querySelector('#tabbyPromoWrapper');\n if (oldTabbyWrapper) {\n oldTabbyWrapper.remove();\n }\n\n var tabbyPromoWrapper = document.createElement('div');\n tabbyPromoWrapper.setAttribute('id', 'tabbyPromoWrapper');\n var tabbyPromo = document.createElement('div');\n tabbyPromo.setAttribute('id', 'tabbyPromo');\n tabbyPromoWrapper.appendChild(tabbyPromo);\n this.host.appendChild(tabbyPromoWrapper);\n\n var oldTabbyScript = document.querySelector('script[src=\"https://checkout.tabby.ai/tabby-promo.js\"]');\n if (oldTabbyScript) {\n oldTabbyScript.remove();\n }\n }\n\n var tabbyScript = document.createElement('script');\n tabbyScript.setAttribute('src', 'https://checkout.tabby.ai/tabby-promo.js');\n document.head.appendChild(tabbyScript);\n tabbyScript.onload = () => {\n const TabbyPromo = window.TabbyPromo;\n new TabbyPromo({\n selector: '#tabbyPromo',\n currency: this.currency,\n price: this.price,\n lang: this.language,\n });\n document.querySelectorAll('.tabby-promo-snippet__logo').forEach(function (element) {\n element.setAttribute('aria-label', 'Tabby Logo');\n });\n }\n // this is a workaround to remove the default border and add margin\n this.removeTabbyBorder();\n }\n\n // Spotii\n if (this.spotiiIsActive) {\n if (isUpdating) {\n\n var oldSpotiiWrapper = this.host.querySelector('.spotii-wrapper');\n if (oldSpotiiWrapper) {\n oldSpotiiWrapper.remove();\n }\n\n var spotiiPromoWrapper = document.createElement('div');\n spotiiPromoWrapper.classList.add('spotii-wrapper');\n var spotiiPromo = document.createElement('div');\n spotiiPromo.classList.add('spotii-promo');\n spotiiPromoWrapper.appendChild(spotiiPromo);\n this.host.appendChild(spotiiPromoWrapper);\n var oldSpotiiScript = document.querySelector('script[src=\"' + salla.url.cdn('js/price-widget-ar-salla.js') + '\"]');\n if (oldSpotiiScript) {\n oldSpotiiScript.remove();\n }\n }\n\n let amount = salla.money((Number(this.price) / 3).toFixed(2));\n let isRTL = salla.config.get('theme.is_rtl', true);\n window.spotiiConfig = {\n targetXPath: ['.spotii-wrapper'],\n renderToPath: ['.spotii-promo'],\n numberOfPayment: 3,\n currency: this.currency,\n templateLine: \"${textOne} ${number} ${textTwo} \" + amount + \"${logo} ${info}\",\n //todo:: translate these\n textOne: isRTL ? \"جزء الدفع على\" : \"Split it into\",\n textTwo: isRTL ? \"أقساط متساوية بدون تكاليف اضافية بقيمة\" : \"payments of\",\n textThree: \"مع\",\n price: this.price,\n // forcedShow: false,\n // merchantID: null,\n };\n\n var spotiiScript = document.createElement('script');\n spotiiScript.setAttribute('src', salla.url.cdn('js/price-widget-ar-salla.js'));\n document.head.appendChild(spotiiScript);\n // spotiiScript.onload = () => {\n // // setTimeout()\n // }\n }\n }\n\n\n /**\n * this is workaround to remove the default border and add margin\n * we will try to remove tabby border 5 times for 7.5 seconds\n */\n removeTabbyBorder() {\n if (this.tabbyBorderRemoved || this.tabbyRemoveBorderTries > 5) {\n return;\n }\n this.tabbyRemoveBorderTries++;\n setTimeout(() => {\n let promo: any = document.querySelector('#tabbyPromo>div>div');\n promo = promo ? promo.shadowRoot.querySelector('div[class^=\"styles__tabby-promo-snippet--\"]') : null;\n if (promo) {\n promo.style = 'border: none; margin: 15px 0!important;';\n this.tabbyBorderRemoved = true;\n } else {\n this.removeTabbyBorder();\n }\n }, this.tabbyRemoveBorderTries * 500)\n }\n}\n"]}
|
|
@@ -87,6 +87,7 @@ export class SallaLoginModal {
|
|
|
87
87
|
this.currentTabName = 'home';
|
|
88
88
|
this.regType = 'phone';
|
|
89
89
|
this.translationLoaded = false;
|
|
90
|
+
this.isModalOpen = false;
|
|
90
91
|
this.currentPhone = '';
|
|
91
92
|
this.currentEmail = '';
|
|
92
93
|
this.title = undefined;
|
|
@@ -118,6 +119,7 @@ export class SallaLoginModal {
|
|
|
118
119
|
return;
|
|
119
120
|
}
|
|
120
121
|
this.withoutReload = (_a = data === null || data === void 0 ? void 0 : data.withoutReload) !== null && _a !== void 0 ? _a : this.withoutReload;
|
|
122
|
+
this.isModalOpen = true;
|
|
121
123
|
this.open(data);
|
|
122
124
|
});
|
|
123
125
|
salla.onReady(() => {
|
|
@@ -147,6 +149,7 @@ export class SallaLoginModal {
|
|
|
147
149
|
if (this.inline) {
|
|
148
150
|
return;
|
|
149
151
|
}
|
|
152
|
+
this.isModalOpen = false;
|
|
150
153
|
this.modal.close();
|
|
151
154
|
return;
|
|
152
155
|
}
|
|
@@ -165,6 +168,7 @@ export class SallaLoginModal {
|
|
|
165
168
|
if (this.inline) {
|
|
166
169
|
return;
|
|
167
170
|
}
|
|
171
|
+
this.isModalOpen = false;
|
|
168
172
|
this.modal.close();
|
|
169
173
|
}
|
|
170
174
|
}
|
|
@@ -208,6 +212,7 @@ export class SallaLoginModal {
|
|
|
208
212
|
return;
|
|
209
213
|
}
|
|
210
214
|
this.getSelectedTab();
|
|
215
|
+
this.isModalOpen = true;
|
|
211
216
|
return this.modal.open();
|
|
212
217
|
}
|
|
213
218
|
getSelectedTab() {
|
|
@@ -229,14 +234,14 @@ export class SallaLoginModal {
|
|
|
229
234
|
if ([this.mobileTab, this.emailTab].includes(tab)) {
|
|
230
235
|
this.regType = tab === this.mobileTab ? 'phone' : 'email';
|
|
231
236
|
}
|
|
232
|
-
const input = tab.querySelector('input[type="tel"], input[type="email"]');
|
|
233
|
-
input && setTimeout(() => {
|
|
234
|
-
input.focus();
|
|
235
|
-
}, 100);
|
|
236
237
|
if (this.inline) {
|
|
237
238
|
return this;
|
|
238
239
|
}
|
|
239
240
|
(_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(this.currentTabName === 'registration' ? salla.lang.get('common.titles.registration') : this.title);
|
|
241
|
+
const input = tab.querySelector('input[type="tel"], input[type="email"]');
|
|
242
|
+
input && this.currentTabName !== 'registration' && setTimeout(() => {
|
|
243
|
+
input.focus();
|
|
244
|
+
}, 100);
|
|
240
245
|
return this;
|
|
241
246
|
}
|
|
242
247
|
login(btn, data) {
|
|
@@ -301,11 +306,11 @@ export class SallaLoginModal {
|
|
|
301
306
|
}
|
|
302
307
|
getLoginDom() {
|
|
303
308
|
return [!this.inline && h("span", { slot: 'icon', class: "s-login-modal-header-icon", innerHTML: UserIcon }), h("div", { class: this.inline ? 's-login-inline' : 's-login-modal-wrapper' }, this.isMobileAllowed ?
|
|
304
|
-
h("div", { class: this.generateTabClasses('login-phone'), "data-name": "login-phone", ref: tab => this.mobileTab = tab }, h("slot", { name: "before-login-mobile" }), h("form", { onSubmit: (event) => this.loginBySMS(event), class: this.hasError && this.errorMessage ? 'has-error' : '', method: "POST" }, h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.mobile')), h("salla-tel-input", { tabindex: "0", ref: el => this.loginTelInput = el, onKeyDown: e => this.typing(e) }), this.hasError && this.errorMessage ? h("span", { class: "s-login-modal-error-message" }, this.errorMessage) : '', h("salla-button", { class: "s-login-modal-enter-button", type: "submit", "loader-position": 'center', width: "wide", ref: b => this.smsBtn = b }, salla.lang.get('blocks.header.enter'))), this.isEmailAllowed ?
|
|
309
|
+
h("div", { class: this.generateTabClasses('login-phone'), "data-name": "login-phone", ref: tab => this.mobileTab = tab }, h("slot", { name: "before-login-mobile" }), h("form", { onSubmit: (event) => this.loginBySMS(event), class: this.hasError && this.errorMessage ? 'has-error' : '', method: "POST" }, h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.mobile')), this.isModalOpen || this.inline ? (h("salla-tel-input", { autofocus: true, tabindex: "0", ref: el => this.loginTelInput = el, onKeyDown: e => this.typing(e) })) : null, this.hasError && this.errorMessage ? h("span", { class: "s-login-modal-error-message" }, this.errorMessage) : '', h("salla-button", { class: "s-login-modal-enter-button", type: "submit", "loader-position": 'center', width: "wide", ref: b => this.smsBtn = b }, salla.lang.get('blocks.header.enter'))), this.isEmailAllowed ?
|
|
305
310
|
h("a", { href: "#", onClick: () => this.showTab(this.emailTab), class: "s-login-modal-link" }, salla.lang.get('blocks.header.login_by_email')) : '', h("slot", { name: "after-login-mobile" })) : '', this.isEmailAllowed ?
|
|
306
311
|
h("div", { class: this.generateTabClasses('login-email'), "data-name": "login-email", ref: tab => this.emailTab = tab }, h("slot", { name: "before-login-email" }), h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.email')), h("form", { onSubmit: () => this.loginByEmail(event), method: "POST" }, h("input", { type: "email", ref: el => this.loginEmail = el, onKeyDown: e => this.typing(e), placeholder: "your@email.com", enterkeyhint: "next", class: { "s-login-modal-input s-ltr": true, "s-has-error": this.hasError } }), this.hasError && this.errorMessage ? h("span", { class: "s-login-modal-error-message" }, this.errorMessage) : '', h("salla-button", { class: "s-login-modal-enter-button", "loader-position": 'center', width: "wide", onClick: () => this.loginByEmail(), ref: b => this.emailBtn = b }, salla.lang.get('blocks.header.enter'))), this.isMobileAllowed ?
|
|
307
312
|
h("a", { href: "#", onClick: () => this.showTab(this.mobileTab), class: "s-login-modal-link" }, salla.lang.get('blocks.header.login_by_sms'))
|
|
308
|
-
: '', h("slot", { name: "after-login-email" })) : '', h("salla-verify", { display: "inline", "support-web-auth": this.supportWebAuth ? 'true' : 'false', class: this.generateTabClasses('otp'), "data-name": "otp", ref: tab => this.verifyTab = tab, autoReload: false }, h("a", { onClick: () => this.showTab(this.regType == 'phone' ? this.mobileTab : this.emailTab), class: "s-verify-back", innerHTML: ArrowRightIcon, slot: "after-footer", href: "#" }), this.isMobileAllowed && this.regType == 'phone' ? h("div", { dir: "ltr", class: "s-login-modal-currentPhone", slot: "mobile" }, this.currentPhone) : '', this.isEmailAllowed && this.regType == 'email' ? h("div", { dir: "ltr", class: "s-login-modal-currentEmail", slot: "email" }, this.currentEmail) : ''), h("div", { "data-name": "registration", class: this.generateTabClasses('registration'), ref: tab => this.registrationTab = tab }, h("slot", { name: "before-registration" }), h("div", null, h("label", { class: "s-login-modal-label" }, salla.lang.get('blocks.header.your_name')), h("input", { type: "text", class: "s-login-modal-input", ref: el => this.firstName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.first_name') }), h("span", { class: "s-login-modal-error-message" })), h("div", null, h("label", { class: "s-login-modal-label" }, salla.lang.get('pages.profile.last_name')), h("input", { type: "text", class: "s-login-modal-input", ref: el => this.lastName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.last_name') }), h("span", { class: "s-login-modal-error-message" })), h("div", { class: this.generateRegClasses('phone') }, h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.mobile')), h("salla-tel-input", { ref: el => this.regTelInput = el, onKeyDown: e => this.typing(e, this.newUser) })), h("div", { class: this.generateRegClasses('email') }, h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.email')), h("input", { type: "email", ref: el => this.regEmail = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: "your@email.com", class: "s-login-modal-input s-ltr" }), h("span", { class: "s-login-modal-error-message" })), h("div", { class: "s-login-modal-custom-fields", ref: el => this.customFieldsWrapper = el }, this.customFields.map((field) => [
|
|
313
|
+
: '', h("slot", { name: "after-login-email" })) : '', h("salla-verify", { display: "inline", "support-web-auth": this.supportWebAuth ? 'true' : 'false', class: this.generateTabClasses('otp'), "data-name": "otp", ref: tab => this.verifyTab = tab, autoReload: false }, h("a", { onClick: () => this.showTab(this.regType == 'phone' ? this.mobileTab : this.emailTab), class: "s-verify-back", innerHTML: ArrowRightIcon, slot: "after-footer", href: "#" }), this.isMobileAllowed && this.regType == 'phone' ? h("div", { dir: "ltr", class: "s-login-modal-currentPhone", slot: "mobile" }, this.currentPhone) : '', this.isEmailAllowed && this.regType == 'email' ? h("div", { dir: "ltr", class: "s-login-modal-currentEmail", slot: "email" }, this.currentEmail) : ''), h("div", { "data-name": "registration", class: this.generateTabClasses('registration'), ref: tab => this.registrationTab = tab }, h("slot", { name: "before-registration" }), h("div", null, h("label", { class: "s-login-modal-label" }, salla.lang.get('blocks.header.your_name')), h("input", { type: "text", class: "s-login-modal-input", ref: el => this.firstName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.first_name') }), h("span", { class: "s-login-modal-error-message" })), h("div", null, h("label", { class: "s-login-modal-label" }, salla.lang.get('pages.profile.last_name')), h("input", { type: "text", class: "s-login-modal-input", ref: el => this.lastName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.last_name') }), h("span", { class: "s-login-modal-error-message" })), h("div", { class: this.generateRegClasses('phone') }, h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.mobile')), (this.isModalOpen || this.inline) && this.currentTabName === "registration" ? (h("salla-tel-input", { ref: el => this.regTelInput = el, onKeyDown: e => this.typing(e, this.newUser) })) : null), h("div", { class: this.generateRegClasses('email') }, h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.email')), h("input", { type: "email", ref: el => this.regEmail = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: "your@email.com", class: "s-login-modal-input s-ltr" }), h("span", { class: "s-login-modal-error-message" })), h("div", { class: "s-login-modal-custom-fields", ref: el => this.customFieldsWrapper = el }, this.customFields.map((field) => [
|
|
309
314
|
h("label", { class: "s-login-modal-label" }, field.label),
|
|
310
315
|
field.type === CustomFieldType.PHOTO
|
|
311
316
|
? h("salla-file-upload", { name: "image", "instant-upload": true, id: `${field.id}`, title: field.label, required: field.required, url: salla.url.get('upload-image'),
|
|
@@ -449,6 +454,7 @@ export class SallaLoginModal {
|
|
|
449
454
|
"currentTabName": {},
|
|
450
455
|
"regType": {},
|
|
451
456
|
"translationLoaded": {},
|
|
457
|
+
"isModalOpen": {},
|
|
452
458
|
"currentPhone": {},
|
|
453
459
|
"currentEmail": {},
|
|
454
460
|
"title": {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"salla-login-modal.js","sourceRoot":"","sources":["../../../src/components/salla-login-modal/salla-login-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AACjD,qDAAqD;AACrD,oDAAoD;AACpD,OAAO,UAAU,MAAM,6BAA6B,CAAC;AACrD,iFAAiF;AACjF,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,EAAe,eAAe,EAAE,MAAM,aAAa,CAAC;AAE3D;;;;;;;;;;GAUG;AAOH,MAAM,OAAO,eAAe;EAC1B;IAiGQ,uBAAkB,GAAW,EAAE,CAAC;IA6HhC,WAAM,GAAG,CAAC,CAAC,EAAE,YAAY,GAAG,IAAI,EAAE,EAAE;MAC1C,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC;MAC1C,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,aA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,CAAC,CAAgB;UACtF,YAAM,IAAI,EAAC,oBAAoB,GAAG,CAC9B,CACF,CAAC,CAAA;EACT,CAAC;EACD,MAAM;IACJ,aAAa;IACb,aAAa;IACb,IAAI,IAAI,CAAC,MAAM,EAAE;MACf,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;KAC3B;IACD,OAAO,CACL,mBAAa,KAAK,EAAC,eAAe,iBAAc,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,EAAE,KAAK,EAAC,IAAI,IACrG,IAAI,CAAC,WAAW,EAAE,CACP,CACf,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Listen, Method, Prop, State } from '@stencil/core';\nimport UserIcon from \"../../assets/svg/user.svg\";\n//import PhoneIcon from \"../../assets/svg/phone.svg\";\n//import EmailIcon from \"../../assets/svg/mail.svg\";\nimport CameraIcon from '../../assets/svg/camera.svg';\n//import KeyboardArrowRightIcon from \"../../assets/svg/keyboard_arrow_right.svg\";\nimport ArrowRightIcon from \"../../assets/svg/arrow-right.svg\";\nimport Helper from '../../Helpers/Helper';\nimport { CustomField, CustomFieldType } from './intefaces';\n\n/**\n * @slot footer - The footer of modal\n * @slot before-login-type - placeholder position\n * @slot after-login-type - placeholder position\n * @slot before-login-mobile - placeholder position\n * @slot after-login-mobile - placeholder position\n * @slot before-login-email - placeholder position\n * @slot after-login-email - placeholder position\n * @slot before-registration - placeholder position\n * @slot after-registration - placeholder position\n */\n@Component({\n tag: 'salla-login-modal',\n styleUrl: 'salla-login-modal.scss'\n})\n\n\nexport class SallaLoginModal {\n constructor() {\n\n this.title = this.host.title || salla.lang.get('blocks.header.login');\n this.host.removeAttribute('title');\n\n this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');\n this.firstNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: salla.lang.get('pages.profile.first_name') });\n this.lastNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: salla.lang.get('pages.profile.last_name') });\n\n salla.lang.onLoaded(() => {\n this.translationLoaded = true;\n this.title = salla.lang.get('blocks.header.login');\n this.dragAndDrop = salla.lang.get('common.uploader.drag_and_drop');\n this.browseFromFiles = salla.lang.get('common.uploader.browse');\n this.updateTranslations();\n });\n\n salla.event.on('login::open', (data) => {\n if(!this.isEmailAllowed && !this.isMobileAllowed){\n salla.logger.warn('Please enable atleast one login type to use this component.');\n return;\n }\n this.withoutReload = data?.withoutReload ?? this.withoutReload;\n this.open(data)\n });\n salla.onReady( () => {\n this.isEmailAllowed = salla.config.get('store.settings.auth.email_allowed', this.isEmailAllowed);\n this.isMobileAllowed = salla.config.get('store.settings.auth.mobile_allowed', this.isMobileAllowed);\n this.isEmailRequired = salla.config.get('store.settings.auth.is_email_required', this.isEmailRequired);\n });\n }\n\n @Element() host: HTMLElement;\n /**\n * Does the merchant allow to login using email\n */\n @Prop({ mutable: true }) isEmailAllowed: boolean;\n /**\n * Does the merchant/current location for visitor allow to login using mobile, By default outside KSA is `false`\n */\n @Prop({ mutable: true }) isMobileAllowed: boolean = true;\n /**\n * Does the merchant require registration with email & mobile\n */\n @Prop({ mutable: true }) isEmailRequired: boolean = false;\n\n /**\n * Once the api verify success, it will be login the customer in web pages\n */\n @Prop({ reflect: true }) supportWebAuth: boolean = true;\n\n /**\n * Display the login inline\n */\n @Prop({ reflect: true }) inline: boolean;\n\n\n /**\n * Reload after a successful login\n */\n @Prop() withoutReload: boolean = false;\n\n private modal: HTMLSallaModalElement;\n //private homeTab: HTMLDivElement;\n private mobileTab: HTMLDivElement;\n private emailTab: HTMLDivElement;\n private verifyTab: HTMLSallaVerifyElement;\n private registrationTab: HTMLDivElement;\n private regTelInput: HTMLSallaTelInputElement;\n private regEmail: HTMLInputElement;\n private customFieldsWrapper: HTMLDivElement;\n private loginTelInput: HTMLSallaTelInputElement;\n private loginEmail: HTMLInputElement;\n private firstName: HTMLInputElement;\n private lastName: HTMLInputElement;\n private smsBtn: HTMLSallaButtonElement;\n private emailBtn: HTMLSallaButtonElement;\n private regBtn: HTMLSallaButtonElement;\n\n @State() currentTabName = 'home'\n @State() regType: 'phone' | 'email' = 'phone';\n\n\n @State() translationLoaded: boolean = false;\n @State() currentPhone: string = '';\n @State() currentEmail: string = '';\n @State() title: string;\n @State() emailErrorMsg: string;\n @State() firstNameErrorMsg: string;\n @State() lastNameErrorMsg: string;\n @State() hasError: boolean;\n @State() errorMessage: string;\n\n @State() dragAndDrop: string = salla.lang.get('common.uploader.drag_and_drop');\n @State() browseFromFiles: string = salla.lang.get('common.uploader.browse');\n @State() customFields: CustomField[] = [];\n\n private customFieldsValues: Object = {};\n @State() uploadedImage: string = undefined;\n\n @Listen('verified', { target: 'window' })\n /**\n * @param {CustomEvent|{details:{case:'new_customer'|'authenticated', redirect_url:string|null}}} event\n */\n onVerified(event) {\n salla.log('verified', event);\n //there is a case when force login is activated & is new user, it will return case inside error key., so cover it.\n let verifyCase = event.detail?.data.case || event.detail?.error.case;\n if (!verifyCase) {\n salla.log('verified but without case!');\n return;\n }\n\n if (verifyCase === \"new_customer\") {\n this.customFields = event.detail?.data?.custom_fields || [];\n return this.showTab(this.registrationTab);\n }\n\n if (!salla.auth.canRedirect()) {\n salla.log('Will not auto redirect or reload, due to `salla.auth.canRedirect()`');\n if (this.inline) {\n return;\n }\n this.modal.close();\n return;\n }\n\n if (event.detail.data.redirect_url) {\n return window.location.href = event.detail.data.redirect_url;\n }\n\n /**\n * we don't want to reload the page if this is not web auth\n * because we'll need the token in the page itself and its there\n * todo :: store the user data in storage for non-web auth and set the config.user from it\n */\n if (this.supportWebAuth && !this.withoutReload) {\n window.location.reload();\n } else {\n if (this.inline) {\n return;\n }\n this.modal.close();\n }\n }\n\n updateTranslations() {\n this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');\n this.firstNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: salla.lang.get('pages.profile.first_name') });\n this.lastNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: salla.lang.get('pages.profile.last_name') });\n if (this.inline) {\n return;\n }\n this.modal?.setTitle(this.title);\n }\n componentDidLoad() {\n if (this.inline) {\n this.getSelectedTab()\n }\n }\n /**\n * Open login component\n */\n @Method()\n // @ts-ignore\n async open(event = null) {\n // todo :: support change the settings from event details\n // if(event && event.hasOwnProperty('isEmailAllowed')){\n // this.isEmailAllowed = event?.isEmailAllowed;\n // }\n //\n // if(event && event.hasOwnProperty('isMobileAllowed')){\n // this.isMobileAllowed = event?.isMobileAllowed;\n // }\n\n /**\n * This is a workaround until we remove all the user objet from twig files\n * When the user is already login, let's reload the page\n */\n if (!salla.config.isGuest()) {\n if (!this.withoutReload) {\n return location.reload();\n }\n // Fire an event if withoutReload is true\n return;\n }\n\n this.getSelectedTab();\n return this.modal.open();\n }\n private getSelectedTab() {\n if (this.isMobileAllowed) {\n this.showTab(this.mobileTab);\n } else if (this.isEmailAllowed) {\n this.showTab(this.emailTab);\n }\n }\n private showTab(tab, evt?) {\n evt?.preventDefault();\n this.hasError = false;\n this.errorMessage = '';\n this.currentTabName = tab.getAttribute('data-name');\n\n // todo:: use better way for resize the modal\n // setTimeout(() => this.modal.querySelector('.s-login-modal-wrapper')?.setAttribute('style', 'height:' + tab?.scrollHeight + 'px'));\n\n if ([this.mobileTab, this.emailTab].includes(tab)) {\n this.regType = tab === this.mobileTab ? 'phone' : 'email';\n }\n\n const input = tab.querySelector('input[type=\"tel\"], input[type=\"email\"]');\n input && setTimeout(() => {\n input.focus();\n }, 100);\n if (this.inline) {\n return this;\n }\n this.modal?.setTitle(this.currentTabName === 'registration' ? salla.lang.get('common.titles.registration') : this.title);\n\n return this;\n }\n\n private typing = (e, submitMethod = null) => {\n const error = e.target.nextElementSibling;\n e.target.classList.remove('s-has-error');\n error?.classList.contains('s-login-modal-error-message') && (error.innerText = '');\n this.hasError = false;\n this.errorMessage = '';\n //it was sending two requests for send two verification requests\n submitMethod && e.key == 'Enter' && submitMethod();\n }\n\n private loginBySMS = async (event = null) => {\n event?.preventDefault();\n const { phone, countryCode, countryKey } = await this.loginTelInput.getValues();\n const isPhoneValid = await this.loginTelInput.isValid();\n if (!isPhoneValid) {\n return;\n }\n this.currentPhone = `${countryKey} ${phone}`;\n this.login(this.smsBtn, { type: 'mobile', phone: phone, country_code: countryCode });\n\n return false;\n }\n\n private loginByEmail = (event = null) => {\n event?.preventDefault();\n if (!Helper.isValidEmail(this.loginEmail.value)) {\n // this.validateField(this.loginEmail, this.emailErrorMsg);\n this.hasError = true;\n this.errorMessage = '* ' + this.emailErrorMsg;\n return;\n }\n this.currentEmail = this.loginEmail.value;\n this.login(this.emailBtn, { type: 'email', email: this.loginEmail.value });\n }\n\n private login(btn: HTMLSallaButtonElement, data) {\n this.hasError = false;\n this.errorMessage = '';\n btn.load()\n .then(() => btn.disable())\n .then(() => salla.auth.api.login(data))\n .then(() => this.showTab(this.verifyTab))\n .then(() => this.verifyTab.open(data))\n .catch((error) => {\n this.hasError = true;\n this.errorMessage = error.response.data?.error?.message;\n })\n .finally(() => btn.stop() && btn.enable());\n }\n\n private newUser = async () => {\n const {\n phone: regPhone,\n countryCode\n } = this.regType == \"email\" ? await this.regTelInput.getValues() : await this.loginTelInput.getValues(),\n emailValue = this.regEmail.value || this.loginEmail?.value\n await this.newUserValidation();\n await this.regBtn.load();\n await this.regBtn.disable();\n\n let data: any = {\n first_name: this.firstName.value,\n last_name: this.lastName.value,\n phone: regPhone || this.loginTelInput.phone,\n country_code: countryCode,\n verified_by: this.regType,\n custom_fields: this.customFieldsValues,\n };\n emailValue && (data = { ...data, email: emailValue });\n this.verifyTab.getCode()\n .then(code => salla.auth.api.register({...data, code}))\n .then(() => salla.auth.canRedirect && !this.withoutReload && window.location.reload())\n .catch((error) => {\n salla.logger.error(error);\n this.regBtn.stop() && this.regBtn.enable()\n })\n }\n\n private async newUserValidation() {\n const isLogByPhone = this.regType == \"phone\",\n isLogByEmail = this.regType == \"email\",\n emailValue = this.regEmail.value || (isLogByEmail && this.loginEmail.value),\n isEmailValid = Helper.isValidEmail(emailValue),\n isFirstNameValid = this.firstName.value.length > 0,\n isLastNameValid = this.lastName.value.length > 0,\n isPhoneValid = await this.regTelInput.isValid() || isLogByPhone && await this.loginTelInput.isValid(),\n emailValidation = (emailValue && isEmailValid) || (!emailValue && !this.isEmailRequired);\n\n // Custom Fields Validation\n var isCustomFieldValid = true;\n //we should make sure that there is text nodes between children\n this.customFieldsWrapper.childNodes\n .forEach((field: HTMLSallaFileUploadElement | HTMLInputElement) => {\n this.customFieldsValues[field.id] = field['value'];\n if (!field.required || this.customFieldsValues[field.id].length) {\n return;\n }\n isCustomFieldValid = false;\n const errorMsg: string = salla.lang.get('common.errors.field_required', { attribute: field.title });\n this.validateField(field, errorMsg)\n });\n\n if (emailValidation && isPhoneValid && isFirstNameValid && isLastNameValid && isCustomFieldValid) return;\n !isEmailValid && this.validateField(this.regEmail, this.emailErrorMsg);\n !isFirstNameValid && this.validateField(this.firstName, this.firstNameErrorMsg);\n !isLastNameValid && this.validateField(this.lastName, this.lastNameErrorMsg);\n throw 'Please insert required fields';\n }\n\n private getFilepondPlaceholder() {\n return `<div class=\"s-login-modal-filepond-placeholder\"><span class=\"s-login-modal-filepond-placeholder-icon\">${CameraIcon}</span><p class=\"s-login-modal-filepond-placeholder-text\">${this.dragAndDrop}</p> <span class=\"filepond--label-action\">${this.browseFromFiles}</span></div>`\n }\n\n // eslint-disable-next-line @stencil/own-methods-must-be-private\n validateField(field: HTMLInputElement | HTMLSallaFileUploadElement, errorMsg: string) {\n field.classList.add('s-has-error');\n field.nextElementSibling['innerText'] = '* ' + errorMsg;\n }\n\n generateTabClasses(tabName) {\n return {\n 's-login-modal-tab': tabName !== 'registration' && tabName !== 'otp',\n \"s-hidden\": this.currentTabName !== tabName,\n \"s-show\": this.currentTabName === tabName,\n 's-login-modal-unactive': tabName !== 'registration' && tabName !== 'otp' && this.currentTabName !== tabName,\n 's-login-modal-active': tabName !== 'registration' && tabName !== 'otp' && this.currentTabName === tabName\n }\n }\n\n generateRegClasses(regType) {\n return {\n \"mb-1.5\": true,\n \"s-hidden\": this.regType === regType\n }\n }\n private getLoginDom() {\n return [!this.inline && <span slot='icon' class=\"s-login-modal-header-icon\" innerHTML={UserIcon} />,\n <div class={this.inline ? 's-login-inline' : 's-login-modal-wrapper'}>\n {/* Tab 2 (Login By Mobile)*/}\n {this.isMobileAllowed ?\n <div class={this.generateTabClasses('login-phone')} data-name=\"login-phone\"\n ref={tab => this.mobileTab = tab}>\n <slot name=\"before-login-mobile\" />\n <form onSubmit={(event) => this.loginBySMS(event)} class={this.hasError && this.errorMessage ? 'has-error' : ''} method=\"POST\">\n <label class=\"s-login-modal-label\">{salla.lang.get('common.elements.mobile')}</label>\n <salla-tel-input tabindex=\"0\" ref={el => this.loginTelInput = el}\n onKeyDown={e => this.typing(e)}></salla-tel-input>\n {this.hasError && this.errorMessage ? <span class=\"s-login-modal-error-message\">\n {this.errorMessage}\n </span> : ''}\n {/* @ts-ignore */}\n <salla-button class=\"s-login-modal-enter-button\" type=\"submit\" loader-position='center' width=\"wide\" ref={b => this.smsBtn = b}>\n {salla.lang.get('blocks.header.enter')}\n </salla-button>\n </form>\n {this.isEmailAllowed ?\n <a href=\"#\" onClick={() => this.showTab(this.emailTab)}\n class=\"s-login-modal-link\">{salla.lang.get('blocks.header.login_by_email')}</a> : ''}\n <slot name=\"after-login-mobile\" />\n </div> : ''}\n\n\n {/* Tab 3 (Login By Email)*/}\n {this.isEmailAllowed ?\n <div class={this.generateTabClasses('login-email')} data-name=\"login-email\"\n ref={tab => this.emailTab = tab}>\n <slot name=\"before-login-email\" />\n <label class=\"s-login-modal-label\">{salla.lang.get('common.elements.email')}</label>\n <form onSubmit={() => this.loginByEmail(event)} method=\"POST\">\n <input type=\"email\" ref={el => this.loginEmail = el} onKeyDown={e => this.typing(e)}\n \n placeholder=\"your@email.com\"\n enterkeyhint=\"next\"\n class={{\"s-login-modal-input s-ltr\": true, \"s-has-error\": this.hasError}} />\n {this.hasError && this.errorMessage ? <span class=\"s-login-modal-error-message\">\n {this.errorMessage}\n </span> : ''}\n <salla-button class=\"s-login-modal-enter-button\" loader-position='center' width=\"wide\" onClick={() => this.loginByEmail()}\n ref={b => this.emailBtn = b}>{salla.lang.get('blocks.header.enter')}</salla-button>\n </form>\n {this.isMobileAllowed ?\n <a href=\"#\" onClick={() => this.showTab(this.mobileTab)}\n class=\"s-login-modal-link\">{salla.lang.get('blocks.header.login_by_sms')}</a>\n : ''\n }\n <slot name=\"after-login-email\" />\n </div> : ''}\n {/* Tab 4 (Verify OTP)*/}\n <salla-verify display=\"inline\" support-web-auth={this.supportWebAuth ? 'true' : 'false'}\n class={this.generateTabClasses('otp')} data-name=\"otp\" ref={tab => this.verifyTab = tab}\n autoReload={false}>\n <a onClick={() => this.showTab(this.regType == 'phone' ? this.mobileTab : this.emailTab)}\n class=\"s-verify-back\"\n innerHTML={ArrowRightIcon}\n slot=\"after-footer\"\n href=\"#\" />\n {this.isMobileAllowed && this.regType == 'phone' ? <div dir=\"ltr\" class=\"s-login-modal-currentPhone\" slot=\"mobile\">{this.currentPhone}</div> : ''}\n {this.isEmailAllowed && this.regType == 'email' ? <div dir=\"ltr\" class=\"s-login-modal-currentEmail\" slot=\"email\">{this.currentEmail}</div> : ''}\n </salla-verify>\n\n {/* Tab 5 (Register New User)*/}\n <div data-name=\"registration\" class={this.generateTabClasses('registration')}\n ref={tab => this.registrationTab = tab}>\n <slot name=\"before-registration\" />\n <div>\n <label class=\"s-login-modal-label\">{salla.lang.get('blocks.header.your_name')}</label>\n <input type=\"text\" class=\"s-login-modal-input\" ref={el => this.firstName = el}\n onKeyDown={e => this.typing(e, this.newUser)}\n placeholder={salla.lang.get('pages.profile.first_name')} />\n <span class=\"s-login-modal-error-message\" />\n </div>\n\n <div>\n <label class=\"s-login-modal-label\">{salla.lang.get('pages.profile.last_name')}</label>\n <input type=\"text\" class=\"s-login-modal-input\" ref={el => this.lastName = el}\n onKeyDown={e => this.typing(e, this.newUser)}\n placeholder={salla.lang.get('pages.profile.last_name')} />\n <span class=\"s-login-modal-error-message\" />\n </div>\n\n <div class={this.generateRegClasses('phone')}>\n <label class=\"s-login-modal-label\">{salla.lang.get('common.elements.mobile')}</label>\n <salla-tel-input ref={el => this.regTelInput = el}\n onKeyDown={e => this.typing(e, this.newUser)}></salla-tel-input>\n </div>\n\n <div class={this.generateRegClasses('email')}>\n <label class=\"s-login-modal-label\">{salla.lang.get('common.elements.email')}</label>\n <input type=\"email\" ref={el => this.regEmail = el} onKeyDown={e => this.typing(e, this.newUser)}\n placeholder=\"your@email.com\"\n class=\"s-login-modal-input s-ltr\" />\n <span class=\"s-login-modal-error-message\" />\n </div>\n <div class=\"s-login-modal-custom-fields\" ref={el => this.customFieldsWrapper = el}>{\n this.customFields.map((field: CustomField) => [\n <label class=\"s-login-modal-label\">{field.label}</label>,\n field.type === CustomFieldType.PHOTO\n ? <salla-file-upload\n name=\"image\"\n instant-upload={true}\n id={`${field.id}`}\n title={field.label}\n required={field.required}\n url={salla.url.get('upload-image')}\n // onUploaded={}\n labelIdle={this.getFilepondPlaceholder()} />\n : <input\n onInput={el => field.type == CustomFieldType.NUMBER ? salla.helpers.inputDigitsOnly(el.target) : {}}\n onKeyDown={e => this.typing(e, this.newUser)}\n class=\"s-login-modal-input s-ltr\"\n maxlength={field.length || 1000}//todo:: support it by adding the maxlength or not, not setting static limit\n placeholder={field.description}\n required={field.required}\n title={field.label}\n id={`${field.id}`}\n type=\"text\" />,\n <span class=\"s-login-modal-error-message\" />\n ])\n }</div>\n\n <salla-button loader-position='center' width=\"wide\" onClick={() => this.newUser()}\n ref={b => this.regBtn = b}>{salla.lang.get('blocks.header.register')}</salla-button>\n <slot name=\"after-registration\" />\n </div>\n </div>]\n }\n render() {\n // @ts-ignore\n // @ts-ignore\n if (this.inline) {\n return this.getLoginDom();\n }\n return (\n <salla-modal class=\"s-login-modal\" modal-title={this.title} ref={modal => this.modal = modal} width=\"xs\">\n {this.getLoginDom()}\n </salla-modal>\n );\n }\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"salla-login-modal.js","sourceRoot":"","sources":["../../../src/components/salla-login-modal/salla-login-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AACjD,qDAAqD;AACrD,oDAAoD;AACpD,OAAO,UAAU,MAAM,6BAA6B,CAAC;AACrD,iFAAiF;AACjF,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,EAAe,eAAe,EAAE,MAAM,aAAa,CAAC;AAE3D;;;;;;;;;;GAUG;AAOH,MAAM,OAAO,eAAe;EAC1B;IAmGQ,uBAAkB,GAAW,EAAE,CAAC;IAiIhC,WAAM,GAAG,CAAC,CAAC,EAAE,YAAY,GAAG,IAAI,EAAE,EAAE;MAC1C,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC;MAC1C,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;MACzC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,CAAC,QAAQ,CAAC,6BAA6B,CAAC,KAAI,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC,CAAC;MACnF,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;MACtB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC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AEP,uCAA8B,QAAQ,EAAC,KAAK,EAAC,MAAM,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,EAC/E,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAgB;UACtF,YAAM,IAAI,EAAC,oBAAoB,GAAG,CAC9B,CACF,CAAC,CAAA;EACT,CAAC;EACD,MAAM;IACJ,aAAa;IACb,aAAa;IACb,IAAI,IAAI,CAAC,MAAM,EAAE;MACf,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;KAC3B;IACD,OAAO,CACL,mBAAa,KAAK,EAAC,eAAe,iBAAc,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,EAAE,KAAK,EAAC,IAAI,IACrG,IAAI,CAAC,WAAW,EAAE,CACP,CACf,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Listen, Method, Prop, State } from '@stencil/core';\nimport UserIcon from \"../../assets/svg/user.svg\";\n//import PhoneIcon from \"../../assets/svg/phone.svg\";\n//import EmailIcon from \"../../assets/svg/mail.svg\";\nimport CameraIcon from '../../assets/svg/camera.svg';\n//import KeyboardArrowRightIcon from \"../../assets/svg/keyboard_arrow_right.svg\";\nimport ArrowRightIcon from \"../../assets/svg/arrow-right.svg\";\nimport Helper from '../../Helpers/Helper';\nimport { CustomField, CustomFieldType } from './intefaces';\n\n/**\n * @slot footer - The footer of modal\n * @slot before-login-type - placeholder position\n * @slot after-login-type - placeholder position\n * @slot before-login-mobile - placeholder position\n * @slot after-login-mobile - placeholder position\n * @slot before-login-email - placeholder position\n * @slot after-login-email - placeholder position\n * @slot before-registration - placeholder position\n * @slot after-registration - placeholder position\n */\n@Component({\n tag: 'salla-login-modal',\n styleUrl: 'salla-login-modal.scss'\n})\n\n\nexport class SallaLoginModal {\n constructor() {\n\n this.title = this.host.title || salla.lang.get('blocks.header.login');\n this.host.removeAttribute('title');\n\n this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');\n this.firstNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: salla.lang.get('pages.profile.first_name') });\n this.lastNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: salla.lang.get('pages.profile.last_name') });\n\n salla.lang.onLoaded(() => {\n this.translationLoaded = true;\n this.title = salla.lang.get('blocks.header.login');\n this.dragAndDrop = salla.lang.get('common.uploader.drag_and_drop');\n this.browseFromFiles = salla.lang.get('common.uploader.browse');\n this.updateTranslations();\n });\n\n salla.event.on('login::open', (data) => {\n if (!this.isEmailAllowed && !this.isMobileAllowed) {\n salla.logger.warn('Please enable atleast one login type to use this component.');\n return;\n }\n this.withoutReload = data?.withoutReload ?? this.withoutReload;\n this.isModalOpen = true\n this.open(data)\n });\n salla.onReady(() => {\n this.isEmailAllowed = salla.config.get('store.settings.auth.email_allowed', this.isEmailAllowed);\n this.isMobileAllowed = salla.config.get('store.settings.auth.mobile_allowed', this.isMobileAllowed);\n this.isEmailRequired = salla.config.get('store.settings.auth.is_email_required', this.isEmailRequired);\n });\n }\n\n @Element() host: HTMLElement;\n /**\n * Does the merchant allow to login using email\n */\n @Prop({ mutable: true }) isEmailAllowed: boolean;\n /**\n * Does the merchant/current location for visitor allow to login using mobile, By default outside KSA is `false`\n */\n @Prop({ mutable: true }) isMobileAllowed: boolean = true;\n /**\n * Does the merchant require registration with email & mobile\n */\n @Prop({ mutable: true }) isEmailRequired: boolean = false;\n\n /**\n * Once the api verify success, it will be login the customer in web pages\n */\n @Prop({ reflect: true }) supportWebAuth: boolean = true;\n\n /**\n * Display the login inline\n */\n @Prop({ reflect: true }) inline: boolean;\n\n\n /**\n * Reload after a successful login\n */\n @Prop() withoutReload: boolean = false;\n\n private modal: HTMLSallaModalElement;\n //private homeTab: HTMLDivElement;\n private mobileTab: HTMLDivElement;\n private emailTab: HTMLDivElement;\n private verifyTab: HTMLSallaVerifyElement;\n private registrationTab: HTMLDivElement;\n private regTelInput: HTMLSallaTelInputElement;\n private regEmail: HTMLInputElement;\n private customFieldsWrapper: HTMLDivElement;\n private loginTelInput: HTMLSallaTelInputElement;\n private loginEmail: HTMLInputElement;\n private firstName: HTMLInputElement;\n private lastName: HTMLInputElement;\n private smsBtn: HTMLSallaButtonElement;\n private emailBtn: HTMLSallaButtonElement;\n private regBtn: HTMLSallaButtonElement;\n\n @State() currentTabName = 'home'\n @State() regType: 'phone' | 'email' = 'phone';\n\n\n @State() translationLoaded: boolean = false;\n @State() isModalOpen = false\n @State() currentPhone: string = '';\n @State() currentEmail: string = '';\n @State() title: string;\n @State() emailErrorMsg: string;\n @State() firstNameErrorMsg: string;\n @State() lastNameErrorMsg: string;\n @State() hasError: boolean;\n @State() errorMessage: string;\n\n @State() dragAndDrop: string = salla.lang.get('common.uploader.drag_and_drop');\n @State() browseFromFiles: string = salla.lang.get('common.uploader.browse');\n @State() customFields: CustomField[] = [];\n\n private customFieldsValues: Object = {};\n @State() uploadedImage: string = undefined;\n\n @Listen('verified', { target: 'window' })\n /**\n * @param {CustomEvent|{details:{case:'new_customer'|'authenticated', redirect_url:string|null}}} event\n */\n onVerified(event) {\n salla.log('verified', event);\n //there is a case when force login is activated & is new user, it will return case inside error key., so cover it.\n let verifyCase = event.detail?.data.case || event.detail?.error.case;\n if (!verifyCase) {\n salla.log('verified but without case!');\n return;\n }\n\n if (verifyCase === \"new_customer\") {\n this.customFields = event.detail?.data?.custom_fields || [];\n return this.showTab(this.registrationTab);\n }\n\n if (!salla.auth.canRedirect()) {\n salla.log('Will not auto redirect or reload, due to `salla.auth.canRedirect()`');\n if (this.inline) {\n return;\n }\n this.isModalOpen = false\n this.modal.close();\n \n return;\n }\n\n if (event.detail.data.redirect_url) {\n return window.location.href = event.detail.data.redirect_url;\n }\n\n /**\n * we don't want to reload the page if this is not web auth\n * because we'll need the token in the page itself and its there\n * todo :: store the user data in storage for non-web auth and set the config.user from it\n */\n if (this.supportWebAuth && !this.withoutReload) {\n window.location.reload();\n } else {\n if (this.inline) {\n return;\n }\n this.isModalOpen = false\n this.modal.close();\n }\n }\n\n updateTranslations() {\n this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');\n this.firstNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: salla.lang.get('pages.profile.first_name') });\n this.lastNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: salla.lang.get('pages.profile.last_name') });\n if (this.inline) {\n return;\n }\n this.modal?.setTitle(this.title);\n }\n componentDidLoad() {\n if (this.inline) {\n this.getSelectedTab()\n }\n }\n /**\n * Open login component\n */\n @Method()\n // @ts-ignore\n async open(event = null) {\n // todo :: support change the settings from event details\n // if(event && event.hasOwnProperty('isEmailAllowed')){\n // this.isEmailAllowed = event?.isEmailAllowed;\n // }\n //\n // if(event && event.hasOwnProperty('isMobileAllowed')){\n // this.isMobileAllowed = event?.isMobileAllowed;\n // }\n\n /**\n * This is a workaround until we remove all the user objet from twig files\n * When the user is already login, let's reload the page\n */\n if (!salla.config.isGuest()) {\n if (!this.withoutReload) {\n return location.reload();\n }\n // Fire an event if withoutReload is true\n return;\n }\n\n this.getSelectedTab();\n this.isModalOpen = true\n\n return this.modal.open();\n }\n private getSelectedTab() {\n if (this.isMobileAllowed) {\n this.showTab(this.mobileTab);\n } else if (this.isEmailAllowed) {\n this.showTab(this.emailTab);\n }\n }\n private showTab(tab, evt?) {\n evt?.preventDefault();\n this.hasError = false;\n this.errorMessage = '';\n this.currentTabName = tab.getAttribute('data-name');\n\n // todo:: use better way for resize the modal\n // setTimeout(() => this.modal.querySelector('.s-login-modal-wrapper')?.setAttribute('style', 'height:' + tab?.scrollHeight + 'px'));\n\n if ([this.mobileTab, this.emailTab].includes(tab)) {\n this.regType = tab === this.mobileTab ? 'phone' : 'email';\n }\n\n if (this.inline) {\n return this;\n }\n this.modal?.setTitle(this.currentTabName === 'registration' ? salla.lang.get('common.titles.registration') : this.title);\n const input = tab.querySelector('input[type=\"tel\"], input[type=\"email\"]');\n input && this.currentTabName !== 'registration' && setTimeout(() => {\n input.focus();\n }, 100);\n return this;\n }\n\n private typing = (e, submitMethod = null) => {\n const error = e.target.nextElementSibling;\n e.target.classList.remove('s-has-error');\n error?.classList.contains('s-login-modal-error-message') && (error.innerText = '');\n this.hasError = false;\n this.errorMessage = '';\n //it was sending two requests for send two verification requests\n submitMethod && e.key == 'Enter' && submitMethod();\n }\n\n private loginBySMS = async (event = null) => {\n event?.preventDefault();\n const { phone, countryCode, countryKey } = await this.loginTelInput.getValues();\n const isPhoneValid = await this.loginTelInput.isValid();\n if (!isPhoneValid) {\n return;\n }\n this.currentPhone = `${countryKey} ${phone}`;\n this.login(this.smsBtn, { type: 'mobile', phone: phone, country_code: countryCode });\n\n return false;\n }\n\n private loginByEmail = (event = null) => {\n event?.preventDefault();\n if (!Helper.isValidEmail(this.loginEmail.value)) {\n // this.validateField(this.loginEmail, this.emailErrorMsg);\n this.hasError = true;\n this.errorMessage = '* ' + this.emailErrorMsg;\n return;\n }\n this.currentEmail = this.loginEmail.value;\n this.login(this.emailBtn, { type: 'email', email: this.loginEmail.value });\n }\n\n private login(btn: HTMLSallaButtonElement, data) {\n this.hasError = false;\n this.errorMessage = '';\n btn.load()\n .then(() => btn.disable())\n .then(() => salla.auth.api.login(data))\n .then(() => this.showTab(this.verifyTab))\n .then(() => this.verifyTab.open(data))\n .catch((error) => {\n this.hasError = true;\n this.errorMessage = error.response.data?.error?.message;\n })\n .finally(() => btn.stop() && btn.enable());\n }\n\n private newUser = async () => {\n const {\n phone: regPhone,\n countryCode\n } = this.regType == \"email\" ? await this.regTelInput.getValues() : await this.loginTelInput.getValues(),\n emailValue = this.regEmail.value || this.loginEmail?.value\n await this.newUserValidation();\n await this.regBtn.load();\n await this.regBtn.disable();\n\n let data: any = {\n first_name: this.firstName.value,\n last_name: this.lastName.value,\n phone: regPhone || this.loginTelInput.phone,\n country_code: countryCode,\n verified_by: this.regType,\n custom_fields: this.customFieldsValues,\n };\n emailValue && (data = { ...data, email: emailValue });\n this.verifyTab.getCode()\n .then(code => salla.auth.api.register({ ...data, code }))\n .then(() => salla.auth.canRedirect && !this.withoutReload && window.location.reload())\n .catch((error) => {\n salla.logger.error(error);\n this.regBtn.stop() && this.regBtn.enable()\n })\n }\n\n private async newUserValidation() {\n const isLogByPhone = this.regType == \"phone\",\n isLogByEmail = this.regType == \"email\",\n emailValue = this.regEmail.value || (isLogByEmail && this.loginEmail.value),\n isEmailValid = Helper.isValidEmail(emailValue),\n isFirstNameValid = this.firstName.value.length > 0,\n isLastNameValid = this.lastName.value.length > 0,\n isPhoneValid = await this.regTelInput.isValid() || isLogByPhone && await this.loginTelInput.isValid(),\n emailValidation = (emailValue && isEmailValid) || (!emailValue && !this.isEmailRequired);\n\n // Custom Fields Validation\n var isCustomFieldValid = true;\n //we should make sure that there is text nodes between children\n this.customFieldsWrapper.childNodes\n .forEach((field: HTMLSallaFileUploadElement | HTMLInputElement) => {\n this.customFieldsValues[field.id] = field['value'];\n if (!field.required || this.customFieldsValues[field.id].length) {\n return;\n }\n isCustomFieldValid = false;\n const errorMsg: string = salla.lang.get('common.errors.field_required', { attribute: field.title });\n this.validateField(field, errorMsg)\n });\n\n if (emailValidation && isPhoneValid && isFirstNameValid && isLastNameValid && isCustomFieldValid) return;\n !isEmailValid && this.validateField(this.regEmail, this.emailErrorMsg);\n !isFirstNameValid && this.validateField(this.firstName, this.firstNameErrorMsg);\n !isLastNameValid && this.validateField(this.lastName, this.lastNameErrorMsg);\n throw 'Please insert required fields';\n }\n\n private getFilepondPlaceholder() {\n return `<div class=\"s-login-modal-filepond-placeholder\"><span class=\"s-login-modal-filepond-placeholder-icon\">${CameraIcon}</span><p class=\"s-login-modal-filepond-placeholder-text\">${this.dragAndDrop}</p> <span class=\"filepond--label-action\">${this.browseFromFiles}</span></div>`\n }\n\n // eslint-disable-next-line @stencil/own-methods-must-be-private\n validateField(field: HTMLInputElement | HTMLSallaFileUploadElement, errorMsg: string) {\n field.classList.add('s-has-error');\n field.nextElementSibling['innerText'] = '* ' + errorMsg;\n }\n\n generateTabClasses(tabName) {\n return {\n 's-login-modal-tab': tabName !== 'registration' && tabName !== 'otp',\n \"s-hidden\": this.currentTabName !== tabName,\n \"s-show\": this.currentTabName === tabName,\n 's-login-modal-unactive': tabName !== 'registration' && tabName !== 'otp' && this.currentTabName !== tabName,\n 's-login-modal-active': tabName !== 'registration' && tabName !== 'otp' && this.currentTabName === tabName\n }\n }\n\n generateRegClasses(regType) {\n return {\n \"mb-1.5\": true,\n \"s-hidden\": this.regType === regType\n }\n }\n private getLoginDom() {\n return [!this.inline && <span slot='icon' class=\"s-login-modal-header-icon\" innerHTML={UserIcon} />,\n <div class={this.inline ? 's-login-inline' : 's-login-modal-wrapper'}>\n {/* Tab 2 (Login By Mobile)*/}\n {this.isMobileAllowed ?\n <div class={this.generateTabClasses('login-phone')} data-name=\"login-phone\"\n ref={tab => this.mobileTab = tab}>\n <slot name=\"before-login-mobile\" />\n <form onSubmit={(event) => this.loginBySMS(event)} class={this.hasError && this.errorMessage ? 'has-error' : ''} method=\"POST\">\n <label class=\"s-login-modal-label\">{salla.lang.get('common.elements.mobile')}</label>\n {this.isModalOpen || this.inline ? (<salla-tel-input autofocus tabindex=\"0\" ref={el => this.loginTelInput = el}\n onKeyDown={e => this.typing(e)}></salla-tel-input>) : null}\n {this.hasError && this.errorMessage ? <span class=\"s-login-modal-error-message\">\n {this.errorMessage}\n </span> : ''}\n {/* @ts-ignore */}\n <salla-button class=\"s-login-modal-enter-button\" type=\"submit\" loader-position='center' width=\"wide\" ref={b => this.smsBtn = b}>\n {salla.lang.get('blocks.header.enter')}\n </salla-button>\n </form>\n {this.isEmailAllowed ?\n <a href=\"#\" onClick={() => this.showTab(this.emailTab)}\n class=\"s-login-modal-link\">{salla.lang.get('blocks.header.login_by_email')}</a> : ''}\n <slot name=\"after-login-mobile\" />\n </div> : ''}\n\n\n {/* Tab 3 (Login By Email)*/}\n {this.isEmailAllowed ?\n <div class={this.generateTabClasses('login-email')} data-name=\"login-email\"\n ref={tab => this.emailTab = tab}>\n <slot name=\"before-login-email\" />\n <label class=\"s-login-modal-label\">{salla.lang.get('common.elements.email')}</label>\n <form onSubmit={() => this.loginByEmail(event)} method=\"POST\">\n <input type=\"email\" ref={el => this.loginEmail = el} onKeyDown={e => this.typing(e)}\n\n placeholder=\"your@email.com\"\n enterkeyhint=\"next\"\n class={{ \"s-login-modal-input s-ltr\": true, \"s-has-error\": this.hasError }} />\n {this.hasError && this.errorMessage ? <span class=\"s-login-modal-error-message\">\n {this.errorMessage}\n </span> : ''}\n <salla-button class=\"s-login-modal-enter-button\" loader-position='center' width=\"wide\" onClick={() => this.loginByEmail()}\n ref={b => this.emailBtn = b}>{salla.lang.get('blocks.header.enter')}</salla-button>\n </form>\n {this.isMobileAllowed ?\n <a href=\"#\" onClick={() => this.showTab(this.mobileTab)}\n class=\"s-login-modal-link\">{salla.lang.get('blocks.header.login_by_sms')}</a>\n : ''\n }\n <slot name=\"after-login-email\" />\n </div> : ''}\n {/* Tab 4 (Verify OTP)*/}\n <salla-verify display=\"inline\" support-web-auth={this.supportWebAuth ? 'true' : 'false'}\n class={this.generateTabClasses('otp')} data-name=\"otp\" ref={tab => this.verifyTab = tab}\n autoReload={false}>\n <a onClick={() => this.showTab(this.regType == 'phone' ? this.mobileTab : this.emailTab)}\n class=\"s-verify-back\"\n innerHTML={ArrowRightIcon}\n slot=\"after-footer\"\n href=\"#\" />\n {this.isMobileAllowed && this.regType == 'phone' ? <div dir=\"ltr\" class=\"s-login-modal-currentPhone\" slot=\"mobile\">{this.currentPhone}</div> : ''}\n {this.isEmailAllowed && this.regType == 'email' ? <div dir=\"ltr\" class=\"s-login-modal-currentEmail\" slot=\"email\">{this.currentEmail}</div> : ''}\n </salla-verify>\n\n {/* Tab 5 (Register New User)*/}\n <div data-name=\"registration\" class={this.generateTabClasses('registration')}\n ref={tab => this.registrationTab = tab}>\n <slot name=\"before-registration\" />\n <div>\n <label class=\"s-login-modal-label\">{salla.lang.get('blocks.header.your_name')}</label>\n <input type=\"text\" class=\"s-login-modal-input\" ref={el => this.firstName = el}\n onKeyDown={e => this.typing(e, this.newUser)}\n placeholder={salla.lang.get('pages.profile.first_name')} />\n <span class=\"s-login-modal-error-message\" />\n </div>\n\n <div>\n <label class=\"s-login-modal-label\">{salla.lang.get('pages.profile.last_name')}</label>\n <input type=\"text\" class=\"s-login-modal-input\" ref={el => this.lastName = el}\n onKeyDown={e => this.typing(e, this.newUser)}\n placeholder={salla.lang.get('pages.profile.last_name')} />\n <span class=\"s-login-modal-error-message\" />\n </div>\n\n <div class={this.generateRegClasses('phone')}>\n <label class=\"s-login-modal-label\">{salla.lang.get('common.elements.mobile')}</label>\n {(this.isModalOpen || this.inline) && this.currentTabName === \"registration\" ? (<salla-tel-input ref={el => this.regTelInput = el}\n onKeyDown={e => this.typing(e, this.newUser)}></salla-tel-input>) : null}\n </div>\n\n <div class={this.generateRegClasses('email')}>\n <label class=\"s-login-modal-label\">{salla.lang.get('common.elements.email')}</label>\n <input type=\"email\" ref={el => this.regEmail = el} onKeyDown={e => this.typing(e, this.newUser)}\n placeholder=\"your@email.com\"\n class=\"s-login-modal-input s-ltr\" />\n <span class=\"s-login-modal-error-message\" />\n </div>\n <div class=\"s-login-modal-custom-fields\" ref={el => this.customFieldsWrapper = el}>{\n this.customFields.map((field: CustomField) => [\n <label class=\"s-login-modal-label\">{field.label}</label>,\n field.type === CustomFieldType.PHOTO\n ? <salla-file-upload\n name=\"image\"\n instant-upload={true}\n id={`${field.id}`}\n title={field.label}\n required={field.required}\n url={salla.url.get('upload-image')}\n // onUploaded={}\n labelIdle={this.getFilepondPlaceholder()} />\n : <input\n onInput={el => field.type == CustomFieldType.NUMBER ? salla.helpers.inputDigitsOnly(el.target) : {}}\n onKeyDown={e => this.typing(e, this.newUser)}\n class=\"s-login-modal-input s-ltr\"\n maxlength={field.length || 1000}//todo:: support it by adding the maxlength or not, not setting static limit\n placeholder={field.description}\n required={field.required}\n title={field.label}\n id={`${field.id}`}\n type=\"text\" />,\n <span class=\"s-login-modal-error-message\" />\n ])\n }</div>\n\n <salla-button loader-position='center' width=\"wide\" onClick={() => this.newUser()}\n ref={b => this.regBtn = b}>{salla.lang.get('blocks.header.register')}</salla-button>\n <slot name=\"after-registration\" />\n </div>\n </div>]\n }\n render() {\n // @ts-ignore\n // @ts-ignore\n if (this.inline) {\n return this.getLoginDom();\n }\n return (\n <salla-modal class=\"s-login-modal\" modal-title={this.title} ref={modal => this.modal = modal} width=\"xs\">\n {this.getLoginDom()}\n </salla-modal>\n );\n }\n}\n\n"]}
|
|
@@ -6,6 +6,7 @@ import TelInput from "intl-tel-input";
|
|
|
6
6
|
export class SallaTelInput {
|
|
7
7
|
constructor() {
|
|
8
8
|
this.phone = undefined;
|
|
9
|
+
this.autofocus = undefined;
|
|
9
10
|
this.name = 'phone';
|
|
10
11
|
this.countryCode = salla.config.get('user.country_code', 'SA') || 'SA';
|
|
11
12
|
this.mobileRequired = undefined;
|
|
@@ -68,6 +69,7 @@ export class SallaTelInput {
|
|
|
68
69
|
autoPlaceholder: 'aggressive',
|
|
69
70
|
utilsScript: 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/js/utils.min.js',
|
|
70
71
|
});
|
|
72
|
+
this.autofocus && this.phoneInput.focus();
|
|
71
73
|
this.phoneInput.addEventListener("countrychange", () => {
|
|
72
74
|
let data = this.iti.getSelectedCountryData();
|
|
73
75
|
let value = data.iso2.toUpperCase();
|
|
@@ -130,6 +132,23 @@ export class SallaTelInput {
|
|
|
130
132
|
"attribute": "phone",
|
|
131
133
|
"reflect": false
|
|
132
134
|
},
|
|
135
|
+
"autofocus": {
|
|
136
|
+
"type": "boolean",
|
|
137
|
+
"mutable": false,
|
|
138
|
+
"complexType": {
|
|
139
|
+
"original": "boolean",
|
|
140
|
+
"resolved": "boolean",
|
|
141
|
+
"references": {}
|
|
142
|
+
},
|
|
143
|
+
"required": false,
|
|
144
|
+
"optional": false,
|
|
145
|
+
"docs": {
|
|
146
|
+
"tags": [],
|
|
147
|
+
"text": "Automatically focus telephone input"
|
|
148
|
+
},
|
|
149
|
+
"attribute": "autofocus",
|
|
150
|
+
"reflect": true
|
|
151
|
+
},
|
|
133
152
|
"name": {
|
|
134
153
|
"type": "string",
|
|
135
154
|
"mutable": false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"salla-tel-input.js","sourceRoot":"","sources":["../../../src/components/salla-tel-input/salla-tel-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAKtC,MAAM,OAAO,aAAa;EACxB;;gBAoBuB,OAAO;uBAIiB,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,mBAAmB,EAAE,IAAI,CAAC,IAAI,IAAI;;4BAU9D,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC;uBAC1C,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC;oBAC3C,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,yBAAyB,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;mBAC3E,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,CAA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K,EAAC,uBAAuB,EAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,GAAG,EAAE,GAAG;MACrE,aAAO,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,cAAc,EAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,gBAAgB,GAAG,EAAE,EACrG,KAAK,EAAC,cAAc,GAAG,CACpB,CACR,CAAC;EACJ,CAAC;EAED,gBAAgB;IACd,IAAI,CAAC,YAAY,EAAE,CAAC;EACtB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Element, Component, Host, h, Prop, Method, Event, EventEmitter, State } from '@stencil/core';\nimport TelInput from \"intl-tel-input\";\nimport { Phone } from './interfaces';\n\n@Component({ tag: 'salla-tel-input', styleUrl: 'salla-tel-input.scss' })\n\nexport class SallaTelInput {\n constructor() {\n salla.lang.onLoaded(() => {\n this.mobileLabel = salla.lang.get('common.elements.mobile');\n this.countryCodeLabel = salla.lang.get('common.elements.country_code');\n this.invalidNumber = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });\n this.invalidCountryCode = salla.lang.get('common.errors.invalid_value', { attribute: this.countryCodeLabel });\n this.tooShort = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });\n this.tooLong = salla.lang.get('common.errors.too_long', { attribute: this.mobileLabel });\n this.mobileRequired = salla.lang.get('common.errors.field_required', { attribute: this.mobileLabel });\n this.errorMap = [this.invalidNumber, this.invalidCountryCode, this.tooShort, this.tooLong, this.invalidNumber];\n });\n }\n\n /**\n * Current mobile number\n */\n @Prop({ mutable: true }) phone: string;\n /**\n * input name\n */\n @Prop() name: string = 'phone';\n /**\n * Current country_code\n */\n @Prop({ mutable: true }) countryCode: string = salla.config.get('user.country_code', 'SA') || 'SA';\n\n /**\n * Event emmitted when user enters a phone number.\n */\n @Event() phoneEntered: EventEmitter<Phone>;\n\n\n @Element() host: HTMLElement;\n @State() mobileRequired: string;\n @State() countryCodeLabel: string = salla.lang.get('common.country_code');\n @State() mobileLabel: string = salla.lang.get('common.elements.mobile');\n @State() tooShort: string = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });\n @State() tooLong: string = salla.lang.get('common.errors.too_long', { attribute: this.mobileLabel });\n @State() invalidCountryCode: string = salla.lang.get('common.errors.invalid_value', { attribute: this.countryCodeLabel });\n @State() invalidNumber: string = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });\n @State() errorMap: string[] = [this.invalidNumber, this.invalidCountryCode, this.tooShort, this.tooLong, this.invalidNumber];\n\n private phoneInput: HTMLInputElement;\n private countryCodeInput: HTMLInputElement;\n private errorMsg: any;\n private iti: any;\n\n\n /**\n * Get current values\n * @return {{mobile:number,countryCode:'SA'|string}}\n */\n @Method()\n async getValues() {\n return {\n [this.name]: this.phone = this.phoneInput.value,\n countryCode: this.countryCode = this.countryCodeInput.value,\n countryKey: (this.host.querySelector('.iti__selected-dial-code') as any).innerText\n }\n }\n\n /**\n * Is current data valid or not\n * @return {boolean}\n */\n @Method()\n async isValid() {\n this.reset();\n if (this.iti.isValidNumber()) return true;\n\n if (!this.phoneInput.value.trim()) {\n this.phoneInput.classList.add(\"s-has-error\");\n this.errorMsg.innerText = this.mobileRequired || 'The mobile is required';\n return;\n }\n\n this.phoneInput.classList.add(\"s-has-error\");\n let errorCode = this.iti.getValidationError();\n this.errorMsg.innerText = this.errorMap[errorCode] || '';\n\n salla.logger.info('Phone number (' + this.countryCode + ' - ' + this.phone + ') is not valid, error code ' + errorCode);\n return false;\n }\n\n private initTelInput() {\n salla.helpers.inputDigitsOnly(this.phoneInput);\n this.iti = TelInput(this.phoneInput, {\n initialCountry: this.countryCode || 'sa',\n preferredCountries: ['sa', 'ae', 'kw', 'bh', 'qa', 'iq', 'om', 'ye', 'eg', 'jo', 'ps', 'sd', 'lb', 'dz', 'tn', 'ma', 'ly'],\n excludeCountries: ['sy', 'ir', 'cu', 'kp'],\n formatOnDisplay: false,\n separateDialCode: true,\n autoPlaceholder: 'aggressive',\n utilsScript: 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/js/utils.min.js',\n });\n this.phoneInput.addEventListener(\"countrychange\", () => {\n let data = this.iti.getSelectedCountryData();\n let value = data.iso2.toUpperCase();\n this.countryCodeInput.value = value\n this.countryCode = value;\n this.phoneEntered.emit({ number: this.phone, country_code: value })\n });\n\n // on blur: validate\n // this.phoneInput.addEventListener('blur', () => this.isValid());\n\n // on keyup / change flag: reset\n this.phoneInput.addEventListener('input', (e: Event) => {\n salla.helpers.inputDigitsOnly(e.target);\n this.reset();\n this.phoneEntered.emit({ number: (e.target as HTMLInputElement).value, country_code: this.countryCode })\n });\n\n }\n\n private reset() {\n this.phoneInput.classList.remove(\"s-has-error\");\n this.errorMsg.innerHTML = \"\";\n };\n\n private handleCountryInput(event) {\n if (!!this.phone) {\n this.phoneEntered.emit({ number: event.target.value, country_code: this.countryCode })\n }\n }\n\n\n render() {\n return (\n <Host class=\"s-tel-input\">\n <input type=\"tel\" name={this.name} value={this.phone} onChange={(event) => this.handleCountryInput(event)} ref={el => this.phoneInput = el}\n enterkeyhint=\"next\"\n autocomplete=\"tel\"\n class=\"s-tel-input-control tel-input s-ltr\" />\n <span class=\"s-tel-input-error-msg\" ref={el => this.errorMsg = el}/>\n <input type=\"hidden\" name=\"country_code\" value={this.countryCode} ref={el => this.countryCodeInput = el}\n class=\"country_code\" />\n </Host>\n );\n }\n\n componentDidLoad() {\n this.initTelInput();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"salla-tel-input.js","sourceRoot":"","sources":["../../../src/components/salla-tel-input/salla-tel-input.tsx"],"names":[],"mappings":"AAAA,OAAO,E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;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Element, Component, Host, h, Prop, Method, Event, EventEmitter, State } from '@stencil/core';\nimport TelInput from \"intl-tel-input\";\nimport { Phone } from './interfaces';\n\n@Component({ tag: 'salla-tel-input', styleUrl: 'salla-tel-input.scss' })\n\nexport class SallaTelInput {\n constructor() {\n salla.lang.onLoaded(() => {\n this.mobileLabel = salla.lang.get('common.elements.mobile');\n this.countryCodeLabel = salla.lang.get('common.elements.country_code');\n this.invalidNumber = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });\n this.invalidCountryCode = salla.lang.get('common.errors.invalid_value', { attribute: this.countryCodeLabel });\n this.tooShort = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });\n this.tooLong = salla.lang.get('common.errors.too_long', { attribute: this.mobileLabel });\n this.mobileRequired = salla.lang.get('common.errors.field_required', { attribute: this.mobileLabel });\n this.errorMap = [this.invalidNumber, this.invalidCountryCode, this.tooShort, this.tooLong, this.invalidNumber];\n });\n }\n\n /**\n * Current mobile number\n */\n @Prop({ mutable: true }) phone: string;\n /**\n * Automatically focus telephone input\n */\n @Prop({ reflect:true }) autofocus: boolean;\n /**\n * input name\n */\n @Prop() name: string = 'phone';\n /**\n * Current country_code\n */\n @Prop({ mutable: true }) countryCode: string = salla.config.get('user.country_code', 'SA') || 'SA';\n\n /**\n * Event emmitted when user enters a phone number.\n */\n @Event() phoneEntered: EventEmitter<Phone>;\n\n\n @Element() host: HTMLElement;\n @State() mobileRequired: string;\n @State() countryCodeLabel: string = salla.lang.get('common.country_code');\n @State() mobileLabel: string = salla.lang.get('common.elements.mobile');\n @State() tooShort: string = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });\n @State() tooLong: string = salla.lang.get('common.errors.too_long', { attribute: this.mobileLabel });\n @State() invalidCountryCode: string = salla.lang.get('common.errors.invalid_value', { attribute: this.countryCodeLabel });\n @State() invalidNumber: string = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });\n @State() errorMap: string[] = [this.invalidNumber, this.invalidCountryCode, this.tooShort, this.tooLong, this.invalidNumber];\n\n private phoneInput: HTMLInputElement;\n private countryCodeInput: HTMLInputElement;\n private errorMsg: any;\n private iti: any;\n\n\n /**\n * Get current values\n * @return {{mobile:number,countryCode:'SA'|string}}\n */\n @Method()\n async getValues() {\n return {\n [this.name]: this.phone = this.phoneInput.value,\n countryCode: this.countryCode = this.countryCodeInput.value,\n countryKey: (this.host.querySelector('.iti__selected-dial-code') as any).innerText\n }\n }\n\n /**\n * Is current data valid or not\n * @return {boolean}\n */\n @Method()\n async isValid() {\n this.reset();\n if (this.iti.isValidNumber()) return true;\n\n if (!this.phoneInput.value.trim()) {\n this.phoneInput.classList.add(\"s-has-error\");\n this.errorMsg.innerText = this.mobileRequired || 'The mobile is required';\n return;\n }\n\n this.phoneInput.classList.add(\"s-has-error\");\n let errorCode = this.iti.getValidationError();\n this.errorMsg.innerText = this.errorMap[errorCode] || '';\n\n salla.logger.info('Phone number (' + this.countryCode + ' - ' + this.phone + ') is not valid, error code ' + errorCode);\n return false;\n }\n\n private initTelInput() {\n salla.helpers.inputDigitsOnly(this.phoneInput);\n this.iti = TelInput(this.phoneInput, {\n initialCountry: this.countryCode || 'sa',\n preferredCountries: ['sa', 'ae', 'kw', 'bh', 'qa', 'iq', 'om', 'ye', 'eg', 'jo', 'ps', 'sd', 'lb', 'dz', 'tn', 'ma', 'ly'],\n excludeCountries: ['sy', 'ir', 'cu', 'kp'],\n formatOnDisplay: false,\n separateDialCode: true,\n autoPlaceholder: 'aggressive',\n utilsScript: 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/js/utils.min.js',\n });\n\n this.autofocus && this.phoneInput.focus()\n\n this.phoneInput.addEventListener(\"countrychange\", () => {\n let data = this.iti.getSelectedCountryData();\n let value = data.iso2.toUpperCase();\n this.countryCodeInput.value = value\n this.countryCode = value;\n this.phoneEntered.emit({ number: this.phone, country_code: value })\n });\n\n // on blur: validate\n // this.phoneInput.addEventListener('blur', () => this.isValid());\n\n // on keyup / change flag: reset\n this.phoneInput.addEventListener('input', (e: Event) => {\n salla.helpers.inputDigitsOnly(e.target);\n this.reset();\n this.phoneEntered.emit({ number: (e.target as HTMLInputElement).value, country_code: this.countryCode })\n });\n\n }\n\n private reset() {\n this.phoneInput.classList.remove(\"s-has-error\");\n this.errorMsg.innerHTML = \"\";\n };\n\n private handleCountryInput(event) {\n if (!!this.phone) {\n this.phoneEntered.emit({ number: event.target.value, country_code: this.countryCode })\n }\n }\n\n\n render() {\n return (\n <Host class=\"s-tel-input\">\n <input type=\"tel\" name={this.name} value={this.phone} onChange={(event) => this.handleCountryInput(event)} ref={el => this.phoneInput = el}\n enterkeyhint=\"next\"\n autocomplete=\"tel\"\n class=\"s-tel-input-control tel-input s-ltr\" />\n <span class=\"s-tel-input-error-msg\" ref={el => this.errorMsg = el}/>\n <input type=\"hidden\" name=\"country_code\" value={this.countryCode} ref={el => this.countryCodeInput = el}\n class=\"country_code\" />\n </Host>\n );\n }\n\n componentDidLoad() {\n this.initTelInput();\n }\n}\n"]}
|
|
@@ -41,6 +41,7 @@ const SallaGifting$1 = /*@__PURE__*/ proxyCustomElement(class SallaGifting exten
|
|
|
41
41
|
constructor() {
|
|
42
42
|
super();
|
|
43
43
|
this.__registerHost();
|
|
44
|
+
this.defaultEvent = "gifting:open";
|
|
44
45
|
this.sectionTitle = undefined;
|
|
45
46
|
this.sectionSubtitle = undefined;
|
|
46
47
|
this.sectionBtnText = undefined;
|
|
@@ -111,6 +112,9 @@ const SallaGifting$1 = /*@__PURE__*/ proxyCustomElement(class SallaGifting exten
|
|
|
111
112
|
this.donationRequired = salla.lang.get('pages.products.donation_amount_required');
|
|
112
113
|
this.currentLang = salla.lang.locale;
|
|
113
114
|
});
|
|
115
|
+
salla.event.on(this.defaultEvent, () => {
|
|
116
|
+
this.open();
|
|
117
|
+
});
|
|
114
118
|
}
|
|
115
119
|
componentDidLoad() {
|
|
116
120
|
salla.event.product.onPriceUpdated(() => {
|
|
@@ -124,6 +128,7 @@ const SallaGifting$1 = /*@__PURE__*/ proxyCustomElement(class SallaGifting exten
|
|
|
124
128
|
*/
|
|
125
129
|
async open() {
|
|
126
130
|
if (salla.config.isGuest()) {
|
|
131
|
+
salla.api.auth.setAfterLoginEvent(this.defaultEvent);
|
|
127
132
|
salla.event.dispatch('login::open');
|
|
128
133
|
return;
|
|
129
134
|
}
|