@drawbridge/components 0.0.45 → 0.0.46

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,7 +668,7 @@ 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
  ...{
@@ -1024,21 +680,21 @@ 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
687
  className: "flex items-center h-48 " + (images.length > 1 && "pr-12")
1032
688
  },
1033
689
  children: [
1034
- images.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
690
+ images.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1035
691
  wrapper_gradient_default,
1036
692
  {
1037
693
  ...{
1038
694
  classNameScroll: "flex flex-col w-12 h-48 space-y-3",
1039
695
  color: resolved.background.color.rgb
1040
696
  },
1041
- children: images.map(({ src }, key) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
697
+ children: images.map(({ src }, key) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1042
698
  "button",
1043
699
  {
1044
700
  ...{
@@ -1052,7 +708,7 @@ var Product = ({
1052
708
  style: inputStyle(resolved)
1053
709
  }
1054
710
  },
1055
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
711
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1056
712
  ImageComponent,
1057
713
  {
1058
714
  ...{
@@ -1060,7 +716,7 @@ var Product = ({
1060
716
  className: "object-cover",
1061
717
  fill: true,
1062
718
  sizes: "48px",
1063
- src: (0, import_cdn3.cdnShopify)(src, "100x100", product == null ? void 0 : product.updatedAt) || src,
719
+ src: (0, import_cdn.cdnShopify)(src, "100x100", product == null ? void 0 : product.updatedAt) || src,
1064
720
  unoptimized: true
1065
721
  }
1066
722
  }
@@ -1070,26 +726,26 @@ var Product = ({
1070
726
  ))
1071
727
  }
1072
728
  ),
1073
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
729
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1074
730
  "div",
1075
731
  {
1076
732
  ...{
1077
733
  className: "w-48 h-48 overflow-hidden rounded-3xl m-auto",
1078
734
  ref: emblaRef
1079
735
  },
1080
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
736
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1081
737
  "div",
1082
738
  {
1083
739
  ...{
1084
740
  className: "flex h-full"
1085
741
  },
1086
- children: images.map(({ src }, key) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
742
+ children: images.map(({ src }, key) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1087
743
  "div",
1088
744
  {
1089
745
  ...{
1090
746
  className: "min-w-0 flex-[0_0_100%] relative h-full bg-gray-100"
1091
747
  },
1092
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
748
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1093
749
  ImageComponent,
1094
750
  {
1095
751
  ...{
@@ -1097,7 +753,7 @@ var Product = ({
1097
753
  className: "object-cover",
1098
754
  fill: true,
1099
755
  sizes: "192px",
1100
- src: (0, import_cdn3.cdnShopify)(src, "400x400", product == null ? void 0 : product.updatedAt) || src,
756
+ src: (0, import_cdn.cdnShopify)(src, "400x400", product == null ? void 0 : product.updatedAt) || src,
1101
757
  unoptimized: true
1102
758
  }
1103
759
  }
@@ -1112,14 +768,14 @@ var Product = ({
1112
768
  ]
1113
769
  }
1114
770
  ),
1115
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
771
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1116
772
  "div",
1117
773
  {
1118
774
  ...{
1119
775
  className: "text-center space-y-2"
1120
776
  },
1121
777
  children: [
1122
- (product == null ? void 0 : product.title) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
778
+ (product == null ? void 0 : product.title) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1123
779
  "h2",
1124
780
  {
1125
781
  ...{
@@ -1133,30 +789,30 @@ var Product = ({
1133
789
  children: product == null ? void 0 : product.title
1134
790
  }
1135
791
  ),
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)({
792
+ !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
793
  code: selectedVariant.currency,
1138
794
  display: "parts",
1139
795
  value: selectedVariant.price
1140
796
  }) }),
1141
- (product == null ? void 0 : product.description) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
797
+ (product == null ? void 0 : product.description) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1142
798
  wrapper_gradient_default,
1143
799
  {
1144
800
  ...{
1145
801
  classNameScroll: "max-h-[4.5em]",
1146
802
  color: resolved.background.color.rgb
1147
803
  },
1148
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { children: product.description })
804
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: product.description })
1149
805
  }
1150
806
  )
1151
807
  ]
1152
808
  }
1153
809
  ),
1154
- available.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
810
+ available.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1155
811
  input_group_default,
1156
812
  {
1157
813
  ...{
1158
814
  error: errors == null ? void 0 : errors.variant,
1159
- input: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
815
+ input: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1160
816
  input_select_default,
1161
817
  {
1162
818
  ...{
@@ -1175,29 +831,29 @@ var Product = ({
1175
831
  }
1176
832
  }
1177
833
  ),
1178
- available.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
834
+ available.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1179
835
  input_group_default,
1180
836
  {
1181
837
  ...{
1182
838
  error: errors == null ? void 0 : errors.root,
1183
- input: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
839
+ input: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1184
840
  "div",
1185
841
  {
1186
842
  ...{
1187
843
  className: addToCart ? "grid grid-cols-2 gap-3" : ""
1188
844
  },
1189
845
  children: [
1190
- addToCart && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
846
+ addToCart && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1191
847
  "button",
1192
848
  {
1193
849
  ...{
1194
- className: "button justify-center border",
850
+ className: "button justify-center border py-3 px-4 rounded",
1195
851
  disabled: disabled || Boolean(action),
1196
852
  onClick: onAdd,
1197
853
  style: inputStyle(resolved),
1198
854
  type: "button"
1199
855
  },
1200
- children: action === "add" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
856
+ children: action === "add" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1201
857
  loader_default,
1202
858
  {
1203
859
  ...{
@@ -1207,17 +863,17 @@ var Product = ({
1207
863
  ) : "Add to cart"
1208
864
  }
1209
865
  ),
1210
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
866
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1211
867
  "button",
1212
868
  {
1213
869
  ...{
1214
- className: "button justify-center" + (addToCart ? "" : " w-full"),
870
+ className: "button justify-center py-3 px-4 rounded" + (addToCart ? "" : " w-full"),
1215
871
  disabled: disabled || Boolean(action),
1216
872
  onClick: onBuy,
1217
873
  style: buttonStyle(resolved),
1218
874
  type: "button"
1219
875
  },
1220
- children: action === "buy" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
876
+ children: action === "buy" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1221
877
  loader_default,
1222
878
  {
1223
879
  ...{
@@ -1241,10 +897,29 @@ var Product = ({
1241
897
  var product_default = Product;
1242
898
 
1243
899
  // components/advertisement.js
1244
- var import_jsx_runtime9 = require("react/jsx-runtime");
900
+ var import_jsx_runtime8 = require("react/jsx-runtime");
901
+ var DefaultImage2 = ({ alt, className, src }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
902
+ "img",
903
+ {
904
+ ...{
905
+ alt,
906
+ className,
907
+ src
908
+ }
909
+ }
910
+ );
911
+ var DefaultVideo = ({ className, hls, mp4, poster }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
912
+ "video",
913
+ {
914
+ ...{
915
+ className,
916
+ poster,
917
+ src: mp4 || hls
918
+ }
919
+ }
920
+ );
1245
921
  var Advertisement = ({
1246
922
  action = null,
1247
- affiliate,
1248
923
  brand,
1249
924
  button,
1250
925
  campaign,
@@ -1253,16 +928,13 @@ var Advertisement = ({
1253
928
  file,
1254
929
  fonts,
1255
930
  header,
1256
- id,
1257
- ImageComponent,
931
+ ImageComponent = DefaultImage2,
1258
932
  lead,
1259
933
  onAdd,
1260
934
  onBuy,
1261
935
  onClick = () => {
1262
936
  },
1263
937
  onVariantChange,
1264
- onVariantSelect = () => {
1265
- },
1266
938
  organization,
1267
939
  page,
1268
940
  preview = false,
@@ -1271,10 +943,11 @@ var Advertisement = ({
1271
943
  title,
1272
944
  url,
1273
945
  variant,
1274
- VideoComponent
946
+ VideoComponent = DefaultVideo
1275
947
  }) => {
948
+ var _a, _b, _c, _d, _e;
1276
949
  if (product) {
1277
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
950
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1278
951
  product_default,
1279
952
  {
1280
953
  ...{
@@ -1294,29 +967,130 @@ var Advertisement = ({
1294
967
  }
1295
968
  );
1296
969
  }
1297
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1298
- card_advertisement_default,
970
+ const base = (brand == null ? void 0 : brand.style) || style;
971
+ const resolved = {
972
+ ...base,
973
+ background: {
974
+ ...base == null ? void 0 : base.background,
975
+ color: ((_a = base == null ? void 0 : base.background) == null ? void 0 : _a.color) || { hex: "#FFFFFF", rgb: "rgb( 255, 255, 255 )" }
976
+ },
977
+ text: {
978
+ ...base == null ? void 0 : base.text,
979
+ color: ((_b = base == null ? void 0 : base.text) == null ? void 0 : _b.color) || { hex: "#000000", rgb: "rgb( 0, 0, 0 )" }
980
+ }
981
+ };
982
+ const isVideo = (_c = file == null ? void 0 : file.mimetype) == null ? void 0 : _c.includes("video");
983
+ const card = (assetNode) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
984
+ "div",
1299
985
  {
1300
986
  ...{
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
- }
987
+ className: "block w-full space-y-2",
988
+ style: {
989
+ backgroundColor: resolved.background.color.hex,
990
+ color: resolved.text.color.hex
991
+ }
992
+ },
993
+ children: [
994
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
995
+ "span",
996
+ {
997
+ ...{
998
+ className: "block relative aspect-square rounded overflow-hidden" + ((file == null ? void 0 : file.sizes) ? "" : " bg-gray-light")
999
+ },
1000
+ children: assetNode
1001
+ }
1002
+ ),
1003
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1004
+ "span",
1005
+ {
1006
+ ...{
1007
+ className: "flex flex-col items-center justify-between gap-x-4 text-center text-sm rounded",
1008
+ style: {
1009
+ ...fonts == null ? void 0 : fonts.body,
1010
+ color: resolved.text.color.hex,
1011
+ gap: "10px",
1012
+ marginTop: "10px"
1013
+ }
1014
+ },
1015
+ children: [
1016
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1017
+ "div",
1018
+ {
1019
+ ...{
1020
+ className: "flex-1 min-w-0 space-y-2"
1021
+ },
1022
+ children: title && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1023
+ "p",
1024
+ {
1025
+ ...{
1026
+ style: {
1027
+ fontSize: "18px"
1028
+ }
1029
+ },
1030
+ children: title
1031
+ }
1032
+ )
1033
+ }
1034
+ ),
1035
+ button && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1036
+ "button",
1037
+ {
1038
+ ...{
1039
+ className: "flex items-center justify-center py-3 px-4 w-full border",
1040
+ disabled: !preview && !url,
1041
+ onClick: preview ? () => {
1042
+ } : onClick,
1043
+ style: buttonStyle(resolved),
1044
+ type: "button"
1045
+ },
1046
+ children: button
1047
+ }
1048
+ )
1049
+ ]
1050
+ }
1051
+ )
1052
+ ]
1319
1053
  }
1320
1054
  );
1055
+ if (isVideo) {
1056
+ return card(
1057
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1058
+ "div",
1059
+ {
1060
+ ...{
1061
+ className: "relative h-full w-full aspect-[9/16]"
1062
+ },
1063
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1064
+ VideoComponent,
1065
+ {
1066
+ ...{
1067
+ className: "w-full h-full",
1068
+ hls: (0, import_cdn2.cdnSrc)(file, "hls", file == null ? void 0 : file.updatedAt),
1069
+ mp4: (0, import_cdn2.cdnSrc)(file, "original", file == null ? void 0 : file.updatedAt),
1070
+ 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),
1071
+ style: resolved
1072
+ }
1073
+ }
1074
+ )
1075
+ }
1076
+ )
1077
+ );
1078
+ }
1079
+ return card(
1080
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1081
+ ImageComponent,
1082
+ {
1083
+ ...{
1084
+ alt: file == null ? void 0 : file.filename,
1085
+ className: "w-full h-full object-cover",
1086
+ fill: true,
1087
+ priority: false,
1088
+ sizes: "100%",
1089
+ src: (0, import_cdn2.cdnSrc)(file, "400x400", file == null ? void 0 : file.updatedAt)
1090
+ }
1091
+ },
1092
+ file == null ? void 0 : file.id
1093
+ )
1094
+ );
1321
1095
  };
1322
1096
  var advertisement_default = Advertisement;