@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/index.cjs CHANGED
@@ -61,6 +61,7 @@ __export(index_exports, {
61
61
  CUSTOM_FIELD_OPERATORS_BY_SOURCE: () => CUSTOM_FIELD_OPERATORS_BY_SOURCE,
62
62
  CUSTOM_FIELD_VALUELESS_OPERATORS: () => CUSTOM_FIELD_VALUELESS_OPERATORS,
63
63
  Cards: () => Cards,
64
+ ChargebackPrevention: () => ChargebackPrevention,
64
65
  CheckoutMethods: () => CheckoutMethods,
65
66
  CheckoutRecovery: () => CheckoutRecovery,
66
67
  CheckoutSession: () => CheckoutSession,
@@ -70,10 +71,33 @@ __export(index_exports, {
70
71
  DEFAULT_BADGES_DARK: () => DEFAULT_BADGES_DARK,
71
72
  DEFAULT_BRANDING: () => DEFAULT_BRANDING,
72
73
  DEFAULT_BRANDING_DARK: () => DEFAULT_BRANDING_DARK,
74
+ DEFAULT_ENIGMA_CARD_FORM: () => DEFAULT_ENIGMA_CARD_FORM,
73
75
  DEFAULT_NOTICES: () => DEFAULT_NOTICES,
74
76
  Delopay: () => Delopay,
75
77
  DelopayAuthenticationError: () => DelopayAuthenticationError,
76
78
  DelopayError: () => DelopayError,
79
+ ENIGMA_CLICK_FEEDBACK: () => ENIGMA_CLICK_FEEDBACK,
80
+ ENIGMA_CORNERS: () => ENIGMA_CORNERS,
81
+ ENIGMA_CUSTOM_CSS_MAX_LENGTH: () => ENIGMA_CUSTOM_CSS_MAX_LENGTH,
82
+ ENIGMA_CUSTOM_HEIGHT_DEFAULT: () => ENIGMA_CUSTOM_HEIGHT_DEFAULT,
83
+ ENIGMA_CUSTOM_HEIGHT_MAX: () => ENIGMA_CUSTOM_HEIGHT_MAX,
84
+ ENIGMA_CUSTOM_HEIGHT_MIN: () => ENIGMA_CUSTOM_HEIGHT_MIN,
85
+ ENIGMA_FIELD_CHROMES: () => ENIGMA_FIELD_CHROMES,
86
+ ENIGMA_FIELD_HEIGHTS: () => ENIGMA_FIELD_HEIGHTS,
87
+ ENIGMA_FIELD_MOTIONS: () => ENIGMA_FIELD_MOTIONS,
88
+ ENIGMA_FIELD_ORDERS: () => ENIGMA_FIELD_ORDERS,
89
+ ENIGMA_FOCUS_RINGS: () => ENIGMA_FOCUS_RINGS,
90
+ ENIGMA_LABEL_PLACEMENTS: () => ENIGMA_LABEL_PLACEMENTS,
91
+ ENIGMA_LABEL_TONES: () => ENIGMA_LABEL_TONES,
92
+ ENIGMA_LOADING_STYLES: () => ENIGMA_LOADING_STYLES,
93
+ ENIGMA_NETWORK_MARKS: () => ENIGMA_NETWORK_MARKS,
94
+ ENIGMA_OPENINGS: () => ENIGMA_OPENINGS,
95
+ ENIGMA_PAY_FEEDBACK: () => ENIGMA_PAY_FEEDBACK,
96
+ ENIGMA_REVEALS: () => ENIGMA_REVEALS,
97
+ ENIGMA_ROW_GAPS: () => ENIGMA_ROW_GAPS,
98
+ ENIGMA_STYLE_MODES: () => ENIGMA_STYLE_MODES,
99
+ ENIGMA_TEMPLATES: () => ENIGMA_TEMPLATES,
100
+ ENIGMA_TEMPLATE_PRESETS: () => ENIGMA_TEMPLATE_PRESETS,
77
101
  Export: () => Export,
78
102
  ExternalRecords: () => ExternalRecords,
79
103
  FeatureMatrix: () => FeatureMatrix,
@@ -167,6 +191,7 @@ __export(index_exports, {
167
191
  allOf: () => allOf,
168
192
  anyOf: () => anyOf,
169
193
  applyBrandingVariables: () => applyBrandingVariables,
194
+ applyEnigmaTemplate: () => applyEnigmaTemplate,
170
195
  asAirwallexCardPreset: () => asAirwallexCardPreset,
171
196
  brandingAssetPath: () => brandingAssetPath,
172
197
  buildBrandingExport: () => buildBrandingExport,
@@ -195,6 +220,7 @@ __export(index_exports, {
195
220
  decodeBadges: () => decodeBadges,
196
221
  decodeBranding: () => decodeBranding,
197
222
  decodeCustomFields: () => decodeCustomFields,
223
+ decodeEnigmaCardForm: () => decodeEnigmaCardForm,
198
224
  decodeMethodSectionLabels: () => decodeMethodSectionLabels,
199
225
  decodeMethodSectionOrder: () => decodeMethodSectionOrder,
200
226
  decodeNativePanes: () => decodeNativePanes,
@@ -211,11 +237,17 @@ __export(index_exports, {
211
237
  encodeBadges: () => encodeBadges,
212
238
  encodeBranding: () => encodeBranding,
213
239
  encodeCustomFields: () => encodeCustomFields,
240
+ encodeEnigmaCardForm: () => encodeEnigmaCardForm,
214
241
  encodeMethodSectionLabels: () => encodeMethodSectionLabels,
215
242
  encodeMethodSectionOrder: () => encodeMethodSectionOrder,
216
243
  encodeNativePanes: () => encodeNativePanes,
217
244
  encodeNotices: () => encodeNotices,
218
245
  encodePanes: () => encodePanes,
246
+ enigmaCornerPx: () => enigmaCornerPx,
247
+ enigmaCustomCssProblem: () => enigmaCustomCssProblem,
248
+ enigmaDefaultFill: () => enigmaDefaultFill,
249
+ enigmaNamesInside: () => enigmaNamesInside,
250
+ enigmaTemplateChanges: () => enigmaTemplateChanges,
219
251
  evaluateCustomFieldCondition: () => evaluateCustomFieldCondition,
220
252
  evaluateCustomFieldVisibility: () => evaluateCustomFieldVisibility,
221
253
  feeProgram: () => feeProgram,
@@ -2250,6 +2282,77 @@ var Disputes = class {
2250
2282
  }
2251
2283
  };
2252
2284
 
2285
+ // src/resources/chargebackPrevention.ts
2286
+ function preventionCaseQuery(params) {
2287
+ if (!params) return void 0;
2288
+ const { provider, source, status, outcome, match_status, ...query } = params;
2289
+ return {
2290
+ ...query,
2291
+ ...provider?.length ? { provider: provider.join(",") } : {},
2292
+ ...source?.length ? { source: source.join(",") } : {},
2293
+ ...status?.length ? { status: status.join(",") } : {},
2294
+ ...outcome?.length ? { outcome: outcome.join(",") } : {},
2295
+ ...match_status?.length ? { match_status: match_status.join(",") } : {}
2296
+ };
2297
+ }
2298
+ var ChargebackPrevention = class {
2299
+ constructor(request) {
2300
+ this.request = request;
2301
+ }
2302
+ /** The merchant's connections, with their business accounts and sync health. */
2303
+ async listConnections() {
2304
+ return this.request("GET", "/chargeback-prevention/connections");
2305
+ }
2306
+ /**
2307
+ * Connect a provider account. DeloPay checks the key with the provider,
2308
+ * registers its webhooks there and starts reading alerts. Dashboard session
2309
+ * only.
2310
+ */
2311
+ async connect(params) {
2312
+ return this.request("POST", "/chargeback-prevention/connections", { body: params });
2313
+ }
2314
+ /** Replace a connection's key; reconnects one whose key was refused. */
2315
+ async replaceKey(connectionId, params) {
2316
+ return this.request(
2317
+ "PUT",
2318
+ `/chargeback-prevention/connections/${encodeURIComponent(connectionId)}/key`,
2319
+ { body: params }
2320
+ );
2321
+ }
2322
+ /** Stop reading a connection. Its cases are kept. */
2323
+ async disconnect(connectionId) {
2324
+ return this.request(
2325
+ "DELETE",
2326
+ `/chargeback-prevention/connections/${encodeURIComponent(connectionId)}`
2327
+ );
2328
+ }
2329
+ /** Read the connection's alerts again as soon as the provider allows. */
2330
+ async syncNow(connectionId) {
2331
+ return this.request(
2332
+ "POST",
2333
+ `/chargeback-prevention/connections/${encodeURIComponent(connectionId)}/sync`
2334
+ );
2335
+ }
2336
+ /** Set the shops a provider business account sells through; its cases are matched again. */
2337
+ async mapAccount(connectionId, providerAccountId, params) {
2338
+ return this.request(
2339
+ "PUT",
2340
+ `/chargeback-prevention/connections/${encodeURIComponent(connectionId)}/accounts/${encodeURIComponent(providerAccountId)}`,
2341
+ { body: params }
2342
+ );
2343
+ }
2344
+ /** Cases with what DeloPay's records say happened to each payment. */
2345
+ async listCases(params) {
2346
+ return this.request("GET", "/chargeback-prevention/cases", {
2347
+ query: preventionCaseQuery(params)
2348
+ });
2349
+ }
2350
+ /** One case with its references and observed history. */
2351
+ async retrieveCase(caseId) {
2352
+ return this.request("GET", `/chargeback-prevention/cases/${encodeURIComponent(caseId)}`);
2353
+ }
2354
+ };
2355
+
2253
2356
  // src/resources/paypalDisputes.ts
2254
2357
  var PaypalDisputes = class {
2255
2358
  constructor(request) {
@@ -4489,7 +4592,12 @@ var Routing = class {
4489
4592
  async getDefaultForProfile(profileId) {
4490
4593
  return this.request("GET", `/routing/default/profile/${encodeURIComponent(profileId)}`);
4491
4594
  }
4492
- /** Update default config for a profile. `POST /routing/default/profile/{profileId}` */
4595
+ /**
4596
+ * Update default config for a profile. `POST /routing/default/profile/{profileId}`
4597
+ *
4598
+ * Send the list alone to keep the shop's fallback mode, or `{ connectors, mode, splits }` to set
4599
+ * it. A `volume_split` whose shares do not total 100 is refused.
4600
+ */
4493
4601
  async updateDefaultProfile(profileId, params, options) {
4494
4602
  return this.request("POST", `/routing/default/profile/${encodeURIComponent(profileId)}`, {
4495
4603
  body: params,
@@ -10002,7 +10110,8 @@ var Settlement = class {
10002
10110
  });
10003
10111
  }
10004
10112
  /**
10005
- * Export a statement as PDF. Returns the raw PDF bytes as a `Blob`, with
10113
+ * Export a statement as PDF, or with `format` as CSV, JSON
10114
+ * (`StatementDocument`) or XLSX. Returns the raw bytes as a `Blob`, with
10006
10115
  * the same auth, retries and error handling as every other call — persist
10007
10116
  * or object-URL it caller-side.
10008
10117
  *
@@ -10021,7 +10130,8 @@ var Settlement = class {
10021
10130
  return this.request("GET", `/settlement/statements/${encodeURIComponent(statementId)}/pdf`, {
10022
10131
  query: {
10023
10132
  currency: params?.currency,
10024
- include_transactions: params?.include_transactions
10133
+ include_transactions: params?.include_transactions,
10134
+ format: params?.format
10025
10135
  },
10026
10136
  responseType: "blob",
10027
10137
  ...options
@@ -10285,7 +10395,21 @@ var OperationLimits = class {
10285
10395
  */
10286
10396
  async retrieveUsage(params, options) {
10287
10397
  return this.request("GET", "/operation-limits/usage", {
10288
- query: { operation: params.operation },
10398
+ query: { operation: params.operation, profile_id: params.profile_id },
10399
+ ...options
10400
+ });
10401
+ }
10402
+ /**
10403
+ * The version history of the merchant's limit settings, newest first: every
10404
+ * rule created, changed (switched off or on included) or deleted, and every
10405
+ * settings change, with who made it (and who really did, under act-as) and
10406
+ * the values before and after.
10407
+ *
10408
+ * `GET /operation-limits/history`
10409
+ */
10410
+ async listHistory(params, options) {
10411
+ return this.request("GET", "/operation-limits/history", {
10412
+ query: { limit: params?.limit, before: params?.before },
10289
10413
  ...options
10290
10414
  });
10291
10415
  }
@@ -11087,6 +11211,7 @@ var Delopay = class {
11087
11211
  this.paymentLinks = new PaymentLinks(request);
11088
11212
  this.mandates = new Mandates(request);
11089
11213
  this.disputes = new Disputes(request);
11214
+ this.chargebackPrevention = new ChargebackPrevention(request);
11090
11215
  this.paypalDisputes = new PaypalDisputes(request);
11091
11216
  this.whopResolutionCases = new WhopResolutionCases(request);
11092
11217
  this.payouts = new Payouts(request);
@@ -11932,9 +12057,9 @@ function resolveStripeTheme(theme, dark) {
11932
12057
  var STRIPE_INPUT_STYLES = ["spaced", "condensed"];
11933
12058
  var STRIPE_LABEL_PLACEMENTS = ["above", "floating"];
11934
12059
  var STRIPE_SPACINGS = ["compact", "comfortable", "spacious"];
11935
- function stripeSpacingValues(spacing) {
11936
- if (spacing === "compact") return { spacingUnit: "3px", gridRowSpacing: "8px" };
11937
- if (spacing === "spacious") return { spacingUnit: "5px", gridRowSpacing: "16px" };
12060
+ function stripeSpacingValues(spacing2) {
12061
+ if (spacing2 === "compact") return { spacingUnit: "3px", gridRowSpacing: "8px" };
12062
+ if (spacing2 === "spacious") return { spacingUnit: "5px", gridRowSpacing: "16px" };
11938
12063
  return { spacingUnit: "4px", gridRowSpacing: "12px" };
11939
12064
  }
11940
12065
  var PAYPAL_CARD_LAYOUTS = ["split", "stacked"];
@@ -12214,6 +12339,444 @@ function matchWhopLook(settings) {
12214
12339
  ) ?? null;
12215
12340
  }
12216
12341
 
12342
+ // src/enigmaCardForm.ts
12343
+ var ENIGMA_FIELD_CHROMES = ["outlined", "filled", "underline", "joined"];
12344
+ var ENIGMA_LABEL_PLACEMENTS = ["above", "inside"];
12345
+ var ENIGMA_LABEL_TONES = ["strong", "muted"];
12346
+ var ENIGMA_FIELD_ORDERS = ["number", "name"];
12347
+ var ENIGMA_NETWORK_MARKS = ["live", "static", "hidden"];
12348
+ var ENIGMA_FOCUS_RINGS = ["strong", "subtle"];
12349
+ var ENIGMA_FIELD_MOTIONS = ["smooth", "slow", "none"];
12350
+ var ENIGMA_FIELD_HEIGHTS = ["40", "44", "48", "52"];
12351
+ var ENIGMA_ROW_GAPS = ["8", "12", "16"];
12352
+ var ENIGMA_CORNERS = ["square", "small", "medium", "large", "pill"];
12353
+ var ENIGMA_STYLE_MODES = ["designed", "custom"];
12354
+ var ENIGMA_OPENINGS = ["place", "expand"];
12355
+ var ENIGMA_CLICK_FEEDBACK = ["both", "ring", "press", "none"];
12356
+ var ENIGMA_LOADING_STYLES = [
12357
+ "shimmer",
12358
+ "pulse",
12359
+ "dim",
12360
+ "line",
12361
+ "spinner",
12362
+ "none"
12363
+ ];
12364
+ var ENIGMA_REVEALS = ["fade", "rise", "wipe", "none"];
12365
+ var ENIGMA_PAY_FEEDBACK = ["spinner", "press", "none"];
12366
+ var ENIGMA_TEMPLATES = [
12367
+ "soft",
12368
+ "fields",
12369
+ "classic",
12370
+ "compact",
12371
+ "filled",
12372
+ "underline"
12373
+ ];
12374
+ var ENIGMA_CUSTOM_CSS_MAX_LENGTH = 950;
12375
+ var ENIGMA_CUSTOM_HEIGHT_MIN = 120;
12376
+ var ENIGMA_CUSTOM_HEIGHT_MAX = 600;
12377
+ var ENIGMA_CUSTOM_HEIGHT_DEFAULT = 260;
12378
+ var ENIGMA_TEMPLATE_PRESETS = {
12379
+ soft: {
12380
+ enigmaChrome: "outlined",
12381
+ enigmaLabels: "above",
12382
+ enigmaLabelTone: "strong",
12383
+ enigmaHints: true,
12384
+ enigmaCvcIcon: true,
12385
+ enigmaFieldOrder: "number",
12386
+ enigmaMarks: "live",
12387
+ enigmaFocusRing: "strong",
12388
+ enigmaFieldHeight: "44",
12389
+ enigmaRowGap: "12",
12390
+ enigmaCorner: "medium"
12391
+ },
12392
+ fields: {
12393
+ enigmaChrome: "outlined",
12394
+ enigmaLabels: "above",
12395
+ enigmaLabelTone: "muted",
12396
+ enigmaHints: true,
12397
+ enigmaCvcIcon: true,
12398
+ enigmaFieldOrder: "number",
12399
+ enigmaMarks: "live",
12400
+ enigmaFocusRing: "strong",
12401
+ enigmaFieldHeight: "48",
12402
+ enigmaRowGap: "12",
12403
+ enigmaCorner: "small"
12404
+ },
12405
+ classic: {
12406
+ enigmaChrome: "outlined",
12407
+ enigmaLabels: "above",
12408
+ enigmaLabelTone: "strong",
12409
+ enigmaHints: false,
12410
+ enigmaCvcIcon: true,
12411
+ enigmaFieldOrder: "number",
12412
+ enigmaMarks: "live",
12413
+ enigmaFocusRing: "strong",
12414
+ enigmaFieldHeight: "44",
12415
+ enigmaRowGap: "12",
12416
+ enigmaCorner: "medium"
12417
+ },
12418
+ compact: {
12419
+ enigmaChrome: "joined",
12420
+ enigmaLabels: "inside",
12421
+ enigmaLabelTone: "muted",
12422
+ enigmaHints: false,
12423
+ enigmaCvcIcon: true,
12424
+ enigmaFieldOrder: "number",
12425
+ enigmaMarks: "live",
12426
+ enigmaFocusRing: "strong",
12427
+ enigmaFieldHeight: "48",
12428
+ enigmaRowGap: "12",
12429
+ enigmaCorner: "medium"
12430
+ },
12431
+ filled: {
12432
+ enigmaChrome: "filled",
12433
+ enigmaLabels: "above",
12434
+ enigmaLabelTone: "strong",
12435
+ enigmaHints: false,
12436
+ enigmaCvcIcon: true,
12437
+ enigmaFieldOrder: "number",
12438
+ enigmaMarks: "live",
12439
+ enigmaFocusRing: "strong",
12440
+ enigmaFieldHeight: "44",
12441
+ enigmaRowGap: "12",
12442
+ enigmaCorner: "medium"
12443
+ },
12444
+ underline: {
12445
+ enigmaChrome: "underline",
12446
+ enigmaLabels: "above",
12447
+ enigmaLabelTone: "muted",
12448
+ enigmaHints: false,
12449
+ enigmaCvcIcon: true,
12450
+ enigmaFieldOrder: "number",
12451
+ enigmaMarks: "live",
12452
+ enigmaFocusRing: "strong",
12453
+ enigmaFieldHeight: "40",
12454
+ enigmaRowGap: "16",
12455
+ enigmaCorner: "square"
12456
+ }
12457
+ };
12458
+ var DEFAULT_ENIGMA_CARD_FORM = {
12459
+ enigmaTemplate: "soft",
12460
+ enigmaStyleMode: "designed",
12461
+ ...ENIGMA_TEMPLATE_PRESETS.soft,
12462
+ enigmaFieldMotion: "smooth",
12463
+ enigmaAccent: "",
12464
+ enigmaBorder: "",
12465
+ enigmaFill: "",
12466
+ enigmaTrustLine: true,
12467
+ enigmaAutoOpen: false,
12468
+ enigmaOpening: "place",
12469
+ enigmaClickFeedback: "both",
12470
+ enigmaLoading: "shimmer",
12471
+ enigmaReveal: "fade",
12472
+ enigmaPayFeedback: "spinner",
12473
+ enigmaCustomCss: "",
12474
+ enigmaCustomHeight: ENIGMA_CUSTOM_HEIGHT_DEFAULT
12475
+ };
12476
+ function applyEnigmaTemplate(template) {
12477
+ return { enigmaTemplate: template, ...ENIGMA_TEMPLATE_PRESETS[template] };
12478
+ }
12479
+ function enigmaTemplateChanges(settings) {
12480
+ const preset = ENIGMA_TEMPLATE_PRESETS[settings.enigmaTemplate];
12481
+ return Object.keys(preset).filter(
12482
+ (key) => settings[key] !== preset[key]
12483
+ );
12484
+ }
12485
+ function enigmaNamesInside(settings) {
12486
+ return settings.enigmaChrome === "joined" || settings.enigmaLabels === "inside";
12487
+ }
12488
+ var PSEUDO_CLASSES = [
12489
+ "focus",
12490
+ "focus-visible",
12491
+ "focus-within",
12492
+ "hover",
12493
+ "checked",
12494
+ "disabled",
12495
+ "invalid",
12496
+ "valid",
12497
+ "placeholder-shown",
12498
+ "first-child",
12499
+ "last-child"
12500
+ ];
12501
+ var HIDEABLE = ["p", "h1", "#header", "#headertext", ".timer", "#timer"];
12502
+ var PROPERTIES = [
12503
+ "color",
12504
+ "caret-color",
12505
+ "accent-color",
12506
+ "-webkit-text-fill-color",
12507
+ "background",
12508
+ "background-color",
12509
+ "border",
12510
+ "border-top",
12511
+ "border-right",
12512
+ "border-bottom",
12513
+ "border-left",
12514
+ "border-color",
12515
+ "border-width",
12516
+ "border-style",
12517
+ "border-top-color",
12518
+ "border-right-color",
12519
+ "border-bottom-color",
12520
+ "border-left-color",
12521
+ "border-top-width",
12522
+ "border-right-width",
12523
+ "border-bottom-width",
12524
+ "border-left-width",
12525
+ "border-radius",
12526
+ "border-top-left-radius",
12527
+ "border-top-right-radius",
12528
+ "border-bottom-left-radius",
12529
+ "border-bottom-right-radius",
12530
+ "box-shadow",
12531
+ "outline",
12532
+ "outline-color",
12533
+ "outline-offset",
12534
+ "font",
12535
+ "font-family",
12536
+ "font-size",
12537
+ "font-weight",
12538
+ "font-style",
12539
+ "letter-spacing",
12540
+ "line-height",
12541
+ "text-align",
12542
+ "text-transform",
12543
+ "padding",
12544
+ "padding-top",
12545
+ "padding-right",
12546
+ "padding-bottom",
12547
+ "padding-left",
12548
+ "margin",
12549
+ "margin-top",
12550
+ "margin-right",
12551
+ "margin-bottom",
12552
+ "margin-left",
12553
+ "height",
12554
+ "min-height",
12555
+ "width",
12556
+ "min-width",
12557
+ "max-width",
12558
+ "display",
12559
+ "flex-wrap",
12560
+ "gap",
12561
+ "transition",
12562
+ "box-sizing",
12563
+ "top"
12564
+ ];
12565
+ function lengthAtLeast(value, min) {
12566
+ const match = /^(-?[0-9.]+)(px|em|rem)$/.exec(value);
12567
+ if (!match) return false;
12568
+ const number = Number(match[1]) * (match[2] === "px" ? 1 : 16);
12569
+ return Number.isFinite(number) && number >= min;
12570
+ }
12571
+ function spacing(value) {
12572
+ return value.split(" ").every(
12573
+ (part) => part === "0" || part === "auto" || lengthAtLeast(part, 0) && !lengthAtLeast(part, 48.5)
12574
+ );
12575
+ }
12576
+ function width(value) {
12577
+ if (value === "auto") return true;
12578
+ if (value.endsWith("%")) return Number(value.slice(0, -1)) >= 20;
12579
+ const calc = /^calc\(([0-9.]+)% - ([0-9.]+)px\)$/.exec(value);
12580
+ if (calc) return Number(calc[1]) >= 20 && Number(calc[2]) <= 48;
12581
+ if (value.startsWith("calc(")) return false;
12582
+ return lengthAtLeast(value, 40);
12583
+ }
12584
+ function opaqueColour(value) {
12585
+ if (value.startsWith("#")) return /^#([0-9a-f]{3}|[0-9a-f]{6})$/.test(value);
12586
+ if (value.startsWith("rgb("))
12587
+ return value.endsWith(")") && value.split(",").length === 3 && !value.includes("/");
12588
+ return value !== "transparent" && /^[a-z]+$/.test(value);
12589
+ }
12590
+ function declarationProblem(selector, declaration) {
12591
+ const at = declaration.indexOf(":");
12592
+ if (at < 0) return null;
12593
+ const property = declaration.slice(0, at).trim();
12594
+ const raw = declaration.slice(at + 1).trim();
12595
+ const important = raw.endsWith("!important");
12596
+ const value = raw.replace(/!important$/, "").trim();
12597
+ if (!PROPERTIES.includes(property)) return "property";
12598
+ if (["var(", "env(", "attr("].some((fn) => value.includes(fn))) return "variable";
12599
+ let ok = true;
12600
+ switch (property) {
12601
+ case "display": {
12602
+ if (important) return "important_display";
12603
+ const hideable = selector.split(",").every((one) => {
12604
+ const subject = one.split(/[ >]/).pop() ?? one;
12605
+ return HIDEABLE.includes(subject.split(":")[0] ?? subject);
12606
+ });
12607
+ ok = ["block", "flex", "grid", "inline", "inline-block", "inline-flex"].includes(value) || value === "none" && hideable;
12608
+ break;
12609
+ }
12610
+ case "margin":
12611
+ case "margin-top":
12612
+ case "margin-right":
12613
+ case "margin-bottom":
12614
+ case "margin-left":
12615
+ case "padding":
12616
+ case "padding-top":
12617
+ case "padding-right":
12618
+ case "padding-bottom":
12619
+ case "padding-left":
12620
+ ok = spacing(value);
12621
+ break;
12622
+ case "height":
12623
+ case "min-height":
12624
+ ok = value === "auto" || lengthAtLeast(value, 20);
12625
+ break;
12626
+ case "width":
12627
+ case "min-width":
12628
+ case "max-width":
12629
+ ok = width(value);
12630
+ break;
12631
+ case "font-size":
12632
+ ok = lengthAtLeast(value, 12);
12633
+ break;
12634
+ case "font": {
12635
+ const size = value.split(/[ /]/).find((part) => part.endsWith("px") || part.endsWith("em"));
12636
+ ok = size !== void 0 && lengthAtLeast(size, 12);
12637
+ break;
12638
+ }
12639
+ case "line-height":
12640
+ ok = value === "normal" || Number(value) >= 1 || lengthAtLeast(value, 12);
12641
+ break;
12642
+ case "color":
12643
+ case "caret-color":
12644
+ ok = opaqueColour(value);
12645
+ break;
12646
+ case "top":
12647
+ ok = value === "0" || /^-?[0-9.]+px$/.test(value) && Math.abs(parseFloat(value)) <= 4;
12648
+ break;
12649
+ case "-webkit-text-fill-color":
12650
+ ok = selector.split(",").every((one) => (one.split(/[ >]/).pop() ?? "").includes(":placeholder-shown")) || opaqueColour(value);
12651
+ break;
12652
+ }
12653
+ return ok ? null : "hides_field";
12654
+ }
12655
+ function selectorProblem(selector) {
12656
+ if (!selector || !/^[a-z0-9\-_#.:,> ]+$/.test(selector) || selector.includes("::"))
12657
+ return "selector";
12658
+ const pseudoOk = selector.split(":").slice(1).every((after) => PSEUDO_CLASSES.includes(after.split(/[ >,.#]/)[0] ?? after));
12659
+ return pseudoOk ? null : "selector";
12660
+ }
12661
+ function enigmaCustomCssProblem(css) {
12662
+ if (!css.trim()) return null;
12663
+ if (css.length > ENIGMA_CUSTOM_CSS_MAX_LENGTH) return "too_long";
12664
+ if (/[^\x20-\x7e\n\r\t]/.test(css)) return "not_ascii";
12665
+ if (css.includes("<")) return "markup";
12666
+ if (css.includes("\\")) return "escape";
12667
+ const lower = css.toLowerCase();
12668
+ if (lower.includes("/*")) return "comment";
12669
+ if (["url(", "image-set(", "image(", "element(", "cross-fade(", "src(", "data:"].some(
12670
+ (needle) => lower.includes(needle)
12671
+ )) {
12672
+ return "loads_resource";
12673
+ }
12674
+ if (["expression(", "javascript:", "behavior", "-moz-binding"].some(
12675
+ (needle) => lower.includes(needle)
12676
+ )) {
12677
+ return "script";
12678
+ }
12679
+ if (/@(?!media)/.test(lower)) return "at_rule";
12680
+ const compact = lower.split(/\s+/).filter(Boolean).join(" ");
12681
+ const blocks = [];
12682
+ let text = "";
12683
+ for (const ch of compact) {
12684
+ if (ch === "{") {
12685
+ const prelude = text.trim();
12686
+ text = "";
12687
+ const media = prelude.startsWith("@media");
12688
+ if (!media) {
12689
+ const problem = selectorProblem(prelude.replace(/, /g, ","));
12690
+ if (problem) return problem;
12691
+ }
12692
+ blocks.push({ selector: prelude, media });
12693
+ } else if (ch === "}" || ch === ";") {
12694
+ const declaration = text;
12695
+ text = "";
12696
+ const top = blocks[blocks.length - 1];
12697
+ if (!top) {
12698
+ if (ch === "}") return "unbalanced";
12699
+ continue;
12700
+ }
12701
+ if (!top.media && declaration.trim()) {
12702
+ const problem = declarationProblem(top.selector.replace(/, /g, ","), declaration);
12703
+ if (problem) return problem;
12704
+ }
12705
+ if (ch === "}") blocks.pop();
12706
+ } else {
12707
+ text += ch;
12708
+ }
12709
+ }
12710
+ return blocks.length > 0 ? "unbalanced" : null;
12711
+ }
12712
+ function enigmaCornerPx(corner) {
12713
+ return { square: 0, small: 6, medium: 8, large: 12, pill: 22 }[corner];
12714
+ }
12715
+ var HEX = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/;
12716
+ function pick(value, allowed, fallback) {
12717
+ return typeof value === "string" && allowed.includes(value) ? value : fallback;
12718
+ }
12719
+ function bool(value, fallback) {
12720
+ if (value === true || value === "true") return true;
12721
+ if (value === false || value === "false") return false;
12722
+ return fallback;
12723
+ }
12724
+ function hexOrEmpty(value) {
12725
+ return typeof value === "string" && HEX.test(value.trim()) ? value.trim() : "";
12726
+ }
12727
+ function decodeEnigmaCardForm(source) {
12728
+ const d = DEFAULT_ENIGMA_CARD_FORM;
12729
+ const height = Number(source["enigmaCustomHeight"]);
12730
+ const css = typeof source["enigmaCustomCss"] === "string" ? source["enigmaCustomCss"] : "";
12731
+ return {
12732
+ enigmaTemplate: pick(source["enigmaTemplate"], ENIGMA_TEMPLATES, d.enigmaTemplate),
12733
+ enigmaStyleMode: pick(source["enigmaStyleMode"], ENIGMA_STYLE_MODES, d.enigmaStyleMode),
12734
+ enigmaChrome: pick(source["enigmaChrome"], ENIGMA_FIELD_CHROMES, d.enigmaChrome),
12735
+ enigmaLabels: pick(source["enigmaLabels"], ENIGMA_LABEL_PLACEMENTS, d.enigmaLabels),
12736
+ enigmaLabelTone: pick(source["enigmaLabelTone"], ENIGMA_LABEL_TONES, d.enigmaLabelTone),
12737
+ enigmaHints: bool(source["enigmaHints"], d.enigmaHints),
12738
+ enigmaCvcIcon: bool(source["enigmaCvcIcon"], d.enigmaCvcIcon),
12739
+ enigmaFieldOrder: pick(source["enigmaFieldOrder"], ENIGMA_FIELD_ORDERS, d.enigmaFieldOrder),
12740
+ enigmaMarks: pick(source["enigmaMarks"], ENIGMA_NETWORK_MARKS, d.enigmaMarks),
12741
+ enigmaFocusRing: pick(source["enigmaFocusRing"], ENIGMA_FOCUS_RINGS, d.enigmaFocusRing),
12742
+ enigmaFieldMotion: pick(source["enigmaFieldMotion"], ENIGMA_FIELD_MOTIONS, d.enigmaFieldMotion),
12743
+ enigmaFieldHeight: pick(
12744
+ String(source["enigmaFieldHeight"] ?? ""),
12745
+ ENIGMA_FIELD_HEIGHTS,
12746
+ d.enigmaFieldHeight
12747
+ ),
12748
+ enigmaRowGap: pick(String(source["enigmaRowGap"] ?? ""), ENIGMA_ROW_GAPS, d.enigmaRowGap),
12749
+ enigmaCorner: pick(source["enigmaCorner"], ENIGMA_CORNERS, d.enigmaCorner),
12750
+ enigmaAccent: hexOrEmpty(source["enigmaAccent"]),
12751
+ enigmaBorder: hexOrEmpty(source["enigmaBorder"]),
12752
+ enigmaFill: hexOrEmpty(source["enigmaFill"]),
12753
+ enigmaTrustLine: bool(source["enigmaTrustLine"], d.enigmaTrustLine),
12754
+ enigmaAutoOpen: bool(source["enigmaAutoOpen"], d.enigmaAutoOpen),
12755
+ enigmaOpening: pick(source["enigmaOpening"], ENIGMA_OPENINGS, d.enigmaOpening),
12756
+ enigmaClickFeedback: pick(
12757
+ source["enigmaClickFeedback"],
12758
+ ENIGMA_CLICK_FEEDBACK,
12759
+ d.enigmaClickFeedback
12760
+ ),
12761
+ enigmaLoading: pick(source["enigmaLoading"], ENIGMA_LOADING_STYLES, d.enigmaLoading),
12762
+ enigmaReveal: pick(source["enigmaReveal"], ENIGMA_REVEALS, d.enigmaReveal),
12763
+ enigmaPayFeedback: pick(source["enigmaPayFeedback"], ENIGMA_PAY_FEEDBACK, d.enigmaPayFeedback),
12764
+ enigmaCustomCss: css.slice(0, ENIGMA_CUSTOM_CSS_MAX_LENGTH),
12765
+ enigmaCustomHeight: Number.isInteger(height) && height >= ENIGMA_CUSTOM_HEIGHT_MIN && height <= ENIGMA_CUSTOM_HEIGHT_MAX ? height : d.enigmaCustomHeight
12766
+ };
12767
+ }
12768
+ function encodeEnigmaCardForm(settings) {
12769
+ const out = {};
12770
+ for (const key of Object.keys(DEFAULT_ENIGMA_CARD_FORM)) {
12771
+ const value = settings[key];
12772
+ if (value === DEFAULT_ENIGMA_CARD_FORM[key]) continue;
12773
+ const text = String(value);
12774
+ if (key === "enigmaCustomCss" && !text.trim()) continue;
12775
+ out[key] = text;
12776
+ }
12777
+ return out;
12778
+ }
12779
+
12217
12780
  // src/branding.ts
12218
12781
  function surchargeShowsLabel(labelMode, style, position) {
12219
12782
  if (labelMode !== "labelled") return false;
@@ -12487,18 +13050,48 @@ function inputPadValue(size) {
12487
13050
  function buttonPadValue(size) {
12488
13051
  return BUTTON_PAD[size] ?? BUTTON_PAD.md;
12489
13052
  }
12490
- function vaultFormAppearance(b, danger) {
12491
- return {
13053
+ function vaultFormAppearance(b, danger, options = {}) {
13054
+ const border = b.enigmaBorder || b.border;
13055
+ const look = {
12492
13056
  surface: b.surface,
12493
13057
  text: b.text,
12494
- border: b.border,
12495
- accent: b.primary,
13058
+ border,
13059
+ accent: b.enigmaAccent || b.primary,
12496
13060
  ...danger ? { danger } : {},
12497
13061
  font: b.fontFamily,
12498
13062
  radius: b.radiusInput,
12499
13063
  size: b.inputSize,
12500
13064
  labels: b.labelStyle
12501
13065
  };
13066
+ if (!options.designed) return look;
13067
+ return {
13068
+ ...look,
13069
+ chrome: b.enigmaChrome,
13070
+ label: enigmaNamesInside(b) ? "inside" : "above",
13071
+ hints: b.enigmaHints,
13072
+ order: b.enigmaFieldOrder,
13073
+ marks: b.enigmaMarks,
13074
+ focus: b.enigmaFocusRing,
13075
+ motion: b.enigmaFieldMotion,
13076
+ height: b.enigmaFieldHeight,
13077
+ gap: b.enigmaRowGap,
13078
+ corner: b.enigmaCorner,
13079
+ fill: b.enigmaFill || enigmaDefaultFill(b.surface, b.text),
13080
+ ...b.enigmaStyleMode === "custom" ? { custom: true } : {}
13081
+ };
13082
+ }
13083
+ function enigmaDefaultFill(surface, text) {
13084
+ const channels = (hex) => {
13085
+ const v = hex.trim().replace("#", "");
13086
+ const full = v.length === 3 ? v.replace(/./g, "$&$&") : v;
13087
+ if (!/^[0-9a-fA-F]{6}$/.test(full)) return null;
13088
+ return [0, 2, 4].map((i) => parseInt(full.slice(i, i + 2), 16));
13089
+ };
13090
+ const s2 = channels(surface) ?? [255, 255, 255];
13091
+ const t = channels(text) ?? [30, 41, 59];
13092
+ return `#${s2.map(
13093
+ (value, i) => Math.round(value * 0.94 + (t[i] ?? 0) * 0.06).toString(16).padStart(2, "0")
13094
+ ).join("")}`;
12502
13095
  }
12503
13096
  function logoDimensions(size) {
12504
13097
  switch (size) {
@@ -13000,7 +13593,9 @@ var DEFAULT_BRANDING_BASE = {
13000
13593
  whopShadow: "soft",
13001
13594
  whopMethodIcons: true,
13002
13595
  whopSelection: "radio_tint",
13003
- customCss: ""
13596
+ customCss: "",
13597
+ // The Enigma Vault card form: the Stripe-like template.
13598
+ ...DEFAULT_ENIGMA_CARD_FORM
13004
13599
  };
13005
13600
  var DEFAULT_BRANDING = {
13006
13601
  ...DEFAULT_BRANDING_BASE,
@@ -14110,7 +14705,8 @@ function decodeBranding(source) {
14110
14705
  GOOGLE_PAY_BUTTON_TYPES,
14111
14706
  DEFAULT_BRANDING.nomupayGooglePayButtonType
14112
14707
  ),
14113
- customCss: s(extras["customCss"])
14708
+ customCss: s(extras["customCss"]),
14709
+ ...decodeEnigmaCardForm(extras)
14114
14710
  };
14115
14711
  }
14116
14712
  function encodeBranding(branding, base) {
@@ -14272,6 +14868,7 @@ function encodeBranding(branding, base) {
14272
14868
  if (support) extras["supportEmail"] = support;
14273
14869
  const css = trim(branding.customCss);
14274
14870
  if (css) extras["customCss"] = css;
14871
+ Object.assign(extras, encodeEnigmaCardForm(branding));
14275
14872
  const nextRules = {
14276
14873
  ...existingRules,
14277
14874
  [BRANDING_GROUP_KEY]: extras
@@ -14792,7 +15389,8 @@ function parseImportedBranding(raw) {
14792
15389
  GOOGLE_PAY_BUTTON_TYPES,
14793
15390
  dflt.nomupayGooglePayButtonType
14794
15391
  ),
14795
- customCss: sStr(root["customCss"], dflt.customCss).slice(0, CUSTOM_CSS_MAX_LENGTH)
15392
+ customCss: sStr(root["customCss"], dflt.customCss).slice(0, CUSTOM_CSS_MAX_LENGTH),
15393
+ ...decodeEnigmaCardForm(root)
14796
15394
  };
14797
15395
  }
14798
15396
  function isObject(v) {
@@ -14885,7 +15483,19 @@ function vaultFormQuery(params) {
14885
15483
  form_font: look?.font,
14886
15484
  form_radius: look?.radius,
14887
15485
  form_size: look?.size,
14888
- form_labels: look?.labels
15486
+ form_labels: look?.labels,
15487
+ form_chrome: look?.chrome,
15488
+ form_label: look?.label,
15489
+ form_hints: look?.hints === void 0 ? void 0 : String(look.hints),
15490
+ form_order: look?.order,
15491
+ form_marks: look?.marks,
15492
+ form_focus: look?.focus,
15493
+ form_motion: look?.motion,
15494
+ form_height: look?.height,
15495
+ form_gap: look?.gap,
15496
+ form_corner: look?.corner,
15497
+ form_fill: look?.fill,
15498
+ form_custom: look?.custom ? "true" : void 0
14889
15499
  };
14890
15500
  }
14891
15501
  function withoutHeader(headers, name) {
@@ -16422,6 +17032,7 @@ var encodeNativePanes = encodePanes;
16422
17032
  CUSTOM_FIELD_OPERATORS_BY_SOURCE,
16423
17033
  CUSTOM_FIELD_VALUELESS_OPERATORS,
16424
17034
  Cards,
17035
+ ChargebackPrevention,
16425
17036
  CheckoutMethods,
16426
17037
  CheckoutRecovery,
16427
17038
  CheckoutSession,
@@ -16431,10 +17042,33 @@ var encodeNativePanes = encodePanes;
16431
17042
  DEFAULT_BADGES_DARK,
16432
17043
  DEFAULT_BRANDING,
16433
17044
  DEFAULT_BRANDING_DARK,
17045
+ DEFAULT_ENIGMA_CARD_FORM,
16434
17046
  DEFAULT_NOTICES,
16435
17047
  Delopay,
16436
17048
  DelopayAuthenticationError,
16437
17049
  DelopayError,
17050
+ ENIGMA_CLICK_FEEDBACK,
17051
+ ENIGMA_CORNERS,
17052
+ ENIGMA_CUSTOM_CSS_MAX_LENGTH,
17053
+ ENIGMA_CUSTOM_HEIGHT_DEFAULT,
17054
+ ENIGMA_CUSTOM_HEIGHT_MAX,
17055
+ ENIGMA_CUSTOM_HEIGHT_MIN,
17056
+ ENIGMA_FIELD_CHROMES,
17057
+ ENIGMA_FIELD_HEIGHTS,
17058
+ ENIGMA_FIELD_MOTIONS,
17059
+ ENIGMA_FIELD_ORDERS,
17060
+ ENIGMA_FOCUS_RINGS,
17061
+ ENIGMA_LABEL_PLACEMENTS,
17062
+ ENIGMA_LABEL_TONES,
17063
+ ENIGMA_LOADING_STYLES,
17064
+ ENIGMA_NETWORK_MARKS,
17065
+ ENIGMA_OPENINGS,
17066
+ ENIGMA_PAY_FEEDBACK,
17067
+ ENIGMA_REVEALS,
17068
+ ENIGMA_ROW_GAPS,
17069
+ ENIGMA_STYLE_MODES,
17070
+ ENIGMA_TEMPLATES,
17071
+ ENIGMA_TEMPLATE_PRESETS,
16438
17072
  Export,
16439
17073
  ExternalRecords,
16440
17074
  FeatureMatrix,
@@ -16528,6 +17162,7 @@ var encodeNativePanes = encodePanes;
16528
17162
  allOf,
16529
17163
  anyOf,
16530
17164
  applyBrandingVariables,
17165
+ applyEnigmaTemplate,
16531
17166
  asAirwallexCardPreset,
16532
17167
  brandingAssetPath,
16533
17168
  buildBrandingExport,
@@ -16556,6 +17191,7 @@ var encodeNativePanes = encodePanes;
16556
17191
  decodeBadges,
16557
17192
  decodeBranding,
16558
17193
  decodeCustomFields,
17194
+ decodeEnigmaCardForm,
16559
17195
  decodeMethodSectionLabels,
16560
17196
  decodeMethodSectionOrder,
16561
17197
  decodeNativePanes,
@@ -16572,11 +17208,17 @@ var encodeNativePanes = encodePanes;
16572
17208
  encodeBadges,
16573
17209
  encodeBranding,
16574
17210
  encodeCustomFields,
17211
+ encodeEnigmaCardForm,
16575
17212
  encodeMethodSectionLabels,
16576
17213
  encodeMethodSectionOrder,
16577
17214
  encodeNativePanes,
16578
17215
  encodeNotices,
16579
17216
  encodePanes,
17217
+ enigmaCornerPx,
17218
+ enigmaCustomCssProblem,
17219
+ enigmaDefaultFill,
17220
+ enigmaNamesInside,
17221
+ enigmaTemplateChanges,
16580
17222
  evaluateCustomFieldCondition,
16581
17223
  evaluateCustomFieldVisibility,
16582
17224
  feeProgram,