@scopetickets/checkout 0.6.1 → 0.6.2
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/index.cjs +11 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8524,7 +8524,7 @@ function param(value) {
|
|
|
8524
8524
|
}
|
|
8525
8525
|
|
|
8526
8526
|
// src/version.ts
|
|
8527
|
-
var CHECKOUT_VERSION = "0.6.
|
|
8527
|
+
var CHECKOUT_VERSION = "0.6.2";
|
|
8528
8528
|
|
|
8529
8529
|
// src/data/useCheckoutEvents.ts
|
|
8530
8530
|
function useCheckoutEvents(observed, { applicationKey, inventories, onEvent, logger = browserLogger }) {
|
|
@@ -9975,32 +9975,24 @@ function createOrderStore(parts, seed = IDLE_ORDER) {
|
|
|
9975
9975
|
saveAnswers,
|
|
9976
9976
|
charge,
|
|
9977
9977
|
/*
|
|
9978
|
-
*
|
|
9979
|
-
*
|
|
9980
|
-
*
|
|
9978
|
+
* APPLIED STRAIGHT TO THE CART — one call, no `checkPromo` first. The cart's write is
|
|
9979
|
+
* the authority: it applies the code or refuses it with the platform's reason
|
|
9980
|
+
* ("The promo code does not apply to any of the items"), which `writePromo` puts on
|
|
9981
|
+
* the card. The check asked the same question of the whole platform instead of this
|
|
9982
|
+
* cart, and on production it cost ~8 s per row of the code: 25 s for a code with a row
|
|
9983
|
+
* on each of three days, a 500 at 30 s past that — measured 2026-11-10, while the cart
|
|
9984
|
+
* write answered in 0.03 s. A write that could not be MADE is not a code that was
|
|
9985
|
+
* refused: the card goes quiet and the fault travels, which is where `notices` takes it.
|
|
9981
9986
|
*/
|
|
9982
9987
|
applyPromo: async (code) => {
|
|
9983
|
-
|
|
9984
|
-
const cart = state.cart;
|
|
9985
|
-
if (cart === null) return false;
|
|
9988
|
+
if (state.cart === null) return false;
|
|
9986
9989
|
const typed = code.trim();
|
|
9987
|
-
dispatch({ kind: "PROMO_WRITING" });
|
|
9988
|
-
let checked;
|
|
9989
9990
|
try {
|
|
9990
|
-
|
|
9991
|
+
return await writePromo((cartKey) => parts.gateway.writePromo(cartKey, typed));
|
|
9991
9992
|
} catch (cause) {
|
|
9992
9993
|
dispatch({ kind: "PROMO_SETTLED" });
|
|
9993
9994
|
throw cause;
|
|
9994
9995
|
}
|
|
9995
|
-
if (!stillOurs(taken)) {
|
|
9996
|
-
dispatch({ kind: "PROMO_SETTLED" });
|
|
9997
|
-
return false;
|
|
9998
|
-
}
|
|
9999
|
-
if (!checked.ok) {
|
|
10000
|
-
dispatch({ kind: "PROMO_REFUSED", reason: checked.reason });
|
|
10001
|
-
return false;
|
|
10002
|
-
}
|
|
10003
|
-
return writePromo((cartKey) => parts.gateway.writePromo(cartKey, typed));
|
|
10004
9996
|
},
|
|
10005
9997
|
removePromo: () => writePromo((cartKey) => parts.gateway.clearPromo(cartKey)),
|
|
10006
9998
|
/*
|