@drawbridge/components 0.0.45 → 0.0.47

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.
@@ -33,374 +33,20 @@ __export(advertisement_exports, {
33
33
  default: () => advertisement_default
34
34
  });
35
35
  module.exports = __toCommonJS(advertisement_exports);
36
-
37
- // components/card-advertisement.js
38
- var import_react = require("react");
39
- var import_cdn = require("@drawbridge/shopify/cdn");
40
36
  var import_cdn2 = require("@drawbridge/drawbridge-utils/cdn");
41
- var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
42
- var import_jsx_runtime = require("react/jsx-runtime");
43
- var DefaultImage = ({ alt, className, src }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
44
- "img",
45
- {
46
- ...{
47
- alt,
48
- className,
49
- src
50
- }
51
- }
52
- );
53
- var DefaultVideo = ({ className, hls, mp4, poster }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
54
- "video",
55
- {
56
- ...{
57
- className,
58
- poster,
59
- src: mp4 || hls
60
- }
61
- }
62
- );
63
- var CardAdvertisement = ({
64
- advertisement,
65
- affiliate,
66
- asset,
67
- brand = {},
68
- button,
69
- campaign,
70
- fonts,
71
- ImageComponent = DefaultImage,
72
- lead,
73
- onClick = () => {
74
- },
75
- onVariantSelect = () => {
76
- },
77
- organization,
78
- page,
79
- preview = false,
80
- product,
81
- title,
82
- url,
83
- VideoComponent = DefaultVideo
84
- }) => {
85
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N;
86
- const variants = ((product == null ? void 0 : product.variants) || []).filter((v) => v.availableForSale);
87
- const hasVariants = variants.length > 0;
88
- const [selectedVariant, setSelectedVariant] = (0, import_react.useState)(variants[0] || null);
89
- const [keyboard, setKeyboard] = (0, import_react.useState)(false);
90
- (0, import_react.useEffect)(() => {
91
- const down = (e) => {
92
- if (e.key === "Tab") setKeyboard(true);
93
- };
94
- const click = () => setKeyboard(false);
95
- window.addEventListener("keydown", down);
96
- window.addEventListener("mousedown", click);
97
- return () => {
98
- window.removeEventListener("keydown", down);
99
- window.removeEventListener("mousedown", click);
100
- };
101
- }, []);
102
- const style = {
103
- background: {
104
- color: ((_a = brand == null ? void 0 : brand.style) == null ? void 0 : _a.background) ? (_b = brand.style.background) == null ? void 0 : _b.color : {
105
- hex: "#FFFFFF",
106
- rgb: "rgb( 255, 255, 255 )"
107
- }
108
- },
109
- text: {
110
- color: ((_c = brand == null ? void 0 : brand.style) == null ? void 0 : _c.text) ? (_d = brand.style.text) == null ? void 0 : _d.color : {
111
- hex: "#000000",
112
- rgb: "rgb( 0, 0, 0 )"
113
- }
114
- }
115
- };
116
- const classes = {
117
- asset: [
118
- "block relative aspect-square rounded overflow-hidden"
119
- ],
120
- button: [
121
- "card-advertisement-button",
122
- "flex items-center justify-center py-3 px-4 w-full border"
123
- ],
124
- container: [
125
- "card-advertisement",
126
- "block w-full space-y-2 border border-gray rounded p-6"
127
- ],
128
- content: [
129
- "flex flex-col items-center justify-between gap-x-4 text-center text-sm rounded"
130
- ]
131
- };
132
- const productImage = (selectedVariant == null ? void 0 : selectedVariant.image) || (product == null ? void 0 : product.image) || null;
133
- const productImageSrc = (0, import_cdn.cdnShopify)(productImage, "400x400", product == null ? void 0 : product.updatedAt);
134
- if (!(asset == null ? void 0 : asset.sizes) && !productImageSrc) {
135
- classes.asset.push("bg-gray-light");
136
- }
137
- ;
138
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
139
- "div",
140
- {
141
- ...{
142
- className: classes.container.join(" "),
143
- style: {
144
- backgroundColor: (_f = (_e = style == null ? void 0 : style.background) == null ? void 0 : _e.color) == null ? void 0 : _f.hex,
145
- color: (_h = (_g = style == null ? void 0 : style.text) == null ? void 0 : _g.color) == null ? void 0 : _h.hex
146
- }
147
- },
148
- children: [
149
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
150
- "span",
151
- {
152
- ...{
153
- className: classes.asset.join(" ")
154
- },
155
- children: [
156
- (asset == null ? void 0 : asset.sizes) && asset.mimetype.includes("image") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
157
- ImageComponent,
158
- {
159
- ...{
160
- alt: asset == null ? void 0 : asset.filename,
161
- className: "w-full h-full object-cover",
162
- fill: true,
163
- priority: false,
164
- sizes: "100%",
165
- src: (0, import_cdn2.cdnSrc)(asset, "400x400", asset == null ? void 0 : asset.updatedAt)
166
- }
167
- },
168
- asset == null ? void 0 : asset.id
169
- ),
170
- !(asset == null ? void 0 : asset.sizes) && productImageSrc && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
171
- ImageComponent,
172
- {
173
- ...{
174
- alt: (product == null ? void 0 : product.title) || "Product",
175
- className: "w-full h-full object-cover",
176
- fill: true,
177
- priority: false,
178
- sizes: "100%",
179
- src: productImageSrc,
180
- unoptimized: true
181
- }
182
- },
183
- productImageSrc
184
- ),
185
- (asset == null ? void 0 : asset.sizes) && asset.mimetype.includes("video") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
186
- "div",
187
- {
188
- ...{
189
- className: "relative h-full w-full aspect-[9/16]"
190
- },
191
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
192
- VideoComponent,
193
- {
194
- ...{
195
- className: "w-full h-full",
196
- hls: (0, import_cdn2.cdnSrc)(asset, "hls", asset == null ? void 0 : asset.updatedAt),
197
- mp4: (0, import_cdn2.cdnSrc)(asset, "original", asset == null ? void 0 : asset.updatedAt),
198
- poster: (0, import_cdn2.cdnSrc)((_i = asset == null ? void 0 : asset.frames) == null ? void 0 : _i[asset == null ? void 0 : asset.poster], "500x500", asset == null ? void 0 : asset.updatedAt) || (0, import_cdn2.cdnSrc)((_j = asset == null ? void 0 : asset.frames) == null ? void 0 : _j[asset == null ? void 0 : asset.poster], "1080x1920", asset == null ? void 0 : asset.updatedAt)
199
- }
200
- }
201
- )
202
- }
203
- )
204
- ]
205
- }
206
- ),
207
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
208
- "span",
209
- {
210
- ...{
211
- className: classes.content.join(" "),
212
- style: {
213
- ...fonts == null ? void 0 : fonts.body,
214
- color: (_l = (_k = style == null ? void 0 : style.text) == null ? void 0 : _k.color) == null ? void 0 : _l.hex,
215
- gap: "10px",
216
- marginTop: "10px"
217
- }
218
- },
219
- children: [
220
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
221
- "div",
222
- {
223
- ...{
224
- className: "flex-1 min-w-0 space-y-2"
225
- },
226
- children: [
227
- title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
228
- "p",
229
- {
230
- ...{
231
- style: {
232
- fontSize: "18px"
233
- }
234
- },
235
- children: title
236
- }
237
- ),
238
- (selectedVariant == null ? void 0 : selectedVariant.price) && (selectedVariant == null ? void 0 : selectedVariant.currency) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
239
- "p",
240
- {
241
- ...{
242
- style: {
243
- fontSize: "14px",
244
- marginBottom: "10px"
245
- }
246
- },
247
- children: [
248
- (selectedVariant == null ? void 0 : selectedVariant.sale) && selectedVariant.sale > selectedVariant.price && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
249
- "span",
250
- {
251
- ...{
252
- style: {
253
- marginRight: "6px",
254
- opacity: 0.5,
255
- textDecoration: "line-through"
256
- }
257
- },
258
- children: (0, import_drawbridge_utils.formatCurrency)({
259
- code: selectedVariant.currency,
260
- display: "parts",
261
- value: selectedVariant.sale
262
- })
263
- }
264
- ),
265
- (0, import_drawbridge_utils.formatCurrency)({
266
- code: selectedVariant.currency,
267
- display: "parts",
268
- value: selectedVariant.price
269
- })
270
- ]
271
- }
272
- ),
273
- variants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
274
- "div",
275
- {
276
- ...{
277
- className: "relative w-full"
278
- },
279
- children: [
280
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
281
- "select",
282
- {
283
- ...{
284
- className: "input appearance-none " + (keyboard ? "focus-visible:!outline-1 focus-visible:!ring-1 focus-visible:!ring-blue-600" : "focus-visible:!outline-0 focus-visible:!ring-0"),
285
- onChange: (e) => {
286
- const variant = variants.find((v) => v.id === e.target.value);
287
- if (variant) setSelectedVariant(variant);
288
- },
289
- style: {
290
- appearance: "none",
291
- backgroundColor: (_n = (_m = style == null ? void 0 : style.background) == null ? void 0 : _m.color) == null ? void 0 : _n.rgb,
292
- backgroundImage: "none",
293
- borderColor: (_p = (_o = style == null ? void 0 : style.text) == null ? void 0 : _o.color) == null ? void 0 : _p.rgb,
294
- borderRadius: ((_r = (_q = brand == null ? void 0 : brand.style) == null ? void 0 : _q.button) == null ? void 0 : _r.radius) != null ? brand.style.button.radius / 4 + "px" : void 0,
295
- color: (_t = (_s = style == null ? void 0 : style.text) == null ? void 0 : _s.color) == null ? void 0 : _t.rgb,
296
- WebkitAppearance: "none"
297
- },
298
- value: (selectedVariant == null ? void 0 : selectedVariant.id) || ""
299
- },
300
- children: variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
301
- "option",
302
- {
303
- ...{
304
- value: variant.id
305
- },
306
- children: variant.title
307
- },
308
- variant.id
309
- ))
310
- }
311
- ),
312
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
313
- "div",
314
- {
315
- ...{
316
- "aria-hidden": true,
317
- style: {
318
- alignItems: "center",
319
- bottom: 0,
320
- display: "flex",
321
- paddingRight: "0.625rem",
322
- pointerEvents: "none",
323
- position: "absolute",
324
- right: 0,
325
- top: 0
326
- }
327
- },
328
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
329
- "svg",
330
- {
331
- ...{
332
- style: {
333
- height: "1.25rem",
334
- width: "1.25rem"
335
- },
336
- fill: "none",
337
- stroke: "currentColor",
338
- strokeWidth: 1.5,
339
- viewBox: "0 0 24 24",
340
- xmlns: "http://www.w3.org/2000/svg"
341
- },
342
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
343
- "path",
344
- {
345
- ...{
346
- d: "M19.5 8.25l-7.5 7.5-7.5-7.5",
347
- strokeLinecap: "round",
348
- strokeLinejoin: "round"
349
- }
350
- }
351
- )
352
- }
353
- )
354
- }
355
- )
356
- ]
357
- }
358
- )
359
- ]
360
- }
361
- ),
362
- button && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
363
- "button",
364
- {
365
- ...{
366
- className: classes.button.join(" "),
367
- disabled: !preview && !hasVariants && !url,
368
- onClick: hasVariants ? () => {
369
- if (!preview) onVariantSelect(selectedVariant);
370
- } : preview ? () => {
371
- } : onClick,
372
- style: {
373
- backgroundColor: ((_x = (_w = (_v = (_u = brand == null ? void 0 : brand.style) == null ? void 0 : _u.button) == null ? void 0 : _v.background) == null ? void 0 : _w.color) == null ? void 0 : _x.hex) || ((_z = (_y = style == null ? void 0 : style.text) == null ? void 0 : _y.color) == null ? void 0 : _z.hex),
374
- borderColor: ((_D = (_C = (_B = (_A = brand == null ? void 0 : brand.style) == null ? void 0 : _A.button) == null ? void 0 : _B.background) == null ? void 0 : _C.color) == null ? void 0 : _D.hex) || ((_F = (_E = style == null ? void 0 : style.text) == null ? void 0 : _E.color) == null ? void 0 : _F.hex),
375
- borderRadius: ((_H = (_G = brand == null ? void 0 : brand.style) == null ? void 0 : _G.button) == null ? void 0 : _H.radius) != null ? brand.style.button.radius / 4 + "px" : void 0,
376
- color: ((_L = (_K = (_J = (_I = brand == null ? void 0 : brand.style) == null ? void 0 : _I.button) == null ? void 0 : _J.text) == null ? void 0 : _K.color) == null ? void 0 : _L.hex) || ((_N = (_M = style == null ? void 0 : style.background) == null ? void 0 : _M.color) == null ? void 0 : _N.hex)
377
- },
378
- type: "button"
379
- },
380
- children: button
381
- }
382
- )
383
- ]
384
- }
385
- )
386
- ]
387
- }
388
- );
389
- };
390
- var card_advertisement_default = CardAdvertisement;
391
37
 
392
38
  // components/product.js
393
- var import_react5 = require("react");
39
+ var import_react4 = require("react");
394
40
  var import_embla_carousel_react = __toESM(require("embla-carousel-react"));
395
- var import_cdn3 = require("@drawbridge/shopify/cdn");
396
- var import_drawbridge_utils2 = require("@drawbridge/drawbridge-utils");
41
+ var import_cdn = require("@drawbridge/shopify/cdn");
42
+ var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
397
43
 
398
44
  // components/input-group.js
399
- var import_react2 = require("react");
45
+ var import_react = require("react");
400
46
 
401
47
  // components/icons/warning.js
402
- var import_jsx_runtime2 = require("react/jsx-runtime");
403
- var Warning = (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
48
+ var import_jsx_runtime = require("react/jsx-runtime");
49
+ var Warning = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
404
50
  "svg",
405
51
  {
406
52
  ...{
@@ -410,7 +56,7 @@ var Warning = (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
410
56
  viewBox: "0 0 24 24",
411
57
  ...props
412
58
  },
413
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
59
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
414
60
  "path",
415
61
  {
416
62
  ...{
@@ -425,7 +71,7 @@ var Warning = (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
425
71
  var warning_default = Warning;
426
72
 
427
73
  // components/input-group.js
428
- var import_jsx_runtime3 = require("react/jsx-runtime");
74
+ var import_jsx_runtime2 = require("react/jsx-runtime");
429
75
  var InputGroup = ({
430
76
  className,
431
77
  error,
@@ -445,7 +91,7 @@ var InputGroup = ({
445
91
  if (error) {
446
92
  classes.push("error");
447
93
  }
448
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
94
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
449
95
  "div",
450
96
  {
451
97
  ...{
@@ -456,14 +102,14 @@ var InputGroup = ({
456
102
  }
457
103
  },
458
104
  children: [
459
- label ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
105
+ label ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
460
106
  "div",
461
107
  {
462
108
  ...{
463
109
  className: "space-y-2"
464
110
  },
465
111
  children: [
466
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
112
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
467
113
  "span",
468
114
  {
469
115
  ...{
@@ -476,21 +122,21 @@ var InputGroup = ({
476
122
  ]
477
123
  }
478
124
  ) : input,
479
- (error || message) && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
125
+ (error || message) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
480
126
  "p",
481
127
  {
482
128
  ...{
483
129
  className: "flex items-center justify-start space-x-2 py-1 rounded text-sm " + (error && "px-1.5"),
484
- ...error && Object.keys(style).length > 0 && {
130
+ ...error && {
485
131
  style: {
486
- backgroundColor: (_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb.replace(")", ",.1)"),
487
- color: (_d = (_c = style == null ? void 0 : style.text) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb
132
+ backgroundColor: (((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || "rgb( 0, 0, 0 )").replace(")", ",.1)"),
133
+ color: ((_d = (_c = style == null ? void 0 : style.text) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb) || "rgb( 0, 0, 0 )"
488
134
  }
489
135
  }
490
136
  },
491
137
  children: [
492
- error && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react2.Fragment, { children: [
493
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
138
+ error && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react.Fragment, { children: [
139
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
494
140
  warning_default,
495
141
  {
496
142
  ...{
@@ -499,7 +145,7 @@ var InputGroup = ({
499
145
  }
500
146
  }
501
147
  ),
502
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
148
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
503
149
  "span",
504
150
  {
505
151
  ...{
@@ -513,7 +159,7 @@ var InputGroup = ({
513
159
  }
514
160
  )
515
161
  ] }),
516
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
162
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
517
163
  "span",
518
164
  {
519
165
  ...{
@@ -534,11 +180,11 @@ var InputGroup = ({
534
180
  var input_group_default = InputGroup;
535
181
 
536
182
  // components/input-select.js
537
- var import_react3 = require("react");
183
+ var import_react2 = require("react");
538
184
 
539
185
  // components/icons/chevron-down.js
540
- var import_jsx_runtime4 = require("react/jsx-runtime");
541
- var ChevronDown = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
186
+ var import_jsx_runtime3 = require("react/jsx-runtime");
187
+ var ChevronDown = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
542
188
  "svg",
543
189
  {
544
190
  ...{
@@ -548,7 +194,7 @@ var ChevronDown = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
548
194
  viewBox: "0 0 24 24",
549
195
  ...props
550
196
  },
551
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
197
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
552
198
  "path",
553
199
  {
554
200
  ...{
@@ -563,27 +209,37 @@ var ChevronDown = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
563
209
  var chevron_down_default = ChevronDown;
564
210
 
565
211
  // components/styles.js
212
+ var WHITE = "rgb( 255, 255, 255 )";
213
+ var BLACK = "rgb( 0, 0, 0 )";
214
+ var bgColor = (style) => {
215
+ var _a, _b;
216
+ return ((_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || WHITE;
217
+ };
218
+ var textColor = (style) => {
219
+ var _a, _b;
220
+ return ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || BLACK;
221
+ };
566
222
  var buttonStyle = (style) => {
567
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
223
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
568
224
  return {
569
- backgroundColor: ((_c = (_b = (_a = style == null ? void 0 : style.button) == null ? void 0 : _a.background) == null ? void 0 : _b.color) == null ? void 0 : _c.rgb) || ((_e = (_d = style == null ? void 0 : style.text) == null ? void 0 : _d.color) == null ? void 0 : _e.rgb),
570
- borderColor: ((_h = (_g = (_f = style == null ? void 0 : style.button) == null ? void 0 : _f.background) == null ? void 0 : _g.color) == null ? void 0 : _h.rgb) || ((_j = (_i = style == null ? void 0 : style.text) == null ? void 0 : _i.color) == null ? void 0 : _j.rgb),
571
- borderRadius: ((_k = style == null ? void 0 : style.button) == null ? void 0 : _k.radius) != null ? style.button.radius / 4 + "px" : void 0,
572
- color: ((_n = (_m = (_l = style == null ? void 0 : style.button) == null ? void 0 : _l.text) == null ? void 0 : _m.color) == null ? void 0 : _n.rgb) || ((_p = (_o = style == null ? void 0 : style.background) == null ? void 0 : _o.color) == null ? void 0 : _p.rgb)
225
+ backgroundColor: ((_c = (_b = (_a = style == null ? void 0 : style.button) == null ? void 0 : _a.background) == null ? void 0 : _b.color) == null ? void 0 : _c.rgb) || textColor(style),
226
+ borderColor: ((_f = (_e = (_d = style == null ? void 0 : style.button) == null ? void 0 : _d.background) == null ? void 0 : _e.color) == null ? void 0 : _f.rgb) || textColor(style),
227
+ borderRadius: ((_g = style == null ? void 0 : style.button) == null ? void 0 : _g.radius) != null ? style.button.radius / 4 + "px" : void 0,
228
+ color: ((_j = (_i = (_h = style == null ? void 0 : style.button) == null ? void 0 : _h.text) == null ? void 0 : _i.color) == null ? void 0 : _j.rgb) || bgColor(style)
573
229
  };
574
230
  };
575
231
  var inputStyle = (style) => {
576
- var _a, _b, _c, _d, _e, _f, _g;
232
+ var _a;
577
233
  return {
578
- backgroundColor: (_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb,
579
- borderColor: (_d = (_c = style == null ? void 0 : style.text) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb,
580
- borderRadius: ((_e = style == null ? void 0 : style.input) == null ? void 0 : _e.radius) != null ? style.input.radius / 4 + "px" : void 0,
581
- color: (_g = (_f = style == null ? void 0 : style.text) == null ? void 0 : _f.color) == null ? void 0 : _g.rgb
234
+ backgroundColor: bgColor(style),
235
+ borderColor: textColor(style),
236
+ borderRadius: ((_a = style == null ? void 0 : style.input) == null ? void 0 : _a.radius) != null ? style.input.radius / 4 + "px" : void 0,
237
+ color: textColor(style)
582
238
  };
583
239
  };
584
240
 
585
241
  // components/input-select.js
586
- var import_jsx_runtime5 = require("react/jsx-runtime");
242
+ var import_jsx_runtime4 = require("react/jsx-runtime");
587
243
  var InputSelect = ({
588
244
  onChange,
589
245
  options = [],
@@ -591,8 +247,8 @@ var InputSelect = ({
591
247
  value,
592
248
  ...rest
593
249
  }) => {
594
- const [keyboard, setKeyboard] = (0, import_react3.useState)(false);
595
- (0, import_react3.useEffect)(() => {
250
+ const [keyboard, setKeyboard] = (0, import_react2.useState)(false);
251
+ (0, import_react2.useEffect)(() => {
596
252
  const down = (e) => {
597
253
  if (e.key === "Tab") setKeyboard(true);
598
254
  };
@@ -604,14 +260,14 @@ var InputSelect = ({
604
260
  window.removeEventListener("mousedown", click);
605
261
  };
606
262
  }, []);
607
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
263
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
608
264
  "div",
609
265
  {
610
266
  ...{
611
267
  className: "relative"
612
268
  },
613
269
  children: [
614
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
270
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
615
271
  "select",
616
272
  {
617
273
  ...{
@@ -622,7 +278,7 @@ var InputSelect = ({
622
278
  value
623
279
  },
624
280
  children: [
625
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
281
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
626
282
  "option",
627
283
  {
628
284
  ...{
@@ -633,7 +289,7 @@ var InputSelect = ({
633
289
  children: "Select"
634
290
  }
635
291
  ),
636
- options.map(({ label, option, value: optValue }, key) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
292
+ options.map(({ label, option, value: optValue }, key) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
637
293
  "option",
638
294
  {
639
295
  ...{
@@ -646,14 +302,14 @@ var InputSelect = ({
646
302
  ]
647
303
  }
648
304
  ),
649
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
305
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
650
306
  "div",
651
307
  {
652
308
  ...{
653
309
  "aria-hidden": true,
654
310
  className: "h-full flex items-center absolute inset-y-0 right-0 pointer-events-none px-2.5"
655
311
  },
656
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
312
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
657
313
  chevron_down_default,
658
314
  {
659
315
  ...{
@@ -670,9 +326,9 @@ var InputSelect = ({
670
326
  var input_select_default = InputSelect;
671
327
 
672
328
  // components/wrapper-gradient.js
673
- var import_react4 = require("react");
674
- var import_jsx_runtime6 = require("react/jsx-runtime");
675
- var WrapperGradientContext = (0, import_react4.createContext)(null);
329
+ var import_react3 = require("react");
330
+ var import_jsx_runtime5 = require("react/jsx-runtime");
331
+ var WrapperGradientContext = (0, import_react3.createContext)(null);
676
332
  var WrapperGradient = ({
677
333
  children,
678
334
  className,
@@ -730,14 +386,14 @@ var WrapperGradient = ({
730
386
  left: "linear-gradient( to right, " + color + " 0%, transparent 100% )",
731
387
  right: "linear-gradient( to left, " + color + " 0%, transparent 100% )"
732
388
  };
733
- const containerRef = (0, import_react4.useRef)(null);
734
- const [scroll, setScroll] = (0, import_react4.useState)({
389
+ const containerRef = (0, import_react3.useRef)(null);
390
+ const [scroll, setScroll] = (0, import_react3.useState)({
735
391
  top: 0,
736
392
  left: 0,
737
393
  atBottom: true,
738
394
  atRight: true
739
395
  });
740
- (0, import_react4.useEffect)(
396
+ (0, import_react3.useEffect)(
741
397
  () => {
742
398
  const container = containerRef.current;
743
399
  const handleScroll = () => {
@@ -787,21 +443,21 @@ var WrapperGradient = ({
787
443
  },
788
444
  [horizontal]
789
445
  );
790
- const contextValue = (0, import_react4.useMemo)(
446
+ const contextValue = (0, import_react3.useMemo)(
791
447
  () => ({
792
448
  atBottom: scroll.atBottom,
793
449
  atRight: scroll.atRight
794
450
  }),
795
451
  [scroll.atBottom, scroll.atRight]
796
452
  );
797
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
453
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
798
454
  "div",
799
455
  {
800
456
  ...{
801
457
  className: classes.container.join(" ")
802
458
  },
803
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(WrapperGradientContext.Provider, { value: contextValue, children: [
804
- showY && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
459
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(WrapperGradientContext.Provider, { value: contextValue, children: [
460
+ showY && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
805
461
  "div",
806
462
  {
807
463
  ...{
@@ -817,7 +473,7 @@ var WrapperGradient = ({
817
473
  }
818
474
  }
819
475
  ),
820
- showX && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
476
+ showX && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
821
477
  "div",
822
478
  {
823
479
  ...{
@@ -830,7 +486,7 @@ var WrapperGradient = ({
830
486
  }
831
487
  }
832
488
  ),
833
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
489
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
834
490
  "div",
835
491
  {
836
492
  ...{
@@ -840,7 +496,7 @@ var WrapperGradient = ({
840
496
  children
841
497
  }
842
498
  ),
843
- showY && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
499
+ showY && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
844
500
  "div",
845
501
  {
846
502
  ...{
@@ -853,7 +509,7 @@ var WrapperGradient = ({
853
509
  }
854
510
  }
855
511
  ),
856
- showX && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
512
+ showX && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
857
513
  "div",
858
514
  {
859
515
  ...{
@@ -873,8 +529,8 @@ var WrapperGradient = ({
873
529
  var wrapper_gradient_default = WrapperGradient;
874
530
 
875
531
  // components/icons/loader.js
876
- var import_jsx_runtime7 = require("react/jsx-runtime");
877
- var Loader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
532
+ var import_jsx_runtime6 = require("react/jsx-runtime");
533
+ var Loader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
878
534
  "svg",
879
535
  {
880
536
  ...{
@@ -886,7 +542,7 @@ var Loader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime
886
542
  ...props
887
543
  },
888
544
  children: [
889
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
545
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
890
546
  "circle",
891
547
  {
892
548
  ...{
@@ -899,7 +555,7 @@ var Loader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime
899
555
  }
900
556
  }
901
557
  ),
902
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
558
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
903
559
  "path",
904
560
  {
905
561
  ...{
@@ -915,8 +571,8 @@ var Loader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime
915
571
  var loader_default = Loader;
916
572
 
917
573
  // components/product.js
918
- var import_jsx_runtime8 = require("react/jsx-runtime");
919
- var DefaultImage2 = ({ alt, className, src }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
574
+ var import_jsx_runtime7 = require("react/jsx-runtime");
575
+ var DefaultImage = ({ alt, className, src }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
920
576
  "img",
921
577
  {
922
578
  ...{
@@ -932,7 +588,7 @@ var Product = ({
932
588
  disabled = false,
933
589
  errors = {},
934
590
  header,
935
- ImageComponent = DefaultImage2,
591
+ ImageComponent = DefaultImage,
936
592
  onAdd = () => {
937
593
  },
938
594
  onBuy = () => {
@@ -955,14 +611,14 @@ var Product = ({
955
611
  color: ((_b = style == null ? void 0 : style.text) == null ? void 0 : _b.color) || { hex: "#000000", rgb: "rgb( 0, 0, 0 )" }
956
612
  }
957
613
  };
958
- const available = (0, import_react5.useMemo)(
614
+ const available = (0, import_react4.useMemo)(
959
615
  () => ((product == null ? void 0 : product.variants) || []).filter((v) => v.availableForSale),
960
616
  [product]
961
617
  );
962
- const [activeImage, setActiveImage] = (0, import_react5.useState)(0);
618
+ const [activeImage, setActiveImage] = (0, import_react4.useState)(0);
963
619
  const [emblaRef, emblaApi] = (0, import_embla_carousel_react.default)();
964
620
  const selectedVariant = available.find((v) => v.id === variant) || available[0] || null;
965
- const images = (0, import_react5.useMemo)(
621
+ const images = (0, import_react4.useMemo)(
966
622
  () => {
967
623
  const variants = ((product == null ? void 0 : product.variants) || []).filter((v) => v.availableForSale);
968
624
  const result = [];
@@ -987,7 +643,7 @@ var Product = ({
987
643
  },
988
644
  [product]
989
645
  );
990
- (0, import_react5.useEffect)(
646
+ (0, import_react4.useEffect)(
991
647
  () => {
992
648
  if (!emblaApi) return;
993
649
  const onSelect = () => {
@@ -1012,11 +668,11 @@ var Product = ({
1012
668
  }
1013
669
  ;
1014
670
  };
1015
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
671
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1016
672
  "div",
1017
673
  {
1018
674
  ...{
1019
- className: "space-y-6 pb-12",
675
+ className: "space-y-6",
1020
676
  style: {
1021
677
  backgroundColor: resolved.background.color.rgb,
1022
678
  color: resolved.text.color.rgb
@@ -1024,21 +680,24 @@ var Product = ({
1024
680
  },
1025
681
  children: [
1026
682
  header,
1027
- images.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
683
+ images.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1028
684
  "div",
1029
685
  {
1030
686
  ...{
1031
- className: "flex items-center h-48 " + (images.length > 1 && "pr-12")
687
+ className: "flex items-center " + (images.length > 1 ? "pr-12" : ""),
688
+ style: {
689
+ height: "12rem"
690
+ }
1032
691
  },
1033
692
  children: [
1034
- images.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
693
+ images.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1035
694
  wrapper_gradient_default,
1036
695
  {
1037
696
  ...{
1038
697
  classNameScroll: "flex flex-col w-12 h-48 space-y-3",
1039
698
  color: resolved.background.color.rgb
1040
699
  },
1041
- children: images.map(({ src }, key) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
700
+ children: images.map(({ src }, key) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1042
701
  "button",
1043
702
  {
1044
703
  ...{
@@ -1052,7 +711,7 @@ var Product = ({
1052
711
  style: inputStyle(resolved)
1053
712
  }
1054
713
  },
1055
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
714
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1056
715
  ImageComponent,
1057
716
  {
1058
717
  ...{
@@ -1060,7 +719,7 @@ var Product = ({
1060
719
  className: "object-cover",
1061
720
  fill: true,
1062
721
  sizes: "48px",
1063
- src: (0, import_cdn3.cdnShopify)(src, "100x100", product == null ? void 0 : product.updatedAt) || src,
722
+ src: (0, import_cdn.cdnShopify)(src, "100x100", product == null ? void 0 : product.updatedAt) || src,
1064
723
  unoptimized: true
1065
724
  }
1066
725
  }
@@ -1070,26 +729,41 @@ var Product = ({
1070
729
  ))
1071
730
  }
1072
731
  ),
1073
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
732
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1074
733
  "div",
1075
734
  {
1076
735
  ...{
1077
- className: "w-48 h-48 overflow-hidden rounded-3xl m-auto",
1078
- ref: emblaRef
736
+ // Dimensions are inline rather than Tailwind size utilities:
737
+ // those sizes live only in this package's dist, and a consuming
738
+ // app's Tailwind scan of node_modules can lag and drop them,
739
+ // silently collapsing the carousel. Inline styles are immune.
740
+ className: "overflow-hidden rounded-3xl m-auto",
741
+ ref: emblaRef,
742
+ style: {
743
+ width: "12rem",
744
+ height: "12rem"
745
+ }
1079
746
  },
1080
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
747
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1081
748
  "div",
1082
749
  {
1083
750
  ...{
1084
- className: "flex h-full"
751
+ className: "flex",
752
+ style: {
753
+ height: "100%"
754
+ }
1085
755
  },
1086
- children: images.map(({ src }, key) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
756
+ children: images.map(({ src }, key) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1087
757
  "div",
1088
758
  {
1089
759
  ...{
1090
- className: "min-w-0 flex-[0_0_100%] relative h-full bg-gray-100"
760
+ className: "min-w-0 relative bg-gray-100",
761
+ style: {
762
+ flex: "0 0 100%",
763
+ height: "100%"
764
+ }
1091
765
  },
1092
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
766
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1093
767
  ImageComponent,
1094
768
  {
1095
769
  ...{
@@ -1097,7 +771,7 @@ var Product = ({
1097
771
  className: "object-cover",
1098
772
  fill: true,
1099
773
  sizes: "192px",
1100
- src: (0, import_cdn3.cdnShopify)(src, "400x400", product == null ? void 0 : product.updatedAt) || src,
774
+ src: (0, import_cdn.cdnShopify)(src, "400x400", product == null ? void 0 : product.updatedAt) || src,
1101
775
  unoptimized: true
1102
776
  }
1103
777
  }
@@ -1112,14 +786,14 @@ var Product = ({
1112
786
  ]
1113
787
  }
1114
788
  ),
1115
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
789
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1116
790
  "div",
1117
791
  {
1118
792
  ...{
1119
793
  className: "text-center space-y-2"
1120
794
  },
1121
795
  children: [
1122
- (product == null ? void 0 : product.title) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
796
+ (product == null ? void 0 : product.title) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1123
797
  "h2",
1124
798
  {
1125
799
  ...{
@@ -1133,30 +807,30 @@ var Product = ({
1133
807
  children: product == null ? void 0 : product.title
1134
808
  }
1135
809
  ),
1136
- !available.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { children: "Unavailable" }) : (selectedVariant == null ? void 0 : selectedVariant.price) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { children: (0, import_drawbridge_utils2.formatCurrency)({
810
+ !available.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: "Unavailable" }) : (selectedVariant == null ? void 0 : selectedVariant.price) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: (0, import_drawbridge_utils.formatCurrency)({
1137
811
  code: selectedVariant.currency,
1138
812
  display: "parts",
1139
813
  value: selectedVariant.price
1140
814
  }) }),
1141
- (product == null ? void 0 : product.description) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
815
+ (product == null ? void 0 : product.description) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1142
816
  wrapper_gradient_default,
1143
817
  {
1144
818
  ...{
1145
819
  classNameScroll: "max-h-[4.5em]",
1146
820
  color: resolved.background.color.rgb
1147
821
  },
1148
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { children: product.description })
822
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: product.description })
1149
823
  }
1150
824
  )
1151
825
  ]
1152
826
  }
1153
827
  ),
1154
- available.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
828
+ available.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1155
829
  input_group_default,
1156
830
  {
1157
831
  ...{
1158
832
  error: errors == null ? void 0 : errors.variant,
1159
- input: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
833
+ input: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1160
834
  input_select_default,
1161
835
  {
1162
836
  ...{
@@ -1175,29 +849,29 @@ var Product = ({
1175
849
  }
1176
850
  }
1177
851
  ),
1178
- available.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
852
+ available.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1179
853
  input_group_default,
1180
854
  {
1181
855
  ...{
1182
856
  error: errors == null ? void 0 : errors.root,
1183
- input: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
857
+ input: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1184
858
  "div",
1185
859
  {
1186
860
  ...{
1187
861
  className: addToCart ? "grid grid-cols-2 gap-3" : ""
1188
862
  },
1189
863
  children: [
1190
- addToCart && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
864
+ addToCart && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1191
865
  "button",
1192
866
  {
1193
867
  ...{
1194
- className: "button justify-center border",
868
+ className: "button justify-center border py-3 px-4 rounded",
1195
869
  disabled: disabled || Boolean(action),
1196
870
  onClick: onAdd,
1197
871
  style: inputStyle(resolved),
1198
872
  type: "button"
1199
873
  },
1200
- children: action === "add" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
874
+ children: action === "add" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1201
875
  loader_default,
1202
876
  {
1203
877
  ...{
@@ -1207,17 +881,17 @@ var Product = ({
1207
881
  ) : "Add to cart"
1208
882
  }
1209
883
  ),
1210
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
884
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1211
885
  "button",
1212
886
  {
1213
887
  ...{
1214
- className: "button justify-center" + (addToCart ? "" : " w-full"),
888
+ className: "button justify-center py-3 px-4 rounded" + (addToCart ? "" : " w-full"),
1215
889
  disabled: disabled || Boolean(action),
1216
890
  onClick: onBuy,
1217
891
  style: buttonStyle(resolved),
1218
892
  type: "button"
1219
893
  },
1220
- children: action === "buy" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
894
+ children: action === "buy" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1221
895
  loader_default,
1222
896
  {
1223
897
  ...{
@@ -1241,10 +915,29 @@ var Product = ({
1241
915
  var product_default = Product;
1242
916
 
1243
917
  // components/advertisement.js
1244
- var import_jsx_runtime9 = require("react/jsx-runtime");
918
+ var import_jsx_runtime8 = require("react/jsx-runtime");
919
+ var DefaultImage2 = ({ alt, className, src }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
920
+ "img",
921
+ {
922
+ ...{
923
+ alt,
924
+ className,
925
+ src
926
+ }
927
+ }
928
+ );
929
+ var DefaultVideo = ({ className, hls, mp4, poster }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
930
+ "video",
931
+ {
932
+ ...{
933
+ className,
934
+ poster,
935
+ src: mp4 || hls
936
+ }
937
+ }
938
+ );
1245
939
  var Advertisement = ({
1246
940
  action = null,
1247
- affiliate,
1248
941
  brand,
1249
942
  button,
1250
943
  campaign,
@@ -1253,16 +946,13 @@ var Advertisement = ({
1253
946
  file,
1254
947
  fonts,
1255
948
  header,
1256
- id,
1257
- ImageComponent,
949
+ ImageComponent = DefaultImage2,
1258
950
  lead,
1259
951
  onAdd,
1260
952
  onBuy,
1261
953
  onClick = () => {
1262
954
  },
1263
955
  onVariantChange,
1264
- onVariantSelect = () => {
1265
- },
1266
956
  organization,
1267
957
  page,
1268
958
  preview = false,
@@ -1271,10 +961,11 @@ var Advertisement = ({
1271
961
  title,
1272
962
  url,
1273
963
  variant,
1274
- VideoComponent
964
+ VideoComponent = DefaultVideo
1275
965
  }) => {
966
+ var _a, _b, _c, _d, _e;
1276
967
  if (product) {
1277
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
968
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1278
969
  product_default,
1279
970
  {
1280
971
  ...{
@@ -1294,29 +985,130 @@ var Advertisement = ({
1294
985
  }
1295
986
  );
1296
987
  }
1297
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1298
- card_advertisement_default,
988
+ const base = (brand == null ? void 0 : brand.style) || style;
989
+ const resolved = {
990
+ ...base,
991
+ background: {
992
+ ...base == null ? void 0 : base.background,
993
+ color: ((_a = base == null ? void 0 : base.background) == null ? void 0 : _a.color) || { hex: "#FFFFFF", rgb: "rgb( 255, 255, 255 )" }
994
+ },
995
+ text: {
996
+ ...base == null ? void 0 : base.text,
997
+ color: ((_b = base == null ? void 0 : base.text) == null ? void 0 : _b.color) || { hex: "#000000", rgb: "rgb( 0, 0, 0 )" }
998
+ }
999
+ };
1000
+ const isVideo = (_c = file == null ? void 0 : file.mimetype) == null ? void 0 : _c.includes("video");
1001
+ const card = (assetNode) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1002
+ "div",
1299
1003
  {
1300
1004
  ...{
1301
- advertisement: id,
1302
- affiliate,
1303
- asset: file,
1304
- brand: brand || { style },
1305
- button,
1306
- campaign,
1307
- fonts,
1308
- ImageComponent,
1309
- lead,
1310
- onClick,
1311
- onVariantSelect,
1312
- organization,
1313
- page,
1314
- preview,
1315
- title,
1316
- url,
1317
- VideoComponent
1318
- }
1005
+ className: "block w-full space-y-2",
1006
+ style: {
1007
+ backgroundColor: resolved.background.color.hex,
1008
+ color: resolved.text.color.hex
1009
+ }
1010
+ },
1011
+ children: [
1012
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1013
+ "span",
1014
+ {
1015
+ ...{
1016
+ className: "block relative aspect-square rounded overflow-hidden" + ((file == null ? void 0 : file.sizes) ? "" : " bg-gray-light")
1017
+ },
1018
+ children: assetNode
1019
+ }
1020
+ ),
1021
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1022
+ "span",
1023
+ {
1024
+ ...{
1025
+ className: "flex flex-col items-center justify-between gap-x-4 text-center text-sm rounded",
1026
+ style: {
1027
+ ...fonts == null ? void 0 : fonts.body,
1028
+ color: resolved.text.color.hex,
1029
+ gap: "10px",
1030
+ marginTop: "10px"
1031
+ }
1032
+ },
1033
+ children: [
1034
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1035
+ "div",
1036
+ {
1037
+ ...{
1038
+ className: "flex-1 min-w-0 space-y-2"
1039
+ },
1040
+ children: title && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1041
+ "p",
1042
+ {
1043
+ ...{
1044
+ style: {
1045
+ fontSize: "18px"
1046
+ }
1047
+ },
1048
+ children: title
1049
+ }
1050
+ )
1051
+ }
1052
+ ),
1053
+ button && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1054
+ "button",
1055
+ {
1056
+ ...{
1057
+ className: "flex items-center justify-center py-3 px-4 w-full border",
1058
+ disabled: !preview && !url,
1059
+ onClick: preview ? () => {
1060
+ } : onClick,
1061
+ style: buttonStyle(resolved),
1062
+ type: "button"
1063
+ },
1064
+ children: button
1065
+ }
1066
+ )
1067
+ ]
1068
+ }
1069
+ )
1070
+ ]
1319
1071
  }
1320
1072
  );
1073
+ if (isVideo) {
1074
+ return card(
1075
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1076
+ "div",
1077
+ {
1078
+ ...{
1079
+ className: "relative h-full w-full aspect-[9/16]"
1080
+ },
1081
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1082
+ VideoComponent,
1083
+ {
1084
+ ...{
1085
+ className: "w-full h-full",
1086
+ hls: (0, import_cdn2.cdnSrc)(file, "hls", file == null ? void 0 : file.updatedAt),
1087
+ mp4: (0, import_cdn2.cdnSrc)(file, "original", file == null ? void 0 : file.updatedAt),
1088
+ poster: (0, import_cdn2.cdnSrc)((_d = file == null ? void 0 : file.frames) == null ? void 0 : _d[file == null ? void 0 : file.poster], "500x500", file == null ? void 0 : file.updatedAt) || (0, import_cdn2.cdnSrc)((_e = file == null ? void 0 : file.frames) == null ? void 0 : _e[file == null ? void 0 : file.poster], "1080x1920", file == null ? void 0 : file.updatedAt),
1089
+ style: resolved
1090
+ }
1091
+ }
1092
+ )
1093
+ }
1094
+ )
1095
+ );
1096
+ }
1097
+ return card(
1098
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1099
+ ImageComponent,
1100
+ {
1101
+ ...{
1102
+ alt: file == null ? void 0 : file.filename,
1103
+ className: "w-full h-full object-cover",
1104
+ fill: true,
1105
+ priority: false,
1106
+ sizes: "100%",
1107
+ src: (0, import_cdn2.cdnSrc)(file, "400x400", file == null ? void 0 : file.updatedAt)
1108
+ }
1109
+ },
1110
+ file == null ? void 0 : file.id
1111
+ )
1112
+ );
1321
1113
  };
1322
1114
  var advertisement_default = Advertisement;