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