@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,264 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useLivePage = useLivePage;
4
+ /**
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.
8
+ */
9
+ const sdk_analytics_core_1 = require("@tiledev/sdk-analytics-core");
10
+ const sdk_shopify_1 = require("@tiledev/sdk-shopify");
11
+ const react_1 = require("react");
12
+ const react_native_1 = require("react-native");
13
+ const client_1 = require("../client");
14
+ const hiddenShows_1 = require("../hiddenShows");
15
+ const liveSelling_1 = require("../liveSelling");
16
+ const livePages_1 = require("../livePages");
17
+ const pageOptions_1 = require("../pageOptions");
18
+ const sessionTypes_1 = require("../sessionTypes");
19
+ const LiveSellingProvider_1 = require("./LiveSellingProvider");
20
+ const platformSession_1 = require("./platformSession");
21
+ const replayPlayer_1 = require("./replayPlayer");
22
+ const useKeepScreenAwake_1 = require("./useKeepScreenAwake");
23
+ const useLiveChat_1 = require("./useLiveChat");
24
+ const useStreamInfo_1 = require("./useStreamInfo");
25
+ const navigation_1 = require("./navigation");
26
+ /**
27
+ * Shows already reported as joined (`liveJoin`) in this run of the app: once per show per run, so a
28
+ * trip through the bubble, the Cart or another screen and back isn't a second join (amore-v2's audit,
29
+ * L5: production reported on every viewer-count tick).
30
+ */
31
+ const joinedThisRun = new Set();
32
+ /**
33
+ * Everything the Live screen wires, so the screen stays plain tiles. Call it from the Live screen and
34
+ * from each of its tiles' wiring: every call reads the same session.
35
+ *
36
+ * - **The session is the app's** (`ShopifyLiveSessionProvider`), joined above the navigator; this
37
+ * screen binds to its picture (the player tile's `LiveVideoTarget`) and never owns the room.
38
+ * - **Pinned to the route's show** while watching (`holdStream(streamId)`, at every arrival), so a host
39
+ * restarting the broadcast can't swap the room underneath; released when the shopper closes the show
40
+ * (back on a show that has ended or is still joining, ✕ on the bubble, or leaving any other way
41
+ * without the bubble), and kept when the bubble takes the show.
42
+ * - **Which show** (`useLiveShow`): the session's record once it is this show's (just after the pin it
43
+ * can still hold the last show's), where it stands, and whether it is on air.
44
+ * - **Where the link lands** (`streams.destinationFor`, one read of the show's record on arrival): a
45
+ * show on air stays; an ended show with a recording is replaced by its Replay
46
+ * (`routes.replaceWithReplay`); anything else (a rehearsal this shopper can't see included) by the
47
+ * Live tab (`routes.backToLiveTab`). Not on the web, where nothing can play: the Tile preview stays on
48
+ * this page to show its tiles, with the record's poster and the ended words.
49
+ * - **Every arrival** reads the record again (`refreshStreamRecords`, which restarts the session's
50
+ * off-air wait, so a push tapped in the foreground can't be declared over on a stale record) and ends
51
+ * the bubble: this screen shows the picture again.
52
+ * - **Back, every kind** (the header's arrow, the iOS swipe, Android's back; decided 2026-10-05,
53
+ * amore-v2's Head of Engineering) shrinks a show that is playing or waiting for its host into the
54
+ * bubble as the screen leaves, and closes one that has ended. One path: the screen's `beforeRemove`,
55
+ * for the navigation's back actions (`BACK_ACTIONS`). Picture-in-picture is a back that always
56
+ * shrinks; the cart shrinks the show and opens the Cart over this screen (Items You Won on an auction
57
+ * show: `routes.openCart`). Android's back with nothing behind this screen (a link on a cold start)
58
+ * does what the arrow does: back to the Live tab.
59
+ * - **One shrunk show at a time:** arriving here stops a replay's bubble (and the Replay screen stops
60
+ * this show's bubble).
61
+ * - **The screen stays on** while it shows the show playing or waiting for its host.
62
+ * - **Under a sheet** (`routes.sheets`: the variant page, opened from the shop; the Sign In page) the
63
+ * show plays on here, with the screen on and the light status bar, as Replay's does.
64
+ * - **Put away** while the show plays here (a sheet over it included), it goes on in the phone's own
65
+ * floating window (`systemWindowWhenAway`); coming back finds it here again.
66
+ * - **`liveJoin`** (`track`) once per show per app run; never for a rehearsal, a show the config's
67
+ * `hiddenShows` names, whoever watches it.
68
+ * - **Hidden shows** (`hiddenShows`): for a shopper who isn't on the team the session never holds one,
69
+ * 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.
71
+ */
72
+ function useLivePage() {
73
+ var _a, _b, _c, _d;
74
+ const nav = (0, navigation_1.useNavigation)();
75
+ const route = (0, navigation_1.useRoute)();
76
+ const streamId = (_b = (_a = route.params) === null || _a === void 0 ? void 0 : _a.streamId) !== null && _b !== void 0 ? _b : '';
77
+ const isFocused = (0, navigation_1.useIsFocused)();
78
+ const { routes, track } = (0, LiveSellingProvider_1.useLivePageOptions)();
79
+ // The session changes only on the room's events, never on a clock: the header and the auction tiles keep their own.
80
+ const session = (0, platformSession_1.useLiveSession)();
81
+ const { holdStream, releaseStream, enterPip, exitPip, setMuted } = session.actions;
82
+ const { viewerEmail: email } = (0, LiveSellingProvider_1.useLiveSelling)();
83
+ const { show: sessionShow, status, onAir } = (0, platformSession_1.useLiveShow)(streamId);
84
+ const { itemCount } = (0, sdk_shopify_1.useCart)();
85
+ const { bubbleShown: replayInBubble, stop: stopReplay } = (0, replayPlayer_1.useReplayPlayer)();
86
+ // ─── Which show ────────────────────────────────────────────────────────────────────────────────
87
+ // `sessionShow` (above) is the session's record once it is this show's. The record the link's answer
88
+ // was read from stands in for its poster until then, and on the web.
89
+ const [linkedShow, setLinkedShow] = (0, react_1.useState)(null);
90
+ const show = sessionShow !== null && sessionShow !== void 0 ? sessionShow : (linkedShow && linkedShow.streamingId === streamId ? linkedShow : null);
91
+ /** The screen is leaving for good (closed, or sent on by the link's answer): going doesn't shrink the show. */
92
+ const leavingForGood = (0, react_1.useRef)(false);
93
+ // ─── Where the link lands ──────────────────────────────────────────────────────────────────────
94
+ (0, react_1.useEffect)(() => {
95
+ if (!streamId)
96
+ return;
97
+ let stillHere = true;
98
+ void liveSelling_1.liveSelling.streams.destinationFor(streamId, { viewerEmail: email }).then(({ destination, show: record, readError }) => {
99
+ if (readError)
100
+ (0, pageOptions_1.reportLiveWarning)(readError, { at: 'live.destinationFor', streamId });
101
+ if (!stillHere)
102
+ return;
103
+ setLinkedShow(record);
104
+ if (react_native_1.Platform.OS === 'web' || destination.to === 'livePlayer')
105
+ return;
106
+ leavingForGood.current = true;
107
+ if (destination.to === 'replay')
108
+ routes.replaceWithReplay(destination.feedId, nav);
109
+ // Back to the tabs already in the stack, or in this screen's place when it opened alone (a link on a cold start).
110
+ else
111
+ routes.backToLiveTab(nav);
112
+ });
113
+ return () => {
114
+ stillHere = false;
115
+ };
116
+ }, [streamId, email, nav, routes]);
117
+ // ─── Arriving ──────────────────────────────────────────────────────────────────────────────────
118
+ (0, navigation_1.useFocusEffect)((0, react_1.useCallback)(() => {
119
+ holdStream(streamId || undefined);
120
+ (0, useStreamInfo_1.refreshStreamRecords)();
121
+ exitPip();
122
+ }, [streamId, holdStream, exitPip]));
123
+ (0, react_1.useEffect)(() => {
124
+ if (isFocused && replayInBubble)
125
+ stopReplay();
126
+ }, [isFocused, replayInBubble, stopReplay]);
127
+ // ─── Leaving ───────────────────────────────────────────────────────────────────────────────────
128
+ /** The show went into the bubble on the way out: leaving keeps it playing there, pinned. */
129
+ const shrunk = (0, react_1.useRef)(false);
130
+ (0, react_1.useEffect)(() => {
131
+ if (!isFocused)
132
+ return;
133
+ shrunk.current = false;
134
+ leavingForGood.current = false;
135
+ }, [isFocused]);
136
+ const pipModeNow = (0, react_1.useRef)(session.pipMode);
137
+ pipModeNow.current = session.pipMode;
138
+ // Gone without the bubble (back on an ended show, replaced by the Replay or the Live tab): the show
139
+ // stops and the pin goes. Not when the bubble took it.
140
+ (0, react_1.useEffect)(() => () => {
141
+ if (shrunk.current || pipModeNow.current !== 'none')
142
+ return;
143
+ exitPip({ stopVideo: true });
144
+ releaseStream();
145
+ }, [exitPip, releaseStream]);
146
+ // ─── Where the show stands ─────────────────────────────────────────────────────────────────────
147
+ // `status` and `onAir` are `useLiveShow`'s: joining until the session holds this show's record. The
148
+ // controls follow the link's record until then (an auction's cart is Items You Won from the start).
149
+ const capabilities = (0, sessionTypes_1.capabilitiesFor)(show);
150
+ const canShrink = capabilities.canPip && onAir;
151
+ // On show, or covered only by a page drawn as a sheet (the variant page, from the shop): the picture
152
+ // stays here, playing behind it, and the screen stays on.
153
+ const coveredOnlyBySheet = (0, navigation_1.useNavigationState)((state) => (0, livePages_1.isCoveredOnlyBySheet)(state, route.key, routes.sheets));
154
+ const onScreen = isFocused || coveredOnlyBySheet;
155
+ const showing = onScreen && session.pipMode === 'none';
156
+ // 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 });
158
+ // Every back press (`BACK_ACTIONS`) passes here as the screen goes: a show on air enters the bubble,
159
+ // then the screen is let go. Nothing is prevented.
160
+ const canShrinkNow = (0, react_1.useRef)(canShrink);
161
+ canShrinkNow.current = canShrink;
162
+ (0, react_1.useEffect)(() => nav.addListener('beforeRemove', (event) => {
163
+ if (!livePages_1.BACK_ACTIONS.has(event.data.action.type))
164
+ return;
165
+ if (leavingForGood.current || !canShrinkNow.current || pipModeNow.current !== 'none')
166
+ return;
167
+ shrunk.current = true;
168
+ enterPip();
169
+ }), [nav, enterPip]);
170
+ (0, useKeepScreenAwake_1.useKeepScreenAwake)(showing && onAir, 'live');
171
+ // ─── liveJoin, once per show per app run ───────────────────────────────────────────────────────
172
+ const viewerCount = session.viewerCount;
173
+ (0, react_1.useEffect)(() => {
174
+ if (!isFocused || !sessionShow || sessionShow.status !== 'live' || (0, hiddenShows_1.isHiddenShow)(sessionShow, (0, client_1.hiddenShowsRule)()))
175
+ return;
176
+ if (joinedThisRun.has(sessionShow.streamingId))
177
+ return;
178
+ joinedThisRun.add(sessionShow.streamingId);
179
+ track(sdk_analytics_core_1.DefaultEvents.LIVE_JOIN, (0, sdk_analytics_core_1.liveJoinParams)(sessionShow.streamingId, viewerCount));
180
+ }, [isFocused, sessionShow, viewerCount, track]);
181
+ // ─── The header's buttons ──────────────────────────────────────────────────────────────────────
182
+ /** Back: to the screen behind, or to the Live tab when this one opened alone. A show on air shrinks on the way (above). */
183
+ const goBack = (0, react_1.useCallback)(() => {
184
+ if (nav.canGoBack())
185
+ nav.goBack();
186
+ else
187
+ routes.backToLiveTab(nav);
188
+ }, [nav, routes]);
189
+ const close = (0, react_1.useCallback)(() => {
190
+ leavingForGood.current = true;
191
+ // Stopped outright: without `stopVideo` the room plays on with no surface.
192
+ exitPip({ stopVideo: true });
193
+ releaseStream();
194
+ goBack();
195
+ }, [exitPip, releaseStream, goBack]);
196
+ const back = canShrink ? goBack : close;
197
+ // Android's back with nothing behind this screen (a link on a cold start) would close the app: it does
198
+ // what the arrow does instead. With a screen behind, the navigator goes back, through `beforeRemove`.
199
+ const backNow = (0, react_1.useRef)(back);
200
+ backNow.current = back;
201
+ (0, navigation_1.useFocusEffect)((0, react_1.useCallback)(() => {
202
+ const subscription = react_native_1.BackHandler.addEventListener('hardwareBackPress', () => {
203
+ if (nav.canGoBack())
204
+ return false;
205
+ backNow.current();
206
+ return true;
207
+ });
208
+ return () => subscription.remove();
209
+ }, [nav]));
210
+ const isAuction = capabilities.canBid;
211
+ const openCart = (0, react_1.useCallback)(() => {
212
+ if (canShrink) {
213
+ shrunk.current = true;
214
+ enterPip();
215
+ }
216
+ // A bidder's cart is what they've won: their bids never land in the shopping cart (Freckled Poppy's).
217
+ routes.openCart({ itemsYouWon: isAuction }, nav);
218
+ }, [canShrink, enterPip, isAuction, nav, routes]);
219
+ // 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
+ const videoActive = showing && !!sessionShow;
221
+ return {
222
+ /**
223
+ * Android's own picture-in-picture window is up. It shrinks the whole app, and every sheet on the
224
+ * Live screen (poll, giveaway, shop, custom bid, name, reactions) is a window of its own above the
225
+ * app, so it rode the shrink and covered the video (fixed 2026-10-08; Freckled Poppy hides its
226
+ * sheets the same way). The screen then draws only the player; the sheets' open state is the
227
+ * hooks', so they come back. iOS's window shows the video alone.
228
+ */
229
+ inSystemWindow: react_native_1.Platform.OS === 'android' && session.pipMode === 'system',
230
+ /** The screen is on show (or under a sheet), over the dark video: light status bar text. */
231
+ lightStatusBar: onScreen,
232
+ player: {
233
+ status,
234
+ posterUrl: (_c = show === null || show === void 0 ? void 0 : show.thumbnailUrl) !== null && _c !== void 0 ? _c : null,
235
+ isAuction: !!(show === null || show === void 0 ? void 0 : show.isAuction),
236
+ videoActive,
237
+ // Put away while the show plays here, it goes on in the phone's own floating window. Not while
238
+ // joining, waiting for the host or ended: there is no picture.
239
+ systemWindowWhenAway: videoActive && status === 'playing' && capabilities.canPip,
240
+ },
241
+ header: {
242
+ ended: status === 'ended',
243
+ // An auction show: the header's own LIVE words for one (sparkl-v2's and k-marie-v2's LiveHeader01 `auctionLiveLabel`).
244
+ isAuction: !!(show === null || show === void 0 ? void 0 : show.isAuction),
245
+ // The header counts its clock up from it on its own (`useShowClock`), so the screen isn't drawn each second.
246
+ startedAt: (_d = sessionShow === null || sessionShow === void 0 ? void 0 : sessionShow.startedAtMs) !== null && _d !== void 0 ? _d : null,
247
+ // Known once the room has said: 0 means it hasn't yet.
248
+ viewerCount: onAir && capabilities.showViewerCount && viewerCount > 0 ? viewerCount : null,
249
+ muted: session.muted,
250
+ canMute: status !== 'ended' && status !== 'error',
251
+ canPip: canShrink,
252
+ backShrinks: canShrink,
253
+ cartCount: itemCount,
254
+ onBack: back,
255
+ onToggleMute: () => setMuted(!session.muted),
256
+ // Shown only while the show can shrink: a back press, which shrinks it on the way.
257
+ onPip: goBack,
258
+ onCart: openCart,
259
+ },
260
+ /** The chat, the comment box, reactions and the pinned comment: one set of props per tile (`useLiveChat`). */
261
+ chat,
262
+ };
263
+ }
264
+ //# sourceMappingURL=useLivePage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLivePage.js","sourceRoot":"","sources":["../../src/react/useLivePage.ts"],"names":[],"mappings":";;AAoFA,kCAuMC;AA3RD;;;;GAIG;AACH,oEAA4E;AAC5E,sDAA+C;AAC/C,iCAAiE;AACjE,+CAAqD;AAErD,sCAA4C;AAC5C,gDAA8C;AAC9C,gDAA6C;AAC7C,4CAAkE;AAClE,gDAAmD;AACnD,kDAAkD;AAElD,+DAA2E;AAC3E,uDAAgE;AAChE,iDAAiD;AACjD,6DAA0D;AAC1D,+CAA4C;AAC5C,m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,uBAAJ,IAAI,CAAE,SAAS,CAAA;YAC5B,WAAW;YACX,+FAA+F;YAC/F,+DAA+D;YAC/D,oBAAoB,EAAE,WAAW,IAAI,MAAM,KAAK,SAAS,IAAI,YAAY,CAAC,MAAM;SACjF;QACD,MAAM,EAAE;YACN,KAAK,EAAE,MAAM,KAAK,OAAO;YACzB,uHAAuH;YACvH,SAAS,EAAE,CAAC,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,CAAA;YAC5B,6GAA6G;YAC7G,SAAS,EAAE,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,mCAAI,IAAI;YAC3C,uDAAuD;YACvD,WAAW,EAAE,KAAK,IAAI,YAAY,CAAC,eAAe,IAAI,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;YAC1F,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,OAAO,EAAE,MAAM,KAAK,OAAO,IAAI,MAAM,KAAK,OAAO;YACjD,MAAM,EAAE,SAAS;YACjB,WAAW,EAAE,SAAS;YACtB,SAAS,EAAE,SAAS;YACpB,MAAM,EAAE,IAAI;YACZ,YAAY,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;YAC5C,mFAAmF;YACnF,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,QAAQ;SACjB;QACD,8GAA8G;QAC9G,IAAI;KACL,CAAC;AACJ,CAAC"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * The Live screen's shopping (0.14.0, moved from amore-v2's `src/core/hooks/useLiveShop.ts`: phase 3 of
3
+ * its "Live player plan", shop and cart). The routes are the app's (`LiveSellingProvider`'s `routes`);
4
+ * the route's `streamId` param is read here.
5
+ */
6
+ import { type Product } from '@tiledev/sdk-shopify';
7
+ import type { LiveCartChip, LiveFeaturedProduct, LiveSoldChip } from '../pageTypes';
8
+ /**
9
+ * The phone's share sheet with an address (a product's page): iOS takes the link as `url`, Android as
10
+ * text. Nothing without one; a dismissed sheet, or none (the web preview without the browser's share),
11
+ * is nothing to report.
12
+ */
13
+ export declare function shareAddress(url: string | null | undefined): Promise<void>;
14
+ /** The phone's share sheet with a product's link (the Live card's and Replay's share): its page on the store (`productShareUrl`). */
15
+ export declare function shareProduct(product: Product): Promise<void>;
16
+ /**
17
+ * The Live screen's shopping, so the screen stays plain tiles. Reads the app's live session, as
18
+ * `useLivePage` does, for the show the route names.
19
+ *
20
+ * - **The featured product** (`productCard`): the session's `activeProduct`, with its lot number
21
+ * (`sellId`; the session re-reads the record when the host features a lot, so a number issued at
22
+ * show time arrives; the card shows it only when its own setting turns it on). A tap on the card
23
+ * opens the product (`openProduct`, below); share opens the phone's share sheet with the product's
24
+ * link (`shareProduct`, old Amore's). On an auction show: where bidding starts, no Buy and no lot
25
+ * badge, no share (decided 2026-10-05, amore-v2's Head of Engineering: "Share icon should be hidden
26
+ * for live auctions"), and "Waiting for the next lot…" while nothing is featured; the round's bid,
27
+ * state and leader are `useLiveAuction`'s.
28
+ * - **The Shop button** (`shopButton`) and its sheet: every product on the show, the featured one first
29
+ * and marked (`featuredFirst`), each with its lot number. A pick opens the product (`openProduct`);
30
+ * quick add as everywhere. On an auction show too: there its sheet lists the lots instead
31
+ * (`useLiveAuction`), and a pick opens the lot.
32
+ * - **What a tap on a product opens** (`openProduct`; decided 2026-10-05: "Size sheet over show"): the
33
+ * variant page over the playing show (`routes.openVariantPage`). On a live show it is for buying, with
34
+ * the live credit (`liveShowCredit`). On an auction show it is the lot's details in auction mode
35
+ * (`auctionLotPageParams`): the product page's auction notice, no Add to Cart, no credit and no
36
+ * announcement; the shopper bids from the show.
37
+ * - **Buying goes through the variant page**, over the playing show, as Replay's products do. Every add
38
+ * from here carries the live credit and, once it lands, is announced to the room
39
+ * (`announceToLiveRoom`, which the app's variant page hands `reportShowAdd`; quick add does it
40
+ * itself). Signed out, shopping is open, as Freckled Poppy's.
41
+ * - **The room's chips:** "just sold" (`session.sold`) and "added to cart" (`session.cartAnnouncements`,
42
+ * not on an auction show, as Freckled Poppy's). A name the room sent is shown by its first word
43
+ * (`firstNameOf`); the session hands out no name as an email.
44
+ * - **Nothing shows** until the session holds this show's record (`useLiveShow`). It never holds a
45
+ * hidden show the shopper can't see (`hiddenShows`). The web's session is always "ended" with no
46
+ * show, so none of these tiles draw there.
47
+ */
48
+ export declare function useLiveShop(): {
49
+ productCard: {
50
+ visible: boolean;
51
+ product: LiveFeaturedProduct | null;
52
+ betweenLots: boolean;
53
+ canBuy: boolean;
54
+ canShare: boolean;
55
+ favorite: boolean;
56
+ onOpenProduct: () => void;
57
+ onToggleFavorite: () => void;
58
+ onShare: () => void;
59
+ };
60
+ shopButton: {
61
+ visible: boolean;
62
+ products: Product[];
63
+ onScreenProductId: string | null;
64
+ lotNumbers: Record<string, string>;
65
+ favoriteIds: string[];
66
+ auctionProductIds: string[];
67
+ onPressProduct: (product: Product) => void;
68
+ onToggleFavorite: (product: Product) => undefined;
69
+ onQuickAdd: (product: Product) => void;
70
+ addingProductIds: string[];
71
+ };
72
+ soldChips: {
73
+ visible: boolean;
74
+ chips: LiveSoldChip[];
75
+ };
76
+ cartChips: {
77
+ visible: boolean;
78
+ chips: LiveCartChip[];
79
+ };
80
+ };
81
+ /** What `useLiveShop` hands the Live screen's shop tiles. */
82
+ export type LiveShop = ReturnType<typeof useLiveShop>;
83
+ //# sourceMappingURL=useLiveShop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLiveShop.d.ts","sourceRoot":"","sources":["../../src/react/useLiveShop.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAuE,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAIzH,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAWpF;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAOhF;AAED,qIAAqI;AACrI,wBAAsB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAElE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,WAAW;;;;;;;;;;;;;;;;;;;kCAiCb,OAAO;oCAwEa,OAAO;;;;;;;;;;;;EAQxC;AAED,6DAA6D;AAC7D,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shareAddress = shareAddress;
4
+ exports.shareProduct = shareProduct;
5
+ exports.useLiveShop = useLiveShop;
6
+ /**
7
+ * The Live screen's shopping (0.14.0, moved from amore-v2's `src/core/hooks/useLiveShop.ts`: phase 3 of
8
+ * its "Live player plan", shop and cart). The routes are the app's (`LiveSellingProvider`'s `routes`);
9
+ * the route's `streamId` param is read here.
10
+ */
11
+ const sdk_shopify_1 = require("@tiledev/sdk-shopify");
12
+ const react_1 = require("react");
13
+ const react_native_1 = require("react-native");
14
+ const showCredit_1 = require("../showCredit");
15
+ const showNames_1 = require("../showNames");
16
+ const showLots_1 = require("../showLots");
17
+ const LiveSellingProvider_1 = require("./LiveSellingProvider");
18
+ const platformSession_1 = require("./platformSession");
19
+ const navigation_1 = require("./navigation");
20
+ /**
21
+ * The phone's share sheet with an address (a product's page): iOS takes the link as `url`, Android as
22
+ * text. Nothing without one; a dismissed sheet, or none (the web preview without the browser's share),
23
+ * is nothing to report.
24
+ */
25
+ async function shareAddress(url) {
26
+ if (!url)
27
+ return;
28
+ try {
29
+ await react_native_1.Share.share(react_native_1.Platform.OS === 'ios' ? { url } : { message: url });
30
+ }
31
+ catch {
32
+ // Dismissed, or no share sheet.
33
+ }
34
+ }
35
+ /** The phone's share sheet with a product's link (the Live card's and Replay's share): its page on the store (`productShareUrl`). */
36
+ async function shareProduct(product) {
37
+ await shareAddress((0, sdk_shopify_1.productShareUrl)(product));
38
+ }
39
+ /**
40
+ * The Live screen's shopping, so the screen stays plain tiles. Reads the app's live session, as
41
+ * `useLivePage` does, for the show the route names.
42
+ *
43
+ * - **The featured product** (`productCard`): the session's `activeProduct`, with its lot number
44
+ * (`sellId`; the session re-reads the record when the host features a lot, so a number issued at
45
+ * show time arrives; the card shows it only when its own setting turns it on). A tap on the card
46
+ * opens the product (`openProduct`, below); share opens the phone's share sheet with the product's
47
+ * link (`shareProduct`, old Amore's). On an auction show: where bidding starts, no Buy and no lot
48
+ * badge, no share (decided 2026-10-05, amore-v2's Head of Engineering: "Share icon should be hidden
49
+ * for live auctions"), and "Waiting for the next lot…" while nothing is featured; the round's bid,
50
+ * state and leader are `useLiveAuction`'s.
51
+ * - **The Shop button** (`shopButton`) and its sheet: every product on the show, the featured one first
52
+ * and marked (`featuredFirst`), each with its lot number. A pick opens the product (`openProduct`);
53
+ * quick add as everywhere. On an auction show too: there its sheet lists the lots instead
54
+ * (`useLiveAuction`), and a pick opens the lot.
55
+ * - **What a tap on a product opens** (`openProduct`; decided 2026-10-05: "Size sheet over show"): the
56
+ * variant page over the playing show (`routes.openVariantPage`). On a live show it is for buying, with
57
+ * the live credit (`liveShowCredit`). On an auction show it is the lot's details in auction mode
58
+ * (`auctionLotPageParams`): the product page's auction notice, no Add to Cart, no credit and no
59
+ * announcement; the shopper bids from the show.
60
+ * - **Buying goes through the variant page**, over the playing show, as Replay's products do. Every add
61
+ * from here carries the live credit and, once it lands, is announced to the room
62
+ * (`announceToLiveRoom`, which the app's variant page hands `reportShowAdd`; quick add does it
63
+ * itself). Signed out, shopping is open, as Freckled Poppy's.
64
+ * - **The room's chips:** "just sold" (`session.sold`) and "added to cart" (`session.cartAnnouncements`,
65
+ * not on an auction show, as Freckled Poppy's). A name the room sent is shown by its first word
66
+ * (`firstNameOf`); the session hands out no name as an email.
67
+ * - **Nothing shows** until the session holds this show's record (`useLiveShow`). It never holds a
68
+ * hidden show the shopper can't see (`hiddenShows`). The web's session is always "ended" with no
69
+ * show, so none of these tiles draw there.
70
+ */
71
+ function useLiveShop() {
72
+ var _a, _b, _c, _d, _e;
73
+ const nav = (0, navigation_1.useNavigation)();
74
+ const streamId = (_b = (_a = (0, navigation_1.useRoute)().params) === null || _a === void 0 ? void 0 : _a.streamId) !== null && _b !== void 0 ? _b : '';
75
+ const { routes, track } = (0, LiveSellingProvider_1.useLivePageOptions)();
76
+ // The session changes only on the room's events, never on a clock.
77
+ const session = (0, platformSession_1.useLiveSession)();
78
+ const wishlist = (0, sdk_shopify_1.useWishlist)();
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 hidden = !show;
82
+ const isAuction = capabilities.canBid;
83
+ // ─── The products ──────────────────────────────────────────────────────────────────────────────
84
+ const featured = show ? session.activeProduct : null;
85
+ const featuredProduct = (_c = featured === null || featured === void 0 ? void 0 : featured.raw) !== null && _c !== void 0 ? _c : null;
86
+ const featuredId = (_d = featuredProduct === null || featuredProduct === void 0 ? void 0 : featuredProduct.id) !== null && _d !== void 0 ? _d : null;
87
+ /** The show's Shopify products, the featured one first: the shopper who taps Shop wants what the host holds up. */
88
+ const products = (0, react_1.useMemo)(() => (0, showLots_1.featuredFirst)(session.products.flatMap((lot) => (lot.raw ? [lot.raw] : [])), featuredId), [session.products, featuredId]);
89
+ /** Each product's lot number, by product id: the number the host reads out. */
90
+ const lotNumbers = (0, react_1.useMemo)(() => Object.fromEntries(session.products.flatMap((lot) => (lot.raw && lot.sellId ? [[lot.raw.id, lot.sellId]] : []))), [session.products]);
91
+ const auctionProductIds = (0, react_1.useMemo)(() => products.filter(sdk_shopify_1.isAuctioned).map((product) => product.id), [products]);
92
+ // ─── Buying ────────────────────────────────────────────────────────────────────────────────────
93
+ const creditFor = (0, react_1.useCallback)((product) => { var _a; return (0, showCredit_1.liveShowCredit)(show, (_a = lotNumbers[product.id]) !== null && _a !== void 0 ? _a : null); }, [show, lotNumbers]);
94
+ const quickAdd = (0, sdk_shopify_1.useQuickAdd)((0, showCredit_1.showQuickAddOptions)((params) => routes.openVariantPage(params, nav), { credit: creditFor, track }));
95
+ const openVariantPage = (0, react_1.useCallback)((product) => routes.openVariantPage((0, showCredit_1.variantPageParams)(product, creditFor(product)), nav), [routes, nav, creditFor]);
96
+ const openLotPage = (0, react_1.useCallback)((product) => routes.openVariantPage((0, showCredit_1.auctionLotPageParams)(product), nav), [routes, nav]);
97
+ /** A tap on a product, on the card or in the Shop sheet: a lot's details on an auction show, else the variant page to buy it. */
98
+ const openProduct = isAuction ? openLotPage : openVariantPage;
99
+ // ─── The featured card ─────────────────────────────────────────────────────────────────────────
100
+ // The lot's opening bid, joined onto the product from the record by the session.
101
+ const startingBid = isAuction && featured ? ((_e = featured.baseBidPrice) !== null && _e !== void 0 ? _e : null) : null;
102
+ const featuredCard = (0, react_1.useMemo)(() => {
103
+ var _a, _b, _c, _d, _e;
104
+ return featuredProduct
105
+ ? {
106
+ id: featuredProduct.id,
107
+ title: featuredProduct.title,
108
+ price: (0, sdk_shopify_1.formatMoney)(featuredProduct.priceRange.min),
109
+ imageUrl: (_d = (_b = (_a = featuredProduct.featuredImage) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : (_c = featuredProduct.images[0]) === null || _c === void 0 ? void 0 : _c.url) !== null && _d !== void 0 ? _d : null,
110
+ // No lot badge on an auction lot: a bidder bids, they don't buy by the number (Freckled Poppy's).
111
+ lotNumber: isAuction ? null : ((_e = featured === null || featured === void 0 ? void 0 : featured.sellId) !== null && _e !== void 0 ? _e : null),
112
+ startingBid: startingBid != null ? (0, sdk_shopify_1.formatMoney)({ amount: String(startingBid), currencyCode: featuredProduct.priceRange.min.currencyCode }) : null,
113
+ }
114
+ : null;
115
+ }, [featuredProduct, featured === null || featured === void 0 ? void 0 : featured.sellId, isAuction, startingBid]);
116
+ // ─── The room's chips ──────────────────────────────────────────────────────────────────────────
117
+ const soldChips = (0, react_1.useMemo)(() => session.sold.map((card) => ({ id: card.id, quantity: card.quantity, productName: card.productName, lotNumber: card.sellId })), [session.sold]);
118
+ const cartChips = (0, react_1.useMemo)(() => session.cartAnnouncements.map((card) => ({
119
+ id: card.id,
120
+ name: (0, showNames_1.firstNameOf)(card.userName),
121
+ productTitle: card.productTitle,
122
+ lotNumber: card.sellId,
123
+ })), [session.cartAnnouncements]);
124
+ return {
125
+ productCard: {
126
+ visible: !hidden,
127
+ product: featuredCard,
128
+ // An auction has gaps between lots: the slot keeps its place rather than leave the frame empty.
129
+ betweenLots: isAuction && !featuredProduct && onAir,
130
+ canBuy: !isAuction,
131
+ // No share on an auction show (decided 2026-10-05, amore-v2's Head of Engineering).
132
+ canShare: !isAuction,
133
+ favorite: !!featuredProduct && wishlist.has(featuredProduct.id),
134
+ onOpenProduct: () => {
135
+ if (featuredProduct)
136
+ openProduct(featuredProduct);
137
+ },
138
+ onToggleFavorite: () => {
139
+ if (featuredProduct)
140
+ void wishlist.toggle(featuredProduct);
141
+ },
142
+ onShare: () => {
143
+ if (featuredProduct)
144
+ void shareProduct(featuredProduct);
145
+ },
146
+ },
147
+ shopButton: {
148
+ // On an auction show too: there its sheet lists the lots (`useLiveAuction`'s `shopButton.lots`).
149
+ visible: !hidden,
150
+ products,
151
+ onScreenProductId: featuredId,
152
+ lotNumbers,
153
+ favoriteIds: wishlist.ids,
154
+ auctionProductIds,
155
+ onPressProduct: openProduct,
156
+ onToggleFavorite: (product) => void wishlist.toggle(product),
157
+ onQuickAdd: quickAdd.add,
158
+ addingProductIds: quickAdd.addingProductIds,
159
+ },
160
+ soldChips: { visible: !hidden, chips: soldChips },
161
+ // An auction sells by bidding: its room has no carts to announce (Freckled Poppy's).
162
+ cartChips: { visible: !hidden && !isAuction, chips: cartChips },
163
+ };
164
+ }
165
+ //# sourceMappingURL=useLiveShop.js.map
@@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