@drawbridge/components 0.1.12 → 0.1.14
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/components/styles.css +364 -2
- package/dist/advertisement.js +3 -1
- package/dist/advertisement.mjs +3 -1
- package/dist/bridge/advertisements.js +2 -0
- package/dist/bridge/advertisements.mjs +2 -0
- package/dist/bridge/countdown.js +2 -1
- package/dist/bridge/countdown.mjs +2 -1
- package/dist/bridge/form-subdomain-embed.js +18 -20
- package/dist/bridge/form-subdomain-embed.mjs +18 -20
- package/dist/bridge/form-subdomain-header.js +24 -1
- package/dist/bridge/form-subdomain-header.mjs +24 -1
- package/dist/bridge/form-subdomain-missions.js +538 -0
- package/dist/bridge/form-subdomain-missions.mjs +502 -0
- package/dist/bridge/form-subdomain.js +530 -220
- package/dist/bridge/form-subdomain.mjs +533 -222
- package/dist/bridge/lib/entry.js +59 -0
- package/dist/bridge/lib/entry.mjs +29 -0
- package/dist/bridge/lib/location.js +38 -0
- package/dist/bridge/lib/location.mjs +13 -0
- package/dist/bridge/lib/order.js +71 -0
- package/dist/bridge/lib/order.mjs +44 -0
- package/dist/bridge/lib/url.js +9 -0
- package/dist/bridge/lib/url.mjs +7 -0
- package/dist/bridge/share-button.js +5 -3
- package/dist/bridge/share-button.mjs +5 -3
- package/dist/bridge/subdomain-content.js +7 -6
- package/dist/bridge/subdomain-content.mjs +7 -6
- package/dist/bridge/template-layout.js +59 -21
- package/dist/bridge/template-layout.mjs +59 -21
- package/dist/bridge/template-modal.js +42 -76
- package/dist/bridge/template-modal.mjs +39 -73
- package/dist/bridge/template-preview.js +208 -0
- package/dist/bridge/template-preview.mjs +173 -0
- package/dist/bridge/template-subdomain-gallery.js +6 -2
- package/dist/bridge/template-subdomain-gallery.mjs +6 -2
- package/dist/bridge/template-subdomain-link.js +6 -1
- package/dist/bridge/template-subdomain-link.mjs +6 -1
- package/dist/bridge/template-subdomain.js +20 -15
- package/dist/bridge/template-subdomain.mjs +20 -15
- package/dist/dashboard/accordion.js +74 -39
- package/dist/dashboard/accordion.mjs +74 -39
- package/dist/dashboard/avatar.js +109 -3
- package/dist/dashboard/avatar.mjs +106 -4
- package/dist/dashboard/buttons-subscription.js +384 -0
- package/dist/dashboard/buttons-subscription.mjs +349 -0
- package/dist/dashboard/card-campaign-switch.js +265 -0
- package/dist/dashboard/card-campaign-switch.mjs +231 -0
- package/dist/dashboard/card-order.js +28 -11
- package/dist/dashboard/card-order.mjs +28 -11
- package/dist/dashboard/card-section.js +26 -2
- package/dist/dashboard/card-section.mjs +26 -2
- package/dist/dashboard/card-tile.js +6 -7
- package/dist/dashboard/card-tile.mjs +6 -7
- package/dist/dashboard/connection-workflows.js +196 -0
- package/dist/dashboard/connection-workflows.mjs +162 -0
- package/dist/dashboard/device.js +95 -0
- package/dist/dashboard/device.mjs +72 -0
- package/dist/dashboard/form-admin-campaign.js +19 -50
- package/dist/dashboard/form-admin-campaign.mjs +20 -51
- package/dist/dashboard/form-ai.js +9 -6
- package/dist/dashboard/form-ai.mjs +9 -6
- package/dist/dashboard/form-auth.js +35 -25
- package/dist/dashboard/form-auth.mjs +36 -26
- package/dist/dashboard/form-file.js +10 -1
- package/dist/dashboard/form-file.mjs +10 -1
- package/dist/dashboard/form-filters-analytics.js +14 -1
- package/dist/dashboard/form-filters-analytics.mjs +15 -2
- package/dist/dashboard/form-organization-campaign-advertisement.js +15 -1
- package/dist/dashboard/form-organization-campaign-advertisement.mjs +16 -2
- package/dist/dashboard/form-organization-campaign-agreement.js +215 -164
- package/dist/dashboard/form-organization-campaign-agreement.mjs +215 -164
- package/dist/dashboard/form-organization-campaign-field-email.js +0 -34
- package/dist/dashboard/form-organization-campaign-field-email.mjs +0 -34
- package/dist/dashboard/form-organization-campaign-field-list.js +466 -0
- package/dist/dashboard/form-organization-campaign-field-list.mjs +437 -0
- package/dist/dashboard/form-organization-campaign-field-phone.js +0 -34
- package/dist/dashboard/form-organization-campaign-field-phone.mjs +0 -34
- package/dist/dashboard/form-organization-campaign-field-remove.js +66 -0
- package/dist/dashboard/form-organization-campaign-field-remove.mjs +33 -0
- package/dist/dashboard/form-organization-campaign-integration-age.js +6 -12
- package/dist/dashboard/form-organization-campaign-integration-age.mjs +6 -12
- package/dist/dashboard/form-organization-campaign-integration-enable.js +52 -24
- package/dist/dashboard/form-organization-campaign-integration-enable.mjs +54 -26
- package/dist/dashboard/form-organization-campaign-integration-geocode.js +6 -12
- package/dist/dashboard/form-organization-campaign-integration-geocode.mjs +6 -12
- package/dist/dashboard/form-organization-campaign-integration-gtm.js +6 -12
- package/dist/dashboard/form-organization-campaign-integration-gtm.mjs +6 -12
- package/dist/dashboard/form-organization-campaign-link.js +7 -1
- package/dist/dashboard/form-organization-campaign-link.mjs +7 -1
- package/dist/dashboard/form-organization-campaign-mission.js +291 -0
- package/dist/dashboard/form-organization-campaign-mission.mjs +258 -0
- package/dist/dashboard/form-organization-campaign-page-embed.js +13 -2
- package/dist/dashboard/form-organization-campaign-page-embed.mjs +12 -1
- package/dist/dashboard/form-organization-campaign-page.js +20 -11
- package/dist/dashboard/form-organization-campaign-page.mjs +20 -11
- package/dist/dashboard/form-organization-campaign-prize-edit.js +12 -1
- package/dist/dashboard/form-organization-campaign-prize-edit.mjs +12 -1
- package/dist/dashboard/form-organization-campaign-section.js +223 -0
- package/dist/dashboard/form-organization-campaign-section.mjs +194 -0
- package/dist/dashboard/form-organization-campaign.js +114 -469
- package/dist/dashboard/form-organization-campaign.mjs +113 -467
- package/dist/dashboard/form-organization-export.js +4 -7
- package/dist/dashboard/form-organization-export.mjs +4 -7
- package/dist/dashboard/form-organization-identity.js +46 -51
- package/dist/dashboard/form-organization-identity.mjs +46 -51
- package/dist/dashboard/form-organization-workflow.js +518 -686
- package/dist/dashboard/form-organization-workflow.mjs +517 -682
- package/dist/dashboard/form-organization.js +82 -110
- package/dist/dashboard/form-organization.mjs +81 -109
- package/dist/dashboard/form-otc.js +4 -5
- package/dist/dashboard/form-otc.mjs +4 -5
- package/dist/dashboard/form-payment-methods.js +20 -9
- package/dist/dashboard/form-payment-methods.mjs +20 -9
- package/dist/dashboard/form-stripe.js +30 -0
- package/dist/dashboard/form-stripe.mjs +26 -0
- package/dist/dashboard/input-array.js +4 -2
- package/dist/dashboard/input-array.mjs +4 -2
- package/dist/dashboard/input-combobox.js +7 -3
- package/dist/dashboard/input-combobox.mjs +7 -3
- package/dist/dashboard/input-date.js +7 -0
- package/dist/dashboard/input-date.mjs +7 -0
- package/dist/dashboard/input-fields.js +80 -20
- package/dist/dashboard/input-fields.mjs +80 -20
- package/dist/dashboard/input-file.js +21 -1
- package/dist/dashboard/input-file.mjs +21 -1
- package/dist/dashboard/input-font.js +10 -1
- package/dist/dashboard/input-font.mjs +10 -1
- package/dist/dashboard/lib/item-list.js +57 -0
- package/dist/dashboard/lib/item-list.mjs +33 -0
- package/dist/dashboard/lib/menu.js +50 -0
- package/dist/dashboard/lib/menu.mjs +26 -0
- package/dist/dashboard/locked.js +82 -0
- package/dist/dashboard/locked.mjs +53 -0
- package/dist/dashboard/menu.js +72 -19
- package/dist/dashboard/menu.mjs +72 -19
- package/dist/dashboard/note-ai.js +69 -0
- package/dist/dashboard/note-ai.mjs +36 -0
- package/dist/dashboard/preview.js +419 -0
- package/dist/dashboard/preview.mjs +384 -0
- package/dist/dashboard/steps.js +39 -13
- package/dist/dashboard/steps.mjs +37 -12
- package/dist/dashboard/table-contacts.js +136 -0
- package/dist/dashboard/table-contacts.mjs +103 -0
- package/dist/dashboard/template-not-found.js +4 -2
- package/dist/dashboard/template-not-found.mjs +4 -2
- package/dist/dashboard/template-socket.js +51 -7
- package/dist/dashboard/template-socket.mjs +51 -7
- package/dist/icons/desktop.js +46 -0
- package/dist/icons/desktop.mjs +27 -0
- package/dist/icons/phone.js +46 -0
- package/dist/icons/phone.mjs +27 -0
- package/dist/icons/puzzle-piece.js +46 -0
- package/dist/icons/puzzle-piece.mjs +27 -0
- package/dist/icons/tablet.js +46 -0
- package/dist/icons/tablet.mjs +27 -0
- package/dist/icons/users.js +46 -0
- package/dist/icons/users.mjs +27 -0
- package/dist/input-checkbox.js +1 -0
- package/dist/input-checkbox.mjs +1 -0
- package/dist/input-code.js +101 -0
- package/dist/input-code.mjs +78 -0
- package/dist/input-text.js +2 -1
- package/dist/input-text.mjs +2 -1
- package/dist/shared/input-checkbox-list.js +0 -1
- package/dist/shared/input-checkbox-list.mjs +0 -1
- package/dist/shared/input-switch.js +6 -1
- package/dist/shared/input-switch.mjs +6 -1
- package/dist/shared/lib/campaign.js +117 -0
- package/dist/shared/lib/campaign.mjs +91 -0
- package/dist/shared/lib/helpers.js +14 -2
- package/dist/shared/lib/helpers.mjs +13 -2
- package/package.json +133 -13
- package/types/bridge/form-subdomain-header.d.ts +2 -0
- package/types/bridge/form-subdomain-missions.d.ts +36 -0
- package/types/bridge/form-subdomain.d.ts +23 -1
- package/types/bridge/lib/entry.d.ts +26 -0
- package/types/bridge/lib/location.d.ts +13 -0
- package/types/bridge/lib/order.d.ts +30 -0
- package/types/bridge/lib/url.d.ts +19 -0
- package/types/bridge/template-modal.d.ts +1 -1
- package/types/bridge/template-preview.d.ts +10 -0
- package/types/bridge/template-subdomain-link.d.ts +2 -0
- package/types/dashboard/accordion.d.ts +2 -0
- package/types/dashboard/avatar.d.ts +18 -2
- package/types/dashboard/buttons-subscription.d.ts +22 -0
- package/types/dashboard/card-campaign-switch.d.ts +32 -0
- package/types/dashboard/card-order.d.ts +11 -0
- package/types/dashboard/card-section.d.ts +2 -0
- package/types/dashboard/connection-workflows.d.ts +33 -0
- package/types/dashboard/device.d.ts +12 -0
- package/types/dashboard/form-admin-campaign.d.ts +3 -2
- package/types/dashboard/form-ai.d.ts +2 -2
- package/types/dashboard/form-organization-campaign-agreement.d.ts +18 -12
- package/types/dashboard/form-organization-campaign-field-email.d.ts +1 -2
- package/types/dashboard/form-organization-campaign-field-list.d.ts +36 -0
- package/types/dashboard/form-organization-campaign-field-phone.d.ts +1 -2
- package/types/dashboard/form-organization-campaign-field-remove.d.ts +22 -0
- package/types/dashboard/form-organization-campaign-field-select.d.ts +2 -1
- package/types/dashboard/form-organization-campaign-field-textarea.d.ts +2 -1
- package/types/dashboard/form-organization-campaign-integration-age.d.ts +3 -3
- package/types/dashboard/form-organization-campaign-integration-enable.d.ts +3 -3
- package/types/dashboard/form-organization-campaign-mission.d.ts +40 -0
- package/types/dashboard/form-organization-campaign-section.d.ts +27 -0
- package/types/dashboard/form-organization-campaign.d.ts +27 -17
- package/types/dashboard/form-organization-identity.d.ts +2 -0
- package/types/dashboard/form-organization-workflow.d.ts +43 -47
- package/types/dashboard/form-organization.d.ts +7 -2
- package/types/dashboard/form-stripe.d.ts +3 -0
- package/types/dashboard/input-combobox.d.ts +2 -0
- package/types/dashboard/input-date.d.ts +2 -0
- package/types/dashboard/input-fields.d.ts +3 -2
- package/types/dashboard/input-file.d.ts +4 -0
- package/types/dashboard/lib/item-list.d.ts +14 -0
- package/types/dashboard/lib/menu.d.ts +17 -0
- package/types/dashboard/locked.d.ts +10 -0
- package/types/dashboard/menu.d.ts +10 -2
- package/types/dashboard/note-ai.d.ts +15 -0
- package/types/dashboard/preview.d.ts +33 -0
- package/types/dashboard/steps.d.ts +19 -4
- package/types/dashboard/table-cell-title.d.ts +2 -2
- package/types/dashboard/table-contacts.d.ts +2 -0
- package/types/icons/desktop.d.ts +5 -0
- package/types/icons/phone.d.ts +5 -0
- package/types/icons/puzzle-piece.d.ts +5 -0
- package/types/icons/tablet.d.ts +5 -0
- package/types/icons/users.d.ts +5 -0
- package/types/input-code.d.ts +23 -0
- package/types/shared/input-switch.d.ts +2 -0
- package/types/shared/lib/campaign.d.ts +35 -0
- package/types/shared/lib/helpers.d.ts +3 -0
- package/dist/dashboard/card-integration.js +0 -187
- package/dist/dashboard/card-integration.mjs +0 -158
- package/dist/dashboard/iframe.js +0 -159
- package/dist/dashboard/iframe.mjs +0 -130
- package/types/dashboard/card-integration.d.ts +0 -24
- package/types/dashboard/iframe.d.ts +0 -18
|
@@ -46,17 +46,18 @@ var import_overlay = __toESM(require("../shared/overlay"));
|
|
|
46
46
|
var import_button = __toESM(require("../shared/button"));
|
|
47
47
|
var import_link = __toESM(require("next/link"));
|
|
48
48
|
var import_fetch = require("@drawbridge/drawbridge-utils/fetch");
|
|
49
|
-
var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
|
|
50
49
|
var import_constants = __toESM(require("./lib/constants"));
|
|
51
50
|
var import_checkout_kit = require("./lib/checkout-kit");
|
|
52
51
|
var import_provider_analytics = require("./provider-analytics");
|
|
52
|
+
var import_entry = require("./lib/entry");
|
|
53
|
+
var import_url = require("./lib/url");
|
|
53
54
|
const TemplateModal = (0, import_dynamic.default)(() => import("./template-modal"), { ssr: false });
|
|
54
55
|
const TemplateLayout = ({
|
|
55
56
|
params,
|
|
56
57
|
result,
|
|
57
58
|
userAgent
|
|
58
59
|
}) => {
|
|
59
|
-
var _a, _b, _c, _d
|
|
60
|
+
var _a, _b, _c, _d;
|
|
60
61
|
const searchParams = (0, import_navigation.useSearchParams)();
|
|
61
62
|
const token = searchParams.get("drwbrdg_pre");
|
|
62
63
|
const preview = Boolean(token);
|
|
@@ -79,6 +80,7 @@ const TemplateLayout = ({
|
|
|
79
80
|
const [panel, setPanel] = (0, import_react.useState)(submissionId ? {
|
|
80
81
|
name: "submission",
|
|
81
82
|
data: {
|
|
83
|
+
giveaway: (0, import_entry.awardingOn)(result),
|
|
82
84
|
id: submissionId,
|
|
83
85
|
title: "Keep going",
|
|
84
86
|
preview,
|
|
@@ -100,7 +102,6 @@ const TemplateLayout = ({
|
|
|
100
102
|
affiliate,
|
|
101
103
|
campaign: data == null ? void 0 : data.campaign,
|
|
102
104
|
onComplete: () => {
|
|
103
|
-
var _a2;
|
|
104
105
|
if (typeof window !== "undefined") {
|
|
105
106
|
window.localStorage.removeItem(cartStorageKey);
|
|
106
107
|
window.localStorage.removeItem(cartStorageKey + "_expiry");
|
|
@@ -110,7 +111,7 @@ const TemplateLayout = ({
|
|
|
110
111
|
setPanel({
|
|
111
112
|
name: "purchase",
|
|
112
113
|
data: {
|
|
113
|
-
message: (
|
|
114
|
+
message: (0, import_entry.copy)(data, "purchase")
|
|
114
115
|
}
|
|
115
116
|
});
|
|
116
117
|
setModal(true);
|
|
@@ -123,7 +124,7 @@ const TemplateLayout = ({
|
|
|
123
124
|
subdomain: params == null ? void 0 : params.subdomain,
|
|
124
125
|
...args
|
|
125
126
|
}),
|
|
126
|
-
[affiliate, cartStorageKey, data
|
|
127
|
+
[affiliate, cartStorageKey, data, params == null ? void 0 : params.slug, params == null ? void 0 : params.subdomain, redirectToCheckout]
|
|
127
128
|
);
|
|
128
129
|
const openCheckout = (0, import_react.useCallback)(
|
|
129
130
|
(checkoutUrl) => checkout({ checkoutUrl }),
|
|
@@ -313,7 +314,7 @@ const TemplateLayout = ({
|
|
|
313
314
|
event,
|
|
314
315
|
preview: preview2
|
|
315
316
|
}) => {
|
|
316
|
-
var _a2, _b2, _c2, _d2,
|
|
317
|
+
var _a2, _b2, _c2, _d2, _e, _f, _g;
|
|
317
318
|
let trusted = false;
|
|
318
319
|
try {
|
|
319
320
|
trusted = Boolean(
|
|
@@ -326,7 +327,7 @@ const TemplateLayout = ({
|
|
|
326
327
|
setIframe(true);
|
|
327
328
|
}
|
|
328
329
|
if (preview2 && trusted && ((_a2 = event == null ? void 0 : event.data) == null ? void 0 : _a2.update)) {
|
|
329
|
-
const headline = ((_c2 = (_b2 = event == null ? void 0 : event.data) == null ? void 0 : _b2.update) == null ? void 0 : _c2.headline) || ((_d2 = result == null ? void 0 : result.data) == null ? void 0 : _d2.headline) || ((_f = (
|
|
330
|
+
const headline = ((_c2 = (_b2 = event == null ? void 0 : event.data) == null ? void 0 : _b2.update) == null ? void 0 : _c2.headline) || ((_d2 = result == null ? void 0 : result.data) == null ? void 0 : _d2.headline) || ((_f = (_e = import_constants.default) == null ? void 0 : _e.form) == null ? void 0 : _f.headline);
|
|
330
331
|
setData({
|
|
331
332
|
...result,
|
|
332
333
|
...(_g = event == null ? void 0 : event.data) == null ? void 0 : _g.update,
|
|
@@ -354,6 +355,13 @@ const TemplateLayout = ({
|
|
|
354
355
|
preview
|
|
355
356
|
});
|
|
356
357
|
window.addEventListener("message", onRecievedMessage);
|
|
358
|
+
if (preview && window.parent !== window) {
|
|
359
|
+
try {
|
|
360
|
+
window.parent.postMessage({ ready: true }, new URL(process.env.NEXT_PUBLIC_DASHBOARD_URI).origin);
|
|
361
|
+
} catch {
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
;
|
|
357
365
|
return () => {
|
|
358
366
|
window.removeEventListener("message", onRecievedMessage);
|
|
359
367
|
document.documentElement.style.background = "";
|
|
@@ -361,18 +369,21 @@ const TemplateLayout = ({
|
|
|
361
369
|
document.documentElement.style.color = "";
|
|
362
370
|
};
|
|
363
371
|
},
|
|
364
|
-
[iframeMessageResponse, preview, tracking, (
|
|
372
|
+
[iframeMessageResponse, preview, tracking, (_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb, (_d = (_c = style == null ? void 0 : style.text) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb, userAgent]
|
|
365
373
|
);
|
|
366
374
|
const submission = (0, import_react.useCallback)(
|
|
367
|
-
({ id, lead, message, title }) => {
|
|
375
|
+
({ id, lead, message, panel: answer, repeat, title }) => {
|
|
368
376
|
setPanel({
|
|
369
377
|
name: "submission",
|
|
370
378
|
data: {
|
|
371
379
|
affiliate,
|
|
380
|
+
giveaway: (0, import_entry.awardingOn)(data),
|
|
372
381
|
id,
|
|
373
382
|
lead,
|
|
374
383
|
message,
|
|
384
|
+
panel: answer,
|
|
375
385
|
preview,
|
|
386
|
+
repeat,
|
|
376
387
|
style,
|
|
377
388
|
title,
|
|
378
389
|
...params
|
|
@@ -380,11 +391,36 @@ const TemplateLayout = ({
|
|
|
380
391
|
});
|
|
381
392
|
setModal(true);
|
|
382
393
|
},
|
|
383
|
-
[affiliate, params, preview, style]
|
|
394
|
+
[affiliate, data, params, preview, style]
|
|
395
|
+
);
|
|
396
|
+
const leadMission = searchParams.get("mission");
|
|
397
|
+
const leadUrl = submissionId ? null : (0, import_url.leadEndpoint)({ lead: searchParams.get("lead"), slug: params == null ? void 0 : params.slug, subdomain: params == null ? void 0 : params.subdomain, token });
|
|
398
|
+
(0, import_react.useEffect)(
|
|
399
|
+
() => {
|
|
400
|
+
if (!leadUrl) return;
|
|
401
|
+
(0, import_fetch.request)({
|
|
402
|
+
cache: "no-store",
|
|
403
|
+
endpoint: leadUrl,
|
|
404
|
+
method: "GET"
|
|
405
|
+
}).then(({ result: result2 }) => {
|
|
406
|
+
var _a2;
|
|
407
|
+
if (!((_a2 = result2 == null ? void 0 : result2.missions) == null ? void 0 : _a2.length)) return;
|
|
408
|
+
setPanel({
|
|
409
|
+
name: "lead",
|
|
410
|
+
data: {
|
|
411
|
+
...result2,
|
|
412
|
+
mission: leadMission
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
setModal(true);
|
|
416
|
+
}).catch(() => {
|
|
417
|
+
});
|
|
418
|
+
},
|
|
419
|
+
[leadMission, leadUrl]
|
|
384
420
|
);
|
|
385
421
|
const buttons = (0, import_react.useMemo)(
|
|
386
422
|
() => {
|
|
387
|
-
var _a2, _b2, _c2, _d2,
|
|
423
|
+
var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
388
424
|
const branding = (compact = false) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
389
425
|
"div",
|
|
390
426
|
{
|
|
@@ -429,7 +465,7 @@ const TemplateLayout = ({
|
|
|
429
465
|
branding: branding(),
|
|
430
466
|
brandingCompact: branding(true),
|
|
431
467
|
close: (name) => {
|
|
432
|
-
var _a3, _b3, _c3, _d3,
|
|
468
|
+
var _a3, _b3, _c3, _d3, _e2, _f2, _g2, _h2, _i2, _j2, _k2;
|
|
433
469
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
434
470
|
import_button.default,
|
|
435
471
|
{
|
|
@@ -451,7 +487,7 @@ const TemplateLayout = ({
|
|
|
451
487
|
className: "flex items-center justify-center w-6 h-6 rounded-full",
|
|
452
488
|
...style && {
|
|
453
489
|
style: {
|
|
454
|
-
backgroundColor: ((_c3 = (_b3 = (_a3 = style == null ? void 0 : style.button) == null ? void 0 : _a3.background) == null ? void 0 : _b3.color) == null ? void 0 : _c3.rgb) || ((
|
|
490
|
+
backgroundColor: ((_c3 = (_b3 = (_a3 = style == null ? void 0 : style.button) == null ? void 0 : _a3.background) == null ? void 0 : _b3.color) == null ? void 0 : _c3.rgb) || ((_e2 = (_d3 = style == null ? void 0 : style.text) == null ? void 0 : _d3.color) == null ? void 0 : _e2.rgb),
|
|
455
491
|
borderRadius: ((_f2 = style == null ? void 0 : style.button) == null ? void 0 : _f2.radius) != null ? style.button.radius / 4 + "px" : void 0,
|
|
456
492
|
color: ((_i2 = (_h2 = (_g2 = style == null ? void 0 : style.button) == null ? void 0 : _g2.text) == null ? void 0 : _h2.color) == null ? void 0 : _i2.rgb) || ((_k2 = (_j2 = style == null ? void 0 : style.background) == null ? void 0 : _j2.color) == null ? void 0 : _k2.rgb)
|
|
457
493
|
}
|
|
@@ -471,7 +507,9 @@ const TemplateLayout = ({
|
|
|
471
507
|
}
|
|
472
508
|
);
|
|
473
509
|
},
|
|
474
|
-
|
|
510
|
+
// @story public-entry/view-page
|
|
511
|
+
// The form off: no Enter button, the owner's preview included.
|
|
512
|
+
enter: (0, import_entry.formOn)(data) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
475
513
|
import_button.default,
|
|
476
514
|
{
|
|
477
515
|
...{
|
|
@@ -487,7 +525,7 @@ const TemplateLayout = ({
|
|
|
487
525
|
},
|
|
488
526
|
style
|
|
489
527
|
},
|
|
490
|
-
children:
|
|
528
|
+
children: (0, import_entry.buttonText)(data, preview || Boolean(data == null ? void 0 : data.valid))
|
|
491
529
|
}
|
|
492
530
|
),
|
|
493
531
|
menu: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -514,10 +552,10 @@ const TemplateLayout = ({
|
|
|
514
552
|
className: "flex items-center justify-center w-10 h-10 border border-current rounded-full",
|
|
515
553
|
...style && {
|
|
516
554
|
style: {
|
|
517
|
-
backgroundColor: ((
|
|
518
|
-
borderColor: ((
|
|
519
|
-
borderRadius: ((
|
|
520
|
-
color: ((
|
|
555
|
+
backgroundColor: ((_c2 = (_b2 = (_a2 = style == null ? void 0 : style.button) == null ? void 0 : _a2.background) == null ? void 0 : _b2.color) == null ? void 0 : _c2.rgb) || ((_e = (_d2 = style == null ? void 0 : style.text) == null ? void 0 : _d2.color) == null ? void 0 : _e.rgb),
|
|
556
|
+
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),
|
|
557
|
+
borderRadius: ((_k = style == null ? void 0 : style.button) == null ? void 0 : _k.radius) != null ? style.button.radius / 4 + "px" : void 0,
|
|
558
|
+
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)
|
|
521
559
|
}
|
|
522
560
|
}
|
|
523
561
|
},
|
|
@@ -578,7 +616,7 @@ const TemplateLayout = ({
|
|
|
578
616
|
);
|
|
579
617
|
},
|
|
580
618
|
shop: (name = "shop") => {
|
|
581
|
-
var _a3, _b3, _c3, _d3,
|
|
619
|
+
var _a3, _b3, _c3, _d3, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
|
|
582
620
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
583
621
|
import_button.default,
|
|
584
622
|
{
|
|
@@ -603,7 +641,7 @@ const TemplateLayout = ({
|
|
|
603
641
|
className: "flex items-center justify-center h-10 border border-current rounded-full " + (cartCount > 0 ? "pl-3 pr-4 space-x-1" : "w-10"),
|
|
604
642
|
...style && {
|
|
605
643
|
style: {
|
|
606
|
-
backgroundColor: ((_c3 = (_b3 = (_a3 = style == null ? void 0 : style.button) == null ? void 0 : _a3.background) == null ? void 0 : _b3.color) == null ? void 0 : _c3.rgb) || ((
|
|
644
|
+
backgroundColor: ((_c3 = (_b3 = (_a3 = style == null ? void 0 : style.button) == null ? void 0 : _a3.background) == null ? void 0 : _b3.color) == null ? void 0 : _c3.rgb) || ((_e2 = (_d3 = style == null ? void 0 : style.text) == null ? void 0 : _d3.color) == null ? void 0 : _e2.rgb),
|
|
607
645
|
borderColor: ((_h2 = (_g2 = (_f2 = style == null ? void 0 : style.button) == null ? void 0 : _f2.background) == null ? void 0 : _g2.color) == null ? void 0 : _h2.rgb) || ((_j2 = (_i2 = style == null ? void 0 : style.text) == null ? void 0 : _i2.color) == null ? void 0 : _j2.rgb),
|
|
608
646
|
borderRadius: ((_k2 = style == null ? void 0 : style.button) == null ? void 0 : _k2.radius) != null ? style.button.radius / 4 + "px" : void 0,
|
|
609
647
|
color: ((_n2 = (_m2 = (_l2 = style == null ? void 0 : style.button) == null ? void 0 : _l2.text) == null ? void 0 : _m2.color) == null ? void 0 : _n2.rgb) || ((_p2 = (_o2 = style == null ? void 0 : style.background) == null ? void 0 : _o2.color) == null ? void 0 : _p2.rgb)
|
|
@@ -14,17 +14,18 @@ import Overlay from "../shared/overlay.mjs";
|
|
|
14
14
|
import Button from "../shared/button.mjs";
|
|
15
15
|
import Link from "next/link";
|
|
16
16
|
import { request } from "@drawbridge/drawbridge-utils/fetch";
|
|
17
|
-
import { constants as shared } from "@drawbridge/drawbridge-utils";
|
|
18
17
|
import constants from "./lib/constants.mjs";
|
|
19
18
|
import { checkout as checkoutKit, ensureCheckoutKit } from "./lib/checkout-kit.mjs";
|
|
20
19
|
import { useTracking } from "./provider-analytics.mjs";
|
|
20
|
+
import { awardingOn, buttonText, copy, formOn } from "./lib/entry.mjs";
|
|
21
|
+
import { leadEndpoint } from "./lib/url.mjs";
|
|
21
22
|
const TemplateModal = dynamic(() => import("./template-modal.mjs"), { ssr: false });
|
|
22
23
|
const TemplateLayout = ({
|
|
23
24
|
params,
|
|
24
25
|
result,
|
|
25
26
|
userAgent
|
|
26
27
|
}) => {
|
|
27
|
-
var _a, _b, _c, _d
|
|
28
|
+
var _a, _b, _c, _d;
|
|
28
29
|
const searchParams = useSearchParams();
|
|
29
30
|
const token = searchParams.get("drwbrdg_pre");
|
|
30
31
|
const preview = Boolean(token);
|
|
@@ -47,6 +48,7 @@ const TemplateLayout = ({
|
|
|
47
48
|
const [panel, setPanel] = useState(submissionId ? {
|
|
48
49
|
name: "submission",
|
|
49
50
|
data: {
|
|
51
|
+
giveaway: awardingOn(result),
|
|
50
52
|
id: submissionId,
|
|
51
53
|
title: "Keep going",
|
|
52
54
|
preview,
|
|
@@ -68,7 +70,6 @@ const TemplateLayout = ({
|
|
|
68
70
|
affiliate,
|
|
69
71
|
campaign: data == null ? void 0 : data.campaign,
|
|
70
72
|
onComplete: () => {
|
|
71
|
-
var _a2;
|
|
72
73
|
if (typeof window !== "undefined") {
|
|
73
74
|
window.localStorage.removeItem(cartStorageKey);
|
|
74
75
|
window.localStorage.removeItem(cartStorageKey + "_expiry");
|
|
@@ -78,7 +79,7 @@ const TemplateLayout = ({
|
|
|
78
79
|
setPanel({
|
|
79
80
|
name: "purchase",
|
|
80
81
|
data: {
|
|
81
|
-
message: (
|
|
82
|
+
message: copy(data, "purchase")
|
|
82
83
|
}
|
|
83
84
|
});
|
|
84
85
|
setModal(true);
|
|
@@ -91,7 +92,7 @@ const TemplateLayout = ({
|
|
|
91
92
|
subdomain: params == null ? void 0 : params.subdomain,
|
|
92
93
|
...args
|
|
93
94
|
}),
|
|
94
|
-
[affiliate, cartStorageKey, data
|
|
95
|
+
[affiliate, cartStorageKey, data, params == null ? void 0 : params.slug, params == null ? void 0 : params.subdomain, redirectToCheckout]
|
|
95
96
|
);
|
|
96
97
|
const openCheckout = useCallback(
|
|
97
98
|
(checkoutUrl) => checkout({ checkoutUrl }),
|
|
@@ -281,7 +282,7 @@ const TemplateLayout = ({
|
|
|
281
282
|
event,
|
|
282
283
|
preview: preview2
|
|
283
284
|
}) => {
|
|
284
|
-
var _a2, _b2, _c2, _d2,
|
|
285
|
+
var _a2, _b2, _c2, _d2, _e, _f, _g;
|
|
285
286
|
let trusted = false;
|
|
286
287
|
try {
|
|
287
288
|
trusted = Boolean(
|
|
@@ -294,7 +295,7 @@ const TemplateLayout = ({
|
|
|
294
295
|
setIframe(true);
|
|
295
296
|
}
|
|
296
297
|
if (preview2 && trusted && ((_a2 = event == null ? void 0 : event.data) == null ? void 0 : _a2.update)) {
|
|
297
|
-
const headline = ((_c2 = (_b2 = event == null ? void 0 : event.data) == null ? void 0 : _b2.update) == null ? void 0 : _c2.headline) || ((_d2 = result == null ? void 0 : result.data) == null ? void 0 : _d2.headline) || ((_f = (
|
|
298
|
+
const headline = ((_c2 = (_b2 = event == null ? void 0 : event.data) == null ? void 0 : _b2.update) == null ? void 0 : _c2.headline) || ((_d2 = result == null ? void 0 : result.data) == null ? void 0 : _d2.headline) || ((_f = (_e = constants) == null ? void 0 : _e.form) == null ? void 0 : _f.headline);
|
|
298
299
|
setData({
|
|
299
300
|
...result,
|
|
300
301
|
...(_g = event == null ? void 0 : event.data) == null ? void 0 : _g.update,
|
|
@@ -322,6 +323,13 @@ const TemplateLayout = ({
|
|
|
322
323
|
preview
|
|
323
324
|
});
|
|
324
325
|
window.addEventListener("message", onRecievedMessage);
|
|
326
|
+
if (preview && window.parent !== window) {
|
|
327
|
+
try {
|
|
328
|
+
window.parent.postMessage({ ready: true }, new URL(process.env.NEXT_PUBLIC_DASHBOARD_URI).origin);
|
|
329
|
+
} catch {
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
;
|
|
325
333
|
return () => {
|
|
326
334
|
window.removeEventListener("message", onRecievedMessage);
|
|
327
335
|
document.documentElement.style.background = "";
|
|
@@ -329,18 +337,21 @@ const TemplateLayout = ({
|
|
|
329
337
|
document.documentElement.style.color = "";
|
|
330
338
|
};
|
|
331
339
|
},
|
|
332
|
-
[iframeMessageResponse, preview, tracking, (
|
|
340
|
+
[iframeMessageResponse, preview, tracking, (_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb, (_d = (_c = style == null ? void 0 : style.text) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb, userAgent]
|
|
333
341
|
);
|
|
334
342
|
const submission = useCallback(
|
|
335
|
-
({ id, lead, message, title }) => {
|
|
343
|
+
({ id, lead, message, panel: answer, repeat, title }) => {
|
|
336
344
|
setPanel({
|
|
337
345
|
name: "submission",
|
|
338
346
|
data: {
|
|
339
347
|
affiliate,
|
|
348
|
+
giveaway: awardingOn(data),
|
|
340
349
|
id,
|
|
341
350
|
lead,
|
|
342
351
|
message,
|
|
352
|
+
panel: answer,
|
|
343
353
|
preview,
|
|
354
|
+
repeat,
|
|
344
355
|
style,
|
|
345
356
|
title,
|
|
346
357
|
...params
|
|
@@ -348,11 +359,36 @@ const TemplateLayout = ({
|
|
|
348
359
|
});
|
|
349
360
|
setModal(true);
|
|
350
361
|
},
|
|
351
|
-
[affiliate, params, preview, style]
|
|
362
|
+
[affiliate, data, params, preview, style]
|
|
363
|
+
);
|
|
364
|
+
const leadMission = searchParams.get("mission");
|
|
365
|
+
const leadUrl = submissionId ? null : leadEndpoint({ lead: searchParams.get("lead"), slug: params == null ? void 0 : params.slug, subdomain: params == null ? void 0 : params.subdomain, token });
|
|
366
|
+
useEffect(
|
|
367
|
+
() => {
|
|
368
|
+
if (!leadUrl) return;
|
|
369
|
+
request({
|
|
370
|
+
cache: "no-store",
|
|
371
|
+
endpoint: leadUrl,
|
|
372
|
+
method: "GET"
|
|
373
|
+
}).then(({ result: result2 }) => {
|
|
374
|
+
var _a2;
|
|
375
|
+
if (!((_a2 = result2 == null ? void 0 : result2.missions) == null ? void 0 : _a2.length)) return;
|
|
376
|
+
setPanel({
|
|
377
|
+
name: "lead",
|
|
378
|
+
data: {
|
|
379
|
+
...result2,
|
|
380
|
+
mission: leadMission
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
setModal(true);
|
|
384
|
+
}).catch(() => {
|
|
385
|
+
});
|
|
386
|
+
},
|
|
387
|
+
[leadMission, leadUrl]
|
|
352
388
|
);
|
|
353
389
|
const buttons = useMemo(
|
|
354
390
|
() => {
|
|
355
|
-
var _a2, _b2, _c2, _d2,
|
|
391
|
+
var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
356
392
|
const branding = (compact = false) => /* @__PURE__ */ jsx(
|
|
357
393
|
"div",
|
|
358
394
|
{
|
|
@@ -397,7 +433,7 @@ const TemplateLayout = ({
|
|
|
397
433
|
branding: branding(),
|
|
398
434
|
brandingCompact: branding(true),
|
|
399
435
|
close: (name) => {
|
|
400
|
-
var _a3, _b3, _c3, _d3,
|
|
436
|
+
var _a3, _b3, _c3, _d3, _e2, _f2, _g2, _h2, _i2, _j2, _k2;
|
|
401
437
|
return /* @__PURE__ */ jsx(
|
|
402
438
|
Button,
|
|
403
439
|
{
|
|
@@ -419,7 +455,7 @@ const TemplateLayout = ({
|
|
|
419
455
|
className: "flex items-center justify-center w-6 h-6 rounded-full",
|
|
420
456
|
...style && {
|
|
421
457
|
style: {
|
|
422
|
-
backgroundColor: ((_c3 = (_b3 = (_a3 = style == null ? void 0 : style.button) == null ? void 0 : _a3.background) == null ? void 0 : _b3.color) == null ? void 0 : _c3.rgb) || ((
|
|
458
|
+
backgroundColor: ((_c3 = (_b3 = (_a3 = style == null ? void 0 : style.button) == null ? void 0 : _a3.background) == null ? void 0 : _b3.color) == null ? void 0 : _c3.rgb) || ((_e2 = (_d3 = style == null ? void 0 : style.text) == null ? void 0 : _d3.color) == null ? void 0 : _e2.rgb),
|
|
423
459
|
borderRadius: ((_f2 = style == null ? void 0 : style.button) == null ? void 0 : _f2.radius) != null ? style.button.radius / 4 + "px" : void 0,
|
|
424
460
|
color: ((_i2 = (_h2 = (_g2 = style == null ? void 0 : style.button) == null ? void 0 : _g2.text) == null ? void 0 : _h2.color) == null ? void 0 : _i2.rgb) || ((_k2 = (_j2 = style == null ? void 0 : style.background) == null ? void 0 : _j2.color) == null ? void 0 : _k2.rgb)
|
|
425
461
|
}
|
|
@@ -439,7 +475,9 @@ const TemplateLayout = ({
|
|
|
439
475
|
}
|
|
440
476
|
);
|
|
441
477
|
},
|
|
442
|
-
|
|
478
|
+
// @story public-entry/view-page
|
|
479
|
+
// The form off: no Enter button, the owner's preview included.
|
|
480
|
+
enter: formOn(data) && /* @__PURE__ */ jsx(
|
|
443
481
|
Button,
|
|
444
482
|
{
|
|
445
483
|
...{
|
|
@@ -455,7 +493,7 @@ const TemplateLayout = ({
|
|
|
455
493
|
},
|
|
456
494
|
style
|
|
457
495
|
},
|
|
458
|
-
children: preview || Boolean(data == null ? void 0 : data.valid)
|
|
496
|
+
children: buttonText(data, preview || Boolean(data == null ? void 0 : data.valid))
|
|
459
497
|
}
|
|
460
498
|
),
|
|
461
499
|
menu: /* @__PURE__ */ jsx(
|
|
@@ -482,10 +520,10 @@ const TemplateLayout = ({
|
|
|
482
520
|
className: "flex items-center justify-center w-10 h-10 border border-current rounded-full",
|
|
483
521
|
...style && {
|
|
484
522
|
style: {
|
|
485
|
-
backgroundColor: ((
|
|
486
|
-
borderColor: ((
|
|
487
|
-
borderRadius: ((
|
|
488
|
-
color: ((
|
|
523
|
+
backgroundColor: ((_c2 = (_b2 = (_a2 = style == null ? void 0 : style.button) == null ? void 0 : _a2.background) == null ? void 0 : _b2.color) == null ? void 0 : _c2.rgb) || ((_e = (_d2 = style == null ? void 0 : style.text) == null ? void 0 : _d2.color) == null ? void 0 : _e.rgb),
|
|
524
|
+
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),
|
|
525
|
+
borderRadius: ((_k = style == null ? void 0 : style.button) == null ? void 0 : _k.radius) != null ? style.button.radius / 4 + "px" : void 0,
|
|
526
|
+
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)
|
|
489
527
|
}
|
|
490
528
|
}
|
|
491
529
|
},
|
|
@@ -546,7 +584,7 @@ const TemplateLayout = ({
|
|
|
546
584
|
);
|
|
547
585
|
},
|
|
548
586
|
shop: (name = "shop") => {
|
|
549
|
-
var _a3, _b3, _c3, _d3,
|
|
587
|
+
var _a3, _b3, _c3, _d3, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
|
|
550
588
|
return /* @__PURE__ */ jsx(
|
|
551
589
|
Button,
|
|
552
590
|
{
|
|
@@ -571,7 +609,7 @@ const TemplateLayout = ({
|
|
|
571
609
|
className: "flex items-center justify-center h-10 border border-current rounded-full " + (cartCount > 0 ? "pl-3 pr-4 space-x-1" : "w-10"),
|
|
572
610
|
...style && {
|
|
573
611
|
style: {
|
|
574
|
-
backgroundColor: ((_c3 = (_b3 = (_a3 = style == null ? void 0 : style.button) == null ? void 0 : _a3.background) == null ? void 0 : _b3.color) == null ? void 0 : _c3.rgb) || ((
|
|
612
|
+
backgroundColor: ((_c3 = (_b3 = (_a3 = style == null ? void 0 : style.button) == null ? void 0 : _a3.background) == null ? void 0 : _b3.color) == null ? void 0 : _c3.rgb) || ((_e2 = (_d3 = style == null ? void 0 : style.text) == null ? void 0 : _d3.color) == null ? void 0 : _e2.rgb),
|
|
575
613
|
borderColor: ((_h2 = (_g2 = (_f2 = style == null ? void 0 : style.button) == null ? void 0 : _f2.background) == null ? void 0 : _g2.color) == null ? void 0 : _h2.rgb) || ((_j2 = (_i2 = style == null ? void 0 : style.text) == null ? void 0 : _i2.color) == null ? void 0 : _j2.rgb),
|
|
576
614
|
borderRadius: ((_k2 = style == null ? void 0 : style.button) == null ? void 0 : _k2.radius) != null ? style.button.radius / 4 + "px" : void 0,
|
|
577
615
|
color: ((_n2 = (_m2 = (_l2 = style == null ? void 0 : style.button) == null ? void 0 : _l2.text) == null ? void 0 : _m2.color) == null ? void 0 : _n2.rgb) || ((_p2 = (_o2 = style == null ? void 0 : style.background) == null ? void 0 : _o2.color) == null ? void 0 : _p2.rgb)
|
|
@@ -35,20 +35,20 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
35
35
|
var import_react = require("react");
|
|
36
36
|
var import_react2 = require("@headlessui/react");
|
|
37
37
|
var import_form_subdomain = __toESM(require("./form-subdomain"));
|
|
38
|
+
var import_form_subdomain_header = __toESM(require("./form-subdomain-header"));
|
|
38
39
|
var import_form_subdomain_issue = __toESM(require("./form-subdomain-issue"));
|
|
39
40
|
var import_form_subdomain_prize = __toESM(require("./form-subdomain-prize"));
|
|
40
41
|
var import_provider_recaptcha = __toESM(require("../shared/provider-recaptcha"));
|
|
41
42
|
var import_form_subdomain_shop_modal = require("./form-subdomain-shop-modal");
|
|
42
43
|
var import_template_subdomain_link = __toESM(require("./template-subdomain-link"));
|
|
43
|
-
var
|
|
44
|
-
var import_share_button = __toESM(require("./share-button"));
|
|
44
|
+
var import_form_subdomain_missions = __toESM(require("./form-subdomain-missions"));
|
|
45
45
|
var import_tabs = __toESM(require("../shared/tabs"));
|
|
46
46
|
var import_empty = __toESM(require("../shared/empty"));
|
|
47
47
|
var import_card_prize = __toESM(require("../shared/card-prize"));
|
|
48
48
|
var import_arrow_right = __toESM(require("../icons/arrow-right"));
|
|
49
49
|
var import_flag = __toESM(require("../icons/flag"));
|
|
50
|
-
var import_link = __toESM(require("../icons/link"));
|
|
51
50
|
var import_warning = __toESM(require("../icons/warning"));
|
|
51
|
+
var import_entry = require("./lib/entry");
|
|
52
52
|
const TemplateModal = ({
|
|
53
53
|
buttons,
|
|
54
54
|
cart,
|
|
@@ -74,7 +74,7 @@ const TemplateModal = ({
|
|
|
74
74
|
var _a, _b, _c, _d, _e, _f;
|
|
75
75
|
const renderPanel = (0, import_react.useCallback)(
|
|
76
76
|
() => {
|
|
77
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u
|
|
77
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
78
78
|
const agreements = (data == null ? void 0 : data.agreements) || {};
|
|
79
79
|
switch (panel == null ? void 0 : panel.name) {
|
|
80
80
|
case "cart":
|
|
@@ -99,6 +99,7 @@ const TemplateModal = ({
|
|
|
99
99
|
}
|
|
100
100
|
);
|
|
101
101
|
case "enter":
|
|
102
|
+
if (!(0, import_entry.formOn)(data)) return null;
|
|
102
103
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
103
104
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
104
105
|
import_form_subdomain.default,
|
|
@@ -113,12 +114,18 @@ const TemplateModal = ({
|
|
|
113
114
|
message
|
|
114
115
|
}
|
|
115
116
|
}),
|
|
116
|
-
onSuccess: ({ message, result }) => {
|
|
117
|
-
var _a3
|
|
117
|
+
onSuccess: ({ created, message, result }) => {
|
|
118
|
+
var _a3;
|
|
118
119
|
return submission({
|
|
119
120
|
id: (_a3 = result == null ? void 0 : result.submission) == null ? void 0 : _a3.id,
|
|
120
|
-
message: message || (
|
|
121
|
-
|
|
121
|
+
message: message || (0, import_entry.copy)(data, "confirmation"),
|
|
122
|
+
// @story public-entry/submit
|
|
123
|
+
// The panel's ads and missions ride on the answer: nothing more to ask.
|
|
124
|
+
panel: result == null ? void 0 : result.panel,
|
|
125
|
+
// The api answers a submitter at the limit with created false.
|
|
126
|
+
repeat: created === false,
|
|
127
|
+
// @story public-entry/submit
|
|
128
|
+
title: (0, import_entry.panelTitle)(data)
|
|
122
129
|
});
|
|
123
130
|
},
|
|
124
131
|
disabled: !preview && !(data == null ? void 0 : data.valid),
|
|
@@ -149,10 +156,32 @@ const TemplateModal = ({
|
|
|
149
156
|
}
|
|
150
157
|
}
|
|
151
158
|
);
|
|
159
|
+
// @story public-entry/lead-link
|
|
160
|
+
// Opened by the lead's own link while entries are being awarded:
|
|
161
|
+
// the missions panel, at the mission a `&mission=` asked for. With
|
|
162
|
+
// no missions the link opens no panel (template-layout.js).
|
|
163
|
+
case "lead":
|
|
164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
165
|
+
import_form_subdomain_missions.default,
|
|
166
|
+
{
|
|
167
|
+
...{
|
|
168
|
+
button: buttons.close("lead"),
|
|
169
|
+
contact: panel.data.contact,
|
|
170
|
+
initial: panel.data.mission,
|
|
171
|
+
missions: panel.data.missions,
|
|
172
|
+
shareLink: panel.data.shareLink,
|
|
173
|
+
slug: params == null ? void 0 : params.slug,
|
|
174
|
+
style,
|
|
175
|
+
subdomain: params == null ? void 0 : params.subdomain,
|
|
176
|
+
title: "Your entries",
|
|
177
|
+
token: panel.data.token
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
);
|
|
152
181
|
case "menu":
|
|
153
182
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
154
183
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
155
|
-
|
|
184
|
+
import_form_subdomain_header.default,
|
|
156
185
|
{
|
|
157
186
|
...{
|
|
158
187
|
button: buttons.close("menu"),
|
|
@@ -173,7 +202,7 @@ const TemplateModal = ({
|
|
|
173
202
|
}
|
|
174
203
|
},
|
|
175
204
|
children: [
|
|
176
|
-
((_e2 = (_d2 = data == null ? void 0 : data.prizes) == null ? void 0 : _d2.pageInfo) == null ? void 0 : _e2.total) > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
205
|
+
(0, import_entry.giveawayOn)(data) && ((_e2 = (_d2 = data == null ? void 0 : data.prizes) == null ? void 0 : _d2.pageInfo) == null ? void 0 : _e2.total) > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
177
206
|
import_template_subdomain_link.default,
|
|
178
207
|
{
|
|
179
208
|
...{
|
|
@@ -192,25 +221,6 @@ const TemplateModal = ({
|
|
|
192
221
|
}
|
|
193
222
|
}
|
|
194
223
|
),
|
|
195
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
196
|
-
import_template_subdomain_link.default,
|
|
197
|
-
{
|
|
198
|
-
...{
|
|
199
|
-
disabled: iframe,
|
|
200
|
-
onClick: () => {
|
|
201
|
-
setPanel({
|
|
202
|
-
name: "share"
|
|
203
|
-
});
|
|
204
|
-
tracking.track({
|
|
205
|
-
name: "link-share"
|
|
206
|
-
});
|
|
207
|
-
},
|
|
208
|
-
svg: import_arrow_right.default,
|
|
209
|
-
text: "Share link",
|
|
210
|
-
"aria-label": "Open to share this link"
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
),
|
|
214
224
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
215
225
|
import_template_subdomain_link.default,
|
|
216
226
|
{
|
|
@@ -237,7 +247,7 @@ const TemplateModal = ({
|
|
|
237
247
|
case "prize":
|
|
238
248
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
239
249
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
240
|
-
|
|
250
|
+
import_form_subdomain_header.default,
|
|
241
251
|
{
|
|
242
252
|
...{
|
|
243
253
|
back: {
|
|
@@ -344,7 +354,7 @@ const TemplateModal = ({
|
|
|
344
354
|
case "prizes":
|
|
345
355
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
346
356
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
347
|
-
|
|
357
|
+
import_form_subdomain_header.default,
|
|
348
358
|
{
|
|
349
359
|
...{
|
|
350
360
|
back: {
|
|
@@ -467,7 +477,7 @@ const TemplateModal = ({
|
|
|
467
477
|
case "report":
|
|
468
478
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
469
479
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
470
|
-
|
|
480
|
+
import_form_subdomain_header.default,
|
|
471
481
|
{
|
|
472
482
|
...{
|
|
473
483
|
back: {
|
|
@@ -496,50 +506,6 @@ const TemplateModal = ({
|
|
|
496
506
|
),
|
|
497
507
|
buttons.recaptcha()
|
|
498
508
|
] });
|
|
499
|
-
case "share":
|
|
500
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
|
|
501
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
502
|
-
import_form_subdomain.FormSubdomainHeader,
|
|
503
|
-
{
|
|
504
|
-
...{
|
|
505
|
-
back: {
|
|
506
|
-
onClick: () => setPanel({
|
|
507
|
-
name: "menu"
|
|
508
|
-
})
|
|
509
|
-
},
|
|
510
|
-
button: buttons.close("menu"),
|
|
511
|
-
style,
|
|
512
|
-
title: "Share link"
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
),
|
|
516
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
517
|
-
import_share_button.default,
|
|
518
|
-
{
|
|
519
|
-
...{
|
|
520
|
-
style,
|
|
521
|
-
values: {
|
|
522
|
-
description: data == null ? void 0 : data.description,
|
|
523
|
-
headline: data == null ? void 0 : data.headline,
|
|
524
|
-
image: (_v = data == null ? void 0 : data.images) == null ? void 0 : _v.preview,
|
|
525
|
-
url: data == null ? void 0 : data.url
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
),
|
|
530
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
531
|
-
import_copy_to_clipboard.default,
|
|
532
|
-
{
|
|
533
|
-
...{
|
|
534
|
-
className: "justify-between w-full pt-5 pr-3 border-t border-inherit",
|
|
535
|
-
icon: import_link.default,
|
|
536
|
-
style,
|
|
537
|
-
value: data == null ? void 0 : data.url
|
|
538
|
-
},
|
|
539
|
-
children: "Copy link"
|
|
540
|
-
}
|
|
541
|
-
)
|
|
542
|
-
] });
|
|
543
509
|
case "submission":
|
|
544
510
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
545
511
|
import_form_subdomain.FormSubdomainSubmission,
|