@relipay/shared-types 0.1.0-beta.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.
@@ -0,0 +1,1378 @@
1
+ /**
2
+ * @relipay/shared-types
3
+ *
4
+ * Zod schemas + TypeScript types shared between the API and the SDKs.
5
+ * Anything serialized over the wire lives here — never duplicate a shape.
6
+ */
7
+ import { z } from 'zod';
8
+ /**
9
+ * The error envelope every ReliPay API response uses on failure.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * { code: 'PLAN_NOT_FOUND', message: 'Plan "pro" not found.', fix: 'Run `relipay plans list`.' }
14
+ * ```
15
+ */
16
+ export declare const RelipayErrorSchema: z.ZodObject<{
17
+ code: z.ZodString;
18
+ message: z.ZodString;
19
+ /** Concrete remediation a human or AI agent can act on. */
20
+ fix: z.ZodOptional<z.ZodString>;
21
+ /** Documentation URL for this error code. */
22
+ docs: z.ZodOptional<z.ZodString>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ code: string;
25
+ message: string;
26
+ fix?: string | undefined;
27
+ docs?: string | undefined;
28
+ }, {
29
+ code: string;
30
+ message: string;
31
+ fix?: string | undefined;
32
+ docs?: string | undefined;
33
+ }>;
34
+ export type RelipayError = z.infer<typeof RelipayErrorSchema>;
35
+ export declare const ApiResponseSchema: <T extends z.ZodTypeAny>(data: T) => z.ZodDiscriminatedUnion<"success", [z.ZodObject<{
36
+ success: z.ZodLiteral<true>;
37
+ data: T;
38
+ }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
39
+ success: z.ZodLiteral<true>;
40
+ data: T;
41
+ }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
42
+ success: z.ZodLiteral<true>;
43
+ data: T;
44
+ }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>, z.ZodObject<{
45
+ success: z.ZodLiteral<false>;
46
+ error: z.ZodObject<{
47
+ code: z.ZodString;
48
+ message: z.ZodString;
49
+ /** Concrete remediation a human or AI agent can act on. */
50
+ fix: z.ZodOptional<z.ZodString>;
51
+ /** Documentation URL for this error code. */
52
+ docs: z.ZodOptional<z.ZodString>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ code: string;
55
+ message: string;
56
+ fix?: string | undefined;
57
+ docs?: string | undefined;
58
+ }, {
59
+ code: string;
60
+ message: string;
61
+ fix?: string | undefined;
62
+ docs?: string | undefined;
63
+ }>;
64
+ }, "strip", z.ZodTypeAny, {
65
+ success: false;
66
+ error: {
67
+ code: string;
68
+ message: string;
69
+ fix?: string | undefined;
70
+ docs?: string | undefined;
71
+ };
72
+ }, {
73
+ success: false;
74
+ error: {
75
+ code: string;
76
+ message: string;
77
+ fix?: string | undefined;
78
+ docs?: string | undefined;
79
+ };
80
+ }>]>;
81
+ /**
82
+ * Auth methods this Application exposes. `password` and `magic_link` are
83
+ * primary methods (the SDK calls them directly). OAuth provider presence is
84
+ * implicit from `Application.oauthConfig` having that provider as a key —
85
+ * not duplicated here. Open string to keep the enum from limiting future
86
+ * additions.
87
+ */
88
+ export declare const AuthMethodSchema: z.ZodString;
89
+ export type AuthMethod = z.infer<typeof AuthMethodSchema>;
90
+ export declare const AuthConfigSchema: z.ZodObject<{
91
+ /** Which primary methods are enabled. Empty array = OAuth-only app. */
92
+ methods: z.ZodArray<z.ZodString, "many">;
93
+ passwordMinLength: z.ZodDefault<z.ZodNumber>;
94
+ /** Where to send the user after sign-in / sign-up. */
95
+ redirectUrls: z.ZodArray<z.ZodString, "many">;
96
+ /** If true, organisations / teams are enabled for this application. */
97
+ organizationsEnabled: z.ZodDefault<z.ZodBoolean>;
98
+ /** If false, public sign-up is blocked and operators must invite end-users. */
99
+ signupEnabled: z.ZodDefault<z.ZodBoolean>;
100
+ /**
101
+ * End-user two-factor (TOTP) policy for this Application:
102
+ * - `off` — MFA endpoints are refused (`MFA_NOT_ENABLED`).
103
+ * - `optional` — end-users may enroll; enrolled users are challenged at
104
+ * sign-in (the default — preserves prior behaviour).
105
+ * - `required` — sign-in returns `mfaEnrollmentRequired: true` for users
106
+ * who haven't enrolled yet, so the app can force setup.
107
+ */
108
+ mfa: z.ZodDefault<z.ZodEnum<["off", "optional", "required"]>>;
109
+ /**
110
+ * If true (default), submitted passwords are checked against the HIBP
111
+ * Pwned Passwords k-anonymity API at sign-up + password-reset +
112
+ * password-change time. Operators on offline / restricted networks can
113
+ * opt out per Application; a deployment-level kill-switch lives at
114
+ * env `HIBP_BREACH_CHECK_DISABLED=true`.
115
+ */
116
+ passwordBreachCheckEnabled: z.ZodDefault<z.ZodBoolean>;
117
+ /**
118
+ * WebAuthn / passkey configuration. Both fields are required when
119
+ * `"passkey"` appears in `methods` — the registration ceremony needs
120
+ * to bind credentials to a specific Relying Party. `rpId` is the
121
+ * eTLD+1 the credential is scoped to (e.g. `"acme.example.com"`),
122
+ * `rpOrigins` is the list of full origins the customer's app will
123
+ * authenticate from (used to verify `origin` on the client response).
124
+ */
125
+ webauthn: z.ZodOptional<z.ZodObject<{
126
+ rpId: z.ZodString;
127
+ /** At least one origin required. e.g. `["https://app.acme.example.com"]`. */
128
+ rpOrigins: z.ZodArray<z.ZodString, "many">;
129
+ /** Human-readable name shown in the OS passkey UI. Falls back to `rpId`. */
130
+ rpName: z.ZodOptional<z.ZodString>;
131
+ }, "strip", z.ZodTypeAny, {
132
+ rpId: string;
133
+ rpOrigins: string[];
134
+ rpName?: string | undefined;
135
+ }, {
136
+ rpId: string;
137
+ rpOrigins: string[];
138
+ rpName?: string | undefined;
139
+ }>>;
140
+ }, "strip", z.ZodTypeAny, {
141
+ methods: string[];
142
+ passwordMinLength: number;
143
+ redirectUrls: string[];
144
+ organizationsEnabled: boolean;
145
+ signupEnabled: boolean;
146
+ mfa: "off" | "optional" | "required";
147
+ passwordBreachCheckEnabled: boolean;
148
+ webauthn?: {
149
+ rpId: string;
150
+ rpOrigins: string[];
151
+ rpName?: string | undefined;
152
+ } | undefined;
153
+ }, {
154
+ methods: string[];
155
+ redirectUrls: string[];
156
+ passwordMinLength?: number | undefined;
157
+ organizationsEnabled?: boolean | undefined;
158
+ signupEnabled?: boolean | undefined;
159
+ mfa?: "off" | "optional" | "required" | undefined;
160
+ passwordBreachCheckEnabled?: boolean | undefined;
161
+ webauthn?: {
162
+ rpId: string;
163
+ rpOrigins: string[];
164
+ rpName?: string | undefined;
165
+ } | undefined;
166
+ }>;
167
+ export type AuthConfig = z.infer<typeof AuthConfigSchema>;
168
+ export declare const BillingProviderSchema: z.ZodEnum<["stripe", "paypal", "razorpay"]>;
169
+ export type BillingProvider = z.infer<typeof BillingProviderSchema>;
170
+ export declare const BillingConfigSchema: z.ZodObject<{
171
+ provider: z.ZodEnum<["stripe", "paypal", "razorpay"]>;
172
+ /** Default currency for this application. ISO 4217. */
173
+ currency: z.ZodDefault<z.ZodString>;
174
+ /** Provider-specific config — Stripe account id, PayPal merchant id, etc. */
175
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
176
+ }, "strip", z.ZodTypeAny, {
177
+ provider: "stripe" | "paypal" | "razorpay";
178
+ currency: string;
179
+ metadata: Record<string, unknown>;
180
+ }, {
181
+ provider: "stripe" | "paypal" | "razorpay";
182
+ currency?: string | undefined;
183
+ metadata?: Record<string, unknown> | undefined;
184
+ }>;
185
+ export type BillingConfig = z.infer<typeof BillingConfigSchema>;
186
+ export declare const ApplicationDtoSchema: z.ZodObject<{
187
+ id: z.ZodString;
188
+ tenantId: z.ZodString;
189
+ name: z.ZodString;
190
+ slug: z.ZodString;
191
+ publicKey: z.ZodString;
192
+ authConfig: z.ZodObject<{
193
+ /** Which primary methods are enabled. Empty array = OAuth-only app. */
194
+ methods: z.ZodArray<z.ZodString, "many">;
195
+ passwordMinLength: z.ZodDefault<z.ZodNumber>;
196
+ /** Where to send the user after sign-in / sign-up. */
197
+ redirectUrls: z.ZodArray<z.ZodString, "many">;
198
+ /** If true, organisations / teams are enabled for this application. */
199
+ organizationsEnabled: z.ZodDefault<z.ZodBoolean>;
200
+ /** If false, public sign-up is blocked and operators must invite end-users. */
201
+ signupEnabled: z.ZodDefault<z.ZodBoolean>;
202
+ /**
203
+ * End-user two-factor (TOTP) policy for this Application:
204
+ * - `off` — MFA endpoints are refused (`MFA_NOT_ENABLED`).
205
+ * - `optional` — end-users may enroll; enrolled users are challenged at
206
+ * sign-in (the default — preserves prior behaviour).
207
+ * - `required` — sign-in returns `mfaEnrollmentRequired: true` for users
208
+ * who haven't enrolled yet, so the app can force setup.
209
+ */
210
+ mfa: z.ZodDefault<z.ZodEnum<["off", "optional", "required"]>>;
211
+ /**
212
+ * If true (default), submitted passwords are checked against the HIBP
213
+ * Pwned Passwords k-anonymity API at sign-up + password-reset +
214
+ * password-change time. Operators on offline / restricted networks can
215
+ * opt out per Application; a deployment-level kill-switch lives at
216
+ * env `HIBP_BREACH_CHECK_DISABLED=true`.
217
+ */
218
+ passwordBreachCheckEnabled: z.ZodDefault<z.ZodBoolean>;
219
+ /**
220
+ * WebAuthn / passkey configuration. Both fields are required when
221
+ * `"passkey"` appears in `methods` — the registration ceremony needs
222
+ * to bind credentials to a specific Relying Party. `rpId` is the
223
+ * eTLD+1 the credential is scoped to (e.g. `"acme.example.com"`),
224
+ * `rpOrigins` is the list of full origins the customer's app will
225
+ * authenticate from (used to verify `origin` on the client response).
226
+ */
227
+ webauthn: z.ZodOptional<z.ZodObject<{
228
+ rpId: z.ZodString;
229
+ /** At least one origin required. e.g. `["https://app.acme.example.com"]`. */
230
+ rpOrigins: z.ZodArray<z.ZodString, "many">;
231
+ /** Human-readable name shown in the OS passkey UI. Falls back to `rpId`. */
232
+ rpName: z.ZodOptional<z.ZodString>;
233
+ }, "strip", z.ZodTypeAny, {
234
+ rpId: string;
235
+ rpOrigins: string[];
236
+ rpName?: string | undefined;
237
+ }, {
238
+ rpId: string;
239
+ rpOrigins: string[];
240
+ rpName?: string | undefined;
241
+ }>>;
242
+ }, "strip", z.ZodTypeAny, {
243
+ methods: string[];
244
+ passwordMinLength: number;
245
+ redirectUrls: string[];
246
+ organizationsEnabled: boolean;
247
+ signupEnabled: boolean;
248
+ mfa: "off" | "optional" | "required";
249
+ passwordBreachCheckEnabled: boolean;
250
+ webauthn?: {
251
+ rpId: string;
252
+ rpOrigins: string[];
253
+ rpName?: string | undefined;
254
+ } | undefined;
255
+ }, {
256
+ methods: string[];
257
+ redirectUrls: string[];
258
+ passwordMinLength?: number | undefined;
259
+ organizationsEnabled?: boolean | undefined;
260
+ signupEnabled?: boolean | undefined;
261
+ mfa?: "off" | "optional" | "required" | undefined;
262
+ passwordBreachCheckEnabled?: boolean | undefined;
263
+ webauthn?: {
264
+ rpId: string;
265
+ rpOrigins: string[];
266
+ rpName?: string | undefined;
267
+ } | undefined;
268
+ }>;
269
+ billingConfig: z.ZodObject<{
270
+ provider: z.ZodEnum<["stripe", "paypal", "razorpay"]>;
271
+ /** Default currency for this application. ISO 4217. */
272
+ currency: z.ZodDefault<z.ZodString>;
273
+ /** Provider-specific config — Stripe account id, PayPal merchant id, etc. */
274
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
275
+ }, "strip", z.ZodTypeAny, {
276
+ provider: "stripe" | "paypal" | "razorpay";
277
+ currency: string;
278
+ metadata: Record<string, unknown>;
279
+ }, {
280
+ provider: "stripe" | "paypal" | "razorpay";
281
+ currency?: string | undefined;
282
+ metadata?: Record<string, unknown> | undefined;
283
+ }>;
284
+ createdAt: z.ZodString;
285
+ }, "strip", z.ZodTypeAny, {
286
+ id: string;
287
+ tenantId: string;
288
+ name: string;
289
+ slug: string;
290
+ publicKey: string;
291
+ authConfig: {
292
+ methods: string[];
293
+ passwordMinLength: number;
294
+ redirectUrls: string[];
295
+ organizationsEnabled: boolean;
296
+ signupEnabled: boolean;
297
+ mfa: "off" | "optional" | "required";
298
+ passwordBreachCheckEnabled: boolean;
299
+ webauthn?: {
300
+ rpId: string;
301
+ rpOrigins: string[];
302
+ rpName?: string | undefined;
303
+ } | undefined;
304
+ };
305
+ billingConfig: {
306
+ provider: "stripe" | "paypal" | "razorpay";
307
+ currency: string;
308
+ metadata: Record<string, unknown>;
309
+ };
310
+ createdAt: string;
311
+ }, {
312
+ id: string;
313
+ tenantId: string;
314
+ name: string;
315
+ slug: string;
316
+ publicKey: string;
317
+ authConfig: {
318
+ methods: string[];
319
+ redirectUrls: string[];
320
+ passwordMinLength?: number | undefined;
321
+ organizationsEnabled?: boolean | undefined;
322
+ signupEnabled?: boolean | undefined;
323
+ mfa?: "off" | "optional" | "required" | undefined;
324
+ passwordBreachCheckEnabled?: boolean | undefined;
325
+ webauthn?: {
326
+ rpId: string;
327
+ rpOrigins: string[];
328
+ rpName?: string | undefined;
329
+ } | undefined;
330
+ };
331
+ billingConfig: {
332
+ provider: "stripe" | "paypal" | "razorpay";
333
+ currency?: string | undefined;
334
+ metadata?: Record<string, unknown> | undefined;
335
+ };
336
+ createdAt: string;
337
+ }>;
338
+ export type ApplicationDto = z.infer<typeof ApplicationDtoSchema>;
339
+ export declare const EndUserDtoSchema: z.ZodObject<{
340
+ id: z.ZodString;
341
+ applicationId: z.ZodString;
342
+ email: z.ZodString;
343
+ emailVerified: z.ZodBoolean;
344
+ metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
345
+ createdAt: z.ZodString;
346
+ }, "strip", z.ZodTypeAny, {
347
+ metadata: Record<string, unknown> | null;
348
+ id: string;
349
+ createdAt: string;
350
+ applicationId: string;
351
+ email: string;
352
+ emailVerified: boolean;
353
+ }, {
354
+ metadata: Record<string, unknown> | null;
355
+ id: string;
356
+ createdAt: string;
357
+ applicationId: string;
358
+ email: string;
359
+ emailVerified: boolean;
360
+ }>;
361
+ export type EndUserDto = z.infer<typeof EndUserDtoSchema>;
362
+ export declare const ApiKeyDtoSchema: z.ZodObject<{
363
+ id: z.ZodString;
364
+ applicationId: z.ZodString;
365
+ name: z.ZodString;
366
+ keyPrefix: z.ZodString;
367
+ scopes: z.ZodArray<z.ZodString, "many">;
368
+ lastUsedAt: z.ZodNullable<z.ZodString>;
369
+ expiresAt: z.ZodNullable<z.ZodString>;
370
+ revokedAt: z.ZodNullable<z.ZodString>;
371
+ createdAt: z.ZodString;
372
+ }, "strip", z.ZodTypeAny, {
373
+ id: string;
374
+ name: string;
375
+ createdAt: string;
376
+ applicationId: string;
377
+ keyPrefix: string;
378
+ scopes: string[];
379
+ lastUsedAt: string | null;
380
+ expiresAt: string | null;
381
+ revokedAt: string | null;
382
+ }, {
383
+ id: string;
384
+ name: string;
385
+ createdAt: string;
386
+ applicationId: string;
387
+ keyPrefix: string;
388
+ scopes: string[];
389
+ lastUsedAt: string | null;
390
+ expiresAt: string | null;
391
+ revokedAt: string | null;
392
+ }>;
393
+ export type ApiKeyDto = z.infer<typeof ApiKeyDtoSchema>;
394
+ export declare const SignUpRequestSchema: z.ZodObject<{
395
+ email: z.ZodString;
396
+ password: z.ZodString;
397
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
398
+ }, "strip", z.ZodTypeAny, {
399
+ email: string;
400
+ password: string;
401
+ metadata?: Record<string, unknown> | undefined;
402
+ }, {
403
+ email: string;
404
+ password: string;
405
+ metadata?: Record<string, unknown> | undefined;
406
+ }>;
407
+ export type SignUpRequest = z.infer<typeof SignUpRequestSchema>;
408
+ export declare const SignInRequestSchema: z.ZodObject<{
409
+ email: z.ZodString;
410
+ password: z.ZodString;
411
+ }, "strip", z.ZodTypeAny, {
412
+ email: string;
413
+ password: string;
414
+ }, {
415
+ email: string;
416
+ password: string;
417
+ }>;
418
+ export type SignInRequest = z.infer<typeof SignInRequestSchema>;
419
+ /**
420
+ * Result of a successful primary-factor auth (password sign-in, OAuth
421
+ * callback, MFA-verify). Includes `mfaRequired: false` as the
422
+ * discriminator field for `SignInOutcomeDto`.
423
+ */
424
+ export declare const AuthResultDtoSchema: z.ZodObject<{
425
+ mfaRequired: z.ZodDefault<z.ZodLiteral<false>>;
426
+ /**
427
+ * True when the Application's MFA policy is `required` but this user has not
428
+ * enrolled yet. The session is still issued; the app should route the user
429
+ * to MFA setup before granting sensitive access.
430
+ */
431
+ mfaEnrollmentRequired: z.ZodOptional<z.ZodBoolean>;
432
+ endUser: z.ZodObject<{
433
+ id: z.ZodString;
434
+ applicationId: z.ZodString;
435
+ email: z.ZodString;
436
+ emailVerified: z.ZodBoolean;
437
+ metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
438
+ createdAt: z.ZodString;
439
+ }, "strip", z.ZodTypeAny, {
440
+ metadata: Record<string, unknown> | null;
441
+ id: string;
442
+ createdAt: string;
443
+ applicationId: string;
444
+ email: string;
445
+ emailVerified: boolean;
446
+ }, {
447
+ metadata: Record<string, unknown> | null;
448
+ id: string;
449
+ createdAt: string;
450
+ applicationId: string;
451
+ email: string;
452
+ emailVerified: boolean;
453
+ }>;
454
+ /** Short-lived access JWT. Pass via X-Relipay-User-Token. */
455
+ accessToken: z.ZodString;
456
+ accessTokenExpiresAt: z.ZodString;
457
+ /** Long-lived refresh token. Use to mint new access tokens via auth.refresh(). */
458
+ refreshToken: z.ZodString;
459
+ refreshTokenExpiresAt: z.ZodString;
460
+ }, "strip", z.ZodTypeAny, {
461
+ mfaRequired: false;
462
+ endUser: {
463
+ metadata: Record<string, unknown> | null;
464
+ id: string;
465
+ createdAt: string;
466
+ applicationId: string;
467
+ email: string;
468
+ emailVerified: boolean;
469
+ };
470
+ accessToken: string;
471
+ accessTokenExpiresAt: string;
472
+ refreshToken: string;
473
+ refreshTokenExpiresAt: string;
474
+ mfaEnrollmentRequired?: boolean | undefined;
475
+ }, {
476
+ endUser: {
477
+ metadata: Record<string, unknown> | null;
478
+ id: string;
479
+ createdAt: string;
480
+ applicationId: string;
481
+ email: string;
482
+ emailVerified: boolean;
483
+ };
484
+ accessToken: string;
485
+ accessTokenExpiresAt: string;
486
+ refreshToken: string;
487
+ refreshTokenExpiresAt: string;
488
+ mfaRequired?: false | undefined;
489
+ mfaEnrollmentRequired?: boolean | undefined;
490
+ }>;
491
+ export type AuthResultDto = z.infer<typeof AuthResultDtoSchema>;
492
+ /**
493
+ * The user passed the primary factor (password / OAuth) but has MFA
494
+ * enrolled. The customer's server must prompt the user for their TOTP /
495
+ * backup code and POST it to /auth/mfa-verify along with
496
+ * `mfaChallengeToken` to receive a real session.
497
+ *
498
+ * The challenge token is short-lived (5 min) and bound to (endUser,
499
+ * application). It is **not** a session token — it cannot be used at any
500
+ * other endpoint.
501
+ */
502
+ export declare const MfaChallengeResultDtoSchema: z.ZodObject<{
503
+ mfaRequired: z.ZodLiteral<true>;
504
+ endUser: z.ZodObject<{
505
+ id: z.ZodString;
506
+ applicationId: z.ZodString;
507
+ email: z.ZodString;
508
+ emailVerified: z.ZodBoolean;
509
+ metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
510
+ createdAt: z.ZodString;
511
+ }, "strip", z.ZodTypeAny, {
512
+ metadata: Record<string, unknown> | null;
513
+ id: string;
514
+ createdAt: string;
515
+ applicationId: string;
516
+ email: string;
517
+ emailVerified: boolean;
518
+ }, {
519
+ metadata: Record<string, unknown> | null;
520
+ id: string;
521
+ createdAt: string;
522
+ applicationId: string;
523
+ email: string;
524
+ emailVerified: boolean;
525
+ }>;
526
+ mfaChallengeToken: z.ZodString;
527
+ mfaChallengeExpiresAt: z.ZodString;
528
+ }, "strip", z.ZodTypeAny, {
529
+ mfaRequired: true;
530
+ endUser: {
531
+ metadata: Record<string, unknown> | null;
532
+ id: string;
533
+ createdAt: string;
534
+ applicationId: string;
535
+ email: string;
536
+ emailVerified: boolean;
537
+ };
538
+ mfaChallengeToken: string;
539
+ mfaChallengeExpiresAt: string;
540
+ }, {
541
+ mfaRequired: true;
542
+ endUser: {
543
+ metadata: Record<string, unknown> | null;
544
+ id: string;
545
+ createdAt: string;
546
+ applicationId: string;
547
+ email: string;
548
+ emailVerified: boolean;
549
+ };
550
+ mfaChallengeToken: string;
551
+ mfaChallengeExpiresAt: string;
552
+ }>;
553
+ export type MfaChallengeResultDto = z.infer<typeof MfaChallengeResultDtoSchema>;
554
+ /**
555
+ * Discriminated union over `mfaRequired`. Returned by `signIn`, OAuth
556
+ * `callback`, and any future flow that accepts a primary factor — the
557
+ * client always branches on `mfaRequired` to decide whether to render the
558
+ * second-factor prompt or store the session tokens.
559
+ */
560
+ export declare const SignInOutcomeDtoSchema: z.ZodDiscriminatedUnion<"mfaRequired", [z.ZodObject<{
561
+ mfaRequired: z.ZodDefault<z.ZodLiteral<false>>;
562
+ /**
563
+ * True when the Application's MFA policy is `required` but this user has not
564
+ * enrolled yet. The session is still issued; the app should route the user
565
+ * to MFA setup before granting sensitive access.
566
+ */
567
+ mfaEnrollmentRequired: z.ZodOptional<z.ZodBoolean>;
568
+ endUser: z.ZodObject<{
569
+ id: z.ZodString;
570
+ applicationId: z.ZodString;
571
+ email: z.ZodString;
572
+ emailVerified: z.ZodBoolean;
573
+ metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
574
+ createdAt: z.ZodString;
575
+ }, "strip", z.ZodTypeAny, {
576
+ metadata: Record<string, unknown> | null;
577
+ id: string;
578
+ createdAt: string;
579
+ applicationId: string;
580
+ email: string;
581
+ emailVerified: boolean;
582
+ }, {
583
+ metadata: Record<string, unknown> | null;
584
+ id: string;
585
+ createdAt: string;
586
+ applicationId: string;
587
+ email: string;
588
+ emailVerified: boolean;
589
+ }>;
590
+ /** Short-lived access JWT. Pass via X-Relipay-User-Token. */
591
+ accessToken: z.ZodString;
592
+ accessTokenExpiresAt: z.ZodString;
593
+ /** Long-lived refresh token. Use to mint new access tokens via auth.refresh(). */
594
+ refreshToken: z.ZodString;
595
+ refreshTokenExpiresAt: z.ZodString;
596
+ }, "strip", z.ZodTypeAny, {
597
+ mfaRequired: false;
598
+ endUser: {
599
+ metadata: Record<string, unknown> | null;
600
+ id: string;
601
+ createdAt: string;
602
+ applicationId: string;
603
+ email: string;
604
+ emailVerified: boolean;
605
+ };
606
+ accessToken: string;
607
+ accessTokenExpiresAt: string;
608
+ refreshToken: string;
609
+ refreshTokenExpiresAt: string;
610
+ mfaEnrollmentRequired?: boolean | undefined;
611
+ }, {
612
+ endUser: {
613
+ metadata: Record<string, unknown> | null;
614
+ id: string;
615
+ createdAt: string;
616
+ applicationId: string;
617
+ email: string;
618
+ emailVerified: boolean;
619
+ };
620
+ accessToken: string;
621
+ accessTokenExpiresAt: string;
622
+ refreshToken: string;
623
+ refreshTokenExpiresAt: string;
624
+ mfaRequired?: false | undefined;
625
+ mfaEnrollmentRequired?: boolean | undefined;
626
+ }>, z.ZodObject<{
627
+ mfaRequired: z.ZodLiteral<true>;
628
+ endUser: z.ZodObject<{
629
+ id: z.ZodString;
630
+ applicationId: z.ZodString;
631
+ email: z.ZodString;
632
+ emailVerified: z.ZodBoolean;
633
+ metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
634
+ createdAt: z.ZodString;
635
+ }, "strip", z.ZodTypeAny, {
636
+ metadata: Record<string, unknown> | null;
637
+ id: string;
638
+ createdAt: string;
639
+ applicationId: string;
640
+ email: string;
641
+ emailVerified: boolean;
642
+ }, {
643
+ metadata: Record<string, unknown> | null;
644
+ id: string;
645
+ createdAt: string;
646
+ applicationId: string;
647
+ email: string;
648
+ emailVerified: boolean;
649
+ }>;
650
+ mfaChallengeToken: z.ZodString;
651
+ mfaChallengeExpiresAt: z.ZodString;
652
+ }, "strip", z.ZodTypeAny, {
653
+ mfaRequired: true;
654
+ endUser: {
655
+ metadata: Record<string, unknown> | null;
656
+ id: string;
657
+ createdAt: string;
658
+ applicationId: string;
659
+ email: string;
660
+ emailVerified: boolean;
661
+ };
662
+ mfaChallengeToken: string;
663
+ mfaChallengeExpiresAt: string;
664
+ }, {
665
+ mfaRequired: true;
666
+ endUser: {
667
+ metadata: Record<string, unknown> | null;
668
+ id: string;
669
+ createdAt: string;
670
+ applicationId: string;
671
+ email: string;
672
+ emailVerified: boolean;
673
+ };
674
+ mfaChallengeToken: string;
675
+ mfaChallengeExpiresAt: string;
676
+ }>]>;
677
+ export type SignInOutcomeDto = z.infer<typeof SignInOutcomeDtoSchema>;
678
+ export declare const MfaVerifyRequestSchema: z.ZodObject<{
679
+ mfaChallengeToken: z.ZodString;
680
+ code: z.ZodString;
681
+ }, "strip", z.ZodTypeAny, {
682
+ code: string;
683
+ mfaChallengeToken: string;
684
+ }, {
685
+ code: string;
686
+ mfaChallengeToken: string;
687
+ }>;
688
+ export type MfaVerifyRequest = z.infer<typeof MfaVerifyRequestSchema>;
689
+ export declare const RefreshRequestSchema: z.ZodObject<{
690
+ refreshToken: z.ZodString;
691
+ }, "strip", z.ZodTypeAny, {
692
+ refreshToken: string;
693
+ }, {
694
+ refreshToken: string;
695
+ }>;
696
+ export type RefreshRequest = z.infer<typeof RefreshRequestSchema>;
697
+ export declare const ForgotPasswordRequestSchema: z.ZodObject<{
698
+ email: z.ZodString;
699
+ /**
700
+ * Optional URL for the reset link in the email. `{token}` will be
701
+ * URL-encoded and substituted by the server. Required only if you've
702
+ * configured email transport — otherwise the server returns the raw
703
+ * token in the response for you to forward.
704
+ */
705
+ resetUrl: z.ZodOptional<z.ZodString>;
706
+ }, "strip", z.ZodTypeAny, {
707
+ email: string;
708
+ resetUrl?: string | undefined;
709
+ }, {
710
+ email: string;
711
+ resetUrl?: string | undefined;
712
+ }>;
713
+ export type ForgotPasswordRequest = z.infer<typeof ForgotPasswordRequestSchema>;
714
+ export declare const ForgotPasswordResultDtoSchema: z.ZodObject<{
715
+ /** True iff a real user existed and a token was minted. False is also returned when the email is unknown — never enumerate. */
716
+ delivered: z.ZodBoolean;
717
+ /**
718
+ * True iff ReliPay sent the email itself (BYO Resend creds or
719
+ * RESEND_DEFAULT_* env configured). When true, `resetToken` is null and
720
+ * no further action is needed from the caller.
721
+ */
722
+ emailSent: z.ZodBoolean;
723
+ /**
724
+ * Raw reset token. Null when `delivered` is false (unknown email) OR
725
+ * when `emailSent` is true (we delivered it). Present when the customer's
726
+ * server is expected to forward it via its own provider.
727
+ */
728
+ resetToken: z.ZodNullable<z.ZodString>;
729
+ }, "strip", z.ZodTypeAny, {
730
+ delivered: boolean;
731
+ emailSent: boolean;
732
+ resetToken: string | null;
733
+ }, {
734
+ delivered: boolean;
735
+ emailSent: boolean;
736
+ resetToken: string | null;
737
+ }>;
738
+ export type ForgotPasswordResultDto = z.infer<typeof ForgotPasswordResultDtoSchema>;
739
+ export declare const SendVerificationRequestSchema: z.ZodObject<{
740
+ /** Optional URL for the verify link. `{token}` is URL-encoded + substituted. */
741
+ verifyUrl: z.ZodOptional<z.ZodString>;
742
+ }, "strip", z.ZodTypeAny, {
743
+ verifyUrl?: string | undefined;
744
+ }, {
745
+ verifyUrl?: string | undefined;
746
+ }>;
747
+ export type SendVerificationRequest = z.infer<typeof SendVerificationRequestSchema>;
748
+ export declare const SendVerificationResultDtoSchema: z.ZodObject<{
749
+ /** True iff ReliPay sent the email via its transport. */
750
+ emailSent: z.ZodBoolean;
751
+ /** Raw verification token; null when emailSent is true. */
752
+ verificationToken: z.ZodNullable<z.ZodString>;
753
+ }, "strip", z.ZodTypeAny, {
754
+ emailSent: boolean;
755
+ verificationToken: string | null;
756
+ }, {
757
+ emailSent: boolean;
758
+ verificationToken: string | null;
759
+ }>;
760
+ export type SendVerificationResultDto = z.infer<typeof SendVerificationResultDtoSchema>;
761
+ export declare const VerifyEmailRequestSchema: z.ZodObject<{
762
+ token: z.ZodString;
763
+ }, "strip", z.ZodTypeAny, {
764
+ token: string;
765
+ }, {
766
+ token: string;
767
+ }>;
768
+ export type VerifyEmailRequest = z.infer<typeof VerifyEmailRequestSchema>;
769
+ /**
770
+ * Known transactional email events. Templates can be customised per
771
+ * Application in the panel. New events are added as part of a release;
772
+ * older SDK versions will see unknown keys as plain strings.
773
+ */
774
+ export declare const EmailEventKeySchema: z.ZodEnum<["password_reset", "email_verification", "workspace_invitation", "welcome", "mfa_enabled", "password_changed"]>;
775
+ export type EmailEventKey = z.infer<typeof EmailEventKeySchema>;
776
+ export declare const ResetPasswordRequestSchema: z.ZodObject<{
777
+ token: z.ZodString;
778
+ newPassword: z.ZodString;
779
+ }, "strip", z.ZodTypeAny, {
780
+ token: string;
781
+ newPassword: string;
782
+ }, {
783
+ token: string;
784
+ newPassword: string;
785
+ }>;
786
+ export type ResetPasswordRequest = z.infer<typeof ResetPasswordRequestSchema>;
787
+ export declare const ChangePasswordRequestSchema: z.ZodObject<{
788
+ currentPassword: z.ZodString;
789
+ newPassword: z.ZodString;
790
+ }, "strip", z.ZodTypeAny, {
791
+ newPassword: string;
792
+ currentPassword: string;
793
+ }, {
794
+ newPassword: string;
795
+ currentPassword: string;
796
+ }>;
797
+ export type ChangePasswordRequest = z.infer<typeof ChangePasswordRequestSchema>;
798
+ export declare const PlanIntervalSchema: z.ZodEnum<["MONTH", "YEAR"]>;
799
+ export type PlanIntervalType = z.infer<typeof PlanIntervalSchema>;
800
+ /** What a plan sells. SUBSCRIPTION = recurring; LICENSE = key issued on purchase; USAGE = metered; CREDIT = prepaid balance / lead pack. */
801
+ export declare const PlanKindSchema: z.ZodEnum<["SUBSCRIPTION", "LICENSE", "USAGE", "CREDIT"]>;
802
+ export type PlanKindType = z.infer<typeof PlanKindSchema>;
803
+ /** Shape of a LICENSE-kind plan's key. PERPETUAL = never expires; TIMED = N-day; SEATS = capped activations. */
804
+ export declare const LicenseKindSchema: z.ZodEnum<["PERPETUAL", "TIMED", "SEATS"]>;
805
+ export type LicenseKindType = z.infer<typeof LicenseKindSchema>;
806
+ export declare const SubscriptionStatusSchema: z.ZodEnum<["PENDING", "ACTIVE", "PAST_DUE", "CANCELED", "EXPIRED"]>;
807
+ export type SubscriptionStatusType = z.infer<typeof SubscriptionStatusSchema>;
808
+ export declare const PlanDtoSchema: z.ZodObject<{
809
+ id: z.ZodString;
810
+ applicationId: z.ZodString;
811
+ slug: z.ZodString;
812
+ name: z.ZodString;
813
+ /** Amount in the smallest currency unit (cents/paise/sen). Always integer. */
814
+ amount: z.ZodNumber;
815
+ currency: z.ZodString;
816
+ interval: z.ZodEnum<["MONTH", "YEAR"]>;
817
+ /** What this plan sells. Defaults to SUBSCRIPTION for plans created before kinds existed. */
818
+ kind: z.ZodEnum<["SUBSCRIPTION", "LICENSE", "USAGE", "CREDIT"]>;
819
+ licenseKind: z.ZodNullable<z.ZodEnum<["PERPETUAL", "TIMED", "SEATS"]>>;
820
+ licenseSeatsAllowed: z.ZodNullable<z.ZodNumber>;
821
+ /** For TIMED licenses: key lifetime in days from purchase. */
822
+ licenseDurationDays: z.ZodNullable<z.ZodNumber>;
823
+ /** Slug of the usage meter this plan bills against. */
824
+ meterSlug: z.ZodNullable<z.ZodString>;
825
+ /** Per-unit price in the smallest currency unit. `amount` is the base/recurring fee. */
826
+ pricePerUnitCents: z.ZodNullable<z.ZodNumber>;
827
+ /** Credits granted to the buyer on successful payment of a CREDIT-kind plan. */
828
+ creditsAmount: z.ZodNullable<z.ZodNumber>;
829
+ active: z.ZodBoolean;
830
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
831
+ createdAt: z.ZodString;
832
+ updatedAt: z.ZodString;
833
+ }, "strip", z.ZodTypeAny, {
834
+ currency: string;
835
+ metadata: Record<string, unknown>;
836
+ id: string;
837
+ name: string;
838
+ slug: string;
839
+ createdAt: string;
840
+ applicationId: string;
841
+ amount: number;
842
+ interval: "MONTH" | "YEAR";
843
+ kind: "SUBSCRIPTION" | "LICENSE" | "USAGE" | "CREDIT";
844
+ licenseKind: "PERPETUAL" | "TIMED" | "SEATS" | null;
845
+ licenseSeatsAllowed: number | null;
846
+ licenseDurationDays: number | null;
847
+ meterSlug: string | null;
848
+ pricePerUnitCents: number | null;
849
+ creditsAmount: number | null;
850
+ active: boolean;
851
+ updatedAt: string;
852
+ }, {
853
+ currency: string;
854
+ metadata: Record<string, unknown>;
855
+ id: string;
856
+ name: string;
857
+ slug: string;
858
+ createdAt: string;
859
+ applicationId: string;
860
+ amount: number;
861
+ interval: "MONTH" | "YEAR";
862
+ kind: "SUBSCRIPTION" | "LICENSE" | "USAGE" | "CREDIT";
863
+ licenseKind: "PERPETUAL" | "TIMED" | "SEATS" | null;
864
+ licenseSeatsAllowed: number | null;
865
+ licenseDurationDays: number | null;
866
+ meterSlug: string | null;
867
+ pricePerUnitCents: number | null;
868
+ creditsAmount: number | null;
869
+ active: boolean;
870
+ updatedAt: string;
871
+ }>;
872
+ export type PlanDto = z.infer<typeof PlanDtoSchema>;
873
+ export declare const CreditReasonSchema: z.ZodEnum<["PURCHASE", "GRANT", "CONSUME", "REFUND", "ADJUST"]>;
874
+ export type CreditReasonType = z.infer<typeof CreditReasonSchema>;
875
+ export declare const CreditBalanceDtoSchema: z.ZodObject<{
876
+ applicationId: z.ZodString;
877
+ endUserId: z.ZodString;
878
+ /** Current spendable balance (whole credits, never negative). */
879
+ balance: z.ZodNumber;
880
+ updatedAt: z.ZodString;
881
+ }, "strip", z.ZodTypeAny, {
882
+ applicationId: string;
883
+ updatedAt: string;
884
+ endUserId: string;
885
+ balance: number;
886
+ }, {
887
+ applicationId: string;
888
+ updatedAt: string;
889
+ endUserId: string;
890
+ balance: number;
891
+ }>;
892
+ export type CreditBalanceDto = z.infer<typeof CreditBalanceDtoSchema>;
893
+ export declare const CreditLedgerEntryDtoSchema: z.ZodObject<{
894
+ id: z.ZodString;
895
+ /** Signed change: + added (purchase/grant/refund), − consumed. */
896
+ delta: z.ZodNumber;
897
+ reason: z.ZodEnum<["PURCHASE", "GRANT", "CONSUME", "REFUND", "ADJUST"]>;
898
+ /** Balance immediately after this entry. */
899
+ balanceAfter: z.ZodNumber;
900
+ description: z.ZodNullable<z.ZodString>;
901
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
902
+ createdAt: z.ZodString;
903
+ }, "strip", z.ZodTypeAny, {
904
+ metadata: Record<string, unknown>;
905
+ id: string;
906
+ createdAt: string;
907
+ delta: number;
908
+ reason: "PURCHASE" | "GRANT" | "CONSUME" | "REFUND" | "ADJUST";
909
+ balanceAfter: number;
910
+ description: string | null;
911
+ }, {
912
+ metadata: Record<string, unknown>;
913
+ id: string;
914
+ createdAt: string;
915
+ delta: number;
916
+ reason: "PURCHASE" | "GRANT" | "CONSUME" | "REFUND" | "ADJUST";
917
+ balanceAfter: number;
918
+ description: string | null;
919
+ }>;
920
+ export type CreditLedgerEntryDto = z.infer<typeof CreditLedgerEntryDtoSchema>;
921
+ /** Body for POST /api/v1/credits/consume (end-user drawdown). */
922
+ export declare const ConsumeCreditsRequestSchema: z.ZodObject<{
923
+ /** How many credits to deduct. Must be a positive integer. */
924
+ amount: z.ZodNumber;
925
+ /**
926
+ * Optional idempotency key (e.g. the lead id). A repeated consume with the
927
+ * same key is a no-op that returns the original result — safe to retry.
928
+ */
929
+ idempotencyKey: z.ZodOptional<z.ZodString>;
930
+ description: z.ZodOptional<z.ZodString>;
931
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
932
+ }, "strip", z.ZodTypeAny, {
933
+ amount: number;
934
+ metadata?: Record<string, unknown> | undefined;
935
+ description?: string | undefined;
936
+ idempotencyKey?: string | undefined;
937
+ }, {
938
+ amount: number;
939
+ metadata?: Record<string, unknown> | undefined;
940
+ description?: string | undefined;
941
+ idempotencyKey?: string | undefined;
942
+ }>;
943
+ export type ConsumeCreditsRequest = z.infer<typeof ConsumeCreditsRequestSchema>;
944
+ /** Body for the operator grant endpoint (manual top-up / adjustment). */
945
+ export declare const GrantCreditsRequestSchema: z.ZodObject<{
946
+ /** Credits to add (positive) or remove (negative, for ADJUST). */
947
+ amount: z.ZodNumber;
948
+ reason: z.ZodDefault<z.ZodEnum<["GRANT", "REFUND", "ADJUST"]>>;
949
+ idempotencyKey: z.ZodOptional<z.ZodString>;
950
+ description: z.ZodOptional<z.ZodString>;
951
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
952
+ }, "strip", z.ZodTypeAny, {
953
+ amount: number;
954
+ reason: "GRANT" | "REFUND" | "ADJUST";
955
+ metadata?: Record<string, unknown> | undefined;
956
+ description?: string | undefined;
957
+ idempotencyKey?: string | undefined;
958
+ }, {
959
+ amount: number;
960
+ metadata?: Record<string, unknown> | undefined;
961
+ reason?: "GRANT" | "REFUND" | "ADJUST" | undefined;
962
+ description?: string | undefined;
963
+ idempotencyKey?: string | undefined;
964
+ }>;
965
+ export type GrantCreditsRequest = z.infer<typeof GrantCreditsRequestSchema>;
966
+ export declare const SubscriptionDtoSchema: z.ZodObject<{
967
+ id: z.ZodString;
968
+ applicationId: z.ZodString;
969
+ endUserId: z.ZodString;
970
+ planId: z.ZodString;
971
+ status: z.ZodEnum<["PENDING", "ACTIVE", "PAST_DUE", "CANCELED", "EXPIRED"]>;
972
+ currentPeriodEnd: z.ZodNullable<z.ZodString>;
973
+ cancelAt: z.ZodNullable<z.ZodString>;
974
+ canceledAt: z.ZodNullable<z.ZodString>;
975
+ providerSubId: z.ZodNullable<z.ZodString>;
976
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
977
+ createdAt: z.ZodString;
978
+ updatedAt: z.ZodString;
979
+ }, "strip", z.ZodTypeAny, {
980
+ status: "PENDING" | "ACTIVE" | "PAST_DUE" | "CANCELED" | "EXPIRED";
981
+ metadata: Record<string, unknown>;
982
+ id: string;
983
+ createdAt: string;
984
+ applicationId: string;
985
+ updatedAt: string;
986
+ endUserId: string;
987
+ planId: string;
988
+ currentPeriodEnd: string | null;
989
+ cancelAt: string | null;
990
+ canceledAt: string | null;
991
+ providerSubId: string | null;
992
+ }, {
993
+ status: "PENDING" | "ACTIVE" | "PAST_DUE" | "CANCELED" | "EXPIRED";
994
+ metadata: Record<string, unknown>;
995
+ id: string;
996
+ createdAt: string;
997
+ applicationId: string;
998
+ updatedAt: string;
999
+ endUserId: string;
1000
+ planId: string;
1001
+ currentPeriodEnd: string | null;
1002
+ cancelAt: string | null;
1003
+ canceledAt: string | null;
1004
+ providerSubId: string | null;
1005
+ }>;
1006
+ export type SubscriptionDto = z.infer<typeof SubscriptionDtoSchema>;
1007
+ export declare const CreateCheckoutRequestSchema: z.ZodObject<{
1008
+ planSlug: z.ZodString;
1009
+ successUrl: z.ZodString;
1010
+ cancelUrl: z.ZodString;
1011
+ /**
1012
+ * Optional billing provider override. When omitted, the geo router picks
1013
+ * one from the Application's enabled providers using `country` and the
1014
+ * per-provider routing rules.
1015
+ */
1016
+ provider: z.ZodOptional<z.ZodEnum<["stripe", "paypal", "razorpay"]>>;
1017
+ /** ISO 3166-1 alpha-2. Used by the geo router when `provider` is absent. */
1018
+ country: z.ZodOptional<z.ZodString>;
1019
+ }, "strip", z.ZodTypeAny, {
1020
+ planSlug: string;
1021
+ successUrl: string;
1022
+ cancelUrl: string;
1023
+ provider?: "stripe" | "paypal" | "razorpay" | undefined;
1024
+ country?: string | undefined;
1025
+ }, {
1026
+ planSlug: string;
1027
+ successUrl: string;
1028
+ cancelUrl: string;
1029
+ provider?: "stripe" | "paypal" | "razorpay" | undefined;
1030
+ country?: string | undefined;
1031
+ }>;
1032
+ export type CreateCheckoutRequest = z.infer<typeof CreateCheckoutRequestSchema>;
1033
+ export declare const CreateCheckoutRequestWithCouponSchema: z.ZodObject<{
1034
+ planSlug: z.ZodString;
1035
+ successUrl: z.ZodString;
1036
+ cancelUrl: z.ZodString;
1037
+ /**
1038
+ * Optional billing provider override. When omitted, the geo router picks
1039
+ * one from the Application's enabled providers using `country` and the
1040
+ * per-provider routing rules.
1041
+ */
1042
+ provider: z.ZodOptional<z.ZodEnum<["stripe", "paypal", "razorpay"]>>;
1043
+ /** ISO 3166-1 alpha-2. Used by the geo router when `provider` is absent. */
1044
+ country: z.ZodOptional<z.ZodString>;
1045
+ } & {
1046
+ couponCode: z.ZodOptional<z.ZodString>;
1047
+ }, "strip", z.ZodTypeAny, {
1048
+ planSlug: string;
1049
+ successUrl: string;
1050
+ cancelUrl: string;
1051
+ provider?: "stripe" | "paypal" | "razorpay" | undefined;
1052
+ country?: string | undefined;
1053
+ couponCode?: string | undefined;
1054
+ }, {
1055
+ planSlug: string;
1056
+ successUrl: string;
1057
+ cancelUrl: string;
1058
+ provider?: "stripe" | "paypal" | "razorpay" | undefined;
1059
+ country?: string | undefined;
1060
+ couponCode?: string | undefined;
1061
+ }>;
1062
+ export declare const CheckoutResultDtoSchema: z.ZodObject<{
1063
+ url: z.ZodString;
1064
+ subscription: z.ZodObject<{
1065
+ id: z.ZodString;
1066
+ applicationId: z.ZodString;
1067
+ endUserId: z.ZodString;
1068
+ planId: z.ZodString;
1069
+ status: z.ZodEnum<["PENDING", "ACTIVE", "PAST_DUE", "CANCELED", "EXPIRED"]>;
1070
+ currentPeriodEnd: z.ZodNullable<z.ZodString>;
1071
+ cancelAt: z.ZodNullable<z.ZodString>;
1072
+ canceledAt: z.ZodNullable<z.ZodString>;
1073
+ providerSubId: z.ZodNullable<z.ZodString>;
1074
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1075
+ createdAt: z.ZodString;
1076
+ updatedAt: z.ZodString;
1077
+ }, "strip", z.ZodTypeAny, {
1078
+ status: "PENDING" | "ACTIVE" | "PAST_DUE" | "CANCELED" | "EXPIRED";
1079
+ metadata: Record<string, unknown>;
1080
+ id: string;
1081
+ createdAt: string;
1082
+ applicationId: string;
1083
+ updatedAt: string;
1084
+ endUserId: string;
1085
+ planId: string;
1086
+ currentPeriodEnd: string | null;
1087
+ cancelAt: string | null;
1088
+ canceledAt: string | null;
1089
+ providerSubId: string | null;
1090
+ }, {
1091
+ status: "PENDING" | "ACTIVE" | "PAST_DUE" | "CANCELED" | "EXPIRED";
1092
+ metadata: Record<string, unknown>;
1093
+ id: string;
1094
+ createdAt: string;
1095
+ applicationId: string;
1096
+ updatedAt: string;
1097
+ endUserId: string;
1098
+ planId: string;
1099
+ currentPeriodEnd: string | null;
1100
+ cancelAt: string | null;
1101
+ canceledAt: string | null;
1102
+ providerSubId: string | null;
1103
+ }>;
1104
+ /** Discount applied (smallest currency unit). 0 if no coupon. */
1105
+ discountAmount: z.ZodNumber;
1106
+ /** Which provider issued this checkout. Stamped on Subscription.provider. */
1107
+ provider: z.ZodEnum<["stripe", "paypal", "razorpay"]>;
1108
+ }, "strip", z.ZodTypeAny, {
1109
+ provider: "stripe" | "paypal" | "razorpay";
1110
+ url: string;
1111
+ subscription: {
1112
+ status: "PENDING" | "ACTIVE" | "PAST_DUE" | "CANCELED" | "EXPIRED";
1113
+ metadata: Record<string, unknown>;
1114
+ id: string;
1115
+ createdAt: string;
1116
+ applicationId: string;
1117
+ updatedAt: string;
1118
+ endUserId: string;
1119
+ planId: string;
1120
+ currentPeriodEnd: string | null;
1121
+ cancelAt: string | null;
1122
+ canceledAt: string | null;
1123
+ providerSubId: string | null;
1124
+ };
1125
+ discountAmount: number;
1126
+ }, {
1127
+ provider: "stripe" | "paypal" | "razorpay";
1128
+ url: string;
1129
+ subscription: {
1130
+ status: "PENDING" | "ACTIVE" | "PAST_DUE" | "CANCELED" | "EXPIRED";
1131
+ metadata: Record<string, unknown>;
1132
+ id: string;
1133
+ createdAt: string;
1134
+ applicationId: string;
1135
+ updatedAt: string;
1136
+ endUserId: string;
1137
+ planId: string;
1138
+ currentPeriodEnd: string | null;
1139
+ cancelAt: string | null;
1140
+ canceledAt: string | null;
1141
+ providerSubId: string | null;
1142
+ };
1143
+ discountAmount: number;
1144
+ }>;
1145
+ export type CheckoutResultDto = z.infer<typeof CheckoutResultDtoSchema>;
1146
+ export declare const BillingProviderInfoDtoSchema: z.ZodObject<{
1147
+ provider: z.ZodEnum<["stripe", "paypal", "razorpay"]>;
1148
+ priority: z.ZodNumber;
1149
+ countries: z.ZodArray<z.ZodString, "many">;
1150
+ }, "strip", z.ZodTypeAny, {
1151
+ provider: "stripe" | "paypal" | "razorpay";
1152
+ priority: number;
1153
+ countries: string[];
1154
+ }, {
1155
+ provider: "stripe" | "paypal" | "razorpay";
1156
+ priority: number;
1157
+ countries: string[];
1158
+ }>;
1159
+ export type BillingProviderInfoDto = z.infer<typeof BillingProviderInfoDtoSchema>;
1160
+ export declare const ProvidersListDtoSchema: z.ZodObject<{
1161
+ country: z.ZodNullable<z.ZodString>;
1162
+ providers: z.ZodArray<z.ZodObject<{
1163
+ provider: z.ZodEnum<["stripe", "paypal", "razorpay"]>;
1164
+ priority: z.ZodNumber;
1165
+ countries: z.ZodArray<z.ZodString, "many">;
1166
+ }, "strip", z.ZodTypeAny, {
1167
+ provider: "stripe" | "paypal" | "razorpay";
1168
+ priority: number;
1169
+ countries: string[];
1170
+ }, {
1171
+ provider: "stripe" | "paypal" | "razorpay";
1172
+ priority: number;
1173
+ countries: string[];
1174
+ }>, "many">;
1175
+ }, "strip", z.ZodTypeAny, {
1176
+ country: string | null;
1177
+ providers: {
1178
+ provider: "stripe" | "paypal" | "razorpay";
1179
+ priority: number;
1180
+ countries: string[];
1181
+ }[];
1182
+ }, {
1183
+ country: string | null;
1184
+ providers: {
1185
+ provider: "stripe" | "paypal" | "razorpay";
1186
+ priority: number;
1187
+ countries: string[];
1188
+ }[];
1189
+ }>;
1190
+ export type ProvidersListDto = z.infer<typeof ProvidersListDtoSchema>;
1191
+ export declare const CouponDiscountTypeSchema: z.ZodEnum<["PERCENT", "AMOUNT"]>;
1192
+ export type CouponDiscountTypeValue = z.infer<typeof CouponDiscountTypeSchema>;
1193
+ export declare const CouponDtoSchema: z.ZodObject<{
1194
+ id: z.ZodString;
1195
+ applicationId: z.ZodString;
1196
+ code: z.ZodString;
1197
+ discountType: z.ZodEnum<["PERCENT", "AMOUNT"]>;
1198
+ /** PERCENT: basis-points × 10 (1500 = 15.00%). AMOUNT: smallest currency unit. */
1199
+ amountOff: z.ZodNumber;
1200
+ currency: z.ZodNullable<z.ZodString>;
1201
+ planSlugs: z.ZodArray<z.ZodString, "many">;
1202
+ active: z.ZodBoolean;
1203
+ startsAt: z.ZodNullable<z.ZodString>;
1204
+ endsAt: z.ZodNullable<z.ZodString>;
1205
+ maxRedemptions: z.ZodNullable<z.ZodNumber>;
1206
+ maxRedemptionsPerUser: z.ZodNullable<z.ZodNumber>;
1207
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1208
+ createdAt: z.ZodString;
1209
+ updatedAt: z.ZodString;
1210
+ }, "strip", z.ZodTypeAny, {
1211
+ code: string;
1212
+ currency: string | null;
1213
+ metadata: Record<string, unknown>;
1214
+ id: string;
1215
+ createdAt: string;
1216
+ applicationId: string;
1217
+ active: boolean;
1218
+ updatedAt: string;
1219
+ discountType: "PERCENT" | "AMOUNT";
1220
+ amountOff: number;
1221
+ planSlugs: string[];
1222
+ startsAt: string | null;
1223
+ endsAt: string | null;
1224
+ maxRedemptions: number | null;
1225
+ maxRedemptionsPerUser: number | null;
1226
+ }, {
1227
+ code: string;
1228
+ currency: string | null;
1229
+ metadata: Record<string, unknown>;
1230
+ id: string;
1231
+ createdAt: string;
1232
+ applicationId: string;
1233
+ active: boolean;
1234
+ updatedAt: string;
1235
+ discountType: "PERCENT" | "AMOUNT";
1236
+ amountOff: number;
1237
+ planSlugs: string[];
1238
+ startsAt: string | null;
1239
+ endsAt: string | null;
1240
+ maxRedemptions: number | null;
1241
+ maxRedemptionsPerUser: number | null;
1242
+ }>;
1243
+ export type CouponDto = z.infer<typeof CouponDtoSchema>;
1244
+ export declare const ValidateCouponRequestSchema: z.ZodObject<{
1245
+ code: z.ZodString;
1246
+ planSlug: z.ZodString;
1247
+ }, "strip", z.ZodTypeAny, {
1248
+ code: string;
1249
+ planSlug: string;
1250
+ }, {
1251
+ code: string;
1252
+ planSlug: string;
1253
+ }>;
1254
+ export type ValidateCouponRequest = z.infer<typeof ValidateCouponRequestSchema>;
1255
+ export declare const ValidateCouponResultDtoSchema: z.ZodObject<{
1256
+ coupon: z.ZodObject<{
1257
+ id: z.ZodString;
1258
+ applicationId: z.ZodString;
1259
+ code: z.ZodString;
1260
+ discountType: z.ZodEnum<["PERCENT", "AMOUNT"]>;
1261
+ /** PERCENT: basis-points × 10 (1500 = 15.00%). AMOUNT: smallest currency unit. */
1262
+ amountOff: z.ZodNumber;
1263
+ currency: z.ZodNullable<z.ZodString>;
1264
+ planSlugs: z.ZodArray<z.ZodString, "many">;
1265
+ active: z.ZodBoolean;
1266
+ startsAt: z.ZodNullable<z.ZodString>;
1267
+ endsAt: z.ZodNullable<z.ZodString>;
1268
+ maxRedemptions: z.ZodNullable<z.ZodNumber>;
1269
+ maxRedemptionsPerUser: z.ZodNullable<z.ZodNumber>;
1270
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1271
+ createdAt: z.ZodString;
1272
+ updatedAt: z.ZodString;
1273
+ }, "strip", z.ZodTypeAny, {
1274
+ code: string;
1275
+ currency: string | null;
1276
+ metadata: Record<string, unknown>;
1277
+ id: string;
1278
+ createdAt: string;
1279
+ applicationId: string;
1280
+ active: boolean;
1281
+ updatedAt: string;
1282
+ discountType: "PERCENT" | "AMOUNT";
1283
+ amountOff: number;
1284
+ planSlugs: string[];
1285
+ startsAt: string | null;
1286
+ endsAt: string | null;
1287
+ maxRedemptions: number | null;
1288
+ maxRedemptionsPerUser: number | null;
1289
+ }, {
1290
+ code: string;
1291
+ currency: string | null;
1292
+ metadata: Record<string, unknown>;
1293
+ id: string;
1294
+ createdAt: string;
1295
+ applicationId: string;
1296
+ active: boolean;
1297
+ updatedAt: string;
1298
+ discountType: "PERCENT" | "AMOUNT";
1299
+ amountOff: number;
1300
+ planSlugs: string[];
1301
+ startsAt: string | null;
1302
+ endsAt: string | null;
1303
+ maxRedemptions: number | null;
1304
+ maxRedemptionsPerUser: number | null;
1305
+ }>;
1306
+ plan: z.ZodObject<{
1307
+ slug: z.ZodString;
1308
+ name: z.ZodString;
1309
+ amount: z.ZodNumber;
1310
+ currency: z.ZodString;
1311
+ }, "strip", z.ZodTypeAny, {
1312
+ currency: string;
1313
+ name: string;
1314
+ slug: string;
1315
+ amount: number;
1316
+ }, {
1317
+ currency: string;
1318
+ name: string;
1319
+ slug: string;
1320
+ amount: number;
1321
+ }>;
1322
+ discountAmount: z.ZodNumber;
1323
+ amountAfterDiscount: z.ZodNumber;
1324
+ }, "strip", z.ZodTypeAny, {
1325
+ discountAmount: number;
1326
+ coupon: {
1327
+ code: string;
1328
+ currency: string | null;
1329
+ metadata: Record<string, unknown>;
1330
+ id: string;
1331
+ createdAt: string;
1332
+ applicationId: string;
1333
+ active: boolean;
1334
+ updatedAt: string;
1335
+ discountType: "PERCENT" | "AMOUNT";
1336
+ amountOff: number;
1337
+ planSlugs: string[];
1338
+ startsAt: string | null;
1339
+ endsAt: string | null;
1340
+ maxRedemptions: number | null;
1341
+ maxRedemptionsPerUser: number | null;
1342
+ };
1343
+ plan: {
1344
+ currency: string;
1345
+ name: string;
1346
+ slug: string;
1347
+ amount: number;
1348
+ };
1349
+ amountAfterDiscount: number;
1350
+ }, {
1351
+ discountAmount: number;
1352
+ coupon: {
1353
+ code: string;
1354
+ currency: string | null;
1355
+ metadata: Record<string, unknown>;
1356
+ id: string;
1357
+ createdAt: string;
1358
+ applicationId: string;
1359
+ active: boolean;
1360
+ updatedAt: string;
1361
+ discountType: "PERCENT" | "AMOUNT";
1362
+ amountOff: number;
1363
+ planSlugs: string[];
1364
+ startsAt: string | null;
1365
+ endsAt: string | null;
1366
+ maxRedemptions: number | null;
1367
+ maxRedemptionsPerUser: number | null;
1368
+ };
1369
+ plan: {
1370
+ currency: string;
1371
+ name: string;
1372
+ slug: string;
1373
+ amount: number;
1374
+ };
1375
+ amountAfterDiscount: number;
1376
+ }>;
1377
+ export type ValidateCouponResultDto = z.infer<typeof ValidateCouponResultDtoSchema>;
1378
+ //# sourceMappingURL=index.d.ts.map