@salla.sa/twilight-components 1.6.0 → 1.6.1

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/Helper-8ae6a805.js +28 -0
  2. package/dist/cjs/arrow-right-3d137e4c.js +13 -0
  3. package/dist/cjs/cancel-ae668d91.js +13 -0
  4. package/dist/cjs/check-circle2-1aac98d1.js +13 -0
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/mail-2db058ee.js +13 -0
  7. package/dist/cjs/salla-add-product-button_13.cjs.entry.js +2870 -0
  8. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +93 -0
  9. package/dist/cjs/salla-list-tile_2.cjs.entry.js +80 -0
  10. package/dist/cjs/salla-loyalty.cjs.entry.js +229 -0
  11. package/dist/cjs/salla-product-size-guide.cjs.entry.js +52 -0
  12. package/dist/cjs/salla-quantity-input.cjs.entry.js +101 -0
  13. package/dist/cjs/salla-rating-modal.cjs.entry.js +169 -0
  14. package/dist/cjs/salla-social-share.cjs.entry.js +1447 -0
  15. package/dist/cjs/salla-swiper.cjs.entry.js +5023 -0
  16. package/dist/cjs/salla-tab-content_3.cjs.entry.js +159 -0
  17. package/dist/cjs/star2-8288e6e1.js +13 -0
  18. package/dist/cjs/twilight-components.cjs.js +1 -1
  19. package/dist/collection/components/salla-login-modal/salla-login-modal.js +4 -3
  20. package/dist/components/salla-login-modal.js +4 -3
  21. package/dist/esm/Helper-e1d414a5.js +26 -0
  22. package/dist/esm/arrow-right-1c3e04f2.js +11 -0
  23. package/dist/esm/cancel-41a92070.js +11 -0
  24. package/dist/esm/check-circle2-f6e5f685.js +11 -0
  25. package/dist/esm/loader.js +1 -1
  26. package/dist/esm/mail-9d5204c6.js +11 -0
  27. package/dist/esm/salla-add-product-button_13.entry.js +2854 -0
  28. package/dist/esm/salla-infinite-scroll.entry.js +89 -0
  29. package/dist/esm/salla-list-tile_2.entry.js +75 -0
  30. package/dist/esm/salla-loyalty.entry.js +225 -0
  31. package/dist/esm/salla-product-size-guide.entry.js +48 -0
  32. package/dist/esm/salla-quantity-input.entry.js +97 -0
  33. package/dist/esm/salla-rating-modal.entry.js +165 -0
  34. package/dist/esm/salla-social-share.entry.js +1443 -0
  35. package/dist/esm/salla-swiper.entry.js +5019 -0
  36. package/dist/esm/salla-tab-content_3.entry.js +153 -0
  37. package/dist/esm/star2-b134fc74.js +11 -0
  38. package/dist/esm/twilight-components.js +1 -1
  39. package/dist/twilight-components/p-14f0ff17.entry.js +4 -0
  40. package/dist/twilight-components/p-2749c9d3.entry.js +4 -0
  41. package/dist/twilight-components/p-335abbbb.entry.js +4 -0
  42. package/dist/twilight-components/p-4cafb11b.entry.js +4 -0
  43. package/dist/twilight-components/p-5e63e308.entry.js +4 -0
  44. package/dist/twilight-components/p-648e74e5.entry.js +4 -0
  45. package/dist/twilight-components/p-897b2018.js +4 -0
  46. package/dist/twilight-components/p-93708e1e.js +4 -0
  47. package/dist/twilight-components/p-9d236cf4.entry.js +4 -0
  48. package/dist/twilight-components/p-9d2ca9c8.js +4 -0
  49. package/dist/twilight-components/p-af7d5660.js +4 -0
  50. package/dist/twilight-components/p-bdbd2386.entry.js +4 -0
  51. package/dist/twilight-components/p-cac3db69.entry.js +4 -0
  52. package/dist/twilight-components/p-d914a212.js +4 -0
  53. package/dist/twilight-components/p-dace8e6d.js +4 -0
  54. package/dist/twilight-components/p-f9253fda.entry.js +4 -0
  55. package/dist/twilight-components/twilight-components.esm.js +1 -1
  56. package/package.json +2 -2
  57. package/dist/cjs/salla-add-product-button.cjs.entry.js +0 -104
  58. package/dist/cjs/salla-button_24.cjs.entry.js +0 -10087
  59. package/dist/esm/salla-add-product-button.entry.js +0 -100
  60. package/dist/esm/salla-button_24.entry.js +0 -10060
  61. package/dist/twilight-components/p-30b2c5b0.entry.js +0 -4
  62. package/dist/twilight-components/p-76cb2574.entry.js +0 -4
@@ -0,0 +1,93 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ 'use strict';
5
+
6
+ Object.defineProperty(exports, '__esModule', { value: true });
7
+
8
+ const index = require('./index-0d0167d5.js');
9
+ const Helper = require('./Helper-8ae6a805.js');
10
+
11
+ const sallaInfiniteScrollCss = "";
12
+
13
+ const SallaInfiniteScroll = class {
14
+ constructor(hostRef) {
15
+ index.registerInstance(this, hostRef);
16
+ /**
17
+ * Next Page element
18
+ */
19
+ this.nextPage = '';
20
+ /**
21
+ * Is there is need to autoload next page when scroll `next-page-autoload|next-page.autoload`
22
+ */
23
+ this.autoload = false;
24
+ /**
25
+ * Class selector to know the container if it's not the host `<salla-infinite-scroll>`
26
+ */
27
+ this.container = 'salla-infinite-scroll';
28
+ /**
29
+ * Class selector to know list items
30
+ */
31
+ this.item = 'salla-infinite-scroll > *';
32
+ Helper.Helper.setHost(this.host);
33
+ this.status = document.createElement('div');
34
+ this.status.className = 's-infinite-scroll-wrapper';
35
+ this.status.innerHTML = `<div class="s-infinite-scroll-status" style="display:none">
36
+ <p class="s-infinite-scroll-last infinite-scroll-last"></p>
37
+ <p class="s-infinite-scroll-error infinite-scroll-error"></p>
38
+ </div>
39
+ <a href="${this.nextPage}" class="s-infinite-scroll-btn s-button-btn s-button-primary">
40
+ <span class="s-button-text s-infinite-scroll-btn-text">${salla.lang.get('common.elements.load_more')}</span>
41
+ <span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader" style="display: none"></span>
42
+ </a>`;
43
+ this.btnLoader = this.status.querySelector('.s-button-loader');
44
+ salla.lang.onLoaded(() => {
45
+ this.status.querySelector('.s-button-text').innerHTML = salla.lang.get('common.elements.load_more');
46
+ this.status.querySelector('.s-infinite-scroll-last').innerHTML = salla.lang.get('common.elements.end_of_content');
47
+ this.status.querySelector('.s-infinite-scroll-error').innerHTML = salla.lang.get('common.elements.failed_to_load_more');
48
+ });
49
+ }
50
+ loading(isLoading = true) {
51
+ let btnText = this.status.querySelector('.s-button-text');
52
+ Helper.Helper.toggleElementClassIf(btnText, 's-button-hide', 's-button-show', () => isLoading);
53
+ this.btnLoader.style.display = isLoading ? 'inherit' : 'none';
54
+ }
55
+ render() {
56
+ return this.nextPage.length > 1 ?
57
+ index.h(index.Host, { class: "s-infinite-scroll-container" }, index.h("slot", null)) : '';
58
+ }
59
+ componentDidLoad() {
60
+ if (this.nextPage.length === 0) {
61
+ return;
62
+ }
63
+ this.host.insertAdjacentElement('afterend', this.status);
64
+ let that = this;
65
+ let infScroll = salla.infiniteScroll.initiate(this.container, {
66
+ history: this.autoload ? 'push' : false,
67
+ scrollThreshold: this.autoload ? 400 : false,
68
+ nextPage: this.nextPage,
69
+ checkLastPage: 'salla-infinite-scroll[next-page*=":"],salla-infinite-scroll[next-page*="."]',
70
+ status: '.s-infinite-scroll-status',
71
+ button: this.status.querySelector('.s-button-btn'),
72
+ append: this.item,
73
+ path: function () {
74
+ return that.nextPage.replace(/page\=(\d)/g, 'page=' + (this.loadCount + 2));
75
+ },
76
+ })
77
+ .on('request', () => this.loading())
78
+ .on('load', () => {
79
+ this.loading(false);
80
+ if (infScroll.pageIndex == 2) {
81
+ infScroll.option({ loadOnScroll: false });
82
+ }
83
+ if (infScroll.pageIndex == 3) {
84
+ infScroll.option({ loadOnScroll: true });
85
+ }
86
+ })
87
+ .on('error', () => this.loading(false));
88
+ }
89
+ get host() { return index.getElement(this); }
90
+ };
91
+ SallaInfiniteScroll.style = sallaInfiniteScrollCss;
92
+
93
+ exports.salla_infinite_scroll = SallaInfiniteScroll;
@@ -0,0 +1,80 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ 'use strict';
5
+
6
+ Object.defineProperty(exports, '__esModule', { value: true });
7
+
8
+ const index = require('./index-0d0167d5.js');
9
+
10
+ const sallaListTileCss = "";
11
+
12
+ const SallaListTile = class {
13
+ constructor(hostRef) {
14
+ index.registerInstance(this, hostRef);
15
+ /**
16
+ * Designates the component as anchor and applies the `href` attribute.
17
+ */
18
+ this.href = undefined;
19
+ /**
20
+ * Designates the target attribute. This should only be applied when using the `href` prop.
21
+ */
22
+ this.target = "_self";
23
+ }
24
+ generateClass() {
25
+ return {
26
+ "s-list-tile-item": true,
27
+ "s-list-tile-item-href": !!this.href
28
+ };
29
+ }
30
+ render() {
31
+ return (index.h(index.Host, null, index.h("a", { class: this.generateClass(), href: this.href, target: this.target }, index.h("div", { class: "s-list-tile-item-icon" }, index.h("slot", { name: 'icon' })), index.h("div", { class: "s-list-tile-item-content" }, index.h("div", { class: "s-list-tile-item-title" }, index.h("slot", { name: 'title' })), index.h("div", { class: "s-list-tile-item-subtitle" }, index.h("slot", { name: "subtitle" }))), index.h("div", { class: "s-list-tile-item-action" }, index.h("slot", { name: 'action' })))));
32
+ }
33
+ };
34
+ SallaListTile.style = sallaListTileCss;
35
+
36
+ const Inbox = `<!-- Generated by IcoMoon.io -->
37
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
38
+ <title>inbox</title>
39
+ <path d="M31.984 19.797l-2.667-17.333c-0.1-0.651-0.659-1.131-1.317-1.131h-24c-0.659 0-1.217 0.48-1.317 1.131l-2.667 17.333c-0.011 0.067-0.016 0.135-0.016 0.203v6.667c0 2.205 1.795 4 4 4h24c2.205 0 4-1.795 4-4v-6.667c0-0.068-0.005-0.136-0.016-0.203zM5.144 4h21.712l2.256 14.667h-9.112c-0.736 0-1.333 0.596-1.333 1.333 0 1.471-1.196 2.667-2.667 2.667s-2.667-1.196-2.667-2.667c0-0.737-0.597-1.333-1.333-1.333h-9.112zM29.333 26.667c0 0.736-0.599 1.333-1.333 1.333h-24c-0.735 0-1.333-0.597-1.333-1.333v-5.333h8.168c0.593 2.299 2.684 4 5.165 4s4.571-1.701 5.165-4h8.168z"></path>
40
+ </svg>
41
+ `;
42
+
43
+ const sallaPlaceholderCss = "";
44
+
45
+ const SallaPlaceholder = class {
46
+ constructor(hostRef) {
47
+ index.registerInstance(this, hostRef);
48
+ this.translationLoaded = false;
49
+ /**
50
+ * Custom icon to display, defaults to [`sicon-inbox`]
51
+ */
52
+ this.icon = Inbox;
53
+ /**
54
+ * Defines the alignment of contents. Defaults to [`left`]
55
+ */
56
+ this.alignment = 'left';
57
+ /**
58
+ * The size of the icon. Defaults to [`md`]
59
+ */
60
+ this.iconSize = 'md';
61
+ salla.lang.onLoaded(() => {
62
+ this.translationLoaded = true;
63
+ });
64
+ }
65
+ alignmentClass() {
66
+ return {
67
+ 's-placeholder-wrapper': true,
68
+ 's-placeholder-align-left': this.alignment == 'left',
69
+ 's-placeholder-align-center': this.alignment == 'center',
70
+ 's-placeholder-align-right': this.alignment == 'right',
71
+ };
72
+ }
73
+ render() {
74
+ return (index.h(index.Host, { class: this.alignmentClass() }, index.h("div", { class: `s-placeholder-icon s-placeholder-icon-${this.iconSize}`, innerHTML: this.icon }), index.h("div", { class: "s-placeholder-title" }, index.h("slot", { name: 'title' }, index.h("span", null, salla.lang.get('common.elements.no_options')))), index.h("div", { class: "s-placeholder-description" }, index.h("slot", { name: 'description' }, index.h("span", null, salla.lang.get('common.errors.empty_results'))))));
75
+ }
76
+ };
77
+ SallaPlaceholder.style = sallaPlaceholderCss;
78
+
79
+ exports.salla_list_tile = SallaListTile;
80
+ exports.salla_placeholder = SallaPlaceholder;
@@ -0,0 +1,229 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ 'use strict';
5
+
6
+ Object.defineProperty(exports, '__esModule', { value: true });
7
+
8
+ const index = require('./index-0d0167d5.js');
9
+ const star2 = require('./star2-8288e6e1.js');
10
+ const cancel = require('./cancel-ae668d91.js');
11
+
12
+ const Star3 = `<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 80 80">
13
+ <title>star3</title>
14
+ <defs>
15
+ <style>
16
+ .a {
17
+ fill: none !important;
18
+ }
19
+
20
+ .b {
21
+ fill: #ff9e01;
22
+ }
23
+
24
+ .c {
25
+ fill: #fff;
26
+ opacity: 0.1;
27
+ }
28
+
29
+ </style>
30
+ </defs>
31
+ <g transform="translate(-683 -269)">
32
+ <rect class="a" width="80" height="80" transform="translate(683 269)" />
33
+ <g transform="translate(684.539 261.216)">
34
+ <path class="b"
35
+ d="M110.117,37.062,90.024,35.2,82.043,16.665a1.61,1.61,0,0,0-2.958,0L71.1,35.2,51.011,37.062a1.61,1.61,0,0,0-.914,2.813l15.16,13.318L60.821,72.878a1.61,1.61,0,0,0,2.393,1.739l17.351-10.3,17.351,10.3a1.61,1.61,0,0,0,2.393-1.739L95.871,53.192l15.16-13.318A1.61,1.61,0,0,0,110.117,37.062Z"
36
+ transform="translate(-42.104 -4.011)" />
37
+ <g transform="translate(0 10.971)">
38
+ <path class="b"
39
+ d="M93.54,12.016c1.024,1.423,3.915,7.533,5.568,11.094a.559.559,0,0,1-.891.641c-2.853-2.7-7.73-7.377-8.754-8.8a2.512,2.512,0,0,1,4.077-2.935Z"
40
+ transform="translate(-75.621 -10.971)" />
41
+ <path class="b"
42
+ d="M360.909,12.016c-1.024,1.423-3.915,7.533-5.568,11.094a.559.559,0,0,0,.891.641c2.853-2.7,7.73-7.377,8.754-8.8a2.512,2.512,0,0,0-4.077-2.935Z"
43
+ transform="translate(-301.908 -10.971)" />
44
+ <path class="b"
45
+ d="M427.538,284.659c-1.667-.543-8.366-1.441-12.261-1.934a.559.559,0,0,0-.34,1.044c3.436,1.9,9.377,5.123,11.044,5.666a2.512,2.512,0,0,0,1.558-4.776Z"
46
+ transform="translate(-352.351 -241.894)" />
47
+ <path class="b"
48
+ d="M1.734,284.659c1.667-.543,8.366-1.441,12.261-1.934a.559.559,0,0,1,.34,1.044c-3.436,1.9-9.377,5.123-11.044,5.666a2.512,2.512,0,0,1-1.558-4.776Z"
49
+ transform="translate(0 -241.894)" />
50
+ <path class="b"
51
+ d="M239.794,412.414c0-1.753,1.224-8.4,1.963-12.257a.559.559,0,0,1,1.1,0c.739,3.855,1.963,10.5,1.963,12.257a2.512,2.512,0,0,1-5.023,0Z"
52
+ transform="translate(-203.768 -341.301)" />
53
+ </g>
54
+ <path class="c"
55
+ d="M84.945,23.4l-2.9-6.74a1.61,1.61,0,0,0-2.958,0L71.1,35.2,51.011,37.062a1.61,1.61,0,0,0-.914,2.813l15.16,13.318L60.821,72.878a1.61,1.61,0,0,0,2.393,1.739l2.309-1.371A125,125,0,0,1,84.945,23.4Z"
56
+ transform="translate(-42.104 -4.011)" />
57
+ </g>
58
+ </g>
59
+ </svg>
60
+ `;
61
+
62
+ const GiftImg = `<svg xmlns="http://www.w3.org/2000/svg" width="54.079" height="53.191" viewBox="0 0 54.079 53.191"><defs><style>.a{fill:#ee9d0d;}.b{fill:#c7830b;}.c{fill:#ea2b2d;}.d{fill:#cb2527;}.e{fill:#6699ce;}.f{fill:#faa6b2;}.g{fill:#a6deff;}.h{fill:#eeb436;}.i{fill:#f72d2f;}</style></defs><path class="a" d="M40,248H77.3v25.88a2.1,2.1,0,0,1-2.1,2.1H42.1a2.1,2.1,0,0,1-2.1-2.1Z" transform="translate(-38.135 -222.787)"/><path class="b" d="M250.632,248.711v12.755L236.2,248h13.67Z" transform="translate(-211.463 -222.787)"/><path class="b" d="M333.957,336v3.207L330.52,336Z" transform="translate(-294.787 -300.528)"/><path class="c" d="M226.194,32.048l-.5.185a5.035,5.035,0,0,0-3.072,3.292l-.468,1.585-.759.414a5.035,5.035,0,0,0-2.422,3l8.865,8.271,5.09-5.456.262-6.205a5.191,5.191,0,0,0-7-5.083Z" transform="translate(-196.246 -31.722)"/><path class="c" d="M358.628,175.48l-.15.509a5.034,5.034,0,0,1-3.072,3.292l-1.55.577-.359.785a5.034,5.034,0,0,1-2.822,2.624L341.81,175l5.09-5.455,6.172-.69a5.191,5.191,0,0,1,5.555,6.629Z" transform="translate(-304.761 -152.837)"/><path class="d" d="M168,248h7.461v27.978H168Z" transform="translate(-151.213 -222.787)"/><path class="c" d="M40,336H77.3v7.461H40Z" transform="translate(-38.135 -300.528)"/><path class="d" d="M333.957,336v3.207L330.52,336Z" transform="translate(-294.787 -300.528)"/><path class="a" d="M2.1,0H40.8a2.1,2.1,0,0,1,2.1,2.1V9.326H0V2.1A2.1,2.1,0,0,1,2.1,0Z" transform="matrix(0.731, 0.682, -0.682, 0.731, 18.641, 4.976)"/><path class="d" d="M0,0H9.326V9.326H0Z" transform="matrix(0.731, 0.682, -0.682, 0.731, 30.912, 16.424)"/><path class="d" d="M286.857,79.389a.931.931,0,0,1-.74-.365l-.615-.8a12.516,12.516,0,0,1-2.528-9,.933.933,0,0,1,1.855.2,10.66,10.66,0,0,0,2.153,7.667l.615.8a.933.933,0,0,1-.739,1.5Z" transform="translate(-252.718 -64.113)"/><path class="c" d="M185.485,178.151l-.039.014a30.78,30.78,0,0,1-12.034,1.906l-2.381-.1,4.092,3.817-1.181,4,3.728-1.206a30.775,30.775,0,0,0,9.833-5.315l.71-.572Z" transform="translate(-153.891 -161.081)"/><path class="d" d="M363.834,194.779a12.51,12.51,0,0,1-6.93-2.1l-.843-.559a.933.933,0,1,1,1.031-1.554l.842.558a10.659,10.659,0,0,0,7.8,1.618.933.933,0,1,1,.328,1.836A12.663,12.663,0,0,1,363.834,194.779Z" transform="translate(-316.982 -171.914)"/><path class="c" d="M275,202.524l-.012.04a30.776,30.776,0,0,0-1.069,12.137l.265,2.369-4.092-3.817-3.909,1.455.945-3.8a30.776,30.776,0,0,1,4.622-10.177l.521-.748Z" transform="translate(-237.949 -180.364)"/><circle class="e" cx="1.865" cy="1.865" r="1.865" transform="translate(10.259 0.032)"/><circle class="f" cx="1.865" cy="1.865" r="1.865" transform="translate(0 21.482)"/><path class="g" d="M36.663,36.663a.933.933,0,0,1-.885-.638l-.048-.143a2.946,2.946,0,0,0-2.8-2.017.933.933,0,1,1,0-1.865A4.808,4.808,0,0,1,37.5,35.292l.048.143a.933.933,0,0,1-.885,1.228Z" transform="translate(-31.067 -31.968)"/><path class="g" d="M79.493,194.438a.929.929,0,0,1-.506-.15l-.185-.12a2.074,2.074,0,0,0-2.192-.047.933.933,0,0,1-.947-1.607,3.929,3.929,0,0,1,4.153.088l.185.12a.933.933,0,0,1-.508,1.716Z" transform="translate(-69.235 -173.283)"/><path class="h" d="M27.751,85.141l2.88,2.644,3.811-.874-1.624,3.556,2.008,3.354-3.884-.446-2.569,2.946L27.6,92.49,24,90.957l3.4-1.922Z" transform="translate(-24 -78.914)"/><path class="h" d="M82.174,227.375l-.959,3.772,2.564,2.928-3.884.254L77.9,237.673l-1.442-3.615-3.8-.862,2.993-2.488-.353-3.876,3.291,2.078Z" transform="translate(-66.992 -204.086)"/><path class="i" d="M300.471,141.9l-5.455-5.09,5.09-5.456a8.342,8.342,0,0,1,5.455,5.09Z" transform="translate(-263.422 -119.737)"/></svg>`;
63
+
64
+ const sallaLoyaltyCss = "#salla-loyalty-modal .s-swiper-button-prev button,#salla-loyalty-modal .s-swiper-button-next button{box-shadow:#32325d40 0px 6px 12px -2px, #0000004d 0px 3px 7px -3px}";
65
+
66
+ const SallaLoyalty = class {
67
+ constructor(hostRef) {
68
+ index.registerInstance(this, hostRef);
69
+ this.loyaltyProgram = undefined;
70
+ this.buttonLoading = false;
71
+ this.selectedItem = undefined;
72
+ this.askConfirmation = false;
73
+ this.is_loggedin = false;
74
+ /**
75
+ * The exchanged prize point
76
+ */
77
+ this.prizePoints = undefined;
78
+ /**
79
+ * Available customer points with which they can exchange.
80
+ */
81
+ this.customerPoints = undefined;
82
+ /**
83
+ * The exchangable prize title
84
+ */
85
+ this.prizeTitle = undefined;
86
+ /**
87
+ * Does the merchant allow to login using email
88
+ */
89
+ this.allowEmail = true;
90
+ /**
91
+ * Does the merchant/current location for visitor allow to login using mobile, By default outside KSA is `false`
92
+ */
93
+ this.allowMobile = true;
94
+ /**
95
+ * Does the merchant require registration with email & mobile
96
+ */
97
+ this.requireEmail = false;
98
+ salla.event.on('loyalty::open', () => this.open());
99
+ salla.auth.event.onLoggedIn(() => {
100
+ this.is_loggedin = true;
101
+ });
102
+ salla.lang.onLoaded(() => {
103
+ this.translationLoaded = true;
104
+ });
105
+ }
106
+ setSelectedPrizeItem(item) {
107
+ if (!this.selectedItem || this.selectedItem.id != item.id) {
108
+ this.selectedItem = item;
109
+ }
110
+ else {
111
+ this.selectedItem = undefined;
112
+ }
113
+ }
114
+ handleLongText(text) {
115
+ if (text.length > 150) {
116
+ return text.substring(0, 150) + '...';
117
+ }
118
+ return text;
119
+ }
120
+ prizeItem(item) {
121
+ let klass = {
122
+ 's-loyalty-prize-item-selected': !!this.selectedItem && this.selectedItem.id == item.id,
123
+ "s-loyalty-prize-item": true
124
+ };
125
+ return index.h("div", { onClick: () => this.setSelectedPrizeItem(item), class: klass }, index.h("img", { class: "s-loyalty-prize-item-image", src: item.image, alt: item.name }), index.h("div", { class: "s-loyalty-prize-item-title" }, item.name), index.h("div", { class: "s-loyalty-prize-item-subtitle" }, this.handleLongText(item.description)), index.h("div", { class: "s-loyalty-prize-item-points" }, item.cost_points, " ", salla.lang.get('pages.loyalty_program.point'), index.h("div", { class: "s-loyalty-prize-item-check" }, index.h("div", null))));
126
+ }
127
+ getConfirmationModal() {
128
+ var _a, _b;
129
+ return [
130
+ index.h("salla-placeholder", { alignment: "center", icon: Star3, class: "s-loyalty-confirmation-modal-content" }, index.h("div", { slot: "title", class: "s-loyalty-confirmation-title" }, salla.lang.get('pages.loyalty_program.exchange_points')), index.h("div", { slot: "description" }, salla.lang.get('pages.loyalty_program.are_you_sure_to_exchange'), " ( ", index.h("strong", null, (_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.cost_points), " ) ", salla.lang.get('pages.loyalty_program.for'), " ( ", index.h("strong", null, (_b = this.selectedItem) === null || _b === void 0 ? void 0 : _b.name), " )")),
131
+ index.h("div", { class: "s-loyalty-confirmation-actions" }, index.h("salla-button", { fill: 'outline', width: "wide", onClick: () => this.cancelProcess() }, salla.lang.get('pages.loyalty_program.cancellation')), index.h("salla-button", { loading: this.buttonLoading, width: "wide", onClick: () => this.exchangeLoyaltyPoint() }, salla.lang.get('pages.loyalty_program.confirm')))
132
+ ];
133
+ }
134
+ getAfterExchangeUI() {
135
+ return index.h("slot", { name: 'points-applied-widget' }, index.h("salla-list-tile", { class: "s-loyalty-after-exchange" }, index.h("div", { slot: "title", class: "s-loyalty-after-exchange-title" }, this.prizeTitle, " \u00A0 - \u00A0 ", this.prizePoints), index.h("div", { slot: 'action', class: "s-loyalty-after-exchange-action" }, index.h("salla-button", { class: "s-loyalty-after-exchange-reset", shape: "icon", fill: 'outline', color: "danger", size: "small", onClick: () => this.resetExchange() }, index.h("span", { innerHTML: cancel.Cancel })))));
136
+ }
137
+ /**
138
+ * Show loyalty modal
139
+ */
140
+ async open() {
141
+ if (!this.is_loggedin)
142
+ return salla.event.dispatch('login::open');
143
+ this.modal.open();
144
+ return await salla.loyalty.getProgram()
145
+ .then((response) => {
146
+ this.loyaltyProgram = response.data;
147
+ })
148
+ .catch(e => console.log(e))
149
+ .finally(() => {
150
+ this.modal.stopLoading();
151
+ });
152
+ }
153
+ /**
154
+ *
155
+ * Hide loyalty modal
156
+ */
157
+ async close() {
158
+ return this.modal.close();
159
+ }
160
+ /**
161
+ *
162
+ * Cancel Exchanged prizes
163
+ */
164
+ async resetExchange() {
165
+ return await salla.loyalty.reset()
166
+ .then(() => {
167
+ this.prizePoints = undefined;
168
+ this.prizeTitle = undefined;
169
+ }).catch(e => console.log(e));
170
+ }
171
+ /**
172
+ * Open Confirmation modal
173
+ */
174
+ async openConfirmation() {
175
+ return await this.modal.close()
176
+ .then(() => this.confirmationModal.open())
177
+ .catch(e => console.log(e));
178
+ }
179
+ /**
180
+ * Cancel process
181
+ */
182
+ async cancelProcess() {
183
+ return await this.confirmationModal.close()
184
+ .then(() => this.selectedItem = null)
185
+ .catch(e => console.log(e));
186
+ }
187
+ /**
188
+ * Exchange loyalty points with the selected prize item
189
+ * @param {number} loyalty_prize_id
190
+ *
191
+ */
192
+ async exchangeLoyaltyPoint() {
193
+ this.buttonLoading = true;
194
+ return await salla.loyalty.exchange(this.selectedItem.id)
195
+ .then((response) => {
196
+ this.loyaltyProgram = response.data;
197
+ })
198
+ .catch(e => console.log(e))
199
+ .finally(() => {
200
+ this.buttonLoading = false;
201
+ this.cancelProcess();
202
+ });
203
+ }
204
+ render() {
205
+ // A. when the exchange is done, and we have the final prize points to show it in cart page
206
+ if (this.prizePoints) {
207
+ return this.getAfterExchangeUI();
208
+ }
209
+ return [
210
+ index.h("slot", { name: 'widget' }, this.customerPoints ?
211
+ index.h("salla-list-tile", { class: 's-loyalty-widget' }, index.h("div", { slot: "icon", class: "s-loyalty-widget-icon", innerHTML: star2.Star2 }), index.h("div", { slot: "subtitle" }, this.is_loggedin ? salla.lang.get('pages.loyalty_program.cart_total_point_summary', { "balance": this.customerPoints }) : (this.guestMessage || salla.lang.get('pages.loyalty_program.guest_message')), index.h("salla-button", { shape: "link", color: "primary", onClick: () => salla.event.dispatch("loyalty::open") }, this.is_loggedin ? salla.lang.get('pages.loyalty_program.cart_point_exchange_now') : salla.lang.get('blocks.header.login')))) :
212
+ ''),
213
+ index.h("salla-modal", { noPadding: true, width: "sm", ref: modal => this.confirmationModal = modal }, this.getConfirmationModal()),
214
+ index.h("salla-modal", { isLoading: true, "has-skeleton": true, width: "md", ref: modal => this.modal = modal }, index.h("div", { slot: "loading" }, index.h("div", { class: "s-loyalty-skeleton" }, index.h("salla-list-tile", { class: "s-loyalty-header" }, index.h("div", { slot: "icon", class: "s-loyalty-header-icon" }, index.h("salla-skeleton", { type: "circle", height: '6rem', width: '6rem' })), index.h("div", { slot: "title", class: "s-loyalty-header-title mb-5" }, index.h("salla-skeleton", { height: '15px', width: '50%' })), index.h("div", { slot: "subtitle", class: "s-loyalty-header-subtitle" }, index.h("salla-skeleton", { height: '10px' }), index.h("salla-skeleton", { height: '10px', width: '75%' }))), index.h("div", { class: "s-loyalty-skeleton-cards" }, [...Array(3)].map(() => index.h("div", { class: "s-loyalty-prize-item" }, index.h("salla-skeleton", { height: '9rem' }), index.h("div", { class: "s-loyalty-prize-item-title" }, index.h("salla-skeleton", { height: '15px', width: '75%' })), index.h("div", { class: "s-loyalty-prize-item-subtitle" }, index.h("salla-skeleton", { height: '10px', width: '50%' }), index.h("salla-skeleton", { height: '10px', width: '25%' })), index.h("div", { class: "s-loyalty-prize-item-points" }, index.h("salla-skeleton", { height: '15px', width: '100px' }), index.h("div", { class: "s-loyalty-prize-item-check" }, index.h("salla-skeleton", { height: '1rem', width: '1rem', type: 'circle' })))))))), !!this.loyaltyProgram ?
215
+ [
216
+ index.h("salla-list-tile", { id: 's-loyalty-header', class: "s-loyalty-header" }, index.h("div", { slot: "icon", class: "s-loyalty-header-icon", innerHTML: GiftImg }), index.h("div", { slot: "title", class: "s-loyalty-header-title" }, this.loyaltyProgram.prize_promotion_title), index.h("div", { slot: "subtitle", class: "s-loyalty-header-subtitle" }, this.loyaltyProgram.prize_promotion_description)),
217
+ index.h("salla-tabs", null, this.loyaltyProgram.prizes.map((prize) => index.h("salla-tab-header", { slot: "header", name: prize.title }, index.h("span", null, prize.title))), this.loyaltyProgram.prizes.map((prize) => index.h("salla-tab-content", { slot: "content", name: prize.title }, index.h("salla-swiper", { "space-between-items": "20" }, prize.items.map((item) => this.prizeItem(item)))))),
218
+ index.h("salla-button", { disabled: !this.selectedItem, width: "wide", class: "s-loyalty-program-redeem-btn", onClick: () => this.openConfirmation() }, salla.lang.get('pages.loyalty_program.exchange_points')),
219
+ ]
220
+ : index.h("salla-placeholder", { class: "s-loyalty-placeholder", alignment: "center" })),
221
+ ];
222
+ }
223
+ componentDidLoad() {
224
+ this.is_loggedin = salla.config.isUser();
225
+ }
226
+ };
227
+ SallaLoyalty.style = sallaLoyaltyCss;
228
+
229
+ exports.salla_loyalty = SallaLoyalty;
@@ -0,0 +1,52 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ 'use strict';
5
+
6
+ Object.defineProperty(exports, '__esModule', { value: true });
7
+
8
+ const index = require('./index-0d0167d5.js');
9
+ const Helper = require('./Helper-8ae6a805.js');
10
+
11
+ const sallaProductSizeGuideCss = "";
12
+
13
+ const SallaProductSizeGuide = class {
14
+ constructor(hostRef) {
15
+ index.registerInstance(this, hostRef);
16
+ Helper.Helper.setHost(document);
17
+ salla.event.on('size-guide::open', (product_id) => this.open(product_id));
18
+ }
19
+ /**
20
+ * Show the size-guide modal window
21
+ */
22
+ async open(product_id) {
23
+ this.modal.setTitle(salla.lang.get('pages.products.size_guides'));
24
+ this.modal.open();
25
+ return await salla.product.getSizeGuides(product_id)
26
+ .then((response) => {
27
+ this.guides = response.data;
28
+ })
29
+ .catch(e => console.log(e))
30
+ .finally(() => this.modal.stopLoading());
31
+ }
32
+ /**
33
+ *
34
+ * Hide the size-guide modal window
35
+ */
36
+ async close() {
37
+ return this.modal.close();
38
+ }
39
+ // !Todo - Enhance placeholder text
40
+ showPlaceholder() {
41
+ return index.h("salla-placeholder", { alignment: "center", iconSize: "xl" }, index.h("div", { slot: "title" }, salla.lang.get('pages.products.size_guide_placeholder')), index.h("div", { slot: "description" }, salla.lang.get('pages.products.size_guide_placeholder_info')));
42
+ }
43
+ render() {
44
+ return (index.h(index.Host, { class: "s-product-size-guide-block" }, index.h("salla-modal", { id: 'salla-product-size-guide-modal', isLoading: true, "has-skeleton": true, width: "md", ref: modal => this.modal = modal }, index.h("div", { slot: "loading" }, index.h("div", { class: "s-product-size-guide-skeleton" }, index.h("salla-skeleton", { height: '15px', width: '25%' }), index.h("div", { class: "s-product-size-guide-skeleton-header" }, index.h("salla-skeleton", { height: '40px' }), index.h("salla-skeleton", { height: '40px' }), index.h("salla-skeleton", { height: '40px' }), index.h("salla-skeleton", { height: '40px' })), index.h("div", { class: "s-product-size-guide-skeleton-content" }, index.h("salla-skeleton", { height: '15px', width: '25%' }), index.h("salla-skeleton", { height: '10px', width: '75%' }), index.h("salla-skeleton", { height: '10px', width: '50%' }), index.h("salla-skeleton", { height: '10px', width: '75%' }), index.h("salla-skeleton", { height: '10px', width: '100%' }), index.h("salla-skeleton", { height: '10px', width: '25%' }), index.h("salla-skeleton", { height: '10px', width: '60%' }), index.h("salla-skeleton", { height: '10px', width: '45%' }), index.h("salla-skeleton", { height: '10px', width: '30%' })))), index.h("slot", { name: "header" }), !!this.guides ?
45
+ [index.h("div", { class: "container px-8" }, index.h("salla-tabs", null, this.guides.map((guide) => index.h("salla-tab-header", { slot: "header", name: guide.name }, index.h("span", null, guide.name))), this.guides.map((guide) => index.h("salla-tab-content", { slot: "content", name: guide.name }, index.h("div", { innerHTML: guide.description })))))]
46
+ : this.showPlaceholder(), index.h("slot", { name: "footer" }))));
47
+ }
48
+ get host() { return index.getElement(this); }
49
+ };
50
+ SallaProductSizeGuide.style = sallaProductSizeGuideCss;
51
+
52
+ exports.salla_product_size_guide = SallaProductSizeGuide;
@@ -0,0 +1,101 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ 'use strict';
5
+
6
+ Object.defineProperty(exports, '__esModule', { value: true });
7
+
8
+ const index = require('./index-0d0167d5.js');
9
+ const Helper = require('./Helper-8ae6a805.js');
10
+
11
+ const Add = `<!-- Generated by IcoMoon.io -->
12
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
13
+ <title>add</title>
14
+ <path d="M26.667 14.667h-9.333v-9.333c0-0.736-0.597-1.333-1.333-1.333s-1.333 0.597-1.333 1.333v9.333h-9.333c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333h9.333v9.333c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-9.333h9.333c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333z"></path>
15
+ </svg>
16
+ `;
17
+
18
+ const Minus = `<!-- Generated by IcoMoon.io -->
19
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
20
+ <title>minus</title>
21
+ <path d="M26.667 14.667h-21.333c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333h21.333c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333z"></path>
22
+ </svg>
23
+ `;
24
+
25
+ const sallaQuantityInputCss = "";
26
+
27
+ const SallaQuantityInput = class {
28
+ constructor(hostRef) {
29
+ index.registerInstance(this, hostRef);
30
+ this.hostAttributes = {};
31
+ this.hasIncrementSlot = false;
32
+ this.hasDecrementSlot = false;
33
+ this.didLoaded = false;
34
+ this.quantity = 1;
35
+ }
36
+ /**
37
+ * Workaround to fire change event for the input.
38
+ */
39
+ watchPropHandler() {
40
+ if (!this.didLoaded) {
41
+ return;
42
+ }
43
+ Helper.Helper.debounce(() => salla.document.event.fireEvent(this.textInput, 'change', { 'bubbles': true }));
44
+ }
45
+ componentWillLoad() {
46
+ this.quantity = parseInt(this.host.getAttribute('value')) || 1;
47
+ this.hasIncrementSlot = !!this.host.querySelector('[slot="increment-button"]');
48
+ this.hasDecrementSlot = !!this.host.querySelector('[slot="decrement-button"]');
49
+ }
50
+ componentDidLoad() {
51
+ this.didLoaded = true;
52
+ this.textInput.addEventListener('input', (event) => salla.helpers.inputDigitsOnly(event.target));
53
+ }
54
+ getInputAttributes() {
55
+ for (let i = 0; i < this.host.attributes.length; i++) {
56
+ if (!['id', 'value', 'min', 'class'].includes(this.host.attributes[i].name)) {
57
+ this.hostAttributes[this.host.attributes[i].name] = this.host.attributes[i].value;
58
+ }
59
+ }
60
+ return this.hostAttributes;
61
+ }
62
+ /**
63
+ * decrease quantity by one.
64
+ * @return HTMLSallaQuantityInputElement
65
+ */
66
+ async decrease() {
67
+ return this.setValue(this.quantity - 1);
68
+ }
69
+ /**
70
+ * increase quantity by one.
71
+ * @return HTMLSallaQuantityInputElement
72
+ */
73
+ async increase() {
74
+ return this.setValue(Number(this.quantity) + 1);
75
+ }
76
+ /**
77
+ * set quantity by one.
78
+ * @return HTMLSallaQuantityInputElement
79
+ */
80
+ async setValue(value) {
81
+ let maxQuantity = parseInt(this.host.getAttribute('max'));
82
+ if (maxQuantity && value > maxQuantity) {
83
+ value = maxQuantity;
84
+ }
85
+ if (value <= 1) {
86
+ value = 1;
87
+ }
88
+ this.quantity = value;
89
+ return this.host;
90
+ }
91
+ render() {
92
+ return (index.h(index.Host, { class: "s-quantity-input" }, index.h("div", { class: "s-quantity-input-container" }, index.h("button", { onClick: () => this.increase(), class: "s-quantity-input-increase-button s-quantity-input-button", type: "button" }, !this.hasIncrementSlot ? index.h("span", { innerHTML: Add }) : '', index.h("slot", { name: "increment-button" })), index.h("input", Object.assign({ class: "s-quantity-input-input" }, this.getInputAttributes(), { ref: (el) => this.textInput = el, onInput: (event) => this.setValue(event.target.value), min: "1", value: this.quantity })), index.h("button", { class: "s-quantity-input-decrease-button s-quantity-input-button", onClick: () => this.decrease(), type: "button" }, !this.hasDecrementSlot ? index.h("span", { innerHTML: Minus }) : '', index.h("slot", { name: "decrement-button" })))));
93
+ }
94
+ get host() { return index.getElement(this); }
95
+ static get watchers() { return {
96
+ "quantity": ["watchPropHandler"]
97
+ }; }
98
+ };
99
+ SallaQuantityInput.style = sallaQuantityInputCss;
100
+
101
+ exports.salla_quantity_input = SallaQuantityInput;