@tiledev/sdk-apptile-live-selling 0.13.0 → 0.14.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 (111) hide show
  1. package/README.md +94 -12
  2. package/dist/giveawayPrizeLines.d.ts +10 -0
  3. package/dist/giveawayPrizeLines.d.ts.map +1 -1
  4. package/dist/giveawayPrizeLines.js +11 -1
  5. package/dist/giveawayPrizeLines.js.map +1 -1
  6. package/dist/hiddenShows.d.ts +10 -0
  7. package/dist/hiddenShows.d.ts.map +1 -1
  8. package/dist/hiddenShows.js +11 -0
  9. package/dist/hiddenShows.js.map +1 -1
  10. package/dist/index.d.ts +7 -2
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +32 -2
  13. package/dist/index.js.map +1 -1
  14. package/dist/livePages.d.ts +79 -0
  15. package/dist/livePages.d.ts.map +1 -0
  16. package/dist/livePages.js +90 -0
  17. package/dist/livePages.js.map +1 -0
  18. package/dist/liveRoom.d.ts +21 -0
  19. package/dist/liveRoom.d.ts.map +1 -0
  20. package/dist/liveRoom.js +28 -0
  21. package/dist/liveRoom.js.map +1 -0
  22. package/dist/pageOptions.d.ts +100 -0
  23. package/dist/pageOptions.d.ts.map +1 -0
  24. package/dist/pageOptions.js +82 -0
  25. package/dist/pageOptions.js.map +1 -0
  26. package/dist/pageTypes.d.ts +127 -0
  27. package/dist/pageTypes.d.ts.map +1 -0
  28. package/dist/pageTypes.js +3 -0
  29. package/dist/pageTypes.js.map +1 -0
  30. package/dist/react/LiveSellingProvider.d.ts +23 -1
  31. package/dist/react/LiveSellingProvider.d.ts.map +1 -1
  32. package/dist/react/LiveSellingProvider.js +26 -2
  33. package/dist/react/LiveSellingProvider.js.map +1 -1
  34. package/dist/react/index.d.ts +10 -0
  35. package/dist/react/index.d.ts.map +1 -1
  36. package/dist/react/index.js +29 -1
  37. package/dist/react/index.js.map +1 -1
  38. package/dist/react/index.web.d.ts +11 -32
  39. package/dist/react/index.web.d.ts.map +1 -1
  40. package/dist/react/index.web.js +46 -139
  41. package/dist/react/index.web.js.map +1 -1
  42. package/dist/react/navigation.d.ts +13 -0
  43. package/dist/react/navigation.d.ts.map +1 -0
  44. package/dist/react/navigation.js +7 -0
  45. package/dist/react/navigation.js.map +1 -0
  46. package/dist/react/platformSession.d.ts +16 -0
  47. package/dist/react/platformSession.d.ts.map +1 -0
  48. package/dist/react/platformSession.js +28 -0
  49. package/dist/react/platformSession.js.map +1 -0
  50. package/dist/react/platformSession.web.d.ts +35 -0
  51. package/dist/react/platformSession.web.d.ts.map +1 -0
  52. package/dist/react/platformSession.web.js +148 -0
  53. package/dist/react/platformSession.web.js.map +1 -0
  54. package/dist/react/replayPlayer.d.ts +74 -0
  55. package/dist/react/replayPlayer.d.ts.map +1 -0
  56. package/dist/react/replayPlayer.js +279 -0
  57. package/dist/react/replayPlayer.js.map +1 -0
  58. package/dist/react/shopifyProviders.d.ts +68 -0
  59. package/dist/react/shopifyProviders.d.ts.map +1 -0
  60. package/dist/react/shopifyProviders.js +98 -0
  61. package/dist/react/shopifyProviders.js.map +1 -0
  62. package/dist/react/useKeepScreenAwake.d.ts +2 -0
  63. package/dist/react/useKeepScreenAwake.d.ts.map +1 -0
  64. package/dist/react/useKeepScreenAwake.js +34 -0
  65. package/dist/react/useKeepScreenAwake.js.map +1 -0
  66. package/dist/react/useLiveAuction.d.ts +104 -0
  67. package/dist/react/useLiveAuction.d.ts.map +1 -0
  68. package/dist/react/useLiveAuction.js +244 -0
  69. package/dist/react/useLiveAuction.js.map +1 -0
  70. package/dist/react/useLiveChat.d.ts +75 -0
  71. package/dist/react/useLiveChat.d.ts.map +1 -0
  72. package/dist/react/useLiveChat.js +131 -0
  73. package/dist/react/useLiveChat.js.map +1 -0
  74. package/dist/react/useLiveGiveawaysAndPolls.d.ts +84 -0
  75. package/dist/react/useLiveGiveawaysAndPolls.d.ts.map +1 -0
  76. package/dist/react/useLiveGiveawaysAndPolls.js +180 -0
  77. package/dist/react/useLiveGiveawaysAndPolls.js.map +1 -0
  78. package/dist/react/useLivePage.d.ts +113 -0
  79. package/dist/react/useLivePage.d.ts.map +1 -0
  80. package/dist/react/useLivePage.js +264 -0
  81. package/dist/react/useLivePage.js.map +1 -0
  82. package/dist/react/useLiveShop.d.ts +83 -0
  83. package/dist/react/useLiveShop.d.ts.map +1 -0
  84. package/dist/react/useLiveShop.js +165 -0
  85. package/dist/react/useLiveShop.js.map +1 -0
  86. package/dist/react/useReplayPage.d.ts +117 -0
  87. package/dist/react/useReplayPage.d.ts.map +1 -0
  88. package/dist/react/useReplayPage.js +504 -0
  89. package/dist/react/useReplayPage.js.map +1 -0
  90. package/dist/showCredit.d.ts +87 -0
  91. package/dist/showCredit.d.ts.map +1 -0
  92. package/dist/showCredit.js +120 -0
  93. package/dist/showCredit.js.map +1 -0
  94. package/dist/ui/BubbleFrame.d.ts +38 -0
  95. package/dist/ui/BubbleFrame.d.ts.map +1 -0
  96. package/dist/ui/BubbleFrame.js +181 -0
  97. package/dist/ui/BubbleFrame.js.map +1 -0
  98. package/dist/ui/LiveBubble.d.ts +37 -0
  99. package/dist/ui/LiveBubble.d.ts.map +1 -0
  100. package/dist/ui/LiveBubble.js +101 -0
  101. package/dist/ui/LiveBubble.js.map +1 -0
  102. package/dist/ui/ReplayBubble.d.ts +23 -0
  103. package/dist/ui/ReplayBubble.d.ts.map +1 -0
  104. package/dist/ui/ReplayBubble.js +65 -0
  105. package/dist/ui/ReplayBubble.js.map +1 -0
  106. package/dist/ui.d.ts +27 -0
  107. package/dist/ui.d.ts.map +1 -0
  108. package/dist/ui.js +34 -0
  109. package/dist/ui.js.map +1 -0
  110. package/package.json +36 -5
  111. package/ui/package.json +6 -0
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useLiveChat = useLiveChat;
4
+ /**
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).
7
+ */
8
+ const sdk_shopify_1 = require("@tiledev/sdk-shopify");
9
+ const react_1 = require("react");
10
+ const react_native_1 = require("react-native");
11
+ const livePages_1 = require("../livePages");
12
+ const viewer_1 = require("../viewer");
13
+ const platformSession_1 = require("./platformSession");
14
+ /**
15
+ * The Live screen's chat and reactions. `useLivePage` calls it with what it knows about the show and
16
+ * hands the result to the screen (`page.chat`), one set of props per tile.
17
+ *
18
+ * - **Only while the show is on air** (playing, or waiting for its host): the chat, the comment box,
19
+ * the reaction button, the floating reactions and the pinned comment all go once it has ended, as
20
+ * Freckled Poppy's, and while it is still joining (nothing can be said into a room not yet joined).
21
+ * - **The session does the work:** the room's history in front of what arrives since
22
+ * (`session.comments`), the name a comment goes out under, holding a comment while the shopper's
23
+ * account loads, the pin (`session.pinnedComment`), the host's reaction setting
24
+ * (`session.reactionStyle`), and the shopper's own comment and reaction shown at once. Nothing here
25
+ * 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
29
+ * 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).
33
+ * - **Reactions** need no sign-in. Which ones is the button tile's; the Live screen hands the same list
34
+ * to the floating reactions.
35
+ * - **A tap on a name** in the chat puts "@name" in the comment box.
36
+ * - **Hide Comments** is the shopper's, for this visit to the screen.
37
+ * - **`keyboardUp`**: the comment box's keyboard is up, so the screen lets a tap on the video put it
38
+ * away (iOS has no key for that).
39
+ */
40
+ function useLiveChat({ onAir, canComment, canReact }) {
41
+ var _a, _b, _c, _d, _e;
42
+ // The session changes only on the room's events, never on a clock.
43
+ const session = (0, platformSession_1.useLiveSession)();
44
+ const { sendComment, sendReaction, chooseViewerName } = session.actions;
45
+ const { loggedIn, restoring, customer } = (0, sdk_shopify_1.useCustomer)();
46
+ // ─── Who the shopper is in the room ──────────────────────────────────────────────────────────────
47
+ const { askForName, waitingForName } = (0, livePages_1.chatNameAsk)({
48
+ named: !!((_a = session.viewerName) === null || _a === void 0 ? void 0 : _a.trim()),
49
+ loggedIn: !!loggedIn,
50
+ restoring: !!restoring,
51
+ hasCustomer: !!customer,
52
+ });
53
+ // ─── Commenting ─────────────────────────────────────────────────────────────────────────────────
54
+ const [sending, setSending] = (0, react_1.useState)(false);
55
+ const send = (0, react_1.useCallback)(async (text) => {
56
+ setSending(true);
57
+ try {
58
+ await sendComment(text);
59
+ }
60
+ finally {
61
+ setSending(false);
62
+ }
63
+ }, [sendComment]);
64
+ /** True once the session has saved the name, and the engine has it for the comment that follows. */
65
+ const saveName = (0, react_1.useCallback)(async (name) => !!(await chooseViewerName(name)), [chooseViewerName]);
66
+ const [mention, setMention] = (0, react_1.useState)(null);
67
+ const mentionsSoFar = (0, react_1.useRef)(0);
68
+ const replyTo = (0, react_1.useCallback)((name) => {
69
+ mentionsSoFar.current += 1;
70
+ setMention({ name, key: mentionsSoFar.current });
71
+ }, []);
72
+ const [commentsHidden, setCommentsHidden] = (0, react_1.useState)(false);
73
+ const toggleComments = (0, react_1.useCallback)(() => setCommentsHidden((hidden) => !hidden), []);
74
+ // ─── Reacting ───────────────────────────────────────────────────────────────────────────────────
75
+ const react = (0, react_1.useCallback)((reactionUrl) => void sendReaction(reactionUrl), [sendReaction]);
76
+ // ─── The keyboard ───────────────────────────────────────────────────────────────────────────────
77
+ const [keyboardUp, setKeyboardUp] = (0, react_1.useState)(false);
78
+ /**
79
+ * The comment box has the keyboard. The bottom group rises only then (fixed 2026-10-05: it rose for
80
+ * any keyboard, and Shopify's sign-in sheet, opened by a bid while signed out, left it stuck a
81
+ * keyboard's height up the screen when the sheet closed without the screen hearing the keyboard go).
82
+ */
83
+ const [typing, setTyping] = (0, react_1.useState)(false);
84
+ (0, react_1.useEffect)(() => {
85
+ const shown = react_native_1.Keyboard.addListener(react_native_1.Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow', () => setKeyboardUp(true));
86
+ const hidden = react_native_1.Keyboard.addListener(react_native_1.Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide', () => setKeyboardUp(false));
87
+ return () => {
88
+ shown.remove();
89
+ hidden.remove();
90
+ };
91
+ }, []);
92
+ const commentBoxShown = onAir && canComment;
93
+ return {
94
+ keyboardUp: commentBoxShown && typing && keyboardUp,
95
+ /** The comment box has the keyboard: the screen lifts its bottom group for it, and for nothing else. */
96
+ typing: commentBoxShown && typing,
97
+ comments: {
98
+ visible: onAir,
99
+ comments: (_b = session.comments) !== null && _b !== void 0 ? _b : [],
100
+ hidden: commentsHidden,
101
+ onToggleHidden: toggleComments,
102
+ // Only with a comment box to reply into.
103
+ onPressName: commentBoxShown ? replyTo : undefined,
104
+ },
105
+ commentBox: {
106
+ visible: commentBoxShown,
107
+ askForName,
108
+ waitingForName,
109
+ sending,
110
+ mention,
111
+ nameMaxLength: viewer_1.MAX_VIEWER_NAME,
112
+ onSend: send,
113
+ onSaveName: saveName,
114
+ onTypingChange: setTyping,
115
+ },
116
+ reactionButton: {
117
+ visible: onAir && canReact,
118
+ onReact: react,
119
+ },
120
+ reactions: {
121
+ visible: onAir,
122
+ reactions: (_c = session.reactions) !== null && _c !== void 0 ? _c : [],
123
+ reactionStyle: (_d = session.reactionStyle) !== null && _d !== void 0 ? _d : 'single',
124
+ },
125
+ pinnedComment: {
126
+ visible: onAir,
127
+ pinnedComment: (_e = session.pinnedComment) !== null && _e !== void 0 ? _e : null,
128
+ },
129
+ };
130
+ }
131
+ //# sourceMappingURL=useLiveChat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLiveChat.js","sourceRoot":"","sources":["../../src/react/useLiveChat.ts"],"names":[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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"}
@@ -0,0 +1,84 @@
1
+ import type { LiveGiveawayPrize } from '../pageTypes';
2
+ /**
3
+ * The Live screen's giveaways and polls, so the screen stays plain tiles. Reads the app's live session
4
+ * for the show the route names, as `useLiveShop` does.
5
+ *
6
+ * - **Only while the show is on air** (playing, or waiting for its host) and the session holds this
7
+ * show's record (`useLiveShow`; never a hidden show the shopper can't see). Once the show has ended,
8
+ * all three tiles go.
9
+ * - **The session does the work:** the giveaway and poll, from the room and from the show's record for
10
+ * a shopper who arrives late; the entry count; whether this shopper has entered
11
+ * (`giveaway.registered`); the entry itself (`actions.enterGiveaway`); the draw's roster, waited for
12
+ * and kept (`giveaway.result.entrantNamesReady`, ENG-705); one vote a poll, kept on the phone
13
+ * (`actions.voteInPoll`), the tally hidden until this phone votes; a giveaway this phone watched end
14
+ * never coming back from an out-of-date record, and a poll the record says has closed never raised;
15
+ * the entry's flow (`useGiveawayEntry`), "YOU WON!" (`giveaway.result.isYou`) and the prize's
16
+ * catalogue read (`useGiveawayPrize`). Nothing here repeats it.
17
+ * - **The giveaway** (`giveawayButton`): the pill while a giveaway is open and not drawn yet. Its sheet
18
+ * shows the prize from the catalogue (Freckled Poppy's: the host picks it from the whole store, not
19
+ * from this show's lots), its variant's photo and price, and the record's own name and variant; until
20
+ * the catalogue answers, the record's variant photo and price (`variantImageUrl`, `variantPrice`). A
21
+ * catalogue read that fails goes to `onWarning`.
22
+ * - **Entering needs sign-in** (Freckled Poppy's rule). Signed out, Enter closes the sheet and starts
23
+ * the app's sign-in (sdk-shopify's `useSignIn`; the app's Sign In page is `routes.openSignIn`); back
24
+ * here signed in, the sheet opens again if the giveaway is still open and not drawn (Freckled
25
+ * Poppy's ENG-583 fix), and the shopper taps Enter themselves. Back without signing in (the Sign In
26
+ * page closed, or the system's sheet dismissed), nothing reopens. `useGiveawayEntry` does this;
27
+ * "back here" is this screen focused with no system sheet up.
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.
32
+ * - An entry the host didn't confirm (`enterGiveaway` answers `{ entered: false }`) says so in the
33
+ * sheet, and Enter can be tried again.
34
+ * - The host's draw closes the sheet (Freckled Poppy's).
35
+ * - **The draw** (`giveawayDraw`): handed over once the roster is ready; "YOU WON!" for the shopper who
36
+ * won (`giveaway.result.isYou`: by customer id when the record names the winner, else among those who
37
+ * entered by name, the gateway naming the winner only by name). A draw already on the session when
38
+ * this screen opens happened while the shopper was elsewhere: it is let go rather than played late.
39
+ * - **Where the prize goes is the server's, by the kind of show** (corrected 2026-10-19 in k-marie-v2,
40
+ * ENG-928). On an auction show the server writes the win to the customer's `auction.winner` metafield
41
+ * only, and Items You Won shows it. On a live show (not an auction) it adds the prize line, with its
42
+ * `GIVEAWAY-…` discount code, to the cart id the shopper entered with (`cartId`, below) and writes no
43
+ * metafield: Items You Won never sees it, and if that cart has been replaced since (a new cart after
44
+ * an order, a dead cart replaced at launch) the prize is lost.
45
+ * - **The poll** (`pollButton`): the chip while a poll is open; its sheet closes when the poll ends or
46
+ * the host opens another (Freckled Poppy's). Voting needs no sign-in.
47
+ */
48
+ export declare function useLiveGiveawaysAndPolls(): {
49
+ giveawayButton: {
50
+ visible: boolean;
51
+ prize: LiveGiveawayPrize | null;
52
+ entryCount: number;
53
+ entered: boolean;
54
+ entering: boolean;
55
+ signInToEnter: boolean;
56
+ waitingForName: boolean;
57
+ askForName: boolean;
58
+ nameMaxLength: number;
59
+ entryFailed: boolean;
60
+ sheetVisible: boolean;
61
+ onOpenSheet: () => void;
62
+ onCloseSheet: () => void;
63
+ onEnter: (typedName?: string) => void;
64
+ onSignInToEnter: () => void;
65
+ };
66
+ giveawayDraw: {
67
+ visible: boolean;
68
+ draw: import("./useGiveawayEntry").GiveawayDraw | null;
69
+ isWinner: boolean;
70
+ onDone: () => void;
71
+ };
72
+ pollButton: {
73
+ visible: boolean;
74
+ poll: import("../sessionTypes").LivePollView | null;
75
+ logoUrl: string | null;
76
+ sheetVisible: boolean;
77
+ onOpenSheet: () => void;
78
+ onCloseSheet: () => void;
79
+ onVote: (optionId: string) => void;
80
+ };
81
+ };
82
+ /** What `useLiveGiveawaysAndPolls` hands the Live screen's giveaway and poll tiles. */
83
+ export type LiveGiveawaysAndPolls = ReturnType<typeof useLiveGiveawaysAndPolls>;
84
+ //# sourceMappingURL=useLiveGiveawaysAndPolls.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useLiveGiveawaysAndPolls = useLiveGiveawaysAndPolls;
4
+ /**
5
+ * The Live screen's giveaways and polls (0.14.0, moved from amore-v2's
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.
9
+ */
10
+ const sdk_shopify_1 = require("@tiledev/sdk-shopify");
11
+ const react_1 = require("react");
12
+ const pageOptions_1 = require("../pageOptions");
13
+ const sessionTypes_1 = require("../sessionTypes");
14
+ const viewer_1 = require("../viewer");
15
+ const LiveSellingProvider_1 = require("./LiveSellingProvider");
16
+ const platformSession_1 = require("./platformSession");
17
+ const useGiveawayEntry_1 = require("./useGiveawayEntry");
18
+ const useGiveawayPrize_1 = require("./useGiveawayPrize");
19
+ const navigation_1 = require("./navigation");
20
+ /**
21
+ * The Live screen's giveaways and polls, so the screen stays plain tiles. Reads the app's live session
22
+ * for the show the route names, as `useLiveShop` does.
23
+ *
24
+ * - **Only while the show is on air** (playing, or waiting for its host) and the session holds this
25
+ * show's record (`useLiveShow`; never a hidden show the shopper can't see). Once the show has ended,
26
+ * all three tiles go.
27
+ * - **The session does the work:** the giveaway and poll, from the room and from the show's record for
28
+ * a shopper who arrives late; the entry count; whether this shopper has entered
29
+ * (`giveaway.registered`); the entry itself (`actions.enterGiveaway`); the draw's roster, waited for
30
+ * and kept (`giveaway.result.entrantNamesReady`, ENG-705); one vote a poll, kept on the phone
31
+ * (`actions.voteInPoll`), the tally hidden until this phone votes; a giveaway this phone watched end
32
+ * never coming back from an out-of-date record, and a poll the record says has closed never raised;
33
+ * the entry's flow (`useGiveawayEntry`), "YOU WON!" (`giveaway.result.isYou`) and the prize's
34
+ * catalogue read (`useGiveawayPrize`). Nothing here repeats it.
35
+ * - **The giveaway** (`giveawayButton`): the pill while a giveaway is open and not drawn yet. Its sheet
36
+ * shows the prize from the catalogue (Freckled Poppy's: the host picks it from the whole store, not
37
+ * from this show's lots), its variant's photo and price, and the record's own name and variant; until
38
+ * the catalogue answers, the record's variant photo and price (`variantImageUrl`, `variantPrice`). A
39
+ * catalogue read that fails goes to `onWarning`.
40
+ * - **Entering needs sign-in** (Freckled Poppy's rule). Signed out, Enter closes the sheet and starts
41
+ * the app's sign-in (sdk-shopify's `useSignIn`; the app's Sign In page is `routes.openSignIn`); back
42
+ * here signed in, the sheet opens again if the giveaway is still open and not drawn (Freckled
43
+ * Poppy's ENG-583 fix), and the shopper taps Enter themselves. Back without signing in (the Sign In
44
+ * page closed, or the system's sheet dismissed), nothing reopens. `useGiveawayEntry` does this;
45
+ * "back here" is this screen focused with no system sheet up.
46
+ * - **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.
50
+ * - An entry the host didn't confirm (`enterGiveaway` answers `{ entered: false }`) says so in the
51
+ * sheet, and Enter can be tried again.
52
+ * - The host's draw closes the sheet (Freckled Poppy's).
53
+ * - **The draw** (`giveawayDraw`): handed over once the roster is ready; "YOU WON!" for the shopper who
54
+ * won (`giveaway.result.isYou`: by customer id when the record names the winner, else among those who
55
+ * entered by name, the gateway naming the winner only by name). A draw already on the session when
56
+ * this screen opens happened while the shopper was elsewhere: it is let go rather than played late.
57
+ * - **Where the prize goes is the server's, by the kind of show** (corrected 2026-10-19 in k-marie-v2,
58
+ * ENG-928). On an auction show the server writes the win to the customer's `auction.winner` metafield
59
+ * only, and Items You Won shows it. On a live show (not an auction) it adds the prize line, with its
60
+ * `GIVEAWAY-…` discount code, to the cart id the shopper entered with (`cartId`, below) and writes no
61
+ * metafield: Items You Won never sees it, and if that cart has been replaced since (a new cart after
62
+ * an order, a dead cart replaced at launch) the prize is lost.
63
+ * - **The poll** (`pollButton`): the chip while a poll is open; its sheet closes when the poll ends or
64
+ * the host opens another (Freckled Poppy's). Voting needs no sign-in.
65
+ */
66
+ function useLiveGiveawaysAndPolls() {
67
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
68
+ const streamId = (_b = (_a = (0, navigation_1.useRoute)().params) === null || _a === void 0 ? void 0 : _a.streamId) !== null && _b !== void 0 ? _b : '';
69
+ const isFocused = (0, navigation_1.useIsFocused)();
70
+ // The session changes only on the room's events, never on a clock.
71
+ const session = (0, platformSession_1.useLiveSession)();
72
+ const { voteInPoll } = session.actions;
73
+ const { loggedIn, restoring, customer } = (0, sdk_shopify_1.useCustomer)();
74
+ 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
+ const nav = (0, navigation_1.useNavigation)();
76
+ const { routes } = (0, LiveSellingProvider_1.useLivePageOptions)();
77
+ const signIn = (0, sdk_shopify_1.useSignIn)({ onOpenSignInPage: (method) => routes.openSignIn(method, nav) });
78
+ // ─── Which show ────────────────────────────────────────────────────────────────────────────────
79
+ // The session's record once it is this show's: right after the pin it can still hold the last show's.
80
+ const { show, onAir, capabilities } = (0, platformSession_1.useLiveShow)(streamId);
81
+ const showing = onAir && !!show;
82
+ const giveaway = (_e = session.giveaway) !== null && _e !== void 0 ? _e : sessionTypes_1.IDLE_GIVEAWAY;
83
+ // ─── The giveaway: the entry's flow ────────────────────────────────────────────────────────────
84
+ const entry = (0, useGiveawayEntry_1.useGiveawayEntry)({
85
+ session,
86
+ canEnter: showing && capabilities.canEnterGiveaway,
87
+ isLoggedIn: !!loggedIn,
88
+ startSignIn: signIn.start,
89
+ // Back here: this screen focused (the Sign In page closed), and no system sign-in sheet up.
90
+ screenOnShow: isFocused && !signIn.signingIn,
91
+ // The shopper's ordinary cart, which the gateway ties the entry to (Freckled Poppy's). On a live
92
+ // show the server puts a won prize in this cart, even if the app has moved to another by the draw
93
+ // ("Where the prize goes", above).
94
+ cartId,
95
+ });
96
+ const openGiveaway = entry.open;
97
+ /** The prize from the catalogue: the description, and the given-away variant's photo and price. */
98
+ const { product: prizeProduct, variant: prizeVariant, readError: prizeReadError } = (0, useGiveawayPrize_1.useGiveawayPrize)(openGiveaway);
99
+ (0, react_1.useEffect)(() => {
100
+ var _a;
101
+ if (prizeReadError)
102
+ (0, pageOptions_1.reportLiveWarning)(prizeReadError, { at: 'live.giveawayPrize', storeProductId: (_a = openGiveaway === null || openGiveaway === void 0 ? void 0 : openGiveaway.storeProductId) !== null && _a !== void 0 ? _a : null });
103
+ // Reported once per failed read, for the prize it was for.
104
+ // eslint-disable-next-line react-hooks/exhaustive-deps
105
+ }, [prizeReadError]);
106
+ // The record's own price, should the catalogue not answer, priced in the show's currency.
107
+ const showCurrency = (_k = (_g = (_f = session.activeProduct) === null || _f === void 0 ? void 0 : _f.currencyCode) !== null && _g !== void 0 ? _g : (_j = (_h = session.products) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.currencyCode) !== null && _k !== void 0 ? _k : null;
108
+ const prize = (0, react_1.useMemo)(() => {
109
+ var _a, _b, _c, _d, _e, _f, _g, _h;
110
+ if (!openGiveaway)
111
+ return null;
112
+ const recordPrice = openGiveaway.variantPrice && showCurrency ? (0, sdk_shopify_1.formatMoney)({ amount: openGiveaway.variantPrice, currencyCode: showCurrency }) : null;
113
+ const variantPrice = (prizeVariant === null || prizeVariant === void 0 ? void 0 : prizeVariant.price) && (prizeProduct === null || prizeProduct === void 0 ? void 0 : prizeProduct.currencyCode) ? (0, sdk_shopify_1.formatMoney)({ amount: prizeVariant.price, currencyCode: prizeProduct.currencyCode }) : null;
114
+ return {
115
+ productName: openGiveaway.productName || (prizeProduct === null || prizeProduct === void 0 ? void 0 : prizeProduct.title) || '',
116
+ variantTitle: (_b = (_a = openGiveaway.variantTitle) !== null && _a !== void 0 ? _a : prizeVariant === null || prizeVariant === void 0 ? void 0 : prizeVariant.title) !== null && _b !== void 0 ? _b : null,
117
+ retailPrice: prizeVariant ? variantPrice : recordPrice,
118
+ // The catalogue's variant photo, else its product photo; until it answers, the record's variant photo.
119
+ imageUrl: (_f = (_e = (_d = (_c = prizeVariant === null || prizeVariant === void 0 ? void 0 : prizeVariant.imageUrl) !== null && _c !== void 0 ? _c : prizeProduct === null || prizeProduct === void 0 ? void 0 : prizeProduct.imageUrl) !== null && _d !== void 0 ? _d : openGiveaway.variantImageUrl) !== null && _e !== void 0 ? _e : openGiveaway.thumbnailUrl) !== null && _f !== void 0 ? _f : null,
120
+ description: ((_h = (_g = prizeProduct === null || prizeProduct === void 0 ? void 0 : prizeProduct.raw) === null || _g === void 0 ? void 0 : _g.description) === null || _h === void 0 ? void 0 : _h.trim()) || null,
121
+ };
122
+ }, [openGiveaway, prizeProduct, prizeVariant, showCurrency]);
123
+ // ─── Who the shopper is to the giveaway ────────────────────────────────────────────────────────
124
+ const named = !!((_l = session.viewerName) === null || _l === void 0 ? void 0 : _l.trim());
125
+ 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;
129
+ // ─── The poll ──────────────────────────────────────────────────────────────────────────────────
130
+ const poll = showing ? ((_m = session.poll) !== null && _m !== void 0 ? _m : null) : null;
131
+ const pollId = (_p = (_o = session.poll) === null || _o === void 0 ? void 0 : _o.pollUuid) !== null && _p !== void 0 ? _p : null;
132
+ const [pollSheetOpen, setPollSheetOpen] = (0, react_1.useState)(false);
133
+ // Closed whenever the poll changes, ended or replaced by the host's next: an empty sheet, or a
134
+ // question the shopper never chose to answer, would be in front of them.
135
+ (0, react_1.useEffect)(() => {
136
+ setPollSheetOpen(false);
137
+ }, [pollId]);
138
+ const votedAlready = !!((_q = session.poll) === null || _q === void 0 ? void 0 : _q.votedOptionId);
139
+ const vote = (0, react_1.useCallback)((optionId) => {
140
+ // One vote a poll (the session keeps it on the phone and ignores another); the sheet's choices are off once voted.
141
+ if (!votedAlready)
142
+ void voteInPoll(optionId);
143
+ }, [votedAlready, voteInPoll]);
144
+ return {
145
+ giveawayButton: {
146
+ visible: !!openGiveaway,
147
+ prize,
148
+ entryCount: giveaway.entryCount,
149
+ entered: giveaway.registered,
150
+ entering: entry.entering,
151
+ signInToEnter,
152
+ waitingForName,
153
+ askForName,
154
+ nameMaxLength: viewer_1.MAX_VIEWER_NAME,
155
+ entryFailed: entry.entryFailed,
156
+ sheetVisible: entry.sheetOpen,
157
+ onOpenSheet: entry.openSheet,
158
+ onCloseSheet: entry.closeSheet,
159
+ onEnter: entry.enter,
160
+ onSignInToEnter: entry.signInToEnter,
161
+ },
162
+ giveawayDraw: {
163
+ visible: showing,
164
+ draw: entry.draw,
165
+ isWinner: entry.youWon,
166
+ onDone: entry.drawDone,
167
+ },
168
+ pollButton: {
169
+ visible: !!poll,
170
+ poll,
171
+ // The show's poster stands in for a brand mark beside the question (old Amore's).
172
+ logoUrl: (_r = show === null || show === void 0 ? void 0 : show.thumbnailUrl) !== null && _r !== void 0 ? _r : null,
173
+ sheetVisible: pollSheetOpen && !!poll,
174
+ onOpenSheet: () => setPollSheetOpen(true),
175
+ onCloseSheet: () => setPollSheetOpen(false),
176
+ onVote: vote,
177
+ },
178
+ };
179
+ }
180
+ //# sourceMappingURL=useLiveGiveawaysAndPolls.js.map
@@ -0,0 +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,OA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;YACV,OAAO,EAAE,CAAC,CAAC,IAAI;YACf,IAAI;YACJ,kFAAkF;YAClF,OAAO,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY,mCAAI,IAAI;YACnC,YAAY,EAAE,aAAa,IAAI,CAAC,CAAC,IAAI;YACrC,WAAW,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC;YACzC,YAAY,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC;YAC3C,MAAM,EAAE,IAAI;SACb;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Everything the Live screen wires, so the screen stays plain tiles. Call it from the Live screen and
3
+ * from each of its tiles' wiring: every call reads the same session.
4
+ *
5
+ * - **The session is the app's** (`ShopifyLiveSessionProvider`), joined above the navigator; this
6
+ * screen binds to its picture (the player tile's `LiveVideoTarget`) and never owns the room.
7
+ * - **Pinned to the route's show** while watching (`holdStream(streamId)`, at every arrival), so a host
8
+ * restarting the broadcast can't swap the room underneath; released when the shopper closes the show
9
+ * (back on a show that has ended or is still joining, ✕ on the bubble, or leaving any other way
10
+ * without the bubble), and kept when the bubble takes the show.
11
+ * - **Which show** (`useLiveShow`): the session's record once it is this show's (just after the pin it
12
+ * can still hold the last show's), where it stands, and whether it is on air.
13
+ * - **Where the link lands** (`streams.destinationFor`, one read of the show's record on arrival): a
14
+ * show on air stays; an ended show with a recording is replaced by its Replay
15
+ * (`routes.replaceWithReplay`); anything else (a rehearsal this shopper can't see included) by the
16
+ * Live tab (`routes.backToLiveTab`). Not on the web, where nothing can play: the Tile preview stays on
17
+ * this page to show its tiles, with the record's poster and the ended words.
18
+ * - **Every arrival** reads the record again (`refreshStreamRecords`, which restarts the session's
19
+ * off-air wait, so a push tapped in the foreground can't be declared over on a stale record) and ends
20
+ * the bubble: this screen shows the picture again.
21
+ * - **Back, every kind** (the header's arrow, the iOS swipe, Android's back; decided 2026-10-05,
22
+ * amore-v2's Head of Engineering) shrinks a show that is playing or waiting for its host into the
23
+ * bubble as the screen leaves, and closes one that has ended. One path: the screen's `beforeRemove`,
24
+ * for the navigation's back actions (`BACK_ACTIONS`). Picture-in-picture is a back that always
25
+ * shrinks; the cart shrinks the show and opens the Cart over this screen (Items You Won on an auction
26
+ * show: `routes.openCart`). Android's back with nothing behind this screen (a link on a cold start)
27
+ * does what the arrow does: back to the Live tab.
28
+ * - **One shrunk show at a time:** arriving here stops a replay's bubble (and the Replay screen stops
29
+ * this show's bubble).
30
+ * - **The screen stays on** while it shows the show playing or waiting for its host.
31
+ * - **Under a sheet** (`routes.sheets`: the variant page, opened from the shop; the Sign In page) the
32
+ * show plays on here, with the screen on and the light status bar, as Replay's does.
33
+ * - **Put away** while the show plays here (a sheet over it included), it goes on in the phone's own
34
+ * floating window (`systemWindowWhenAway`); coming back finds it here again.
35
+ * - **`liveJoin`** (`track`) once per show per app run; never for a rehearsal, a show the config's
36
+ * `hiddenShows` names, whoever watches it.
37
+ * - **Hidden shows** (`hiddenShows`): for a shopper who isn't on the team the session never holds one,
38
+ * 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.
40
+ */
41
+ export declare function useLivePage(): {
42
+ /**
43
+ * Android's own picture-in-picture window is up. It shrinks the whole app, and every sheet on the
44
+ * Live screen (poll, giveaway, shop, custom bid, name, reactions) is a window of its own above the
45
+ * app, so it rode the shrink and covered the video (fixed 2026-10-08; Freckled Poppy hides its
46
+ * sheets the same way). The screen then draws only the player; the sheets' open state is the
47
+ * hooks', so they come back. iOS's window shows the video alone.
48
+ */
49
+ inSystemWindow: boolean;
50
+ /** The screen is on show (or under a sheet), over the dark video: light status bar text. */
51
+ lightStatusBar: boolean;
52
+ player: {
53
+ status: import("..").LiveShowStatus;
54
+ posterUrl: string | null;
55
+ isAuction: boolean;
56
+ videoActive: boolean;
57
+ systemWindowWhenAway: boolean;
58
+ };
59
+ header: {
60
+ ended: boolean;
61
+ isAuction: boolean;
62
+ startedAt: number | null;
63
+ viewerCount: number | null;
64
+ muted: boolean;
65
+ canMute: boolean;
66
+ canPip: boolean;
67
+ backShrinks: boolean;
68
+ cartCount: number;
69
+ onBack: () => void;
70
+ onToggleMute: () => void;
71
+ onPip: () => void;
72
+ onCart: () => void;
73
+ };
74
+ /** The chat, the comment box, reactions and the pinned comment: one set of props per tile (`useLiveChat`). */
75
+ chat: {
76
+ keyboardUp: boolean;
77
+ typing: boolean;
78
+ comments: {
79
+ visible: boolean;
80
+ comments: import("../types").LiveComment[];
81
+ hidden: boolean;
82
+ onToggleHidden: () => void;
83
+ onPressName: ((name: string) => void) | undefined;
84
+ };
85
+ commentBox: {
86
+ visible: boolean;
87
+ askForName: boolean;
88
+ waitingForName: boolean;
89
+ sending: boolean;
90
+ mention: import("..").LiveCommentMention | null;
91
+ nameMaxLength: number;
92
+ onSend: (text: string) => Promise<void>;
93
+ onSaveName: (name: string) => Promise<boolean>;
94
+ onTypingChange: import("react").Dispatch<import("react").SetStateAction<boolean>>;
95
+ };
96
+ reactionButton: {
97
+ visible: boolean;
98
+ onReact: (reactionUrl: string) => undefined;
99
+ };
100
+ reactions: {
101
+ visible: boolean;
102
+ reactions: import("../sessionTypes").FloatingReaction[];
103
+ reactionStyle: import("../types").ReactionStyle;
104
+ };
105
+ pinnedComment: {
106
+ visible: boolean;
107
+ pinnedComment: import("../types").LivePinnedComment | null;
108
+ };
109
+ };
110
+ };
111
+ /** What `useLivePage` hands the Live screen and its tiles. */
112
+ export type LivePage = ReturnType<typeof useLivePage>;
113
+ //# sourceMappingURL=useLivePage.d.ts.map
@@ -0,0 +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"}