@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,540 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { request } from "@drawbridge/drawbridge-utils/fetch";
5
+ import { CODE_CHANNELS, COMPLETIONS, entriesText, missions as manifests } from "@drawbridge/drawbridge-utils/missions";
6
+ import Button from "../shared/button.mjs";
7
+ import CopyToClipboard from "../shared/copy-to-clipboard.mjs";
8
+ import Error from "../shared/error.mjs";
9
+ import Check from "../icons/check.mjs";
10
+ import ChevronLeft from "../icons/chevron-left.mjs";
11
+ import ChevronRight from "../icons/chevron-right.mjs";
12
+ import Loader from "../icons/loader.mjs";
13
+ import InputGroup from "../input-group.mjs";
14
+ import InputCode from "../input-code.mjs";
15
+ import ShareButton from "./share-button.mjs";
16
+ import { FormSubdomainHeader } from "./form-subdomain-header.mjs";
17
+ import { missionEndpoint } from "./lib/url.mjs";
18
+ import { inputStyle } from "../styles.mjs";
19
+ const screenFor = (type) => {
20
+ var _a;
21
+ return {
22
+ [COMPLETIONS.code]: "send",
23
+ [COMPLETIONS.referral]: "share"
24
+ }[(_a = manifests[type]) == null ? void 0 : _a.completion] || "missions";
25
+ };
26
+ const openingScreen = (items = [], type) => {
27
+ const item = items.find((row) => row.type === type);
28
+ return item && !item.completed ? screenFor(type) : "start";
29
+ };
30
+ const bonusText = (items = [], completed = items.filter((item) => item.completed).map((item) => item.type)) => {
31
+ const open = items.filter((item) => item.type !== "form" && !completed.includes(item.type));
32
+ const total = open.reduce((sum, item) => sum + Number(item.entries || 0), 0);
33
+ return total ? total + (open.some((item) => item.type === "share") ? "+" : "") : null;
34
+ };
35
+ const pillText = (item, completed) => (completed ? "+" : "") + Number((item == null ? void 0 : item.entries) || 0);
36
+ const Pill = ({ children, style }) => {
37
+ var _a, _b, _c, _d;
38
+ return /* @__PURE__ */ jsx(
39
+ "span",
40
+ {
41
+ ...{
42
+ className: "inline-flex items-center justify-center min-w-8 h-6 px-2 rounded-full text-sm shrink-0",
43
+ style: {
44
+ backgroundColor: ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || "currentColor",
45
+ color: ((_d = (_c = style == null ? void 0 : style.background) == null ? void 0 : _c.color) == null ? void 0 : _d.rgb) || "white"
46
+ }
47
+ },
48
+ children
49
+ }
50
+ );
51
+ };
52
+ const Back = ({ onClick, style }) => {
53
+ var _a, _b;
54
+ return /* @__PURE__ */ jsx(
55
+ "div",
56
+ {
57
+ ...{
58
+ className: "pb-3 border-b",
59
+ style: {
60
+ borderColor: (_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb
61
+ }
62
+ },
63
+ children: /* @__PURE__ */ jsx(
64
+ Button,
65
+ {
66
+ ...{
67
+ icon: ChevronLeft,
68
+ inline: true,
69
+ onClick,
70
+ reverse: true,
71
+ variant: "link"
72
+ },
73
+ children: "Back to missions"
74
+ }
75
+ )
76
+ }
77
+ );
78
+ };
79
+ const Centre = ({ children }) => /* @__PURE__ */ jsx(
80
+ "div",
81
+ {
82
+ ...{
83
+ className: "space-y-1 text-center"
84
+ },
85
+ children
86
+ }
87
+ );
88
+ const Strong = ({ children, className }) => /* @__PURE__ */ jsx(
89
+ "p",
90
+ {
91
+ ...{
92
+ className: "font-bold " + (className || "")
93
+ },
94
+ children
95
+ }
96
+ );
97
+ const CodeStep = ({ disabled, error, onComplete, style }) => {
98
+ const [code, setCode] = useState("");
99
+ return /* @__PURE__ */ jsx(
100
+ InputGroup,
101
+ {
102
+ ...{
103
+ error,
104
+ input: /* @__PURE__ */ jsx(
105
+ InputCode,
106
+ {
107
+ ...{
108
+ autoFocus: true,
109
+ disabled,
110
+ onChange: setCode,
111
+ onComplete,
112
+ style,
113
+ value: code
114
+ }
115
+ }
116
+ ),
117
+ label: "Verification code",
118
+ style
119
+ }
120
+ }
121
+ );
122
+ };
123
+ const FormSubdomainMissions = ({
124
+ advertisements,
125
+ button,
126
+ contact,
127
+ initial,
128
+ message,
129
+ missions: items = [],
130
+ shareLink,
131
+ slug,
132
+ style,
133
+ subdomain,
134
+ title,
135
+ token
136
+ }) => {
137
+ var _a, _b;
138
+ const [screen, setScreen] = useState(openingScreen(items, initial));
139
+ const [mission, setMission] = useState(initial);
140
+ const [completed, setCompleted] = useState(items.filter((item2) => item2.completed).map((item2) => item2.type));
141
+ const [busy, setBusy] = useState(false);
142
+ const [error, setError] = useState(null);
143
+ const [attempt, setAttempt] = useState(0);
144
+ const manifest = manifests[mission];
145
+ const item = items.find((row) => row.type === mission);
146
+ const words = (manifest == null ? void 0 : manifest.words) || {};
147
+ const go = (next, type = mission) => {
148
+ setError(null);
149
+ setMission(type);
150
+ setScreen(next);
151
+ };
152
+ const back = () => go("missions");
153
+ const header = (text, back2) => /* @__PURE__ */ jsx(
154
+ FormSubdomainHeader,
155
+ {
156
+ ...{
157
+ back: back2,
158
+ button,
159
+ style,
160
+ title: text
161
+ }
162
+ }
163
+ );
164
+ const call = async (action, body = {}) => request({
165
+ body: {
166
+ ...body,
167
+ token
168
+ },
169
+ endpoint: missionEndpoint({ action, slug, subdomain, type: mission }),
170
+ method: "POST"
171
+ });
172
+ const send = async () => {
173
+ setBusy(true);
174
+ try {
175
+ await call("send");
176
+ setError(null);
177
+ setAttempt(attempt + 1);
178
+ setScreen("code");
179
+ } catch ({ message: text }) {
180
+ setError(text);
181
+ }
182
+ setBusy(false);
183
+ };
184
+ const confirm = async (code) => {
185
+ setBusy(true);
186
+ try {
187
+ await call("confirm", { code });
188
+ setCompleted([.../* @__PURE__ */ new Set([...completed, mission])]);
189
+ go("done");
190
+ } catch ({ message: text }) {
191
+ setError(text || "Verification code incorrect");
192
+ setAttempt(attempt + 1);
193
+ }
194
+ setBusy(false);
195
+ };
196
+ if (screen === "send") return /* @__PURE__ */ jsxs(
197
+ "div",
198
+ {
199
+ ...{
200
+ className: "space-y-6"
201
+ },
202
+ children: [
203
+ header(words.title),
204
+ /* @__PURE__ */ jsx(Back, { ...{ onClick: back, style } }),
205
+ /* @__PURE__ */ jsxs(Centre, { children: [
206
+ /* @__PURE__ */ jsx("p", { children: words.send }),
207
+ /* @__PURE__ */ jsx(Strong, { ...{ className: "break-all" }, children: contact == null ? void 0 : contact[CODE_CHANNELS[manifest == null ? void 0 : manifest.channel]] })
208
+ ] }),
209
+ error && /* @__PURE__ */ jsx(
210
+ Error,
211
+ {
212
+ ...{
213
+ error,
214
+ style
215
+ }
216
+ }
217
+ ),
218
+ (item == null ? void 0 : item.refused) ? /* @__PURE__ */ jsx(
219
+ "p",
220
+ {
221
+ ...{
222
+ className: "text-center"
223
+ },
224
+ children: words.refused
225
+ }
226
+ ) : /* @__PURE__ */ jsx(
227
+ Button,
228
+ {
229
+ ...{
230
+ loading: busy,
231
+ onClick: send,
232
+ style
233
+ },
234
+ children: "Verify"
235
+ }
236
+ )
237
+ ]
238
+ }
239
+ );
240
+ if (screen === "code") return /* @__PURE__ */ jsxs(
241
+ "div",
242
+ {
243
+ ...{
244
+ className: "space-y-6"
245
+ },
246
+ children: [
247
+ header(words.title),
248
+ /* @__PURE__ */ jsx(Back, { ...{ onClick: back, style } }),
249
+ /* @__PURE__ */ jsx(Centre, { children: /* @__PURE__ */ jsx(Strong, { children: words.sent }) }),
250
+ /* @__PURE__ */ jsx(
251
+ CodeStep,
252
+ {
253
+ ...{
254
+ disabled: busy,
255
+ error,
256
+ onComplete: confirm,
257
+ style
258
+ }
259
+ },
260
+ attempt
261
+ ),
262
+ busy && /* @__PURE__ */ jsx(
263
+ "div",
264
+ {
265
+ ...{
266
+ className: "flex justify-center"
267
+ },
268
+ children: /* @__PURE__ */ jsx(
269
+ Loader,
270
+ {
271
+ ...{
272
+ className: "w-5 h-5 animate-spin"
273
+ }
274
+ }
275
+ )
276
+ }
277
+ ),
278
+ /* @__PURE__ */ jsxs(
279
+ "p",
280
+ {
281
+ ...{
282
+ className: "text-sm text-center"
283
+ },
284
+ children: [
285
+ "Didn't get it? ",
286
+ /* @__PURE__ */ jsx(
287
+ Button,
288
+ {
289
+ ...{
290
+ disabled: busy,
291
+ inline: true,
292
+ onClick: send,
293
+ variant: "link"
294
+ },
295
+ children: "Resend code"
296
+ }
297
+ )
298
+ ]
299
+ }
300
+ )
301
+ ]
302
+ }
303
+ );
304
+ if (screen === "share") return /* @__PURE__ */ jsxs(
305
+ "div",
306
+ {
307
+ ...{
308
+ className: "space-y-6"
309
+ },
310
+ children: [
311
+ header(words.title),
312
+ /* @__PURE__ */ jsx(Back, { ...{ onClick: back, style } }),
313
+ /* @__PURE__ */ jsxs(Centre, { children: [
314
+ /* @__PURE__ */ jsx(Strong, { children: words.title }),
315
+ /* @__PURE__ */ jsx("p", { children: String(words.pays || "").replace("{entries}", entriesText(item == null ? void 0 : item.entries)) })
316
+ ] }),
317
+ shareLink && /* @__PURE__ */ jsx(
318
+ "div",
319
+ {
320
+ ...{
321
+ className: "px-4 py-3 border",
322
+ style: inputStyle(style)
323
+ },
324
+ children: /* @__PURE__ */ jsx(
325
+ CopyToClipboard,
326
+ {
327
+ ...{
328
+ className: "justify-between",
329
+ message: "Copied",
330
+ style,
331
+ value: shareLink
332
+ },
333
+ children: /* @__PURE__ */ jsx(
334
+ "span",
335
+ {
336
+ ...{
337
+ className: "truncate"
338
+ },
339
+ children: shareLink
340
+ }
341
+ )
342
+ }
343
+ )
344
+ }
345
+ ),
346
+ /* @__PURE__ */ jsx(
347
+ ShareButton,
348
+ {
349
+ ...{
350
+ style,
351
+ values: {
352
+ url: shareLink
353
+ }
354
+ }
355
+ }
356
+ )
357
+ ]
358
+ }
359
+ );
360
+ if (screen === "done") return /* @__PURE__ */ jsxs(
361
+ "div",
362
+ {
363
+ ...{
364
+ className: "space-y-6"
365
+ },
366
+ children: [
367
+ header("Thank you!"),
368
+ /* @__PURE__ */ jsx(Back, { ...{ onClick: back, style } }),
369
+ /* @__PURE__ */ jsxs(Centre, { children: [
370
+ /* @__PURE__ */ jsx(Strong, { children: "Mission accomplished!" }),
371
+ /* @__PURE__ */ jsx("p", { children: "Your bonus entries are in. Go back to missions to earn more." })
372
+ ] })
373
+ ]
374
+ }
375
+ );
376
+ if (screen === "start") {
377
+ const bonus = bonusText(items, completed);
378
+ return /* @__PURE__ */ jsxs(
379
+ "div",
380
+ {
381
+ ...{
382
+ className: "space-y-6"
383
+ },
384
+ children: [
385
+ header(title),
386
+ message && /* @__PURE__ */ jsx(
387
+ "p",
388
+ {
389
+ ...{
390
+ "aria-live": "polite",
391
+ className: "text-center",
392
+ role: "alert"
393
+ },
394
+ children: message
395
+ }
396
+ ),
397
+ bonus && /* @__PURE__ */ jsx(
398
+ Button,
399
+ {
400
+ ...{
401
+ onClick: () => go("missions"),
402
+ variant: "link"
403
+ },
404
+ children: /* @__PURE__ */ jsxs(
405
+ "span",
406
+ {
407
+ ...{
408
+ className: "flex w-full items-center gap-4 px-4 py-3 border text-left",
409
+ style: inputStyle(style)
410
+ },
411
+ children: [
412
+ /* @__PURE__ */ jsx(Pill, { ...{ style }, children: bonus }),
413
+ /* @__PURE__ */ jsx(
414
+ "span",
415
+ {
416
+ ...{
417
+ className: "flex-1"
418
+ },
419
+ children: "Bonus entries available"
420
+ }
421
+ ),
422
+ /* @__PURE__ */ jsx(
423
+ ChevronRight,
424
+ {
425
+ ...{
426
+ "aria-hidden": true,
427
+ className: "w-4 h-4"
428
+ }
429
+ }
430
+ )
431
+ ]
432
+ }
433
+ )
434
+ }
435
+ ),
436
+ advertisements
437
+ ]
438
+ }
439
+ );
440
+ }
441
+ return /* @__PURE__ */ jsxs(
442
+ "div",
443
+ {
444
+ ...{
445
+ className: "space-y-6"
446
+ },
447
+ children: [
448
+ header("Earn more entries", { onClick: () => go("start") }),
449
+ /* @__PURE__ */ jsx(
450
+ "ul",
451
+ {
452
+ ...{
453
+ className: "divide-y",
454
+ style: {
455
+ borderColor: (_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb
456
+ }
457
+ },
458
+ children: items.filter((row) => manifests[row.type]).map((row, index) => {
459
+ var _a2;
460
+ const finished = completed.includes(row.type);
461
+ const opens = screenFor(row.type);
462
+ const Mark = finished ? Check : ChevronRight;
463
+ const content = /* @__PURE__ */ jsxs(
464
+ "span",
465
+ {
466
+ ...{
467
+ className: "flex w-full items-center gap-4 text-left " + (index ? "py-4" : "pb-4")
468
+ },
469
+ children: [
470
+ /* @__PURE__ */ jsxs(
471
+ "span",
472
+ {
473
+ ...{
474
+ className: "flex items-center gap-4 flex-1 min-w-0" + (finished ? " opacity-40" : "")
475
+ },
476
+ children: [
477
+ /* @__PURE__ */ jsx(Pill, { ...{ style }, children: pillText(row, finished) }),
478
+ /* @__PURE__ */ jsx(
479
+ "span",
480
+ {
481
+ ...{
482
+ className: "text-sm"
483
+ },
484
+ children: manifests[row.type].sentence
485
+ }
486
+ )
487
+ ]
488
+ }
489
+ ),
490
+ (finished || opens !== "missions") && /* @__PURE__ */ jsx(Pill, { ...{ style }, children: /* @__PURE__ */ jsx(
491
+ Mark,
492
+ {
493
+ ...{
494
+ "aria-hidden": true,
495
+ className: "w-4 h-4"
496
+ }
497
+ }
498
+ ) })
499
+ ]
500
+ }
501
+ );
502
+ return /* @__PURE__ */ jsx(
503
+ "li",
504
+ {
505
+ ...{
506
+ style: {
507
+ borderColor: "inherit"
508
+ }
509
+ },
510
+ children: finished || opens === "missions" ? content : /* @__PURE__ */ jsx(
511
+ Button,
512
+ {
513
+ ...{
514
+ "aria-label": ((_a2 = manifests[row.type].words) == null ? void 0 : _a2.title) || manifests[row.type].title,
515
+ onClick: () => go(opens, row.type),
516
+ variant: "link"
517
+ },
518
+ children: content
519
+ }
520
+ )
521
+ },
522
+ row.type
523
+ );
524
+ })
525
+ }
526
+ ),
527
+ advertisements
528
+ ]
529
+ }
530
+ );
531
+ };
532
+ var form_subdomain_missions_default = FormSubdomainMissions;
533
+ export {
534
+ FormSubdomainMissions,
535
+ bonusText,
536
+ form_subdomain_missions_default as default,
537
+ openingScreen,
538
+ pillText,
539
+ screenFor
540
+ };