@juo/blocks 1.17.0 → 1.18.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/core.js
CHANGED
|
@@ -433,8 +433,12 @@ function createLoginService(init) {
|
|
|
433
433
|
function storeTokens(data) {
|
|
434
434
|
const { access_token, refresh_token, expires_in } = data;
|
|
435
435
|
accessToken.value = access_token;
|
|
436
|
-
|
|
437
|
-
|
|
436
|
+
if (typeof refresh_token === "string" && refresh_token !== "") {
|
|
437
|
+
refreshToken.value = refresh_token;
|
|
438
|
+
}
|
|
439
|
+
const lifetime = Number.isFinite(expires_in) ? expires_in : 300;
|
|
440
|
+
const margin = Math.min(60, lifetime / 2);
|
|
441
|
+
expires.value = new Date(Date.now() + (lifetime - margin) * 1e3);
|
|
438
442
|
}
|
|
439
443
|
async function getToken() {
|
|
440
444
|
if (refreshToken.value == null) return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loginService.d.ts","sourceRoot":"","sources":["../../../src/services/login/loginService.ts"],"names":[],"mappings":"AAEA,OAAO,EAA4B,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAKxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAI9C,oBAAY,yBAAyB;IACnC,OAAO,YAAY;IACnB,aAAa,eAAe;IAC5B,YAAY,mBAAmB;IAC/B,OAAO,aAAa;IACpB,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,MAAM,EAAE,yBAAyB,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAG5B,MAAM,EAAE,yBAAyB,EACjC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMjC;AAED,UAAU,aAAa;IACrB,IAAI,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAA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;IACxB,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;;;;;;;;;;;;;;;;EAmBA;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,wBAAwB;;;;;;;;;;;;;;;;EAsNhE"}
|
|
@@ -8,9 +8,14 @@
|
|
|
8
8
|
* machine-readable code — so hosts discriminate on status. The backend's own
|
|
9
9
|
* refusal codes collapse accordingly: `invalid_items` and
|
|
10
10
|
* `shipping_method_unavailable` both arrive as 400, and `disabled`,
|
|
11
|
-
* `product_not_allowed` and `subscription_ineligible` all
|
|
12
|
-
*
|
|
11
|
+
* `product_not_allowed` and `subscription_ineligible` all as 403. Telling those
|
|
12
|
+
* apart would need the backend to send a code first, the way discounts send
|
|
13
13
|
* `DISCOUNT_CODE_REJECTED`.
|
|
14
|
+
*
|
|
15
|
+
* `outstanding_balance` is the exception, and it is why granularity matters
|
|
16
|
+
* here: it gets its own status (402) precisely so a host can tell the customer
|
|
17
|
+
* to settle up rather than showing them the "not available" copy every other
|
|
18
|
+
* 403 earns. Any future refusal a customer can act on should do the same.
|
|
14
19
|
*/
|
|
15
20
|
/**
|
|
16
21
|
* Reading the instant-order catalog. An adapter that does not implement instant
|
|
@@ -47,6 +52,15 @@ export type PlaceInstantOrderError =
|
|
|
47
52
|
kind: "INVALID_REQUEST";
|
|
48
53
|
message?: string;
|
|
49
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* 402 — the customer has an unpaid or overdue order on their account. Split
|
|
57
|
+
* out of `REFUSED` because it is the only refusal the customer can act on:
|
|
58
|
+
* settle the outstanding order and the purchase becomes available again.
|
|
59
|
+
*/
|
|
60
|
+
| {
|
|
61
|
+
kind: "OUTSTANDING_BALANCE";
|
|
62
|
+
message?: string;
|
|
63
|
+
}
|
|
50
64
|
/**
|
|
51
65
|
* 403 — the shop has the feature off, the product is not on the allowlist, or
|
|
52
66
|
* the subscription cannot carry an instant order.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instantOrderErrors.d.ts","sourceRoot":"","sources":["../../../src/services/subscription/instantOrderErrors.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"instantOrderErrors.d.ts","sourceRoot":"","sources":["../../../src/services/subscription/instantOrderErrors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,yBAAyB,GACjC;IAAE,IAAI,EAAE,wBAAwB,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C,MAAM,MAAM,sBAAsB;AAChC,iEAAiE;AAC/D;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE;AACzB,4EAA4E;GAC1E;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE;AACjD,wEAAwE;GACtE;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE;AAC5C,2EAA2E;GACzE;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE;AAC/C;;;;GAIG;GACD;IAAE,IAAI,EAAE,qBAAqB,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE;AACnD;;;GAGG;GACD;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,wBAAwB,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC"}
|