@drawbridge/components 0.1.14 → 0.1.15

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.
Files changed (27) hide show
  1. package/dist/bridge/form-subdomain-missions.js +77 -38
  2. package/dist/bridge/form-subdomain-missions.mjs +76 -38
  3. package/dist/dashboard/card-campaign-switch.js +55 -43
  4. package/dist/dashboard/card-campaign-switch.mjs +56 -44
  5. package/dist/dashboard/card-order.js +216 -31
  6. package/dist/dashboard/card-order.mjs +216 -31
  7. package/dist/dashboard/connection-workflows.js +13 -4
  8. package/dist/dashboard/connection-workflows.mjs +13 -4
  9. package/dist/dashboard/form-organization-campaign-field-select.js +51 -5
  10. package/dist/dashboard/form-organization-campaign-field-select.mjs +51 -5
  11. package/dist/dashboard/form-organization-campaign-field-textarea.js +46 -8
  12. package/dist/dashboard/form-organization-campaign-field-textarea.mjs +46 -8
  13. package/dist/dashboard/form-organization-campaign-section.js +24 -4
  14. package/dist/dashboard/form-organization-campaign-section.mjs +24 -4
  15. package/dist/dashboard/form-organization-workflow.js +222 -33
  16. package/dist/dashboard/form-organization-workflow.mjs +219 -33
  17. package/dist/input-code.js +35 -53
  18. package/dist/input-code.mjs +26 -54
  19. package/dist/shared/button.js +1 -1
  20. package/dist/shared/button.mjs +1 -1
  21. package/dist/shared/lib/campaign.js +9 -3
  22. package/dist/shared/lib/campaign.mjs +7 -2
  23. package/package.json +1 -1
  24. package/types/bridge/form-subdomain-missions.d.ts +3 -1
  25. package/types/dashboard/card-order.d.ts +15 -2
  26. package/types/dashboard/form-organization-campaign-section.d.ts +2 -0
  27. package/types/dashboard/form-organization-workflow.d.ts +13 -0
@@ -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");
@@ -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
- "Entries are awarded while a range in your schedule is running." + (form ? "" : " The form turns on too, because entries come from the form.")
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
- "Entries are awarded while a range in your schedule is running." + (form ? "" : " The form turns on too, because entries come from the form.")
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawbridge/components",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "exports": {
5
5
  "./advertisement": {
6
6
  "types": "./types/advertisement.d.ts",
@@ -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' | 'missions';
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
 
@@ -16,19 +16,32 @@ export interface CardOrderProvider {
16
16
  slug?: string;
17
17
  }
18
18
 
19
+ export interface CardOrderCustomer {
20
+ email?: string | null;
21
+ firstName?: string | null;
22
+ lastName?: string | null;
23
+ phone?: string | null;
24
+ }
25
+
19
26
  export interface CardOrderProps {
20
27
  // ISO code, lower or upper case; defaults to usd.
21
28
  currency?: string;
29
+ // A form order's customer, shown in its drawer.
30
+ customer?: CardOrderCustomer | null;
22
31
  fee?: number;
23
32
  gross?: number;
24
33
  lines?: CardOrderLine[];
25
34
  net?: number;
35
+ // A form order's note and pickup.
36
+ note?: string | null;
37
+ pickup?: string | null;
26
38
  provider?: CardOrderProvider;
27
39
  purchasedAt?: string | number | Date;
28
40
  // Fee rate in percent; not shown for a redemption.
29
41
  rate?: number | null;
30
- // Picks the attribution sentence; anything but 'redemption' reads as a campaign order.
31
- type?: 'conversion' | 'redemption' | string;
42
+ // Picks the attribution sentence; anything but 'redemption' reads as a campaign
43
+ // order. 'form' shows a form order: who ordered, pickup, note, no fee.
44
+ type?: 'conversion' | 'form' | 'redemption' | string;
32
45
  }
33
46
 
34
47
  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,10 @@ 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
+ // The team email's title and lines, for a new entry or an order.
117
+ export declare const teamSample: ( args: { campaign?: { title?: string } | null; event?: string; organization?: { title?: string } | null } ) => { lines: string[]; title: string };