@salla.sa/twilight-components 2.11.69 → 2.11.71

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 (55) hide show
  1. package/dist/cjs/{app-globals-bd54e7cb.js → app-globals-7aa5a435.js} +2 -2
  2. package/dist/cjs/cart-3ecaa815.js +13 -0
  3. package/dist/cjs/index-1d2b3370.js +2 -2
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/salla-add-product-button.cjs.entry.js +21 -4
  6. package/dist/cjs/{salla-button_36.cjs.entry.js → salla-button_37.cjs.entry.js} +2605 -34
  7. package/dist/cjs/twilight.cjs.js +2 -2
  8. package/dist/collection/collection-manifest.json +1 -0
  9. package/dist/collection/components/salla-add-product-button/salla-add-product-button.css +2 -1
  10. package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +59 -6
  11. package/dist/collection/components/salla-quick-buy/salla-quick-buy.css +10 -0
  12. package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +326 -0
  13. package/dist/collection/global/app-dev.js +4 -0
  14. package/dist/components/index.d.ts +1 -0
  15. package/dist/components/index.js +3 -2
  16. package/dist/components/salla-add-product-button.js +39 -13
  17. package/dist/components/salla-quick-buy.d.ts +11 -0
  18. package/dist/components/salla-quick-buy.js +9 -0
  19. package/dist/components/salla-quick-buy2.js +2612 -0
  20. package/dist/esm/{app-globals-ab75dc1d.js → app-globals-225364bb.js} +2 -2
  21. package/dist/esm/cart-8c60b447.js +11 -0
  22. package/dist/esm/index-f1d446ac.js +2 -2
  23. package/dist/esm/loader.js +2 -2
  24. package/dist/esm/salla-add-product-button.entry.js +21 -4
  25. package/dist/esm/{salla-button_36.entry.js → salla-button_37.entry.js} +2605 -35
  26. package/dist/esm/twilight.js +2 -2
  27. package/dist/esm-es5/app-globals-225364bb.js +24 -0
  28. package/dist/esm-es5/cart-8c60b447.js +4 -0
  29. package/dist/esm-es5/index-f1d446ac.js +1 -1
  30. package/dist/esm-es5/loader.js +1 -1
  31. package/dist/esm-es5/salla-add-product-button.entry.js +2 -2
  32. package/dist/esm-es5/salla-button_37.entry.js +53 -0
  33. package/dist/esm-es5/twilight.js +1 -1
  34. package/dist/twilight/{p-d17a8244.entry.js → p-28812dd3.entry.js} +6 -6
  35. package/dist/twilight/p-3c6e1a89.js +24 -0
  36. package/dist/twilight/{p-d16bcce2.system.entry.js → p-45b5a0f3.system.entry.js} +9 -9
  37. package/dist/twilight/p-4bf1c1a4.system.js +4 -0
  38. package/dist/twilight/p-60fb9bb5.system.js +4 -0
  39. package/dist/twilight/p-8a13cf01.js +4 -0
  40. package/dist/twilight/p-8c7b124e.system.entry.js +4 -0
  41. package/dist/twilight/p-91f5d041.entry.js +4 -0
  42. package/dist/twilight/p-f35ef1d6.system.js +24 -0
  43. package/dist/twilight/twilight.esm.js +1 -1
  44. package/dist/twilight/twilight.js +1 -1
  45. package/dist/types/components/salla-add-product-button/salla-add-product-button.d.ts +11 -1
  46. package/dist/types/components/salla-quick-buy/salla-quick-buy.d.ts +50 -0
  47. package/dist/types/components.d.ts +97 -0
  48. package/package.json +6 -5
  49. package/dist/esm-es5/app-globals-ab75dc1d.js +0 -24
  50. package/dist/esm-es5/salla-button_36.entry.js +0 -53
  51. package/dist/twilight/p-70aabbb8.entry.js +0 -4
  52. package/dist/twilight/p-c0731d21.system.js +0 -4
  53. package/dist/twilight/p-e211326b.system.js +0 -24
  54. package/dist/twilight/p-f080991b.system.entry.js +0 -4
  55. package/dist/twilight/p-f43fba74.js +0 -24
@@ -6,6 +6,7 @@
6
6
  Object.defineProperty(exports, '__esModule', { value: true });
7
7
 
8
8
  const index = require('./index-1d2b3370.js');
9
+ const cart = require('./cart-3ecaa815.js');
9
10
 
10
11
  const sallaAddProductButtonCss = ":host{display:block}salla-add-product-button[width=wide]{width:100%}";
11
12
 
@@ -24,9 +25,15 @@ const SallaAddProductButton = class {
24
25
  */
25
26
  this.productType = 'product';
26
27
  this.selectedOptions = [];
28
+ salla.onReady(() => {
29
+ this.showQuickBuy = this.quickBuy && !!salla.config.get('store.settings.buy_now');
30
+ });
27
31
  }
28
32
  getLabel() {
29
33
  if (this.productStatus === 'sale') {
34
+ if (this.supportStickyBar && window.innerWidth <= 768) {
35
+ return cart.Cart;
36
+ }
30
37
  return salla.lang.get('pages.cart.add_to_cart');
31
38
  }
32
39
  if (this.productType !== 'donating') {
@@ -82,7 +89,18 @@ const SallaAddProductButton = class {
82
89
  return this.hostAttributes;
83
90
  }
84
91
  componentWillLoad() {
85
- this.hasLabel = !!this.host.innerHTML.replace('<!---->', '').trim();
92
+ this.passedLabel = this.host.innerHTML.replace('<!---->', '').trim();
93
+ if (this.host.hasAttribute('type') && this.host.getAttribute('type') === 'submit' && this.supportStickyBar) {
94
+ window.addEventListener('resize', () => {
95
+ var _a, _b;
96
+ if (window.innerWidth >= 768 && !!this.passedLabel) {
97
+ (_a = this.btn) === null || _a === void 0 ? void 0 : _a.setText(this.passedLabel);
98
+ }
99
+ else {
100
+ (_b = this.btn) === null || _b === void 0 ? void 0 : _b.setText(this.getLabel());
101
+ }
102
+ });
103
+ }
86
104
  }
87
105
  render() {
88
106
  var _a;
@@ -96,7 +114,7 @@ const SallaAddProductButton = class {
96
114
  if ((this.productStatus === 'out-and-notify' && this.channels) || this.hasOutOfStockOption) {
97
115
  return index.h(index.Host, null, index.h("salla-product-availability", Object.assign({}, this.getBtnAttributes()), index.h("span", { class: "s-hidden" }, index.h("slot", null))));
98
116
  }
99
- return index.h(index.Host, null, index.h("salla-button", Object.assign({ color: this.productStatus === 'sale' ? 'primary' : 'light', type: "button", fill: this.productStatus === 'sale' ? 'solid' : 'outline', ref: el => this.btn = el, onClick: event => this.addProductToCart(event), disabled: this.productStatus !== 'sale' }, this.getBtnAttributes(), { "loader-position": "center" }), index.h("slot", null)));
117
+ return index.h(index.Host, { class: { 's-add-product-button-with-quick-buy': this.showQuickBuy, 's-add-product-button-with-sticky-bar': this.supportStickyBar } }, index.h("salla-button", Object.assign({ color: this.productStatus === 'sale' ? 'primary' : 'light', type: "button", fill: this.productStatus === 'sale' ? 'solid' : 'outline', ref: el => this.btn = el, onClick: event => this.addProductToCart(event), disabled: this.productStatus !== 'sale' }, this.getBtnAttributes(), { "loader-position": "center" }), index.h("slot", null)), this.showQuickBuy ? index.h("salla-quick-buy", Object.assign({}, this.getBtnAttributes())) : '');
100
118
  }
101
119
  componentDidLoad() {
102
120
  if (!this.notifyOptionsAvailability) {
@@ -108,7 +126,6 @@ const SallaAddProductButton = class {
108
126
  return;
109
127
  }
110
128
  this.hasSubscribedOptions = false;
111
- this.hasLabel = false;
112
129
  this.selectedOptions = await ((_a = document.querySelector(`salla-product-options[product-id="${this.productId}"]`)) === null || _a === void 0 ? void 0 : _a.getSelectedOptions());
113
130
  this.hasOutOfStockOption = await ((_b = document.querySelector(`salla-product-options[product-id="${this.productId}"]`)) === null || _b === void 0 ? void 0 : _b.hasOutOfStockOption());
114
131
  let subscribedDetails = salla.storage.get(`product-${this.productId}-subscribed-options`);
@@ -127,7 +144,7 @@ const SallaAddProductButton = class {
127
144
  componentDidRender() {
128
145
  var _a;
129
146
  //if label not passed, get label
130
- if (this.hasLabel) {
147
+ if (!!this.passedLabel && window.innerWidth >= 768) {
131
148
  return;
132
149
  }
133
150
  (_a = this.btn) === null || _a === void 0 ? void 0 : _a.setText(this.getLabel());