ads-web-sdkm 2.0.24
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/README.md +369 -0
- package/dist/AdsCarousel.css +1 -0
- package/dist/AdsCarousel.d.ts +1 -0
- package/dist/AdsCarousel.js +519 -0
- package/dist/AdsCarousel.js.map +1 -0
- package/dist/Brandshop.css +1 -0
- package/dist/Brandshop.d.ts +1 -0
- package/dist/Brandshop.js +918 -0
- package/dist/Brandshop.js.map +1 -0
- package/dist/Brandshops.css +1 -0
- package/dist/Brandshops.d.ts +1 -0
- package/dist/Brandshops.js +103 -0
- package/dist/Brandshops.js.map +1 -0
- package/dist/Image-zvdPHg5N.js +35 -0
- package/dist/Image-zvdPHg5N.js.map +1 -0
- package/dist/ReactQueryProvider-D__k2BsQ.js +6755 -0
- package/dist/ReactQueryProvider-D__k2BsQ.js.map +1 -0
- package/dist/ads-CChrT00a.js +4470 -0
- package/dist/ads-CChrT00a.js.map +1 -0
- package/dist/api/queries/useGetAds.d.ts +16 -0
- package/dist/api/queries/useGetBrandshop.d.ts +14 -0
- package/dist/api/queries/useGetBrandshopList.d.ts +11 -0
- package/dist/api/queries/useGetCollection.d.ts +11 -0
- package/dist/api/services/getAds.d.ts +14 -0
- package/dist/api/services/getBrandshop.d.ts +13 -0
- package/dist/api/services/getBrandshopList.d.ts +11 -0
- package/dist/api/services/getCollection.d.ts +4 -0
- package/dist/components/Brandshop/Banner.d.ts +6 -0
- package/dist/components/Brandshop/BannerSection.d.ts +15 -0
- package/dist/components/Brandshop/BannerWithLink.d.ts +8 -0
- package/dist/components/Brandshop/Brandshop.d.ts +16 -0
- package/dist/components/Brandshop/BrandshopContent.d.ts +3 -0
- package/dist/components/Brandshop/BrandshopError.d.ts +6 -0
- package/dist/components/Brandshop/BrandshopSection.d.ts +18 -0
- package/dist/components/Brandshop/BrandshopSkeleton.d.ts +1 -0
- package/dist/components/Brandshop/CategorySection.d.ts +14 -0
- package/dist/components/Brandshop/NavigationSection.d.ts +16 -0
- package/dist/components/Brandshop/ProductSliderSection.d.ts +18 -0
- package/dist/components/Brandshop/index.d.ts +1 -0
- package/dist/components/Brandshops/Brandshops.d.ts +11 -0
- package/dist/components/Brandshops/BrandshopsList.d.ts +3 -0
- package/dist/components/Brandshops/BrandshopsSkeleton.d.ts +6 -0
- package/dist/components/Brandshops/index.d.ts +1 -0
- package/dist/components/Card/Card.d.ts +8 -0
- package/dist/components/Carousel/AdBanner.d.ts +17 -0
- package/dist/components/Carousel/AdBanners.d.ts +24 -0
- package/dist/components/Carousel/AdCarousel.d.ts +43 -0
- package/dist/components/Carousel/AdSkeleton.d.ts +8 -0
- package/dist/components/Carousel/AdsCarousel.d.ts +24 -0
- package/dist/components/Carousel/index.d.ts +1 -0
- package/dist/components/Chip/Chip.d.ts +6 -0
- package/dist/components/ErrorBoundary/ErrorBoundary.d.ts +18 -0
- package/dist/components/Image/Image.d.ts +13 -0
- package/dist/components/ProductsCarousel/CouponBadge.d.ts +8 -0
- package/dist/components/ProductsCarousel/DiscountChip.d.ts +12 -0
- package/dist/components/ProductsCarousel/PriceDisplay.d.ts +8 -0
- package/dist/components/ProductsCarousel/ProductCard.d.ts +15 -0
- package/dist/components/ProductsCarousel/ProductCardSkeleton.d.ts +5 -0
- package/dist/components/ProductsCarousel/ProductSliderSkeleton.d.ts +5 -0
- package/dist/components/ProductsCarousel/ProductTitle.d.ts +5 -0
- package/dist/components/ProductsCarousel/ProductsCarousel.d.ts +11 -0
- package/dist/hooks/use-async-memo.d.ts +1 -0
- package/dist/hooks/use-is-platform.d.ts +8 -0
- package/dist/hooks/useDetectScrolledToBottom.d.ts +5 -0
- package/dist/hooks/useSwipeThreshold.d.ts +4 -0
- package/dist/providers/ReactQueryProvider.d.ts +5 -0
- package/dist/types/ads.d.ts +116 -0
- package/dist/types/brandshop.d.ts +62 -0
- package/dist/types/brandshopsList.d.ts +32 -0
- package/dist/types/configTypes.d.ts +16 -0
- package/dist/types/enums.d.ts +8 -0
- package/dist/types/products.d.ts +72 -0
- package/dist/types/tenures.d.ts +11 -0
- package/dist/types/types.d.ts +2 -0
- package/dist/utils/analytics/trackAdsEvent.d.ts +16 -0
- package/dist/utils/analytics/trackBrandshopEvents.d.ts +15 -0
- package/dist/utils/helpers/ads.d.ts +3 -0
- package/dist/utils/helpers/authToken.d.ts +5 -0
- package/dist/utils/helpers/discountChip.d.ts +14 -0
- package/dist/utils/helpers/getBaseUrl.d.ts +4 -0
- package/dist/utils/helpers/mergeClasses.d.ts +1 -0
- package/dist/utils/helpers/price-utils.d.ts +1 -0
- package/dist/utils/helpers/productDiscounts.d.ts +3 -0
- package/dist/utils/helpers/products.d.ts +4 -0
- package/dist/utils/helpers/text.d.ts +1 -0
- package/dist/utils/helpers/translate.d.ts +63 -0
- package/dist/utils/helpers/utilities.d.ts +1 -0
- package/dist/utils/validations/ads.d.ts +7 -0
- package/package.json +81 -0
|
@@ -0,0 +1,918 @@
|
|
|
1
|
+
import { jsxs as h, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { g as L, a as W, u as G, R as K } from "./ReactQueryProvider-D__k2BsQ.js";
|
|
3
|
+
import { useState as T, useEffect as P, Component as V } from "react";
|
|
4
|
+
import { h as B, b as F, c as q, d as j, e as Z, f as H, g as z, S as k, u as J, a as X, A as O } from "./ads-CChrT00a.js";
|
|
5
|
+
import { I as f } from "./Image-zvdPHg5N.js";
|
|
6
|
+
const ee = async ({
|
|
7
|
+
deviceType: e,
|
|
8
|
+
language: t,
|
|
9
|
+
brandshopId: o,
|
|
10
|
+
environment: r,
|
|
11
|
+
adServerApiKey: a
|
|
12
|
+
}) => {
|
|
13
|
+
const [s, l] = await L(a), u = W("adServer", r);
|
|
14
|
+
try {
|
|
15
|
+
return (await (await fetch(
|
|
16
|
+
`${u}/api/v2/brandshop/server/${o}`,
|
|
17
|
+
{
|
|
18
|
+
headers: {
|
|
19
|
+
device: e,
|
|
20
|
+
lang: t,
|
|
21
|
+
"auth-token": s,
|
|
22
|
+
"auth-timestamp": l
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
)).json()).data;
|
|
26
|
+
} catch (d) {
|
|
27
|
+
throw new Error(`Failed to fetch brandshop details - ${d}`);
|
|
28
|
+
}
|
|
29
|
+
}, ne = "brandshop", te = ({
|
|
30
|
+
deviceType: e,
|
|
31
|
+
language: t,
|
|
32
|
+
brandshopId: o,
|
|
33
|
+
environment: r,
|
|
34
|
+
adServerApiKey: a,
|
|
35
|
+
enabled: s
|
|
36
|
+
}) => G({
|
|
37
|
+
queryKey: [
|
|
38
|
+
ne,
|
|
39
|
+
o,
|
|
40
|
+
e,
|
|
41
|
+
t
|
|
42
|
+
],
|
|
43
|
+
queryFn: () => ee({
|
|
44
|
+
deviceType: e,
|
|
45
|
+
language: t,
|
|
46
|
+
brandshopId: o,
|
|
47
|
+
environment: r,
|
|
48
|
+
adServerApiKey: a
|
|
49
|
+
}),
|
|
50
|
+
enabled: s
|
|
51
|
+
}), oe = "_brandshopContent_1lmgx_7", re = "_sectionContainer_1lmgx_39", ae = "_sectionTitle_1lmgx_55", ce = "_navigationSection_1lmgx_121", ie = "_navigationLogo_1lmgx_137", se = "_navigationLinks_1lmgx_147", le = "_navigationLink_1lmgx_147", de = "_navigationSectionContainer_1lmgx_187", _e = "_bannerButton_1lmgx_281", ue = "_banner_1lmgx_281", me = "_bannerCta_1lmgx_301", pe = "_bannerImage_1lmgx_329", ge = "_categoryContainer_1lmgx_409", he = "_categoryTile_1lmgx_423", Ce = "_categoryImageWrapper_1lmgx_443", ve = "_categoryImage_1lmgx_443", ke = "_categoryName_1lmgx_473", Se = "_categoryNameShrink_1lmgx_503", Ne = "_categoryShrinkGap_1lmgx_511", fe = "_cols3_1lmgx_533", be = "_cols2_1lmgx_541", ye = "_brandshopContainerSkeleton_1lmgx_621", xe = "_bannerSkeleton_1lmgx_639", Te = "_navContainerSkeleton_1lmgx_651", Pe = "_navPillSkeleton_1lmgx_665", we = "_categoryGridSkeleton_1lmgx_677", Be = "_categoryTileSkeleton_1lmgx_689", $e = "_promoSkeleton_1lmgx_701", Ae = "_brandshopError_1lmgx_775", Ie = "_errorIcon_1lmgx_805", Ee = "_errorContent_1lmgx_817", Oe = "_errorText_1lmgx_833", De = "_errorButton_1lmgx_875", c = {
|
|
52
|
+
brandshopContent: oe,
|
|
53
|
+
sectionContainer: re,
|
|
54
|
+
sectionTitle: ae,
|
|
55
|
+
navigationSection: ce,
|
|
56
|
+
navigationLogo: ie,
|
|
57
|
+
navigationLinks: se,
|
|
58
|
+
navigationLink: le,
|
|
59
|
+
navigationSectionContainer: de,
|
|
60
|
+
bannerButton: _e,
|
|
61
|
+
banner: ue,
|
|
62
|
+
bannerCta: me,
|
|
63
|
+
bannerImage: pe,
|
|
64
|
+
categoryContainer: ge,
|
|
65
|
+
categoryTile: he,
|
|
66
|
+
categoryImageWrapper: Ce,
|
|
67
|
+
categoryImage: ve,
|
|
68
|
+
categoryName: ke,
|
|
69
|
+
categoryNameShrink: Se,
|
|
70
|
+
categoryShrinkGap: Ne,
|
|
71
|
+
cols3: fe,
|
|
72
|
+
cols2: be,
|
|
73
|
+
brandshopContainerSkeleton: ye,
|
|
74
|
+
bannerSkeleton: xe,
|
|
75
|
+
navContainerSkeleton: Te,
|
|
76
|
+
navPillSkeleton: Pe,
|
|
77
|
+
categoryGridSkeleton: we,
|
|
78
|
+
categoryTileSkeleton: Be,
|
|
79
|
+
promoSkeleton: $e,
|
|
80
|
+
brandshopError: Ae,
|
|
81
|
+
errorIcon: Ie,
|
|
82
|
+
errorContent: Ee,
|
|
83
|
+
errorText: Oe,
|
|
84
|
+
errorButton: De
|
|
85
|
+
}, Le = ({
|
|
86
|
+
image: e,
|
|
87
|
+
text: t,
|
|
88
|
+
alt: o,
|
|
89
|
+
onClick: r
|
|
90
|
+
}) => e ? /* @__PURE__ */ h("button", { type: "button", className: c.bannerButton, onClick: r, children: [
|
|
91
|
+
/* @__PURE__ */ n(f, { src: e, alt: o, className: c.bannerImage }),
|
|
92
|
+
/* @__PURE__ */ n("div", { className: c.bannerCta, children: t })
|
|
93
|
+
] }) : null, We = ({ image: e, alt: t }) => /* @__PURE__ */ n("div", { className: c.banner, children: /* @__PURE__ */ n(f, { src: e, alt: t, className: c.bannerImage, fetchPriority: "high" }) }), N = (e, t, o) => {
|
|
94
|
+
switch (e) {
|
|
95
|
+
case "ads_bs_pageload":
|
|
96
|
+
case "ads_bs_pageend": {
|
|
97
|
+
const { brandName: r, userStatus: a, platform: s } = t;
|
|
98
|
+
o?.(e, {
|
|
99
|
+
brand_name: r,
|
|
100
|
+
user_status: a,
|
|
101
|
+
platform: s
|
|
102
|
+
});
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
case "ads_bs_section_view": {
|
|
106
|
+
const { brandName: r, sectionName: a, sectionOrder: s, userStatus: l, platform: u } = t;
|
|
107
|
+
o?.(e, {
|
|
108
|
+
brand_name: r,
|
|
109
|
+
section_name: a,
|
|
110
|
+
section_order: s,
|
|
111
|
+
user_status: l,
|
|
112
|
+
platform: u
|
|
113
|
+
});
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
case "ads_bs_content_click": {
|
|
117
|
+
const { contentName: r, contentOrder: a, userStatus: s, platform: l } = t;
|
|
118
|
+
o?.(e, {
|
|
119
|
+
content_name: r,
|
|
120
|
+
content_order: a,
|
|
121
|
+
user_status: s,
|
|
122
|
+
platform: l
|
|
123
|
+
});
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}, Ge = ({
|
|
128
|
+
title: e,
|
|
129
|
+
hideTitle: t,
|
|
130
|
+
banners: o,
|
|
131
|
+
isLoggedin: r,
|
|
132
|
+
sectionTitle: a,
|
|
133
|
+
onBannerClick: s,
|
|
134
|
+
trackBrandshopHandler: l
|
|
135
|
+
}) => {
|
|
136
|
+
const u = (d) => {
|
|
137
|
+
if (!d?.link?.link_destination) return;
|
|
138
|
+
N(
|
|
139
|
+
"ads_bs_content_click",
|
|
140
|
+
{
|
|
141
|
+
contentName: a,
|
|
142
|
+
contentOrder: d.display_order.toString(),
|
|
143
|
+
userStatus: r ? "logged_in" : "guest",
|
|
144
|
+
platform: "Web"
|
|
145
|
+
},
|
|
146
|
+
l
|
|
147
|
+
);
|
|
148
|
+
const g = B(d.link.link_destination);
|
|
149
|
+
g && s(g);
|
|
150
|
+
};
|
|
151
|
+
return o.length === 0 ? null : /* @__PURE__ */ h("div", { className: c.sectionContainer, children: [
|
|
152
|
+
!t && /* @__PURE__ */ n("h2", { className: c.sectionTitle, children: e }),
|
|
153
|
+
o.map((d) => d.link ? /* @__PURE__ */ n(
|
|
154
|
+
Le,
|
|
155
|
+
{
|
|
156
|
+
image: d.image,
|
|
157
|
+
text: d.link.link_text,
|
|
158
|
+
alt: e,
|
|
159
|
+
onClick: () => u(d)
|
|
160
|
+
},
|
|
161
|
+
d.tracking_id
|
|
162
|
+
) : /* @__PURE__ */ n(
|
|
163
|
+
We,
|
|
164
|
+
{
|
|
165
|
+
image: d.image,
|
|
166
|
+
alt: e
|
|
167
|
+
},
|
|
168
|
+
d.tracking_id
|
|
169
|
+
))
|
|
170
|
+
] });
|
|
171
|
+
}, Me = ({
|
|
172
|
+
title: e,
|
|
173
|
+
hideTitle: t,
|
|
174
|
+
categories: o,
|
|
175
|
+
isLoggedin: r,
|
|
176
|
+
onCategoryClick: a,
|
|
177
|
+
trackBrandshopHandler: s
|
|
178
|
+
}) => {
|
|
179
|
+
const l = (i) => {
|
|
180
|
+
if (!i?.link?.link_destination) return;
|
|
181
|
+
N(
|
|
182
|
+
"ads_bs_content_click",
|
|
183
|
+
{
|
|
184
|
+
contentName: i.category_name,
|
|
185
|
+
contentOrder: i.display_order.toString(),
|
|
186
|
+
userStatus: r ? "logged_in" : "guest",
|
|
187
|
+
platform: "Web"
|
|
188
|
+
},
|
|
189
|
+
s
|
|
190
|
+
);
|
|
191
|
+
const m = B(i.link.link_destination);
|
|
192
|
+
m && a(m);
|
|
193
|
+
};
|
|
194
|
+
if (o.length < 2) return null;
|
|
195
|
+
const u = o.slice(0, 6), d = [...u].sort(
|
|
196
|
+
(i, m) => i.display_order - m.display_order
|
|
197
|
+
), g = u.length === 2 || u.length === 4 ? 2 : 3;
|
|
198
|
+
return /* @__PURE__ */ h("div", { className: c.sectionContainer, children: [
|
|
199
|
+
!t && /* @__PURE__ */ n("h2", { className: c.sectionTitle, children: e }),
|
|
200
|
+
/* @__PURE__ */ n(
|
|
201
|
+
"div",
|
|
202
|
+
{
|
|
203
|
+
className: `${c.categoryContainer} ${c[`cols${g}`]} ${u.length === 6 ? c.categoryShrinkGap : ""}`,
|
|
204
|
+
children: d.map((i) => i ? /* @__PURE__ */ h(
|
|
205
|
+
"button",
|
|
206
|
+
{
|
|
207
|
+
className: c.categoryTile,
|
|
208
|
+
onClick: () => l(i),
|
|
209
|
+
children: [
|
|
210
|
+
/* @__PURE__ */ n("div", { className: c.categoryImageWrapper, children: i.image && /* @__PURE__ */ n(
|
|
211
|
+
f,
|
|
212
|
+
{
|
|
213
|
+
src: i.image,
|
|
214
|
+
alt: i.category_name ?? e,
|
|
215
|
+
className: c.categoryImage
|
|
216
|
+
}
|
|
217
|
+
) }),
|
|
218
|
+
i.category_name && /* @__PURE__ */ n(
|
|
219
|
+
"span",
|
|
220
|
+
{
|
|
221
|
+
className: `${c.categoryName} ${u.length === 6 ? c.categoryNameShrink : ""}`,
|
|
222
|
+
children: i.category_name
|
|
223
|
+
}
|
|
224
|
+
)
|
|
225
|
+
]
|
|
226
|
+
},
|
|
227
|
+
i.tracking_id
|
|
228
|
+
) : null)
|
|
229
|
+
}
|
|
230
|
+
)
|
|
231
|
+
] });
|
|
232
|
+
}, Re = ({
|
|
233
|
+
title: e,
|
|
234
|
+
hideTitle: t,
|
|
235
|
+
logo: o,
|
|
236
|
+
navigationLinks: r,
|
|
237
|
+
isLoggedin: a,
|
|
238
|
+
brandshopName: s,
|
|
239
|
+
onLinkClick: l,
|
|
240
|
+
trackBrandshopHandler: u
|
|
241
|
+
}) => {
|
|
242
|
+
const d = (i) => {
|
|
243
|
+
N(
|
|
244
|
+
"ads_bs_content_click",
|
|
245
|
+
{
|
|
246
|
+
contentName: i.link.link_text,
|
|
247
|
+
contentOrder: i.link.link_display_order.toString(),
|
|
248
|
+
userStatus: a ? "logged_in" : "guest",
|
|
249
|
+
platform: "Web"
|
|
250
|
+
},
|
|
251
|
+
u
|
|
252
|
+
);
|
|
253
|
+
const m = B(i.link.link_destination);
|
|
254
|
+
m && l(m);
|
|
255
|
+
};
|
|
256
|
+
if (r.length === 0) return null;
|
|
257
|
+
const g = [...r].sort(
|
|
258
|
+
(i, m) => i.link.link_display_order - m.link.link_display_order
|
|
259
|
+
);
|
|
260
|
+
return /* @__PURE__ */ h(
|
|
261
|
+
"div",
|
|
262
|
+
{
|
|
263
|
+
className: `${c.sectionContainer} ${c.navigationSectionContainer}`,
|
|
264
|
+
children: [
|
|
265
|
+
!t && /* @__PURE__ */ n("h2", { className: c.sectionTitle, children: e }),
|
|
266
|
+
/* @__PURE__ */ h("div", { className: c.navigationSection, children: [
|
|
267
|
+
o && /* @__PURE__ */ n("h1", { children: /* @__PURE__ */ n(
|
|
268
|
+
f,
|
|
269
|
+
{
|
|
270
|
+
src: o,
|
|
271
|
+
alt: s ?? e,
|
|
272
|
+
className: c.navigationLogo
|
|
273
|
+
}
|
|
274
|
+
) }),
|
|
275
|
+
/* @__PURE__ */ n("div", { className: c.navigationLinks, children: g.map((i) => /* @__PURE__ */ n(
|
|
276
|
+
"button",
|
|
277
|
+
{
|
|
278
|
+
className: c.navigationLink,
|
|
279
|
+
onClick: () => d(i),
|
|
280
|
+
children: i.link.link_text
|
|
281
|
+
},
|
|
282
|
+
i.tracking_id
|
|
283
|
+
)) })
|
|
284
|
+
] })
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
);
|
|
288
|
+
};
|
|
289
|
+
var M = /* @__PURE__ */ ((e) => (e.PERCENTAGE = "PERCENTAGE", e.AMOUNT = "AMOUNT", e))(M || {}), $ = /* @__PURE__ */ ((e) => (e[e.PROMOTION = 1] = "PROMOTION", e[e.COUPON = 2] = "COUPON", e))($ || {});
|
|
290
|
+
const D = (e, t) => e.type === M.PERCENTAGE ? `${e.value}%` : `${e.discount_value} ${t}`, R = (e, t) => e.reduce(
|
|
291
|
+
(o, r) => r.order === $.PROMOTION ? {
|
|
292
|
+
...o,
|
|
293
|
+
promotion: {
|
|
294
|
+
value: D(r, t),
|
|
295
|
+
priceAfterDiscount: r.price_after_discount
|
|
296
|
+
}
|
|
297
|
+
} : r.order === $.COUPON ? {
|
|
298
|
+
...o,
|
|
299
|
+
coupon: {
|
|
300
|
+
value: D(r, t),
|
|
301
|
+
priceAfterDiscount: r.price_after_discount
|
|
302
|
+
}
|
|
303
|
+
} : o,
|
|
304
|
+
{ promotion: null, coupon: null }
|
|
305
|
+
), Ue = ({ children: e, className: t }) => /* @__PURE__ */ n("div", { className: t, children: e }), Qe = "_chip_fqk2t_3", Ye = {
|
|
306
|
+
chip: Qe
|
|
307
|
+
};
|
|
308
|
+
function Ke({ children: e, className: t }) {
|
|
309
|
+
return /* @__PURE__ */ n("div", { className: `${Ye.chip} ${t}`, children: e });
|
|
310
|
+
}
|
|
311
|
+
const Ve = (e) => {
|
|
312
|
+
const {
|
|
313
|
+
promotionValue: t,
|
|
314
|
+
hasCoupon: o,
|
|
315
|
+
isPriceDropped: r,
|
|
316
|
+
saveLabelText: a,
|
|
317
|
+
couponText: s,
|
|
318
|
+
priceDropText: l
|
|
319
|
+
} = e;
|
|
320
|
+
return r ? {
|
|
321
|
+
label: l,
|
|
322
|
+
variant: "priceDrop"
|
|
323
|
+
} : o ? {
|
|
324
|
+
label: s,
|
|
325
|
+
variant: "coupon"
|
|
326
|
+
} : t ? {
|
|
327
|
+
label: `${a} ${t}`,
|
|
328
|
+
variant: "promotion"
|
|
329
|
+
} : null;
|
|
330
|
+
}, Fe = "_card_8c2od_3", qe = "_header_8c2od_25", je = "_imageContainer_8c2od_47", Ze = "_image_8c2od_47", He = "_topControls_8c2od_77", ze = "_footer_8c2od_91", Je = "_priceSection_8c2od_105", Xe = "_priceWrapper_8c2od_117", en = "_priceCurrency_8c2od_129", nn = "_withPromotion_8c2od_139", tn = "_priceAmount_8c2od_151", on = "_priceOriginal_8c2od_175", rn = "_brand_8c2od_221", an = "_ProductTitle_8c2od_233", cn = "_couponBadge_8c2od_261", sn = "_discountChipCoupon_8c2od_281", ln = "_discountChipPromotion_8c2od_291", dn = "_discountChipPriceDrop_8c2od_293", _n = "_container_8c2od_351", un = "_carousel_8c2od_391", mn = "_carouselContent_8c2od_421", pn = "_carouselItem_8c2od_429", gn = "_navButtonNext_8c2od_467", hn = "_navButtonPrev_8c2od_469", Cn = "_navButtonPrevIcon_8c2od_521", vn = "_navButtonNextIcon_8c2od_523", kn = "_paginationContainer_8c2od_549", Sn = "_paginationDot_8c2od_559", Nn = "_paginationActiveDot_8c2od_571", _ = {
|
|
331
|
+
card: Fe,
|
|
332
|
+
header: qe,
|
|
333
|
+
imageContainer: je,
|
|
334
|
+
image: Ze,
|
|
335
|
+
topControls: He,
|
|
336
|
+
footer: ze,
|
|
337
|
+
priceSection: Je,
|
|
338
|
+
priceWrapper: Xe,
|
|
339
|
+
priceCurrency: en,
|
|
340
|
+
withPromotion: nn,
|
|
341
|
+
priceAmount: tn,
|
|
342
|
+
priceOriginal: on,
|
|
343
|
+
brand: rn,
|
|
344
|
+
ProductTitle: an,
|
|
345
|
+
couponBadge: cn,
|
|
346
|
+
discountChipCoupon: sn,
|
|
347
|
+
discountChipPromotion: ln,
|
|
348
|
+
discountChipPriceDrop: dn,
|
|
349
|
+
container: _n,
|
|
350
|
+
carousel: un,
|
|
351
|
+
carouselContent: mn,
|
|
352
|
+
carouselItem: pn,
|
|
353
|
+
navButtonNext: gn,
|
|
354
|
+
navButtonPrev: hn,
|
|
355
|
+
navButtonPrevIcon: Cn,
|
|
356
|
+
navButtonNextIcon: vn,
|
|
357
|
+
paginationContainer: kn,
|
|
358
|
+
paginationDot: Sn,
|
|
359
|
+
paginationActiveDot: Nn
|
|
360
|
+
}, fn = {
|
|
361
|
+
en: {
|
|
362
|
+
couponBadge: {
|
|
363
|
+
extra: "Extra",
|
|
364
|
+
offAtCheckout: "off at checkout"
|
|
365
|
+
},
|
|
366
|
+
discountChip: {
|
|
367
|
+
save: "Save",
|
|
368
|
+
onlineExclusive: "Online exclusive offer",
|
|
369
|
+
priceDrop: "Price drop"
|
|
370
|
+
},
|
|
371
|
+
mylo: {
|
|
372
|
+
from: "From",
|
|
373
|
+
perMonth: "/mo with"
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
ar: {
|
|
377
|
+
couponBadge: {
|
|
378
|
+
extra: "خصم إضافي",
|
|
379
|
+
offAtCheckout: "يطبق عند الدفع"
|
|
380
|
+
},
|
|
381
|
+
discountChip: {
|
|
382
|
+
save: "هتوفر",
|
|
383
|
+
onlineExclusive: "عرض أونلاين حصري",
|
|
384
|
+
priceDrop: "سعر أقل"
|
|
385
|
+
},
|
|
386
|
+
mylo: {
|
|
387
|
+
from: "يبدأ من",
|
|
388
|
+
perMonth: "/الشهر مع"
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}, U = (e) => fn[e], bn = {
|
|
392
|
+
coupon: _.discountChipCoupon,
|
|
393
|
+
promotion: _.discountChipPromotion,
|
|
394
|
+
priceDrop: _.discountChipPriceDrop
|
|
395
|
+
};
|
|
396
|
+
function yn({
|
|
397
|
+
language: e,
|
|
398
|
+
promotionValue: t,
|
|
399
|
+
coupon: o,
|
|
400
|
+
isPriceDropped: r,
|
|
401
|
+
className: a
|
|
402
|
+
}) {
|
|
403
|
+
const s = U(e), l = Ve({
|
|
404
|
+
promotionValue: t,
|
|
405
|
+
hasCoupon: !!o,
|
|
406
|
+
isPriceDropped: r,
|
|
407
|
+
saveLabelText: s.discountChip.save,
|
|
408
|
+
couponText: s.discountChip.onlineExclusive,
|
|
409
|
+
priceDropText: s.discountChip.priceDrop
|
|
410
|
+
});
|
|
411
|
+
return l ? /* @__PURE__ */ n(
|
|
412
|
+
Ke,
|
|
413
|
+
{
|
|
414
|
+
className: `${a} ${bn[l.variant]}`,
|
|
415
|
+
children: l.label
|
|
416
|
+
}
|
|
417
|
+
) : null;
|
|
418
|
+
}
|
|
419
|
+
const xn = "data:image/svg+xml,%3csvg%20width='14'%20height='14'%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12.94%206.38667L6.94%200.386667C6.7%200.146667%206.36667%200%206%200H1.33333C0.6%200%200%200.6%200%201.33333V6C0%206.36667%200.146667%206.7%200.393333%206.94667L6.39333%2012.9467C6.63333%2013.1867%206.96667%2013.3333%207.33333%2013.3333C7.7%2013.3333%208.03333%2013.1867%208.27333%2012.94L12.94%208.27333C13.1867%208.03333%2013.3333%207.7%2013.3333%207.33333C13.3333%206.96667%2013.18%206.62667%2012.94%206.38667ZM2.33333%203.33333C1.78%203.33333%201.33333%202.88667%201.33333%202.33333C1.33333%201.78%201.78%201.33333%202.33333%201.33333C2.88667%201.33333%203.33333%201.78%203.33333%202.33333C3.33333%202.88667%202.88667%203.33333%202.33333%203.33333Z'%20fill='%231AA573'/%3e%3c/svg%3e";
|
|
420
|
+
function Tn({ value: e, language: t }) {
|
|
421
|
+
const o = U(t);
|
|
422
|
+
return /* @__PURE__ */ h("div", { className: _.couponBadge, children: [
|
|
423
|
+
/* @__PURE__ */ n(f, { alt: "tag", src: xn, width: 13.3, height: 13.3 }),
|
|
424
|
+
/* @__PURE__ */ n("span", { children: `${o.couponBadge.extra} ${e} ${o.couponBadge.offAtCheckout}` })
|
|
425
|
+
] });
|
|
426
|
+
}
|
|
427
|
+
function Pn({
|
|
428
|
+
price: e,
|
|
429
|
+
discounts: t
|
|
430
|
+
}) {
|
|
431
|
+
const { promotion: o } = R(t, e.currency), r = o?.priceAfterDiscount;
|
|
432
|
+
return /* @__PURE__ */ h("div", { className: _.priceWrapper, children: [
|
|
433
|
+
/* @__PURE__ */ n(
|
|
434
|
+
"span",
|
|
435
|
+
{
|
|
436
|
+
className: `${_.priceCurrency} ${r && _.withPromotion}`,
|
|
437
|
+
children: e.currency
|
|
438
|
+
}
|
|
439
|
+
),
|
|
440
|
+
/* @__PURE__ */ n(
|
|
441
|
+
"span",
|
|
442
|
+
{
|
|
443
|
+
className: `${_.priceAmount} ${r && _.withPromotion}`,
|
|
444
|
+
children: o ? o.priceAfterDiscount : e.base
|
|
445
|
+
}
|
|
446
|
+
),
|
|
447
|
+
r && /* @__PURE__ */ n("span", { className: _.priceOriginal, children: e.base })
|
|
448
|
+
] });
|
|
449
|
+
}
|
|
450
|
+
function wn({ title: e }) {
|
|
451
|
+
return /* @__PURE__ */ n("div", { className: _.ProductTitle, children: e });
|
|
452
|
+
}
|
|
453
|
+
function Bn({
|
|
454
|
+
id: e,
|
|
455
|
+
title: t,
|
|
456
|
+
brand: o,
|
|
457
|
+
image: r,
|
|
458
|
+
price: a,
|
|
459
|
+
discounts: s = [],
|
|
460
|
+
language: l,
|
|
461
|
+
className: u
|
|
462
|
+
}) {
|
|
463
|
+
const { promotion: d, coupon: g } = R(s, a.currency);
|
|
464
|
+
return /* @__PURE__ */ h(Ue, { className: `${_.card} ${u}`, children: [
|
|
465
|
+
/* @__PURE__ */ h("header", { className: _.header, children: [
|
|
466
|
+
/* @__PURE__ */ n("div", { className: _.imageContainer, children: /* @__PURE__ */ n(f, { className: _.image, src: r, alt: t }) }),
|
|
467
|
+
/* @__PURE__ */ n("div", { className: _.topControls, children: /* @__PURE__ */ n(
|
|
468
|
+
yn,
|
|
469
|
+
{
|
|
470
|
+
language: l,
|
|
471
|
+
coupon: g,
|
|
472
|
+
promotionValue: d?.value,
|
|
473
|
+
isPriceDropped: a.is_price_dropped
|
|
474
|
+
}
|
|
475
|
+
) })
|
|
476
|
+
] }),
|
|
477
|
+
/* @__PURE__ */ h("footer", { className: _.footer, children: [
|
|
478
|
+
/* @__PURE__ */ n("div", { className: _.priceSection, children: /* @__PURE__ */ n(Pn, { price: a, discounts: s }) }),
|
|
479
|
+
/* @__PURE__ */ n("h4", { className: _.brand, children: o }),
|
|
480
|
+
/* @__PURE__ */ n(wn, { title: t }),
|
|
481
|
+
g && /* @__PURE__ */ n(Tn, { value: g.value, language: l })
|
|
482
|
+
] })
|
|
483
|
+
] }, e);
|
|
484
|
+
}
|
|
485
|
+
function $n({
|
|
486
|
+
slidesToScroll: e,
|
|
487
|
+
products: t,
|
|
488
|
+
onProductClick: o,
|
|
489
|
+
language: r
|
|
490
|
+
}) {
|
|
491
|
+
const [a, s] = T(), [l, u] = T(0), [d, g] = T(0), [i, m] = T(!1), [C, v] = T(!1);
|
|
492
|
+
return P(() => {
|
|
493
|
+
if (!a)
|
|
494
|
+
return;
|
|
495
|
+
const p = () => {
|
|
496
|
+
g(a.scrollSnapList().length), u(a.selectedScrollSnap()), m(a.canScrollPrev()), v(a.canScrollNext());
|
|
497
|
+
};
|
|
498
|
+
return p(), a.on("select", p), a.on("reInit", p), () => {
|
|
499
|
+
a.off("select", p), a.off("reInit", p);
|
|
500
|
+
};
|
|
501
|
+
}, [a]), /* @__PURE__ */ h("div", { className: _.container, children: [
|
|
502
|
+
/* @__PURE__ */ h(
|
|
503
|
+
F,
|
|
504
|
+
{
|
|
505
|
+
opts: {
|
|
506
|
+
align: "start",
|
|
507
|
+
slidesToScroll: e ?? 1,
|
|
508
|
+
direction: r === "ar" ? "rtl" : "ltr"
|
|
509
|
+
},
|
|
510
|
+
setApi: s,
|
|
511
|
+
className: _.carousel,
|
|
512
|
+
children: [
|
|
513
|
+
/* @__PURE__ */ n(q, { className: _.carouselContent, children: t.map((p, S) => /* @__PURE__ */ n(
|
|
514
|
+
j,
|
|
515
|
+
{
|
|
516
|
+
className: _.carouselItem,
|
|
517
|
+
onClick: () => o(p, S),
|
|
518
|
+
children: /* @__PURE__ */ n(
|
|
519
|
+
Bn,
|
|
520
|
+
{
|
|
521
|
+
id: p.offering_id,
|
|
522
|
+
brand: p.brand,
|
|
523
|
+
image: p.formatted_main_image,
|
|
524
|
+
price: p.price,
|
|
525
|
+
title: p.title,
|
|
526
|
+
discounts: p.discounts,
|
|
527
|
+
language: r
|
|
528
|
+
}
|
|
529
|
+
)
|
|
530
|
+
},
|
|
531
|
+
`${p.offering_id}-${S}`
|
|
532
|
+
)) }),
|
|
533
|
+
i && /* @__PURE__ */ n(
|
|
534
|
+
Z,
|
|
535
|
+
{
|
|
536
|
+
className: _.navButtonPrev,
|
|
537
|
+
iconClassName: _.navButtonPrevIcon
|
|
538
|
+
}
|
|
539
|
+
),
|
|
540
|
+
C && /* @__PURE__ */ n(
|
|
541
|
+
H,
|
|
542
|
+
{
|
|
543
|
+
className: _.navButtonNext,
|
|
544
|
+
iconClassName: _.navButtonNextIcon
|
|
545
|
+
}
|
|
546
|
+
)
|
|
547
|
+
]
|
|
548
|
+
}
|
|
549
|
+
),
|
|
550
|
+
/* @__PURE__ */ n(
|
|
551
|
+
z,
|
|
552
|
+
{
|
|
553
|
+
slidesCount: d,
|
|
554
|
+
currentIndex: l,
|
|
555
|
+
onClick: (p) => a?.scrollTo(p),
|
|
556
|
+
showProgress: !1,
|
|
557
|
+
containerClassName: _.paginationContainer,
|
|
558
|
+
buttonClassName: _.paginationButton,
|
|
559
|
+
dotClassName: _.paginationDot,
|
|
560
|
+
activeDotClassName: _.paginationActiveDot
|
|
561
|
+
}
|
|
562
|
+
)
|
|
563
|
+
] });
|
|
564
|
+
}
|
|
565
|
+
const An = (e) => ({
|
|
566
|
+
type: "single product",
|
|
567
|
+
val: [e.offering_id],
|
|
568
|
+
filters: [
|
|
569
|
+
{
|
|
570
|
+
key: "slug",
|
|
571
|
+
value: [e.slug]
|
|
572
|
+
}
|
|
573
|
+
]
|
|
574
|
+
}), In = async ({
|
|
575
|
+
language: e,
|
|
576
|
+
collectionId: t,
|
|
577
|
+
environment: o,
|
|
578
|
+
adServerApiKey: r
|
|
579
|
+
}) => {
|
|
580
|
+
const [a, s] = await L(r), l = W("adServer", o);
|
|
581
|
+
try {
|
|
582
|
+
return (await (await fetch(
|
|
583
|
+
`${l}/api/v2/brandshop/server/collection/${t}`,
|
|
584
|
+
{
|
|
585
|
+
headers: {
|
|
586
|
+
lang: e,
|
|
587
|
+
device: "web",
|
|
588
|
+
"auth-token": a,
|
|
589
|
+
"auth-timestamp": s,
|
|
590
|
+
"accept-language": e
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
)).json()).data;
|
|
594
|
+
} catch (u) {
|
|
595
|
+
throw new Error(`Failed to fetch collection data - ${u}`);
|
|
596
|
+
}
|
|
597
|
+
}, En = "collection", On = ({
|
|
598
|
+
language: e,
|
|
599
|
+
collectionId: t,
|
|
600
|
+
environment: o,
|
|
601
|
+
adServerApiKey: r
|
|
602
|
+
}) => G({
|
|
603
|
+
queryKey: [En, t, e],
|
|
604
|
+
queryFn: () => In({
|
|
605
|
+
language: e,
|
|
606
|
+
collectionId: t,
|
|
607
|
+
environment: o,
|
|
608
|
+
adServerApiKey: r
|
|
609
|
+
})
|
|
610
|
+
}), Dn = "_card_15xcs_1", Ln = "_imageSkeleton_15xcs_17", Wn = "_titleSkeleton_15xcs_19", Gn = "_descriptionSkeleton_15xcs_21", Mn = "_priceSkeleton_15xcs_23", Rn = "_buttonSkeleton_15xcs_25", y = {
|
|
611
|
+
card: Dn,
|
|
612
|
+
imageSkeleton: Ln,
|
|
613
|
+
titleSkeleton: Wn,
|
|
614
|
+
descriptionSkeleton: Gn,
|
|
615
|
+
priceSkeleton: Mn,
|
|
616
|
+
buttonSkeleton: Rn
|
|
617
|
+
}, Un = (e) => {
|
|
618
|
+
const { className: t } = e;
|
|
619
|
+
return /* @__PURE__ */ h("div", { className: `${y.card} ${t || ""}`, children: [
|
|
620
|
+
/* @__PURE__ */ n(k, { className: y.imageSkeleton }),
|
|
621
|
+
/* @__PURE__ */ n(k, { className: y.titleSkeleton }),
|
|
622
|
+
/* @__PURE__ */ n(k, { className: y.descriptionSkeleton }),
|
|
623
|
+
/* @__PURE__ */ n(k, { className: y.priceSkeleton }),
|
|
624
|
+
/* @__PURE__ */ n(k, { className: y.buttonSkeleton })
|
|
625
|
+
] });
|
|
626
|
+
}, Qn = "_container_gnnm8_1", Yn = "_header_gnnm8_13", Kn = "_titleSkeleton_gnnm8_27", Vn = "_carouselWrapper_gnnm8_37", Fn = "_carouselContainer_gnnm8_49", qn = "_cardWrapper_gnnm8_67", x = {
|
|
627
|
+
container: Qn,
|
|
628
|
+
header: Yn,
|
|
629
|
+
titleSkeleton: Kn,
|
|
630
|
+
carouselWrapper: Vn,
|
|
631
|
+
carouselContainer: Fn,
|
|
632
|
+
cardWrapper: qn
|
|
633
|
+
}, jn = (e) => {
|
|
634
|
+
const { length: t } = e, o = t ?? 5;
|
|
635
|
+
return /* @__PURE__ */ h("div", { className: x.container, children: [
|
|
636
|
+
/* @__PURE__ */ n("div", { className: x.header, children: /* @__PURE__ */ n(k, { className: x.titleSkeleton }) }),
|
|
637
|
+
/* @__PURE__ */ n("div", { className: x.carouselWrapper, children: /* @__PURE__ */ n("div", { className: x.carouselContainer, children: Array.from({ length: o }, (r, a) => /* @__PURE__ */ n("div", { className: x.cardWrapper, children: /* @__PURE__ */ n(Un, {}) }, a)) }) })
|
|
638
|
+
] });
|
|
639
|
+
};
|
|
640
|
+
function Zn({
|
|
641
|
+
products: e,
|
|
642
|
+
title: t,
|
|
643
|
+
hideTitle: o,
|
|
644
|
+
isLoggedin: r,
|
|
645
|
+
language: a,
|
|
646
|
+
environment: s,
|
|
647
|
+
adServerApiKey: l,
|
|
648
|
+
trackBrandshopHandler: u,
|
|
649
|
+
onProductClick: d
|
|
650
|
+
}) {
|
|
651
|
+
const { data: g, isLoading: i, error: m } = On({
|
|
652
|
+
language: a,
|
|
653
|
+
collectionId: e.collection_id ?? "",
|
|
654
|
+
environment: s,
|
|
655
|
+
adServerApiKey: l
|
|
656
|
+
}), C = (v, p) => {
|
|
657
|
+
N(
|
|
658
|
+
"ads_bs_content_click",
|
|
659
|
+
{
|
|
660
|
+
contentName: v.title,
|
|
661
|
+
contentOrder: (p + 1).toString(),
|
|
662
|
+
userStatus: r ? "logged_in" : "guest",
|
|
663
|
+
platform: "Web"
|
|
664
|
+
},
|
|
665
|
+
u
|
|
666
|
+
);
|
|
667
|
+
const S = An(v), b = B(S);
|
|
668
|
+
b && d(b);
|
|
669
|
+
};
|
|
670
|
+
return i ? /* @__PURE__ */ n(jn, {}) : m || !g ? null : /* @__PURE__ */ h("div", { className: c.sectionContainer, children: [
|
|
671
|
+
!o && /* @__PURE__ */ n("h2", { className: c.sectionTitle, children: t }),
|
|
672
|
+
/* @__PURE__ */ n(
|
|
673
|
+
$n,
|
|
674
|
+
{
|
|
675
|
+
products: g.items,
|
|
676
|
+
onProductClick: (v, p) => C(v, p),
|
|
677
|
+
language: a
|
|
678
|
+
}
|
|
679
|
+
)
|
|
680
|
+
] });
|
|
681
|
+
}
|
|
682
|
+
const Hn = ({
|
|
683
|
+
section: e,
|
|
684
|
+
onLinkClick: t,
|
|
685
|
+
trackBrandshopHandler: o,
|
|
686
|
+
isLoggedin: r,
|
|
687
|
+
brandName: a,
|
|
688
|
+
language: s,
|
|
689
|
+
environment: l,
|
|
690
|
+
adServerApiKey: u,
|
|
691
|
+
brandshopName: d
|
|
692
|
+
}) => {
|
|
693
|
+
const {
|
|
694
|
+
section_type: g,
|
|
695
|
+
section_title: i,
|
|
696
|
+
show_section_title: m,
|
|
697
|
+
data: C,
|
|
698
|
+
section_display_order: v
|
|
699
|
+
} = e, { ref: p } = J({
|
|
700
|
+
onChange: (S) => {
|
|
701
|
+
S && N(
|
|
702
|
+
"ads_bs_section_view",
|
|
703
|
+
{
|
|
704
|
+
brandName: a,
|
|
705
|
+
sectionName: i,
|
|
706
|
+
sectionOrder: v.toString(),
|
|
707
|
+
userStatus: r ? "logged_in" : "guest",
|
|
708
|
+
platform: "Web"
|
|
709
|
+
},
|
|
710
|
+
o
|
|
711
|
+
);
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
return /* @__PURE__ */ n("div", { ref: p, style: { width: "100%" }, children: (() => {
|
|
715
|
+
switch (g) {
|
|
716
|
+
case "nav":
|
|
717
|
+
return /* @__PURE__ */ n(
|
|
718
|
+
Re,
|
|
719
|
+
{
|
|
720
|
+
title: i,
|
|
721
|
+
hideTitle: !m,
|
|
722
|
+
logo: C[0].logo ?? "",
|
|
723
|
+
navigationLinks: C[0].navigation_links ?? [],
|
|
724
|
+
onLinkClick: t,
|
|
725
|
+
isLoggedin: r,
|
|
726
|
+
trackBrandshopHandler: o,
|
|
727
|
+
brandshopName: d
|
|
728
|
+
}
|
|
729
|
+
);
|
|
730
|
+
case "category":
|
|
731
|
+
return /* @__PURE__ */ n(
|
|
732
|
+
Me,
|
|
733
|
+
{
|
|
734
|
+
title: i,
|
|
735
|
+
hideTitle: !m,
|
|
736
|
+
categories: C,
|
|
737
|
+
onCategoryClick: t,
|
|
738
|
+
isLoggedin: r,
|
|
739
|
+
trackBrandshopHandler: o
|
|
740
|
+
}
|
|
741
|
+
);
|
|
742
|
+
case "banner":
|
|
743
|
+
return /* @__PURE__ */ n(
|
|
744
|
+
Ge,
|
|
745
|
+
{
|
|
746
|
+
title: i,
|
|
747
|
+
banners: C,
|
|
748
|
+
hideTitle: !m,
|
|
749
|
+
onBannerClick: t,
|
|
750
|
+
isLoggedin: r,
|
|
751
|
+
sectionTitle: i,
|
|
752
|
+
trackBrandshopHandler: o
|
|
753
|
+
}
|
|
754
|
+
);
|
|
755
|
+
case "productSlider":
|
|
756
|
+
return /* @__PURE__ */ n(
|
|
757
|
+
Zn,
|
|
758
|
+
{
|
|
759
|
+
products: C[0],
|
|
760
|
+
title: i,
|
|
761
|
+
hideTitle: !m,
|
|
762
|
+
isLoggedin: r,
|
|
763
|
+
trackBrandshopHandler: o,
|
|
764
|
+
onProductClick: t,
|
|
765
|
+
language: s,
|
|
766
|
+
environment: l,
|
|
767
|
+
adServerApiKey: u
|
|
768
|
+
}
|
|
769
|
+
);
|
|
770
|
+
default:
|
|
771
|
+
return null;
|
|
772
|
+
}
|
|
773
|
+
})() });
|
|
774
|
+
}, zn = (e, t) => {
|
|
775
|
+
let o;
|
|
776
|
+
return (...r) => {
|
|
777
|
+
clearTimeout(o), o = setTimeout(() => {
|
|
778
|
+
e(...r);
|
|
779
|
+
}, t);
|
|
780
|
+
};
|
|
781
|
+
};
|
|
782
|
+
function Jn(e = 5) {
|
|
783
|
+
const [t, o] = T(!1);
|
|
784
|
+
return P(() => {
|
|
785
|
+
const a = zn(() => {
|
|
786
|
+
const s = window.scrollY || document.documentElement.scrollTop, l = window.innerHeight, u = document.documentElement.scrollHeight, d = s + l >= u - e;
|
|
787
|
+
o(d);
|
|
788
|
+
}, 100);
|
|
789
|
+
return window.addEventListener("scroll", a, { passive: !0 }), a(), () => {
|
|
790
|
+
window.removeEventListener("scroll", a);
|
|
791
|
+
};
|
|
792
|
+
}, [e]), t;
|
|
793
|
+
}
|
|
794
|
+
function Xn() {
|
|
795
|
+
return /* @__PURE__ */ h("div", { className: c.brandshopContainerSkeleton, children: [
|
|
796
|
+
/* @__PURE__ */ n(k, { className: c.bannerSkeleton }),
|
|
797
|
+
/* @__PURE__ */ n("div", { className: c.navContainerSkeleton, children: Array.from({ length: 3 }).map((o, r) => /* @__PURE__ */ n(k, { className: c.navPillSkeleton }, r)) }),
|
|
798
|
+
/* @__PURE__ */ n(
|
|
799
|
+
"div",
|
|
800
|
+
{
|
|
801
|
+
className: c.categoryGridSkeleton,
|
|
802
|
+
style: {
|
|
803
|
+
gridTemplateColumns: `repeat(${Math.min(2, 2)}, 1fr)`
|
|
804
|
+
},
|
|
805
|
+
children: Array.from({ length: 2 }).map((o, r) => /* @__PURE__ */ n(k, { className: c.categoryTileSkeleton }, r))
|
|
806
|
+
}
|
|
807
|
+
),
|
|
808
|
+
/* @__PURE__ */ n(k, { className: c.promoSkeleton })
|
|
809
|
+
] });
|
|
810
|
+
}
|
|
811
|
+
function et({
|
|
812
|
+
language: e,
|
|
813
|
+
brandshopId: t,
|
|
814
|
+
environment: o,
|
|
815
|
+
adServerApiKey: r,
|
|
816
|
+
isLoggedin: a,
|
|
817
|
+
brandshop: s,
|
|
818
|
+
onLinkClick: l,
|
|
819
|
+
trackBrandshopHandler: u
|
|
820
|
+
}) {
|
|
821
|
+
const { isLaptop: d, isDesktop: g } = X(), i = d || g ? O.Web : O.Mobile;
|
|
822
|
+
let m = s;
|
|
823
|
+
const {
|
|
824
|
+
data: C,
|
|
825
|
+
isLoading: v,
|
|
826
|
+
error: p
|
|
827
|
+
} = te({
|
|
828
|
+
language: e,
|
|
829
|
+
brandshopId: t,
|
|
830
|
+
environment: o,
|
|
831
|
+
adServerApiKey: r,
|
|
832
|
+
deviceType: i,
|
|
833
|
+
enabled: !s
|
|
834
|
+
});
|
|
835
|
+
m ??= C;
|
|
836
|
+
const S = Jn(), b = m?.name || "", A = a ? "logged_in" : "guest", I = "Web";
|
|
837
|
+
if (P(() => {
|
|
838
|
+
window.scrollTo(0, 0);
|
|
839
|
+
}, []), P(() => {
|
|
840
|
+
m && N(
|
|
841
|
+
"ads_bs_pageload",
|
|
842
|
+
{ brandName: b, userStatus: A, platform: I },
|
|
843
|
+
u
|
|
844
|
+
);
|
|
845
|
+
}, [m]), P(() => {
|
|
846
|
+
!m || !S || N(
|
|
847
|
+
"ads_bs_pageend",
|
|
848
|
+
{ brandName: b, userStatus: A, platform: I },
|
|
849
|
+
u
|
|
850
|
+
);
|
|
851
|
+
}, [S]), v) return /* @__PURE__ */ n(Xn, {});
|
|
852
|
+
if (p)
|
|
853
|
+
throw new Error(
|
|
854
|
+
`brandshop with id ${t} failed to load} - ${p?.message || "unknown error"}`
|
|
855
|
+
);
|
|
856
|
+
const E = m?.content;
|
|
857
|
+
if (!Array.isArray(E)) return null;
|
|
858
|
+
const Q = [...E].sort(
|
|
859
|
+
(w, Y) => w.section_display_order - Y.section_display_order
|
|
860
|
+
);
|
|
861
|
+
return /* @__PURE__ */ n("div", { className: c.brandshopContent, children: Q.map((w) => /* @__PURE__ */ n(
|
|
862
|
+
Hn,
|
|
863
|
+
{
|
|
864
|
+
section: w,
|
|
865
|
+
onLinkClick: l,
|
|
866
|
+
isLoggedin: a,
|
|
867
|
+
brandName: b,
|
|
868
|
+
trackBrandshopHandler: u,
|
|
869
|
+
language: e,
|
|
870
|
+
environment: o,
|
|
871
|
+
adServerApiKey: r,
|
|
872
|
+
brandshopName: m?.name
|
|
873
|
+
},
|
|
874
|
+
w.tracking_id
|
|
875
|
+
)) });
|
|
876
|
+
}
|
|
877
|
+
const nt = "data:image/svg+xml,%3csvg%20width='49'%20height='48'%20viewBox='0%200%2049%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M24.4941%2020.0311V24.0242M24.5%2030H24.52M22.7708%206.98426L6.27321%2034.9912C5.4892%2036.3221%206.45019%2038%207.9965%2038H40.9918C42.5381%2038%2043.4991%2036.3221%2042.7151%2034.9912L26.2174%206.98426C25.4444%205.67192%2023.5439%205.67191%2022.7708%206.98426ZM25%2030C25%2030.2761%2024.7761%2030.5%2024.5%2030.5C24.2239%2030.5%2024%2030.2761%2024%2030C24%2029.7239%2024.2239%2029.5%2024.5%2029.5C24.7761%2029.5%2025%2029.7239%2025%2030Z'%20stroke='%23DA1E28'%20stroke-width='4'%20stroke-linecap='round'/%3e%3c/svg%3e";
|
|
878
|
+
function tt({ language: e }) {
|
|
879
|
+
const t = e === "ar", o = t ? "حدث خطأ ما" : "Something went wrong", r = t ? "نواجه مشكلة في تحميل هذه الصفحة. يرجى الانتظار قليلاً؛ سيتم حلها قريباً." : "We're having trouble loading this page. Please bear with us; it should be resolved shortly.", a = t ? "إعادة المحاولة" : "Try again";
|
|
880
|
+
return /* @__PURE__ */ h("div", { className: c.brandshopError, children: [
|
|
881
|
+
/* @__PURE__ */ n(f, { src: nt, className: c.errorIcon, alt: "error" }),
|
|
882
|
+
/* @__PURE__ */ h("div", { className: c.errorContent, children: [
|
|
883
|
+
/* @__PURE__ */ h("div", { className: c.errorText, children: [
|
|
884
|
+
/* @__PURE__ */ n("h2", { children: o }),
|
|
885
|
+
/* @__PURE__ */ n("p", { children: r })
|
|
886
|
+
] }),
|
|
887
|
+
/* @__PURE__ */ n(
|
|
888
|
+
"button",
|
|
889
|
+
{
|
|
890
|
+
className: c.errorButton,
|
|
891
|
+
onClick: () => window.location.reload(),
|
|
892
|
+
children: a
|
|
893
|
+
}
|
|
894
|
+
)
|
|
895
|
+
] })
|
|
896
|
+
] });
|
|
897
|
+
}
|
|
898
|
+
class ot extends V {
|
|
899
|
+
constructor(t) {
|
|
900
|
+
super(t), this.state = { hasError: !1, error: null, errorInfo: null };
|
|
901
|
+
}
|
|
902
|
+
static getDerivedStateFromError(t) {
|
|
903
|
+
return { hasError: !0, error: t, errorInfo: null };
|
|
904
|
+
}
|
|
905
|
+
componentDidCatch(t, o) {
|
|
906
|
+
this.setState({ error: t, errorInfo: o });
|
|
907
|
+
}
|
|
908
|
+
render() {
|
|
909
|
+
return this.state.hasError ? this.props.fallback : this.props.children;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
function lt(e) {
|
|
913
|
+
return /* @__PURE__ */ n(K, { children: /* @__PURE__ */ n(ot, { fallback: /* @__PURE__ */ n(tt, { language: e.language }), children: /* @__PURE__ */ n(et, { ...e }) }) });
|
|
914
|
+
}
|
|
915
|
+
export {
|
|
916
|
+
lt as Brandshop
|
|
917
|
+
};
|
|
918
|
+
//# sourceMappingURL=Brandshop.js.map
|