@salla.sa/twilight-components 1.6.1 → 1.6.3

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 (62) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/salla-add-product-button.cjs.entry.js +104 -0
  3. package/dist/cjs/salla-button_24.cjs.entry.js +10087 -0
  4. package/dist/cjs/twilight-components.cjs.js +1 -1
  5. package/dist/collection/components/salla-login-modal/salla-login-modal.js +3 -4
  6. package/dist/components/salla-login-modal.js +3 -4
  7. package/dist/esm/loader.js +1 -1
  8. package/dist/esm/salla-add-product-button.entry.js +100 -0
  9. package/dist/esm/salla-button_24.entry.js +10060 -0
  10. package/dist/esm/twilight-components.js +1 -1
  11. package/dist/twilight-components/p-30b2c5b0.entry.js +4 -0
  12. package/dist/twilight-components/p-76cb2574.entry.js +4 -0
  13. package/dist/twilight-components/twilight-components.esm.js +1 -1
  14. package/package.json +9 -3
  15. package/dist/cjs/Helper-8ae6a805.js +0 -28
  16. package/dist/cjs/arrow-right-3d137e4c.js +0 -13
  17. package/dist/cjs/cancel-ae668d91.js +0 -13
  18. package/dist/cjs/check-circle2-1aac98d1.js +0 -13
  19. package/dist/cjs/mail-2db058ee.js +0 -13
  20. package/dist/cjs/salla-add-product-button_13.cjs.entry.js +0 -2870
  21. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +0 -93
  22. package/dist/cjs/salla-list-tile_2.cjs.entry.js +0 -80
  23. package/dist/cjs/salla-loyalty.cjs.entry.js +0 -229
  24. package/dist/cjs/salla-product-size-guide.cjs.entry.js +0 -52
  25. package/dist/cjs/salla-quantity-input.cjs.entry.js +0 -101
  26. package/dist/cjs/salla-rating-modal.cjs.entry.js +0 -169
  27. package/dist/cjs/salla-social-share.cjs.entry.js +0 -1447
  28. package/dist/cjs/salla-swiper.cjs.entry.js +0 -5023
  29. package/dist/cjs/salla-tab-content_3.cjs.entry.js +0 -159
  30. package/dist/cjs/star2-8288e6e1.js +0 -13
  31. package/dist/esm/Helper-e1d414a5.js +0 -26
  32. package/dist/esm/arrow-right-1c3e04f2.js +0 -11
  33. package/dist/esm/cancel-41a92070.js +0 -11
  34. package/dist/esm/check-circle2-f6e5f685.js +0 -11
  35. package/dist/esm/mail-9d5204c6.js +0 -11
  36. package/dist/esm/salla-add-product-button_13.entry.js +0 -2854
  37. package/dist/esm/salla-infinite-scroll.entry.js +0 -89
  38. package/dist/esm/salla-list-tile_2.entry.js +0 -75
  39. package/dist/esm/salla-loyalty.entry.js +0 -225
  40. package/dist/esm/salla-product-size-guide.entry.js +0 -48
  41. package/dist/esm/salla-quantity-input.entry.js +0 -97
  42. package/dist/esm/salla-rating-modal.entry.js +0 -165
  43. package/dist/esm/salla-social-share.entry.js +0 -1443
  44. package/dist/esm/salla-swiper.entry.js +0 -5019
  45. package/dist/esm/salla-tab-content_3.entry.js +0 -153
  46. package/dist/esm/star2-b134fc74.js +0 -11
  47. package/dist/twilight-components/p-14f0ff17.entry.js +0 -4
  48. package/dist/twilight-components/p-2749c9d3.entry.js +0 -4
  49. package/dist/twilight-components/p-335abbbb.entry.js +0 -4
  50. package/dist/twilight-components/p-4cafb11b.entry.js +0 -4
  51. package/dist/twilight-components/p-5e63e308.entry.js +0 -4
  52. package/dist/twilight-components/p-648e74e5.entry.js +0 -4
  53. package/dist/twilight-components/p-897b2018.js +0 -4
  54. package/dist/twilight-components/p-93708e1e.js +0 -4
  55. package/dist/twilight-components/p-9d236cf4.entry.js +0 -4
  56. package/dist/twilight-components/p-9d2ca9c8.js +0 -4
  57. package/dist/twilight-components/p-af7d5660.js +0 -4
  58. package/dist/twilight-components/p-bdbd2386.entry.js +0 -4
  59. package/dist/twilight-components/p-cac3db69.entry.js +0 -4
  60. package/dist/twilight-components/p-d914a212.js +0 -4
  61. package/dist/twilight-components/p-dace8e6d.js +0 -4
  62. package/dist/twilight-components/p-f9253fda.entry.js +0 -4
@@ -18,5 +18,5 @@ const patchBrowser = () => {
18
18
  };
19
19
 
20
20
  patchBrowser().then(options => {
21
- return index.bootstrapLazy([["salla-loyalty.cjs",[[4,"salla-loyalty",{"prizePoints":[8,"prize-points"],"customerPoints":[2,"customer-points"],"prizeTitle":[1,"prize-title"],"allowEmail":[4,"allow-email"],"allowMobile":[4,"allow-mobile"],"requireEmail":[4,"require-email"],"guestMessage":[1,"guest-message"],"loyaltyProgram":[32],"buttonLoading":[32],"selectedItem":[32],"askConfirmation":[32],"is_loggedin":[32],"translationLoaded":[32],"open":[64],"close":[64],"resetExchange":[64],"exchangeLoyaltyPoint":[64]}]]],["salla-product-size-guide.cjs",[[4,"salla-product-size-guide",{"guides":[32],"productId":[32],"open":[64],"close":[64]}]]],["salla-scopes.cjs",[[4,"salla-scopes",{"selection":[1],"searchDisplayLimit":[2,"search-display-limit"],"translationLoaded":[32],"mode":[32],"current_scope":[32],"scopes":[32],"originalScopesList":[32],"selected_scope":[32],"isOpenedBefore":[32],"close":[64],"open":[64],"handleSubmit":[64]}]]],["salla-rating-modal.cjs",[[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"translationLoaded":[32],"open":[64],"close":[64]}]]],["salla-social-share.cjs",[[4,"salla-social-share",{"url":[513],"urlName":[513,"url-name"],"platforms":[16],"opened":[32],"allPlatforms":[32],"platformIcons":[32],"open":[64]}]]],["salla-conditional-fields.cjs",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["salla-infinite-scroll.cjs",[[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}]]],["salla-installment.cjs",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["salla-quantity-input.cjs",[[4,"salla-quantity-input",{"quantity":[32],"decrease":[64],"increase":[64],"setValue":[64]}]]],["salla-tab-content_3.cjs",[[4,"salla-tab-content",{"name":[1],"isSelected":[32],"getChild":[64]}],[4,"salla-tab-header",{"name":[1],"activeClass":[1,"active-class"],"height":[8],"centered":[4],"isSelected":[32],"getChild":[64]}],[4,"salla-tabs",{"backgroundColor":[1,"background-color"],"vertical":[4]},[[0,"tabSelected","onSelectedTab"]]]]],["salla-add-product-button_13.cjs",[[4,"salla-add-product-button",{"channels":[513],"quantity":[514],"donatingAmount":[514,"donating-amount"],"productId":[520,"product-id"],"productStatus":[513,"product-status"],"productType":[513,"product-type"]}],[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"translationLoaded":[32],"title":[32],"emailErrorMsg":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"open":[64]},[[8,"verified","onVerified"]]],[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"translationLoaded":[32],"languages":[32],"currencies":[32],"isLoading":[32],"open":[64],"close":[64],"submit":[64]}],[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"translationLoaded":[32],"open":[64],"showOffer":[64]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"translationLoaded":[32],"results":[32],"loading":[32],"typing":[32],"debounce":[32],"search_term":[32]},[[0,"keydown","handleKeyDown"]]],[0,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"translationLoaded":[32],"title_":[32],"isVisitorSubscribed":[32]}],[4,"salla-verify",{"display":[1],"type":[1025],"autoReload":[4,"auto-reload"],"translationLoaded":[32],"title":[32],"resendAfter":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}],[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2]}],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[0,"salla-skeleton",{"type":[1],"width":[1],"height":[1]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"hasSkeleton":[516,"has-skeleton"],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"centered":[4],"iconStyle":[1,"icon-style"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}],[0,"salla-loading",{"size":[8],"width":[8],"color":[1],"bgColor":[1,"bg-color"]}]]],["salla-swiper.cjs",[[4,"salla-swiper",{"loop":[4],"speed":[2],"itemPerView":[8,"item-per-view"],"spaceBetweenItems":[2,"space-between-items"],"currentIndex":[32],"isLastSlideItem":[32],"isFirstSlideItem":[32]}]]],["salla-list-tile_2.cjs",[[4,"salla-list-tile",{"href":[1],"target":[1]}],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"translationLoaded":[32]}]]]], options);
21
+ return index.bootstrapLazy([["salla-button_24.cjs",[[4,"salla-loyalty",{"prizePoints":[8,"prize-points"],"customerPoints":[2,"customer-points"],"prizeTitle":[1,"prize-title"],"allowEmail":[4,"allow-email"],"allowMobile":[4,"allow-mobile"],"requireEmail":[4,"require-email"],"guestMessage":[1,"guest-message"],"loyaltyProgram":[32],"buttonLoading":[32],"selectedItem":[32],"askConfirmation":[32],"is_loggedin":[32],"translationLoaded":[32],"open":[64],"close":[64],"resetExchange":[64],"exchangeLoyaltyPoint":[64]}],[4,"salla-product-size-guide",{"guides":[32],"productId":[32],"open":[64],"close":[64]}],[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"translationLoaded":[32],"title":[32],"emailErrorMsg":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"open":[64]},[[8,"verified","onVerified"]]],[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"translationLoaded":[32],"languages":[32],"currencies":[32],"isLoading":[32],"open":[64],"close":[64],"submit":[64]}],[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"translationLoaded":[32],"open":[64],"close":[64]}],[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"translationLoaded":[32],"open":[64],"showOffer":[64]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"translationLoaded":[32],"results":[32],"loading":[32],"typing":[32],"debounce":[32],"search_term":[32]},[[0,"keydown","handleKeyDown"]]],[4,"salla-social-share",{"url":[513],"urlName":[513,"url-name"],"platforms":[16],"opened":[32],"allPlatforms":[32],"platformIcons":[32],"open":[64]}],[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}],[4,"salla-quantity-input",{"quantity":[32],"decrease":[64],"increase":[64],"setValue":[64]}],[0,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"translationLoaded":[32],"title_":[32],"isVisitorSubscribed":[32]}],[4,"salla-verify",{"display":[1],"type":[1025],"autoReload":[4,"auto-reload"],"translationLoaded":[32],"title":[32],"resendAfter":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}],[4,"salla-swiper",{"loop":[4],"speed":[2],"itemPerView":[8,"item-per-view"],"spaceBetweenItems":[2,"space-between-items"],"currentIndex":[32],"isLastSlideItem":[32],"isFirstSlideItem":[32]}],[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2]}],[4,"salla-list-tile",{"href":[1],"target":[1]}],[4,"salla-tab-content",{"name":[1],"isSelected":[32],"getChild":[64]}],[4,"salla-tab-header",{"name":[1],"activeClass":[1,"active-class"],"height":[8],"centered":[4],"isSelected":[32],"getChild":[64]}],[4,"salla-tabs",{"backgroundColor":[1,"background-color"],"vertical":[4]},[[0,"tabSelected","onSelectedTab"]]],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"translationLoaded":[32]}],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[0,"salla-skeleton",{"type":[1],"width":[1],"height":[1]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"hasSkeleton":[516,"has-skeleton"],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"centered":[4],"iconStyle":[1,"icon-style"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}],[0,"salla-loading",{"size":[8],"width":[8],"color":[1],"bgColor":[1,"bg-color"]}]]],["salla-scopes.cjs",[[4,"salla-scopes",{"selection":[1],"searchDisplayLimit":[2,"search-display-limit"],"translationLoaded":[32],"mode":[32],"current_scope":[32],"scopes":[32],"originalScopesList":[32],"selected_scope":[32],"isOpenedBefore":[32],"close":[64],"open":[64],"handleSubmit":[64]}]]],["salla-add-product-button.cjs",[[4,"salla-add-product-button",{"channels":[513],"quantity":[514],"donatingAmount":[514,"donating-amount"],"productId":[520,"product-id"],"productStatus":[513,"product-status"],"productType":[513,"product-type"]}]]],["salla-conditional-fields.cjs",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["salla-installment.cjs",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]]], options);
22
22
  });
@@ -151,7 +151,7 @@ export class SallaLoginModal {
151
151
  return this.modal.open();
152
152
  }
153
153
  showTab(tab, evt) {
154
- var _a;
154
+ var _a, _b;
155
155
  evt === null || evt === void 0 ? void 0 : evt.preventDefault();
156
156
  let tabs = [this.homeTab, this.mobileTab, this.emailTab, this.verifyTab, this.registrationTab];
157
157
  tabs.map(el => Helper.toggleElementClassIf(el, 'visible', 's-hidden', () => el == tab));
@@ -163,9 +163,8 @@ export class SallaLoginModal {
163
163
  this.regType = tab === this.mobileTab ? 'phone' : 'email';
164
164
  }
165
165
  let isRegistrationTab = tab == this.registrationTab;
166
- // focus the first input in tab
167
- // tab.querySelector('input')?.focus();
168
- (_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(isRegistrationTab ? salla.lang.get('common.titles.registration') : this.title);
166
+ (_a = tab.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus(); // focus the first input in tab
167
+ (_b = this.modal) === null || _b === void 0 ? void 0 : _b.setTitle(isRegistrationTab ? salla.lang.get('common.titles.registration') : this.title);
169
168
  if (!isRegistrationTab) {
170
169
  Helper.toggleElementClassIf(this.regMobileBlock, 's-hidden', 's-show', () => this.regType === 'phone')
171
170
  .toggleElementClassIf(this.regEmailBlock, 's-hidden', 's-show', () => this.regType === 'email');
@@ -162,7 +162,7 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
162
162
  return this.modal.open();
163
163
  }
164
164
  showTab(tab, evt) {
165
- var _a;
165
+ var _a, _b;
166
166
  evt === null || evt === void 0 ? void 0 : evt.preventDefault();
167
167
  let tabs = [this.homeTab, this.mobileTab, this.emailTab, this.verifyTab, this.registrationTab];
168
168
  tabs.map(el => Helper.toggleElementClassIf(el, 'visible', 's-hidden', () => el == tab));
@@ -174,9 +174,8 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
174
174
  this.regType = tab === this.mobileTab ? 'phone' : 'email';
175
175
  }
176
176
  let isRegistrationTab = tab == this.registrationTab;
177
- // focus the first input in tab
178
- // tab.querySelector('input')?.focus();
179
- (_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(isRegistrationTab ? salla.lang.get('common.titles.registration') : this.title);
177
+ (_a = tab.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus(); // focus the first input in tab
178
+ (_b = this.modal) === null || _b === void 0 ? void 0 : _b.setTitle(isRegistrationTab ? salla.lang.get('common.titles.registration') : this.title);
180
179
  if (!isRegistrationTab) {
181
180
  Helper.toggleElementClassIf(this.regMobileBlock, 's-hidden', 's-show', () => this.regType === 'phone')
182
181
  .toggleElementClassIf(this.regEmailBlock, 's-hidden', 's-show', () => this.regType === 'email');
@@ -13,7 +13,7 @@ const patchEsm = () => {
13
13
  const defineCustomElements = (win, options) => {
14
14
  if (typeof window === 'undefined') return Promise.resolve();
15
15
  return patchEsm().then(() => {
16
- return bootstrapLazy([["salla-loyalty",[[4,"salla-loyalty",{"prizePoints":[8,"prize-points"],"customerPoints":[2,"customer-points"],"prizeTitle":[1,"prize-title"],"allowEmail":[4,"allow-email"],"allowMobile":[4,"allow-mobile"],"requireEmail":[4,"require-email"],"guestMessage":[1,"guest-message"],"loyaltyProgram":[32],"buttonLoading":[32],"selectedItem":[32],"askConfirmation":[32],"is_loggedin":[32],"translationLoaded":[32],"open":[64],"close":[64],"resetExchange":[64],"exchangeLoyaltyPoint":[64]}]]],["salla-product-size-guide",[[4,"salla-product-size-guide",{"guides":[32],"productId":[32],"open":[64],"close":[64]}]]],["salla-scopes",[[4,"salla-scopes",{"selection":[1],"searchDisplayLimit":[2,"search-display-limit"],"translationLoaded":[32],"mode":[32],"current_scope":[32],"scopes":[32],"originalScopesList":[32],"selected_scope":[32],"isOpenedBefore":[32],"close":[64],"open":[64],"handleSubmit":[64]}]]],["salla-rating-modal",[[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"translationLoaded":[32],"open":[64],"close":[64]}]]],["salla-social-share",[[4,"salla-social-share",{"url":[513],"urlName":[513,"url-name"],"platforms":[16],"opened":[32],"allPlatforms":[32],"platformIcons":[32],"open":[64]}]]],["salla-conditional-fields",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["salla-infinite-scroll",[[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}]]],["salla-installment",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["salla-quantity-input",[[4,"salla-quantity-input",{"quantity":[32],"decrease":[64],"increase":[64],"setValue":[64]}]]],["salla-tab-content_3",[[4,"salla-tab-content",{"name":[1],"isSelected":[32],"getChild":[64]}],[4,"salla-tab-header",{"name":[1],"activeClass":[1,"active-class"],"height":[8],"centered":[4],"isSelected":[32],"getChild":[64]}],[4,"salla-tabs",{"backgroundColor":[1,"background-color"],"vertical":[4]},[[0,"tabSelected","onSelectedTab"]]]]],["salla-add-product-button_13",[[4,"salla-add-product-button",{"channels":[513],"quantity":[514],"donatingAmount":[514,"donating-amount"],"productId":[520,"product-id"],"productStatus":[513,"product-status"],"productType":[513,"product-type"]}],[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"translationLoaded":[32],"title":[32],"emailErrorMsg":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"open":[64]},[[8,"verified","onVerified"]]],[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"translationLoaded":[32],"languages":[32],"currencies":[32],"isLoading":[32],"open":[64],"close":[64],"submit":[64]}],[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"translationLoaded":[32],"open":[64],"showOffer":[64]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"translationLoaded":[32],"results":[32],"loading":[32],"typing":[32],"debounce":[32],"search_term":[32]},[[0,"keydown","handleKeyDown"]]],[0,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"translationLoaded":[32],"title_":[32],"isVisitorSubscribed":[32]}],[4,"salla-verify",{"display":[1],"type":[1025],"autoReload":[4,"auto-reload"],"translationLoaded":[32],"title":[32],"resendAfter":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}],[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2]}],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[0,"salla-skeleton",{"type":[1],"width":[1],"height":[1]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"hasSkeleton":[516,"has-skeleton"],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"centered":[4],"iconStyle":[1,"icon-style"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}],[0,"salla-loading",{"size":[8],"width":[8],"color":[1],"bgColor":[1,"bg-color"]}]]],["salla-swiper",[[4,"salla-swiper",{"loop":[4],"speed":[2],"itemPerView":[8,"item-per-view"],"spaceBetweenItems":[2,"space-between-items"],"currentIndex":[32],"isLastSlideItem":[32],"isFirstSlideItem":[32]}]]],["salla-list-tile_2",[[4,"salla-list-tile",{"href":[1],"target":[1]}],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"translationLoaded":[32]}]]]], options);
16
+ return bootstrapLazy([["salla-button_24",[[4,"salla-loyalty",{"prizePoints":[8,"prize-points"],"customerPoints":[2,"customer-points"],"prizeTitle":[1,"prize-title"],"allowEmail":[4,"allow-email"],"allowMobile":[4,"allow-mobile"],"requireEmail":[4,"require-email"],"guestMessage":[1,"guest-message"],"loyaltyProgram":[32],"buttonLoading":[32],"selectedItem":[32],"askConfirmation":[32],"is_loggedin":[32],"translationLoaded":[32],"open":[64],"close":[64],"resetExchange":[64],"exchangeLoyaltyPoint":[64]}],[4,"salla-product-size-guide",{"guides":[32],"productId":[32],"open":[64],"close":[64]}],[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"translationLoaded":[32],"title":[32],"emailErrorMsg":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"open":[64]},[[8,"verified","onVerified"]]],[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"translationLoaded":[32],"languages":[32],"currencies":[32],"isLoading":[32],"open":[64],"close":[64],"submit":[64]}],[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"translationLoaded":[32],"open":[64],"close":[64]}],[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"translationLoaded":[32],"open":[64],"showOffer":[64]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"translationLoaded":[32],"results":[32],"loading":[32],"typing":[32],"debounce":[32],"search_term":[32]},[[0,"keydown","handleKeyDown"]]],[4,"salla-social-share",{"url":[513],"urlName":[513,"url-name"],"platforms":[16],"opened":[32],"allPlatforms":[32],"platformIcons":[32],"open":[64]}],[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}],[4,"salla-quantity-input",{"quantity":[32],"decrease":[64],"increase":[64],"setValue":[64]}],[0,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"translationLoaded":[32],"title_":[32],"isVisitorSubscribed":[32]}],[4,"salla-verify",{"display":[1],"type":[1025],"autoReload":[4,"auto-reload"],"translationLoaded":[32],"title":[32],"resendAfter":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}],[4,"salla-swiper",{"loop":[4],"speed":[2],"itemPerView":[8,"item-per-view"],"spaceBetweenItems":[2,"space-between-items"],"currentIndex":[32],"isLastSlideItem":[32],"isFirstSlideItem":[32]}],[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2]}],[4,"salla-list-tile",{"href":[1],"target":[1]}],[4,"salla-tab-content",{"name":[1],"isSelected":[32],"getChild":[64]}],[4,"salla-tab-header",{"name":[1],"activeClass":[1,"active-class"],"height":[8],"centered":[4],"isSelected":[32],"getChild":[64]}],[4,"salla-tabs",{"backgroundColor":[1,"background-color"],"vertical":[4]},[[0,"tabSelected","onSelectedTab"]]],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"translationLoaded":[32]}],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[0,"salla-skeleton",{"type":[1],"width":[1],"height":[1]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"hasSkeleton":[516,"has-skeleton"],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"centered":[4],"iconStyle":[1,"icon-style"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}],[0,"salla-loading",{"size":[8],"width":[8],"color":[1],"bgColor":[1,"bg-color"]}]]],["salla-scopes",[[4,"salla-scopes",{"selection":[1],"searchDisplayLimit":[2,"search-display-limit"],"translationLoaded":[32],"mode":[32],"current_scope":[32],"scopes":[32],"originalScopesList":[32],"selected_scope":[32],"isOpenedBefore":[32],"close":[64],"open":[64],"handleSubmit":[64]}]]],["salla-add-product-button",[[4,"salla-add-product-button",{"channels":[513],"quantity":[514],"donatingAmount":[514,"donating-amount"],"productId":[520,"product-id"],"productStatus":[513,"product-status"],"productType":[513,"product-type"]}]]],["salla-conditional-fields",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["salla-installment",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]]], options);
17
17
  });
18
18
  };
19
19
 
@@ -0,0 +1,100 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-4e30ffd0.js';
5
+
6
+ const sallaAddProductButtonCss = ":host{display:block}salla-add-product-button[width=wide]{width:100%}";
7
+
8
+ const SallaAddProductButton = class {
9
+ constructor(hostRef) {
10
+ registerInstance(this, hostRef);
11
+ this.success = createEvent(this, "success", 7);
12
+ this.failed = createEvent(this, "failed", 7);
13
+ this.hostAttributes = {};
14
+ this.hasLabel = false;
15
+ /**
16
+ * Channels.
17
+ */
18
+ this.channels = null;
19
+ /**
20
+ * Product Quantity
21
+ */
22
+ this.quantity = 0;
23
+ /**
24
+ * Donating amount.
25
+ */
26
+ this.donatingAmount = 0;
27
+ /**
28
+ * Product Status.Defaults to `sale`
29
+ */
30
+ this.productStatus = 'sale';
31
+ /**
32
+ * Product type. Defaults to `product`
33
+ */
34
+ this.productType = 'product';
35
+ }
36
+ getLabel() {
37
+ if (this.productStatus === 'sale') {
38
+ return salla.lang.get('pages.cart.add_to_cart');
39
+ }
40
+ if (this.productType !== 'donating') {
41
+ return salla.lang.get('pages.products.out_of_stock');
42
+ }
43
+ // donating
44
+ return salla.lang.get('pages.products.donation_exceed');
45
+ }
46
+ addProductToCart(event) {
47
+ // we want to ignore the click action when the type of button is submit a form
48
+ if (this.hostAttributes['type'] === 'submit') {
49
+ return false;
50
+ }
51
+ event.preventDefault();
52
+ /**
53
+ * by default the quick add is just an alias for add item function
54
+ * but its work only when the id is the only value is passed via the object
55
+ * so we will filter the object entities to remove null and zero values in case we don't want the normal add item action
56
+ */
57
+ const data = Object.entries({
58
+ id: this.productId,
59
+ donating_amount: this.donatingAmount,
60
+ quantity: this.quantity
61
+ }).reduce((a, [k, v]) => (v ? (a[k] = v, a) : a), {});
62
+ return salla.cart.quickAdd(data)
63
+ .then((response) => {
64
+ return this.success.emit(response);
65
+ })
66
+ .catch((error) => {
67
+ return this.failed.emit(error);
68
+ });
69
+ }
70
+ getBtnAttributes() {
71
+ for (let i = 0; i < this.host.attributes.length; i++) {
72
+ if (!['id', 'class'].includes(this.host.attributes[i].name)) {
73
+ this.hostAttributes[this.host.attributes[i].name] = this.host.attributes[i].value;
74
+ }
75
+ }
76
+ return this.hostAttributes;
77
+ }
78
+ componentWillLoad() {
79
+ this.hasLabel = !!this.host.innerHTML.replace('<!---->', '').trim();
80
+ }
81
+ render() {
82
+ return (h(Host, null, this.productStatus === 'out-and-notify' && this.channels ?
83
+ h("salla-product-availability", Object.assign({}, this.getBtnAttributes()), h("slot", null)) :
84
+ h("salla-button", Object.assign({ ref: el => this.btn = el, onClick: event => this.addProductToCart(event), type: "button", fill: this.productStatus === 'sale' ? 'solid' : 'outline', color: this.productStatus === 'sale' ? 'primary' : 'light', "loader-position": "center" }, this.getBtnAttributes(), { disabled: this.productStatus !== 'sale' }), h("slot", null))));
85
+ }
86
+ componentDidRender() {
87
+ //if label not passed, get label
88
+ if (this.hasLabel) {
89
+ return;
90
+ }
91
+ this.btn.setText(this.getLabel() || 'اضافة للسلة');
92
+ salla.lang.onLoaded(() => {
93
+ this.btn.setText(this.getLabel() || 'اضافة للسلة');
94
+ });
95
+ }
96
+ get host() { return getElement(this); }
97
+ };
98
+ SallaAddProductButton.style = sallaAddProductButtonCss;
99
+
100
+ export { SallaAddProductButton as salla_add_product_button };