@salla.sa/twilight-components 2.13.53 → 2.13.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{Helper-134c96cd.js → Helper-11c2f7a7.js} +2 -2
- package/dist/cjs/Helper-11c2f7a7.js.map +1 -0
- package/dist/cjs/{app-globals-8f8d8f50.js → app-globals-db36c588.js} +5 -5
- package/dist/cjs/app-globals-db36c588.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-add-product-button_47.cjs.entry.js +1 -1
- package/dist/cjs/salla-add-product-button_47.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-reviews.cjs.entry.js +11 -5
- package/dist/cjs/salla-reviews.cjs.entry.js.map +1 -1
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/collection/Helpers/Helper.js +1 -1
- package/dist/collection/Helpers/Helper.js.map +1 -1
- package/dist/collection/components/salla-reviews/interfaces.js.map +1 -1
- package/dist/collection/components/salla-reviews/salla-reviews.js +97 -14
- package/dist/collection/components/salla-reviews/salla-reviews.js.map +1 -1
- package/dist/components/Helper.js +1 -1
- package/dist/components/Helper.js.map +1 -1
- package/dist/components/index.js +4 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/salla-quick-buy2.js.map +1 -1
- package/dist/components/salla-reviews.js +14 -5
- package/dist/components/salla-reviews.js.map +1 -1
- package/dist/esm/{Helper-6e1f8269.js → Helper-e84a53b2.js} +2 -2
- package/dist/esm/Helper-e84a53b2.js.map +1 -0
- package/dist/esm/{app-globals-c3c69e17.js → app-globals-29abf3e3.js} +5 -5
- package/dist/esm/app-globals-29abf3e3.js.map +1 -0
- package/dist/esm/loader.js +2 -2
- package/dist/esm/salla-add-product-button_47.entry.js +1 -1
- package/dist/esm/salla-add-product-button_47.entry.js.map +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-notifications.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +1 -1
- package/dist/esm/salla-products-slider.entry.js +1 -1
- package/dist/esm/salla-reviews.entry.js +11 -5
- package/dist/esm/salla-reviews.entry.js.map +1 -1
- package/dist/esm/twilight.js +2 -2
- package/dist/esm-es5/{Helper-6e1f8269.js → Helper-e84a53b2.js} +2 -2
- package/dist/esm-es5/Helper-e84a53b2.js.map +1 -0
- package/dist/esm-es5/{app-globals-c3c69e17.js → app-globals-29abf3e3.js} +3 -3
- package/dist/esm-es5/app-globals-29abf3e3.js.map +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/esm-es5/salla-add-product-button_47.entry.js +1 -1
- package/dist/esm-es5/salla-add-product-button_47.entry.js.map +1 -1
- package/dist/esm-es5/salla-filters-widget.entry.js +1 -1
- package/dist/esm-es5/salla-filters.entry.js +1 -1
- package/dist/esm-es5/salla-notifications.entry.js +1 -1
- package/dist/esm-es5/salla-orders.entry.js +1 -1
- package/dist/esm-es5/salla-products-list.entry.js +1 -1
- package/dist/esm-es5/salla-products-slider.entry.js +1 -1
- package/dist/esm-es5/salla-reviews.entry.js +1 -1
- package/dist/esm-es5/salla-reviews.entry.js.map +1 -1
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/esm-es5/twilight.js.map +1 -1
- package/dist/twilight/p-06221496.js +25 -0
- package/dist/twilight/p-06221496.js.map +1 -0
- package/dist/twilight/{p-868c776b.system.entry.js → p-1079c870.system.entry.js} +2 -2
- package/dist/twilight/{p-e7d5c03c.entry.js → p-20a47e29.entry.js} +2 -2
- package/dist/twilight/p-2866def3.system.entry.js +5 -0
- package/dist/twilight/p-2866def3.system.entry.js.map +1 -0
- package/dist/twilight/{p-d08d5f11.entry.js → p-508a9dbf.entry.js} +2 -2
- package/dist/twilight/p-546db59b.entry.js +5 -0
- package/dist/twilight/p-546db59b.entry.js.map +1 -0
- package/dist/twilight/{p-b0585915.system.entry.js → p-5be05a17.system.entry.js} +2 -2
- package/dist/twilight/{p-b0585915.system.entry.js.map → p-5be05a17.system.entry.js.map} +1 -1
- package/dist/twilight/{p-f629ebf3.js → p-5de9ca19.js} +2 -2
- package/dist/twilight/p-5de9ca19.js.map +1 -0
- package/dist/twilight/{p-49a5b997.entry.js → p-60d513b0.entry.js} +2 -2
- package/dist/twilight/{p-38e9e758.system.entry.js → p-69539ba8.system.entry.js} +2 -2
- package/dist/twilight/{p-7d3b8a00.entry.js → p-708b7673.entry.js} +2 -2
- package/dist/twilight/p-a7b263b2.system.js +25 -0
- package/dist/twilight/p-a7b263b2.system.js.map +1 -0
- package/dist/twilight/{p-b0c8cac2.entry.js → p-a859e3fc.entry.js} +2 -2
- package/dist/twilight/{p-e3444194.system.js → p-af17aa74.system.js} +2 -2
- package/dist/twilight/p-af17aa74.system.js.map +1 -0
- package/dist/twilight/{p-429870cc.entry.js → p-bc7cb3df.entry.js} +2 -2
- package/dist/twilight/{p-429870cc.entry.js.map → p-bc7cb3df.entry.js.map} +1 -1
- package/dist/twilight/{p-3e19dd7e.system.entry.js → p-dcb268c2.system.entry.js} +2 -2
- package/dist/twilight/{p-5e7ea64b.system.entry.js → p-e56c026b.system.entry.js} +2 -2
- package/dist/twilight/{p-09f168ed.system.entry.js → p-eed0af43.system.entry.js} +2 -2
- package/dist/twilight/{p-e8c4822f.system.entry.js → p-f493ef81.system.entry.js} +2 -2
- package/dist/twilight/p-f51c9acb.system.js +5 -0
- package/dist/twilight/{p-64d97ea7.system.js.map → p-f51c9acb.system.js.map} +1 -1
- package/dist/twilight/{p-9d552606.entry.js → p-f5e0d239.entry.js} +2 -2
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.esm.js.map +1 -1
- package/dist/twilight/twilight.js +1 -1
- package/dist/types/Helpers/Helper.d.ts +1 -1
- package/dist/types/components/salla-reviews/interfaces.d.ts +4 -2
- package/dist/types/components/salla-reviews/salla-reviews.d.ts +32 -6
- package/dist/types/components.d.ts +41 -9
- package/package.json +5 -5
- package/dist/cjs/Helper-134c96cd.js.map +0 -1
- package/dist/cjs/app-globals-8f8d8f50.js.map +0 -1
- package/dist/esm/Helper-6e1f8269.js.map +0 -1
- package/dist/esm/app-globals-c3c69e17.js.map +0 -1
- package/dist/esm-es5/Helper-6e1f8269.js.map +0 -1
- package/dist/esm-es5/app-globals-c3c69e17.js.map +0 -1
- package/dist/twilight/p-43badfba.js +0 -25
- package/dist/twilight/p-43badfba.js.map +0 -1
- package/dist/twilight/p-52f673f6.system.js +0 -25
- package/dist/twilight/p-52f673f6.system.js.map +0 -1
- package/dist/twilight/p-64d97ea7.system.js +0 -5
- package/dist/twilight/p-6b99863e.system.entry.js +0 -5
- package/dist/twilight/p-6b99863e.system.entry.js.map +0 -1
- package/dist/twilight/p-e3444194.system.js.map +0 -1
- package/dist/twilight/p-f209fb12.entry.js +0 -5
- package/dist/twilight/p-f209fb12.entry.js.map +0 -1
- package/dist/twilight/p-f629ebf3.js.map +0 -1
- /package/dist/twilight/{p-868c776b.system.entry.js.map → p-1079c870.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-e7d5c03c.entry.js.map → p-20a47e29.entry.js.map} +0 -0
- /package/dist/twilight/{p-d08d5f11.entry.js.map → p-508a9dbf.entry.js.map} +0 -0
- /package/dist/twilight/{p-49a5b997.entry.js.map → p-60d513b0.entry.js.map} +0 -0
- /package/dist/twilight/{p-38e9e758.system.entry.js.map → p-69539ba8.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-7d3b8a00.entry.js.map → p-708b7673.entry.js.map} +0 -0
- /package/dist/twilight/{p-b0c8cac2.entry.js.map → p-a859e3fc.entry.js.map} +0 -0
- /package/dist/twilight/{p-3e19dd7e.system.entry.js.map → p-dcb268c2.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-5e7ea64b.system.entry.js.map → p-e56c026b.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-09f168ed.system.entry.js.map → p-eed0af43.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-e8c4822f.system.entry.js.map → p-f493ef81.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-9d552606.entry.js.map → p-f5e0d239.entry.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Source, Review } from "./interfaces";
|
|
1
|
+
import { Source, Review, ReviewType, SortingOption } from "./interfaces";
|
|
2
2
|
export declare class SallaReviews {
|
|
3
3
|
constructor();
|
|
4
4
|
/**
|
|
@@ -13,8 +13,6 @@ export declare class SallaReviews {
|
|
|
13
13
|
* Specifies the data source for reviews.
|
|
14
14
|
*
|
|
15
15
|
* Valid options include:
|
|
16
|
-
* - 'store': Retrieves reviews for the entire store.
|
|
17
|
-
* - 'all': Retrieves reviews from all sources.
|
|
18
16
|
* - 'categories': Retrieves reviews for specific product categories.
|
|
19
17
|
* - 'products': Retrieves reviews for individual products.
|
|
20
18
|
* - 'json': Retrieves reviews from a custom JSON payload provided in `sourceValue`.
|
|
@@ -24,7 +22,7 @@ export declare class SallaReviews {
|
|
|
24
22
|
* @type {Source}
|
|
25
23
|
* @default "store"
|
|
26
24
|
*/
|
|
27
|
-
source
|
|
25
|
+
source?: Source;
|
|
28
26
|
/**
|
|
29
27
|
* Provides data specific to the chosen source.
|
|
30
28
|
*
|
|
@@ -33,9 +31,9 @@ export declare class SallaReviews {
|
|
|
33
31
|
* - 'products': An array of product IDs.
|
|
34
32
|
* - 'json': A custom JSON object containing review data.
|
|
35
33
|
*
|
|
36
|
-
* @type {
|
|
34
|
+
* @type {string | object | Array<number>}
|
|
37
35
|
*/
|
|
38
|
-
sourceValue
|
|
36
|
+
sourceValue?: string | object | Array<number>;
|
|
39
37
|
/**
|
|
40
38
|
* Defines the maximum number of reviews to retrieve from the API.
|
|
41
39
|
*
|
|
@@ -43,6 +41,34 @@ export declare class SallaReviews {
|
|
|
43
41
|
* @default 5
|
|
44
42
|
*/
|
|
45
43
|
limit: number;
|
|
44
|
+
/**
|
|
45
|
+
* Specifies the type of reviews to fetch.
|
|
46
|
+
* Available options:
|
|
47
|
+
* - "all": Fetches reviews from all sources.
|
|
48
|
+
* - "store": Fetches reviews specific to the store.
|
|
49
|
+
* - "products": Fetches reviews specific to products.
|
|
50
|
+
*
|
|
51
|
+
* @type {ReviewType}
|
|
52
|
+
* @default store
|
|
53
|
+
*/
|
|
54
|
+
type: ReviewType;
|
|
55
|
+
/**
|
|
56
|
+
* Specifies the sorting criteria for the fetched reviews.
|
|
57
|
+
* Available options:
|
|
58
|
+
* - "top_rating": Sorts reviews based on top ratings.
|
|
59
|
+
* - "random": Sorts reviews randomly.
|
|
60
|
+
* - "latest": Sorts reviews based on the latest ones (default).
|
|
61
|
+
*
|
|
62
|
+
* @type {SortingOption}
|
|
63
|
+
* @default latest
|
|
64
|
+
*/
|
|
65
|
+
sort: SortingOption;
|
|
66
|
+
/**
|
|
67
|
+
* Specifies whether to hide customer information in the component.
|
|
68
|
+
* When set to true, customer information will be hidden.
|
|
69
|
+
* Defaults to false, meaning customer information will be displayed.
|
|
70
|
+
*/
|
|
71
|
+
hideCustomerInfo: boolean;
|
|
46
72
|
reviews: Array<Review>;
|
|
47
73
|
isRTL: boolean;
|
|
48
74
|
showReviews: boolean;
|
|
@@ -16,7 +16,7 @@ import { MenuContentDTO, Sources } from "./components/salla-menu/interfaces";
|
|
|
16
16
|
import { Notification } from "./components/salla-notifications/interfaces";
|
|
17
17
|
import { OrderQueryParameters } from "./components/salla-orders/interface";
|
|
18
18
|
import { Donation, Option } from "./components/salla-product-options/interfaces";
|
|
19
|
-
import { Source } from "./components/salla-reviews/interfaces";
|
|
19
|
+
import { ReviewType, SortingOption, Source } from "./components/salla-reviews/interfaces";
|
|
20
20
|
import { Phone } from "./components/salla-tel-input/interfaces";
|
|
21
21
|
import { CustomField } from "./components/salla-user-profile/interfaces";
|
|
22
22
|
export { Color, Options } from "./components/salla-color-picker/interfaces";
|
|
@@ -30,7 +30,7 @@ export { MenuContentDTO, Sources } from "./components/salla-menu/interfaces";
|
|
|
30
30
|
export { Notification } from "./components/salla-notifications/interfaces";
|
|
31
31
|
export { OrderQueryParameters } from "./components/salla-orders/interface";
|
|
32
32
|
export { Donation, Option } from "./components/salla-product-options/interfaces";
|
|
33
|
-
export { Source } from "./components/salla-reviews/interfaces";
|
|
33
|
+
export { ReviewType, SortingOption, Source } from "./components/salla-reviews/interfaces";
|
|
34
34
|
export { Phone } from "./components/salla-tel-input/interfaces";
|
|
35
35
|
export { CustomField } from "./components/salla-user-profile/interfaces";
|
|
36
36
|
export namespace Components {
|
|
@@ -1648,6 +1648,10 @@ export namespace Components {
|
|
|
1648
1648
|
* @type {boolean}
|
|
1649
1649
|
*/
|
|
1650
1650
|
"displayAllLink": boolean;
|
|
1651
|
+
/**
|
|
1652
|
+
* Specifies whether to hide customer information in the component. When set to true, customer information will be hidden. Defaults to false, meaning customer information will be displayed.
|
|
1653
|
+
*/
|
|
1654
|
+
"hideCustomerInfo": boolean;
|
|
1651
1655
|
/**
|
|
1652
1656
|
* Defines the maximum number of reviews to retrieve from the API.
|
|
1653
1657
|
* @type {number}
|
|
@@ -1655,16 +1659,28 @@ export namespace Components {
|
|
|
1655
1659
|
*/
|
|
1656
1660
|
"limit": number;
|
|
1657
1661
|
/**
|
|
1658
|
-
* Specifies the
|
|
1662
|
+
* Specifies the sorting criteria for the fetched reviews. Available options: - "top_rating": Sorts reviews based on top ratings. - "random": Sorts reviews randomly. - "latest": Sorts reviews based on the latest ones (default).
|
|
1663
|
+
* @type {SortingOption}
|
|
1664
|
+
* @default latest
|
|
1665
|
+
*/
|
|
1666
|
+
"sort": SortingOption;
|
|
1667
|
+
/**
|
|
1668
|
+
* Specifies the data source for reviews. Valid options include: - 'categories': Retrieves reviews for specific product categories. - 'products': Retrieves reviews for individual products. - 'json': Retrieves reviews from a custom JSON payload provided in `sourceValue`. When using 'json' as the source, a valid payload must be provided in `sourceValue`.
|
|
1659
1669
|
* @type {Source}
|
|
1660
1670
|
* @default "store"
|
|
1661
1671
|
*/
|
|
1662
|
-
"source"
|
|
1672
|
+
"source"?: Source;
|
|
1663
1673
|
/**
|
|
1664
1674
|
* Provides data specific to the chosen source. Required when using 'categories', 'products', or 'json' as the source: - 'categories': An array of category IDs. - 'products': An array of product IDs. - 'json': A custom JSON object containing review data.
|
|
1665
|
-
* @type {
|
|
1675
|
+
* @type {string | object | Array<number>}
|
|
1676
|
+
*/
|
|
1677
|
+
"sourceValue"?: string | object | Array<number>;
|
|
1678
|
+
/**
|
|
1679
|
+
* Specifies the type of reviews to fetch. Available options: - "all": Fetches reviews from all sources. - "store": Fetches reviews specific to the store. - "products": Fetches reviews specific to products.
|
|
1680
|
+
* @type {ReviewType}
|
|
1681
|
+
* @default store
|
|
1666
1682
|
*/
|
|
1667
|
-
"
|
|
1683
|
+
"type": ReviewType;
|
|
1668
1684
|
}
|
|
1669
1685
|
interface SallaScopes {
|
|
1670
1686
|
/**
|
|
@@ -4127,6 +4143,10 @@ declare namespace LocalJSX {
|
|
|
4127
4143
|
* @type {boolean}
|
|
4128
4144
|
*/
|
|
4129
4145
|
"displayAllLink"?: boolean;
|
|
4146
|
+
/**
|
|
4147
|
+
* Specifies whether to hide customer information in the component. When set to true, customer information will be hidden. Defaults to false, meaning customer information will be displayed.
|
|
4148
|
+
*/
|
|
4149
|
+
"hideCustomerInfo"?: boolean;
|
|
4130
4150
|
/**
|
|
4131
4151
|
* Defines the maximum number of reviews to retrieve from the API.
|
|
4132
4152
|
* @type {number}
|
|
@@ -4134,16 +4154,28 @@ declare namespace LocalJSX {
|
|
|
4134
4154
|
*/
|
|
4135
4155
|
"limit"?: number;
|
|
4136
4156
|
/**
|
|
4137
|
-
* Specifies the
|
|
4157
|
+
* Specifies the sorting criteria for the fetched reviews. Available options: - "top_rating": Sorts reviews based on top ratings. - "random": Sorts reviews randomly. - "latest": Sorts reviews based on the latest ones (default).
|
|
4158
|
+
* @type {SortingOption}
|
|
4159
|
+
* @default latest
|
|
4160
|
+
*/
|
|
4161
|
+
"sort"?: SortingOption;
|
|
4162
|
+
/**
|
|
4163
|
+
* Specifies the data source for reviews. Valid options include: - 'categories': Retrieves reviews for specific product categories. - 'products': Retrieves reviews for individual products. - 'json': Retrieves reviews from a custom JSON payload provided in `sourceValue`. When using 'json' as the source, a valid payload must be provided in `sourceValue`.
|
|
4138
4164
|
* @type {Source}
|
|
4139
4165
|
* @default "store"
|
|
4140
4166
|
*/
|
|
4141
4167
|
"source"?: Source;
|
|
4142
4168
|
/**
|
|
4143
4169
|
* Provides data specific to the chosen source. Required when using 'categories', 'products', or 'json' as the source: - 'categories': An array of category IDs. - 'products': An array of product IDs. - 'json': A custom JSON object containing review data.
|
|
4144
|
-
* @type {
|
|
4170
|
+
* @type {string | object | Array<number>}
|
|
4171
|
+
*/
|
|
4172
|
+
"sourceValue"?: string | object | Array<number>;
|
|
4173
|
+
/**
|
|
4174
|
+
* Specifies the type of reviews to fetch. Available options: - "all": Fetches reviews from all sources. - "store": Fetches reviews specific to the store. - "products": Fetches reviews specific to products.
|
|
4175
|
+
* @type {ReviewType}
|
|
4176
|
+
* @default store
|
|
4145
4177
|
*/
|
|
4146
|
-
"
|
|
4178
|
+
"type"?: ReviewType;
|
|
4147
4179
|
}
|
|
4148
4180
|
interface SallaScopes {
|
|
4149
4181
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salla.sa/twilight-components",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.55",
|
|
4
4
|
"license": "GPL-3.0",
|
|
5
5
|
"author": "Salla Team <support@salla.dev> (https://salla.dev)",
|
|
6
6
|
"bugs": {
|
|
@@ -79,9 +79,9 @@
|
|
|
79
79
|
"typescript": "^5.2.2"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@salla.sa/applepay": "^2.13.
|
|
83
|
-
"@salla.sa/twilight": "^2.13.
|
|
84
|
-
"@salla.sa/twilight-tailwind-theme": "^2.13.
|
|
82
|
+
"@salla.sa/applepay": "^2.13.55",
|
|
83
|
+
"@salla.sa/twilight": "^2.13.55",
|
|
84
|
+
"@salla.sa/twilight-tailwind-theme": "^2.13.55",
|
|
85
85
|
"@types/node": "^20.4.8",
|
|
86
86
|
"animejs": "^3.2.1",
|
|
87
87
|
"filepond": "^4.30.4",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"vanilla-lazyload": "^17.8.3",
|
|
100
100
|
"vanilla-picker": "^2.12.1"
|
|
101
101
|
},
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "efba865f7649279fdf9975cae89e082902c40fda"
|
|
103
103
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"Helper-134c96cd.js","mappings":";;;;;;;AAMA;AACA,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;AAEjC,MAAM,MAAM;EAGV,oBAAoB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ;IACxD,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpE,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpE,IAAI,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IACnC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAC,MAAM,CAAC,IAAI,UAA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AI,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;MAClE,aAAa,EAAE,UAAU,CAAC,OAAO;MACjC,cAAc,EAAE;QACd,OAAO,EAAE,QAAQ;QACjB,YAAY,EAAE,GAAG;QACjB,aAAa,EAAE,GAAG;QAClB,aAAa,EAAE,GAAG;OACnB;KACF,CAAC;GACH;EAED,oBAAoB,CAAC,OAAsB;IACzC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,CAAC,IAAI,GAAG,qBAAqB,CAAC;IAGpC,MAAM,MAAM,GAAG;MACb,UAAU,EAAE,oBAAoB;MAChC,OAAO,EAAE,gBAAgB;MACzB,MAAM,EAAE,eAAe;MACvB,aAAa,EAAE,6BAA6B;MAC5C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;KACnE,CAAA;IAED,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC5C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;GACnC;CACF;AAED,iBAAe,IAAI,MAAM;;;;","names":["anime"],"sources":["src/Helpers/Helper.ts"],"sourcesContent":["import { ProductDetail, ProductResponse } from \"@salla.sa/twilight/types/api/product\";\nimport { Review } from \"../../src/components/salla-reviews/interfaces\";\nimport { Product as SallaProduct } from \"@salla.sa/twilight/types/common\";\nimport { ListItem, ItemList, Product as SchemaProduct, WithContext } from 'schema-dts';\nimport anime from 'animejs';\n\n//TODO::reduce it to 10\nsalla.event.setMaxListeners(100);\n\nclass Helper {\n private debounce_: any;\n\n toggleElementClassIf(element, classes1, classes2, callback) {\n classes1 = Array.isArray(classes1) ? classes1 : classes1.split(' ');\n classes2 = Array.isArray(classes2) ? classes2 : classes2.split(' ');\n let isClasses1 = callback(element);\n element?.classList.remove(...(isClasses1 ? classes2 : classes1));\n element?.classList.add(...(isClasses1 ? classes1 : classes2));\n return this;\n }\n\n toggleClassIf(selector, classes1, classes2, callback) {\n document.querySelectorAll(selector).forEach(element => this.toggleElementClassIf(element, classes1, classes2, callback));\n return this;\n }\n\n isValidEmail(email) {\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return re.test(String(email).toLowerCase());\n }\n\n filterEmojies(text) {\n var characterFilter = /(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\u0023-\\u0039]\\ufe0f?\\u20e3|\\u3299|\\u3297|\\u303d|\\u3030|\\u24c2|\\ud83c[\\udd70-\\udd71]|\\ud83c[\\udd7e-\\udd7f]|\\ud83c\\udd8e|\\ud83c[\\udd91-\\udd9a]|\\ud83c[\\udde6-\\uddff]|\\ud83c[\\ude01-\\ude02]|\\ud83c\\ude1a|\\ud83c\\ude2f|\\ud83c[\\ude32-\\ude3a]|\\ud83c[\\ude50-\\ude51]|\\u203c|\\u2049|[\\u25aa-\\u25ab]|\\u25b6|\\u25c0|[\\u25fb-\\u25fe]|\\u00a9|\\u00ae|\\u2122|\\u2139|\\ud83c\\udc04|[\\u2600-\\u26FF]|\\u2b05|\\u2b06|\\u2b07|\\u2b1b|\\u2b1c|\\u2b50|\\u2b55|\\u231a|\\u231b|\\u2328|\\u23cf|[\\u23e9-\\u23f3]|[\\u23f8-\\u23fa]|\\ud83c\\udccf|\\u2934|\\u2935|[\\u2190-\\u21ff])/g;\n return text.replace(characterFilter, \"\");\n }\n\n debounce(fn, ...data) {\n if (!this.debounce_) {\n this.debounce_ = salla.helpers.debounce((callback, ...innerData) => callback(...innerData), 500);\n }\n //@ts-ignore\n return this.debounce_(fn, ...data);\n }\n\n getProductsSource(source) {\n return {\n 'brands.single': 'brands',\n 'product.index': 'categories',\n 'product.index.latest': 'latest',\n 'product.index.offers': 'offers',\n 'product.index.search': 'search',\n 'customer.wishlist': 'wishlist',\n 'landing-page': 'landing-page',\n 'product.index.tag': 'tags',\n 'product.index.sales': 'sales',\n 'components.most_sales_products': 'sales',//temporary, delete it after two days from now\n }[source || salla.config.get('page.slug')] || source || 'latest';\n }\n\n getPageTitleForSource(source) {\n\n source = {\n 'brands': 'common.titles.brands',\n // 'categories':'',\n 'latest': 'blocks.home.latest_products',\n 'offers': 'common.titles.discounts',\n // 'search':'',\n // 'landing-page':'',\n // 'tags':'',\n 'sales': 'common.titles.most_sales',\n }[source];\n\n return source ? salla.lang.get(source) : '';\n }\n\n getProductsSourceValue(source, sourceValue) {\n const parsedSource = this.getProductsSource(source);\n\n // Validate if the source value is a valid JSON string\n let parsedSourceValue: any = null;\n if (sourceValue) {\n try {\n parsedSourceValue = JSON.parse(sourceValue);\n } catch (error) {\n console.error('Invalid JSON string in sourceValue:', error);\n }\n }\n\n // Handle different source types\n if (!['search', 'json', 'offers', 'latest', 'sales', 'related'].includes(parsedSource)) {\n\n if (Array.isArray(parsedSourceValue) && parsedSourceValue.length) {\n return parsedSourceValue;\n }\n\n\n if (Array.isArray(parsedSourceValue) && !parsedSourceValue.length) {\n return '';\n }\n\n if (typeof parsedSourceValue === 'number') {\n return [parsedSourceValue];\n }\n\n if (!sourceValue && ['categories', 'tags', 'brands'].includes(source)) {\n return [salla.config.get('page.id')];\n }\n }\n\n // Return sourceValue if it exists and is a valid JSON object/array\n if (parsedSourceValue || sourceValue) {\n return parsedSourceValue || sourceValue;\n }\n\n if (parsedSource === 'search') {\n return new URLSearchParams(window.location.search).get('q') || '';\n }\n\n // Return page id as default value\n return salla.config.get('page.id');\n }\n\n extractFiltersFromUrl(searchParams) {\n let filters = {};\n searchParams.forEach((value, key) => {\n // Handle filters[xxx] format\n const matchesNested = key.match(/^filters\\[(.*?)\\](\\[(.*?)\\])?$/u);\n\n if (matchesNested) {\n const filterName = matchesNested[1];\n const nestedKey = matchesNested[3];\n\n if (nestedKey) {\n // Handle nested object\n filters[filterName] = filters[filterName] || {};\n filters[filterName][nestedKey] = value;\n } else {\n // Handle regular key\n filters[filterName] = value;\n }\n } else {\n // Handle simple key-value pairs\n const matchesSimple = key.match(/^(.*?)$/u);\n\n if (matchesSimple) {\n filters[matchesSimple[1]] = value;\n }\n }\n });\n return filters;\n }\n\n /**\n * We needed this function to help us avoid requesting the products list before salla is ready,\n * was causing a strange issues in live for the bad connections ex: not loading the dom, requesting api without storeIdentefire\n */\n onSallaReadyPromise(callback): Promise<any> {\n return new Promise((resolve) => salla.onReady(() => callback(resolve)));\n }\n\n /**\n * \n * let's make sure to send the request only when salla is ready\n * we will return the data and the resolve callback, to give the component the green light (by resolving the Promise in onSallaReadyPromise) to render only when we have the data\n * we will return the data and the resolve callback, to give the component the green light (by resolving the Promise in onSallaReadyPromise) to render only when we have the data\n */\n fetchProducts(source, source_value, limit): Promise<ProductResponse.lists> {\n return this.onSallaReadyPromise((resolve) => resolve(salla.product.api.fetch({ source: source, source_value: source_value, limit: limit })));\n }\n\n getProductSchemaMarkupScript(product: any): HTMLScriptElement {\n const scriptElement = document.createElement('script');\n scriptElement.type = 'application/ld+json';\n // TODO: This json object MIGHT need mode data or properties.\n const jsonData = {\n \"@context\": \"http://schema.org\",\n \"@type\": \"Product\",\n \"name\": product?.name,\n \"image\": product?.image?.url || product?.thumbnail,\n \"description\": product?.description,\n \"brand\": {\n \"@type\": \"Brand\",\n \"logo\": product?.brand?.logo\n },\n \"offers\": {\n \"@type\": \"Offer\",\n \"price\": product?.price\n }\n };\n scriptElement.text = JSON.stringify(jsonData);\n return scriptElement\n }\n\n createProductSchema(product: SallaProduct | ProductDetail, position: number): ListItem {\n let ProductSchema: SchemaProduct = {\n \"productID\": `${product.id}`,\n \"@type\": 'Product',\n \"name\": product.name,\n \"url\": product.url,\n \"image\": product.image.url || (product.image as string),\n \"description\": product.description || product.subtitle || product.name,\n \"offers\": {\n \"@type\": \"Offer\",\n \"url\": product.url,\n \"priceCurrency\": product.currency,\n \"price\": product.price,\n \"itemCondition\": \"NewCondition\",\n \"availability\": product.is_available ? \"InStock\" : \"OutOfStock\",\n //if there is no product.discount_ends, will set it to be valid until the end of this week\n \"priceValidUntil\": product.discount_ends || (new Date(new Date().setDate(new Date().getDate() + 7)).toISOString().split('T')[0]),\n \"priceSpecification\": {\n \"@type\": \"PriceSpecification\",\n \"price\": product.regular_price,\n \"priceCurrency\": product.currency,\n \"valueAddedTaxIncluded\": product.is_taxable,\n },\n \"seller\": {\n \"@type\": \"Organization\",\n \"name\": salla.config.get('store.name'),\n },\n }\n };\n //@ts-ignore\n if (product.rating?.stars) {\n ProductSchema.aggregateRating = {\n \"@type\": \"AggregateRating\",\n //@ts-ignore\n \"ratingValue\": product.rating.stars,\n \"reviewCount\": product.rating.count,\n };\n }\n\n\n return {\n \"@type\": \"ListItem\",\n \"position\": position,\n \"item\": ProductSchema,\n\n };\n }\n \n generateProductSchema(productList: Array<SallaProduct | ProductDetail>) {\n const schemaId = 'salla-product-schema-script';\n if (document.getElementById(schemaId)) {\n salla.logger.warn(`already added schema-script with id (${schemaId})!`)\n return;\n }\n\n const script = document.createElement('script');\n script.type = 'application/ld+json';\n script.id = schemaId;\n\n\n const schema: WithContext<ItemList> = {\n \"@context\": \"https://schema.org\",\n \"@type\": \"ItemList\",\n \"name\": salla.config.get('page.title'),\n \"itemListElement\": productList.map((product, indxe) => this.createProductSchema(product, indxe + 1)),\n };\n\n script.textContent = JSON.stringify(schema);\n document.head.appendChild(script);\n }\n\n /**\n * Format date in the form of `Monday 13 November 2023`\n */\n formatDateFromString(dateString: string, numberCb: Function, lang: string = 'en'): string {\n const dateObject = new Date(dateString);\n\n const errors = {\n en: \"Invalid Date\",\n ar: \"تاريخ غير صالح\"\n }\n\n if (isNaN(dateObject.getTime())) {\n return errors[lang];\n }\n\n const daysOfWeek = {\n en: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n ar: ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت']\n };\n const months = {\n en: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\n ar: ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر']\n };\n\n const dayOfWeek = daysOfWeek[lang][dateObject.getDay()];\n const dayOfMonth = numberCb(dateObject.getDate(), lang === 'en');\n const month = months[lang][dateObject.getMonth()];\n const year = numberCb(dateObject.getFullYear(), lang === 'en');\n\n return `${dayOfWeek} ${dayOfMonth} ${month} ${year}`;\n }\n\n /**\n * Copy text into clipboard.\n * @param event \n */\n copyToClipboard(event) {\n // Get the text content from the clicked div\n var textToCopy = event.target.innerText;\n\n // Use the Clipboard API to copy text to the clipboard\n navigator.clipboard.writeText(textToCopy)\n .then(() => {\n console.log('Text copied to clipboard: ' + textToCopy);\n })\n .catch(err => {\n console.error('Unable to copy text to clipboard', err);\n });\n\n }\n\n animateItems(items: NodeListOf<Element>) {\n if (!items) return;\n anime({\n targets: items,\n opacity: [0, 1],\n duration: 1200,\n translateY: [20, 0],\n delay: function (_el, i) {\n return i * 100;\n },\n easing: 'easeOutExpo',\n complete: function (_anim) {\n items.forEach((item: Element) => {\n item.classList.add('animated');\n })\n }\n\n })\n }\n\n createReviewObject(reviewData: Review) {\n return {\n \"@type\": \"Review\",\n \"author\": reviewData.name,\n \"datePublished\": Date.parse(reviewData.created_at.date).toString(),\n \"description\": reviewData.content,\n \"reviewRating\": {\n \"@type\": \"Rating\",\n \"bestRating\": \"5\",\n \"ratingValue\": \"5\",\n \"worstRating\": \"1\"\n }\n };\n }\n\n generateReviewSchema(reviews: Array<Review>){\n const script = document.createElement('script');\n script.type = 'application/ld+json';\n\n\n const schema = {\n \"@context\": \"http://schema.org/\",\n \"@type\": \"CollectionPage\",\n \"name\": \"Category Name\", // TODO: check for the correct value here\n \"description\": \"Description of the category\", // TODO: here too\n \"review\": reviews.map((review) => this.createReviewObject(review))\n }\n\n script.textContent = JSON.stringify(schema);\n document.head.appendChild(script);\n }\n}\n\nexport default new Helper;\n"],"version":3}
|