@tiledev/sdk-apptile-live-selling 0.13.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.
- package/README.md +116 -12
- package/dist/clipsPage.d.ts +29 -0
- package/dist/clipsPage.d.ts.map +1 -0
- package/dist/clipsPage.js +49 -0
- package/dist/clipsPage.js.map +1 -0
- package/dist/giveawayPrizeLines.d.ts +10 -0
- package/dist/giveawayPrizeLines.d.ts.map +1 -1
- package/dist/giveawayPrizeLines.js +11 -1
- package/dist/giveawayPrizeLines.js.map +1 -1
- package/dist/hiddenShows.d.ts +10 -0
- package/dist/hiddenShows.d.ts.map +1 -1
- package/dist/hiddenShows.js +11 -0
- package/dist/hiddenShows.js.map +1 -1
- package/dist/index.d.ts +10 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +53 -2
- package/dist/index.js.map +1 -1
- package/dist/linkLots.d.ts +64 -0
- package/dist/linkLots.d.ts.map +1 -0
- package/dist/linkLots.js +84 -0
- package/dist/linkLots.js.map +1 -0
- package/dist/livePages.d.ts +166 -0
- package/dist/livePages.d.ts.map +1 -0
- package/dist/livePages.js +187 -0
- package/dist/livePages.js.map +1 -0
- package/dist/liveRoom.d.ts +21 -0
- package/dist/liveRoom.d.ts.map +1 -0
- package/dist/liveRoom.js +28 -0
- package/dist/liveRoom.js.map +1 -0
- package/dist/pageOptions.d.ts +118 -0
- package/dist/pageOptions.d.ts.map +1 -0
- package/dist/pageOptions.js +99 -0
- package/dist/pageOptions.js.map +1 -0
- package/dist/pageTypes.d.ts +185 -0
- package/dist/pageTypes.d.ts.map +1 -0
- package/dist/pageTypes.js +3 -0
- package/dist/pageTypes.js.map +1 -0
- package/dist/react/LiveSellingProvider.d.ts +31 -1
- package/dist/react/LiveSellingProvider.d.ts.map +1 -1
- package/dist/react/LiveSellingProvider.js +44 -2
- package/dist/react/LiveSellingProvider.js.map +1 -1
- package/dist/react/index.d.ts +12 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +34 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.web.d.ts +13 -32
- package/dist/react/index.web.d.ts.map +1 -1
- package/dist/react/index.web.js +52 -139
- package/dist/react/index.web.js.map +1 -1
- package/dist/react/navigation.d.ts +13 -0
- package/dist/react/navigation.d.ts.map +1 -0
- package/dist/react/navigation.js +7 -0
- package/dist/react/navigation.js.map +1 -0
- package/dist/react/platformSession.d.ts +16 -0
- package/dist/react/platformSession.d.ts.map +1 -0
- package/dist/react/platformSession.js +28 -0
- package/dist/react/platformSession.js.map +1 -0
- package/dist/react/platformSession.web.d.ts +35 -0
- package/dist/react/platformSession.web.d.ts.map +1 -0
- package/dist/react/platformSession.web.js +148 -0
- package/dist/react/platformSession.web.js.map +1 -0
- package/dist/react/replayPlayer.d.ts +74 -0
- package/dist/react/replayPlayer.d.ts.map +1 -0
- package/dist/react/replayPlayer.js +279 -0
- package/dist/react/replayPlayer.js.map +1 -0
- package/dist/react/shopifyProviders.d.ts +69 -0
- package/dist/react/shopifyProviders.d.ts.map +1 -0
- package/dist/react/shopifyProviders.js +100 -0
- package/dist/react/shopifyProviders.js.map +1 -0
- package/dist/react/useAccountName.d.ts +8 -0
- package/dist/react/useAccountName.d.ts.map +1 -0
- package/dist/react/useAccountName.js +49 -0
- package/dist/react/useAccountName.js.map +1 -0
- package/dist/react/useClipsPage.d.ts +47 -0
- package/dist/react/useClipsPage.d.ts.map +1 -0
- package/dist/react/useClipsPage.js +130 -0
- package/dist/react/useClipsPage.js.map +1 -0
- package/dist/react/useKeepScreenAwake.d.ts +2 -0
- package/dist/react/useKeepScreenAwake.d.ts.map +1 -0
- package/dist/react/useKeepScreenAwake.js +34 -0
- package/dist/react/useKeepScreenAwake.js.map +1 -0
- package/dist/react/useLiveAuction.d.ts +106 -0
- package/dist/react/useLiveAuction.d.ts.map +1 -0
- package/dist/react/useLiveAuction.js +249 -0
- package/dist/react/useLiveAuction.js.map +1 -0
- package/dist/react/useLiveChat.d.ts +110 -0
- package/dist/react/useLiveChat.d.ts.map +1 -0
- package/dist/react/useLiveChat.js +209 -0
- package/dist/react/useLiveChat.js.map +1 -0
- package/dist/react/useLiveGiveawaysAndPolls.d.ts +95 -0
- package/dist/react/useLiveGiveawaysAndPolls.d.ts.map +1 -0
- package/dist/react/useLiveGiveawaysAndPolls.js +225 -0
- package/dist/react/useLiveGiveawaysAndPolls.js.map +1 -0
- package/dist/react/useLivePage.d.ts +134 -0
- package/dist/react/useLivePage.d.ts.map +1 -0
- package/dist/react/useLivePage.js +304 -0
- package/dist/react/useLivePage.js.map +1 -0
- package/dist/react/useLiveShop.d.ts +103 -0
- package/dist/react/useLiveShop.d.ts.map +1 -0
- package/dist/react/useLiveShop.js +211 -0
- package/dist/react/useLiveShop.js.map +1 -0
- package/dist/react/useReplayPage.d.ts +133 -0
- package/dist/react/useReplayPage.d.ts.map +1 -0
- package/dist/react/useReplayPage.js +565 -0
- package/dist/react/useReplayPage.js.map +1 -0
- package/dist/showCredit.d.ts +87 -0
- package/dist/showCredit.d.ts.map +1 -0
- package/dist/showCredit.js +120 -0
- package/dist/showCredit.js.map +1 -0
- package/dist/showNames.d.ts +11 -0
- package/dist/showNames.d.ts.map +1 -1
- package/dist/showNames.js +23 -1
- package/dist/showNames.js.map +1 -1
- package/dist/ui/BubbleFrame.d.ts +38 -0
- package/dist/ui/BubbleFrame.d.ts.map +1 -0
- package/dist/ui/BubbleFrame.js +181 -0
- package/dist/ui/BubbleFrame.js.map +1 -0
- package/dist/ui/LiveBubble.d.ts +37 -0
- package/dist/ui/LiveBubble.d.ts.map +1 -0
- package/dist/ui/LiveBubble.js +101 -0
- package/dist/ui/LiveBubble.js.map +1 -0
- package/dist/ui/ReplayBubble.d.ts +23 -0
- package/dist/ui/ReplayBubble.d.ts.map +1 -0
- package/dist/ui/ReplayBubble.js +65 -0
- package/dist/ui/ReplayBubble.js.map +1 -0
- package/dist/ui.d.ts +27 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +34 -0
- package/dist/ui.js.map +1 -0
- package/package.json +36 -5
- package/ui/package.json +6 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a link can open inside the app: an https address. Plain `http:`, an email, a phone number,
|
|
3
|
+
* words or nothing: false, and the link is drawn as words, not something to tap. Where an https link
|
|
4
|
+
* goes is the app's (`LiveSellingProvider`'s `routes.openLink`).
|
|
5
|
+
*/
|
|
6
|
+
export declare function opensInApp(url: string | null | undefined): boolean;
|
|
7
|
+
/** A link lot ready to draw: what the Live and Replay screens' link cards take (`LiveShopLink`, `ReplayShopLink`). */
|
|
8
|
+
export interface ShowLink {
|
|
9
|
+
/** Says this item is a link, not a product. */
|
|
10
|
+
kind: 'link';
|
|
11
|
+
/** The lot's key on the show: its address when the host gave it no id. */
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
/** Formatted ("$45.00"); empty when the host gave no price. */
|
|
15
|
+
price: string;
|
|
16
|
+
imageUrl: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* The page, when a tap can open it inside the app (an https address, and an app that opens links);
|
|
19
|
+
* null otherwise, and the card is words, not a button.
|
|
20
|
+
*/
|
|
21
|
+
url: string | null;
|
|
22
|
+
}
|
|
23
|
+
/** What a link lot carries, from the session (`LiveProduct`) or the show's record (`LiveStreamProduct`). */
|
|
24
|
+
export interface LinkLotFields {
|
|
25
|
+
id: string;
|
|
26
|
+
title: string;
|
|
27
|
+
/** The host's price, as the gateway sends it ("45.0"); none when unset. */
|
|
28
|
+
price: string | number | null | undefined;
|
|
29
|
+
/** The session leaves it null on a link lot: the shop's own currency then (`getCurrencyCode`). */
|
|
30
|
+
currencyCode?: string | null;
|
|
31
|
+
imageUrl?: string | null;
|
|
32
|
+
externalUrl?: string | null;
|
|
33
|
+
}
|
|
34
|
+
/** The host's price in the shop's currency ("$45.00"), or empty when there is none to show. */
|
|
35
|
+
export declare function linkLotPrice(price: LinkLotFields['price'], currencyCode?: string | null): string;
|
|
36
|
+
/**
|
|
37
|
+
* A link lot as its card draws it. `canOpen` false (an app that gave no `routes.openLink`): the address
|
|
38
|
+
* is kept from the card, so it is words, as for a link that isn't https.
|
|
39
|
+
*/
|
|
40
|
+
export declare function showLinkOf(lot: LinkLotFields, { canOpen }?: {
|
|
41
|
+
canOpen?: boolean;
|
|
42
|
+
}): ShowLink;
|
|
43
|
+
/** A lot on a show's record (`LiveStreamProduct`), as far as a recording's shop reads it. */
|
|
44
|
+
export interface RecordLot {
|
|
45
|
+
storeProductId: string;
|
|
46
|
+
name: string;
|
|
47
|
+
price: string | number | null;
|
|
48
|
+
thumbnailUrl: string | null;
|
|
49
|
+
externalUrl?: string | null;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A recording's shop in the host's order (amore-v2, 2026-10-19): the show's record lists every lot, the
|
|
53
|
+
* links the host added among the products, so a link takes its place there and a product is found by
|
|
54
|
+
* its id (`productGidOf` the lot's). Products the record doesn't list (the replay feed's own list) follow
|
|
55
|
+
* in the feed's order. With no record (it couldn't be read) the products alone, as before.
|
|
56
|
+
*/
|
|
57
|
+
export declare function recordingShopItems<Item extends {
|
|
58
|
+
id: string;
|
|
59
|
+
}>(products: readonly Item[], recordLots: readonly RecordLot[] | null, productGidOf: (storeProductId: string) => string, { canOpen }?: {
|
|
60
|
+
canOpen?: boolean;
|
|
61
|
+
}): (Item | ShowLink)[];
|
|
62
|
+
/** An item of a show's shop that is a link the host added, not a product. */
|
|
63
|
+
export declare function isShowLink<Item extends object>(item: Item | ShowLink): item is ShowLink;
|
|
64
|
+
//# sourceMappingURL=linkLots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkLots.d.ts","sourceRoot":"","sources":["../src/linkLots.ts"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAElE;AA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C,IAAI,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAC5D,QAAQ,EAAE,SAAS,IAAI,EAAE,EACzB,UAAU,EAAE,SAAS,SAAS,EAAE,GAAG,IAAI,EACvC,YAAY,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,MAAM,EAChD,EAAE,OAAc,EAAE,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAC7C,CAAC,IAAI,GAAG,QAAQ,CAAC,EAAE,CAqBrB;AAED,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,IAAI,SAAS,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,QAAQ,GAAG,IAAI,IAAI,QAAQ,CAEvF"}
|
package/dist/linkLots.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.opensInApp = opensInApp;
|
|
4
|
+
exports.linkLotPrice = linkLotPrice;
|
|
5
|
+
exports.showLinkOf = showLinkOf;
|
|
6
|
+
exports.recordingShopItems = recordingShopItems;
|
|
7
|
+
exports.isShowLink = isShowLink;
|
|
8
|
+
/**
|
|
9
|
+
* Link lots (0.15.0, moved from amore-v2's `src/core/utils/linkLots.ts` and the https rule of its
|
|
10
|
+
* `screenForLink`): a lot the host added as a web address (`product_type: "url"`) rather than a product
|
|
11
|
+
* of the store, mostly an affiliate link. The session hands them over among its products, in the host's
|
|
12
|
+
* order, with a title, a price, a photo and the address (`LiveProduct.externalUrl`), no sizes and no
|
|
13
|
+
* catalogue product (`raw`); a show's record has the same (`LiveStreamProduct.externalUrl`). One store's
|
|
14
|
+
* last 80 shows had 305 of 1,803 lots as links (17%), every one https and priced. They are opened, never
|
|
15
|
+
* bought: no Add to Cart, no favourite.
|
|
16
|
+
*
|
|
17
|
+
* Free of React and React Native, so it loads in plain Node for tests; the price is sdk-shopify's
|
|
18
|
+
* `formatMoney` in the shop's currency (`getCurrencyCode`), plain functions.
|
|
19
|
+
*/
|
|
20
|
+
const sdk_shopify_1 = require("@tiledev/sdk-shopify");
|
|
21
|
+
/** An https address with a host and no spaces: the only kind of link that opens anything (an app's web page loads https only). */
|
|
22
|
+
const HTTPS_ADDRESS = /^https:\/\/[^\s/?#]+\S*$/i;
|
|
23
|
+
/**
|
|
24
|
+
* Whether a link can open inside the app: an https address. Plain `http:`, an email, a phone number,
|
|
25
|
+
* words or nothing: false, and the link is drawn as words, not something to tap. Where an https link
|
|
26
|
+
* goes is the app's (`LiveSellingProvider`'s `routes.openLink`).
|
|
27
|
+
*/
|
|
28
|
+
function opensInApp(url) {
|
|
29
|
+
return typeof url === 'string' && HTTPS_ADDRESS.test(url.trim());
|
|
30
|
+
}
|
|
31
|
+
/** The host's price in the shop's currency ("$45.00"), or empty when there is none to show. */
|
|
32
|
+
function linkLotPrice(price, currencyCode) {
|
|
33
|
+
if (price === null || price === undefined || price === '')
|
|
34
|
+
return '';
|
|
35
|
+
const amount = Number(price);
|
|
36
|
+
if (!Number.isFinite(amount))
|
|
37
|
+
return '';
|
|
38
|
+
return (0, sdk_shopify_1.formatMoney)({ amount: String(amount), currencyCode: currencyCode || (0, sdk_shopify_1.getCurrencyCode)() || 'USD' });
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A link lot as its card draws it. `canOpen` false (an app that gave no `routes.openLink`): the address
|
|
42
|
+
* is kept from the card, so it is words, as for a link that isn't https.
|
|
43
|
+
*/
|
|
44
|
+
function showLinkOf(lot, { canOpen = true } = {}) {
|
|
45
|
+
var _a;
|
|
46
|
+
const address = typeof lot.externalUrl === 'string' ? lot.externalUrl.trim() : '';
|
|
47
|
+
return {
|
|
48
|
+
kind: 'link',
|
|
49
|
+
id: lot.id,
|
|
50
|
+
title: lot.title,
|
|
51
|
+
price: linkLotPrice(lot.price, lot.currencyCode),
|
|
52
|
+
imageUrl: (_a = lot.imageUrl) !== null && _a !== void 0 ? _a : null,
|
|
53
|
+
url: canOpen && opensInApp(address) ? address : null,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A recording's shop in the host's order (amore-v2, 2026-10-19): the show's record lists every lot, the
|
|
58
|
+
* links the host added among the products, so a link takes its place there and a product is found by
|
|
59
|
+
* its id (`productGidOf` the lot's). Products the record doesn't list (the replay feed's own list) follow
|
|
60
|
+
* in the feed's order. With no record (it couldn't be read) the products alone, as before.
|
|
61
|
+
*/
|
|
62
|
+
function recordingShopItems(products, recordLots, productGidOf, { canOpen = true } = {}) {
|
|
63
|
+
if (!recordLots)
|
|
64
|
+
return [...products];
|
|
65
|
+
const placed = new Set();
|
|
66
|
+
const inOrder = [];
|
|
67
|
+
for (const lot of recordLots) {
|
|
68
|
+
if (lot.externalUrl) {
|
|
69
|
+
inOrder.push(showLinkOf({ id: lot.storeProductId, title: lot.name, price: lot.price, imageUrl: lot.thumbnailUrl, externalUrl: lot.externalUrl }, { canOpen }));
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
const product = products.find((item) => item.id === productGidOf(lot.storeProductId));
|
|
73
|
+
if (product && !placed.has(product.id)) {
|
|
74
|
+
placed.add(product.id);
|
|
75
|
+
inOrder.push(product);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return [...inOrder, ...products.filter((item) => !placed.has(item.id))];
|
|
79
|
+
}
|
|
80
|
+
/** An item of a show's shop that is a link the host added, not a product. */
|
|
81
|
+
function isShowLink(item) {
|
|
82
|
+
return item.kind === 'link';
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=linkLots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkLots.js","sourceRoot":"","sources":["../src/linkLots.ts"],"names":[],"mappings":";;AAsBA,gCAEC;AAgCD,oCAKC;AAMD,gCAUC;AAiBD,gDA0BC;AAGD,gCAEC;AA7HD;;;;;;;;;;;GAWG;AACH,sDAAoE;AAEpE,kIAAkI;AAClI,MAAM,aAAa,G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ED,6EAA6E;AAC7E,SAAgB,UAAU,CAAsB,IAAqB;IACnE,OAAQ,IAAiB,CAAC,IAAI,KAAK,MAAM,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rules behind the Live and Replay page models (0.14.0, moved from amore-v2's `useLivePage`,
|
|
3
|
+
* `useLiveChat` and `useReplayPage`): which navigation is a back press, when a sheet leaves the show
|
|
4
|
+
* playing, who the chat asks for a name, and what a recording shows at a point of its playhead.
|
|
5
|
+
*
|
|
6
|
+
* Pure, so it loads in plain Node for tests (sdk-shopify's `cartLineFacts` is a plain function). The
|
|
7
|
+
* hooks (`react/useLivePage.ts` and the rest) apply them.
|
|
8
|
+
*/
|
|
9
|
+
import { type Cart, type CartExtension } from '@tiledev/sdk-shopify';
|
|
10
|
+
import type { NameOnAccount, ReplayCommentItem } from './pageTypes';
|
|
11
|
+
import type { Replay, ReplayComment, ReplaySegment } from './types';
|
|
12
|
+
/**
|
|
13
|
+
* The navigation actions that are a back press: the header's arrow and picture-in-picture button
|
|
14
|
+
* (`goBack`, or `popTo` the tabs when nothing is behind), Android's back (`GO_BACK`) and the iOS swipe
|
|
15
|
+
* (native-stack's `POP`). Leaving any of these ways shrinks a show on air into the bubble. Being
|
|
16
|
+
* replaced (a link's show has a recording) or navigated away from is not going back.
|
|
17
|
+
*/
|
|
18
|
+
export declare const BACK_ACTIONS: ReadonlySet<string>;
|
|
19
|
+
/** A navigator's state, as far as `isCoveredOnlyBySheet` reads it (React Navigation's has it). */
|
|
20
|
+
export interface StackStateForSheets {
|
|
21
|
+
index: number;
|
|
22
|
+
routes: readonly {
|
|
23
|
+
key: string;
|
|
24
|
+
name: string;
|
|
25
|
+
}[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The screen (`screenKey`, its route key) is covered only by a page drawn as a sheet (`sheets`, the
|
|
29
|
+
* app's route names: the variant page, the Sign In page): the show plays on behind it, with the screen
|
|
30
|
+
* kept on, as if the screen were on show.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isCoveredOnlyBySheet(state: StackStateForSheets | null | undefined, screenKey: string, sheets: readonly string[]): boolean;
|
|
33
|
+
/** Who the shopper is in the room, as far as the chat's name ask reads it. */
|
|
34
|
+
export interface ChatNameInput {
|
|
35
|
+
/** The room has a name for the shopper (`session.viewerName`). */
|
|
36
|
+
named: boolean;
|
|
37
|
+
/** sdk-shopify's `useCustomer().loggedIn`. */
|
|
38
|
+
loggedIn: boolean;
|
|
39
|
+
/** A stored sign-in is still being read on app open (`useCustomer().restoring`). */
|
|
40
|
+
restoring: boolean;
|
|
41
|
+
/** The signed-in shopper's account has been read (`useCustomer().customer`). */
|
|
42
|
+
hasCustomer: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* What the comment box does about the shopper's name: ask for one on the first Send (`askForName`,
|
|
46
|
+
* saved on this phone by the session's `chooseViewerName`), or wait while the account loads
|
|
47
|
+
* (`waitingForName`, Send held so nothing goes out as "Anonymous").
|
|
48
|
+
*
|
|
49
|
+
* Signed in, the account's name is the room's (`viewerNameFor`). Since sdk-apptile-live-selling 0.13.0
|
|
50
|
+
* an account with no name gives none (it was the email's part before the @), and nor does one with a
|
|
51
|
+
* name the show's team goes by: the room has no name, and the shopper is asked like a signed-out one
|
|
52
|
+
* once the account has loaded. amore-v2's chat waited for as long as a signed-in shopper had no name,
|
|
53
|
+
* which on 0.13.0 was for ever for such an account.
|
|
54
|
+
*/
|
|
55
|
+
export declare function chatNameAsk({ named, loggedIn, restoring, hasCustomer }: ChatNameInput): {
|
|
56
|
+
askForName: boolean;
|
|
57
|
+
waitingForName: boolean;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* A cart with no holds: one list, so the header isn't handed a new one on every draw. A plain array, as
|
|
61
|
+
* the header tile types it (`holdEndTimes?: number[]`); never change it.
|
|
62
|
+
*/
|
|
63
|
+
export declare const NO_HOLDS: number[];
|
|
64
|
+
/**
|
|
65
|
+
* When each of the cart's holds ends (0.15.0, amore-v2's ENG-691), for the Live header's timer under the
|
|
66
|
+
* cart button: each line's reservation as the Cart reads it (sdk-shopify's `cartLineFacts` over the
|
|
67
|
+
* provider's `cartExtensions`: Cart Hold's stamp). A giveaway prize and a service line have none, nor
|
|
68
|
+
* does a line Cart Hold never held. Every end, not only the soonest: the Live screen doesn't read the
|
|
69
|
+
* cart again when a hold runs out, so the soonest worked out here would stay on a hold that has ended;
|
|
70
|
+
* the header picks the soonest still running as it counts. `NO_HOLDS` when there are none.
|
|
71
|
+
*/
|
|
72
|
+
export declare function holdEndTimesOf(cart: Cart | null | undefined, extensions: readonly CartExtension[]): number[];
|
|
73
|
+
/** The signed-in shopper's account, as far as the name asks read it (sdk-shopify's `useCustomer()`). */
|
|
74
|
+
export interface AccountForNames {
|
|
75
|
+
loggedIn: boolean;
|
|
76
|
+
/** A stored sign-in is still being read on app open. */
|
|
77
|
+
restoring?: boolean;
|
|
78
|
+
customer: {
|
|
79
|
+
firstName?: string | null;
|
|
80
|
+
lastName?: string | null;
|
|
81
|
+
} | null | undefined;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Signed in, the account not read yet (a stored sign-in on app open, or a moment after signing in, with
|
|
85
|
+
* the session and no profile): what to ask isn't known, so Send and Enter wait.
|
|
86
|
+
*/
|
|
87
|
+
export declare function accountLoadingOf({ loggedIn, restoring, customer }: AccountForNames): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* The name a signed-in shopper's account needs (0.15.0, amore-v2's ENG-686): read, and with no first
|
|
90
|
+
* name (blank, or only spaces) or with a name the show's team goes by. What it has, each part trimmed,
|
|
91
|
+
* for the ask to start from (a last name already there needn't be typed again). Null when it has a
|
|
92
|
+
* first name, while it loads, and when signed out (a guest's name stays on the phone).
|
|
93
|
+
*/
|
|
94
|
+
export declare function accountNameToComplete(account: AccountForNames, blockedNames: readonly string[]): NameOnAccount | null;
|
|
95
|
+
/**
|
|
96
|
+
* A typed name as it goes on the account: each part's spaces closed up and trimmed, and the whole name
|
|
97
|
+
* ("Jane Doe", or "Jane" with no last name). Null with no first name, or a name the show's team goes by:
|
|
98
|
+
* nothing is saved.
|
|
99
|
+
*/
|
|
100
|
+
export declare function tidyAccountName(typedFirstName: string, typedLastName: string, blockedNames: readonly string[]): {
|
|
101
|
+
firstName: string;
|
|
102
|
+
lastName: string;
|
|
103
|
+
fullName: string;
|
|
104
|
+
} | null;
|
|
105
|
+
/**
|
|
106
|
+
* What the comment box does about the shopper's name since 0.15.0 (amore-v2's ENG-686), beside
|
|
107
|
+
* `chatNameAsk`, 0.14.0's rule, which is unchanged:
|
|
108
|
+
*
|
|
109
|
+
* - **Ask** (`askForName`) a signed-in shopper whose account needs a name (`accountNameToComplete`):
|
|
110
|
+
* a first and a last name, saved to the account; and a signed-out shopper the room has no name for,
|
|
111
|
+
* saved on this phone.
|
|
112
|
+
* - **Wait** (`waitingForName`) while the account loads: Send is held, so nothing goes out as
|
|
113
|
+
* "Anonymous".
|
|
114
|
+
*/
|
|
115
|
+
export declare function accountNameAsk({ named, loggedIn, restoring, accountLoading, nameToComplete, }: {
|
|
116
|
+
/** The room has a name for the shopper (`session.viewerName`). */
|
|
117
|
+
named: boolean;
|
|
118
|
+
loggedIn: boolean;
|
|
119
|
+
restoring: boolean;
|
|
120
|
+
accountLoading: boolean;
|
|
121
|
+
nameToComplete: NameOnAccount | null;
|
|
122
|
+
}): {
|
|
123
|
+
askForName: boolean;
|
|
124
|
+
waitingForName: boolean;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* What a giveaway's "Entering As:" does about the shopper's name (entering needs a sign-in): ask a
|
|
128
|
+
* signed-in shopper whose account needs a name, or whom the room has no name for once their profile has
|
|
129
|
+
* arrived; wait while the account loads.
|
|
130
|
+
*/
|
|
131
|
+
export declare function giveawayNameAsk({ named, loggedIn, hasCustomer, accountLoading, nameToComplete, }: {
|
|
132
|
+
named: boolean;
|
|
133
|
+
loggedIn: boolean;
|
|
134
|
+
hasCustomer: boolean;
|
|
135
|
+
accountLoading: boolean;
|
|
136
|
+
nameToComplete: NameOnAccount | null;
|
|
137
|
+
}): {
|
|
138
|
+
askForName: boolean;
|
|
139
|
+
waitingForName: boolean;
|
|
140
|
+
};
|
|
141
|
+
/** A card passes the recording's feed id; a push passes its show's streaming id. Both find it. */
|
|
142
|
+
export declare function isTheShow(replay: Pick<Replay, 'id' | 'streamingId'>, id: string): boolean;
|
|
143
|
+
/** A time or length from the player, in seconds, as milliseconds; 0 when it has none yet. */
|
|
144
|
+
export declare function playerMs(seconds: number): number;
|
|
145
|
+
/**
|
|
146
|
+
* The product on screen at `atMs`: the one whose time window covers it (where windows overlap, the
|
|
147
|
+
* host went back to something, and the last one is what they were on); before the first window (a
|
|
148
|
+
* sale opens with a greeting), the first tagged product. Null with no products. Since 0.15.0 the items
|
|
149
|
+
* can be a recording's shop, links among the products (`windowKeyOf`).
|
|
150
|
+
*/
|
|
151
|
+
export declare function productOnScreen<Item extends {
|
|
152
|
+
id: string;
|
|
153
|
+
}>(segments: readonly ReplaySegment[], products: readonly Item[], atMs: number,
|
|
154
|
+
/** The key a window names an item by (0.15.0): a product's id, or a link lot's as a product GID. */
|
|
155
|
+
windowKeyOf?: (item: Item) => string): Item | null;
|
|
156
|
+
/** Where the host first showed a product, or null for one they never did (tagged, with no time window). */
|
|
157
|
+
export declare function firstShownAt(segments: readonly ReplaySegment[], productId: string): number | null;
|
|
158
|
+
/** Comments kept in the replay's chat pane: the newest of what has been said so far. */
|
|
159
|
+
export declare const REPLAY_COMMENTS_SHOWN = 60;
|
|
160
|
+
/**
|
|
161
|
+
* The recording's chat as it stood at `atMs`: what had been said by then, the newest `shown`, oldest
|
|
162
|
+
* first. The comments file writes the host's rows as "You" (true on the console that recorded them),
|
|
163
|
+
* so those read as the host's too.
|
|
164
|
+
*/
|
|
165
|
+
export declare function replayCommentsAt(comments: readonly ReplayComment[], atMs: number, shown?: number): ReplayCommentItem[];
|
|
166
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AI,EAAE,MAAM,EACZ,KAAK,GAAE,MAA8B,GACpC,iBAAiB,EAAE,CASrB"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REPLAY_COMMENTS_SHOWN = exports.NO_HOLDS = exports.BACK_ACTIONS = void 0;
|
|
4
|
+
exports.isCoveredOnlyBySheet = isCoveredOnlyBySheet;
|
|
5
|
+
exports.chatNameAsk = chatNameAsk;
|
|
6
|
+
exports.holdEndTimesOf = holdEndTimesOf;
|
|
7
|
+
exports.accountLoadingOf = accountLoadingOf;
|
|
8
|
+
exports.accountNameToComplete = accountNameToComplete;
|
|
9
|
+
exports.tidyAccountName = tidyAccountName;
|
|
10
|
+
exports.accountNameAsk = accountNameAsk;
|
|
11
|
+
exports.giveawayNameAsk = giveawayNameAsk;
|
|
12
|
+
exports.isTheShow = isTheShow;
|
|
13
|
+
exports.playerMs = playerMs;
|
|
14
|
+
exports.productOnScreen = productOnScreen;
|
|
15
|
+
exports.firstShownAt = firstShownAt;
|
|
16
|
+
exports.replayCommentsAt = replayCommentsAt;
|
|
17
|
+
/**
|
|
18
|
+
* The rules behind the Live and Replay page models (0.14.0, moved from amore-v2's `useLivePage`,
|
|
19
|
+
* `useLiveChat` and `useReplayPage`): which navigation is a back press, when a sheet leaves the show
|
|
20
|
+
* playing, who the chat asks for a name, and what a recording shows at a point of its playhead.
|
|
21
|
+
*
|
|
22
|
+
* Pure, so it loads in plain Node for tests (sdk-shopify's `cartLineFacts` is a plain function). The
|
|
23
|
+
* hooks (`react/useLivePage.ts` and the rest) apply them.
|
|
24
|
+
*/
|
|
25
|
+
const sdk_shopify_1 = require("@tiledev/sdk-shopify");
|
|
26
|
+
const showNames_1 = require("./showNames");
|
|
27
|
+
// ─── The Live screen ──────────────────────────────────────────────────────────
|
|
28
|
+
/**
|
|
29
|
+
* The navigation actions that are a back press: the header's arrow and picture-in-picture button
|
|
30
|
+
* (`goBack`, or `popTo` the tabs when nothing is behind), Android's back (`GO_BACK`) and the iOS swipe
|
|
31
|
+
* (native-stack's `POP`). Leaving any of these ways shrinks a show on air into the bubble. Being
|
|
32
|
+
* replaced (a link's show has a recording) or navigated away from is not going back.
|
|
33
|
+
*/
|
|
34
|
+
exports.BACK_ACTIONS = new Set(['GO_BACK', 'POP', 'POP_TO', 'POP_TO_TOP']);
|
|
35
|
+
/**
|
|
36
|
+
* The screen (`screenKey`, its route key) is covered only by a page drawn as a sheet (`sheets`, the
|
|
37
|
+
* app's route names: the variant page, the Sign In page): the show plays on behind it, with the screen
|
|
38
|
+
* kept on, as if the screen were on show.
|
|
39
|
+
*/
|
|
40
|
+
function isCoveredOnlyBySheet(state, screenKey, sheets) {
|
|
41
|
+
if (!state)
|
|
42
|
+
return false;
|
|
43
|
+
const top = state.routes[state.index];
|
|
44
|
+
const below = state.routes[state.index - 1];
|
|
45
|
+
return !!top && sheets.includes(top.name) && (below === null || below === void 0 ? void 0 : below.key) === screenKey;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* What the comment box does about the shopper's name: ask for one on the first Send (`askForName`,
|
|
49
|
+
* saved on this phone by the session's `chooseViewerName`), or wait while the account loads
|
|
50
|
+
* (`waitingForName`, Send held so nothing goes out as "Anonymous").
|
|
51
|
+
*
|
|
52
|
+
* Signed in, the account's name is the room's (`viewerNameFor`). Since sdk-apptile-live-selling 0.13.0
|
|
53
|
+
* an account with no name gives none (it was the email's part before the @), and nor does one with a
|
|
54
|
+
* name the show's team goes by: the room has no name, and the shopper is asked like a signed-out one
|
|
55
|
+
* once the account has loaded. amore-v2's chat waited for as long as a signed-in shopper had no name,
|
|
56
|
+
* which on 0.13.0 was for ever for such an account.
|
|
57
|
+
*/
|
|
58
|
+
function chatNameAsk({ named, loggedIn, restoring, hasCustomer }) {
|
|
59
|
+
// On app open, or a moment after signing in (signed in, the account not read yet).
|
|
60
|
+
const accountLoading = restoring || (loggedIn && !hasCustomer);
|
|
61
|
+
return { askForName: !named && !accountLoading, waitingForName: !named && accountLoading };
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A cart with no holds: one list, so the header isn't handed a new one on every draw. A plain array, as
|
|
65
|
+
* the header tile types it (`holdEndTimes?: number[]`); never change it.
|
|
66
|
+
*/
|
|
67
|
+
exports.NO_HOLDS = [];
|
|
68
|
+
/**
|
|
69
|
+
* When each of the cart's holds ends (0.15.0, amore-v2's ENG-691), for the Live header's timer under the
|
|
70
|
+
* cart button: each line's reservation as the Cart reads it (sdk-shopify's `cartLineFacts` over the
|
|
71
|
+
* provider's `cartExtensions`: Cart Hold's stamp). A giveaway prize and a service line have none, nor
|
|
72
|
+
* does a line Cart Hold never held. Every end, not only the soonest: the Live screen doesn't read the
|
|
73
|
+
* cart again when a hold runs out, so the soonest worked out here would stay on a hold that has ended;
|
|
74
|
+
* the header picks the soonest still running as it counts. `NO_HOLDS` when there are none.
|
|
75
|
+
*/
|
|
76
|
+
function holdEndTimesOf(cart, extensions) {
|
|
77
|
+
if (!cart)
|
|
78
|
+
return exports.NO_HOLDS;
|
|
79
|
+
const ends = cart.lines
|
|
80
|
+
.map((line) => (0, sdk_shopify_1.cartLineFacts)(line, cart, extensions).holdExpiresAt)
|
|
81
|
+
.filter((end) => end !== null && end !== undefined);
|
|
82
|
+
return ends.length > 0 ? ends : exports.NO_HOLDS;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Signed in, the account not read yet (a stored sign-in on app open, or a moment after signing in, with
|
|
86
|
+
* the session and no profile): what to ask isn't known, so Send and Enter wait.
|
|
87
|
+
*/
|
|
88
|
+
function accountLoadingOf({ loggedIn, restoring, customer }) {
|
|
89
|
+
return !!restoring || (!!loggedIn && !customer);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The name a signed-in shopper's account needs (0.15.0, amore-v2's ENG-686): read, and with no first
|
|
93
|
+
* name (blank, or only spaces) or with a name the show's team goes by. What it has, each part trimmed,
|
|
94
|
+
* for the ask to start from (a last name already there needn't be typed again). Null when it has a
|
|
95
|
+
* first name, while it loads, and when signed out (a guest's name stays on the phone).
|
|
96
|
+
*/
|
|
97
|
+
function accountNameToComplete(account, blockedNames) {
|
|
98
|
+
var _a, _b, _c, _d, _e, _f;
|
|
99
|
+
if (!account.loggedIn || accountLoadingOf(account))
|
|
100
|
+
return null;
|
|
101
|
+
const firstName = (_c = (_b = (_a = account.customer) === null || _a === void 0 ? void 0 : _a.firstName) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '';
|
|
102
|
+
const lastName = (_f = (_e = (_d = account.customer) === null || _d === void 0 ? void 0 : _d.lastName) === null || _e === void 0 ? void 0 : _e.trim()) !== null && _f !== void 0 ? _f : '';
|
|
103
|
+
const needsAName = !firstName || (0, showNames_1.isBlockedViewerName)(`${firstName} ${lastName}`, blockedNames);
|
|
104
|
+
return needsAName ? { firstName, lastName } : null;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A typed name as it goes on the account: each part's spaces closed up and trimmed, and the whole name
|
|
108
|
+
* ("Jane Doe", or "Jane" with no last name). Null with no first name, or a name the show's team goes by:
|
|
109
|
+
* nothing is saved.
|
|
110
|
+
*/
|
|
111
|
+
function tidyAccountName(typedFirstName, typedLastName, blockedNames) {
|
|
112
|
+
const firstName = typedFirstName.replace(/\s+/g, ' ').trim();
|
|
113
|
+
const lastName = typedLastName.replace(/\s+/g, ' ').trim();
|
|
114
|
+
const fullName = lastName ? `${firstName} ${lastName}` : firstName;
|
|
115
|
+
if (!firstName || (0, showNames_1.isBlockedViewerName)(fullName, blockedNames))
|
|
116
|
+
return null;
|
|
117
|
+
return { firstName, lastName, fullName };
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* What the comment box does about the shopper's name since 0.15.0 (amore-v2's ENG-686), beside
|
|
121
|
+
* `chatNameAsk`, 0.14.0's rule, which is unchanged:
|
|
122
|
+
*
|
|
123
|
+
* - **Ask** (`askForName`) a signed-in shopper whose account needs a name (`accountNameToComplete`):
|
|
124
|
+
* a first and a last name, saved to the account; and a signed-out shopper the room has no name for,
|
|
125
|
+
* saved on this phone.
|
|
126
|
+
* - **Wait** (`waitingForName`) while the account loads: Send is held, so nothing goes out as
|
|
127
|
+
* "Anonymous".
|
|
128
|
+
*/
|
|
129
|
+
function accountNameAsk({ named, loggedIn, restoring, accountLoading, nameToComplete, }) {
|
|
130
|
+
const signedIn = loggedIn || restoring;
|
|
131
|
+
return { askForName: !!nameToComplete || (!named && !signedIn), waitingForName: accountLoading };
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* What a giveaway's "Entering As:" does about the shopper's name (entering needs a sign-in): ask a
|
|
135
|
+
* signed-in shopper whose account needs a name, or whom the room has no name for once their profile has
|
|
136
|
+
* arrived; wait while the account loads.
|
|
137
|
+
*/
|
|
138
|
+
function giveawayNameAsk({ named, loggedIn, hasCustomer, accountLoading, nameToComplete, }) {
|
|
139
|
+
return { askForName: !!nameToComplete || (loggedIn && !named && hasCustomer), waitingForName: accountLoading };
|
|
140
|
+
}
|
|
141
|
+
// ─── The Replay screen ────────────────────────────────────────────────────────
|
|
142
|
+
/** A card passes the recording's feed id; a push passes its show's streaming id. Both find it. */
|
|
143
|
+
function isTheShow(replay, id) {
|
|
144
|
+
return replay.id === id || replay.streamingId === id;
|
|
145
|
+
}
|
|
146
|
+
/** A time or length from the player, in seconds, as milliseconds; 0 when it has none yet. */
|
|
147
|
+
function playerMs(seconds) {
|
|
148
|
+
return Number.isFinite(seconds) && seconds > 0 ? seconds * 1000 : 0;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The product on screen at `atMs`: the one whose time window covers it (where windows overlap, the
|
|
152
|
+
* host went back to something, and the last one is what they were on); before the first window (a
|
|
153
|
+
* sale opens with a greeting), the first tagged product. Null with no products. Since 0.15.0 the items
|
|
154
|
+
* can be a recording's shop, links among the products (`windowKeyOf`).
|
|
155
|
+
*/
|
|
156
|
+
function productOnScreen(segments, products, atMs,
|
|
157
|
+
/** The key a window names an item by (0.15.0): a product's id, or a link lot's as a product GID. */
|
|
158
|
+
windowKeyOf = (item) => item.id) {
|
|
159
|
+
var _a, _b;
|
|
160
|
+
const covering = segments.filter((segment) => atMs >= segment.startMs && atMs <= segment.endMs);
|
|
161
|
+
const productId = covering.length ? covering[covering.length - 1].productGid : null;
|
|
162
|
+
return (_b = (_a = (productId ? products.find((product) => windowKeyOf(product) === productId) : undefined)) !== null && _a !== void 0 ? _a : products[0]) !== null && _b !== void 0 ? _b : null;
|
|
163
|
+
}
|
|
164
|
+
/** Where the host first showed a product, or null for one they never did (tagged, with no time window). */
|
|
165
|
+
function firstShownAt(segments, productId) {
|
|
166
|
+
var _a, _b;
|
|
167
|
+
return (_b = (_a = segments.find((segment) => segment.productGid === productId)) === null || _a === void 0 ? void 0 : _a.startMs) !== null && _b !== void 0 ? _b : null;
|
|
168
|
+
}
|
|
169
|
+
/** Comments kept in the replay's chat pane: the newest of what has been said so far. */
|
|
170
|
+
exports.REPLAY_COMMENTS_SHOWN = 60;
|
|
171
|
+
/**
|
|
172
|
+
* The recording's chat as it stood at `atMs`: what had been said by then, the newest `shown`, oldest
|
|
173
|
+
* first. The comments file writes the host's rows as "You" (true on the console that recorded them),
|
|
174
|
+
* so those read as the host's too.
|
|
175
|
+
*/
|
|
176
|
+
function replayCommentsAt(comments, atMs, shown = exports.REPLAY_COMMENTS_SHOWN) {
|
|
177
|
+
let said = 0;
|
|
178
|
+
while (said < comments.length && comments[said].atMs <= atMs)
|
|
179
|
+
said += 1;
|
|
180
|
+
return comments.slice(Math.max(0, said - shown), said).map(({ comment }) => ({
|
|
181
|
+
id: comment.id,
|
|
182
|
+
author: comment.userName,
|
|
183
|
+
text: comment.text,
|
|
184
|
+
fromHost: comment.source === 'HOST' || comment.userName === 'You',
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=livePages.js.map
|
|
@@ -0,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EAAE,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS,CAAC,0CAAE,OAAO,mCAAI,IAAI,CAAC;AACvF,CAAC;AAED,wFAAwF;AAC3E,QAAA,qBAAqB,GAAG,EAAE,CAAC;AAExC;;;;GAIG;AACH,SAAgB,gBAAgB,CAC9B,QAAkC,EAClC,IAAY,EACZ,QAAgB,6BAAqB;IAErC,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,OAAO,IAAI,GAAG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI;QAAE,IAAI,IAAI,CAAC,CAAC;IACxE,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAC3E,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,MAAM,EAAE,OAAO,CAAC,QAAQ;QACxB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,QAAQ,EAAE,OAAO,CAAC,MAAM,KAAK,MAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,KAAK;KAClE,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An add to tell the live show's room about once it lands: the variant page's and quick add's
|
|
3
|
+
* `announceToLiveRoom`, set only by the Live screen (`useLiveShop`). `lotNumber` is the lot's number
|
|
4
|
+
* (the session's `sellId`), or null when the gateway hasn't issued one.
|
|
5
|
+
*/
|
|
6
|
+
export interface LiveRoomAnnouncement {
|
|
7
|
+
lotNumber: string | null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Tells the room of the live show this phone is watching that the shopper put a product in their cart:
|
|
11
|
+
* every phone in the room shows it as a cart chip ("Sold 104", or "Jane added …"), this one included,
|
|
12
|
+
* as the room sends it back. **Only after the add landed** (Freckled Poppy's rule): a refused add must
|
|
13
|
+
* not be announced, as the room reads the chip as "it is going".
|
|
14
|
+
*
|
|
15
|
+
* The engine's own call (`sendCartAnnouncement`, which the session's `actions.announceAddToCart`
|
|
16
|
+
* wraps). The phone is in one room at a time, the one the Live screen holds (`holdStream`) while the
|
|
17
|
+
* variant page is over it; with no room (the show ended meanwhile) nothing is sent. A send that fails
|
|
18
|
+
* goes to the provider's `onWarning`. Never throws.
|
|
19
|
+
*/
|
|
20
|
+
export declare function announceAddToLiveRoom(productTitle: string, { lotNumber }: LiveRoomAnnouncement): void;
|
|
21
|
+
//# sourceMappingURL=liveRoom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liveRoom.d.ts","sourceRoot":"","sources":["../src/liveRoom.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,EAAE,oBAAoB,GAAG,IAAI,CAIrG"}
|
package/dist/liveRoom.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.announceAddToLiveRoom = announceAddToLiveRoom;
|
|
4
|
+
/**
|
|
5
|
+
* Telling the live show's room about an add (0.14.0, moved from amore-v2's `src/core/services/liveRoom.ts`).
|
|
6
|
+
*
|
|
7
|
+
* Free of React, so the variant page and quick add can announce without reading the session, which they
|
|
8
|
+
* need for nothing else. `engine` is the native one on a phone and the no-op everywhere else.
|
|
9
|
+
*/
|
|
10
|
+
const engine_1 = require("./engine");
|
|
11
|
+
const pageOptions_1 = require("./pageOptions");
|
|
12
|
+
/**
|
|
13
|
+
* Tells the room of the live show this phone is watching that the shopper put a product in their cart:
|
|
14
|
+
* every phone in the room shows it as a cart chip ("Sold 104", or "Jane added …"), this one included,
|
|
15
|
+
* as the room sends it back. **Only after the add landed** (Freckled Poppy's rule): a refused add must
|
|
16
|
+
* not be announced, as the room reads the chip as "it is going".
|
|
17
|
+
*
|
|
18
|
+
* The engine's own call (`sendCartAnnouncement`, which the session's `actions.announceAddToCart`
|
|
19
|
+
* wraps). The phone is in one room at a time, the one the Live screen holds (`holdStream`) while the
|
|
20
|
+
* variant page is over it; with no room (the show ended meanwhile) nothing is sent. A send that fails
|
|
21
|
+
* goes to the provider's `onWarning`. Never throws.
|
|
22
|
+
*/
|
|
23
|
+
function announceAddToLiveRoom(productTitle, { lotNumber }) {
|
|
24
|
+
void engine_1.engine.sendCartAnnouncement(productTitle, lotNumber).catch((error) => {
|
|
25
|
+
(0, pageOptions_1.reportLiveWarning)(error, { at: 'announceAddToLiveRoom', productTitle, lotNumber });
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=liveRoom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liveRoom.js","sourceRoot":"","sources":["../src/liveRoom.ts"],"names":[],"mappings":";;AA6BA,sDAIC;AAjCD;;;;;GAKG;AACH,qCAAkC;AAClC,+CAAkD;AAWlD;;;;;;;;;;GAUG;AACH,SAAgB,qBAAqB,CAAC,YAAoB,EAAE,EAAE,SAAS,EAAwB;IAC7F,KAAK,eAAM,CAAC,oBAAoB,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACjF,IAAA,+BAAiB,EAAC,KAAK,EAAE,EAAE,EAAE,EAAE,uBAAuB,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,CAAC;IACrF,CAAC,CAAC,CAAC;AACL,CAAC"}
|