@delopay/sdk 0.115.0 → 0.117.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
  *
@@ -4300,11 +4319,12 @@ var Settlement = class {
4300
4319
  /**
4301
4320
  * Record payout progress on a statement (`unpaid` / `partial` / `paid`).
4302
4321
  *
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.
4322
+ * Subject to the caller's `settlement_payout` operation limit a
4323
+ * per-operation ceiling, a windowed total, a windowed count, or any
4324
+ * combination: an over-limit call fails with `DE_01` and nothing is
4325
+ * recorded. There is no approval route out of it four-eyes needs an
4326
+ * executor that can run the operation once somebody says yes, and only
4327
+ * refunds have one, so a settlement rule can only block.
4308
4328
  *
4309
4329
  * `POST /settlement/statements/{statementId}/payout`
4310
4330
  */
@@ -5170,6 +5190,121 @@ function feeProgram() {
5170
5190
  }
5171
5191
 
5172
5192
  // src/branding.ts
5193
+ function surchargeShowsLabel(labelMode, style, position) {
5194
+ if (labelMode !== "labelled") return false;
5195
+ return !(style === "ribbon" && (position === "cornerStart" || position === "cornerEnd"));
5196
+ }
5197
+ function surchargeFigurePlan(branding, isDiscount, percentAvailable) {
5198
+ const mode = isDiscount ? branding.discountFigure : branding.surchargeFigure;
5199
+ const label = surchargeShowsLabel(
5200
+ branding.surchargeLabel,
5201
+ branding.surchargeStyle,
5202
+ branding.surchargePosition
5203
+ );
5204
+ if (!percentAvailable) return { first: "amount", second: null, label };
5205
+ const ordered = {
5206
+ amount: ["amount", null],
5207
+ percent: ["percent", null],
5208
+ amountThenPercent: ["amount", "percent"],
5209
+ percentThenAmount: ["percent", "amount"]
5210
+ };
5211
+ const [first, second] = ordered[mode];
5212
+ const cornerRibbon = branding.surchargeStyle === "ribbon" && (branding.surchargePosition === "cornerStart" || branding.surchargePosition === "cornerEnd");
5213
+ return { first, second: cornerRibbon ? null : second, label };
5214
+ }
5215
+ function readableInkOn(color) {
5216
+ const onBlack = contrastRatio(color, "#000000");
5217
+ const onWhite = contrastRatio(color, "#ffffff");
5218
+ if (onBlack === null || onWhite === null) return "#ffffff";
5219
+ return onBlack >= onWhite ? "#000000" : "#ffffff";
5220
+ }
5221
+ var SURCHARGE_FONT_SIZE = {
5222
+ sm: "0.6875rem",
5223
+ md: "0.8125rem",
5224
+ lg: "0.9375rem"
5225
+ };
5226
+ var SURCHARGE_PAD = {
5227
+ sm: "1px 6px",
5228
+ md: "2px 8px",
5229
+ lg: "3px 10px"
5230
+ };
5231
+ var SURCHARGE_RADIUS = {
5232
+ pill: "999px",
5233
+ rounded: "6px",
5234
+ square: "0px"
5235
+ };
5236
+ var SURCHARGE_BORDER_WIDTH = {
5237
+ none: "0px",
5238
+ thin: "1px",
5239
+ medium: "2px",
5240
+ thick: "3px"
5241
+ };
5242
+ var SURCHARGE_FONT_WEIGHT = {
5243
+ regular: "400",
5244
+ medium: "600",
5245
+ bold: "700"
5246
+ };
5247
+ var SURCHARGE_POSITIONS = [
5248
+ "trailing",
5249
+ "inline",
5250
+ "below",
5251
+ "above",
5252
+ "cornerStart",
5253
+ "cornerEnd"
5254
+ ];
5255
+ var SURCHARGE_STYLES = [
5256
+ "plain",
5257
+ "underline",
5258
+ "outline",
5259
+ "badge",
5260
+ "solid",
5261
+ "ribbon"
5262
+ ];
5263
+ var SURCHARGE_BORDER_WIDTHS = [
5264
+ "none",
5265
+ "thin",
5266
+ "medium",
5267
+ "thick"
5268
+ ];
5269
+ var SURCHARGE_BORDER_STYLES = [
5270
+ "solid",
5271
+ "dashed",
5272
+ "dotted"
5273
+ ];
5274
+ var SURCHARGE_SIZES = ["sm", "md", "lg"];
5275
+ function surchargeStyleDrawsAShape(style) {
5276
+ return style === "badge" || style === "outline" || style === "solid";
5277
+ }
5278
+ var SURCHARGE_SHAPES = ["pill", "rounded", "square"];
5279
+ var SURCHARGE_WEIGHTS = ["regular", "medium", "bold"];
5280
+ var SURCHARGE_SIGNS = ["always", "minusOnly", "none"];
5281
+ var SURCHARGE_LABEL_MODES = ["amount", "labelled"];
5282
+ var SURCHARGE_FIGURE_MODES = [
5283
+ "amount",
5284
+ "percent",
5285
+ "amountThenPercent",
5286
+ "percentThenAmount"
5287
+ ];
5288
+ var CHECKOUT_LOCALES = ["en", "de"];
5289
+ var LOCALIZABLE_COPY_FIELDS = [
5290
+ "headerText",
5291
+ "payButtonLabel",
5292
+ "cardTermsMessage",
5293
+ "footerText"
5294
+ ];
5295
+ function copyTranslationsKey(field) {
5296
+ return `${field}Translations`;
5297
+ }
5298
+ function checkoutCopy(branding, field, locale) {
5299
+ const translated = translationFor(branding[copyTranslationsKey(field)], locale);
5300
+ return translated ?? branding[field];
5301
+ }
5302
+ function surchargeWordFor(branding, isDiscount, locale) {
5303
+ return translationFor(
5304
+ isDiscount ? branding.discountWordTranslations : branding.surchargeWordTranslations,
5305
+ locale
5306
+ );
5307
+ }
5173
5308
  var FONT_STACKS = {
5174
5309
  inter: "'Inter Variable', 'Inter', system-ui, -apple-system, sans-serif",
5175
5310
  system: "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif",
@@ -5360,6 +5495,44 @@ var DEFAULT_BRANDING_BASE = {
5360
5495
  verticalGap: "comfortable",
5361
5496
  inputSize: "md",
5362
5497
  buttonSize: "md",
5498
+ // Disclosure on by default: with provider-scoped pricing the tile is where
5499
+ // the buyer chooses between prices, and a price they cannot see is one they
5500
+ // find out about on the statement.
5501
+ showSurcharge: true,
5502
+ surchargePosition: "trailing",
5503
+ surchargeStyle: "badge",
5504
+ surchargeSize: "sm",
5505
+ surchargeShape: "pill",
5506
+ surchargeBorderWidth: "thin",
5507
+ surchargeBorderStyle: "solid",
5508
+ surchargeWeight: "medium",
5509
+ surchargeSign: "always",
5510
+ surchargeUppercase: false,
5511
+ // Named, not bare. A tile that reads "-EUR 2.50" beside a brand name is a
5512
+ // number with no subject — buyers read it as the price, not as a change to
5513
+ // it. "Discount -EUR 2.50" needs no interpreting, and the word is what makes
5514
+ // the default configuration legible without the merchant touching anything.
5515
+ surchargeLabel: "labelled",
5516
+ // The two directions default differently on purpose, which is the whole
5517
+ // reason they are two settings. A fee is something a buyer acts on in money,
5518
+ // so it leads with money and says nothing else. A saving is something worth
5519
+ // advertising, and the share is the persuasive half of it — "-5.1% (EUR
5520
+ // 2.50)" sells what "-EUR 2.50" merely states, and the amount is still right
5521
+ // there beside it.
5522
+ surchargeFigure: "amount",
5523
+ discountFigure: "percentThenAmount",
5524
+ // Empty: the checkout's own localized words are the default, in every
5525
+ // language it ships. A merchant fills these in only to say it differently.
5526
+ surchargeWordTranslations: {},
5527
+ discountWordTranslations: {},
5528
+ // amber-700 / emerald-700, not the 600s: the `plain` style renders the
5529
+ // disclosure as coloured TEXT, so it is bound by `WCAG_AA_TEXT` (4.5) rather
5530
+ // than by the 3:1 a coloured shape would be, and the 600s come to 3.19 and
5531
+ // 3.77 against the default white surface. These are 5.02 and 5.48, pinned by
5532
+ // tests. Far enough apart to read as opposite news at a glance rather than as
5533
+ // two shades of "extra".
5534
+ surchargeColor: "#b45309",
5535
+ discountColor: "#047857",
5363
5536
  layout: "split",
5364
5537
  summaryPosition: "left",
5365
5538
  showOrderSummary: true,
@@ -5368,10 +5541,17 @@ var DEFAULT_BRANDING_BASE = {
5368
5541
  totalLabel: "Total",
5369
5542
  showCurrencyCode: false,
5370
5543
  showOrderItems: true,
5544
+ // Each flat field keeps its meaning: what the merchant wrote, used in every
5545
+ // locale that carries no override. Empty maps therefore change nothing for a
5546
+ // profile saved before translations existed.
5371
5547
  headerText: "",
5548
+ headerTextTranslations: {},
5372
5549
  payButtonLabel: "",
5550
+ payButtonLabelTranslations: {},
5373
5551
  cardTermsMessage: "",
5552
+ cardTermsMessageTranslations: {},
5374
5553
  footerText: "",
5554
+ footerTextTranslations: {},
5375
5555
  supportEmail: "",
5376
5556
  paymentLayout: "tabs",
5377
5557
  labelStyle: "above",
@@ -5397,6 +5577,11 @@ var DEFAULT_BRANDING_DARK = {
5397
5577
  buttonBackground: "#1E4FEB",
5398
5578
  buttonText: "#ffffff",
5399
5579
  surfaceStyle: "flat",
5580
+ // amber-400 / emerald-400: the 700s above are far too dark to read on
5581
+ // slate-900, and this pair is the same news in the same order at the light
5582
+ // end of the ramp — 10.69 and 9.29 against the dark surface, also pinned.
5583
+ surchargeColor: "#fbbf24",
5584
+ discountColor: "#34d399",
5400
5585
  trustBadges: DEFAULT_BADGES_DARK.map((b) => ({ ...b })),
5401
5586
  customFields: []
5402
5587
  };
@@ -5407,7 +5592,16 @@ function cloneBranding(b) {
5407
5592
  return {
5408
5593
  ...b,
5409
5594
  trustBadges: b.trustBadges.map((badge) => ({ ...badge })),
5410
- customFields: b.customFields.map(cloneCustomField)
5595
+ customFields: b.customFields.map(cloneCustomField),
5596
+ // Copied, not shared. A spread alone would leave the clone pointing at the
5597
+ // original's maps, and the dashboard edits a clone precisely so the form
5598
+ // can be abandoned without touching what is saved.
5599
+ surchargeWordTranslations: { ...b.surchargeWordTranslations },
5600
+ discountWordTranslations: { ...b.discountWordTranslations },
5601
+ headerTextTranslations: { ...b.headerTextTranslations },
5602
+ payButtonLabelTranslations: { ...b.payButtonLabelTranslations },
5603
+ cardTermsMessageTranslations: { ...b.cardTermsMessageTranslations },
5604
+ footerTextTranslations: { ...b.footerTextTranslations }
5411
5605
  };
5412
5606
  }
5413
5607
  function cloneCustomField(f) {
@@ -5558,13 +5752,25 @@ function defaultCustomFieldVisibility() {
5558
5752
  return { mode: "always", match: "all", conditions: [] };
5559
5753
  }
5560
5754
  function parseTranslations(raw) {
5561
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
5755
+ let value = raw;
5756
+ if (typeof value === "string") {
5757
+ try {
5758
+ value = JSON.parse(value);
5759
+ } catch {
5760
+ return {};
5761
+ }
5762
+ }
5763
+ if (!value || typeof value !== "object" || Array.isArray(value)) return {};
5562
5764
  const out = {};
5563
- for (const [k, v] of Object.entries(raw)) {
5564
- if (typeof v === "string" && v.length > 0) out[k] = v;
5765
+ for (const [k, v] of Object.entries(value)) {
5766
+ if (typeof v === "string" && v.trim().length > 0) out[k] = v;
5565
5767
  }
5566
5768
  return out;
5567
5769
  }
5770
+ function encodeTranslations(map) {
5771
+ const entries = Object.entries(map).filter(([, v]) => v.trim().length > 0);
5772
+ return entries.length > 0 ? JSON.stringify(Object.fromEntries(entries)) : void 0;
5773
+ }
5568
5774
  function normalizeCondition(raw, index) {
5569
5775
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
5570
5776
  const c = raw;
@@ -5916,6 +6122,74 @@ function decodeBranding(source) {
5916
6122
  ["sm", "md", "lg"],
5917
6123
  DEFAULT_BRANDING.buttonSize
5918
6124
  ),
6125
+ showSurcharge: parseBool(extras["showSurcharge"], DEFAULT_BRANDING.showSurcharge),
6126
+ surchargePosition: pickEnum(
6127
+ extras["surchargePosition"],
6128
+ SURCHARGE_POSITIONS,
6129
+ DEFAULT_BRANDING.surchargePosition
6130
+ ),
6131
+ surchargeStyle: pickEnum(
6132
+ extras["surchargeStyle"],
6133
+ SURCHARGE_STYLES,
6134
+ DEFAULT_BRANDING.surchargeStyle
6135
+ ),
6136
+ surchargeSize: pickEnum(
6137
+ extras["surchargeSize"],
6138
+ SURCHARGE_SIZES,
6139
+ DEFAULT_BRANDING.surchargeSize
6140
+ ),
6141
+ surchargeShape: pickEnum(
6142
+ extras["surchargeShape"],
6143
+ SURCHARGE_SHAPES,
6144
+ DEFAULT_BRANDING.surchargeShape
6145
+ ),
6146
+ surchargeBorderWidth: pickEnum(
6147
+ extras["surchargeBorderWidth"],
6148
+ SURCHARGE_BORDER_WIDTHS,
6149
+ DEFAULT_BRANDING.surchargeBorderWidth
6150
+ ),
6151
+ surchargeBorderStyle: pickEnum(
6152
+ extras["surchargeBorderStyle"],
6153
+ SURCHARGE_BORDER_STYLES,
6154
+ DEFAULT_BRANDING.surchargeBorderStyle
6155
+ ),
6156
+ surchargeWeight: pickEnum(
6157
+ extras["surchargeWeight"],
6158
+ SURCHARGE_WEIGHTS,
6159
+ DEFAULT_BRANDING.surchargeWeight
6160
+ ),
6161
+ surchargeSign: pickEnum(
6162
+ extras["surchargeSign"],
6163
+ SURCHARGE_SIGNS,
6164
+ DEFAULT_BRANDING.surchargeSign
6165
+ ),
6166
+ surchargeUppercase: parseBool(
6167
+ extras["surchargeUppercase"],
6168
+ DEFAULT_BRANDING.surchargeUppercase
6169
+ ),
6170
+ surchargeLabel: pickEnum(
6171
+ extras["surchargeLabel"],
6172
+ SURCHARGE_LABEL_MODES,
6173
+ DEFAULT_BRANDING.surchargeLabel
6174
+ ),
6175
+ surchargeFigure: pickEnum(
6176
+ extras["surchargeFigure"],
6177
+ SURCHARGE_FIGURE_MODES,
6178
+ DEFAULT_BRANDING.surchargeFigure
6179
+ ),
6180
+ discountFigure: pickEnum(
6181
+ extras["discountFigure"],
6182
+ SURCHARGE_FIGURE_MODES,
6183
+ DEFAULT_BRANDING.discountFigure
6184
+ ),
6185
+ surchargeWordTranslations: parseTranslations(extras["surchargeWordTranslations"]),
6186
+ discountWordTranslations: parseTranslations(extras["discountWordTranslations"]),
6187
+ headerTextTranslations: parseTranslations(extras["headerTextTranslations"]),
6188
+ payButtonLabelTranslations: parseTranslations(extras["payButtonLabelTranslations"]),
6189
+ cardTermsMessageTranslations: parseTranslations(extras["cardTermsMessageTranslations"]),
6190
+ footerTextTranslations: parseTranslations(extras["footerTextTranslations"]),
6191
+ surchargeColor: s(extras["surchargeColor"]) || DEFAULT_BRANDING.surchargeColor,
6192
+ discountColor: s(extras["discountColor"]) || DEFAULT_BRANDING.discountColor,
5919
6193
  layout: pickEnum(extras["layout"], ["compact", "split"], DEFAULT_BRANDING.layout),
5920
6194
  summaryPosition: pickEnum(
5921
6195
  extras["summaryPosition"],
@@ -5969,6 +6243,21 @@ function encodeBranding(branding, base) {
5969
6243
  verticalGap: branding.verticalGap,
5970
6244
  inputSize: branding.inputSize,
5971
6245
  buttonSize: branding.buttonSize,
6246
+ showSurcharge: String(branding.showSurcharge),
6247
+ surchargePosition: branding.surchargePosition,
6248
+ surchargeStyle: branding.surchargeStyle,
6249
+ surchargeSize: branding.surchargeSize,
6250
+ surchargeShape: branding.surchargeShape,
6251
+ surchargeBorderWidth: branding.surchargeBorderWidth,
6252
+ surchargeBorderStyle: branding.surchargeBorderStyle,
6253
+ surchargeWeight: branding.surchargeWeight,
6254
+ surchargeSign: branding.surchargeSign,
6255
+ surchargeUppercase: String(branding.surchargeUppercase),
6256
+ surchargeLabel: branding.surchargeLabel,
6257
+ surchargeFigure: branding.surchargeFigure,
6258
+ discountFigure: branding.discountFigure,
6259
+ surchargeColor: branding.surchargeColor,
6260
+ discountColor: branding.discountColor,
5972
6261
  layout: branding.layout,
5973
6262
  summaryPosition: branding.summaryPosition,
5974
6263
  showOrderSummary: String(branding.showOrderSummary),
@@ -5986,6 +6275,17 @@ function encodeBranding(branding, base) {
5986
6275
  if (branding.customFields.length > 0) {
5987
6276
  extras["customFields"] = encodeCustomFields(branding.customFields);
5988
6277
  }
6278
+ for (const key of [
6279
+ "surchargeWordTranslations",
6280
+ "discountWordTranslations",
6281
+ "headerTextTranslations",
6282
+ "payButtonLabelTranslations",
6283
+ "cardTermsMessageTranslations",
6284
+ "footerTextTranslations"
6285
+ ]) {
6286
+ const encoded = encodeTranslations(branding[key]);
6287
+ if (encoded) extras[key] = encoded;
6288
+ }
5989
6289
  const tagline = trim(branding.tagline);
5990
6290
  if (tagline) extras["tagline"] = tagline;
5991
6291
  const footer = trim(branding.footerText);
@@ -6094,6 +6394,71 @@ function parseImportedBranding(raw) {
6094
6394
  ),
6095
6395
  inputSize: pickEnum(root["inputSize"], ["sm", "md", "lg"], dflt.inputSize),
6096
6396
  buttonSize: pickEnum(root["buttonSize"], ["sm", "md", "lg"], dflt.buttonSize),
6397
+ showSurcharge: parseBool(root["showSurcharge"], dflt.showSurcharge),
6398
+ surchargePosition: pickEnum(
6399
+ root["surchargePosition"],
6400
+ SURCHARGE_POSITIONS,
6401
+ dflt.surchargePosition
6402
+ ),
6403
+ surchargeStyle: pickEnum(
6404
+ root["surchargeStyle"],
6405
+ SURCHARGE_STYLES,
6406
+ dflt.surchargeStyle
6407
+ ),
6408
+ surchargeSize: pickEnum(
6409
+ root["surchargeSize"],
6410
+ SURCHARGE_SIZES,
6411
+ dflt.surchargeSize
6412
+ ),
6413
+ surchargeShape: pickEnum(
6414
+ root["surchargeShape"],
6415
+ SURCHARGE_SHAPES,
6416
+ dflt.surchargeShape
6417
+ ),
6418
+ surchargeBorderWidth: pickEnum(
6419
+ root["surchargeBorderWidth"],
6420
+ SURCHARGE_BORDER_WIDTHS,
6421
+ dflt.surchargeBorderWidth
6422
+ ),
6423
+ surchargeBorderStyle: pickEnum(
6424
+ root["surchargeBorderStyle"],
6425
+ SURCHARGE_BORDER_STYLES,
6426
+ dflt.surchargeBorderStyle
6427
+ ),
6428
+ surchargeWeight: pickEnum(
6429
+ root["surchargeWeight"],
6430
+ SURCHARGE_WEIGHTS,
6431
+ dflt.surchargeWeight
6432
+ ),
6433
+ surchargeSign: pickEnum(
6434
+ root["surchargeSign"],
6435
+ SURCHARGE_SIGNS,
6436
+ dflt.surchargeSign
6437
+ ),
6438
+ surchargeUppercase: parseBool(root["surchargeUppercase"], dflt.surchargeUppercase),
6439
+ surchargeLabel: pickEnum(
6440
+ root["surchargeLabel"],
6441
+ SURCHARGE_LABEL_MODES,
6442
+ dflt.surchargeLabel
6443
+ ),
6444
+ surchargeFigure: pickEnum(
6445
+ root["surchargeFigure"],
6446
+ SURCHARGE_FIGURE_MODES,
6447
+ dflt.surchargeFigure
6448
+ ),
6449
+ discountFigure: pickEnum(
6450
+ root["discountFigure"],
6451
+ SURCHARGE_FIGURE_MODES,
6452
+ dflt.discountFigure
6453
+ ),
6454
+ surchargeWordTranslations: parseTranslations(root["surchargeWordTranslations"]),
6455
+ discountWordTranslations: parseTranslations(root["discountWordTranslations"]),
6456
+ headerTextTranslations: parseTranslations(root["headerTextTranslations"]),
6457
+ payButtonLabelTranslations: parseTranslations(root["payButtonLabelTranslations"]),
6458
+ cardTermsMessageTranslations: parseTranslations(root["cardTermsMessageTranslations"]),
6459
+ footerTextTranslations: parseTranslations(root["footerTextTranslations"]),
6460
+ surchargeColor: sHex(root["surchargeColor"], dflt.surchargeColor),
6461
+ discountColor: sHex(root["discountColor"], dflt.discountColor),
6097
6462
  layout: pickEnum(root["layout"], ["compact", "split"], dflt.layout),
6098
6463
  summaryPosition: pickEnum(
6099
6464
  root["summaryPosition"],
@@ -6160,6 +6525,19 @@ function applyBrandingVariables(el, b) {
6160
6525
  set("--dp-gap-vertical", VERTICAL_GAP[b.verticalGap]);
6161
6526
  set("--dp-input-pad", INPUT_PAD[b.inputSize]);
6162
6527
  set("--dp-button-pad", BUTTON_PAD[b.buttonSize]);
6528
+ set("--dp-surcharge", b.surchargeColor);
6529
+ set("--dp-discount", b.discountColor);
6530
+ set("--dp-surcharge-ink", readableInkOn(b.surchargeColor));
6531
+ set("--dp-discount-ink", readableInkOn(b.discountColor));
6532
+ set("--dp-surcharge-size", SURCHARGE_FONT_SIZE[b.surchargeSize]);
6533
+ set("--dp-surcharge-pad", SURCHARGE_PAD[b.surchargeSize]);
6534
+ set("--dp-surcharge-radius", SURCHARGE_RADIUS[b.surchargeShape]);
6535
+ set("--dp-surcharge-weight", SURCHARGE_FONT_WEIGHT[b.surchargeWeight]);
6536
+ set(
6537
+ "--dp-surcharge-border-width",
6538
+ SURCHARGE_BORDER_WIDTH[b.surchargeStyle === "outline" && b.surchargeBorderWidth === "none" ? "thin" : b.surchargeBorderWidth]
6539
+ );
6540
+ set("--dp-surcharge-border-style", b.surchargeBorderStyle);
6163
6541
  set("--dp-shadow", shadowFor(b.surfaceStyle));
6164
6542
  set(
6165
6543
  "--dp-surface-border",
@@ -6550,9 +6928,9 @@ var STRIPE_FALLBACK_PANE_METHODS = [
6550
6928
  requiresBillingCountry: true,
6551
6929
  defaultLabel: "Klarna",
6552
6930
  // 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
6931
+ // what a router predating the capability endpoint renders, and that copy
6932
+ // only gained the "3" in the same release that added the endpoint.
6933
+ // Restating the new string here
6556
6934
  // would put copy no reachable router emits in front of a merchant, and
6557
6935
  // would change what the deprecated `nativePaneMethodInfo` has returned
6558
6936
  // since 0.106.0.
@@ -6888,6 +7266,7 @@ var encodeNativePanes = encodePanes;
6888
7266
  CHECKBOX_CHECKED,
6889
7267
  CHECKBOX_UNCHECKED,
6890
7268
  CHECKOUT_EVENT_KINDS,
7269
+ CHECKOUT_LOCALES,
6891
7270
  CUSTOM_CSS_MAX_LENGTH,
6892
7271
  CUSTOM_FIELDS_MAX,
6893
7272
  CUSTOM_FIELD_CONDITIONS_MAX,
@@ -6908,6 +7287,7 @@ var encodeNativePanes = encodePanes;
6908
7287
  FeeProgramBuilder,
6909
7288
  Files,
6910
7289
  Forex,
7290
+ LOCALIZABLE_COPY_FIELDS,
6911
7291
  NATIVE_PANES_MAX,
6912
7292
  NATIVE_PANE_CATEGORY_KEYS,
6913
7293
  NATIVE_PANE_ICON_KEYS,
@@ -6920,6 +7300,16 @@ var encodeNativePanes = encodePanes;
6920
7300
  STRIPE_FALLBACK_PANE_CATALOG,
6921
7301
  STRIPE_FALLBACK_PANE_METHODS,
6922
7302
  STRIPE_NATIVE_PANE_METHODS,
7303
+ SURCHARGE_BORDER_STYLES,
7304
+ SURCHARGE_BORDER_WIDTHS,
7305
+ SURCHARGE_FIGURE_MODES,
7306
+ SURCHARGE_LABEL_MODES,
7307
+ SURCHARGE_POSITIONS,
7308
+ SURCHARGE_SHAPES,
7309
+ SURCHARGE_SIGNS,
7310
+ SURCHARGE_SIZES,
7311
+ SURCHARGE_STYLES,
7312
+ SURCHARGE_WEIGHTS,
6923
7313
  Search,
6924
7314
  Settlement,
6925
7315
  Subscriptions,
@@ -6931,11 +7321,13 @@ var encodeNativePanes = encodePanes;
6931
7321
  applyBrandingVariables,
6932
7322
  buildBrandingExport,
6933
7323
  buttonPadValue,
7324
+ checkoutCopy,
6934
7325
  cloneBranding,
6935
7326
  cloneCustomField,
6936
7327
  cloneNativePane,
6937
7328
  clonePane,
6938
7329
  contrastRatio,
7330
+ copyTranslationsKey,
6939
7331
  customFieldContextFromMetadata,
6940
7332
  customFieldIsTextLike,
6941
7333
  customFieldOperatorTakesValue,
@@ -6980,9 +7372,14 @@ var encodeNativePanes = encodePanes;
6980
7372
  parseImportedBranding,
6981
7373
  programToTree,
6982
7374
  radiusValue,
7375
+ readableInkOn,
6983
7376
  ruleMatchToTree,
6984
7377
  sanitizeCustomCss,
6985
7378
  shadowFor,
7379
+ surchargeFigurePlan,
7380
+ surchargeShowsLabel,
7381
+ surchargeStyleDrawsAShape,
7382
+ surchargeWordFor,
6986
7383
  surfacePadValue,
6987
7384
  validatePanes,
6988
7385
  verticalGapValue,