@drawbridge/components 0.1.50 → 0.1.51

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.
@@ -192,6 +192,8 @@ const FormSubdomainMissions = ({
192
192
  initial,
193
193
  message,
194
194
  missions: items = [],
195
+ // The page payload: the Share mission shares its headline and description.
196
+ page,
195
197
  shareLink,
196
198
  slug,
197
199
  style,
@@ -397,9 +399,7 @@ const FormSubdomainMissions = ({
397
399
  {
398
400
  ...{
399
401
  style,
400
- values: {
401
- url: shareLink
402
- }
402
+ values: (0, import_entry.shareValues)(page, shareLink ?? null)
403
403
  }
404
404
  }
405
405
  )
@@ -15,7 +15,7 @@ import InputCode from "../input-code.mjs";
15
15
  import ShareButton from "./share-button.mjs";
16
16
  import { BACK, FormSubdomainHeader } from "./form-subdomain-header.mjs";
17
17
  import { missionEndpoint } from "./lib/url.mjs";
18
- import { AFTER } from "./lib/entry.mjs";
18
+ import { AFTER, shareValues } from "./lib/entry.mjs";
19
19
  import { inputStyle } from "../styles.mjs";
20
20
  const screenFor = (type) => {
21
21
  var _a;
@@ -155,6 +155,8 @@ const FormSubdomainMissions = ({
155
155
  initial,
156
156
  message,
157
157
  missions: items = [],
158
+ // The page payload: the Share mission shares its headline and description.
159
+ page,
158
160
  shareLink,
159
161
  slug,
160
162
  style,
@@ -360,9 +362,7 @@ const FormSubdomainMissions = ({
360
362
  {
361
363
  ...{
362
364
  style,
363
- values: {
364
- url: shareLink
365
- }
365
+ values: shareValues(page, shareLink ?? null)
366
366
  }
367
367
  }
368
368
  )
@@ -90,6 +90,7 @@ const FormSubdomainSubmission = ({
90
90
  id,
91
91
  lead,
92
92
  message,
93
+ page,
93
94
  panel,
94
95
  preview,
95
96
  quiet,
@@ -194,6 +195,7 @@ const FormSubdomainSubmission = ({
194
195
  contact: data == null ? void 0 : data.contact,
195
196
  message,
196
197
  missions: (0, import_entry.panelMissions)(data.missions, repeat),
198
+ page,
197
199
  shareLink: data == null ? void 0 : data.shareLink,
198
200
  slug,
199
201
  style,
@@ -53,6 +53,7 @@ const FormSubdomainSubmission = ({
53
53
  id,
54
54
  lead,
55
55
  message,
56
+ page,
56
57
  panel,
57
58
  preview,
58
59
  quiet,
@@ -157,6 +158,7 @@ const FormSubdomainSubmission = ({
157
158
  contact: data == null ? void 0 : data.contact,
158
159
  message,
159
160
  missions: panelMissions(data.missions, repeat),
161
+ page,
160
162
  shareLink: data == null ? void 0 : data.shareLink,
161
163
  slug,
162
164
  style,
@@ -36,6 +36,7 @@ __export(entry_exports, {
36
36
  missionsOn: () => missionsOn,
37
37
  panelMissions: () => panelMissions,
38
38
  previewStep: () => previewStep,
39
+ shareValues: () => shareValues,
39
40
  withLocale: () => withLocale
40
41
  });
41
42
  module.exports = __toCommonJS(entry_exports);
@@ -62,6 +63,20 @@ const buttonState = (data, open) => !open ? "inactive" : (data == null ? void 0
62
63
  const buttonText = (data, open) => copy(data, buttonState(data, open));
63
64
  const formOn = (data) => (data == null ? void 0 : data.form) !== false;
64
65
  const giveawayOn = (data) => (data == null ? void 0 : data.giveaway) !== false;
66
+ const shareValues = (data, link) => {
67
+ var _a, _b;
68
+ return {
69
+ description: data == null ? void 0 : data.description,
70
+ headline: data == null ? void 0 : data.headline,
71
+ ...link === void 0 ? {
72
+ alt: (_a = data == null ? void 0 : data.descriptions) == null ? void 0 : _a.preview,
73
+ image: (_b = data == null ? void 0 : data.images) == null ? void 0 : _b.preview,
74
+ url: data == null ? void 0 : data.url
75
+ } : {
76
+ url: link
77
+ }
78
+ };
79
+ };
65
80
  const awardingOn = (data) => giveawayOn(data) && (data == null ? void 0 : data.awarding) !== false;
66
81
  const missionsOn = (data, preview) => preview ? giveawayOn(data) : awardingOn(data);
67
82
  const AFTER = ["message", "missions", "advertisements"];
@@ -164,5 +179,6 @@ const withLocale = (agreements = {}, locale = {}) => Object.fromEntries(
164
179
  missionsOn,
165
180
  panelMissions,
166
181
  previewStep,
182
+ shareValues,
167
183
  withLocale
168
184
  });
@@ -21,6 +21,20 @@ const buttonState = (data, open) => !open ? "inactive" : (data == null ? void 0
21
21
  const buttonText = (data, open) => copy(data, buttonState(data, open));
22
22
  const formOn = (data) => (data == null ? void 0 : data.form) !== false;
23
23
  const giveawayOn = (data) => (data == null ? void 0 : data.giveaway) !== false;
24
+ const shareValues = (data, link) => {
25
+ var _a, _b;
26
+ return {
27
+ description: data == null ? void 0 : data.description,
28
+ headline: data == null ? void 0 : data.headline,
29
+ ...link === void 0 ? {
30
+ alt: (_a = data == null ? void 0 : data.descriptions) == null ? void 0 : _a.preview,
31
+ image: (_b = data == null ? void 0 : data.images) == null ? void 0 : _b.preview,
32
+ url: data == null ? void 0 : data.url
33
+ } : {
34
+ url: link
35
+ }
36
+ };
37
+ };
24
38
  const awardingOn = (data) => giveawayOn(data) && (data == null ? void 0 : data.awarding) !== false;
25
39
  const missionsOn = (data, preview) => preview ? giveawayOn(data) : awardingOn(data);
26
40
  const AFTER = ["message", "missions", "advertisements"];
@@ -122,5 +136,6 @@ export {
122
136
  missionsOn,
123
137
  panelMissions,
124
138
  previewStep,
139
+ shareValues,
125
140
  withLocale
126
141
  };
@@ -43,11 +43,14 @@ var import_provider_recaptcha = __toESM(require("../shared/provider-recaptcha"))
43
43
  var import_form_subdomain_shop_modal = require("./form-subdomain-shop-modal");
44
44
  var import_template_subdomain_link = __toESM(require("./template-subdomain-link"));
45
45
  var import_form_subdomain_missions = __toESM(require("./form-subdomain-missions"));
46
+ var import_copy_to_clipboard = __toESM(require("../shared/copy-to-clipboard"));
47
+ var import_share_button = __toESM(require("./share-button"));
46
48
  var import_tabs = __toESM(require("../shared/tabs"));
47
49
  var import_empty = __toESM(require("../shared/empty"));
48
50
  var import_card_prize = __toESM(require("../shared/card-prize"));
49
51
  var import_arrow_right = __toESM(require("../icons/arrow-right"));
50
52
  var import_flag = __toESM(require("../icons/flag"));
53
+ var import_link = __toESM(require("../icons/link"));
51
54
  var import_warning = __toESM(require("../icons/warning"));
52
55
  var import_entry = require("./lib/entry");
53
56
  var import_motion = require("../shared/lib/motion");
@@ -183,6 +186,7 @@ const TemplateModal = ({
183
186
  contact: panel.data.contact,
184
187
  initial: panel.data.mission,
185
188
  missions: panel.data.missions,
189
+ page: data,
186
190
  shareLink: panel.data.shareLink,
187
191
  slug: params == null ? void 0 : params.slug,
188
192
  style,
@@ -235,6 +239,25 @@ const TemplateModal = ({
235
239
  }
236
240
  }
237
241
  ),
242
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
243
+ import_template_subdomain_link.default,
244
+ {
245
+ ...{
246
+ disabled: iframe,
247
+ onClick: () => {
248
+ setPanel({
249
+ name: "share"
250
+ });
251
+ tracking.track({
252
+ name: "link-share"
253
+ });
254
+ },
255
+ svg: import_arrow_right.default,
256
+ text: "Share link",
257
+ "aria-label": "Open to share this link"
258
+ }
259
+ }
260
+ ),
238
261
  (0, import_entry.menuAgreements)(data).map(
239
262
  (id) => {
240
263
  var _a3, _b3, _c3;
@@ -582,6 +605,47 @@ const TemplateModal = ({
582
605
  ),
583
606
  buttons.recaptcha()
584
607
  ] });
608
+ // @story public-entry/view-page
609
+ // The menu's Share link: the page's own link, with Back to the menu.
610
+ case "share":
611
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
612
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
613
+ import_form_subdomain_header.default,
614
+ {
615
+ ...{
616
+ back: {
617
+ onClick: () => setPanel({
618
+ name: "menu"
619
+ })
620
+ },
621
+ button: buttons.close("menu"),
622
+ style,
623
+ title: "Share link"
624
+ }
625
+ }
626
+ ),
627
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
628
+ import_share_button.default,
629
+ {
630
+ ...{
631
+ style,
632
+ values: (0, import_entry.shareValues)(data)
633
+ }
634
+ }
635
+ ),
636
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
637
+ import_copy_to_clipboard.default,
638
+ {
639
+ ...{
640
+ className: "justify-between w-full pt-5 pr-3 border-t border-inherit",
641
+ icon: import_link.default,
642
+ style,
643
+ value: data == null ? void 0 : data.url
644
+ },
645
+ children: "Copy link"
646
+ }
647
+ )
648
+ ] });
585
649
  case "submission":
586
650
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
587
651
  import_form_subdomain.FormSubdomainSubmission,
@@ -589,6 +653,7 @@ const TemplateModal = ({
589
653
  ...{
590
654
  button: buttons.close("submission"),
591
655
  checkout,
656
+ page: data,
592
657
  // @story campaigns/form-page
593
658
  // The dashboard's own previews show no Preview mode line ( Darren, 2026-11-21 ).
594
659
  quiet: iframe,
@@ -11,13 +11,16 @@ import ProviderRecaptcha from "../shared/provider-recaptcha.mjs";
11
11
  import { FormSubdomainCart, FormSubdomainProduct } from "./form-subdomain-shop-modal.mjs";
12
12
  import TemplateSubdomainLink from "./template-subdomain-link.mjs";
13
13
  import FormSubdomainMissions from "./form-subdomain-missions.mjs";
14
+ import CopyToClipboard from "../shared/copy-to-clipboard.mjs";
15
+ import ShareButton from "./share-button.mjs";
14
16
  import Tabs from "../shared/tabs.mjs";
15
17
  import Empty from "../shared/empty.mjs";
16
18
  import CardPrize from "../shared/card-prize.mjs";
17
19
  import ArrowRight from "../icons/arrow-right.mjs";
18
20
  import Flag from "../icons/flag.mjs";
21
+ import Link from "../icons/link.mjs";
19
22
  import Warning from "../icons/warning.mjs";
20
- import { afterOrder, agreementName, agreementTitles, copy, formOn, giveawayOn, menuAgreements } from "./lib/entry.mjs";
23
+ import { afterOrder, agreementName, agreementTitles, copy, formOn, giveawayOn, menuAgreements, shareValues } from "./lib/entry.mjs";
21
24
  import { motion } from "../shared/lib/motion.mjs";
22
25
  const TemplateModal = ({
23
26
  buttons,
@@ -151,6 +154,7 @@ const TemplateModal = ({
151
154
  contact: panel.data.contact,
152
155
  initial: panel.data.mission,
153
156
  missions: panel.data.missions,
157
+ page: data,
154
158
  shareLink: panel.data.shareLink,
155
159
  slug: params == null ? void 0 : params.slug,
156
160
  style,
@@ -203,6 +207,25 @@ const TemplateModal = ({
203
207
  }
204
208
  }
205
209
  ),
210
+ /* @__PURE__ */ jsx(
211
+ TemplateSubdomainLink,
212
+ {
213
+ ...{
214
+ disabled: iframe,
215
+ onClick: () => {
216
+ setPanel({
217
+ name: "share"
218
+ });
219
+ tracking.track({
220
+ name: "link-share"
221
+ });
222
+ },
223
+ svg: ArrowRight,
224
+ text: "Share link",
225
+ "aria-label": "Open to share this link"
226
+ }
227
+ }
228
+ ),
206
229
  menuAgreements(data).map(
207
230
  (id) => {
208
231
  var _a3, _b3, _c3;
@@ -550,6 +573,47 @@ const TemplateModal = ({
550
573
  ),
551
574
  buttons.recaptcha()
552
575
  ] });
576
+ // @story public-entry/view-page
577
+ // The menu's Share link: the page's own link, with Back to the menu.
578
+ case "share":
579
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
580
+ /* @__PURE__ */ jsx(
581
+ FormSubdomainHeader,
582
+ {
583
+ ...{
584
+ back: {
585
+ onClick: () => setPanel({
586
+ name: "menu"
587
+ })
588
+ },
589
+ button: buttons.close("menu"),
590
+ style,
591
+ title: "Share link"
592
+ }
593
+ }
594
+ ),
595
+ /* @__PURE__ */ jsx(
596
+ ShareButton,
597
+ {
598
+ ...{
599
+ style,
600
+ values: shareValues(data)
601
+ }
602
+ }
603
+ ),
604
+ /* @__PURE__ */ jsx(
605
+ CopyToClipboard,
606
+ {
607
+ ...{
608
+ className: "justify-between w-full pt-5 pr-3 border-t border-inherit",
609
+ icon: Link,
610
+ style,
611
+ value: data == null ? void 0 : data.url
612
+ },
613
+ children: "Copy link"
614
+ }
615
+ )
616
+ ] });
553
617
  case "submission":
554
618
  return /* @__PURE__ */ jsx(
555
619
  FormSubdomainSubmission,
@@ -557,6 +621,7 @@ const TemplateModal = ({
557
621
  ...{
558
622
  button: buttons.close("submission"),
559
623
  checkout,
624
+ page: data,
560
625
  // @story campaigns/form-page
561
626
  // The dashboard's own previews show no Preview mode line ( Darren, 2026-11-21 ).
562
627
  quiet: iframe,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawbridge/components",
3
- "version": "0.1.50",
3
+ "version": "0.1.51",
4
4
  "exports": {
5
5
  "./advertisement": {
6
6
  "types": "./types/advertisement.d.ts",
@@ -20,6 +20,8 @@ export interface FormSubdomainMissionsProps {
20
20
  initial?: string | null;
21
21
  message?: ReactNode;
22
22
  missions?: MissionItem[];
23
+ // The page payload: the Share mission shares its headline and description.
24
+ page?: { description?: string | null; headline?: string | null } | null;
23
25
  shareLink?: string | null;
24
26
  slug?: string;
25
27
  style?: BrandStyle;
@@ -104,6 +104,8 @@ export interface FormSubdomainSubmissionProps {
104
104
  id?: string;
105
105
  lead?: string;
106
106
  message?: ReactNode;
107
+ // The page payload: the Share mission shares its headline and description.
108
+ page?: { description?: string | null; headline?: string | null } | null;
107
109
  // The submission POST's `result.panel`: the ads and missions, so the panel
108
110
  // asks nothing more. Without it ( the ?submission= deep link ) it asks once.
109
111
  panel?: {
@@ -15,6 +15,13 @@ export declare const formOn: ( data: { form?: boolean } | null | undefined ) =>
15
15
 
16
16
  export declare const giveawayOn: ( data: { giveaway?: boolean } | null | undefined ) => boolean;
17
17
 
18
+ // What the share buttons share: the page's own link and preview image ( the
19
+ // menu's Share link ), or `link`, the person's share link, with no image.
20
+ export declare const shareValues: (
21
+ data: { description?: string | null; descriptions?: { preview?: string | null }; headline?: string | null; images?: { preview?: unknown }; url?: string | null } | null | undefined,
22
+ link?: string | null
23
+ ) => { alt?: string | null; description?: string | null; headline?: string | null; image?: unknown; url?: string | null };
24
+
18
25
  // Entries are being awarded: the giveaway is on and `awarding` is not false.
19
26
  export declare const awardingOn: ( data: { awarding?: boolean; giveaway?: boolean } | null | undefined ) => boolean;
20
27