@drawbridge/components 0.1.46 → 0.1.48
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/cart-drawer.js +152 -0
- package/dist/bridge/cart-drawer.mjs +123 -0
- package/dist/bridge/fields.js +278 -0
- package/dist/bridge/fields.mjs +276 -1
- package/dist/bridge/form-subdomain-checkout.js +687 -0
- package/dist/bridge/form-subdomain-checkout.mjs +665 -0
- package/dist/bridge/form-subdomain-shop-modal.js +234 -274
- package/dist/bridge/form-subdomain-shop-modal.mjs +233 -275
- package/dist/bridge/form-subdomain-shop.js +4 -1
- package/dist/bridge/form-subdomain-shop.mjs +4 -1
- package/dist/bridge/form-subdomain.js +24 -5
- package/dist/bridge/form-subdomain.mjs +25 -6
- package/dist/bridge/lib/age-gate.js +12 -0
- package/dist/bridge/lib/age-gate.mjs +11 -0
- package/dist/bridge/lib/cart.js +79 -0
- package/dist/bridge/lib/cart.mjs +48 -0
- package/dist/bridge/lib/checkout-kit.js +2 -32
- package/dist/bridge/lib/checkout-kit.mjs +2 -32
- package/dist/bridge/lib/entry.js +41 -0
- package/dist/bridge/lib/entry.mjs +40 -0
- package/dist/bridge/product-tile.js +13 -6
- package/dist/bridge/product-tile.mjs +13 -6
- package/dist/bridge/template-layout.js +263 -129
- package/dist/bridge/template-layout.mjs +264 -130
- package/dist/bridge/template-modal.js +39 -74
- package/dist/bridge/template-modal.mjs +40 -75
- package/dist/dashboard/avatar.js +2 -3
- package/dist/dashboard/avatar.mjs +2 -3
- package/dist/dashboard/buttons-subscription.js +1 -1
- package/dist/dashboard/buttons-subscription.mjs +1 -1
- package/dist/dashboard/campaign-form.js +179 -155
- package/dist/dashboard/campaign-form.mjs +179 -155
- 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/card-order.js +22 -4
- package/dist/dashboard/card-order.mjs +22 -4
- package/dist/dashboard/embed-stripe.js +145 -0
- package/dist/dashboard/embed-stripe.mjs +116 -0
- package/dist/dashboard/form-admin-provider.js +71 -17
- package/dist/dashboard/form-admin-provider.mjs +71 -17
- package/dist/dashboard/form-file-upload.js +3 -2
- package/dist/dashboard/form-file-upload.mjs +4 -3
- package/dist/dashboard/form-organization-campaign-advertisements.js +47 -6
- package/dist/dashboard/form-organization-campaign-advertisements.mjs +47 -6
- package/dist/dashboard/form-organization-campaign-field-birthday.js +193 -0
- package/dist/dashboard/form-organization-campaign-field-birthday.mjs +164 -0
- package/dist/dashboard/form-organization-campaign-field-rating.js +246 -0
- package/dist/dashboard/form-organization-campaign-field-rating.mjs +217 -0
- package/dist/dashboard/form-organization-campaign-page.js +73 -39
- package/dist/dashboard/form-organization-campaign-page.mjs +73 -39
- package/dist/dashboard/form-organization-campaign.js +82 -0
- package/dist/dashboard/form-organization-campaign.mjs +81 -0
- package/dist/dashboard/form-organization-connection.js +48 -6
- package/dist/dashboard/form-organization-connection.mjs +48 -7
- package/dist/dashboard/form-organization-product.js +1461 -0
- package/dist/dashboard/form-organization-product.mjs +1425 -0
- package/dist/dashboard/form-organization-workflow.js +72 -1
- package/dist/dashboard/form-organization-workflow.mjs +69 -1
- package/dist/dashboard/form-otc.js +4 -5
- package/dist/dashboard/form-otc.mjs +4 -5
- package/dist/dashboard/form-stripe.js +12 -5
- package/dist/dashboard/form-stripe.mjs +12 -5
- package/dist/dashboard/input-combobox.js +6 -0
- package/dist/dashboard/input-combobox.mjs +6 -0
- package/dist/dashboard/input-fields.js +37 -161
- package/dist/dashboard/input-fields.mjs +37 -161
- package/dist/dashboard/input-file.js +21 -4
- package/dist/dashboard/input-file.mjs +21 -4
- package/dist/dashboard/input-font.js +2 -0
- package/dist/dashboard/input-font.mjs +2 -0
- package/dist/dashboard/input-gallery.js +201 -0
- package/dist/dashboard/input-gallery.mjs +172 -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/connection-controls.js +5 -2
- package/dist/dashboard/lib/connection-controls.mjs +3 -1
- package/dist/dashboard/lib/form-page.js +1 -1
- package/dist/dashboard/lib/form-page.mjs +1 -1
- package/dist/dashboard/lib/menu.js +19 -0
- package/dist/dashboard/lib/menu.mjs +18 -0
- package/dist/dashboard/lib/products.js +169 -0
- package/dist/dashboard/lib/products.mjs +135 -0
- package/dist/dashboard/lib/settings-paths.js +35 -0
- package/dist/dashboard/lib/settings-paths.mjs +11 -0
- package/dist/dashboard/lib/uppy.js +10 -1
- package/dist/dashboard/lib/uppy.mjs +11 -2
- package/dist/dashboard/menu.js +13 -2
- package/dist/dashboard/menu.mjs +13 -2
- package/dist/dashboard/order-sections.js +456 -6
- package/dist/dashboard/order-sections.mjs +453 -7
- package/dist/dashboard/preview.js +119 -52
- package/dist/dashboard/preview.mjs +119 -52
- package/dist/dashboard/provider-ui.js +9 -7
- package/dist/dashboard/provider-ui.mjs +9 -7
- package/dist/dashboard/recharts.js +10 -4
- package/dist/dashboard/recharts.mjs +10 -4
- package/dist/dashboard/shipping-rates.js +404 -0
- package/dist/dashboard/shipping-rates.mjs +371 -0
- package/dist/dashboard/template-buyer.js +301 -0
- package/dist/dashboard/template-buyer.mjs +267 -0
- 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/input-checkbox.js +28 -10
- package/dist/input-checkbox.mjs +28 -10
- package/dist/product.js +96 -24
- package/dist/product.mjs +97 -25
- package/dist/shared/carousel.js +14 -5
- package/dist/shared/carousel.mjs +14 -5
- package/dist/shared/lib/helpers.js +54 -6
- package/dist/shared/lib/helpers.mjs +53 -8
- package/dist/shared/order-summary.js +139 -0
- package/dist/shared/order-summary.mjs +110 -0
- package/package.json +84 -4
- package/types/bridge/cart-drawer.d.ts +31 -0
- package/types/bridge/fields.d.ts +14 -2
- package/types/bridge/form-subdomain-checkout.d.ts +20 -0
- package/types/bridge/form-subdomain-shop-modal.d.ts +27 -3
- package/types/bridge/form-subdomain.d.ts +13 -0
- package/types/bridge/lib/age-gate.d.ts +5 -0
- package/types/bridge/lib/cart.d.ts +44 -0
- package/types/bridge/lib/checkout-kit.d.ts +2 -10
- 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/card-order.d.ts +6 -0
- package/types/dashboard/embed-stripe.d.ts +25 -0
- package/types/dashboard/form-admin-provider.d.ts +9 -2
- package/types/dashboard/form-file-upload.d.ts +2 -1
- package/types/dashboard/form-organization-campaign-advertisements.d.ts +3 -0
- package/types/dashboard/form-organization-campaign-field-birthday.d.ts +31 -0
- package/types/dashboard/form-organization-campaign-field-rating.d.ts +33 -0
- package/types/dashboard/form-organization-campaign-page.d.ts +8 -1
- package/types/dashboard/form-organization-campaign.d.ts +3 -0
- package/types/dashboard/form-organization-connection.d.ts +11 -0
- package/types/dashboard/form-organization-product.d.ts +24 -0
- package/types/dashboard/form-otc.d.ts +5 -1
- package/types/dashboard/form-stripe.d.ts +3 -2
- package/types/dashboard/input-combobox.d.ts +2 -0
- package/types/dashboard/input-file.d.ts +2 -0
- package/types/dashboard/input-gallery.d.ts +14 -0
- package/types/dashboard/lib/products.d.ts +14 -0
- package/types/dashboard/lib/settings-paths.d.ts +5 -0
- package/types/dashboard/order-sections.d.ts +24 -1
- package/types/dashboard/preview.d.ts +11 -3
- package/types/dashboard/shipping-rates.d.ts +26 -0
- package/types/dashboard/template-buyer.d.ts +50 -0
- package/types/icons/flags.d.ts +5 -0
- package/types/input-checkbox.d.ts +2 -0
- package/types/shared/lib/helpers.d.ts +4 -0
- package/types/shared/order-summary.d.ts +19 -0
|
@@ -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
|
};
|
|
@@ -33,10 +33,12 @@ __export(product_tile_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(product_tile_exports);
|
|
34
34
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
35
|
var import_image = __toESM(require("next/image"));
|
|
36
|
-
var
|
|
36
|
+
var import_helpers = require("../shared/lib/helpers");
|
|
37
37
|
var import_button = __toESM(require("../shared/button"));
|
|
38
38
|
var import_styles = require("../styles");
|
|
39
|
+
var import_cart = require("./lib/cart");
|
|
39
40
|
const CardProduct = ({
|
|
41
|
+
eager,
|
|
40
42
|
title,
|
|
41
43
|
onClick,
|
|
42
44
|
stacked,
|
|
@@ -44,13 +46,16 @@ const CardProduct = ({
|
|
|
44
46
|
variants,
|
|
45
47
|
...rest
|
|
46
48
|
}) => {
|
|
47
|
-
var _a, _b, _c
|
|
49
|
+
var _a, _b, _c;
|
|
48
50
|
const available = (variants || []).filter((variant) => variant.availableForSale);
|
|
49
51
|
const price = ((_a = available[0]) == null ? void 0 : _a.price) || null;
|
|
50
52
|
const currency = ((_b = available[0]) == null ? void 0 : _b.currency) || null;
|
|
51
|
-
const image = (
|
|
53
|
+
const image = (0, import_cart.productImage)({
|
|
54
|
+
...rest,
|
|
55
|
+
variants
|
|
56
|
+
}, "400x400");
|
|
52
57
|
const textSize = stacked ? "text-base" : "text-xs sm:text-sm";
|
|
53
|
-
const imageRadius = ((
|
|
58
|
+
const imageRadius = ((_c = style == null ? void 0 : style.image) == null ? void 0 : _c.radius) != null ? style.image.radius + "px" : "12px";
|
|
54
59
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
55
60
|
import_button.default,
|
|
56
61
|
{
|
|
@@ -81,6 +86,9 @@ const CardProduct = ({
|
|
|
81
86
|
alt: title + " image",
|
|
82
87
|
className: "object-cover",
|
|
83
88
|
fill: true,
|
|
89
|
+
...eager && {
|
|
90
|
+
loading: "eager"
|
|
91
|
+
},
|
|
84
92
|
sizes: "50vw",
|
|
85
93
|
src: image,
|
|
86
94
|
unoptimized: true
|
|
@@ -95,9 +103,8 @@ const CardProduct = ({
|
|
|
95
103
|
...{
|
|
96
104
|
className: textSize + " font-bold text-center mb-1"
|
|
97
105
|
},
|
|
98
|
-
children: available.length > 0 && price ? (0,
|
|
106
|
+
children: available.length > 0 && price ? (0, import_helpers.money)({
|
|
99
107
|
code: currency,
|
|
100
|
-
display: "parts",
|
|
101
108
|
value: price
|
|
102
109
|
}) : "Unavailable"
|
|
103
110
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import Image from "next/image";
|
|
4
|
-
import {
|
|
4
|
+
import { money } from "../shared/lib/helpers.mjs";
|
|
5
5
|
import Button from "../shared/button.mjs";
|
|
6
6
|
import { headerStyle } from "../styles.mjs";
|
|
7
|
+
import { productImage } from "./lib/cart.mjs";
|
|
7
8
|
const CardProduct = ({
|
|
9
|
+
eager,
|
|
8
10
|
title,
|
|
9
11
|
onClick,
|
|
10
12
|
stacked,
|
|
@@ -12,13 +14,16 @@ const CardProduct = ({
|
|
|
12
14
|
variants,
|
|
13
15
|
...rest
|
|
14
16
|
}) => {
|
|
15
|
-
var _a, _b, _c
|
|
17
|
+
var _a, _b, _c;
|
|
16
18
|
const available = (variants || []).filter((variant) => variant.availableForSale);
|
|
17
19
|
const price = ((_a = available[0]) == null ? void 0 : _a.price) || null;
|
|
18
20
|
const currency = ((_b = available[0]) == null ? void 0 : _b.currency) || null;
|
|
19
|
-
const image = (
|
|
21
|
+
const image = productImage({
|
|
22
|
+
...rest,
|
|
23
|
+
variants
|
|
24
|
+
}, "400x400");
|
|
20
25
|
const textSize = stacked ? "text-base" : "text-xs sm:text-sm";
|
|
21
|
-
const imageRadius = ((
|
|
26
|
+
const imageRadius = ((_c = style == null ? void 0 : style.image) == null ? void 0 : _c.radius) != null ? style.image.radius + "px" : "12px";
|
|
22
27
|
return /* @__PURE__ */ jsx(
|
|
23
28
|
Button,
|
|
24
29
|
{
|
|
@@ -49,6 +54,9 @@ const CardProduct = ({
|
|
|
49
54
|
alt: title + " image",
|
|
50
55
|
className: "object-cover",
|
|
51
56
|
fill: true,
|
|
57
|
+
...eager && {
|
|
58
|
+
loading: "eager"
|
|
59
|
+
},
|
|
52
60
|
sizes: "50vw",
|
|
53
61
|
src: image,
|
|
54
62
|
unoptimized: true
|
|
@@ -63,9 +71,8 @@ const CardProduct = ({
|
|
|
63
71
|
...{
|
|
64
72
|
className: textSize + " font-bold text-center mb-1"
|
|
65
73
|
},
|
|
66
|
-
children: available.length > 0 && price ?
|
|
74
|
+
children: available.length > 0 && price ? money({
|
|
67
75
|
code: currency,
|
|
68
|
-
display: "parts",
|
|
69
76
|
value: price
|
|
70
77
|
}) : "Unavailable"
|
|
71
78
|
}
|