@delopay/sdk 0.115.0 → 0.118.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
@@ -35,6 +35,7 @@ __export(internal_exports, {
35
35
  CHECKBOX_CHECKED: () => CHECKBOX_CHECKED,
36
36
  CHECKBOX_UNCHECKED: () => CHECKBOX_UNCHECKED,
37
37
  CHECKOUT_EVENT_KINDS: () => CHECKOUT_EVENT_KINDS,
38
+ CHECKOUT_LOCALES: () => CHECKOUT_LOCALES,
38
39
  CUSTOM_CSS_MAX_LENGTH: () => CUSTOM_CSS_MAX_LENGTH,
39
40
  CUSTOM_FIELDS_MAX: () => CUSTOM_FIELDS_MAX,
40
41
  CUSTOM_FIELD_CONDITIONS_MAX: () => CUSTOM_FIELD_CONDITIONS_MAX,
@@ -62,6 +63,7 @@ __export(internal_exports, {
62
63
  Files: () => Files,
63
64
  Forex: () => Forex,
64
65
  Gsm: () => Gsm,
66
+ LOCALIZABLE_COPY_FIELDS: () => LOCALIZABLE_COPY_FIELDS,
65
67
  NATIVE_PANES_MAX: () => NATIVE_PANES_MAX,
66
68
  NATIVE_PANE_CATEGORY_KEYS: () => NATIVE_PANE_CATEGORY_KEYS,
67
69
  NATIVE_PANE_ICON_KEYS: () => NATIVE_PANE_ICON_KEYS,
@@ -76,6 +78,16 @@ __export(internal_exports, {
76
78
  STRIPE_FALLBACK_PANE_CATALOG: () => STRIPE_FALLBACK_PANE_CATALOG,
77
79
  STRIPE_FALLBACK_PANE_METHODS: () => STRIPE_FALLBACK_PANE_METHODS,
78
80
  STRIPE_NATIVE_PANE_METHODS: () => STRIPE_NATIVE_PANE_METHODS,
81
+ SURCHARGE_BORDER_STYLES: () => SURCHARGE_BORDER_STYLES,
82
+ SURCHARGE_BORDER_WIDTHS: () => SURCHARGE_BORDER_WIDTHS,
83
+ SURCHARGE_FIGURE_MODES: () => SURCHARGE_FIGURE_MODES,
84
+ SURCHARGE_LABEL_MODES: () => SURCHARGE_LABEL_MODES,
85
+ SURCHARGE_POSITIONS: () => SURCHARGE_POSITIONS,
86
+ SURCHARGE_SHAPES: () => SURCHARGE_SHAPES,
87
+ SURCHARGE_SIGNS: () => SURCHARGE_SIGNS,
88
+ SURCHARGE_SIZES: () => SURCHARGE_SIZES,
89
+ SURCHARGE_STYLES: () => SURCHARGE_STYLES,
90
+ SURCHARGE_WEIGHTS: () => SURCHARGE_WEIGHTS,
79
91
  Search: () => Search,
80
92
  Settlement: () => Settlement,
81
93
  Subscriptions: () => Subscriptions,
@@ -87,11 +99,13 @@ __export(internal_exports, {
87
99
  applyBrandingVariables: () => applyBrandingVariables,
88
100
  buildBrandingExport: () => buildBrandingExport,
89
101
  buttonPadValue: () => buttonPadValue,
102
+ checkoutCopy: () => checkoutCopy,
90
103
  cloneBranding: () => cloneBranding,
91
104
  cloneCustomField: () => cloneCustomField,
92
105
  cloneNativePane: () => cloneNativePane,
93
106
  clonePane: () => clonePane,
94
107
  contrastRatio: () => contrastRatio,
108
+ copyTranslationsKey: () => copyTranslationsKey,
95
109
  customFieldContextFromMetadata: () => customFieldContextFromMetadata,
96
110
  customFieldIsTextLike: () => customFieldIsTextLike,
97
111
  customFieldOperatorTakesValue: () => customFieldOperatorTakesValue,
@@ -136,9 +150,14 @@ __export(internal_exports, {
136
150
  parseImportedBranding: () => parseImportedBranding,
137
151
  programToTree: () => programToTree,
138
152
  radiusValue: () => radiusValue,
153
+ readableInkOn: () => readableInkOn,
139
154
  ruleMatchToTree: () => ruleMatchToTree,
140
155
  sanitizeCustomCss: () => sanitizeCustomCss,
141
156
  shadowFor: () => shadowFor,
157
+ surchargeFigurePlan: () => surchargeFigurePlan,
158
+ surchargeShowsLabel: () => surchargeShowsLabel,
159
+ surchargeStyleDrawsAShape: () => surchargeStyleDrawsAShape,
160
+ surchargeWordFor: () => surchargeWordFor,
142
161
  surfacePadValue: () => surfacePadValue,
143
162
  validatePanes: () => validatePanes,
144
163
  verticalGapValue: () => verticalGapValue,
@@ -680,9 +699,9 @@ var Connectors = class {
680
699
  /**
681
700
  * Update a connector account.
682
701
  *
683
- * `connector_webhook_details` **merges** into the stored block key by key
684
- * (be#992): an absent key keeps its stored secret, an explicit value is
685
- * written, and an explicit empty string clears that secret. Send only the
702
+ * `connector_webhook_details` **merges** into the stored block key by key:
703
+ * an absent key keeps its stored secret, an explicit value is written, and
704
+ * an explicit empty string clears that secret. Send only the
686
705
  * keys the operator typed — padding the other environment's keys with `''`
687
706
  * clears a live signing secret and inbound webhooks stop verifying.
688
707
  *
@@ -3857,11 +3876,79 @@ var Export = class {
3857
3876
  constructor(request) {
3858
3877
  this.request = request;
3859
3878
  }
3860
- /** Export transactions. `POST /export/transactions` */
3861
- async transactions(params) {
3862
- return this.request("POST", "/export/transactions", { body: params });
3879
+ async transactions(params, options) {
3880
+ return this.request(
3881
+ "POST",
3882
+ "/export/transactions",
3883
+ transactionBody(params, options)
3884
+ );
3885
+ }
3886
+ async transactionsForProfile(params, options) {
3887
+ return this.request(
3888
+ "POST",
3889
+ "/export/profile/transactions",
3890
+ transactionBody(params, options)
3891
+ );
3892
+ }
3893
+ async refunds(params, options) {
3894
+ return this.request("POST", "/refunds/list/export", bodied(params ?? {}, options));
3895
+ }
3896
+ async refundsForProfile(params, options) {
3897
+ return this.request(
3898
+ "POST",
3899
+ "/refunds/profile/list/export",
3900
+ bodied(params ?? {}, options)
3901
+ );
3902
+ }
3903
+ async disputes(params, options) {
3904
+ return this.request("GET", "/disputes/list/export", queried(params, options));
3905
+ }
3906
+ async disputesForProfile(params, options) {
3907
+ return this.request(
3908
+ "GET",
3909
+ "/disputes/profile/list/export",
3910
+ queried(params, options)
3911
+ );
3912
+ }
3913
+ async payouts(params, options) {
3914
+ return this.request("POST", "/payouts/list/export", bodied(params, options));
3915
+ }
3916
+ async payoutsForProfile(params, options) {
3917
+ return this.request("POST", "/payouts/profile/list/export", bodied(params, options));
3918
+ }
3919
+ async subscriptions(profileId, params, options) {
3920
+ return this.request(
3921
+ "GET",
3922
+ "/subscriptions/list/export",
3923
+ queried(params, options, { "X-Profile-Id": profileId })
3924
+ );
3925
+ }
3926
+ async auditLog(params, options) {
3927
+ return this.request("GET", "/audit/export", queried(params, options));
3863
3928
  }
3864
3929
  };
3930
+ var ACCEPT = {
3931
+ csv: "text/csv",
3932
+ json: "application/json",
3933
+ pdf: "application/pdf"
3934
+ };
3935
+ function negotiated(options, format) {
3936
+ const headers = { ...options.headers, Accept: ACCEPT[format] };
3937
+ return format === "json" ? { ...options, headers } : { ...options, headers, responseType: "blob" };
3938
+ }
3939
+ function transactionBody(params, options) {
3940
+ const format = options?.format ?? "json";
3941
+ return negotiated({ body: { ...params, format } }, format);
3942
+ }
3943
+ function bodied(body, options) {
3944
+ return negotiated({ body }, options?.format ?? "json");
3945
+ }
3946
+ function queried(params, options, headers) {
3947
+ return negotiated(
3948
+ { query: params ?? {}, ...headers ? { headers } : {} },
3949
+ options?.format ?? "json"
3950
+ );
3951
+ }
3865
3952
 
3866
3953
  // src/resources/featureMatrix.ts
3867
3954
  var FeatureMatrix = class {
@@ -4312,11 +4399,12 @@ var Settlement = class {
4312
4399
  /**
4313
4400
  * Record payout progress on a statement (`unpaid` / `partial` / `paid`).
4314
4401
  *
4315
- * Subject to the caller's `settlement_payout` operation limit, which can
4316
- * only be a per-operation ceiling: an over-limit call fails with `DE_01`
4317
- * and nothing is recorded. There is no approval route out of it — four-eyes
4318
- * needs an executor that can run the operation once somebody says yes, and
4319
- * only refunds have one, so a settlement rule can only block.
4402
+ * Subject to the caller's `settlement_payout` operation limit a
4403
+ * per-operation ceiling, a windowed total, a windowed count, or any
4404
+ * combination: an over-limit call fails with `DE_01` and nothing is
4405
+ * recorded. There is no approval route out of it four-eyes needs an
4406
+ * executor that can run the operation once somebody says yes, and only
4407
+ * refunds have one, so a settlement rule can only block.
4320
4408
  *
4321
4409
  * `POST /settlement/statements/{statementId}/payout`
4322
4410
  */
@@ -5182,6 +5270,121 @@ function feeProgram() {
5182
5270
  }
5183
5271
 
5184
5272
  // src/branding.ts
5273
+ function surchargeShowsLabel(labelMode, style, position) {
5274
+ if (labelMode !== "labelled") return false;
5275
+ return !(style === "ribbon" && (position === "cornerStart" || position === "cornerEnd"));
5276
+ }
5277
+ function surchargeFigurePlan(branding, isDiscount, percentAvailable) {
5278
+ const mode = isDiscount ? branding.discountFigure : branding.surchargeFigure;
5279
+ const label = surchargeShowsLabel(
5280
+ branding.surchargeLabel,
5281
+ branding.surchargeStyle,
5282
+ branding.surchargePosition
5283
+ );
5284
+ if (!percentAvailable) return { first: "amount", second: null, label };
5285
+ const ordered = {
5286
+ amount: ["amount", null],
5287
+ percent: ["percent", null],
5288
+ amountThenPercent: ["amount", "percent"],
5289
+ percentThenAmount: ["percent", "amount"]
5290
+ };
5291
+ const [first, second] = ordered[mode];
5292
+ const cornerRibbon = branding.surchargeStyle === "ribbon" && (branding.surchargePosition === "cornerStart" || branding.surchargePosition === "cornerEnd");
5293
+ return { first, second: cornerRibbon ? null : second, label };
5294
+ }
5295
+ function readableInkOn(color) {
5296
+ const onBlack = contrastRatio(color, "#000000");
5297
+ const onWhite = contrastRatio(color, "#ffffff");
5298
+ if (onBlack === null || onWhite === null) return "#ffffff";
5299
+ return onBlack >= onWhite ? "#000000" : "#ffffff";
5300
+ }
5301
+ var SURCHARGE_FONT_SIZE = {
5302
+ sm: "0.6875rem",
5303
+ md: "0.8125rem",
5304
+ lg: "0.9375rem"
5305
+ };
5306
+ var SURCHARGE_PAD = {
5307
+ sm: "1px 6px",
5308
+ md: "2px 8px",
5309
+ lg: "3px 10px"
5310
+ };
5311
+ var SURCHARGE_RADIUS = {
5312
+ pill: "999px",
5313
+ rounded: "6px",
5314
+ square: "0px"
5315
+ };
5316
+ var SURCHARGE_BORDER_WIDTH = {
5317
+ none: "0px",
5318
+ thin: "1px",
5319
+ medium: "2px",
5320
+ thick: "3px"
5321
+ };
5322
+ var SURCHARGE_FONT_WEIGHT = {
5323
+ regular: "400",
5324
+ medium: "600",
5325
+ bold: "700"
5326
+ };
5327
+ var SURCHARGE_POSITIONS = [
5328
+ "trailing",
5329
+ "inline",
5330
+ "below",
5331
+ "above",
5332
+ "cornerStart",
5333
+ "cornerEnd"
5334
+ ];
5335
+ var SURCHARGE_STYLES = [
5336
+ "plain",
5337
+ "underline",
5338
+ "outline",
5339
+ "badge",
5340
+ "solid",
5341
+ "ribbon"
5342
+ ];
5343
+ var SURCHARGE_BORDER_WIDTHS = [
5344
+ "none",
5345
+ "thin",
5346
+ "medium",
5347
+ "thick"
5348
+ ];
5349
+ var SURCHARGE_BORDER_STYLES = [
5350
+ "solid",
5351
+ "dashed",
5352
+ "dotted"
5353
+ ];
5354
+ var SURCHARGE_SIZES = ["sm", "md", "lg"];
5355
+ function surchargeStyleDrawsAShape(style) {
5356
+ return style === "badge" || style === "outline" || style === "solid";
5357
+ }
5358
+ var SURCHARGE_SHAPES = ["pill", "rounded", "square"];
5359
+ var SURCHARGE_WEIGHTS = ["regular", "medium", "bold"];
5360
+ var SURCHARGE_SIGNS = ["always", "minusOnly", "none"];
5361
+ var SURCHARGE_LABEL_MODES = ["amount", "labelled"];
5362
+ var SURCHARGE_FIGURE_MODES = [
5363
+ "amount",
5364
+ "percent",
5365
+ "amountThenPercent",
5366
+ "percentThenAmount"
5367
+ ];
5368
+ var CHECKOUT_LOCALES = ["en", "de"];
5369
+ var LOCALIZABLE_COPY_FIELDS = [
5370
+ "headerText",
5371
+ "payButtonLabel",
5372
+ "cardTermsMessage",
5373
+ "footerText"
5374
+ ];
5375
+ function copyTranslationsKey(field) {
5376
+ return `${field}Translations`;
5377
+ }
5378
+ function checkoutCopy(branding, field, locale) {
5379
+ const translated = translationFor(branding[copyTranslationsKey(field)], locale);
5380
+ return translated ?? branding[field];
5381
+ }
5382
+ function surchargeWordFor(branding, isDiscount, locale) {
5383
+ return translationFor(
5384
+ isDiscount ? branding.discountWordTranslations : branding.surchargeWordTranslations,
5385
+ locale
5386
+ );
5387
+ }
5185
5388
  var FONT_STACKS = {
5186
5389
  inter: "'Inter Variable', 'Inter', system-ui, -apple-system, sans-serif",
5187
5390
  system: "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif",
@@ -5372,6 +5575,44 @@ var DEFAULT_BRANDING_BASE = {
5372
5575
  verticalGap: "comfortable",
5373
5576
  inputSize: "md",
5374
5577
  buttonSize: "md",
5578
+ // Disclosure on by default: with provider-scoped pricing the tile is where
5579
+ // the buyer chooses between prices, and a price they cannot see is one they
5580
+ // find out about on the statement.
5581
+ showSurcharge: true,
5582
+ surchargePosition: "trailing",
5583
+ surchargeStyle: "badge",
5584
+ surchargeSize: "sm",
5585
+ surchargeShape: "pill",
5586
+ surchargeBorderWidth: "thin",
5587
+ surchargeBorderStyle: "solid",
5588
+ surchargeWeight: "medium",
5589
+ surchargeSign: "always",
5590
+ surchargeUppercase: false,
5591
+ // Named, not bare. A tile that reads "-EUR 2.50" beside a brand name is a
5592
+ // number with no subject — buyers read it as the price, not as a change to
5593
+ // it. "Discount -EUR 2.50" needs no interpreting, and the word is what makes
5594
+ // the default configuration legible without the merchant touching anything.
5595
+ surchargeLabel: "labelled",
5596
+ // The two directions default differently on purpose, which is the whole
5597
+ // reason they are two settings. A fee is something a buyer acts on in money,
5598
+ // so it leads with money and says nothing else. A saving is something worth
5599
+ // advertising, and the share is the persuasive half of it — "-5.1% (EUR
5600
+ // 2.50)" sells what "-EUR 2.50" merely states, and the amount is still right
5601
+ // there beside it.
5602
+ surchargeFigure: "amount",
5603
+ discountFigure: "percentThenAmount",
5604
+ // Empty: the checkout's own localized words are the default, in every
5605
+ // language it ships. A merchant fills these in only to say it differently.
5606
+ surchargeWordTranslations: {},
5607
+ discountWordTranslations: {},
5608
+ // amber-700 / emerald-700, not the 600s: the `plain` style renders the
5609
+ // disclosure as coloured TEXT, so it is bound by `WCAG_AA_TEXT` (4.5) rather
5610
+ // than by the 3:1 a coloured shape would be, and the 600s come to 3.19 and
5611
+ // 3.77 against the default white surface. These are 5.02 and 5.48, pinned by
5612
+ // tests. Far enough apart to read as opposite news at a glance rather than as
5613
+ // two shades of "extra".
5614
+ surchargeColor: "#b45309",
5615
+ discountColor: "#047857",
5375
5616
  layout: "split",
5376
5617
  summaryPosition: "left",
5377
5618
  showOrderSummary: true,
@@ -5380,10 +5621,17 @@ var DEFAULT_BRANDING_BASE = {
5380
5621
  totalLabel: "Total",
5381
5622
  showCurrencyCode: false,
5382
5623
  showOrderItems: true,
5624
+ // Each flat field keeps its meaning: what the merchant wrote, used in every
5625
+ // locale that carries no override. Empty maps therefore change nothing for a
5626
+ // profile saved before translations existed.
5383
5627
  headerText: "",
5628
+ headerTextTranslations: {},
5384
5629
  payButtonLabel: "",
5630
+ payButtonLabelTranslations: {},
5385
5631
  cardTermsMessage: "",
5632
+ cardTermsMessageTranslations: {},
5386
5633
  footerText: "",
5634
+ footerTextTranslations: {},
5387
5635
  supportEmail: "",
5388
5636
  paymentLayout: "tabs",
5389
5637
  labelStyle: "above",
@@ -5409,6 +5657,11 @@ var DEFAULT_BRANDING_DARK = {
5409
5657
  buttonBackground: "#1E4FEB",
5410
5658
  buttonText: "#ffffff",
5411
5659
  surfaceStyle: "flat",
5660
+ // amber-400 / emerald-400: the 700s above are far too dark to read on
5661
+ // slate-900, and this pair is the same news in the same order at the light
5662
+ // end of the ramp — 10.69 and 9.29 against the dark surface, also pinned.
5663
+ surchargeColor: "#fbbf24",
5664
+ discountColor: "#34d399",
5412
5665
  trustBadges: DEFAULT_BADGES_DARK.map((b) => ({ ...b })),
5413
5666
  customFields: []
5414
5667
  };
@@ -5419,7 +5672,16 @@ function cloneBranding(b) {
5419
5672
  return {
5420
5673
  ...b,
5421
5674
  trustBadges: b.trustBadges.map((badge) => ({ ...badge })),
5422
- customFields: b.customFields.map(cloneCustomField)
5675
+ customFields: b.customFields.map(cloneCustomField),
5676
+ // Copied, not shared. A spread alone would leave the clone pointing at the
5677
+ // original's maps, and the dashboard edits a clone precisely so the form
5678
+ // can be abandoned without touching what is saved.
5679
+ surchargeWordTranslations: { ...b.surchargeWordTranslations },
5680
+ discountWordTranslations: { ...b.discountWordTranslations },
5681
+ headerTextTranslations: { ...b.headerTextTranslations },
5682
+ payButtonLabelTranslations: { ...b.payButtonLabelTranslations },
5683
+ cardTermsMessageTranslations: { ...b.cardTermsMessageTranslations },
5684
+ footerTextTranslations: { ...b.footerTextTranslations }
5423
5685
  };
5424
5686
  }
5425
5687
  function cloneCustomField(f) {
@@ -5570,13 +5832,25 @@ function defaultCustomFieldVisibility() {
5570
5832
  return { mode: "always", match: "all", conditions: [] };
5571
5833
  }
5572
5834
  function parseTranslations(raw) {
5573
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
5835
+ let value = raw;
5836
+ if (typeof value === "string") {
5837
+ try {
5838
+ value = JSON.parse(value);
5839
+ } catch {
5840
+ return {};
5841
+ }
5842
+ }
5843
+ if (!value || typeof value !== "object" || Array.isArray(value)) return {};
5574
5844
  const out = {};
5575
- for (const [k, v] of Object.entries(raw)) {
5576
- if (typeof v === "string" && v.length > 0) out[k] = v;
5845
+ for (const [k, v] of Object.entries(value)) {
5846
+ if (typeof v === "string" && v.trim().length > 0) out[k] = v;
5577
5847
  }
5578
5848
  return out;
5579
5849
  }
5850
+ function encodeTranslations(map) {
5851
+ const entries = Object.entries(map).filter(([, v]) => v.trim().length > 0);
5852
+ return entries.length > 0 ? JSON.stringify(Object.fromEntries(entries)) : void 0;
5853
+ }
5580
5854
  function normalizeCondition(raw, index) {
5581
5855
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
5582
5856
  const c = raw;
@@ -5928,6 +6202,74 @@ function decodeBranding(source) {
5928
6202
  ["sm", "md", "lg"],
5929
6203
  DEFAULT_BRANDING.buttonSize
5930
6204
  ),
6205
+ showSurcharge: parseBool(extras["showSurcharge"], DEFAULT_BRANDING.showSurcharge),
6206
+ surchargePosition: pickEnum(
6207
+ extras["surchargePosition"],
6208
+ SURCHARGE_POSITIONS,
6209
+ DEFAULT_BRANDING.surchargePosition
6210
+ ),
6211
+ surchargeStyle: pickEnum(
6212
+ extras["surchargeStyle"],
6213
+ SURCHARGE_STYLES,
6214
+ DEFAULT_BRANDING.surchargeStyle
6215
+ ),
6216
+ surchargeSize: pickEnum(
6217
+ extras["surchargeSize"],
6218
+ SURCHARGE_SIZES,
6219
+ DEFAULT_BRANDING.surchargeSize
6220
+ ),
6221
+ surchargeShape: pickEnum(
6222
+ extras["surchargeShape"],
6223
+ SURCHARGE_SHAPES,
6224
+ DEFAULT_BRANDING.surchargeShape
6225
+ ),
6226
+ surchargeBorderWidth: pickEnum(
6227
+ extras["surchargeBorderWidth"],
6228
+ SURCHARGE_BORDER_WIDTHS,
6229
+ DEFAULT_BRANDING.surchargeBorderWidth
6230
+ ),
6231
+ surchargeBorderStyle: pickEnum(
6232
+ extras["surchargeBorderStyle"],
6233
+ SURCHARGE_BORDER_STYLES,
6234
+ DEFAULT_BRANDING.surchargeBorderStyle
6235
+ ),
6236
+ surchargeWeight: pickEnum(
6237
+ extras["surchargeWeight"],
6238
+ SURCHARGE_WEIGHTS,
6239
+ DEFAULT_BRANDING.surchargeWeight
6240
+ ),
6241
+ surchargeSign: pickEnum(
6242
+ extras["surchargeSign"],
6243
+ SURCHARGE_SIGNS,
6244
+ DEFAULT_BRANDING.surchargeSign
6245
+ ),
6246
+ surchargeUppercase: parseBool(
6247
+ extras["surchargeUppercase"],
6248
+ DEFAULT_BRANDING.surchargeUppercase
6249
+ ),
6250
+ surchargeLabel: pickEnum(
6251
+ extras["surchargeLabel"],
6252
+ SURCHARGE_LABEL_MODES,
6253
+ DEFAULT_BRANDING.surchargeLabel
6254
+ ),
6255
+ surchargeFigure: pickEnum(
6256
+ extras["surchargeFigure"],
6257
+ SURCHARGE_FIGURE_MODES,
6258
+ DEFAULT_BRANDING.surchargeFigure
6259
+ ),
6260
+ discountFigure: pickEnum(
6261
+ extras["discountFigure"],
6262
+ SURCHARGE_FIGURE_MODES,
6263
+ DEFAULT_BRANDING.discountFigure
6264
+ ),
6265
+ surchargeWordTranslations: parseTranslations(extras["surchargeWordTranslations"]),
6266
+ discountWordTranslations: parseTranslations(extras["discountWordTranslations"]),
6267
+ headerTextTranslations: parseTranslations(extras["headerTextTranslations"]),
6268
+ payButtonLabelTranslations: parseTranslations(extras["payButtonLabelTranslations"]),
6269
+ cardTermsMessageTranslations: parseTranslations(extras["cardTermsMessageTranslations"]),
6270
+ footerTextTranslations: parseTranslations(extras["footerTextTranslations"]),
6271
+ surchargeColor: s(extras["surchargeColor"]) || DEFAULT_BRANDING.surchargeColor,
6272
+ discountColor: s(extras["discountColor"]) || DEFAULT_BRANDING.discountColor,
5931
6273
  layout: pickEnum(extras["layout"], ["compact", "split"], DEFAULT_BRANDING.layout),
5932
6274
  summaryPosition: pickEnum(
5933
6275
  extras["summaryPosition"],
@@ -5981,6 +6323,21 @@ function encodeBranding(branding, base) {
5981
6323
  verticalGap: branding.verticalGap,
5982
6324
  inputSize: branding.inputSize,
5983
6325
  buttonSize: branding.buttonSize,
6326
+ showSurcharge: String(branding.showSurcharge),
6327
+ surchargePosition: branding.surchargePosition,
6328
+ surchargeStyle: branding.surchargeStyle,
6329
+ surchargeSize: branding.surchargeSize,
6330
+ surchargeShape: branding.surchargeShape,
6331
+ surchargeBorderWidth: branding.surchargeBorderWidth,
6332
+ surchargeBorderStyle: branding.surchargeBorderStyle,
6333
+ surchargeWeight: branding.surchargeWeight,
6334
+ surchargeSign: branding.surchargeSign,
6335
+ surchargeUppercase: String(branding.surchargeUppercase),
6336
+ surchargeLabel: branding.surchargeLabel,
6337
+ surchargeFigure: branding.surchargeFigure,
6338
+ discountFigure: branding.discountFigure,
6339
+ surchargeColor: branding.surchargeColor,
6340
+ discountColor: branding.discountColor,
5984
6341
  layout: branding.layout,
5985
6342
  summaryPosition: branding.summaryPosition,
5986
6343
  showOrderSummary: String(branding.showOrderSummary),
@@ -5998,6 +6355,17 @@ function encodeBranding(branding, base) {
5998
6355
  if (branding.customFields.length > 0) {
5999
6356
  extras["customFields"] = encodeCustomFields(branding.customFields);
6000
6357
  }
6358
+ for (const key of [
6359
+ "surchargeWordTranslations",
6360
+ "discountWordTranslations",
6361
+ "headerTextTranslations",
6362
+ "payButtonLabelTranslations",
6363
+ "cardTermsMessageTranslations",
6364
+ "footerTextTranslations"
6365
+ ]) {
6366
+ const encoded = encodeTranslations(branding[key]);
6367
+ if (encoded) extras[key] = encoded;
6368
+ }
6001
6369
  const tagline = trim(branding.tagline);
6002
6370
  if (tagline) extras["tagline"] = tagline;
6003
6371
  const footer = trim(branding.footerText);
@@ -6106,6 +6474,71 @@ function parseImportedBranding(raw) {
6106
6474
  ),
6107
6475
  inputSize: pickEnum(root["inputSize"], ["sm", "md", "lg"], dflt.inputSize),
6108
6476
  buttonSize: pickEnum(root["buttonSize"], ["sm", "md", "lg"], dflt.buttonSize),
6477
+ showSurcharge: parseBool(root["showSurcharge"], dflt.showSurcharge),
6478
+ surchargePosition: pickEnum(
6479
+ root["surchargePosition"],
6480
+ SURCHARGE_POSITIONS,
6481
+ dflt.surchargePosition
6482
+ ),
6483
+ surchargeStyle: pickEnum(
6484
+ root["surchargeStyle"],
6485
+ SURCHARGE_STYLES,
6486
+ dflt.surchargeStyle
6487
+ ),
6488
+ surchargeSize: pickEnum(
6489
+ root["surchargeSize"],
6490
+ SURCHARGE_SIZES,
6491
+ dflt.surchargeSize
6492
+ ),
6493
+ surchargeShape: pickEnum(
6494
+ root["surchargeShape"],
6495
+ SURCHARGE_SHAPES,
6496
+ dflt.surchargeShape
6497
+ ),
6498
+ surchargeBorderWidth: pickEnum(
6499
+ root["surchargeBorderWidth"],
6500
+ SURCHARGE_BORDER_WIDTHS,
6501
+ dflt.surchargeBorderWidth
6502
+ ),
6503
+ surchargeBorderStyle: pickEnum(
6504
+ root["surchargeBorderStyle"],
6505
+ SURCHARGE_BORDER_STYLES,
6506
+ dflt.surchargeBorderStyle
6507
+ ),
6508
+ surchargeWeight: pickEnum(
6509
+ root["surchargeWeight"],
6510
+ SURCHARGE_WEIGHTS,
6511
+ dflt.surchargeWeight
6512
+ ),
6513
+ surchargeSign: pickEnum(
6514
+ root["surchargeSign"],
6515
+ SURCHARGE_SIGNS,
6516
+ dflt.surchargeSign
6517
+ ),
6518
+ surchargeUppercase: parseBool(root["surchargeUppercase"], dflt.surchargeUppercase),
6519
+ surchargeLabel: pickEnum(
6520
+ root["surchargeLabel"],
6521
+ SURCHARGE_LABEL_MODES,
6522
+ dflt.surchargeLabel
6523
+ ),
6524
+ surchargeFigure: pickEnum(
6525
+ root["surchargeFigure"],
6526
+ SURCHARGE_FIGURE_MODES,
6527
+ dflt.surchargeFigure
6528
+ ),
6529
+ discountFigure: pickEnum(
6530
+ root["discountFigure"],
6531
+ SURCHARGE_FIGURE_MODES,
6532
+ dflt.discountFigure
6533
+ ),
6534
+ surchargeWordTranslations: parseTranslations(root["surchargeWordTranslations"]),
6535
+ discountWordTranslations: parseTranslations(root["discountWordTranslations"]),
6536
+ headerTextTranslations: parseTranslations(root["headerTextTranslations"]),
6537
+ payButtonLabelTranslations: parseTranslations(root["payButtonLabelTranslations"]),
6538
+ cardTermsMessageTranslations: parseTranslations(root["cardTermsMessageTranslations"]),
6539
+ footerTextTranslations: parseTranslations(root["footerTextTranslations"]),
6540
+ surchargeColor: sHex(root["surchargeColor"], dflt.surchargeColor),
6541
+ discountColor: sHex(root["discountColor"], dflt.discountColor),
6109
6542
  layout: pickEnum(root["layout"], ["compact", "split"], dflt.layout),
6110
6543
  summaryPosition: pickEnum(
6111
6544
  root["summaryPosition"],
@@ -6172,6 +6605,19 @@ function applyBrandingVariables(el, b) {
6172
6605
  set("--dp-gap-vertical", VERTICAL_GAP[b.verticalGap]);
6173
6606
  set("--dp-input-pad", INPUT_PAD[b.inputSize]);
6174
6607
  set("--dp-button-pad", BUTTON_PAD[b.buttonSize]);
6608
+ set("--dp-surcharge", b.surchargeColor);
6609
+ set("--dp-discount", b.discountColor);
6610
+ set("--dp-surcharge-ink", readableInkOn(b.surchargeColor));
6611
+ set("--dp-discount-ink", readableInkOn(b.discountColor));
6612
+ set("--dp-surcharge-size", SURCHARGE_FONT_SIZE[b.surchargeSize]);
6613
+ set("--dp-surcharge-pad", SURCHARGE_PAD[b.surchargeSize]);
6614
+ set("--dp-surcharge-radius", SURCHARGE_RADIUS[b.surchargeShape]);
6615
+ set("--dp-surcharge-weight", SURCHARGE_FONT_WEIGHT[b.surchargeWeight]);
6616
+ set(
6617
+ "--dp-surcharge-border-width",
6618
+ SURCHARGE_BORDER_WIDTH[b.surchargeStyle === "outline" && b.surchargeBorderWidth === "none" ? "thin" : b.surchargeBorderWidth]
6619
+ );
6620
+ set("--dp-surcharge-border-style", b.surchargeBorderStyle);
6175
6621
  set("--dp-shadow", shadowFor(b.surfaceStyle));
6176
6622
  set(
6177
6623
  "--dp-surface-border",
@@ -6562,9 +7008,9 @@ var STRIPE_FALLBACK_PANE_METHODS = [
6562
7008
  requiresBillingCountry: true,
6563
7009
  defaultLabel: "Klarna",
6564
7010
  // NOT the router's current "Pay later or in 3 instalments". This table is
6565
- // what a router predating the capability endpoint (delopay-backend#964)
6566
- // renders, and that copy only gained the "3" in delopay-backend#1051
6567
- // the same release that added the endpoint. Restating the new string here
7011
+ // what a router predating the capability endpoint renders, and that copy
7012
+ // only gained the "3" in the same release that added the endpoint.
7013
+ // Restating the new string here
6568
7014
  // would put copy no reachable router emits in front of a merchant, and
6569
7015
  // would change what the deprecated `nativePaneMethodInfo` has returned
6570
7016
  // since 0.106.0.
@@ -7436,6 +7882,19 @@ var AuditLogs = class {
7436
7882
  async retrieve(logId) {
7437
7883
  return this.request("GET", `/admin-portal/audit/${encodeURIComponent(logId)}`);
7438
7884
  }
7885
+ async export(params, options) {
7886
+ const format = options?.format ?? "json";
7887
+ const accept = format === "csv" ? "text/csv" : format === "pdf" ? "application/pdf" : "application/json";
7888
+ const request = {
7889
+ query: params,
7890
+ // The format is negotiated by `Accept`, never a query field: the query
7891
+ // here is the list's own filter model, and adding a key to it would fork
7892
+ // the filter vocabulary the export exists to reuse.
7893
+ headers: { Accept: accept }
7894
+ };
7895
+ if (format !== "json") request.responseType = "blob";
7896
+ return this.request("GET", "/admin-portal/audit/export", request);
7897
+ }
7439
7898
  };
7440
7899
 
7441
7900
  // src/internal/resources/cache.ts
@@ -7674,13 +8133,13 @@ var PlatformBilling = class {
7674
8133
  });
7675
8134
  }
7676
8135
  /**
7677
- * Mark a merchant free (not billed), or put it back on the prepaid model
7678
- * (delopay-backend#378). While free, no platform fee is deducted, the
7679
- * payment gate never blocks on billing status, top-ups are refused and
7680
- * auto-recharge is inert. Marking free needs a `reason` and is refused
7681
- * (412) while an admin suspension is in force — lift that first.
8136
+ * Mark a merchant free (not billed), or put it back on the prepaid model.
8137
+ * While free, no platform fee is deducted, the payment gate never blocks on
8138
+ * billing status, top-ups are refused and auto-recharge is inert. Marking
8139
+ * free needs a `reason` and is refused (412) while an admin suspension is in
8140
+ * force — lift that first.
7682
8141
  *
7683
- * Requires a router with delopay-backend#378; older routers answer `404`.
8142
+ * Requires a router that supports the free flag; older ones answer `404`.
7684
8143
  *
7685
8144
  * @param merchantId - The merchant account ID.
7686
8145
  * @param params - The desired free state and, when marking free, the reason.
@@ -7692,14 +8151,14 @@ var PlatformBilling = class {
7692
8151
  });
7693
8152
  }
7694
8153
  /**
7695
- * Delete a merchant's **entire** ledger (delopay-backend#378). Every live
7696
- * entry is soft-deleted — kept, so a replayed fee deduction or top-up
7697
- * webhook still no-ops — the balance is set to zero and the status
7698
- * re-derived (`active` for a free merchant; an active paying merchant
7699
- * lands in `delinquent`). Refused (412) while the merchant has shop
7700
- * allocations. Audited.
8154
+ * Delete a merchant's **entire** ledger. Every live entry is soft-deleted —
8155
+ * kept, so a replayed fee deduction or top-up webhook still no-ops — the
8156
+ * balance is set to zero and the status re-derived (`active` for a free
8157
+ * merchant; an active paying merchant lands in `delinquent`). Refused (412)
8158
+ * while the merchant has shop allocations. Audited.
7701
8159
  *
7702
- * Requires a router with delopay-backend#378; older routers answer `404`.
8160
+ * Requires a router that serves the ledger admin routes; older ones answer
8161
+ * `404`.
7703
8162
  *
7704
8163
  * @param merchantId - The merchant account ID.
7705
8164
  * @param params - The reason, required for audit.
@@ -7711,14 +8170,15 @@ var PlatformBilling = class {
7711
8170
  });
7712
8171
  }
7713
8172
  /**
7714
- * (Re)create a merchant's ledger, optionally seeded with an opening balance
7715
- * (delopay-backend#378). Ensures the billing profile exists (created
7716
- * without the welcome promo credit) and, when `opening_balance` is set,
7717
- * writes one `opening_balance` entry through the same atomic helper an
7718
- * admin credit uses. Refused (412) while live entries or a non-zero balance
7719
- * remain — reset first. Does not clear the free flag. Audited.
8173
+ * (Re)create a merchant's ledger, optionally seeded with an opening
8174
+ * balance. Ensures the billing profile exists (created without the welcome
8175
+ * promo credit) and, when `opening_balance` is set, writes one
8176
+ * `opening_balance` entry through the same atomic helper an admin credit
8177
+ * uses. Refused (412) while live entries or a non-zero balance remain —
8178
+ * reset first. Does not clear the free flag. Audited.
7720
8179
  *
7721
- * Requires a router with delopay-backend#378; older routers answer `404`.
8180
+ * Requires a router that serves the ledger admin routes; older ones answer
8181
+ * `404`.
7722
8182
  *
7723
8183
  * @param merchantId - The merchant account ID.
7724
8184
  * @param params - Opening balance (minor units), currency for a new profile, and the reason.
@@ -7841,6 +8301,7 @@ var DelopayInternal = class extends Delopay {
7841
8301
  CHECKBOX_CHECKED,
7842
8302
  CHECKBOX_UNCHECKED,
7843
8303
  CHECKOUT_EVENT_KINDS,
8304
+ CHECKOUT_LOCALES,
7844
8305
  CUSTOM_CSS_MAX_LENGTH,
7845
8306
  CUSTOM_FIELDS_MAX,
7846
8307
  CUSTOM_FIELD_CONDITIONS_MAX,
@@ -7868,6 +8329,7 @@ var DelopayInternal = class extends Delopay {
7868
8329
  Files,
7869
8330
  Forex,
7870
8331
  Gsm,
8332
+ LOCALIZABLE_COPY_FIELDS,
7871
8333
  NATIVE_PANES_MAX,
7872
8334
  NATIVE_PANE_CATEGORY_KEYS,
7873
8335
  NATIVE_PANE_ICON_KEYS,
@@ -7882,6 +8344,16 @@ var DelopayInternal = class extends Delopay {
7882
8344
  STRIPE_FALLBACK_PANE_CATALOG,
7883
8345
  STRIPE_FALLBACK_PANE_METHODS,
7884
8346
  STRIPE_NATIVE_PANE_METHODS,
8347
+ SURCHARGE_BORDER_STYLES,
8348
+ SURCHARGE_BORDER_WIDTHS,
8349
+ SURCHARGE_FIGURE_MODES,
8350
+ SURCHARGE_LABEL_MODES,
8351
+ SURCHARGE_POSITIONS,
8352
+ SURCHARGE_SHAPES,
8353
+ SURCHARGE_SIGNS,
8354
+ SURCHARGE_SIZES,
8355
+ SURCHARGE_STYLES,
8356
+ SURCHARGE_WEIGHTS,
7885
8357
  Search,
7886
8358
  Settlement,
7887
8359
  Subscriptions,
@@ -7893,11 +8365,13 @@ var DelopayInternal = class extends Delopay {
7893
8365
  applyBrandingVariables,
7894
8366
  buildBrandingExport,
7895
8367
  buttonPadValue,
8368
+ checkoutCopy,
7896
8369
  cloneBranding,
7897
8370
  cloneCustomField,
7898
8371
  cloneNativePane,
7899
8372
  clonePane,
7900
8373
  contrastRatio,
8374
+ copyTranslationsKey,
7901
8375
  customFieldContextFromMetadata,
7902
8376
  customFieldIsTextLike,
7903
8377
  customFieldOperatorTakesValue,
@@ -7942,9 +8416,14 @@ var DelopayInternal = class extends Delopay {
7942
8416
  parseImportedBranding,
7943
8417
  programToTree,
7944
8418
  radiusValue,
8419
+ readableInkOn,
7945
8420
  ruleMatchToTree,
7946
8421
  sanitizeCustomCss,
7947
8422
  shadowFor,
8423
+ surchargeFigurePlan,
8424
+ surchargeShowsLabel,
8425
+ surchargeStyleDrawsAShape,
8426
+ surchargeWordFor,
7948
8427
  surfacePadValue,
7949
8428
  validatePanes,
7950
8429
  verticalGapValue,