@delopay/sdk 0.179.0 → 0.181.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/{chunk-LCYYPYOP.js → chunk-3GSFUNXW.js} +42 -10
- package/dist/chunk-3GSFUNXW.js.map +1 -0
- package/dist/index.cjs +41 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +60 -62
- package/dist/index.d.ts +60 -62
- package/dist/index.js +1 -1
- package/dist/internal.cjs +42 -10
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +6 -7
- package/dist/internal.d.ts +6 -7
- package/dist/internal.js +2 -2
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-LCYYPYOP.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -4649,15 +4649,15 @@ var Analytics = class {
|
|
|
4649
4649
|
}
|
|
4650
4650
|
/**
|
|
4651
4651
|
* Every analytics exclusion of the merchant, with the payments each one
|
|
4652
|
-
* matched in the lookback window
|
|
4652
|
+
* matched in the lookback window.
|
|
4653
4653
|
*
|
|
4654
4654
|
* These rules change what the merchant's own dashboards count. Financial
|
|
4655
4655
|
* records and transaction lists are never filtered by them.
|
|
4656
4656
|
*
|
|
4657
|
-
*
|
|
4658
|
-
*
|
|
4659
|
-
* `best_effort` and `lookback_days`
|
|
4660
|
-
* client signals that may be absent or expired, within that window.
|
|
4657
|
+
* `matched_payments` counts overlap between rules: a payment matched by
|
|
4658
|
+
* three rules is counted once by each, so the values are not additive. The
|
|
4659
|
+
* envelope's `best_effort` and `lookback_days` apply to every row — matching
|
|
4660
|
+
* runs on client signals that may be absent or expired, within that window.
|
|
4661
4661
|
* `GET /analytics/exclusions`
|
|
4662
4662
|
*/
|
|
4663
4663
|
async listExclusions() {
|
|
@@ -7921,7 +7921,7 @@ var DEFAULT_BRANDING_BASE = {
|
|
|
7921
7921
|
var DEFAULT_BRANDING = {
|
|
7922
7922
|
...DEFAULT_BRANDING_BASE,
|
|
7923
7923
|
...LIGHT_PALETTE,
|
|
7924
|
-
// No badges by default
|
|
7924
|
+
// No badges by default any more — notices took their place.
|
|
7925
7925
|
// `DEFAULT_BADGES` stays exported because `isDefaultBadgeSet` still has to
|
|
7926
7926
|
// recognise the pair on shops saved before.
|
|
7927
7927
|
trustBadges: [],
|
|
@@ -9460,6 +9460,18 @@ function withoutHeader(headers, name) {
|
|
|
9460
9460
|
}
|
|
9461
9461
|
return out;
|
|
9462
9462
|
}
|
|
9463
|
+
async function gzipJson(value) {
|
|
9464
|
+
const ctor = globalThis.CompressionStream;
|
|
9465
|
+
if (typeof ctor !== "function") return null;
|
|
9466
|
+
try {
|
|
9467
|
+
const bytes = new TextEncoder().encode(JSON.stringify(value));
|
|
9468
|
+
return await new Response(
|
|
9469
|
+
new Blob([bytes]).stream().pipeThrough(new ctor("gzip"))
|
|
9470
|
+
).arrayBuffer();
|
|
9471
|
+
} catch {
|
|
9472
|
+
return null;
|
|
9473
|
+
}
|
|
9474
|
+
}
|
|
9463
9475
|
var CheckoutSession = class {
|
|
9464
9476
|
constructor(options) {
|
|
9465
9477
|
this.merchantId = options.merchantId;
|
|
@@ -9611,18 +9623,38 @@ var CheckoutSession = class {
|
|
|
9611
9623
|
* away (a redirect rail); browsers refuse keepalive bodies over ~64 KiB, so
|
|
9612
9624
|
* only a small final slice should carry it.
|
|
9613
9625
|
*
|
|
9626
|
+
* Pass `compress: true` to send the slice gzipped. Recorded page events
|
|
9627
|
+
* compress heavily, so this is mostly a saving on the buyer's connection. It
|
|
9628
|
+
* is opt-in and degrades silently: a runtime without `CompressionStream`
|
|
9629
|
+
* sends the same slice uncompressed rather than failing, so a caller never
|
|
9630
|
+
* has to feature-test before asking for it.
|
|
9631
|
+
*
|
|
9632
|
+
* ⚠️ `keepalive` overrides it. Compressing means awaiting a stream read
|
|
9633
|
+
* before the request is made, and `keepalive` protects a request only once
|
|
9634
|
+
* it has been initiated — so a page torn down mid-compression would drop the
|
|
9635
|
+
* final slice altogether. A slice sent with `keepalive` therefore always
|
|
9636
|
+
* travels uncompressed, whatever `compress` says. Passing both is allowed and
|
|
9637
|
+
* is what a recorder should do: every ordinary slice compresses, and the last
|
|
9638
|
+
* one is sent the way that actually arrives.
|
|
9639
|
+
*
|
|
9614
9640
|
* `POST /payments/{paymentId}/replay/slice` (publishable key)
|
|
9615
9641
|
*/
|
|
9616
9642
|
async storeReplaySlice(params, options) {
|
|
9617
|
-
const { keepalive, ...extras } = options ?? {};
|
|
9643
|
+
const { keepalive, compress, ...extras } = options ?? {};
|
|
9644
|
+
const body = { ...params, client_secret: this.requireClientSecret() };
|
|
9645
|
+
const headers = this.pkHeaders(extras.headers);
|
|
9646
|
+
const gzipped = compress === true && keepalive !== true ? await gzipJson(body) : null;
|
|
9618
9647
|
return this.client.request(
|
|
9619
9648
|
"POST",
|
|
9620
9649
|
`/payments/${encodeURIComponent(this.paymentId)}/replay/slice`,
|
|
9621
9650
|
{
|
|
9622
|
-
body:
|
|
9651
|
+
body: gzipped ?? body,
|
|
9623
9652
|
...keepalive !== void 0 ? { keepalive } : {},
|
|
9624
9653
|
...extras,
|
|
9625
|
-
|
|
9654
|
+
// `Content-Type` has to be stated for the compressed body: the client
|
|
9655
|
+
// only sets it for a body it serialises itself, and the bytes are
|
|
9656
|
+
// still JSON — gzip is how they travel, not what they are.
|
|
9657
|
+
headers: gzipped === null ? headers : { ...headers, "Content-Type": "application/json", "Content-Encoding": "gzip" }
|
|
9626
9658
|
}
|
|
9627
9659
|
);
|
|
9628
9660
|
}
|