@tiledev/sdk-apptile-live-selling 0.8.0 → 0.9.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 +443 -34
- package/dist/auctionComments.d.ts +25 -0
- package/dist/auctionComments.d.ts.map +1 -0
- package/dist/auctionComments.js +28 -0
- package/dist/auctionComments.js.map +1 -0
- package/dist/auctionRules.d.ts +76 -0
- package/dist/auctionRules.d.ts.map +1 -0
- package/dist/auctionRules.js +106 -0
- package/dist/auctionRules.js.map +1 -0
- package/dist/auctions.d.ts.map +1 -1
- package/dist/auctions.js +19 -10
- package/dist/auctions.js.map +1 -1
- package/dist/client.d.ts +51 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +123 -23
- package/dist/client.js.map +1 -1
- package/dist/commentHistory.d.ts +66 -0
- package/dist/commentHistory.d.ts.map +1 -0
- package/dist/commentHistory.js +125 -0
- package/dist/commentHistory.js.map +1 -0
- package/dist/engine.native.d.ts.map +1 -1
- package/dist/engine.native.js +17 -845
- package/dist/engine.native.js.map +1 -1
- package/dist/giveawayPrize.d.ts +13 -0
- package/dist/giveawayPrize.d.ts.map +1 -0
- package/dist/giveawayPrize.js +18 -0
- package/dist/giveawayPrize.js.map +1 -0
- package/dist/giveawayPrizeLines.d.ts +67 -0
- package/dist/giveawayPrizeLines.d.ts.map +1 -0
- package/dist/giveawayPrizeLines.js +48 -0
- package/dist/giveawayPrizeLines.js.map +1 -0
- package/dist/giveawayRoster.d.ts +53 -0
- package/dist/giveawayRoster.d.ts.map +1 -0
- package/dist/giveawayRoster.js +93 -0
- package/dist/giveawayRoster.js.map +1 -0
- package/dist/heldComments.d.ts +29 -0
- package/dist/heldComments.d.ts.map +1 -0
- package/dist/heldComments.js +61 -0
- package/dist/heldComments.js.map +1 -0
- package/dist/hiddenShows.d.ts +34 -0
- package/dist/hiddenShows.d.ts.map +1 -0
- package/dist/hiddenShows.js +42 -0
- package/dist/hiddenShows.js.map +1 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +86 -3
- package/dist/index.js.map +1 -1
- package/dist/liveShow.d.ts +58 -0
- package/dist/liveShow.d.ts.map +1 -0
- package/dist/liveShow.js +55 -0
- package/dist/liveShow.js.map +1 -0
- package/dist/pipWindow.d.ts +85 -0
- package/dist/pipWindow.d.ts.map +1 -0
- package/dist/pipWindow.js +88 -0
- package/dist/pipWindow.js.map +1 -0
- package/dist/polls.d.ts.map +1 -1
- package/dist/polls.js +3 -0
- package/dist/polls.js.map +1 -1
- package/dist/react/LiveSellingProvider.d.ts +10 -1
- package/dist/react/LiveSellingProvider.d.ts.map +1 -1
- package/dist/react/LiveSellingProvider.js +6 -2
- package/dist/react/LiveSellingProvider.js.map +1 -1
- package/dist/react/LiveVideoTarget.d.ts.map +1 -1
- package/dist/react/LiveVideoTarget.js +41 -3
- package/dist/react/LiveVideoTarget.js.map +1 -1
- package/dist/react/clocks.d.ts +29 -0
- package/dist/react/clocks.d.ts.map +1 -0
- package/dist/react/clocks.js +124 -0
- package/dist/react/clocks.js.map +1 -0
- package/dist/react/index.d.ts +7 -2
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +15 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.web.d.ts +9 -2
- package/dist/react/index.web.d.ts.map +1 -1
- package/dist/react/index.web.js +27 -4
- package/dist/react/index.web.js.map +1 -1
- package/dist/react/startSignIn.d.ts +3 -0
- package/dist/react/startSignIn.d.ts.map +1 -0
- package/dist/react/startSignIn.js +19 -0
- package/dist/react/startSignIn.js.map +1 -0
- package/dist/react/useAuctionBidGate.d.ts +54 -4
- package/dist/react/useAuctionBidGate.d.ts.map +1 -1
- package/dist/react/useAuctionBidGate.js +169 -25
- package/dist/react/useAuctionBidGate.js.map +1 -1
- package/dist/react/useAuctionWins.d.ts +9 -1
- package/dist/react/useAuctionWins.d.ts.map +1 -1
- package/dist/react/useAuctionWins.js +9 -3
- package/dist/react/useAuctionWins.js.map +1 -1
- package/dist/react/useGiveawayEntry.d.ts +59 -0
- package/dist/react/useGiveawayEntry.d.ts.map +1 -0
- package/dist/react/useGiveawayEntry.js +170 -0
- package/dist/react/useGiveawayEntry.js.map +1 -0
- package/dist/react/useGiveawayPrize.d.ts +12 -0
- package/dist/react/useGiveawayPrize.d.ts.map +1 -0
- package/dist/react/useGiveawayPrize.js +53 -0
- package/dist/react/useGiveawayPrize.js.map +1 -0
- package/dist/react/useHiddenShows.d.ts +10 -0
- package/dist/react/useHiddenShows.d.ts.map +1 -0
- package/dist/react/useHiddenShows.js +30 -0
- package/dist/react/useHiddenShows.js.map +1 -0
- package/dist/react/useLiveSession.d.ts +7 -3
- package/dist/react/useLiveSession.d.ts.map +1 -1
- package/dist/react/useLiveSession.js +522 -157
- package/dist/react/useLiveSession.js.map +1 -1
- package/dist/react/useLiveShow.d.ts +3 -0
- package/dist/react/useLiveShow.d.ts.map +1 -0
- package/dist/react/useLiveShow.js +21 -0
- package/dist/react/useLiveShow.js.map +1 -0
- package/dist/react/useLiveStreams.d.ts.map +1 -1
- package/dist/react/useLiveStreams.js +6 -2
- package/dist/react/useLiveStreams.js.map +1 -1
- package/dist/react/useOngoingLive.d.ts +1 -0
- package/dist/react/useOngoingLive.d.ts.map +1 -1
- package/dist/react/useOngoingLive.js +7 -1
- package/dist/react/useOngoingLive.js.map +1 -1
- package/dist/react/useReplays.d.ts +12 -0
- package/dist/react/useReplays.d.ts.map +1 -1
- package/dist/react/useReplays.js +56 -24
- package/dist/react/useReplays.js.map +1 -1
- package/dist/react/useStreamInfo.d.ts +13 -2
- package/dist/react/useStreamInfo.d.ts.map +1 -1
- package/dist/react/useStreamInfo.js +31 -5
- package/dist/react/useStreamInfo.js.map +1 -1
- package/dist/replayPages.d.ts +31 -0
- package/dist/replayPages.d.ts.map +1 -0
- package/dist/replayPages.js +34 -0
- package/dist/replayPages.js.map +1 -0
- package/dist/replays.d.ts +7 -0
- package/dist/replays.d.ts.map +1 -1
- package/dist/replays.js +52 -22
- package/dist/replays.js.map +1 -1
- package/dist/session.d.ts +39 -6
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +209 -22
- package/dist/session.js.map +1 -1
- package/dist/sessionTypes.d.ts +190 -14
- package/dist/sessionTypes.d.ts.map +1 -1
- package/dist/sessionTypes.js +2 -1
- package/dist/sessionTypes.js.map +1 -1
- package/dist/shopifyCommerce.d.ts +149 -0
- package/dist/shopifyCommerce.d.ts.map +1 -0
- package/dist/shopifyCommerce.js +123 -0
- package/dist/shopifyCommerce.js.map +1 -0
- package/dist/shopifyIdentity.d.ts +51 -0
- package/dist/shopifyIdentity.d.ts.map +1 -0
- package/dist/shopifyIdentity.js +52 -0
- package/dist/shopifyIdentity.js.map +1 -0
- package/dist/shopifyIds.d.ts +9 -0
- package/dist/shopifyIds.d.ts.map +1 -0
- package/dist/shopifyIds.js +18 -0
- package/dist/shopifyIds.js.map +1 -0
- package/dist/showLinks.d.ts +24 -0
- package/dist/showLinks.d.ts.map +1 -0
- package/dist/showLinks.js +23 -0
- package/dist/showLinks.js.map +1 -0
- package/dist/showLots.d.ts +28 -0
- package/dist/showLots.d.ts.map +1 -0
- package/dist/showLots.js +51 -0
- package/dist/showLots.js.map +1 -0
- package/dist/showNames.d.ts +45 -0
- package/dist/showNames.d.ts.map +1 -0
- package/dist/showNames.js +74 -0
- package/dist/showNames.js.map +1 -0
- package/dist/streams.d.ts +27 -1
- package/dist/streams.d.ts.map +1 -1
- package/dist/streams.js +90 -21
- package/dist/streams.js.map +1 -1
- package/dist/types.d.ts +195 -8
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -1
- package/dist/types.js.map +1 -1
- package/dist/wire.d.ts +31 -0
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +25 -0
- package/dist/wire.js.map +1 -1
- package/dist/zego.d.ts +3 -1
- package/dist/zego.d.ts.map +1 -1
- package/dist/zego.js +1 -1
- package/dist/zegoEngine.d.ts +168 -0
- package/dist/zegoEngine.d.ts.map +1 -0
- package/dist/zegoEngine.js +1052 -0
- package/dist/zegoEngine.js.map +1 -0
- package/package.json +3 -2
package/dist/streams.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streams.d.ts","sourceRoot":"","sources":["../src/streams.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"streams.d.ts","sourceRoot":"","sources":["../src/streams.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,UAAU,EACV,iBAAiB,EAGjB,cAAc,EAGf,MAAM,SAAS,CAAC;AAIjB,KAAK,gBAAgB,GAAG;IACtB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,0FAA0F;IAC1F,iBAAiB,CAAC,EAAE,MAAM,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IACrF,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5B,yFAAyF;IACzF,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACxC,sDAAsD;IACtD,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACzC,cAAc,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAClC,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,CA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,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAMzD;AAiBD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,gBAAgB,GAAG,iBAAiB,GAAG,IAAI,CA4BnF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,EAChD,cAAc,EAAE,MAAM,GACrB,aAAa,EAAE,CAYjB;AAED,wBAAgB,cAAc,CAC5B,GAAG,EAAE,kBAAkB,EACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GAC/C,YAAY,GAAG,IAAI,CAwBrB;AAmBD,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,GAAG,UAAU,CAqC3D;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,cAAc,GAAG,UAAU,EAAE,CAKpE;AAYD,eAAO,MAAM,OAAO,EAAE,cAmDrB,CAAC"}
|
package/dist/streams.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.streams = void 0;
|
|
4
|
+
exports.winnerIdOf = winnerIdOf;
|
|
4
5
|
exports.toLiveStreamProduct = toLiveStreamProduct;
|
|
5
6
|
exports.toGiveawayEntries = toGiveawayEntries;
|
|
6
7
|
exports.toLiveGiveaway = toLiveGiveaway;
|
|
@@ -14,7 +15,12 @@ exports.toLiveStreams = toLiveStreams;
|
|
|
14
15
|
* "misconfigured".
|
|
15
16
|
*/
|
|
16
17
|
const client_1 = require("./client");
|
|
18
|
+
const commentHistory_1 = require("./commentHistory");
|
|
17
19
|
const polls_1 = require("./polls");
|
|
20
|
+
const wire_1 = require("./wire");
|
|
21
|
+
const hiddenShows_1 = require("./hiddenShows");
|
|
22
|
+
const showNames_1 = require("./showNames");
|
|
23
|
+
const showLinks_1 = require("./showLinks");
|
|
18
24
|
// ─── Mappers ─────────────────────────────────────────────────────────────────
|
|
19
25
|
function toStatus(status) {
|
|
20
26
|
if (status === 2)
|
|
@@ -26,6 +32,29 @@ function toStatus(status) {
|
|
|
26
32
|
function toMillis(unix) {
|
|
27
33
|
return unix ? unix * 1000 : null;
|
|
28
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* The winner's bare customer id from the record's `winner`: the number at the end of a GID, or a bare
|
|
37
|
+
* number. Anything else (`"No One Joined"`, absent) is no winner.
|
|
38
|
+
*/
|
|
39
|
+
function winnerIdOf(winner) {
|
|
40
|
+
var _a;
|
|
41
|
+
if (typeof winner !== 'string')
|
|
42
|
+
return null;
|
|
43
|
+
const trimmed = winner.trim();
|
|
44
|
+
const fromGid = /^gid:\/\/[^/]+\/[^/]+\/([^/\s]+)$/.exec(trimmed);
|
|
45
|
+
if (fromGid)
|
|
46
|
+
return (_a = fromGid[1]) !== null && _a !== void 0 ? _a : null;
|
|
47
|
+
return /^\d+$/.test(trimmed) ? trimmed : null;
|
|
48
|
+
}
|
|
49
|
+
/** An ISO time (or epoch ms) as epoch ms; null when missing or unreadable. */
|
|
50
|
+
function toEpochMs(value) {
|
|
51
|
+
if (typeof value === 'number')
|
|
52
|
+
return Number.isFinite(value) && value > 0 ? value : null;
|
|
53
|
+
if (typeof value !== 'string' || !value.trim())
|
|
54
|
+
return null;
|
|
55
|
+
const ms = Date.parse(value);
|
|
56
|
+
return Number.isFinite(ms) ? ms : null;
|
|
57
|
+
}
|
|
29
58
|
/** Numbers arrive as strings on some dashboard fields; anything unparseable is "not set". */
|
|
30
59
|
function toAmount(value) {
|
|
31
60
|
if (value === null || value === undefined || value === '')
|
|
@@ -33,19 +62,6 @@ function toAmount(value) {
|
|
|
33
62
|
const parsed = Number(value);
|
|
34
63
|
return Number.isFinite(parsed) ? parsed : null;
|
|
35
64
|
}
|
|
36
|
-
/**
|
|
37
|
-
* The lot's thumbnail, whichever way the gateway spelled it.
|
|
38
|
-
*
|
|
39
|
-
* A catalogue lot carries `{ url }`; a link lot carries the URL as a plain string — the same
|
|
40
|
-
* inconsistency the giveaway mapper below already had to absorb. Reading only `.url` left every
|
|
41
|
-
* link lot with a blank square where its picture should be.
|
|
42
|
-
*/
|
|
43
|
-
function toThumbnailUrl(value) {
|
|
44
|
-
var _a;
|
|
45
|
-
if (!value)
|
|
46
|
-
return null;
|
|
47
|
-
return typeof value === 'string' ? value : ((_a = value.url) !== null && _a !== void 0 ? _a : null);
|
|
48
|
-
}
|
|
49
65
|
function toLiveStreamProduct(raw) {
|
|
50
66
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
51
67
|
/*
|
|
@@ -62,7 +78,9 @@ function toLiveStreamProduct(raw) {
|
|
|
62
78
|
productGid: `gid://shopify/Product/${storeProductId}`,
|
|
63
79
|
name: (_d = raw.product_name) !== null && _d !== void 0 ? _d : '',
|
|
64
80
|
price: (_e = raw.product_price) !== null && _e !== void 0 ? _e : null,
|
|
65
|
-
|
|
81
|
+
/* A catalogue lot carries `{ url }`, a link lot a plain string. Reading only `.url` left every
|
|
82
|
+
link lot with a blank square where its picture should be. */
|
|
83
|
+
thumbnailUrl: (0, wire_1.imageUrl)(raw.product_thumbnail),
|
|
66
84
|
isCurrent: !!raw.is_current,
|
|
67
85
|
/* `sell_id` on the wire. A string on the gateway even though it reads as a number, so it is
|
|
68
86
|
carried through as one rather than coerced — a leading zero is meaningful to a host reading
|
|
@@ -70,6 +88,7 @@ function toLiveStreamProduct(raw) {
|
|
|
70
88
|
sellId: raw.sell_id != null ? String(raw.sell_id) : null,
|
|
71
89
|
startedAtMs: (_f = raw.start_time) !== null && _f !== void 0 ? _f : null,
|
|
72
90
|
baseBidPrice: toAmount(raw.base_bid_price),
|
|
91
|
+
bidIncrement: toAmount(raw.bid_incrementer),
|
|
73
92
|
winnerCount: (_h = (_g = raw.auction_winner) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0,
|
|
74
93
|
externalUrl,
|
|
75
94
|
};
|
|
@@ -101,17 +120,24 @@ function toLiveGiveaway(raw, meta) {
|
|
|
101
120
|
const storeProductId = raw.store_product_id;
|
|
102
121
|
if (!storeProductId)
|
|
103
122
|
return null;
|
|
104
|
-
|
|
123
|
+
/* `variant_price` is what the gateway writes; 0.9.0 read only `product_variant_price`, which no
|
|
124
|
+
record has, so the price was always null. */
|
|
125
|
+
const price = (_a = toAmount(raw.variant_price)) !== null && _a !== void 0 ? _a : toAmount(raw.product_variant_price);
|
|
105
126
|
return {
|
|
106
127
|
storeProductId,
|
|
107
|
-
variantId: (
|
|
128
|
+
variantId: (_b = raw.variant_id) !== null && _b !== void 0 ? _b : null,
|
|
108
129
|
status: raw.giveawayStatus === 'active' ? 'active' : 'ended',
|
|
109
|
-
productName: (
|
|
110
|
-
|
|
130
|
+
productName: (_c = raw.product_name) !== null && _c !== void 0 ? _c : '',
|
|
131
|
+
/* Passed through raw before 0.9.0, so an object arrived typed as a string. */
|
|
132
|
+
thumbnailUrl: (0, wire_1.imageUrl)(raw.product_thumbnail),
|
|
111
133
|
variantTitle: (_d = raw.product_variant_title) !== null && _d !== void 0 ? _d : null,
|
|
112
134
|
variantPrice: price === null ? null : String(price),
|
|
135
|
+
variantImageUrl: (0, wire_1.imageUrl)(raw.variant_image),
|
|
136
|
+
startedAtMs: toEpochMs(raw.giveawayStartTime),
|
|
137
|
+
winnerId: winnerIdOf(raw.winner),
|
|
138
|
+
// Names the room will show: never an email (`publicName`).
|
|
113
139
|
entrantNames: ((_e = raw.users) !== null && _e !== void 0 ? _e : [])
|
|
114
|
-
.map((user) => { var _a; return (_a = user === null || user === void 0 ? void 0 : user.displayName) !== null && _a !== void 0 ? _a : ''; })
|
|
140
|
+
.map((user) => { var _a; return (_a = (0, showNames_1.publicName)(user === null || user === void 0 ? void 0 : user.displayName)) !== null && _a !== void 0 ? _a : ''; })
|
|
115
141
|
.filter((name) => !!name),
|
|
116
142
|
entries: toGiveawayEntries(meta, storeProductId),
|
|
117
143
|
};
|
|
@@ -129,8 +155,13 @@ function toMutedDeviceIds(raw) {
|
|
|
129
155
|
.map((entry) => entry === null || entry === void 0 ? void 0 : entry.deviceId)
|
|
130
156
|
.filter((id) => typeof id === 'string' && id.length > 0);
|
|
131
157
|
}
|
|
158
|
+
function toReturnable(raw) {
|
|
159
|
+
var _a;
|
|
160
|
+
const value = (_a = raw.meta) === null || _a === void 0 ? void 0 : _a.returnable;
|
|
161
|
+
return value === 'returnable' || value === 'non_returnable' ? value : null;
|
|
162
|
+
}
|
|
132
163
|
function toLiveStream(raw) {
|
|
133
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
164
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
134
165
|
const multiplier = Number((_b = (_a = raw.meta) === null || _a === void 0 ? void 0 : _a.viewMultiplier) !== null && _b !== void 0 ? _b : 1);
|
|
135
166
|
const extendedBidding = Number((_c = raw.ext_bidding_duration) !== null && _c !== void 0 ? _c : 0);
|
|
136
167
|
return {
|
|
@@ -155,14 +186,17 @@ function toLiveStream(raw) {
|
|
|
155
186
|
.filter((p) => !!p),
|
|
156
187
|
productSegments: (_m = raw.product_segments) !== null && _m !== void 0 ? _m : [],
|
|
157
188
|
bidCap: toAmount((_o = raw.meta) === null || _o === void 0 ? void 0 : _o.biddingCap),
|
|
189
|
+
minimumBidIncrement: toAmount((_p = raw.meta) === null || _p === void 0 ? void 0 : _p.minimumBidIncrement),
|
|
158
190
|
extendedBiddingMs: Number.isFinite(extendedBidding) && extendedBidding > 0 ? extendedBidding : 0,
|
|
159
191
|
/* Both off the same document: the gateway attaches the Poll row as it stands, and its field names
|
|
160
192
|
are the ones these two already read, so the question and the tally arrive together. */
|
|
161
193
|
poll: (0, polls_1.toLivePoll)(raw.poll),
|
|
162
194
|
pollResults: (0, polls_1.toEmbeddedResults)(raw.poll),
|
|
163
|
-
giveaways: ((
|
|
195
|
+
giveaways: ((_r = (_q = raw.meta) === null || _q === void 0 ? void 0 : _q.giveawayProducts) !== null && _r !== void 0 ? _r : [])
|
|
164
196
|
.map((giveaway) => toLiveGiveaway(giveaway, raw.meta))
|
|
165
197
|
.filter((giveaway) => !!giveaway),
|
|
198
|
+
returnable: toReturnable(raw),
|
|
199
|
+
pinnedComment: (0, wire_1.toPinnedComment)(raw.pinned_comment),
|
|
166
200
|
};
|
|
167
201
|
}
|
|
168
202
|
function toLiveStreams(response) {
|
|
@@ -173,6 +207,13 @@ function toLiveStreams(response) {
|
|
|
173
207
|
.sort((a, b) => { var _a, _b; return ((_a = a.scheduledAtMs) !== null && _a !== void 0 ? _a : 0) - ((_b = b.scheduledAtMs) !== null && _b !== void 0 ? _b : 0); });
|
|
174
208
|
}
|
|
175
209
|
// ─── Namespace ─────────────────────────────────────────────────────────────
|
|
210
|
+
/**
|
|
211
|
+
* Shows that ended with a recording, by streaming id, as `destinationFor` read them: a recording,
|
|
212
|
+
* once it exists, doesn't change, so a second tap on the same link needs no read. Only the record is
|
|
213
|
+
* kept, never the answer: whether the viewer may see the show is asked again each time, as it turns on
|
|
214
|
+
* who is signed in (a team member's answer must not reach the next shopper on the same phone).
|
|
215
|
+
*/
|
|
216
|
+
const endedWithRecording = new Map();
|
|
176
217
|
exports.streams = {
|
|
177
218
|
async list() {
|
|
178
219
|
var _a;
|
|
@@ -197,5 +238,33 @@ exports.streams = {
|
|
|
197
238
|
});
|
|
198
239
|
return (_a = body === null || body === void 0 ? void 0 : body.data) !== null && _a !== void 0 ? _a : null;
|
|
199
240
|
},
|
|
241
|
+
async commentHistory(streamingId) {
|
|
242
|
+
if (!streamingId)
|
|
243
|
+
return [];
|
|
244
|
+
const body = await (0, client_1.liveSellingRequest)('/live-streaming/comments', {
|
|
245
|
+
params: { streaming_id: streamingId, limit: commentHistory_1.COMMENT_HISTORY_FETCH_LIMIT },
|
|
246
|
+
});
|
|
247
|
+
return (0, commentHistory_1.toCommentHistory)(body === null || body === void 0 ? void 0 : body.data);
|
|
248
|
+
},
|
|
249
|
+
async destinationFor(streamingId, options) {
|
|
250
|
+
var _a;
|
|
251
|
+
if (!streamingId)
|
|
252
|
+
return { destination: { to: 'showList' }, show: null, readError: null };
|
|
253
|
+
let record = (_a = endedWithRecording.get(streamingId)) !== null && _a !== void 0 ? _a : null;
|
|
254
|
+
let readError = null;
|
|
255
|
+
if (!record) {
|
|
256
|
+
try {
|
|
257
|
+
record = await exports.streams.byId(streamingId);
|
|
258
|
+
}
|
|
259
|
+
catch (caught) {
|
|
260
|
+
readError = caught;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
if (record && record.status === 'ended' && record.replayFeedId)
|
|
264
|
+
endedWithRecording.set(streamingId, record);
|
|
265
|
+
// A show hidden from this viewer is handed out nowhere, its record included: as if there were none.
|
|
266
|
+
const visible = record && !(0, hiddenShows_1.isHiddenFrom)(record, options === null || options === void 0 ? void 0 : options.viewerEmail, (0, client_1.hiddenShowsRule)()) ? record : null;
|
|
267
|
+
return { destination: (0, showLinks_1.showLinkDestination)(visible), show: visible, readError };
|
|
268
|
+
},
|
|
200
269
|
};
|
|
201
270
|
//# sourceMappingURL=streams.js.map
|
package/dist/streams.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streams.js","sourceRoot":"","sources":["../src/streams.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"streams.js","sourceRoot":"","sources":["../src/streams.ts"],"names":[],"mappings":";;;AAqIA,gCAMC;AAiBD,kDA4BC;AAOD,8CAeC;AAED,wCA2BC;AAmBD,oCAqCC;AAED,sCAKC;AA1SD;;;;;;GAMG;AACH,qCAAwF;AACxF,qDAAiF;AACjF,mCAAwD;AACxD,iCAAmD;AACnD,+CAA6C;AAC7C,2CAAyC;AACzC,2CAAkD;AAwGlD,gFAAgF;AAEhF,SAAS,QAAQ,CAAC,MAAc;IAC9B,IAAI,MAAM,KAAK,CAAC;QA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CAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,WAAmB,EAAE,OAAyC;;QACjF,IAAI,CAAC,WAAW;YAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC1F,IAAI,MAAM,GAAG,MAAA,kBAAkB,CAAC,GAAG,CAAC,WAAW,CAAC,mCAAI,IAAI,CAAC;QACzD,IAAI,SAAS,GAAY,IAAI,CAAC;QAC9B,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,IAAI,CAAC;gBACH,MAAM,GAAG,MAAM,eAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC3C,CAAC;YAAC,OAAO,MAAM,EAAE,CAAC;gBAChB,SAAS,GAAG,MAAM,CAAC;YACrB,CAAC;QACH,CAAC;QACD,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO,IAAI,MAAM,CAAC,YAAY;YAAE,kBAAkB,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QAC5G,oGAAoG;QACpG,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAA,0BAAY,EAAC,MAAM,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAE,IAAA,wBAAe,GAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;QACzG,OAAO,EAAE,WAAW,EAAE,IAAA,+BAAmB,EAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IACjF,CAAC;CACF,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Nothing here imports React, React Native or Zego, so the pure data layer typechecks and runs in any
|
|
9
9
|
* JavaScript runtime. Product ids are Shopify GIDs (`gid://shopify/Product/…`), ready to hand to a
|
|
10
|
-
* Storefront client such as `@tiledev/sdk-shopify
|
|
10
|
+
* Storefront client such as `@tiledev/sdk-shopify`. This package resolves a product only through the
|
|
11
|
+
* commerce adapter the app gives it (`createShopifyLiveCommerce` builds one on the app's own client).
|
|
11
12
|
*/
|
|
12
13
|
/**
|
|
13
14
|
* Minimal async key/value store. Satisfied by React Native's AsyncStorage as-is, and by a thin
|
|
@@ -85,8 +86,28 @@ export interface LiveSellingConfig {
|
|
|
85
86
|
* product is reasonable; a room showing the wrong one is not.
|
|
86
87
|
*/
|
|
87
88
|
strictActiveProduct?: boolean;
|
|
88
|
-
/**
|
|
89
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Milliseconds before any request to the gateway (or the replay-comment CDN) is given up on, with a
|
|
91
|
+
* `LiveSellingTimeoutError`. Defaults to 10 000. Zero, negative or non-numbers mean the default.
|
|
92
|
+
*/
|
|
93
|
+
requestTimeoutMs?: number;
|
|
94
|
+
/**
|
|
95
|
+
* Milliseconds the session waits, with no live record and not connecting, before its status
|
|
96
|
+
* becomes `ended`. Defaults to 4 000. Without it a session whose record never arrives — nothing on
|
|
97
|
+
* air, or a deep link to a show that has gone — spins on `loading` for ever. A forced record read
|
|
98
|
+
* (`refreshStreamRecords()`) starts the wait again, so a stale record cannot end a show that has
|
|
99
|
+
* only just started.
|
|
100
|
+
*/
|
|
101
|
+
offAirGraceMs?: number;
|
|
102
|
+
/**
|
|
103
|
+
* Backs the durable ids, the remembered poll votes, the signed-out shopper's name and the accepted
|
|
104
|
+
* auction terms: `AsyncStorage` on a phone, `window.localStorage` on the web.
|
|
105
|
+
*
|
|
106
|
+
* **Required since 0.9.0**, and `configure` throws without it. It was optional, with an in-memory
|
|
107
|
+
* store on a phone, and two of the three apps on this package shipped without it: every relaunch
|
|
108
|
+
* forgot the votes, and the gateway doesn't dedupe votes, so a forgotten vote is counted twice.
|
|
109
|
+
*/
|
|
110
|
+
storage: StorageAdapter;
|
|
90
111
|
/** Defaults to a silent no-op. */
|
|
91
112
|
logger?: Logger;
|
|
92
113
|
/** See {@link CustomerAccountRequest}. Only the unpaid-wins helpers use it. */
|
|
@@ -108,10 +129,37 @@ export interface LiveSellingConfig {
|
|
|
108
129
|
* (foreground, `refresh()`, `refreshOngoingLive()`). See `ongoingLive.ts`.
|
|
109
130
|
*/
|
|
110
131
|
ongoingLivePolling?: import('./ongoingLive').OngoingLivePolling;
|
|
132
|
+
/**
|
|
133
|
+
* Shows to keep from shoppers: a team's practice runs on the store's real gateway, which has no
|
|
134
|
+
* "draft" or "hidden" setting of its own. Unset: nothing is hidden. See {@link HiddenShows}.
|
|
135
|
+
*/
|
|
136
|
+
hiddenShows?: HiddenShows;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Which shows a viewer never sees (0.9.0). A show is hidden when its title contains any of
|
|
140
|
+
* `titleIncludes` (in any case), unless the viewer is signed in with an email at one of
|
|
141
|
+
* `visibleToEmailDomains`.
|
|
142
|
+
*
|
|
143
|
+
* What it reaches: every hook that hands out shows (`useReplays`, `useOngoingLive`, `useLiveStreams`,
|
|
144
|
+
* `useStreamInfo` and so the session, which then never joins a hidden show's room) and
|
|
145
|
+
* `streams.destinationFor`. The imperative reads (`streams.list`, `ongoing`, `byId`, `replays.list`)
|
|
146
|
+
* stay the gateway's, unfiltered. The viewer is `LiveSellingProvider`'s `viewerEmail`.
|
|
147
|
+
*
|
|
148
|
+
* It hides shows in the app only: anyone with the company id can still ask the gateway for them.
|
|
149
|
+
*/
|
|
150
|
+
export interface HiddenShows {
|
|
151
|
+
/** A show whose title contains any of these, in any case, is hidden. Amore: `['apptiletest']`. */
|
|
152
|
+
titleIncludes: string[];
|
|
153
|
+
/**
|
|
154
|
+
* Email domains that still see hidden shows, without the @: `['apptile.io']` lets
|
|
155
|
+
* `host@apptile.io` see them, and not `host@apptile.io.example.com`. A signed-out viewer never does.
|
|
156
|
+
*/
|
|
157
|
+
visibleToEmailDomains: string[];
|
|
111
158
|
}
|
|
112
159
|
export type LiveStreamStatus = 'live' | 'scheduled' | 'ended';
|
|
113
160
|
/** How one reaction tap animates: `single` is one emoji, `multiple` a burst. Per stream. */
|
|
114
161
|
export type ReactionStyle = 'single' | 'multiple';
|
|
162
|
+
export type LiveStreamReturnable = 'returnable' | 'non_returnable';
|
|
115
163
|
export interface LiveStreamProduct {
|
|
116
164
|
/**
|
|
117
165
|
* How a lot is matched to a product, and the key everything else joins on.
|
|
@@ -131,6 +179,12 @@ export interface LiveStreamProduct {
|
|
|
131
179
|
startedAtMs: number | null;
|
|
132
180
|
/** Auction only: opening bid, or null on a lot the host has not priced. */
|
|
133
181
|
baseBidPrice: number | null;
|
|
182
|
+
/**
|
|
183
|
+
* Auction only: the lot's bid step (`bid_incrementer`), or null when the host set none. On a lot with
|
|
184
|
+
* no opening bid, the first bid is this step (`openingBidFor`). Optional, so a record built by hand
|
|
185
|
+
* still type-checks.
|
|
186
|
+
*/
|
|
187
|
+
bidIncrement?: number | null;
|
|
134
188
|
/** Auction only: rounds already won on this lot. Non-zero means bidding closed. */
|
|
135
189
|
winnerCount: number;
|
|
136
190
|
/**
|
|
@@ -171,8 +225,30 @@ export interface LiveGiveaway {
|
|
|
171
225
|
productName: string;
|
|
172
226
|
thumbnailUrl: string | null;
|
|
173
227
|
variantTitle: string | null;
|
|
174
|
-
/**
|
|
228
|
+
/**
|
|
229
|
+
* Retail price, struck through beside FREE: the record's `variant_price` (`"22.0"`). Read since
|
|
230
|
+
* 0.9.0; before, the SDK looked only for `product_variant_price`, which no record carries (none of
|
|
231
|
+
* the 24 giveaways on Amore's 20 latest recorded shows, read 2026-10-06), so this was always null.
|
|
232
|
+
*/
|
|
175
233
|
variantPrice: string | null;
|
|
234
|
+
/**
|
|
235
|
+
* The given-away variant's own photo (`variant_image`), where `thumbnailUrl` is the product's. Null
|
|
236
|
+
* when the record has none. Since 0.9.0; optional so a giveaway built by hand (a test's) still fits.
|
|
237
|
+
*/
|
|
238
|
+
variantImageUrl?: string | null;
|
|
239
|
+
/**
|
|
240
|
+
* When the host started this giveaway (`giveawayStartTime`), epoch ms; null when the record has no
|
|
241
|
+
* readable time. Two giveaways of the same product in one show differ by it, so it is what tells
|
|
242
|
+
* them apart. Since 0.9.0; optional so a giveaway built by hand (a test's) still fits.
|
|
243
|
+
*/
|
|
244
|
+
startedAtMs?: number | null;
|
|
245
|
+
/**
|
|
246
|
+
* Who won, once drawn: the bare customer id of the record's `winner` (`"gid://shopify/Customer/42"`
|
|
247
|
+
* → `"42"`, the id `identity.bidderId` gives). Null while open, and for a draw nobody entered (the
|
|
248
|
+
* record says `"No One Joined"`). Every drawn giveaway on shows `h2rorgm7po` and `dq9r6hd8ml` has it
|
|
249
|
+
* (read 2026-10-06). Since 0.9.0; optional so a giveaway built by hand (a test's) still fits.
|
|
250
|
+
*/
|
|
251
|
+
winnerId?: string | null;
|
|
176
252
|
/** The roster the host keeps on the lot, for the winner-roll animation. */
|
|
177
253
|
entrantNames: string[];
|
|
178
254
|
entries: GiveawayEntry[];
|
|
@@ -206,7 +282,10 @@ export interface LiveStream {
|
|
|
206
282
|
*/
|
|
207
283
|
replayFeedId: string | null;
|
|
208
284
|
isAuction: boolean;
|
|
209
|
-
/**
|
|
285
|
+
/**
|
|
286
|
+
* Epoch ms the stream went live, or null when it has not started. The show's clock counts up from it
|
|
287
|
+
* (`useShowClock(stream.startedAtMs)`), read against the phone's clock as `elapsedMs` always was.
|
|
288
|
+
*/
|
|
210
289
|
startedAtMs: number | null;
|
|
211
290
|
scheduledAtMs: number | null;
|
|
212
291
|
hostName: string | null;
|
|
@@ -230,6 +309,11 @@ export interface LiveStream {
|
|
|
230
309
|
productSegments: ProductSegment[];
|
|
231
310
|
/** Auction only: highest bid the host will accept, or null for no ceiling. */
|
|
232
311
|
bidCap: number | null;
|
|
312
|
+
/**
|
|
313
|
+
* Auction only: the show's smallest bid step (`meta.minimumBidIncrement`), or null. The first bid on a
|
|
314
|
+
* lot with neither an opening bid nor a step of its own. Optional, so a record built by hand still type-checks.
|
|
315
|
+
*/
|
|
316
|
+
minimumBidIncrement?: number | null;
|
|
233
317
|
/** Auction only: ms a late bid adds to the clock. 0 when the host disabled extended bidding. */
|
|
234
318
|
extendedBiddingMs: number;
|
|
235
319
|
/** Every giveaway the host has run on this stream, active and finished. */
|
|
@@ -244,6 +328,23 @@ export interface LiveStream {
|
|
|
244
328
|
*/
|
|
245
329
|
poll: LivePoll | null;
|
|
246
330
|
pollResults: LivePollResults | null;
|
|
331
|
+
/** The show's returns setting, from `meta.returnable`. Null means each product decides. */
|
|
332
|
+
returnable: LiveStreamReturnable | null;
|
|
333
|
+
/**
|
|
334
|
+
* The comment the host or a moderator pinned, from the record's `pinned_comment`. Null when nothing
|
|
335
|
+
* is pinned, or the saved pin has no id or no text. The room announces changes with a
|
|
336
|
+
* `pinnedCommentChanged` event; read `session.pinnedComment`, which joins the two.
|
|
337
|
+
*/
|
|
338
|
+
pinnedComment: LivePinnedComment | null;
|
|
339
|
+
}
|
|
340
|
+
/** One pinned comment. Text only: the gateway also sends the author's name, which nothing shows. */
|
|
341
|
+
export interface LivePinnedComment {
|
|
342
|
+
id: string;
|
|
343
|
+
/**
|
|
344
|
+
* The words. A broadcast longer than Zego's 1024 bytes arrives cut, ending in "…"; the record keeps
|
|
345
|
+
* the whole text, and the next record read replaces the cut one.
|
|
346
|
+
*/
|
|
347
|
+
text: string;
|
|
247
348
|
}
|
|
248
349
|
export declare const COMMENT_SOURCES: readonly ["USER", "MODERATOR", "HOST", "TIP"];
|
|
249
350
|
export type CommentSource = (typeof COMMENT_SOURCES)[number];
|
|
@@ -287,6 +388,12 @@ export interface LivePoll {
|
|
|
287
388
|
options: LivePollOption[];
|
|
288
389
|
/** The option ids exactly as they arrived, by normalised id — a vote must echo the original type. */
|
|
289
390
|
wireOptionIds: Record<string, string | number>;
|
|
391
|
+
/**
|
|
392
|
+
* The poll's `status` as the gateway wrote it (`"active"` while it runs), or null when it sent none.
|
|
393
|
+
* The session raises a poll off the RECORD only while this is `"active"` or absent. Since 0.9.0;
|
|
394
|
+
* optional so a poll built by hand (a test's) still fits.
|
|
395
|
+
*/
|
|
396
|
+
status?: string | null;
|
|
290
397
|
}
|
|
291
398
|
export interface LivePollResults {
|
|
292
399
|
pollUuid: string | null;
|
|
@@ -312,10 +419,19 @@ export interface AuctionWinItem {
|
|
|
312
419
|
winningBid: number;
|
|
313
420
|
isGiveaway: boolean;
|
|
314
421
|
discountCode: string | null;
|
|
422
|
+
/**
|
|
423
|
+
* The show this lot was won on. A customer can owe on more than one show at once (a giveaway has no
|
|
424
|
+
* unpaid-wins gate), so the items of one {@link AuctionWins} do not all share its `streamingId`.
|
|
425
|
+
*/
|
|
426
|
+
streamingId: string;
|
|
315
427
|
}
|
|
316
428
|
export interface AuctionWins {
|
|
317
|
-
/**
|
|
429
|
+
/**
|
|
430
|
+
* The stream the tab is settled against — `auction_id` on the checkout cart. The first stream with
|
|
431
|
+
* something payable; `items` can come from more streams than this one, and each names its own.
|
|
432
|
+
*/
|
|
318
433
|
streamingId: string;
|
|
434
|
+
/** Every unpaid lot from every stream: stream by stream in the metafield's key order, then entry order. */
|
|
319
435
|
items: AuctionWinItem[];
|
|
320
436
|
}
|
|
321
437
|
export interface Replay {
|
|
@@ -331,8 +447,17 @@ export interface Replay {
|
|
|
331
447
|
publishedAt: string | null;
|
|
332
448
|
}
|
|
333
449
|
export interface ReplayFeed {
|
|
450
|
+
/** The page's finished recordings that have a playlist, in the gateway's order. */
|
|
334
451
|
replays: Replay[];
|
|
452
|
+
/** The gateway has more after this page. Always false after an empty page. */
|
|
335
453
|
hasMore: boolean;
|
|
454
|
+
/**
|
|
455
|
+
* How many entries the gateway sent for this page, before anything was dropped (no playlist, not a
|
|
456
|
+
* finished livestream). The next page's offset moves by this, never by `replays.length`: moving by
|
|
457
|
+
* what was kept asks for entries already read, and a page where nothing is kept would be asked for
|
|
458
|
+
* again forever.
|
|
459
|
+
*/
|
|
460
|
+
receivedCount: number;
|
|
336
461
|
}
|
|
337
462
|
export interface ReplaySegment {
|
|
338
463
|
productGid: string;
|
|
@@ -456,6 +581,11 @@ export type LiveEvent = {
|
|
|
456
581
|
endsAtMs: number | null;
|
|
457
582
|
serverNowMs: number;
|
|
458
583
|
leader: BidLeader | null;
|
|
584
|
+
/**
|
|
585
|
+
* Who to send bids to, when the host's bid info names one (`data.moderatorInCharge`). The
|
|
586
|
+
* gateway does not send it today — only `START_BIDDING` does — so this is null until it does.
|
|
587
|
+
*/
|
|
588
|
+
moderatorId: string | null;
|
|
459
589
|
} | {
|
|
460
590
|
type: 'biddingClosed';
|
|
461
591
|
} | {
|
|
@@ -503,6 +633,15 @@ export type LiveEvent = {
|
|
|
503
633
|
} | {
|
|
504
634
|
type: 'mixer';
|
|
505
635
|
active: boolean;
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* The host pinned, replaced or unpinned a comment — `PINNED_COMMENT_CHANGED` on the broadcast
|
|
639
|
+
* channel. `comment` is null for an unpin, and for a pin with no id or no text (a blank banner is
|
|
640
|
+
* worse than none).
|
|
641
|
+
*/
|
|
642
|
+
| {
|
|
643
|
+
type: 'pinnedCommentChanged';
|
|
644
|
+
comment: LivePinnedComment | null;
|
|
506
645
|
} | {
|
|
507
646
|
type: 'unknown';
|
|
508
647
|
channel: string;
|
|
@@ -582,6 +721,47 @@ export interface LiveStreamsAPI {
|
|
|
582
721
|
byId(streamingId: string): Promise<LiveStream | null>;
|
|
583
722
|
/** The anonymous Zego room credential for this viewer. */
|
|
584
723
|
zegoToken(viewerId: string, streamingId: string): Promise<string | null>;
|
|
724
|
+
/**
|
|
725
|
+
* What the room said before this viewer arrived: the last 40 lines of a show that is on air, oldest
|
|
726
|
+
* first, with the gateway's duplicate rows collapsed and muted lines left out. `isOwn` is always
|
|
727
|
+
* false here — the stored rows cannot say which device wrote them. The session puts these in front
|
|
728
|
+
* of `session.comments` by itself; call this only to show history without a session.
|
|
729
|
+
*/
|
|
730
|
+
commentHistory(streamingId: string): Promise<LiveComment[]>;
|
|
731
|
+
/**
|
|
732
|
+
* Where a link about a show should take this viewer (0.9.0): one read of the show's record. On air:
|
|
733
|
+
* the live player. Ended with a recording: the replay. Anything else (scheduled, ended with no
|
|
734
|
+
* recording, unknown, unreadable, or hidden from this viewer by `hiddenShows`): the list of shows.
|
|
735
|
+
* Never throws. A show's recording, once it exists, is remembered for the rest of the app's run.
|
|
736
|
+
*/
|
|
737
|
+
destinationFor(streamingId: string, options?: {
|
|
738
|
+
viewerEmail?: string | null;
|
|
739
|
+
}): Promise<ShowLinkAnswer>;
|
|
740
|
+
}
|
|
741
|
+
/** Where a link about a show goes. The app maps each to a screen of its own. */
|
|
742
|
+
export type ShowLinkDestination =
|
|
743
|
+
/** The show is on air: the live player. */
|
|
744
|
+
{
|
|
745
|
+
to: 'livePlayer';
|
|
746
|
+
}
|
|
747
|
+
/** The show has ended and has a recording: its replay, by `Replay.id`. */
|
|
748
|
+
| {
|
|
749
|
+
to: 'replay';
|
|
750
|
+
feedId: string;
|
|
751
|
+
}
|
|
752
|
+
/** Nothing to play: the list of shows, which says what is on now and what has been. */
|
|
753
|
+
| {
|
|
754
|
+
to: 'showList';
|
|
755
|
+
};
|
|
756
|
+
export interface ShowLinkAnswer {
|
|
757
|
+
destination: ShowLinkDestination;
|
|
758
|
+
/**
|
|
759
|
+
* The record the answer was read from, so its poster and title can stand in while a session reads
|
|
760
|
+
* its own. Null when the show is unknown, the read failed, or it is hidden from this viewer.
|
|
761
|
+
*/
|
|
762
|
+
show: LiveStream | null;
|
|
763
|
+
/** Why the read failed, when it did (the answer is then the list of shows); null otherwise. Not logged. */
|
|
764
|
+
readError: unknown;
|
|
585
765
|
}
|
|
586
766
|
export interface AuctionsAPI {
|
|
587
767
|
/** Records a bid against the stream. Fire-and-forget; the round is decided by the host's broadcast. */
|
|
@@ -610,7 +790,10 @@ export interface AuctionsAPI {
|
|
|
610
790
|
acceptTerms(): Promise<void>;
|
|
611
791
|
/** Streams the customer owes on. Needs `customerAccountRequest`; `[]` without it. Never throws. */
|
|
612
792
|
unpaidStreamIds(): Promise<string[]>;
|
|
613
|
-
/**
|
|
793
|
+
/**
|
|
794
|
+
* Everything the customer has won and not checked out, across every stream with something payable.
|
|
795
|
+
* Needs `customerAccountRequest`; null without it, or when nothing is owed.
|
|
796
|
+
*/
|
|
614
797
|
wins(): Promise<AuctionWins | null>;
|
|
615
798
|
/** Whether bidding is blocked by an unsettled previous auction. Pure. */
|
|
616
799
|
isBiddingBlocked(unpaidStreamIds: string[], streamingId: string | null): boolean;
|
|
@@ -638,7 +821,11 @@ export interface ReplaysAPI {
|
|
|
638
821
|
list(limit?: number, offset?: number): Promise<ReplayFeed>;
|
|
639
822
|
/** Product windows for a recording, keyed by shoppable_feed_id. */
|
|
640
823
|
segments(feedId: string): Promise<ReplaySegment[]>;
|
|
641
|
-
/**
|
|
824
|
+
/**
|
|
825
|
+
* The chat a recording had while it was live, in the order said: the static file
|
|
826
|
+
* `https://cdn.apptile.io/assets/live-replay-comments/<streamingId>.json`. A show nobody talked
|
|
827
|
+
* during has no file (the CDN answers 403), which is an empty list, not an error.
|
|
828
|
+
*/
|
|
642
829
|
comments(streamingId: string): Promise<ReplayComment[]>;
|
|
643
830
|
/** Records a play. Fire-and-forget. */
|
|
644
831
|
incrementViews(feedId: string): Promise<void>;
|