@delopay/sdk 0.146.0 → 0.147.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.
@@ -1868,6 +1868,62 @@ var Payments = class {
1868
1868
  options
1869
1869
  );
1870
1870
  }
1871
+ /**
1872
+ * Open a playback of the payment's stored checkout recording
1873
+ * (delopay-backend#1501, delopay-control-center#779): the audited act of
1874
+ * watching. Answers the manifest — which slices exist, how long the
1875
+ * recording runs, whether a pause in it is expected — and the
1876
+ * `playback_id` every {@link Payments.replaySlice} call carries.
1877
+ *
1878
+ * A payment that was never recorded answers `200` with `slices: []` and
1879
+ * `session_id: null` — the ordinary case for every payment made before the
1880
+ * checkout started recording — not a `404`. `404` means the payment does not
1881
+ * exist. Fetch the slices in `sequence` order; a number missing from the
1882
+ * list is a gap, not the end.
1883
+ *
1884
+ * A `POST`, because it writes one audit row: the SDK retries `GET` on its
1885
+ * own, and a lost response must not open three playbacks. Calling this
1886
+ * again deliberately opens another playback.
1887
+ *
1888
+ * Requires the `PaymentReplay` permission on a dashboard session in addition
1889
+ * to payment read access.
1890
+ *
1891
+ * `POST /payments/{paymentId}/replay/playback`
1892
+ *
1893
+ * @param paymentId - The payment intent ID.
1894
+ * @param options - Optional per-call extras: extra `headers`, a `timeout`
1895
+ * override, and an `AbortSignal`.
1896
+ */
1897
+ async openReplayPlayback(paymentId, options) {
1898
+ return this.request(
1899
+ "POST",
1900
+ `/payments/${encodeURIComponent(paymentId)}/replay/playback`,
1901
+ options
1902
+ );
1903
+ }
1904
+ /**
1905
+ * One slice of the payment's stored checkout recording, read against an
1906
+ * open playback: the rrweb events the checkout recorded under that number.
1907
+ * `playbackId` and the numbers come from {@link Payments.openReplayPlayback};
1908
+ * a `playbackId` that names no playback of this payment opened by this
1909
+ * caller, and a number the manifest does not list, both answer `404`.
1910
+ * Not audited per slice — the playback was.
1911
+ *
1912
+ * `GET /payments/{paymentId}/replay/playback/{playbackId}/slices/{sequence}`
1913
+ *
1914
+ * @param paymentId - The payment intent ID.
1915
+ * @param playbackId - The playback, from `openReplayPlayback`.
1916
+ * @param sequence - The slice number, from the playback's manifest.
1917
+ * @param options - Optional per-call extras: extra `headers`, a `timeout`
1918
+ * override, and an `AbortSignal`.
1919
+ */
1920
+ async replaySlice(paymentId, playbackId, sequence, options) {
1921
+ return this.request(
1922
+ "GET",
1923
+ `/payments/${encodeURIComponent(paymentId)}/replay/playback/${encodeURIComponent(playbackId)}/slices/${encodeURIComponent(String(sequence))}`,
1924
+ options
1925
+ );
1926
+ }
1871
1927
  /**
1872
1928
  * Soft-delete a payment. Only payments whose status is in the merchant's
1873
1929
  * delete policy (see {@link Payments.getDeletePolicy}) can be deleted;
@@ -7406,6 +7462,42 @@ var CheckoutSession = class {
7406
7462
  } catch {
7407
7463
  }
7408
7464
  }
7465
+ /**
7466
+ * Store one slice of the buyer's checkout recording on our own side
7467
+ * (delopay-backend#1501, delopay-control-center#779). Called by the hosted
7468
+ * checkout as the buyer works through the page; the client secret is
7469
+ * attached automatically.
7470
+ *
7471
+ * **Not telemetry semantics, on purpose.** Unlike
7472
+ * {@link CheckoutSession.recordEvent}, this rejects with a `DelopayError`
7473
+ * like every other payment call, because the recorder has to tell the
7474
+ * answers apart: a `400` with code `IR_16` means the backend will not take
7475
+ * this recording (recording is off on that deployment, the recording is
7476
+ * full, the payment is already recording a different session, or this
7477
+ * number is stored with different content) and the recorder must stop; any
7478
+ * other `400` is the slice itself being refused; a transport failure may be
7479
+ * retried with the **same** bytes under the **same** number, which the
7480
+ * backend answers with `duplicate: true`.
7481
+ *
7482
+ * Pass `keepalive: true` for the last slice of a page that is navigating
7483
+ * away (a redirect rail); browsers refuse keepalive bodies over ~64 KiB, so
7484
+ * only a small final slice should carry it.
7485
+ *
7486
+ * `POST /payments/{paymentId}/replay/slice` (publishable key)
7487
+ */
7488
+ async storeReplaySlice(params, options) {
7489
+ const { keepalive, ...extras } = options ?? {};
7490
+ return this.client.request(
7491
+ "POST",
7492
+ `/payments/${encodeURIComponent(this.paymentId)}/replay/slice`,
7493
+ {
7494
+ body: { ...params, client_secret: this.requireClientSecret() },
7495
+ ...keepalive !== void 0 ? { keepalive } : {},
7496
+ ...extras,
7497
+ headers: this.pkHeaders(extras.headers)
7498
+ }
7499
+ );
7500
+ }
7409
7501
  /**
7410
7502
  * Confirm a subscription (PayPal approval rail). The client secret is
7411
7503
  * attached automatically; the shop's profile id travels as the
@@ -8204,4 +8296,4 @@ export {
8204
8296
  decodeNativePanes,
8205
8297
  encodeNativePanes
8206
8298
  };
8207
- //# sourceMappingURL=chunk-NRLTXUV7.js.map
8299
+ //# sourceMappingURL=chunk-CK3APM5M.js.map