@tiledev/sdk-apptile-live-selling 0.10.0 → 0.12.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 +94 -1
- package/dist/auctions.d.ts.map +1 -1
- package/dist/auctions.js +22 -1
- package/dist/auctions.js.map +1 -1
- package/dist/commentLinkCards.d.ts +11 -0
- package/dist/commentLinkCards.d.ts.map +1 -0
- package/dist/commentLinkCards.js +70 -0
- package/dist/commentLinkCards.js.map +1 -0
- package/dist/commentLinks.d.ts +29 -0
- package/dist/commentLinks.d.ts.map +1 -1
- package/dist/commentLinks.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +43 -3
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.ts +7 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +21 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.web.d.ts +13 -0
- package/dist/react/index.web.d.ts.map +1 -1
- package/dist/react/index.web.js +35 -1
- package/dist/react/index.web.js.map +1 -1
- package/dist/react/showPages.d.ts +102 -0
- package/dist/react/showPages.d.ts.map +1 -0
- package/dist/react/showPages.js +155 -0
- package/dist/react/showPages.js.map +1 -0
- package/dist/react/showPagesOnDevice.d.ts +18 -0
- package/dist/react/showPagesOnDevice.d.ts.map +1 -0
- package/dist/react/showPagesOnDevice.js +31 -0
- package/dist/react/showPagesOnDevice.js.map +1 -0
- package/dist/react/useCommentLinkCards.d.ts +6 -0
- package/dist/react/useCommentLinkCards.d.ts.map +1 -0
- package/dist/react/useCommentLinkCards.js +67 -0
- package/dist/react/useCommentLinkCards.js.map +1 -0
- package/dist/react/useMySilentAuctionBids.d.ts +29 -0
- package/dist/react/useMySilentAuctionBids.d.ts.map +1 -0
- package/dist/react/useMySilentAuctionBids.js +154 -0
- package/dist/react/useMySilentAuctionBids.js.map +1 -0
- package/dist/react/useSilentAuctionLot.d.ts +42 -0
- package/dist/react/useSilentAuctionLot.d.ts.map +1 -0
- package/dist/react/useSilentAuctionLot.js +147 -0
- package/dist/react/useSilentAuctionLot.js.map +1 -0
- package/dist/react/useSilentAuctionLots.d.ts +39 -0
- package/dist/react/useSilentAuctionLots.d.ts.map +1 -0
- package/dist/react/useSilentAuctionLots.js +59 -0
- package/dist/react/useSilentAuctionLots.js.map +1 -0
- package/dist/react/useSilentAuctionRounds.d.ts +14 -0
- package/dist/react/useSilentAuctionRounds.d.ts.map +1 -0
- package/dist/react/useSilentAuctionRounds.js +40 -0
- package/dist/react/useSilentAuctionRounds.js.map +1 -0
- package/dist/replays.d.ts +7 -0
- package/dist/replays.d.ts.map +1 -1
- package/dist/replays.js +16 -0
- package/dist/replays.js.map +1 -1
- package/dist/sessionTypes.d.ts +9 -0
- package/dist/sessionTypes.d.ts.map +1 -1
- package/dist/sessionTypes.js.map +1 -1
- package/dist/shopifyCommerce.d.ts +43 -1
- package/dist/shopifyCommerce.d.ts.map +1 -1
- package/dist/shopifyCommerce.js +62 -2
- package/dist/shopifyCommerce.js.map +1 -1
- package/dist/showPages.d.ts +44 -0
- package/dist/showPages.d.ts.map +1 -0
- package/dist/showPages.js +38 -0
- package/dist/showPages.js.map +1 -0
- package/dist/silentAuctionFeed.d.ts +47 -0
- package/dist/silentAuctionFeed.d.ts.map +1 -0
- package/dist/silentAuctionFeed.js +232 -0
- package/dist/silentAuctionFeed.js.map +1 -0
- package/dist/silentAuctionRules.d.ts +206 -0
- package/dist/silentAuctionRules.d.ts.map +1 -0
- package/dist/silentAuctionRules.js +424 -0
- package/dist/silentAuctionRules.js.map +1 -0
- package/dist/silentAuctions.d.ts +65 -0
- package/dist/silentAuctions.d.ts.map +1 -0
- package/dist/silentAuctions.js +272 -0
- package/dist/silentAuctions.js.map +1 -0
- package/dist/types.d.ts +40 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BID_RECORD_KEY = exports.BID_RECORD_NAMESPACE = void 0;
|
|
4
|
+
exports.lotProductGid = lotProductGid;
|
|
5
|
+
exports.toSilentAuctionLot = toSilentAuctionLot;
|
|
6
|
+
exports.lotsFromResponse = lotsFromResponse;
|
|
7
|
+
exports.lotKey = lotKey;
|
|
8
|
+
exports.timeLeftMs = timeLeftMs;
|
|
9
|
+
exports.lotPhase = lotPhase;
|
|
10
|
+
exports.inExtensionWindow = inExtensionWindow;
|
|
11
|
+
exports.wasExtended = wasExtended;
|
|
12
|
+
exports.nextBid = nextBid;
|
|
13
|
+
exports.bidCapState = bidCapState;
|
|
14
|
+
exports.isLeading = isLeading;
|
|
15
|
+
exports.lotStatus = lotStatus;
|
|
16
|
+
exports.orderLots = orderLots;
|
|
17
|
+
exports.upcomingGroups = upcomingGroups;
|
|
18
|
+
exports.myBidsTabs = myBidsTabs;
|
|
19
|
+
exports.productPageBuyBar = productPageBuyBar;
|
|
20
|
+
exports.bidRecordEntries = bidRecordEntries;
|
|
21
|
+
exports.bidRecordEntry = bidRecordEntry;
|
|
22
|
+
exports.queryableBidEntries = queryableBidEntries;
|
|
23
|
+
exports.toSilentAuctionRound = toSilentAuctionRound;
|
|
24
|
+
/**
|
|
25
|
+
* Silent auctions' rules (0.12.0, moved from Sparkl's app on 2026-10-17: "added in the SDK", "the same
|
|
26
|
+
* way"). Pure and platform-free: no network, no React, so each rule is tested on its own.
|
|
27
|
+
*
|
|
28
|
+
* A silent auction is a set of timed lots on Apptile's auction service, bid on from the product page
|
|
29
|
+
* rather than in a show. The service answers in more than one shape (PascalCase and camelCase keys, ISO
|
|
30
|
+
* strings and epoch seconds), so every reader goes through `toSilentAuctionLot`.
|
|
31
|
+
*/
|
|
32
|
+
const shopifyIds_1 = require("./shopifyIds");
|
|
33
|
+
/** Epoch ms. 10-digit numbers are seconds, 13-digit ms; strings may be either, or ISO. */
|
|
34
|
+
function toMs(value) {
|
|
35
|
+
if (value === undefined || value === null || value === '')
|
|
36
|
+
return null;
|
|
37
|
+
if (typeof value === 'number')
|
|
38
|
+
return Number.isFinite(value) ? (value < 1e12 ? value * 1000 : value) : null;
|
|
39
|
+
const asNumber = Number(value);
|
|
40
|
+
if (Number.isFinite(asNumber))
|
|
41
|
+
return asNumber < 1e12 ? asNumber * 1000 : asNumber;
|
|
42
|
+
const parsed = Date.parse(String(value));
|
|
43
|
+
return Number.isNaN(parsed) ? null : parsed;
|
|
44
|
+
}
|
|
45
|
+
function toNumber(value) {
|
|
46
|
+
if (value === undefined || value === null || value === '')
|
|
47
|
+
return null;
|
|
48
|
+
const asNumber = Number(value);
|
|
49
|
+
return Number.isFinite(asNumber) ? asNumber : null;
|
|
50
|
+
}
|
|
51
|
+
function firstOf(...values) {
|
|
52
|
+
for (const value of values)
|
|
53
|
+
if (value !== undefined && value !== null && value !== '')
|
|
54
|
+
return value;
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
function text(value) {
|
|
58
|
+
if (value === undefined || value === null)
|
|
59
|
+
return null;
|
|
60
|
+
const trimmed = String(value).trim();
|
|
61
|
+
return trimmed || null;
|
|
62
|
+
}
|
|
63
|
+
/** A Shopify product GID from a GID or a bare numeric id; null for anything else (a `prod-1` key). */
|
|
64
|
+
function lotProductGid(value) {
|
|
65
|
+
const raw = text(value);
|
|
66
|
+
if (!raw)
|
|
67
|
+
return null;
|
|
68
|
+
if (raw.startsWith('gid://shopify/Product/'))
|
|
69
|
+
return raw;
|
|
70
|
+
return /^\d+$/.test(raw) ? (0, shopifyIds_1.productGid)(raw) : null;
|
|
71
|
+
}
|
|
72
|
+
/** One lot, from any of the service's shapes (the list, `/product/{id}`, the bulk read). */
|
|
73
|
+
function toSilentAuctionLot(raw) {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
const row = (raw && typeof raw === 'object' ? raw : {});
|
|
76
|
+
const pk = typeof row.PK === 'string' && row.PK.startsWith('PRODUCT#') ? row.PK.slice('PRODUCT#'.length) : null;
|
|
77
|
+
const productId = text(firstOf(row.productId, row.ProductId, row.storeProductId, row.StoreProductId, pk));
|
|
78
|
+
const gid = (_a = lotProductGid(firstOf(row.storeProductId, row.StoreProductId))) !== null && _a !== void 0 ? _a : lotProductGid(firstOf(row.productId, row.ProductId));
|
|
79
|
+
const bidder = firstOf(row.HighestBidderDetails, row.highestBidderDetails, row.highestBidder);
|
|
80
|
+
const enabled = firstOf(row.extBiddingEnabled, row.ExtBiddingEnabled);
|
|
81
|
+
return {
|
|
82
|
+
storeProductId: gid ? (0, shopifyIds_1.bareId)(gid) : productId,
|
|
83
|
+
productGid: gid,
|
|
84
|
+
productHandle: text(firstOf(row.productHandle, row.ProductHandle, row.handle, row.Handle, row.productSlug)),
|
|
85
|
+
auctionId: text(firstOf(row.auctionId, row.AuctionId)),
|
|
86
|
+
streamId: text(firstOf(row.stream_id, row.streamId, row.StreamId)),
|
|
87
|
+
lotNumber: toNumber(firstOf(row.lotNumber, row.LotNumber, row.lot_number)),
|
|
88
|
+
startsAt: toMs(firstOf(row.StartTime, row.startTime, row.StartTimeStamp, row.startTimestamp, row.currentStartTime, row.CurrentStartTime)),
|
|
89
|
+
endsAt: toMs(firstOf(row.EndTimeStamp, row.endTimeStamp, row.EndTime, row.endTime, row.endTimestamp, row.currentEndTime, row.CurrentEndTime)),
|
|
90
|
+
startingPrice: toNumber(firstOf(row.StartingPrice, row.startingPrice, row.startingBid, row.StartingBid)),
|
|
91
|
+
highestBid: toNumber(firstOf(row.HighestBid, row.highestBid)),
|
|
92
|
+
bidIncrement: toNumber(firstOf(row.BidIncrement, row.bidIncrement)),
|
|
93
|
+
biddingCap: toNumber(firstOf(row.biddingCap, row.BiddingCap)),
|
|
94
|
+
highestBidderId: bidder && typeof bidder === 'object' && bidder.userId != null ? (0, shopifyIds_1.bareId)(String(bidder.userId)) : null,
|
|
95
|
+
// `bareId` though the service sends a plain id: a no-op on one, and right the day it sends a GID.
|
|
96
|
+
highestBidVariantId: text(firstOf(row.HighestBidVariantId, row.highestBidVariantId)) ? (0, shopifyIds_1.bareId)(String(firstOf(row.HighestBidVariantId, row.highestBidVariantId))) : null,
|
|
97
|
+
extendedBidding: {
|
|
98
|
+
enabled: enabled === true || enabled === 'true',
|
|
99
|
+
// Left null rather than 0 when absent: a non-positive trigger is an open gate, and a made-up
|
|
100
|
+
// window would be worse than none.
|
|
101
|
+
triggerMs: toNumber(firstOf(row.extBiddingTriggerMs, row.ExtBiddingTriggerMs)),
|
|
102
|
+
durationMs: toNumber(firstOf(row.extBiddingDurationMs, row.ExtBiddingDurationMs)),
|
|
103
|
+
},
|
|
104
|
+
biddingWarAt: (_b = firstOf(row.BiddingWarNotifiedAt, row.biddingWarNotifiedAt, row.bidding_war_notified_at)) !== null && _b !== void 0 ? _b : null,
|
|
105
|
+
purchaseWindowMs: toNumber(firstOf(row.timeAllowedForPurchase, row.TimeAllowedForPurchase, row.timeAllowedForPurchaseMs)),
|
|
106
|
+
raw,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/** The lots in a list response: a bare array, or one wrapped in `items`, `products`, `auctionProducts` or `data`. */
|
|
110
|
+
function lotsFromResponse(json) {
|
|
111
|
+
var _a, _b, _c, _d;
|
|
112
|
+
const body = json;
|
|
113
|
+
const rows = Array.isArray(body)
|
|
114
|
+
? body
|
|
115
|
+
: ((_d = (_c = (_b = (_a = body === null || body === void 0 ? void 0 : body.items) !== null && _a !== void 0 ? _a : body === null || body === void 0 ? void 0 : body.products) !== null && _b !== void 0 ? _b : body === null || body === void 0 ? void 0 : body.auctionProducts) !== null && _c !== void 0 ? _c : body === null || body === void 0 ? void 0 : body.data) !== null && _d !== void 0 ? _d : []);
|
|
116
|
+
return Array.isArray(rows) ? rows.map(toSilentAuctionLot) : [];
|
|
117
|
+
}
|
|
118
|
+
/** The key a lot keeps across reads: its product and its round. */
|
|
119
|
+
function lotKey(lot) {
|
|
120
|
+
if (lot.productGid && lot.auctionId)
|
|
121
|
+
return `${lot.productGid}#${lot.auctionId}`;
|
|
122
|
+
if (lot.auctionId)
|
|
123
|
+
return `auction:${lot.auctionId}`;
|
|
124
|
+
if (lot.productGid)
|
|
125
|
+
return `gid:${lot.productGid}`;
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
// ─── Time ─────────────────────────────────────────────────────────────────────
|
|
129
|
+
const moment = (value) => typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : null;
|
|
130
|
+
const duration = (value) => typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : 0;
|
|
131
|
+
/** Ms until the lot closes, never below zero. No close time reads as zero. */
|
|
132
|
+
function timeLeftMs(lot, nowMs) {
|
|
133
|
+
const end = moment(lot.endsAt);
|
|
134
|
+
return end === null ? 0 : Math.max(0, end - nowMs);
|
|
135
|
+
}
|
|
136
|
+
/** Upcoming before it opens, live until it closes, ended after (or when it has no close time). */
|
|
137
|
+
function lotPhase(lot, nowMs) {
|
|
138
|
+
const end = moment(lot.endsAt);
|
|
139
|
+
if (end === null || nowMs >= end)
|
|
140
|
+
return 'ended';
|
|
141
|
+
const start = moment(lot.startsAt);
|
|
142
|
+
return start !== null && nowMs < start ? 'upcoming' : 'live';
|
|
143
|
+
}
|
|
144
|
+
/** Inside the anti-sniping window: a bid now pushes the close back. A 0 or unset trigger is always open. */
|
|
145
|
+
function inExtensionWindow(lot, nowMs) {
|
|
146
|
+
if (!lot.extendedBidding.enabled)
|
|
147
|
+
return false;
|
|
148
|
+
const left = timeLeftMs(lot, nowMs);
|
|
149
|
+
if (left <= 0)
|
|
150
|
+
return false;
|
|
151
|
+
const trigger = duration(lot.extendedBidding.triggerMs);
|
|
152
|
+
return trigger <= 0 || left <= trigger;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Whether a new close time is an anti-sniping extension rather than a host's edit: it moved later,
|
|
156
|
+
* while the lot was still open and inside its trigger window.
|
|
157
|
+
*/
|
|
158
|
+
function wasExtended(previousEndsAt, lot, nowMs) {
|
|
159
|
+
if (!lot.extendedBidding.enabled)
|
|
160
|
+
return false;
|
|
161
|
+
const before = moment(previousEndsAt);
|
|
162
|
+
const after = moment(lot.endsAt);
|
|
163
|
+
if (before === null || after === null || after <= before)
|
|
164
|
+
return false;
|
|
165
|
+
const leftBefore = before - nowMs;
|
|
166
|
+
if (leftBefore <= 0)
|
|
167
|
+
return false;
|
|
168
|
+
const trigger = duration(lot.extendedBidding.triggerMs);
|
|
169
|
+
return trigger <= 0 || leftBefore <= trigger;
|
|
170
|
+
}
|
|
171
|
+
// ─── Bidding ──────────────────────────────────────────────────────────────────
|
|
172
|
+
/** What the one-tap bid offers: the standing bid plus the increment, else the starting price. */
|
|
173
|
+
function nextBid(lot) {
|
|
174
|
+
var _a, _b, _c;
|
|
175
|
+
const highest = (_a = lot.highestBid) !== null && _a !== void 0 ? _a : 0;
|
|
176
|
+
return highest > 0 ? highest + ((_b = lot.bidIncrement) !== null && _b !== void 0 ? _b : 0) : ((_c = lot.startingPrice) !== null && _c !== void 0 ? _c : 0);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* The bid cap for an offer of `offered` (what the one-tap bid offers).
|
|
180
|
+
*
|
|
181
|
+
* - **A numeric 0 is a ceiling;** null, undefined and a blank string are none. `Number("")` is 0, so
|
|
182
|
+
* coercing first would turn an unset field into a ceiling of 0 and lock out every bid.
|
|
183
|
+
* - **The cap is inclusive:** a bid of exactly the cap is legal (`overCap` is `>`). The service agreed
|
|
184
|
+
* on 2026-09-14; if either end changes, a bid at the ceiling silently goes nowhere again.
|
|
185
|
+
* - **The keypad's test is stricter** (`noCustomRoom`, `>=`): it needs an amount above the offer and
|
|
186
|
+
* within the cap, and at offer === cap there is none, while the one-tap bid is still live.
|
|
187
|
+
*/
|
|
188
|
+
function bidCapState(offered, cap) {
|
|
189
|
+
const ceiling = typeof cap === 'number' ? cap : typeof cap === 'string' && cap.trim() ? Number(cap) : Number.NaN;
|
|
190
|
+
const hasCap = Number.isFinite(ceiling);
|
|
191
|
+
return { hasCap, overCap: hasCap && offered > ceiling, noCustomRoom: hasCap && offered >= ceiling, ceiling };
|
|
192
|
+
}
|
|
193
|
+
/** Whether this customer holds the leading bid (ids compared bare). */
|
|
194
|
+
function isLeading(lot, customerId) {
|
|
195
|
+
return !!lot.highestBidderId && !!customerId && lot.highestBidderId === (0, shopifyIds_1.bareId)(String(customerId));
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* A lot's card status: ended (won by this customer, or lost), upcoming, inside its anti-sniping window
|
|
199
|
+
* (a bidding war once the service has flagged one, else ending soon), or live. Without a trigger window
|
|
200
|
+
* there are no urgency states.
|
|
201
|
+
*/
|
|
202
|
+
function lotStatus(lot, nowMs, customerId) {
|
|
203
|
+
const phase = lotPhase(lot, nowMs);
|
|
204
|
+
if (phase === 'ended')
|
|
205
|
+
return isLeading(lot, customerId) ? 'endedWon' : 'endedLost';
|
|
206
|
+
if (phase === 'upcoming')
|
|
207
|
+
return 'upcoming';
|
|
208
|
+
const trigger = duration(lot.extendedBidding.triggerMs);
|
|
209
|
+
if (trigger > 0 && timeLeftMs(lot, nowMs) <= trigger)
|
|
210
|
+
return lot.biddingWarAt ? 'biddingWar' : 'endingSoon';
|
|
211
|
+
return 'live';
|
|
212
|
+
}
|
|
213
|
+
/** 0 live, 1 not open yet, 2 closed: lots sort by this first. */
|
|
214
|
+
function tier(lot, nowMs) {
|
|
215
|
+
const phase = lotPhase(lot, nowMs);
|
|
216
|
+
return phase === 'live' ? 0 : phase === 'upcoming' ? 1 : 2;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* The lots in a page's order. Live lots first, then those not open yet (soonest first), then closed ones
|
|
220
|
+
* (latest closed first). `endingSoon` and `upcoming` leave out lots not open yet; `wishlisted` keeps only
|
|
221
|
+
* `wishlistedProductIds` (bare or GIDs).
|
|
222
|
+
*/
|
|
223
|
+
function orderLots(items, order, nowMs, wishlistedProductIds = []) {
|
|
224
|
+
let list = items.slice();
|
|
225
|
+
if (order === 'wishlisted') {
|
|
226
|
+
const wanted = new Set([...wishlistedProductIds].map((id) => (0, shopifyIds_1.bareId)(id)));
|
|
227
|
+
list = list.filter(({ lot }) => !!lot.productGid && wanted.has((0, shopifyIds_1.bareId)(lot.productGid)));
|
|
228
|
+
}
|
|
229
|
+
else if (order !== 'newest') {
|
|
230
|
+
list = list.filter(({ lot }) => { var _a; return ((_a = lot.startsAt) !== null && _a !== void 0 ? _a : 0) <= nowMs; });
|
|
231
|
+
}
|
|
232
|
+
const at = (value) => value !== null && value !== void 0 ? value : 0;
|
|
233
|
+
return list.sort((a, b) => {
|
|
234
|
+
const tierA = tier(a.lot, nowMs);
|
|
235
|
+
const tierB = tier(b.lot, nowMs);
|
|
236
|
+
if (tierA !== tierB)
|
|
237
|
+
return tierA - tierB;
|
|
238
|
+
if (tierA === 2)
|
|
239
|
+
return at(b.lot.endsAt) - at(a.lot.endsAt);
|
|
240
|
+
if (tierA === 1)
|
|
241
|
+
return at(a.lot.startsAt) - at(b.lot.startsAt);
|
|
242
|
+
return order === 'newest' ? at(b.lot.startsAt) - at(a.lot.startsAt) : at(a.lot.endsAt) - at(b.lot.endsAt);
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
/** Upcoming lots grouped by round, the soonest round first; within a round, the service's order. */
|
|
246
|
+
function upcomingGroups(items) {
|
|
247
|
+
const groups = new Map();
|
|
248
|
+
for (const item of items) {
|
|
249
|
+
const auctionId = item.lot.auctionId;
|
|
250
|
+
if (!auctionId)
|
|
251
|
+
continue;
|
|
252
|
+
const group = groups.get(auctionId);
|
|
253
|
+
if (group)
|
|
254
|
+
group.items.push(item);
|
|
255
|
+
else
|
|
256
|
+
groups.set(auctionId, { auctionId, startsAt: item.lot.startsAt, items: [item] });
|
|
257
|
+
}
|
|
258
|
+
return [...groups.values()].sort((a, b) => { var _a, _b; return ((_a = a.startsAt) !== null && _a !== void 0 ? _a : Infinity) - ((_b = b.startsAt) !== null && _b !== void 0 ? _b : Infinity); });
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* My Bids' three tabs: active (not closed, the soonest to close first), won (closed and this customer
|
|
262
|
+
* leads, the latest first), lost (closed otherwise, the latest first). A lot with no close time is
|
|
263
|
+
* closed, as `lotPhase` reads it.
|
|
264
|
+
*/
|
|
265
|
+
function myBidsTabs(items, customerId, nowMs) {
|
|
266
|
+
const tabs = { active: [], won: [], lost: [] };
|
|
267
|
+
for (const item of items) {
|
|
268
|
+
const closed = lotPhase(item.lot, nowMs) === 'ended';
|
|
269
|
+
if (!closed)
|
|
270
|
+
tabs.active.push(item);
|
|
271
|
+
else if (isLeading(item.lot, customerId))
|
|
272
|
+
tabs.won.push(item);
|
|
273
|
+
else
|
|
274
|
+
tabs.lost.push(item);
|
|
275
|
+
}
|
|
276
|
+
const end = (item) => { var _a; return (_a = item.lot.endsAt) !== null && _a !== void 0 ? _a : 0; };
|
|
277
|
+
tabs.active.sort((a, b) => end(a) - end(b));
|
|
278
|
+
tabs.won.sort((a, b) => end(b) - end(a));
|
|
279
|
+
tabs.lost.sort((a, b) => end(b) - end(a));
|
|
280
|
+
return tabs;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Which bottom bar the product page draws: the bid console, Add to Cart, or neither. They aren't
|
|
284
|
+
* opposites: before a round opens neither shows; a round that closed with stock left goes back to a
|
|
285
|
+
* normal sale; a product with a recorded winner keeps the console. A recorded winner blocks a variant
|
|
286
|
+
* only once the round permits no more of it (`allowedQty` ≤ 0; none recorded counts as 0). While the
|
|
287
|
+
* lot read hasn't answered for a managed product, neither shows rather than guess.
|
|
288
|
+
*/
|
|
289
|
+
function productPageBuyBar(input) {
|
|
290
|
+
const { lot, lotStatus, auctionManaged, productHasWinner, variantHasWinner, allowedQty, soldOut, nowMs } = input;
|
|
291
|
+
const winnerBlocks = (variantHasWinner || productHasWinner) && (allowedQty !== null && allowedQty !== void 0 ? allowedQty : 0) <= 0;
|
|
292
|
+
const unknown = lotStatus === 'failed' || (lotStatus === 'loading' && auctionManaged);
|
|
293
|
+
if (unknown && !lot)
|
|
294
|
+
return { console: false, addToCart: false };
|
|
295
|
+
const open = !!lot && lot.endsAt !== null && lot.endsAt > nowMs;
|
|
296
|
+
const notYet = !!lot && lot.startsAt !== null && nowMs < lot.startsAt;
|
|
297
|
+
let showConsole;
|
|
298
|
+
if (!lot)
|
|
299
|
+
showConsole = winnerBlocks;
|
|
300
|
+
else if (notYet)
|
|
301
|
+
showConsole = false;
|
|
302
|
+
else if (open)
|
|
303
|
+
showConsole = true;
|
|
304
|
+
else
|
|
305
|
+
showConsole = winnerBlocks || soldOut;
|
|
306
|
+
let addToCart;
|
|
307
|
+
if (winnerBlocks)
|
|
308
|
+
addToCart = false;
|
|
309
|
+
else if (!lot)
|
|
310
|
+
addToCart = true;
|
|
311
|
+
else if (open)
|
|
312
|
+
addToCart = false;
|
|
313
|
+
else
|
|
314
|
+
addToCart = !soldOut;
|
|
315
|
+
return { console: showConsole, addToCart };
|
|
316
|
+
}
|
|
317
|
+
// ─── The customer's bid record ────────────────────────────────────────────────
|
|
318
|
+
/**
|
|
319
|
+
* The customer metafield that records which lots they bid on: `auction.apptile_silent_auction_bids`.
|
|
320
|
+
* The auction service keeps no per-bidder index, so this is the only record, written on every bid and
|
|
321
|
+
* read by My Bids.
|
|
322
|
+
*/
|
|
323
|
+
exports.BID_RECORD_NAMESPACE = 'auction';
|
|
324
|
+
exports.BID_RECORD_KEY = 'apptile_silent_auction_bids';
|
|
325
|
+
/**
|
|
326
|
+
* Exactly one dash with something on each side: the format `/bulk-auction-product-info` enforces. Any
|
|
327
|
+
* other entry and the service answers 400 for the whole batch (one bare id left by an older client took
|
|
328
|
+
* 89 good bids with it), so the reader drops what doesn't match and the writer never writes it.
|
|
329
|
+
*/
|
|
330
|
+
const QUERYABLE_ENTRY = /^[^-]+-[^-]+$/;
|
|
331
|
+
/** The record's entries, from a JSON array or the comma-separated string an older client left. Deduplicated. */
|
|
332
|
+
function bidRecordEntries(raw) {
|
|
333
|
+
if (raw === null || raw === undefined || raw === '')
|
|
334
|
+
return [];
|
|
335
|
+
let list;
|
|
336
|
+
if (Array.isArray(raw))
|
|
337
|
+
list = raw;
|
|
338
|
+
else if (typeof raw === 'string') {
|
|
339
|
+
const trimmed = raw.trim();
|
|
340
|
+
if (!trimmed)
|
|
341
|
+
return [];
|
|
342
|
+
if (trimmed.startsWith('[')) {
|
|
343
|
+
try {
|
|
344
|
+
const parsed = JSON.parse(trimmed);
|
|
345
|
+
list = Array.isArray(parsed) ? parsed : [parsed];
|
|
346
|
+
}
|
|
347
|
+
catch {
|
|
348
|
+
list = trimmed.split(/[\s,]+/);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
else
|
|
352
|
+
list = trimmed.split(/[\s,]+/);
|
|
353
|
+
}
|
|
354
|
+
else
|
|
355
|
+
list = [raw];
|
|
356
|
+
const out = [];
|
|
357
|
+
const seen = new Set();
|
|
358
|
+
for (const item of list) {
|
|
359
|
+
if (item === null || item === undefined)
|
|
360
|
+
continue;
|
|
361
|
+
const entry = String(item).trim();
|
|
362
|
+
if (!entry || seen.has(entry))
|
|
363
|
+
continue;
|
|
364
|
+
seen.add(entry);
|
|
365
|
+
out.push(entry);
|
|
366
|
+
}
|
|
367
|
+
return out;
|
|
368
|
+
}
|
|
369
|
+
/** One record entry, `<bare product id>-<auction id>`, or null when the halves can't make a queryable one. */
|
|
370
|
+
function bidRecordEntry(productId, auctionId) {
|
|
371
|
+
var _a, _b;
|
|
372
|
+
const product = (_b = (_a = String(productId !== null && productId !== void 0 ? productId : '').split('/').pop()) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '';
|
|
373
|
+
const auction = String(auctionId !== null && auctionId !== void 0 ? auctionId : '').trim();
|
|
374
|
+
if (!product || !auction)
|
|
375
|
+
return null;
|
|
376
|
+
const entry = `${product}-${auction}`;
|
|
377
|
+
return QUERYABLE_ENTRY.test(entry) ? entry : null;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* The entries the service can be asked about, and how many couldn't be (a bid the shopper placed and
|
|
381
|
+
* won't see, so a list missing them says so).
|
|
382
|
+
*/
|
|
383
|
+
function queryableBidEntries(raw) {
|
|
384
|
+
const entries = [];
|
|
385
|
+
let skipped = 0;
|
|
386
|
+
for (const entry of bidRecordEntries(raw)) {
|
|
387
|
+
if (QUERYABLE_ENTRY.test(entry) && lotProductGid(entry.split('-')[0]))
|
|
388
|
+
entries.push(entry);
|
|
389
|
+
else
|
|
390
|
+
skipped += 1;
|
|
391
|
+
}
|
|
392
|
+
return { entries, skipped };
|
|
393
|
+
}
|
|
394
|
+
const asText = (value) => (typeof value === 'string' && value.trim() !== '' ? value : null);
|
|
395
|
+
/** One round, from the rounds endpoint's `auctions[i]`. */
|
|
396
|
+
function toSilentAuctionRound(raw) {
|
|
397
|
+
var _a, _b, _c;
|
|
398
|
+
const row = (raw && typeof raw === 'object' ? raw : {});
|
|
399
|
+
const lots = Array.isArray(row.products) ? row.products : [];
|
|
400
|
+
return {
|
|
401
|
+
id: (_a = asText(row.id)) !== null && _a !== void 0 ? _a : asText(row._id),
|
|
402
|
+
name: asText(row.auctionName),
|
|
403
|
+
streamingId: asText(row.streamingId),
|
|
404
|
+
status: asText(row.status),
|
|
405
|
+
startsAt: toMs(asText(row.startTime)),
|
|
406
|
+
endsAt: toMs(asText(row.endTime)),
|
|
407
|
+
notification: (_b = row.notification) !== null && _b !== void 0 ? _b : null,
|
|
408
|
+
startNotification: (_c = row.startNotification) !== null && _c !== void 0 ? _c : null,
|
|
409
|
+
lots: lots.map((item) => {
|
|
410
|
+
var _a;
|
|
411
|
+
const lot = (item && typeof item === 'object' ? item : {});
|
|
412
|
+
return {
|
|
413
|
+
storeProductId: String((_a = lot.productId) !== null && _a !== void 0 ? _a : ''),
|
|
414
|
+
thumbnailUrl: asText(lot.productThumbnail),
|
|
415
|
+
lotNumber: toNumber(lot.lotNumber),
|
|
416
|
+
startingBid: toNumber(lot.startingBid),
|
|
417
|
+
bidIncrement: toNumber(lot.bidIncrement),
|
|
418
|
+
startsAt: toMs(asText(lot.currentStartTime)),
|
|
419
|
+
endsAt: toMs(asText(lot.currentEndTime)),
|
|
420
|
+
};
|
|
421
|
+
}),
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
//# sourceMappingURL=silentAuctionRules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"silentAuctionRules.js","sourceRoot":"","sources":["../src/silentAuctionRules.ts"],"names":[],"mappings":";;;AA8EA,sCAKC;AAGD,gDAoCC;AAGD,4CAMC;AAGD,wBAKC;AAUD,gCAGC;AAGD,4BAKC;AAGD,8CAMC;AAMD,kCASC;AAKD,0BAGC;AAwBD,kCAIC;AAGD,8BAEC;AAUD,8BAOC;AAsBD,8BAsBC;AAGD,wCAUC;AAOD,gCAiBC;AA6BD,8CAoBC;AAoBD,4CA2BC;AAGD,wCAMC;AAMD,kDAQC;AAgCD,oDAyBC;AAnfD;;;;;;;GAOG;AACH,6CAAkD;AA0ClD,0FAA0F;AAC1F,SAAS,IAAI,CAAC,KAAc;IAC1B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IACvE,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5G,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,QAAQ,GAAG,IAAI,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AE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;QAC1B,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACrC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACjC,YAAY,EAAE,MAAC,GAAG,CAAC,YAAmD,mCAAI,IAAI;QAC9E,iBAAiB,EAAE,MAAC,GAAG,CAAC,iBAA6D,mCAAI,IAAI;QAC7F,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;;YACtB,MAAM,GAAG,GAAG,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAW,CAAC;YACrE,OAAO;gBACL,cAAc,EAAE,MAAM,CAAC,MAAA,GAAG,CAAC,SAAS,mCAAI,EAAE,CAAC;gBAC3C,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC;gBAC1C,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC;gBAClC,WAAW,EAAE,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC;gBACtC,YAAY,EAAE,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC;gBACxC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;gBAC5C,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;aACzC,CAAC;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type SilentAuctionLot, type SilentAuctionRound } from './silentAuctionRules';
|
|
2
|
+
export declare const SILENT_AUCTION_API_URL = "https://auction.apptile.io";
|
|
3
|
+
/** Bid record entries per bulk read (Sparkl's batch). */
|
|
4
|
+
export declare const BID_RECORD_BATCH_SIZE = 90;
|
|
5
|
+
export declare const silentAuctions: {
|
|
6
|
+
/** Whether silent auctions are set up (`silentAuctions.appId` in the config). */
|
|
7
|
+
isConfigured(): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* The store's lots: `current` (open and closed lots of the running rounds) or `upcoming`. A 404 is
|
|
10
|
+
* "none": the service says it for a store with nothing scheduled (and for an app id it doesn't know).
|
|
11
|
+
*/
|
|
12
|
+
lots(filter?: "current" | "upcoming"): Promise<SilentAuctionLot[]>;
|
|
13
|
+
/**
|
|
14
|
+
* One product's lot, for its product page. Null when the product isn't in a round: a 404, or a lot
|
|
15
|
+
* with no close time (nothing to count down, no round to be in).
|
|
16
|
+
*/
|
|
17
|
+
lot(productId: string): Promise<SilentAuctionLot | null>;
|
|
18
|
+
/**
|
|
19
|
+
* A bid. Ids may be GIDs or bare; the service is sent bare ones. Throws when the service refuses or
|
|
20
|
+
* doesn't answer. Doesn't record it: `recordBid` does, after.
|
|
21
|
+
*/
|
|
22
|
+
bid(params: {
|
|
23
|
+
productId: string;
|
|
24
|
+
customerId: string;
|
|
25
|
+
amount: number;
|
|
26
|
+
variantId?: string | null;
|
|
27
|
+
email?: string | null;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* The lots behind bid record entries (`<product>-<auction>`), 90 to a request, all at once. A batch
|
|
31
|
+
* that fails is counted, not thrown, so the rest still show.
|
|
32
|
+
*/
|
|
33
|
+
lotsForBidEntries(entries: string[]): Promise<{
|
|
34
|
+
lots: SilentAuctionLot[];
|
|
35
|
+
failedBatches: number;
|
|
36
|
+
totalBatches: number;
|
|
37
|
+
}>;
|
|
38
|
+
/** The store's rounds, from the live-selling gateway: `active` (bidding open) or `upcoming`. */
|
|
39
|
+
rounds(filter?: "active" | "upcoming"): Promise<SilentAuctionRound[]>;
|
|
40
|
+
/**
|
|
41
|
+
* The signed-in customer's bid record: their id, the entries the service can be asked about, and how
|
|
42
|
+
* many it can't. Null without `customerAccountRequest`. Throws when the read fails, so a failed read
|
|
43
|
+
* isn't shown as "no bids".
|
|
44
|
+
*/
|
|
45
|
+
bidRecord(): Promise<{
|
|
46
|
+
customerId: string | null;
|
|
47
|
+
entries: string[];
|
|
48
|
+
skipped: number;
|
|
49
|
+
} | null>;
|
|
50
|
+
/**
|
|
51
|
+
* Adds a placed bid to the customer's record, which My Bids reads (the service keeps no per-bidder
|
|
52
|
+
* index). False when it couldn't be recorded. Never throws: the bid is already placed, and a failure
|
|
53
|
+
* here mustn't read as a failed bid; it is retried once and reported. One append at a time, or two
|
|
54
|
+
* bids within one round trip each read the same list and the second write drops the first.
|
|
55
|
+
*/
|
|
56
|
+
recordBid(productId: string | null | undefined, auctionId: string | null | undefined): Promise<boolean>;
|
|
57
|
+
/**
|
|
58
|
+
* The variant this device last bid on for a product, so its page opens on that size. Null when none.
|
|
59
|
+
* Sparkl's key (`pdp.bidVariant.<product id>`), so what its app remembered is still read.
|
|
60
|
+
*/
|
|
61
|
+
bidVariant(productId: string): Promise<string | null>;
|
|
62
|
+
/** Remember the variant a bid was placed on. Never throws. */
|
|
63
|
+
rememberBidVariant(productId: string, variantId: string): Promise<void>;
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=silentAuctions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"silentAuctions.d.ts","sourceRoot":"","sources":["../src/silentAuctions.ts"],"names":[],"mappings":"AAsBA,OAAO,EASL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,sBAAsB,CAAC;AAG9B,eAAO,MAAM,sBAAsB,+BAA+B,CAAC;AACnE,yDAAyD;AACzD,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAiFxC,eAAO,MAAM,cAAc;IACzB,iFAAiF;oBACjE,OAAO;IAIvB;;;OAGG;kBACgB,SAAS,GAAG,UAAU,GAAe,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAUnF;;;OAGG;mBACkB,MAAM,GAAG,OAAO,CAA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