@salla.sa/twilight-components 1.0.27 → 1.0.31

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.
Files changed (49) hide show
  1. package/dist/cjs/index.cjs.js +2 -3
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/salla-branches.cjs.entry.js +2 -5
  4. package/dist/cjs/{salla-button_5.cjs.entry.js → salla-button_7.cjs.entry.js} +87 -7
  5. package/dist/cjs/salla-product-availability.cjs.entry.js +11 -11
  6. package/dist/cjs/{salla-login-15aff630.js → salla-search-257561ac.js} +74 -0
  7. package/dist/cjs/twilight-components.cjs.js +1 -1
  8. package/dist/collection/components/salla-branches/salla-branches.js +2 -5
  9. package/dist/collection/components/salla-button/salla-button.js +26 -0
  10. package/dist/collection/components/salla-product-availability/salla-product-availability.js +13 -16
  11. package/dist/collection/components/salla-search/salla-search.js +1 -0
  12. package/dist/collection/components/salla-tel-input/salla-tel-input.js +4 -6
  13. package/dist/collection/plugins/tailwind-theme/index.js +16 -1
  14. package/dist/esm/index.js +1 -2
  15. package/dist/esm/loader.js +1 -1
  16. package/dist/esm/salla-branches.entry.js +2 -5
  17. package/dist/esm/{salla-button_5.entry.js → salla-button_7.entry.js} +85 -7
  18. package/dist/esm/salla-product-availability.entry.js +11 -11
  19. package/dist/esm/{salla-login-e6e86a3d.js → salla-search-c30c12ef.js} +74 -1
  20. package/dist/esm/twilight-components.js +1 -1
  21. package/dist/twilight-components/index.esm.js +1 -1
  22. package/dist/twilight-components/{p-f97ea1f7.js → p-1ec2f128.js} +1 -1
  23. package/dist/twilight-components/p-562fd1e3.entry.js +1 -0
  24. package/dist/twilight-components/p-8d941a1f.entry.js +1 -0
  25. package/dist/twilight-components/p-9cabc8a4.entry.js +1 -0
  26. package/dist/twilight-components/twilight-components.esm.js +1 -1
  27. package/dist/types/components/salla-button/salla-button.d.ts +1 -0
  28. package/dist/types/components/salla-product-availability/salla-product-availability.d.ts +2 -3
  29. package/dist/types/components/salla-tel-input/salla-tel-input.d.ts +1 -1
  30. package/dist/types/components.d.ts +1 -0
  31. package/example/assets/tailwind.css +3 -0
  32. package/example/dist/tailwind.css +2891 -0
  33. package/example/index.html +77 -0
  34. package/example/package-lock.json +1073 -0
  35. package/example/package.json +17 -0
  36. package/example/tailwind.config.js +48 -0
  37. package/package.json +3 -2
  38. package/dist/cjs/salla-localization.cjs.entry.js +0 -84
  39. package/dist/cjs/salla-search-eb0112c0.js +0 -78
  40. package/dist/cjs/salla-search.cjs.entry.js +0 -11
  41. package/dist/esm/salla-localization.entry.js +0 -80
  42. package/dist/esm/salla-search-57bd45eb.js +0 -76
  43. package/dist/esm/salla-search.entry.js +0 -3
  44. package/dist/twilight-components/p-47f3d098.entry.js +0 -1
  45. package/dist/twilight-components/p-5bf5ce53.entry.js +0 -1
  46. package/dist/twilight-components/p-8cce4c31.entry.js +0 -1
  47. package/dist/twilight-components/p-932906dc.entry.js +0 -1
  48. package/dist/twilight-components/p-b195e28c.entry.js +0 -1
  49. package/dist/twilight-components/p-e7edc889.js +0 -1
@@ -2,12 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const sallaLogin = require('./salla-login-15aff630.js');
6
- const sallaSearch = require('./salla-search-eb0112c0.js');
5
+ const sallaSearch = require('./salla-search-257561ac.js');
7
6
  require('./index-714023c8.js');
8
7
  require('./Helper-fcea994c.js');
9
8
 
10
9
 
11
10
 
12
- exports.SallaLogin = sallaLogin.SallaLogin;
11
+ exports.SallaLogin = sallaSearch.SallaLogin;
13
12
  exports.SallaSearch = sallaSearch.SallaSearch;
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["salla-button_5.cjs",[[0,"salla-login",{"isEmailAllowed":[4,"is-email-allowed"],"isMobileAllowed":[4,"is-mobile-allowed"],"isEmailRequired":[4,"is-email-required"],"title":[32],"loginTypeTitle":[32],"loginText":[32],"smsLabel":[32],"mobileLabel":[32],"emailLabel":[32],"enterText":[32],"bySMSText":[32],"byEmailText":[32],"emailErrorMsg":[32],"firstNameLabel":[32],"lastNameLabel":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"show":[64]},[[0,"verified","onVerified"],[0,"backClicked","onbackClicked"]]],[0,"salla-verify",{"withoutModal":[4,"without-modal"],"url":[513],"by":[1],"isShowBack":[4,"is-show-back"],"autoReload":[4,"auto-reload"],"title":[32],"getCode":[64],"show":[64]}],[0,"salla-tel-input",{"mobile":[1025],"countryCode":[1025,"country-code"],"countryKey":[1025,"country-key"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-button",{"btnStyle":[513,"btn-style"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"stop":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"error":[4],"success":[4],"primary":[4],"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"icon":[1],"imageIcon":[1,"image-icon"],"title":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-product-availability.cjs",[[4,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"subscribeText":[32],"cancelText":[32],"subTitle":[32],"mobileLabel":[32],"emailLabel":[32],"emailPlaceholder":[32],"subscribedMessage":[32],"title_":[32],"buttonText":[32],"emailErrorMsg":[32]}]]],["salla-branches.cjs",[[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"ok":[32],"show":[64],"hide":[64]}]]],["salla-localization.cjs",[[4,"salla-localization",{"languagesTitle":[32],"currenciesTitle":[32],"ok":[32],"show":[64],"hide":[64],"submit":[64]}]]],["salla-offer.cjs",[[0,"salla-offer",{"offer":[32],"show":[64]}]]],["salla-rating.cjs",[[0,"salla-rating",{"order":[32],"show":[64],"hide":[64]}]]],["salla-search.cjs",[[0,"salla-search",{"results":[32],"placeholder":[32],"noResultsText":[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]]]],["salla-infinite-scroll.cjs",[[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[4],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}]]]], options);
17
+ return index.bootstrapLazy([["salla-button_7.cjs",[[0,"salla-login",{"isEmailAllowed":[4,"is-email-allowed"],"isMobileAllowed":[4,"is-mobile-allowed"],"isEmailRequired":[4,"is-email-required"],"title":[32],"loginTypeTitle":[32],"loginText":[32],"smsLabel":[32],"mobileLabel":[32],"emailLabel":[32],"enterText":[32],"bySMSText":[32],"byEmailText":[32],"emailErrorMsg":[32],"firstNameLabel":[32],"lastNameLabel":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"show":[64]},[[0,"verified","onVerified"],[0,"backClicked","onbackClicked"]]],[4,"salla-localization",{"languagesTitle":[32],"currenciesTitle":[32],"ok":[32],"show":[64],"hide":[64],"submit":[64]}],[0,"salla-search",{"results":[32],"placeholder":[32],"noResultsText":[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]],[0,"salla-verify",{"withoutModal":[4,"without-modal"],"url":[513],"by":[1],"isShowBack":[4,"is-show-back"],"autoReload":[4,"auto-reload"],"title":[32],"getCode":[64],"show":[64]}],[0,"salla-tel-input",{"mobile":[1025],"countryCode":[1025,"country-code"],"countryKey":[1025,"country-key"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-button",{"btnStyle":[513,"btn-style"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"setText":[64],"stop":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"error":[4],"success":[4],"primary":[4],"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"icon":[1],"imageIcon":[1,"image-icon"],"title":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-product-availability.cjs",[[4,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"subTitle":[32],"mobileLabel":[32],"emailLabel":[32],"emailPlaceholder":[32],"subscribedMessage":[32],"title_":[32],"emailErrorMsg":[32]}]]],["salla-branches.cjs",[[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"ok":[32],"show":[64],"hide":[64]}]]],["salla-offer.cjs",[[0,"salla-offer",{"offer":[32],"show":[64]}]]],["salla-rating.cjs",[[0,"salla-rating",{"order":[32],"show":[64],"hide":[64]}]]],["salla-infinite-scroll.cjs",[[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[4],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -6,14 +6,11 @@ const index = require('./index-714023c8.js');
6
6
 
7
7
  const sallaBranchesCss = ":host{display:block}";
8
8
 
9
- let engine = require('store/src/store-engine');
10
- let storages = require('store/storages/sessionStorage');
11
- let sessionStore = engine.createStore(storages);
12
9
  const SallaBranches = class {
13
10
  constructor(hostRef) {
14
11
  index.registerInstance(this, hostRef);
15
12
  this.open = false;
16
- this.isOpenedBefore = sessionStore.get("branch-choosed-before");
13
+ this.isOpenedBefore = salla.localData.get("branch-choosed-before");
17
14
  this.displayAs = 'default';
18
15
  this.browseProductsFrom = 'all';
19
16
  this.branches = [
@@ -59,7 +56,7 @@ const SallaBranches = class {
59
56
  this.btn.load().then(() => {
60
57
  setTimeout(() => location.reload(), 2000);
61
58
  });
62
- sessionStore.set("branch-choosed-before", true);
59
+ salla.localData.set("branch-choosed-before", true);
63
60
  this.show();
64
61
  setTimeout(() => {
65
62
  this.current = this.selected;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-714023c8.js');
6
6
  const Helper = require('./Helper-fcea994c.js');
7
- const sallaLogin = require('./salla-login-15aff630.js');
7
+ const sallaSearch = require('./salla-search-257561ac.js');
8
8
 
9
9
  const sallaButtonCss = ":host{display:block}";
10
10
 
@@ -39,6 +39,10 @@ const SallaButton = class {
39
39
  this.host.setAttribute('loading', '');
40
40
  return this.host;
41
41
  }
42
+ async setText(html) {
43
+ this.text.innerHTML = html;
44
+ return this.host;
45
+ }
42
46
  async stop() {
43
47
  this.host.removeAttribute('loading');
44
48
  if (this.loaderPosition == 'center')
@@ -79,6 +83,82 @@ const SallaButton = class {
79
83
  };
80
84
  SallaButton.style = sallaButtonCss;
81
85
 
86
+ const SallaLocalization = class {
87
+ constructor(hostRef) {
88
+ index.registerInstance(this, hostRef);
89
+ var _a, _b;
90
+ this.language = salla.config.get('language', {});
91
+ this.currency = salla.config.get('currency', {});
92
+ Helper.Helper.setHost(this.host);
93
+ salla.event.on('localization::show', () => this.show());
94
+ salla.event.on('languages::translations.loaded', () => {
95
+ this.languagesTitle = salla.lang.get('common.titles.language');
96
+ this.currenciesTitle = salla.lang.get('common.titles.currency');
97
+ this.ok = salla.lang.get('common.elements.ok');
98
+ });
99
+ /**
100
+ * letting developer to insert his own slot like:
101
+ * <salla-localization>
102
+ * <div slot="language">...{name}....</div>
103
+ * <div slot="currency">...{name}....</div>
104
+ * </salla-localization>
105
+ * Because scoped templates not supported in stencil );
106
+ * we made a workaround to pass language & currency attributes, then replace names in rendering
107
+ */
108
+ this.languageSlot = ((_a = Helper.Helper.getElement('[slot="language"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<label class="s-localization-label" for="lang-{code}"><span>{name}</span><div class="s-localization-flag flag iti__flag iti__{country_code}"></div></label>';
109
+ this.currencySlot = ((_b = Helper.Helper.getElement('[slot="currency"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || '<label class="s-localization-label" for="currency-{code}"><span>{name}</span><small class="s-localization-currency">{code}</small></label>';
110
+ this.languages = Object.values(salla.config.get('languages', {}));
111
+ this.currencies = Object.values(salla.config.get('currencies', {}));
112
+ }
113
+ async show() {
114
+ return this.modal.show();
115
+ }
116
+ async hide() {
117
+ return this.modal.hide();
118
+ }
119
+ onChangeCurrency(event) {
120
+ this.currency = salla.config.get('currencies.' + event.target.value);
121
+ }
122
+ onChangeLanguage(event) {
123
+ this.language = salla.config.get('languages.' + event.target.value);
124
+ }
125
+ async submit() {
126
+ let url;
127
+ console.log('this.currency.code::::', this.currency, this.currency.code);
128
+ this.btn.load()
129
+ .then(() => this.currency.code === salla.config.get('user.currency') || ((url = window.location.href) && salla.currency.api.change(this.currency.code)))
130
+ .then(() => this.language.code === salla.config.get('user.language') || (url = this.language.url))
131
+ .then(() => this.btn.stop())
132
+ .then(() => this.hide())
133
+ .then(() => url && (window.location.href = url));
134
+ }
135
+ render() {
136
+ return (index.h("salla-modal", { id: "salla-localization", class: "hidden", ref: modal => this.modal = modal, width: "xs" }, index.h("div", { slot: "header" }, index.h("slot", { name: "header" })), index.h("div", { class: "s-localization-inner" }, this.languages.length > 1 ?
137
+ index.h("div", { class: "s-localization-section" }, index.h("label", { class: "s-localization-title" }, this.languagesTitle), index.h("div", { class: "s-localization-section-inner" }, this.languages.length < 6 ?
138
+ this.languages.map(lang => index.h("div", { class: "s-localization-item" }, index.h("input", { class: "s-localization-input", type: "radio", checked: this.language.code == lang.code, onChange: () => this.language = lang, name: "language", id: 'lang-' + lang.code.toLowerCase(), value: lang.code }), index.h("div", { id: "language-slot", innerHTML: this.languageSlot
139
+ .replace(/\{name\}/g, lang.name)
140
+ .replace(/\{code\}/g, lang.code)
141
+ .replace(/\{country_code\}/g, lang.country_code) }))) :
142
+ index.h("select", { class: "s-branches-select", name: "currency", onChange: e => this.onChangeLanguage(e) }, this.languages.map(lang => index.h("option", { value: lang.code, selected: this.language.code == lang.code }, lang.name)))))
143
+ : '', this.currencies.length > 1 ?
144
+ index.h("div", { class: "s-localization-section" }, index.h("label", { class: "s-localization-title" }, this.currenciesTitle), index.h("div", { class: "s-localization-section-inner" }, this.currencies.length < 6 ?
145
+ this.currencies.map(currency => index.h("div", { class: "s-localization-item" }, index.h("input", { class: "s-localization-input", type: "radio", name: "currency", checked: this.currency.code == currency.code, onChange: () => this.currency = currency, id: 'currency-' + currency.code, value: currency.code }), index.h("div", { id: "currency-slot", innerHTML: this.currencySlot
146
+ .replace(/\{name\}/g, currency.name)
147
+ .replace(/\{code\}/g, currency.code)
148
+ .replace(/\{country_code\}/g, currency.country_code) }))) :
149
+ index.h("select", { class: "s-branches-select", name: "currency", onChange: e => this.onChangeCurrency(e) }, this.currencies.map(currency => index.h("option", { value: currency.code, selected: this.currency.code == currency.code }, currency.name)))))
150
+ : ''), index.h("slot", { name: "footer" }, index.h("salla-button", { wide: true, ref: btn => this.btn = btn, onClick: () => this.submit() }, this.ok))));
151
+ }
152
+ /**
153
+ * to reduce dom levels we will move slot data into the parent dom
154
+ */
155
+ componentDidRender() {
156
+ this.host.querySelectorAll('#currency-slot').forEach(el => el.replaceWith(el.firstChild));
157
+ this.host.querySelectorAll('#language-slot').forEach(el => el.replaceWith(el.firstChild));
158
+ }
159
+ get host() { return index.getElement(this); }
160
+ };
161
+
82
162
  const sallaModalCss = "";
83
163
 
84
164
  const SallaModal = class {
@@ -1570,8 +1650,8 @@ const SallaTelInput = class {
1570
1650
  constructor(hostRef) {
1571
1651
  index.registerInstance(this, hostRef);
1572
1652
  this.enterClicked = index.createEvent(this, "enterClicked", 7);
1573
- this.countryCode = "SA";
1574
- this.countryKey = "+966";
1653
+ this.countryCode = salla.config.get('user.country_code', 'SA');
1654
+ this.countryKey = "+966"; //TODO:: why we need it
1575
1655
  this.countryCodeLabel = salla.lang.get('common.country_code');
1576
1656
  this.mobileLabel = salla.lang.get('common.elements.mobile');
1577
1657
  this.tooShort = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });
@@ -1633,9 +1713,7 @@ const SallaTelInput = class {
1633
1713
  this.isValid();
1634
1714
  });
1635
1715
  // on keyup / change flag: reset
1636
- this.phoneInput.addEventListener('keyup', e => {
1637
- if (e.key == 'Enter')
1638
- return;
1716
+ this.phoneInput.addEventListener('input', e => {
1639
1717
  salla.helpers.digitsOnly(e.target);
1640
1718
  this.reset();
1641
1719
  });
@@ -1784,8 +1862,10 @@ const SallaVerify = class {
1784
1862
  get host() { return index.getElement(this); }
1785
1863
  };
1786
1864
 
1787
- exports.salla_login = sallaLogin.SallaLogin;
1865
+ exports.salla_login = sallaSearch.SallaLogin;
1866
+ exports.salla_search = sallaSearch.SallaSearch;
1788
1867
  exports.salla_button = SallaButton;
1868
+ exports.salla_localization = SallaLocalization;
1789
1869
  exports.salla_modal = SallaModal;
1790
1870
  exports.salla_tel_input = SallaTelInput;
1791
1871
  exports.salla_verify = SallaVerify;
@@ -9,7 +9,7 @@ const SallaProductAvailability = class {
9
9
  constructor(hostRef) {
10
10
  index.registerInstance(this, hostRef);
11
11
  this.isUser = Helper.Helper.isUser();
12
- this.productId = salla.get('page.id');
12
+ this.productId = salla.config.get('page.id');
13
13
  this.isSubscribed = false;
14
14
  // @Method()
15
15
  this.submit = async () => {
@@ -20,7 +20,7 @@ const SallaProductAvailability = class {
20
20
  let { mobile, countryCode } = await this.mobileInput.getValues(), data = { id: this.productId, country_code: countryCode };
21
21
  mobile !== '' && (data['mobile'] = mobile);
22
22
  this.email.value !== '' && (data['email'] = this.email.value);
23
- await this.validateform({ mobile: mobile, email: this.email.value });
23
+ await this.validateform();
24
24
  return this.btn.load()
25
25
  .then(() => this.btn.disable())
26
26
  .then(() => salla.api.product.availabilitySubscribe(data))
@@ -43,31 +43,31 @@ const SallaProductAvailability = class {
43
43
  this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
44
44
  this.host.removeAttribute('title');
45
45
  salla.event.on('languages::translations.loaded', () => {
46
- var _a;
46
+ var _a, _b, _c, _d;
47
47
  this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
48
- this.subscribeText = salla.lang.get('common.elements.submit');
49
- this.cancelText = salla.lang.get('common.elements.cancel');
50
48
  this.subTitle = salla.lang.get('pages.products.notify_availability_subtitle');
51
49
  this.mobileLabel = salla.lang.get('common.elements.mobile');
52
50
  this.emailLabel = salla.lang.get('common.elements.email');
53
51
  this.emailPlaceholder = salla.lang.get('common.elements.email_placeholder');
54
52
  this.subscribedMessage = salla.lang.get('pages.products.notify_availability_success');
55
- this.buttonText = salla.lang.get('pages.products.notify_availability');
56
53
  this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');
57
54
  (_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(this.title_);
55
+ (_b = this.btn) === null || _b === void 0 ? void 0 : _b.setText(salla.lang.get('common.elements.submit'));
56
+ (_c = this.cancelBtn) === null || _c === void 0 ? void 0 : _c.setText(salla.lang.get('common.elements.cancel'));
57
+ (_d = this.inlineBtn) === null || _d === void 0 ? void 0 : _d.setText(salla.lang.get('pages.products.notify_availability'));
58
58
  });
59
59
  }
60
60
  channelsWatcher(newValue) {
61
61
  this.channels_ = newValue.split(',');
62
62
  }
63
- async validateform(data) {
64
- if (this.channels_.includes('email') && !data.mobile) {
63
+ async validateform() {
64
+ if (this.channels_.includes('email')) {
65
65
  const isEmailValid = Helper.Helper.isValidEmail(this.email.value);
66
66
  if (isEmailValid)
67
67
  return;
68
68
  !isEmailValid && this.validateField(this.email, this.emailErrorMsg);
69
69
  }
70
- if (this.channels_.includes('sms') && !data.email) {
70
+ if (this.channels_.includes('sms')) {
71
71
  const isPhoneValid = await this.mobileInput.isValid();
72
72
  if (isPhoneValid)
73
73
  return;
@@ -81,7 +81,7 @@ const SallaProductAvailability = class {
81
81
  render() {
82
82
  return (index.h(index.Host, null, this.isSubscribed
83
83
  ? index.h("div", { class: "s-product-availability-subscribed" }, index.h("i", { class: "sicon-bell-ring s-product-availability-subs-icon" }), " ", this.subscribedMessage)
84
- : index.h("slot", null, index.h("salla-button", { wide: true, onClick: () => this.isUser ? this.submit() : this.modal.show() }, this.buttonText)), this.isUser || this.isSubscribed ? '' : this.renderModal()));
84
+ : index.h("slot", null, index.h("salla-button", { onClick: () => this.isUser ? this.submit() : this.modal.show(), wide: true, ref: btn => this.inlineBtn = btn }, salla.lang.get('pages.products.notify_availability'))), this.isUser || this.isSubscribed ? '' : this.renderModal()));
85
85
  }
86
86
  renderModal() {
87
87
  return (index.h("salla-modal", { ref: modal => this.modal = modal, title: this.title_, subTitle: this.subTitle, icon: "sicon-bell-ring", width: "sm" }, index.h("div", { class: "s-product-availability-body" }, this.channels_.includes('email') ? [
@@ -91,7 +91,7 @@ const SallaProductAvailability = class {
91
91
  ] : '', this.channels_.includes('sms') ? [
92
92
  index.h("label", { class: "s-product-availability-label" }, this.mobileLabel),
93
93
  index.h("salla-tel-input", { ref: el => this.mobileInput = el, onKeyDown: e => this.typing(e, this.submit) })
94
- ] : ''), index.h("div", { slot: "footer", class: "s-product-availability-footer" }, index.h("salla-button", { wide: true, "btn-style": "outline", onClick: () => this.modal.hide() }, this.cancelText), index.h("salla-button", { "loader-position": 'center', wide: true, ref: btn => this.btn = btn, onClick: () => this.submit() }, this.subscribeText))));
94
+ ] : ''), index.h("div", { slot: "footer", class: "s-product-availability-footer" }, index.h("salla-button", { wide: true, "btn-style": "outline", onClick: () => this.modal.hide(), ref: btn => this.cancelBtn = btn }, salla.lang.get('common.elements.cancel')), index.h("salla-button", { "loader-position": 'center', wide: true, ref: btn => this.btn = btn, onClick: () => this.submit() }, salla.lang.get('common.elements.submit')))));
95
95
  }
96
96
  get host() { return index.getElement(this); }
97
97
  static get watchers() { return {
@@ -184,4 +184,78 @@ const SallaLogin = class {
184
184
  };
185
185
  SallaLogin.style = sallaLoginCss;
186
186
 
187
+ const sallaSearchCss = "#s-search-modal .s-modal-wrapper{align-items:flex-start;padding:0}#s-search-modal .s-modal-spacer{display:inline}#s-search-modal .s-modal-body{padding:0;max-width:90%;margin-top:3.2rem;border-radius:0.5rem}#s-search-modal .s-modal-close{top:1rem}";
188
+
189
+ const SallaSearch = class {
190
+ constructor(hostRef) {
191
+ index.registerInstance(this, hostRef);
192
+ var _a;
193
+ Helper.Helper.setHost(this.host);
194
+ this.productSlot = ((_a = Helper.Helper.getElement('[slot="product"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || this.getDefaultProductSlot();
195
+ salla.event.on('search::show', () => this.modal.show());
196
+ salla.event.on('languages::translations.loaded', () => {
197
+ this.placeholder = salla.lang.get('blocks.header.search_placeholder');
198
+ this.noResultsText = salla.lang.get('common.elements.no_options');
199
+ });
200
+ }
201
+ onModalOpen() {
202
+ this.modal.querySelector('.s-search-input').focus();
203
+ }
204
+ onModalClose() {
205
+ this.modal.querySelector('.s-search-input').value = '';
206
+ this.results = undefined;
207
+ this.afterSearching();
208
+ }
209
+ getDefaultProductSlot() {
210
+ return '<div class="s-search-product-image-container">' +
211
+ ' <img class="s-search-product-image" src="{image}" alt="{name}"/>' +
212
+ '</div>' +
213
+ '<div class="s-search-product-details">' +
214
+ ' <div class="s-search-product-name">{name}</div> <div class="s-search-product-price">{price}</div>' +
215
+ '</div>';
216
+ }
217
+ //todo:: reset data when closing
218
+ search(e) {
219
+ Helper.Helper.hideElement(this.noResults);
220
+ if (e.target.value.length === 0) {
221
+ this.results = undefined;
222
+ this.afterSearching();
223
+ return;
224
+ }
225
+ if (e.target.value.length <= 2) {
226
+ return;
227
+ }
228
+ //run loading spinner or stop it
229
+ Helper.Helper.toggleElement(this.searchIcon, 's-search-spinner-loader', 'sicon-search', () => true);
230
+ salla.search.api.search(e.target.value)
231
+ .then(response => this.results = response)
232
+ .catch(err => err !== 'Query Same As Previous!' ? this.results = undefined : null)
233
+ .finally(() => this.afterSearching(/*isEmpty*/ false));
234
+ }
235
+ afterSearching(isEmpty = true) {
236
+ var _a;
237
+ this.noResults.style.display = isEmpty || ((_a = this.results) === null || _a === void 0 ? void 0 : _a.data.length) > 0 ? 'none' : 'block';
238
+ Helper.Helper.toggleElement(this.container, 's-search-container-open', 'no-results', () => { var _a; return (_a = this.results) === null || _a === void 0 ? void 0 : _a.data.length; })
239
+ .toggleElement(this.searchIcon, 's-search-spinner-loader', 'sicon-search', () => false); //stop searching anime
240
+ salla.search.api.previousQuery = ''; //avoid having error 'Query Same As Previous' after reopen modal;
241
+ }
242
+ render() {
243
+ var _a;
244
+ return (index.h("salla-modal", { position: "top", id: "s-search-modal", ref: modal => this.modal = modal }, index.h("div", { class: "s-search-container", ref: container => this.container = container }, index.h("input", { class: "s-search-input", type: "text", placeholder: this.placeholder, onInput: e => this.search(e) }), index.h("span", { class: "s-search-icon" }, index.h("i", { class: "sicon-search", ref: el => this.searchIcon = el })), index.h("div", { class: "s-search-results" }, (_a = this.results) === null || _a === void 0 ? void 0 :
245
+ _a.data.map(item => index.h("a", { href: item.url, class: "s-search-product", innerHTML: this.productSlot
246
+ .replace(/\{name\}/g, item.name)
247
+ .replace(/\{price\}/g, item.price) //todo:: get discounted price too
248
+ .replace(/\{image\}/g, item.image_url) })), index.h("p", { ref: el => this.noResults = el, class: "s-search-no-results" }, this.noResultsText)))));
249
+ }
250
+ /**
251
+ * Run it one time after load
252
+ */
253
+ componentDidLoad() {
254
+ this.afterSearching();
255
+ }
256
+ get host() { return index.getElement(this); }
257
+ };
258
+ SallaSearch.style = sallaSearchCss;
259
+
187
260
  exports.SallaLogin = SallaLogin;
261
+ exports.SallaSearch = SallaSearch;
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["salla-button_5.cjs",[[0,"salla-login",{"isEmailAllowed":[4,"is-email-allowed"],"isMobileAllowed":[4,"is-mobile-allowed"],"isEmailRequired":[4,"is-email-required"],"title":[32],"loginTypeTitle":[32],"loginText":[32],"smsLabel":[32],"mobileLabel":[32],"emailLabel":[32],"enterText":[32],"bySMSText":[32],"byEmailText":[32],"emailErrorMsg":[32],"firstNameLabel":[32],"lastNameLabel":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"show":[64]},[[0,"verified","onVerified"],[0,"backClicked","onbackClicked"]]],[0,"salla-verify",{"withoutModal":[4,"without-modal"],"url":[513],"by":[1],"isShowBack":[4,"is-show-back"],"autoReload":[4,"auto-reload"],"title":[32],"getCode":[64],"show":[64]}],[0,"salla-tel-input",{"mobile":[1025],"countryCode":[1025,"country-code"],"countryKey":[1025,"country-key"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-button",{"btnStyle":[513,"btn-style"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"stop":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"error":[4],"success":[4],"primary":[4],"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"icon":[1],"imageIcon":[1,"image-icon"],"title":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-product-availability.cjs",[[4,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"subscribeText":[32],"cancelText":[32],"subTitle":[32],"mobileLabel":[32],"emailLabel":[32],"emailPlaceholder":[32],"subscribedMessage":[32],"title_":[32],"buttonText":[32],"emailErrorMsg":[32]}]]],["salla-branches.cjs",[[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"ok":[32],"show":[64],"hide":[64]}]]],["salla-localization.cjs",[[4,"salla-localization",{"languagesTitle":[32],"currenciesTitle":[32],"ok":[32],"show":[64],"hide":[64],"submit":[64]}]]],["salla-offer.cjs",[[0,"salla-offer",{"offer":[32],"show":[64]}]]],["salla-rating.cjs",[[0,"salla-rating",{"order":[32],"show":[64],"hide":[64]}]]],["salla-search.cjs",[[0,"salla-search",{"results":[32],"placeholder":[32],"noResultsText":[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]]]],["salla-infinite-scroll.cjs",[[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[4],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}]]]], options);
18
+ return index.bootstrapLazy([["salla-button_7.cjs",[[0,"salla-login",{"isEmailAllowed":[4,"is-email-allowed"],"isMobileAllowed":[4,"is-mobile-allowed"],"isEmailRequired":[4,"is-email-required"],"title":[32],"loginTypeTitle":[32],"loginText":[32],"smsLabel":[32],"mobileLabel":[32],"emailLabel":[32],"enterText":[32],"bySMSText":[32],"byEmailText":[32],"emailErrorMsg":[32],"firstNameLabel":[32],"lastNameLabel":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"show":[64]},[[0,"verified","onVerified"],[0,"backClicked","onbackClicked"]]],[4,"salla-localization",{"languagesTitle":[32],"currenciesTitle":[32],"ok":[32],"show":[64],"hide":[64],"submit":[64]}],[0,"salla-search",{"results":[32],"placeholder":[32],"noResultsText":[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]],[0,"salla-verify",{"withoutModal":[4,"without-modal"],"url":[513],"by":[1],"isShowBack":[4,"is-show-back"],"autoReload":[4,"auto-reload"],"title":[32],"getCode":[64],"show":[64]}],[0,"salla-tel-input",{"mobile":[1025],"countryCode":[1025,"country-code"],"countryKey":[1025,"country-key"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-button",{"btnStyle":[513,"btn-style"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"setText":[64],"stop":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"error":[4],"success":[4],"primary":[4],"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"icon":[1],"imageIcon":[1,"image-icon"],"title":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-product-availability.cjs",[[4,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"subTitle":[32],"mobileLabel":[32],"emailLabel":[32],"emailPlaceholder":[32],"subscribedMessage":[32],"title_":[32],"emailErrorMsg":[32]}]]],["salla-branches.cjs",[[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"ok":[32],"show":[64],"hide":[64]}]]],["salla-offer.cjs",[[0,"salla-offer",{"offer":[32],"show":[64]}]]],["salla-rating.cjs",[[0,"salla-rating",{"order":[32],"show":[64],"hide":[64]}]]],["salla-infinite-scroll.cjs",[[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[4],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}]]]], options);
19
19
  });
@@ -1,11 +1,8 @@
1
1
  import { Component, h, Prop, Method, State, Element } from "@stencil/core";
2
- let engine = require('store/src/store-engine');
3
- let storages = require('store/storages/sessionStorage');
4
- let sessionStore = engine.createStore(storages);
5
2
  export class SallaBranches {
6
3
  constructor() {
7
4
  this.open = false;
8
- this.isOpenedBefore = sessionStore.get("branch-choosed-before");
5
+ this.isOpenedBefore = salla.localData.get("branch-choosed-before");
9
6
  this.displayAs = 'default';
10
7
  this.browseProductsFrom = 'all';
11
8
  this.branches = [
@@ -51,7 +48,7 @@ export class SallaBranches {
51
48
  this.btn.load().then(() => {
52
49
  setTimeout(() => location.reload(), 2000);
53
50
  });
54
- sessionStore.set("branch-choosed-before", true);
51
+ salla.localData.set("branch-choosed-before", true);
55
52
  this.show();
56
53
  setTimeout(() => {
57
54
  this.current = this.selected;
@@ -30,6 +30,10 @@ export class SallaButton {
30
30
  this.host.setAttribute('loading', '');
31
31
  return this.host;
32
32
  }
33
+ async setText(html) {
34
+ this.text.innerHTML = html;
35
+ return this.host;
36
+ }
33
37
  async stop() {
34
38
  this.host.removeAttribute('loading');
35
39
  if (this.loaderPosition == 'center')
@@ -185,6 +189,28 @@ export class SallaButton {
185
189
  "tags": []
186
190
  }
187
191
  },
192
+ "setText": {
193
+ "complexType": {
194
+ "signature": "(html: string) => Promise<HTMLElement>",
195
+ "parameters": [{
196
+ "tags": [],
197
+ "text": ""
198
+ }],
199
+ "references": {
200
+ "Promise": {
201
+ "location": "global"
202
+ },
203
+ "HTMLElement": {
204
+ "location": "global"
205
+ }
206
+ },
207
+ "return": "Promise<HTMLElement>"
208
+ },
209
+ "docs": {
210
+ "text": "",
211
+ "tags": []
212
+ }
213
+ },
188
214
  "stop": {
189
215
  "complexType": {
190
216
  "signature": "() => Promise<HTMLElement>",
@@ -3,7 +3,7 @@ import Helper from "../../Helpers/Helper";
3
3
  export class SallaProductAvailability {
4
4
  constructor() {
5
5
  this.isUser = Helper.isUser();
6
- this.productId = salla.get('page.id');
6
+ this.productId = salla.config.get('page.id');
7
7
  this.isSubscribed = false;
8
8
  // @Method()
9
9
  this.submit = async () => {
@@ -14,7 +14,7 @@ export class SallaProductAvailability {
14
14
  let { mobile, countryCode } = await this.mobileInput.getValues(), data = { id: this.productId, country_code: countryCode };
15
15
  mobile !== '' && (data['mobile'] = mobile);
16
16
  this.email.value !== '' && (data['email'] = this.email.value);
17
- await this.validateform({ mobile: mobile, email: this.email.value });
17
+ await this.validateform();
18
18
  return this.btn.load()
19
19
  .then(() => this.btn.disable())
20
20
  .then(() => salla.api.product.availabilitySubscribe(data))
@@ -37,31 +37,31 @@ export class SallaProductAvailability {
37
37
  this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
38
38
  this.host.removeAttribute('title');
39
39
  salla.event.on('languages::translations.loaded', () => {
40
- var _a;
40
+ var _a, _b, _c, _d;
41
41
  this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
42
- this.subscribeText = salla.lang.get('common.elements.submit');
43
- this.cancelText = salla.lang.get('common.elements.cancel');
44
42
  this.subTitle = salla.lang.get('pages.products.notify_availability_subtitle');
45
43
  this.mobileLabel = salla.lang.get('common.elements.mobile');
46
44
  this.emailLabel = salla.lang.get('common.elements.email');
47
45
  this.emailPlaceholder = salla.lang.get('common.elements.email_placeholder');
48
46
  this.subscribedMessage = salla.lang.get('pages.products.notify_availability_success');
49
- this.buttonText = salla.lang.get('pages.products.notify_availability');
50
47
  this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');
51
48
  (_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(this.title_);
49
+ (_b = this.btn) === null || _b === void 0 ? void 0 : _b.setText(salla.lang.get('common.elements.submit'));
50
+ (_c = this.cancelBtn) === null || _c === void 0 ? void 0 : _c.setText(salla.lang.get('common.elements.cancel'));
51
+ (_d = this.inlineBtn) === null || _d === void 0 ? void 0 : _d.setText(salla.lang.get('pages.products.notify_availability'));
52
52
  });
53
53
  }
54
54
  channelsWatcher(newValue) {
55
55
  this.channels_ = newValue.split(',');
56
56
  }
57
- async validateform(data) {
58
- if (this.channels_.includes('email') && !data.mobile) {
57
+ async validateform() {
58
+ if (this.channels_.includes('email')) {
59
59
  const isEmailValid = Helper.isValidEmail(this.email.value);
60
60
  if (isEmailValid)
61
61
  return;
62
62
  !isEmailValid && this.validateField(this.email, this.emailErrorMsg);
63
63
  }
64
- if (this.channels_.includes('sms') && !data.email) {
64
+ if (this.channels_.includes('sms')) {
65
65
  const isPhoneValid = await this.mobileInput.isValid();
66
66
  if (isPhoneValid)
67
67
  return;
@@ -80,7 +80,7 @@ export class SallaProductAvailability {
80
80
  " ",
81
81
  this.subscribedMessage)
82
82
  : h("slot", null,
83
- h("salla-button", { wide: true, onClick: () => this.isUser ? this.submit() : this.modal.show() }, this.buttonText)),
83
+ h("salla-button", { onClick: () => this.isUser ? this.submit() : this.modal.show(), wide: true, ref: btn => this.inlineBtn = btn }, salla.lang.get('pages.products.notify_availability'))),
84
84
  this.isUser || this.isSubscribed ? '' : this.renderModal()));
85
85
  }
86
86
  renderModal() {
@@ -96,8 +96,8 @@ export class SallaProductAvailability {
96
96
  h("salla-tel-input", { ref: el => this.mobileInput = el, onKeyDown: e => this.typing(e, this.submit) })
97
97
  ] : ''),
98
98
  h("div", { slot: "footer", class: "s-product-availability-footer" },
99
- h("salla-button", { wide: true, "btn-style": "outline", onClick: () => this.modal.hide() }, this.cancelText),
100
- h("salla-button", { "loader-position": 'center', wide: true, ref: btn => this.btn = btn, onClick: () => this.submit() }, this.subscribeText))));
99
+ h("salla-button", { wide: true, "btn-style": "outline", onClick: () => this.modal.hide(), ref: btn => this.cancelBtn = btn }, salla.lang.get('common.elements.cancel')),
100
+ h("salla-button", { "loader-position": 'center', wide: true, ref: btn => this.btn = btn, onClick: () => this.submit() }, salla.lang.get('common.elements.submit')))));
101
101
  }
102
102
  static get is() { return "salla-product-availability"; }
103
103
  static get properties() { return {
@@ -134,7 +134,7 @@ export class SallaProductAvailability {
134
134
  },
135
135
  "attribute": "product-id",
136
136
  "reflect": false,
137
- "defaultValue": "salla.get('page.id')"
137
+ "defaultValue": "salla.config.get('page.id')"
138
138
  },
139
139
  "isSubscribed": {
140
140
  "type": "boolean",
@@ -156,15 +156,12 @@ export class SallaProductAvailability {
156
156
  }
157
157
  }; }
158
158
  static get states() { return {
159
- "subscribeText": {},
160
- "cancelText": {},
161
159
  "subTitle": {},
162
160
  "mobileLabel": {},
163
161
  "emailLabel": {},
164
162
  "emailPlaceholder": {},
165
163
  "subscribedMessage": {},
166
164
  "title_": {},
167
- "buttonText": {},
168
165
  "emailErrorMsg": {}
169
166
  }; }
170
167
  static get elementRef() { return "host"; }
@@ -5,6 +5,7 @@ export class SallaSearch {
5
5
  var _a;
6
6
  Helper.setHost(this.host);
7
7
  this.productSlot = ((_a = Helper.getElement('[slot="product"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || this.getDefaultProductSlot();
8
+ salla.event.on('search::show', () => this.modal.show());
8
9
  salla.event.on('languages::translations.loaded', () => {
9
10
  this.placeholder = salla.lang.get('blocks.header.search_placeholder');
10
11
  this.noResultsText = salla.lang.get('common.elements.no_options');
@@ -3,8 +3,8 @@ import TelInput from "intl-tel-input";
3
3
  import Helper from "../../Helpers/Helper";
4
4
  export class SallaTelInput {
5
5
  constructor() {
6
- this.countryCode = "SA";
7
- this.countryKey = "+966";
6
+ this.countryCode = salla.config.get('user.country_code', 'SA');
7
+ this.countryKey = "+966"; //TODO:: why we need it
8
8
  this.countryCodeLabel = salla.lang.get('common.country_code');
9
9
  this.mobileLabel = salla.lang.get('common.elements.mobile');
10
10
  this.tooShort = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });
@@ -66,9 +66,7 @@ export class SallaTelInput {
66
66
  this.isValid();
67
67
  });
68
68
  // on keyup / change flag: reset
69
- this.phoneInput.addEventListener('keyup', e => {
70
- if (e.key == 'Enter')
71
- return;
69
+ this.phoneInput.addEventListener('input', e => {
72
70
  salla.helpers.digitsOnly(e.target);
73
71
  this.reset();
74
72
  });
@@ -123,7 +121,7 @@ export class SallaTelInput {
123
121
  },
124
122
  "attribute": "country-code",
125
123
  "reflect": false,
126
- "defaultValue": "\"SA\""
124
+ "defaultValue": "salla.config.get('user.country_code', 'SA')"
127
125
  },
128
126
  "countryKey": {
129
127
  "type": "string",
@@ -8,13 +8,28 @@ module.exports = require('tailwindcss/plugin').withOptions(() => {
8
8
  '.error' : {},
9
9
  '.search-box' : {},
10
10
  '.spinner-loader-wrap': {},
11
+ // '.me-3' : {},
12
+ // '.ms-3' : {},
13
+ // '.pe-4' : {},
14
+ // '.ps-5' : {},
15
+ // '.space-s-3' : {},
16
+ // '.end-4' : {},
17
+
18
+ '.has-error' : {'@apply border-red-400 focus:border-red-500': {}},
19
+ '.rounded-icon' : {'@apply w-16 h-16 flex justify-center items-center rounded-full text-3xl': {}},
20
+ '.form-input' : {'@apply w-full h-10 transition-colors duration-300 focus:ring-transparent focus:border-primary dark:focus:border-primary sm:text-sm border-border-color dark:bg-gray-600 dark:border-gray-600 rounded-md': {}},
21
+ '.btn' : {'@apply transition duration-300 flex-1 inline-flex justify-center items-center px-6 pb-2.5 pt-2 text-sm font-bold rounded-md hover:opacity-80 whitespace-nowrap': {}},
22
+ '.btn-primary' : {'@apply text-primary-reverse border border-primary bg-primary': {}},
23
+ '.btn-danger' : {'@apply bg-theme-red text-white hover:opacity-80': {}},
24
+ '.btn-outline' : {'@apply text-gray-400 bg-white shadow-sm hover:text-gray-600 border border-border-color': {}},
25
+ '.btn-outline-primary': {'@apply border border-primary text-primary hover:bg-primary hover:text-reverse': {}},
11
26
  });
12
27
 
13
28
  // todo :: move it to global
14
29
  addUtilities({
15
30
  '.spinner-loader': {
16
31
  'border-right-color': 'var(--color-main) !important',
17
- '&.reverse': {
32
+ '&.reverse' : {
18
33
  'border-right-color': '#9f7171 !important',
19
34
  'background-color' : '#f98181'
20
35
  }
package/dist/esm/index.js CHANGED
@@ -1,4 +1,3 @@
1
- export { S as SallaLogin } from './salla-login-e6e86a3d.js';
2
- export { S as SallaSearch } from './salla-search-57bd45eb.js';
1
+ export { S as SallaLogin, a as SallaSearch } from './salla-search-c30c12ef.js';
3
2
  import './index-a1bf769d.js';
4
3
  import './Helper-d07ebbc7.js';