@drawbridge/components 0.1.14 → 0.1.16
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-missions.js +77 -38
- package/dist/bridge/form-subdomain-missions.mjs +76 -38
- package/dist/bridge/lib/url.js +3 -3
- package/dist/bridge/lib/url.mjs +3 -3
- package/dist/bridge/share-button.js +12 -2
- package/dist/bridge/share-button.mjs +12 -2
- package/dist/bridge/template-layout.js +1 -1
- package/dist/bridge/template-layout.mjs +1 -1
- package/dist/dashboard/answer-rows.js +77 -0
- package/dist/dashboard/answer-rows.mjs +41 -0
- package/dist/dashboard/card-campaign-switch.js +55 -43
- package/dist/dashboard/card-campaign-switch.mjs +56 -44
- package/dist/dashboard/card-order.js +248 -120
- package/dist/dashboard/card-order.mjs +248 -120
- package/dist/dashboard/connection-workflows.js +13 -4
- package/dist/dashboard/connection-workflows.mjs +13 -4
- package/dist/dashboard/form-organization-campaign-field-list.js +8 -49
- package/dist/dashboard/form-organization-campaign-field-list.mjs +8 -49
- package/dist/dashboard/form-organization-campaign-field-select.js +51 -5
- package/dist/dashboard/form-organization-campaign-field-select.mjs +51 -5
- package/dist/dashboard/form-organization-campaign-field-textarea.js +46 -8
- package/dist/dashboard/form-organization-campaign-field-textarea.mjs +46 -8
- package/dist/dashboard/form-organization-campaign-section.js +24 -4
- package/dist/dashboard/form-organization-campaign-section.mjs +24 -4
- package/dist/dashboard/form-organization-workflow.js +195 -56
- package/dist/dashboard/form-organization-workflow.mjs +191 -57
- package/dist/dashboard/item-row.js +92 -0
- package/dist/dashboard/item-row.mjs +63 -0
- package/dist/dashboard/lib/sms.js +3 -0
- package/dist/dashboard/lib/sms.mjs +2 -0
- package/dist/dashboard/order-sections.js +220 -0
- package/dist/dashboard/order-sections.mjs +185 -0
- package/dist/dashboard/preview.js +29 -2
- package/dist/dashboard/preview.mjs +28 -2
- package/dist/input-code.js +35 -53
- package/dist/input-code.mjs +26 -54
- package/dist/shared/button.js +1 -1
- package/dist/shared/button.mjs +1 -1
- package/dist/shared/lib/campaign.js +9 -3
- package/dist/shared/lib/campaign.mjs +7 -2
- package/dist/shared/lib/helpers.js +7 -0
- package/dist/shared/lib/helpers.mjs +7 -0
- package/package.json +19 -4
- package/types/bridge/form-subdomain-missions.d.ts +3 -1
- package/types/bridge/lib/url.d.ts +5 -4
- package/types/dashboard/answer-rows.d.ts +30 -0
- package/types/dashboard/card-order.d.ts +18 -3
- package/types/dashboard/form-organization-campaign-section.d.ts +2 -0
- package/types/dashboard/form-organization-workflow.d.ts +15 -0
- package/types/dashboard/item-row.d.ts +25 -0
- package/types/dashboard/order-sections.d.ts +36 -0
- package/types/shared/lib/helpers.d.ts +1 -1
package/dist/input-code.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx
|
|
3
|
-
import
|
|
4
|
-
import { inputStyle } from "./styles.mjs";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import InputText from "./input-text.mjs";
|
|
5
4
|
const codeDigits = (value, length = 6) => String(value ?? "").replace(/\D/g, "").slice(0, length);
|
|
6
5
|
const InputCode = ({
|
|
7
6
|
autoFocus,
|
|
@@ -14,60 +13,33 @@ const InputCode = ({
|
|
|
14
13
|
style,
|
|
15
14
|
value
|
|
16
15
|
}) => {
|
|
17
|
-
const [focused, setFocused] = useState(false);
|
|
18
16
|
const digits = codeDigits(value, length);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return /* @__PURE__ */ jsxs(
|
|
22
|
-
"div",
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
InputText,
|
|
23
19
|
{
|
|
24
20
|
...{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"aria-label": "Verification code"
|
|
48
|
-
},
|
|
49
|
-
autoComplete: "one-time-code",
|
|
50
|
-
autoFocus,
|
|
51
|
-
className: "absolute inset-0 w-full h-full opacity-0 cursor-text",
|
|
52
|
-
disabled,
|
|
53
|
-
id,
|
|
54
|
-
inputMode: "numeric",
|
|
55
|
-
maxLength: length,
|
|
56
|
-
name,
|
|
57
|
-
onBlur: () => setFocused(false),
|
|
58
|
-
onChange: ({ target }) => {
|
|
59
|
-
const next = codeDigits(target.value, length);
|
|
60
|
-
onChange == null ? void 0 : onChange(next);
|
|
61
|
-
if (next.length === length && next !== digits) onComplete == null ? void 0 : onComplete(next);
|
|
62
|
-
},
|
|
63
|
-
onFocus: () => setFocused(true),
|
|
64
|
-
pattern: "[0-9]*",
|
|
65
|
-
type: "text",
|
|
66
|
-
value: digits
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
)
|
|
70
|
-
]
|
|
21
|
+
// An `id` means a <label htmlFor> names it ( InputGroup's ); only a
|
|
22
|
+
// bare field names itself.
|
|
23
|
+
...!id && {
|
|
24
|
+
"aria-label": "Verification code"
|
|
25
|
+
},
|
|
26
|
+
autoComplete: "one-time-code",
|
|
27
|
+
autoFocus,
|
|
28
|
+
disabled,
|
|
29
|
+
id,
|
|
30
|
+
inputMode: "numeric",
|
|
31
|
+
maxLength: length,
|
|
32
|
+
name,
|
|
33
|
+
onChange: (text) => {
|
|
34
|
+
const next = codeDigits(text, length);
|
|
35
|
+
onChange == null ? void 0 : onChange(next);
|
|
36
|
+
if (next.length === length && next !== digits) onComplete == null ? void 0 : onComplete(next);
|
|
37
|
+
},
|
|
38
|
+
pattern: "[0-9]*",
|
|
39
|
+
style,
|
|
40
|
+
type: "text",
|
|
41
|
+
value: digits
|
|
42
|
+
}
|
|
71
43
|
}
|
|
72
44
|
);
|
|
73
45
|
};
|
package/dist/shared/button.js
CHANGED
|
@@ -68,7 +68,7 @@ const Button = (0, import_react.forwardRef)(({
|
|
|
68
68
|
if (size === "small") classes.push("small");
|
|
69
69
|
if (Icon && !labelled) classes.push("icon");
|
|
70
70
|
const text = typeof children === "string" || typeof children === "number";
|
|
71
|
-
if (inline) classes.push(variant !== "link" || style ? "w-fit" : text && !Icon ? "inline" : "inline-flex w-fit");
|
|
71
|
+
if (inline) classes.push(variant !== "link" || style ? "w-fit" : text && !Icon ? "inline w-fit" : "inline-flex w-fit");
|
|
72
72
|
if (justify === "start") classes.push("justify-start");
|
|
73
73
|
if (justify === "end") classes.push("justify-end");
|
|
74
74
|
if (justify === "between" && Icon && labelled) classes.push("justify-between");
|
package/dist/shared/button.mjs
CHANGED
|
@@ -36,7 +36,7 @@ const Button = forwardRef(({
|
|
|
36
36
|
if (size === "small") classes.push("small");
|
|
37
37
|
if (Icon && !labelled) classes.push("icon");
|
|
38
38
|
const text = typeof children === "string" || typeof children === "number";
|
|
39
|
-
if (inline) classes.push(variant !== "link" || style ? "w-fit" : text && !Icon ? "inline" : "inline-flex w-fit");
|
|
39
|
+
if (inline) classes.push(variant !== "link" || style ? "w-fit" : text && !Icon ? "inline w-fit" : "inline-flex w-fit");
|
|
40
40
|
if (justify === "start") classes.push("justify-start");
|
|
41
41
|
if (justify === "end") classes.push("justify-end");
|
|
42
42
|
if (justify === "between" && Icon && labelled) classes.push("justify-between");
|
|
@@ -20,7 +20,8 @@ __export(campaign_exports, {
|
|
|
20
20
|
awardingCard: () => awardingCard,
|
|
21
21
|
campaignSwitch: () => campaignSwitch,
|
|
22
22
|
campaignSwitches: () => campaignSwitches,
|
|
23
|
-
leadCapture: () => leadCapture
|
|
23
|
+
leadCapture: () => leadCapture,
|
|
24
|
+
switchLock: () => switchLock
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(campaign_exports);
|
|
26
27
|
const campaignSwitches = (current, key, on) => {
|
|
@@ -47,7 +48,10 @@ const campaignSwitch = (campaign, key, on) => {
|
|
|
47
48
|
],
|
|
48
49
|
giveaway: on ? [
|
|
49
50
|
"Turn on the giveaway?",
|
|
50
|
-
|
|
51
|
+
// @story campaigns/giveaway-module
|
|
52
|
+
// The giveaway wins over an order form ( the api's `ordering` ), and
|
|
53
|
+
// says so (Darren, 2026-11-03).
|
|
54
|
+
"Entries are awarded while a range in your schedule is running." + (form ? "" : " The form turns on too, because entries come from the form.") + ((campaign == null ? void 0 : campaign.ordering) ? " Giveaways can't run with an order form, so the form stops taking orders. Your order and its fields are kept." : "")
|
|
51
55
|
] : [
|
|
52
56
|
"Turn off the giveaway?",
|
|
53
57
|
"Entries stop being awarded. Prizes, schedule, missions and draws are kept, and come back when you turn it on."
|
|
@@ -63,6 +67,7 @@ const campaignSwitch = (campaign, key, on) => {
|
|
|
63
67
|
title: copy[0]
|
|
64
68
|
};
|
|
65
69
|
};
|
|
70
|
+
const switchLock = (campaign, key, disabled) => disabled ? "You need Manage on Campaigns to change this" : null;
|
|
66
71
|
const leadCapture = (campaign) => {
|
|
67
72
|
var _a, _b;
|
|
68
73
|
if (!((_a = campaign == null ? void 0 : campaign.form) == null ? void 0 : _a.enabled)) return "Off";
|
|
@@ -113,5 +118,6 @@ const awardingCard = (campaign, page = "overview") => {
|
|
|
113
118
|
awardingCard,
|
|
114
119
|
campaignSwitch,
|
|
115
120
|
campaignSwitches,
|
|
116
|
-
leadCapture
|
|
121
|
+
leadCapture,
|
|
122
|
+
switchLock
|
|
117
123
|
});
|
|
@@ -22,7 +22,10 @@ const campaignSwitch = (campaign, key, on) => {
|
|
|
22
22
|
],
|
|
23
23
|
giveaway: on ? [
|
|
24
24
|
"Turn on the giveaway?",
|
|
25
|
-
|
|
25
|
+
// @story campaigns/giveaway-module
|
|
26
|
+
// The giveaway wins over an order form ( the api's `ordering` ), and
|
|
27
|
+
// says so (Darren, 2026-11-03).
|
|
28
|
+
"Entries are awarded while a range in your schedule is running." + (form ? "" : " The form turns on too, because entries come from the form.") + ((campaign == null ? void 0 : campaign.ordering) ? " Giveaways can't run with an order form, so the form stops taking orders. Your order and its fields are kept." : "")
|
|
26
29
|
] : [
|
|
27
30
|
"Turn off the giveaway?",
|
|
28
31
|
"Entries stop being awarded. Prizes, schedule, missions and draws are kept, and come back when you turn it on."
|
|
@@ -38,6 +41,7 @@ const campaignSwitch = (campaign, key, on) => {
|
|
|
38
41
|
title: copy[0]
|
|
39
42
|
};
|
|
40
43
|
};
|
|
44
|
+
const switchLock = (campaign, key, disabled) => disabled ? "You need Manage on Campaigns to change this" : null;
|
|
41
45
|
const leadCapture = (campaign) => {
|
|
42
46
|
var _a, _b;
|
|
43
47
|
if (!((_a = campaign == null ? void 0 : campaign.form) == null ? void 0 : _a.enabled)) return "Off";
|
|
@@ -87,5 +91,6 @@ export {
|
|
|
87
91
|
awardingCard,
|
|
88
92
|
campaignSwitch,
|
|
89
93
|
campaignSwitches,
|
|
90
|
-
leadCapture
|
|
94
|
+
leadCapture,
|
|
95
|
+
switchLock
|
|
91
96
|
};
|
|
@@ -321,6 +321,13 @@ const statuses = {
|
|
|
321
321
|
member: {
|
|
322
322
|
pending: { text: "Invited", type: "warning" }
|
|
323
323
|
},
|
|
324
|
+
// @story campaigns/manage-order
|
|
325
|
+
// A form order's badge beside its customer on Orders: only a closed order
|
|
326
|
+
// shows one, Canceled red as a canceled subscription is.
|
|
327
|
+
order: {
|
|
328
|
+
canceled: { text: "Canceled", type: "error" },
|
|
329
|
+
completed: { text: "Completed", type: "success" }
|
|
330
|
+
},
|
|
324
331
|
organization: Object.fromEntries(organizationStatuses.map((status) => [status, { text: (0, import_drawbridge_utils.capitalize)(status.replace("_", " ")), type: ["active", "unsubscribed"].includes(status) ? "success" : status === "paused" ? "warning" : "error" }])),
|
|
325
332
|
page: published,
|
|
326
333
|
prize: published,
|
|
@@ -261,6 +261,13 @@ const statuses = {
|
|
|
261
261
|
member: {
|
|
262
262
|
pending: { text: "Invited", type: "warning" }
|
|
263
263
|
},
|
|
264
|
+
// @story campaigns/manage-order
|
|
265
|
+
// A form order's badge beside its customer on Orders: only a closed order
|
|
266
|
+
// shows one, Canceled red as a canceled subscription is.
|
|
267
|
+
order: {
|
|
268
|
+
canceled: { text: "Canceled", type: "error" },
|
|
269
|
+
completed: { text: "Completed", type: "success" }
|
|
270
|
+
},
|
|
264
271
|
organization: Object.fromEntries(organizationStatuses.map((status) => [status, { text: capitalize(status.replace("_", " ")), type: ["active", "unsubscribed"].includes(status) ? "success" : status === "paused" ? "warning" : "error" }])),
|
|
265
272
|
page: published,
|
|
266
273
|
prize: published,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drawbridge/components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"exports": {
|
|
5
5
|
"./advertisement": {
|
|
6
6
|
"types": "./types/advertisement.d.ts",
|
|
@@ -172,6 +172,11 @@
|
|
|
172
172
|
"import": "./dist/dashboard/accordion.mjs",
|
|
173
173
|
"default": "./dist/dashboard/accordion.js"
|
|
174
174
|
},
|
|
175
|
+
"./dashboard/answer-rows": {
|
|
176
|
+
"types": "./types/dashboard/answer-rows.d.ts",
|
|
177
|
+
"import": "./dist/dashboard/answer-rows.mjs",
|
|
178
|
+
"default": "./dist/dashboard/answer-rows.js"
|
|
179
|
+
},
|
|
175
180
|
"./dashboard/avatar": {
|
|
176
181
|
"types": "./types/dashboard/avatar.d.ts",
|
|
177
182
|
"import": "./dist/dashboard/avatar.mjs",
|
|
@@ -747,6 +752,11 @@
|
|
|
747
752
|
"import": "./dist/dashboard/input-time.mjs",
|
|
748
753
|
"default": "./dist/dashboard/input-time.js"
|
|
749
754
|
},
|
|
755
|
+
"./dashboard/item-row": {
|
|
756
|
+
"types": "./types/dashboard/item-row.d.ts",
|
|
757
|
+
"import": "./dist/dashboard/item-row.mjs",
|
|
758
|
+
"default": "./dist/dashboard/item-row.js"
|
|
759
|
+
},
|
|
750
760
|
"./dashboard/lib/confetti": {
|
|
751
761
|
"types": "./types/dashboard/lib/confetti.d.ts",
|
|
752
762
|
"import": "./dist/dashboard/lib/confetti.mjs",
|
|
@@ -882,6 +892,11 @@
|
|
|
882
892
|
"import": "./dist/dashboard/notice.mjs",
|
|
883
893
|
"default": "./dist/dashboard/notice.js"
|
|
884
894
|
},
|
|
895
|
+
"./dashboard/order-sections": {
|
|
896
|
+
"types": "./types/dashboard/order-sections.d.ts",
|
|
897
|
+
"import": "./dist/dashboard/order-sections.mjs",
|
|
898
|
+
"default": "./dist/dashboard/order-sections.js"
|
|
899
|
+
},
|
|
885
900
|
"./dashboard/paged": {
|
|
886
901
|
"types": "./types/dashboard/paged.d.ts",
|
|
887
902
|
"import": "./dist/dashboard/paged.mjs",
|
|
@@ -1648,7 +1663,7 @@
|
|
|
1648
1663
|
"peerDependencies": {
|
|
1649
1664
|
"@analytics/google-tag-manager": ">=0.5.5",
|
|
1650
1665
|
"@drawbridge/drawbridge-telemetry": ">=0.0.19",
|
|
1651
|
-
"@drawbridge/drawbridge-utils": ">=0.0.
|
|
1666
|
+
"@drawbridge/drawbridge-utils": ">=0.0.228",
|
|
1652
1667
|
"@headlessui/react": ">=2.1.2",
|
|
1653
1668
|
"@hookform/resolvers": ">=3.1.1",
|
|
1654
1669
|
"@sentry/nextjs": ">=10.58.0",
|
|
@@ -1766,9 +1781,9 @@
|
|
|
1766
1781
|
},
|
|
1767
1782
|
"devDependencies": {
|
|
1768
1783
|
"@analytics/google-tag-manager": "0.5.5",
|
|
1769
|
-
"@drawbridge/drawbridge-agents": "0.1.
|
|
1784
|
+
"@drawbridge/drawbridge-agents": "0.1.102",
|
|
1770
1785
|
"@drawbridge/drawbridge-telemetry": "0.0.19",
|
|
1771
|
-
"@drawbridge/drawbridge-utils": "0.0.
|
|
1786
|
+
"@drawbridge/drawbridge-utils": "0.0.227",
|
|
1772
1787
|
"@headlessui/react": "2.2.9",
|
|
1773
1788
|
"@hookform/resolvers": "3.1.1",
|
|
1774
1789
|
"@sentry/nextjs": "10.58.0",
|
|
@@ -28,8 +28,10 @@ export interface FormSubdomainMissionsProps {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export declare const screenFor: ( type: string ) => 'send' | 'share' | 'missions';
|
|
31
|
-
export declare const openingScreen: ( items?: MissionItem[], type?: string | null ) => 'send' | 'share' | '
|
|
31
|
+
export declare const openingScreen: ( items?: MissionItem[], type?: string | null ) => 'missions' | 'send' | 'share' | 'start';
|
|
32
32
|
export declare const pillText: ( item: MissionItem, completed: boolean ) => string;
|
|
33
|
+
// Bonus entries available's pill: the open entries, "+" while Share is open; null when none.
|
|
34
|
+
export declare const bonusText: ( items?: MissionItem[], completed?: string[] ) => string | null;
|
|
33
35
|
|
|
34
36
|
export declare const FormSubdomainMissions: ComponentType<FormSubdomainMissionsProps>;
|
|
35
37
|
|
|
@@ -20,10 +20,10 @@ export declare const submissionEndpoint: ( props: {
|
|
|
20
20
|
token?: string;
|
|
21
21
|
} ) => string | null;
|
|
22
22
|
|
|
23
|
-
// Where a lead's own link (`?
|
|
24
|
-
// when `
|
|
23
|
+
// Where a lead's own link (`?m=<code>`) asks for their entries, or null
|
|
24
|
+
// when `code` is not a missions code. `token` is the owner's preview token.
|
|
25
25
|
export declare const leadEndpoint: ( props: {
|
|
26
|
-
|
|
26
|
+
code: string | null | undefined;
|
|
27
27
|
slug: string;
|
|
28
28
|
subdomain: string;
|
|
29
29
|
token?: string | null;
|
|
@@ -31,7 +31,8 @@ export declare const leadEndpoint: ( props: {
|
|
|
31
31
|
|
|
32
32
|
// Where the missions panel takes a mission's action: one route for every
|
|
33
33
|
// mission, the action one its completion declares (a code mission sends and
|
|
34
|
-
// confirms). The lead's
|
|
34
|
+
// confirms). The lead's missions code goes in the request body as `token`,
|
|
35
|
+
// not the path.
|
|
35
36
|
export declare const missionEndpoint: ( props: {
|
|
36
37
|
action: string;
|
|
37
38
|
slug: string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface AnswerField {
|
|
4
|
+
deleted?: boolean;
|
|
5
|
+
id: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
slug?: string;
|
|
8
|
+
type?: 'additional' | 'lead' | 'order' | string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface Answer {
|
|
12
|
+
reference: string;
|
|
13
|
+
value?: unknown;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface AnswerRow {
|
|
17
|
+
label?: string;
|
|
18
|
+
value: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export declare const blank: ( value: unknown ) => boolean;
|
|
22
|
+
|
|
23
|
+
// An answer as it reads: an em dash for none, an object's values joined.
|
|
24
|
+
export declare const display: ( value: unknown ) => string;
|
|
25
|
+
|
|
26
|
+
// A removed field's answer: struck through, with a small Removed badge.
|
|
27
|
+
export declare const Removed: ComponentType<{ children?: ReactNode }>;
|
|
28
|
+
|
|
29
|
+
// One type of field's rows, in the Form page's order; a removed field only where it was answered.
|
|
30
|
+
export declare const answerRows: ( fields?: AnswerField[], answers?: Answer[] ) => ( type: string ) => AnswerRow[];
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { ComponentType } from 'react';
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import { Answer, AnswerField } from './answer-rows';
|
|
3
|
+
import { ItemRowFile } from './item-row';
|
|
2
4
|
|
|
3
5
|
export interface CardOrderLine {
|
|
6
|
+
// A form line's item file, or a store line's product image url.
|
|
7
|
+
image?: ItemRowFile | string | null;
|
|
4
8
|
price?: number;
|
|
5
9
|
quantity?: number;
|
|
6
10
|
title?: string;
|
|
@@ -17,9 +21,17 @@ export interface CardOrderProvider {
|
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
export interface CardOrderProps {
|
|
24
|
+
// A form order's submission answers.
|
|
25
|
+
answers?: Answer[];
|
|
26
|
+
// A form order: drawn under its Status row ( the page's Fulfillment section ).
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
// A form order: drawn at the Status row's right ( the page's three dots ).
|
|
29
|
+
cta?: ReactNode;
|
|
20
30
|
// ISO code, lower or upper case; defaults to usd.
|
|
21
31
|
currency?: string;
|
|
22
32
|
fee?: number;
|
|
33
|
+
// A form order: the campaign's fields, removed ones included.
|
|
34
|
+
fields?: AnswerField[];
|
|
23
35
|
gross?: number;
|
|
24
36
|
lines?: CardOrderLine[];
|
|
25
37
|
net?: number;
|
|
@@ -27,8 +39,11 @@ export interface CardOrderProps {
|
|
|
27
39
|
purchasedAt?: string | number | Date;
|
|
28
40
|
// Fee rate in percent; not shown for a redemption.
|
|
29
41
|
rate?: number | null;
|
|
30
|
-
//
|
|
31
|
-
|
|
42
|
+
// A form order's status.
|
|
43
|
+
status?: 'canceled' | 'completed' | 'open' | string;
|
|
44
|
+
// Picks the attribution sentence; anything but 'redemption' reads as a campaign
|
|
45
|
+
// order. 'form' shows a form order: its status, items and answers.
|
|
46
|
+
type?: 'conversion' | 'form' | 'redemption' | string;
|
|
32
47
|
}
|
|
33
48
|
|
|
34
49
|
declare const CardOrder: ComponentType<CardOrderProps>;
|
|
@@ -6,6 +6,8 @@ export interface FormOrganizationCampaignSectionValues {
|
|
|
6
6
|
description?: string | null;
|
|
7
7
|
// Your order's Take orders.
|
|
8
8
|
enabled?: boolean;
|
|
9
|
+
// Your order: whether the campaign's giveaway is on, which locks Take orders.
|
|
10
|
+
giveaway?: boolean;
|
|
9
11
|
id: 'information' | 'order';
|
|
10
12
|
organization: string;
|
|
11
13
|
// Your order's Show prices.
|
|
@@ -2,7 +2,11 @@ import { ComponentType } from 'react';
|
|
|
2
2
|
|
|
3
3
|
// A step as the api stores it.
|
|
4
4
|
export interface FormOrganizationWorkflowStep {
|
|
5
|
+
// The System email: always on, never removed ( the api keeps it ).
|
|
6
|
+
confirmation?: boolean;
|
|
5
7
|
connectionId?: string;
|
|
8
|
+
// The step's own switch; absent reads on.
|
|
9
|
+
enabled?: boolean;
|
|
6
10
|
settings?: {
|
|
7
11
|
discount?: { id: string; title?: string; [ key: string ]: unknown } | null;
|
|
8
12
|
// Member ids; the owner is always a recipient and is never stored.
|
|
@@ -22,8 +26,10 @@ export interface FormOrganizationWorkflowStep {
|
|
|
22
26
|
|
|
23
27
|
// The row shape the editor seeds each step with.
|
|
24
28
|
export interface FormOrganizationWorkflowRow {
|
|
29
|
+
confirmation: boolean;
|
|
25
30
|
connectionId: string;
|
|
26
31
|
discount: Record<string, unknown> | null;
|
|
32
|
+
enabled: boolean;
|
|
27
33
|
members: Record<string, unknown>[];
|
|
28
34
|
message: string;
|
|
29
35
|
score: Record<string, unknown> | null;
|
|
@@ -102,3 +108,12 @@ export declare const prefillRow: ( options: { entry?: WorkflowCatalogEntry | nul
|
|
|
102
108
|
// "Needs a phone field" when the campaign's form cannot feed a step of `type`,
|
|
103
109
|
// from the catalog entry or the saved steps; null when the step can run.
|
|
104
110
|
export declare const stepReason: ( options: { entry?: WorkflowCatalogEntry | null; saved?: Array<{ reason?: string; type?: string; [ key: string ]: unknown }>; type?: string } ) => string | null;
|
|
111
|
+
|
|
112
|
+
// The sample lead every step preview draws from.
|
|
113
|
+
export declare const SAMPLE: { email: string; name: string; order: string; phone: string };
|
|
114
|
+
// The JSON a Send webhook posts, for the sample lead.
|
|
115
|
+
export declare const webhookSample: ( args: { campaign?: { id?: string; title?: string } | null } ) => string;
|
|
116
|
+
// A text as a phone shows it: who it is from, then the bubble holding `children`.
|
|
117
|
+
export declare const TextPreview: ComponentType<{ children?: import( 'react' ).ReactNode; from?: string | null }>;
|
|
118
|
+
// The team email's title and lines, for a new entry or an order.
|
|
119
|
+
export declare const teamSample: ( args: { campaign?: { title?: string } | null; event?: string; organization?: { title?: string } | null } ) => { lines: string[]; title: string };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ItemRowFile {
|
|
4
|
+
filename?: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
mimetype?: string;
|
|
7
|
+
sizes?: Record<string, string>;
|
|
8
|
+
updatedAt?: string | number | Date;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ItemRowProps {
|
|
12
|
+
// The image's alt text; falls back to the file's name, then the item's name.
|
|
13
|
+
description?: string | null;
|
|
14
|
+
// A sortable list's drag handle, drawn first.
|
|
15
|
+
handle?: ReactNode;
|
|
16
|
+
// An uploaded file, or a store's image url; a grey square without one.
|
|
17
|
+
image?: ItemRowFile | string | null;
|
|
18
|
+
name?: ReactNode;
|
|
19
|
+
// The grey line under the name.
|
|
20
|
+
summary?: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare const ItemRow: ComponentType<ItemRowProps>;
|
|
24
|
+
|
|
25
|
+
export default ItemRow;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ConfirmOptions {
|
|
4
|
+
// The dialog's title and its button.
|
|
5
|
+
action: string;
|
|
6
|
+
body?: Record<string, unknown>;
|
|
7
|
+
endpoint: string;
|
|
8
|
+
// The one sentence saying what happens.
|
|
9
|
+
message?: string;
|
|
10
|
+
method?: 'DELETE' | 'POST' | 'PUT';
|
|
11
|
+
onSuccess?: ( response: unknown ) => void;
|
|
12
|
+
// Why the action is blocked: shown as a warning, the button disabled.
|
|
13
|
+
task?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export declare const useConfirm: () => ( options: ConfirmOptions ) => void;
|
|
17
|
+
|
|
18
|
+
export interface FulfillmentOrder {
|
|
19
|
+
fulfillment?: { status?: 'fulfilled' | 'unfulfilled' | string } | null;
|
|
20
|
+
id?: string;
|
|
21
|
+
status?: 'canceled' | 'completed' | 'open' | string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export declare const fulfillmentControls: ( options: { manage?: boolean; order?: FulfillmentOrder | null } ) => { add: boolean; cancel: boolean };
|
|
25
|
+
|
|
26
|
+
export interface OrderFulfillmentProps {
|
|
27
|
+
// The organization's order: /organization/:organization/order/:order.
|
|
28
|
+
endpoint: string;
|
|
29
|
+
// Manage access to Leads.
|
|
30
|
+
manage?: boolean;
|
|
31
|
+
// Gets the saved order after a confirmed change.
|
|
32
|
+
onSuccess?: ( response: unknown ) => void;
|
|
33
|
+
order: FulfillmentOrder;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export declare const OrderFulfillment: ComponentType<OrderFulfillmentProps>;
|
|
@@ -127,7 +127,7 @@ export declare const usageBadge: ( allowance: Allowance | null | undefined ) =>
|
|
|
127
127
|
// @story admin/organizations-list
|
|
128
128
|
export declare const acceptingBadge: ( accepting: Accepting | null | undefined ) => Badge | null;
|
|
129
129
|
|
|
130
|
-
export type StatusKind = 'advertisement' | 'campaign' | 'connection' | 'draw' | 'invoice' | 'member' | 'organization' | 'page' | 'prize' | 'range' | 'subscription' | 'workflow';
|
|
130
|
+
export type StatusKind = 'advertisement' | 'campaign' | 'connection' | 'draw' | 'invoice' | 'member' | 'order' | 'organization' | 'page' | 'prize' | 'range' | 'subscription' | 'workflow';
|
|
131
131
|
|
|
132
132
|
// The badge beside a table title: each kind says which of its statuses get one; null for the rest.
|
|
133
133
|
export declare const statusBadge: ( kind: StatusKind, status: string | null | undefined ) => Badge | null;
|