@drawbridge/components 0.0.44 → 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 = () => {
@@ -943,15 +599,26 @@ var Product = ({
943
599
  style = {},
944
600
  variant
945
601
  }) => {
946
- var _a, _b, _c, _d, _e, _f, _g;
947
- const available = (0, import_react5.useMemo)(
602
+ var _a, _b, _c, _d, _e;
603
+ const resolved = {
604
+ ...style,
605
+ background: {
606
+ ...style == null ? void 0 : style.background,
607
+ color: ((_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) || { hex: "#FFFFFF", rgb: "rgb( 255, 255, 255 )" }
608
+ },
609
+ text: {
610
+ ...style == null ? void 0 : style.text,
611
+ color: ((_b = style == null ? void 0 : style.text) == null ? void 0 : _b.color) || { hex: "#000000", rgb: "rgb( 0, 0, 0 )" }
612
+ }
613
+ };
614
+ const available = (0, import_react4.useMemo)(
948
615
  () => ((product == null ? void 0 : product.variants) || []).filter((v) => v.availableForSale),
949
616
  [product]
950
617
  );
951
- const [activeImage, setActiveImage] = (0, import_react5.useState)(0);
618
+ const [activeImage, setActiveImage] = (0, import_react4.useState)(0);
952
619
  const [emblaRef, emblaApi] = (0, import_embla_carousel_react.default)();
953
- const selectedVariant = available.find((v) => v.id === variant) || null;
954
- const images = (0, import_react5.useMemo)(
620
+ const selectedVariant = available.find((v) => v.id === variant) || available[0] || null;
621
+ const images = (0, import_react4.useMemo)(
955
622
  () => {
956
623
  const variants = ((product == null ? void 0 : product.variants) || []).filter((v) => v.availableForSale);
957
624
  const result = [];
@@ -976,7 +643,7 @@ var Product = ({
976
643
  },
977
644
  [product]
978
645
  );
979
- (0, import_react5.useEffect)(
646
+ (0, import_react4.useEffect)(
980
647
  () => {
981
648
  if (!emblaApi) return;
982
649
  const onSelect = () => {
@@ -1001,29 +668,33 @@ var Product = ({
1001
668
  }
1002
669
  ;
1003
670
  };
1004
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
671
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1005
672
  "div",
1006
673
  {
1007
674
  ...{
1008
- className: "space-y-6 pb-12"
675
+ className: "space-y-6 pb-12",
676
+ style: {
677
+ backgroundColor: resolved.background.color.rgb,
678
+ color: resolved.text.color.rgb
679
+ }
1009
680
  },
1010
681
  children: [
1011
682
  header,
1012
- images.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
683
+ images.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1013
684
  "div",
1014
685
  {
1015
686
  ...{
1016
687
  className: "flex items-center h-48 " + (images.length > 1 && "pr-12")
1017
688
  },
1018
689
  children: [
1019
- images.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
690
+ images.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1020
691
  wrapper_gradient_default,
1021
692
  {
1022
693
  ...{
1023
694
  classNameScroll: "flex flex-col w-12 h-48 space-y-3",
1024
- color: (_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb
695
+ color: resolved.background.color.rgb
1025
696
  },
1026
- children: images.map(({ src }, key) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
697
+ children: images.map(({ src }, key) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1027
698
  "button",
1028
699
  {
1029
700
  ...{
@@ -1034,10 +705,10 @@ var Product = ({
1034
705
  },
1035
706
  type: "button",
1036
707
  ...activeImage === key && {
1037
- style: inputStyle(style)
708
+ style: inputStyle(resolved)
1038
709
  }
1039
710
  },
1040
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
711
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1041
712
  ImageComponent,
1042
713
  {
1043
714
  ...{
@@ -1045,7 +716,7 @@ var Product = ({
1045
716
  className: "object-cover",
1046
717
  fill: true,
1047
718
  sizes: "48px",
1048
- 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,
1049
720
  unoptimized: true
1050
721
  }
1051
722
  }
@@ -1055,26 +726,26 @@ var Product = ({
1055
726
  ))
1056
727
  }
1057
728
  ),
1058
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
729
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1059
730
  "div",
1060
731
  {
1061
732
  ...{
1062
733
  className: "w-48 h-48 overflow-hidden rounded-3xl m-auto",
1063
734
  ref: emblaRef
1064
735
  },
1065
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
736
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1066
737
  "div",
1067
738
  {
1068
739
  ...{
1069
740
  className: "flex h-full"
1070
741
  },
1071
- children: images.map(({ src }, key) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
742
+ children: images.map(({ src }, key) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1072
743
  "div",
1073
744
  {
1074
745
  ...{
1075
746
  className: "min-w-0 flex-[0_0_100%] relative h-full bg-gray-100"
1076
747
  },
1077
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
748
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1078
749
  ImageComponent,
1079
750
  {
1080
751
  ...{
@@ -1082,7 +753,7 @@ var Product = ({
1082
753
  className: "object-cover",
1083
754
  fill: true,
1084
755
  sizes: "192px",
1085
- 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,
1086
757
  unoptimized: true
1087
758
  }
1088
759
  }
@@ -1097,14 +768,14 @@ var Product = ({
1097
768
  ]
1098
769
  }
1099
770
  ),
1100
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
771
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1101
772
  "div",
1102
773
  {
1103
774
  ...{
1104
775
  className: "text-center space-y-2"
1105
776
  },
1106
777
  children: [
1107
- (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)(
1108
779
  "h2",
1109
780
  {
1110
781
  ...{
@@ -1118,30 +789,30 @@ var Product = ({
1118
789
  children: product == null ? void 0 : product.title
1119
790
  }
1120
791
  ),
1121
- !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)({
1122
793
  code: selectedVariant.currency,
1123
794
  display: "parts",
1124
795
  value: selectedVariant.price
1125
796
  }) }),
1126
- (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)(
1127
798
  wrapper_gradient_default,
1128
799
  {
1129
800
  ...{
1130
801
  classNameScroll: "max-h-[4.5em]",
1131
- color: (_g = (_f = style == null ? void 0 : style.background) == null ? void 0 : _f.color) == null ? void 0 : _g.rgb
802
+ color: resolved.background.color.rgb
1132
803
  },
1133
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { children: product.description })
804
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: product.description })
1134
805
  }
1135
806
  )
1136
807
  ]
1137
808
  }
1138
809
  ),
1139
- available.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
810
+ available.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1140
811
  input_group_default,
1141
812
  {
1142
813
  ...{
1143
814
  error: errors == null ? void 0 : errors.variant,
1144
- input: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
815
+ input: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1145
816
  input_select_default,
1146
817
  {
1147
818
  ...{
@@ -1151,38 +822,38 @@ var Product = ({
1151
822
  label: v.title,
1152
823
  value: v.id
1153
824
  })),
1154
- style,
825
+ style: resolved,
1155
826
  value: variant || ""
1156
827
  }
1157
828
  }
1158
829
  ),
1159
- style
830
+ style: resolved
1160
831
  }
1161
832
  }
1162
833
  ),
1163
- available.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
834
+ available.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1164
835
  input_group_default,
1165
836
  {
1166
837
  ...{
1167
838
  error: errors == null ? void 0 : errors.root,
1168
- input: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
839
+ input: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1169
840
  "div",
1170
841
  {
1171
842
  ...{
1172
843
  className: addToCart ? "grid grid-cols-2 gap-3" : ""
1173
844
  },
1174
845
  children: [
1175
- addToCart && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
846
+ addToCart && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1176
847
  "button",
1177
848
  {
1178
849
  ...{
1179
- className: "button justify-center border",
850
+ className: "button justify-center border py-3 px-4 rounded",
1180
851
  disabled: disabled || Boolean(action),
1181
852
  onClick: onAdd,
1182
- style: inputStyle(style),
853
+ style: inputStyle(resolved),
1183
854
  type: "button"
1184
855
  },
1185
- children: action === "add" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
856
+ children: action === "add" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1186
857
  loader_default,
1187
858
  {
1188
859
  ...{
@@ -1192,17 +863,17 @@ var Product = ({
1192
863
  ) : "Add to cart"
1193
864
  }
1194
865
  ),
1195
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
866
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1196
867
  "button",
1197
868
  {
1198
869
  ...{
1199
- className: "button justify-center" + (addToCart ? "" : " w-full"),
870
+ className: "button justify-center py-3 px-4 rounded" + (addToCart ? "" : " w-full"),
1200
871
  disabled: disabled || Boolean(action),
1201
872
  onClick: onBuy,
1202
- style: buttonStyle(style),
873
+ style: buttonStyle(resolved),
1203
874
  type: "button"
1204
875
  },
1205
- children: action === "buy" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
876
+ children: action === "buy" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1206
877
  loader_default,
1207
878
  {
1208
879
  ...{
@@ -1215,7 +886,7 @@ var Product = ({
1215
886
  ]
1216
887
  }
1217
888
  ),
1218
- style
889
+ style: resolved
1219
890
  }
1220
891
  }
1221
892
  )
@@ -1226,10 +897,29 @@ var Product = ({
1226
897
  var product_default = Product;
1227
898
 
1228
899
  // components/advertisement.js
1229
- 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
+ );
1230
921
  var Advertisement = ({
1231
922
  action = null,
1232
- affiliate,
1233
923
  brand,
1234
924
  button,
1235
925
  campaign,
@@ -1238,16 +928,13 @@ var Advertisement = ({
1238
928
  file,
1239
929
  fonts,
1240
930
  header,
1241
- id,
1242
- ImageComponent,
931
+ ImageComponent = DefaultImage2,
1243
932
  lead,
1244
933
  onAdd,
1245
934
  onBuy,
1246
935
  onClick = () => {
1247
936
  },
1248
937
  onVariantChange,
1249
- onVariantSelect = () => {
1250
- },
1251
938
  organization,
1252
939
  page,
1253
940
  preview = false,
@@ -1256,10 +943,11 @@ var Advertisement = ({
1256
943
  title,
1257
944
  url,
1258
945
  variant,
1259
- VideoComponent
946
+ VideoComponent = DefaultVideo
1260
947
  }) => {
948
+ var _a, _b, _c, _d, _e;
1261
949
  if (product) {
1262
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
950
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1263
951
  product_default,
1264
952
  {
1265
953
  ...{
@@ -1273,35 +961,136 @@ var Advertisement = ({
1273
961
  onBuy,
1274
962
  onVariantChange,
1275
963
  product,
1276
- style,
964
+ style: (brand == null ? void 0 : brand.style) || style,
1277
965
  variant
1278
966
  }
1279
967
  }
1280
968
  );
1281
969
  }
1282
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1283
- 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",
1284
985
  {
1285
986
  ...{
1286
- advertisement: id,
1287
- affiliate,
1288
- asset: file,
1289
- brand: brand || { style },
1290
- button,
1291
- campaign,
1292
- fonts,
1293
- ImageComponent,
1294
- lead,
1295
- onClick,
1296
- onVariantSelect,
1297
- organization,
1298
- page,
1299
- preview,
1300
- title,
1301
- url,
1302
- VideoComponent
1303
- }
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
+ ]
1304
1053
  }
1305
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
+ );
1306
1095
  };
1307
1096
  var advertisement_default = Advertisement;