@wix/himalaya-cli 0.2047.0 → 0.2048.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/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/index.d.ts +5 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/monitoring.d.ts +81 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/sdk-types/src/capabilities.generated.d.ts +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/apple-iap-contract.d.ts +7 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/checkout-monitoring.d.ts +23 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/audio-record.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calendar.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calls.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/contacts.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +530 -68
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap.mjs +198 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/location.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/motion.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/photos.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +532 -70
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdk-types.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/tasks.mjs +1 -1
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{bfa6093b86d3106ef891a717dc0da1b1c0d9d1a456259753c25398bbafbcef8e.bin → 78e9187a8551e2a63e7bc9f5cda8449c6a39ba3d9bcfa40947713322e68a3e3b.bin} +1 -1
- package/dist/browser-plane/sw.js +7 -7
- package/dist/cli.mjs +48 -47
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/sdk-reference.json +121 -2
- package/package.json +2 -2
|
@@ -840,7 +840,7 @@ function createFileShareService(opts = {}) {
|
|
|
840
840
|
uploadHidden: true
|
|
841
841
|
};
|
|
842
842
|
}
|
|
843
|
-
async function
|
|
843
|
+
async function failureOf3(error) {
|
|
844
844
|
const status2 = httpStatus(error);
|
|
845
845
|
if (status2 === 428) return "notInstalled";
|
|
846
846
|
if (status2 === 401 || status2 === 403) {
|
|
@@ -880,7 +880,7 @@ function createFileShareService(opts = {}) {
|
|
|
880
880
|
};
|
|
881
881
|
} catch (error) {
|
|
882
882
|
if (isReaderChange(error)) return { generation: mine, cursor, readerChanged: true };
|
|
883
|
-
return { generation: mine, cursor, failure: await
|
|
883
|
+
return { generation: mine, cursor, failure: await failureOf3(error) };
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
886
|
async function applyRead(state, result) {
|
|
@@ -5248,6 +5248,192 @@ var COMPLETE_PAYMENT_CODES = [
|
|
|
5248
5248
|
];
|
|
5249
5249
|
var GET_PAYMENT_CODES = ["NOT_FOUND"];
|
|
5250
5250
|
|
|
5251
|
+
// ../../core/sdk/iap/src/monitoring.ts
|
|
5252
|
+
var FORBIDDEN_IAP_FIELDS = [
|
|
5253
|
+
"memberid",
|
|
5254
|
+
"contactid",
|
|
5255
|
+
"sitememberid",
|
|
5256
|
+
"userid",
|
|
5257
|
+
"appuserid",
|
|
5258
|
+
"uuid",
|
|
5259
|
+
"visitorid",
|
|
5260
|
+
"signedtransaction",
|
|
5261
|
+
"jws",
|
|
5262
|
+
"signedinstance",
|
|
5263
|
+
"instance",
|
|
5264
|
+
"signedpayload",
|
|
5265
|
+
"cookie",
|
|
5266
|
+
"cookies",
|
|
5267
|
+
"authorization",
|
|
5268
|
+
"token",
|
|
5269
|
+
"accesstoken",
|
|
5270
|
+
"appaccounttoken",
|
|
5271
|
+
"refreshtoken",
|
|
5272
|
+
"session",
|
|
5273
|
+
"email",
|
|
5274
|
+
"emailaddress",
|
|
5275
|
+
"name",
|
|
5276
|
+
"firstname",
|
|
5277
|
+
"lastname",
|
|
5278
|
+
"fullname",
|
|
5279
|
+
"nickname",
|
|
5280
|
+
"phone"
|
|
5281
|
+
];
|
|
5282
|
+
var FORBIDDEN = new Set(FORBIDDEN_IAP_FIELDS);
|
|
5283
|
+
var JWS = /^[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}$/;
|
|
5284
|
+
var EMAIL = /[^\s@]+@[^\s@]+\.[^\s@]+/;
|
|
5285
|
+
var HTTP_FAILURE = /^HTTP (\d{3})(?: \[([A-Za-z0-9_]+)\])?/;
|
|
5286
|
+
var TRANSACTION = "IapPurchase";
|
|
5287
|
+
var isForbiddenKey = (key) => FORBIDDEN.has(key.toLowerCase().replace(/[_-]/g, ""));
|
|
5288
|
+
var isForbiddenValue = (value) => typeof value === "string" && (JWS.test(value) || EMAIL.test(value));
|
|
5289
|
+
function scrubIapData(data) {
|
|
5290
|
+
return scrubObject(data, 0);
|
|
5291
|
+
}
|
|
5292
|
+
var MAX_DEPTH = 3;
|
|
5293
|
+
function scrubObject(data, depth) {
|
|
5294
|
+
const kept = {};
|
|
5295
|
+
for (const [key, value] of Object.entries(data)) {
|
|
5296
|
+
if (isForbiddenKey(key)) continue;
|
|
5297
|
+
const scrubbed = scrubValue(value, depth);
|
|
5298
|
+
if (scrubbed !== void 0) kept[key] = scrubbed;
|
|
5299
|
+
}
|
|
5300
|
+
return kept;
|
|
5301
|
+
}
|
|
5302
|
+
function scrubValue(value, depth) {
|
|
5303
|
+
if (value === void 0 || isForbiddenValue(value)) return void 0;
|
|
5304
|
+
if (Array.isArray(value) || isPlainObject2(value)) {
|
|
5305
|
+
if (depth >= MAX_DEPTH) return void 0;
|
|
5306
|
+
return Array.isArray(value) ? value.map((item) => scrubValue(item, depth + 1)).filter((item) => item !== void 0) : scrubObject(value, depth + 1);
|
|
5307
|
+
}
|
|
5308
|
+
return value === null || ["string", "number", "boolean"].includes(typeof value) ? value : void 0;
|
|
5309
|
+
}
|
|
5310
|
+
function describeIapError(error) {
|
|
5311
|
+
try {
|
|
5312
|
+
if (error === void 0 || error === null) return {};
|
|
5313
|
+
const failure4 = typeof error === "object" ? error : {};
|
|
5314
|
+
const http = typeof failure4.message === "string" ? HTTP_FAILURE.exec(failure4.message) : null;
|
|
5315
|
+
const status2 = failure4.httpStatus ?? failure4.status ?? (http ? Number(http[1]) : void 0);
|
|
5316
|
+
const code = failure4.code ?? failure4.kind ?? http?.[2];
|
|
5317
|
+
return defined({
|
|
5318
|
+
// `httpStatus`, not `status`: an outcome's `status` is the purchase's (bought, failed…).
|
|
5319
|
+
httpStatus: typeof status2 === "number" ? status2 : void 0,
|
|
5320
|
+
code: typeof code === "string" ? code : void 0,
|
|
5321
|
+
requestId: typeof failure4.requestId === "string" ? failure4.requestId : void 0,
|
|
5322
|
+
// The error's type, never its message: the bridge copies part of the server's response into
|
|
5323
|
+
// the message, and no filter can recognise every id or token that text may echo.
|
|
5324
|
+
// Read by shape: a rejection can come from another realm.
|
|
5325
|
+
error: typeof failure4.name === "string" && typeof failure4.message === "string" ? failure4.name : void 0
|
|
5326
|
+
});
|
|
5327
|
+
} catch {
|
|
5328
|
+
return {};
|
|
5329
|
+
}
|
|
5330
|
+
}
|
|
5331
|
+
function outcomeLevel(outcome) {
|
|
5332
|
+
if (outcome.status === "failed" || outcome.status === "error") return outcome.charged === true ? "error" : "warn";
|
|
5333
|
+
return "info";
|
|
5334
|
+
}
|
|
5335
|
+
function createIapMonitor(options) {
|
|
5336
|
+
const { sink } = options;
|
|
5337
|
+
const now = options.now ?? Date.now;
|
|
5338
|
+
const newId = options.newId ?? newFlowId;
|
|
5339
|
+
let gateLogged = false;
|
|
5340
|
+
function log(type, data = {}, level = "info") {
|
|
5341
|
+
safely(() => {
|
|
5342
|
+
const shared2 = safeContext(options.context);
|
|
5343
|
+
sink({ type, level, data: scrubIapData({ ...shared2, ...data, eventAt: now() }) });
|
|
5344
|
+
});
|
|
5345
|
+
}
|
|
5346
|
+
function bug(fingerprint, error, data = {}) {
|
|
5347
|
+
log(`iap.bug.${fingerprint.replace("himi-iap-", "")}`, { ...data, ...describeIapError(error), fingerprint }, "error");
|
|
5348
|
+
}
|
|
5349
|
+
function gate(gate2) {
|
|
5350
|
+
if (gateLogged) return;
|
|
5351
|
+
gateLogged = true;
|
|
5352
|
+
log("iap.gate", gate2);
|
|
5353
|
+
}
|
|
5354
|
+
return { log, bug, gate, flow: (entry, ids = {}) => createIapFlow(entry, ids, { log, now, flowId: newId() }) };
|
|
5355
|
+
}
|
|
5356
|
+
function createIapFlow(entry, initial, host) {
|
|
5357
|
+
const { flowId } = host;
|
|
5358
|
+
const ids = {};
|
|
5359
|
+
const stepMs = {};
|
|
5360
|
+
const notes = {};
|
|
5361
|
+
const startedAt = host.now();
|
|
5362
|
+
let stepStartedAt = startedAt;
|
|
5363
|
+
let lastStep;
|
|
5364
|
+
const add = (next) => {
|
|
5365
|
+
Object.assign(ids, defined(next));
|
|
5366
|
+
};
|
|
5367
|
+
const data = (extra = {}) => ({ flowId, entry, ...ids, ...extra });
|
|
5368
|
+
const transaction = () => ({ transaction: TRANSACTION, id: flowId, flowId, entry });
|
|
5369
|
+
const closeStep = () => {
|
|
5370
|
+
const at = host.now();
|
|
5371
|
+
if (lastStep) stepMs[lastStep] = (stepMs[lastStep] ?? 0) + at - stepStartedAt;
|
|
5372
|
+
stepStartedAt = at;
|
|
5373
|
+
};
|
|
5374
|
+
add(initial);
|
|
5375
|
+
return {
|
|
5376
|
+
flowId,
|
|
5377
|
+
entry,
|
|
5378
|
+
add,
|
|
5379
|
+
get knownIds() {
|
|
5380
|
+
return { ...ids };
|
|
5381
|
+
},
|
|
5382
|
+
at(step) {
|
|
5383
|
+
closeStep();
|
|
5384
|
+
lastStep = step;
|
|
5385
|
+
},
|
|
5386
|
+
note(extra) {
|
|
5387
|
+
Object.assign(notes, defined(extra));
|
|
5388
|
+
},
|
|
5389
|
+
started(extra = {}) {
|
|
5390
|
+
host.log("iap.purchase.started", data(extra));
|
|
5391
|
+
host.log("iap.transaction.start", transaction());
|
|
5392
|
+
},
|
|
5393
|
+
failed(step, error, extra = {}, level = extra.charged === true ? "error" : "warn") {
|
|
5394
|
+
host.log(`iap.${step}.failed`, data({ ...describeIapError(error), ...extra }), level);
|
|
5395
|
+
},
|
|
5396
|
+
outcome(outcome, messageKey, extra = {}) {
|
|
5397
|
+
closeStep();
|
|
5398
|
+
host.log("iap.purchase.outcome", data({
|
|
5399
|
+
...notes,
|
|
5400
|
+
...outcome,
|
|
5401
|
+
messageKey,
|
|
5402
|
+
lastStep,
|
|
5403
|
+
stepMs: { ...stepMs },
|
|
5404
|
+
durationMs: host.now() - startedAt,
|
|
5405
|
+
...extra
|
|
5406
|
+
}), outcomeLevel(outcome));
|
|
5407
|
+
if (outcome.status === "bought") host.log("iap.transaction.finish", transaction());
|
|
5408
|
+
}
|
|
5409
|
+
};
|
|
5410
|
+
}
|
|
5411
|
+
function safeContext(context) {
|
|
5412
|
+
try {
|
|
5413
|
+
return context ? { ...context() } : {};
|
|
5414
|
+
} catch {
|
|
5415
|
+
return {};
|
|
5416
|
+
}
|
|
5417
|
+
}
|
|
5418
|
+
function safely(run) {
|
|
5419
|
+
try {
|
|
5420
|
+
run();
|
|
5421
|
+
} catch {
|
|
5422
|
+
}
|
|
5423
|
+
}
|
|
5424
|
+
function defined(data) {
|
|
5425
|
+
return Object.fromEntries(Object.entries(data).filter(([, value]) => value !== void 0));
|
|
5426
|
+
}
|
|
5427
|
+
function isPlainObject2(value) {
|
|
5428
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
5429
|
+
const prototype = Object.getPrototypeOf(value);
|
|
5430
|
+
return prototype === Object.prototype || prototype === null;
|
|
5431
|
+
}
|
|
5432
|
+
function newFlowId() {
|
|
5433
|
+
const random = globalThis.crypto?.randomUUID?.();
|
|
5434
|
+
return random ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
5435
|
+
}
|
|
5436
|
+
|
|
5251
5437
|
// ../../core/sdk/iap/src/index.ts
|
|
5252
5438
|
async function storefrontCountryCode() {
|
|
5253
5439
|
try {
|
|
@@ -5258,6 +5444,12 @@ async function storefrontCountryCode() {
|
|
|
5258
5444
|
return null;
|
|
5259
5445
|
}
|
|
5260
5446
|
}
|
|
5447
|
+
var nativeIapEventSink = (event) => {
|
|
5448
|
+
try {
|
|
5449
|
+
dispatch("capability.iap.logEvent", { type: event.type, level: event.level, data: JSON.stringify(event.data) }).catch(() => void 0);
|
|
5450
|
+
} catch {
|
|
5451
|
+
}
|
|
5452
|
+
};
|
|
5261
5453
|
async function getProducts(productIds) {
|
|
5262
5454
|
if (!productIds || productIds.length === 0) return [];
|
|
5263
5455
|
const r = await dispatch("capability.iap.getProducts", {
|
|
@@ -5367,6 +5559,262 @@ function videosAppleSalesEnabled() {
|
|
|
5367
5559
|
return VIDEOS_APPLE_SALES_ENABLED;
|
|
5368
5560
|
}
|
|
5369
5561
|
|
|
5562
|
+
// ../../stdlib/flows/iap-checkout/src/iap-finish-policy.ts
|
|
5563
|
+
var COMPLETE_PAYMENT_REFUSALS = {
|
|
5564
|
+
// After recordPurchase (PurchaseMatcher.refusalOf / orphan): the purchase is recorded.
|
|
5565
|
+
NOT_PURCHASED: "refusedFinal",
|
|
5566
|
+
PURCHASE_REVOKED: "refusedFinal",
|
|
5567
|
+
ZERO_PRICE: "refusedFinal",
|
|
5568
|
+
NO_MATCHING_PAYMENT: "refusedFinal",
|
|
5569
|
+
PAYMENT_NOT_PENDING: "refusedFinal",
|
|
5570
|
+
// Before recordPurchase: nothing is recorded. Held pending owner confirmation.
|
|
5571
|
+
INVALID_PURCHASE: "hold",
|
|
5572
|
+
APP_NOT_CONFIGURED: "hold",
|
|
5573
|
+
OWNED_BY_ANOTHER_CUSTOMER: "ownershipConflict"
|
|
5574
|
+
};
|
|
5575
|
+
function isFinalRefusal(status2) {
|
|
5576
|
+
return status2 === "canceling" || status2 === "canceled" || status2 === "refunding" || status2 === "refunded";
|
|
5577
|
+
}
|
|
5578
|
+
|
|
5579
|
+
// ../../stdlib/flows/iap-checkout/src/checkout-monitoring.ts
|
|
5580
|
+
var CHARGE_FAILURES = /* @__PURE__ */ new Set(["chargeFailed", "orderRefused", "orderClosed"]);
|
|
5581
|
+
var CHARGE_PATH = /\/orders\/[^/]+\/charges$/;
|
|
5582
|
+
var AFTER_SHEET_FAILURES = /* @__PURE__ */ new Set(["verificationFailed", "persistenceFailed", "invalidResponse"]);
|
|
5583
|
+
function createCheckoutMonitoring(deps) {
|
|
5584
|
+
let known = null;
|
|
5585
|
+
let current = null;
|
|
5586
|
+
let storeAnswered;
|
|
5587
|
+
const running = [];
|
|
5588
|
+
const trigger = () => running[running.length - 1] ?? "background";
|
|
5589
|
+
const finish = (entry) => {
|
|
5590
|
+
const at = running.lastIndexOf(entry);
|
|
5591
|
+
if (at >= 0) running.splice(at, 1);
|
|
5592
|
+
};
|
|
5593
|
+
const monitor = createIapMonitor({
|
|
5594
|
+
sink: deps.sink ?? nativeIapEventSink,
|
|
5595
|
+
context: () => ({ msid: known?.siteId, bundleId: known?.bundleId, isLoggedIn: deps.session.current().kind === "member" })
|
|
5596
|
+
});
|
|
5597
|
+
function binding(source) {
|
|
5598
|
+
return {
|
|
5599
|
+
current: async () => {
|
|
5600
|
+
const value = await source.current();
|
|
5601
|
+
known = value ?? known;
|
|
5602
|
+
return value;
|
|
5603
|
+
}
|
|
5604
|
+
};
|
|
5605
|
+
}
|
|
5606
|
+
function wixIap(client) {
|
|
5607
|
+
return {
|
|
5608
|
+
getPayment: (input) => client.getPayment(input),
|
|
5609
|
+
cancelPayment: (input) => client.cancelPayment(input),
|
|
5610
|
+
startPayment: async (input) => {
|
|
5611
|
+
const sender = current;
|
|
5612
|
+
if (sender) {
|
|
5613
|
+
sender.chargeError = void 0;
|
|
5614
|
+
sender.chargeRequested = false;
|
|
5615
|
+
}
|
|
5616
|
+
sender?.flow.add({ wixTransactionId: input.wixTransactionId });
|
|
5617
|
+
sender?.flow.at("start");
|
|
5618
|
+
const started = await client.startPayment(input);
|
|
5619
|
+
noteStarted(sender, started);
|
|
5620
|
+
return started;
|
|
5621
|
+
},
|
|
5622
|
+
startItemPayment: async (input) => {
|
|
5623
|
+
const sender = current;
|
|
5624
|
+
sender?.flow.add({ productIds: input.item.catalogItemId });
|
|
5625
|
+
sender?.flow.at("start");
|
|
5626
|
+
const started = await client.startItemPayment(input);
|
|
5627
|
+
noteStarted(sender, started);
|
|
5628
|
+
return started;
|
|
5629
|
+
},
|
|
5630
|
+
completePayment: async (transaction) => {
|
|
5631
|
+
const purchase2 = purchaseOf(transaction);
|
|
5632
|
+
purchase2?.flow.at("complete");
|
|
5633
|
+
const generation = deps.session.current().generation;
|
|
5634
|
+
const completed = await client.completePayment(transaction);
|
|
5635
|
+
if (purchase2 && purchase2 !== current || deps.session.current().generation !== generation) return completed;
|
|
5636
|
+
if (purchase2) noteCompleted(purchase2, transaction, completed);
|
|
5637
|
+
else noteRecovered(transaction, completed);
|
|
5638
|
+
return completed;
|
|
5639
|
+
}
|
|
5640
|
+
};
|
|
5641
|
+
}
|
|
5642
|
+
function noteStarted(sender, started) {
|
|
5643
|
+
if (!sender || sender !== current) return;
|
|
5644
|
+
const { flow } = sender;
|
|
5645
|
+
if (started.status === "started") {
|
|
5646
|
+
const { payment, storeProductId, appAccountToken } = started;
|
|
5647
|
+
flow.add({ wixTransactionId: payment.wixTransactionId, paymentId: payment.paymentId, storeProductId });
|
|
5648
|
+
sender.token = appAccountToken.toLowerCase();
|
|
5649
|
+
} else if (started.status === "failed") {
|
|
5650
|
+
flow.failed("start", started);
|
|
5651
|
+
} else {
|
|
5652
|
+
flow.failed("start", { code: started.status, httpStatus: started.httpStatus }, { kind: started.kind });
|
|
5653
|
+
}
|
|
5654
|
+
}
|
|
5655
|
+
function noteCompleted(purchase2, transaction, completed) {
|
|
5656
|
+
const { flow } = purchase2;
|
|
5657
|
+
if (completed.status === "matched") {
|
|
5658
|
+
flow.add({ paymentId: completed.payment.paymentId });
|
|
5659
|
+
if (!isFinalRefusal(completed.payment.status)) {
|
|
5660
|
+
purchase2.completed = completed.payment.status === "pending" ? "pending" : "matched";
|
|
5661
|
+
return;
|
|
5662
|
+
}
|
|
5663
|
+
}
|
|
5664
|
+
const refusal = refusalOf2(completed);
|
|
5665
|
+
purchase2.completed = refusal === "final" ? "final" : "pending";
|
|
5666
|
+
flow.failed("complete", failureOf(completed), { charged: true, final: refusal === "final" }, LEVELS[refusal]);
|
|
5667
|
+
if (refusal === "final") monitor.bug("himi-iap-charged-not-completed", failureOf(completed), { ...flowIds(flow), transactionId: transaction.transactionId });
|
|
5668
|
+
}
|
|
5669
|
+
function noteRecovered(transaction, completed) {
|
|
5670
|
+
const payment = completed.status === "matched" ? completed.payment : void 0;
|
|
5671
|
+
const refusal = payment?.status === "pending" ? "retried" : payment && !isFinalRefusal(payment.status) ? null : refusalOf2(completed);
|
|
5672
|
+
const ids = { transactionId: transaction.transactionId, storeProductId: transaction.productId, paymentId: payment?.paymentId, wixTransactionId: payment?.wixTransactionId };
|
|
5673
|
+
const outcome = refusal === null ? "completed" : refusal === "final" ? "refused" : refusal === "otherMember" ? "otherMember" : "held";
|
|
5674
|
+
const by = trigger();
|
|
5675
|
+
monitor.log("iap.recovery.outcome", { ...ids, ...failureOf(completed), trigger: by, outcome, charged: true }, refusal === null ? "info" : LEVELS[refusal]);
|
|
5676
|
+
if (refusal === "final") monitor.bug("himi-iap-charged-not-completed", failureOf(completed), { ...ids, trigger: by });
|
|
5677
|
+
}
|
|
5678
|
+
function bridge(inner) {
|
|
5679
|
+
return {
|
|
5680
|
+
observes: inner,
|
|
5681
|
+
call: async (method, path, ...rest) => {
|
|
5682
|
+
const charging = method === "POST" && CHARGE_PATH.test(path) ? current : null;
|
|
5683
|
+
if (charging) charging.chargeRequested = true;
|
|
5684
|
+
charging?.flow.at("charge");
|
|
5685
|
+
try {
|
|
5686
|
+
return await inner.call(method, path, ...rest);
|
|
5687
|
+
} catch (error) {
|
|
5688
|
+
if (charging) charging.chargeError = error;
|
|
5689
|
+
throw error;
|
|
5690
|
+
}
|
|
5691
|
+
}
|
|
5692
|
+
};
|
|
5693
|
+
}
|
|
5694
|
+
function orderFailed(failure4) {
|
|
5695
|
+
if (!current || !failure4 || !current.chargeRequested) return;
|
|
5696
|
+
const { chargeError } = current;
|
|
5697
|
+
if (!CHARGE_FAILURES.has(failure4) && !(chargeError !== void 0 && failure4 === "unavailable")) return;
|
|
5698
|
+
current.chargeError = void 0;
|
|
5699
|
+
current.flow.failed("charge", chargeError ?? { code: failure4 }, { failure: failure4 });
|
|
5700
|
+
}
|
|
5701
|
+
function store(inner) {
|
|
5702
|
+
return {
|
|
5703
|
+
getUnfinishedTransactions: async () => {
|
|
5704
|
+
const listed = await inner.getUnfinishedTransactions();
|
|
5705
|
+
if (listed.status === "ok") storeAnswered ?? (storeAnswered = true);
|
|
5706
|
+
else if (listed.code === "unsupported" || listed.code === "unavailable") storeAnswered ?? (storeAnswered = false);
|
|
5707
|
+
return listed;
|
|
5708
|
+
},
|
|
5709
|
+
purchaseForVerification: async (input) => {
|
|
5710
|
+
const sender = current;
|
|
5711
|
+
const generation = deps.session.current().generation;
|
|
5712
|
+
sender?.flow.at("storekit");
|
|
5713
|
+
const result = await inner.purchaseForVerification(input);
|
|
5714
|
+
if (!sender || sender !== current || deps.session.current().generation !== generation) return result;
|
|
5715
|
+
if (result.status === "purchased" && result.transaction.appAccountToken?.toLowerCase() === sender.token) {
|
|
5716
|
+
sender.charged = true;
|
|
5717
|
+
sender.flow.add({ transactionId: result.transaction.transactionId, storeProductId: result.transaction.productId });
|
|
5718
|
+
}
|
|
5719
|
+
if (result.status === "failed") {
|
|
5720
|
+
const maybeCharged = AFTER_SHEET_FAILURES.has(result.code);
|
|
5721
|
+
if (maybeCharged) sender.maybeCharged = true;
|
|
5722
|
+
sender.flow.failed("storekit", { code: result.code }, { maybeCharged, storeProductId: input.productId });
|
|
5723
|
+
}
|
|
5724
|
+
return result;
|
|
5725
|
+
},
|
|
5726
|
+
finishTransaction: async (input) => {
|
|
5727
|
+
const purchase2 = current && current.flow.knownIds.transactionId === input.transactionId ? current : null;
|
|
5728
|
+
purchase2?.flow.at("finish");
|
|
5729
|
+
const result = await inner.finishTransaction(input);
|
|
5730
|
+
if (result.status === "failed") {
|
|
5731
|
+
monitor.log("iap.finish.failed", { ...purchase2 ? flowIds(purchase2.flow) : { trigger: trigger() }, transactionId: input.transactionId, code: result.code }, "error");
|
|
5732
|
+
}
|
|
5733
|
+
return result;
|
|
5734
|
+
}
|
|
5735
|
+
};
|
|
5736
|
+
}
|
|
5737
|
+
async function purchase(run) {
|
|
5738
|
+
const owned = { purchase: null };
|
|
5739
|
+
const begin = () => {
|
|
5740
|
+
if (current) return;
|
|
5741
|
+
owned.purchase = current = { flow: monitor.flow("page"), charged: false };
|
|
5742
|
+
owned.purchase.flow.started();
|
|
5743
|
+
};
|
|
5744
|
+
running.push("beforePurchase");
|
|
5745
|
+
try {
|
|
5746
|
+
const state = await run(begin);
|
|
5747
|
+
owned.purchase?.flow.outcome(outcomeOf(owned.purchase, state), state.failure ?? state.phase);
|
|
5748
|
+
return state;
|
|
5749
|
+
} catch (error) {
|
|
5750
|
+
const failed = owned.purchase;
|
|
5751
|
+
monitor.bug("himi-iap-unexpected", error, failed ? flowIds(failed.flow) : {});
|
|
5752
|
+
failed?.flow.outcome({ status: "error", charged: failed.charged }, "unexpected");
|
|
5753
|
+
throw error;
|
|
5754
|
+
} finally {
|
|
5755
|
+
finish("beforePurchase");
|
|
5756
|
+
if (owned.purchase && current === owned.purchase) current = null;
|
|
5757
|
+
}
|
|
5758
|
+
}
|
|
5759
|
+
async function recovery(next, run) {
|
|
5760
|
+
running.push(next);
|
|
5761
|
+
try {
|
|
5762
|
+
return await run();
|
|
5763
|
+
} catch (error) {
|
|
5764
|
+
monitor.bug("himi-iap-recovery-crash", error, { trigger: next });
|
|
5765
|
+
throw error;
|
|
5766
|
+
} finally {
|
|
5767
|
+
finish(next);
|
|
5768
|
+
}
|
|
5769
|
+
}
|
|
5770
|
+
function purchaseOf(transaction) {
|
|
5771
|
+
const token = transaction.appAccountToken?.toLowerCase();
|
|
5772
|
+
return current && token && current.token === token ? current : null;
|
|
5773
|
+
}
|
|
5774
|
+
return {
|
|
5775
|
+
wixIap,
|
|
5776
|
+
store,
|
|
5777
|
+
bridge,
|
|
5778
|
+
binding,
|
|
5779
|
+
purchase,
|
|
5780
|
+
recovery,
|
|
5781
|
+
notRun: (reason) => monitor.log("iap.checkout.notRun", { reason }, "warn"),
|
|
5782
|
+
loginFailed: (from) => monitor.log("iap.login.failed", { from }, "warn"),
|
|
5783
|
+
orderFailed,
|
|
5784
|
+
paidUnitStuck: (ref) => monitor.bug("himi-iap-paid-unit-stuck", null, {
|
|
5785
|
+
paymentId: ref.paymentId,
|
|
5786
|
+
wixTransactionId: ref.wixTransactionId,
|
|
5787
|
+
storeProductId: ref.storeProductId,
|
|
5788
|
+
transactionId: ref.appleTransactionId
|
|
5789
|
+
}),
|
|
5790
|
+
// StoreKit's own answer when it has given one: a sign-in prompt can hide an unsupported store.
|
|
5791
|
+
gate: (storeKit) => monitor.gate({ enabled: true, storeKit: storeAnswered ?? storeKit, experiment: false })
|
|
5792
|
+
};
|
|
5793
|
+
}
|
|
5794
|
+
var LEVELS = { final: "error", retried: "warn", otherMember: "info" };
|
|
5795
|
+
function refusalOf2(completed) {
|
|
5796
|
+
if (completed.status === "matched") return "final";
|
|
5797
|
+
if (completed.kind !== "application") return "retried";
|
|
5798
|
+
const refusal = COMPLETE_PAYMENT_REFUSALS[completed.code];
|
|
5799
|
+
return refusal === "refusedFinal" ? "final" : refusal === "ownershipConflict" ? "otherMember" : "retried";
|
|
5800
|
+
}
|
|
5801
|
+
function failureOf(completed) {
|
|
5802
|
+
if (completed.status === "matched") return { code: `payment_${completed.payment.status}` };
|
|
5803
|
+
return { code: completed.kind === "application" ? completed.code : completed.kind, httpStatus: completed.httpStatus };
|
|
5804
|
+
}
|
|
5805
|
+
function outcomeOf(purchase, state) {
|
|
5806
|
+
const { charged, completed } = purchase;
|
|
5807
|
+
if (completed === "final") return { status: "failed", charged };
|
|
5808
|
+
if (completed === "matched") return { status: "bought", charged };
|
|
5809
|
+
if (charged) return { status: "pending", charged };
|
|
5810
|
+
if (state.phase === "cancelled") return { status: "cancelled", charged };
|
|
5811
|
+
if (state.phase === "awaitingApproval") return { status: "pending", charged };
|
|
5812
|
+
return purchase.maybeCharged ? { status: "failed", charged, maybeCharged: true } : { status: "failed", charged };
|
|
5813
|
+
}
|
|
5814
|
+
function flowIds(flow) {
|
|
5815
|
+
return { flowId: flow.flowId, entry: flow.entry, ...flow.knownIds };
|
|
5816
|
+
}
|
|
5817
|
+
|
|
5370
5818
|
// ../../stdlib/flows/iap-checkout/src/cashier-charges.ts
|
|
5371
5819
|
async function ensureAppleIapCharge(bridge, route, orderId) {
|
|
5372
5820
|
const invalid2 = invalidRequest(route, orderId);
|
|
@@ -5384,7 +5832,7 @@ function invalidRequest(route, orderId) {
|
|
|
5384
5832
|
}
|
|
5385
5833
|
async function listOrderCharges(bridge, route, orderId) {
|
|
5386
5834
|
const answer = await bridge.call("GET", chargesPath(route, orderId));
|
|
5387
|
-
if (answer.status !== "ok") return
|
|
5835
|
+
if (answer.status !== "ok") return failureOf2(answer);
|
|
5388
5836
|
const charges = decodeCharges(answer.body);
|
|
5389
5837
|
return charges ? { status: "ok", charges } : { status: "invalidResponse" };
|
|
5390
5838
|
}
|
|
@@ -5429,7 +5877,7 @@ function decodeCharge(raw) {
|
|
|
5429
5877
|
const method = isNonEmpty2(raw.paymentMethodId) ? raw.paymentMethodId : isNonEmpty2(raw.paymentMethod) ? raw.paymentMethod : "";
|
|
5430
5878
|
return { chargeId: raw.chargeId, transactionId: raw.transactionId, status: isNonEmpty2(state.status) ? state.status : "UNDEFINED", paymentMethod: method };
|
|
5431
5879
|
}
|
|
5432
|
-
function
|
|
5880
|
+
function failureOf2(answer) {
|
|
5433
5881
|
return answer.status === "http" ? { status: "refused" } : { status: answer.status };
|
|
5434
5882
|
}
|
|
5435
5883
|
function chargesPath(route, orderId) {
|
|
@@ -5450,23 +5898,6 @@ var AWAITING_PAYMENT = /* @__PURE__ */ new Set(["INITIALIZATION", "INITIALIZED",
|
|
|
5450
5898
|
var RETRYABLE_AFTER = /* @__PURE__ */ new Set(["DECLINED", "FAILED"]);
|
|
5451
5899
|
var CLOSED = /* @__PURE__ */ new Set(["BUYER_CANCELED", "TIMEOUT", "VOIDED", "REFUND", "CHARGE_BACK", "OFFLINE"]);
|
|
5452
5900
|
|
|
5453
|
-
// ../../stdlib/flows/iap-checkout/src/iap-finish-policy.ts
|
|
5454
|
-
var COMPLETE_PAYMENT_REFUSALS = {
|
|
5455
|
-
// After recordPurchase (PurchaseMatcher.refusalOf / orphan): the purchase is recorded.
|
|
5456
|
-
NOT_PURCHASED: "refusedFinal",
|
|
5457
|
-
PURCHASE_REVOKED: "refusedFinal",
|
|
5458
|
-
ZERO_PRICE: "refusedFinal",
|
|
5459
|
-
NO_MATCHING_PAYMENT: "refusedFinal",
|
|
5460
|
-
PAYMENT_NOT_PENDING: "refusedFinal",
|
|
5461
|
-
// Before recordPurchase: nothing is recorded. Held pending owner confirmation.
|
|
5462
|
-
INVALID_PURCHASE: "hold",
|
|
5463
|
-
APP_NOT_CONFIGURED: "hold",
|
|
5464
|
-
OWNED_BY_ANOTHER_CUSTOMER: "ownershipConflict"
|
|
5465
|
-
};
|
|
5466
|
-
function isFinalRefusal(status2) {
|
|
5467
|
-
return status2 === "canceling" || status2 === "canceled" || status2 === "refunding" || status2 === "refunded";
|
|
5468
|
-
}
|
|
5469
|
-
|
|
5470
5901
|
// ../../stdlib/flows/iap-checkout/src/order-refs.ts
|
|
5471
5902
|
var NEEDS_SUPPORT_HOLD_MS = 6048e5;
|
|
5472
5903
|
var ITEM_START_HOLD_MS = 36e5;
|
|
@@ -5539,12 +5970,12 @@ function createWorkerOrderRefStore(storage) {
|
|
|
5539
5970
|
const store = kv();
|
|
5540
5971
|
if (!store) return false;
|
|
5541
5972
|
for (let attempt4 = 0; attempt4 < WRITE_ATTEMPTS; attempt4++) {
|
|
5542
|
-
const raw =
|
|
5973
|
+
const raw = safely2(() => store.getItem(location));
|
|
5543
5974
|
const current = parseRefs(raw);
|
|
5544
5975
|
const next = current && change(current);
|
|
5545
5976
|
if (!next) return false;
|
|
5546
5977
|
if (next.length > 0 && !updateIndex(store, key, true)) return false;
|
|
5547
|
-
if (
|
|
5978
|
+
if (safely2(() => store.getItem(location)) !== raw) continue;
|
|
5548
5979
|
if (!writeVerified(store, location, serialize({ v: VERSION, refs: next }))) return false;
|
|
5549
5980
|
if (next.length === 0) updateIndex(store, key, false);
|
|
5550
5981
|
return true;
|
|
@@ -5574,7 +6005,7 @@ function updateIndex(store, key, holdsRefs) {
|
|
|
5574
6005
|
return next.length === members.length && next.every((m, i) => m === members[i]) || writeVerified(store, location, serialize({ v: VERSION, members: next }));
|
|
5575
6006
|
}
|
|
5576
6007
|
function readRefs(store, location) {
|
|
5577
|
-
return store ? parseRefs(
|
|
6008
|
+
return store ? parseRefs(safely2(() => store.getItem(location))) : null;
|
|
5578
6009
|
}
|
|
5579
6010
|
function parseRefs(raw) {
|
|
5580
6011
|
const parsed = parseVersioned(raw);
|
|
@@ -5589,17 +6020,17 @@ function readIndex(store, location) {
|
|
|
5589
6020
|
return parsed.members;
|
|
5590
6021
|
}
|
|
5591
6022
|
function readVersioned(store, location) {
|
|
5592
|
-
return store ? parseVersioned(
|
|
6023
|
+
return store ? parseVersioned(safely2(() => store.getItem(location))) : null;
|
|
5593
6024
|
}
|
|
5594
6025
|
function parseVersioned(raw) {
|
|
5595
6026
|
if (raw === void 0) return null;
|
|
5596
6027
|
if (raw === null || raw === "") return "empty";
|
|
5597
|
-
const parsed =
|
|
6028
|
+
const parsed = safely2(() => JSON.parse(raw));
|
|
5598
6029
|
return isObject6(parsed) && parsed.v === VERSION ? parsed : null;
|
|
5599
6030
|
}
|
|
5600
6031
|
function writeVerified(store, location, value) {
|
|
5601
6032
|
if (!store) return false;
|
|
5602
|
-
return
|
|
6033
|
+
return safely2(() => {
|
|
5603
6034
|
store.setItem(location, value);
|
|
5604
6035
|
return store.getItem(location) === value;
|
|
5605
6036
|
}) === true;
|
|
@@ -5644,7 +6075,7 @@ function hostStorage() {
|
|
|
5644
6075
|
const storage = globalThis.himalaya?.storage;
|
|
5645
6076
|
return typeof storage?.getItem === "function" && typeof storage.setItem === "function" ? storage : void 0;
|
|
5646
6077
|
}
|
|
5647
|
-
function
|
|
6078
|
+
function safely2(read2) {
|
|
5648
6079
|
try {
|
|
5649
6080
|
return read2();
|
|
5650
6081
|
} catch {
|
|
@@ -5693,7 +6124,7 @@ async function attempt3(bridge, method, path, body, expectation) {
|
|
|
5693
6124
|
const answer = expectation ? await bridge.call(method, path, body, void 0, expectation) : await bridge.call(method, path, body);
|
|
5694
6125
|
return { status: "ok", body: answer };
|
|
5695
6126
|
} catch (error) {
|
|
5696
|
-
return
|
|
6127
|
+
return refusalOf3(error);
|
|
5697
6128
|
}
|
|
5698
6129
|
}
|
|
5699
6130
|
function boundExpectation(session, provider, bridge) {
|
|
@@ -5705,9 +6136,13 @@ function boundExpectation(session, provider, bridge) {
|
|
|
5705
6136
|
}
|
|
5706
6137
|
function isLiveHost(bridge) {
|
|
5707
6138
|
const api = globalThis.himalaya?.wixApi;
|
|
5708
|
-
|
|
6139
|
+
if (api == null) return false;
|
|
6140
|
+
for (let at = bridge; at; at = at.observes) {
|
|
6141
|
+
if (at === api || at.call === api.call) return true;
|
|
6142
|
+
}
|
|
6143
|
+
return false;
|
|
5709
6144
|
}
|
|
5710
|
-
function
|
|
6145
|
+
function refusalOf3(error) {
|
|
5711
6146
|
const message = error?.message;
|
|
5712
6147
|
const text2 = typeof message === "string" ? message : "";
|
|
5713
6148
|
if (BRIDGE_REFUSAL2.test(text2)) return { status: "notEnabled" };
|
|
@@ -6291,23 +6726,28 @@ function enabledCheckout(deps) {
|
|
|
6291
6726
|
let tracking = Promise.resolve();
|
|
6292
6727
|
let partitionRead = null;
|
|
6293
6728
|
const awaitingApproval = /* @__PURE__ */ new Map();
|
|
6729
|
+
const monitoring = createCheckoutMonitoring({ sink: deps.monitorSink, session: deps.session });
|
|
6730
|
+
const watchedBinding = monitoring.binding(deps.binding);
|
|
6294
6731
|
const backend = createWixOrderBackend({
|
|
6295
|
-
wixIap: deps.wixIap,
|
|
6732
|
+
wixIap: monitoring.wixIap(deps.wixIap),
|
|
6296
6733
|
identity: deps.identity,
|
|
6297
|
-
binding:
|
|
6734
|
+
binding: watchedBinding,
|
|
6298
6735
|
session: deps.session,
|
|
6299
6736
|
clock: deps.clock,
|
|
6300
6737
|
cashier: deps.cashier,
|
|
6301
6738
|
adapters: deps.adapters,
|
|
6302
6739
|
refs,
|
|
6303
|
-
bridge,
|
|
6740
|
+
bridge: monitoring.bridge(bridge),
|
|
6304
6741
|
itemFor: (key) => sales.get(key),
|
|
6305
6742
|
productBusy,
|
|
6306
|
-
report:
|
|
6743
|
+
report: (event) => {
|
|
6744
|
+
monitoring.orderFailed(event.failure);
|
|
6745
|
+
onEvent(event);
|
|
6746
|
+
},
|
|
6307
6747
|
storeCountry: deps.storeCountry ?? storefrontCountryCode
|
|
6308
6748
|
});
|
|
6309
6749
|
const coordinator = createPurchaseCoordinator({
|
|
6310
|
-
store: deps.store ?? appleManagedStore,
|
|
6750
|
+
store: monitoring.store(deps.store ?? appleManagedStore),
|
|
6311
6751
|
backend,
|
|
6312
6752
|
session: deps.session,
|
|
6313
6753
|
clock: deps.clock,
|
|
@@ -6315,11 +6755,14 @@ function enabledCheckout(deps) {
|
|
|
6315
6755
|
onState: publish,
|
|
6316
6756
|
onAwaitingApproval: reserveAskToBuy
|
|
6317
6757
|
});
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6758
|
+
function start() {
|
|
6759
|
+
return monitoring.recovery("launch", async () => {
|
|
6760
|
+
resetIfSessionChanged();
|
|
6761
|
+
await coordinator.start();
|
|
6762
|
+
await trackPayments({ dueOnly: false });
|
|
6763
|
+
monitoring.gate(coordinator.getState().phase !== "unavailable");
|
|
6764
|
+
return state();
|
|
6765
|
+
});
|
|
6323
6766
|
}
|
|
6324
6767
|
async function checkAccess(items) {
|
|
6325
6768
|
resetIfSessionChanged();
|
|
@@ -6343,36 +6786,52 @@ function enabledCheckout(deps) {
|
|
|
6343
6786
|
}
|
|
6344
6787
|
return publishAndReturn();
|
|
6345
6788
|
}
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6789
|
+
function buy(item) {
|
|
6790
|
+
return monitoring.purchase(async (begin) => {
|
|
6791
|
+
resetIfSessionChanged();
|
|
6792
|
+
const key = itemKey(item);
|
|
6793
|
+
const appleProduct = settledAppleProduct(item);
|
|
6794
|
+
current = { item: key, failure: appleProduct ? null : "notAppleRoute", buying: false };
|
|
6795
|
+
if (!appleProduct) {
|
|
6796
|
+
monitoring.notRun("notAppleRoute");
|
|
6797
|
+
return publishAndReturn();
|
|
6798
|
+
}
|
|
6799
|
+
sales.set(key, { item, appleProduct });
|
|
6800
|
+
if (deps.session.current().kind === "member") begin();
|
|
6801
|
+
else {
|
|
6802
|
+
monitoring.loginFailed("checkout");
|
|
6803
|
+
monitoring.notRun("notLoggedIn");
|
|
6804
|
+
}
|
|
6805
|
+
current.buying = true;
|
|
6806
|
+
publish();
|
|
6807
|
+
await coordinator.purchase(key);
|
|
6808
|
+
if (current.item === key) current.buying = false;
|
|
6809
|
+
return publishAndReturn();
|
|
6810
|
+
});
|
|
6358
6811
|
}
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6812
|
+
function reconcile2() {
|
|
6813
|
+
return monitoring.recovery("reconcile", async () => {
|
|
6814
|
+
resetIfSessionChanged();
|
|
6815
|
+
await coordinator.reconcile();
|
|
6816
|
+
await trackPayments({ dueOnly: false });
|
|
6817
|
+
return state();
|
|
6818
|
+
});
|
|
6364
6819
|
}
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6820
|
+
function retry2() {
|
|
6821
|
+
return monitoring.recovery("retry", async () => {
|
|
6822
|
+
resetIfSessionChanged();
|
|
6823
|
+
await coordinator.retry();
|
|
6824
|
+
await trackPayments({ dueOnly: false });
|
|
6825
|
+
return state();
|
|
6826
|
+
});
|
|
6370
6827
|
}
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6828
|
+
function tick() {
|
|
6829
|
+
return monitoring.recovery("tick", async () => {
|
|
6830
|
+
resetIfSessionChanged();
|
|
6831
|
+
await coordinator.tick();
|
|
6832
|
+
await trackPayments({ dueOnly: true });
|
|
6833
|
+
return state();
|
|
6834
|
+
});
|
|
6376
6835
|
}
|
|
6377
6836
|
function state() {
|
|
6378
6837
|
if (disposed || deps.session.current().generation !== generation) return blankState(true);
|
|
@@ -6490,7 +6949,7 @@ function enabledCheckout(deps) {
|
|
|
6490
6949
|
}
|
|
6491
6950
|
}
|
|
6492
6951
|
async function trackedPartition(session) {
|
|
6493
|
-
const binding = await bindingOf(
|
|
6952
|
+
const binding = await bindingOf(watchedBinding);
|
|
6494
6953
|
if (!binding || !isCurrent(session)) return binding === null ? "none" : null;
|
|
6495
6954
|
const stored = refs.hasRefs(binding);
|
|
6496
6955
|
if (stored !== true) return stored === false ? "none" : null;
|
|
@@ -6561,7 +7020,10 @@ function enabledCheckout(deps) {
|
|
|
6561
7020
|
const payment = payments.get(ref.key) ?? newTracked(ref.key);
|
|
6562
7021
|
const attempts = payment.attempts + 1;
|
|
6563
7022
|
const exhausted = attempts >= MAX_AUTOMATIC_ATTEMPTS;
|
|
6564
|
-
if (exhausted && approvedWithoutAccess)
|
|
7023
|
+
if (exhausted && approvedWithoutAccess) {
|
|
7024
|
+
monitoring.paidUnitStuck(ref);
|
|
7025
|
+
return markNeedsSupport(partition, ref);
|
|
7026
|
+
}
|
|
6565
7027
|
const nextAttemptAt = exhausted ? null : deps.clock.now() + backoffDelay(attempts, deps.jitter);
|
|
6566
7028
|
payments.set(ref.key, { ...payment, access: "processing", attempts, nextAttemptAt });
|
|
6567
7029
|
}
|