@salla.sa/twilight-components 1.5.9 → 1.5.11
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/README.md +39 -18
- package/dist/cjs/{index-d43334bf.js → index-0d0167d5.js} +0 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-add-product-button.cjs.entry.js +1 -1
- package/dist/cjs/salla-button_24.cjs.entry.js +18 -13
- package/dist/cjs/salla-conditional-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +2 -2
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/twilight-components.cjs.js +1 -1
- package/dist/collection/components/salla-installment/salla-installment.js +1 -1
- package/dist/collection/components/salla-login-modal/salla-login-modal.js +6 -2
- package/dist/collection/components/salla-social-share/salla-social-share.js +1 -5
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +2 -1
- package/dist/collection/components/salla-verify/salla-verify.js +9 -4
- package/dist/collection/global/app.js +8 -5
- package/dist/components/salla-installment.js +1 -1
- package/dist/components/salla-login-modal.js +6 -2
- package/dist/components/salla-social-share.js +1 -5
- package/dist/components/salla-tel-input2.js +2 -1
- package/dist/components/salla-verify2.js +8 -4
- package/dist/esm/{index-c78562f8.js → index-4e30ffd0.js} +0 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-add-product-button.entry.js +1 -1
- package/dist/esm/salla-button_24.entry.js +18 -13
- package/dist/esm/salla-conditional-fields.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +2 -2
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/twilight-components.js +1 -1
- package/dist/twilight-components/{p-ca871c42.entry.js → p-019bb315.entry.js} +1 -1
- package/dist/twilight-components/{p-336eda99.js → p-1503d976.js} +0 -0
- package/dist/twilight-components/p-808466f3.entry.js +4 -0
- package/dist/twilight-components/p-88f8666d.entry.js +4 -0
- package/dist/twilight-components/{p-2ae56ddc.entry.js → p-952f6c78.entry.js} +1 -1
- package/dist/twilight-components/{p-c2947b0f.entry.js → p-b9fe5498.entry.js} +1 -1
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/components/salla-social-share/salla-social-share.d.ts +0 -1
- package/dist/types/global/app.d.ts +0 -1
- package/package.json +5 -4
- package/dist/twilight-components/p-11d2a470.entry.js +0 -4
- package/dist/twilight-components/p-b5028001.entry.js +0 -4
package/README.md
CHANGED
|
@@ -94,9 +94,14 @@ Twilight Web Components are maintained by a full-time core team and a large comm
|
|
|
94
94
|
|
|
95
95
|
<p align="right">(<a href="#top">back to top</a>)</p>
|
|
96
96
|
|
|
97
|
+
> #### Things to know:
|
|
98
|
+
> It's worth noting that the [Tailwind CSS Framework](https://tailwindcss.com/) is the default foundation for the **Twilight web components**.There is a possibility that future plans may include other CSS frameworks.
|
|
99
|
+
|
|
97
100
|
## Installation
|
|
98
101
|
|
|
99
|
-
|
|
102
|
+
To use the components, developers need to load a CSS file and some JavaScript. The CSS file includes the fonts and design tokens.
|
|
103
|
+
|
|
104
|
+
You need Node.js and Tailwind CSS installed, then install the components by performing one of the following commands:
|
|
100
105
|
|
|
101
106
|
|
|
102
107
|
```npm title="NPM Installation Command"
|
|
@@ -107,39 +112,55 @@ npm install @salla.sa/twilight-components --save
|
|
|
107
112
|
yarn add @salla.sa/twilight-components
|
|
108
113
|
```
|
|
109
114
|
|
|
110
|
-
|
|
115
|
+
And then in your javascript codebase you can import it as follows:
|
|
111
116
|
|
|
112
|
-
```SCSS title="Import Command"
|
|
113
|
-
@import "~@salla.sa/twilight-components/dist/twilight-components/twilight-components";
|
|
114
|
-
```
|
|
115
117
|
|
|
116
118
|
```JS title="Import Command"
|
|
117
119
|
import {
|
|
118
120
|
applyPolyfills,
|
|
119
|
-
defineCustomElements as
|
|
121
|
+
defineCustomElements as TwilightWebComponents
|
|
120
122
|
} from '@salla.sa/twilight-components/loader';
|
|
121
123
|
|
|
122
124
|
applyPolyfills().then(() => {
|
|
123
|
-
|
|
125
|
+
TwilightWebComponents(window);
|
|
124
126
|
});
|
|
125
127
|
```
|
|
126
128
|
|
|
127
|
-
|
|
129
|
+
Now you can adding twilight tainwind theme to your `tailwind.config.js` file:
|
|
130
|
+
|
|
131
|
+
```js title="tailwind.config.js"
|
|
132
|
+
...
|
|
133
|
+
plugins: [
|
|
134
|
+
...
|
|
135
|
+
require('@salla.sa/twilight-tailwind-theme'),
|
|
136
|
+
...
|
|
137
|
+
]
|
|
138
|
+
...
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
<br />
|
|
142
|
+
|
|
143
|
+
### JIT Enabled
|
|
128
144
|
|
|
145
|
+
**Tailwind** added a [just-in-time compiler](https://v2.tailwindcss.com/docs/just-in-time-mode), which generates styles as the developer writes the theme rather than generating everything in advance at initial build time.
|
|
129
146
|
|
|
130
|
-
|
|
131
|
-
<script
|
|
132
|
-
type="module"
|
|
133
|
-
src="https://unpkg.com/@esri/calcite-components@1.0.0-beta.80/dist/calcite/calcite.esm.js"
|
|
134
|
-
></script>
|
|
147
|
+
Since JIT mode generates your CSS on-demand by scanning your template files, it’s crucial that you configure the `content` option in your `tailwind.config.js` file with all of your template paths, otherwise your CSS will be empty
|
|
135
148
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
149
|
+
|
|
150
|
+
```js title="tailwind.config.js"
|
|
151
|
+
...
|
|
152
|
+
content: [
|
|
153
|
+
// theme views
|
|
154
|
+
"views/**/*.twig",
|
|
155
|
+
// list of classes which required by twilight web components
|
|
156
|
+
"node_modules/@salla.sa/twilight-tailwind-theme/safe-list-css.txt"
|
|
157
|
+
],
|
|
158
|
+
...
|
|
141
159
|
```
|
|
142
160
|
|
|
161
|
+
> Previously, as [mentioned](https://salla.stoplight.io/studio/twilight-themes-documentation?#config-files) that the file `tailwind.config.js` is already bundled with the **Twilight starter theme** files.
|
|
162
|
+
|
|
163
|
+
<!-- type: tab-end -->
|
|
143
164
|
<p align="right">(<a href="#top">back to top</a>)</p>
|
|
144
165
|
|
|
145
166
|
## Usage
|
|
File without changes
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
7
|
|
|
8
|
-
const index = require('./index-
|
|
8
|
+
const index = require('./index-0d0167d5.js');
|
|
9
9
|
|
|
10
10
|
const sallaAddProductButtonCss = ":host{display:block}salla-add-product-button[width=wide]{width:100%}";
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
7
|
|
|
8
|
-
const index$1 = require('./index-
|
|
8
|
+
const index$1 = require('./index-0d0167d5.js');
|
|
9
9
|
const search = require('./search-b487cc49.js');
|
|
10
10
|
|
|
11
11
|
const sallaButtonCss = "";
|
|
@@ -455,8 +455,9 @@ const SallaLoginModal = class {
|
|
|
455
455
|
this.loginBySMS = async () => {
|
|
456
456
|
const { phone, countryCode } = await this.loginTelInput.getValues();
|
|
457
457
|
const isPhoneValid = await this.loginTelInput.isValid();
|
|
458
|
-
if (!isPhoneValid)
|
|
458
|
+
if (!isPhoneValid) {
|
|
459
459
|
return;
|
|
460
|
+
}
|
|
460
461
|
this.login(this.smsBtn, { type: 'mobile', phone: phone, country_code: countryCode });
|
|
461
462
|
};
|
|
462
463
|
this.loginByEmail = () => {
|
|
@@ -483,7 +484,10 @@ const SallaLoginModal = class {
|
|
|
483
484
|
this.verifyTab.getCode()
|
|
484
485
|
.then(code => salla.auth.api.register(Object.assign(Object.assign({}, data), { code })))
|
|
485
486
|
.then(() => salla.auth.canRedirect && window.location.reload())
|
|
486
|
-
.catch(() =>
|
|
487
|
+
.catch((error) => {
|
|
488
|
+
salla.logger.error(error);
|
|
489
|
+
this.regBtn.stop() && this.regBtn.enable();
|
|
490
|
+
});
|
|
487
491
|
};
|
|
488
492
|
this.title = this.host.title || salla.lang.get('blocks.header.login');
|
|
489
493
|
this.host.removeAttribute('title');
|
|
@@ -3248,6 +3252,7 @@ const SallaSocialShare = class {
|
|
|
3248
3252
|
const script = document.createElement('script');
|
|
3249
3253
|
script.src = 'https://static.addtoany.com/menu/page.js';
|
|
3250
3254
|
script.setAttribute('id', 'a2a-script');
|
|
3255
|
+
script.async = true;
|
|
3251
3256
|
script.onload = function () {
|
|
3252
3257
|
// ? this will not work if there is one share component in the page
|
|
3253
3258
|
window.a2a_config = window.a2a_config || {};
|
|
@@ -3302,11 +3307,6 @@ const SallaSocialShare = class {
|
|
|
3302
3307
|
}))));
|
|
3303
3308
|
}))));
|
|
3304
3309
|
}
|
|
3305
|
-
componentDidLoad() {
|
|
3306
|
-
var script = document.createElement('script');
|
|
3307
|
-
script.setAttribute('src', 'https://static.addtoany.com/menu/page.js');
|
|
3308
|
-
document.head.appendChild(script);
|
|
3309
|
-
}
|
|
3310
3310
|
};
|
|
3311
3311
|
SallaSocialShare.style = sallaSocialShareCss;
|
|
3312
3312
|
|
|
@@ -9895,12 +9895,13 @@ const SallaTelInput = class {
|
|
|
9895
9895
|
return true;
|
|
9896
9896
|
if (!this.phoneInput.value.trim()) {
|
|
9897
9897
|
this.phoneInput.classList.add("s-has-error");
|
|
9898
|
-
this.errorMsg.innerText = this.mobileRequired || '';
|
|
9898
|
+
this.errorMsg.innerText = this.mobileRequired || 'The mobile is required';
|
|
9899
9899
|
return;
|
|
9900
9900
|
}
|
|
9901
9901
|
this.phoneInput.classList.add("s-has-error");
|
|
9902
9902
|
let errorCode = this.iti.getValidationError();
|
|
9903
9903
|
this.errorMsg.innerText = this.errorMap[errorCode] || '';
|
|
9904
|
+
salla.logger.info('Phone number (' + this.countryCode + ' - ' + this.phone + ') is not valid, error code ' + errorCode);
|
|
9904
9905
|
return false;
|
|
9905
9906
|
}
|
|
9906
9907
|
initTelInput() {
|
|
@@ -9982,6 +9983,7 @@ const SallaVerify = class {
|
|
|
9982
9983
|
this.modal = { open: () => '', close: () => '', setTitle: () => '' };
|
|
9983
9984
|
return;
|
|
9984
9985
|
}
|
|
9986
|
+
//salla.profile.event.verificationCodeSent({});
|
|
9985
9987
|
salla.event.on('profile::verification', data => {
|
|
9986
9988
|
var _a;
|
|
9987
9989
|
this.isProfileVerify = true;
|
|
@@ -10047,11 +10049,11 @@ const SallaVerify = class {
|
|
|
10047
10049
|
this.otpInputs.forEach(input => input.value && otp.push(input.value));
|
|
10048
10050
|
this.code.value = otp.join('');
|
|
10049
10051
|
if (otp.length === 4) {
|
|
10050
|
-
this.btn.
|
|
10052
|
+
this.btn.disable();
|
|
10051
10053
|
this.btn.click();
|
|
10052
10054
|
return;
|
|
10053
10055
|
}
|
|
10054
|
-
this.btn.
|
|
10056
|
+
this.btn.enable();
|
|
10055
10057
|
}
|
|
10056
10058
|
reset() {
|
|
10057
10059
|
this.otpInputs.forEach((input) => input.value = '');
|
|
@@ -10091,14 +10093,17 @@ const SallaVerify = class {
|
|
|
10091
10093
|
.then(() => this.btn.stop() && this.btn.disable())
|
|
10092
10094
|
.then(() => this.modal.close())
|
|
10093
10095
|
.then(() => this.autoReload && window.location.reload())
|
|
10094
|
-
.catch(() =>
|
|
10096
|
+
.catch((error) => {
|
|
10097
|
+
salla.logger.error(error);
|
|
10098
|
+
this.btn.stop() && this.btn.enable() && this.reset();
|
|
10099
|
+
});
|
|
10095
10100
|
}
|
|
10096
10101
|
render() {
|
|
10097
10102
|
return this.display == 'inline' ? index$1.h(index$1.Host, null, this.myBody()) :
|
|
10098
10103
|
index$1.h("salla-modal", { width: "xs", class: "s-verify", ref: modal => this.modal = modal, "modal-title": this.title }, index$1.h("span", { slot: 'icon', innerHTML: AndroidPhoneIcon }), this.myBody());
|
|
10099
10104
|
}
|
|
10100
10105
|
myBody() {
|
|
10101
|
-
return (index$1.h("div", { class: "s-verify-body", ref: body => this.body = body }, index$1.h("div", { class: "s-verify-message", innerHTML: salla.lang.get('pages.profile.verify_message') }), index$1.h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }), index$1.h("div", { class: "s-verify-codes", dir: "ltr" }, [1, 2, 3, 4].map(() => index$1.h("input", { type: "text", maxlength: "1", class: "s-verify-input", required: true }))), index$1.h("div", { slot: "footer", class: "s-verify-footer" }, index$1.h("salla-button", { class: "s-verify-submit", "loader-position": 'center', disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')), index$1.h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el }, salla.lang.get('blocks.header.resend_after'), index$1.h("b", { class: "s-verify-timer", ref: el => this.timer = el })), index$1.h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit'))), index$1.h("slot", { name: "after-footer" })));
|
|
10106
|
+
return (index$1.h("div", { class: "s-verify-body", ref: body => this.body = body }, index$1.h("div", { class: "s-verify-message", innerHTML: salla.lang.get('pages.profile.verify_message') }), index$1.h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }), index$1.h("div", { class: "s-verify-codes", dir: "ltr" }, [1, 2, 3, 4].map(() => index$1.h("input", { type: "text", maxlength: "1", class: "s-verify-input", required: true }))), index$1.h("div", { slot: "footer", class: "s-verify-footer" }, index$1.h("salla-button", { class: "s-verify-submit", "loader-position": 'center', disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')), index$1.h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el }, salla.lang.get('blocks.header.resend_after'), index$1.h("b", { class: "s-verify-timer", ref: el => this.timer = el }), " "), index$1.h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit'))), index$1.h("slot", { name: "after-footer" })));
|
|
10102
10107
|
}
|
|
10103
10108
|
get host() { return index$1.getElement(this); }
|
|
10104
10109
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
7
|
|
|
8
|
-
const index = require('./index-
|
|
8
|
+
const index = require('./index-0d0167d5.js');
|
|
9
9
|
|
|
10
10
|
const sallaInstallmentCss = "#tabbyPromoWrapper{background:white;border-radius:0.375rem;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);margin-bottom:20px}.salla-y #tabbyPromoWrapper{border:1px solid var(--color-grey-dark);border-radius:12px}#tabbyPromoWrapper:hover{box-shadow:0 0 #0000, 0 0 #0000, 5px 10px 30px #2B2D340D}#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(--color-text);font-size:var(--font-sm);line-height:1.25;padding:18px 20px 18px 100px !important;background:white;border-radius:0.375rem;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1)}.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 #0000, 0 0 #0000, 5px 10px 30px #2B2D340D}.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 .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;top:18px;margin:0 !important}.ltr .tamara-product-widget .tamara-logo{right:20px;left:auto}.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}";
|
|
11
11
|
|
|
@@ -22,7 +22,7 @@ const SallaInstallment = class {
|
|
|
22
22
|
* Currency code
|
|
23
23
|
*/
|
|
24
24
|
this.currency = salla.config.get('user.currency_code');
|
|
25
|
-
|
|
25
|
+
document.addEventListener('twilight::ready', () => {
|
|
26
26
|
const installment = salla.config.get('store.settings.installments');
|
|
27
27
|
if (installment) {
|
|
28
28
|
this.tamaraIsActive = installment.indexOf('tamara_installment') != -1;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
7
|
|
|
8
|
-
const index = require('./index-
|
|
8
|
+
const index = require('./index-0d0167d5.js');
|
|
9
9
|
const search = require('./search-b487cc49.js');
|
|
10
10
|
|
|
11
11
|
const StoreAlt = `<!-- Generated by IcoMoon.io -->
|
|
@@ -14,7 +14,7 @@ export class SallaInstallment {
|
|
|
14
14
|
* Currency code
|
|
15
15
|
*/
|
|
16
16
|
this.currency = salla.config.get('user.currency_code');
|
|
17
|
-
|
|
17
|
+
document.addEventListener('twilight::ready', () => {
|
|
18
18
|
const installment = salla.config.get('store.settings.installments');
|
|
19
19
|
if (installment) {
|
|
20
20
|
this.tamaraIsActive = installment.indexOf('tamara_installment') != -1;
|
|
@@ -43,8 +43,9 @@ export class SallaLoginModal {
|
|
|
43
43
|
this.loginBySMS = async () => {
|
|
44
44
|
const { phone, countryCode } = await this.loginTelInput.getValues();
|
|
45
45
|
const isPhoneValid = await this.loginTelInput.isValid();
|
|
46
|
-
if (!isPhoneValid)
|
|
46
|
+
if (!isPhoneValid) {
|
|
47
47
|
return;
|
|
48
|
+
}
|
|
48
49
|
this.login(this.smsBtn, { type: 'mobile', phone: phone, country_code: countryCode });
|
|
49
50
|
};
|
|
50
51
|
this.loginByEmail = () => {
|
|
@@ -71,7 +72,10 @@ export class SallaLoginModal {
|
|
|
71
72
|
this.verifyTab.getCode()
|
|
72
73
|
.then(code => salla.auth.api.register(Object.assign(Object.assign({}, data), { code })))
|
|
73
74
|
.then(() => salla.auth.canRedirect && window.location.reload())
|
|
74
|
-
.catch(() =>
|
|
75
|
+
.catch((error) => {
|
|
76
|
+
salla.logger.error(error);
|
|
77
|
+
this.regBtn.stop() && this.regBtn.enable();
|
|
78
|
+
});
|
|
75
79
|
};
|
|
76
80
|
this.title = this.host.title || salla.lang.get('blocks.header.login');
|
|
77
81
|
this.host.removeAttribute('title');
|
|
@@ -35,6 +35,7 @@ export class SallaSocialShare {
|
|
|
35
35
|
const script = document.createElement('script');
|
|
36
36
|
script.src = 'https://static.addtoany.com/menu/page.js';
|
|
37
37
|
script.setAttribute('id', 'a2a-script');
|
|
38
|
+
script.async = true;
|
|
38
39
|
script.onload = function () {
|
|
39
40
|
// ? this will not work if there is one share component in the page
|
|
40
41
|
window.a2a_config = window.a2a_config || {};
|
|
@@ -94,11 +95,6 @@ export class SallaSocialShare {
|
|
|
94
95
|
}))));
|
|
95
96
|
}))));
|
|
96
97
|
}
|
|
97
|
-
componentDidLoad() {
|
|
98
|
-
var script = document.createElement('script');
|
|
99
|
-
script.setAttribute('src', 'https://static.addtoany.com/menu/page.js');
|
|
100
|
-
document.head.appendChild(script);
|
|
101
|
-
}
|
|
102
98
|
static get is() { return "salla-social-share"; }
|
|
103
99
|
static get originalStyleUrls() { return {
|
|
104
100
|
"$": ["salla-social-share.scss"]
|
|
@@ -53,12 +53,13 @@ export class SallaTelInput {
|
|
|
53
53
|
return true;
|
|
54
54
|
if (!this.phoneInput.value.trim()) {
|
|
55
55
|
this.phoneInput.classList.add("s-has-error");
|
|
56
|
-
this.errorMsg.innerText = this.mobileRequired || '';
|
|
56
|
+
this.errorMsg.innerText = this.mobileRequired || 'The mobile is required';
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
this.phoneInput.classList.add("s-has-error");
|
|
60
60
|
let errorCode = this.iti.getValidationError();
|
|
61
61
|
this.errorMsg.innerText = this.errorMap[errorCode] || '';
|
|
62
|
+
salla.logger.info('Phone number (' + this.countryCode + ' - ' + this.phone + ') is not valid, error code ' + errorCode);
|
|
62
63
|
return false;
|
|
63
64
|
}
|
|
64
65
|
initTelInput() {
|
|
@@ -39,6 +39,7 @@ export class SallaVerify {
|
|
|
39
39
|
this.modal = { open: () => '', close: () => '', setTitle: () => '' };
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
+
//salla.profile.event.verificationCodeSent({});
|
|
42
43
|
salla.event.on('profile::verification', data => {
|
|
43
44
|
var _a;
|
|
44
45
|
this.isProfileVerify = true;
|
|
@@ -104,11 +105,11 @@ export class SallaVerify {
|
|
|
104
105
|
this.otpInputs.forEach(input => input.value && otp.push(input.value));
|
|
105
106
|
this.code.value = otp.join('');
|
|
106
107
|
if (otp.length === 4) {
|
|
107
|
-
this.btn.
|
|
108
|
+
this.btn.disable();
|
|
108
109
|
this.btn.click();
|
|
109
110
|
return;
|
|
110
111
|
}
|
|
111
|
-
this.btn.
|
|
112
|
+
this.btn.enable();
|
|
112
113
|
}
|
|
113
114
|
reset() {
|
|
114
115
|
this.otpInputs.forEach((input) => input.value = '');
|
|
@@ -148,7 +149,10 @@ export class SallaVerify {
|
|
|
148
149
|
.then(() => this.btn.stop() && this.btn.disable())
|
|
149
150
|
.then(() => this.modal.close())
|
|
150
151
|
.then(() => this.autoReload && window.location.reload())
|
|
151
|
-
.catch(() =>
|
|
152
|
+
.catch((error) => {
|
|
153
|
+
salla.logger.error(error);
|
|
154
|
+
this.btn.stop() && this.btn.enable() && this.reset();
|
|
155
|
+
});
|
|
152
156
|
}
|
|
153
157
|
render() {
|
|
154
158
|
return this.display == 'inline' ? h(Host, null, this.myBody()) :
|
|
@@ -165,7 +169,8 @@ export class SallaVerify {
|
|
|
165
169
|
h("salla-button", { class: "s-verify-submit", "loader-position": 'center', disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')),
|
|
166
170
|
h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el },
|
|
167
171
|
salla.lang.get('blocks.header.resend_after'),
|
|
168
|
-
h("b", { class: "s-verify-timer", ref: el => this.timer = el })
|
|
172
|
+
h("b", { class: "s-verify-timer", ref: el => this.timer = el }),
|
|
173
|
+
" "),
|
|
169
174
|
h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit'))),
|
|
170
175
|
h("slot", { name: "after-footer" })));
|
|
171
176
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import "../../assets/translations.js";
|
|
5
4
|
import '@salla.sa/twilight/dist/cjs/index';
|
|
6
5
|
export default function () {
|
|
7
6
|
salla.init({
|
|
@@ -23,8 +22,12 @@ export default function () {
|
|
|
23
22
|
},
|
|
24
23
|
});
|
|
25
24
|
// this is required to bypass cloudflare in stage
|
|
26
|
-
salla.api.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
if (salla.api.axios) {
|
|
26
|
+
salla.api.axios.defaults.headers.common['CF-Access-Client-Id'] = '2db165f2f48c6b43320719d5d17ef7cf.access';
|
|
27
|
+
salla.api.axios.defaults.headers.common['CF-Access-Client-Secret'] = '';
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
salla.api.defaults.headers.common['CF-Access-Client-Id'] = '2db165f2f48c6b43320719d5d17ef7cf.access';
|
|
31
|
+
salla.api.defaults.headers.common['CF-Access-Client-Secret'] = '';
|
|
32
|
+
}
|
|
30
33
|
}
|
|
@@ -19,7 +19,7 @@ const SallaInstallment$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
19
19
|
* Currency code
|
|
20
20
|
*/
|
|
21
21
|
this.currency = salla.config.get('user.currency_code');
|
|
22
|
-
|
|
22
|
+
document.addEventListener('twilight::ready', () => {
|
|
23
23
|
const installment = salla.config.get('store.settings.installments');
|
|
24
24
|
if (installment) {
|
|
25
25
|
this.tamaraIsActive = installment.indexOf('tamara_installment') != -1;
|
|
@@ -54,8 +54,9 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
54
54
|
this.loginBySMS = async () => {
|
|
55
55
|
const { phone, countryCode } = await this.loginTelInput.getValues();
|
|
56
56
|
const isPhoneValid = await this.loginTelInput.isValid();
|
|
57
|
-
if (!isPhoneValid)
|
|
57
|
+
if (!isPhoneValid) {
|
|
58
58
|
return;
|
|
59
|
+
}
|
|
59
60
|
this.login(this.smsBtn, { type: 'mobile', phone: phone, country_code: countryCode });
|
|
60
61
|
};
|
|
61
62
|
this.loginByEmail = () => {
|
|
@@ -82,7 +83,10 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
82
83
|
this.verifyTab.getCode()
|
|
83
84
|
.then(code => salla.auth.api.register(Object.assign(Object.assign({}, data), { code })))
|
|
84
85
|
.then(() => salla.auth.canRedirect && window.location.reload())
|
|
85
|
-
.catch(() =>
|
|
86
|
+
.catch((error) => {
|
|
87
|
+
salla.logger.error(error);
|
|
88
|
+
this.regBtn.stop() && this.regBtn.enable();
|
|
89
|
+
});
|
|
86
90
|
};
|
|
87
91
|
this.title = this.host.title || salla.lang.get('blocks.header.login');
|
|
88
92
|
this.host.removeAttribute('title');
|
|
@@ -1386,6 +1386,7 @@ const SallaSocialShare$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
1386
1386
|
const script = document.createElement('script');
|
|
1387
1387
|
script.src = 'https://static.addtoany.com/menu/page.js';
|
|
1388
1388
|
script.setAttribute('id', 'a2a-script');
|
|
1389
|
+
script.async = true;
|
|
1389
1390
|
script.onload = function () {
|
|
1390
1391
|
// ? this will not work if there is one share component in the page
|
|
1391
1392
|
window.a2a_config = window.a2a_config || {};
|
|
@@ -1440,11 +1441,6 @@ const SallaSocialShare$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
1440
1441
|
}))));
|
|
1441
1442
|
}))));
|
|
1442
1443
|
}
|
|
1443
|
-
componentDidLoad() {
|
|
1444
|
-
var script = document.createElement('script');
|
|
1445
|
-
script.setAttribute('src', 'https://static.addtoany.com/menu/page.js');
|
|
1446
|
-
document.head.appendChild(script);
|
|
1447
|
-
}
|
|
1448
1444
|
static get style() { return sallaSocialShareCss; }
|
|
1449
1445
|
}, [4, "salla-social-share", {
|
|
1450
1446
|
"url": [513],
|
|
@@ -1431,12 +1431,13 @@ const SallaTelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
1431
1431
|
return true;
|
|
1432
1432
|
if (!this.phoneInput.value.trim()) {
|
|
1433
1433
|
this.phoneInput.classList.add("s-has-error");
|
|
1434
|
-
this.errorMsg.innerText = this.mobileRequired || '';
|
|
1434
|
+
this.errorMsg.innerText = this.mobileRequired || 'The mobile is required';
|
|
1435
1435
|
return;
|
|
1436
1436
|
}
|
|
1437
1437
|
this.phoneInput.classList.add("s-has-error");
|
|
1438
1438
|
let errorCode = this.iti.getValidationError();
|
|
1439
1439
|
this.errorMsg.innerText = this.errorMap[errorCode] || '';
|
|
1440
|
+
salla.logger.info('Phone number (' + this.countryCode + ' - ' + this.phone + ') is not valid, error code ' + errorCode);
|
|
1440
1441
|
return false;
|
|
1441
1442
|
}
|
|
1442
1443
|
initTelInput() {
|
|
@@ -50,6 +50,7 @@ const SallaVerify = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
50
50
|
this.modal = { open: () => '', close: () => '', setTitle: () => '' };
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
+
//salla.profile.event.verificationCodeSent({});
|
|
53
54
|
salla.event.on('profile::verification', data => {
|
|
54
55
|
var _a;
|
|
55
56
|
this.isProfileVerify = true;
|
|
@@ -115,11 +116,11 @@ const SallaVerify = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
115
116
|
this.otpInputs.forEach(input => input.value && otp.push(input.value));
|
|
116
117
|
this.code.value = otp.join('');
|
|
117
118
|
if (otp.length === 4) {
|
|
118
|
-
this.btn.
|
|
119
|
+
this.btn.disable();
|
|
119
120
|
this.btn.click();
|
|
120
121
|
return;
|
|
121
122
|
}
|
|
122
|
-
this.btn.
|
|
123
|
+
this.btn.enable();
|
|
123
124
|
}
|
|
124
125
|
reset() {
|
|
125
126
|
this.otpInputs.forEach((input) => input.value = '');
|
|
@@ -159,14 +160,17 @@ const SallaVerify = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
159
160
|
.then(() => this.btn.stop() && this.btn.disable())
|
|
160
161
|
.then(() => this.modal.close())
|
|
161
162
|
.then(() => this.autoReload && window.location.reload())
|
|
162
|
-
.catch(() =>
|
|
163
|
+
.catch((error) => {
|
|
164
|
+
salla.logger.error(error);
|
|
165
|
+
this.btn.stop() && this.btn.enable() && this.reset();
|
|
166
|
+
});
|
|
163
167
|
}
|
|
164
168
|
render() {
|
|
165
169
|
return this.display == 'inline' ? h(Host, null, this.myBody()) :
|
|
166
170
|
h("salla-modal", { width: "xs", class: "s-verify", ref: modal => this.modal = modal, "modal-title": this.title }, h("span", { slot: 'icon', innerHTML: AndroidPhoneIcon }), this.myBody());
|
|
167
171
|
}
|
|
168
172
|
myBody() {
|
|
169
|
-
return (h("div", { class: "s-verify-body", ref: body => this.body = body }, h("div", { class: "s-verify-message", innerHTML: salla.lang.get('pages.profile.verify_message') }), h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }), h("div", { class: "s-verify-codes", dir: "ltr" }, [1, 2, 3, 4].map(() => h("input", { type: "text", maxlength: "1", class: "s-verify-input", required: true }))), h("div", { slot: "footer", class: "s-verify-footer" }, h("salla-button", { class: "s-verify-submit", "loader-position": 'center', disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')), h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el }, salla.lang.get('blocks.header.resend_after'), h("b", { class: "s-verify-timer", ref: el => this.timer = el })), h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit'))), h("slot", { name: "after-footer" })));
|
|
173
|
+
return (h("div", { class: "s-verify-body", ref: body => this.body = body }, h("div", { class: "s-verify-message", innerHTML: salla.lang.get('pages.profile.verify_message') }), h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }), h("div", { class: "s-verify-codes", dir: "ltr" }, [1, 2, 3, 4].map(() => h("input", { type: "text", maxlength: "1", class: "s-verify-input", required: true }))), h("div", { slot: "footer", class: "s-verify-footer" }, h("salla-button", { class: "s-verify-submit", "loader-position": 'center', disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')), h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el }, salla.lang.get('blocks.header.resend_after'), h("b", { class: "s-verify-timer", ref: el => this.timer = el }), " "), h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit'))), h("slot", { name: "after-footer" })));
|
|
170
174
|
}
|
|
171
175
|
get host() { return this; }
|
|
172
176
|
static get style() { return sallaVerifyCss; }
|
|
File without changes
|
package/dist/esm/loader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
4
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-4e30ffd0.js';
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
Stencil Client Patch Esm v2.17.4 | MIT Licensed | https://stenciljs.com
|
|
@@ -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, g as getElement } from './index-
|
|
4
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-4e30ffd0.js';
|
|
5
5
|
|
|
6
6
|
const sallaAddProductButtonCss = ":host{display:block}salla-add-product-button[width=wide]{width:100%}";
|
|
7
7
|
|