@drawbridge/components 0.1.34 → 0.1.35

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 (328) hide show
  1. package/components/styles.css +68 -355
  2. package/dist/advertisement.js +15 -20
  3. package/dist/advertisement.mjs +15 -20
  4. package/dist/bridge/advertisements.js +4 -2
  5. package/dist/bridge/advertisements.mjs +5 -3
  6. package/dist/bridge/fields.js +89 -6
  7. package/dist/bridge/fields.mjs +89 -7
  8. package/dist/bridge/form-subdomain-agreement.js +165 -0
  9. package/dist/bridge/form-subdomain-agreement.mjs +132 -0
  10. package/dist/bridge/form-subdomain-embed.js +5 -1
  11. package/dist/bridge/form-subdomain-embed.mjs +5 -1
  12. package/dist/bridge/form-subdomain-header.js +21 -14
  13. package/dist/bridge/form-subdomain-header.mjs +20 -14
  14. package/dist/bridge/form-subdomain-issue.js +17 -8
  15. package/dist/bridge/form-subdomain-issue.mjs +17 -8
  16. package/dist/bridge/form-subdomain-missions.js +58 -52
  17. package/dist/bridge/form-subdomain-missions.mjs +60 -54
  18. package/dist/bridge/form-subdomain.js +223 -94
  19. package/dist/bridge/form-subdomain.mjs +222 -96
  20. package/dist/bridge/lib/entry.js +61 -6
  21. package/dist/bridge/lib/entry.mjs +51 -5
  22. package/dist/bridge/lib/order.js +23 -0
  23. package/dist/bridge/lib/order.mjs +20 -0
  24. package/dist/bridge/template-layout.js +5 -2
  25. package/dist/bridge/template-layout.mjs +6 -3
  26. package/dist/bridge/template-modal.js +82 -15
  27. package/dist/bridge/template-modal.mjs +83 -16
  28. package/dist/bridge/template-subdomain-gallery.js +126 -75
  29. package/dist/bridge/template-subdomain-gallery.mjs +122 -75
  30. package/dist/bridge/template-subdomain.js +16 -14
  31. package/dist/bridge/template-subdomain.mjs +17 -15
  32. package/dist/dashboard/avatar.js +5 -0
  33. package/dist/dashboard/avatar.mjs +5 -0
  34. package/dist/dashboard/campaign-form.js +1798 -0
  35. package/dist/dashboard/campaign-form.mjs +1769 -0
  36. package/dist/dashboard/card-affiliate.js +3 -2
  37. package/dist/dashboard/card-affiliate.mjs +3 -2
  38. package/dist/dashboard/card-campaign-agreement.js +172 -0
  39. package/dist/dashboard/card-campaign-agreement.mjs +139 -0
  40. package/dist/dashboard/card-campaign-switch.js +34 -9
  41. package/dist/dashboard/card-campaign-switch.mjs +32 -8
  42. package/dist/dashboard/card-order.js +6 -14
  43. package/dist/dashboard/card-order.mjs +6 -14
  44. package/dist/dashboard/card-section.js +69 -26
  45. package/dist/dashboard/card-section.mjs +65 -26
  46. package/dist/dashboard/card-shortcut.js +181 -0
  47. package/dist/dashboard/card-shortcut.mjs +152 -0
  48. package/dist/dashboard/card-tile.js +3 -35
  49. package/dist/dashboard/card-tile.mjs +3 -34
  50. package/dist/dashboard/document-blocks.js +305 -0
  51. package/dist/dashboard/document-blocks.mjs +270 -0
  52. package/dist/dashboard/drawer-subscription.js +52 -14
  53. package/dist/dashboard/drawer-subscription.mjs +52 -14
  54. package/dist/dashboard/drawer.js +20 -3
  55. package/dist/dashboard/drawer.mjs +21 -4
  56. package/dist/dashboard/dropdown.js +6 -2
  57. package/dist/dashboard/dropdown.mjs +6 -2
  58. package/dist/dashboard/form-admin-subscription-custom.js +72 -8
  59. package/dist/dashboard/form-admin-subscription-custom.mjs +72 -8
  60. package/dist/dashboard/form-ai.js +0 -148
  61. package/dist/dashboard/form-ai.mjs +1 -148
  62. package/dist/dashboard/form-filters-analytics.js +88 -37
  63. package/dist/dashboard/form-filters-analytics.mjs +85 -38
  64. package/dist/dashboard/form-organization-brand.js +30 -13
  65. package/dist/dashboard/form-organization-brand.mjs +30 -13
  66. package/dist/dashboard/form-organization-campaign-advertisement.js +38 -112
  67. package/dist/dashboard/form-organization-campaign-advertisement.mjs +38 -112
  68. package/dist/dashboard/form-organization-campaign-advertisements.js +374 -0
  69. package/dist/dashboard/form-organization-campaign-advertisements.mjs +345 -0
  70. package/dist/dashboard/form-organization-campaign-agreement.js +414 -210
  71. package/dist/dashboard/form-organization-campaign-agreement.mjs +411 -212
  72. package/dist/dashboard/form-organization-campaign-design.js +258 -0
  73. package/dist/dashboard/form-organization-campaign-design.mjs +223 -0
  74. package/dist/dashboard/form-organization-campaign-field-item.js +585 -0
  75. package/dist/dashboard/form-organization-campaign-field-item.mjs +552 -0
  76. package/dist/dashboard/form-organization-campaign-field-number.js +48 -7
  77. package/dist/dashboard/form-organization-campaign-field-number.mjs +48 -7
  78. package/dist/dashboard/form-organization-campaign-field-select.js +15 -4
  79. package/dist/dashboard/form-organization-campaign-field-select.mjs +15 -4
  80. package/dist/dashboard/form-organization-campaign-field-skill.js +359 -0
  81. package/dist/dashboard/form-organization-campaign-field-skill.mjs +330 -0
  82. package/dist/dashboard/form-organization-campaign-field-text.js +46 -6
  83. package/dist/dashboard/form-organization-campaign-field-text.mjs +46 -6
  84. package/dist/dashboard/form-organization-campaign-field-textarea.js +22 -13
  85. package/dist/dashboard/form-organization-campaign-field-textarea.mjs +22 -13
  86. package/dist/dashboard/form-organization-campaign-footer.js +178 -0
  87. package/dist/dashboard/form-organization-campaign-footer.mjs +149 -0
  88. package/dist/dashboard/form-organization-campaign-integration-age.js +2 -35
  89. package/dist/dashboard/form-organization-campaign-integration-age.mjs +2 -35
  90. package/dist/dashboard/form-organization-campaign-integration-geocode.js +4 -1
  91. package/dist/dashboard/form-organization-campaign-integration-geocode.mjs +4 -1
  92. package/dist/dashboard/form-organization-campaign-page-embed.js +1 -1
  93. package/dist/dashboard/form-organization-campaign-page-embed.mjs +1 -1
  94. package/dist/dashboard/form-organization-campaign-page-preview.js +1 -2
  95. package/dist/dashboard/form-organization-campaign-page-preview.mjs +1 -2
  96. package/dist/dashboard/form-organization-campaign-page-qr.js +2 -2
  97. package/dist/dashboard/form-organization-campaign-page-qr.mjs +2 -2
  98. package/dist/dashboard/form-organization-campaign-page-share.js +5 -5
  99. package/dist/dashboard/form-organization-campaign-page-share.mjs +5 -5
  100. package/dist/dashboard/form-organization-campaign-page-slug.js +2 -3
  101. package/dist/dashboard/form-organization-campaign-page-slug.mjs +2 -3
  102. package/dist/dashboard/form-organization-campaign-page.js +168 -265
  103. package/dist/dashboard/form-organization-campaign-page.mjs +170 -266
  104. package/dist/dashboard/form-organization-campaign-section.js +125 -107
  105. package/dist/dashboard/form-organization-campaign-section.mjs +121 -107
  106. package/dist/dashboard/form-organization-campaign.js +119 -9
  107. package/dist/dashboard/form-organization-campaign.mjs +118 -9
  108. package/dist/dashboard/form-organization-file-frame.js +7 -1
  109. package/dist/dashboard/form-organization-file-frame.mjs +7 -1
  110. package/dist/dashboard/form-organization-workflow.js +587 -530
  111. package/dist/dashboard/form-organization-workflow.mjs +588 -531
  112. package/dist/dashboard/form-organization.js +22 -0
  113. package/dist/dashboard/form-organization.mjs +22 -0
  114. package/dist/dashboard/form-reposition.js +396 -0
  115. package/dist/dashboard/form-reposition.mjs +359 -0
  116. package/dist/dashboard/form-support.js +189 -0
  117. package/dist/dashboard/form-support.mjs +160 -0
  118. package/dist/dashboard/form-tests.js +683 -0
  119. package/dist/dashboard/form-tests.mjs +646 -0
  120. package/dist/dashboard/form-verify-prize.js +114 -34
  121. package/dist/dashboard/form-verify-prize.mjs +111 -34
  122. package/dist/dashboard/google.js +8 -1
  123. package/dist/dashboard/google.mjs +8 -1
  124. package/dist/dashboard/input-array.js +2 -0
  125. package/dist/dashboard/input-array.mjs +2 -0
  126. package/dist/dashboard/input-editor.js +17 -6
  127. package/dist/dashboard/input-editor.mjs +17 -6
  128. package/dist/dashboard/input-fields.js +287 -437
  129. package/dist/dashboard/input-fields.mjs +287 -436
  130. package/dist/dashboard/input-file.js +70 -2
  131. package/dist/dashboard/input-file.mjs +70 -2
  132. package/dist/dashboard/input-font.js +64 -55
  133. package/dist/dashboard/input-font.mjs +64 -55
  134. package/dist/dashboard/input-resource.js +4 -1
  135. package/dist/dashboard/input-resource.mjs +4 -1
  136. package/dist/dashboard/lib/ab-tests.js +130 -0
  137. package/dist/dashboard/lib/ab-tests.mjs +94 -0
  138. package/dist/dashboard/lib/features.js +1 -1
  139. package/dist/dashboard/lib/features.mjs +1 -1
  140. package/dist/dashboard/lib/focus.js +93 -0
  141. package/dist/dashboard/lib/focus.mjs +69 -0
  142. package/dist/dashboard/lib/form-page.js +203 -0
  143. package/dist/dashboard/lib/form-page.mjs +155 -0
  144. package/dist/dashboard/lib/item-list.js +0 -15
  145. package/dist/dashboard/lib/item-list.mjs +0 -14
  146. package/dist/dashboard/lib/rail.js +16 -17
  147. package/dist/dashboard/lib/rail.mjs +15 -16
  148. package/dist/dashboard/lib/sms.js +8 -2
  149. package/dist/dashboard/lib/sms.mjs +6 -1
  150. package/dist/dashboard/list-resource.js +2 -0
  151. package/dist/dashboard/list-resource.mjs +2 -0
  152. package/dist/dashboard/menu.js +54 -5
  153. package/dist/dashboard/menu.mjs +53 -5
  154. package/dist/dashboard/modal.js +19 -4
  155. package/dist/dashboard/modal.mjs +20 -5
  156. package/dist/dashboard/order-sections.js +4 -0
  157. package/dist/dashboard/order-sections.mjs +4 -0
  158. package/dist/dashboard/preview.js +838 -324
  159. package/dist/dashboard/preview.mjs +826 -324
  160. package/dist/dashboard/provider-ui.js +20 -12
  161. package/dist/dashboard/provider-ui.mjs +21 -13
  162. package/dist/dashboard/recharts.js +53 -28
  163. package/dist/dashboard/recharts.mjs +53 -28
  164. package/dist/dashboard/swatch.js +35 -0
  165. package/dist/dashboard/swatch.mjs +31 -0
  166. package/dist/dashboard/table-contacts.js +6 -10
  167. package/dist/dashboard/table-contacts.mjs +6 -10
  168. package/dist/dashboard/table.js +10 -3
  169. package/dist/dashboard/table.mjs +9 -3
  170. package/dist/dashboard/template-dashboard.js +12 -7
  171. package/dist/dashboard/template-dashboard.mjs +11 -7
  172. package/dist/dashboard/template-design.js +564 -0
  173. package/dist/dashboard/template-design.mjs +531 -0
  174. package/dist/dashboard/template-rail.js +198 -126
  175. package/dist/dashboard/template-rail.mjs +196 -125
  176. package/dist/dashboard/template-socket.js +0 -3
  177. package/dist/dashboard/template-socket.mjs +0 -3
  178. package/dist/dashboard/template-test-page.js +436 -0
  179. package/dist/dashboard/template-test-page.mjs +407 -0
  180. package/dist/dashboard/template-tests.js +141 -0
  181. package/dist/dashboard/template-tests.mjs +112 -0
  182. package/dist/dashboard/template-ui.js +20 -11
  183. package/dist/dashboard/template-ui.mjs +22 -13
  184. package/dist/dashboard/template-variant.js +185 -0
  185. package/dist/dashboard/template-variant.mjs +156 -0
  186. package/dist/icons/arrow-down-long.js +47 -0
  187. package/dist/icons/arrow-down-long.mjs +28 -0
  188. package/dist/icons/arrows-pointing-out.js +46 -0
  189. package/dist/icons/arrows-pointing-out.mjs +27 -0
  190. package/dist/icons/beaker.js +46 -0
  191. package/dist/icons/beaker.mjs +27 -0
  192. package/dist/icons/identification.js +46 -0
  193. package/dist/icons/identification.mjs +27 -0
  194. package/dist/icons/lifebuoy.js +46 -0
  195. package/dist/icons/lifebuoy.mjs +27 -0
  196. package/dist/icons/rectangle-group.js +46 -0
  197. package/dist/icons/rectangle-group.mjs +27 -0
  198. package/dist/icons/rectangle-stack.js +46 -0
  199. package/dist/icons/rectangle-stack.mjs +27 -0
  200. package/dist/icons/shopping-bag.js +46 -0
  201. package/dist/icons/shopping-bag.mjs +27 -0
  202. package/dist/icons/swatch.js +46 -0
  203. package/dist/icons/swatch.mjs +27 -0
  204. package/dist/icons/window.js +46 -0
  205. package/dist/icons/window.mjs +27 -0
  206. package/dist/icons/zoom-in.js +46 -0
  207. package/dist/icons/zoom-in.mjs +27 -0
  208. package/dist/input-answer.js +60 -0
  209. package/dist/input-answer.mjs +27 -0
  210. package/dist/input-checkbox.js +7 -1
  211. package/dist/input-checkbox.mjs +7 -1
  212. package/dist/input-name.js +3 -3
  213. package/dist/input-name.mjs +3 -3
  214. package/dist/input-select.js +3 -1
  215. package/dist/input-select.mjs +3 -1
  216. package/dist/provider-font.js +4 -3
  217. package/dist/provider-font.mjs +4 -3
  218. package/dist/shared/badge.js +15 -0
  219. package/dist/shared/badge.mjs +11 -0
  220. package/dist/shared/carousel.js +11 -7
  221. package/dist/shared/carousel.mjs +11 -7
  222. package/dist/shared/document-pieces.js +295 -0
  223. package/dist/shared/document-pieces.mjs +260 -0
  224. package/dist/shared/lib/campaign.js +3 -9
  225. package/dist/shared/lib/campaign.mjs +3 -9
  226. package/dist/shared/lib/helpers.js +24 -0
  227. package/dist/shared/lib/helpers.mjs +22 -0
  228. package/dist/shared/lib/video.js +6 -0
  229. package/dist/shared/lib/video.mjs +5 -0
  230. package/dist/shared/sortable.js +27 -10
  231. package/dist/shared/sortable.mjs +27 -10
  232. package/dist/shared/tabs.js +1 -1
  233. package/dist/shared/tabs.mjs +1 -1
  234. package/dist/video.js +127 -9
  235. package/dist/video.mjs +125 -11
  236. package/package.json +176 -20
  237. package/types/bridge/fields.d.ts +6 -1
  238. package/types/bridge/form-subdomain-agreement.d.ts +27 -0
  239. package/types/bridge/form-subdomain-missions.d.ts +2 -0
  240. package/types/bridge/form-subdomain.d.ts +62 -3
  241. package/types/bridge/lib/entry.d.ts +44 -7
  242. package/types/bridge/lib/order.d.ts +13 -2
  243. package/types/bridge/subdomain-content.d.ts +1 -0
  244. package/types/bridge/template-subdomain-gallery.d.ts +13 -1
  245. package/types/dashboard/campaign-form.d.ts +42 -0
  246. package/types/dashboard/card-campaign-agreement.d.ts +26 -0
  247. package/types/dashboard/card-campaign-switch.d.ts +20 -1
  248. package/types/dashboard/card-order.d.ts +2 -2
  249. package/types/dashboard/card-section.d.ts +9 -1
  250. package/types/dashboard/card-shortcut.d.ts +38 -0
  251. package/types/dashboard/card-tile.d.ts +4 -9
  252. package/types/dashboard/document-blocks.d.ts +14 -0
  253. package/types/dashboard/drawer.d.ts +3 -0
  254. package/types/dashboard/form-ai.d.ts +0 -17
  255. package/types/dashboard/form-organization-brand.d.ts +3 -0
  256. package/types/dashboard/form-organization-campaign-advertisements.d.ts +15 -0
  257. package/types/dashboard/form-organization-campaign-agreement.d.ts +53 -10
  258. package/types/dashboard/form-organization-campaign-design.d.ts +46 -0
  259. package/types/dashboard/form-organization-campaign-field-item.d.ts +36 -0
  260. package/types/dashboard/form-organization-campaign-field-number.d.ts +4 -1
  261. package/types/dashboard/form-organization-campaign-field-select.d.ts +6 -1
  262. package/types/dashboard/form-organization-campaign-field-skill.d.ts +36 -0
  263. package/types/dashboard/form-organization-campaign-field-text.d.ts +5 -1
  264. package/types/dashboard/form-organization-campaign-field-textarea.d.ts +4 -1
  265. package/types/dashboard/form-organization-campaign-footer.d.ts +23 -0
  266. package/types/dashboard/form-organization-campaign-integration-age.d.ts +2 -1
  267. package/types/dashboard/form-organization-campaign-integration-geocode.d.ts +2 -0
  268. package/types/dashboard/form-organization-campaign-page.d.ts +9 -15
  269. package/types/dashboard/form-organization-campaign-section.d.ts +24 -8
  270. package/types/dashboard/form-organization-campaign.d.ts +3 -0
  271. package/types/dashboard/form-organization-workflow.d.ts +3 -0
  272. package/types/dashboard/form-organization.d.ts +2 -2
  273. package/types/dashboard/form-reposition.d.ts +29 -0
  274. package/types/dashboard/form-support.d.ts +14 -0
  275. package/types/dashboard/form-tests.d.ts +78 -0
  276. package/types/dashboard/form-verify-prize.d.ts +30 -3
  277. package/types/dashboard/input-editor.d.ts +9 -0
  278. package/types/dashboard/input-fields.d.ts +8 -5
  279. package/types/dashboard/input-file.d.ts +4 -0
  280. package/types/dashboard/input-resource.d.ts +1 -0
  281. package/types/dashboard/lib/ab-tests.d.ts +50 -0
  282. package/types/dashboard/lib/escape.d.ts +4 -0
  283. package/types/dashboard/lib/focus.d.ts +16 -0
  284. package/types/dashboard/lib/form-page.d.ts +25 -0
  285. package/types/dashboard/lib/item-list.d.ts +10 -5
  286. package/types/dashboard/lib/rail.d.ts +0 -1
  287. package/types/dashboard/lib/sms.d.ts +7 -0
  288. package/types/dashboard/modal.d.ts +3 -1
  289. package/types/dashboard/preview.d.ts +65 -10
  290. package/types/dashboard/recharts.d.ts +3 -0
  291. package/types/dashboard/swatch.d.ts +4 -0
  292. package/types/dashboard/template-dashboard.d.ts +3 -0
  293. package/types/dashboard/template-design.d.ts +30 -0
  294. package/types/dashboard/template-test-page.d.ts +69 -0
  295. package/types/dashboard/template-tests.d.ts +30 -0
  296. package/types/dashboard/template-variant.d.ts +18 -0
  297. package/types/icons/arrow-down-long.d.ts +5 -0
  298. package/types/icons/arrows-pointing-out.d.ts +5 -0
  299. package/types/icons/beaker.d.ts +5 -0
  300. package/types/icons/identification.d.ts +5 -0
  301. package/types/icons/lifebuoy.d.ts +5 -0
  302. package/types/icons/rectangle-group.d.ts +5 -0
  303. package/types/icons/rectangle-stack.d.ts +5 -0
  304. package/types/icons/shopping-bag.d.ts +5 -0
  305. package/types/icons/swatch.d.ts +5 -0
  306. package/types/icons/window.d.ts +5 -0
  307. package/types/icons/zoom-in.d.ts +5 -0
  308. package/types/input-answer.d.ts +15 -0
  309. package/types/input-select.d.ts +2 -0
  310. package/types/shared/button.d.ts +1 -1
  311. package/types/shared/document-pieces.d.ts +34 -0
  312. package/types/shared/lib/helpers.d.ts +22 -1
  313. package/types/shared/lib/motion.d.ts +2 -0
  314. package/types/shared/lib/video.d.ts +3 -0
  315. package/types/shared/sortable.d.ts +6 -0
  316. package/types/video.d.ts +18 -2
  317. package/dist/bridge/template-preview.js +0 -208
  318. package/dist/bridge/template-preview.mjs +0 -173
  319. package/dist/dashboard/device.js +0 -95
  320. package/dist/dashboard/device.mjs +0 -72
  321. package/dist/dashboard/form-organization-campaign-field-list.js +0 -425
  322. package/dist/dashboard/form-organization-campaign-field-list.mjs +0 -396
  323. package/dist/dashboard/item-row.js +0 -92
  324. package/dist/dashboard/item-row.mjs +0 -63
  325. package/types/bridge/template-preview.d.ts +0 -10
  326. package/types/dashboard/device.d.ts +0 -12
  327. package/types/dashboard/form-organization-campaign-field-list.d.ts +0 -36
  328. package/types/dashboard/item-row.d.ts +0 -25
@@ -51,11 +51,24 @@ const ProviderUi = ({
51
51
  const queryClient = (0, import_react_query.useQueryClient)();
52
52
  queryClient.setQueryDefaults(["socket"], { structuralSharing: false });
53
53
  const tokenRef = (0, import_react.useRef)(token);
54
+ (0, import_fetch.setMemoryToken)(token);
54
55
  (0, import_react.useEffect)(
55
56
  () => {
56
- (0, import_fetch.setMemoryToken)(token);
57
+ (0, import_fetch.setTokenRefresher)(async () => {
58
+ var _a2;
59
+ const response = await fetch(
60
+ "/api/auth/refresh",
61
+ {
62
+ method: "POST"
63
+ }
64
+ );
65
+ const fresh = response.ok ? ((_a2 = await response.json()) == null ? void 0 : _a2.token) || null : null;
66
+ if (fresh) tokenRef.current = fresh;
67
+ return fresh;
68
+ });
69
+ return () => (0, import_fetch.setTokenRefresher)(null);
57
70
  },
58
- [token]
71
+ []
59
72
  );
60
73
  (0, import_react.useEffect)(
61
74
  () => {
@@ -87,8 +100,7 @@ const ProviderUi = ({
87
100
  queryKey: ["account"],
88
101
  queryFn: async () => {
89
102
  const { result } = await (0, import_fetch.request)({
90
- endpoint: "/account",
91
- token
103
+ endpoint: "/account"
92
104
  });
93
105
  return result || {};
94
106
  },
@@ -98,8 +110,7 @@ const ProviderUi = ({
98
110
  queryKey: ["app"],
99
111
  queryFn: async () => {
100
112
  const { result } = await (0, import_fetch.request)({
101
- endpoint: "/app",
102
- token
113
+ endpoint: "/app"
103
114
  });
104
115
  return result || {};
105
116
  }
@@ -108,8 +119,7 @@ const ProviderUi = ({
108
119
  queryKey: ["countries"],
109
120
  queryFn: async () => {
110
121
  const { result } = await (0, import_fetch.request)({
111
- endpoint: "/app/countries",
112
- token
122
+ endpoint: "/app/countries"
113
123
  });
114
124
  return result || {};
115
125
  }
@@ -118,8 +128,7 @@ const ProviderUi = ({
118
128
  queryKey: ["currencies"],
119
129
  queryFn: async () => {
120
130
  const { result } = await (0, import_fetch.request)({
121
- endpoint: "/app/currencies",
122
- token
131
+ endpoint: "/app/currencies"
123
132
  });
124
133
  return result || {};
125
134
  }
@@ -164,8 +173,7 @@ const ProviderUi = ({
164
173
  queryKey: ["account", "balance"],
165
174
  queryFn: async () => {
166
175
  const { result } = await (0, import_fetch.request)({
167
- endpoint: "/account/balance",
168
- token
176
+ endpoint: "/account/balance"
169
177
  });
170
178
  return result || {};
171
179
  },
@@ -2,7 +2,7 @@
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { Fragment, useEffect, useRef } from "react";
4
4
  import { useQueries, useQueryClient } from "@tanstack/react-query";
5
- import { isTransientError, request, setMemoryToken } from "@drawbridge/drawbridge-utils/fetch";
5
+ import { isTransientError, request, setMemoryToken, setTokenRefresher } from "@drawbridge/drawbridge-utils/fetch";
6
6
  import { io } from "socket.io-client";
7
7
  import TemplateNotFound from "./template-not-found.mjs";
8
8
  import { expiredSessionHref, retrySession, sessionRetryKey } from "./lib/navigation.mjs";
@@ -19,11 +19,24 @@ const ProviderUi = ({
19
19
  const queryClient = useQueryClient();
20
20
  queryClient.setQueryDefaults(["socket"], { structuralSharing: false });
21
21
  const tokenRef = useRef(token);
22
+ setMemoryToken(token);
22
23
  useEffect(
23
24
  () => {
24
- setMemoryToken(token);
25
+ setTokenRefresher(async () => {
26
+ var _a2;
27
+ const response = await fetch(
28
+ "/api/auth/refresh",
29
+ {
30
+ method: "POST"
31
+ }
32
+ );
33
+ const fresh = response.ok ? ((_a2 = await response.json()) == null ? void 0 : _a2.token) || null : null;
34
+ if (fresh) tokenRef.current = fresh;
35
+ return fresh;
36
+ });
37
+ return () => setTokenRefresher(null);
25
38
  },
26
- [token]
39
+ []
27
40
  );
28
41
  useEffect(
29
42
  () => {
@@ -55,8 +68,7 @@ const ProviderUi = ({
55
68
  queryKey: ["account"],
56
69
  queryFn: async () => {
57
70
  const { result } = await request({
58
- endpoint: "/account",
59
- token
71
+ endpoint: "/account"
60
72
  });
61
73
  return result || {};
62
74
  },
@@ -66,8 +78,7 @@ const ProviderUi = ({
66
78
  queryKey: ["app"],
67
79
  queryFn: async () => {
68
80
  const { result } = await request({
69
- endpoint: "/app",
70
- token
81
+ endpoint: "/app"
71
82
  });
72
83
  return result || {};
73
84
  }
@@ -76,8 +87,7 @@ const ProviderUi = ({
76
87
  queryKey: ["countries"],
77
88
  queryFn: async () => {
78
89
  const { result } = await request({
79
- endpoint: "/app/countries",
80
- token
90
+ endpoint: "/app/countries"
81
91
  });
82
92
  return result || {};
83
93
  }
@@ -86,8 +96,7 @@ const ProviderUi = ({
86
96
  queryKey: ["currencies"],
87
97
  queryFn: async () => {
88
98
  const { result } = await request({
89
- endpoint: "/app/currencies",
90
- token
99
+ endpoint: "/app/currencies"
91
100
  });
92
101
  return result || {};
93
102
  }
@@ -132,8 +141,7 @@ const ProviderUi = ({
132
141
  queryKey: ["account", "balance"],
133
142
  queryFn: async () => {
134
143
  const { result } = await request({
135
- endpoint: "/account/balance",
136
- token
144
+ endpoint: "/account/balance"
137
145
  });
138
146
  return result || {};
139
147
  },
@@ -147,7 +147,7 @@ const area = (props, color) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
147
147
  }
148
148
  }
149
149
  );
150
- const gradient = (props, color) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
150
+ const gradient = (props, color, opacity = 0.4) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
151
151
  "linearGradient",
152
152
  {
153
153
  ...{
@@ -161,7 +161,7 @@ const gradient = (props, color) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
161
161
  ...{
162
162
  offset: "5%",
163
163
  stopColor: color,
164
- stopOpacity: 0.4
164
+ stopOpacity: opacity
165
165
  }
166
166
  }
167
167
  ),
@@ -257,10 +257,14 @@ const ChartLine = ({
257
257
  ],
258
258
  empty,
259
259
  format = (value) => value,
260
- legend = true
260
+ labels: given = {},
261
+ legend = true,
262
+ zeros = false
261
263
  }) => {
264
+ const name = (key) => given[key] || label(key);
265
+ const fade = datasets.length > 3 ? 0.06 : 0.4;
262
266
  const [active, setActive] = (0, import_react.useState)(datasets);
263
- if (!(data == null ? void 0 : data.some((point) => datasets.some((key) => Number(point == null ? void 0 : point[key]))))) {
267
+ if (!(data == null ? void 0 : data.length) || !zeros && !data.some((point) => datasets.some((key) => Number(point == null ? void 0 : point[key])))) {
264
268
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChartEmpty, { ...empty });
265
269
  }
266
270
  ;
@@ -288,127 +292,148 @@ const ChartLine = ({
288
292
  {
289
293
  id: "color-actions"
290
294
  },
291
- options.colors.actions
295
+ options.colors.actions,
296
+ fade
292
297
  ),
293
298
  datasets.includes("affiliates") && gradient(
294
299
  {
295
300
  id: "color-affiliates"
296
301
  },
297
- options.colors.affiliates
302
+ options.colors.affiliates,
303
+ fade
298
304
  ),
299
305
  datasets.includes("brands") && gradient(
300
306
  {
301
307
  id: "color-brands"
302
308
  },
303
- options.colors.brands
309
+ options.colors.brands,
310
+ fade
304
311
  ),
305
312
  datasets.includes("campaigns") && gradient(
306
313
  {
307
314
  id: "color-campaigns"
308
315
  },
309
- options.colors.campaigns
316
+ options.colors.campaigns,
317
+ fade
310
318
  ),
311
319
  datasets.includes("connections") && gradient(
312
320
  {
313
321
  id: "color-connections"
314
322
  },
315
- options.colors.connections
323
+ options.colors.connections,
324
+ fade
316
325
  ),
317
326
  datasets.includes("count") && gradient(
318
327
  {
319
328
  id: "color-count"
320
329
  },
321
- options.colors.count
330
+ options.colors.count,
331
+ fade
322
332
  ),
323
333
  datasets.includes("discount") && gradient(
324
334
  {
325
335
  id: "color-discount"
326
336
  },
327
- options.colors.discount
337
+ options.colors.discount,
338
+ fade
328
339
  ),
329
340
  datasets.includes("entries") && gradient(
330
341
  {
331
342
  id: "color-entries"
332
343
  },
333
- options.colors.entries
344
+ options.colors.entries,
345
+ fade
334
346
  ),
335
347
  datasets.includes("events") && gradient(
336
348
  {
337
349
  id: "color-events"
338
350
  },
339
- options.colors.events
351
+ options.colors.events,
352
+ fade
340
353
  ),
341
354
  datasets.includes("fee") && gradient(
342
355
  {
343
356
  id: "color-fee"
344
357
  },
345
- options.colors.fee
358
+ options.colors.fee,
359
+ fade
346
360
  ),
347
361
  datasets.includes("files") && gradient(
348
362
  {
349
363
  id: "color-files"
350
364
  },
351
- options.colors.files
365
+ options.colors.files,
366
+ fade
352
367
  ),
353
368
  datasets.includes("gross") && gradient(
354
369
  {
355
370
  id: "color-gross"
356
371
  },
357
- options.colors.gross
372
+ options.colors.gross,
373
+ fade
358
374
  ),
359
375
  datasets.includes("members") && gradient(
360
376
  {
361
377
  id: "color-members"
362
378
  },
363
- options.colors.members
379
+ options.colors.members,
380
+ fade
364
381
  ),
365
382
  datasets.includes("net") && gradient(
366
383
  {
367
384
  id: "color-net"
368
385
  },
369
- options.colors.net
386
+ options.colors.net,
387
+ fade
370
388
  ),
371
389
  datasets.includes("orders") && gradient(
372
390
  {
373
391
  id: "color-orders"
374
392
  },
375
- options.colors.orders
393
+ options.colors.orders,
394
+ fade
376
395
  ),
377
396
  datasets.includes("pages") && gradient(
378
397
  {
379
398
  id: "color-pages"
380
399
  },
381
- options.colors.pages
400
+ options.colors.pages,
401
+ fade
382
402
  ),
383
403
  datasets.includes("pageviews") && gradient(
384
404
  {
385
405
  id: "color-pageviews"
386
406
  },
387
- options.colors.pageviews
407
+ options.colors.pageviews,
408
+ fade
388
409
  ),
389
410
  datasets.includes("qrcodes") && gradient(
390
411
  {
391
412
  id: "color-qrcodes"
392
413
  },
393
- options.colors.qrcodes
414
+ options.colors.qrcodes,
415
+ fade
394
416
  ),
395
417
  datasets.includes("shortcodes") && gradient(
396
418
  {
397
419
  id: "color-shortcodes"
398
420
  },
399
- options.colors.shortcodes
421
+ options.colors.shortcodes,
422
+ fade
400
423
  ),
401
424
  datasets.includes("storage") && gradient(
402
425
  {
403
426
  id: "color-storage"
404
427
  },
405
- options.colors.storage
428
+ options.colors.storage,
429
+ fade
406
430
  ),
407
431
  datasets.includes("workflows") && gradient(
408
432
  {
409
433
  id: "color-workflows"
410
434
  },
411
- options.colors.workflows
435
+ options.colors.workflows,
436
+ fade
412
437
  )
413
438
  ] }),
414
439
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -436,9 +461,9 @@ const ChartLine = ({
436
461
  // @story redemptions/overview
437
462
  // A money chart passes `format` so a day's summed gross reads
438
463
  // "$12.50", not 12.500000000000002; counts pass nothing.
439
- formatter: (value, name) => [
464
+ formatter: (value, key) => [
440
465
  format(value),
441
- label(name)
466
+ name(key)
442
467
  ]
443
468
  }
444
469
  }
@@ -447,7 +472,7 @@ const ChartLine = ({
447
472
  import_recharts.Legend,
448
473
  {
449
474
  ...{
450
- formatter: (name) => label(name),
475
+ formatter: (key) => name(key),
451
476
  onClick: ({ dataKey }) => handleLegendClick(dataKey),
452
477
  ...options.legend
453
478
  }
@@ -114,7 +114,7 @@ const area = (props, color) => /* @__PURE__ */ jsx(
114
114
  }
115
115
  }
116
116
  );
117
- const gradient = (props, color) => /* @__PURE__ */ jsxs(
117
+ const gradient = (props, color, opacity = 0.4) => /* @__PURE__ */ jsxs(
118
118
  "linearGradient",
119
119
  {
120
120
  ...{
@@ -128,7 +128,7 @@ const gradient = (props, color) => /* @__PURE__ */ jsxs(
128
128
  ...{
129
129
  offset: "5%",
130
130
  stopColor: color,
131
- stopOpacity: 0.4
131
+ stopOpacity: opacity
132
132
  }
133
133
  }
134
134
  ),
@@ -224,10 +224,14 @@ const ChartLine = ({
224
224
  ],
225
225
  empty,
226
226
  format = (value) => value,
227
- legend = true
227
+ labels: given = {},
228
+ legend = true,
229
+ zeros = false
228
230
  }) => {
231
+ const name = (key) => given[key] || label(key);
232
+ const fade = datasets.length > 3 ? 0.06 : 0.4;
229
233
  const [active, setActive] = useState(datasets);
230
- if (!(data == null ? void 0 : data.some((point) => datasets.some((key) => Number(point == null ? void 0 : point[key]))))) {
234
+ if (!(data == null ? void 0 : data.length) || !zeros && !data.some((point) => datasets.some((key) => Number(point == null ? void 0 : point[key])))) {
231
235
  return /* @__PURE__ */ jsx(ChartEmpty, { ...empty });
232
236
  }
233
237
  ;
@@ -255,127 +259,148 @@ const ChartLine = ({
255
259
  {
256
260
  id: "color-actions"
257
261
  },
258
- options.colors.actions
262
+ options.colors.actions,
263
+ fade
259
264
  ),
260
265
  datasets.includes("affiliates") && gradient(
261
266
  {
262
267
  id: "color-affiliates"
263
268
  },
264
- options.colors.affiliates
269
+ options.colors.affiliates,
270
+ fade
265
271
  ),
266
272
  datasets.includes("brands") && gradient(
267
273
  {
268
274
  id: "color-brands"
269
275
  },
270
- options.colors.brands
276
+ options.colors.brands,
277
+ fade
271
278
  ),
272
279
  datasets.includes("campaigns") && gradient(
273
280
  {
274
281
  id: "color-campaigns"
275
282
  },
276
- options.colors.campaigns
283
+ options.colors.campaigns,
284
+ fade
277
285
  ),
278
286
  datasets.includes("connections") && gradient(
279
287
  {
280
288
  id: "color-connections"
281
289
  },
282
- options.colors.connections
290
+ options.colors.connections,
291
+ fade
283
292
  ),
284
293
  datasets.includes("count") && gradient(
285
294
  {
286
295
  id: "color-count"
287
296
  },
288
- options.colors.count
297
+ options.colors.count,
298
+ fade
289
299
  ),
290
300
  datasets.includes("discount") && gradient(
291
301
  {
292
302
  id: "color-discount"
293
303
  },
294
- options.colors.discount
304
+ options.colors.discount,
305
+ fade
295
306
  ),
296
307
  datasets.includes("entries") && gradient(
297
308
  {
298
309
  id: "color-entries"
299
310
  },
300
- options.colors.entries
311
+ options.colors.entries,
312
+ fade
301
313
  ),
302
314
  datasets.includes("events") && gradient(
303
315
  {
304
316
  id: "color-events"
305
317
  },
306
- options.colors.events
318
+ options.colors.events,
319
+ fade
307
320
  ),
308
321
  datasets.includes("fee") && gradient(
309
322
  {
310
323
  id: "color-fee"
311
324
  },
312
- options.colors.fee
325
+ options.colors.fee,
326
+ fade
313
327
  ),
314
328
  datasets.includes("files") && gradient(
315
329
  {
316
330
  id: "color-files"
317
331
  },
318
- options.colors.files
332
+ options.colors.files,
333
+ fade
319
334
  ),
320
335
  datasets.includes("gross") && gradient(
321
336
  {
322
337
  id: "color-gross"
323
338
  },
324
- options.colors.gross
339
+ options.colors.gross,
340
+ fade
325
341
  ),
326
342
  datasets.includes("members") && gradient(
327
343
  {
328
344
  id: "color-members"
329
345
  },
330
- options.colors.members
346
+ options.colors.members,
347
+ fade
331
348
  ),
332
349
  datasets.includes("net") && gradient(
333
350
  {
334
351
  id: "color-net"
335
352
  },
336
- options.colors.net
353
+ options.colors.net,
354
+ fade
337
355
  ),
338
356
  datasets.includes("orders") && gradient(
339
357
  {
340
358
  id: "color-orders"
341
359
  },
342
- options.colors.orders
360
+ options.colors.orders,
361
+ fade
343
362
  ),
344
363
  datasets.includes("pages") && gradient(
345
364
  {
346
365
  id: "color-pages"
347
366
  },
348
- options.colors.pages
367
+ options.colors.pages,
368
+ fade
349
369
  ),
350
370
  datasets.includes("pageviews") && gradient(
351
371
  {
352
372
  id: "color-pageviews"
353
373
  },
354
- options.colors.pageviews
374
+ options.colors.pageviews,
375
+ fade
355
376
  ),
356
377
  datasets.includes("qrcodes") && gradient(
357
378
  {
358
379
  id: "color-qrcodes"
359
380
  },
360
- options.colors.qrcodes
381
+ options.colors.qrcodes,
382
+ fade
361
383
  ),
362
384
  datasets.includes("shortcodes") && gradient(
363
385
  {
364
386
  id: "color-shortcodes"
365
387
  },
366
- options.colors.shortcodes
388
+ options.colors.shortcodes,
389
+ fade
367
390
  ),
368
391
  datasets.includes("storage") && gradient(
369
392
  {
370
393
  id: "color-storage"
371
394
  },
372
- options.colors.storage
395
+ options.colors.storage,
396
+ fade
373
397
  ),
374
398
  datasets.includes("workflows") && gradient(
375
399
  {
376
400
  id: "color-workflows"
377
401
  },
378
- options.colors.workflows
402
+ options.colors.workflows,
403
+ fade
379
404
  )
380
405
  ] }),
381
406
  /* @__PURE__ */ jsx(
@@ -403,9 +428,9 @@ const ChartLine = ({
403
428
  // @story redemptions/overview
404
429
  // A money chart passes `format` so a day's summed gross reads
405
430
  // "$12.50", not 12.500000000000002; counts pass nothing.
406
- formatter: (value, name) => [
431
+ formatter: (value, key) => [
407
432
  format(value),
408
- label(name)
433
+ name(key)
409
434
  ]
410
435
  }
411
436
  }
@@ -414,7 +439,7 @@ const ChartLine = ({
414
439
  Legend,
415
440
  {
416
441
  ...{
417
- formatter: (name) => label(name),
442
+ formatter: (key) => name(key),
418
443
  onClick: ({ dataKey }) => handleLegendClick(dataKey),
419
444
  ...options.legend
420
445
  }
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var swatch_exports = {};
30
30
  __export(swatch_exports, {
31
+ Swatches: () => Swatches,
31
32
  default: () => swatch_default
32
33
  });
33
34
  module.exports = __toCommonJS(swatch_exports);
@@ -78,4 +79,38 @@ const Swatch = ({
78
79
  }
79
80
  );
80
81
  };
82
+ const Swatches = ({ style }) => {
83
+ var _a, _b, _c, _d, _e, _f;
84
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
85
+ "span",
86
+ {
87
+ ...{
88
+ className: "flex items-center space-x-1 shrink-0"
89
+ },
90
+ children: [
91
+ ["Background color", (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color],
92
+ ["Text color", (_b = style == null ? void 0 : style.text) == null ? void 0 : _b.color],
93
+ ["Button color", (_d = (_c = style == null ? void 0 : style.button) == null ? void 0 : _c.background) == null ? void 0 : _d.color],
94
+ ["Button text color", (_f = (_e = style == null ? void 0 : style.button) == null ? void 0 : _e.text) == null ? void 0 : _f.color]
95
+ ].map(([label, color]) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
96
+ "span",
97
+ {
98
+ ...{
99
+ "aria-label": label + " " + ((color == null ? void 0 : color.hex) || ""),
100
+ className: "w-6 h-6 block rounded border shrink-0",
101
+ role: "img",
102
+ style: {
103
+ backgroundColor: color == null ? void 0 : color.hex
104
+ }
105
+ }
106
+ },
107
+ label
108
+ ))
109
+ }
110
+ );
111
+ };
81
112
  var swatch_default = Swatch;
113
+ // Annotate the CommonJS export names for ESM import in node:
114
+ 0 && (module.exports = {
115
+ Swatches
116
+ });