@drawbridge/components 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) 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 +538 -0
  13. package/dist/bridge/form-subdomain-missions.mjs +502 -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 +265 -0
  47. package/dist/dashboard/card-campaign-switch.mjs +231 -0
  48. package/dist/dashboard/card-order.js +28 -11
  49. package/dist/dashboard/card-order.mjs +28 -11
  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 +196 -0
  55. package/dist/dashboard/connection-workflows.mjs +162 -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-integration-age.js +6 -12
  81. package/dist/dashboard/form-organization-campaign-integration-age.mjs +6 -12
  82. package/dist/dashboard/form-organization-campaign-integration-enable.js +52 -24
  83. package/dist/dashboard/form-organization-campaign-integration-enable.mjs +54 -26
  84. package/dist/dashboard/form-organization-campaign-integration-geocode.js +6 -12
  85. package/dist/dashboard/form-organization-campaign-integration-geocode.mjs +6 -12
  86. package/dist/dashboard/form-organization-campaign-integration-gtm.js +6 -12
  87. package/dist/dashboard/form-organization-campaign-integration-gtm.mjs +6 -12
  88. package/dist/dashboard/form-organization-campaign-link.js +7 -1
  89. package/dist/dashboard/form-organization-campaign-link.mjs +7 -1
  90. package/dist/dashboard/form-organization-campaign-mission.js +291 -0
  91. package/dist/dashboard/form-organization-campaign-mission.mjs +258 -0
  92. package/dist/dashboard/form-organization-campaign-page-embed.js +13 -2
  93. package/dist/dashboard/form-organization-campaign-page-embed.mjs +12 -1
  94. package/dist/dashboard/form-organization-campaign-page.js +20 -11
  95. package/dist/dashboard/form-organization-campaign-page.mjs +20 -11
  96. package/dist/dashboard/form-organization-campaign-prize-edit.js +12 -1
  97. package/dist/dashboard/form-organization-campaign-prize-edit.mjs +12 -1
  98. package/dist/dashboard/form-organization-campaign-section.js +223 -0
  99. package/dist/dashboard/form-organization-campaign-section.mjs +194 -0
  100. package/dist/dashboard/form-organization-campaign.js +114 -469
  101. package/dist/dashboard/form-organization-campaign.mjs +113 -467
  102. package/dist/dashboard/form-organization-export.js +4 -7
  103. package/dist/dashboard/form-organization-export.mjs +4 -7
  104. package/dist/dashboard/form-organization-identity.js +46 -51
  105. package/dist/dashboard/form-organization-identity.mjs +46 -51
  106. package/dist/dashboard/form-organization-workflow.js +518 -686
  107. package/dist/dashboard/form-organization-workflow.mjs +517 -682
  108. package/dist/dashboard/form-organization.js +82 -110
  109. package/dist/dashboard/form-organization.mjs +81 -109
  110. package/dist/dashboard/form-otc.js +4 -5
  111. package/dist/dashboard/form-otc.mjs +4 -5
  112. package/dist/dashboard/form-payment-methods.js +20 -9
  113. package/dist/dashboard/form-payment-methods.mjs +20 -9
  114. package/dist/dashboard/form-stripe.js +30 -0
  115. package/dist/dashboard/form-stripe.mjs +26 -0
  116. package/dist/dashboard/input-array.js +4 -2
  117. package/dist/dashboard/input-array.mjs +4 -2
  118. package/dist/dashboard/input-combobox.js +7 -3
  119. package/dist/dashboard/input-combobox.mjs +7 -3
  120. package/dist/dashboard/input-date.js +7 -0
  121. package/dist/dashboard/input-date.mjs +7 -0
  122. package/dist/dashboard/input-fields.js +80 -20
  123. package/dist/dashboard/input-fields.mjs +80 -20
  124. package/dist/dashboard/input-file.js +21 -1
  125. package/dist/dashboard/input-file.mjs +21 -1
  126. package/dist/dashboard/input-font.js +10 -1
  127. package/dist/dashboard/input-font.mjs +10 -1
  128. package/dist/dashboard/lib/item-list.js +57 -0
  129. package/dist/dashboard/lib/item-list.mjs +33 -0
  130. package/dist/dashboard/lib/menu.js +50 -0
  131. package/dist/dashboard/lib/menu.mjs +26 -0
  132. package/dist/dashboard/locked.js +82 -0
  133. package/dist/dashboard/locked.mjs +53 -0
  134. package/dist/dashboard/menu.js +72 -19
  135. package/dist/dashboard/menu.mjs +72 -19
  136. package/dist/dashboard/note-ai.js +69 -0
  137. package/dist/dashboard/note-ai.mjs +36 -0
  138. package/dist/dashboard/preview.js +419 -0
  139. package/dist/dashboard/preview.mjs +384 -0
  140. package/dist/dashboard/steps.js +39 -13
  141. package/dist/dashboard/steps.mjs +37 -12
  142. package/dist/dashboard/table-contacts.js +136 -0
  143. package/dist/dashboard/table-contacts.mjs +103 -0
  144. package/dist/dashboard/template-not-found.js +4 -2
  145. package/dist/dashboard/template-not-found.mjs +4 -2
  146. package/dist/dashboard/template-socket.js +20 -7
  147. package/dist/dashboard/template-socket.mjs +20 -7
  148. package/dist/icons/desktop.js +46 -0
  149. package/dist/icons/desktop.mjs +27 -0
  150. package/dist/icons/phone.js +46 -0
  151. package/dist/icons/phone.mjs +27 -0
  152. package/dist/icons/puzzle-piece.js +46 -0
  153. package/dist/icons/puzzle-piece.mjs +27 -0
  154. package/dist/icons/tablet.js +46 -0
  155. package/dist/icons/tablet.mjs +27 -0
  156. package/dist/icons/users.js +46 -0
  157. package/dist/icons/users.mjs +27 -0
  158. package/dist/input-checkbox.js +1 -0
  159. package/dist/input-checkbox.mjs +1 -0
  160. package/dist/input-code.js +101 -0
  161. package/dist/input-code.mjs +78 -0
  162. package/dist/input-text.js +2 -1
  163. package/dist/input-text.mjs +2 -1
  164. package/dist/shared/input-checkbox-list.js +0 -1
  165. package/dist/shared/input-checkbox-list.mjs +0 -1
  166. package/dist/shared/input-switch.js +6 -1
  167. package/dist/shared/input-switch.mjs +6 -1
  168. package/dist/shared/lib/campaign.js +117 -0
  169. package/dist/shared/lib/campaign.mjs +91 -0
  170. package/dist/shared/lib/helpers.js +14 -2
  171. package/dist/shared/lib/helpers.mjs +13 -2
  172. package/package.json +133 -13
  173. package/types/bridge/form-subdomain-header.d.ts +2 -0
  174. package/types/bridge/form-subdomain-missions.d.ts +36 -0
  175. package/types/bridge/form-subdomain.d.ts +23 -1
  176. package/types/bridge/lib/entry.d.ts +26 -0
  177. package/types/bridge/lib/location.d.ts +13 -0
  178. package/types/bridge/lib/order.d.ts +30 -0
  179. package/types/bridge/lib/url.d.ts +19 -0
  180. package/types/bridge/template-modal.d.ts +1 -1
  181. package/types/bridge/template-preview.d.ts +10 -0
  182. package/types/bridge/template-subdomain-link.d.ts +2 -0
  183. package/types/dashboard/accordion.d.ts +2 -0
  184. package/types/dashboard/avatar.d.ts +18 -2
  185. package/types/dashboard/buttons-subscription.d.ts +22 -0
  186. package/types/dashboard/card-campaign-switch.d.ts +32 -0
  187. package/types/dashboard/card-order.d.ts +11 -0
  188. package/types/dashboard/card-section.d.ts +2 -0
  189. package/types/dashboard/connection-workflows.d.ts +33 -0
  190. package/types/dashboard/device.d.ts +12 -0
  191. package/types/dashboard/form-admin-campaign.d.ts +3 -2
  192. package/types/dashboard/form-ai.d.ts +2 -2
  193. package/types/dashboard/form-organization-campaign-agreement.d.ts +18 -12
  194. package/types/dashboard/form-organization-campaign-field-email.d.ts +1 -2
  195. package/types/dashboard/form-organization-campaign-field-list.d.ts +36 -0
  196. package/types/dashboard/form-organization-campaign-field-phone.d.ts +1 -2
  197. package/types/dashboard/form-organization-campaign-field-remove.d.ts +22 -0
  198. package/types/dashboard/form-organization-campaign-field-select.d.ts +2 -1
  199. package/types/dashboard/form-organization-campaign-field-textarea.d.ts +2 -1
  200. package/types/dashboard/form-organization-campaign-integration-age.d.ts +3 -3
  201. package/types/dashboard/form-organization-campaign-integration-enable.d.ts +3 -3
  202. package/types/dashboard/form-organization-campaign-mission.d.ts +40 -0
  203. package/types/dashboard/form-organization-campaign-section.d.ts +27 -0
  204. package/types/dashboard/form-organization-campaign.d.ts +27 -17
  205. package/types/dashboard/form-organization-identity.d.ts +2 -0
  206. package/types/dashboard/form-organization-workflow.d.ts +43 -47
  207. package/types/dashboard/form-organization.d.ts +7 -2
  208. package/types/dashboard/form-stripe.d.ts +3 -0
  209. package/types/dashboard/input-combobox.d.ts +2 -0
  210. package/types/dashboard/input-date.d.ts +2 -0
  211. package/types/dashboard/input-fields.d.ts +3 -2
  212. package/types/dashboard/input-file.d.ts +4 -0
  213. package/types/dashboard/lib/item-list.d.ts +14 -0
  214. package/types/dashboard/lib/menu.d.ts +17 -0
  215. package/types/dashboard/locked.d.ts +10 -0
  216. package/types/dashboard/menu.d.ts +10 -2
  217. package/types/dashboard/note-ai.d.ts +15 -0
  218. package/types/dashboard/preview.d.ts +33 -0
  219. package/types/dashboard/steps.d.ts +19 -4
  220. package/types/dashboard/table-cell-title.d.ts +2 -2
  221. package/types/dashboard/table-contacts.d.ts +2 -0
  222. package/types/icons/desktop.d.ts +5 -0
  223. package/types/icons/phone.d.ts +5 -0
  224. package/types/icons/puzzle-piece.d.ts +5 -0
  225. package/types/icons/tablet.d.ts +5 -0
  226. package/types/icons/users.d.ts +5 -0
  227. package/types/input-code.d.ts +23 -0
  228. package/types/shared/input-switch.d.ts +2 -0
  229. package/types/shared/lib/campaign.d.ts +35 -0
  230. package/types/shared/lib/helpers.d.ts +3 -0
  231. package/dist/dashboard/card-integration.js +0 -187
  232. package/dist/dashboard/card-integration.mjs +0 -158
  233. package/dist/dashboard/iframe.js +0 -159
  234. package/dist/dashboard/iframe.mjs +0 -130
  235. package/types/dashboard/card-integration.d.ts +0 -24
  236. package/types/dashboard/iframe.d.ts +0 -18
@@ -0,0 +1,231 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useQueryClient } from "@tanstack/react-query";
3
+ import { request } from "@drawbridge/drawbridge-utils/fetch";
4
+ import { awardingCard, campaignSwitch } from "../shared/lib/campaign.mjs";
5
+ import { useModal } from "./lib/hooks.mjs";
6
+ import CardSection from "./card-section.mjs";
7
+ import CardTask from "./card-task.mjs";
8
+ import FormAction from "./form-action.mjs";
9
+ import InputSwitch from "../shared/input-switch.mjs";
10
+ import Tooltip from "../shared/tooltip.mjs";
11
+ import Lock from "../icons/lock.mjs";
12
+ const useCampaignSwitch = ({ campaign, onError, onSuccess }) => {
13
+ const queryClient = useQueryClient();
14
+ const modal = useModal({
15
+ queryClient
16
+ });
17
+ return (key, on) => {
18
+ const { body, message, title } = campaignSwitch(campaign, key, on);
19
+ modal.open({
20
+ message: /* @__PURE__ */ jsx(
21
+ FormAction,
22
+ {
23
+ ...{
24
+ callback: () => request({
25
+ body,
26
+ endpoint: "/organization/" + (campaign == null ? void 0 : campaign.organization) + "/campaign/" + (campaign == null ? void 0 : campaign.id),
27
+ method: "PUT"
28
+ }),
29
+ onError,
30
+ onSuccess
31
+ },
32
+ children: /* @__PURE__ */ jsx("p", { children: message })
33
+ }
34
+ ),
35
+ title
36
+ });
37
+ };
38
+ };
39
+ const SwitchLock = ({ disabled, onChange, value }) => /* @__PURE__ */ jsxs(
40
+ "span",
41
+ {
42
+ ...{
43
+ className: "flex items-center gap-2 shrink-0"
44
+ },
45
+ children: [
46
+ disabled && /* @__PURE__ */ jsx(
47
+ Lock,
48
+ {
49
+ ...{
50
+ "aria-label": "Locked",
51
+ className: "w-5 h-5 text-gray-dark",
52
+ role: "img"
53
+ }
54
+ }
55
+ ),
56
+ /* @__PURE__ */ jsx(
57
+ InputSwitch,
58
+ {
59
+ ...{
60
+ disabled,
61
+ onChange,
62
+ value
63
+ }
64
+ }
65
+ )
66
+ ]
67
+ }
68
+ );
69
+ const Row = ({ description, disabled, onChange, title, value }) => /* @__PURE__ */ jsxs(
70
+ "div",
71
+ {
72
+ ...{
73
+ className: "flex items-center gap-4 py-3 first:pt-0 last:pb-0"
74
+ },
75
+ children: [
76
+ /* @__PURE__ */ jsxs(
77
+ "div",
78
+ {
79
+ ...{
80
+ className: "flex-1 min-w-0"
81
+ },
82
+ children: [
83
+ /* @__PURE__ */ jsx("p", { children: title }),
84
+ /* @__PURE__ */ jsx(
85
+ "p",
86
+ {
87
+ ...{
88
+ className: "text-sm text-gray-dark"
89
+ },
90
+ children: description
91
+ }
92
+ )
93
+ ]
94
+ }
95
+ ),
96
+ /* @__PURE__ */ jsx(
97
+ SwitchLock,
98
+ {
99
+ ...{
100
+ disabled,
101
+ onChange,
102
+ value
103
+ }
104
+ }
105
+ )
106
+ ]
107
+ }
108
+ );
109
+ const HeaderCampaignSwitch = ({
110
+ campaign,
111
+ disabled,
112
+ onError,
113
+ onSuccess,
114
+ which,
115
+ ...rest
116
+ }) => {
117
+ var _a;
118
+ const flip = useCampaignSwitch({
119
+ campaign,
120
+ onError,
121
+ onSuccess
122
+ });
123
+ const input = /* @__PURE__ */ jsx(
124
+ InputSwitch,
125
+ {
126
+ ...{
127
+ "aria-label": which === "form" ? "Form" : "Giveaway",
128
+ disabled,
129
+ onChange: (value) => flip(which, value),
130
+ value: Boolean((_a = campaign == null ? void 0 : campaign[which]) == null ? void 0 : _a.enabled)
131
+ }
132
+ }
133
+ );
134
+ return /* @__PURE__ */ jsx(
135
+ "span",
136
+ {
137
+ ...{
138
+ className: "flex",
139
+ ...rest
140
+ },
141
+ children: disabled ? /* @__PURE__ */ jsx(
142
+ Tooltip,
143
+ {
144
+ ...{
145
+ content: "You need Manage on Campaigns to change this"
146
+ },
147
+ children: input
148
+ }
149
+ ) : input
150
+ }
151
+ );
152
+ };
153
+ const CardLeadCapture = ({
154
+ campaign,
155
+ disabled,
156
+ onError,
157
+ onSuccess
158
+ }) => {
159
+ const flip = useCampaignSwitch({
160
+ campaign,
161
+ onError,
162
+ onSuccess
163
+ });
164
+ const card = awardingCard(campaign);
165
+ const rows = [
166
+ {
167
+ description: "Collect leads with the entry form on your pages",
168
+ key: "form",
169
+ title: "Form"
170
+ },
171
+ {
172
+ description: "Award entries for prizes while a range is running",
173
+ key: "giveaway",
174
+ title: "Giveaway"
175
+ }
176
+ ];
177
+ return /* @__PURE__ */ jsx(
178
+ CardSection,
179
+ {
180
+ ...{
181
+ className: "shrink-0",
182
+ "data-guide": "section-lead-capture",
183
+ title: "Lead capture"
184
+ },
185
+ children: /* @__PURE__ */ jsxs(
186
+ "div",
187
+ {
188
+ ...{
189
+ className: "space-y-4"
190
+ },
191
+ children: [
192
+ card && /* @__PURE__ */ jsx(
193
+ CardTask,
194
+ {
195
+ ...card
196
+ }
197
+ ),
198
+ /* @__PURE__ */ jsx(
199
+ "div",
200
+ {
201
+ ...{
202
+ className: "divide-y divide-gray"
203
+ },
204
+ children: rows.map(({ description, key, title }) => {
205
+ var _a;
206
+ return /* @__PURE__ */ jsx(
207
+ Row,
208
+ {
209
+ ...{
210
+ description,
211
+ disabled,
212
+ onChange: (value) => flip(key, value),
213
+ title,
214
+ value: Boolean((_a = campaign == null ? void 0 : campaign[key]) == null ? void 0 : _a.enabled)
215
+ }
216
+ },
217
+ key
218
+ );
219
+ })
220
+ }
221
+ )
222
+ ]
223
+ }
224
+ )
225
+ }
226
+ );
227
+ };
228
+ export {
229
+ CardLeadCapture,
230
+ HeaderCampaignSwitch
231
+ };
@@ -34,12 +34,17 @@ var import_jsx_runtime = require("react/jsx-runtime");
34
34
  var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
35
35
  var import_card_data_item = __toESM(require("./card-data-item"));
36
36
  const className = "p-3 bg-white rounded shadow-[0_1px_3px_0_rgb(0_0_0/0.1),0_1px_2px_-1px_rgb(0_0_0/0.1)]";
37
+ const attributions = {
38
+ conversion: "A campaign link brought the buyer to checkout, so the conversion fee applies.",
39
+ redemption: "The buyer used one of your discount codes, so no fee applies."
40
+ };
37
41
  const CardOrder = ({
38
42
  currency,
39
43
  fee = 0,
40
44
  gross = 0,
41
45
  lines = [],
42
46
  net = 0,
47
+ provider,
43
48
  purchasedAt,
44
49
  rate,
45
50
  type
@@ -52,6 +57,7 @@ const CardOrder = ({
52
57
  className: "space-y-6"
53
58
  },
54
59
  children: [
60
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: attributions[type] || attributions.conversion }),
55
61
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
56
62
  "div",
57
63
  {
@@ -65,15 +71,19 @@ const CardOrder = ({
65
71
  ...{
66
72
  className: ["flex flex-col", className].join(" "),
67
73
  classNameSlotLeft: "text-sm disabled",
68
- label: "Date",
69
- value: purchasedAt ? (0, import_drawbridge_utils.formatDateString)({
70
- date: purchasedAt,
71
- options: {
72
- day: "numeric",
73
- month: "short",
74
- year: "numeric"
75
- }
76
- }) : "\u2014"
74
+ label: "Order number",
75
+ value: (provider == null ? void 0 : provider.name) || "\u2014"
76
+ }
77
+ }
78
+ ),
79
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
80
+ import_card_data_item.default,
81
+ {
82
+ ...{
83
+ className: ["flex flex-col", className].join(" "),
84
+ classNameSlotLeft: "text-sm disabled",
85
+ label: "Order ID",
86
+ value: (provider == null ? void 0 : provider.id) || "\u2014"
77
87
  }
78
88
  }
79
89
  ),
@@ -83,8 +93,15 @@ const CardOrder = ({
83
93
  ...{
84
94
  className: ["flex flex-col", className].join(" "),
85
95
  classNameSlotLeft: "text-sm disabled",
86
- label: "Type",
87
- value: type === "redemption" ? "Redemption" : "Campaign"
96
+ label: "Date",
97
+ value: purchasedAt ? (0, import_drawbridge_utils.formatDateString)({
98
+ date: purchasedAt,
99
+ options: {
100
+ day: "numeric",
101
+ month: "short",
102
+ year: "numeric"
103
+ }
104
+ }) : "\u2014"
88
105
  }
89
106
  }
90
107
  ),
@@ -2,12 +2,17 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { formatCurrency, formatDateString, formatNumber } from "@drawbridge/drawbridge-utils";
3
3
  import CardDataItem from "./card-data-item.mjs";
4
4
  const className = "p-3 bg-white rounded shadow-[0_1px_3px_0_rgb(0_0_0/0.1),0_1px_2px_-1px_rgb(0_0_0/0.1)]";
5
+ const attributions = {
6
+ conversion: "A campaign link brought the buyer to checkout, so the conversion fee applies.",
7
+ redemption: "The buyer used one of your discount codes, so no fee applies."
8
+ };
5
9
  const CardOrder = ({
6
10
  currency,
7
11
  fee = 0,
8
12
  gross = 0,
9
13
  lines = [],
10
14
  net = 0,
15
+ provider,
11
16
  purchasedAt,
12
17
  rate,
13
18
  type
@@ -20,6 +25,7 @@ const CardOrder = ({
20
25
  className: "space-y-6"
21
26
  },
22
27
  children: [
28
+ /* @__PURE__ */ jsx("p", { children: attributions[type] || attributions.conversion }),
23
29
  /* @__PURE__ */ jsxs(
24
30
  "div",
25
31
  {
@@ -33,15 +39,19 @@ const CardOrder = ({
33
39
  ...{
34
40
  className: ["flex flex-col", className].join(" "),
35
41
  classNameSlotLeft: "text-sm disabled",
36
- label: "Date",
37
- value: purchasedAt ? formatDateString({
38
- date: purchasedAt,
39
- options: {
40
- day: "numeric",
41
- month: "short",
42
- year: "numeric"
43
- }
44
- }) : "\u2014"
42
+ label: "Order number",
43
+ value: (provider == null ? void 0 : provider.name) || "\u2014"
44
+ }
45
+ }
46
+ ),
47
+ /* @__PURE__ */ jsx(
48
+ CardDataItem,
49
+ {
50
+ ...{
51
+ className: ["flex flex-col", className].join(" "),
52
+ classNameSlotLeft: "text-sm disabled",
53
+ label: "Order ID",
54
+ value: (provider == null ? void 0 : provider.id) || "\u2014"
45
55
  }
46
56
  }
47
57
  ),
@@ -51,8 +61,15 @@ const CardOrder = ({
51
61
  ...{
52
62
  className: ["flex flex-col", className].join(" "),
53
63
  classNameSlotLeft: "text-sm disabled",
54
- label: "Type",
55
- value: type === "redemption" ? "Redemption" : "Campaign"
64
+ label: "Date",
65
+ value: purchasedAt ? formatDateString({
66
+ date: purchasedAt,
67
+ options: {
68
+ day: "numeric",
69
+ month: "short",
70
+ year: "numeric"
71
+ }
72
+ }) : "\u2014"
56
73
  }
57
74
  }
58
75
  ),
@@ -21,15 +21,20 @@ __export(card_section_exports, {
21
21
  });
22
22
  module.exports = __toCommonJS(card_section_exports);
23
23
  var import_jsx_runtime = require("react/jsx-runtime");
24
+ var import_react = require("react");
24
25
  const CardSection = ({
25
26
  children,
26
27
  className,
28
+ columns = 1,
27
29
  cta,
28
30
  title,
29
31
  ...rest
30
32
  }) => {
31
33
  const classes = [
32
- "flex flex-col w-full bg-white rounded border border-gray overflow-hidden"
34
+ "flex flex-col w-full bg-white rounded border border-gray",
35
+ // In columns the card does not clip, so a column can stay in view as the
36
+ // page scrolls; and it never shrinks in the page's column.
37
+ columns > 1 ? "shrink-0" : "overflow-hidden"
33
38
  ];
34
39
  const hasHeader = Boolean(title || cta);
35
40
  if (className) {
@@ -72,7 +77,26 @@ const CardSection = ({
72
77
  // overlay) anchors to the content area, not a distant ancestor.
73
78
  className: "relative flex-1 min-h-0 p-6" + (hasHeader ? " pt-0" : "")
74
79
  },
75
- children
80
+ children: columns > 1 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
81
+ "div",
82
+ {
83
+ ...{
84
+ className: "grid grid-cols-1 gap-6 items-start xl:grid-cols-2"
85
+ },
86
+ children: import_react.Children.toArray(children).map((child, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
87
+ "div",
88
+ {
89
+ ...{
90
+ // The first column ( the form ) runs with the page; the others
91
+ // stay in view beside it while it scrolls.
92
+ className: "min-w-0" + (index ? " xl:sticky xl:top-6" : "")
93
+ },
94
+ children: child
95
+ },
96
+ index
97
+ ))
98
+ }
99
+ ) : children
76
100
  }
77
101
  )
78
102
  ]
@@ -1,13 +1,18 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Children } from "react";
2
3
  const CardSection = ({
3
4
  children,
4
5
  className,
6
+ columns = 1,
5
7
  cta,
6
8
  title,
7
9
  ...rest
8
10
  }) => {
9
11
  const classes = [
10
- "flex flex-col w-full bg-white rounded border border-gray overflow-hidden"
12
+ "flex flex-col w-full bg-white rounded border border-gray",
13
+ // In columns the card does not clip, so a column can stay in view as the
14
+ // page scrolls; and it never shrinks in the page's column.
15
+ columns > 1 ? "shrink-0" : "overflow-hidden"
11
16
  ];
12
17
  const hasHeader = Boolean(title || cta);
13
18
  if (className) {
@@ -50,7 +55,26 @@ const CardSection = ({
50
55
  // overlay) anchors to the content area, not a distant ancestor.
51
56
  className: "relative flex-1 min-h-0 p-6" + (hasHeader ? " pt-0" : "")
52
57
  },
53
- children
58
+ children: columns > 1 ? /* @__PURE__ */ jsx(
59
+ "div",
60
+ {
61
+ ...{
62
+ className: "grid grid-cols-1 gap-6 items-start xl:grid-cols-2"
63
+ },
64
+ children: Children.toArray(children).map((child, index) => /* @__PURE__ */ jsx(
65
+ "div",
66
+ {
67
+ ...{
68
+ // The first column ( the form ) runs with the page; the others
69
+ // stay in view beside it while it scrolls.
70
+ className: "min-w-0" + (index ? " xl:sticky xl:top-6" : "")
71
+ },
72
+ children: child
73
+ },
74
+ index
75
+ ))
76
+ }
77
+ ) : children
54
78
  }
55
79
  )
56
80
  ]
@@ -42,6 +42,7 @@ var import_link = __toESM(require("./link"));
42
42
  var import_button = __toESM(require("../shared/button"));
43
43
  var import_drawbridge_utils = require("@drawbridge/drawbridge-utils");
44
44
  var import_cdn = require("@drawbridge/drawbridge-utils/cdn");
45
+ var import_campaign = require("../shared/lib/campaign");
45
46
  const classes = {
46
47
  container: [
47
48
  "group relative flex w-full h-full p-6 space-x-6 transition duration-200 ease-in xl:aspect-video 2xl:space-x-12"
@@ -388,13 +389,11 @@ const TileCampaign = ({
388
389
  page,
389
390
  updatedAt
390
391
  }) => {
391
- var _a, _b, _c, _d, _e, _f, _g;
392
+ var _a, _b, _c, _d, _e, _f;
392
393
  const generating = ((_b = (_a = campaign == null ? void 0 : campaign.process) == null ? void 0 : _a.ai) == null ? void 0 : _b.status) === "pending";
393
- const status = (campaign == null ? void 0 : campaign.status) || "drafted";
394
394
  const touched = updatedAt || (campaign == null ? void 0 : campaign.updatedAt);
395
395
  const description = [
396
- (0, import_drawbridge_utils.capitalize)(status),
397
- (_c = campaign == null ? void 0 : campaign.type) == null ? void 0 : _c.key,
396
+ (0, import_campaign.leadCapture)(campaign),
398
397
  tileDate(touched)
399
398
  ].filter(Boolean).join(" \xB7 ");
400
399
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -406,7 +405,7 @@ const TileCampaign = ({
406
405
  generating,
407
406
  image: tileImage(page),
408
407
  manage: "/organizations/" + organization + "/campaigns/" + (campaign == null ? void 0 : campaign.id),
409
- percentage: tilePercentage((_e = (_d = campaign == null ? void 0 : campaign.process) == null ? void 0 : _d.ai) == null ? void 0 : _e.progress),
408
+ percentage: tilePercentage((_d = (_c = campaign == null ? void 0 : campaign.process) == null ? void 0 : _c.ai) == null ? void 0 : _d.progress),
410
409
  // Same asset, same bg-contain-on-bg-green treatment CardTile's own
411
410
  // default placeholder above already uses for the API's promo-tile
412
411
  // icons — just pointed at drawbridge-api's public/images/. It stands
@@ -415,8 +414,8 @@ const TileCampaign = ({
415
414
  // a gallery photo nor a preview image — that case dropped the image
416
415
  // slot entirely and left the slide as text against white.
417
416
  placeholder: process.env.NEXT_PUBLIC_API_URI + "/images/campaigns.png",
418
- title: generating ? (_f = campaign == null ? void 0 : campaign.source) == null ? void 0 : _f.url : campaign == null ? void 0 : campaign.title,
419
- view: (_g = page == null ? void 0 : page.share) == null ? void 0 : _g.url
417
+ title: generating ? (_e = campaign == null ? void 0 : campaign.source) == null ? void 0 : _e.url : campaign == null ? void 0 : campaign.title,
418
+ view: (_f = page == null ? void 0 : page.share) == null ? void 0 : _f.url
420
419
  }
421
420
  }
422
421
  );
@@ -8,6 +8,7 @@ import Link from "./link.mjs";
8
8
  import Button from "../shared/button.mjs";
9
9
  import { capitalize, formatDateString } from "@drawbridge/drawbridge-utils";
10
10
  import { cdnSrc } from "@drawbridge/drawbridge-utils/cdn";
11
+ import { leadCapture } from "../shared/lib/campaign.mjs";
11
12
  const classes = {
12
13
  container: [
13
14
  "group relative flex w-full h-full p-6 space-x-6 transition duration-200 ease-in xl:aspect-video 2xl:space-x-12"
@@ -354,13 +355,11 @@ const TileCampaign = ({
354
355
  page,
355
356
  updatedAt
356
357
  }) => {
357
- var _a, _b, _c, _d, _e, _f, _g;
358
+ var _a, _b, _c, _d, _e, _f;
358
359
  const generating = ((_b = (_a = campaign == null ? void 0 : campaign.process) == null ? void 0 : _a.ai) == null ? void 0 : _b.status) === "pending";
359
- const status = (campaign == null ? void 0 : campaign.status) || "drafted";
360
360
  const touched = updatedAt || (campaign == null ? void 0 : campaign.updatedAt);
361
361
  const description = [
362
- capitalize(status),
363
- (_c = campaign == null ? void 0 : campaign.type) == null ? void 0 : _c.key,
362
+ leadCapture(campaign),
364
363
  tileDate(touched)
365
364
  ].filter(Boolean).join(" \xB7 ");
366
365
  return /* @__PURE__ */ jsx(
@@ -372,7 +371,7 @@ const TileCampaign = ({
372
371
  generating,
373
372
  image: tileImage(page),
374
373
  manage: "/organizations/" + organization + "/campaigns/" + (campaign == null ? void 0 : campaign.id),
375
- percentage: tilePercentage((_e = (_d = campaign == null ? void 0 : campaign.process) == null ? void 0 : _d.ai) == null ? void 0 : _e.progress),
374
+ percentage: tilePercentage((_d = (_c = campaign == null ? void 0 : campaign.process) == null ? void 0 : _c.ai) == null ? void 0 : _d.progress),
376
375
  // Same asset, same bg-contain-on-bg-green treatment CardTile's own
377
376
  // default placeholder above already uses for the API's promo-tile
378
377
  // icons — just pointed at drawbridge-api's public/images/. It stands
@@ -381,8 +380,8 @@ const TileCampaign = ({
381
380
  // a gallery photo nor a preview image — that case dropped the image
382
381
  // slot entirely and left the slide as text against white.
383
382
  placeholder: process.env.NEXT_PUBLIC_API_URI + "/images/campaigns.png",
384
- title: generating ? (_f = campaign == null ? void 0 : campaign.source) == null ? void 0 : _f.url : campaign == null ? void 0 : campaign.title,
385
- view: (_g = page == null ? void 0 : page.share) == null ? void 0 : _g.url
383
+ title: generating ? (_e = campaign == null ? void 0 : campaign.source) == null ? void 0 : _e.url : campaign == null ? void 0 : campaign.title,
384
+ view: (_f = page == null ? void 0 : page.share) == null ? void 0 : _f.url
386
385
  }
387
386
  }
388
387
  );