@drawbridge/components 0.1.13 → 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 (242) hide show
  1. package/components/styles.css +364 -2
  2. package/dist/advertisement.js +3 -1
  3. package/dist/advertisement.mjs +3 -1
  4. package/dist/bridge/advertisements.js +2 -0
  5. package/dist/bridge/advertisements.mjs +2 -0
  6. package/dist/bridge/countdown.js +2 -1
  7. package/dist/bridge/countdown.mjs +2 -1
  8. package/dist/bridge/form-subdomain-embed.js +18 -20
  9. package/dist/bridge/form-subdomain-embed.mjs +18 -20
  10. package/dist/bridge/form-subdomain-header.js +24 -1
  11. package/dist/bridge/form-subdomain-header.mjs +24 -1
  12. package/dist/bridge/form-subdomain-missions.js +577 -0
  13. package/dist/bridge/form-subdomain-missions.mjs +540 -0
  14. package/dist/bridge/form-subdomain.js +530 -220
  15. package/dist/bridge/form-subdomain.mjs +533 -222
  16. package/dist/bridge/lib/entry.js +59 -0
  17. package/dist/bridge/lib/entry.mjs +29 -0
  18. package/dist/bridge/lib/location.js +38 -0
  19. package/dist/bridge/lib/location.mjs +13 -0
  20. package/dist/bridge/lib/order.js +71 -0
  21. package/dist/bridge/lib/order.mjs +44 -0
  22. package/dist/bridge/lib/url.js +9 -0
  23. package/dist/bridge/lib/url.mjs +7 -0
  24. package/dist/bridge/share-button.js +5 -3
  25. package/dist/bridge/share-button.mjs +5 -3
  26. package/dist/bridge/subdomain-content.js +7 -6
  27. package/dist/bridge/subdomain-content.mjs +7 -6
  28. package/dist/bridge/template-layout.js +59 -21
  29. package/dist/bridge/template-layout.mjs +59 -21
  30. package/dist/bridge/template-modal.js +42 -76
  31. package/dist/bridge/template-modal.mjs +39 -73
  32. package/dist/bridge/template-preview.js +208 -0
  33. package/dist/bridge/template-preview.mjs +173 -0
  34. package/dist/bridge/template-subdomain-gallery.js +6 -2
  35. package/dist/bridge/template-subdomain-gallery.mjs +6 -2
  36. package/dist/bridge/template-subdomain-link.js +6 -1
  37. package/dist/bridge/template-subdomain-link.mjs +6 -1
  38. package/dist/bridge/template-subdomain.js +20 -15
  39. package/dist/bridge/template-subdomain.mjs +20 -15
  40. package/dist/dashboard/accordion.js +74 -39
  41. package/dist/dashboard/accordion.mjs +74 -39
  42. package/dist/dashboard/avatar.js +109 -3
  43. package/dist/dashboard/avatar.mjs +106 -4
  44. package/dist/dashboard/buttons-subscription.js +384 -0
  45. package/dist/dashboard/buttons-subscription.mjs +349 -0
  46. package/dist/dashboard/card-campaign-switch.js +277 -0
  47. package/dist/dashboard/card-campaign-switch.mjs +243 -0
  48. package/dist/dashboard/card-order.js +231 -29
  49. package/dist/dashboard/card-order.mjs +231 -29
  50. package/dist/dashboard/card-section.js +26 -2
  51. package/dist/dashboard/card-section.mjs +26 -2
  52. package/dist/dashboard/card-tile.js +6 -7
  53. package/dist/dashboard/card-tile.mjs +6 -7
  54. package/dist/dashboard/connection-workflows.js +205 -0
  55. package/dist/dashboard/connection-workflows.mjs +171 -0
  56. package/dist/dashboard/device.js +95 -0
  57. package/dist/dashboard/device.mjs +72 -0
  58. package/dist/dashboard/form-admin-campaign.js +19 -50
  59. package/dist/dashboard/form-admin-campaign.mjs +20 -51
  60. package/dist/dashboard/form-ai.js +9 -6
  61. package/dist/dashboard/form-ai.mjs +9 -6
  62. package/dist/dashboard/form-auth.js +35 -25
  63. package/dist/dashboard/form-auth.mjs +36 -26
  64. package/dist/dashboard/form-file.js +10 -1
  65. package/dist/dashboard/form-file.mjs +10 -1
  66. package/dist/dashboard/form-filters-analytics.js +14 -1
  67. package/dist/dashboard/form-filters-analytics.mjs +15 -2
  68. package/dist/dashboard/form-organization-campaign-advertisement.js +15 -1
  69. package/dist/dashboard/form-organization-campaign-advertisement.mjs +16 -2
  70. package/dist/dashboard/form-organization-campaign-agreement.js +215 -164
  71. package/dist/dashboard/form-organization-campaign-agreement.mjs +215 -164
  72. package/dist/dashboard/form-organization-campaign-field-email.js +0 -34
  73. package/dist/dashboard/form-organization-campaign-field-email.mjs +0 -34
  74. package/dist/dashboard/form-organization-campaign-field-list.js +466 -0
  75. package/dist/dashboard/form-organization-campaign-field-list.mjs +437 -0
  76. package/dist/dashboard/form-organization-campaign-field-phone.js +0 -34
  77. package/dist/dashboard/form-organization-campaign-field-phone.mjs +0 -34
  78. package/dist/dashboard/form-organization-campaign-field-remove.js +66 -0
  79. package/dist/dashboard/form-organization-campaign-field-remove.mjs +33 -0
  80. package/dist/dashboard/form-organization-campaign-field-select.js +51 -5
  81. package/dist/dashboard/form-organization-campaign-field-select.mjs +51 -5
  82. package/dist/dashboard/form-organization-campaign-field-textarea.js +46 -8
  83. package/dist/dashboard/form-organization-campaign-field-textarea.mjs +46 -8
  84. package/dist/dashboard/form-organization-campaign-integration-age.js +6 -12
  85. package/dist/dashboard/form-organization-campaign-integration-age.mjs +6 -12
  86. package/dist/dashboard/form-organization-campaign-integration-enable.js +52 -24
  87. package/dist/dashboard/form-organization-campaign-integration-enable.mjs +54 -26
  88. package/dist/dashboard/form-organization-campaign-integration-geocode.js +6 -12
  89. package/dist/dashboard/form-organization-campaign-integration-geocode.mjs +6 -12
  90. package/dist/dashboard/form-organization-campaign-integration-gtm.js +6 -12
  91. package/dist/dashboard/form-organization-campaign-integration-gtm.mjs +6 -12
  92. package/dist/dashboard/form-organization-campaign-link.js +7 -1
  93. package/dist/dashboard/form-organization-campaign-link.mjs +7 -1
  94. package/dist/dashboard/form-organization-campaign-mission.js +291 -0
  95. package/dist/dashboard/form-organization-campaign-mission.mjs +258 -0
  96. package/dist/dashboard/form-organization-campaign-page-embed.js +13 -2
  97. package/dist/dashboard/form-organization-campaign-page-embed.mjs +12 -1
  98. package/dist/dashboard/form-organization-campaign-page.js +20 -11
  99. package/dist/dashboard/form-organization-campaign-page.mjs +20 -11
  100. package/dist/dashboard/form-organization-campaign-prize-edit.js +12 -1
  101. package/dist/dashboard/form-organization-campaign-prize-edit.mjs +12 -1
  102. package/dist/dashboard/form-organization-campaign-section.js +243 -0
  103. package/dist/dashboard/form-organization-campaign-section.mjs +214 -0
  104. package/dist/dashboard/form-organization-campaign.js +114 -469
  105. package/dist/dashboard/form-organization-campaign.mjs +113 -467
  106. package/dist/dashboard/form-organization-export.js +4 -7
  107. package/dist/dashboard/form-organization-export.mjs +4 -7
  108. package/dist/dashboard/form-organization-identity.js +46 -51
  109. package/dist/dashboard/form-organization-identity.mjs +46 -51
  110. package/dist/dashboard/form-organization-workflow.js +708 -687
  111. package/dist/dashboard/form-organization-workflow.mjs +704 -683
  112. package/dist/dashboard/form-organization.js +82 -110
  113. package/dist/dashboard/form-organization.mjs +81 -109
  114. package/dist/dashboard/form-otc.js +4 -5
  115. package/dist/dashboard/form-otc.mjs +4 -5
  116. package/dist/dashboard/form-payment-methods.js +20 -9
  117. package/dist/dashboard/form-payment-methods.mjs +20 -9
  118. package/dist/dashboard/form-stripe.js +30 -0
  119. package/dist/dashboard/form-stripe.mjs +26 -0
  120. package/dist/dashboard/input-array.js +4 -2
  121. package/dist/dashboard/input-array.mjs +4 -2
  122. package/dist/dashboard/input-combobox.js +7 -3
  123. package/dist/dashboard/input-combobox.mjs +7 -3
  124. package/dist/dashboard/input-date.js +7 -0
  125. package/dist/dashboard/input-date.mjs +7 -0
  126. package/dist/dashboard/input-fields.js +80 -20
  127. package/dist/dashboard/input-fields.mjs +80 -20
  128. package/dist/dashboard/input-file.js +21 -1
  129. package/dist/dashboard/input-file.mjs +21 -1
  130. package/dist/dashboard/input-font.js +10 -1
  131. package/dist/dashboard/input-font.mjs +10 -1
  132. package/dist/dashboard/lib/item-list.js +57 -0
  133. package/dist/dashboard/lib/item-list.mjs +33 -0
  134. package/dist/dashboard/lib/menu.js +50 -0
  135. package/dist/dashboard/lib/menu.mjs +26 -0
  136. package/dist/dashboard/locked.js +82 -0
  137. package/dist/dashboard/locked.mjs +53 -0
  138. package/dist/dashboard/menu.js +72 -19
  139. package/dist/dashboard/menu.mjs +72 -19
  140. package/dist/dashboard/note-ai.js +69 -0
  141. package/dist/dashboard/note-ai.mjs +36 -0
  142. package/dist/dashboard/preview.js +419 -0
  143. package/dist/dashboard/preview.mjs +384 -0
  144. package/dist/dashboard/steps.js +39 -13
  145. package/dist/dashboard/steps.mjs +37 -12
  146. package/dist/dashboard/table-contacts.js +136 -0
  147. package/dist/dashboard/table-contacts.mjs +103 -0
  148. package/dist/dashboard/template-not-found.js +4 -2
  149. package/dist/dashboard/template-not-found.mjs +4 -2
  150. package/dist/dashboard/template-socket.js +20 -7
  151. package/dist/dashboard/template-socket.mjs +20 -7
  152. package/dist/icons/desktop.js +46 -0
  153. package/dist/icons/desktop.mjs +27 -0
  154. package/dist/icons/phone.js +46 -0
  155. package/dist/icons/phone.mjs +27 -0
  156. package/dist/icons/puzzle-piece.js +46 -0
  157. package/dist/icons/puzzle-piece.mjs +27 -0
  158. package/dist/icons/tablet.js +46 -0
  159. package/dist/icons/tablet.mjs +27 -0
  160. package/dist/icons/users.js +46 -0
  161. package/dist/icons/users.mjs +27 -0
  162. package/dist/input-checkbox.js +1 -0
  163. package/dist/input-checkbox.mjs +1 -0
  164. package/dist/input-code.js +83 -0
  165. package/dist/input-code.mjs +50 -0
  166. package/dist/input-text.js +2 -1
  167. package/dist/input-text.mjs +2 -1
  168. package/dist/shared/button.js +1 -1
  169. package/dist/shared/button.mjs +1 -1
  170. package/dist/shared/input-checkbox-list.js +0 -1
  171. package/dist/shared/input-checkbox-list.mjs +0 -1
  172. package/dist/shared/input-switch.js +6 -1
  173. package/dist/shared/input-switch.mjs +6 -1
  174. package/dist/shared/lib/campaign.js +123 -0
  175. package/dist/shared/lib/campaign.mjs +96 -0
  176. package/dist/shared/lib/helpers.js +14 -2
  177. package/dist/shared/lib/helpers.mjs +13 -2
  178. package/package.json +133 -13
  179. package/types/bridge/form-subdomain-header.d.ts +2 -0
  180. package/types/bridge/form-subdomain-missions.d.ts +38 -0
  181. package/types/bridge/form-subdomain.d.ts +23 -1
  182. package/types/bridge/lib/entry.d.ts +26 -0
  183. package/types/bridge/lib/location.d.ts +13 -0
  184. package/types/bridge/lib/order.d.ts +30 -0
  185. package/types/bridge/lib/url.d.ts +19 -0
  186. package/types/bridge/template-modal.d.ts +1 -1
  187. package/types/bridge/template-preview.d.ts +10 -0
  188. package/types/bridge/template-subdomain-link.d.ts +2 -0
  189. package/types/dashboard/accordion.d.ts +2 -0
  190. package/types/dashboard/avatar.d.ts +18 -2
  191. package/types/dashboard/buttons-subscription.d.ts +22 -0
  192. package/types/dashboard/card-campaign-switch.d.ts +32 -0
  193. package/types/dashboard/card-order.d.ts +25 -1
  194. package/types/dashboard/card-section.d.ts +2 -0
  195. package/types/dashboard/connection-workflows.d.ts +33 -0
  196. package/types/dashboard/device.d.ts +12 -0
  197. package/types/dashboard/form-admin-campaign.d.ts +3 -2
  198. package/types/dashboard/form-ai.d.ts +2 -2
  199. package/types/dashboard/form-organization-campaign-agreement.d.ts +18 -12
  200. package/types/dashboard/form-organization-campaign-field-email.d.ts +1 -2
  201. package/types/dashboard/form-organization-campaign-field-list.d.ts +36 -0
  202. package/types/dashboard/form-organization-campaign-field-phone.d.ts +1 -2
  203. package/types/dashboard/form-organization-campaign-field-remove.d.ts +22 -0
  204. package/types/dashboard/form-organization-campaign-field-select.d.ts +2 -1
  205. package/types/dashboard/form-organization-campaign-field-textarea.d.ts +2 -1
  206. package/types/dashboard/form-organization-campaign-integration-age.d.ts +3 -3
  207. package/types/dashboard/form-organization-campaign-integration-enable.d.ts +3 -3
  208. package/types/dashboard/form-organization-campaign-mission.d.ts +40 -0
  209. package/types/dashboard/form-organization-campaign-section.d.ts +29 -0
  210. package/types/dashboard/form-organization-campaign.d.ts +27 -17
  211. package/types/dashboard/form-organization-identity.d.ts +2 -0
  212. package/types/dashboard/form-organization-workflow.d.ts +56 -47
  213. package/types/dashboard/form-organization.d.ts +7 -2
  214. package/types/dashboard/form-stripe.d.ts +3 -0
  215. package/types/dashboard/input-combobox.d.ts +2 -0
  216. package/types/dashboard/input-date.d.ts +2 -0
  217. package/types/dashboard/input-fields.d.ts +3 -2
  218. package/types/dashboard/input-file.d.ts +4 -0
  219. package/types/dashboard/lib/item-list.d.ts +14 -0
  220. package/types/dashboard/lib/menu.d.ts +17 -0
  221. package/types/dashboard/locked.d.ts +10 -0
  222. package/types/dashboard/menu.d.ts +10 -2
  223. package/types/dashboard/note-ai.d.ts +15 -0
  224. package/types/dashboard/preview.d.ts +33 -0
  225. package/types/dashboard/steps.d.ts +19 -4
  226. package/types/dashboard/table-cell-title.d.ts +2 -2
  227. package/types/dashboard/table-contacts.d.ts +2 -0
  228. package/types/icons/desktop.d.ts +5 -0
  229. package/types/icons/phone.d.ts +5 -0
  230. package/types/icons/puzzle-piece.d.ts +5 -0
  231. package/types/icons/tablet.d.ts +5 -0
  232. package/types/icons/users.d.ts +5 -0
  233. package/types/input-code.d.ts +23 -0
  234. package/types/shared/input-switch.d.ts +2 -0
  235. package/types/shared/lib/campaign.d.ts +35 -0
  236. package/types/shared/lib/helpers.d.ts +3 -0
  237. package/dist/dashboard/card-integration.js +0 -187
  238. package/dist/dashboard/card-integration.mjs +0 -158
  239. package/dist/dashboard/iframe.js +0 -159
  240. package/dist/dashboard/iframe.mjs +0 -130
  241. package/types/dashboard/card-integration.d.ts +0 -24
  242. package/types/dashboard/iframe.d.ts +0 -18
@@ -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.
@@ -13,15 +17,19 @@ export interface FormOrganizationWorkflowStep {
13
17
  text?: string;
14
18
  url?: string;
15
19
  };
20
+ // The workflow read's "Needs a phone field": the campaign's form lacks the address this step sends to.
21
+ reason?: string;
16
22
  slug?: string;
17
- // 'step.email.notify' | 'step.email.send' | 'step.email.digest' | 'step.commerce.code.issue' | 'step.webhook.send' | ...
23
+ // 'step.email.notify' | 'step.email.send' | 'step.sms.send' | 'step.commerce.code.issue' | 'step.webhook.send' | ...
18
24
  type?: string;
19
25
  }
20
26
 
21
27
  // The row shape the editor seeds each step with.
22
28
  export interface FormOrganizationWorkflowRow {
29
+ confirmation: boolean;
23
30
  connectionId: string;
24
31
  discount: Record<string, unknown> | null;
32
+ enabled: boolean;
25
33
  members: Record<string, unknown>[];
26
34
  message: string;
27
35
  score: Record<string, unknown> | null;
@@ -34,71 +42,53 @@ export interface FormOrganizationWorkflowRow {
34
42
 
35
43
  interface Callbacks {
36
44
  disabled?: boolean;
37
- onClose?: () => void;
38
45
  onError: ( error: unknown ) => void;
39
46
  onSuccess: ( response: unknown ) => void;
40
47
  }
41
48
 
42
- // Quick create: a trigger and a title (POST /organization/:id/workflow).
43
- // Reads GET /organization/:id/workflows/catalog.
44
- export interface FormOrganizationWorkflowProps extends Callbacks {
45
- values?: {
46
- organization?: string;
47
- // A checklist deep link's step type: created with starter settings.
48
- step?: string;
49
- triggerEvent?: string;
50
- };
49
+ // A value a step's message can insert: the trigger's own (`leadLink`) or what
50
+ // an earlier step returns (`shopifyDiscountCode`).
51
+ export interface WorkflowVariable {
52
+ key: string;
53
+ label: string;
54
+ }
55
+
56
+ // One trigger's catalog entry for one campaign, as `catalog` on
57
+ // GET /organization/:id/campaign/:campaign/workflow/:event.
58
+ export interface WorkflowCatalogEntry {
59
+ // `reason` ("Needs a phone field"): the campaign's form lacks the address the step sends to.
60
+ steps?: { connectionId?: string; disabled?: boolean; key?: string; ownerOnly?: boolean; reason?: string; returns?: WorkflowVariable[]; slug?: string; value: string; [ key: string ]: unknown }[];
61
+ title?: string;
62
+ trigger: string;
63
+ type?: string;
64
+ variables?: WorkflowVariable[];
51
65
  }
52
66
 
53
- // The full editor (PUT /organization/:id/workflow/:id). Reads the catalog, the
54
- // accepted members and, for commerce steps, the connection; also needs the
55
- // ['organization', id] query (with owner.email) loaded.
67
+ // One campaign's chain for one trigger, edited on the trigger page
68
+ // (PUT /organization/:id/campaign/:campaign/workflow/:event). Takes the
69
+ // trigger's catalog entry from the page; reads the accepted members and, for
70
+ // commerce steps, the connection; also needs the ['organization', id] query
71
+ // (with owner.email) loaded.
56
72
  export interface FormOrganizationWorkflowEditProps extends Callbacks {
73
+ // The trigger page read's `catalog`: the steps this trigger offers.
74
+ catalog?: WorkflowCatalogEntry | null;
57
75
  values: {
58
- id: string;
76
+ campaign: string;
59
77
  // Sync's run-time issue, shown on the first step of `step`'s type.
60
78
  issue?: { message?: string; step?: string } | null;
61
79
  organization: string;
80
+ // A step type an Overview next step asked for (?step=): added unsaved.
81
+ step?: string | null;
62
82
  steps?: FormOrganizationWorkflowStep[];
63
- title?: string;
64
- trigger?: {
65
- event?: string;
66
- // The picked campaigns: the read hydrates them into documents in pick
67
- // order; empty means every campaign. A pre-Cherry workflow may still
68
- // carry one `campaign` string, which loads as a one-item list.
69
- filters?: {
70
- campaign?: string | { id: string } | null;
71
- campaigns?: ( string | { id: string; [ key: string ]: unknown } )[];
72
- segment?: string | { id: string } | null;
73
- };
83
+ trigger: {
84
+ event: 'lead.insert' | 'lead.delete' | string;
74
85
  };
75
86
  [ key: string ]: unknown;
76
87
  };
77
88
  }
78
89
 
79
- export declare const FormOrganizationWorkflow: ComponentType<FormOrganizationWorkflowProps>;
80
90
  export declare const FormOrganizationWorkflowEdit: ComponentType<FormOrganizationWorkflowEditProps>;
81
91
 
82
- // Reduces a campaign (hydrated document or id) to its id.
83
- export declare const campaignFilterId: ( campaign?: string | { id?: string } | null ) => string | null;
84
-
85
- // The picked campaigns as ids, from `filters.campaigns` (ids or documents) or
86
- // a pre-Cherry `filters.campaign`.
87
- export declare const campaignFilterIds: ( filters?: {
88
- campaign?: string | { id?: string } | null;
89
- campaigns?: ( string | { id?: string } | null )[];
90
- } | null ) => string[];
91
-
92
- // One picker row per id, in the ids' order: its document, or a bare { id }
93
- // while it loads or once it is deleted.
94
- export declare const filterRows: <T extends { id?: string }>( ids: string[], docs: ( T | null | undefined )[] ) => ( T | { id: string } )[];
95
-
96
- // The document among `seeds` (the read's hydrated campaigns) for one id.
97
- export declare const filterSeed: <T extends { id?: string }>( seeds: ( T | string | null )[] | null | undefined, id: string ) => T | undefined;
98
-
99
- // A label read's catch: a 404 resolves { result : null }; anything else throws.
100
- export declare const filterMissing: ( error: unknown ) => { result: null };
101
-
102
92
  // The editor's validation schema (yup).
103
93
  export declare const workflowSchema: {
104
94
  validate: ( value: unknown, options?: Record<string, unknown> ) => Promise<unknown>;
@@ -106,3 +96,22 @@ export declare const workflowSchema: {
106
96
  };
107
97
 
108
98
  export declare const stepRow: ( step?: FormOrganizationWorkflowStep, members?: { id?: string; [ key: string ]: unknown }[] ) => FormOrganizationWorkflowRow;
99
+
100
+ // What step `index`'s message can insert: the trigger's variables, then the
101
+ // returns of every step before it.
102
+ export declare const stepVariables: ( entry: WorkflowCatalogEntry | null | undefined, steps?: { type?: string }[], index?: number ) => WorkflowVariable[];
103
+
104
+ // The row a ?step= deep link adds, or null when the chain has it already or
105
+ // the catalog does not offer it to this member.
106
+ export declare const prefillRow: ( options: { entry?: WorkflowCatalogEntry | null; step?: string | null; steps?: { type?: string }[] } ) => FormOrganizationWorkflowRow | null;
107
+
108
+ // "Needs a phone field" when the campaign's form cannot feed a step of `type`,
109
+ // from the catalog entry or the saved steps; null when the step can run.
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 };
@@ -21,7 +21,12 @@ export interface FormOrganizationSubdomainProps extends Callbacks {
21
21
  values?: { domain?: string; id?: string; shortId?: string; subdomain?: string; [ key: string ]: unknown };
22
22
  }
23
23
 
24
- export interface FormOrganizationBusinessProps extends Callbacks {
24
+ // One fact per form; each PUTs only its own field to /organization/:id/business.
25
+ export interface FormOrganizationBusinessFieldProps extends Callbacks {
26
+ // The fact this form edits.
27
+ name: 'email' | 'name' | 'website';
28
+ // The owner's address, the contact email's starting value while none is saved.
29
+ owner?: string;
25
30
  values?: { business?: { email?: string; name?: string; website?: string }; id?: string };
26
31
  }
27
32
 
@@ -39,7 +44,7 @@ export interface FormOrganizationRevenueProps extends Callbacks {
39
44
  values?: { currency?: string; defaultCurrency?: string; id?: string };
40
45
  }
41
46
 
42
- export declare const FormOrganizationBusiness: ComponentType<FormOrganizationBusinessProps>;
47
+ export declare const FormOrganizationBusinessField: ComponentType<FormOrganizationBusinessFieldProps>;
43
48
  export declare const FormOrganizationDefaults: ComponentType<FormOrganizationDefaultsProps>;
44
49
  export declare const FormOrganizationRevenue: ComponentType<FormOrganizationRevenueProps>;
45
50
  export declare const FormOrganizationSubdomain: ComponentType<FormOrganizationSubdomainProps>;
@@ -15,6 +15,9 @@ export interface FormStripeProps {
15
15
  onSuccess: ( response: unknown ) => void | Promise<void>;
16
16
  }
17
17
 
18
+ // The Add payment method dialog's body: GET /account/intent, then FormStripe.
19
+ export declare const FormStripeIntent: ComponentType<Pick<FormStripeProps, 'onSuccess'>>;
20
+
18
21
  declare const FormStripe: ComponentType<FormStripeProps>;
19
22
 
20
23
  export default FormStripe;
@@ -22,6 +22,8 @@ export interface InputComboboxProps {
22
22
  placeholder?: string;
23
23
  // Typing filters the options.
24
24
  searchable?: boolean;
25
+ // 42 px tall ( the small button's ) with small text, for a toolbar.
26
+ size?: 'small';
25
27
  value?: unknown;
26
28
  }
27
29
 
@@ -21,6 +21,8 @@ export interface InputDateRangeValue {
21
21
 
22
22
  export interface InputDateRangeProps {
23
23
  className?: string;
24
+ // The last day that can be picked, 'YYYY-MM-DD'; the calendar stops at its month.
25
+ max?: string | Date;
24
26
  onChange: ( value: InputDateRangeValue ) => void;
25
27
  value?: InputDateRangeValue;
26
28
  }
@@ -11,7 +11,8 @@ interface Organization { id: string; [ key: string ]: unknown }
11
11
  // yup shape builders the parent form spreads into its schema.
12
12
  export const schemas: {
13
13
  address: () => unknown;
14
- campaign: ( args: { typeEnum: string[] } ) => Record<string, unknown>;
14
+ // Title, and the Form and Giveaway switches.
15
+ campaign: () => Record<string, unknown>;
15
16
  currency: () => Record<string, unknown>;
16
17
  images: () => Record<string, unknown>;
17
18
  page: () => Record<string, unknown>;
@@ -25,7 +26,7 @@ export const InputFieldsAddress: ComponentType<{ showAutocomplete?: boolean }>;
25
26
  // style.heading/body fonts, colours and radii.
26
27
  export const InputFieldsStyle: ComponentType<{ disabled?: boolean; onUpdate?: OnUpdate }>;
27
28
 
28
- // title and type ( options from the cached [ 'app' ] enums ).
29
+ // title, and the Form and Giveaway switches ( one flip keeps the pair consistent ).
29
30
  export const InputFieldsCampaign: ComponentType<{ onUpdate?: ( title: string ) => void }>;
30
31
 
31
32
  // currency ( options from the cached [ 'app' ] enums ).
@@ -13,6 +13,8 @@ export interface InputFileValue {
13
13
 
14
14
  export interface InputFileProps {
15
15
  button?: { icon?: ComponentType<SVGProps<SVGSVGElement>>; text?: ReactNode };
16
+ // This placement's description of the image (its alt text), up to 150 characters.
17
+ description?: string;
16
18
  disabled?: boolean;
17
19
  // Base for the picker's library and upload ( /organization/:id ).
18
20
  endpoint?: string;
@@ -20,6 +22,8 @@ export interface InputFileProps {
20
22
  // false hides the remove button.
21
23
  nullable?: boolean;
22
24
  onChange: ( file: InputFileValue | null ) => void;
25
+ // With it, the row's name becomes an editable Description, the file's name as its placeholder.
26
+ onDescription?: ( description: string ) => void;
23
27
  organization?: { id: string; [ key: string ]: unknown } | string;
24
28
  type?: 'image' | 'media' | 'video' | 'all' | string;
25
29
  value?: InputFileValue | null | '';
@@ -0,0 +1,14 @@
1
+ import { FormOrganizationCampaignFieldListItem } from '../form-organization-campaign-field-list';
2
+
3
+ // "$22.00 CAD · Up to 6 per order": the price while prices are on, then the limit.
4
+ export declare const itemSummary: ( item: Partial<FormOrganizationCampaignFieldListItem> | null | undefined, prices: boolean, currency: string ) => string;
5
+
6
+ // The items as the field routes take them: image ids, explicit nulls.
7
+ export declare const itemsBody: ( items?: Partial<FormOrganizationCampaignFieldListItem>[] ) => Array<{
8
+ attributes: { max: number | null };
9
+ description: string | null;
10
+ id?: string;
11
+ image: string | null;
12
+ name?: string;
13
+ price: number | null;
14
+ }>;
@@ -0,0 +1,17 @@
1
+ import { MenuItem } from '../menu';
2
+
3
+ // Whether a menu entry is the page at `path`: the exact address for an `exact`
4
+ // entry, otherwise the address or anything under it. No href is never active.
5
+ export declare const isActive: ( item: { exact?: boolean; href?: string } | null | undefined, path?: string ) => boolean;
6
+
7
+ // A sidebar row as it draws at `path`: its children with `active`, `open` while
8
+ // the row or a child is active, `highlighted` on the row's own page only, and
9
+ // `error` (the dot) on a closed row when it or any child has one, on an open row
10
+ // only when it has its own.
11
+ export declare const menuRow: ( row?: MenuItem, path?: string ) => MenuItem & {
12
+ active: boolean;
13
+ children: ( MenuItem & { active: boolean } )[];
14
+ error: boolean;
15
+ highlighted: boolean;
16
+ open: boolean;
17
+ };
@@ -0,0 +1,10 @@
1
+ import { ComponentType } from 'react';
2
+
3
+ export interface LockedProps {
4
+ // The api's reason the row can't be removed; nothing renders without one.
5
+ locked?: string | null;
6
+ }
7
+
8
+ declare const Locked: ComponentType<LockedProps>;
9
+
10
+ export default Locked;
@@ -1,17 +1,25 @@
1
1
  import { ComponentType, ElementType, MouseEventHandler, ReactNode } from 'react';
2
2
 
3
- // One row of a GET /menu/* group ( drawbridge-api lib/menus.js ).
3
+ // One row of a GET /menu/* group ( drawbridge-api lib/menus.js ). The
4
+ // organization and campaign menus send dropdown rows ( an icon and the pages
5
+ // under the row as children ); the account and admin menus send flat rows.
4
6
  export interface MenuItem {
5
7
  badge?: { text?: ReactNode; type?: string };
8
+ // The pages under a dropdown row, listed while the row or one of them is
9
+ // open. A page has the row's shape without icon and children.
10
+ children?: MenuItem[];
6
11
  description?: string;
7
12
  disabled?: boolean;
8
13
  element?: ElementType;
9
- // Shows the warning dot.
14
+ // Shows the warning dot. A closed row also shows it when a child has one.
10
15
  error?: boolean;
11
16
  // Active only on an exact path match.
12
17
  exact?: boolean;
13
18
  // Without href the row is inert.
14
19
  href?: string;
20
+ // A dropdown row's icon: chart, document, flag, home, link, queue, share,
21
+ // star or users. An unknown name draws no icon.
22
+ icon?: string;
15
23
  key?: string;
16
24
  locked?: boolean;
17
25
  title: ReactNode;
@@ -0,0 +1,15 @@
1
+ import { ComponentType } from 'react';
2
+
3
+ // True for a loaded balance with no AI credits left; false while it loads.
4
+ export declare const needsCredits: ( balance?: { ai?: number } | null ) => boolean;
5
+
6
+ export interface NoteAIProps {
7
+ // The ['account', 'balance'] query's data.
8
+ balance?: { ai?: number } | null;
9
+ // The drawer's close, for a note inside one.
10
+ onClose?: () => void;
11
+ }
12
+
13
+ declare const NoteAI: ComponentType<NoteAIProps>;
14
+
15
+ export default NoteAI;
@@ -0,0 +1,33 @@
1
+ import { ComponentType, ReactNode } from 'react';
2
+
3
+ export interface PreviewStates {
4
+ onChange: ( value: unknown ) => void;
5
+ options: { key: string; value: unknown }[];
6
+ value: unknown;
7
+ }
8
+
9
+ export interface PreviewProps {
10
+ children?: ReactNode;
11
+ // The screen still loading what it draws: the loader shows in the device instead of the children.
12
+ loading?: boolean;
13
+ // The states dropdown, shown when there is more than one option.
14
+ states?: PreviewStates;
15
+ // The brand the iframe's body is painted in ( background and text colours ).
16
+ style?: Record<string, unknown> | null;
17
+ }
18
+
19
+ export interface PreviewPageProps {
20
+ states?: PreviewStates;
21
+ // Posted to the page as { update } whenever it changes.
22
+ update?: Record<string, unknown>;
23
+ // The share page's absolute address, in preview mode.
24
+ url?: string;
25
+ }
26
+
27
+ export declare const clamp: ( value: number, limit: number ) => number;
28
+ export declare const fitScale: ( space: { height: number; width: number }, size: { height: number; width: number } ) => number;
29
+ export declare const PreviewPage: ComponentType<PreviewPageProps>;
30
+
31
+ declare const Preview: ComponentType<PreviewProps>;
32
+
33
+ export default Preview;
@@ -30,10 +30,25 @@ export interface StepsProps {
30
30
  organization: { id: string; [ key: string ]: unknown };
31
31
  }
32
32
 
33
- // 'Team notification — 4 new entries' for a window; the entrant's email for a run.
34
- export declare const groupTitle: ( group: StepGroup ) => string;
35
- // The step's slug in a run; 'Email sent' / 'Some emails failed' / … in a window.
36
- export declare const rowLabel: ( options: { item?: StepRow; kind?: string } ) => string | undefined;
33
+ // A step type's label, as the app's enums.step.type options carry it.
34
+ export interface StepLabel {
35
+ key: string;
36
+ value: string;
37
+ }
38
+
39
+ // 'Team notification — 4 new entries' for a window; the entrant's email for a
40
+ // run, or its first step's label when no entrant is named.
41
+ export declare const groupTitle: ( group: StepGroup, labels?: StepLabel[] ) => string;
42
+ // The step's label from `labels` ( its slug when none ) in a run; 'Email sent' /
43
+ // 'Some emails failed' / … in a window.
44
+ export declare const rowLabel: ( options: { item?: StepRow; kind?: string; labels?: StepLabel[] } ) => string | undefined;
45
+ // A row's badge ('Skipped' in amber, 'Failed' in red, …) and the sentence shown
46
+ // in place of its request and response: the failure, or the reason it was skipped.
47
+ export declare const rowState: ( row: { error?: string | null; message?: string | null; status?: StepStatus } ) => {
48
+ badge: { text: string; type: string };
49
+ error: string | null;
50
+ notice: string | null;
51
+ };
37
52
 
38
53
  declare const Steps: ComponentType<StepsProps>;
39
54
 
@@ -12,8 +12,8 @@ export interface TableCellTitleProps {
12
12
  error?: { icon?: ComponentType<SVGProps<SVGSVGElement>>; message?: string | null } | string | null;
13
13
  // Drawn in the thumbnail's place when asset has no image ( a link's social glyph ); an image wins.
14
14
  icon?: ComponentType<SVGProps<SVGSVGElement>> | null;
15
- // A campaign's dot when there is no picture, with the words it shows on hover: active
16
- // ('Accepting submissions'), error (published, 'Not accepting submissions'), inactive (draft).
15
+ // A record's dot when there is no picture, with the words it shows on hover. Table
16
+ // recolours it on a generating ( grey, 'Generating' ) or failed ( red ) row.
17
17
  indicator?: { label: string; type: 'active' | 'error' | 'inactive' | 'warning' } | null;
18
18
  // The badge beside the title, as statusBadge returns it.
19
19
  status?: { text: string; type: 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'ai' } | null;
@@ -0,0 +1,2 @@
1
+ // The contacts table's columns, for Table: the Contacts page and a segment's page.
2
+ export declare const contactColumns: Record<string, unknown>[];
@@ -0,0 +1,5 @@
1
+ import { ComponentType, SVGProps } from 'react';
2
+
3
+ declare const Icon: ComponentType<SVGProps<SVGSVGElement>>;
4
+
5
+ export default Icon;
@@ -0,0 +1,5 @@
1
+ import { ComponentType, SVGProps } from 'react';
2
+
3
+ declare const Icon: ComponentType<SVGProps<SVGSVGElement>>;
4
+
5
+ export default Icon;
@@ -0,0 +1,5 @@
1
+ import { ComponentType, SVGProps } from 'react';
2
+
3
+ declare const Icon: ComponentType<SVGProps<SVGSVGElement>>;
4
+
5
+ export default Icon;
@@ -0,0 +1,5 @@
1
+ import { ComponentType, SVGProps } from 'react';
2
+
3
+ declare const Icon: ComponentType<SVGProps<SVGSVGElement>>;
4
+
5
+ export default Icon;
@@ -0,0 +1,5 @@
1
+ import { ComponentType, SVGProps } from 'react';
2
+
3
+ declare const Icon: ComponentType<SVGProps<SVGSVGElement>>;
4
+
5
+ export default Icon;
@@ -0,0 +1,23 @@
1
+ import { ComponentType } from 'react';
2
+ import { BrandStyle } from './styles';
3
+
4
+ export interface InputCodeProps {
5
+ autoFocus?: boolean;
6
+ disabled?: boolean;
7
+ id?: string;
8
+ // How many digits; 6 by default.
9
+ length?: number;
10
+ name?: string;
11
+ // The digits typed so far, never anything but digits.
12
+ onChange?: ( value: string ) => void;
13
+ // Called with the code when its last digit lands.
14
+ onComplete?: ( value: string ) => void;
15
+ style?: BrandStyle;
16
+ value?: string;
17
+ }
18
+
19
+ export declare const codeDigits: ( value: unknown, length?: number ) => string;
20
+
21
+ declare const InputCode: ComponentType<InputCodeProps>;
22
+
23
+ export default InputCode;
@@ -2,6 +2,8 @@ import { ComponentType, ReactNode } from 'react';
2
2
  import { BrandStyle } from '../styles';
3
3
 
4
4
  export interface InputSwitchProps {
5
+ /** Names a switch with no text beside it. */
6
+ 'aria-label'?: string;
5
7
  disabled?: boolean;
6
8
  helper?: ReactNode;
7
9
  onChange?: ( value: boolean ) => void;
@@ -0,0 +1,35 @@
1
+ // The campaign fields these helpers read, as GET /organization/:o/campaign/:c returns them.
2
+ export interface CampaignSwitchesRecord {
3
+ awarding?: boolean;
4
+ awardingErrors?: { message?: string }[];
5
+ form?: { enabled?: boolean } | null;
6
+ giveaway?: { enabled?: boolean } | null;
7
+ range?: { id?: string; title?: string } | null;
8
+ }
9
+
10
+ export type CampaignSwitchKey = 'form' | 'giveaway';
11
+
12
+ export interface CampaignSwitchState {
13
+ form: boolean;
14
+ giveaway: boolean;
15
+ }
16
+
17
+ // The rule between the two switches: giveaway on turns the form on, form off turns the giveaway off.
18
+ export declare const campaignSwitches: ( current: Partial<CampaignSwitchState> | null | undefined, key: CampaignSwitchKey, on: boolean ) => CampaignSwitchState;
19
+
20
+ // The confirmation a flip asks first, and the campaign PUT body it sends.
21
+ export declare const campaignSwitch: ( campaign: CampaignSwitchesRecord | null | undefined, key: CampaignSwitchKey, on: boolean ) => {
22
+ body: Record<string, { enabled: boolean }>;
23
+ message: string;
24
+ title: string;
25
+ };
26
+
27
+ // "Form and Giveaway", "Form" or "Off".
28
+ export declare const leadCapture: ( campaign: CampaignSwitchesRecord | null | undefined ) => 'Form and Giveaway' | 'Form' | 'Off';
29
+
30
+ // The CardTask props for the awarding state while the giveaway is on, or null while it is off.
31
+ export declare const awardingCard: ( campaign: CampaignSwitchesRecord | null | undefined, page?: 'giveaway' | 'overview' ) => {
32
+ message: string;
33
+ title: string;
34
+ type: 'success' | 'warning';
35
+ } | null;
@@ -143,3 +143,6 @@ export declare const alertFor: ( record: { capped?: boolean; error?: string | nu
143
143
  export declare const stripeUrl: ( label: string, id: string, ...more: string[] ) => string;
144
144
 
145
145
  export declare const years: ( props: { current: number | string; length?: number } ) => Array<{ key: number; value: number }>;
146
+
147
+ // An image's alt text: this placement's description, else the file's name.
148
+ export declare const imageAlt: ( file?: { filename?: string } | null, description?: string | null ) => string;