@strimz/shared-types 0.14.0 → 0.16.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.
@@ -43,6 +43,9 @@ declare const subscriptionPlanSchema: z.ZodObject<{
43
43
  intervalCount: z.ZodNumber;
44
44
  trialPeriodDays: z.ZodNullable<z.ZodNumber>;
45
45
  status: z.ZodEnum<["active", "archived"]>;
46
+ /** `{SUBSCRIPTION_ID}` and `{ON_CHAIN_TX_HASH}` are filled in on redirect. */
47
+ successUrl: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
48
+ cancelUrl: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
46
49
  metadata: z.ZodDefault<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>, Record<string, string | number | boolean | null>, Record<string, string | number | boolean | null>>>;
47
50
  createdAt: z.ZodString;
48
51
  updatedAt: z.ZodString;
@@ -57,6 +60,8 @@ declare const subscriptionPlanSchema: z.ZodObject<{
57
60
  updatedAt: string;
58
61
  chainMerchantId: string | null;
59
62
  tokenAddress: string | null;
63
+ successUrl: string | null;
64
+ cancelUrl: string | null;
60
65
  metadata: Record<string, string | number | boolean | null>;
61
66
  intervalSeconds: number;
62
67
  name: string;
@@ -74,6 +79,8 @@ declare const subscriptionPlanSchema: z.ZodObject<{
74
79
  updatedAt: string;
75
80
  chainMerchantId: string | null;
76
81
  tokenAddress: string | null;
82
+ successUrl: string | null;
83
+ cancelUrl: string | null;
77
84
  intervalSeconds: number;
78
85
  name: string;
79
86
  interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
@@ -90,6 +97,8 @@ declare const createSubscriptionPlanInputSchema: z.ZodObject<{
90
97
  interval: z.ZodEnum<["daily", "weekly", "monthly", "quarterly", "yearly"]>;
91
98
  intervalCount: z.ZodDefault<z.ZodNumber>;
92
99
  trialPeriodDays: z.ZodOptional<z.ZodNumber>;
100
+ successUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
101
+ cancelUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
93
102
  metadata: z.ZodOptional<z.ZodDefault<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>, Record<string, string | number | boolean | null>, Record<string, string | number | boolean | null>>>>;
94
103
  }, "strip", z.ZodTypeAny, {
95
104
  amount: string;
@@ -98,6 +107,8 @@ declare const createSubscriptionPlanInputSchema: z.ZodObject<{
98
107
  interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
99
108
  intervalCount: number;
100
109
  description?: string | undefined;
110
+ successUrl?: string | undefined;
111
+ cancelUrl?: string | undefined;
101
112
  metadata?: Record<string, string | number | boolean | null> | undefined;
102
113
  trialPeriodDays?: number | undefined;
103
114
  }, {
@@ -106,12 +117,78 @@ declare const createSubscriptionPlanInputSchema: z.ZodObject<{
106
117
  name: string;
107
118
  interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
108
119
  description?: string | undefined;
120
+ successUrl?: string | undefined;
121
+ cancelUrl?: string | undefined;
109
122
  metadata?: Record<string, string | number | boolean | null> | undefined;
110
123
  intervalCount?: number | undefined;
111
124
  trialPeriodDays?: number | undefined;
112
125
  }>;
113
126
  type CreateSubscriptionPlanInput = z.input<typeof createSubscriptionPlanInputSchema>;
114
127
  type CreateSubscriptionPlanParsed = z.output<typeof createSubscriptionPlanInputSchema>;
128
+ /** Price, interval and trial are fixed once a plan exists; only these change. */
129
+ declare const updateSubscriptionPlanInputSchema: z.ZodEffects<z.ZodObject<{
130
+ successUrl: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
131
+ cancelUrl: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
132
+ }, "strict", z.ZodTypeAny, {
133
+ successUrl?: string | null | undefined;
134
+ cancelUrl?: string | null | undefined;
135
+ }, {
136
+ successUrl?: string | null | undefined;
137
+ cancelUrl?: string | null | undefined;
138
+ }>, {
139
+ successUrl?: string | null | undefined;
140
+ cancelUrl?: string | null | undefined;
141
+ }, {
142
+ successUrl?: string | null | undefined;
143
+ cancelUrl?: string | null | undefined;
144
+ }>;
145
+ type UpdateSubscriptionPlanInput = z.input<typeof updateSubscriptionPlanInputSchema>;
146
+ type UpdateSubscriptionPlanParsed = z.output<typeof updateSubscriptionPlanInputSchema>;
147
+ declare const subscriptionResultErrorCodes: readonly ["load_failed", "merchant_not_ready", "payment_reverted", "already_subscribed"];
148
+ declare const subscriptionResultErrorCodeSchema: z.ZodEnum<["load_failed", "merchant_not_ready", "payment_reverted", "already_subscribed"]>;
149
+ type SubscriptionResultErrorCode = z.infer<typeof subscriptionResultErrorCodeSchema>;
150
+ /** What `/sub/{planId}` posts to the page that embedded or opened it. */
151
+ declare const subscriptionResultMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
152
+ type: z.ZodLiteral<"strimz:subscription:success">;
153
+ planId: z.ZodString;
154
+ subscriptionId: z.ZodNullable<z.ZodString>;
155
+ txHash: z.ZodString;
156
+ }, "strip", z.ZodTypeAny, {
157
+ type: "strimz:subscription:success";
158
+ txHash: string;
159
+ planId: string;
160
+ subscriptionId: string | null;
161
+ }, {
162
+ type: "strimz:subscription:success";
163
+ txHash: string;
164
+ planId: string;
165
+ subscriptionId: string | null;
166
+ }>, z.ZodObject<{
167
+ type: z.ZodLiteral<"strimz:subscription:cancel">;
168
+ planId: z.ZodString;
169
+ }, "strip", z.ZodTypeAny, {
170
+ type: "strimz:subscription:cancel";
171
+ planId: string;
172
+ }, {
173
+ type: "strimz:subscription:cancel";
174
+ planId: string;
175
+ }>, z.ZodObject<{
176
+ type: z.ZodLiteral<"strimz:subscription:error">;
177
+ planId: z.ZodString;
178
+ code: z.ZodEnum<["load_failed", "merchant_not_ready", "payment_reverted", "already_subscribed"]>;
179
+ message: z.ZodString;
180
+ }, "strip", z.ZodTypeAny, {
181
+ code: "load_failed" | "merchant_not_ready" | "payment_reverted" | "already_subscribed";
182
+ message: string;
183
+ type: "strimz:subscription:error";
184
+ planId: string;
185
+ }, {
186
+ code: "load_failed" | "merchant_not_ready" | "payment_reverted" | "already_subscribed";
187
+ message: string;
188
+ type: "strimz:subscription:error";
189
+ planId: string;
190
+ }>]>;
191
+ type SubscriptionResultMessage = z.infer<typeof subscriptionResultMessageSchema>;
115
192
  declare const subscriptionStatusSchema: z.ZodEnum<["trialing", "active", "at_risk", "paused", "cancelled", "lapsed"]>;
116
193
  type SubscriptionStatus = z.infer<typeof subscriptionStatusSchema>;
117
194
  declare const subscriptionSchema: z.ZodObject<{
@@ -148,8 +225,8 @@ declare const subscriptionSchema: z.ZodObject<{
148
225
  payerAddress: string;
149
226
  interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
150
227
  intervalCount: number;
151
- onchainSubscriptionId: number | null;
152
228
  planId: string;
229
+ onchainSubscriptionId: number | null;
153
230
  trialEndsAt: string | null;
154
231
  currentPeriodStartAt: string;
155
232
  currentPeriodEndAt: string;
@@ -168,8 +245,8 @@ declare const subscriptionSchema: z.ZodObject<{
168
245
  payerAddress: string;
169
246
  interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
170
247
  intervalCount: number;
171
- onchainSubscriptionId: number | null;
172
248
  planId: string;
249
+ onchainSubscriptionId: number | null;
173
250
  trialEndsAt: string | null;
174
251
  currentPeriodStartAt: string;
175
252
  currentPeriodEndAt: string;
@@ -217,7 +294,7 @@ declare const cancelSubscriptionInputSchema: z.ZodObject<{
217
294
  }>;
218
295
  type CancelSubscriptionInput = z.input<typeof cancelSubscriptionInputSchema>;
219
296
  type CancelSubscriptionParsed = z.output<typeof cancelSubscriptionInputSchema>;
220
- declare const subscriptionChargeOutcomeSchema: z.ZodEnum<["charged", "insufficient_funds", "revoked_approval", "cancelled", "not_due", "ended", "duplicate", "unknown", "merchant_inactive", "transfer_failed", "skipped"]>;
297
+ declare const subscriptionChargeOutcomeSchema: z.ZodEnum<["charged", "insufficient_funds", "revoked_approval", "cancelled", "not_due", "ended", "duplicate", "unknown", "merchant_inactive", "transfer_failed", "skipped", "token_not_allowed"]>;
221
298
  type SubscriptionChargeOutcome = z.infer<typeof subscriptionChargeOutcomeSchema>;
222
299
  declare const subscriptionChargeStatusSchema: z.ZodEnum<["pending", "in_flight", "succeeded", "failed", "retrying", "abandoned"]>;
223
300
  type SubscriptionChargeStatus = z.infer<typeof subscriptionChargeStatusSchema>;
@@ -231,7 +308,7 @@ declare const subscriptionChargeSchema: z.ZodObject<{
231
308
  amount: z.ZodString;
232
309
  currency: z.ZodEnum<["USDC", "EURC"]>;
233
310
  status: z.ZodEnum<["pending", "in_flight", "succeeded", "failed", "retrying", "abandoned"]>;
234
- outcome: z.ZodNullable<z.ZodEnum<["charged", "insufficient_funds", "revoked_approval", "cancelled", "not_due", "ended", "duplicate", "unknown", "merchant_inactive", "transfer_failed", "skipped"]>>;
311
+ outcome: z.ZodNullable<z.ZodEnum<["charged", "insufficient_funds", "revoked_approval", "cancelled", "not_due", "ended", "duplicate", "unknown", "merchant_inactive", "transfer_failed", "skipped", "token_not_allowed"]>>;
235
312
  attemptNumber: z.ZodNumber;
236
313
  scheduledAt: z.ZodString;
237
314
  executedAt: z.ZodNullable<z.ZodString>;
@@ -253,7 +330,7 @@ declare const subscriptionChargeSchema: z.ZodObject<{
253
330
  chargeAttemptId: string;
254
331
  periodStartAt: string;
255
332
  periodEndAt: string;
256
- outcome: "unknown" | "cancelled" | "charged" | "insufficient_funds" | "revoked_approval" | "not_due" | "ended" | "duplicate" | "merchant_inactive" | "transfer_failed" | "skipped" | null;
333
+ outcome: "unknown" | "cancelled" | "charged" | "insufficient_funds" | "revoked_approval" | "not_due" | "ended" | "duplicate" | "merchant_inactive" | "transfer_failed" | "skipped" | "token_not_allowed" | null;
257
334
  attemptNumber: number;
258
335
  scheduledAt: string;
259
336
  executedAt: string | null;
@@ -271,11 +348,11 @@ declare const subscriptionChargeSchema: z.ZodObject<{
271
348
  chargeAttemptId: string;
272
349
  periodStartAt: string;
273
350
  periodEndAt: string;
274
- outcome: "unknown" | "cancelled" | "charged" | "insufficient_funds" | "revoked_approval" | "not_due" | "ended" | "duplicate" | "merchant_inactive" | "transfer_failed" | "skipped" | null;
351
+ outcome: "unknown" | "cancelled" | "charged" | "insufficient_funds" | "revoked_approval" | "not_due" | "ended" | "duplicate" | "merchant_inactive" | "transfer_failed" | "skipped" | "token_not_allowed" | null;
275
352
  attemptNumber: number;
276
353
  scheduledAt: string;
277
354
  executedAt: string | null;
278
355
  }>;
279
356
  type SubscriptionCharge = z.infer<typeof subscriptionChargeSchema>;
280
357
 
281
- export { type CancelSubscriptionInput, type CancelSubscriptionParsed, type CreateSubscriptionPlanInput, type CreateSubscriptionPlanParsed, type Subscription, type SubscriptionCharge, type SubscriptionChargeOutcome, type SubscriptionChargeStatus, type SubscriptionEnrolmentTerms, type SubscriptionInterval, type SubscriptionPlan, type SubscriptionPlanStatus, type SubscriptionStatus, type SubscriptionStatusResult, cancelSubscriptionInputSchema, createSubscriptionPlanInputSchema, subscriptionChargeOutcomeSchema, subscriptionChargeSchema, subscriptionChargeStatusSchema, subscriptionEnrolmentTermsSchema, subscriptionIntervalSchema, subscriptionPlanSchema, subscriptionPlanStatusSchema, subscriptionSchema, subscriptionStatusResultSchema, subscriptionStatusSchema };
358
+ export { type CancelSubscriptionInput, type CancelSubscriptionParsed, type CreateSubscriptionPlanInput, type CreateSubscriptionPlanParsed, type Subscription, type SubscriptionCharge, type SubscriptionChargeOutcome, type SubscriptionChargeStatus, type SubscriptionEnrolmentTerms, type SubscriptionInterval, type SubscriptionPlan, type SubscriptionPlanStatus, type SubscriptionResultErrorCode, type SubscriptionResultMessage, type SubscriptionStatus, type SubscriptionStatusResult, type UpdateSubscriptionPlanInput, type UpdateSubscriptionPlanParsed, cancelSubscriptionInputSchema, createSubscriptionPlanInputSchema, subscriptionChargeOutcomeSchema, subscriptionChargeSchema, subscriptionChargeStatusSchema, subscriptionEnrolmentTermsSchema, subscriptionIntervalSchema, subscriptionPlanSchema, subscriptionPlanStatusSchema, subscriptionResultErrorCodeSchema, subscriptionResultErrorCodes, subscriptionResultMessageSchema, subscriptionSchema, subscriptionStatusResultSchema, subscriptionStatusSchema, updateSubscriptionPlanInputSchema };
@@ -43,6 +43,9 @@ declare const subscriptionPlanSchema: z.ZodObject<{
43
43
  intervalCount: z.ZodNumber;
44
44
  trialPeriodDays: z.ZodNullable<z.ZodNumber>;
45
45
  status: z.ZodEnum<["active", "archived"]>;
46
+ /** `{SUBSCRIPTION_ID}` and `{ON_CHAIN_TX_HASH}` are filled in on redirect. */
47
+ successUrl: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
48
+ cancelUrl: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
46
49
  metadata: z.ZodDefault<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>, Record<string, string | number | boolean | null>, Record<string, string | number | boolean | null>>>;
47
50
  createdAt: z.ZodString;
48
51
  updatedAt: z.ZodString;
@@ -57,6 +60,8 @@ declare const subscriptionPlanSchema: z.ZodObject<{
57
60
  updatedAt: string;
58
61
  chainMerchantId: string | null;
59
62
  tokenAddress: string | null;
63
+ successUrl: string | null;
64
+ cancelUrl: string | null;
60
65
  metadata: Record<string, string | number | boolean | null>;
61
66
  intervalSeconds: number;
62
67
  name: string;
@@ -74,6 +79,8 @@ declare const subscriptionPlanSchema: z.ZodObject<{
74
79
  updatedAt: string;
75
80
  chainMerchantId: string | null;
76
81
  tokenAddress: string | null;
82
+ successUrl: string | null;
83
+ cancelUrl: string | null;
77
84
  intervalSeconds: number;
78
85
  name: string;
79
86
  interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
@@ -90,6 +97,8 @@ declare const createSubscriptionPlanInputSchema: z.ZodObject<{
90
97
  interval: z.ZodEnum<["daily", "weekly", "monthly", "quarterly", "yearly"]>;
91
98
  intervalCount: z.ZodDefault<z.ZodNumber>;
92
99
  trialPeriodDays: z.ZodOptional<z.ZodNumber>;
100
+ successUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
101
+ cancelUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
93
102
  metadata: z.ZodOptional<z.ZodDefault<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>, Record<string, string | number | boolean | null>, Record<string, string | number | boolean | null>>>>;
94
103
  }, "strip", z.ZodTypeAny, {
95
104
  amount: string;
@@ -98,6 +107,8 @@ declare const createSubscriptionPlanInputSchema: z.ZodObject<{
98
107
  interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
99
108
  intervalCount: number;
100
109
  description?: string | undefined;
110
+ successUrl?: string | undefined;
111
+ cancelUrl?: string | undefined;
101
112
  metadata?: Record<string, string | number | boolean | null> | undefined;
102
113
  trialPeriodDays?: number | undefined;
103
114
  }, {
@@ -106,12 +117,78 @@ declare const createSubscriptionPlanInputSchema: z.ZodObject<{
106
117
  name: string;
107
118
  interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
108
119
  description?: string | undefined;
120
+ successUrl?: string | undefined;
121
+ cancelUrl?: string | undefined;
109
122
  metadata?: Record<string, string | number | boolean | null> | undefined;
110
123
  intervalCount?: number | undefined;
111
124
  trialPeriodDays?: number | undefined;
112
125
  }>;
113
126
  type CreateSubscriptionPlanInput = z.input<typeof createSubscriptionPlanInputSchema>;
114
127
  type CreateSubscriptionPlanParsed = z.output<typeof createSubscriptionPlanInputSchema>;
128
+ /** Price, interval and trial are fixed once a plan exists; only these change. */
129
+ declare const updateSubscriptionPlanInputSchema: z.ZodEffects<z.ZodObject<{
130
+ successUrl: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
131
+ cancelUrl: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
132
+ }, "strict", z.ZodTypeAny, {
133
+ successUrl?: string | null | undefined;
134
+ cancelUrl?: string | null | undefined;
135
+ }, {
136
+ successUrl?: string | null | undefined;
137
+ cancelUrl?: string | null | undefined;
138
+ }>, {
139
+ successUrl?: string | null | undefined;
140
+ cancelUrl?: string | null | undefined;
141
+ }, {
142
+ successUrl?: string | null | undefined;
143
+ cancelUrl?: string | null | undefined;
144
+ }>;
145
+ type UpdateSubscriptionPlanInput = z.input<typeof updateSubscriptionPlanInputSchema>;
146
+ type UpdateSubscriptionPlanParsed = z.output<typeof updateSubscriptionPlanInputSchema>;
147
+ declare const subscriptionResultErrorCodes: readonly ["load_failed", "merchant_not_ready", "payment_reverted", "already_subscribed"];
148
+ declare const subscriptionResultErrorCodeSchema: z.ZodEnum<["load_failed", "merchant_not_ready", "payment_reverted", "already_subscribed"]>;
149
+ type SubscriptionResultErrorCode = z.infer<typeof subscriptionResultErrorCodeSchema>;
150
+ /** What `/sub/{planId}` posts to the page that embedded or opened it. */
151
+ declare const subscriptionResultMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
152
+ type: z.ZodLiteral<"strimz:subscription:success">;
153
+ planId: z.ZodString;
154
+ subscriptionId: z.ZodNullable<z.ZodString>;
155
+ txHash: z.ZodString;
156
+ }, "strip", z.ZodTypeAny, {
157
+ type: "strimz:subscription:success";
158
+ txHash: string;
159
+ planId: string;
160
+ subscriptionId: string | null;
161
+ }, {
162
+ type: "strimz:subscription:success";
163
+ txHash: string;
164
+ planId: string;
165
+ subscriptionId: string | null;
166
+ }>, z.ZodObject<{
167
+ type: z.ZodLiteral<"strimz:subscription:cancel">;
168
+ planId: z.ZodString;
169
+ }, "strip", z.ZodTypeAny, {
170
+ type: "strimz:subscription:cancel";
171
+ planId: string;
172
+ }, {
173
+ type: "strimz:subscription:cancel";
174
+ planId: string;
175
+ }>, z.ZodObject<{
176
+ type: z.ZodLiteral<"strimz:subscription:error">;
177
+ planId: z.ZodString;
178
+ code: z.ZodEnum<["load_failed", "merchant_not_ready", "payment_reverted", "already_subscribed"]>;
179
+ message: z.ZodString;
180
+ }, "strip", z.ZodTypeAny, {
181
+ code: "load_failed" | "merchant_not_ready" | "payment_reverted" | "already_subscribed";
182
+ message: string;
183
+ type: "strimz:subscription:error";
184
+ planId: string;
185
+ }, {
186
+ code: "load_failed" | "merchant_not_ready" | "payment_reverted" | "already_subscribed";
187
+ message: string;
188
+ type: "strimz:subscription:error";
189
+ planId: string;
190
+ }>]>;
191
+ type SubscriptionResultMessage = z.infer<typeof subscriptionResultMessageSchema>;
115
192
  declare const subscriptionStatusSchema: z.ZodEnum<["trialing", "active", "at_risk", "paused", "cancelled", "lapsed"]>;
116
193
  type SubscriptionStatus = z.infer<typeof subscriptionStatusSchema>;
117
194
  declare const subscriptionSchema: z.ZodObject<{
@@ -148,8 +225,8 @@ declare const subscriptionSchema: z.ZodObject<{
148
225
  payerAddress: string;
149
226
  interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
150
227
  intervalCount: number;
151
- onchainSubscriptionId: number | null;
152
228
  planId: string;
229
+ onchainSubscriptionId: number | null;
153
230
  trialEndsAt: string | null;
154
231
  currentPeriodStartAt: string;
155
232
  currentPeriodEndAt: string;
@@ -168,8 +245,8 @@ declare const subscriptionSchema: z.ZodObject<{
168
245
  payerAddress: string;
169
246
  interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
170
247
  intervalCount: number;
171
- onchainSubscriptionId: number | null;
172
248
  planId: string;
249
+ onchainSubscriptionId: number | null;
173
250
  trialEndsAt: string | null;
174
251
  currentPeriodStartAt: string;
175
252
  currentPeriodEndAt: string;
@@ -217,7 +294,7 @@ declare const cancelSubscriptionInputSchema: z.ZodObject<{
217
294
  }>;
218
295
  type CancelSubscriptionInput = z.input<typeof cancelSubscriptionInputSchema>;
219
296
  type CancelSubscriptionParsed = z.output<typeof cancelSubscriptionInputSchema>;
220
- declare const subscriptionChargeOutcomeSchema: z.ZodEnum<["charged", "insufficient_funds", "revoked_approval", "cancelled", "not_due", "ended", "duplicate", "unknown", "merchant_inactive", "transfer_failed", "skipped"]>;
297
+ declare const subscriptionChargeOutcomeSchema: z.ZodEnum<["charged", "insufficient_funds", "revoked_approval", "cancelled", "not_due", "ended", "duplicate", "unknown", "merchant_inactive", "transfer_failed", "skipped", "token_not_allowed"]>;
221
298
  type SubscriptionChargeOutcome = z.infer<typeof subscriptionChargeOutcomeSchema>;
222
299
  declare const subscriptionChargeStatusSchema: z.ZodEnum<["pending", "in_flight", "succeeded", "failed", "retrying", "abandoned"]>;
223
300
  type SubscriptionChargeStatus = z.infer<typeof subscriptionChargeStatusSchema>;
@@ -231,7 +308,7 @@ declare const subscriptionChargeSchema: z.ZodObject<{
231
308
  amount: z.ZodString;
232
309
  currency: z.ZodEnum<["USDC", "EURC"]>;
233
310
  status: z.ZodEnum<["pending", "in_flight", "succeeded", "failed", "retrying", "abandoned"]>;
234
- outcome: z.ZodNullable<z.ZodEnum<["charged", "insufficient_funds", "revoked_approval", "cancelled", "not_due", "ended", "duplicate", "unknown", "merchant_inactive", "transfer_failed", "skipped"]>>;
311
+ outcome: z.ZodNullable<z.ZodEnum<["charged", "insufficient_funds", "revoked_approval", "cancelled", "not_due", "ended", "duplicate", "unknown", "merchant_inactive", "transfer_failed", "skipped", "token_not_allowed"]>>;
235
312
  attemptNumber: z.ZodNumber;
236
313
  scheduledAt: z.ZodString;
237
314
  executedAt: z.ZodNullable<z.ZodString>;
@@ -253,7 +330,7 @@ declare const subscriptionChargeSchema: z.ZodObject<{
253
330
  chargeAttemptId: string;
254
331
  periodStartAt: string;
255
332
  periodEndAt: string;
256
- outcome: "unknown" | "cancelled" | "charged" | "insufficient_funds" | "revoked_approval" | "not_due" | "ended" | "duplicate" | "merchant_inactive" | "transfer_failed" | "skipped" | null;
333
+ outcome: "unknown" | "cancelled" | "charged" | "insufficient_funds" | "revoked_approval" | "not_due" | "ended" | "duplicate" | "merchant_inactive" | "transfer_failed" | "skipped" | "token_not_allowed" | null;
257
334
  attemptNumber: number;
258
335
  scheduledAt: string;
259
336
  executedAt: string | null;
@@ -271,11 +348,11 @@ declare const subscriptionChargeSchema: z.ZodObject<{
271
348
  chargeAttemptId: string;
272
349
  periodStartAt: string;
273
350
  periodEndAt: string;
274
- outcome: "unknown" | "cancelled" | "charged" | "insufficient_funds" | "revoked_approval" | "not_due" | "ended" | "duplicate" | "merchant_inactive" | "transfer_failed" | "skipped" | null;
351
+ outcome: "unknown" | "cancelled" | "charged" | "insufficient_funds" | "revoked_approval" | "not_due" | "ended" | "duplicate" | "merchant_inactive" | "transfer_failed" | "skipped" | "token_not_allowed" | null;
275
352
  attemptNumber: number;
276
353
  scheduledAt: string;
277
354
  executedAt: string | null;
278
355
  }>;
279
356
  type SubscriptionCharge = z.infer<typeof subscriptionChargeSchema>;
280
357
 
281
- export { type CancelSubscriptionInput, type CancelSubscriptionParsed, type CreateSubscriptionPlanInput, type CreateSubscriptionPlanParsed, type Subscription, type SubscriptionCharge, type SubscriptionChargeOutcome, type SubscriptionChargeStatus, type SubscriptionEnrolmentTerms, type SubscriptionInterval, type SubscriptionPlan, type SubscriptionPlanStatus, type SubscriptionStatus, type SubscriptionStatusResult, cancelSubscriptionInputSchema, createSubscriptionPlanInputSchema, subscriptionChargeOutcomeSchema, subscriptionChargeSchema, subscriptionChargeStatusSchema, subscriptionEnrolmentTermsSchema, subscriptionIntervalSchema, subscriptionPlanSchema, subscriptionPlanStatusSchema, subscriptionSchema, subscriptionStatusResultSchema, subscriptionStatusSchema };
358
+ export { type CancelSubscriptionInput, type CancelSubscriptionParsed, type CreateSubscriptionPlanInput, type CreateSubscriptionPlanParsed, type Subscription, type SubscriptionCharge, type SubscriptionChargeOutcome, type SubscriptionChargeStatus, type SubscriptionEnrolmentTerms, type SubscriptionInterval, type SubscriptionPlan, type SubscriptionPlanStatus, type SubscriptionResultErrorCode, type SubscriptionResultMessage, type SubscriptionStatus, type SubscriptionStatusResult, type UpdateSubscriptionPlanInput, type UpdateSubscriptionPlanParsed, cancelSubscriptionInputSchema, createSubscriptionPlanInputSchema, subscriptionChargeOutcomeSchema, subscriptionChargeSchema, subscriptionChargeStatusSchema, subscriptionEnrolmentTermsSchema, subscriptionIntervalSchema, subscriptionPlanSchema, subscriptionPlanStatusSchema, subscriptionResultErrorCodeSchema, subscriptionResultErrorCodes, subscriptionResultMessageSchema, subscriptionSchema, subscriptionStatusResultSchema, subscriptionStatusSchema, updateSubscriptionPlanInputSchema };
@@ -26,6 +26,120 @@ var paymentCurrencySchema = z.enum(["USDC", "EURC"]);
26
26
  z.enum(["USDC", "EURC", "USYC"]);
27
27
  z.enum(["free", "starter", "growth", "enterprise"]);
28
28
  z.enum(["testnet", "mainnet"]);
29
+ var paymentSessionStatusSchema = z.enum([
30
+ "created",
31
+ "awaiting_payment",
32
+ "submitted",
33
+ "confirmed",
34
+ "failed",
35
+ "expired",
36
+ "cancelled"
37
+ ]);
38
+ var callbackUrlSchema = z.string().url().refine((v) => v.startsWith("https://") || v.startsWith("http://"), {
39
+ message: "must be an http:// or https:// URL"
40
+ });
41
+ z.object({
42
+ id: idSchema,
43
+ merchantId: idSchema,
44
+ /**
45
+ * On-chain StrimzRegistry merchant id (uint96) as a decimal string.
46
+ * Set when the merchant has been registered on-chain; null when the
47
+ * merchant exists in our DB but the registry transaction hasn't
48
+ * been broadcast yet. Hosted checkout uses this to populate the
49
+ * meta-tx calldata; if null, the checkout refuses to accept
50
+ * payments.
51
+ */
52
+ chainMerchantId: z.string().regex(/^[0-9]+$/u, "must be a non-negative decimal integer string").nullable(),
53
+ /**
54
+ * ERC-20 token contract address resolved from `currency` on the
55
+ * active chain (Arc Testnet / Mainnet). Used as the `verifyingContract`
56
+ * in the EIP-712 domain for both EIP-3009 and EIP-2612 signing.
57
+ * Null on the (vanishingly unlikely) path where the API has no
58
+ * configured address for the session's currency.
59
+ */
60
+ tokenAddress: evmAddressSchema.nullable(),
61
+ customerId: idSchema.nullable(),
62
+ status: paymentSessionStatusSchema,
63
+ amount: tokenAmountSchema,
64
+ currency: paymentCurrencySchema,
65
+ feeAmount: tokenAmountSchema,
66
+ netAmount: tokenAmountSchema,
67
+ description: z.string().max(500).nullable(),
68
+ payerWalletAddress: evmAddressSchema.nullable(),
69
+ payerEmail: z.string().email().nullable(),
70
+ successUrl: callbackUrlSchema.nullable(),
71
+ cancelUrl: callbackUrlSchema.nullable(),
72
+ sourceChain: z.enum(["arc", "ethereum", "base", "polygon", "arbitrum", "optimism", "avalanche", "solana"]).nullable(),
73
+ bridgeTxHash: evmTxHashSchema.nullable(),
74
+ onchainTxHash: evmTxHashSchema.nullable(),
75
+ checkoutUrl: z.string().url(),
76
+ metadata: metadataSchema,
77
+ expiresAt: isoTimestampSchema,
78
+ createdAt: isoTimestampSchema,
79
+ updatedAt: isoTimestampSchema
80
+ });
81
+ z.object({
82
+ amount: tokenAmountSchema,
83
+ currency: paymentCurrencySchema,
84
+ description: z.string().max(500).optional(),
85
+ customer: z.object({
86
+ walletAddress: evmAddressSchema.optional(),
87
+ email: z.string().email().optional(),
88
+ externalRef: z.string().max(120).optional()
89
+ }).optional(),
90
+ successUrl: callbackUrlSchema.optional(),
91
+ cancelUrl: callbackUrlSchema.optional(),
92
+ /** Minutes until the session expires. Default 30, max 60*24 (one day). */
93
+ expiresInMinutes: z.number().int().min(1).max(60 * 24).default(30),
94
+ /**
95
+ * Allowed source chains a payer can bridge USDC from via CCTP. Omit to
96
+ * accept every CCTP-supported chain.
97
+ */
98
+ supportedSourceChains: z.array(
99
+ z.enum(["arc", "ethereum", "base", "polygon", "arbitrum", "optimism", "avalanche", "solana"])
100
+ ).optional(),
101
+ metadata: metadataSchema.optional()
102
+ });
103
+ z.object({
104
+ sourceChain: z.enum([
105
+ "arc",
106
+ "ethereum",
107
+ "base",
108
+ "polygon",
109
+ "arbitrum",
110
+ "optimism",
111
+ "avalanche",
112
+ "solana"
113
+ ]),
114
+ onchainTxHash: evmTxHashSchema,
115
+ bridgeTxHash: evmTxHashSchema.optional(),
116
+ payerWalletAddress: evmAddressSchema
117
+ });
118
+ var checkoutResultErrorCodes = [
119
+ "load_failed",
120
+ "merchant_not_ready",
121
+ "payment_reverted",
122
+ // No longer sent: smart-contract wallets can pay since the #142 redeploy.
123
+ "unsupported_wallet"
124
+ ];
125
+ var checkoutResultErrorCodeSchema = z.enum(checkoutResultErrorCodes);
126
+ z.discriminatedUnion("type", [
127
+ z.object({
128
+ type: z.literal("strimz:checkout:success"),
129
+ sessionId: idSchema,
130
+ txHash: evmTxHashSchema
131
+ }),
132
+ z.object({
133
+ type: z.literal("strimz:checkout:cancel"),
134
+ sessionId: idSchema
135
+ }),
136
+ z.object({
137
+ type: z.literal("strimz:checkout:error"),
138
+ sessionId: idSchema,
139
+ code: checkoutResultErrorCodeSchema,
140
+ message: z.string().min(1).max(500)
141
+ })
142
+ ]);
29
143
 
30
144
  // src/subscriptions.ts
31
145
  var subscriptionIntervalSchema = z.enum([
@@ -65,6 +179,9 @@ var subscriptionPlanSchema = z.object({
65
179
  intervalCount: z.number().int().min(1).max(365),
66
180
  trialPeriodDays: z.number().int().min(0).max(365).nullable(),
67
181
  status: subscriptionPlanStatusSchema,
182
+ /** `{SUBSCRIPTION_ID}` and `{ON_CHAIN_TX_HASH}` are filled in on redirect. */
183
+ successUrl: callbackUrlSchema.nullable(),
184
+ cancelUrl: callbackUrlSchema.nullable(),
68
185
  metadata: metadataSchema,
69
186
  createdAt: isoTimestampSchema,
70
187
  updatedAt: isoTimestampSchema
@@ -77,8 +194,41 @@ var createSubscriptionPlanInputSchema = z.object({
77
194
  interval: subscriptionIntervalSchema,
78
195
  intervalCount: z.number().int().min(1).max(365).default(1),
79
196
  trialPeriodDays: z.number().int().min(0).max(365).optional(),
197
+ successUrl: callbackUrlSchema.optional(),
198
+ cancelUrl: callbackUrlSchema.optional(),
80
199
  metadata: metadataSchema.optional()
81
200
  });
201
+ var updateSubscriptionPlanInputSchema = z.object({
202
+ successUrl: callbackUrlSchema.nullable().optional(),
203
+ cancelUrl: callbackUrlSchema.nullable().optional()
204
+ }).strict().refine((v) => v.successUrl !== void 0 || v.cancelUrl !== void 0, {
205
+ message: "set successUrl or cancelUrl"
206
+ });
207
+ var subscriptionResultErrorCodes = [
208
+ "load_failed",
209
+ "merchant_not_ready",
210
+ "payment_reverted",
211
+ "already_subscribed"
212
+ ];
213
+ var subscriptionResultErrorCodeSchema = z.enum(subscriptionResultErrorCodes);
214
+ var subscriptionResultMessageSchema = z.discriminatedUnion("type", [
215
+ z.object({
216
+ type: z.literal("strimz:subscription:success"),
217
+ planId: idSchema,
218
+ subscriptionId: idSchema.nullable(),
219
+ txHash: evmTxHashSchema
220
+ }),
221
+ z.object({
222
+ type: z.literal("strimz:subscription:cancel"),
223
+ planId: idSchema
224
+ }),
225
+ z.object({
226
+ type: z.literal("strimz:subscription:error"),
227
+ planId: idSchema,
228
+ code: subscriptionResultErrorCodeSchema,
229
+ message: z.string().min(1).max(500)
230
+ })
231
+ ]);
82
232
  var subscriptionStatusSchema = z.enum([
83
233
  "trialing",
84
234
  "active",
@@ -133,7 +283,8 @@ var subscriptionChargeOutcomeSchema = z.enum([
133
283
  "unknown",
134
284
  "merchant_inactive",
135
285
  "transfer_failed",
136
- "skipped"
286
+ "skipped",
287
+ "token_not_allowed"
137
288
  ]);
138
289
  var subscriptionChargeStatusSchema = z.enum([
139
290
  "pending",
@@ -163,6 +314,6 @@ var subscriptionChargeSchema = z.object({
163
314
  updatedAt: isoTimestampSchema
164
315
  });
165
316
 
166
- export { cancelSubscriptionInputSchema, createSubscriptionPlanInputSchema, subscriptionChargeOutcomeSchema, subscriptionChargeSchema, subscriptionChargeStatusSchema, subscriptionEnrolmentTermsSchema, subscriptionIntervalSchema, subscriptionPlanSchema, subscriptionPlanStatusSchema, subscriptionSchema, subscriptionStatusResultSchema, subscriptionStatusSchema };
317
+ export { cancelSubscriptionInputSchema, createSubscriptionPlanInputSchema, subscriptionChargeOutcomeSchema, subscriptionChargeSchema, subscriptionChargeStatusSchema, subscriptionEnrolmentTermsSchema, subscriptionIntervalSchema, subscriptionPlanSchema, subscriptionPlanStatusSchema, subscriptionResultErrorCodeSchema, subscriptionResultErrorCodes, subscriptionResultMessageSchema, subscriptionSchema, subscriptionStatusResultSchema, subscriptionStatusSchema, updateSubscriptionPlanInputSchema };
167
318
  //# sourceMappingURL=subscriptions.js.map
168
319
  //# sourceMappingURL=subscriptions.js.map