@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.
package/dist/index.cjs CHANGED
@@ -2063,6 +2063,62 @@ var Payments = class {
2063
2063
  options
2064
2064
  );
2065
2065
  }
2066
+ /**
2067
+ * Open a playback of the payment's stored checkout recording
2068
+ * (delopay-backend#1501, delopay-control-center#779): the audited act of
2069
+ * watching. Answers the manifest — which slices exist, how long the
2070
+ * recording runs, whether a pause in it is expected — and the
2071
+ * `playback_id` every {@link Payments.replaySlice} call carries.
2072
+ *
2073
+ * A payment that was never recorded answers `200` with `slices: []` and
2074
+ * `session_id: null` — the ordinary case for every payment made before the
2075
+ * checkout started recording — not a `404`. `404` means the payment does not
2076
+ * exist. Fetch the slices in `sequence` order; a number missing from the
2077
+ * list is a gap, not the end.
2078
+ *
2079
+ * A `POST`, because it writes one audit row: the SDK retries `GET` on its
2080
+ * own, and a lost response must not open three playbacks. Calling this
2081
+ * again deliberately opens another playback.
2082
+ *
2083
+ * Requires the `PaymentReplay` permission on a dashboard session in addition
2084
+ * to payment read access.
2085
+ *
2086
+ * `POST /payments/{paymentId}/replay/playback`
2087
+ *
2088
+ * @param paymentId - The payment intent ID.
2089
+ * @param options - Optional per-call extras: extra `headers`, a `timeout`
2090
+ * override, and an `AbortSignal`.
2091
+ */
2092
+ async openReplayPlayback(paymentId, options) {
2093
+ return this.request(
2094
+ "POST",
2095
+ `/payments/${encodeURIComponent(paymentId)}/replay/playback`,
2096
+ options
2097
+ );
2098
+ }
2099
+ /**
2100
+ * One slice of the payment's stored checkout recording, read against an
2101
+ * open playback: the rrweb events the checkout recorded under that number.
2102
+ * `playbackId` and the numbers come from {@link Payments.openReplayPlayback};
2103
+ * a `playbackId` that names no playback of this payment opened by this
2104
+ * caller, and a number the manifest does not list, both answer `404`.
2105
+ * Not audited per slice — the playback was.
2106
+ *
2107
+ * `GET /payments/{paymentId}/replay/playback/{playbackId}/slices/{sequence}`
2108
+ *
2109
+ * @param paymentId - The payment intent ID.
2110
+ * @param playbackId - The playback, from `openReplayPlayback`.
2111
+ * @param sequence - The slice number, from the playback's manifest.
2112
+ * @param options - Optional per-call extras: extra `headers`, a `timeout`
2113
+ * override, and an `AbortSignal`.
2114
+ */
2115
+ async replaySlice(paymentId, playbackId, sequence, options) {
2116
+ return this.request(
2117
+ "GET",
2118
+ `/payments/${encodeURIComponent(paymentId)}/replay/playback/${encodeURIComponent(playbackId)}/slices/${encodeURIComponent(String(sequence))}`,
2119
+ options
2120
+ );
2121
+ }
2066
2122
  /**
2067
2123
  * Soft-delete a payment. Only payments whose status is in the merchant's
2068
2124
  * delete policy (see {@link Payments.getDeletePolicy}) can be deleted;
@@ -7601,6 +7657,42 @@ var CheckoutSession = class {
7601
7657
  } catch {
7602
7658
  }
7603
7659
  }
7660
+ /**
7661
+ * Store one slice of the buyer's checkout recording on our own side
7662
+ * (delopay-backend#1501, delopay-control-center#779). Called by the hosted
7663
+ * checkout as the buyer works through the page; the client secret is
7664
+ * attached automatically.
7665
+ *
7666
+ * **Not telemetry semantics, on purpose.** Unlike
7667
+ * {@link CheckoutSession.recordEvent}, this rejects with a `DelopayError`
7668
+ * like every other payment call, because the recorder has to tell the
7669
+ * answers apart: a `400` with code `IR_16` means the backend will not take
7670
+ * this recording (recording is off on that deployment, the recording is
7671
+ * full, the payment is already recording a different session, or this
7672
+ * number is stored with different content) and the recorder must stop; any
7673
+ * other `400` is the slice itself being refused; a transport failure may be
7674
+ * retried with the **same** bytes under the **same** number, which the
7675
+ * backend answers with `duplicate: true`.
7676
+ *
7677
+ * Pass `keepalive: true` for the last slice of a page that is navigating
7678
+ * away (a redirect rail); browsers refuse keepalive bodies over ~64 KiB, so
7679
+ * only a small final slice should carry it.
7680
+ *
7681
+ * `POST /payments/{paymentId}/replay/slice` (publishable key)
7682
+ */
7683
+ async storeReplaySlice(params, options) {
7684
+ const { keepalive, ...extras } = options ?? {};
7685
+ return this.client.request(
7686
+ "POST",
7687
+ `/payments/${encodeURIComponent(this.paymentId)}/replay/slice`,
7688
+ {
7689
+ body: { ...params, client_secret: this.requireClientSecret() },
7690
+ ...keepalive !== void 0 ? { keepalive } : {},
7691
+ ...extras,
7692
+ headers: this.pkHeaders(extras.headers)
7693
+ }
7694
+ );
7695
+ }
7604
7696
  /**
7605
7697
  * Confirm a subscription (PayPal approval rail). The client secret is
7606
7698
  * attached automatically; the shop's profile id travels as the