@delopay/sdk 0.230.0 → 0.232.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.
@@ -1843,6 +1843,20 @@ var PaymentLinks = class {
1843
1843
  async retrieve(linkId) {
1844
1844
  return this.request("GET", `/payment-link/${encodeURIComponent(linkId)}`);
1845
1845
  }
1846
+ /**
1847
+ * The merchant and payment an opaque checkout link opens.
1848
+ *
1849
+ * A link the API issues today is `/pay/{payment_link_id}`, so it names
1850
+ * neither the merchant nor the payment. This answers which ones it means.
1851
+ * Unauthenticated, like the checkout render it precedes: no credential is
1852
+ * needed or sent beyond what the client already carries. An unknown id is a
1853
+ * 404.
1854
+ *
1855
+ * `GET /payment-link/resolve/{payment_link_id}`
1856
+ */
1857
+ async resolve(paymentLinkId) {
1858
+ return this.request("GET", `/payment-link/resolve/${encodeURIComponent(paymentLinkId)}`);
1859
+ }
1846
1860
  /**
1847
1861
  * List payment links, optionally filtered by status or date range.
1848
1862
  *
@@ -8927,6 +8941,19 @@ function inputPadValue(size) {
8927
8941
  function buttonPadValue(size) {
8928
8942
  return BUTTON_PAD[size] ?? BUTTON_PAD.md;
8929
8943
  }
8944
+ function vaultFormAppearance(b, danger) {
8945
+ return {
8946
+ surface: b.surface,
8947
+ text: b.text,
8948
+ border: b.border,
8949
+ accent: b.primary,
8950
+ ...danger ? { danger } : {},
8951
+ font: b.fontFamily,
8952
+ radius: b.radiusInput,
8953
+ size: b.inputSize,
8954
+ labels: b.labelStyle
8955
+ };
8956
+ }
8930
8957
  function logoDimensions(size) {
8931
8958
  switch (size) {
8932
8959
  case "sm":
@@ -11553,11 +11580,29 @@ var CheckoutSession = class {
11553
11580
  * reports the vault as enabled and still expects its cards cloaked. The same
11554
11581
  * status also covers a payment that does not exist.
11555
11582
  *
11583
+ * `params.appearance` asks for a form styled to match the page (Enigma
11584
+ * Vault). The answer then carries `height`, the frame height to use. If the
11585
+ * vault refuses the styled form the answer is the plain one, without
11586
+ * `height`. `params.locale` is the buyer's locale.
11587
+ *
11556
11588
  * `GET /payment-link/{merchantId}/{paymentId}/vault/collect-session`
11557
11589
  */
11558
- async vaultCollectSession(options) {
11590
+ async vaultCollectSession(options, params) {
11591
+ const look = params?.appearance;
11559
11592
  return this.client.request("GET", `${this.linkBase}/vault/collect-session`, {
11560
11593
  ...options,
11594
+ query: {
11595
+ locale: params?.locale,
11596
+ form_surface: look?.surface,
11597
+ form_text: look?.text,
11598
+ form_border: look?.border,
11599
+ form_accent: look?.accent,
11600
+ form_danger: look?.danger,
11601
+ form_font: look?.font,
11602
+ form_radius: look?.radius,
11603
+ form_size: look?.size,
11604
+ form_labels: look?.labels
11605
+ },
11561
11606
  headers: this.bearerHeaders(options?.headers)
11562
11607
  });
11563
11608
  }
@@ -12146,9 +12191,10 @@ function encodePanes(panes) {
12146
12191
  };
12147
12192
  });
12148
12193
  }
12194
+ var OPAQUE_PAYMENT_LINK_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
12149
12195
  function focusedCheckoutUrl(params) {
12150
12196
  const base = params.checkoutBaseUrl.replace(/\/+$/, "");
12151
- const path = `${base}/pay/${encodeURIComponent(params.merchantId)}/${encodeURIComponent(
12197
+ const path = params.paymentLinkId && OPAQUE_PAYMENT_LINK_ID.test(params.paymentLinkId) ? `${base}/pay/${params.paymentLinkId}` : `${base}/pay/${encodeURIComponent(params.merchantId)}/${encodeURIComponent(
12152
12198
  params.paymentId
12153
12199
  )}`;
12154
12200
  const query = new URLSearchParams({ pane: params.method });
@@ -12315,6 +12361,7 @@ export {
12315
12361
  verticalGapValue,
12316
12362
  inputPadValue,
12317
12363
  buttonPadValue,
12364
+ vaultFormAppearance,
12318
12365
  logoDimensions,
12319
12366
  isHexColor,
12320
12367
  WCAG_AA_TEXT,
@@ -12422,4 +12469,4 @@ export {
12422
12469
  decodeNativePanes,
12423
12470
  encodeNativePanes
12424
12471
  };
12425
- //# sourceMappingURL=chunk-HNQKUUSW.js.map
12472
+ //# sourceMappingURL=chunk-3I5BQEA4.js.map