@drawbridge/components 0.1.45 → 0.1.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bridge/form-subdomain-shop.js +4 -1
- package/dist/bridge/form-subdomain-shop.mjs +4 -1
- package/dist/bridge/form-subdomain.js +23 -5
- package/dist/bridge/form-subdomain.mjs +23 -5
- package/dist/bridge/lib/entry.js +41 -0
- package/dist/bridge/lib/entry.mjs +40 -0
- package/dist/bridge/product-tile.js +4 -0
- package/dist/bridge/product-tile.mjs +4 -0
- package/dist/bridge/template-layout.js +27 -8
- package/dist/bridge/template-layout.mjs +28 -9
- package/dist/bridge/template-modal.js +11 -1
- package/dist/bridge/template-modal.mjs +11 -1
- package/dist/dashboard/avatar.js +2 -3
- package/dist/dashboard/avatar.mjs +2 -3
- package/dist/dashboard/campaign-form.js +172 -153
- package/dist/dashboard/campaign-form.mjs +172 -153
- package/dist/dashboard/campaign-share.js +347 -0
- package/dist/dashboard/campaign-share.mjs +314 -0
- package/dist/dashboard/card-affiliate.js +1 -1
- package/dist/dashboard/card-affiliate.mjs +1 -1
- package/dist/dashboard/card-campaign-switch.js +4 -1
- package/dist/dashboard/card-campaign-switch.mjs +4 -1
- package/dist/dashboard/form-organization-campaign-field-item.js +4 -1
- package/dist/dashboard/form-organization-campaign-field-item.mjs +4 -1
- package/dist/dashboard/form-organization-campaign-page.js +73 -39
- package/dist/dashboard/form-organization-campaign-page.mjs +73 -39
- package/dist/dashboard/input-combobox.js +6 -0
- package/dist/dashboard/input-combobox.mjs +6 -0
- package/dist/dashboard/input-fields.js +26 -3
- package/dist/dashboard/input-fields.mjs +26 -3
- package/dist/dashboard/input-font.js +2 -0
- package/dist/dashboard/input-font.mjs +2 -0
- package/dist/dashboard/input-group-ai.js +15 -3
- package/dist/dashboard/input-group-ai.mjs +15 -3
- package/dist/dashboard/lib/ab-tests.js +2 -2
- package/dist/dashboard/lib/ab-tests.mjs +2 -2
- package/dist/dashboard/lib/menu.js +19 -0
- package/dist/dashboard/lib/menu.mjs +18 -0
- package/dist/dashboard/menu.js +13 -2
- package/dist/dashboard/menu.mjs +13 -2
- package/dist/dashboard/preview.js +119 -52
- package/dist/dashboard/preview.mjs +119 -52
- package/dist/dashboard/recharts.js +10 -4
- package/dist/dashboard/recharts.mjs +10 -4
- package/dist/dashboard/template-dashboard.js +11 -1
- package/dist/dashboard/template-dashboard.mjs +11 -1
- package/dist/dashboard/template-design.js +209 -130
- package/dist/dashboard/template-design.mjs +210 -131
- package/dist/dashboard/template-ui.js +157 -55
- package/dist/dashboard/template-ui.mjs +158 -56
- package/dist/icons/flags.js +134 -0
- package/dist/icons/flags.mjs +115 -0
- package/dist/shared/carousel.js +14 -5
- package/dist/shared/carousel.mjs +14 -5
- package/package.json +11 -1
- package/types/bridge/form-subdomain.d.ts +13 -0
- package/types/bridge/lib/entry.d.ts +5 -0
- package/types/bridge/product-tile.d.ts +2 -0
- package/types/dashboard/campaign-share.d.ts +16 -0
- package/types/dashboard/form-organization-campaign-page.d.ts +8 -1
- package/types/dashboard/input-combobox.d.ts +2 -0
- package/types/dashboard/preview.d.ts +11 -3
- package/types/icons/flags.d.ts +5 -0
|
@@ -46,11 +46,14 @@ const FormSubdomainShop = ({
|
|
|
46
46
|
...{
|
|
47
47
|
className: "grid " + (stacked ? "grid-cols-1" : "grid-cols-2") + " items-start gap-6"
|
|
48
48
|
},
|
|
49
|
-
children: products.map((product) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
49
|
+
children: products.map((product, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
50
50
|
import_product_tile.default,
|
|
51
51
|
{
|
|
52
52
|
...{
|
|
53
53
|
...product,
|
|
54
|
+
// The first tile's picture can be the page's largest, so it loads
|
|
55
|
+
// at once ( the dev warning, Impeccable audit 2026-11-21 ).
|
|
56
|
+
eager: index === 0,
|
|
54
57
|
onClick: () => onProductClick(product),
|
|
55
58
|
stacked,
|
|
56
59
|
style
|
|
@@ -14,11 +14,14 @@ const FormSubdomainShop = ({
|
|
|
14
14
|
...{
|
|
15
15
|
className: "grid " + (stacked ? "grid-cols-1" : "grid-cols-2") + " items-start gap-6"
|
|
16
16
|
},
|
|
17
|
-
children: products.map((product) => /* @__PURE__ */ jsx(
|
|
17
|
+
children: products.map((product, index) => /* @__PURE__ */ jsx(
|
|
18
18
|
CardProduct,
|
|
19
19
|
{
|
|
20
20
|
...{
|
|
21
21
|
...product,
|
|
22
|
+
// The first tile's picture can be the page's largest, so it loads
|
|
23
|
+
// at once ( the dev warning, Impeccable audit 2026-11-21 ).
|
|
24
|
+
eager: index === 0,
|
|
22
25
|
onClick: () => onProductClick(product),
|
|
23
26
|
stacked,
|
|
24
27
|
style
|
|
@@ -92,6 +92,7 @@ const FormSubdomainSubmission = ({
|
|
|
92
92
|
message,
|
|
93
93
|
panel,
|
|
94
94
|
preview,
|
|
95
|
+
quiet,
|
|
95
96
|
repeat,
|
|
96
97
|
slug,
|
|
97
98
|
style,
|
|
@@ -219,6 +220,7 @@ const FormSubdomainSubmission = ({
|
|
|
219
220
|
...{
|
|
220
221
|
button,
|
|
221
222
|
preview,
|
|
223
|
+
quiet,
|
|
222
224
|
style,
|
|
223
225
|
title
|
|
224
226
|
}
|
|
@@ -233,6 +235,9 @@ const FormSubdomainMessage = ({
|
|
|
233
235
|
button,
|
|
234
236
|
message,
|
|
235
237
|
preview,
|
|
238
|
+
// @story campaigns/form-page
|
|
239
|
+
// The dashboard's own previews show no Preview mode line ( Darren, 2026-11-21 ).
|
|
240
|
+
quiet,
|
|
236
241
|
style,
|
|
237
242
|
svg: Svg,
|
|
238
243
|
title
|
|
@@ -254,7 +259,7 @@ const FormSubdomainMessage = ({
|
|
|
254
259
|
}
|
|
255
260
|
}
|
|
256
261
|
),
|
|
257
|
-
Boolean(preview) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
262
|
+
Boolean(preview) && !quiet && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
258
263
|
import_error.default,
|
|
259
264
|
{
|
|
260
265
|
...{
|
|
@@ -328,6 +333,7 @@ const FormSubdomainGeocode = ({
|
|
|
328
333
|
disabled,
|
|
329
334
|
callback,
|
|
330
335
|
preview,
|
|
336
|
+
quiet,
|
|
331
337
|
still,
|
|
332
338
|
style,
|
|
333
339
|
values
|
|
@@ -433,7 +439,7 @@ const FormSubdomainGeocode = ({
|
|
|
433
439
|
}
|
|
434
440
|
}
|
|
435
441
|
),
|
|
436
|
-
Boolean(preview) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
442
|
+
Boolean(preview) && !quiet && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
437
443
|
import_error.default,
|
|
438
444
|
{
|
|
439
445
|
...{
|
|
@@ -480,6 +486,7 @@ const FormSubdomainAge = ({
|
|
|
480
486
|
},
|
|
481
487
|
disabled,
|
|
482
488
|
preview,
|
|
489
|
+
quiet,
|
|
483
490
|
style,
|
|
484
491
|
values
|
|
485
492
|
}) => {
|
|
@@ -525,7 +532,7 @@ const FormSubdomainAge = ({
|
|
|
525
532
|
}
|
|
526
533
|
}
|
|
527
534
|
),
|
|
528
|
-
Boolean(preview) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
535
|
+
Boolean(preview) && !quiet && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
529
536
|
import_error.default,
|
|
530
537
|
{
|
|
531
538
|
...{
|
|
@@ -825,6 +832,7 @@ const FormSubdomainSection = ({
|
|
|
825
832
|
last,
|
|
826
833
|
onAgreement,
|
|
827
834
|
preview,
|
|
835
|
+
quiet,
|
|
828
836
|
refused,
|
|
829
837
|
section,
|
|
830
838
|
slugs = [],
|
|
@@ -1065,7 +1073,7 @@ const FormSubdomainSection = ({
|
|
|
1065
1073
|
)
|
|
1066
1074
|
}
|
|
1067
1075
|
),
|
|
1068
|
-
Boolean(preview) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1076
|
+
Boolean(preview) && !quiet && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1069
1077
|
"div",
|
|
1070
1078
|
{
|
|
1071
1079
|
...{
|
|
@@ -1236,9 +1244,15 @@ const FormSubdomain = ({
|
|
|
1236
1244
|
},
|
|
1237
1245
|
params,
|
|
1238
1246
|
preview,
|
|
1247
|
+
// The dashboard's own previews show no Preview mode line.
|
|
1248
|
+
quiet,
|
|
1239
1249
|
// @story public-entry/read-agreement
|
|
1240
1250
|
// False while the campaign's giveaway is off ( lib/entry giveawayOn ).
|
|
1241
1251
|
giveaway,
|
|
1252
|
+
// @story campaigns/form-page
|
|
1253
|
+
// The Form page's preview: an agreement open over the form, and the location step drawn still.
|
|
1254
|
+
read = null,
|
|
1255
|
+
still,
|
|
1242
1256
|
// The share payload's `sms` : false while texts are off on the platform.
|
|
1243
1257
|
sms,
|
|
1244
1258
|
step: start = 0,
|
|
@@ -1254,7 +1268,7 @@ const FormSubdomain = ({
|
|
|
1254
1268
|
const token = searchParams.get("drwbrdg_pre");
|
|
1255
1269
|
const [data, setData] = (0, import_react.useState)({});
|
|
1256
1270
|
const [step, setStep] = (0, import_react.useState)(start);
|
|
1257
|
-
const [reading, setReading] = (0, import_react.useState)(
|
|
1271
|
+
const [reading, setReading] = (0, import_react.useState)(read);
|
|
1258
1272
|
const [refused, setRefused] = (0, import_react.useState)(null);
|
|
1259
1273
|
const sections = (0, import_order.sectionsOf)(fields);
|
|
1260
1274
|
const slugs = sections.flatMap((section) => ((section == null ? void 0 : section.fields) || []).map((field) => field == null ? void 0 : field.slug));
|
|
@@ -1338,6 +1352,8 @@ const FormSubdomain = ({
|
|
|
1338
1352
|
disabled,
|
|
1339
1353
|
style,
|
|
1340
1354
|
preview,
|
|
1355
|
+
quiet,
|
|
1356
|
+
still,
|
|
1341
1357
|
values: params
|
|
1342
1358
|
}
|
|
1343
1359
|
},
|
|
@@ -1368,6 +1384,7 @@ const FormSubdomain = ({
|
|
|
1368
1384
|
},
|
|
1369
1385
|
disabled,
|
|
1370
1386
|
preview,
|
|
1387
|
+
quiet,
|
|
1371
1388
|
style,
|
|
1372
1389
|
values: (_e = integrations == null ? void 0 : integrations.age) == null ? void 0 : _e.settings
|
|
1373
1390
|
}
|
|
@@ -1401,6 +1418,7 @@ const FormSubdomain = ({
|
|
|
1401
1418
|
last: index === sections.length - 1,
|
|
1402
1419
|
onAgreement: setReading,
|
|
1403
1420
|
preview,
|
|
1421
|
+
quiet,
|
|
1404
1422
|
refused,
|
|
1405
1423
|
section,
|
|
1406
1424
|
slugs,
|
|
@@ -55,6 +55,7 @@ const FormSubdomainSubmission = ({
|
|
|
55
55
|
message,
|
|
56
56
|
panel,
|
|
57
57
|
preview,
|
|
58
|
+
quiet,
|
|
58
59
|
repeat,
|
|
59
60
|
slug,
|
|
60
61
|
style,
|
|
@@ -182,6 +183,7 @@ const FormSubdomainSubmission = ({
|
|
|
182
183
|
...{
|
|
183
184
|
button,
|
|
184
185
|
preview,
|
|
186
|
+
quiet,
|
|
185
187
|
style,
|
|
186
188
|
title
|
|
187
189
|
}
|
|
@@ -196,6 +198,9 @@ const FormSubdomainMessage = ({
|
|
|
196
198
|
button,
|
|
197
199
|
message,
|
|
198
200
|
preview,
|
|
201
|
+
// @story campaigns/form-page
|
|
202
|
+
// The dashboard's own previews show no Preview mode line ( Darren, 2026-11-21 ).
|
|
203
|
+
quiet,
|
|
199
204
|
style,
|
|
200
205
|
svg: Svg,
|
|
201
206
|
title
|
|
@@ -217,7 +222,7 @@ const FormSubdomainMessage = ({
|
|
|
217
222
|
}
|
|
218
223
|
}
|
|
219
224
|
),
|
|
220
|
-
Boolean(preview) && /* @__PURE__ */ jsx(
|
|
225
|
+
Boolean(preview) && !quiet && /* @__PURE__ */ jsx(
|
|
221
226
|
Error,
|
|
222
227
|
{
|
|
223
228
|
...{
|
|
@@ -291,6 +296,7 @@ const FormSubdomainGeocode = ({
|
|
|
291
296
|
disabled,
|
|
292
297
|
callback,
|
|
293
298
|
preview,
|
|
299
|
+
quiet,
|
|
294
300
|
still,
|
|
295
301
|
style,
|
|
296
302
|
values
|
|
@@ -396,7 +402,7 @@ const FormSubdomainGeocode = ({
|
|
|
396
402
|
}
|
|
397
403
|
}
|
|
398
404
|
),
|
|
399
|
-
Boolean(preview) && /* @__PURE__ */ jsx(
|
|
405
|
+
Boolean(preview) && !quiet && /* @__PURE__ */ jsx(
|
|
400
406
|
Error,
|
|
401
407
|
{
|
|
402
408
|
...{
|
|
@@ -443,6 +449,7 @@ const FormSubdomainAge = ({
|
|
|
443
449
|
},
|
|
444
450
|
disabled,
|
|
445
451
|
preview,
|
|
452
|
+
quiet,
|
|
446
453
|
style,
|
|
447
454
|
values
|
|
448
455
|
}) => {
|
|
@@ -488,7 +495,7 @@ const FormSubdomainAge = ({
|
|
|
488
495
|
}
|
|
489
496
|
}
|
|
490
497
|
),
|
|
491
|
-
Boolean(preview) && /* @__PURE__ */ jsx(
|
|
498
|
+
Boolean(preview) && !quiet && /* @__PURE__ */ jsx(
|
|
492
499
|
Error,
|
|
493
500
|
{
|
|
494
501
|
...{
|
|
@@ -788,6 +795,7 @@ const FormSubdomainSection = ({
|
|
|
788
795
|
last,
|
|
789
796
|
onAgreement,
|
|
790
797
|
preview,
|
|
798
|
+
quiet,
|
|
791
799
|
refused,
|
|
792
800
|
section,
|
|
793
801
|
slugs = [],
|
|
@@ -1028,7 +1036,7 @@ const FormSubdomainSection = ({
|
|
|
1028
1036
|
)
|
|
1029
1037
|
}
|
|
1030
1038
|
),
|
|
1031
|
-
Boolean(preview) && /* @__PURE__ */ jsx(
|
|
1039
|
+
Boolean(preview) && !quiet && /* @__PURE__ */ jsx(
|
|
1032
1040
|
"div",
|
|
1033
1041
|
{
|
|
1034
1042
|
...{
|
|
@@ -1199,9 +1207,15 @@ const FormSubdomain = ({
|
|
|
1199
1207
|
},
|
|
1200
1208
|
params,
|
|
1201
1209
|
preview,
|
|
1210
|
+
// The dashboard's own previews show no Preview mode line.
|
|
1211
|
+
quiet,
|
|
1202
1212
|
// @story public-entry/read-agreement
|
|
1203
1213
|
// False while the campaign's giveaway is off ( lib/entry giveawayOn ).
|
|
1204
1214
|
giveaway,
|
|
1215
|
+
// @story campaigns/form-page
|
|
1216
|
+
// The Form page's preview: an agreement open over the form, and the location step drawn still.
|
|
1217
|
+
read = null,
|
|
1218
|
+
still,
|
|
1205
1219
|
// The share payload's `sms` : false while texts are off on the platform.
|
|
1206
1220
|
sms,
|
|
1207
1221
|
step: start = 0,
|
|
@@ -1217,7 +1231,7 @@ const FormSubdomain = ({
|
|
|
1217
1231
|
const token = searchParams.get("drwbrdg_pre");
|
|
1218
1232
|
const [data, setData] = useState({});
|
|
1219
1233
|
const [step, setStep] = useState(start);
|
|
1220
|
-
const [reading, setReading] = useState(
|
|
1234
|
+
const [reading, setReading] = useState(read);
|
|
1221
1235
|
const [refused, setRefused] = useState(null);
|
|
1222
1236
|
const sections = sectionsOf(fields);
|
|
1223
1237
|
const slugs = sections.flatMap((section) => ((section == null ? void 0 : section.fields) || []).map((field) => field == null ? void 0 : field.slug));
|
|
@@ -1301,6 +1315,8 @@ const FormSubdomain = ({
|
|
|
1301
1315
|
disabled,
|
|
1302
1316
|
style,
|
|
1303
1317
|
preview,
|
|
1318
|
+
quiet,
|
|
1319
|
+
still,
|
|
1304
1320
|
values: params
|
|
1305
1321
|
}
|
|
1306
1322
|
},
|
|
@@ -1331,6 +1347,7 @@ const FormSubdomain = ({
|
|
|
1331
1347
|
},
|
|
1332
1348
|
disabled,
|
|
1333
1349
|
preview,
|
|
1350
|
+
quiet,
|
|
1334
1351
|
style,
|
|
1335
1352
|
values: (_e = integrations == null ? void 0 : integrations.age) == null ? void 0 : _e.settings
|
|
1336
1353
|
}
|
|
@@ -1364,6 +1381,7 @@ const FormSubdomain = ({
|
|
|
1364
1381
|
last: index === sections.length - 1,
|
|
1365
1382
|
onAgreement: setReading,
|
|
1366
1383
|
preview,
|
|
1384
|
+
quiet,
|
|
1367
1385
|
refused,
|
|
1368
1386
|
section,
|
|
1369
1387
|
slugs,
|
package/dist/bridge/lib/entry.js
CHANGED
|
@@ -34,11 +34,13 @@ __export(entry_exports, {
|
|
|
34
34
|
giveawayOn: () => giveawayOn,
|
|
35
35
|
menuAgreements: () => menuAgreements,
|
|
36
36
|
panelMissions: () => panelMissions,
|
|
37
|
+
previewStep: () => previewStep,
|
|
37
38
|
termsOptOut: () => termsOptOut,
|
|
38
39
|
withLocale: () => withLocale
|
|
39
40
|
});
|
|
40
41
|
module.exports = __toCommonJS(entry_exports);
|
|
41
42
|
var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
|
|
43
|
+
var import_order = require("./order");
|
|
42
44
|
const copy = (data, key) => {
|
|
43
45
|
var _a, _b, _c, _d, _e;
|
|
44
46
|
return ((_a = data == null ? void 0 : data.defaults) == null ? void 0 : _a[key]) || ((_e = (_d = (_c = (_b = import_drawbridge_utils.constants) == null ? void 0 : _b.campaign) == null ? void 0 : _c.form) == null ? void 0 : _d.copy) == null ? void 0 : _e[key === "purchase" ? "order" : key]);
|
|
@@ -67,6 +69,44 @@ const afterOrder = (data) => {
|
|
|
67
69
|
const order = (data == null ? void 0 : data.after) || ((_a = data == null ? void 0 : data.form) == null ? void 0 : _a.after);
|
|
68
70
|
return Array.isArray(order) && order.length > 0 ? order : AFTER;
|
|
69
71
|
};
|
|
72
|
+
const previewStep = (data, open = {}) => {
|
|
73
|
+
var _a, _b, _c, _d;
|
|
74
|
+
const { panel, state, step } = open;
|
|
75
|
+
if (!formOn(data)) return { face: null, modal: false };
|
|
76
|
+
if (step === "start") return { face: state || null, modal: false };
|
|
77
|
+
if (step === "after") return {
|
|
78
|
+
face: null,
|
|
79
|
+
modal: true,
|
|
80
|
+
panel: {
|
|
81
|
+
name: "submission",
|
|
82
|
+
data: {
|
|
83
|
+
after: afterOrder(data),
|
|
84
|
+
// The missions show while the giveaway is on, before entries are
|
|
85
|
+
// awarded too: what entrants will see once it runs ( Darren, 2026-11-21 ).
|
|
86
|
+
giveaway: giveawayOn(data),
|
|
87
|
+
message: copy(data, state === "order" ? "purchase" : state || "confirmation"),
|
|
88
|
+
panel: panel || {},
|
|
89
|
+
repeat: state === "rejection"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const geocode = Boolean((_b = (_a = data == null ? void 0 : data.integrations) == null ? void 0 : _a.geocode) == null ? void 0 : _b.enabled);
|
|
94
|
+
const before = Number(geocode) + Number(Boolean((_d = (_c = data == null ? void 0 : data.integrations) == null ? void 0 : _c.age) == null ? void 0 : _d.enabled));
|
|
95
|
+
const sections = (0, import_order.sectionsOf)(data == null ? void 0 : data.fields);
|
|
96
|
+
const index = sections.findIndex((section) => (section == null ? void 0 : section.id) === step);
|
|
97
|
+
const at = step === "location" ? 0 : step === "age" ? Number(geocode) : step === "agreements" ? before + sections.length - 1 : before + Math.max(index, 0);
|
|
98
|
+
return {
|
|
99
|
+
face: null,
|
|
100
|
+
modal: true,
|
|
101
|
+
panel: {
|
|
102
|
+
name: "enter",
|
|
103
|
+
...step === "agreements" && state && {
|
|
104
|
+
read: state
|
|
105
|
+
},
|
|
106
|
+
step: at
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
};
|
|
70
110
|
const panelMissions = (missions = [], repeat = false) => repeat ? (missions || []).filter((item) => (item == null ? void 0 : item.type) !== "form") : missions;
|
|
71
111
|
const agreementTitles = {
|
|
72
112
|
terms: "Terms and conditions",
|
|
@@ -122,6 +162,7 @@ const termsOptOut = ({ giveaway, sms } = {}) => giveaway === false ? null : "If
|
|
|
122
162
|
giveawayOn,
|
|
123
163
|
menuAgreements,
|
|
124
164
|
panelMissions,
|
|
165
|
+
previewStep,
|
|
125
166
|
termsOptOut,
|
|
126
167
|
withLocale
|
|
127
168
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { constants } from "@drawbridge/drawbridge-utils";
|
|
2
|
+
import { sectionsOf } from "./order.mjs";
|
|
2
3
|
const copy = (data, key) => {
|
|
3
4
|
var _a, _b, _c, _d, _e;
|
|
4
5
|
return ((_a = data == null ? void 0 : data.defaults) == null ? void 0 : _a[key]) || ((_e = (_d = (_c = (_b = constants) == null ? void 0 : _b.campaign) == null ? void 0 : _c.form) == null ? void 0 : _d.copy) == null ? void 0 : _e[key === "purchase" ? "order" : key]);
|
|
@@ -27,6 +28,44 @@ const afterOrder = (data) => {
|
|
|
27
28
|
const order = (data == null ? void 0 : data.after) || ((_a = data == null ? void 0 : data.form) == null ? void 0 : _a.after);
|
|
28
29
|
return Array.isArray(order) && order.length > 0 ? order : AFTER;
|
|
29
30
|
};
|
|
31
|
+
const previewStep = (data, open = {}) => {
|
|
32
|
+
var _a, _b, _c, _d;
|
|
33
|
+
const { panel, state, step } = open;
|
|
34
|
+
if (!formOn(data)) return { face: null, modal: false };
|
|
35
|
+
if (step === "start") return { face: state || null, modal: false };
|
|
36
|
+
if (step === "after") return {
|
|
37
|
+
face: null,
|
|
38
|
+
modal: true,
|
|
39
|
+
panel: {
|
|
40
|
+
name: "submission",
|
|
41
|
+
data: {
|
|
42
|
+
after: afterOrder(data),
|
|
43
|
+
// The missions show while the giveaway is on, before entries are
|
|
44
|
+
// awarded too: what entrants will see once it runs ( Darren, 2026-11-21 ).
|
|
45
|
+
giveaway: giveawayOn(data),
|
|
46
|
+
message: copy(data, state === "order" ? "purchase" : state || "confirmation"),
|
|
47
|
+
panel: panel || {},
|
|
48
|
+
repeat: state === "rejection"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const geocode = Boolean((_b = (_a = data == null ? void 0 : data.integrations) == null ? void 0 : _a.geocode) == null ? void 0 : _b.enabled);
|
|
53
|
+
const before = Number(geocode) + Number(Boolean((_d = (_c = data == null ? void 0 : data.integrations) == null ? void 0 : _c.age) == null ? void 0 : _d.enabled));
|
|
54
|
+
const sections = sectionsOf(data == null ? void 0 : data.fields);
|
|
55
|
+
const index = sections.findIndex((section) => (section == null ? void 0 : section.id) === step);
|
|
56
|
+
const at = step === "location" ? 0 : step === "age" ? Number(geocode) : step === "agreements" ? before + sections.length - 1 : before + Math.max(index, 0);
|
|
57
|
+
return {
|
|
58
|
+
face: null,
|
|
59
|
+
modal: true,
|
|
60
|
+
panel: {
|
|
61
|
+
name: "enter",
|
|
62
|
+
...step === "agreements" && state && {
|
|
63
|
+
read: state
|
|
64
|
+
},
|
|
65
|
+
step: at
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
};
|
|
30
69
|
const panelMissions = (missions = [], repeat = false) => repeat ? (missions || []).filter((item) => (item == null ? void 0 : item.type) !== "form") : missions;
|
|
31
70
|
const agreementTitles = {
|
|
32
71
|
terms: "Terms and conditions",
|
|
@@ -81,6 +120,7 @@ export {
|
|
|
81
120
|
giveawayOn,
|
|
82
121
|
menuAgreements,
|
|
83
122
|
panelMissions,
|
|
123
|
+
previewStep,
|
|
84
124
|
termsOptOut,
|
|
85
125
|
withLocale
|
|
86
126
|
};
|
|
@@ -37,6 +37,7 @@ var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
|
|
|
37
37
|
var import_button = __toESM(require("../shared/button"));
|
|
38
38
|
var import_styles = require("../styles");
|
|
39
39
|
const CardProduct = ({
|
|
40
|
+
eager,
|
|
40
41
|
title,
|
|
41
42
|
onClick,
|
|
42
43
|
stacked,
|
|
@@ -81,6 +82,9 @@ const CardProduct = ({
|
|
|
81
82
|
alt: title + " image",
|
|
82
83
|
className: "object-cover",
|
|
83
84
|
fill: true,
|
|
85
|
+
...eager && {
|
|
86
|
+
loading: "eager"
|
|
87
|
+
},
|
|
84
88
|
sizes: "50vw",
|
|
85
89
|
src: image,
|
|
86
90
|
unoptimized: true
|
|
@@ -5,6 +5,7 @@ import { formatCurrency } from "@drawbridge/drawbridge-utils";
|
|
|
5
5
|
import Button from "../shared/button.mjs";
|
|
6
6
|
import { headerStyle } from "../styles.mjs";
|
|
7
7
|
const CardProduct = ({
|
|
8
|
+
eager,
|
|
8
9
|
title,
|
|
9
10
|
onClick,
|
|
10
11
|
stacked,
|
|
@@ -49,6 +50,9 @@ const CardProduct = ({
|
|
|
49
50
|
alt: title + " image",
|
|
50
51
|
className: "object-cover",
|
|
51
52
|
fill: true,
|
|
53
|
+
...eager && {
|
|
54
|
+
loading: "eager"
|
|
55
|
+
},
|
|
52
56
|
sizes: "50vw",
|
|
53
57
|
src: image,
|
|
54
58
|
unoptimized: true
|
|
@@ -72,6 +72,7 @@ const TemplateLayout = ({
|
|
|
72
72
|
);
|
|
73
73
|
const [data, setData] = (0, import_react.useState)(result);
|
|
74
74
|
const [iframe, setIframe] = (0, import_react.useState)(false);
|
|
75
|
+
const [face, setFace] = (0, import_react.useState)(null);
|
|
75
76
|
const style = data == null ? void 0 : data.style;
|
|
76
77
|
const [cart, setCart] = (0, import_react.useState)(null);
|
|
77
78
|
const [cartLoading, setCartLoading] = (0, import_react.useState)(true);
|
|
@@ -316,7 +317,7 @@ const TemplateLayout = ({
|
|
|
316
317
|
event,
|
|
317
318
|
preview: preview2
|
|
318
319
|
}) => {
|
|
319
|
-
var _a2, _b2, _c2, _d2, _e, _f, _g;
|
|
320
|
+
var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j, _k;
|
|
320
321
|
let trusted = false;
|
|
321
322
|
try {
|
|
322
323
|
trusted = Boolean(
|
|
@@ -328,16 +329,34 @@ const TemplateLayout = ({
|
|
|
328
329
|
if (preview2 && trusted) {
|
|
329
330
|
setIframe(true);
|
|
330
331
|
}
|
|
331
|
-
if (preview2 && trusted && ((_a2 = event == null ? void 0 : event.data) == null ? void 0 : _a2.
|
|
332
|
-
const
|
|
332
|
+
if (preview2 && trusted && ((_b2 = (_a2 = event == null ? void 0 : event.data) == null ? void 0 : _a2.open) == null ? void 0 : _b2.step)) {
|
|
333
|
+
const shown = (0, import_entry.previewStep)({
|
|
334
|
+
...result,
|
|
335
|
+
...(_c2 = event == null ? void 0 : event.data) == null ? void 0 : _c2.update
|
|
336
|
+
}, event.data.open);
|
|
337
|
+
setFace(shown.face);
|
|
338
|
+
setModal(shown.modal);
|
|
339
|
+
if (((_d2 = shown.panel) == null ? void 0 : _d2.name) === "submission") setPanel({
|
|
340
|
+
name: "submission",
|
|
341
|
+
data: {
|
|
342
|
+
...shown.panel.data,
|
|
343
|
+
preview: preview2,
|
|
344
|
+
style: result == null ? void 0 : result.style,
|
|
345
|
+
...params
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
else if (shown.panel) setPanel(shown.panel);
|
|
349
|
+
}
|
|
350
|
+
if (preview2 && trusted && ((_e = event == null ? void 0 : event.data) == null ? void 0 : _e.update)) {
|
|
351
|
+
const headline = ((_g = (_f = event == null ? void 0 : event.data) == null ? void 0 : _f.update) == null ? void 0 : _g.headline) || ((_h = result == null ? void 0 : result.data) == null ? void 0 : _h.headline) || ((_j = (_i = import_constants.default) == null ? void 0 : _i.form) == null ? void 0 : _j.headline);
|
|
333
352
|
setData({
|
|
334
353
|
...result,
|
|
335
|
-
...(
|
|
354
|
+
...(_k = event == null ? void 0 : event.data) == null ? void 0 : _k.update,
|
|
336
355
|
headline
|
|
337
356
|
});
|
|
338
357
|
}
|
|
339
358
|
},
|
|
340
|
-
[result]
|
|
359
|
+
[params, result]
|
|
341
360
|
);
|
|
342
361
|
(0, import_react.useEffect)(
|
|
343
362
|
() => {
|
|
@@ -516,7 +535,7 @@ const TemplateLayout = ({
|
|
|
516
535
|
import_button.default,
|
|
517
536
|
{
|
|
518
537
|
...{
|
|
519
|
-
disabled: !preview && !(data == null ? void 0 : data.valid),
|
|
538
|
+
disabled: !preview && !(data == null ? void 0 : data.valid) || face === "inactive",
|
|
520
539
|
onClick: () => {
|
|
521
540
|
setPanel({
|
|
522
541
|
name: "enter"
|
|
@@ -528,7 +547,7 @@ const TemplateLayout = ({
|
|
|
528
547
|
},
|
|
529
548
|
style
|
|
530
549
|
},
|
|
531
|
-
children: (0, import_entry.buttonText)(data, preview || Boolean(data == null ? void 0 : data.valid))
|
|
550
|
+
children: face ? (0, import_entry.copy)(data, face) : (0, import_entry.buttonText)(data, preview || Boolean(data == null ? void 0 : data.valid))
|
|
532
551
|
}
|
|
533
552
|
),
|
|
534
553
|
menu: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -684,7 +703,7 @@ const TemplateLayout = ({
|
|
|
684
703
|
}
|
|
685
704
|
};
|
|
686
705
|
},
|
|
687
|
-
[cartCount, cartLoading, data, preview, style, tracking]
|
|
706
|
+
[cartCount, cartLoading, data, face, preview, style, tracking]
|
|
688
707
|
);
|
|
689
708
|
const props = {
|
|
690
709
|
affiliate,
|
|
@@ -17,7 +17,7 @@ import { request } from "@drawbridge/drawbridge-utils/fetch";
|
|
|
17
17
|
import constants from "./lib/constants.mjs";
|
|
18
18
|
import { checkout as checkoutKit, ensureCheckoutKit } from "./lib/checkout-kit.mjs";
|
|
19
19
|
import { useTracking } from "./provider-analytics.mjs";
|
|
20
|
-
import { afterOrder, awardingOn, buttonText, copy, formOn } from "./lib/entry.mjs";
|
|
20
|
+
import { afterOrder, awardingOn, buttonText, copy, formOn, previewStep } from "./lib/entry.mjs";
|
|
21
21
|
import { leadEndpoint } from "./lib/url.mjs";
|
|
22
22
|
const TemplateModal = dynamic(() => import("./template-modal.mjs"), { ssr: false });
|
|
23
23
|
const TemplateLayout = ({
|
|
@@ -40,6 +40,7 @@ const TemplateLayout = ({
|
|
|
40
40
|
);
|
|
41
41
|
const [data, setData] = useState(result);
|
|
42
42
|
const [iframe, setIframe] = useState(false);
|
|
43
|
+
const [face, setFace] = useState(null);
|
|
43
44
|
const style = data == null ? void 0 : data.style;
|
|
44
45
|
const [cart, setCart] = useState(null);
|
|
45
46
|
const [cartLoading, setCartLoading] = useState(true);
|
|
@@ -284,7 +285,7 @@ const TemplateLayout = ({
|
|
|
284
285
|
event,
|
|
285
286
|
preview: preview2
|
|
286
287
|
}) => {
|
|
287
|
-
var _a2, _b2, _c2, _d2, _e, _f, _g;
|
|
288
|
+
var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j, _k;
|
|
288
289
|
let trusted = false;
|
|
289
290
|
try {
|
|
290
291
|
trusted = Boolean(
|
|
@@ -296,16 +297,34 @@ const TemplateLayout = ({
|
|
|
296
297
|
if (preview2 && trusted) {
|
|
297
298
|
setIframe(true);
|
|
298
299
|
}
|
|
299
|
-
if (preview2 && trusted && ((_a2 = event == null ? void 0 : event.data) == null ? void 0 : _a2.
|
|
300
|
-
const
|
|
300
|
+
if (preview2 && trusted && ((_b2 = (_a2 = event == null ? void 0 : event.data) == null ? void 0 : _a2.open) == null ? void 0 : _b2.step)) {
|
|
301
|
+
const shown = previewStep({
|
|
302
|
+
...result,
|
|
303
|
+
...(_c2 = event == null ? void 0 : event.data) == null ? void 0 : _c2.update
|
|
304
|
+
}, event.data.open);
|
|
305
|
+
setFace(shown.face);
|
|
306
|
+
setModal(shown.modal);
|
|
307
|
+
if (((_d2 = shown.panel) == null ? void 0 : _d2.name) === "submission") setPanel({
|
|
308
|
+
name: "submission",
|
|
309
|
+
data: {
|
|
310
|
+
...shown.panel.data,
|
|
311
|
+
preview: preview2,
|
|
312
|
+
style: result == null ? void 0 : result.style,
|
|
313
|
+
...params
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
else if (shown.panel) setPanel(shown.panel);
|
|
317
|
+
}
|
|
318
|
+
if (preview2 && trusted && ((_e = event == null ? void 0 : event.data) == null ? void 0 : _e.update)) {
|
|
319
|
+
const headline = ((_g = (_f = event == null ? void 0 : event.data) == null ? void 0 : _f.update) == null ? void 0 : _g.headline) || ((_h = result == null ? void 0 : result.data) == null ? void 0 : _h.headline) || ((_j = (_i = constants) == null ? void 0 : _i.form) == null ? void 0 : _j.headline);
|
|
301
320
|
setData({
|
|
302
321
|
...result,
|
|
303
|
-
...(
|
|
322
|
+
...(_k = event == null ? void 0 : event.data) == null ? void 0 : _k.update,
|
|
304
323
|
headline
|
|
305
324
|
});
|
|
306
325
|
}
|
|
307
326
|
},
|
|
308
|
-
[result]
|
|
327
|
+
[params, result]
|
|
309
328
|
);
|
|
310
329
|
useEffect(
|
|
311
330
|
() => {
|
|
@@ -484,7 +503,7 @@ const TemplateLayout = ({
|
|
|
484
503
|
Button,
|
|
485
504
|
{
|
|
486
505
|
...{
|
|
487
|
-
disabled: !preview && !(data == null ? void 0 : data.valid),
|
|
506
|
+
disabled: !preview && !(data == null ? void 0 : data.valid) || face === "inactive",
|
|
488
507
|
onClick: () => {
|
|
489
508
|
setPanel({
|
|
490
509
|
name: "enter"
|
|
@@ -496,7 +515,7 @@ const TemplateLayout = ({
|
|
|
496
515
|
},
|
|
497
516
|
style
|
|
498
517
|
},
|
|
499
|
-
children: buttonText(data, preview || Boolean(data == null ? void 0 : data.valid))
|
|
518
|
+
children: face ? copy(data, face) : buttonText(data, preview || Boolean(data == null ? void 0 : data.valid))
|
|
500
519
|
}
|
|
501
520
|
),
|
|
502
521
|
menu: /* @__PURE__ */ jsx(
|
|
@@ -652,7 +671,7 @@ const TemplateLayout = ({
|
|
|
652
671
|
}
|
|
653
672
|
};
|
|
654
673
|
},
|
|
655
|
-
[cartCount, cartLoading, data, preview, style, tracking]
|
|
674
|
+
[cartCount, cartLoading, data, face, preview, style, tracking]
|
|
656
675
|
);
|
|
657
676
|
const props = {
|
|
658
677
|
affiliate,
|
|
@@ -139,11 +139,18 @@ const TemplateModal = ({
|
|
|
139
139
|
params,
|
|
140
140
|
sms: data == null ? void 0 : data.sms,
|
|
141
141
|
preview,
|
|
142
|
+
quiet: iframe,
|
|
143
|
+
// @story campaigns/form-page
|
|
144
|
+
// The Form page's preview opens the form at its step, or an agreement, with the location step still.
|
|
145
|
+
read: panel == null ? void 0 : panel.read,
|
|
146
|
+
step: panel == null ? void 0 : panel.step,
|
|
147
|
+
still: (panel == null ? void 0 : panel.step) !== void 0,
|
|
142
148
|
style,
|
|
143
149
|
submit: (0, import_entry.copy)(data, "submit"),
|
|
144
150
|
tracking
|
|
145
151
|
}
|
|
146
|
-
}
|
|
152
|
+
},
|
|
153
|
+
"form-" + ((panel == null ? void 0 : panel.step) ?? "") + "-" + ((panel == null ? void 0 : panel.read) || "")
|
|
147
154
|
),
|
|
148
155
|
buttons.recaptcha()
|
|
149
156
|
] });
|
|
@@ -582,6 +589,9 @@ const TemplateModal = ({
|
|
|
582
589
|
...{
|
|
583
590
|
button: buttons.close("submission"),
|
|
584
591
|
checkout,
|
|
592
|
+
// @story campaigns/form-page
|
|
593
|
+
// The dashboard's own previews show no Preview mode line ( Darren, 2026-11-21 ).
|
|
594
|
+
quiet: iframe,
|
|
585
595
|
tracking,
|
|
586
596
|
...panel.data
|
|
587
597
|
}
|