@delopay/sdk 0.248.0 → 0.261.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
@@ -44,7 +44,9 @@ __export(internal_exports, {
44
44
  AvailabilityOverrides: () => AvailabilityOverrides,
45
45
  BRANDING_EXPORT_FORMAT: () => BRANDING_EXPORT_FORMAT,
46
46
  BRANDING_EXPORT_VERSION: () => BRANDING_EXPORT_VERSION,
47
+ BUILTIN_PAYMENT_ICON_KEYS: () => BUILTIN_PAYMENT_ICON_KEYS,
47
48
  BuyerBlocklist: () => BuyerBlocklist,
49
+ BuyerConversations: () => BuyerConversations,
48
50
  CARD_FIELD_CHROMES: () => CARD_FIELD_CHROMES,
49
51
  CARD_FIELD_FONT_SIZES: () => CARD_FIELD_FONT_SIZES,
50
52
  CARD_FIELD_WEIGHTS: () => CARD_FIELD_WEIGHTS,
@@ -114,11 +116,13 @@ __export(internal_exports, {
114
116
  PANE_ICON_KEYS: () => PANE_ICON_KEYS,
115
117
  PAYPAL_CARD_LAYOUTS: () => PAYPAL_CARD_LAYOUTS,
116
118
  PAYPAL_LABEL_STYLES: () => PAYPAL_LABEL_STYLES,
119
+ PRESENTATION_CONTRACT_VERSION: () => PRESENTATION_CONTRACT_VERSION,
117
120
  PaypalDisputes: () => PaypalDisputes,
118
121
  PlatformBilling: () => PlatformBilling,
119
122
  PlatformFees: () => PlatformFees,
120
123
  PlatformMessageTemplates: () => PlatformMessageTemplates,
121
124
  PlatformSettings: () => PlatformSettings,
125
+ PresentationCache: () => PresentationCache,
122
126
  ProcessorCosts: () => ProcessorCosts,
123
127
  Products: () => Products,
124
128
  RTL_CHECKOUT_LOCALES: () => RTL_CHECKOUT_LOCALES,
@@ -172,6 +176,8 @@ __export(internal_exports, {
172
176
  applyBrandingVariables: () => applyBrandingVariables,
173
177
  asAirwallexCardPreset: () => asAirwallexCardPreset,
174
178
  buildBrandingExport: () => buildBrandingExport,
179
+ builtinPaymentIconDataUri: () => builtinPaymentIconDataUri,
180
+ builtinPaymentIconSvg: () => builtinPaymentIconSvg,
175
181
  buttonPadValue: () => buttonPadValue,
176
182
  canonicalSectionId: () => canonicalSectionId,
177
183
  cardFieldFontPx: () => cardFieldFontPx,
@@ -229,6 +235,7 @@ __export(internal_exports, {
229
235
  isNoticeIcon: () => isNoticeIcon,
230
236
  isSubscriptionDisputeWebhook: () => isSubscriptionDisputeWebhook,
231
237
  isSubscriptionLifecycleWebhook: () => isSubscriptionLifecycleWebhook,
238
+ isSupportedPresentation: () => isSupportedPresentation,
232
239
  knownSectionLabelKey: () => knownSectionLabelKey,
233
240
  leaf: () => leaf,
234
241
  logoDimensions: () => logoDimensions,
@@ -246,6 +253,9 @@ __export(internal_exports, {
246
253
  parseCustomFieldsLoose: () => parseCustomFieldsLoose,
247
254
  parseImportedBranding: () => parseImportedBranding,
248
255
  parseNoticesLoose: () => parseNoticesLoose,
256
+ presentationIconDataUri: () => presentationIconDataUri,
257
+ presentationIconSrc: () => presentationIconSrc,
258
+ presentationTiers: () => presentationTiers,
249
259
  programToTree: () => programToTree,
250
260
  radiusValue: () => radiusValue,
251
261
  readableInkOn: () => readableInkOn,
@@ -260,6 +270,7 @@ __export(internal_exports, {
260
270
  sanitizeCustomCss: () => sanitizeCustomCss,
261
271
  sectionLabel: () => sectionLabel,
262
272
  sectionOrderOf: () => sectionOrderOf,
273
+ selectableEntries: () => selectableEntries,
263
274
  shadowFor: () => shadowFor,
264
275
  shownNotices: () => shownNotices,
265
276
  stripeSpacingValues: () => stripeSpacingValues,
@@ -1243,11 +1254,92 @@ var Connectors = class {
1243
1254
  { body: params }
1244
1255
  );
1245
1256
  }
1257
+ /**
1258
+ * Every webhook the connector's payment provider lists for its credentials
1259
+ * in one environment: Delopay's own, other connector accounts', former
1260
+ * addresses' and other integrations'.
1261
+ * `GET /account/{merchantId}/connectors/webhooks/{connectorId}/provider`
1262
+ *
1263
+ * Available for Stripe, PayPal, Airwallex, Whop and Adyen. Destinations are
1264
+ * masked; `capabilities` says which changes the provider allows and
1265
+ * `editable` whether the caller may make them.
1266
+ */
1267
+ async listProviderWebhooks(merchantId, connectorId, environment) {
1268
+ return this.request("GET", providerWebhooksPath(merchantId, connectorId), {
1269
+ query: { environment }
1270
+ });
1271
+ }
1272
+ /**
1273
+ * Create a webhook at the provider for the merchant's own systems.
1274
+ * `POST /account/{merchantId}/connectors/webhooks/{connectorId}/provider`
1275
+ *
1276
+ * The URL must be `https` and outside Delopay; Delopay's own webhook is
1277
+ * registered with `registerWebhook`. A returned `signing_secret` is not kept
1278
+ * by Delopay and cannot be read again.
1279
+ */
1280
+ async createProviderWebhook(merchantId, connectorId, params) {
1281
+ return this.request("POST", providerWebhooksPath(merchantId, connectorId), { body: params });
1282
+ }
1283
+ /**
1284
+ * Change one webhook at the provider.
1285
+ * `PATCH /account/{merchantId}/connectors/webhooks/{connectorId}/provider/{webhookId}`
1286
+ *
1287
+ * Refused once the webhook changed since `fingerprint`, and for Delopay's
1288
+ * own webhooks.
1289
+ */
1290
+ async updateProviderWebhook(merchantId, connectorId, webhookId, params) {
1291
+ return this.request(
1292
+ "PATCH",
1293
+ `${providerWebhooksPath(merchantId, connectorId)}/${encodeURIComponent(webhookId)}`,
1294
+ { body: params }
1295
+ );
1296
+ }
1297
+ /**
1298
+ * Delete one webhook at the provider.
1299
+ * `POST /account/{merchantId}/connectors/webhooks/{connectorId}/provider/{webhookId}/delete`
1300
+ *
1301
+ * Refused once the webhook changed since `fingerprint`. Deleting Delopay's
1302
+ * own webhook needs `confirm_managed: true`; another connector account's is
1303
+ * never deleted from here.
1304
+ */
1305
+ async deleteProviderWebhook(merchantId, connectorId, webhookId, params) {
1306
+ return this.request(
1307
+ "POST",
1308
+ `${providerWebhooksPath(merchantId, connectorId)}/${encodeURIComponent(webhookId)}/delete`,
1309
+ { body: params }
1310
+ );
1311
+ }
1312
+ /**
1313
+ * What "replace all" would delete and keep. Nothing is changed.
1314
+ * `GET /account/{merchantId}/connectors/webhooks/{connectorId}/provider/replace`
1315
+ */
1316
+ async previewProviderWebhookReplace(merchantId, connectorId, environment) {
1317
+ return this.request("GET", `${providerWebhooksPath(merchantId, connectorId)}/replace`, {
1318
+ query: { environment }
1319
+ });
1320
+ }
1321
+ /**
1322
+ * Keep only Delopay's webhook: delete exactly the confirmed webhooks of the
1323
+ * preview, after registering Delopay's own unless `sequence` is
1324
+ * `delete_first`.
1325
+ * `POST /account/{merchantId}/connectors/webhooks/{connectorId}/provider/replace`
1326
+ *
1327
+ * A list that changed since the preview answers `scope_changed` and deletes
1328
+ * nothing. A second replacement while one runs is refused as busy (`HE_00`).
1329
+ */
1330
+ async replaceProviderWebhooks(merchantId, connectorId, params) {
1331
+ return this.request("POST", `${providerWebhooksPath(merchantId, connectorId)}/replace`, {
1332
+ body: params
1333
+ });
1334
+ }
1246
1335
  /** List available payment methods. `GET /account/payment-methods` */
1247
1336
  async listPaymentMethods() {
1248
1337
  return this.request("GET", "/account/payment-methods");
1249
1338
  }
1250
1339
  };
1340
+ function providerWebhooksPath(merchantId, connectorId) {
1341
+ return `/account/${encodeURIComponent(merchantId)}/connectors/webhooks/${encodeURIComponent(connectorId)}/provider`;
1342
+ }
1251
1343
 
1252
1344
  // src/resources/customers.ts
1253
1345
  function toQuery(params) {
@@ -2420,6 +2512,44 @@ var PaymentMethods = class {
2420
2512
  query: params
2421
2513
  });
2422
2514
  }
2515
+ /**
2516
+ * The shop's payment buttons as the hosted checkout draws them: order,
2517
+ * labels in the shop's or caller's language, artwork, and what selecting
2518
+ * each one does. For rendering payment buttons on your own site without a
2519
+ * local table of provider names and icons.
2520
+ *
2521
+ * With a secret key, name the shop (`profile_id`) and optionally the
2522
+ * environment and a buyer context; the answer may be reused for
2523
+ * `cache.max_age_seconds` — {@link PresentationCache} does that. With a
2524
+ * publishable key, pass the payment's `client_secret` (or use
2525
+ * `CheckoutSession.paymentMethodPresentation`); that answer is never reused.
2526
+ *
2527
+ * A displayed entry is not a promise: the payment is confirmed against the
2528
+ * current configuration.
2529
+ *
2530
+ * `GET /account/payment-methods/presentation`
2531
+ *
2532
+ * @example
2533
+ * ```typescript
2534
+ * const buttons = await delopay.paymentMethods.presentation({
2535
+ * profile_id: 'pro_123',
2536
+ * country: 'DE',
2537
+ * currency: 'EUR',
2538
+ * amount: 4999,
2539
+ * locale: 'de',
2540
+ * });
2541
+ * for (const entry of buttons.entries) {
2542
+ * if (entry.kind === 'heading') renderHeading(entry.label);
2543
+ * else renderButton(entry.label, entry.sublabel, presentationIconSrc(entry));
2544
+ * }
2545
+ * ```
2546
+ */
2547
+ async presentation(params, options) {
2548
+ return this.request("GET", "/account/payment-methods/presentation", {
2549
+ query: params,
2550
+ ...options
2551
+ });
2552
+ }
2423
2553
  /**
2424
2554
  * List all saved payment methods for a customer, optionally filtered.
2425
2555
  *
@@ -5714,6 +5844,73 @@ var BuyerBlocklist = class {
5714
5844
  }
5715
5845
  };
5716
5846
 
5847
+ // src/resources/buyerConversations.ts
5848
+ var BuyerConversations = class {
5849
+ constructor(request) {
5850
+ this.request = request;
5851
+ }
5852
+ /**
5853
+ * One page of the inbox, the latest message first, filtered by shop,
5854
+ * status, assignee, mode or buyer. `GET /buyer-conversations`
5855
+ */
5856
+ async list(params) {
5857
+ return this.request("GET", "/buyer-conversations", {
5858
+ query: params
5859
+ });
5860
+ }
5861
+ /**
5862
+ * Starts the conversation with a buyer at one shop, or adds to the one that
5863
+ * exists, with a first message. `POST /buyer-conversations`
5864
+ */
5865
+ async start(params) {
5866
+ return this.request("POST", "/buyer-conversations", { body: params });
5867
+ }
5868
+ /**
5869
+ * One conversation and its newest messages, oldest first; `before` pages
5870
+ * back. `GET /buyer-conversations/{id}`
5871
+ */
5872
+ async retrieve(id, params) {
5873
+ return this.request("GET", `/buyer-conversations/${encodeURIComponent(id)}`, {
5874
+ query: params
5875
+ });
5876
+ }
5877
+ /**
5878
+ * A team member's answer. A closed conversation refuses it.
5879
+ * `POST /buyer-conversations/{id}/messages`
5880
+ */
5881
+ async reply(id, params) {
5882
+ return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/messages`, {
5883
+ body: params
5884
+ });
5885
+ }
5886
+ /**
5887
+ * The team has read the conversation up to its last accepted message.
5888
+ * `POST /buyer-conversations/{id}/read`
5889
+ */
5890
+ async markRead(id) {
5891
+ return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/read`);
5892
+ }
5893
+ /**
5894
+ * Hands the conversation to a team member, to the caller with `me`, or to
5895
+ * nobody with `null`. `POST /buyer-conversations/{id}/assign`
5896
+ */
5897
+ async assign(id, params) {
5898
+ return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/assign`, {
5899
+ body: params
5900
+ });
5901
+ }
5902
+ /**
5903
+ * Closes or reopens the conversation. Closing moves no money and decides
5904
+ * no case; it stops new messages until reopened.
5905
+ * `POST /buyer-conversations/{id}/status`
5906
+ */
5907
+ async setStatus(id, params) {
5908
+ return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/status`, {
5909
+ body: params
5910
+ });
5911
+ }
5912
+ };
5913
+
5717
5914
  // src/resources/checkoutRecovery.ts
5718
5915
  var CheckoutRecovery = class {
5719
5916
  constructor(request) {
@@ -7262,7 +7459,7 @@ var BuyerAccount = class {
7262
7459
  constructor(request) {
7263
7460
  this.request = request;
7264
7461
  }
7265
- /** Whether buyers can sign in by email on this platform, and how. */
7462
+ /** Whether buyers can sign in on this platform, and which methods are offered. */
7266
7463
  async availability(options) {
7267
7464
  return this.request("GET", "/buyer-account/availability", { ...options });
7268
7465
  }
@@ -7299,6 +7496,108 @@ var BuyerAccount = class {
7299
7496
  ...options
7300
7497
  });
7301
7498
  }
7499
+ /**
7500
+ * The shops the buyer has purchases at, once each and by name. Pass a
7501
+ * shop's `shop` to `listPurchases` to list only that shop's purchases.
7502
+ */
7503
+ async listShops(options) {
7504
+ return this.request("GET", "/buyer-account/shops", { ...options });
7505
+ }
7506
+ /**
7507
+ * The buyer's subscriptions across shops, newest first. A record the buyer
7508
+ * has not confirmed shows what a receipt carries, without its period or
7509
+ * cancellation.
7510
+ */
7511
+ async listSubscriptions(query, options) {
7512
+ return this.request("GET", "/buyer-account/subscriptions", {
7513
+ query,
7514
+ ...options
7515
+ });
7516
+ }
7517
+ /**
7518
+ * The issued invoices of the records the buyer has confirmed through a
7519
+ * shop's own link, newest first. `unconfirmed_records` says when records
7520
+ * were left out.
7521
+ */
7522
+ async listInvoices(query, options) {
7523
+ return this.request("GET", "/buyer-account/invoices", {
7524
+ query,
7525
+ ...options
7526
+ });
7527
+ }
7528
+ /** The refund requests of the records the buyer has confirmed, newest first, with the shop's decision. */
7529
+ async listRefundRequests(query, options) {
7530
+ return this.request("GET", "/buyer-account/refund-requests", {
7531
+ query,
7532
+ ...options
7533
+ });
7534
+ }
7535
+ /**
7536
+ * The cases of the records the buyer has confirmed: the refund requests
7537
+ * they sent and the disputes about their purchases, newest first, with
7538
+ * where each stands, who acts next, the outcome and the recorded steps.
7539
+ */
7540
+ async listCases(query, options) {
7541
+ return this.request("GET", "/buyer-account/cases", {
7542
+ query,
7543
+ ...options
7544
+ });
7545
+ }
7546
+ /**
7547
+ * The conversations of the records the buyer has confirmed, the latest
7548
+ * message first. `unconfirmed_records` says when other records were left out.
7549
+ */
7550
+ async listConversations(query, options) {
7551
+ return this.request("GET", "/buyer-account/conversations", {
7552
+ query,
7553
+ ...options
7554
+ });
7555
+ }
7556
+ /**
7557
+ * The conversation of a confirmed record with one shop, and its newest
7558
+ * messages, oldest first; `before` pages back. `shop` is required here.
7559
+ */
7560
+ async listRecordMessages(record, query, options) {
7561
+ return this.request("GET", `/buyer-account/records/${encodeURIComponent(record)}/messages`, {
7562
+ query,
7563
+ ...options
7564
+ });
7565
+ }
7566
+ /**
7567
+ * A message from a confirmed record to one of its shops. Sending again with
7568
+ * the same `client_message_id` returns the message the first send stored.
7569
+ */
7570
+ async sendRecordMessage(record, message, options) {
7571
+ return this.request("POST", `/buyer-account/records/${encodeURIComponent(record)}/messages`, {
7572
+ body: message,
7573
+ ...options
7574
+ });
7575
+ }
7576
+ /**
7577
+ * The buyer has read a record's conversation with one shop up to its last
7578
+ * accepted message. Answers with the buyer's conversations as they now stand.
7579
+ */
7580
+ async markRecordMessagesRead(record, query, options) {
7581
+ return this.request(
7582
+ "POST",
7583
+ `/buyer-account/records/${encodeURIComponent(record)}/messages/read`,
7584
+ {
7585
+ query,
7586
+ ...options
7587
+ }
7588
+ );
7589
+ }
7590
+ /**
7591
+ * What the buyer spent in a period: paid purchases summed per currency,
7592
+ * never converted, for the whole period, per day, week or month, per shop
7593
+ * and per kind of purchase.
7594
+ */
7595
+ async analytics(query, options) {
7596
+ return this.request("GET", "/buyer-account/analytics", {
7597
+ query,
7598
+ ...options
7599
+ });
7600
+ }
7302
7601
  /**
7303
7602
  * Confirm the record of a shop's customer portal link for the signed-in
7304
7603
  * buyer. The link's customer must carry the address the buyer signed in
@@ -7327,6 +7626,48 @@ var BuyerPortal = class {
7327
7626
  async getSession(options) {
7328
7627
  return this.request("GET", "/buyer-portal/session", { ...options });
7329
7628
  }
7629
+ /**
7630
+ * The buyer's cases at the shop: the refund requests they sent and the
7631
+ * disputes about their purchases, newest first, with where each stands, who
7632
+ * acts next, the outcome and the recorded steps.
7633
+ */
7634
+ async listCases(options) {
7635
+ return this.request("GET", "/buyer-portal/cases", { ...options });
7636
+ }
7637
+ /**
7638
+ * The buyer's conversations with the shop, the latest message first. A
7639
+ * portal link for the whole merchant lists one per shop and mode.
7640
+ */
7641
+ async listConversations(options) {
7642
+ return this.request("GET", "/buyer-portal/conversations", { ...options });
7643
+ }
7644
+ /**
7645
+ * The conversation with one shop and its newest messages, oldest first;
7646
+ * `before` pages back. A link issued for one shop may leave `shop` out.
7647
+ */
7648
+ async listMessages(query, options) {
7649
+ return this.request("GET", "/buyer-portal/messages", {
7650
+ query,
7651
+ ...options
7652
+ });
7653
+ }
7654
+ /**
7655
+ * A message to the shop. Sending again with the same `client_message_id`
7656
+ * returns the message the first send stored; a closed conversation refuses it.
7657
+ */
7658
+ async sendMessage(message, options) {
7659
+ return this.request("POST", "/buyer-portal/messages", { body: message, ...options });
7660
+ }
7661
+ /**
7662
+ * The buyer has read the conversation with the shop up to its last accepted
7663
+ * message. Answers with the buyer's conversations as they now stand.
7664
+ */
7665
+ async markMessagesRead(query, options) {
7666
+ return this.request("POST", "/buyer-portal/messages/read", {
7667
+ query,
7668
+ ...options
7669
+ });
7670
+ }
7330
7671
  /** The buyer's contact and billing details, and what they may change. */
7331
7672
  async getProfile(options) {
7332
7673
  return this.request("GET", "/buyer-portal/profile", { ...options });
@@ -8454,6 +8795,7 @@ var Delopay = class {
8454
8795
  this.availabilityOverrides = new AvailabilityOverrides(request);
8455
8796
  this.sellToRestrictions = new SellToRestrictions(request);
8456
8797
  this.buyerBlocklist = new BuyerBlocklist(request);
8798
+ this.buyerConversations = new BuyerConversations(request);
8457
8799
  this.checkoutRecovery = new CheckoutRecovery(request);
8458
8800
  this.costRules = new CostRules(request);
8459
8801
  this.externalRecords = new ExternalRecords(request);
@@ -12650,8 +12992,196 @@ var CheckoutSession = class {
12650
12992
  headers: this.pkHeaders(options?.headers)
12651
12993
  });
12652
12994
  }
12995
+ /**
12996
+ * This payment's checkout buttons, as the hosted checkout draws them: order,
12997
+ * labels, artwork, and what selecting each one does. The shop, environment,
12998
+ * currency and amount are the payment's. Ask again when the cart changes;
12999
+ * an answer is never reused for another payment.
13000
+ *
13001
+ * `GET /account/payment-methods/presentation` (publishable key + client secret)
13002
+ *
13003
+ * @param params - `country` outranks the billing address and IP
13004
+ * geolocation; `locale` names the language of the labels.
13005
+ */
13006
+ async paymentMethodPresentation(params, options) {
13007
+ return this.client.request("GET", "/account/payment-methods/presentation", {
13008
+ query: {
13009
+ client_secret: this.requireClientSecret(),
13010
+ country: params?.country,
13011
+ locale: params?.locale,
13012
+ contract_version: params?.contract_version
13013
+ },
13014
+ ...options,
13015
+ headers: this.pkHeaders(options?.headers)
13016
+ });
13017
+ }
12653
13018
  };
12654
13019
 
13020
+ // src/paymentPresentation.ts
13021
+ var PRESENTATION_CONTRACT_VERSION = 1;
13022
+ var BUILTIN_PAYMENT_ICON_KEYS = [
13023
+ "wallet",
13024
+ "card",
13025
+ "bank",
13026
+ "apple",
13027
+ "google",
13028
+ "bnpl",
13029
+ "cash",
13030
+ "paypal",
13031
+ "klarna",
13032
+ "crypto"
13033
+ ];
13034
+ var SVG_OPEN = '<svg xmlns="http://www.w3.org/2000/svg"';
13035
+ function glyph(key, color) {
13036
+ const line = (body) => `${SVG_OPEN} viewBox="0 0 24 24" fill="none" stroke="${color}" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">${body}</svg>`;
13037
+ switch (key) {
13038
+ case "card":
13039
+ return line('<rect x="2" y="5" width="20" height="14" rx="2"/><path d="M2 10h20"/>');
13040
+ case "bank":
13041
+ return line(
13042
+ '<path d="M3 10h18"/><path d="m12 3 9 5H3l9-5Z"/><path d="M6 10v7M10 10v7M14 10v7M18 10v7"/><path d="M3 20h18"/>'
13043
+ );
13044
+ case "bnpl":
13045
+ return line(
13046
+ '<rect x="2" y="6" width="20" height="12" rx="2"/><path d="M6 12h4"/><path d="M14 10v4"/><path d="M18 10v4"/>'
13047
+ );
13048
+ case "cash":
13049
+ return line(
13050
+ '<rect x="2" y="6" width="20" height="12" rx="2"/><circle cx="12" cy="12" r="2.5"/><path d="M6 12h.01M18 12h.01"/>'
13051
+ );
13052
+ case "apple":
13053
+ return `${SVG_OPEN} viewBox="0 0 384 512" fill="${color}"><path d="M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"/></svg>`;
13054
+ case "google":
13055
+ return `${SVG_OPEN} viewBox="0 0 48 48"><path fill="#4285F4" d="M45.12 24.5c0-1.56-.14-3.06-.4-4.5H24v8.51h11.84c-.51 2.75-2.06 5.08-4.39 6.64v5.52h7.11c4.16-3.83 6.56-9.47 6.56-16.17z"/><path fill="#34A853" d="M24 46c5.94 0 10.92-1.97 14.56-5.33l-7.11-5.52c-1.97 1.32-4.49 2.1-7.45 2.1-5.73 0-10.58-3.87-12.31-9.07H4.34v5.7C7.96 41.07 15.4 46 24 46z"/><path fill="#FBBC05" d="M11.69 28.18C11.25 26.86 11 25.45 11 24s.25-2.86.69-4.18v-5.7H4.34C2.85 17.09 2 20.45 2 24s.85 6.91 2.34 9.88l7.35-5.7z"/><path fill="#EA4335" d="M24 10.75c3.23 0 6.13 1.11 8.41 3.29l6.31-6.31C34.91 4.18 29.93 2 24 2 15.4 2 7.96 6.93 4.34 14.12l7.35 5.7c1.73-5.2 6.58-9.07 12.31-9.07z"/></svg>`;
13056
+ case "paypal":
13057
+ return `${SVG_OPEN} viewBox="0 0 32 32"><path d="M9 4h7.2c3.4 0 6 2.4 5.6 5.8-.4 3.6-3.5 6-7.1 6h-3.2L10.4 23H6.7L9 4z" fill="#003087"/><path d="M13 8.5h7.2c3.4 0 6 2.4 5.6 5.8-.4 3.6-3.5 6-7.1 6h-3.2L14.4 27.5H10.7L13 8.5z" fill="#009cde"/></svg>`;
13058
+ case "klarna":
13059
+ return `${SVG_OPEN} viewBox="0 0 24 24"><rect width="24" height="24" rx="6" fill="#FFA8CD"/><path fill="#0B051D" d="M8 6h2.7v12H8V6zm6.5 0h2.5c-.4 2.7-1.5 5-3 6.6 1.6 1.6 2.7 3.6 3.2 5.4h-2.7c-.5-1.6-1.4-3-2.7-4.2v4.2H10V12c2.1-1 3.8-3.2 4.5-6z"/></svg>`;
13060
+ case "crypto":
13061
+ return `${SVG_OPEN} viewBox="0 0 64 64"><path fill="#F7931A" d="m63.033,39.744c-4.274,17.143-21.637,27.576-38.782,23.301-17.138-4.274-27.571-21.638-23.295-38.78,4.272-17.145,21.635-27.579,38.775-23.305,17.144,4.274,27.576,21.64,23.302,38.784z"/><path fill="#FFF" d="m46.103,27.444c0.637-4.258-2.605-6.547-7.038-8.074l1.438-5.768-3.511-0.875-1.4,5.616c-0.923-0.23-1.871-0.447-2.813-0.662l1.41-5.653-3.509-0.875-1.439,5.766c-0.764-0.174-1.514-0.346-2.242-0.527l0.004-0.018-4.842-1.209-0.934,3.75s2.605,0.597,2.55,0.634c1.422,0.355,1.679,1.296,1.636,2.042l-1.638,6.571c0.098,0.025,0.225,0.061,0.365,0.117-0.117-0.029-0.242-0.061-0.371-0.092l-2.296,9.205c-0.174,0.432-0.615,1.08-1.609,0.834,0.035,0.051-2.552-0.637-2.552-0.637l-1.743,4.019,4.569,1.139c0.85,0.213,1.683,0.436,2.503,0.646l-1.453,5.834,3.507,0.875,1.439-5.772c0.958,0.26,1.888,0.5,2.798,0.726l-1.434,5.745,3.511,0.875,1.453-5.823c5.987,1.133,10.489,0.676,12.384-4.739,1.527-4.36-0.076-6.875-3.226-8.515,2.294-0.529,4.022-2.038,4.483-5.155zm-8.022,11.249c-1.085,4.36-8.426,2.003-10.806,1.412l1.928-7.729c2.38,0.594,10.012,1.77,8.878,6.317zm1.086-11.312c-0.99,3.966-7.1,1.951-9.082,1.457l1.748-7.01c1.982,0.494,8.365,1.416,7.334,5.553z"/></svg>`;
13062
+ case "wallet":
13063
+ return line(
13064
+ '<path d="M3 7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2"/><rect x="3" y="7" width="18" height="12" rx="2"/><path d="M16 13h3"/>'
13065
+ );
13066
+ }
13067
+ }
13068
+ function isBuiltinKey(key) {
13069
+ return BUILTIN_PAYMENT_ICON_KEYS.includes(key);
13070
+ }
13071
+ function builtinPaymentIconSvg(key, color = "#1f2937") {
13072
+ return glyph(isBuiltinKey(key) ? key : "wallet", color);
13073
+ }
13074
+ function builtinPaymentIconDataUri(key, color) {
13075
+ return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(builtinPaymentIconSvg(key, color))}`;
13076
+ }
13077
+ function presentationIconDataUri(icon, color) {
13078
+ return icon.type === "svg" ? icon.data_uri : builtinPaymentIconDataUri(icon.key, color);
13079
+ }
13080
+ function presentationIconSrc(entry, color) {
13081
+ if (entry.icon) return presentationIconDataUri(entry.icon, color);
13082
+ if (entry.fallback_icon) return builtinPaymentIconDataUri(entry.fallback_icon, color);
13083
+ return null;
13084
+ }
13085
+ function isSupportedPresentation(response) {
13086
+ return response.contract_version === PRESENTATION_CONTRACT_VERSION;
13087
+ }
13088
+ function presentationTiers(response) {
13089
+ const out = { express: [], normal: [], alternative: [] };
13090
+ for (const entry of response.entries) {
13091
+ if (entry.tier === "express") {
13092
+ const row = entry.row ?? 0;
13093
+ while (out.express.length <= row) out.express.push([]);
13094
+ out.express[row]?.push(entry);
13095
+ } else {
13096
+ out[entry.tier].push(entry);
13097
+ }
13098
+ }
13099
+ out.express = out.express.filter((row) => row.length > 0);
13100
+ return out;
13101
+ }
13102
+ function selectableEntries(response) {
13103
+ return response.entries.filter((entry) => entry.action !== void 0);
13104
+ }
13105
+ var PresentationCache = class _PresentationCache {
13106
+ constructor(options) {
13107
+ this.slots = /* @__PURE__ */ new Map();
13108
+ this.load = options.load;
13109
+ this.now = options.now ?? Date.now;
13110
+ this.maxEntries = options.maxEntries ?? 500;
13111
+ }
13112
+ /** The key two requests share exactly when DeloPay would answer them alike. */
13113
+ static keyOf(params) {
13114
+ return JSON.stringify([
13115
+ params.profile_id ?? null,
13116
+ params.environment ?? "live",
13117
+ params.locale?.toLowerCase() ?? null,
13118
+ params.country?.toUpperCase() ?? null,
13119
+ params.currency ?? null,
13120
+ params.amount ?? null,
13121
+ params.contract_version ?? PRESENTATION_CONTRACT_VERSION
13122
+ ]);
13123
+ }
13124
+ async get(params) {
13125
+ const request = {
13126
+ ...params,
13127
+ contract_version: params.contract_version ?? PRESENTATION_CONTRACT_VERSION
13128
+ };
13129
+ if (request.client_secret) {
13130
+ return { response: await this.load(request, {}), stale: false };
13131
+ }
13132
+ const key = _PresentationCache.keyOf(request);
13133
+ const slot = this.slots.get(key);
13134
+ const now = this.now();
13135
+ if (slot && now - slot.fetchedAt < slot.response.cache.max_age_seconds * 1e3) {
13136
+ return { response: slot.response, stale: false };
13137
+ }
13138
+ try {
13139
+ const response = await this.load(
13140
+ request,
13141
+ slot ? { headers: { "If-None-Match": `"${slot.response.revision}"` } } : {}
13142
+ );
13143
+ this.store(key, response, now);
13144
+ return { response, stale: false };
13145
+ } catch (error) {
13146
+ if (slot && error instanceof DelopayError && error.status === 304) {
13147
+ this.store(key, slot.response, now);
13148
+ return { response: slot.response, stale: false };
13149
+ }
13150
+ const policy = slot?.response.cache;
13151
+ const usableUntil = slot ? slot.fetchedAt + ((policy?.max_age_seconds ?? 0) + (policy?.stale_if_error_seconds ?? 0)) * 1e3 : 0;
13152
+ if (slot && isUnavailable(error) && now < usableUntil) {
13153
+ return { response: slot.response, stale: true };
13154
+ }
13155
+ if (slot && isRefusal(error)) this.slots.delete(key);
13156
+ throw error;
13157
+ }
13158
+ }
13159
+ /** Forget every answer, e.g. after the merchant changes the checkout editor. */
13160
+ clear() {
13161
+ this.slots.clear();
13162
+ }
13163
+ store(key, response, now) {
13164
+ if (response.cache.max_age_seconds <= 0) {
13165
+ this.slots.delete(key);
13166
+ return;
13167
+ }
13168
+ this.slots.delete(key);
13169
+ this.slots.set(key, { response, fetchedAt: now });
13170
+ while (this.slots.size > this.maxEntries) {
13171
+ const oldest = this.slots.keys().next().value;
13172
+ if (oldest === void 0) break;
13173
+ this.slots.delete(oldest);
13174
+ }
13175
+ }
13176
+ };
13177
+ function isRefusal(error) {
13178
+ return error instanceof DelopayError && error.status >= 400 && error.status < 500 && error.status !== 429;
13179
+ }
13180
+ function isUnavailable(error) {
13181
+ if (!(error instanceof DelopayError)) return false;
13182
+ return error.status === 0 || error.status === 429 || error.status >= 500;
13183
+ }
13184
+
12655
13185
  // src/panes.ts
12656
13186
  var PANE_VISIBILITIES = ["always", "embedded_only", "external_only"];
12657
13187
  function parseOpenTarget(raw) {
@@ -13124,6 +13654,34 @@ var AdminPortal = class {
13124
13654
  }
13125
13655
  );
13126
13656
  }
13657
+ /** Read whether refunds return their share of the platform fee, and the scope supplying it. */
13658
+ async getPlatformFeeReturn(merchantId, query = {}) {
13659
+ return this.request(
13660
+ "GET",
13661
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/platform-fee-return`,
13662
+ {
13663
+ query: { ...query }
13664
+ }
13665
+ );
13666
+ }
13667
+ /** Change the fee return for refunds that succeed from now on; earlier refunds keep their decision. */
13668
+ async updatePlatformFeeReturn(merchantId, body, query = {}) {
13669
+ return this.request(
13670
+ "PUT",
13671
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/platform-fee-return`,
13672
+ {
13673
+ query: { ...query },
13674
+ body
13675
+ }
13676
+ );
13677
+ }
13678
+ /** What each successful refund of one payment returned of the platform fee. */
13679
+ async listPaymentPlatformFeeReturns(merchantId, paymentId) {
13680
+ return this.request(
13681
+ "GET",
13682
+ `/admin-portal/accounts/${encodeURIComponent(merchantId)}/transactions/${encodeURIComponent(paymentId)}/platform-fee-returns`
13683
+ );
13684
+ }
13127
13685
  /**
13128
13686
  * The deployment's merchant roles: shared roles, the roles defined in code,
13129
13687
  * and every merchant's own custom roles. `GET /admin-portal/merchant-roles`
@@ -14684,7 +15242,9 @@ var DelopayInternal = class extends Delopay {
14684
15242
  AvailabilityOverrides,
14685
15243
  BRANDING_EXPORT_FORMAT,
14686
15244
  BRANDING_EXPORT_VERSION,
15245
+ BUILTIN_PAYMENT_ICON_KEYS,
14687
15246
  BuyerBlocklist,
15247
+ BuyerConversations,
14688
15248
  CARD_FIELD_CHROMES,
14689
15249
  CARD_FIELD_FONT_SIZES,
14690
15250
  CARD_FIELD_WEIGHTS,
@@ -14754,11 +15314,13 @@ var DelopayInternal = class extends Delopay {
14754
15314
  PANE_ICON_KEYS,
14755
15315
  PAYPAL_CARD_LAYOUTS,
14756
15316
  PAYPAL_LABEL_STYLES,
15317
+ PRESENTATION_CONTRACT_VERSION,
14757
15318
  PaypalDisputes,
14758
15319
  PlatformBilling,
14759
15320
  PlatformFees,
14760
15321
  PlatformMessageTemplates,
14761
15322
  PlatformSettings,
15323
+ PresentationCache,
14762
15324
  ProcessorCosts,
14763
15325
  Products,
14764
15326
  RTL_CHECKOUT_LOCALES,
@@ -14812,6 +15374,8 @@ var DelopayInternal = class extends Delopay {
14812
15374
  applyBrandingVariables,
14813
15375
  asAirwallexCardPreset,
14814
15376
  buildBrandingExport,
15377
+ builtinPaymentIconDataUri,
15378
+ builtinPaymentIconSvg,
14815
15379
  buttonPadValue,
14816
15380
  canonicalSectionId,
14817
15381
  cardFieldFontPx,
@@ -14869,6 +15433,7 @@ var DelopayInternal = class extends Delopay {
14869
15433
  isNoticeIcon,
14870
15434
  isSubscriptionDisputeWebhook,
14871
15435
  isSubscriptionLifecycleWebhook,
15436
+ isSupportedPresentation,
14872
15437
  knownSectionLabelKey,
14873
15438
  leaf,
14874
15439
  logoDimensions,
@@ -14886,6 +15451,9 @@ var DelopayInternal = class extends Delopay {
14886
15451
  parseCustomFieldsLoose,
14887
15452
  parseImportedBranding,
14888
15453
  parseNoticesLoose,
15454
+ presentationIconDataUri,
15455
+ presentationIconSrc,
15456
+ presentationTiers,
14889
15457
  programToTree,
14890
15458
  radiusValue,
14891
15459
  readableInkOn,
@@ -14900,6 +15468,7 @@ var DelopayInternal = class extends Delopay {
14900
15468
  sanitizeCustomCss,
14901
15469
  sectionLabel,
14902
15470
  sectionOrderOf,
15471
+ selectableEntries,
14903
15472
  shadowFor,
14904
15473
  shownNotices,
14905
15474
  stripeSpacingValues,