@drawbridge/components 0.0.4 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/card-advertisement.js +61 -83
- package/dist/card-advertisement.mjs +61 -73
- package/package.json +33 -29
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
|
|
29
19
|
// components/card-advertisement.js
|
|
@@ -32,7 +22,8 @@ __export(card_advertisement_exports, {
|
|
|
32
22
|
default: () => card_advertisement_default
|
|
33
23
|
});
|
|
34
24
|
module.exports = __toCommonJS(card_advertisement_exports);
|
|
35
|
-
var import_react =
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var import_cdn = require("@drawbridge/drawbridge-utils/cdn");
|
|
36
27
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
28
|
var DefaultImage = ({ alt, className, src }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
38
29
|
"img",
|
|
@@ -55,35 +46,31 @@ var DefaultVideo = ({ className, hsl, mp4, poster }) => /* @__PURE__ */ (0, impo
|
|
|
55
46
|
}
|
|
56
47
|
);
|
|
57
48
|
var CardAdvertisement = ({
|
|
49
|
+
advertisement,
|
|
50
|
+
affiliate,
|
|
58
51
|
asset,
|
|
59
52
|
brand = {},
|
|
60
53
|
button,
|
|
61
54
|
campaign,
|
|
62
55
|
fonts,
|
|
63
56
|
ImageComponent = DefaultImage,
|
|
57
|
+
lead,
|
|
64
58
|
onClick = () => {
|
|
65
59
|
},
|
|
60
|
+
onVariantSelect = () => {
|
|
61
|
+
},
|
|
66
62
|
organization,
|
|
63
|
+
page,
|
|
67
64
|
preview = false,
|
|
68
65
|
product,
|
|
69
66
|
title,
|
|
70
67
|
url,
|
|
71
68
|
VideoComponent = DefaultVideo
|
|
72
69
|
}) => {
|
|
73
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v
|
|
70
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
74
71
|
const variants = ((product == null ? void 0 : product.variants) || []).filter((v) => v.availableForSale);
|
|
75
|
-
const hasVariants = variants.length >
|
|
76
|
-
const [
|
|
77
|
-
const variantUrl = (variant) => {
|
|
78
|
-
const variantShopifyId = (variant.shopifyId || "").split("/").pop();
|
|
79
|
-
const domain = (product == null ? void 0 : product.url) ? new URL(product.url).hostname : null;
|
|
80
|
-
if (!domain || !variantShopifyId) return null;
|
|
81
|
-
const params = [
|
|
82
|
-
...campaign ? ["attributes[drwbrdg_c]=" + campaign] : [],
|
|
83
|
-
...organization ? ["attributes[drwbrdg_o]=" + organization] : []
|
|
84
|
-
].join("&");
|
|
85
|
-
return "https://" + domain + "/cart/" + variantShopifyId + ":1" + (params ? "?" + params : "");
|
|
86
|
-
};
|
|
72
|
+
const hasVariants = variants.length > 0;
|
|
73
|
+
const [selectedVariant, setSelectedVariant] = (0, import_react.useState)(variants[0] || null);
|
|
87
74
|
const style = {
|
|
88
75
|
background: {
|
|
89
76
|
color: ((_a = brand == null ? void 0 : brand.style) == null ? void 0 : _a.background) ? (_b = brand.style.background) == null ? void 0 : _b.color : {
|
|
@@ -114,7 +101,8 @@ var CardAdvertisement = ({
|
|
|
114
101
|
"flex items-center justify-between space-x-4 text-left text-sm p-4 rounded"
|
|
115
102
|
]
|
|
116
103
|
};
|
|
117
|
-
|
|
104
|
+
const productImage = (selectedVariant == null ? void 0 : selectedVariant.image) || (product == null ? void 0 : product.image) || null;
|
|
105
|
+
if (!(asset == null ? void 0 : asset.sizes) && !productImage) {
|
|
118
106
|
classes.asset.push("bg-gray-light");
|
|
119
107
|
}
|
|
120
108
|
;
|
|
@@ -146,23 +134,21 @@ var CardAdvertisement = ({
|
|
|
146
134
|
key: asset == null ? void 0 : asset.id,
|
|
147
135
|
priority: false,
|
|
148
136
|
sizes: "100%",
|
|
149
|
-
src:
|
|
150
|
-
(_i = asset == null ? void 0 : asset.sizes) == null ? void 0 : _i["400x400"],
|
|
151
|
-
(asset == null ? void 0 : asset.updatedAt) && "?query=" + (asset == null ? void 0 : asset.updatedAt)
|
|
152
|
-
].filter(Boolean).join("")
|
|
137
|
+
src: (0, import_cdn.cdnSrc)(asset, "400x400", asset == null ? void 0 : asset.updatedAt)
|
|
153
138
|
}
|
|
154
139
|
}
|
|
155
140
|
),
|
|
156
|
-
!(asset == null ? void 0 : asset.sizes) &&
|
|
141
|
+
!(asset == null ? void 0 : asset.sizes) && productImage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
157
142
|
ImageComponent,
|
|
158
143
|
{
|
|
159
144
|
...{
|
|
160
145
|
alt: (product == null ? void 0 : product.title) || "Product",
|
|
161
146
|
className: "w-full h-full object-cover",
|
|
162
147
|
fill: true,
|
|
148
|
+
key: productImage,
|
|
163
149
|
priority: false,
|
|
164
150
|
sizes: "100%",
|
|
165
|
-
src:
|
|
151
|
+
src: productImage,
|
|
166
152
|
unoptimized: true
|
|
167
153
|
}
|
|
168
154
|
}
|
|
@@ -178,92 +164,84 @@ var CardAdvertisement = ({
|
|
|
178
164
|
{
|
|
179
165
|
...{
|
|
180
166
|
className: "w-full h-full",
|
|
181
|
-
hsl: (
|
|
182
|
-
mp4: (
|
|
183
|
-
poster: (
|
|
167
|
+
hsl: (0, import_cdn.cdnSrc)(asset, "hsl", asset == null ? void 0 : asset.updatedAt),
|
|
168
|
+
mp4: (0, import_cdn.cdnSrc)(asset, "original", asset == null ? void 0 : asset.updatedAt),
|
|
169
|
+
poster: (0, import_cdn.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_cdn.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)
|
|
184
170
|
}
|
|
185
171
|
}
|
|
186
172
|
)
|
|
187
173
|
}
|
|
188
|
-
)
|
|
189
|
-
|
|
174
|
+
)
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
),
|
|
178
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
179
|
+
"span",
|
|
180
|
+
{
|
|
181
|
+
...{
|
|
182
|
+
className: classes.content.join(" "),
|
|
183
|
+
style: {
|
|
184
|
+
...fonts == null ? void 0 : fonts.body,
|
|
185
|
+
backgroundColor: (_l = (_k = style == null ? void 0 : style.text) == null ? void 0 : _k.color) == null ? void 0 : _l.hex,
|
|
186
|
+
color: (_n = (_m = style == null ? void 0 : style.background) == null ? void 0 : _m.color) == null ? void 0 : _n.hex
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
190
191
|
"div",
|
|
191
192
|
{
|
|
192
193
|
...{
|
|
193
|
-
className: "
|
|
194
|
-
style: {
|
|
195
|
-
backgroundColor: "rgba(0,0,0,0.92)",
|
|
196
|
-
transform: variantsOpen ? "translateY(0)" : "translateY(100%)"
|
|
197
|
-
}
|
|
194
|
+
className: "flex-1 min-w-0 space-y-2"
|
|
198
195
|
},
|
|
199
196
|
children: [
|
|
200
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
...{
|
|
204
|
-
className: "text-xs text-white/60"
|
|
205
|
-
},
|
|
206
|
-
children: "Select an option"
|
|
207
|
-
}
|
|
208
|
-
),
|
|
209
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
210
|
-
"div",
|
|
197
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: title }),
|
|
198
|
+
variants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
199
|
+
"select",
|
|
211
200
|
{
|
|
212
201
|
...{
|
|
213
|
-
className: "
|
|
202
|
+
className: "w-full text-xs rounded border px-2 py-1 bg-transparent",
|
|
203
|
+
onChange: (e) => {
|
|
204
|
+
const variant = variants.find((v) => v.providerId === e.target.value);
|
|
205
|
+
if (variant) setSelectedVariant(variant);
|
|
206
|
+
},
|
|
207
|
+
style: {
|
|
208
|
+
borderColor: (_p = (_o = style == null ? void 0 : style.background) == null ? void 0 : _o.color) == null ? void 0 : _p.rgb.replace(")", ", 0.3)"),
|
|
209
|
+
color: (_r = (_q = style == null ? void 0 : style.background) == null ? void 0 : _q.color) == null ? void 0 : _r.hex
|
|
210
|
+
},
|
|
211
|
+
value: (selectedVariant == null ? void 0 : selectedVariant.providerId) || ""
|
|
214
212
|
},
|
|
215
213
|
children: variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
216
|
-
"
|
|
214
|
+
"option",
|
|
217
215
|
{
|
|
218
216
|
...{
|
|
219
|
-
|
|
220
|
-
onClick: () => {
|
|
221
|
-
if (preview) return;
|
|
222
|
-
const href = variantUrl(variant);
|
|
223
|
-
if (href) window.open(href, "_blank");
|
|
224
|
-
},
|
|
225
|
-
type: "button"
|
|
217
|
+
value: variant.providerId
|
|
226
218
|
},
|
|
227
219
|
children: variant.title
|
|
228
220
|
},
|
|
229
|
-
variant.
|
|
221
|
+
variant.providerId
|
|
230
222
|
))
|
|
231
223
|
}
|
|
232
224
|
)
|
|
233
225
|
]
|
|
234
226
|
}
|
|
235
|
-
)
|
|
236
|
-
]
|
|
237
|
-
}
|
|
238
|
-
),
|
|
239
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
240
|
-
"span",
|
|
241
|
-
{
|
|
242
|
-
...{
|
|
243
|
-
className: classes.content.join(" "),
|
|
244
|
-
style: {
|
|
245
|
-
...fonts == null ? void 0 : fonts.body,
|
|
246
|
-
backgroundColor: (_s = (_r = style == null ? void 0 : style.text) == null ? void 0 : _r.color) == null ? void 0 : _s.hex,
|
|
247
|
-
color: (_u = (_t = style == null ? void 0 : style.background) == null ? void 0 : _t.color) == null ? void 0 : _u.hex
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
children: [
|
|
251
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: title }),
|
|
227
|
+
),
|
|
252
228
|
button && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
253
229
|
"button",
|
|
254
230
|
{
|
|
255
231
|
...{
|
|
256
232
|
className: classes.button.join(" "),
|
|
257
233
|
disabled: !preview && !hasVariants && !url,
|
|
258
|
-
onClick: hasVariants ? () =>
|
|
234
|
+
onClick: hasVariants ? () => {
|
|
235
|
+
if (!preview) onVariantSelect(selectedVariant);
|
|
236
|
+
} : preview ? () => {
|
|
259
237
|
} : onClick,
|
|
260
238
|
style: {
|
|
261
|
-
backgroundColor: (
|
|
262
|
-
color: (
|
|
239
|
+
backgroundColor: (_t = (_s = style == null ? void 0 : style.background) == null ? void 0 : _s.color) == null ? void 0 : _t.hex,
|
|
240
|
+
color: (_v = (_u = style == null ? void 0 : style.text) == null ? void 0 : _u.color) == null ? void 0 : _v.hex
|
|
263
241
|
},
|
|
264
242
|
type: "button"
|
|
265
243
|
},
|
|
266
|
-
children:
|
|
244
|
+
children: button
|
|
267
245
|
}
|
|
268
246
|
)
|
|
269
247
|
]
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// components/card-advertisement.js
|
|
2
|
-
import
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { cdnSrc } from "@drawbridge/drawbridge-utils/cdn";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
var DefaultImage = ({ alt, className, src }) => /* @__PURE__ */ jsx(
|
|
5
6
|
"img",
|
|
@@ -22,35 +23,31 @@ var DefaultVideo = ({ className, hsl, mp4, poster }) => /* @__PURE__ */ jsx(
|
|
|
22
23
|
}
|
|
23
24
|
);
|
|
24
25
|
var CardAdvertisement = ({
|
|
26
|
+
advertisement,
|
|
27
|
+
affiliate,
|
|
25
28
|
asset,
|
|
26
29
|
brand = {},
|
|
27
30
|
button,
|
|
28
31
|
campaign,
|
|
29
32
|
fonts,
|
|
30
33
|
ImageComponent = DefaultImage,
|
|
34
|
+
lead,
|
|
31
35
|
onClick = () => {
|
|
32
36
|
},
|
|
37
|
+
onVariantSelect = () => {
|
|
38
|
+
},
|
|
33
39
|
organization,
|
|
40
|
+
page,
|
|
34
41
|
preview = false,
|
|
35
42
|
product,
|
|
36
43
|
title,
|
|
37
44
|
url,
|
|
38
45
|
VideoComponent = DefaultVideo
|
|
39
46
|
}) => {
|
|
40
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v
|
|
47
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
41
48
|
const variants = ((product == null ? void 0 : product.variants) || []).filter((v) => v.availableForSale);
|
|
42
|
-
const hasVariants = variants.length >
|
|
43
|
-
const [
|
|
44
|
-
const variantUrl = (variant) => {
|
|
45
|
-
const variantShopifyId = (variant.shopifyId || "").split("/").pop();
|
|
46
|
-
const domain = (product == null ? void 0 : product.url) ? new URL(product.url).hostname : null;
|
|
47
|
-
if (!domain || !variantShopifyId) return null;
|
|
48
|
-
const params = [
|
|
49
|
-
...campaign ? ["attributes[drwbrdg_c]=" + campaign] : [],
|
|
50
|
-
...organization ? ["attributes[drwbrdg_o]=" + organization] : []
|
|
51
|
-
].join("&");
|
|
52
|
-
return "https://" + domain + "/cart/" + variantShopifyId + ":1" + (params ? "?" + params : "");
|
|
53
|
-
};
|
|
49
|
+
const hasVariants = variants.length > 0;
|
|
50
|
+
const [selectedVariant, setSelectedVariant] = useState(variants[0] || null);
|
|
54
51
|
const style = {
|
|
55
52
|
background: {
|
|
56
53
|
color: ((_a = brand == null ? void 0 : brand.style) == null ? void 0 : _a.background) ? (_b = brand.style.background) == null ? void 0 : _b.color : {
|
|
@@ -81,7 +78,8 @@ var CardAdvertisement = ({
|
|
|
81
78
|
"flex items-center justify-between space-x-4 text-left text-sm p-4 rounded"
|
|
82
79
|
]
|
|
83
80
|
};
|
|
84
|
-
|
|
81
|
+
const productImage = (selectedVariant == null ? void 0 : selectedVariant.image) || (product == null ? void 0 : product.image) || null;
|
|
82
|
+
if (!(asset == null ? void 0 : asset.sizes) && !productImage) {
|
|
85
83
|
classes.asset.push("bg-gray-light");
|
|
86
84
|
}
|
|
87
85
|
;
|
|
@@ -113,23 +111,21 @@ var CardAdvertisement = ({
|
|
|
113
111
|
key: asset == null ? void 0 : asset.id,
|
|
114
112
|
priority: false,
|
|
115
113
|
sizes: "100%",
|
|
116
|
-
src:
|
|
117
|
-
(_i = asset == null ? void 0 : asset.sizes) == null ? void 0 : _i["400x400"],
|
|
118
|
-
(asset == null ? void 0 : asset.updatedAt) && "?query=" + (asset == null ? void 0 : asset.updatedAt)
|
|
119
|
-
].filter(Boolean).join("")
|
|
114
|
+
src: cdnSrc(asset, "400x400", asset == null ? void 0 : asset.updatedAt)
|
|
120
115
|
}
|
|
121
116
|
}
|
|
122
117
|
),
|
|
123
|
-
!(asset == null ? void 0 : asset.sizes) &&
|
|
118
|
+
!(asset == null ? void 0 : asset.sizes) && productImage && /* @__PURE__ */ jsx(
|
|
124
119
|
ImageComponent,
|
|
125
120
|
{
|
|
126
121
|
...{
|
|
127
122
|
alt: (product == null ? void 0 : product.title) || "Product",
|
|
128
123
|
className: "w-full h-full object-cover",
|
|
129
124
|
fill: true,
|
|
125
|
+
key: productImage,
|
|
130
126
|
priority: false,
|
|
131
127
|
sizes: "100%",
|
|
132
|
-
src:
|
|
128
|
+
src: productImage,
|
|
133
129
|
unoptimized: true
|
|
134
130
|
}
|
|
135
131
|
}
|
|
@@ -145,92 +141,84 @@ var CardAdvertisement = ({
|
|
|
145
141
|
{
|
|
146
142
|
...{
|
|
147
143
|
className: "w-full h-full",
|
|
148
|
-
hsl: (
|
|
149
|
-
mp4: (
|
|
150
|
-
poster: ((
|
|
144
|
+
hsl: cdnSrc(asset, "hsl", asset == null ? void 0 : asset.updatedAt),
|
|
145
|
+
mp4: cdnSrc(asset, "original", asset == null ? void 0 : asset.updatedAt),
|
|
146
|
+
poster: 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) || 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)
|
|
151
147
|
}
|
|
152
148
|
}
|
|
153
149
|
)
|
|
154
150
|
}
|
|
155
|
-
)
|
|
156
|
-
|
|
151
|
+
)
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
),
|
|
155
|
+
/* @__PURE__ */ jsxs(
|
|
156
|
+
"span",
|
|
157
|
+
{
|
|
158
|
+
...{
|
|
159
|
+
className: classes.content.join(" "),
|
|
160
|
+
style: {
|
|
161
|
+
...fonts == null ? void 0 : fonts.body,
|
|
162
|
+
backgroundColor: (_l = (_k = style == null ? void 0 : style.text) == null ? void 0 : _k.color) == null ? void 0 : _l.hex,
|
|
163
|
+
color: (_n = (_m = style == null ? void 0 : style.background) == null ? void 0 : _m.color) == null ? void 0 : _n.hex
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ jsxs(
|
|
157
168
|
"div",
|
|
158
169
|
{
|
|
159
170
|
...{
|
|
160
|
-
className: "
|
|
161
|
-
style: {
|
|
162
|
-
backgroundColor: "rgba(0,0,0,0.92)",
|
|
163
|
-
transform: variantsOpen ? "translateY(0)" : "translateY(100%)"
|
|
164
|
-
}
|
|
171
|
+
className: "flex-1 min-w-0 space-y-2"
|
|
165
172
|
},
|
|
166
173
|
children: [
|
|
167
|
-
/* @__PURE__ */ jsx(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
...{
|
|
171
|
-
className: "text-xs text-white/60"
|
|
172
|
-
},
|
|
173
|
-
children: "Select an option"
|
|
174
|
-
}
|
|
175
|
-
),
|
|
176
|
-
/* @__PURE__ */ jsx(
|
|
177
|
-
"div",
|
|
174
|
+
title && /* @__PURE__ */ jsx("p", { children: title }),
|
|
175
|
+
variants.length > 1 && /* @__PURE__ */ jsx(
|
|
176
|
+
"select",
|
|
178
177
|
{
|
|
179
178
|
...{
|
|
180
|
-
className: "
|
|
179
|
+
className: "w-full text-xs rounded border px-2 py-1 bg-transparent",
|
|
180
|
+
onChange: (e) => {
|
|
181
|
+
const variant = variants.find((v) => v.providerId === e.target.value);
|
|
182
|
+
if (variant) setSelectedVariant(variant);
|
|
183
|
+
},
|
|
184
|
+
style: {
|
|
185
|
+
borderColor: (_p = (_o = style == null ? void 0 : style.background) == null ? void 0 : _o.color) == null ? void 0 : _p.rgb.replace(")", ", 0.3)"),
|
|
186
|
+
color: (_r = (_q = style == null ? void 0 : style.background) == null ? void 0 : _q.color) == null ? void 0 : _r.hex
|
|
187
|
+
},
|
|
188
|
+
value: (selectedVariant == null ? void 0 : selectedVariant.providerId) || ""
|
|
181
189
|
},
|
|
182
190
|
children: variants.map((variant) => /* @__PURE__ */ jsx(
|
|
183
|
-
"
|
|
191
|
+
"option",
|
|
184
192
|
{
|
|
185
193
|
...{
|
|
186
|
-
|
|
187
|
-
onClick: () => {
|
|
188
|
-
if (preview) return;
|
|
189
|
-
const href = variantUrl(variant);
|
|
190
|
-
if (href) window.open(href, "_blank");
|
|
191
|
-
},
|
|
192
|
-
type: "button"
|
|
194
|
+
value: variant.providerId
|
|
193
195
|
},
|
|
194
196
|
children: variant.title
|
|
195
197
|
},
|
|
196
|
-
variant.
|
|
198
|
+
variant.providerId
|
|
197
199
|
))
|
|
198
200
|
}
|
|
199
201
|
)
|
|
200
202
|
]
|
|
201
203
|
}
|
|
202
|
-
)
|
|
203
|
-
]
|
|
204
|
-
}
|
|
205
|
-
),
|
|
206
|
-
/* @__PURE__ */ jsxs(
|
|
207
|
-
"span",
|
|
208
|
-
{
|
|
209
|
-
...{
|
|
210
|
-
className: classes.content.join(" "),
|
|
211
|
-
style: {
|
|
212
|
-
...fonts == null ? void 0 : fonts.body,
|
|
213
|
-
backgroundColor: (_s = (_r = style == null ? void 0 : style.text) == null ? void 0 : _r.color) == null ? void 0 : _s.hex,
|
|
214
|
-
color: (_u = (_t = style == null ? void 0 : style.background) == null ? void 0 : _t.color) == null ? void 0 : _u.hex
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
children: [
|
|
218
|
-
title && /* @__PURE__ */ jsx("p", { children: title }),
|
|
204
|
+
),
|
|
219
205
|
button && /* @__PURE__ */ jsx(
|
|
220
206
|
"button",
|
|
221
207
|
{
|
|
222
208
|
...{
|
|
223
209
|
className: classes.button.join(" "),
|
|
224
210
|
disabled: !preview && !hasVariants && !url,
|
|
225
|
-
onClick: hasVariants ? () =>
|
|
211
|
+
onClick: hasVariants ? () => {
|
|
212
|
+
if (!preview) onVariantSelect(selectedVariant);
|
|
213
|
+
} : preview ? () => {
|
|
226
214
|
} : onClick,
|
|
227
215
|
style: {
|
|
228
|
-
backgroundColor: (
|
|
229
|
-
color: (
|
|
216
|
+
backgroundColor: (_t = (_s = style == null ? void 0 : style.background) == null ? void 0 : _s.color) == null ? void 0 : _t.hex,
|
|
217
|
+
color: (_v = (_u = style == null ? void 0 : style.text) == null ? void 0 : _u.color) == null ? void 0 : _v.hex
|
|
230
218
|
},
|
|
231
219
|
type: "button"
|
|
232
220
|
},
|
|
233
|
-
children:
|
|
221
|
+
children: button
|
|
234
222
|
}
|
|
235
223
|
)
|
|
236
224
|
]
|
package/package.json
CHANGED
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
2
|
+
"name": "@drawbridge/components",
|
|
3
|
+
"version": "0.0.8",
|
|
4
|
+
"overrides": {
|
|
5
|
+
"postcss": "8.5.15"
|
|
6
|
+
},
|
|
7
|
+
"exports": {
|
|
8
|
+
"./card-advertisement": {
|
|
9
|
+
"types": "./types/card-advertisement.d.ts",
|
|
10
|
+
"default": "./dist/card-advertisement.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"types"
|
|
16
|
+
],
|
|
17
|
+
"author": "",
|
|
18
|
+
"license": "ISC",
|
|
19
|
+
"description": "",
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsup && npm publish"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@drawbridge/drawbridge-utils": "0.0.13",
|
|
28
|
+
"next": ">=14",
|
|
29
|
+
"react": ">=18"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/react": "18.0.0",
|
|
33
|
+
"tsup": "8.5.1"
|
|
34
|
+
}
|
|
31
35
|
}
|