@tiledev/sdk-apptile-live-selling 0.16.0-beta.0 → 0.16.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 +5 -1
- package/dist/attribution.d.ts +16 -2
- package/dist/attribution.d.ts.map +1 -1
- package/dist/attribution.js +10 -4
- package/dist/attribution.js.map +1 -1
- package/dist/auctions.d.ts.map +1 -1
- package/dist/auctions.js +2 -1
- package/dist/auctions.js.map +1 -1
- package/dist/cartAttributes.d.ts +10 -0
- package/dist/cartAttributes.d.ts.map +1 -1
- package/dist/cartAttributes.js +20 -1
- package/dist/cartAttributes.js.map +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -12
- package/dist/index.js.map +1 -1
- package/dist/liveShow.d.ts +7 -0
- package/dist/liveShow.d.ts.map +1 -1
- package/dist/liveShow.js +10 -0
- package/dist/liveShow.js.map +1 -1
- package/dist/missedPolls.d.ts +27 -0
- package/dist/missedPolls.d.ts.map +1 -0
- package/dist/missedPolls.js +16 -0
- package/dist/missedPolls.js.map +1 -0
- package/dist/pageOptions.d.ts +16 -1
- package/dist/pageOptions.d.ts.map +1 -1
- package/dist/pageOptions.js +22 -1
- package/dist/pageOptions.js.map +1 -1
- package/dist/react/LiveSellingProvider.d.ts +9 -1
- package/dist/react/LiveSellingProvider.d.ts.map +1 -1
- package/dist/react/LiveSellingProvider.js +7 -4
- package/dist/react/LiveSellingProvider.js.map +1 -1
- package/dist/react/shopifyProviders.d.ts +12 -4
- package/dist/react/shopifyProviders.d.ts.map +1 -1
- package/dist/react/shopifyProviders.js +10 -7
- package/dist/react/shopifyProviders.js.map +1 -1
- package/dist/react/useLiveAuction.d.ts.map +1 -1
- package/dist/react/useLiveAuction.js +3 -1
- package/dist/react/useLiveAuction.js.map +1 -1
- package/dist/react/useLiveChat.d.ts +0 -5
- package/dist/react/useLiveChat.d.ts.map +1 -1
- package/dist/react/useLiveChat.js +11 -12
- package/dist/react/useLiveChat.js.map +1 -1
- package/dist/react/useLivePage.d.ts +0 -4
- package/dist/react/useLivePage.d.ts.map +1 -1
- package/dist/react/useLiveSession.d.ts.map +1 -1
- package/dist/react/useLiveSession.js +51 -0
- package/dist/react/useLiveSession.js.map +1 -1
- package/dist/react/useLiveShop.d.ts +2 -1
- package/dist/react/useLiveShop.d.ts.map +1 -1
- package/dist/react/useLiveShop.js +4 -2
- package/dist/react/useLiveShop.js.map +1 -1
- package/dist/react/useReplayPage.d.ts.map +1 -1
- package/dist/react/useReplayPage.js +7 -5
- package/dist/react/useReplayPage.js.map +1 -1
- package/dist/react/useStreamInfo.d.ts.map +1 -1
- package/dist/react/useStreamInfo.js +5 -3
- package/dist/react/useStreamInfo.js.map +1 -1
- package/dist/shopifyCommerce.d.ts.map +1 -1
- package/dist/shopifyCommerce.js +3 -0
- package/dist/shopifyCommerce.js.map +1 -1
- package/dist/showCredit.d.ts +4 -2
- package/dist/showCredit.d.ts.map +1 -1
- package/dist/showCredit.js +2 -2
- package/dist/showCredit.js.map +1 -1
- package/dist/showLots.d.ts +16 -0
- package/dist/showLots.d.ts.map +1 -1
- package/dist/showLots.js +19 -0
- package/dist/showLots.js.map +1 -1
- package/dist/silentAuctionRules.d.ts +19 -2
- package/dist/silentAuctionRules.d.ts.map +1 -1
- package/dist/silentAuctionRules.js +16 -5
- package/dist/silentAuctionRules.js.map +1 -1
- package/dist/storeData.d.ts +7 -36
- package/dist/storeData.d.ts.map +1 -1
- package/dist/storeData.js +14 -30
- package/dist/storeData.js.map +1 -1
- package/dist/ui/LiveBubble.d.ts +7 -1
- package/dist/ui/LiveBubble.d.ts.map +1 -1
- package/dist/ui/LiveBubble.js +19 -4
- package/dist/ui/LiveBubble.js.map +1 -1
- package/dist/unreadRoomMessages.d.ts +26 -0
- package/dist/unreadRoomMessages.d.ts.map +1 -0
- package/dist/unreadRoomMessages.js +62 -0
- package/dist/unreadRoomMessages.js.map +1 -0
- package/dist/viewerRules.d.ts +7 -8
- package/dist/viewerRules.d.ts.map +1 -1
- package/dist/viewerRules.js +9 -9
- package/dist/viewerRules.js.map +1 -1
- package/dist/winsAttribution.d.ts +22 -0
- package/dist/winsAttribution.d.ts.map +1 -0
- package/dist/winsAttribution.js +49 -0
- package/dist/winsAttribution.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Room messages this version doesn't read (0.16.0, ENG-969, 2026-10-26).
|
|
3
|
+
*
|
|
4
|
+
* The engine hands the session every room message it doesn't know as `{ type: 'unknown', channel,
|
|
5
|
+
* payload }`, and the session used to drop them. A poll opened mid-show never reached the screen, and
|
|
6
|
+
* nothing said what the room had sent instead. Now the session reports the first message of each kind
|
|
7
|
+
* per show to the app's `onWarning` (`LiveSellingProvider`'s, the app's Sentry; the console without one):
|
|
8
|
+
* a dashboard that renames or moves a message shows up in the app's own logs, once, rather than as a
|
|
9
|
+
* feature that silently stops.
|
|
10
|
+
*
|
|
11
|
+
* Pure, so it loads in plain Node for tests.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* What kind of message it is, for telling one kind from another: its own name (`type`, `command`,
|
|
15
|
+
* `event` or `action`), else its keys in order, on the channel it came by.
|
|
16
|
+
*/
|
|
17
|
+
export declare function roomMessageKind(channel: string, payload: unknown): string;
|
|
18
|
+
/** The message as the report carries it: JSON, cut at `MAX_REPORTED_CHARACTERS`. */
|
|
19
|
+
export declare function reportedCopyOf(payload: unknown): string;
|
|
20
|
+
/** Remembers which kinds were reported, so each is reported once (a show's session makes a new one). */
|
|
21
|
+
export declare class UnreadRoomMessages {
|
|
22
|
+
private readonly reported;
|
|
23
|
+
/** The message's kind the first time one of its kind arrives; null after that. */
|
|
24
|
+
firstOfItsKind(channel: string, payload: unknown): string | null;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=unreadRoomMessages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unreadRoomMessages.d.ts","sourceRoot":"","sources":["../src/unreadRoomMessages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAOzE;AAED,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAQvD;AAED,wGAAwG;AACxG,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAE9C,kFAAkF;IAClF,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI;CAMjE"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Room messages this version doesn't read (0.16.0, ENG-969, 2026-10-26).
|
|
4
|
+
*
|
|
5
|
+
* The engine hands the session every room message it doesn't know as `{ type: 'unknown', channel,
|
|
6
|
+
* payload }`, and the session used to drop them. A poll opened mid-show never reached the screen, and
|
|
7
|
+
* nothing said what the room had sent instead. Now the session reports the first message of each kind
|
|
8
|
+
* per show to the app's `onWarning` (`LiveSellingProvider`'s, the app's Sentry; the console without one):
|
|
9
|
+
* a dashboard that renames or moves a message shows up in the app's own logs, once, rather than as a
|
|
10
|
+
* feature that silently stops.
|
|
11
|
+
*
|
|
12
|
+
* Pure, so it loads in plain Node for tests.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.UnreadRoomMessages = void 0;
|
|
16
|
+
exports.roomMessageKind = roomMessageKind;
|
|
17
|
+
exports.reportedCopyOf = reportedCopyOf;
|
|
18
|
+
/** The longest copy of a message a report carries. */
|
|
19
|
+
const MAX_REPORTED_CHARACTERS = 2000;
|
|
20
|
+
const isRecord = (value) => !!value && typeof value === 'object' && !Array.isArray(value);
|
|
21
|
+
/**
|
|
22
|
+
* What kind of message it is, for telling one kind from another: its own name (`type`, `command`,
|
|
23
|
+
* `event` or `action`), else its keys in order, on the channel it came by.
|
|
24
|
+
*/
|
|
25
|
+
function roomMessageKind(channel, payload) {
|
|
26
|
+
if (!isRecord(payload))
|
|
27
|
+
return `${channel}:${typeof payload}`;
|
|
28
|
+
for (const key of ['type', 'command', 'event', 'action']) {
|
|
29
|
+
const name = payload[key];
|
|
30
|
+
if (typeof name === 'string' && name.trim())
|
|
31
|
+
return `${channel}:${name.trim()}`;
|
|
32
|
+
}
|
|
33
|
+
return `${channel}:{${Object.keys(payload).sort().join(',')}}`;
|
|
34
|
+
}
|
|
35
|
+
/** The message as the report carries it: JSON, cut at `MAX_REPORTED_CHARACTERS`. */
|
|
36
|
+
function reportedCopyOf(payload) {
|
|
37
|
+
var _a;
|
|
38
|
+
let text;
|
|
39
|
+
try {
|
|
40
|
+
text = (_a = JSON.stringify(payload)) !== null && _a !== void 0 ? _a : String(payload);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
text = String(payload);
|
|
44
|
+
}
|
|
45
|
+
return text.length > MAX_REPORTED_CHARACTERS ? `${text.slice(0, MAX_REPORTED_CHARACTERS)}…` : text;
|
|
46
|
+
}
|
|
47
|
+
/** Remembers which kinds were reported, so each is reported once (a show's session makes a new one). */
|
|
48
|
+
class UnreadRoomMessages {
|
|
49
|
+
constructor() {
|
|
50
|
+
this.reported = new Set();
|
|
51
|
+
}
|
|
52
|
+
/** The message's kind the first time one of its kind arrives; null after that. */
|
|
53
|
+
firstOfItsKind(channel, payload) {
|
|
54
|
+
const kind = roomMessageKind(channel, payload);
|
|
55
|
+
if (this.reported.has(kind))
|
|
56
|
+
return null;
|
|
57
|
+
this.reported.add(kind);
|
|
58
|
+
return kind;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.UnreadRoomMessages = UnreadRoomMessages;
|
|
62
|
+
//# sourceMappingURL=unreadRoomMessages.js.map
|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C;IACzB,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,GAAG,uBAAuB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,uBAAuB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACrG,CAAC;AAED,wGAAwG;AACxG,MAAa,kBAAkB;IAA/B;QACmB,aAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IAShD,CAAC;IAPC,kFAAkF;IAClF,cAAc,CAAC,OAAe,EAAE,OAAgB;QAC9C,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/C,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACzC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAVD,gDAUC"}
|
package/dist/viewerRules.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Rules the Live pages apply to the viewer (0.16.0
|
|
3
|
-
*
|
|
2
|
+
* Rules the Live pages apply to the viewer (0.16.0), pure so they can be tested without a screen: the store's
|
|
3
|
+
* bar on bidding, and the reaction limit an app may set.
|
|
4
4
|
*/
|
|
5
5
|
import type { ViewerRestrictions } from './pageOptions';
|
|
6
6
|
/**
|
|
@@ -8,11 +8,6 @@ import type { ViewerRestrictions } from './pageOptions';
|
|
|
8
8
|
* (the bid waits, for `ACCOUNT_CHECK_LIMIT_MS` at most); null when it may go on through the gate.
|
|
9
9
|
*/
|
|
10
10
|
export declare function restrictionStepFor(bidding: ViewerRestrictions['bidding']): 'blocked' | 'checkingAccount' | null;
|
|
11
|
-
/** Taps a visit (33.2.0's Live). */
|
|
12
|
-
export declare const REACTION_BUDGET = 15;
|
|
13
|
-
/** What the budget is topped back up to, at least, each time the host features another product. */
|
|
14
|
-
export declare const REACTION_BUDGET_AFTER_PRODUCT_CHANGE = 6;
|
|
15
|
-
export declare const REACTION_LIMIT_MESSAGE = "Please wait before reacting again.";
|
|
16
11
|
export interface ReactionBudget {
|
|
17
12
|
/** One tap: true when it may be sent (and counts it), false past the limit. */
|
|
18
13
|
take(): boolean;
|
|
@@ -20,7 +15,11 @@ export interface ReactionBudget {
|
|
|
20
15
|
productChanged(): void;
|
|
21
16
|
left(): number;
|
|
22
17
|
}
|
|
23
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The reaction limit (0.16.0; `LiveSellingProvider({ reactionLimit })`): `limit` taps, back to `limit` each
|
|
20
|
+
* time the host features another product.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createReactionBudget(limit: number): ReactionBudget;
|
|
24
23
|
/** How long a Replay's controls stay after they show or are touched, unless the app says (`controlsShowMs`). */
|
|
25
24
|
export declare const REPLAY_CONTROLS_SHOW_MS = 4000;
|
|
26
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewerRules.d.ts","sourceRoot":"","sources":["../src/viewerRules.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,CAAC,SAAS,CAAC,GAAG,SAAS,GAAG,iBAAiB,GAAG,IAAI,CAE/G;
|
|
1
|
+
{"version":3,"file":"viewerRules.d.ts","sourceRoot":"","sources":["../src/viewerRules.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,CAAC,SAAS,CAAC,GAAG,SAAS,GAAG,iBAAiB,GAAG,IAAI,CAE/G;AAGD,MAAM,WAAW,cAAc;IAC7B,+EAA+E;IAC/E,IAAI,IAAI,OAAO,CAAC;IAChB,yCAAyC;IACzC,cAAc,IAAI,IAAI,CAAC;IACvB,IAAI,IAAI,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAclE;AAED,gHAAgH;AAChH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,EAAE,QAAsB,EAAE,cAAc,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,WAAW,GAAG,cAAc,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,EAChH,OAAO,EAAE,OAAO,GACf;IAAE,gBAAgB,EAAE,OAAO,CAAC;IAAC,eAAe,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAK5E"}
|
package/dist/viewerRules.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.REPLAY_CONTROLS_SHOW_MS =
|
|
3
|
+
exports.REPLAY_CONTROLS_SHOW_MS = void 0;
|
|
4
4
|
exports.restrictionStepFor = restrictionStepFor;
|
|
5
5
|
exports.createReactionBudget = createReactionBudget;
|
|
6
6
|
exports.replayControlsRule = replayControlsRule;
|
|
@@ -11,13 +11,13 @@ exports.replayControlsRule = replayControlsRule;
|
|
|
11
11
|
function restrictionStepFor(bidding) {
|
|
12
12
|
return bidding === 'blocked' ? 'blocked' : bidding === 'unknown' ? 'checkingAccount' : null;
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
let left =
|
|
14
|
+
/**
|
|
15
|
+
* The reaction limit (0.16.0; `LiveSellingProvider({ reactionLimit })`): `limit` taps, back to `limit` each
|
|
16
|
+
* time the host features another product.
|
|
17
|
+
*/
|
|
18
|
+
function createReactionBudget(limit) {
|
|
19
|
+
const budget = Math.max(0, limit);
|
|
20
|
+
let left = budget;
|
|
21
21
|
return {
|
|
22
22
|
take() {
|
|
23
23
|
if (left <= 0)
|
|
@@ -26,7 +26,7 @@ function createReactionBudget() {
|
|
|
26
26
|
return true;
|
|
27
27
|
},
|
|
28
28
|
productChanged() {
|
|
29
|
-
left =
|
|
29
|
+
left = budget;
|
|
30
30
|
},
|
|
31
31
|
left: () => left,
|
|
32
32
|
};
|
package/dist/viewerRules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewerRules.js","sourceRoot":"","sources":["../src/viewerRules.ts"],"names":[],"mappings":";;;AAUA,gDAEC;
|
|
1
|
+
{"version":3,"file":"viewerRules.js","sourceRoot":"","sources":["../src/viewerRules.ts"],"names":[],"mappings":";;;AAUA,gDAEC;AAeD,oDAcC;AAUD,gDAQC;AArDD;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,OAAsC;IACvE,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9F,CAAC;AAWD;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,KAAa;IAChD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAClC,IAAI,IAAI,GAAG,MAAM,CAAC;IAClB,OAAO;QACL,IAAI;YACF,IAAI,IAAI,IAAI,CAAC;gBAAE,OAAO,KAAK,CAAC;YAC5B,IAAI,IAAI,CAAC,CAAC;YACV,OAAO,IAAI,CAAC;QACd,CAAC;QACD,cAAc;YACZ,IAAI,GAAG,MAAM,CAAC;QAChB,CAAC;QACD,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI;KACjB,CAAC;AACJ,CAAC;AAED,gHAAgH;AACnG,QAAA,uBAAuB,GAAG,IAAI,CAAC;AAE5C;;;;GAIG;AACH,SAAgB,kBAAkB,CAChC,EAAE,QAAQ,GAAG,WAAW,EAAE,cAAc,EAAwE,EAChH,OAAgB;IAEhB,MAAM,SAAS,GACb,OAAO,cAAc,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,+BAAuB,CAAC;IACpJ,MAAM,gBAAgB,GAAG,QAAQ,KAAK,cAAc,CAAC;IACrD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,gBAAgB,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wins cart's `_apptile_attribution` (0.16.0). The wins checkout is a cart of its own, built outside
|
|
3
|
+
* sdk-shopify's provider, so the provider's recorder never sees it; this writes the same record with
|
|
4
|
+
* sdk-shopify's own `recordAdd` and `serializeAttribution`. A lot won on a live show (its `_stream_id`)
|
|
5
|
+
* counts under `auction` for that show, a silent auction's win (its `_silent_auction_id`) under
|
|
6
|
+
* `silent-auction` for that auction, and any other line as the app's. Each line counts by `attributionLineType`.
|
|
7
|
+
*/
|
|
8
|
+
import { type AttributionLineType } from '@tiledev/sdk-shopify';
|
|
9
|
+
import type { ShopifyAttribute, ShopifyCartLineInput } from './shopifyCommerce';
|
|
10
|
+
/**
|
|
11
|
+
* A line's type in `_apptile_attribution`: `g` for a giveaway prize (`isGiveawayPrizeLine`, even when
|
|
12
|
+
* pre-authorised), else sdk-shopify's `lineTypeOf` (`p` pre-authorised, `n`).
|
|
13
|
+
*/
|
|
14
|
+
export declare function attributionLineType(attributes: readonly ShopifyAttribute[]): AttributionLineType;
|
|
15
|
+
/** The record for the wins cart's lines; none for an empty cart. */
|
|
16
|
+
export declare function winsAttribution(lines: readonly ShopifyCartLineInput[], nowSeconds?: number): ShopifyAttribute[];
|
|
17
|
+
/**
|
|
18
|
+
* The wins cart's extra attributes: the app's own (`extraCartAttributes`), then the record when the app
|
|
19
|
+
* turns it on, unless the app already wrote one.
|
|
20
|
+
*/
|
|
21
|
+
export declare function winsCartAttributes(lines: readonly ShopifyCartLineInput[], attributionEnabled: boolean, extraCartAttributes?: (lines: ShopifyCartLineInput[]) => ShopifyAttribute[]): ShopifyAttribute[];
|
|
22
|
+
//# sourceMappingURL=winsAttribution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"winsAttribution.d.ts","sourceRoot":"","sources":["../src/winsAttribution.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAA4F,KAAK,mBAAmB,EAA0B,MAAM,sBAAsB,CAAC;AAKlL,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEhF;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,SAAS,gBAAgB,EAAE,GAAG,mBAAmB,CAEhG;AAWD,oEAAoE;AACpE,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,oBAAoB,EAAE,EAAE,UAAU,SAAgC,GAAG,gBAAgB,EAAE,CAOtI;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,SAAS,oBAAoB,EAAE,EACtC,kBAAkB,EAAE,OAAO,EAC3B,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,EAAE,KAAK,gBAAgB,EAAE,GAC1E,gBAAgB,EAAE,CAIpB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.attributionLineType = attributionLineType;
|
|
4
|
+
exports.winsAttribution = winsAttribution;
|
|
5
|
+
exports.winsCartAttributes = winsCartAttributes;
|
|
6
|
+
/**
|
|
7
|
+
* The wins cart's `_apptile_attribution` (0.16.0). The wins checkout is a cart of its own, built outside
|
|
8
|
+
* sdk-shopify's provider, so the provider's recorder never sees it; this writes the same record with
|
|
9
|
+
* sdk-shopify's own `recordAdd` and `serializeAttribution`. A lot won on a live show (its `_stream_id`)
|
|
10
|
+
* counts under `auction` for that show, a silent auction's win (its `_silent_auction_id`) under
|
|
11
|
+
* `silent-auction` for that auction, and any other line as the app's. Each line counts by `attributionLineType`.
|
|
12
|
+
*/
|
|
13
|
+
const sdk_shopify_1 = require("@tiledev/sdk-shopify");
|
|
14
|
+
const cartAttributes_1 = require("./cartAttributes");
|
|
15
|
+
const giveawayPrizeLines_1 = require("./giveawayPrizeLines");
|
|
16
|
+
/**
|
|
17
|
+
* A line's type in `_apptile_attribution`: `g` for a giveaway prize (`isGiveawayPrizeLine`, even when
|
|
18
|
+
* pre-authorised), else sdk-shopify's `lineTypeOf` (`p` pre-authorised, `n`).
|
|
19
|
+
*/
|
|
20
|
+
function attributionLineType(attributes) {
|
|
21
|
+
return (0, giveawayPrizeLines_1.isGiveawayPrizeLine)({ attributes }) ? 'g' : (0, sdk_shopify_1.lineTypeOf)([...attributes]);
|
|
22
|
+
}
|
|
23
|
+
/** Where a won line came from: its live auction show (`_stream_id`), its silent auction, else the app. */
|
|
24
|
+
function sourceOf(attributes) {
|
|
25
|
+
const valueOf = (key) => { var _a, _b; return (_b = (_a = attributes.find((attribute) => attribute.key === key)) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.trim(); };
|
|
26
|
+
const show = valueOf(cartAttributes_1.LIVE_STREAM_ID_ATTRIBUTE);
|
|
27
|
+
if (show)
|
|
28
|
+
return { type: 'auction', showId: show };
|
|
29
|
+
const silent = valueOf(cartAttributes_1.SILENT_AUCTION_ID_ATTRIBUTE);
|
|
30
|
+
return silent ? { type: 'silent-auction', showId: silent } : { type: 'app' };
|
|
31
|
+
}
|
|
32
|
+
/** The record for the wins cart's lines; none for an empty cart. */
|
|
33
|
+
function winsAttribution(lines, nowSeconds = Math.floor(Date.now() / 1000)) {
|
|
34
|
+
if (lines.length === 0)
|
|
35
|
+
return [];
|
|
36
|
+
const record = lines.reduce((current, line) => (0, sdk_shopify_1.recordAdd)(current, sourceOf(line.attributes), line.merchandiseId, attributionLineType(line.attributes), line.quantity, nowSeconds), { v: 1 });
|
|
37
|
+
return [{ key: sdk_shopify_1.ATTRIBUTION_ATTRIBUTE_KEY, value: (0, sdk_shopify_1.serializeAttribution)(record) }];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The wins cart's extra attributes: the app's own (`extraCartAttributes`), then the record when the app
|
|
41
|
+
* turns it on, unless the app already wrote one.
|
|
42
|
+
*/
|
|
43
|
+
function winsCartAttributes(lines, attributionEnabled, extraCartAttributes) {
|
|
44
|
+
const extra = extraCartAttributes ? extraCartAttributes([...lines]) : [];
|
|
45
|
+
if (!attributionEnabled || extra.some((attribute) => attribute.key === sdk_shopify_1.ATTRIBUTION_ATTRIBUTE_KEY))
|
|
46
|
+
return extra;
|
|
47
|
+
return [...extra, ...winsAttribution(lines)];
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=winsAttribution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"winsAttribution.js","sourceRoot":"","sources":["../src/winsAttribution.ts"],"names":[],"mappings":";;AAkBA,kDAEC;AAYD,0CAOC;AAMD,gDAQC;AArDD;;;;;;GAMG;AACH,sDAAkL;AAElL,qDAAyF;AACzF,6DAA2D;AAI3D;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,UAAuC;IACzE,OAAO,IAAA,wCAAmB,EAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAA,wBAAU,EAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;AACjF,CAAC;AAED,0GAA0G;AAC1G,SAAS,QAAQ,CAAC,UA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G;AACH,SAAgB,kBAAkB,CAChC,KAAsC,EACtC,kBAA2B,EAC3B,mBAA2E;IAE3E,MAAM,KAAK,GAAG,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACzE,IAAI,CAAC,kBAAkB,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,KAAK,uCAAyB,CAAC;QAAE,OAAO,KAAK,CAAC;IAChH,OAAO,CAAC,GAAG,KAAK,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiledev/sdk-apptile-live-selling",
|
|
3
|
-
"version": "0.16.0
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Live selling, auctions and giveaways for React Native — the Apptile live-selling gateway as a typed singleton, a Zego room engine behind a platform boundary, an assembled session state machine, system picture-in-picture with its own config plugin, and the Live and Replay page models with their floating bubbles (`/ui`). Commerce comes from an adapter.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@react-navigation/native": ">=7.0.0 <8",
|
|
64
64
|
"@tiledev/react-native-performant-image": ">=0.3.0 <1",
|
|
65
65
|
"@tiledev/sdk-analytics-core": ">=0.3.2 <1",
|
|
66
|
-
"@tiledev/sdk-shopify": ">=0.23.0
|
|
66
|
+
"@tiledev/sdk-shopify": ">=0.23.0 <1",
|
|
67
67
|
"expo-keep-awake": ">=15.0.0",
|
|
68
68
|
"expo-video": ">=3.0.0",
|
|
69
69
|
"react": ">=17",
|