@drawbridge/components 0.1.46 → 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.
Files changed (61) hide show
  1. package/dist/bridge/form-subdomain-shop.js +4 -1
  2. package/dist/bridge/form-subdomain-shop.mjs +4 -1
  3. package/dist/bridge/form-subdomain.js +23 -5
  4. package/dist/bridge/form-subdomain.mjs +23 -5
  5. package/dist/bridge/lib/entry.js +41 -0
  6. package/dist/bridge/lib/entry.mjs +40 -0
  7. package/dist/bridge/product-tile.js +4 -0
  8. package/dist/bridge/product-tile.mjs +4 -0
  9. package/dist/bridge/template-layout.js +27 -8
  10. package/dist/bridge/template-layout.mjs +28 -9
  11. package/dist/bridge/template-modal.js +11 -1
  12. package/dist/bridge/template-modal.mjs +11 -1
  13. package/dist/dashboard/avatar.js +2 -3
  14. package/dist/dashboard/avatar.mjs +2 -3
  15. package/dist/dashboard/campaign-form.js +172 -153
  16. package/dist/dashboard/campaign-form.mjs +172 -153
  17. package/dist/dashboard/campaign-share.js +347 -0
  18. package/dist/dashboard/campaign-share.mjs +314 -0
  19. package/dist/dashboard/card-affiliate.js +1 -1
  20. package/dist/dashboard/card-affiliate.mjs +1 -1
  21. package/dist/dashboard/card-campaign-switch.js +4 -1
  22. package/dist/dashboard/card-campaign-switch.mjs +4 -1
  23. package/dist/dashboard/form-organization-campaign-page.js +73 -39
  24. package/dist/dashboard/form-organization-campaign-page.mjs +73 -39
  25. package/dist/dashboard/input-combobox.js +6 -0
  26. package/dist/dashboard/input-combobox.mjs +6 -0
  27. package/dist/dashboard/input-fields.js +26 -3
  28. package/dist/dashboard/input-fields.mjs +26 -3
  29. package/dist/dashboard/input-font.js +2 -0
  30. package/dist/dashboard/input-font.mjs +2 -0
  31. package/dist/dashboard/input-group-ai.js +15 -3
  32. package/dist/dashboard/input-group-ai.mjs +15 -3
  33. package/dist/dashboard/lib/ab-tests.js +2 -2
  34. package/dist/dashboard/lib/ab-tests.mjs +2 -2
  35. package/dist/dashboard/lib/menu.js +19 -0
  36. package/dist/dashboard/lib/menu.mjs +18 -0
  37. package/dist/dashboard/menu.js +13 -2
  38. package/dist/dashboard/menu.mjs +13 -2
  39. package/dist/dashboard/preview.js +119 -52
  40. package/dist/dashboard/preview.mjs +119 -52
  41. package/dist/dashboard/recharts.js +10 -4
  42. package/dist/dashboard/recharts.mjs +10 -4
  43. package/dist/dashboard/template-dashboard.js +11 -1
  44. package/dist/dashboard/template-dashboard.mjs +11 -1
  45. package/dist/dashboard/template-design.js +209 -130
  46. package/dist/dashboard/template-design.mjs +210 -131
  47. package/dist/dashboard/template-ui.js +157 -55
  48. package/dist/dashboard/template-ui.mjs +158 -56
  49. package/dist/icons/flags.js +134 -0
  50. package/dist/icons/flags.mjs +115 -0
  51. package/dist/shared/carousel.js +14 -5
  52. package/dist/shared/carousel.mjs +14 -5
  53. package/package.json +11 -1
  54. package/types/bridge/form-subdomain.d.ts +13 -0
  55. package/types/bridge/lib/entry.d.ts +5 -0
  56. package/types/bridge/product-tile.d.ts +2 -0
  57. package/types/dashboard/campaign-share.d.ts +16 -0
  58. package/types/dashboard/form-organization-campaign-page.d.ts +8 -1
  59. package/types/dashboard/input-combobox.d.ts +2 -0
  60. package/types/dashboard/preview.d.ts +11 -3
  61. package/types/icons/flags.d.ts +5 -0
@@ -15,6 +15,7 @@ import CardTask from "./card-task.mjs";
15
15
  import Dropdown from "./dropdown.mjs";
16
16
  import Link from "./link.mjs";
17
17
  import Preview, { Slider, SliderLayout, useCard } from "./preview.mjs";
18
+ import { variantPreview } from "./lib/ab-tests.mjs";
18
19
  import Empty from "../shared/empty.mjs";
19
20
  import Badge, { Disabled } from "../shared/badge.mjs";
20
21
  import Button from "../shared/button.mjs";
@@ -1474,6 +1475,11 @@ const After = ({
1474
1475
  {
1475
1476
  ...{
1476
1477
  id: "after",
1478
+ // The real page's panel: the missions and advertisements shown here.
1479
+ page: {
1480
+ advertisements: ads,
1481
+ missions: response === "order" ? [] : missions
1482
+ },
1477
1483
  states: {
1478
1484
  onChange: setResponse,
1479
1485
  options: messageStates,
@@ -1520,6 +1526,7 @@ const CampaignForm = ({
1520
1526
  const texts = textsOn(organization);
1521
1527
  const currency = ((_a = organization == null ? void 0 : organization.defaults) == null ? void 0 : _a.currency) || "usd";
1522
1528
  const documents = useMemo(() => readableDocuments(campaign == null ? void 0 : campaign.agreements, texts), [campaign == null ? void 0 : campaign.agreements, texts]);
1529
+ const version = useMemo(() => JSON.stringify([campaign == null ? void 0 : campaign.updatedAt, sections]), [campaign == null ? void 0 : campaign.updatedAt, sections]);
1523
1530
  useEffect(() => {
1524
1531
  if (open !== "footer") return;
1525
1532
  actions.footer({
@@ -1598,185 +1605,197 @@ const CampaignForm = ({
1598
1605
  ProviderFont,
1599
1606
  {
1600
1607
  ...style,
1601
- children: (fonts) => /* @__PURE__ */ jsxs(
1602
- SliderLayout,
1603
- {
1604
- ...{
1605
- blank: dragging,
1606
- last: lastId,
1607
- slides: formSlides(parts, documents.length > 0),
1608
- style
1609
- },
1610
- children: [
1611
- /* @__PURE__ */ jsx(
1612
- Start,
1613
- {
1614
- ...{
1615
- actions,
1616
- campaign,
1617
- fonts,
1618
- style
1608
+ children: (fonts) => {
1609
+ var _a2;
1610
+ return /* @__PURE__ */ jsxs(
1611
+ SliderLayout,
1612
+ {
1613
+ ...{
1614
+ blank: dragging,
1615
+ last: lastId,
1616
+ // @story campaigns/form-page
1617
+ // Every step in the campaign's real page ( Darren, 2026-11-21 ),
1618
+ // loaded again after each save.
1619
+ ...((_a2 = campaign == null ? void 0 : campaign.share) == null ? void 0 : _a2.url) && {
1620
+ page: {
1621
+ url: variantPreview(campaign),
1622
+ version
1619
1623
  }
1620
- }
1621
- ),
1622
- /* @__PURE__ */ jsx(Arrow, {}),
1623
- location && /* @__PURE__ */ jsxs(Fragment, { children: [
1624
+ },
1625
+ slides: formSlides(parts, documents.length > 0),
1626
+ style
1627
+ },
1628
+ children: [
1624
1629
  /* @__PURE__ */ jsx(
1625
- Location,
1630
+ Start,
1626
1631
  {
1627
1632
  ...{
1633
+ actions,
1634
+ campaign,
1628
1635
  fonts,
1629
- item: location,
1630
1636
  style
1631
1637
  }
1632
1638
  }
1633
1639
  ),
1634
- /* @__PURE__ */ jsx(Arrow, {})
1635
- ] }),
1636
- /* @__PURE__ */ jsxs(
1637
- CardSection,
1638
- {
1639
- ...{
1640
- className: "shrink-0",
1641
- "data-guide": "section-fields",
1642
- title: "Fields",
1643
- variant: "gray"
1644
- },
1645
- children: [
1646
- !age && canManage && /* @__PURE__ */ jsx(
1647
- Join,
1648
- {
1649
- ...{
1650
- label: "Add an age gate",
1651
- onAdd: choose([addAge]),
1652
- start: true
1653
- }
1640
+ /* @__PURE__ */ jsx(Arrow, {}),
1641
+ location && /* @__PURE__ */ jsxs(Fragment, { children: [
1642
+ /* @__PURE__ */ jsx(
1643
+ Location,
1644
+ {
1645
+ ...{
1646
+ fonts,
1647
+ item: location,
1648
+ style
1654
1649
  }
1655
- ),
1656
- age && /* @__PURE__ */ jsx(
1657
- AgeStep,
1658
- {
1659
- ...{
1660
- actions,
1661
- age,
1662
- canManage,
1663
- fonts,
1664
- style
1650
+ }
1651
+ ),
1652
+ /* @__PURE__ */ jsx(Arrow, {})
1653
+ ] }),
1654
+ /* @__PURE__ */ jsxs(
1655
+ CardSection,
1656
+ {
1657
+ ...{
1658
+ className: "shrink-0",
1659
+ "data-guide": "section-fields",
1660
+ title: "Fields",
1661
+ variant: "gray"
1662
+ },
1663
+ children: [
1664
+ !age && canManage && /* @__PURE__ */ jsx(
1665
+ Join,
1666
+ {
1667
+ ...{
1668
+ label: "Add an age gate",
1669
+ onAdd: choose([addAge]),
1670
+ start: true
1671
+ }
1665
1672
  }
1666
- }
1667
- ),
1668
- information && /* @__PURE__ */ jsxs(Fragment, { children: [
1669
- age && /* @__PURE__ */ jsx(Join, {}),
1670
- step(information, fonts)
1671
- ] }),
1672
- /* @__PURE__ */ jsx(
1673
- Sortable,
1674
- {
1675
- ...{
1676
- disabled: !canManage,
1677
- handleClassName: GRIP,
1678
- handleLabel: (section) => "Move " + section.title,
1679
- items: customs,
1680
- onDragging: setDragging,
1681
- onSort: (sorted) => actions.reorderSections(sorted.map((section) => section.id)),
1682
- renderItem: (section, _index, handle) => /* @__PURE__ */ jsxs(Fragment, { children: [
1683
- dragging ? /* @__PURE__ */ jsx(
1684
- "div",
1685
- {
1686
- ...{
1687
- className: "h-4"
1688
- }
1689
- }
1690
- ) : /* @__PURE__ */ jsx(
1691
- Join,
1692
- {
1693
- ...{
1694
- label: "Add a section here",
1695
- onAdd: middle(section.id)
1696
- }
1697
- }
1698
- ),
1699
- step(section, fonts, handle, dragging)
1700
- ] }),
1701
- sortableElement: "div"
1673
+ ),
1674
+ age && /* @__PURE__ */ jsx(
1675
+ AgeStep,
1676
+ {
1677
+ ...{
1678
+ actions,
1679
+ age,
1680
+ canManage,
1681
+ fonts,
1682
+ style
1683
+ }
1702
1684
  }
1703
- }
1704
- ),
1705
- order && /* @__PURE__ */ jsxs(Fragment, { children: [
1706
- dragging ? /* @__PURE__ */ jsx(
1707
- "div",
1685
+ ),
1686
+ information && /* @__PURE__ */ jsxs(Fragment, { children: [
1687
+ age && /* @__PURE__ */ jsx(Join, {}),
1688
+ step(information, fonts)
1689
+ ] }),
1690
+ /* @__PURE__ */ jsx(
1691
+ Sortable,
1708
1692
  {
1709
1693
  ...{
1710
- className: "h-4"
1694
+ disabled: !canManage,
1695
+ handleClassName: GRIP,
1696
+ handleLabel: (section) => "Move " + section.title,
1697
+ items: customs,
1698
+ onDragging: setDragging,
1699
+ onSort: (sorted) => actions.reorderSections(sorted.map((section) => section.id)),
1700
+ renderItem: (section, _index, handle) => /* @__PURE__ */ jsxs(Fragment, { children: [
1701
+ dragging ? /* @__PURE__ */ jsx(
1702
+ "div",
1703
+ {
1704
+ ...{
1705
+ className: "h-4"
1706
+ }
1707
+ }
1708
+ ) : /* @__PURE__ */ jsx(
1709
+ Join,
1710
+ {
1711
+ ...{
1712
+ label: "Add a section here",
1713
+ onAdd: middle(section.id)
1714
+ }
1715
+ }
1716
+ ),
1717
+ step(section, fonts, handle, dragging)
1718
+ ] }),
1719
+ sortableElement: "div"
1711
1720
  }
1712
1721
  }
1713
- ) : /* @__PURE__ */ jsx(
1722
+ ),
1723
+ order && /* @__PURE__ */ jsxs(Fragment, { children: [
1724
+ dragging ? /* @__PURE__ */ jsx(
1725
+ "div",
1726
+ {
1727
+ ...{
1728
+ className: "h-4"
1729
+ }
1730
+ }
1731
+ ) : /* @__PURE__ */ jsx(
1732
+ Join,
1733
+ {
1734
+ ...{
1735
+ label: "Add a section here",
1736
+ onAdd: middle()
1737
+ }
1738
+ }
1739
+ ),
1740
+ step(order, fonts)
1741
+ ] }),
1742
+ !order && canManage && /* @__PURE__ */ jsx(
1714
1743
  Join,
1715
1744
  {
1716
1745
  ...{
1717
- label: "Add a section here",
1718
- onAdd: middle()
1746
+ end: true,
1747
+ label: "Add an order or a section here",
1748
+ onAdd: choose([addOrder, addSection()])
1719
1749
  }
1720
1750
  }
1721
1751
  ),
1722
- step(order, fonts)
1723
- ] }),
1724
- !order && canManage && /* @__PURE__ */ jsx(
1725
- Join,
1726
- {
1727
- ...{
1728
- end: true,
1729
- label: "Add an order or a section here",
1730
- onAdd: choose([addOrder, addSection()])
1731
- }
1732
- }
1733
- ),
1734
- lastId && /* @__PURE__ */ jsx(
1735
- Footer,
1736
- {
1737
- ...{
1738
- actions,
1739
- campaign,
1740
- phone,
1741
- texts
1752
+ lastId && /* @__PURE__ */ jsx(
1753
+ Footer,
1754
+ {
1755
+ ...{
1756
+ actions,
1757
+ campaign,
1758
+ phone,
1759
+ texts
1760
+ }
1742
1761
  }
1743
- }
1744
- ),
1745
- documents.length > 0 && /* @__PURE__ */ jsx(
1746
- Agreements,
1747
- {
1748
- ...{
1749
- campaign,
1750
- documents,
1751
- fonts,
1752
- style
1762
+ ),
1763
+ documents.length > 0 && /* @__PURE__ */ jsx(
1764
+ Agreements,
1765
+ {
1766
+ ...{
1767
+ campaign,
1768
+ documents,
1769
+ fonts,
1770
+ style
1771
+ }
1753
1772
  }
1773
+ )
1774
+ ]
1775
+ }
1776
+ ),
1777
+ after && /* @__PURE__ */ jsxs(Fragment, { children: [
1778
+ /* @__PURE__ */ jsx(Arrow, {}),
1779
+ /* @__PURE__ */ jsx(
1780
+ After,
1781
+ {
1782
+ ...{
1783
+ actions,
1784
+ after,
1785
+ campaign,
1786
+ canManage,
1787
+ fonts,
1788
+ organization,
1789
+ params,
1790
+ style
1754
1791
  }
1755
- )
1756
- ]
1757
- }
1758
- ),
1759
- after && /* @__PURE__ */ jsxs(Fragment, { children: [
1760
- /* @__PURE__ */ jsx(Arrow, {}),
1761
- /* @__PURE__ */ jsx(
1762
- After,
1763
- {
1764
- ...{
1765
- actions,
1766
- after,
1767
- campaign,
1768
- canManage,
1769
- fonts,
1770
- organization,
1771
- params,
1772
- style
1773
1792
  }
1774
- }
1775
- )
1776
- ] })
1777
- ]
1778
- }
1779
- )
1793
+ )
1794
+ ] })
1795
+ ]
1796
+ }
1797
+ );
1798
+ }
1780
1799
  }
1781
1800
  );
1782
1801
  };