@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/index.cjs CHANGED
@@ -32,6 +32,7 @@ __export(index_exports, {
32
32
  CHECKBOX_CHECKED: () => CHECKBOX_CHECKED,
33
33
  CHECKBOX_UNCHECKED: () => CHECKBOX_UNCHECKED,
34
34
  CHECKOUT_EVENT_KINDS: () => CHECKOUT_EVENT_KINDS,
35
+ CHECKOUT_LOCALES: () => CHECKOUT_LOCALES,
35
36
  CUSTOM_CSS_MAX_LENGTH: () => CUSTOM_CSS_MAX_LENGTH,
36
37
  CUSTOM_FIELDS_MAX: () => CUSTOM_FIELDS_MAX,
37
38
  CUSTOM_FIELD_CONDITIONS_MAX: () => CUSTOM_FIELD_CONDITIONS_MAX,
@@ -52,6 +53,7 @@ __export(index_exports, {
52
53
  FeeProgramBuilder: () => FeeProgramBuilder,
53
54
  Files: () => Files,
54
55
  Forex: () => Forex,
56
+ LOCALIZABLE_COPY_FIELDS: () => LOCALIZABLE_COPY_FIELDS,
55
57
  NATIVE_PANES_MAX: () => NATIVE_PANES_MAX,
56
58
  NATIVE_PANE_CATEGORY_KEYS: () => NATIVE_PANE_CATEGORY_KEYS,
57
59
  NATIVE_PANE_ICON_KEYS: () => NATIVE_PANE_ICON_KEYS,
@@ -64,6 +66,16 @@ __export(index_exports, {
64
66
  STRIPE_FALLBACK_PANE_CATALOG: () => STRIPE_FALLBACK_PANE_CATALOG,
65
67
  STRIPE_FALLBACK_PANE_METHODS: () => STRIPE_FALLBACK_PANE_METHODS,
66
68
  STRIPE_NATIVE_PANE_METHODS: () => STRIPE_NATIVE_PANE_METHODS,
69
+ SURCHARGE_BORDER_STYLES: () => SURCHARGE_BORDER_STYLES,
70
+ SURCHARGE_BORDER_WIDTHS: () => SURCHARGE_BORDER_WIDTHS,
71
+ SURCHARGE_FIGURE_MODES: () => SURCHARGE_FIGURE_MODES,
72
+ SURCHARGE_LABEL_MODES: () => SURCHARGE_LABEL_MODES,
73
+ SURCHARGE_POSITIONS: () => SURCHARGE_POSITIONS,
74
+ SURCHARGE_SHAPES: () => SURCHARGE_SHAPES,
75
+ SURCHARGE_SIGNS: () => SURCHARGE_SIGNS,
76
+ SURCHARGE_SIZES: () => SURCHARGE_SIZES,
77
+ SURCHARGE_STYLES: () => SURCHARGE_STYLES,
78
+ SURCHARGE_WEIGHTS: () => SURCHARGE_WEIGHTS,
67
79
  Search: () => Search,
68
80
  Settlement: () => Settlement,
69
81
  Subscriptions: () => Subscriptions,
@@ -75,11 +87,13 @@ __export(index_exports, {
75
87
  applyBrandingVariables: () => applyBrandingVariables,
76
88
  buildBrandingExport: () => buildBrandingExport,
77
89
  buttonPadValue: () => buttonPadValue,
90
+ checkoutCopy: () => checkoutCopy,
78
91
  cloneBranding: () => cloneBranding,
79
92
  cloneCustomField: () => cloneCustomField,
80
93
  cloneNativePane: () => cloneNativePane,
81
94
  clonePane: () => clonePane,
82
95
  contrastRatio: () => contrastRatio,
96
+ copyTranslationsKey: () => copyTranslationsKey,
83
97
  customFieldContextFromMetadata: () => customFieldContextFromMetadata,
84
98
  customFieldIsTextLike: () => customFieldIsTextLike,
85
99
  customFieldOperatorTakesValue: () => customFieldOperatorTakesValue,
@@ -124,9 +138,14 @@ __export(index_exports, {
124
138
  parseImportedBranding: () => parseImportedBranding,
125
139
  programToTree: () => programToTree,
126
140
  radiusValue: () => radiusValue,
141
+ readableInkOn: () => readableInkOn,
127
142
  ruleMatchToTree: () => ruleMatchToTree,
128
143
  sanitizeCustomCss: () => sanitizeCustomCss,
129
144
  shadowFor: () => shadowFor,
145
+ surchargeFigurePlan: () => surchargeFigurePlan,
146
+ surchargeShowsLabel: () => surchargeShowsLabel,
147
+ surchargeStyleDrawsAShape: () => surchargeStyleDrawsAShape,
148
+ surchargeWordFor: () => surchargeWordFor,
130
149
  surfacePadValue: () => surfacePadValue,
131
150
  validatePanes: () => validatePanes,
132
151
  verticalGapValue: () => verticalGapValue,
@@ -668,9 +687,9 @@ var Connectors = class {
668
687
  /**
669
688
  * Update a connector account.
670
689
  *
671
- * `connector_webhook_details` **merges** into the stored block key by key
672
- * (be#992): an absent key keeps its stored secret, an explicit value is
673
- * written, and an explicit empty string clears that secret. Send only the
690
+ * `connector_webhook_details` **merges** into the stored block key by key:
691
+ * an absent key keeps its stored secret, an explicit value is written, and
692
+ * an explicit empty string clears that secret. Send only the
674
693
  * keys the operator typed — padding the other environment's keys with `''`
675
694
  * clears a live signing secret and inbound webhooks stop verifying.
676
695
  *
@@ -3845,11 +3864,79 @@ var Export = class {
3845
3864
  constructor(request) {
3846
3865
  this.request = request;
3847
3866
  }
3848
- /** Export transactions. `POST /export/transactions` */
3849
- async transactions(params) {
3850
- return this.request("POST", "/export/transactions", { body: params });
3867
+ async transactions(params, options) {
3868
+ return this.request(
3869
+ "POST",
3870
+ "/export/transactions",
3871
+ transactionBody(params, options)
3872
+ );
3873
+ }
3874
+ async transactionsForProfile(params, options) {
3875
+ return this.request(
3876
+ "POST",
3877
+ "/export/profile/transactions",
3878
+ transactionBody(params, options)
3879
+ );
3880
+ }
3881
+ async refunds(params, options) {
3882
+ return this.request("POST", "/refunds/list/export", bodied(params ?? {}, options));
3883
+ }
3884
+ async refundsForProfile(params, options) {
3885
+ return this.request(
3886
+ "POST",
3887
+ "/refunds/profile/list/export",
3888
+ bodied(params ?? {}, options)
3889
+ );
3890
+ }
3891
+ async disputes(params, options) {
3892
+ return this.request("GET", "/disputes/list/export", queried(params, options));
3893
+ }
3894
+ async disputesForProfile(params, options) {
3895
+ return this.request(
3896
+ "GET",
3897
+ "/disputes/profile/list/export",
3898
+ queried(params, options)
3899
+ );
3900
+ }
3901
+ async payouts(params, options) {
3902
+ return this.request("POST", "/payouts/list/export", bodied(params, options));
3903
+ }
3904
+ async payoutsForProfile(params, options) {
3905
+ return this.request("POST", "/payouts/profile/list/export", bodied(params, options));
3906
+ }
3907
+ async subscriptions(profileId, params, options) {
3908
+ return this.request(
3909
+ "GET",
3910
+ "/subscriptions/list/export",
3911
+ queried(params, options, { "X-Profile-Id": profileId })
3912
+ );
3913
+ }
3914
+ async auditLog(params, options) {
3915
+ return this.request("GET", "/audit/export", queried(params, options));
3851
3916
  }
3852
3917
  };
3918
+ var ACCEPT = {
3919
+ csv: "text/csv",
3920
+ json: "application/json",
3921
+ pdf: "application/pdf"
3922
+ };
3923
+ function negotiated(options, format) {
3924
+ const headers = { ...options.headers, Accept: ACCEPT[format] };
3925
+ return format === "json" ? { ...options, headers } : { ...options, headers, responseType: "blob" };
3926
+ }
3927
+ function transactionBody(params, options) {
3928
+ const format = options?.format ?? "json";
3929
+ return negotiated({ body: { ...params, format } }, format);
3930
+ }
3931
+ function bodied(body, options) {
3932
+ return negotiated({ body }, options?.format ?? "json");
3933
+ }
3934
+ function queried(params, options, headers) {
3935
+ return negotiated(
3936
+ { query: params ?? {}, ...headers ? { headers } : {} },
3937
+ options?.format ?? "json"
3938
+ );
3939
+ }
3853
3940
 
3854
3941
  // src/resources/featureMatrix.ts
3855
3942
  var FeatureMatrix = class {
@@ -4300,11 +4387,12 @@ var Settlement = class {
4300
4387
  /**
4301
4388
  * Record payout progress on a statement (`unpaid` / `partial` / `paid`).
4302
4389
  *
4303
- * Subject to the caller's `settlement_payout` operation limit, which can
4304
- * only be a per-operation ceiling: an over-limit call fails with `DE_01`
4305
- * and nothing is recorded. There is no approval route out of it — four-eyes
4306
- * needs an executor that can run the operation once somebody says yes, and
4307
- * only refunds have one, so a settlement rule can only block.
4390
+ * Subject to the caller's `settlement_payout` operation limit a
4391
+ * per-operation ceiling, a windowed total, a windowed count, or any
4392
+ * combination: an over-limit call fails with `DE_01` and nothing is
4393
+ * recorded. There is no approval route out of it four-eyes needs an
4394
+ * executor that can run the operation once somebody says yes, and only
4395
+ * refunds have one, so a settlement rule can only block.
4308
4396
  *
4309
4397
  * `POST /settlement/statements/{statementId}/payout`
4310
4398
  */
@@ -5170,6 +5258,121 @@ function feeProgram() {
5170
5258
  }
5171
5259
 
5172
5260
  // src/branding.ts
5261
+ function surchargeShowsLabel(labelMode, style, position) {
5262
+ if (labelMode !== "labelled") return false;
5263
+ return !(style === "ribbon" && (position === "cornerStart" || position === "cornerEnd"));
5264
+ }
5265
+ function surchargeFigurePlan(branding, isDiscount, percentAvailable) {
5266
+ const mode = isDiscount ? branding.discountFigure : branding.surchargeFigure;
5267
+ const label = surchargeShowsLabel(
5268
+ branding.surchargeLabel,
5269
+ branding.surchargeStyle,
5270
+ branding.surchargePosition
5271
+ );
5272
+ if (!percentAvailable) return { first: "amount", second: null, label };
5273
+ const ordered = {
5274
+ amount: ["amount", null],
5275
+ percent: ["percent", null],
5276
+ amountThenPercent: ["amount", "percent"],
5277
+ percentThenAmount: ["percent", "amount"]
5278
+ };
5279
+ const [first, second] = ordered[mode];
5280
+ const cornerRibbon = branding.surchargeStyle === "ribbon" && (branding.surchargePosition === "cornerStart" || branding.surchargePosition === "cornerEnd");
5281
+ return { first, second: cornerRibbon ? null : second, label };
5282
+ }
5283
+ function readableInkOn(color) {
5284
+ const onBlack = contrastRatio(color, "#000000");
5285
+ const onWhite = contrastRatio(color, "#ffffff");
5286
+ if (onBlack === null || onWhite === null) return "#ffffff";
5287
+ return onBlack >= onWhite ? "#000000" : "#ffffff";
5288
+ }
5289
+ var SURCHARGE_FONT_SIZE = {
5290
+ sm: "0.6875rem",
5291
+ md: "0.8125rem",
5292
+ lg: "0.9375rem"
5293
+ };
5294
+ var SURCHARGE_PAD = {
5295
+ sm: "1px 6px",
5296
+ md: "2px 8px",
5297
+ lg: "3px 10px"
5298
+ };
5299
+ var SURCHARGE_RADIUS = {
5300
+ pill: "999px",
5301
+ rounded: "6px",
5302
+ square: "0px"
5303
+ };
5304
+ var SURCHARGE_BORDER_WIDTH = {
5305
+ none: "0px",
5306
+ thin: "1px",
5307
+ medium: "2px",
5308
+ thick: "3px"
5309
+ };
5310
+ var SURCHARGE_FONT_WEIGHT = {
5311
+ regular: "400",
5312
+ medium: "600",
5313
+ bold: "700"
5314
+ };
5315
+ var SURCHARGE_POSITIONS = [
5316
+ "trailing",
5317
+ "inline",
5318
+ "below",
5319
+ "above",
5320
+ "cornerStart",
5321
+ "cornerEnd"
5322
+ ];
5323
+ var SURCHARGE_STYLES = [
5324
+ "plain",
5325
+ "underline",
5326
+ "outline",
5327
+ "badge",
5328
+ "solid",
5329
+ "ribbon"
5330
+ ];
5331
+ var SURCHARGE_BORDER_WIDTHS = [
5332
+ "none",
5333
+ "thin",
5334
+ "medium",
5335
+ "thick"
5336
+ ];
5337
+ var SURCHARGE_BORDER_STYLES = [
5338
+ "solid",
5339
+ "dashed",
5340
+ "dotted"
5341
+ ];
5342
+ var SURCHARGE_SIZES = ["sm", "md", "lg"];
5343
+ function surchargeStyleDrawsAShape(style) {
5344
+ return style === "badge" || style === "outline" || style === "solid";
5345
+ }
5346
+ var SURCHARGE_SHAPES = ["pill", "rounded", "square"];
5347
+ var SURCHARGE_WEIGHTS = ["regular", "medium", "bold"];
5348
+ var SURCHARGE_SIGNS = ["always", "minusOnly", "none"];
5349
+ var SURCHARGE_LABEL_MODES = ["amount", "labelled"];
5350
+ var SURCHARGE_FIGURE_MODES = [
5351
+ "amount",
5352
+ "percent",
5353
+ "amountThenPercent",
5354
+ "percentThenAmount"
5355
+ ];
5356
+ var CHECKOUT_LOCALES = ["en", "de"];
5357
+ var LOCALIZABLE_COPY_FIELDS = [
5358
+ "headerText",
5359
+ "payButtonLabel",
5360
+ "cardTermsMessage",
5361
+ "footerText"
5362
+ ];
5363
+ function copyTranslationsKey(field) {
5364
+ return `${field}Translations`;
5365
+ }
5366
+ function checkoutCopy(branding, field, locale) {
5367
+ const translated = translationFor(branding[copyTranslationsKey(field)], locale);
5368
+ return translated ?? branding[field];
5369
+ }
5370
+ function surchargeWordFor(branding, isDiscount, locale) {
5371
+ return translationFor(
5372
+ isDiscount ? branding.discountWordTranslations : branding.surchargeWordTranslations,
5373
+ locale
5374
+ );
5375
+ }
5173
5376
  var FONT_STACKS = {
5174
5377
  inter: "'Inter Variable', 'Inter', system-ui, -apple-system, sans-serif",
5175
5378
  system: "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif",
@@ -5360,6 +5563,44 @@ var DEFAULT_BRANDING_BASE = {
5360
5563
  verticalGap: "comfortable",
5361
5564
  inputSize: "md",
5362
5565
  buttonSize: "md",
5566
+ // Disclosure on by default: with provider-scoped pricing the tile is where
5567
+ // the buyer chooses between prices, and a price they cannot see is one they
5568
+ // find out about on the statement.
5569
+ showSurcharge: true,
5570
+ surchargePosition: "trailing",
5571
+ surchargeStyle: "badge",
5572
+ surchargeSize: "sm",
5573
+ surchargeShape: "pill",
5574
+ surchargeBorderWidth: "thin",
5575
+ surchargeBorderStyle: "solid",
5576
+ surchargeWeight: "medium",
5577
+ surchargeSign: "always",
5578
+ surchargeUppercase: false,
5579
+ // Named, not bare. A tile that reads "-EUR 2.50" beside a brand name is a
5580
+ // number with no subject — buyers read it as the price, not as a change to
5581
+ // it. "Discount -EUR 2.50" needs no interpreting, and the word is what makes
5582
+ // the default configuration legible without the merchant touching anything.
5583
+ surchargeLabel: "labelled",
5584
+ // The two directions default differently on purpose, which is the whole
5585
+ // reason they are two settings. A fee is something a buyer acts on in money,
5586
+ // so it leads with money and says nothing else. A saving is something worth
5587
+ // advertising, and the share is the persuasive half of it — "-5.1% (EUR
5588
+ // 2.50)" sells what "-EUR 2.50" merely states, and the amount is still right
5589
+ // there beside it.
5590
+ surchargeFigure: "amount",
5591
+ discountFigure: "percentThenAmount",
5592
+ // Empty: the checkout's own localized words are the default, in every
5593
+ // language it ships. A merchant fills these in only to say it differently.
5594
+ surchargeWordTranslations: {},
5595
+ discountWordTranslations: {},
5596
+ // amber-700 / emerald-700, not the 600s: the `plain` style renders the
5597
+ // disclosure as coloured TEXT, so it is bound by `WCAG_AA_TEXT` (4.5) rather
5598
+ // than by the 3:1 a coloured shape would be, and the 600s come to 3.19 and
5599
+ // 3.77 against the default white surface. These are 5.02 and 5.48, pinned by
5600
+ // tests. Far enough apart to read as opposite news at a glance rather than as
5601
+ // two shades of "extra".
5602
+ surchargeColor: "#b45309",
5603
+ discountColor: "#047857",
5363
5604
  layout: "split",
5364
5605
  summaryPosition: "left",
5365
5606
  showOrderSummary: true,
@@ -5368,10 +5609,17 @@ var DEFAULT_BRANDING_BASE = {
5368
5609
  totalLabel: "Total",
5369
5610
  showCurrencyCode: false,
5370
5611
  showOrderItems: true,
5612
+ // Each flat field keeps its meaning: what the merchant wrote, used in every
5613
+ // locale that carries no override. Empty maps therefore change nothing for a
5614
+ // profile saved before translations existed.
5371
5615
  headerText: "",
5616
+ headerTextTranslations: {},
5372
5617
  payButtonLabel: "",
5618
+ payButtonLabelTranslations: {},
5373
5619
  cardTermsMessage: "",
5620
+ cardTermsMessageTranslations: {},
5374
5621
  footerText: "",
5622
+ footerTextTranslations: {},
5375
5623
  supportEmail: "",
5376
5624
  paymentLayout: "tabs",
5377
5625
  labelStyle: "above",
@@ -5397,6 +5645,11 @@ var DEFAULT_BRANDING_DARK = {
5397
5645
  buttonBackground: "#1E4FEB",
5398
5646
  buttonText: "#ffffff",
5399
5647
  surfaceStyle: "flat",
5648
+ // amber-400 / emerald-400: the 700s above are far too dark to read on
5649
+ // slate-900, and this pair is the same news in the same order at the light
5650
+ // end of the ramp — 10.69 and 9.29 against the dark surface, also pinned.
5651
+ surchargeColor: "#fbbf24",
5652
+ discountColor: "#34d399",
5400
5653
  trustBadges: DEFAULT_BADGES_DARK.map((b) => ({ ...b })),
5401
5654
  customFields: []
5402
5655
  };
@@ -5407,7 +5660,16 @@ function cloneBranding(b) {
5407
5660
  return {
5408
5661
  ...b,
5409
5662
  trustBadges: b.trustBadges.map((badge) => ({ ...badge })),
5410
- customFields: b.customFields.map(cloneCustomField)
5663
+ customFields: b.customFields.map(cloneCustomField),
5664
+ // Copied, not shared. A spread alone would leave the clone pointing at the
5665
+ // original's maps, and the dashboard edits a clone precisely so the form
5666
+ // can be abandoned without touching what is saved.
5667
+ surchargeWordTranslations: { ...b.surchargeWordTranslations },
5668
+ discountWordTranslations: { ...b.discountWordTranslations },
5669
+ headerTextTranslations: { ...b.headerTextTranslations },
5670
+ payButtonLabelTranslations: { ...b.payButtonLabelTranslations },
5671
+ cardTermsMessageTranslations: { ...b.cardTermsMessageTranslations },
5672
+ footerTextTranslations: { ...b.footerTextTranslations }
5411
5673
  };
5412
5674
  }
5413
5675
  function cloneCustomField(f) {
@@ -5558,13 +5820,25 @@ function defaultCustomFieldVisibility() {
5558
5820
  return { mode: "always", match: "all", conditions: [] };
5559
5821
  }
5560
5822
  function parseTranslations(raw) {
5561
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
5823
+ let value = raw;
5824
+ if (typeof value === "string") {
5825
+ try {
5826
+ value = JSON.parse(value);
5827
+ } catch {
5828
+ return {};
5829
+ }
5830
+ }
5831
+ if (!value || typeof value !== "object" || Array.isArray(value)) return {};
5562
5832
  const out = {};
5563
- for (const [k, v] of Object.entries(raw)) {
5564
- if (typeof v === "string" && v.length > 0) out[k] = v;
5833
+ for (const [k, v] of Object.entries(value)) {
5834
+ if (typeof v === "string" && v.trim().length > 0) out[k] = v;
5565
5835
  }
5566
5836
  return out;
5567
5837
  }
5838
+ function encodeTranslations(map) {
5839
+ const entries = Object.entries(map).filter(([, v]) => v.trim().length > 0);
5840
+ return entries.length > 0 ? JSON.stringify(Object.fromEntries(entries)) : void 0;
5841
+ }
5568
5842
  function normalizeCondition(raw, index) {
5569
5843
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
5570
5844
  const c = raw;
@@ -5916,6 +6190,74 @@ function decodeBranding(source) {
5916
6190
  ["sm", "md", "lg"],
5917
6191
  DEFAULT_BRANDING.buttonSize
5918
6192
  ),
6193
+ showSurcharge: parseBool(extras["showSurcharge"], DEFAULT_BRANDING.showSurcharge),
6194
+ surchargePosition: pickEnum(
6195
+ extras["surchargePosition"],
6196
+ SURCHARGE_POSITIONS,
6197
+ DEFAULT_BRANDING.surchargePosition
6198
+ ),
6199
+ surchargeStyle: pickEnum(
6200
+ extras["surchargeStyle"],
6201
+ SURCHARGE_STYLES,
6202
+ DEFAULT_BRANDING.surchargeStyle
6203
+ ),
6204
+ surchargeSize: pickEnum(
6205
+ extras["surchargeSize"],
6206
+ SURCHARGE_SIZES,
6207
+ DEFAULT_BRANDING.surchargeSize
6208
+ ),
6209
+ surchargeShape: pickEnum(
6210
+ extras["surchargeShape"],
6211
+ SURCHARGE_SHAPES,
6212
+ DEFAULT_BRANDING.surchargeShape
6213
+ ),
6214
+ surchargeBorderWidth: pickEnum(
6215
+ extras["surchargeBorderWidth"],
6216
+ SURCHARGE_BORDER_WIDTHS,
6217
+ DEFAULT_BRANDING.surchargeBorderWidth
6218
+ ),
6219
+ surchargeBorderStyle: pickEnum(
6220
+ extras["surchargeBorderStyle"],
6221
+ SURCHARGE_BORDER_STYLES,
6222
+ DEFAULT_BRANDING.surchargeBorderStyle
6223
+ ),
6224
+ surchargeWeight: pickEnum(
6225
+ extras["surchargeWeight"],
6226
+ SURCHARGE_WEIGHTS,
6227
+ DEFAULT_BRANDING.surchargeWeight
6228
+ ),
6229
+ surchargeSign: pickEnum(
6230
+ extras["surchargeSign"],
6231
+ SURCHARGE_SIGNS,
6232
+ DEFAULT_BRANDING.surchargeSign
6233
+ ),
6234
+ surchargeUppercase: parseBool(
6235
+ extras["surchargeUppercase"],
6236
+ DEFAULT_BRANDING.surchargeUppercase
6237
+ ),
6238
+ surchargeLabel: pickEnum(
6239
+ extras["surchargeLabel"],
6240
+ SURCHARGE_LABEL_MODES,
6241
+ DEFAULT_BRANDING.surchargeLabel
6242
+ ),
6243
+ surchargeFigure: pickEnum(
6244
+ extras["surchargeFigure"],
6245
+ SURCHARGE_FIGURE_MODES,
6246
+ DEFAULT_BRANDING.surchargeFigure
6247
+ ),
6248
+ discountFigure: pickEnum(
6249
+ extras["discountFigure"],
6250
+ SURCHARGE_FIGURE_MODES,
6251
+ DEFAULT_BRANDING.discountFigure
6252
+ ),
6253
+ surchargeWordTranslations: parseTranslations(extras["surchargeWordTranslations"]),
6254
+ discountWordTranslations: parseTranslations(extras["discountWordTranslations"]),
6255
+ headerTextTranslations: parseTranslations(extras["headerTextTranslations"]),
6256
+ payButtonLabelTranslations: parseTranslations(extras["payButtonLabelTranslations"]),
6257
+ cardTermsMessageTranslations: parseTranslations(extras["cardTermsMessageTranslations"]),
6258
+ footerTextTranslations: parseTranslations(extras["footerTextTranslations"]),
6259
+ surchargeColor: s(extras["surchargeColor"]) || DEFAULT_BRANDING.surchargeColor,
6260
+ discountColor: s(extras["discountColor"]) || DEFAULT_BRANDING.discountColor,
5919
6261
  layout: pickEnum(extras["layout"], ["compact", "split"], DEFAULT_BRANDING.layout),
5920
6262
  summaryPosition: pickEnum(
5921
6263
  extras["summaryPosition"],
@@ -5969,6 +6311,21 @@ function encodeBranding(branding, base) {
5969
6311
  verticalGap: branding.verticalGap,
5970
6312
  inputSize: branding.inputSize,
5971
6313
  buttonSize: branding.buttonSize,
6314
+ showSurcharge: String(branding.showSurcharge),
6315
+ surchargePosition: branding.surchargePosition,
6316
+ surchargeStyle: branding.surchargeStyle,
6317
+ surchargeSize: branding.surchargeSize,
6318
+ surchargeShape: branding.surchargeShape,
6319
+ surchargeBorderWidth: branding.surchargeBorderWidth,
6320
+ surchargeBorderStyle: branding.surchargeBorderStyle,
6321
+ surchargeWeight: branding.surchargeWeight,
6322
+ surchargeSign: branding.surchargeSign,
6323
+ surchargeUppercase: String(branding.surchargeUppercase),
6324
+ surchargeLabel: branding.surchargeLabel,
6325
+ surchargeFigure: branding.surchargeFigure,
6326
+ discountFigure: branding.discountFigure,
6327
+ surchargeColor: branding.surchargeColor,
6328
+ discountColor: branding.discountColor,
5972
6329
  layout: branding.layout,
5973
6330
  summaryPosition: branding.summaryPosition,
5974
6331
  showOrderSummary: String(branding.showOrderSummary),
@@ -5986,6 +6343,17 @@ function encodeBranding(branding, base) {
5986
6343
  if (branding.customFields.length > 0) {
5987
6344
  extras["customFields"] = encodeCustomFields(branding.customFields);
5988
6345
  }
6346
+ for (const key of [
6347
+ "surchargeWordTranslations",
6348
+ "discountWordTranslations",
6349
+ "headerTextTranslations",
6350
+ "payButtonLabelTranslations",
6351
+ "cardTermsMessageTranslations",
6352
+ "footerTextTranslations"
6353
+ ]) {
6354
+ const encoded = encodeTranslations(branding[key]);
6355
+ if (encoded) extras[key] = encoded;
6356
+ }
5989
6357
  const tagline = trim(branding.tagline);
5990
6358
  if (tagline) extras["tagline"] = tagline;
5991
6359
  const footer = trim(branding.footerText);
@@ -6094,6 +6462,71 @@ function parseImportedBranding(raw) {
6094
6462
  ),
6095
6463
  inputSize: pickEnum(root["inputSize"], ["sm", "md", "lg"], dflt.inputSize),
6096
6464
  buttonSize: pickEnum(root["buttonSize"], ["sm", "md", "lg"], dflt.buttonSize),
6465
+ showSurcharge: parseBool(root["showSurcharge"], dflt.showSurcharge),
6466
+ surchargePosition: pickEnum(
6467
+ root["surchargePosition"],
6468
+ SURCHARGE_POSITIONS,
6469
+ dflt.surchargePosition
6470
+ ),
6471
+ surchargeStyle: pickEnum(
6472
+ root["surchargeStyle"],
6473
+ SURCHARGE_STYLES,
6474
+ dflt.surchargeStyle
6475
+ ),
6476
+ surchargeSize: pickEnum(
6477
+ root["surchargeSize"],
6478
+ SURCHARGE_SIZES,
6479
+ dflt.surchargeSize
6480
+ ),
6481
+ surchargeShape: pickEnum(
6482
+ root["surchargeShape"],
6483
+ SURCHARGE_SHAPES,
6484
+ dflt.surchargeShape
6485
+ ),
6486
+ surchargeBorderWidth: pickEnum(
6487
+ root["surchargeBorderWidth"],
6488
+ SURCHARGE_BORDER_WIDTHS,
6489
+ dflt.surchargeBorderWidth
6490
+ ),
6491
+ surchargeBorderStyle: pickEnum(
6492
+ root["surchargeBorderStyle"],
6493
+ SURCHARGE_BORDER_STYLES,
6494
+ dflt.surchargeBorderStyle
6495
+ ),
6496
+ surchargeWeight: pickEnum(
6497
+ root["surchargeWeight"],
6498
+ SURCHARGE_WEIGHTS,
6499
+ dflt.surchargeWeight
6500
+ ),
6501
+ surchargeSign: pickEnum(
6502
+ root["surchargeSign"],
6503
+ SURCHARGE_SIGNS,
6504
+ dflt.surchargeSign
6505
+ ),
6506
+ surchargeUppercase: parseBool(root["surchargeUppercase"], dflt.surchargeUppercase),
6507
+ surchargeLabel: pickEnum(
6508
+ root["surchargeLabel"],
6509
+ SURCHARGE_LABEL_MODES,
6510
+ dflt.surchargeLabel
6511
+ ),
6512
+ surchargeFigure: pickEnum(
6513
+ root["surchargeFigure"],
6514
+ SURCHARGE_FIGURE_MODES,
6515
+ dflt.surchargeFigure
6516
+ ),
6517
+ discountFigure: pickEnum(
6518
+ root["discountFigure"],
6519
+ SURCHARGE_FIGURE_MODES,
6520
+ dflt.discountFigure
6521
+ ),
6522
+ surchargeWordTranslations: parseTranslations(root["surchargeWordTranslations"]),
6523
+ discountWordTranslations: parseTranslations(root["discountWordTranslations"]),
6524
+ headerTextTranslations: parseTranslations(root["headerTextTranslations"]),
6525
+ payButtonLabelTranslations: parseTranslations(root["payButtonLabelTranslations"]),
6526
+ cardTermsMessageTranslations: parseTranslations(root["cardTermsMessageTranslations"]),
6527
+ footerTextTranslations: parseTranslations(root["footerTextTranslations"]),
6528
+ surchargeColor: sHex(root["surchargeColor"], dflt.surchargeColor),
6529
+ discountColor: sHex(root["discountColor"], dflt.discountColor),
6097
6530
  layout: pickEnum(root["layout"], ["compact", "split"], dflt.layout),
6098
6531
  summaryPosition: pickEnum(
6099
6532
  root["summaryPosition"],
@@ -6160,6 +6593,19 @@ function applyBrandingVariables(el, b) {
6160
6593
  set("--dp-gap-vertical", VERTICAL_GAP[b.verticalGap]);
6161
6594
  set("--dp-input-pad", INPUT_PAD[b.inputSize]);
6162
6595
  set("--dp-button-pad", BUTTON_PAD[b.buttonSize]);
6596
+ set("--dp-surcharge", b.surchargeColor);
6597
+ set("--dp-discount", b.discountColor);
6598
+ set("--dp-surcharge-ink", readableInkOn(b.surchargeColor));
6599
+ set("--dp-discount-ink", readableInkOn(b.discountColor));
6600
+ set("--dp-surcharge-size", SURCHARGE_FONT_SIZE[b.surchargeSize]);
6601
+ set("--dp-surcharge-pad", SURCHARGE_PAD[b.surchargeSize]);
6602
+ set("--dp-surcharge-radius", SURCHARGE_RADIUS[b.surchargeShape]);
6603
+ set("--dp-surcharge-weight", SURCHARGE_FONT_WEIGHT[b.surchargeWeight]);
6604
+ set(
6605
+ "--dp-surcharge-border-width",
6606
+ SURCHARGE_BORDER_WIDTH[b.surchargeStyle === "outline" && b.surchargeBorderWidth === "none" ? "thin" : b.surchargeBorderWidth]
6607
+ );
6608
+ set("--dp-surcharge-border-style", b.surchargeBorderStyle);
6163
6609
  set("--dp-shadow", shadowFor(b.surfaceStyle));
6164
6610
  set(
6165
6611
  "--dp-surface-border",
@@ -6550,9 +6996,9 @@ var STRIPE_FALLBACK_PANE_METHODS = [
6550
6996
  requiresBillingCountry: true,
6551
6997
  defaultLabel: "Klarna",
6552
6998
  // NOT the router's current "Pay later or in 3 instalments". This table is
6553
- // what a router predating the capability endpoint (delopay-backend#964)
6554
- // renders, and that copy only gained the "3" in delopay-backend#1051
6555
- // the same release that added the endpoint. Restating the new string here
6999
+ // what a router predating the capability endpoint renders, and that copy
7000
+ // only gained the "3" in the same release that added the endpoint.
7001
+ // Restating the new string here
6556
7002
  // would put copy no reachable router emits in front of a merchant, and
6557
7003
  // would change what the deprecated `nativePaneMethodInfo` has returned
6558
7004
  // since 0.106.0.
@@ -6888,6 +7334,7 @@ var encodeNativePanes = encodePanes;
6888
7334
  CHECKBOX_CHECKED,
6889
7335
  CHECKBOX_UNCHECKED,
6890
7336
  CHECKOUT_EVENT_KINDS,
7337
+ CHECKOUT_LOCALES,
6891
7338
  CUSTOM_CSS_MAX_LENGTH,
6892
7339
  CUSTOM_FIELDS_MAX,
6893
7340
  CUSTOM_FIELD_CONDITIONS_MAX,
@@ -6908,6 +7355,7 @@ var encodeNativePanes = encodePanes;
6908
7355
  FeeProgramBuilder,
6909
7356
  Files,
6910
7357
  Forex,
7358
+ LOCALIZABLE_COPY_FIELDS,
6911
7359
  NATIVE_PANES_MAX,
6912
7360
  NATIVE_PANE_CATEGORY_KEYS,
6913
7361
  NATIVE_PANE_ICON_KEYS,
@@ -6920,6 +7368,16 @@ var encodeNativePanes = encodePanes;
6920
7368
  STRIPE_FALLBACK_PANE_CATALOG,
6921
7369
  STRIPE_FALLBACK_PANE_METHODS,
6922
7370
  STRIPE_NATIVE_PANE_METHODS,
7371
+ SURCHARGE_BORDER_STYLES,
7372
+ SURCHARGE_BORDER_WIDTHS,
7373
+ SURCHARGE_FIGURE_MODES,
7374
+ SURCHARGE_LABEL_MODES,
7375
+ SURCHARGE_POSITIONS,
7376
+ SURCHARGE_SHAPES,
7377
+ SURCHARGE_SIGNS,
7378
+ SURCHARGE_SIZES,
7379
+ SURCHARGE_STYLES,
7380
+ SURCHARGE_WEIGHTS,
6923
7381
  Search,
6924
7382
  Settlement,
6925
7383
  Subscriptions,
@@ -6931,11 +7389,13 @@ var encodeNativePanes = encodePanes;
6931
7389
  applyBrandingVariables,
6932
7390
  buildBrandingExport,
6933
7391
  buttonPadValue,
7392
+ checkoutCopy,
6934
7393
  cloneBranding,
6935
7394
  cloneCustomField,
6936
7395
  cloneNativePane,
6937
7396
  clonePane,
6938
7397
  contrastRatio,
7398
+ copyTranslationsKey,
6939
7399
  customFieldContextFromMetadata,
6940
7400
  customFieldIsTextLike,
6941
7401
  customFieldOperatorTakesValue,
@@ -6980,9 +7440,14 @@ var encodeNativePanes = encodePanes;
6980
7440
  parseImportedBranding,
6981
7441
  programToTree,
6982
7442
  radiusValue,
7443
+ readableInkOn,
6983
7444
  ruleMatchToTree,
6984
7445
  sanitizeCustomCss,
6985
7446
  shadowFor,
7447
+ surchargeFigurePlan,
7448
+ surchargeShowsLabel,
7449
+ surchargeStyleDrawsAShape,
7450
+ surchargeWordFor,
6986
7451
  surfacePadValue,
6987
7452
  validatePanes,
6988
7453
  verticalGapValue,