@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
@@ -0,0 +1,243 @@
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, switchLock } 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, lock, onChange, title, value }) => {
70
+ const input = /* @__PURE__ */ jsx(
71
+ SwitchLock,
72
+ {
73
+ ...{
74
+ disabled: Boolean(lock),
75
+ onChange,
76
+ value
77
+ }
78
+ }
79
+ );
80
+ return /* @__PURE__ */ jsxs(
81
+ "div",
82
+ {
83
+ ...{
84
+ className: "flex items-center gap-4 py-3 first:pt-0 last:pb-0"
85
+ },
86
+ children: [
87
+ /* @__PURE__ */ jsxs(
88
+ "div",
89
+ {
90
+ ...{
91
+ className: "flex-1 min-w-0"
92
+ },
93
+ children: [
94
+ /* @__PURE__ */ jsx("p", { children: title }),
95
+ /* @__PURE__ */ jsx(
96
+ "p",
97
+ {
98
+ ...{
99
+ className: "text-sm text-gray-dark"
100
+ },
101
+ children: description
102
+ }
103
+ )
104
+ ]
105
+ }
106
+ ),
107
+ lock ? /* @__PURE__ */ jsx(
108
+ Tooltip,
109
+ {
110
+ ...{
111
+ content: lock
112
+ },
113
+ children: input
114
+ }
115
+ ) : input
116
+ ]
117
+ }
118
+ );
119
+ };
120
+ const HeaderCampaignSwitch = ({
121
+ campaign,
122
+ disabled,
123
+ onError,
124
+ onSuccess,
125
+ which,
126
+ ...rest
127
+ }) => {
128
+ var _a;
129
+ const flip = useCampaignSwitch({
130
+ campaign,
131
+ onError,
132
+ onSuccess
133
+ });
134
+ const lock = switchLock(campaign, which, disabled);
135
+ const input = /* @__PURE__ */ jsx(
136
+ InputSwitch,
137
+ {
138
+ ...{
139
+ "aria-label": which === "form" ? "Form" : "Giveaway",
140
+ disabled: Boolean(lock),
141
+ onChange: (value) => flip(which, value),
142
+ value: Boolean((_a = campaign == null ? void 0 : campaign[which]) == null ? void 0 : _a.enabled)
143
+ }
144
+ }
145
+ );
146
+ return /* @__PURE__ */ jsx(
147
+ "span",
148
+ {
149
+ ...{
150
+ className: "flex",
151
+ ...rest
152
+ },
153
+ children: lock ? /* @__PURE__ */ jsx(
154
+ Tooltip,
155
+ {
156
+ ...{
157
+ content: lock
158
+ },
159
+ children: input
160
+ }
161
+ ) : input
162
+ }
163
+ );
164
+ };
165
+ const CardLeadCapture = ({
166
+ campaign,
167
+ disabled,
168
+ onError,
169
+ onSuccess
170
+ }) => {
171
+ const flip = useCampaignSwitch({
172
+ campaign,
173
+ onError,
174
+ onSuccess
175
+ });
176
+ const card = awardingCard(campaign);
177
+ const rows = [
178
+ {
179
+ description: "Collect leads with the entry form on your pages",
180
+ key: "form",
181
+ title: "Form"
182
+ },
183
+ {
184
+ description: "Award entries for prizes while a range is running",
185
+ key: "giveaway",
186
+ title: "Giveaway"
187
+ }
188
+ ];
189
+ return /* @__PURE__ */ jsx(
190
+ CardSection,
191
+ {
192
+ ...{
193
+ className: "shrink-0",
194
+ "data-guide": "section-lead-capture",
195
+ title: "Lead capture"
196
+ },
197
+ children: /* @__PURE__ */ jsxs(
198
+ "div",
199
+ {
200
+ ...{
201
+ className: "space-y-4"
202
+ },
203
+ children: [
204
+ card && /* @__PURE__ */ jsx(
205
+ CardTask,
206
+ {
207
+ ...card
208
+ }
209
+ ),
210
+ /* @__PURE__ */ jsx(
211
+ "div",
212
+ {
213
+ ...{
214
+ className: "divide-y divide-gray"
215
+ },
216
+ children: rows.map(({ description, key, title }) => {
217
+ var _a;
218
+ return /* @__PURE__ */ jsx(
219
+ Row,
220
+ {
221
+ ...{
222
+ description,
223
+ lock: switchLock(campaign, key, disabled),
224
+ onChange: (value) => flip(key, value),
225
+ title,
226
+ value: Boolean((_a = campaign == null ? void 0 : campaign[key]) == null ? void 0 : _a.enabled)
227
+ }
228
+ },
229
+ key
230
+ );
231
+ })
232
+ }
233
+ )
234
+ ]
235
+ }
236
+ )
237
+ }
238
+ );
239
+ };
240
+ export {
241
+ CardLeadCapture,
242
+ HeaderCampaignSwitch
243
+ };
@@ -34,17 +34,228 @@ 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
+ };
41
+ const date = (value) => value ? (0, import_drawbridge_utils.formatDateString)({
42
+ date: value,
43
+ options: {
44
+ day: "numeric",
45
+ month: "short",
46
+ year: "numeric"
47
+ }
48
+ }) : "\u2014";
49
+ const Item = ({ label, value }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
50
+ import_card_data_item.default,
51
+ {
52
+ ...{
53
+ className: ["flex flex-col min-w-0", className].join(" "),
54
+ classNameSlotLeft: "text-sm disabled",
55
+ classNameSlotRight: "w-full break-words",
56
+ label,
57
+ value: value || "\u2014"
58
+ }
59
+ }
60
+ );
61
+ const FormOrder = ({ code, customer, gross, lines, note, pickup, purchasedAt }) => {
62
+ const priced = lines.some((line) => typeof (line == null ? void 0 : line.price) === "number");
63
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
64
+ "div",
65
+ {
66
+ ...{
67
+ className: "space-y-6"
68
+ },
69
+ children: [
70
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Placed on your entry form. No payment was taken." }),
71
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
72
+ "div",
73
+ {
74
+ ...{
75
+ className: "grid grid-cols-2 gap-6 sm:grid-cols-3"
76
+ },
77
+ children: [
78
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
79
+ Item,
80
+ {
81
+ ...{
82
+ label: "Customer",
83
+ value: [customer == null ? void 0 : customer.firstName, customer == null ? void 0 : customer.lastName].filter(Boolean).join(" ")
84
+ }
85
+ }
86
+ ),
87
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
88
+ Item,
89
+ {
90
+ ...{
91
+ label: "Email",
92
+ value: customer == null ? void 0 : customer.email
93
+ }
94
+ }
95
+ ),
96
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
97
+ Item,
98
+ {
99
+ ...{
100
+ label: "Phone",
101
+ value: customer == null ? void 0 : customer.phone
102
+ }
103
+ }
104
+ ),
105
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
106
+ Item,
107
+ {
108
+ ...{
109
+ label: "Date",
110
+ value: date(purchasedAt)
111
+ }
112
+ }
113
+ ),
114
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
115
+ Item,
116
+ {
117
+ ...{
118
+ label: "Pickup",
119
+ value: pickup
120
+ }
121
+ }
122
+ ),
123
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
124
+ Item,
125
+ {
126
+ ...{
127
+ label: "Note",
128
+ value: note
129
+ }
130
+ }
131
+ ),
132
+ priced && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
133
+ Item,
134
+ {
135
+ ...{
136
+ label: "Estimated total",
137
+ value: (0, import_drawbridge_utils.formatCurrency)({ code, value: gross })
138
+ }
139
+ }
140
+ )
141
+ ]
142
+ }
143
+ ),
144
+ lines.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
145
+ "div",
146
+ {
147
+ ...{
148
+ className: "space-y-2"
149
+ },
150
+ children: [
151
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
152
+ "p",
153
+ {
154
+ ...{
155
+ className: "text-sm disabled"
156
+ },
157
+ children: "Items"
158
+ }
159
+ ),
160
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
161
+ "div",
162
+ {
163
+ ...{
164
+ className: "space-y-3"
165
+ },
166
+ children: lines.map(({ price, quantity = 0, title }, key) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
167
+ "div",
168
+ {
169
+ ...{
170
+ className: ["space-y-3", className].join(" ")
171
+ },
172
+ children: [
173
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: title || "Untitled item" }),
174
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
175
+ "div",
176
+ {
177
+ ...{
178
+ className: "grid grid-cols-3 gap-6"
179
+ },
180
+ children: [
181
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
182
+ import_card_data_item.default,
183
+ {
184
+ ...{
185
+ className: "flex flex-col",
186
+ classNameSlotLeft: "text-sm disabled",
187
+ label: "Quantity",
188
+ value: (0, import_drawbridge_utils.formatNumber)(quantity)
189
+ }
190
+ }
191
+ ),
192
+ typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
193
+ import_card_data_item.default,
194
+ {
195
+ ...{
196
+ className: "flex flex-col",
197
+ classNameSlotLeft: "text-sm disabled",
198
+ label: "Price",
199
+ value: (0, import_drawbridge_utils.formatCurrency)({ code, value: price })
200
+ }
201
+ }
202
+ ),
203
+ typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
204
+ import_card_data_item.default,
205
+ {
206
+ ...{
207
+ className: "flex flex-col",
208
+ classNameSlotLeft: "text-sm disabled",
209
+ label: "Total",
210
+ value: (0, import_drawbridge_utils.formatCurrency)({ code, value: price * quantity })
211
+ }
212
+ }
213
+ )
214
+ ]
215
+ }
216
+ )
217
+ ]
218
+ },
219
+ key
220
+ ))
221
+ }
222
+ )
223
+ ]
224
+ }
225
+ )
226
+ ]
227
+ }
228
+ );
229
+ };
37
230
  const CardOrder = ({
38
231
  currency,
232
+ customer,
39
233
  fee = 0,
40
234
  gross = 0,
41
235
  lines = [],
42
236
  net = 0,
237
+ note,
238
+ pickup,
239
+ provider,
43
240
  purchasedAt,
44
241
  rate,
45
242
  type
46
243
  }) => {
47
244
  const code = (currency || "usd").toUpperCase();
245
+ if (type === "form") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
246
+ FormOrder,
247
+ {
248
+ ...{
249
+ code,
250
+ customer,
251
+ gross,
252
+ lines,
253
+ note,
254
+ pickup,
255
+ purchasedAt
256
+ }
257
+ }
258
+ );
48
259
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
49
260
  "div",
50
261
  {
@@ -52,6 +263,7 @@ const CardOrder = ({
52
263
  className: "space-y-6"
53
264
  },
54
265
  children: [
266
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: attributions[type] || attributions.conversion }),
55
267
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
56
268
  "div",
57
269
  {
@@ -60,73 +272,63 @@ const CardOrder = ({
60
272
  },
61
273
  children: [
62
274
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
63
- import_card_data_item.default,
275
+ Item,
64
276
  {
65
277
  ...{
66
- className: ["flex flex-col", className].join(" "),
67
- 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"
278
+ label: "Order number",
279
+ value: provider == null ? void 0 : provider.name
77
280
  }
78
281
  }
79
282
  ),
80
283
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
81
- import_card_data_item.default,
284
+ Item,
82
285
  {
83
286
  ...{
84
- className: ["flex flex-col", className].join(" "),
85
- classNameSlotLeft: "text-sm disabled",
86
- label: "Type",
87
- value: type === "redemption" ? "Redemption" : "Campaign"
287
+ label: "Order ID",
288
+ value: provider == null ? void 0 : provider.id
289
+ }
290
+ }
291
+ ),
292
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
293
+ Item,
294
+ {
295
+ ...{
296
+ label: "Date",
297
+ value: date(purchasedAt)
88
298
  }
89
299
  }
90
300
  ),
91
301
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
92
- import_card_data_item.default,
302
+ Item,
93
303
  {
94
304
  ...{
95
- className: ["flex flex-col", className].join(" "),
96
- classNameSlotLeft: "text-sm disabled",
97
305
  label: "Currency",
98
306
  value: code
99
307
  }
100
308
  }
101
309
  ),
102
310
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
103
- import_card_data_item.default,
311
+ Item,
104
312
  {
105
313
  ...{
106
- className: ["flex flex-col", className].join(" "),
107
- classNameSlotLeft: "text-sm disabled",
108
314
  label: "Gross",
109
315
  value: (0, import_drawbridge_utils.formatCurrency)({ code, value: gross })
110
316
  }
111
317
  }
112
318
  ),
113
319
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
114
- import_card_data_item.default,
320
+ Item,
115
321
  {
116
322
  ...{
117
- className: ["flex flex-col", className].join(" "),
118
- classNameSlotLeft: "text-sm disabled",
119
323
  label: "Net",
120
324
  value: (0, import_drawbridge_utils.formatCurrency)({ code, value: net })
121
325
  }
122
326
  }
123
327
  ),
124
328
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
125
- import_card_data_item.default,
329
+ Item,
126
330
  {
127
331
  ...{
128
- className: ["flex flex-col", className].join(" "),
129
- classNameSlotLeft: "text-sm disabled",
130
332
  label: "Fee",
131
333
  // A redemption is charged no fee, so it shows no rate ( rateCell in table.js ).
132
334
  value: (0, import_drawbridge_utils.formatCurrency)({ code, value: fee }) + (type !== "redemption" && (rate || rate === 0) ? " (" + rate + "%)" : "")