@delopay/sdk 0.358.0 → 0.362.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,
@@ -2281,6 +2282,77 @@ var Disputes = class {
2281
2282
  }
2282
2283
  };
2283
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
+
2284
2356
  // src/resources/paypalDisputes.ts
2285
2357
  var PaypalDisputes = class {
2286
2358
  constructor(request) {
@@ -4520,7 +4592,12 @@ var Routing = class {
4520
4592
  async getDefaultForProfile(profileId) {
4521
4593
  return this.request("GET", `/routing/default/profile/${encodeURIComponent(profileId)}`);
4522
4594
  }
4523
- /** 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
+ */
4524
4601
  async updateDefaultProfile(profileId, params, options) {
4525
4602
  return this.request("POST", `/routing/default/profile/${encodeURIComponent(profileId)}`, {
4526
4603
  body: params,
@@ -11134,6 +11211,7 @@ var Delopay = class {
11134
11211
  this.paymentLinks = new PaymentLinks(request);
11135
11212
  this.mandates = new Mandates(request);
11136
11213
  this.disputes = new Disputes(request);
11214
+ this.chargebackPrevention = new ChargebackPrevention(request);
11137
11215
  this.paypalDisputes = new PaypalDisputes(request);
11138
11216
  this.whopResolutionCases = new WhopResolutionCases(request);
11139
11217
  this.payouts = new Payouts(request);
@@ -12586,6 +12664,7 @@ function enigmaCustomCssProblem(css) {
12586
12664
  if (/[^\x20-\x7e\n\r\t]/.test(css)) return "not_ascii";
12587
12665
  if (css.includes("<")) return "markup";
12588
12666
  if (css.includes("\\")) return "escape";
12667
+ if (/["']/.test(css)) return "quote";
12589
12668
  const lower = css.toLowerCase();
12590
12669
  if (lower.includes("/*")) return "comment";
12591
12670
  if (["url(", "image-set(", "image(", "element(", "cross-fade(", "src(", "data:"].some(
@@ -12601,9 +12680,19 @@ function enigmaCustomCssProblem(css) {
12601
12680
  if (/@(?!media)/.test(lower)) return "at_rule";
12602
12681
  const compact = lower.split(/\s+/).filter(Boolean).join(" ");
12603
12682
  const blocks = [];
12683
+ const brackets = [];
12604
12684
  let text = "";
12605
12685
  for (const ch of compact) {
12606
- if (ch === "{") {
12686
+ if ((ch === "{" || ch === "}" || ch === ";") && brackets.length > 0) return "misplaced";
12687
+ if (ch === "(" || ch === "[") {
12688
+ brackets.push(ch);
12689
+ text += ch;
12690
+ } else if (ch === ")" || ch === "]") {
12691
+ if (brackets.pop() !== (ch === ")" ? "(" : "[")) return "unbalanced";
12692
+ text += ch;
12693
+ } else if (ch === "{") {
12694
+ const outer = blocks[blocks.length - 1];
12695
+ if (outer && !outer.media) return "misplaced";
12607
12696
  const prelude = text.trim();
12608
12697
  text = "";
12609
12698
  const media = prelude.startsWith("@media");
@@ -12618,9 +12707,11 @@ function enigmaCustomCssProblem(css) {
12618
12707
  const top = blocks[blocks.length - 1];
12619
12708
  if (!top) {
12620
12709
  if (ch === "}") return "unbalanced";
12710
+ if (declaration.trim()) return "misplaced";
12621
12711
  continue;
12622
12712
  }
12623
- if (!top.media && declaration.trim()) {
12713
+ if (declaration.trim()) {
12714
+ if (top.media) return "misplaced";
12624
12715
  const problem = declarationProblem(top.selector.replace(/, /g, ","), declaration);
12625
12716
  if (problem) return problem;
12626
12717
  }
@@ -12629,7 +12720,8 @@ function enigmaCustomCssProblem(css) {
12629
12720
  text += ch;
12630
12721
  }
12631
12722
  }
12632
- return blocks.length > 0 ? "unbalanced" : null;
12723
+ if (blocks.length > 0 || brackets.length > 0) return "unbalanced";
12724
+ return text.trim() ? "misplaced" : null;
12633
12725
  }
12634
12726
  function enigmaCornerPx(corner) {
12635
12727
  return { square: 0, small: 6, medium: 8, large: 12, pill: 22 }[corner];
@@ -16954,6 +17046,7 @@ var encodeNativePanes = encodePanes;
16954
17046
  CUSTOM_FIELD_OPERATORS_BY_SOURCE,
16955
17047
  CUSTOM_FIELD_VALUELESS_OPERATORS,
16956
17048
  Cards,
17049
+ ChargebackPrevention,
16957
17050
  CheckoutMethods,
16958
17051
  CheckoutRecovery,
16959
17052
  CheckoutSession,