@tiledev/sdk-apptile-live-selling 0.14.0 → 0.15.0

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 (76) hide show
  1. package/README.md +30 -8
  2. package/dist/clipsPage.d.ts +29 -0
  3. package/dist/clipsPage.d.ts.map +1 -0
  4. package/dist/clipsPage.js +49 -0
  5. package/dist/clipsPage.js.map +1 -0
  6. package/dist/index.d.ts +4 -2
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +23 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/linkLots.d.ts +64 -0
  11. package/dist/linkLots.d.ts.map +1 -0
  12. package/dist/linkLots.js +84 -0
  13. package/dist/linkLots.js.map +1 -0
  14. package/dist/livePages.d.ts +91 -4
  15. package/dist/livePages.d.ts.map +1 -1
  16. package/dist/livePages.js +101 -4
  17. package/dist/livePages.js.map +1 -1
  18. package/dist/pageOptions.d.ts +24 -6
  19. package/dist/pageOptions.d.ts.map +1 -1
  20. package/dist/pageOptions.js +20 -3
  21. package/dist/pageOptions.js.map +1 -1
  22. package/dist/pageTypes.d.ts +58 -0
  23. package/dist/pageTypes.d.ts.map +1 -1
  24. package/dist/react/LiveSellingProvider.d.ts +11 -3
  25. package/dist/react/LiveSellingProvider.d.ts.map +1 -1
  26. package/dist/react/LiveSellingProvider.js +26 -8
  27. package/dist/react/LiveSellingProvider.js.map +1 -1
  28. package/dist/react/index.d.ts +3 -1
  29. package/dist/react/index.d.ts.map +1 -1
  30. package/dist/react/index.js +6 -1
  31. package/dist/react/index.js.map +1 -1
  32. package/dist/react/index.web.d.ts +3 -1
  33. package/dist/react/index.web.d.ts.map +1 -1
  34. package/dist/react/index.web.js +7 -1
  35. package/dist/react/index.web.js.map +1 -1
  36. package/dist/react/shopifyProviders.d.ts +4 -3
  37. package/dist/react/shopifyProviders.d.ts.map +1 -1
  38. package/dist/react/shopifyProviders.js +6 -4
  39. package/dist/react/shopifyProviders.js.map +1 -1
  40. package/dist/react/useAccountName.d.ts +8 -0
  41. package/dist/react/useAccountName.d.ts.map +1 -0
  42. package/dist/react/useAccountName.js +49 -0
  43. package/dist/react/useAccountName.js.map +1 -0
  44. package/dist/react/useClipsPage.d.ts +47 -0
  45. package/dist/react/useClipsPage.d.ts.map +1 -0
  46. package/dist/react/useClipsPage.js +130 -0
  47. package/dist/react/useClipsPage.js.map +1 -0
  48. package/dist/react/useLiveAuction.d.ts +5 -3
  49. package/dist/react/useLiveAuction.d.ts.map +1 -1
  50. package/dist/react/useLiveAuction.js +10 -5
  51. package/dist/react/useLiveAuction.js.map +1 -1
  52. package/dist/react/useLiveChat.d.ts +42 -7
  53. package/dist/react/useLiveChat.d.ts.map +1 -1
  54. package/dist/react/useLiveChat.js +90 -12
  55. package/dist/react/useLiveChat.js.map +1 -1
  56. package/dist/react/useLiveGiveawaysAndPolls.d.ts +14 -3
  57. package/dist/react/useLiveGiveawaysAndPolls.d.ts.map +1 -1
  58. package/dist/react/useLiveGiveawaysAndPolls.js +56 -11
  59. package/dist/react/useLiveGiveawaysAndPolls.js.map +1 -1
  60. package/dist/react/useLivePage.d.ts +22 -1
  61. package/dist/react/useLivePage.d.ts.map +1 -1
  62. package/dist/react/useLivePage.js +51 -11
  63. package/dist/react/useLivePage.js.map +1 -1
  64. package/dist/react/useLiveShop.d.ts +25 -5
  65. package/dist/react/useLiveShop.d.ts.map +1 -1
  66. package/dist/react/useLiveShop.js +65 -19
  67. package/dist/react/useLiveShop.js.map +1 -1
  68. package/dist/react/useReplayPage.d.ts +20 -4
  69. package/dist/react/useReplayPage.d.ts.map +1 -1
  70. package/dist/react/useReplayPage.js +94 -33
  71. package/dist/react/useReplayPage.js.map +1 -1
  72. package/dist/showNames.d.ts +11 -0
  73. package/dist/showNames.d.ts.map +1 -1
  74. package/dist/showNames.js +23 -1
  75. package/dist/showNames.js.map +1 -1
  76. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useLiveChat.d.ts","sourceRoot":"","sources":["../../src/react/useLiveChat.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIvD,oFAAoF;AACpF,MAAM,WAAW,YAAY;IAC3B,kFAAkF;IAClF,KAAK,EAAE,OAAO,CAAC;IACf,oEAAoE;IACpE,UAAU,EAAE,OAAO,CAAC;IACpB,mEAAmE;IACnE,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,YAAY;;IA+DrE,wGAAwG;;;;;;;6BA/BvE,MAAM;;;;;;;;;uBAf1B,MAAM;2BAWqB,MAAM;;;;;+BAaR,MAAM;;;;;;;;;;;EAyD/C;AAED,2EAA2E;AAC3E,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC"}
1
+ {"version":3,"file":"useLiveChat.d.ts","sourceRoot":"","sources":["../../src/react/useLiveChat.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAQvD,oFAAoF;AACpF,MAAM,WAAW,YAAY;IAC3B,kFAAkF;IAClF,KAAK,EAAE,OAAO,CAAC;IACf,oEAAoE;IACpE,UAAU,EAAE,OAAO,CAAC;IACpB,mEAAmE;IACnE,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,sIAAsI;IACtI,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAe,EAAE,EAAE,YAAY;;IA8GhG,wGAAwG;;;;;;;6BA/BvE,MAAM;2BAjIxB,MAAM,KAAK,IAAI;;;;;;;;;;;;;;uBAoGjB,MAAM;2BAaqB,MAAM;uCAO5B,MAAM,YAAY,MAAM;8BATH,MAAM;;;;;+BA2BP,MAAM;;;;;;;;;;;EAkE/C;AAED,2EAA2E;AAC3E,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -3,14 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLiveChat = useLiveChat;
4
4
  /**
5
5
  * The Live screen's chat and reactions (0.14.0, moved from amore-v2's `src/core/hooks/useLiveChat.ts`:
6
- * phase 2 of its "Live player plan", Freckled Poppy's behaviour).
6
+ * phase 2 of its "Live player plan", Freckled Poppy's behaviour; 0.15.0 adds its links, account names,
7
+ * blocked names and "Sign in to comment", from amore-v2's `eng928/integration`).
7
8
  */
8
9
  const sdk_shopify_1 = require("@tiledev/sdk-shopify");
9
10
  const react_1 = require("react");
10
11
  const react_native_1 = require("react-native");
11
12
  const livePages_1 = require("../livePages");
13
+ const showNames_1 = require("../showNames");
12
14
  const viewer_1 = require("../viewer");
15
+ const LiveSellingProvider_1 = require("./LiveSellingProvider");
13
16
  const platformSession_1 = require("./platformSession");
17
+ const useAccountName_1 = require("./useAccountName");
18
+ const navigation_1 = require("./navigation");
14
19
  /**
15
20
  * The Live screen's chat and reactions. `useLivePage` calls it with what it knows about the show and
16
21
  * hands the result to the screen (`page.chat`), one set of props per tile.
@@ -23,33 +28,86 @@ const platformSession_1 = require("./platformSession");
23
28
  * account loads, the pin (`session.pinnedComment`), the host's reaction setting
24
29
  * (`session.reactionStyle`), and the shopper's own comment and reaction shown at once. Nothing here
25
30
  * repeats it.
26
- * - **Anyone can comment** (Freckled Poppy's rule, decided): a shopper the room has no name for is asked
27
- * for one on their first comment, inside the comment box, and the session saves it on this phone
28
- * (`chooseViewerName`) before the comment goes out. A signed-in shopper comments under their
31
+ * - **Anyone can comment** (Freckled Poppy's rule, decided): a signed-out shopper the room has no name
32
+ * for is asked for one on their first comment, inside the comment box, and the session saves it on
33
+ * this phone (`chooseViewerName`) before the comment goes out. A signed-in shopper comments under their
29
34
  * account's name (`ShopifyLiveSessionProvider`'s `viewerName`); while their account loads (on app
30
- * open, or a moment after signing in), Send waits. An account with no name, or with a name the show's
31
- * team goes by, gives the room none since 0.13.0, so that shopper is asked too, once it has loaded
32
- * (`chatNameAsk`; amore-v2's chat waited for ever for them).
35
+ * open, or a moment after signing in), Send waits (`accountNameAsk`).
36
+ * - **A signed-in shopper with no first name on their account is asked once** (0.15.0; amore-v2's
37
+ * ENG-686, decided 2026-10-19 by its Head of Engineering: old Amore's and old K-Marie's way). A Shopify
38
+ * sign-in by emailed code leaves the name blank, and since 0.13.0 the room names nobody by their
39
+ * email. The comment box asks for a first and a last name (`commentBox.accountName`, starting from what
40
+ * the account has), saves them on the account (`onSaveAccountName`, through `useAccountName`) and only
41
+ * then sends the comment, so the account, the room and the next show all have it. A giveaway entry
42
+ * asks the same way, so whichever comes first asks, once. A name typed as a guest before signing in
43
+ * isn't used: the account's name governs. A save that didn't go through sends nothing, and the sheet
44
+ * says so. A comment box without the account's fields asks for one name, kept on this phone
45
+ * (`onSaveName`), as in 0.14.0.
46
+ * - **The show's team's names can't be used** (0.15.0; Host and Moderator unless `LiveSellingProvider`'s
47
+ * `blockedNames` says), signed in or not: the sheet says so as the name is typed (`isNameAllowed`), and
48
+ * an account named as one is asked as one with no name. The session refuses them too.
49
+ * - **"Sign in to comment"** (0.15.0; decided 2026-10-19 by amore-v2's Head of Engineering): the comment
50
+ * box's two switches, one for live shows and one for auction shows (`auction` says which applies), off
51
+ * by default. On, a signed-out shopper's tap on the box starts the app's sign-in (sdk-shopify's
52
+ * `useSignIn`; the app's Sign In page is `routes.openSignIn`) in place of the name sheet; back on this
53
+ * screen signed in, the keyboard comes up in the box (`keyboardRequest`). Back still signed out,
54
+ * nothing more happens, now or after a later sign-in elsewhere.
33
55
  * - **Reactions** need no sign-in. Which ones is the button tile's; the Live screen hands the same list
34
56
  * to the floating reactions.
35
57
  * - **A tap on a name** in the chat puts "@name" in the comment box.
58
+ * - **A tap on a host's or moderator's link** opens it inside the app, the show in the bubble
59
+ * (`comments.onOpenLink`, 0.15.0, amore-v2's ENG-656). None without a way to open links.
36
60
  * - **Hide Comments** is the shopper's, for this visit to the screen.
37
61
  * - **`keyboardUp`**: the comment box's keyboard is up, so the screen lets a tap on the video put it
38
62
  * away (iOS has no key for that).
39
63
  */
40
- function useLiveChat({ onAir, canComment, canReact }) {
64
+ function useLiveChat({ onAir, canComment, canReact, openLink, auction = false }) {
41
65
  var _a, _b, _c, _d, _e;
42
66
  // The session changes only on the room's events, never on a clock.
43
67
  const session = (0, platformSession_1.useLiveSession)();
44
68
  const { sendComment, sendReaction, chooseViewerName } = session.actions;
45
- const { loggedIn, restoring, customer } = (0, sdk_shopify_1.useCustomer)();
69
+ const { loggedIn, restoring } = (0, sdk_shopify_1.useCustomer)();
70
+ const { accountLoading, nameToComplete, saveNameToAccount } = (0, useAccountName_1.useAccountName)();
71
+ const { routes, blockedNames, canOpenLinks } = (0, LiveSellingProvider_1.useLivePageOptions)();
46
72
  // ─── Who the shopper is in the room ──────────────────────────────────────────────────────────────
47
- const { askForName, waitingForName } = (0, livePages_1.chatNameAsk)({
73
+ // A stored sign-in is still being read on app open: not a signed-out shopper to ask.
74
+ const signedIn = !!loggedIn || !!restoring;
75
+ const { askForName, waitingForName } = (0, livePages_1.accountNameAsk)({
48
76
  named: !!((_a = session.viewerName) === null || _a === void 0 ? void 0 : _a.trim()),
49
77
  loggedIn: !!loggedIn,
50
78
  restoring: !!restoring,
51
- hasCustomer: !!customer,
79
+ accountLoading,
80
+ nameToComplete,
52
81
  });
82
+ // ─── "Sign in to comment", and back to the box ───────────────────────────────────────────────────
83
+ const nav = (0, navigation_1.useNavigation)();
84
+ const isFocused = (0, navigation_1.useIsFocused)();
85
+ const signIn = (0, sdk_shopify_1.useSignIn)({ onOpenSignInPage: (method) => routes.openSignIn(method, nav) });
86
+ /** The shopper tapped the box to sign in: once back here signed in, the keyboard comes up in it. */
87
+ const [backToTheBox, setBackToTheBox] = (0, react_1.useState)(false);
88
+ /** A new number each time the box should take the keyboard. */
89
+ const [keyboardRequest, setKeyboardRequest] = (0, react_1.useState)(0);
90
+ const startSignIn = signIn.start;
91
+ const signInToComment = (0, react_1.useCallback)(() => {
92
+ setBackToTheBox(true);
93
+ void startSignIn();
94
+ }, [startSignIn]);
95
+ // Back here: this screen focused (the Sign In page closed), and no system sign-in sheet up.
96
+ const screenOnShow = isFocused && !signIn.signingIn;
97
+ const wasOnShow = (0, react_1.useRef)(screenOnShow);
98
+ (0, react_1.useEffect)(() => {
99
+ const cameBackOnShow = screenOnShow && !wasOnShow.current;
100
+ wasOnShow.current = screenOnShow;
101
+ if (!backToTheBox)
102
+ return;
103
+ if (loggedIn && screenOnShow) {
104
+ setBackToTheBox(false);
105
+ setKeyboardRequest((request) => request + 1);
106
+ }
107
+ // Back without signing in: the box stays as it was, now and after a later sign-in elsewhere.
108
+ else if (!loggedIn && cameBackOnShow)
109
+ setBackToTheBox(false);
110
+ }, [backToTheBox, loggedIn, screenOnShow]);
53
111
  // ─── Commenting ─────────────────────────────────────────────────────────────────────────────────
54
112
  const [sending, setSending] = (0, react_1.useState)(false);
55
113
  const send = (0, react_1.useCallback)(async (text) => {
@@ -61,8 +119,19 @@ function useLiveChat({ onAir, canComment, canReact }) {
61
119
  setSending(false);
62
120
  }
63
121
  }, [sendComment]);
64
- /** True once the session has saved the name, and the engine has it for the comment that follows. */
122
+ /** False for a name the show's team goes by: the sheet says so before Save. */
123
+ const isNameAllowed = (0, react_1.useCallback)((name) => !(0, showNames_1.isBlockedViewerName)(name, blockedNames), [blockedNames]);
124
+ /** Signed out: true once the session has saved the name on this phone, and the engine has it for the comment that follows. */
65
125
  const saveName = (0, react_1.useCallback)(async (name) => !!(await chooseViewerName(name)), [chooseViewerName]);
126
+ /**
127
+ * Signed in: true once the name is on the account. Then given to the session as well, as the room reads
128
+ * the account's name only on the next draw, after the comment waiting for it has gone: this gives the
129
+ * engine the name for that comment, and keeps it on this phone.
130
+ */
131
+ const saveAccountName = (0, react_1.useCallback)(async (firstName, lastName) => {
132
+ const savedName = await saveNameToAccount(firstName, lastName);
133
+ return !!savedName && !!(await chooseViewerName(savedName));
134
+ }, [saveNameToAccount, chooseViewerName]);
66
135
  const [mention, setMention] = (0, react_1.useState)(null);
67
136
  const mentionsSoFar = (0, react_1.useRef)(0);
68
137
  const replyTo = (0, react_1.useCallback)((name) => {
@@ -101,16 +170,25 @@ function useLiveChat({ onAir, canComment, canReact }) {
101
170
  onToggleHidden: toggleComments,
102
171
  // Only with a comment box to reply into.
103
172
  onPressName: commentBoxShown ? replyTo : undefined,
173
+ // Only with somewhere to open it: without, every link is words.
174
+ onOpenLink: canOpenLinks ? openLink : undefined,
104
175
  },
105
176
  commentBox: {
106
177
  visible: commentBoxShown,
107
178
  askForName,
179
+ accountName: nameToComplete,
108
180
  waitingForName,
181
+ signedOut: !signedIn,
182
+ auction,
183
+ keyboardRequest,
184
+ onSignInToComment: signInToComment,
109
185
  sending,
110
186
  mention,
111
187
  nameMaxLength: viewer_1.MAX_VIEWER_NAME,
112
188
  onSend: send,
113
189
  onSaveName: saveName,
190
+ onSaveAccountName: saveAccountName,
191
+ isNameAllowed,
114
192
  onTypingChange: setTyping,
115
193
  },
116
194
  reactionButton: {
@@ -1 +1 @@
1
- {"version":3,"file":"useLiveChat.js","sourceRoot":"","sources":["../../src/react/useLiveChat.ts"],"names":[],"mappings":";;AAiDA,kCAkGC;AAnJD;;;GAGG;AACH,sDAAmD;AACnD,iCAAiE;AACjE,+CAAkD;AAElD,4CAA2C;AAE3C,sCAA4C;AAC5C,uDAAmD;AAYnD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAg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C,aAAa,EAAE,MAAA,OAAO,CAAC,aAAa,mCAAI,QAAQ;SACjD;QACD,aAAa,EAAE;YACb,OAAO,EAAE,KAAK;YACd,aAAa,EAAE,MAAA,OAAO,CAAC,aAAa,mCAAI,IAAI;SAC7C;KACF,CAAC;AACJ,CAAC"}
@@ -26,9 +26,16 @@ import type { LiveGiveawayPrize } from '../pageTypes';
26
26
  * page closed, or the system's sheet dismissed), nothing reopens. `useGiveawayEntry` does this;
27
27
  * "back here" is this screen focused with no system sheet up.
28
28
  * - **The entry carries the room's name for the shopper** (`session.viewerName`: their account's
29
- * name, never an email). While it loads, Enter waits; if the room has none (an account with no
30
- * name, since 0.13.0), the sheet asks ("Entering As:", old Amore's) and the entry goes once the
31
- * session holds the name.
29
+ * name, never an email). While their account loads, Enter waits; if the room has none, the sheet
30
+ * asks ("Entering As:", old Amore's) and the entry goes once the session holds the name.
31
+ * - **An account with no first name is asked for one, and it goes on the account** (0.15.0; amore-v2's
32
+ * ENG-686, decided 2026-10-19 by its Head of Engineering, the comment box's way: `useAccountName`).
33
+ * "Entering As:" asks for a first and a last name (`accountName`, starting from what the account
34
+ * has); Enter puts them on the account (sdk-shopify's `updateProfile`) and then enters under that
35
+ * name (`onEnterWithAccountName`). So a shopper is asked once, by a giveaway or a comment. A name
36
+ * that didn't go on the account says so in the sheet (`nameSaveFailed`) and enters nothing. A name
37
+ * the show's team goes by (`LiveSellingProvider`'s `blockedNames`) is refused as it is typed
38
+ * (`isNameAllowed`); the session refuses it too.
32
39
  * - An entry the host didn't confirm (`enterGiveaway` answers `{ entered: false }`) says so in the
33
40
  * sheet, and Enter can be tried again.
34
41
  * - The host's draw closes the sheet (Freckled Poppy's).
@@ -55,12 +62,16 @@ export declare function useLiveGiveawaysAndPolls(): {
55
62
  signInToEnter: boolean;
56
63
  waitingForName: boolean;
57
64
  askForName: boolean;
65
+ accountName: import("../pageTypes").NameOnAccount | null;
66
+ nameSaveFailed: boolean;
67
+ isNameAllowed: (name: string) => boolean;
58
68
  nameMaxLength: number;
59
69
  entryFailed: boolean;
60
70
  sheetVisible: boolean;
61
71
  onOpenSheet: () => void;
62
72
  onCloseSheet: () => void;
63
73
  onEnter: (typedName?: string) => void;
74
+ onEnterWithAccountName: (firstName: string, lastName: string) => undefined;
64
75
  onSignInToEnter: () => void;
65
76
  };
66
77
  giveawayDraw: {
@@ -1 +1 @@
1
- {"version":3,"file":"useLiveGiveawaysAndPolls.d.ts","sourceRoot":"","sources":["../../src/react/useLiveGiveawaysAndPolls.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAYtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BA4EzB,MAAM;;EA0CpB;AAED,uFAAuF;AACvF,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
1
+ {"version":3,"file":"useLiveGiveawaysAndPolls.d.ts","sourceRoot":"","sources":["../../src/react/useLiveGiveawaysAndPolls.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AActD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,wBAAgB,wBAAwB;;;;;;;;;;;;8BA6FG,MAAM;;;;;;;4CAuCP,MAAM,YAAY,MAAM;;;;;;;;;;;;;;;;2BA1BnD,MAAM;;EA8CpB;AAED,uFAAuF;AACvF,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
@@ -4,16 +4,20 @@ exports.useLiveGiveawaysAndPolls = useLiveGiveawaysAndPolls;
4
4
  /**
5
5
  * The Live screen's giveaways and polls (0.14.0, moved from amore-v2's
6
6
  * `src/core/hooks/useLiveGiveawaysAndPolls.ts`: phase 5 of its "Live player plan", Freckled Poppy's
7
- * behaviour, old Amore's look). The routes are the app's (`LiveSellingProvider`'s `routes`); the
8
- * route's `streamId` param is read here.
7
+ * behaviour, old Amore's look; 0.15.0 adds its account names and blocked names, from amore-v2's
8
+ * `eng928/integration`). The routes are the app's (`LiveSellingProvider`'s `routes`); the route's
9
+ * `streamId` param is read here.
9
10
  */
10
11
  const sdk_shopify_1 = require("@tiledev/sdk-shopify");
11
12
  const react_1 = require("react");
13
+ const livePages_1 = require("../livePages");
12
14
  const pageOptions_1 = require("../pageOptions");
13
15
  const sessionTypes_1 = require("../sessionTypes");
16
+ const showNames_1 = require("../showNames");
14
17
  const viewer_1 = require("../viewer");
15
18
  const LiveSellingProvider_1 = require("./LiveSellingProvider");
16
19
  const platformSession_1 = require("./platformSession");
20
+ const useAccountName_1 = require("./useAccountName");
17
21
  const useGiveawayEntry_1 = require("./useGiveawayEntry");
18
22
  const useGiveawayPrize_1 = require("./useGiveawayPrize");
19
23
  const navigation_1 = require("./navigation");
@@ -44,9 +48,16 @@ const navigation_1 = require("./navigation");
44
48
  * page closed, or the system's sheet dismissed), nothing reopens. `useGiveawayEntry` does this;
45
49
  * "back here" is this screen focused with no system sheet up.
46
50
  * - **The entry carries the room's name for the shopper** (`session.viewerName`: their account's
47
- * name, never an email). While it loads, Enter waits; if the room has none (an account with no
48
- * name, since 0.13.0), the sheet asks ("Entering As:", old Amore's) and the entry goes once the
49
- * session holds the name.
51
+ * name, never an email). While their account loads, Enter waits; if the room has none, the sheet
52
+ * asks ("Entering As:", old Amore's) and the entry goes once the session holds the name.
53
+ * - **An account with no first name is asked for one, and it goes on the account** (0.15.0; amore-v2's
54
+ * ENG-686, decided 2026-10-19 by its Head of Engineering, the comment box's way: `useAccountName`).
55
+ * "Entering As:" asks for a first and a last name (`accountName`, starting from what the account
56
+ * has); Enter puts them on the account (sdk-shopify's `updateProfile`) and then enters under that
57
+ * name (`onEnterWithAccountName`). So a shopper is asked once, by a giveaway or a comment. A name
58
+ * that didn't go on the account says so in the sheet (`nameSaveFailed`) and enters nothing. A name
59
+ * the show's team goes by (`LiveSellingProvider`'s `blockedNames`) is refused as it is typed
60
+ * (`isNameAllowed`); the session refuses it too.
50
61
  * - An entry the host didn't confirm (`enterGiveaway` answers `{ entered: false }`) says so in the
51
62
  * sheet, and Enter can be tried again.
52
63
  * - The host's draw closes the sheet (Freckled Poppy's).
@@ -71,9 +82,10 @@ function useLiveGiveawaysAndPolls() {
71
82
  const session = (0, platformSession_1.useLiveSession)();
72
83
  const { voteInPoll } = session.actions;
73
84
  const { loggedIn, restoring, customer } = (0, sdk_shopify_1.useCustomer)();
85
+ const { accountLoading, nameToComplete, saveNameToAccount } = (0, useAccountName_1.useAccountName)();
74
86
  const cartId = (_d = (_c = (0, sdk_shopify_1.useCart)().cart) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : null;
75
87
  const nav = (0, navigation_1.useNavigation)();
76
- const { routes } = (0, LiveSellingProvider_1.useLivePageOptions)();
88
+ const { routes, blockedNames } = (0, LiveSellingProvider_1.useLivePageOptions)();
77
89
  const signIn = (0, sdk_shopify_1.useSignIn)({ onOpenSignInPage: (method) => routes.openSignIn(method, nav) });
78
90
  // ─── Which show ────────────────────────────────────────────────────────────────────────────────
79
91
  // The session's record once it is this show's: right after the pin it can still hold the last show's.
@@ -121,11 +133,40 @@ function useLiveGiveawaysAndPolls() {
121
133
  };
122
134
  }, [openGiveaway, prizeProduct, prizeVariant, showCurrency]);
123
135
  // ─── Who the shopper is to the giveaway ────────────────────────────────────────────────────────
124
- const named = !!((_l = session.viewerName) === null || _l === void 0 ? void 0 : _l.trim());
125
136
  const signInToEnter = !loggedIn && !restoring;
126
- // A stored sign-in still being read, or a signed-in shopper's profile (and so their name) still on its way.
127
- const waitingForName = !!restoring || (!!loggedIn && !named && !customer);
128
- const askForName = !!loggedIn && !named && !!customer;
137
+ // A stored sign-in still being read, or a signed-in shopper's account (and so their name) still on its
138
+ // way: Enter waits. No first name on the account: asked, and saved to it. Else the room's own ask.
139
+ const { askForName, waitingForName } = (0, livePages_1.giveawayNameAsk)({
140
+ named: !!((_l = session.viewerName) === null || _l === void 0 ? void 0 : _l.trim()),
141
+ loggedIn: !!loggedIn,
142
+ hasCustomer: !!customer,
143
+ accountLoading,
144
+ nameToComplete,
145
+ });
146
+ // "Entering As:" for the account: the name goes on the account, then the entry goes under it.
147
+ const [savingAccountName, setSavingAccountName] = (0, react_1.useState)(false);
148
+ const [accountNameNotSaved, setAccountNameNotSaved] = (0, react_1.useState)(false);
149
+ const enterUnder = entry.enter;
150
+ const enterWithAccountName = (0, react_1.useCallback)(async (firstName, lastName) => {
151
+ setSavingAccountName(true);
152
+ setAccountNameNotSaved(false);
153
+ try {
154
+ const savedName = await saveNameToAccount(firstName, lastName);
155
+ if (savedName)
156
+ enterUnder(savedName);
157
+ else
158
+ setAccountNameNotSaved(true);
159
+ }
160
+ finally {
161
+ setSavingAccountName(false);
162
+ }
163
+ }, [saveNameToAccount, enterUnder]);
164
+ // A failure belongs to the sheet it happened in.
165
+ (0, react_1.useEffect)(() => {
166
+ if (!entry.sheetOpen)
167
+ setAccountNameNotSaved(false);
168
+ }, [entry.sheetOpen]);
169
+ const isNameAllowed = (0, react_1.useCallback)((name) => !(0, showNames_1.isBlockedViewerName)(name, blockedNames), [blockedNames]);
129
170
  // ─── The poll ──────────────────────────────────────────────────────────────────────────────────
130
171
  const poll = showing ? ((_m = session.poll) !== null && _m !== void 0 ? _m : null) : null;
131
172
  const pollId = (_p = (_o = session.poll) === null || _o === void 0 ? void 0 : _o.pollUuid) !== null && _p !== void 0 ? _p : null;
@@ -147,16 +188,20 @@ function useLiveGiveawaysAndPolls() {
147
188
  prize,
148
189
  entryCount: giveaway.entryCount,
149
190
  entered: giveaway.registered,
150
- entering: entry.entering,
191
+ entering: entry.entering || savingAccountName,
151
192
  signInToEnter,
152
193
  waitingForName,
153
194
  askForName,
195
+ accountName: nameToComplete,
196
+ nameSaveFailed: accountNameNotSaved,
197
+ isNameAllowed,
154
198
  nameMaxLength: viewer_1.MAX_VIEWER_NAME,
155
199
  entryFailed: entry.entryFailed,
156
200
  sheetVisible: entry.sheetOpen,
157
201
  onOpenSheet: entry.openSheet,
158
202
  onCloseSheet: entry.closeSheet,
159
203
  onEnter: entry.enter,
204
+ onEnterWithAccountName: (firstName, lastName) => void enterWithAccountName(firstName, lastName),
160
205
  onSignInToEnter: entry.signInToEnter,
161
206
  },
162
207
  giveawayDraw: {
@@ -1 +1 @@
1
- {"version":3,"file":"useLiveGiveawaysAndPolls.js","sourceRoot":"","sources":["../../src/react/useLiveGiveawaysAndPolls.ts"],"names":[],"mappings":";;AAoEA,4DAsHC;AA1LD;;;;;GAKG;AACH,sDAAkG;AAClG,iCAAkE;AAElE,gDAAmD;AAEnD,kDAAgD;AAChD,sCAA4C;AAC5C,+DAA2D;AAC3D,uDAAgE;AAChE,yDAAsD;AACtD,yDAAsD;AACtD,6CAA8H;AAK9H;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,SAAgB,wBAAwB;;IACtC,MAAM,QAAQ,GAAG,MAAA,MAAA,IAAA,qBAAQ,GAAa,CAAC,MAAM,0CAAE,QAAQ,mCAAI,EAAE,CAAC;IAC9D,MAAM,SAAS,GAAG,IAAA,yBAAY,GAAE,CAAC;IACjC,mEAAmE;IACnE,MAAM,OAAO,GAAG,IAAA,gCAAc,GAAW,CAAC;IAC1C,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IACvC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAA,yBAAW,GAAE,CAAC;IACxD,MAAM,MAAM,GAAG,MAAA,MAAA,IAAA,qBAAO,GAAE,CAAC,IAAI,0CAAE,EAAE,mCAAI,IAAI,CAAC;IAC1C,MAAM,GAAG,GAAG,IAAA,0BAAa,GAAiC,CAAC;IAC3D,MAAM,EAAE,MAAM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MAAM,EAAE,IAAI;SACb;KACF,CAAC;AACJ,CAAC"}
@@ -25,6 +25,15 @@
25
25
  * shrinks; the cart shrinks the show and opens the Cart over this screen (Items You Won on an auction
26
26
  * show: `routes.openCart`). Android's back with nothing behind this screen (a link on a cold start)
27
27
  * does what the arrow does: back to the Live tab.
28
+ * - **A link from the show** (`openLink`, 0.15.0; decided 2026-10-19 by amore-v2's Head of Engineering)
29
+ * opens inside the app, never the phone's browser: the show goes into the bubble, as for the cart, and
30
+ * the app's `routes.openLink` opens the page (amore-v2: the store's product or collection on its
31
+ * screen, any other page in its web page). Leaving the app for the phone's browser is what left the
32
+ * player dark on the way back (ENG-629) and the phone's window blank (ENG-580). A link that isn't https
33
+ * (`opensInApp`), or an app without `routes.openLink`, opens nothing, and the show stays.
34
+ * - **The cart's holds** (0.15.0, amore-v2's ENG-691): the header shows a timer under the cart button in
35
+ * the soonest hold's last minutes; this hands it when each hold ends (`header.holdEndTimes`,
36
+ * `holdEndTimesOf` over sdk-shopify's cart and its `cartExtensions`), and the header counts.
28
37
  * - **One shrunk show at a time:** arriving here stops a replay's bubble (and the Replay screen stops
29
38
  * this show's bubble).
30
39
  * - **The screen stays on** while it shows the show playing or waiting for its host.
@@ -36,7 +45,8 @@
36
45
  * `hiddenShows` names, whoever watches it.
37
46
  * - **Hidden shows** (`hiddenShows`): for a shopper who isn't on the team the session never holds one,
38
47
  * so it is never on air here (the link goes to the Live tab).
39
- * - **Chat and reactions** are `useLiveChat`'s, shown only while the show is on air.
48
+ * - **Chat and reactions** are `useLiveChat`'s, shown only while the show is on air; a host's or
49
+ * moderator's link in the chat opens through `openLink`.
40
50
  */
41
51
  export declare function useLivePage(): {
42
52
  /**
@@ -66,6 +76,7 @@ export declare function useLivePage(): {
66
76
  canPip: boolean;
67
77
  backShrinks: boolean;
68
78
  cartCount: number;
79
+ holdEndTimes: number[];
69
80
  onBack: () => void;
70
81
  onToggleMute: () => void;
71
82
  onPip: () => void;
@@ -81,16 +92,24 @@ export declare function useLivePage(): {
81
92
  hidden: boolean;
82
93
  onToggleHidden: () => void;
83
94
  onPressName: ((name: string) => void) | undefined;
95
+ onOpenLink: ((url: string) => void) | undefined;
84
96
  };
85
97
  commentBox: {
86
98
  visible: boolean;
87
99
  askForName: boolean;
100
+ accountName: import("..").NameOnAccount | null;
88
101
  waitingForName: boolean;
102
+ signedOut: boolean;
103
+ auction: boolean;
104
+ keyboardRequest: number;
105
+ onSignInToComment: () => void;
89
106
  sending: boolean;
90
107
  mention: import("..").LiveCommentMention | null;
91
108
  nameMaxLength: number;
92
109
  onSend: (text: string) => Promise<void>;
93
110
  onSaveName: (name: string) => Promise<boolean>;
111
+ onSaveAccountName: (firstName: string, lastName: string) => Promise<boolean>;
112
+ isNameAllowed: (name: string) => boolean;
94
113
  onTypingChange: import("react").Dispatch<import("react").SetStateAction<boolean>>;
95
114
  };
96
115
  reactionButton: {
@@ -107,6 +126,8 @@ export declare function useLivePage(): {
107
126
  pinnedComment: import("../types").LivePinnedComment | null;
108
127
  };
109
128
  };
129
+ /** A link from the show (0.15.0): its page inside the app, the show in the bubble. `useLiveShop` takes it. */
130
+ openLink: (url: string, title?: string | null) => void;
110
131
  };
111
132
  /** What `useLivePage` hands the Live screen and its tiles. */
112
133
  export type LivePage = ReturnType<typeof useLivePage>;
@@ -1 +1 @@
1
- {"version":3,"file":"useLivePage.d.ts","sourceRoot":"","sources":["../../src/react/useLivePage.ts"],"names":[],"mappings":"AA4CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,WAAW;IA8JvB;;;;;;OAMG;;IAEH,4FAA4F;;;;;;;;;;;;;;;;;;;;;;;;IA8B5F,8GAA8G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGjH;AAED,8DAA8D;AAC9D,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC"}
1
+ {"version":3,"file":"useLivePage.d.ts","sourceRoot":"","sources":["../../src/react/useLivePage.ts"],"names":[],"mappings":"AA8CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAgB,WAAW;IA2LvB;;;;;;OAMG;;IAEH,4FAA4F;;;;;;;;;;;;;;;;;;;;;;;;;IAgC5F,8GAA8G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAE9G,8GAA8G;oBA7HxG,MAAM,UAAU,MAAM,GAAG,IAAI;EAgItC;AAED,8DAA8D;AAC9D,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLivePage = useLivePage;
4
4
  /**
5
5
  * The Live screen's page model (0.14.0, moved from amore-v2's `src/core/hooks/useLivePage.ts`:
6
- * Freckled Poppy's Live, phase 1, watching and the in-app bubble). The routes are the app's
7
- * (`LiveSellingProvider`'s `routes`); the route's `streamId` param is read here.
6
+ * Freckled Poppy's Live, phase 1, watching and the in-app bubble; 0.15.0 adds its links and the cart
7
+ * hold's timer, from amore-v2's `eng928/integration`). The routes are the app's (`LiveSellingProvider`'s
8
+ * `routes`); the route's `streamId` param is read here.
8
9
  */
9
10
  const sdk_analytics_core_1 = require("@tiledev/sdk-analytics-core");
10
11
  const sdk_shopify_1 = require("@tiledev/sdk-shopify");
@@ -13,6 +14,7 @@ const react_native_1 = require("react-native");
13
14
  const client_1 = require("../client");
14
15
  const hiddenShows_1 = require("../hiddenShows");
15
16
  const liveSelling_1 = require("../liveSelling");
17
+ const linkLots_1 = require("../linkLots");
16
18
  const livePages_1 = require("../livePages");
17
19
  const pageOptions_1 = require("../pageOptions");
18
20
  const sessionTypes_1 = require("../sessionTypes");
@@ -56,6 +58,15 @@ const joinedThisRun = new Set();
56
58
  * shrinks; the cart shrinks the show and opens the Cart over this screen (Items You Won on an auction
57
59
  * show: `routes.openCart`). Android's back with nothing behind this screen (a link on a cold start)
58
60
  * does what the arrow does: back to the Live tab.
61
+ * - **A link from the show** (`openLink`, 0.15.0; decided 2026-10-19 by amore-v2's Head of Engineering)
62
+ * opens inside the app, never the phone's browser: the show goes into the bubble, as for the cart, and
63
+ * the app's `routes.openLink` opens the page (amore-v2: the store's product or collection on its
64
+ * screen, any other page in its web page). Leaving the app for the phone's browser is what left the
65
+ * player dark on the way back (ENG-629) and the phone's window blank (ENG-580). A link that isn't https
66
+ * (`opensInApp`), or an app without `routes.openLink`, opens nothing, and the show stays.
67
+ * - **The cart's holds** (0.15.0, amore-v2's ENG-691): the header shows a timer under the cart button in
68
+ * the soonest hold's last minutes; this hands it when each hold ends (`header.holdEndTimes`,
69
+ * `holdEndTimesOf` over sdk-shopify's cart and its `cartExtensions`), and the header counts.
59
70
  * - **One shrunk show at a time:** arriving here stops a replay's bubble (and the Replay screen stops
60
71
  * this show's bubble).
61
72
  * - **The screen stays on** while it shows the show playing or waiting for its host.
@@ -67,7 +78,8 @@ const joinedThisRun = new Set();
67
78
  * `hiddenShows` names, whoever watches it.
68
79
  * - **Hidden shows** (`hiddenShows`): for a shopper who isn't on the team the session never holds one,
69
80
  * so it is never on air here (the link goes to the Live tab).
70
- * - **Chat and reactions** are `useLiveChat`'s, shown only while the show is on air.
81
+ * - **Chat and reactions** are `useLiveChat`'s, shown only while the show is on air; a host's or
82
+ * moderator's link in the chat opens through `openLink`.
71
83
  */
72
84
  function useLivePage() {
73
85
  var _a, _b, _c, _d;
@@ -75,13 +87,14 @@ function useLivePage() {
75
87
  const route = (0, navigation_1.useRoute)();
76
88
  const streamId = (_b = (_a = route.params) === null || _a === void 0 ? void 0 : _a.streamId) !== null && _b !== void 0 ? _b : '';
77
89
  const isFocused = (0, navigation_1.useIsFocused)();
78
- const { routes, track } = (0, LiveSellingProvider_1.useLivePageOptions)();
90
+ const { routes, track, canOpenLinks } = (0, LiveSellingProvider_1.useLivePageOptions)();
79
91
  // The session changes only on the room's events, never on a clock: the header and the auction tiles keep their own.
80
92
  const session = (0, platformSession_1.useLiveSession)();
81
93
  const { holdStream, releaseStream, enterPip, exitPip, setMuted } = session.actions;
82
94
  const { viewerEmail: email } = (0, LiveSellingProvider_1.useLiveSelling)();
83
95
  const { show: sessionShow, status, onAir } = (0, platformSession_1.useLiveShow)(streamId);
84
- const { itemCount } = (0, sdk_shopify_1.useCart)();
96
+ const { cart: { cart, itemCount }, cartPage: { extensions: cartExtensions }, } = (0, sdk_shopify_1.useShopify)();
97
+ const holdEndTimes = (0, react_1.useMemo)(() => (0, livePages_1.holdEndTimesOf)(cart, cartExtensions), [cart, cartExtensions]);
85
98
  const { bubbleShown: replayInBubble, stop: stopReplay } = (0, replayPlayer_1.useReplayPlayer)();
86
99
  // ─── Which show ────────────────────────────────────────────────────────────────────────────────
87
100
  // `sessionShow` (above) is the session's record once it is this show's. The record the link's answer
@@ -153,8 +166,34 @@ function useLivePage() {
153
166
  const coveredOnlyBySheet = (0, navigation_1.useNavigationState)((state) => (0, livePages_1.isCoveredOnlyBySheet)(state, route.key, routes.sheets));
154
167
  const onScreen = isFocused || coveredOnlyBySheet;
155
168
  const showing = onScreen && session.pipMode === 'none';
169
+ // ─── Leaving for another page, the show playing on in the bubble ───────────────────────────────
170
+ /**
171
+ * The show goes into the app's own bubble (the session's `enterPip`: `pipMode` `inapp`, `LiveBubble`;
172
+ * never the phone's window, which only the phone opens as the app is put away) before a page opens over
173
+ * this screen, so it plays on there; not while it is joining or has ended. Coming back here (back, the
174
+ * bubble's tap, Android's back) ends the bubble as the screen focuses (above).
175
+ */
176
+ const shrinkForAnotherPage = (0, react_1.useCallback)(() => {
177
+ if (!canShrink)
178
+ return;
179
+ shrunk.current = true;
180
+ enterPip();
181
+ }, [canShrink, enterPip]);
182
+ /** A link from the show: its page inside the app, the show in the bubble. Nothing for one that can't open. */
183
+ const openLink = (0, react_1.useCallback)((url, title) => {
184
+ if (!canOpenLinks || !(0, linkLots_1.opensInApp)(url))
185
+ return;
186
+ shrinkForAnotherPage();
187
+ routes.openLink(url.trim(), title, nav);
188
+ }, [canOpenLinks, shrinkForAnotherPage, routes, nav]);
156
189
  // Chat and reactions: only while this show is on air. Its own hook (`useLiveChat`).
157
- const chat = (0, useLiveChat_1.useLiveChat)({ onAir, canComment: capabilities.canComment, canReact: capabilities.canReact });
190
+ const chat = (0, useLiveChat_1.useLiveChat)({
191
+ onAir,
192
+ canComment: capabilities.canComment,
193
+ canReact: capabilities.canReact,
194
+ openLink,
195
+ auction: capabilities.canBid,
196
+ });
158
197
  // Every back press (`BACK_ACTIONS`) passes here as the screen goes: a show on air enters the bubble,
159
198
  // then the screen is let go. Nothing is prevented.
160
199
  const canShrinkNow = (0, react_1.useRef)(canShrink);
@@ -209,13 +248,10 @@ function useLivePage() {
209
248
  }, [nav]));
210
249
  const isAuction = capabilities.canBid;
211
250
  const openCart = (0, react_1.useCallback)(() => {
212
- if (canShrink) {
213
- shrunk.current = true;
214
- enterPip();
215
- }
251
+ shrinkForAnotherPage();
216
252
  // A bidder's cart is what they've won: their bids never land in the shopping cart (Freckled Poppy's).
217
253
  routes.openCart({ itemsYouWon: isAuction }, nav);
218
- }, [canShrink, enterPip, isAuction, nav, routes]);
254
+ }, [shrinkForAnotherPage, isAuction, nav, routes]);
219
255
  // One surface at a time: not while the bubble or the phone's own window has it, or another screen is over this one.
220
256
  const videoActive = showing && !!sessionShow;
221
257
  return {
@@ -251,6 +287,8 @@ function useLivePage() {
251
287
  canPip: canShrink,
252
288
  backShrinks: canShrink,
253
289
  cartCount: itemCount,
290
+ // The hold timer under the cart button counts down to the soonest of these on its own (0.15.0).
291
+ holdEndTimes,
254
292
  onBack: back,
255
293
  onToggleMute: () => setMuted(!session.muted),
256
294
  // Shown only while the show can shrink: a back press, which shrinks it on the way.
@@ -259,6 +297,8 @@ function useLivePage() {
259
297
  },
260
298
  /** The chat, the comment box, reactions and the pinned comment: one set of props per tile (`useLiveChat`). */
261
299
  chat,
300
+ /** A link from the show (0.15.0): its page inside the app, the show in the bubble. `useLiveShop` takes it. */
301
+ openLink,
262
302
  };
263
303
  }
264
304
  //# sourceMappingURL=useLivePage.js.map