@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
@@ -107,11 +107,18 @@ const TemplateModal = ({
107
107
  params,
108
108
  sms: data == null ? void 0 : data.sms,
109
109
  preview,
110
+ quiet: iframe,
111
+ // @story campaigns/form-page
112
+ // The Form page's preview opens the form at its step, or an agreement, with the location step still.
113
+ read: panel == null ? void 0 : panel.read,
114
+ step: panel == null ? void 0 : panel.step,
115
+ still: (panel == null ? void 0 : panel.step) !== void 0,
110
116
  style,
111
117
  submit: copy(data, "submit"),
112
118
  tracking
113
119
  }
114
- }
120
+ },
121
+ "form-" + ((panel == null ? void 0 : panel.step) ?? "") + "-" + ((panel == null ? void 0 : panel.read) || "")
115
122
  ),
116
123
  buttons.recaptcha()
117
124
  ] });
@@ -550,6 +557,9 @@ const TemplateModal = ({
550
557
  ...{
551
558
  button: buttons.close("submission"),
552
559
  checkout,
560
+ // @story campaigns/form-page
561
+ // The dashboard's own previews show no Preview mode line ( Darren, 2026-11-21 ).
562
+ quiet: iframe,
553
563
  tracking,
554
564
  ...panel.data
555
565
  }
@@ -154,9 +154,8 @@ const Avatars = ({
154
154
  {
155
155
  ...{
156
156
  href,
157
- ...rest > 0 && {
158
- title: rest + " more"
159
- }
157
+ // Impeccable audit, 2026-11-21: the plus alone is named for what it opens.
158
+ title: rest > 0 ? rest + " more" : "Members"
160
159
  },
161
160
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
162
161
  "span",
@@ -121,9 +121,8 @@ const Avatars = ({
121
121
  {
122
122
  ...{
123
123
  href,
124
- ...rest > 0 && {
125
- title: rest + " more"
126
- }
124
+ // Impeccable audit, 2026-11-21: the plus alone is named for what it opens.
125
+ title: rest > 0 ? rest + " more" : "Members"
127
126
  },
128
127
  children: /* @__PURE__ */ jsx(
129
128
  "span",
@@ -47,6 +47,7 @@ var import_card_task = __toESM(require("./card-task"));
47
47
  var import_dropdown = __toESM(require("./dropdown"));
48
48
  var import_link = __toESM(require("./link"));
49
49
  var import_preview = __toESM(require("./preview"));
50
+ var import_ab_tests = require("./lib/ab-tests");
50
51
  var import_empty = __toESM(require("../shared/empty"));
51
52
  var import_badge = __toESM(require("../shared/badge"));
52
53
  var import_button = __toESM(require("../shared/button"));
@@ -1506,6 +1507,11 @@ const After = ({
1506
1507
  {
1507
1508
  ...{
1508
1509
  id: "after",
1510
+ // The real page's panel: the missions and advertisements shown here.
1511
+ page: {
1512
+ advertisements: ads,
1513
+ missions: response === "order" ? [] : missions
1514
+ },
1509
1515
  states: {
1510
1516
  onChange: setResponse,
1511
1517
  options: messageStates,
@@ -1552,6 +1558,7 @@ const CampaignForm = ({
1552
1558
  const texts = (0, import_sms.textsOn)(organization);
1553
1559
  const currency = ((_a = organization == null ? void 0 : organization.defaults) == null ? void 0 : _a.currency) || "usd";
1554
1560
  const documents = (0, import_react.useMemo)(() => (0, import_form_page.readableDocuments)(campaign == null ? void 0 : campaign.agreements, texts), [campaign == null ? void 0 : campaign.agreements, texts]);
1561
+ const version = (0, import_react.useMemo)(() => JSON.stringify([campaign == null ? void 0 : campaign.updatedAt, sections]), [campaign == null ? void 0 : campaign.updatedAt, sections]);
1555
1562
  (0, import_react.useEffect)(() => {
1556
1563
  if (open !== "footer") return;
1557
1564
  actions.footer({
@@ -1630,185 +1637,197 @@ const CampaignForm = ({
1630
1637
  import_provider_font.default,
1631
1638
  {
1632
1639
  ...style,
1633
- children: (fonts) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1634
- import_preview.SliderLayout,
1635
- {
1636
- ...{
1637
- blank: dragging,
1638
- last: lastId,
1639
- slides: (0, import_form_page.formSlides)(parts, documents.length > 0),
1640
- style
1641
- },
1642
- children: [
1643
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1644
- Start,
1645
- {
1646
- ...{
1647
- actions,
1648
- campaign,
1649
- fonts,
1650
- style
1640
+ children: (fonts) => {
1641
+ var _a2;
1642
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1643
+ import_preview.SliderLayout,
1644
+ {
1645
+ ...{
1646
+ blank: dragging,
1647
+ last: lastId,
1648
+ // @story campaigns/form-page
1649
+ // Every step in the campaign's real page ( Darren, 2026-11-21 ),
1650
+ // loaded again after each save.
1651
+ ...((_a2 = campaign == null ? void 0 : campaign.share) == null ? void 0 : _a2.url) && {
1652
+ page: {
1653
+ url: (0, import_ab_tests.variantPreview)(campaign),
1654
+ version
1651
1655
  }
1652
- }
1653
- ),
1654
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Arrow, {}),
1655
- location && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1656
+ },
1657
+ slides: (0, import_form_page.formSlides)(parts, documents.length > 0),
1658
+ style
1659
+ },
1660
+ children: [
1656
1661
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1657
- Location,
1662
+ Start,
1658
1663
  {
1659
1664
  ...{
1665
+ actions,
1666
+ campaign,
1660
1667
  fonts,
1661
- item: location,
1662
1668
  style
1663
1669
  }
1664
1670
  }
1665
1671
  ),
1666
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Arrow, {})
1667
- ] }),
1668
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1669
- import_card_section.default,
1670
- {
1671
- ...{
1672
- className: "shrink-0",
1673
- "data-guide": "section-fields",
1674
- title: "Fields",
1675
- variant: "gray"
1676
- },
1677
- children: [
1678
- !age && canManage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1679
- Join,
1680
- {
1681
- ...{
1682
- label: "Add an age gate",
1683
- onAdd: choose([addAge]),
1684
- start: true
1685
- }
1672
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Arrow, {}),
1673
+ location && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1674
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1675
+ Location,
1676
+ {
1677
+ ...{
1678
+ fonts,
1679
+ item: location,
1680
+ style
1686
1681
  }
1687
- ),
1688
- age && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1689
- AgeStep,
1690
- {
1691
- ...{
1692
- actions,
1693
- age,
1694
- canManage,
1695
- fonts,
1696
- style
1682
+ }
1683
+ ),
1684
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Arrow, {})
1685
+ ] }),
1686
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1687
+ import_card_section.default,
1688
+ {
1689
+ ...{
1690
+ className: "shrink-0",
1691
+ "data-guide": "section-fields",
1692
+ title: "Fields",
1693
+ variant: "gray"
1694
+ },
1695
+ children: [
1696
+ !age && canManage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1697
+ Join,
1698
+ {
1699
+ ...{
1700
+ label: "Add an age gate",
1701
+ onAdd: choose([addAge]),
1702
+ start: true
1703
+ }
1697
1704
  }
1698
- }
1699
- ),
1700
- information && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1701
- age && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Join, {}),
1702
- step(information, fonts)
1703
- ] }),
1704
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1705
- import_sortable.default,
1706
- {
1707
- ...{
1708
- disabled: !canManage,
1709
- handleClassName: GRIP,
1710
- handleLabel: (section) => "Move " + section.title,
1711
- items: customs,
1712
- onDragging: setDragging,
1713
- onSort: (sorted) => actions.reorderSections(sorted.map((section) => section.id)),
1714
- renderItem: (section, _index, handle) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1715
- dragging ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1716
- "div",
1717
- {
1718
- ...{
1719
- className: "h-4"
1720
- }
1721
- }
1722
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1723
- Join,
1724
- {
1725
- ...{
1726
- label: "Add a section here",
1727
- onAdd: middle(section.id)
1728
- }
1729
- }
1730
- ),
1731
- step(section, fonts, handle, dragging)
1732
- ] }),
1733
- sortableElement: "div"
1705
+ ),
1706
+ age && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1707
+ AgeStep,
1708
+ {
1709
+ ...{
1710
+ actions,
1711
+ age,
1712
+ canManage,
1713
+ fonts,
1714
+ style
1715
+ }
1734
1716
  }
1735
- }
1736
- ),
1737
- order && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1738
- dragging ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1739
- "div",
1717
+ ),
1718
+ information && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1719
+ age && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Join, {}),
1720
+ step(information, fonts)
1721
+ ] }),
1722
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1723
+ import_sortable.default,
1740
1724
  {
1741
1725
  ...{
1742
- className: "h-4"
1726
+ disabled: !canManage,
1727
+ handleClassName: GRIP,
1728
+ handleLabel: (section) => "Move " + section.title,
1729
+ items: customs,
1730
+ onDragging: setDragging,
1731
+ onSort: (sorted) => actions.reorderSections(sorted.map((section) => section.id)),
1732
+ renderItem: (section, _index, handle) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1733
+ dragging ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1734
+ "div",
1735
+ {
1736
+ ...{
1737
+ className: "h-4"
1738
+ }
1739
+ }
1740
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1741
+ Join,
1742
+ {
1743
+ ...{
1744
+ label: "Add a section here",
1745
+ onAdd: middle(section.id)
1746
+ }
1747
+ }
1748
+ ),
1749
+ step(section, fonts, handle, dragging)
1750
+ ] }),
1751
+ sortableElement: "div"
1743
1752
  }
1744
1753
  }
1745
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1754
+ ),
1755
+ order && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1756
+ dragging ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1757
+ "div",
1758
+ {
1759
+ ...{
1760
+ className: "h-4"
1761
+ }
1762
+ }
1763
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1764
+ Join,
1765
+ {
1766
+ ...{
1767
+ label: "Add a section here",
1768
+ onAdd: middle()
1769
+ }
1770
+ }
1771
+ ),
1772
+ step(order, fonts)
1773
+ ] }),
1774
+ !order && canManage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1746
1775
  Join,
1747
1776
  {
1748
1777
  ...{
1749
- label: "Add a section here",
1750
- onAdd: middle()
1778
+ end: true,
1779
+ label: "Add an order or a section here",
1780
+ onAdd: choose([addOrder, addSection()])
1751
1781
  }
1752
1782
  }
1753
1783
  ),
1754
- step(order, fonts)
1755
- ] }),
1756
- !order && canManage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1757
- Join,
1758
- {
1759
- ...{
1760
- end: true,
1761
- label: "Add an order or a section here",
1762
- onAdd: choose([addOrder, addSection()])
1763
- }
1764
- }
1765
- ),
1766
- lastId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1767
- Footer,
1768
- {
1769
- ...{
1770
- actions,
1771
- campaign,
1772
- phone,
1773
- texts
1784
+ lastId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1785
+ Footer,
1786
+ {
1787
+ ...{
1788
+ actions,
1789
+ campaign,
1790
+ phone,
1791
+ texts
1792
+ }
1774
1793
  }
1775
- }
1776
- ),
1777
- documents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1778
- Agreements,
1779
- {
1780
- ...{
1781
- campaign,
1782
- documents,
1783
- fonts,
1784
- style
1794
+ ),
1795
+ documents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1796
+ Agreements,
1797
+ {
1798
+ ...{
1799
+ campaign,
1800
+ documents,
1801
+ fonts,
1802
+ style
1803
+ }
1785
1804
  }
1805
+ )
1806
+ ]
1807
+ }
1808
+ ),
1809
+ after && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1810
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Arrow, {}),
1811
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1812
+ After,
1813
+ {
1814
+ ...{
1815
+ actions,
1816
+ after,
1817
+ campaign,
1818
+ canManage,
1819
+ fonts,
1820
+ organization,
1821
+ params,
1822
+ style
1786
1823
  }
1787
- )
1788
- ]
1789
- }
1790
- ),
1791
- after && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
1792
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Arrow, {}),
1793
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1794
- After,
1795
- {
1796
- ...{
1797
- actions,
1798
- after,
1799
- campaign,
1800
- canManage,
1801
- fonts,
1802
- organization,
1803
- params,
1804
- style
1805
1824
  }
1806
- }
1807
- )
1808
- ] })
1809
- ]
1810
- }
1811
- )
1825
+ )
1826
+ ] })
1827
+ ]
1828
+ }
1829
+ );
1830
+ }
1812
1831
  }
1813
1832
  );
1814
1833
  };