@drawbridge/components 0.1.45 → 0.1.47
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.
- package/dist/bridge/form-subdomain-shop.js +4 -1
- package/dist/bridge/form-subdomain-shop.mjs +4 -1
- package/dist/bridge/form-subdomain.js +23 -5
- package/dist/bridge/form-subdomain.mjs +23 -5
- package/dist/bridge/lib/entry.js +41 -0
- package/dist/bridge/lib/entry.mjs +40 -0
- package/dist/bridge/product-tile.js +4 -0
- package/dist/bridge/product-tile.mjs +4 -0
- package/dist/bridge/template-layout.js +27 -8
- package/dist/bridge/template-layout.mjs +28 -9
- package/dist/bridge/template-modal.js +11 -1
- package/dist/bridge/template-modal.mjs +11 -1
- package/dist/dashboard/avatar.js +2 -3
- package/dist/dashboard/avatar.mjs +2 -3
- package/dist/dashboard/campaign-form.js +172 -153
- package/dist/dashboard/campaign-form.mjs +172 -153
- package/dist/dashboard/campaign-share.js +347 -0
- package/dist/dashboard/campaign-share.mjs +314 -0
- package/dist/dashboard/card-affiliate.js +1 -1
- package/dist/dashboard/card-affiliate.mjs +1 -1
- package/dist/dashboard/card-campaign-switch.js +4 -1
- package/dist/dashboard/card-campaign-switch.mjs +4 -1
- package/dist/dashboard/form-organization-campaign-field-item.js +4 -1
- package/dist/dashboard/form-organization-campaign-field-item.mjs +4 -1
- package/dist/dashboard/form-organization-campaign-page.js +73 -39
- package/dist/dashboard/form-organization-campaign-page.mjs +73 -39
- package/dist/dashboard/input-combobox.js +6 -0
- package/dist/dashboard/input-combobox.mjs +6 -0
- package/dist/dashboard/input-fields.js +26 -3
- package/dist/dashboard/input-fields.mjs +26 -3
- package/dist/dashboard/input-font.js +2 -0
- package/dist/dashboard/input-font.mjs +2 -0
- package/dist/dashboard/input-group-ai.js +15 -3
- package/dist/dashboard/input-group-ai.mjs +15 -3
- package/dist/dashboard/lib/ab-tests.js +2 -2
- package/dist/dashboard/lib/ab-tests.mjs +2 -2
- package/dist/dashboard/lib/menu.js +19 -0
- package/dist/dashboard/lib/menu.mjs +18 -0
- package/dist/dashboard/menu.js +13 -2
- package/dist/dashboard/menu.mjs +13 -2
- package/dist/dashboard/preview.js +119 -52
- package/dist/dashboard/preview.mjs +119 -52
- package/dist/dashboard/recharts.js +10 -4
- package/dist/dashboard/recharts.mjs +10 -4
- package/dist/dashboard/template-dashboard.js +11 -1
- package/dist/dashboard/template-dashboard.mjs +11 -1
- package/dist/dashboard/template-design.js +209 -130
- package/dist/dashboard/template-design.mjs +210 -131
- package/dist/dashboard/template-ui.js +157 -55
- package/dist/dashboard/template-ui.mjs +158 -56
- package/dist/icons/flags.js +134 -0
- package/dist/icons/flags.mjs +115 -0
- package/dist/shared/carousel.js +14 -5
- package/dist/shared/carousel.mjs +14 -5
- package/package.json +11 -1
- package/types/bridge/form-subdomain.d.ts +13 -0
- package/types/bridge/lib/entry.d.ts +5 -0
- package/types/bridge/product-tile.d.ts +2 -0
- package/types/dashboard/campaign-share.d.ts +16 -0
- package/types/dashboard/form-organization-campaign-page.d.ts +8 -1
- package/types/dashboard/input-combobox.d.ts +2 -0
- package/types/dashboard/preview.d.ts +11 -3
- package/types/icons/flags.d.ts +5 -0
|
@@ -12,15 +12,26 @@ import { TemplateDashboardResource, TemplateDashboardTasks } from "./template-da
|
|
|
12
12
|
import CardSection, { Beside } from "./card-section.mjs";
|
|
13
13
|
import CardTask from "./card-task.mjs";
|
|
14
14
|
import FormAction from "./form-action.mjs";
|
|
15
|
-
import {
|
|
15
|
+
import { FormOrganizationCampaignDesignBrand } from "./form-organization-campaign-design.mjs";
|
|
16
16
|
import Link from "./link.mjs";
|
|
17
17
|
import ListResource from "./list-resource.mjs";
|
|
18
18
|
import { PreviewPage, States, useFill } from "./preview.mjs";
|
|
19
19
|
import { Swatches } from "./swatch.mjs";
|
|
20
20
|
import Button from "../shared/button.mjs";
|
|
21
|
-
import
|
|
21
|
+
import Lock from "../icons/lock.mjs";
|
|
22
22
|
import Plus from "../icons/plus.mjs";
|
|
23
|
+
import Trash from "../icons/trash.mjs";
|
|
24
|
+
import Empty from "../shared/empty.mjs";
|
|
23
25
|
import { variantKey, variantPage, variantPreview, variantSaved } from "./lib/ab-tests.mjs";
|
|
26
|
+
import { LoaderDynamic } from "../shared/loader.mjs";
|
|
27
|
+
import dynamic from "next/dynamic";
|
|
28
|
+
const FormOrganizationCampaignPageEdit = dynamic(
|
|
29
|
+
() => import("./form-organization-campaign-page.mjs").then((mod) => mod.FormOrganizationCampaignPageEdit),
|
|
30
|
+
{
|
|
31
|
+
loading: () => /* @__PURE__ */ jsx(LoaderDynamic, {}),
|
|
32
|
+
ssr: false
|
|
33
|
+
}
|
|
34
|
+
);
|
|
24
35
|
const SHOWN = [
|
|
25
36
|
{ key: "Page", value: "page" },
|
|
26
37
|
{ key: "Email", value: "email" }
|
|
@@ -172,120 +183,147 @@ const Brands = ({
|
|
|
172
183
|
]
|
|
173
184
|
}
|
|
174
185
|
);
|
|
186
|
+
const Fill = ({ children }) => {
|
|
187
|
+
const box = useRef(null);
|
|
188
|
+
useFill(box, false, 0, "minHeight");
|
|
189
|
+
return /* @__PURE__ */ jsx(
|
|
190
|
+
"div",
|
|
191
|
+
{
|
|
192
|
+
...{
|
|
193
|
+
className: "flex flex-col",
|
|
194
|
+
ref: box
|
|
195
|
+
},
|
|
196
|
+
children
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
};
|
|
175
200
|
const Linked = ({
|
|
176
|
-
brand,
|
|
177
201
|
href,
|
|
202
|
+
name,
|
|
178
203
|
onDisconnect,
|
|
179
204
|
style
|
|
180
205
|
}) => {
|
|
181
206
|
const box = useRef(null);
|
|
182
|
-
useFill(box);
|
|
207
|
+
useFill(box, false, 25);
|
|
183
208
|
return /* @__PURE__ */ jsx(
|
|
184
209
|
"div",
|
|
185
210
|
{
|
|
186
211
|
...{
|
|
187
212
|
// Named for a screen reader: the box holds no sentence of its own.
|
|
188
213
|
"aria-label": "Linked brand",
|
|
189
|
-
|
|
214
|
+
// A grid's one row stretches to the box, so the empty state fills it and
|
|
215
|
+
// centres its content ( Darren, 2026-11-21 ).
|
|
216
|
+
className: "grid xl:min-h-[480px]",
|
|
190
217
|
ref: box,
|
|
191
218
|
role: "group"
|
|
192
219
|
},
|
|
193
|
-
children: /* @__PURE__ */ jsxs(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
/* @__PURE__ */ jsx(
|
|
201
|
-
|
|
202
|
-
{
|
|
203
|
-
...{
|
|
204
|
-
className: "relative aspect-square w-24"
|
|
205
|
-
},
|
|
206
|
-
children: /* @__PURE__ */ jsx(
|
|
207
|
-
Image,
|
|
208
|
-
{
|
|
209
|
-
...{
|
|
210
|
-
// The Brands list's own empty image, beside words that say it all.
|
|
211
|
-
alt: "",
|
|
212
|
-
className: "rounded overflow-hidden bg-green border border-green",
|
|
213
|
-
fill: true,
|
|
214
|
-
// The box's largest picture, above the fold.
|
|
215
|
-
priority: true,
|
|
216
|
-
sizes: "96px",
|
|
217
|
-
src: process.env.NEXT_PUBLIC_API_URI + "/images/brands.svg",
|
|
218
|
-
unoptimized: true
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
)
|
|
222
|
-
}
|
|
223
|
-
),
|
|
224
|
-
/* @__PURE__ */ jsxs(
|
|
225
|
-
"div",
|
|
226
|
-
{
|
|
227
|
-
...{
|
|
228
|
-
className: "flex flex-col items-center w-full max-w-sm space-y-2"
|
|
229
|
-
},
|
|
230
|
-
children: [
|
|
231
|
-
/* @__PURE__ */ jsx(
|
|
232
|
-
"p",
|
|
233
|
-
{
|
|
234
|
-
...{
|
|
235
|
-
className: "text-black text-lg"
|
|
236
|
-
},
|
|
237
|
-
children: brand == null ? void 0 : brand.title
|
|
238
|
-
}
|
|
239
|
-
),
|
|
240
|
-
/* @__PURE__ */ jsx(
|
|
241
|
-
Swatches,
|
|
242
|
-
{
|
|
243
|
-
...{
|
|
244
|
-
style
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
)
|
|
248
|
-
]
|
|
249
|
-
}
|
|
250
|
-
),
|
|
251
|
-
(href || onDisconnect) && /* @__PURE__ */ jsxs(
|
|
252
|
-
"div",
|
|
220
|
+
children: /* @__PURE__ */ jsxs(Empty, { children: [
|
|
221
|
+
/* @__PURE__ */ jsx(
|
|
222
|
+
"div",
|
|
223
|
+
{
|
|
224
|
+
...{
|
|
225
|
+
className: "relative aspect-square w-24"
|
|
226
|
+
},
|
|
227
|
+
children: /* @__PURE__ */ jsx(
|
|
228
|
+
Image,
|
|
253
229
|
{
|
|
254
230
|
...{
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
size: "small",
|
|
266
|
-
variant: "secondary"
|
|
267
|
-
},
|
|
268
|
-
children: "Edit brand"
|
|
269
|
-
}
|
|
270
|
-
),
|
|
271
|
-
onDisconnect && /* @__PURE__ */ jsx(
|
|
272
|
-
Button,
|
|
273
|
-
{
|
|
274
|
-
...{
|
|
275
|
-
inline: true,
|
|
276
|
-
onClick: onDisconnect,
|
|
277
|
-
size: "small",
|
|
278
|
-
variant: "secondary"
|
|
279
|
-
},
|
|
280
|
-
children: "Disconnect"
|
|
281
|
-
}
|
|
282
|
-
)
|
|
283
|
-
]
|
|
231
|
+
// The Brands list's own empty image, beside words that say it all.
|
|
232
|
+
alt: "",
|
|
233
|
+
className: "rounded overflow-hidden bg-green border border-green",
|
|
234
|
+
fill: true,
|
|
235
|
+
// The box's largest picture, above the fold.
|
|
236
|
+
priority: true,
|
|
237
|
+
sizes: "96px",
|
|
238
|
+
src: process.env.NEXT_PUBLIC_API_URI + "/images/brands.svg",
|
|
239
|
+
unoptimized: true
|
|
240
|
+
}
|
|
284
241
|
}
|
|
285
242
|
)
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
243
|
+
}
|
|
244
|
+
),
|
|
245
|
+
/* @__PURE__ */ jsxs(
|
|
246
|
+
"div",
|
|
247
|
+
{
|
|
248
|
+
...{
|
|
249
|
+
className: "flex flex-col items-center w-full max-w-sm space-y-2"
|
|
250
|
+
},
|
|
251
|
+
children: [
|
|
252
|
+
/* @__PURE__ */ jsxs(
|
|
253
|
+
"p",
|
|
254
|
+
{
|
|
255
|
+
...{
|
|
256
|
+
className: "flex items-center gap-1 text-black text-lg"
|
|
257
|
+
},
|
|
258
|
+
children: [
|
|
259
|
+
/* @__PURE__ */ jsx(
|
|
260
|
+
Lock,
|
|
261
|
+
{
|
|
262
|
+
...{
|
|
263
|
+
className: "w-4 h-4 shrink-0"
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
),
|
|
267
|
+
"Set by the connected brand"
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
),
|
|
271
|
+
name && /* @__PURE__ */ jsx(
|
|
272
|
+
"p",
|
|
273
|
+
{
|
|
274
|
+
...{
|
|
275
|
+
className: "text-gray-dark"
|
|
276
|
+
},
|
|
277
|
+
children: name
|
|
278
|
+
}
|
|
279
|
+
),
|
|
280
|
+
/* @__PURE__ */ jsx(
|
|
281
|
+
Swatches,
|
|
282
|
+
{
|
|
283
|
+
...{
|
|
284
|
+
style
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
)
|
|
288
|
+
]
|
|
289
|
+
}
|
|
290
|
+
),
|
|
291
|
+
(href || onDisconnect) && /* @__PURE__ */ jsxs(
|
|
292
|
+
"div",
|
|
293
|
+
{
|
|
294
|
+
...{
|
|
295
|
+
className: "flex items-center justify-center space-x-3"
|
|
296
|
+
},
|
|
297
|
+
children: [
|
|
298
|
+
href && /* @__PURE__ */ jsx(
|
|
299
|
+
Button,
|
|
300
|
+
{
|
|
301
|
+
...{
|
|
302
|
+
element: Link,
|
|
303
|
+
href,
|
|
304
|
+
inline: true,
|
|
305
|
+
size: "small",
|
|
306
|
+
variant: "secondary"
|
|
307
|
+
},
|
|
308
|
+
children: "Edit brand"
|
|
309
|
+
}
|
|
310
|
+
),
|
|
311
|
+
onDisconnect && /* @__PURE__ */ jsx(
|
|
312
|
+
Button,
|
|
313
|
+
{
|
|
314
|
+
...{
|
|
315
|
+
inline: true,
|
|
316
|
+
onClick: onDisconnect,
|
|
317
|
+
size: "small",
|
|
318
|
+
variant: "secondary"
|
|
319
|
+
},
|
|
320
|
+
children: "Disconnect"
|
|
321
|
+
}
|
|
322
|
+
)
|
|
323
|
+
]
|
|
324
|
+
}
|
|
325
|
+
)
|
|
326
|
+
] })
|
|
289
327
|
}
|
|
290
328
|
);
|
|
291
329
|
};
|
|
@@ -312,6 +350,10 @@ const TemplateDesign = ({
|
|
|
312
350
|
const { onError, onSuccess } = useCallbacks({
|
|
313
351
|
queryClient
|
|
314
352
|
});
|
|
353
|
+
const merge = (next) => setUpdate((previous) => ({
|
|
354
|
+
...previous || {},
|
|
355
|
+
...next
|
|
356
|
+
}));
|
|
315
357
|
if (!(campaign == null ? void 0 : campaign.variant)) return null;
|
|
316
358
|
const page = {
|
|
317
359
|
campaign: id,
|
|
@@ -344,11 +386,12 @@ const TemplateDesign = ({
|
|
|
344
386
|
}
|
|
345
387
|
);
|
|
346
388
|
};
|
|
347
|
-
const confirm = ({ brand, message, title, value }) => modal.open({
|
|
389
|
+
const confirm = ({ action, brand, message, title, type = "warning", value }) => modal.open({
|
|
348
390
|
message: /* @__PURE__ */ jsx(
|
|
349
391
|
FormAction,
|
|
350
392
|
{
|
|
351
393
|
...{
|
|
394
|
+
action,
|
|
352
395
|
callback: () => request({
|
|
353
396
|
body: {
|
|
354
397
|
brand: value
|
|
@@ -368,7 +411,7 @@ const TemplateDesign = ({
|
|
|
368
411
|
...{
|
|
369
412
|
message,
|
|
370
413
|
title: brand == null ? void 0 : brand.title,
|
|
371
|
-
type
|
|
414
|
+
type
|
|
372
415
|
}
|
|
373
416
|
}
|
|
374
417
|
)
|
|
@@ -416,10 +459,13 @@ const TemplateDesign = ({
|
|
|
416
459
|
...canAdd && {
|
|
417
460
|
onAdd: () => add(design)
|
|
418
461
|
},
|
|
462
|
+
// The design is lost for good here: the warning is red ( Darren, 2026-11-21 ).
|
|
419
463
|
onUse: (item) => confirm({
|
|
464
|
+
action: "Use brand",
|
|
420
465
|
brand: item,
|
|
421
|
-
message: "This replaces the campaign's logo, preview image and style. Your current design
|
|
466
|
+
message: "This replaces the campaign's logo, preview image and style. Your current design will be lost, and you can't undo this.",
|
|
422
467
|
title: "Use brand",
|
|
468
|
+
type: "error",
|
|
423
469
|
value: item.id
|
|
424
470
|
})
|
|
425
471
|
}
|
|
@@ -428,6 +474,7 @@ const TemplateDesign = ({
|
|
|
428
474
|
title: "Brands"
|
|
429
475
|
});
|
|
430
476
|
const disconnect = (brand) => confirm({
|
|
477
|
+
action: "Disconnect",
|
|
431
478
|
brand,
|
|
432
479
|
message: "Styles will stop updating with brand changes. The current brand styles will be applied.",
|
|
433
480
|
title: "Disconnect brand",
|
|
@@ -445,10 +492,29 @@ const TemplateDesign = ({
|
|
|
445
492
|
...{
|
|
446
493
|
// @story brands/use
|
|
447
494
|
// The white Brand button with a plus, top right, only while no
|
|
448
|
-
// brand is linked: it opens the drawer to use one or make one
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
495
|
+
// brand is linked: it opens the drawer to use one or make one
|
|
496
|
+
// ( back in the header once Share left it: Darren, 2026-11-20 ).
|
|
497
|
+
// @story brands/use
|
|
498
|
+
// @story brands/disconnect
|
|
499
|
+
// ONE BRAND BUTTON at the top right, white in both states ( Darren,
|
|
500
|
+
// 2026-11-20 ): Brand with a plus while none is linked, opening the
|
|
501
|
+
// drawer to use one or make one; once linked, named for the brand,
|
|
502
|
+
// with a trash icon that disconnects it after the confirmation.
|
|
503
|
+
// Shown to a person who can manage the campaign and has access to
|
|
504
|
+
// Brands.
|
|
505
|
+
controls: (data) => canManage && canBrands ? [
|
|
506
|
+
linked(data) ? {
|
|
507
|
+
"aria-label": "Disconnect brand",
|
|
508
|
+
"data-guide": "button-brand",
|
|
509
|
+
onClick: () => disconnect(linked(data)),
|
|
510
|
+
svg: Trash,
|
|
511
|
+
title: linked(data).title
|
|
512
|
+
} : {
|
|
513
|
+
"data-guide": "button-brand",
|
|
514
|
+
onClick: () => brands(update ? {
|
|
515
|
+
...data,
|
|
516
|
+
...update
|
|
517
|
+
} : data),
|
|
452
518
|
svg: Plus,
|
|
453
519
|
title: "Brand"
|
|
454
520
|
}
|
|
@@ -459,7 +525,10 @@ const TemplateDesign = ({
|
|
|
459
525
|
},
|
|
460
526
|
children: (data) => {
|
|
461
527
|
const brand = linked(data);
|
|
462
|
-
const design = update
|
|
528
|
+
const design = update ? {
|
|
529
|
+
...data,
|
|
530
|
+
...update
|
|
531
|
+
} : data;
|
|
463
532
|
return /* @__PURE__ */ jsxs(
|
|
464
533
|
Beside,
|
|
465
534
|
{
|
|
@@ -484,35 +553,45 @@ const TemplateDesign = ({
|
|
|
484
553
|
}
|
|
485
554
|
}
|
|
486
555
|
),
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
{
|
|
490
|
-
...{
|
|
491
|
-
brand,
|
|
492
|
-
...canBrands && {
|
|
493
|
-
href: "/organizations/" + organizationId + "/brands/" + brand.id
|
|
494
|
-
},
|
|
495
|
-
...canManage && canBrands && {
|
|
496
|
-
onDisconnect: () => disconnect(brand)
|
|
497
|
-
},
|
|
498
|
-
style: data == null ? void 0 : data.style
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
) : /* @__PURE__ */ jsx(CardSection, { children: /* @__PURE__ */ jsx(
|
|
502
|
-
FormOrganizationCampaignDesign,
|
|
556
|
+
/* @__PURE__ */ jsx(Fill, { children: /* @__PURE__ */ jsx(
|
|
557
|
+
CardSection,
|
|
503
558
|
{
|
|
504
559
|
...{
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
560
|
+
className: "flex-1"
|
|
561
|
+
},
|
|
562
|
+
children: /* @__PURE__ */ jsx(
|
|
563
|
+
FormOrganizationCampaignPageEdit,
|
|
564
|
+
{
|
|
565
|
+
...{
|
|
566
|
+
brand,
|
|
567
|
+
disabled: !canManage,
|
|
568
|
+
images: true,
|
|
569
|
+
linked: /* @__PURE__ */ jsx(
|
|
570
|
+
Linked,
|
|
571
|
+
{
|
|
572
|
+
...{
|
|
573
|
+
// Its colours: the header's button names the brand and
|
|
574
|
+
// disconnects it ( Darren, 2026-11-21 ). Who has no
|
|
575
|
+
// button reads the name here.
|
|
576
|
+
name: canManage && canBrands ? null : brand == null ? void 0 : brand.title,
|
|
577
|
+
style: data == null ? void 0 : data.style
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
),
|
|
581
|
+
onError,
|
|
582
|
+
onSuccess: (response) => saved(response),
|
|
583
|
+
onUpdate: merge,
|
|
584
|
+
organization,
|
|
585
|
+
tabs: true,
|
|
586
|
+
values: {
|
|
587
|
+
campaign: id,
|
|
588
|
+
id: data == null ? void 0 : data.id,
|
|
589
|
+
organization: organizationId,
|
|
590
|
+
...data
|
|
591
|
+
}
|
|
592
|
+
}
|
|
514
593
|
}
|
|
515
|
-
|
|
594
|
+
)
|
|
516
595
|
}
|
|
517
596
|
) })
|
|
518
597
|
]
|