@delopay/sdk 0.93.0 → 0.95.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/{chunk-BWTQ34HP.js → chunk-6BVLBNEZ.js} +148 -1
- package/dist/chunk-6BVLBNEZ.js.map +1 -0
- package/dist/index.cjs +147 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +363 -1
- package/dist/index.d.ts +363 -1
- package/dist/index.js +1 -1
- package/dist/internal.cjs +147 -0
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-BWTQ34HP.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -2171,6 +2171,227 @@ interface SurchargeRuleResponse {
|
|
|
2171
2171
|
* surcharge not applied on Stripe card). Empty/absent when none. */
|
|
2172
2172
|
warnings?: string[];
|
|
2173
2173
|
}
|
|
2174
|
+
/**
|
|
2175
|
+
* The appearance a matched rule selects.
|
|
2176
|
+
*
|
|
2177
|
+
* `variant` names one of the shop's stored appearance variants (a key of the
|
|
2178
|
+
* shop's `business_specific_configs`). A name the shop does not define is not
|
|
2179
|
+
* an evaluation error — the checkout falls back to the shop default, exactly as
|
|
2180
|
+
* it does for an unknown `?theme=`, because a buyer who cannot pay is a worse
|
|
2181
|
+
* outcome than a buyer who sees the default look. The API reports such names in
|
|
2182
|
+
* `CheckoutThemeProgramResponse.warnings` instead.
|
|
2183
|
+
*/
|
|
2184
|
+
interface ThemeChoice {
|
|
2185
|
+
variant: string;
|
|
2186
|
+
}
|
|
2187
|
+
/**
|
|
2188
|
+
* The Euclid program output `O`: a matched branch may name a variant.
|
|
2189
|
+
*
|
|
2190
|
+
* Absent or `null` means *leave the appearance alone* — the shop's default
|
|
2191
|
+
* config is used. That is a legal program, and it is what a default selection
|
|
2192
|
+
* carries most of the time.
|
|
2193
|
+
*/
|
|
2194
|
+
interface CheckoutThemeOutput {
|
|
2195
|
+
theme?: ThemeChoice | null;
|
|
2196
|
+
}
|
|
2197
|
+
/** A single theme rule (`Rule<ThemeRules>`). camelCase on the wire. */
|
|
2198
|
+
interface CheckoutThemeRule {
|
|
2199
|
+
name: string;
|
|
2200
|
+
connectorSelection: CheckoutThemeOutput;
|
|
2201
|
+
/** The theme-only statement type, not the shared one — see {@link ThemeCondition}. */
|
|
2202
|
+
statements: ThemeIfStatement[];
|
|
2203
|
+
}
|
|
2204
|
+
/**
|
|
2205
|
+
* The theme-selection program (`Program<ThemeRules>`). camelCase on the wire.
|
|
2206
|
+
*
|
|
2207
|
+
* Rules are evaluated top-to-bottom and the first match wins;
|
|
2208
|
+
* `defaultSelection` is what applies when none does.
|
|
2209
|
+
*/
|
|
2210
|
+
interface CheckoutThemeProgram {
|
|
2211
|
+
defaultSelection: CheckoutThemeOutput;
|
|
2212
|
+
rules: CheckoutThemeRule[];
|
|
2213
|
+
/** Required on the wire — send `{}` when empty. */
|
|
2214
|
+
metadata: Record<string, unknown>;
|
|
2215
|
+
}
|
|
2216
|
+
/** Form factor, resolved from the user-agent at render time. */
|
|
2217
|
+
type ThemeDeviceClass = 'phone' | 'tablet' | 'desktop';
|
|
2218
|
+
/**
|
|
2219
|
+
* The buyer's language, **already normalised to one matchable token**.
|
|
2220
|
+
*
|
|
2221
|
+
* This is a closed set on purpose, and building a language picker from anything
|
|
2222
|
+
* else will produce rules that never fire. The DSL has only equality and
|
|
2223
|
+
* numeric ordering — no prefix match, no regex — while a browser sends
|
|
2224
|
+
* `Accept-Language: de-DE,de;q=0.9,en;q=0.8`, which equals no plain tag as raw
|
|
2225
|
+
* text. So the header is reduced to a primary subtag *before* evaluation, and
|
|
2226
|
+
* these are the resulting values: the languages the checkout itself ships
|
|
2227
|
+
* translations for, plus `other`.
|
|
2228
|
+
*
|
|
2229
|
+
* `other` means a language was stated and it is not one the checkout speaks. A
|
|
2230
|
+
* header carrying nothing usable is *absent* instead, and then no language
|
|
2231
|
+
* condition matches at all — absent and `other` are different claims.
|
|
2232
|
+
*/
|
|
2233
|
+
type ThemeBrowserLanguage = 'ar' | 'ca' | 'de' | 'en' | 'es' | 'fr' | 'he' | 'it' | 'ja' | 'nl' | 'pl' | 'pt' | 'ru' | 'sv' | 'zh' | 'other';
|
|
2234
|
+
/** How the checkout is being rendered: inside the merchant's page, or hosted. */
|
|
2235
|
+
type ThemeCheckoutChannel = 'embedded' | 'standalone';
|
|
2236
|
+
/**
|
|
2237
|
+
* Where the buyer came from, bucketed from the `Referer` header.
|
|
2238
|
+
*
|
|
2239
|
+
* Coarse on purpose — the referrer is frequently stripped and is not trustworthy
|
|
2240
|
+
* enough to decide anything but a look. `direct` means no referrer was sent,
|
|
2241
|
+
* which includes "stripped by referrer policy" and not just "typed the URL".
|
|
2242
|
+
*/
|
|
2243
|
+
type ThemeTrafficSource = 'direct' | 'search' | 'social' | 'email' | 'other';
|
|
2244
|
+
/**
|
|
2245
|
+
* A condition on a dimension whose values are a closed enum.
|
|
2246
|
+
*
|
|
2247
|
+
* Both shapes the engine accepts for an enum dimension: one value, or a list
|
|
2248
|
+
* meaning "any of". Only equality is available — the DSL has no prefix match,
|
|
2249
|
+
* which is exactly why the value types are closed.
|
|
2250
|
+
*/
|
|
2251
|
+
interface ThemeEnumCondition<L extends string, V extends string> {
|
|
2252
|
+
lhs: L;
|
|
2253
|
+
comparison: 'equal' | 'not_equal';
|
|
2254
|
+
value: {
|
|
2255
|
+
type: 'enum_variant';
|
|
2256
|
+
value: V;
|
|
2257
|
+
} | {
|
|
2258
|
+
type: 'enum_variant_array';
|
|
2259
|
+
value: V[];
|
|
2260
|
+
};
|
|
2261
|
+
/** Required on the wire — send `{}` when empty. */
|
|
2262
|
+
metadata: Record<string, unknown>;
|
|
2263
|
+
}
|
|
2264
|
+
/** A condition on a numeric dimension. Amounts are in minor units. */
|
|
2265
|
+
interface ThemeNumberCondition<L extends string> {
|
|
2266
|
+
lhs: L;
|
|
2267
|
+
comparison: EuclidComparisonType;
|
|
2268
|
+
value: {
|
|
2269
|
+
type: 'number';
|
|
2270
|
+
value: number;
|
|
2271
|
+
} | {
|
|
2272
|
+
type: 'number_array';
|
|
2273
|
+
value: number[];
|
|
2274
|
+
} | {
|
|
2275
|
+
type: 'number_comparison_array';
|
|
2276
|
+
value: {
|
|
2277
|
+
comparisonType: EuclidComparisonType;
|
|
2278
|
+
number: number;
|
|
2279
|
+
}[];
|
|
2280
|
+
};
|
|
2281
|
+
/** Required on the wire — send `{}` when empty. */
|
|
2282
|
+
metadata: Record<string, unknown>;
|
|
2283
|
+
}
|
|
2284
|
+
/**
|
|
2285
|
+
* A condition on a merchant-supplied `payment_intent.metadata` entry.
|
|
2286
|
+
*
|
|
2287
|
+
* Carries nothing observed about the buyer: the merchant chose both the key and
|
|
2288
|
+
* the value, which is why this dimension is allowed here at all.
|
|
2289
|
+
*/
|
|
2290
|
+
interface ThemeMetadataCondition {
|
|
2291
|
+
lhs: 'metadata';
|
|
2292
|
+
comparison: 'equal' | 'not_equal';
|
|
2293
|
+
value: {
|
|
2294
|
+
type: 'metadata_variant';
|
|
2295
|
+
value: {
|
|
2296
|
+
key: string;
|
|
2297
|
+
value: string;
|
|
2298
|
+
};
|
|
2299
|
+
};
|
|
2300
|
+
/** Required on the wire — send `{}` when empty. */
|
|
2301
|
+
metadata: Record<string, unknown>;
|
|
2302
|
+
}
|
|
2303
|
+
/**
|
|
2304
|
+
* Every condition a theme rule may express — and, by construction, no others.
|
|
2305
|
+
*
|
|
2306
|
+
* Deliberately **not** the shared `EuclidComparison`, whose `lhs` and enum
|
|
2307
|
+
* values are plain `string`. Reusing it would leave the closed sets above as
|
|
2308
|
+
* documentation: `payment_method` and `browser_language = 'de-DE'` would both
|
|
2309
|
+
* compile, and neither fails loudly. The first is rejected by the server; the
|
|
2310
|
+
* second is worse, because the backend normalises `Accept-Language` to a
|
|
2311
|
+
* primary subtag before evaluating, so a rule written against `de-DE` does not
|
|
2312
|
+
* error — it silently never matches, and never says why.
|
|
2313
|
+
*
|
|
2314
|
+
* The two country dimensions are both here and mean different things:
|
|
2315
|
+
* `buyer_country` is observed at render time, `billing_country` comes off the
|
|
2316
|
+
* address. They disagree routinely and legitimately — a German address opened
|
|
2317
|
+
* from an airport in Spain — so a shop may key on either. Their values are
|
|
2318
|
+
* ISO 3166-1 alpha-2 codes, left as `string` because this SDK has no country
|
|
2319
|
+
* union to point at; the *dimension* is still closed.
|
|
2320
|
+
*/
|
|
2321
|
+
type ThemeCondition = ThemeEnumCondition<'device_class', ThemeDeviceClass> | ThemeEnumCondition<'browser_language', ThemeBrowserLanguage> | ThemeEnumCondition<'checkout_channel', ThemeCheckoutChannel> | ThemeEnumCondition<'traffic_source', ThemeTrafficSource> | ThemeEnumCondition<'buyer_country', string> | ThemeEnumCondition<'billing_country', string> | ThemeEnumCondition<'currency', Currency> | ThemeNumberCondition<'amount'> | ThemeMetadataCondition;
|
|
2322
|
+
/**
|
|
2323
|
+
* The dimensions a theme rule may condition on — the whole list.
|
|
2324
|
+
*
|
|
2325
|
+
* Derived from {@link ThemeCondition} rather than written twice, so the picker
|
|
2326
|
+
* a dashboard builds from this cannot drift from what the AST accepts.
|
|
2327
|
+
* Anything outside the set is rejected at save time rather than ignored, so a
|
|
2328
|
+
* typo cannot become a rule that quietly never fires.
|
|
2329
|
+
*
|
|
2330
|
+
* A theme program decides a look and nothing else: `payment_method`,
|
|
2331
|
+
* `connector` and `card_network` are absent by design, not by oversight, and
|
|
2332
|
+
* the server enforces the same boundary on its side.
|
|
2333
|
+
*/
|
|
2334
|
+
type CheckoutThemeDimension = ThemeCondition['lhs'];
|
|
2335
|
+
/** An IF block; all conditions in `condition` are ANDed. camelCase on the wire. */
|
|
2336
|
+
interface ThemeIfStatement {
|
|
2337
|
+
condition: ThemeCondition[];
|
|
2338
|
+
nested?: ThemeIfStatement[] | null;
|
|
2339
|
+
}
|
|
2340
|
+
/** Request for `PUT /routing/checkout-theme/rules`. */
|
|
2341
|
+
interface CheckoutThemeProgramRequest {
|
|
2342
|
+
/** Shown in the dashboard and echoed on retrieval. */
|
|
2343
|
+
name?: string | null;
|
|
2344
|
+
/**
|
|
2345
|
+
* Shop scope. Omit/null = merchant-wide.
|
|
2346
|
+
*
|
|
2347
|
+
* A shop-scoped caller may omit it — the scope resolves to that caller's own
|
|
2348
|
+
* shop — and may not name any other shop.
|
|
2349
|
+
*/
|
|
2350
|
+
profile_id?: string | null;
|
|
2351
|
+
algorithm: CheckoutThemeProgram;
|
|
2352
|
+
/**
|
|
2353
|
+
* Whether the program takes effect on save. Defaults to `true` server-side.
|
|
2354
|
+
*
|
|
2355
|
+
* `false` stores a revision without retiring the live one, which is where a
|
|
2356
|
+
* program drafted against a variant that does not exist yet belongs.
|
|
2357
|
+
*/
|
|
2358
|
+
active?: boolean | null;
|
|
2359
|
+
/** RFC3339; defaults to now when omitted. */
|
|
2360
|
+
valid_from?: string | null;
|
|
2361
|
+
/** RFC3339; omit = open-ended. */
|
|
2362
|
+
valid_until?: string | null;
|
|
2363
|
+
}
|
|
2364
|
+
/** Response for `PUT/GET /routing/checkout-theme/rules`. */
|
|
2365
|
+
interface CheckoutThemeProgramResponse {
|
|
2366
|
+
id: string;
|
|
2367
|
+
name: string;
|
|
2368
|
+
/**
|
|
2369
|
+
* The scope the program is stored against, resolved — a shop-scoped caller
|
|
2370
|
+
* that omitted `profile_id` gets its own shop back here.
|
|
2371
|
+
*
|
|
2372
|
+
* Optional, because the contract does not list it as required: a caller that
|
|
2373
|
+
* read an absent value as definitely `null` would turn "not stated" into
|
|
2374
|
+
* "merchant-wide".
|
|
2375
|
+
*/
|
|
2376
|
+
profile_id?: string | null;
|
|
2377
|
+
algorithm: CheckoutThemeProgram;
|
|
2378
|
+
version: number;
|
|
2379
|
+
is_active: boolean;
|
|
2380
|
+
/** RFC3339. */
|
|
2381
|
+
valid_from: string;
|
|
2382
|
+
/** RFC3339, or null when open-ended. Optional for the same reason as `profile_id`. */
|
|
2383
|
+
valid_until?: string | null;
|
|
2384
|
+
/**
|
|
2385
|
+
* Non-blocking advisories, recomputed on every read. Empty when none.
|
|
2386
|
+
*
|
|
2387
|
+
* The case this exists for: a rule naming a variant the shop has not defined.
|
|
2388
|
+
* That cannot be an error — programs and variants are edited independently,
|
|
2389
|
+
* so rejecting the save would make it impossible to author them in either
|
|
2390
|
+
* order — but the symptom is a rule that simply never appears to fire, which
|
|
2391
|
+
* is worse to debug than to be told about.
|
|
2392
|
+
*/
|
|
2393
|
+
warnings?: string[];
|
|
2394
|
+
}
|
|
2174
2395
|
/** Full routing config returned by `GET /routing/{id}`. */
|
|
2175
2396
|
interface MerchantRoutingAlgorithm {
|
|
2176
2397
|
id: string;
|
|
@@ -5795,6 +6016,8 @@ declare class Routing {
|
|
|
5795
6016
|
readonly decision: RoutingDecisionManager;
|
|
5796
6017
|
/** Merchant-friendly, per-payment-method surcharge rules (no Euclid DSL). */
|
|
5797
6018
|
readonly surchargeRules: SurchargeRules;
|
|
6019
|
+
/** Which stored appearance variant a buyer is shown. Decides a look, never a payment. */
|
|
6020
|
+
readonly checkoutThemeRules: CheckoutThemeRules;
|
|
5798
6021
|
constructor(request: RequestFn);
|
|
5799
6022
|
/**
|
|
5800
6023
|
* Create a new routing algorithm.
|
|
@@ -5972,6 +6195,100 @@ declare class SurchargeRules {
|
|
|
5972
6195
|
*/
|
|
5973
6196
|
delete(profileId?: string): Promise<void>;
|
|
5974
6197
|
}
|
|
6198
|
+
/**
|
|
6199
|
+
* Checkout theme programs: which of a shop's stored appearance variants a buyer
|
|
6200
|
+
* is shown.
|
|
6201
|
+
*
|
|
6202
|
+
* Same engine and same wire format as the advanced routing rules above — a
|
|
6203
|
+
* Euclid program whose rules run top-down, first match wins, with
|
|
6204
|
+
* `defaultSelection` as the fallback — with the output swapped for a variant
|
|
6205
|
+
* name. That is deliberate: the dashboard's routing rule builder can author
|
|
6206
|
+
* these without learning a second condition language.
|
|
6207
|
+
*
|
|
6208
|
+
* **A theme program decides a look and nothing else.** It cannot express which
|
|
6209
|
+
* payment methods are offered, what is charged, which provider processes the
|
|
6210
|
+
* payment, or whether it succeeds. The allowed dimensions are fixed server-side
|
|
6211
|
+
* by the output type — see {@link CheckoutThemeDimension} — so that is a
|
|
6212
|
+
* property of the API rather than a convention.
|
|
6213
|
+
*
|
|
6214
|
+
* Naming a variant the shop has not defined is **not** an error: the checkout
|
|
6215
|
+
* falls back to the shop default, exactly as it does for an unknown `?theme=`,
|
|
6216
|
+
* because a buyer who cannot pay is worse than a buyer who sees the default
|
|
6217
|
+
* look. Such names come back in `warnings` instead, recomputed on every read.
|
|
6218
|
+
*/
|
|
6219
|
+
declare class CheckoutThemeRules {
|
|
6220
|
+
private readonly request;
|
|
6221
|
+
constructor(request: RequestFn);
|
|
6222
|
+
/**
|
|
6223
|
+
* Create or replace the theme program for a scope.
|
|
6224
|
+
*
|
|
6225
|
+
* `PUT /routing/checkout-theme/rules`
|
|
6226
|
+
*
|
|
6227
|
+
* Supersedes rather than overwrites: the previous active version is retired
|
|
6228
|
+
* and a new one stored, so the record of which look was live when survives.
|
|
6229
|
+
* Pass `active: false` to store a revision **without** retiring the live one —
|
|
6230
|
+
* that is where a program drafted against a variant you have not built yet
|
|
6231
|
+
* belongs.
|
|
6232
|
+
*
|
|
6233
|
+
* @example A phone in Germany gets the compact look; everyone else the house style.
|
|
6234
|
+
* ```typescript
|
|
6235
|
+
* await delopay.routing.checkoutThemeRules.upsert({
|
|
6236
|
+
* name: 'Autumn targeting',
|
|
6237
|
+
* profile_id: 'pro_...',
|
|
6238
|
+
* algorithm: {
|
|
6239
|
+
* rules: [
|
|
6240
|
+
* {
|
|
6241
|
+
* name: 'German phones',
|
|
6242
|
+
* connectorSelection: { theme: { variant: 'compact' } },
|
|
6243
|
+
* statements: [
|
|
6244
|
+
* {
|
|
6245
|
+
* condition: [
|
|
6246
|
+
* {
|
|
6247
|
+
* lhs: 'device_class',
|
|
6248
|
+
* comparison: 'equal',
|
|
6249
|
+
* value: { type: 'enum_variant', value: 'phone' },
|
|
6250
|
+
* metadata: {},
|
|
6251
|
+
* },
|
|
6252
|
+
* {
|
|
6253
|
+
* lhs: 'browser_language',
|
|
6254
|
+
* comparison: 'equal',
|
|
6255
|
+
* value: { type: 'enum_variant', value: 'de' },
|
|
6256
|
+
* metadata: {},
|
|
6257
|
+
* },
|
|
6258
|
+
* ],
|
|
6259
|
+
* },
|
|
6260
|
+
* ],
|
|
6261
|
+
* },
|
|
6262
|
+
* ],
|
|
6263
|
+
* defaultSelection: { theme: { variant: 'house' } },
|
|
6264
|
+
* metadata: {},
|
|
6265
|
+
* },
|
|
6266
|
+
* });
|
|
6267
|
+
* ```
|
|
6268
|
+
*/
|
|
6269
|
+
upsert(params: CheckoutThemeProgramRequest): Promise<CheckoutThemeProgramResponse>;
|
|
6270
|
+
/**
|
|
6271
|
+
* Retrieve the active theme program for a scope, or `null` when none is set.
|
|
6272
|
+
*
|
|
6273
|
+
* `GET /routing/checkout-theme/rules?profile_id={profileId}`
|
|
6274
|
+
*
|
|
6275
|
+
* @param profileId - Shop scope. Omit for the merchant-wide program. A
|
|
6276
|
+
* shop-scoped caller that omits it gets its own shop's program.
|
|
6277
|
+
*/
|
|
6278
|
+
retrieve(profileId?: string): Promise<CheckoutThemeProgramResponse | null>;
|
|
6279
|
+
/**
|
|
6280
|
+
* Deactivate the active theme program for a scope. Idempotent.
|
|
6281
|
+
*
|
|
6282
|
+
* `DELETE /routing/checkout-theme/rules?profile_id={profileId}`
|
|
6283
|
+
*
|
|
6284
|
+
* Deactivation, not deletion — the stored row is what says which look was
|
|
6285
|
+
* live when, and that history cannot be reconstructed after the fact. Shops
|
|
6286
|
+
* go back to their default appearance immediately.
|
|
6287
|
+
*
|
|
6288
|
+
* @param profileId - Shop scope. Omit for the merchant-wide program.
|
|
6289
|
+
*/
|
|
6290
|
+
delete(profileId?: string): Promise<void>;
|
|
6291
|
+
}
|
|
5975
6292
|
|
|
5976
6293
|
/** Index discriminator returned for each search result group. */
|
|
5977
6294
|
type SearchIndex = 'payment_attempts' | 'payment_intents' | 'refunds' | 'disputes' | 'payouts' | 'sessionizer_payment_attempts' | 'sessionizer_payment_intents' | 'sessionizer_refunds' | 'sessionizer_disputes' | 'routing_rules' | 'webhook_events' | 'audit_logs' | 'subscriptions';
|
|
@@ -6186,6 +6503,31 @@ declare class Users {
|
|
|
6186
6503
|
signUp(params: SignUpRequest | SignUpWithMerchantRequest): Promise<AuthResponse>;
|
|
6187
6504
|
signIn(params: SignInRequest): Promise<AuthResponse>;
|
|
6188
6505
|
signOut(): Promise<Record<string, unknown>>;
|
|
6506
|
+
/**
|
|
6507
|
+
* Sliding-session refresh: exchange the current (still-valid) login JWT
|
|
6508
|
+
* for a fresh one with the same claims and a full lifetime. The backend
|
|
6509
|
+
* keeps the session's identity (`jti`), slides `user_session.expires_at`
|
|
6510
|
+
* forward and re-sets the `login_token` cookie.
|
|
6511
|
+
*
|
|
6512
|
+
* Requires a token backed by a revocable session (a `jti` claim). Signin
|
|
6513
|
+
* and switch-merchant/-profile tokens have one; **session-less tokens do
|
|
6514
|
+
* not and are rejected with 400** — team-impersonation tokens are the
|
|
6515
|
+
* case in practice, and they are deliberately tab-scoped and
|
|
6516
|
+
* time-bounded rather than renewable. A 400 here is not a dead session:
|
|
6517
|
+
* the token remains valid for ordinary calls, it simply cannot slide.
|
|
6518
|
+
*
|
|
6519
|
+
* Rejected (401) for expired, blacklisted or revoked tokens — refresh can
|
|
6520
|
+
* only extend a session that is still alive. Rate-limited server-side
|
|
6521
|
+
* (429) to one mint per session per minute; treat a 429 as "still fresh
|
|
6522
|
+
* enough", not as an error.
|
|
6523
|
+
*
|
|
6524
|
+
* The returned token is NOT applied to this client automatically — pass
|
|
6525
|
+
* it to `setJwtToken()`, or use {@link Delopay.refreshSession} which does
|
|
6526
|
+
* both.
|
|
6527
|
+
*
|
|
6528
|
+
* `POST /user/token/refresh`. Requires a logged-in JWT.
|
|
6529
|
+
*/
|
|
6530
|
+
refreshToken(): Promise<TokenResponse>;
|
|
6189
6531
|
/**
|
|
6190
6532
|
* Paginated login history for the authenticated user -- IP, User-Agent,
|
|
6191
6533
|
* country / city / lat-lon (when GeoIP is enabled), success and failure
|
|
@@ -6985,6 +7327,26 @@ declare class Delopay {
|
|
|
6985
7327
|
* Clear the JWT token, reverting to API key authentication.
|
|
6986
7328
|
*/
|
|
6987
7329
|
clearJwtToken(): void;
|
|
7330
|
+
/**
|
|
7331
|
+
* Refresh the current login JWT (see {@link Users.refreshToken}) and
|
|
7332
|
+
* apply the fresh token to this client, so subsequent requests use it.
|
|
7333
|
+
* Returns the fresh token for the caller to persist (e.g. session
|
|
7334
|
+
* storage) — the backend has already re-set the `login_token` cookie.
|
|
7335
|
+
*
|
|
7336
|
+
* If the client's auth state changes while the refresh is pending —
|
|
7337
|
+
* `clearJwtToken()` on sign-out, or `setJwtToken()` switching to another
|
|
7338
|
+
* session — the stale completion is discarded and this rejects with a
|
|
7339
|
+
* `session_changed` `DelopayError` (status 0), so the explicit change
|
|
7340
|
+
* wins and the caller never persists a token for a session that is gone.
|
|
7341
|
+
*
|
|
7342
|
+
* Otherwise throws like any other request; in particular a 401 means the
|
|
7343
|
+
* session is dead (expired/blacklisted/revoked), a 429 means a refresh
|
|
7344
|
+
* was already minted for this session within the last minute, and a 400
|
|
7345
|
+
* means this token has no revocable session to slide (no `jti` — team
|
|
7346
|
+
* impersonation is the case in practice) and can never be refreshed,
|
|
7347
|
+
* though it stays valid for ordinary calls.
|
|
7348
|
+
*/
|
|
7349
|
+
refreshSession(): Promise<TokenResponse>;
|
|
6988
7350
|
/**
|
|
6989
7351
|
* Make a raw HTTP request to the Delopay API.
|
|
6990
7352
|
*
|
|
@@ -8026,4 +8388,4 @@ declare function focusedCheckoutUrl(params: FocusedCheckoutUrlParams): string;
|
|
|
8026
8388
|
declare const CHECKOUT_EVENT_KINDS: readonly ["native_pane_selected", "native_pane_tab_opened", "native_pane_tab_blocked", "native_pane_abandoned", "native_pane_returned"];
|
|
8027
8389
|
type CheckoutEventKind = (typeof CHECKOUT_EVENT_KINDS)[number];
|
|
8028
8390
|
|
|
8029
|
-
export { ALL_CUSTOM_FIELD_CONDITION_SOURCES, ALL_CUSTOM_FIELD_OPERATORS, ALL_CUSTOM_FIELD_TYPES, type AddUserRequest, type AddUserResponse, type Address, type AddressDetails, type AllocationListResponse, type AllocationResponse, type AllocationTransferRequest, type AllocationTransferResponse, type AmountFilter, type AmountRange, Analytics, type AnalyticsChild, type AnalyticsConnectorDay, type AnalyticsConnectorSeries, AnalyticsDashboard, type AnalyticsDayBucket, type AnalyticsMethodSlice, type AnalyticsScopeRequest, type AnalyticsScopeResponse, type ApiKeyCreateRequest, type ApiKeyCreateResponse, type ApiKeyExpiration, type ApiKeyListConstraints, type ApiKeyResponse, type ApiKeyRevokeResponse, type ApiKeyUpdateRequest, type ApplePayVerificationRequest, type ApplePayVerificationResponse, type ApplePayVerifiedDomainsResponse, type AttemptStatus, type AuthResponse, type AuthenticationCreateRequest, type AuthenticationResponse, type AuthenticationStatus, type AuthenticationType, type AutoRechargeConfig, type AutoRechargeUpdateRequest, type AvailabilityOverrideCreateRequest, type AvailabilityOverrideResponse, AvailabilityOverrides, type AvailabilityPreviewMethod, type AvailabilityPreviewParams, type AvailabilityPreviewResponse, BRANDING_EXPORT_FORMAT, BRANDING_EXPORT_VERSION, type BankCodeResponse, type BankDebitTypes, type BankTransferTypes, type BillingCompleteSetupRequest, type BillingProfileResponse, type BillingSetupRequest, type BillingSetupResponse, type BlockedAttempt, type BlockedAttemptListParams, type BlockedAttemptListResponse, type BlocklistAddRequest, type BlocklistDataKind, type BlocklistResponse, type BrandingExport, type BrandingSource, type BuiltInRegionGroupResponse, type BusinessPaymentLinkConfig, CHECKBOX_CHECKED, CHECKBOX_UNCHECKED, CHECKOUT_EVENT_KINDS, CUSTOM_CSS_MAX_LENGTH, CUSTOM_FIELDS_MAX, CUSTOM_FIELD_CONDITIONS_MAX, CUSTOM_FIELD_KEY_PATTERN, CUSTOM_FIELD_OPERATORS_BY_SOURCE, CUSTOM_FIELD_VALUELESS_OPERATORS, type CancelSubscriptionRequest, type CancelSubscriptionResponse, type CaptureMethod, type CardDetail, type CardDetailFromLocker, type CardNetworkTypes, Cards, type ChangePasswordRequest, type CheckoutBranding, type CheckoutBrandingUpdate, type CheckoutCustomField, type CheckoutEventKind, CheckoutSession, type CheckoutSessionOptions, type ConditionNode, type ConfirmSubscriptionPaymentDetails, type ConfirmSubscriptionRequest, type ConfirmSubscriptionResponse, type Connector, type ConnectorCloneRequest, type ConnectorCreateRequest, type ConnectorListResponse, type ConnectorOwnership, type ConnectorResponse, type ConnectorSelection, type ConnectorType, type ConnectorUpdateRequest, type ConnectorVolumeSplit, type ConnectorWebhookEntry, type ConnectorWebhookEventType, type ConnectorWebhookListResponse, type ConnectorWebhookRegisterRequest, type ConnectorWebhookRegisterResponse, type ConnectorWebhookSyncResponse, type ConnectorWebhookSyncResult, type CornerRadius, type CreateAndConfirmSubscriptionRequest, type CreateSubscriptionPaymentDetails, type CreateSubscriptionRequest, type Currency, type CurrencyRevenue, type CustomFieldCondition, type CustomFieldConditionSource, type CustomFieldContext, type CustomFieldOperator, type CustomFieldOption, type CustomFieldTranslations, type CustomFieldType, type CustomFieldVisibility, type CustomerCreateRequest, type CustomerListParams, type CustomerPaymentMethodsListParams, type CustomerPaymentMethodsListResponse, type CustomerResponse, type CustomerUpdateRequest, DEFAULT_BADGES, DEFAULT_BADGES_DARK, DEFAULT_BRANDING, DEFAULT_BRANDING_DARK, type DeleteAccountRequest, type DeleteUserRoleRequest, Delopay, DelopayAuthenticationError, DelopayError, type DelopayLogger, type DelopayOptions, type DisputeEvidenceBlock, type DisputeEvidenceRequest, type DisputeEvidenceType, type DisputeListParams, type DisputeResponse, type DisputeStage, type DisputeStatus, type EncodedBranding, type EpayoutsCatalogEntry, type EpayoutsCatalogResponse, type EpayoutsLocality, type EpayoutsMethod, type EpayoutsMethodsResponse, type EpayoutsRail, type EphemeralKeyCreateRequest, type EphemeralKeyCreateResponse, type EuclidComparison, type EuclidComparisonType, type EuclidIfStatement, type EuclidValue, type EventClass, type EventDeliveryAttemptResponse, type EventDetailResponse, type EventListParams, type EventListResponse, type EventResponse, type EventType, Export, FeatureMatrix, type FeeOwner, FeeProgramBuilder, type FeeRuleConditions, type FeeRuleDefaultPrecedence, type FeeRuleInput, type FeeRulePreviewRequest, type FeeRulePreviewResponse, type FeeScheduleCreateRequest, type FeeScheduleResponse, type FeeScheduleUpdateRequest, type FeeSpecInput, type FeeStatementDetail, type FeeStatementSummary, type FeeType, Files, type FocusedCheckoutUrlParams, type FontFamily, type FontWeight, Forex, type ForgotPasswordRequest, type FromEmailRequest, type FutureUsage, type GatewayConnectRequest, type GatewayResponse, type GetSubscriptionItemsParams, type GetSubscriptionItemsResponse, type GlobalSearchRequest, type GroupNode, type ImpersonateEmployeeRequest, type IntentStatus, type InviteUsersRequest, type InviteUsersResponse, type InvoiceStatus, type LabelStyle, type LayoutStyle, type LeafNode, type LedgerEntry, type LedgerListParams, type LedgerResponse, type LimitedOperation, type LinkedRoutingConfigRetrieveResponse, type ListInvitableRolesParams, type ListUsersInLineageParams, type LoginHistoryEntry, type LoginHistoryParams, type LoginHistoryResponse, type LogoShape, type LogoSize, type MandateListParams, type MandateResponse, type MandateRevokedResponse, type MandateStatus, type MandateType, type MerchantAccountCreateRequest, type MerchantAccountResponse, type MerchantAccountType, type MerchantAccountUpdateRequest, type MerchantOverviewResponse, type MerchantOverviewStat, type MerchantRoutingAlgorithm, type MethodSurcharge, type MinimalRoleInfo, NATIVE_PANES_MAX, NATIVE_PANE_CATEGORY_KEYS, NATIVE_PANE_ICON_KEYS, type NativePaneMethodInfo, type NativePaneOpenTarget, type NativePaneRail, type NativePaneView, type NativePaneVisibility, type NonPillRadius, type OperationLimitOnExceeded, type OperationLimitRule, type OperationLimitRuleDeleteResponse, type OperationLimitRuleListParams, type OperationLimitScope, type OperationLimitSettings, type OperationLimitWindowMode, OperationLimits, type OverrideAction, type OverrideScope, type ParentGroup, type ParentGroupInfo, type PauseSubscriptionRequest, type PauseSubscriptionResponse, type PaymentAttemptResponse, type PaymentAttemptsListResponse, type PaymentCancelRequest, type PaymentCaptureRequest, type PaymentClientContextEntry, type PaymentClientContextListResponse, type PaymentConfirmRequest, type PaymentCreateRequest, type PaymentErrorDetails, type PaymentExperience, type PaymentExperienceTypes, type PaymentIdFormatConfig, type PaymentIdStyle, type PaymentIntentStateMetadata, type PaymentLayout, type PaymentLinkBackgroundImageConfig, type PaymentLinkConfigRequest, type PaymentLinkListParams, type PaymentLinkListResponse, type PaymentLinkResponse, type PaymentLinkTransactionDetails, type PaymentListFilterConstraints, type PaymentListFilteredResponse, type PaymentListOrder, type PaymentListParams, type PaymentListResponse, type PaymentMethod, type PaymentMethodAmountLimits, type PaymentMethodCreateRequest, type PaymentMethodDeleteResponse, type PaymentMethodDisplayInfo, type PaymentMethodListInstallmentAmountDetails, type PaymentMethodListInstallmentOption, type PaymentMethodListInstallmentPlan, type PaymentMethodListIntentData, type PaymentMethodListParams, type PaymentMethodListResponse, type PaymentMethodResponse, type PaymentMethodType, type PaymentMethodUpdateRequest, type PaymentResponse, type PaymentRetrieveOptions, type PaymentStatusHistoryEntityType, type PaymentStatusHistoryEvent, type PaymentStatusHistoryResponse, type PaymentUpdateRequest, type PaymentsDeletePolicyResponse, type PaymentsDeleteResponse, type PayoutCreateRequest, type PayoutListParams, type PayoutListResponse, type PayoutResponse, type PayoutStatus, type PayoutType, type PayoutUpdateRequest, type PayseproMethod, type PayseproMethodsResponse, type PerMethodSurchargeItem, type PermissionScope, type PhoneDetails, type PhoneOtpRequest, type PhoneOtpResponse, type PhoneOtpVerifyRequest, type PhoneOtpVerifyResponse, type PlatformFeeKind, type PlatformFeeOutput, type PlatformFeeProgram, type PlatformFeeRule, type PlatformFeeRuleInput, type PlatformFeeRuleOutput, type PlatformFeeRuleRecord, type PlatformFeeRuleRequest, type PollStatus, type PollStatusResponse, type ProcessorCostSource, type ProfileAcquirerCreateRequest, type ProfileAcquirerResponse, type ProfileAcquirerUpdateRequest, type ProfileCreateRequest, type ProfileDefaultRoutingConfig, type ProfileDeniedConnectorsResponse, type ProfileLogoUploadResponse, type ProfileResponse, type ProfileUpdateRequest, type ProgramConnectorSelection, type ProjectCreateRequest, type ProjectResponse, type ProjectStats, type ProjectStatsResponse, type ProjectUpdateRequest, type PublishableKey, type RecordCheckoutEventRequest, type RecordCheckoutEventResponse, type RecoveryCodesResponse, type RefundAggregateResponse, type RefundCreateRequest, type RefundListParams, type RefundListResponse, type RefundResponse, type RefundStatus, type RefundType, type RefundUpdateRequest, type RegionCountriesResponse, type RegionCreateRequest, type RegionResponse, type RegionSetCountriesRequest, type RegionUpdateRequest, Regions, type RelayRequest, type RelayResponse, type RelayStatus, type RelayType, type RequestExtras, type RequestFn, type RequestOptions, type RequiredFieldInfo, type ResetPasswordRequest, type ResponsePaymentMethodTypes, type ResponsePaymentMethodsEnabled, type ResumeSubscriptionRequest, type ResumeSubscriptionResponse, type RoutableConnectorChoice, type RoutingActivatePayload, type RoutingConfigCreateRequest, type RoutingConfigResponse, type RoutingDeactivateRequest, type RoutingDictionary, type RoutingDictionaryRecord, type RuleConnectorSelection, STRIPE_NATIVE_PANE_METHODS, Search, type SearchGroupResponse, type SearchIndex, type SearchStatus, Settlement, type SettlementBackfillRequest, type SettlementBackfillResponse, type SettlementBucket, type SettlementCurrentParams, type SettlementCurrentResponse, type SettlementLine, type SettlementLineBase, type SettlementLineListParams, type SettlementLineListResponse, type SettlementLineWithProcessorCost, type SettlementLineWithoutProcessorCost, type SettlementOverviewParams, type SettlementOverviewResponse, type SettlementPayoutStatus, type SettlementStatementListParams, type SettlementStatementListResponse, type ShopCreateRequest, type ShopFeeConfigEntry, type ShopFeeConfigParams, type ShopFeeConfigResponse, type ShopResponse, type ShopSettlementOverview, type ShopStats, type ShopStatsResponse, type ShopUpdateRequest, type ShopVisibilityResponse, type ShopVisibilityUpdateRequest, type SignInRequest, type SignUpRequest, type SignUpWithMerchantIdRequest, type SignUpWithMerchantRequest, type SizeScale, type SpacingScale, type StatementAdjustment, type StatementAdjustmentCreateRequest, type StatementAdjustmentListResponse, type StatementGenerateRequest, type StatementPayoutUpdateRequest, type StatementPdfParams, type StaticRoutingAlgorithm, type StatsPeriod, type StripeConnectAccountRequest, type StripeConnectAccountResponse, type StripeConnectLinkRequest, type StripeConnectLinkResponse, type StripeNativePane, type StripePaymentMethodDomainResult, type StripePaymentMethodDomainStatus, type StripePaymentMethodDomainsRegisterRequest, type StripePaymentMethodDomainsRegisterResponse, type SubscriptionEstimateParams, type SubscriptionEstimateResponse, type SubscriptionInvoice, type SubscriptionItem, type SubscriptionItemPrice, type SubscriptionItemType, type SubscriptionLineItem, type SubscriptionListParams, type SubscriptionPaymentData, type SubscriptionPaymentDetails, type SubscriptionPaymentLink, type SubscriptionPaymentLookupRequest, type SubscriptionPaymentLookupResponse, type SubscriptionPeriodUnit, type SubscriptionResponse, type SubscriptionStatus, Subscriptions, type SummaryPosition, type SurchargeDetailsResponse, type SurchargeResponse, type SurchargeRuleRequest, type SurchargeRuleResponse, type SurfaceStyle, type SwitchMerchantRequest, type SwitchProfileRequest, type Terminate2faQueryParams, type ThreeDSDecision, type ThreeDsRuleExecuteRequest, type ThreeDsRuleResponse, type TierSummary, type TokenPurpose, type TokenResponse, type TopupRequest, type TopupResponse, type TotpResponse, type TransactionType, type TrustBadge, type UpdateMetadataRequest, type UpdateOperationLimitSettingsRequest, type UpdateSubscriptionRequest, type UpdateUserDetailsRequest, type UpdateUserRoleRequest, type UpsertOperationLimitRuleRequest, type UserInLineage, type UserResponse, type UserSessionEntry, type UserSessionListResponse, type UserSessionRevokeResponse, type VaultCheck, type VaultCheckId, type VaultCheckStatus, type VaultCollectSessionResponse, type VaultEnvironment, type VaultPaymentMethodRequest, type VaultPaymentMethodResponse, type VaultRouteApplyVerification, type VaultRouteChange, type VaultRouteChangeKind, type VaultRouteFieldChange, type VaultRouteIds, type VaultRoutePurpose, type VaultRouteWarning, type VaultRouteWarningCode, type VaultRoutesApplyRequest, type VaultRoutesApplyResponse, type VaultRoutesFingerprint, type VaultRoutesPreviewRequest, type VaultRoutesPreviewResponse, type VaultVerificationResponse, type VaultVerifyRequest, type VerifyTotpRequest, type WebhookDeliveryAttempt, type WebhookDeliveryTerminalReason, type WebhookDetails, type WebhookEvent, type WebhookRefundStatus, type WebhookRegistrationEnvironment, Webhooks, allOf, anyOf, applyBrandingVariables, buildBrandingExport, buttonPadValue, cloneBranding, cloneCustomField, cloneNativePane, customFieldContextFromMetadata, customFieldIsTextLike, customFieldOperatorTakesValue, customFieldOptionLabel, customFieldText, decodeBadges, decodeBranding, decodeCustomFields, decodeNativePanes, defaultBranding, defaultCustomFieldVisibility, defaultNativePane, defaultOperatorForSource, encodeBadges, encodeBranding, encodeCustomFields, encodeNativePanes, evaluateCustomFieldCondition, evaluateCustomFieldVisibility, feeProgram, focusedCheckoutUrl, fontStack, fontWeightValue, inputPadValue, isCheckboxChecked, isDarkSurface, isHexColor, leaf, logoDimensions, nativePaneMethodInfo, parseCustomFieldsLoose, parseImportedBranding, programToTree, radiusValue, ruleMatchToTree, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue, visibleCustomFields };
|
|
8391
|
+
export { ALL_CUSTOM_FIELD_CONDITION_SOURCES, ALL_CUSTOM_FIELD_OPERATORS, ALL_CUSTOM_FIELD_TYPES, type AddUserRequest, type AddUserResponse, type Address, type AddressDetails, type AllocationListResponse, type AllocationResponse, type AllocationTransferRequest, type AllocationTransferResponse, type AmountFilter, type AmountRange, Analytics, type AnalyticsChild, type AnalyticsConnectorDay, type AnalyticsConnectorSeries, AnalyticsDashboard, type AnalyticsDayBucket, type AnalyticsMethodSlice, type AnalyticsScopeRequest, type AnalyticsScopeResponse, type ApiKeyCreateRequest, type ApiKeyCreateResponse, type ApiKeyExpiration, type ApiKeyListConstraints, type ApiKeyResponse, type ApiKeyRevokeResponse, type ApiKeyUpdateRequest, type ApplePayVerificationRequest, type ApplePayVerificationResponse, type ApplePayVerifiedDomainsResponse, type AttemptStatus, type AuthResponse, type AuthenticationCreateRequest, type AuthenticationResponse, type AuthenticationStatus, type AuthenticationType, type AutoRechargeConfig, type AutoRechargeUpdateRequest, type AvailabilityOverrideCreateRequest, type AvailabilityOverrideResponse, AvailabilityOverrides, type AvailabilityPreviewMethod, type AvailabilityPreviewParams, type AvailabilityPreviewResponse, BRANDING_EXPORT_FORMAT, BRANDING_EXPORT_VERSION, type BankCodeResponse, type BankDebitTypes, type BankTransferTypes, type BillingCompleteSetupRequest, type BillingProfileResponse, type BillingSetupRequest, type BillingSetupResponse, type BlockedAttempt, type BlockedAttemptListParams, type BlockedAttemptListResponse, type BlocklistAddRequest, type BlocklistDataKind, type BlocklistResponse, type BrandingExport, type BrandingSource, type BuiltInRegionGroupResponse, type BusinessPaymentLinkConfig, CHECKBOX_CHECKED, CHECKBOX_UNCHECKED, CHECKOUT_EVENT_KINDS, CUSTOM_CSS_MAX_LENGTH, CUSTOM_FIELDS_MAX, CUSTOM_FIELD_CONDITIONS_MAX, CUSTOM_FIELD_KEY_PATTERN, CUSTOM_FIELD_OPERATORS_BY_SOURCE, CUSTOM_FIELD_VALUELESS_OPERATORS, type CancelSubscriptionRequest, type CancelSubscriptionResponse, type CaptureMethod, type CardDetail, type CardDetailFromLocker, type CardNetworkTypes, Cards, type ChangePasswordRequest, type CheckoutBranding, type CheckoutBrandingUpdate, type CheckoutCustomField, type CheckoutEventKind, CheckoutSession, type CheckoutSessionOptions, type CheckoutThemeDimension, type CheckoutThemeOutput, type CheckoutThemeProgram, type CheckoutThemeProgramRequest, type CheckoutThemeProgramResponse, type CheckoutThemeRule, type ConditionNode, type ConfirmSubscriptionPaymentDetails, type ConfirmSubscriptionRequest, type ConfirmSubscriptionResponse, type Connector, type ConnectorCloneRequest, type ConnectorCreateRequest, type ConnectorListResponse, type ConnectorOwnership, type ConnectorResponse, type ConnectorSelection, type ConnectorType, type ConnectorUpdateRequest, type ConnectorVolumeSplit, type ConnectorWebhookEntry, type ConnectorWebhookEventType, type ConnectorWebhookListResponse, type ConnectorWebhookRegisterRequest, type ConnectorWebhookRegisterResponse, type ConnectorWebhookSyncResponse, type ConnectorWebhookSyncResult, type CornerRadius, type CreateAndConfirmSubscriptionRequest, type CreateSubscriptionPaymentDetails, type CreateSubscriptionRequest, type Currency, type CurrencyRevenue, type CustomFieldCondition, type CustomFieldConditionSource, type CustomFieldContext, type CustomFieldOperator, type CustomFieldOption, type CustomFieldTranslations, type CustomFieldType, type CustomFieldVisibility, type CustomerCreateRequest, type CustomerListParams, type CustomerPaymentMethodsListParams, type CustomerPaymentMethodsListResponse, type CustomerResponse, type CustomerUpdateRequest, DEFAULT_BADGES, DEFAULT_BADGES_DARK, DEFAULT_BRANDING, DEFAULT_BRANDING_DARK, type DeleteAccountRequest, type DeleteUserRoleRequest, Delopay, DelopayAuthenticationError, DelopayError, type DelopayLogger, type DelopayOptions, type DisputeEvidenceBlock, type DisputeEvidenceRequest, type DisputeEvidenceType, type DisputeListParams, type DisputeResponse, type DisputeStage, type DisputeStatus, type EncodedBranding, type EpayoutsCatalogEntry, type EpayoutsCatalogResponse, type EpayoutsLocality, type EpayoutsMethod, type EpayoutsMethodsResponse, type EpayoutsRail, type EphemeralKeyCreateRequest, type EphemeralKeyCreateResponse, type EuclidComparison, type EuclidComparisonType, type EuclidIfStatement, type EuclidValue, type EventClass, type EventDeliveryAttemptResponse, type EventDetailResponse, type EventListParams, type EventListResponse, type EventResponse, type EventType, Export, FeatureMatrix, type FeeOwner, FeeProgramBuilder, type FeeRuleConditions, type FeeRuleDefaultPrecedence, type FeeRuleInput, type FeeRulePreviewRequest, type FeeRulePreviewResponse, type FeeScheduleCreateRequest, type FeeScheduleResponse, type FeeScheduleUpdateRequest, type FeeSpecInput, type FeeStatementDetail, type FeeStatementSummary, type FeeType, Files, type FocusedCheckoutUrlParams, type FontFamily, type FontWeight, Forex, type ForgotPasswordRequest, type FromEmailRequest, type FutureUsage, type GatewayConnectRequest, type GatewayResponse, type GetSubscriptionItemsParams, type GetSubscriptionItemsResponse, type GlobalSearchRequest, type GroupNode, type ImpersonateEmployeeRequest, type IntentStatus, type InviteUsersRequest, type InviteUsersResponse, type InvoiceStatus, type LabelStyle, type LayoutStyle, type LeafNode, type LedgerEntry, type LedgerListParams, type LedgerResponse, type LimitedOperation, type LinkedRoutingConfigRetrieveResponse, type ListInvitableRolesParams, type ListUsersInLineageParams, type LoginHistoryEntry, type LoginHistoryParams, type LoginHistoryResponse, type LogoShape, type LogoSize, type MandateListParams, type MandateResponse, type MandateRevokedResponse, type MandateStatus, type MandateType, type MerchantAccountCreateRequest, type MerchantAccountResponse, type MerchantAccountType, type MerchantAccountUpdateRequest, type MerchantOverviewResponse, type MerchantOverviewStat, type MerchantRoutingAlgorithm, type MethodSurcharge, type MinimalRoleInfo, NATIVE_PANES_MAX, NATIVE_PANE_CATEGORY_KEYS, NATIVE_PANE_ICON_KEYS, type NativePaneMethodInfo, type NativePaneOpenTarget, type NativePaneRail, type NativePaneView, type NativePaneVisibility, type NonPillRadius, type OperationLimitOnExceeded, type OperationLimitRule, type OperationLimitRuleDeleteResponse, type OperationLimitRuleListParams, type OperationLimitScope, type OperationLimitSettings, type OperationLimitWindowMode, OperationLimits, type OverrideAction, type OverrideScope, type ParentGroup, type ParentGroupInfo, type PauseSubscriptionRequest, type PauseSubscriptionResponse, type PaymentAttemptResponse, type PaymentAttemptsListResponse, type PaymentCancelRequest, type PaymentCaptureRequest, type PaymentClientContextEntry, type PaymentClientContextListResponse, type PaymentConfirmRequest, type PaymentCreateRequest, type PaymentErrorDetails, type PaymentExperience, type PaymentExperienceTypes, type PaymentIdFormatConfig, type PaymentIdStyle, type PaymentIntentStateMetadata, type PaymentLayout, type PaymentLinkBackgroundImageConfig, type PaymentLinkConfigRequest, type PaymentLinkListParams, type PaymentLinkListResponse, type PaymentLinkResponse, type PaymentLinkTransactionDetails, type PaymentListFilterConstraints, type PaymentListFilteredResponse, type PaymentListOrder, type PaymentListParams, type PaymentListResponse, type PaymentMethod, type PaymentMethodAmountLimits, type PaymentMethodCreateRequest, type PaymentMethodDeleteResponse, type PaymentMethodDisplayInfo, type PaymentMethodListInstallmentAmountDetails, type PaymentMethodListInstallmentOption, type PaymentMethodListInstallmentPlan, type PaymentMethodListIntentData, type PaymentMethodListParams, type PaymentMethodListResponse, type PaymentMethodResponse, type PaymentMethodType, type PaymentMethodUpdateRequest, type PaymentResponse, type PaymentRetrieveOptions, type PaymentStatusHistoryEntityType, type PaymentStatusHistoryEvent, type PaymentStatusHistoryResponse, type PaymentUpdateRequest, type PaymentsDeletePolicyResponse, type PaymentsDeleteResponse, type PayoutCreateRequest, type PayoutListParams, type PayoutListResponse, type PayoutResponse, type PayoutStatus, type PayoutType, type PayoutUpdateRequest, type PayseproMethod, type PayseproMethodsResponse, type PerMethodSurchargeItem, type PermissionScope, type PhoneDetails, type PhoneOtpRequest, type PhoneOtpResponse, type PhoneOtpVerifyRequest, type PhoneOtpVerifyResponse, type PlatformFeeKind, type PlatformFeeOutput, type PlatformFeeProgram, type PlatformFeeRule, type PlatformFeeRuleInput, type PlatformFeeRuleOutput, type PlatformFeeRuleRecord, type PlatformFeeRuleRequest, type PollStatus, type PollStatusResponse, type ProcessorCostSource, type ProfileAcquirerCreateRequest, type ProfileAcquirerResponse, type ProfileAcquirerUpdateRequest, type ProfileCreateRequest, type ProfileDefaultRoutingConfig, type ProfileDeniedConnectorsResponse, type ProfileLogoUploadResponse, type ProfileResponse, type ProfileUpdateRequest, type ProgramConnectorSelection, type ProjectCreateRequest, type ProjectResponse, type ProjectStats, type ProjectStatsResponse, type ProjectUpdateRequest, type PublishableKey, type RecordCheckoutEventRequest, type RecordCheckoutEventResponse, type RecoveryCodesResponse, type RefundAggregateResponse, type RefundCreateRequest, type RefundListParams, type RefundListResponse, type RefundResponse, type RefundStatus, type RefundType, type RefundUpdateRequest, type RegionCountriesResponse, type RegionCreateRequest, type RegionResponse, type RegionSetCountriesRequest, type RegionUpdateRequest, Regions, type RelayRequest, type RelayResponse, type RelayStatus, type RelayType, type RequestExtras, type RequestFn, type RequestOptions, type RequiredFieldInfo, type ResetPasswordRequest, type ResponsePaymentMethodTypes, type ResponsePaymentMethodsEnabled, type ResumeSubscriptionRequest, type ResumeSubscriptionResponse, type RoutableConnectorChoice, type RoutingActivatePayload, type RoutingConfigCreateRequest, type RoutingConfigResponse, type RoutingDeactivateRequest, type RoutingDictionary, type RoutingDictionaryRecord, type RuleConnectorSelection, STRIPE_NATIVE_PANE_METHODS, Search, type SearchGroupResponse, type SearchIndex, type SearchStatus, Settlement, type SettlementBackfillRequest, type SettlementBackfillResponse, type SettlementBucket, type SettlementCurrentParams, type SettlementCurrentResponse, type SettlementLine, type SettlementLineBase, type SettlementLineListParams, type SettlementLineListResponse, type SettlementLineWithProcessorCost, type SettlementLineWithoutProcessorCost, type SettlementOverviewParams, type SettlementOverviewResponse, type SettlementPayoutStatus, type SettlementStatementListParams, type SettlementStatementListResponse, type ShopCreateRequest, type ShopFeeConfigEntry, type ShopFeeConfigParams, type ShopFeeConfigResponse, type ShopResponse, type ShopSettlementOverview, type ShopStats, type ShopStatsResponse, type ShopUpdateRequest, type ShopVisibilityResponse, type ShopVisibilityUpdateRequest, type SignInRequest, type SignUpRequest, type SignUpWithMerchantIdRequest, type SignUpWithMerchantRequest, type SizeScale, type SpacingScale, type StatementAdjustment, type StatementAdjustmentCreateRequest, type StatementAdjustmentListResponse, type StatementGenerateRequest, type StatementPayoutUpdateRequest, type StatementPdfParams, type StaticRoutingAlgorithm, type StatsPeriod, type StripeConnectAccountRequest, type StripeConnectAccountResponse, type StripeConnectLinkRequest, type StripeConnectLinkResponse, type StripeNativePane, type StripePaymentMethodDomainResult, type StripePaymentMethodDomainStatus, type StripePaymentMethodDomainsRegisterRequest, type StripePaymentMethodDomainsRegisterResponse, type SubscriptionEstimateParams, type SubscriptionEstimateResponse, type SubscriptionInvoice, type SubscriptionItem, type SubscriptionItemPrice, type SubscriptionItemType, type SubscriptionLineItem, type SubscriptionListParams, type SubscriptionPaymentData, type SubscriptionPaymentDetails, type SubscriptionPaymentLink, type SubscriptionPaymentLookupRequest, type SubscriptionPaymentLookupResponse, type SubscriptionPeriodUnit, type SubscriptionResponse, type SubscriptionStatus, Subscriptions, type SummaryPosition, type SurchargeDetailsResponse, type SurchargeResponse, type SurchargeRuleRequest, type SurchargeRuleResponse, type SurfaceStyle, type SwitchMerchantRequest, type SwitchProfileRequest, type Terminate2faQueryParams, type ThemeBrowserLanguage, type ThemeCheckoutChannel, type ThemeChoice, type ThemeCondition, type ThemeDeviceClass, type ThemeEnumCondition, type ThemeIfStatement, type ThemeMetadataCondition, type ThemeNumberCondition, type ThemeTrafficSource, type ThreeDSDecision, type ThreeDsRuleExecuteRequest, type ThreeDsRuleResponse, type TierSummary, type TokenPurpose, type TokenResponse, type TopupRequest, type TopupResponse, type TotpResponse, type TransactionType, type TrustBadge, type UpdateMetadataRequest, type UpdateOperationLimitSettingsRequest, type UpdateSubscriptionRequest, type UpdateUserDetailsRequest, type UpdateUserRoleRequest, type UpsertOperationLimitRuleRequest, type UserInLineage, type UserResponse, type UserSessionEntry, type UserSessionListResponse, type UserSessionRevokeResponse, type VaultCheck, type VaultCheckId, type VaultCheckStatus, type VaultCollectSessionResponse, type VaultEnvironment, type VaultPaymentMethodRequest, type VaultPaymentMethodResponse, type VaultRouteApplyVerification, type VaultRouteChange, type VaultRouteChangeKind, type VaultRouteFieldChange, type VaultRouteIds, type VaultRoutePurpose, type VaultRouteWarning, type VaultRouteWarningCode, type VaultRoutesApplyRequest, type VaultRoutesApplyResponse, type VaultRoutesFingerprint, type VaultRoutesPreviewRequest, type VaultRoutesPreviewResponse, type VaultVerificationResponse, type VaultVerifyRequest, type VerifyTotpRequest, type WebhookDeliveryAttempt, type WebhookDeliveryTerminalReason, type WebhookDetails, type WebhookEvent, type WebhookRefundStatus, type WebhookRegistrationEnvironment, Webhooks, allOf, anyOf, applyBrandingVariables, buildBrandingExport, buttonPadValue, cloneBranding, cloneCustomField, cloneNativePane, customFieldContextFromMetadata, customFieldIsTextLike, customFieldOperatorTakesValue, customFieldOptionLabel, customFieldText, decodeBadges, decodeBranding, decodeCustomFields, decodeNativePanes, defaultBranding, defaultCustomFieldVisibility, defaultNativePane, defaultOperatorForSource, encodeBadges, encodeBranding, encodeCustomFields, encodeNativePanes, evaluateCustomFieldCondition, evaluateCustomFieldVisibility, feeProgram, focusedCheckoutUrl, fontStack, fontWeightValue, inputPadValue, isCheckboxChecked, isDarkSurface, isHexColor, leaf, logoDimensions, nativePaneMethodInfo, parseCustomFieldsLoose, parseImportedBranding, programToTree, radiusValue, ruleMatchToTree, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue, visibleCustomFields };
|
package/dist/index.js
CHANGED
package/dist/internal.cjs
CHANGED
|
@@ -2215,6 +2215,7 @@ var Routing = class {
|
|
|
2215
2215
|
this.request = request;
|
|
2216
2216
|
this.decision = new RoutingDecisionManager(request);
|
|
2217
2217
|
this.surchargeRules = new SurchargeRules(request);
|
|
2218
|
+
this.checkoutThemeRules = new CheckoutThemeRules(request);
|
|
2218
2219
|
}
|
|
2219
2220
|
/**
|
|
2220
2221
|
* Create a new routing algorithm.
|
|
@@ -2443,6 +2444,90 @@ var SurchargeRules = class {
|
|
|
2443
2444
|
});
|
|
2444
2445
|
}
|
|
2445
2446
|
};
|
|
2447
|
+
var CheckoutThemeRules = class {
|
|
2448
|
+
constructor(request) {
|
|
2449
|
+
this.request = request;
|
|
2450
|
+
}
|
|
2451
|
+
/**
|
|
2452
|
+
* Create or replace the theme program for a scope.
|
|
2453
|
+
*
|
|
2454
|
+
* `PUT /routing/checkout-theme/rules`
|
|
2455
|
+
*
|
|
2456
|
+
* Supersedes rather than overwrites: the previous active version is retired
|
|
2457
|
+
* and a new one stored, so the record of which look was live when survives.
|
|
2458
|
+
* Pass `active: false` to store a revision **without** retiring the live one —
|
|
2459
|
+
* that is where a program drafted against a variant you have not built yet
|
|
2460
|
+
* belongs.
|
|
2461
|
+
*
|
|
2462
|
+
* @example A phone in Germany gets the compact look; everyone else the house style.
|
|
2463
|
+
* ```typescript
|
|
2464
|
+
* await delopay.routing.checkoutThemeRules.upsert({
|
|
2465
|
+
* name: 'Autumn targeting',
|
|
2466
|
+
* profile_id: 'pro_...',
|
|
2467
|
+
* algorithm: {
|
|
2468
|
+
* rules: [
|
|
2469
|
+
* {
|
|
2470
|
+
* name: 'German phones',
|
|
2471
|
+
* connectorSelection: { theme: { variant: 'compact' } },
|
|
2472
|
+
* statements: [
|
|
2473
|
+
* {
|
|
2474
|
+
* condition: [
|
|
2475
|
+
* {
|
|
2476
|
+
* lhs: 'device_class',
|
|
2477
|
+
* comparison: 'equal',
|
|
2478
|
+
* value: { type: 'enum_variant', value: 'phone' },
|
|
2479
|
+
* metadata: {},
|
|
2480
|
+
* },
|
|
2481
|
+
* {
|
|
2482
|
+
* lhs: 'browser_language',
|
|
2483
|
+
* comparison: 'equal',
|
|
2484
|
+
* value: { type: 'enum_variant', value: 'de' },
|
|
2485
|
+
* metadata: {},
|
|
2486
|
+
* },
|
|
2487
|
+
* ],
|
|
2488
|
+
* },
|
|
2489
|
+
* ],
|
|
2490
|
+
* },
|
|
2491
|
+
* ],
|
|
2492
|
+
* defaultSelection: { theme: { variant: 'house' } },
|
|
2493
|
+
* metadata: {},
|
|
2494
|
+
* },
|
|
2495
|
+
* });
|
|
2496
|
+
* ```
|
|
2497
|
+
*/
|
|
2498
|
+
async upsert(params) {
|
|
2499
|
+
return this.request("PUT", "/routing/checkout-theme/rules", { body: params });
|
|
2500
|
+
}
|
|
2501
|
+
/**
|
|
2502
|
+
* Retrieve the active theme program for a scope, or `null` when none is set.
|
|
2503
|
+
*
|
|
2504
|
+
* `GET /routing/checkout-theme/rules?profile_id={profileId}`
|
|
2505
|
+
*
|
|
2506
|
+
* @param profileId - Shop scope. Omit for the merchant-wide program. A
|
|
2507
|
+
* shop-scoped caller that omits it gets its own shop's program.
|
|
2508
|
+
*/
|
|
2509
|
+
async retrieve(profileId) {
|
|
2510
|
+
return this.request("GET", "/routing/checkout-theme/rules", {
|
|
2511
|
+
query: { profile_id: profileId }
|
|
2512
|
+
});
|
|
2513
|
+
}
|
|
2514
|
+
/**
|
|
2515
|
+
* Deactivate the active theme program for a scope. Idempotent.
|
|
2516
|
+
*
|
|
2517
|
+
* `DELETE /routing/checkout-theme/rules?profile_id={profileId}`
|
|
2518
|
+
*
|
|
2519
|
+
* Deactivation, not deletion — the stored row is what says which look was
|
|
2520
|
+
* live when, and that history cannot be reconstructed after the fact. Shops
|
|
2521
|
+
* go back to their default appearance immediately.
|
|
2522
|
+
*
|
|
2523
|
+
* @param profileId - Shop scope. Omit for the merchant-wide program.
|
|
2524
|
+
*/
|
|
2525
|
+
async delete(profileId) {
|
|
2526
|
+
return this.request("DELETE", "/routing/checkout-theme/rules", {
|
|
2527
|
+
query: { profile_id: profileId }
|
|
2528
|
+
});
|
|
2529
|
+
}
|
|
2530
|
+
};
|
|
2446
2531
|
|
|
2447
2532
|
// src/resources/search.ts
|
|
2448
2533
|
var Search = class {
|
|
@@ -2718,6 +2803,33 @@ var Users = class {
|
|
|
2718
2803
|
async signOut() {
|
|
2719
2804
|
return this.request("POST", "/user/signout");
|
|
2720
2805
|
}
|
|
2806
|
+
/**
|
|
2807
|
+
* Sliding-session refresh: exchange the current (still-valid) login JWT
|
|
2808
|
+
* for a fresh one with the same claims and a full lifetime. The backend
|
|
2809
|
+
* keeps the session's identity (`jti`), slides `user_session.expires_at`
|
|
2810
|
+
* forward and re-sets the `login_token` cookie.
|
|
2811
|
+
*
|
|
2812
|
+
* Requires a token backed by a revocable session (a `jti` claim). Signin
|
|
2813
|
+
* and switch-merchant/-profile tokens have one; **session-less tokens do
|
|
2814
|
+
* not and are rejected with 400** — team-impersonation tokens are the
|
|
2815
|
+
* case in practice, and they are deliberately tab-scoped and
|
|
2816
|
+
* time-bounded rather than renewable. A 400 here is not a dead session:
|
|
2817
|
+
* the token remains valid for ordinary calls, it simply cannot slide.
|
|
2818
|
+
*
|
|
2819
|
+
* Rejected (401) for expired, blacklisted or revoked tokens — refresh can
|
|
2820
|
+
* only extend a session that is still alive. Rate-limited server-side
|
|
2821
|
+
* (429) to one mint per session per minute; treat a 429 as "still fresh
|
|
2822
|
+
* enough", not as an error.
|
|
2823
|
+
*
|
|
2824
|
+
* The returned token is NOT applied to this client automatically — pass
|
|
2825
|
+
* it to `setJwtToken()`, or use {@link Delopay.refreshSession} which does
|
|
2826
|
+
* both.
|
|
2827
|
+
*
|
|
2828
|
+
* `POST /user/token/refresh`. Requires a logged-in JWT.
|
|
2829
|
+
*/
|
|
2830
|
+
async refreshToken() {
|
|
2831
|
+
return this.request("POST", "/user/token/refresh");
|
|
2832
|
+
}
|
|
2721
2833
|
/**
|
|
2722
2834
|
* Paginated login history for the authenticated user -- IP, User-Agent,
|
|
2723
2835
|
* country / city / lat-lon (when GeoIP is enabled), success and failure
|
|
@@ -3985,6 +4097,41 @@ var Delopay = class {
|
|
|
3985
4097
|
clearJwtToken() {
|
|
3986
4098
|
this.jwtToken = void 0;
|
|
3987
4099
|
}
|
|
4100
|
+
/**
|
|
4101
|
+
* Refresh the current login JWT (see {@link Users.refreshToken}) and
|
|
4102
|
+
* apply the fresh token to this client, so subsequent requests use it.
|
|
4103
|
+
* Returns the fresh token for the caller to persist (e.g. session
|
|
4104
|
+
* storage) — the backend has already re-set the `login_token` cookie.
|
|
4105
|
+
*
|
|
4106
|
+
* If the client's auth state changes while the refresh is pending —
|
|
4107
|
+
* `clearJwtToken()` on sign-out, or `setJwtToken()` switching to another
|
|
4108
|
+
* session — the stale completion is discarded and this rejects with a
|
|
4109
|
+
* `session_changed` `DelopayError` (status 0), so the explicit change
|
|
4110
|
+
* wins and the caller never persists a token for a session that is gone.
|
|
4111
|
+
*
|
|
4112
|
+
* Otherwise throws like any other request; in particular a 401 means the
|
|
4113
|
+
* session is dead (expired/blacklisted/revoked), a 429 means a refresh
|
|
4114
|
+
* was already minted for this session within the last minute, and a 400
|
|
4115
|
+
* means this token has no revocable session to slide (no `jti` — team
|
|
4116
|
+
* impersonation is the case in practice) and can never be refreshed,
|
|
4117
|
+
* though it stays valid for ordinary calls.
|
|
4118
|
+
*/
|
|
4119
|
+
async refreshSession() {
|
|
4120
|
+
const originatingToken = this.jwtToken;
|
|
4121
|
+
const response = await this.users.refreshToken();
|
|
4122
|
+
if (this.jwtToken !== originatingToken) {
|
|
4123
|
+
throw new DelopayError(
|
|
4124
|
+
"Auth state changed while the refresh was pending; refreshed token discarded",
|
|
4125
|
+
{
|
|
4126
|
+
status: 0,
|
|
4127
|
+
code: "session_changed",
|
|
4128
|
+
type: "session_changed"
|
|
4129
|
+
}
|
|
4130
|
+
);
|
|
4131
|
+
}
|
|
4132
|
+
this.setJwtToken(response.token);
|
|
4133
|
+
return response;
|
|
4134
|
+
}
|
|
3988
4135
|
/**
|
|
3989
4136
|
* Make a raw HTTP request to the Delopay API.
|
|
3990
4137
|
*
|