@delopay/sdk 0.351.0 → 0.361.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
@@ -68,6 +68,7 @@ __export(internal_exports, {
68
68
  Cache: () => Cache,
69
69
  CardIssuers: () => CardIssuers,
70
70
  Cards: () => Cards,
71
+ ChargebackPrevention: () => ChargebackPrevention,
71
72
  CheckoutMethods: () => CheckoutMethods,
72
73
  CheckoutRecovery: () => CheckoutRecovery,
73
74
  CheckoutSession: () => CheckoutSession,
@@ -80,12 +81,35 @@ __export(internal_exports, {
80
81
  DEFAULT_BADGES_DARK: () => DEFAULT_BADGES_DARK,
81
82
  DEFAULT_BRANDING: () => DEFAULT_BRANDING,
82
83
  DEFAULT_BRANDING_DARK: () => DEFAULT_BRANDING_DARK,
84
+ DEFAULT_ENIGMA_CARD_FORM: () => DEFAULT_ENIGMA_CARD_FORM,
83
85
  DEFAULT_NOTICES: () => DEFAULT_NOTICES,
84
86
  Delopay: () => Delopay,
85
87
  DelopayAuthenticationError: () => DelopayAuthenticationError,
86
88
  DelopayError: () => DelopayError,
87
89
  DelopayInternal: () => DelopayInternal,
88
90
  Diagnostic: () => Diagnostic,
91
+ ENIGMA_CLICK_FEEDBACK: () => ENIGMA_CLICK_FEEDBACK,
92
+ ENIGMA_CORNERS: () => ENIGMA_CORNERS,
93
+ ENIGMA_CUSTOM_CSS_MAX_LENGTH: () => ENIGMA_CUSTOM_CSS_MAX_LENGTH,
94
+ ENIGMA_CUSTOM_HEIGHT_DEFAULT: () => ENIGMA_CUSTOM_HEIGHT_DEFAULT,
95
+ ENIGMA_CUSTOM_HEIGHT_MAX: () => ENIGMA_CUSTOM_HEIGHT_MAX,
96
+ ENIGMA_CUSTOM_HEIGHT_MIN: () => ENIGMA_CUSTOM_HEIGHT_MIN,
97
+ ENIGMA_FIELD_CHROMES: () => ENIGMA_FIELD_CHROMES,
98
+ ENIGMA_FIELD_HEIGHTS: () => ENIGMA_FIELD_HEIGHTS,
99
+ ENIGMA_FIELD_MOTIONS: () => ENIGMA_FIELD_MOTIONS,
100
+ ENIGMA_FIELD_ORDERS: () => ENIGMA_FIELD_ORDERS,
101
+ ENIGMA_FOCUS_RINGS: () => ENIGMA_FOCUS_RINGS,
102
+ ENIGMA_LABEL_PLACEMENTS: () => ENIGMA_LABEL_PLACEMENTS,
103
+ ENIGMA_LABEL_TONES: () => ENIGMA_LABEL_TONES,
104
+ ENIGMA_LOADING_STYLES: () => ENIGMA_LOADING_STYLES,
105
+ ENIGMA_NETWORK_MARKS: () => ENIGMA_NETWORK_MARKS,
106
+ ENIGMA_OPENINGS: () => ENIGMA_OPENINGS,
107
+ ENIGMA_PAY_FEEDBACK: () => ENIGMA_PAY_FEEDBACK,
108
+ ENIGMA_REVEALS: () => ENIGMA_REVEALS,
109
+ ENIGMA_ROW_GAPS: () => ENIGMA_ROW_GAPS,
110
+ ENIGMA_STYLE_MODES: () => ENIGMA_STYLE_MODES,
111
+ ENIGMA_TEMPLATES: () => ENIGMA_TEMPLATES,
112
+ ENIGMA_TEMPLATE_PRESETS: () => ENIGMA_TEMPLATE_PRESETS,
89
113
  Export: () => Export,
90
114
  ExternalRecords: () => ExternalRecords,
91
115
  FeatureMatrix: () => FeatureMatrix,
@@ -185,6 +209,7 @@ __export(internal_exports, {
185
209
  allOf: () => allOf,
186
210
  anyOf: () => anyOf,
187
211
  applyBrandingVariables: () => applyBrandingVariables,
212
+ applyEnigmaTemplate: () => applyEnigmaTemplate,
188
213
  asAirwallexCardPreset: () => asAirwallexCardPreset,
189
214
  brandingAssetPath: () => brandingAssetPath,
190
215
  buildBrandingExport: () => buildBrandingExport,
@@ -213,6 +238,7 @@ __export(internal_exports, {
213
238
  decodeBadges: () => decodeBadges,
214
239
  decodeBranding: () => decodeBranding,
215
240
  decodeCustomFields: () => decodeCustomFields,
241
+ decodeEnigmaCardForm: () => decodeEnigmaCardForm,
216
242
  decodeMethodSectionLabels: () => decodeMethodSectionLabels,
217
243
  decodeMethodSectionOrder: () => decodeMethodSectionOrder,
218
244
  decodeNativePanes: () => decodeNativePanes,
@@ -229,11 +255,17 @@ __export(internal_exports, {
229
255
  encodeBadges: () => encodeBadges,
230
256
  encodeBranding: () => encodeBranding,
231
257
  encodeCustomFields: () => encodeCustomFields,
258
+ encodeEnigmaCardForm: () => encodeEnigmaCardForm,
232
259
  encodeMethodSectionLabels: () => encodeMethodSectionLabels,
233
260
  encodeMethodSectionOrder: () => encodeMethodSectionOrder,
234
261
  encodeNativePanes: () => encodeNativePanes,
235
262
  encodeNotices: () => encodeNotices,
236
263
  encodePanes: () => encodePanes,
264
+ enigmaCornerPx: () => enigmaCornerPx,
265
+ enigmaCustomCssProblem: () => enigmaCustomCssProblem,
266
+ enigmaDefaultFill: () => enigmaDefaultFill,
267
+ enigmaNamesInside: () => enigmaNamesInside,
268
+ enigmaTemplateChanges: () => enigmaTemplateChanges,
237
269
  evaluateCustomFieldCondition: () => evaluateCustomFieldCondition,
238
270
  evaluateCustomFieldVisibility: () => evaluateCustomFieldVisibility,
239
271
  feeProgram: () => feeProgram,
@@ -2268,6 +2300,77 @@ var Disputes = class {
2268
2300
  }
2269
2301
  };
2270
2302
 
2303
+ // src/resources/chargebackPrevention.ts
2304
+ function preventionCaseQuery(params) {
2305
+ if (!params) return void 0;
2306
+ const { provider, source, status, outcome, match_status, ...query } = params;
2307
+ return {
2308
+ ...query,
2309
+ ...provider?.length ? { provider: provider.join(",") } : {},
2310
+ ...source?.length ? { source: source.join(",") } : {},
2311
+ ...status?.length ? { status: status.join(",") } : {},
2312
+ ...outcome?.length ? { outcome: outcome.join(",") } : {},
2313
+ ...match_status?.length ? { match_status: match_status.join(",") } : {}
2314
+ };
2315
+ }
2316
+ var ChargebackPrevention = class {
2317
+ constructor(request) {
2318
+ this.request = request;
2319
+ }
2320
+ /** The merchant's connections, with their business accounts and sync health. */
2321
+ async listConnections() {
2322
+ return this.request("GET", "/chargeback-prevention/connections");
2323
+ }
2324
+ /**
2325
+ * Connect a provider account. DeloPay checks the key with the provider,
2326
+ * registers its webhooks there and starts reading alerts. Dashboard session
2327
+ * only.
2328
+ */
2329
+ async connect(params) {
2330
+ return this.request("POST", "/chargeback-prevention/connections", { body: params });
2331
+ }
2332
+ /** Replace a connection's key; reconnects one whose key was refused. */
2333
+ async replaceKey(connectionId, params) {
2334
+ return this.request(
2335
+ "PUT",
2336
+ `/chargeback-prevention/connections/${encodeURIComponent(connectionId)}/key`,
2337
+ { body: params }
2338
+ );
2339
+ }
2340
+ /** Stop reading a connection. Its cases are kept. */
2341
+ async disconnect(connectionId) {
2342
+ return this.request(
2343
+ "DELETE",
2344
+ `/chargeback-prevention/connections/${encodeURIComponent(connectionId)}`
2345
+ );
2346
+ }
2347
+ /** Read the connection's alerts again as soon as the provider allows. */
2348
+ async syncNow(connectionId) {
2349
+ return this.request(
2350
+ "POST",
2351
+ `/chargeback-prevention/connections/${encodeURIComponent(connectionId)}/sync`
2352
+ );
2353
+ }
2354
+ /** Set the shops a provider business account sells through; its cases are matched again. */
2355
+ async mapAccount(connectionId, providerAccountId, params) {
2356
+ return this.request(
2357
+ "PUT",
2358
+ `/chargeback-prevention/connections/${encodeURIComponent(connectionId)}/accounts/${encodeURIComponent(providerAccountId)}`,
2359
+ { body: params }
2360
+ );
2361
+ }
2362
+ /** Cases with what DeloPay's records say happened to each payment. */
2363
+ async listCases(params) {
2364
+ return this.request("GET", "/chargeback-prevention/cases", {
2365
+ query: preventionCaseQuery(params)
2366
+ });
2367
+ }
2368
+ /** One case with its references and observed history. */
2369
+ async retrieveCase(caseId) {
2370
+ return this.request("GET", `/chargeback-prevention/cases/${encodeURIComponent(caseId)}`);
2371
+ }
2372
+ };
2373
+
2271
2374
  // src/resources/paypalDisputes.ts
2272
2375
  var PaypalDisputes = class {
2273
2376
  constructor(request) {
@@ -4507,7 +4610,12 @@ var Routing = class {
4507
4610
  async getDefaultForProfile(profileId) {
4508
4611
  return this.request("GET", `/routing/default/profile/${encodeURIComponent(profileId)}`);
4509
4612
  }
4510
- /** Update default config for a profile. `POST /routing/default/profile/{profileId}` */
4613
+ /**
4614
+ * Update default config for a profile. `POST /routing/default/profile/{profileId}`
4615
+ *
4616
+ * Send the list alone to keep the shop's fallback mode, or `{ connectors, mode, splits }` to set
4617
+ * it. A `volume_split` whose shares do not total 100 is refused.
4618
+ */
4511
4619
  async updateDefaultProfile(profileId, params, options) {
4512
4620
  return this.request("POST", `/routing/default/profile/${encodeURIComponent(profileId)}`, {
4513
4621
  body: params,
@@ -10020,7 +10128,8 @@ var Settlement = class {
10020
10128
  });
10021
10129
  }
10022
10130
  /**
10023
- * Export a statement as PDF. Returns the raw PDF bytes as a `Blob`, with
10131
+ * Export a statement as PDF, or with `format` as CSV, JSON
10132
+ * (`StatementDocument`) or XLSX. Returns the raw bytes as a `Blob`, with
10024
10133
  * the same auth, retries and error handling as every other call — persist
10025
10134
  * or object-URL it caller-side.
10026
10135
  *
@@ -10039,7 +10148,8 @@ var Settlement = class {
10039
10148
  return this.request("GET", `/settlement/statements/${encodeURIComponent(statementId)}/pdf`, {
10040
10149
  query: {
10041
10150
  currency: params?.currency,
10042
- include_transactions: params?.include_transactions
10151
+ include_transactions: params?.include_transactions,
10152
+ format: params?.format
10043
10153
  },
10044
10154
  responseType: "blob",
10045
10155
  ...options
@@ -10303,7 +10413,21 @@ var OperationLimits = class {
10303
10413
  */
10304
10414
  async retrieveUsage(params, options) {
10305
10415
  return this.request("GET", "/operation-limits/usage", {
10306
- query: { operation: params.operation },
10416
+ query: { operation: params.operation, profile_id: params.profile_id },
10417
+ ...options
10418
+ });
10419
+ }
10420
+ /**
10421
+ * The version history of the merchant's limit settings, newest first: every
10422
+ * rule created, changed (switched off or on included) or deleted, and every
10423
+ * settings change, with who made it (and who really did, under act-as) and
10424
+ * the values before and after.
10425
+ *
10426
+ * `GET /operation-limits/history`
10427
+ */
10428
+ async listHistory(params, options) {
10429
+ return this.request("GET", "/operation-limits/history", {
10430
+ query: { limit: params?.limit, before: params?.before },
10307
10431
  ...options
10308
10432
  });
10309
10433
  }
@@ -11105,6 +11229,7 @@ var Delopay = class {
11105
11229
  this.paymentLinks = new PaymentLinks(request);
11106
11230
  this.mandates = new Mandates(request);
11107
11231
  this.disputes = new Disputes(request);
11232
+ this.chargebackPrevention = new ChargebackPrevention(request);
11108
11233
  this.paypalDisputes = new PaypalDisputes(request);
11109
11234
  this.whopResolutionCases = new WhopResolutionCases(request);
11110
11235
  this.payouts = new Payouts(request);
@@ -11950,9 +12075,9 @@ function resolveStripeTheme(theme, dark) {
11950
12075
  var STRIPE_INPUT_STYLES = ["spaced", "condensed"];
11951
12076
  var STRIPE_LABEL_PLACEMENTS = ["above", "floating"];
11952
12077
  var STRIPE_SPACINGS = ["compact", "comfortable", "spacious"];
11953
- function stripeSpacingValues(spacing) {
11954
- if (spacing === "compact") return { spacingUnit: "3px", gridRowSpacing: "8px" };
11955
- if (spacing === "spacious") return { spacingUnit: "5px", gridRowSpacing: "16px" };
12078
+ function stripeSpacingValues(spacing2) {
12079
+ if (spacing2 === "compact") return { spacingUnit: "3px", gridRowSpacing: "8px" };
12080
+ if (spacing2 === "spacious") return { spacingUnit: "5px", gridRowSpacing: "16px" };
11956
12081
  return { spacingUnit: "4px", gridRowSpacing: "12px" };
11957
12082
  }
11958
12083
  var PAYPAL_CARD_LAYOUTS = ["split", "stacked"];
@@ -12232,6 +12357,444 @@ function matchWhopLook(settings) {
12232
12357
  ) ?? null;
12233
12358
  }
12234
12359
 
12360
+ // src/enigmaCardForm.ts
12361
+ var ENIGMA_FIELD_CHROMES = ["outlined", "filled", "underline", "joined"];
12362
+ var ENIGMA_LABEL_PLACEMENTS = ["above", "inside"];
12363
+ var ENIGMA_LABEL_TONES = ["strong", "muted"];
12364
+ var ENIGMA_FIELD_ORDERS = ["number", "name"];
12365
+ var ENIGMA_NETWORK_MARKS = ["live", "static", "hidden"];
12366
+ var ENIGMA_FOCUS_RINGS = ["strong", "subtle"];
12367
+ var ENIGMA_FIELD_MOTIONS = ["smooth", "slow", "none"];
12368
+ var ENIGMA_FIELD_HEIGHTS = ["40", "44", "48", "52"];
12369
+ var ENIGMA_ROW_GAPS = ["8", "12", "16"];
12370
+ var ENIGMA_CORNERS = ["square", "small", "medium", "large", "pill"];
12371
+ var ENIGMA_STYLE_MODES = ["designed", "custom"];
12372
+ var ENIGMA_OPENINGS = ["place", "expand"];
12373
+ var ENIGMA_CLICK_FEEDBACK = ["both", "ring", "press", "none"];
12374
+ var ENIGMA_LOADING_STYLES = [
12375
+ "shimmer",
12376
+ "pulse",
12377
+ "dim",
12378
+ "line",
12379
+ "spinner",
12380
+ "none"
12381
+ ];
12382
+ var ENIGMA_REVEALS = ["fade", "rise", "wipe", "none"];
12383
+ var ENIGMA_PAY_FEEDBACK = ["spinner", "press", "none"];
12384
+ var ENIGMA_TEMPLATES = [
12385
+ "soft",
12386
+ "fields",
12387
+ "classic",
12388
+ "compact",
12389
+ "filled",
12390
+ "underline"
12391
+ ];
12392
+ var ENIGMA_CUSTOM_CSS_MAX_LENGTH = 950;
12393
+ var ENIGMA_CUSTOM_HEIGHT_MIN = 120;
12394
+ var ENIGMA_CUSTOM_HEIGHT_MAX = 600;
12395
+ var ENIGMA_CUSTOM_HEIGHT_DEFAULT = 260;
12396
+ var ENIGMA_TEMPLATE_PRESETS = {
12397
+ soft: {
12398
+ enigmaChrome: "outlined",
12399
+ enigmaLabels: "above",
12400
+ enigmaLabelTone: "strong",
12401
+ enigmaHints: true,
12402
+ enigmaCvcIcon: true,
12403
+ enigmaFieldOrder: "number",
12404
+ enigmaMarks: "live",
12405
+ enigmaFocusRing: "strong",
12406
+ enigmaFieldHeight: "44",
12407
+ enigmaRowGap: "12",
12408
+ enigmaCorner: "medium"
12409
+ },
12410
+ fields: {
12411
+ enigmaChrome: "outlined",
12412
+ enigmaLabels: "above",
12413
+ enigmaLabelTone: "muted",
12414
+ enigmaHints: true,
12415
+ enigmaCvcIcon: true,
12416
+ enigmaFieldOrder: "number",
12417
+ enigmaMarks: "live",
12418
+ enigmaFocusRing: "strong",
12419
+ enigmaFieldHeight: "48",
12420
+ enigmaRowGap: "12",
12421
+ enigmaCorner: "small"
12422
+ },
12423
+ classic: {
12424
+ enigmaChrome: "outlined",
12425
+ enigmaLabels: "above",
12426
+ enigmaLabelTone: "strong",
12427
+ enigmaHints: false,
12428
+ enigmaCvcIcon: true,
12429
+ enigmaFieldOrder: "number",
12430
+ enigmaMarks: "live",
12431
+ enigmaFocusRing: "strong",
12432
+ enigmaFieldHeight: "44",
12433
+ enigmaRowGap: "12",
12434
+ enigmaCorner: "medium"
12435
+ },
12436
+ compact: {
12437
+ enigmaChrome: "joined",
12438
+ enigmaLabels: "inside",
12439
+ enigmaLabelTone: "muted",
12440
+ enigmaHints: false,
12441
+ enigmaCvcIcon: true,
12442
+ enigmaFieldOrder: "number",
12443
+ enigmaMarks: "live",
12444
+ enigmaFocusRing: "strong",
12445
+ enigmaFieldHeight: "48",
12446
+ enigmaRowGap: "12",
12447
+ enigmaCorner: "medium"
12448
+ },
12449
+ filled: {
12450
+ enigmaChrome: "filled",
12451
+ enigmaLabels: "above",
12452
+ enigmaLabelTone: "strong",
12453
+ enigmaHints: false,
12454
+ enigmaCvcIcon: true,
12455
+ enigmaFieldOrder: "number",
12456
+ enigmaMarks: "live",
12457
+ enigmaFocusRing: "strong",
12458
+ enigmaFieldHeight: "44",
12459
+ enigmaRowGap: "12",
12460
+ enigmaCorner: "medium"
12461
+ },
12462
+ underline: {
12463
+ enigmaChrome: "underline",
12464
+ enigmaLabels: "above",
12465
+ enigmaLabelTone: "muted",
12466
+ enigmaHints: false,
12467
+ enigmaCvcIcon: true,
12468
+ enigmaFieldOrder: "number",
12469
+ enigmaMarks: "live",
12470
+ enigmaFocusRing: "strong",
12471
+ enigmaFieldHeight: "40",
12472
+ enigmaRowGap: "16",
12473
+ enigmaCorner: "square"
12474
+ }
12475
+ };
12476
+ var DEFAULT_ENIGMA_CARD_FORM = {
12477
+ enigmaTemplate: "soft",
12478
+ enigmaStyleMode: "designed",
12479
+ ...ENIGMA_TEMPLATE_PRESETS.soft,
12480
+ enigmaFieldMotion: "smooth",
12481
+ enigmaAccent: "",
12482
+ enigmaBorder: "",
12483
+ enigmaFill: "",
12484
+ enigmaTrustLine: true,
12485
+ enigmaAutoOpen: false,
12486
+ enigmaOpening: "place",
12487
+ enigmaClickFeedback: "both",
12488
+ enigmaLoading: "shimmer",
12489
+ enigmaReveal: "fade",
12490
+ enigmaPayFeedback: "spinner",
12491
+ enigmaCustomCss: "",
12492
+ enigmaCustomHeight: ENIGMA_CUSTOM_HEIGHT_DEFAULT
12493
+ };
12494
+ function applyEnigmaTemplate(template) {
12495
+ return { enigmaTemplate: template, ...ENIGMA_TEMPLATE_PRESETS[template] };
12496
+ }
12497
+ function enigmaTemplateChanges(settings) {
12498
+ const preset = ENIGMA_TEMPLATE_PRESETS[settings.enigmaTemplate];
12499
+ return Object.keys(preset).filter(
12500
+ (key) => settings[key] !== preset[key]
12501
+ );
12502
+ }
12503
+ function enigmaNamesInside(settings) {
12504
+ return settings.enigmaChrome === "joined" || settings.enigmaLabels === "inside";
12505
+ }
12506
+ var PSEUDO_CLASSES = [
12507
+ "focus",
12508
+ "focus-visible",
12509
+ "focus-within",
12510
+ "hover",
12511
+ "checked",
12512
+ "disabled",
12513
+ "invalid",
12514
+ "valid",
12515
+ "placeholder-shown",
12516
+ "first-child",
12517
+ "last-child"
12518
+ ];
12519
+ var HIDEABLE = ["p", "h1", "#header", "#headertext", ".timer", "#timer"];
12520
+ var PROPERTIES = [
12521
+ "color",
12522
+ "caret-color",
12523
+ "accent-color",
12524
+ "-webkit-text-fill-color",
12525
+ "background",
12526
+ "background-color",
12527
+ "border",
12528
+ "border-top",
12529
+ "border-right",
12530
+ "border-bottom",
12531
+ "border-left",
12532
+ "border-color",
12533
+ "border-width",
12534
+ "border-style",
12535
+ "border-top-color",
12536
+ "border-right-color",
12537
+ "border-bottom-color",
12538
+ "border-left-color",
12539
+ "border-top-width",
12540
+ "border-right-width",
12541
+ "border-bottom-width",
12542
+ "border-left-width",
12543
+ "border-radius",
12544
+ "border-top-left-radius",
12545
+ "border-top-right-radius",
12546
+ "border-bottom-left-radius",
12547
+ "border-bottom-right-radius",
12548
+ "box-shadow",
12549
+ "outline",
12550
+ "outline-color",
12551
+ "outline-offset",
12552
+ "font",
12553
+ "font-family",
12554
+ "font-size",
12555
+ "font-weight",
12556
+ "font-style",
12557
+ "letter-spacing",
12558
+ "line-height",
12559
+ "text-align",
12560
+ "text-transform",
12561
+ "padding",
12562
+ "padding-top",
12563
+ "padding-right",
12564
+ "padding-bottom",
12565
+ "padding-left",
12566
+ "margin",
12567
+ "margin-top",
12568
+ "margin-right",
12569
+ "margin-bottom",
12570
+ "margin-left",
12571
+ "height",
12572
+ "min-height",
12573
+ "width",
12574
+ "min-width",
12575
+ "max-width",
12576
+ "display",
12577
+ "flex-wrap",
12578
+ "gap",
12579
+ "transition",
12580
+ "box-sizing",
12581
+ "top"
12582
+ ];
12583
+ function lengthAtLeast(value, min) {
12584
+ const match = /^(-?[0-9.]+)(px|em|rem)$/.exec(value);
12585
+ if (!match) return false;
12586
+ const number = Number(match[1]) * (match[2] === "px" ? 1 : 16);
12587
+ return Number.isFinite(number) && number >= min;
12588
+ }
12589
+ function spacing(value) {
12590
+ return value.split(" ").every(
12591
+ (part) => part === "0" || part === "auto" || lengthAtLeast(part, 0) && !lengthAtLeast(part, 48.5)
12592
+ );
12593
+ }
12594
+ function width(value) {
12595
+ if (value === "auto") return true;
12596
+ if (value.endsWith("%")) return Number(value.slice(0, -1)) >= 20;
12597
+ const calc = /^calc\(([0-9.]+)% - ([0-9.]+)px\)$/.exec(value);
12598
+ if (calc) return Number(calc[1]) >= 20 && Number(calc[2]) <= 48;
12599
+ if (value.startsWith("calc(")) return false;
12600
+ return lengthAtLeast(value, 40);
12601
+ }
12602
+ function opaqueColour(value) {
12603
+ if (value.startsWith("#")) return /^#([0-9a-f]{3}|[0-9a-f]{6})$/.test(value);
12604
+ if (value.startsWith("rgb("))
12605
+ return value.endsWith(")") && value.split(",").length === 3 && !value.includes("/");
12606
+ return value !== "transparent" && /^[a-z]+$/.test(value);
12607
+ }
12608
+ function declarationProblem(selector, declaration) {
12609
+ const at = declaration.indexOf(":");
12610
+ if (at < 0) return null;
12611
+ const property = declaration.slice(0, at).trim();
12612
+ const raw = declaration.slice(at + 1).trim();
12613
+ const important = raw.endsWith("!important");
12614
+ const value = raw.replace(/!important$/, "").trim();
12615
+ if (!PROPERTIES.includes(property)) return "property";
12616
+ if (["var(", "env(", "attr("].some((fn) => value.includes(fn))) return "variable";
12617
+ let ok = true;
12618
+ switch (property) {
12619
+ case "display": {
12620
+ if (important) return "important_display";
12621
+ const hideable = selector.split(",").every((one) => {
12622
+ const subject = one.split(/[ >]/).pop() ?? one;
12623
+ return HIDEABLE.includes(subject.split(":")[0] ?? subject);
12624
+ });
12625
+ ok = ["block", "flex", "grid", "inline", "inline-block", "inline-flex"].includes(value) || value === "none" && hideable;
12626
+ break;
12627
+ }
12628
+ case "margin":
12629
+ case "margin-top":
12630
+ case "margin-right":
12631
+ case "margin-bottom":
12632
+ case "margin-left":
12633
+ case "padding":
12634
+ case "padding-top":
12635
+ case "padding-right":
12636
+ case "padding-bottom":
12637
+ case "padding-left":
12638
+ ok = spacing(value);
12639
+ break;
12640
+ case "height":
12641
+ case "min-height":
12642
+ ok = value === "auto" || lengthAtLeast(value, 20);
12643
+ break;
12644
+ case "width":
12645
+ case "min-width":
12646
+ case "max-width":
12647
+ ok = width(value);
12648
+ break;
12649
+ case "font-size":
12650
+ ok = lengthAtLeast(value, 12);
12651
+ break;
12652
+ case "font": {
12653
+ const size = value.split(/[ /]/).find((part) => part.endsWith("px") || part.endsWith("em"));
12654
+ ok = size !== void 0 && lengthAtLeast(size, 12);
12655
+ break;
12656
+ }
12657
+ case "line-height":
12658
+ ok = value === "normal" || Number(value) >= 1 || lengthAtLeast(value, 12);
12659
+ break;
12660
+ case "color":
12661
+ case "caret-color":
12662
+ ok = opaqueColour(value);
12663
+ break;
12664
+ case "top":
12665
+ ok = value === "0" || /^-?[0-9.]+px$/.test(value) && Math.abs(parseFloat(value)) <= 4;
12666
+ break;
12667
+ case "-webkit-text-fill-color":
12668
+ ok = selector.split(",").every((one) => (one.split(/[ >]/).pop() ?? "").includes(":placeholder-shown")) || opaqueColour(value);
12669
+ break;
12670
+ }
12671
+ return ok ? null : "hides_field";
12672
+ }
12673
+ function selectorProblem(selector) {
12674
+ if (!selector || !/^[a-z0-9\-_#.:,> ]+$/.test(selector) || selector.includes("::"))
12675
+ return "selector";
12676
+ const pseudoOk = selector.split(":").slice(1).every((after) => PSEUDO_CLASSES.includes(after.split(/[ >,.#]/)[0] ?? after));
12677
+ return pseudoOk ? null : "selector";
12678
+ }
12679
+ function enigmaCustomCssProblem(css) {
12680
+ if (!css.trim()) return null;
12681
+ if (css.length > ENIGMA_CUSTOM_CSS_MAX_LENGTH) return "too_long";
12682
+ if (/[^\x20-\x7e\n\r\t]/.test(css)) return "not_ascii";
12683
+ if (css.includes("<")) return "markup";
12684
+ if (css.includes("\\")) return "escape";
12685
+ const lower = css.toLowerCase();
12686
+ if (lower.includes("/*")) return "comment";
12687
+ if (["url(", "image-set(", "image(", "element(", "cross-fade(", "src(", "data:"].some(
12688
+ (needle) => lower.includes(needle)
12689
+ )) {
12690
+ return "loads_resource";
12691
+ }
12692
+ if (["expression(", "javascript:", "behavior", "-moz-binding"].some(
12693
+ (needle) => lower.includes(needle)
12694
+ )) {
12695
+ return "script";
12696
+ }
12697
+ if (/@(?!media)/.test(lower)) return "at_rule";
12698
+ const compact = lower.split(/\s+/).filter(Boolean).join(" ");
12699
+ const blocks = [];
12700
+ let text = "";
12701
+ for (const ch of compact) {
12702
+ if (ch === "{") {
12703
+ const prelude = text.trim();
12704
+ text = "";
12705
+ const media = prelude.startsWith("@media");
12706
+ if (!media) {
12707
+ const problem = selectorProblem(prelude.replace(/, /g, ","));
12708
+ if (problem) return problem;
12709
+ }
12710
+ blocks.push({ selector: prelude, media });
12711
+ } else if (ch === "}" || ch === ";") {
12712
+ const declaration = text;
12713
+ text = "";
12714
+ const top = blocks[blocks.length - 1];
12715
+ if (!top) {
12716
+ if (ch === "}") return "unbalanced";
12717
+ continue;
12718
+ }
12719
+ if (!top.media && declaration.trim()) {
12720
+ const problem = declarationProblem(top.selector.replace(/, /g, ","), declaration);
12721
+ if (problem) return problem;
12722
+ }
12723
+ if (ch === "}") blocks.pop();
12724
+ } else {
12725
+ text += ch;
12726
+ }
12727
+ }
12728
+ return blocks.length > 0 ? "unbalanced" : null;
12729
+ }
12730
+ function enigmaCornerPx(corner) {
12731
+ return { square: 0, small: 6, medium: 8, large: 12, pill: 22 }[corner];
12732
+ }
12733
+ var HEX = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/;
12734
+ function pick(value, allowed, fallback) {
12735
+ return typeof value === "string" && allowed.includes(value) ? value : fallback;
12736
+ }
12737
+ function bool(value, fallback) {
12738
+ if (value === true || value === "true") return true;
12739
+ if (value === false || value === "false") return false;
12740
+ return fallback;
12741
+ }
12742
+ function hexOrEmpty(value) {
12743
+ return typeof value === "string" && HEX.test(value.trim()) ? value.trim() : "";
12744
+ }
12745
+ function decodeEnigmaCardForm(source) {
12746
+ const d = DEFAULT_ENIGMA_CARD_FORM;
12747
+ const height = Number(source["enigmaCustomHeight"]);
12748
+ const css = typeof source["enigmaCustomCss"] === "string" ? source["enigmaCustomCss"] : "";
12749
+ return {
12750
+ enigmaTemplate: pick(source["enigmaTemplate"], ENIGMA_TEMPLATES, d.enigmaTemplate),
12751
+ enigmaStyleMode: pick(source["enigmaStyleMode"], ENIGMA_STYLE_MODES, d.enigmaStyleMode),
12752
+ enigmaChrome: pick(source["enigmaChrome"], ENIGMA_FIELD_CHROMES, d.enigmaChrome),
12753
+ enigmaLabels: pick(source["enigmaLabels"], ENIGMA_LABEL_PLACEMENTS, d.enigmaLabels),
12754
+ enigmaLabelTone: pick(source["enigmaLabelTone"], ENIGMA_LABEL_TONES, d.enigmaLabelTone),
12755
+ enigmaHints: bool(source["enigmaHints"], d.enigmaHints),
12756
+ enigmaCvcIcon: bool(source["enigmaCvcIcon"], d.enigmaCvcIcon),
12757
+ enigmaFieldOrder: pick(source["enigmaFieldOrder"], ENIGMA_FIELD_ORDERS, d.enigmaFieldOrder),
12758
+ enigmaMarks: pick(source["enigmaMarks"], ENIGMA_NETWORK_MARKS, d.enigmaMarks),
12759
+ enigmaFocusRing: pick(source["enigmaFocusRing"], ENIGMA_FOCUS_RINGS, d.enigmaFocusRing),
12760
+ enigmaFieldMotion: pick(source["enigmaFieldMotion"], ENIGMA_FIELD_MOTIONS, d.enigmaFieldMotion),
12761
+ enigmaFieldHeight: pick(
12762
+ String(source["enigmaFieldHeight"] ?? ""),
12763
+ ENIGMA_FIELD_HEIGHTS,
12764
+ d.enigmaFieldHeight
12765
+ ),
12766
+ enigmaRowGap: pick(String(source["enigmaRowGap"] ?? ""), ENIGMA_ROW_GAPS, d.enigmaRowGap),
12767
+ enigmaCorner: pick(source["enigmaCorner"], ENIGMA_CORNERS, d.enigmaCorner),
12768
+ enigmaAccent: hexOrEmpty(source["enigmaAccent"]),
12769
+ enigmaBorder: hexOrEmpty(source["enigmaBorder"]),
12770
+ enigmaFill: hexOrEmpty(source["enigmaFill"]),
12771
+ enigmaTrustLine: bool(source["enigmaTrustLine"], d.enigmaTrustLine),
12772
+ enigmaAutoOpen: bool(source["enigmaAutoOpen"], d.enigmaAutoOpen),
12773
+ enigmaOpening: pick(source["enigmaOpening"], ENIGMA_OPENINGS, d.enigmaOpening),
12774
+ enigmaClickFeedback: pick(
12775
+ source["enigmaClickFeedback"],
12776
+ ENIGMA_CLICK_FEEDBACK,
12777
+ d.enigmaClickFeedback
12778
+ ),
12779
+ enigmaLoading: pick(source["enigmaLoading"], ENIGMA_LOADING_STYLES, d.enigmaLoading),
12780
+ enigmaReveal: pick(source["enigmaReveal"], ENIGMA_REVEALS, d.enigmaReveal),
12781
+ enigmaPayFeedback: pick(source["enigmaPayFeedback"], ENIGMA_PAY_FEEDBACK, d.enigmaPayFeedback),
12782
+ enigmaCustomCss: css.slice(0, ENIGMA_CUSTOM_CSS_MAX_LENGTH),
12783
+ enigmaCustomHeight: Number.isInteger(height) && height >= ENIGMA_CUSTOM_HEIGHT_MIN && height <= ENIGMA_CUSTOM_HEIGHT_MAX ? height : d.enigmaCustomHeight
12784
+ };
12785
+ }
12786
+ function encodeEnigmaCardForm(settings) {
12787
+ const out = {};
12788
+ for (const key of Object.keys(DEFAULT_ENIGMA_CARD_FORM)) {
12789
+ const value = settings[key];
12790
+ if (value === DEFAULT_ENIGMA_CARD_FORM[key]) continue;
12791
+ const text = String(value);
12792
+ if (key === "enigmaCustomCss" && !text.trim()) continue;
12793
+ out[key] = text;
12794
+ }
12795
+ return out;
12796
+ }
12797
+
12235
12798
  // src/branding.ts
12236
12799
  function surchargeShowsLabel(labelMode, style, position) {
12237
12800
  if (labelMode !== "labelled") return false;
@@ -12505,18 +13068,48 @@ function inputPadValue(size) {
12505
13068
  function buttonPadValue(size) {
12506
13069
  return BUTTON_PAD[size] ?? BUTTON_PAD.md;
12507
13070
  }
12508
- function vaultFormAppearance(b, danger) {
12509
- return {
13071
+ function vaultFormAppearance(b, danger, options = {}) {
13072
+ const border = b.enigmaBorder || b.border;
13073
+ const look = {
12510
13074
  surface: b.surface,
12511
13075
  text: b.text,
12512
- border: b.border,
12513
- accent: b.primary,
13076
+ border,
13077
+ accent: b.enigmaAccent || b.primary,
12514
13078
  ...danger ? { danger } : {},
12515
13079
  font: b.fontFamily,
12516
13080
  radius: b.radiusInput,
12517
13081
  size: b.inputSize,
12518
13082
  labels: b.labelStyle
12519
13083
  };
13084
+ if (!options.designed) return look;
13085
+ return {
13086
+ ...look,
13087
+ chrome: b.enigmaChrome,
13088
+ label: enigmaNamesInside(b) ? "inside" : "above",
13089
+ hints: b.enigmaHints,
13090
+ order: b.enigmaFieldOrder,
13091
+ marks: b.enigmaMarks,
13092
+ focus: b.enigmaFocusRing,
13093
+ motion: b.enigmaFieldMotion,
13094
+ height: b.enigmaFieldHeight,
13095
+ gap: b.enigmaRowGap,
13096
+ corner: b.enigmaCorner,
13097
+ fill: b.enigmaFill || enigmaDefaultFill(b.surface, b.text),
13098
+ ...b.enigmaStyleMode === "custom" ? { custom: true } : {}
13099
+ };
13100
+ }
13101
+ function enigmaDefaultFill(surface, text) {
13102
+ const channels = (hex) => {
13103
+ const v = hex.trim().replace("#", "");
13104
+ const full = v.length === 3 ? v.replace(/./g, "$&$&") : v;
13105
+ if (!/^[0-9a-fA-F]{6}$/.test(full)) return null;
13106
+ return [0, 2, 4].map((i) => parseInt(full.slice(i, i + 2), 16));
13107
+ };
13108
+ const s2 = channels(surface) ?? [255, 255, 255];
13109
+ const t = channels(text) ?? [30, 41, 59];
13110
+ return `#${s2.map(
13111
+ (value, i) => Math.round(value * 0.94 + (t[i] ?? 0) * 0.06).toString(16).padStart(2, "0")
13112
+ ).join("")}`;
12520
13113
  }
12521
13114
  function logoDimensions(size) {
12522
13115
  switch (size) {
@@ -13018,7 +13611,9 @@ var DEFAULT_BRANDING_BASE = {
13018
13611
  whopShadow: "soft",
13019
13612
  whopMethodIcons: true,
13020
13613
  whopSelection: "radio_tint",
13021
- customCss: ""
13614
+ customCss: "",
13615
+ // The Enigma Vault card form: the Stripe-like template.
13616
+ ...DEFAULT_ENIGMA_CARD_FORM
13022
13617
  };
13023
13618
  var DEFAULT_BRANDING = {
13024
13619
  ...DEFAULT_BRANDING_BASE,
@@ -14128,7 +14723,8 @@ function decodeBranding(source) {
14128
14723
  GOOGLE_PAY_BUTTON_TYPES,
14129
14724
  DEFAULT_BRANDING.nomupayGooglePayButtonType
14130
14725
  ),
14131
- customCss: s(extras["customCss"])
14726
+ customCss: s(extras["customCss"]),
14727
+ ...decodeEnigmaCardForm(extras)
14132
14728
  };
14133
14729
  }
14134
14730
  function encodeBranding(branding, base) {
@@ -14290,6 +14886,7 @@ function encodeBranding(branding, base) {
14290
14886
  if (support) extras["supportEmail"] = support;
14291
14887
  const css = trim(branding.customCss);
14292
14888
  if (css) extras["customCss"] = css;
14889
+ Object.assign(extras, encodeEnigmaCardForm(branding));
14293
14890
  const nextRules = {
14294
14891
  ...existingRules,
14295
14892
  [BRANDING_GROUP_KEY]: extras
@@ -14810,7 +15407,8 @@ function parseImportedBranding(raw) {
14810
15407
  GOOGLE_PAY_BUTTON_TYPES,
14811
15408
  dflt.nomupayGooglePayButtonType
14812
15409
  ),
14813
- customCss: sStr(root["customCss"], dflt.customCss).slice(0, CUSTOM_CSS_MAX_LENGTH)
15410
+ customCss: sStr(root["customCss"], dflt.customCss).slice(0, CUSTOM_CSS_MAX_LENGTH),
15411
+ ...decodeEnigmaCardForm(root)
14814
15412
  };
14815
15413
  }
14816
15414
  function isObject(v) {
@@ -14903,7 +15501,19 @@ function vaultFormQuery(params) {
14903
15501
  form_font: look?.font,
14904
15502
  form_radius: look?.radius,
14905
15503
  form_size: look?.size,
14906
- form_labels: look?.labels
15504
+ form_labels: look?.labels,
15505
+ form_chrome: look?.chrome,
15506
+ form_label: look?.label,
15507
+ form_hints: look?.hints === void 0 ? void 0 : String(look.hints),
15508
+ form_order: look?.order,
15509
+ form_marks: look?.marks,
15510
+ form_focus: look?.focus,
15511
+ form_motion: look?.motion,
15512
+ form_height: look?.height,
15513
+ form_gap: look?.gap,
15514
+ form_corner: look?.corner,
15515
+ form_fill: look?.fill,
15516
+ form_custom: look?.custom ? "true" : void 0
14907
15517
  };
14908
15518
  }
14909
15519
  function withoutHeader(headers, name) {
@@ -16827,6 +17437,26 @@ var AdminPortal = class {
16827
17437
  query: params
16828
17438
  });
16829
17439
  }
17440
+ /** Chargeback prevention connections across merchants, or of one merchant. */
17441
+ async listChargebackPreventionConnections(params) {
17442
+ return this.request("GET", "/admin-portal/chargeback-prevention/connections", {
17443
+ query: params
17444
+ });
17445
+ }
17446
+ /** Chargeback prevention cases across merchants, or of one merchant. */
17447
+ async listChargebackPreventionCases(params) {
17448
+ const { merchant_id, ...filters } = params ?? {};
17449
+ return this.request("GET", "/admin-portal/chargeback-prevention/cases", {
17450
+ query: { ...preventionCaseQuery(filters), ...merchant_id ? { merchant_id } : {} }
17451
+ });
17452
+ }
17453
+ /** One chargeback prevention case of any merchant, with its history. */
17454
+ async getChargebackPreventionCase(caseId) {
17455
+ return this.request(
17456
+ "GET",
17457
+ `/admin-portal/chargeback-prevention/cases/${encodeURIComponent(caseId)}`
17458
+ );
17459
+ }
16830
17460
  /** One case's evidence with every step and file, internal ones included. */
16831
17461
  async getBuyerEvidence(evidenceId) {
16832
17462
  return this.request("GET", `/admin-portal/buyer-evidence/${encodeURIComponent(evidenceId)}`);
@@ -17455,7 +18085,8 @@ var AdminPortal = class {
17455
18085
  {
17456
18086
  query: {
17457
18087
  currency: params?.currency,
17458
- include_transactions: params?.include_transactions
18088
+ include_transactions: params?.include_transactions,
18089
+ format: params?.format
17459
18090
  },
17460
18091
  responseType: "blob",
17461
18092
  ...options
@@ -18641,6 +19272,7 @@ var DelopayInternal = class extends Delopay {
18641
19272
  Cache,
18642
19273
  CardIssuers,
18643
19274
  Cards,
19275
+ ChargebackPrevention,
18644
19276
  CheckoutMethods,
18645
19277
  CheckoutRecovery,
18646
19278
  CheckoutSession,
@@ -18653,12 +19285,35 @@ var DelopayInternal = class extends Delopay {
18653
19285
  DEFAULT_BADGES_DARK,
18654
19286
  DEFAULT_BRANDING,
18655
19287
  DEFAULT_BRANDING_DARK,
19288
+ DEFAULT_ENIGMA_CARD_FORM,
18656
19289
  DEFAULT_NOTICES,
18657
19290
  Delopay,
18658
19291
  DelopayAuthenticationError,
18659
19292
  DelopayError,
18660
19293
  DelopayInternal,
18661
19294
  Diagnostic,
19295
+ ENIGMA_CLICK_FEEDBACK,
19296
+ ENIGMA_CORNERS,
19297
+ ENIGMA_CUSTOM_CSS_MAX_LENGTH,
19298
+ ENIGMA_CUSTOM_HEIGHT_DEFAULT,
19299
+ ENIGMA_CUSTOM_HEIGHT_MAX,
19300
+ ENIGMA_CUSTOM_HEIGHT_MIN,
19301
+ ENIGMA_FIELD_CHROMES,
19302
+ ENIGMA_FIELD_HEIGHTS,
19303
+ ENIGMA_FIELD_MOTIONS,
19304
+ ENIGMA_FIELD_ORDERS,
19305
+ ENIGMA_FOCUS_RINGS,
19306
+ ENIGMA_LABEL_PLACEMENTS,
19307
+ ENIGMA_LABEL_TONES,
19308
+ ENIGMA_LOADING_STYLES,
19309
+ ENIGMA_NETWORK_MARKS,
19310
+ ENIGMA_OPENINGS,
19311
+ ENIGMA_PAY_FEEDBACK,
19312
+ ENIGMA_REVEALS,
19313
+ ENIGMA_ROW_GAPS,
19314
+ ENIGMA_STYLE_MODES,
19315
+ ENIGMA_TEMPLATES,
19316
+ ENIGMA_TEMPLATE_PRESETS,
18662
19317
  Export,
18663
19318
  ExternalRecords,
18664
19319
  FeatureMatrix,
@@ -18758,6 +19413,7 @@ var DelopayInternal = class extends Delopay {
18758
19413
  allOf,
18759
19414
  anyOf,
18760
19415
  applyBrandingVariables,
19416
+ applyEnigmaTemplate,
18761
19417
  asAirwallexCardPreset,
18762
19418
  brandingAssetPath,
18763
19419
  buildBrandingExport,
@@ -18786,6 +19442,7 @@ var DelopayInternal = class extends Delopay {
18786
19442
  decodeBadges,
18787
19443
  decodeBranding,
18788
19444
  decodeCustomFields,
19445
+ decodeEnigmaCardForm,
18789
19446
  decodeMethodSectionLabels,
18790
19447
  decodeMethodSectionOrder,
18791
19448
  decodeNativePanes,
@@ -18802,11 +19459,17 @@ var DelopayInternal = class extends Delopay {
18802
19459
  encodeBadges,
18803
19460
  encodeBranding,
18804
19461
  encodeCustomFields,
19462
+ encodeEnigmaCardForm,
18805
19463
  encodeMethodSectionLabels,
18806
19464
  encodeMethodSectionOrder,
18807
19465
  encodeNativePanes,
18808
19466
  encodeNotices,
18809
19467
  encodePanes,
19468
+ enigmaCornerPx,
19469
+ enigmaCustomCssProblem,
19470
+ enigmaDefaultFill,
19471
+ enigmaNamesInside,
19472
+ enigmaTemplateChanges,
18810
19473
  evaluateCustomFieldCondition,
18811
19474
  evaluateCustomFieldVisibility,
18812
19475
  feeProgram,