@strimz/shared-types 0.6.0 → 0.8.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/README.md +7 -4
- package/dist/agents.cjs.map +1 -1
- package/dist/agents.d.cts +7 -5
- package/dist/agents.d.ts +7 -5
- package/dist/agents.js.map +1 -1
- package/dist/analytics.cjs +568 -0
- package/dist/analytics.cjs.map +1 -0
- package/dist/analytics.d.cts +1719 -0
- package/dist/analytics.d.ts +1719 -0
- package/dist/analytics.js +540 -0
- package/dist/analytics.js.map +1 -0
- package/dist/api-keys.cjs.map +1 -1
- package/dist/api-keys.d.cts +19 -17
- package/dist/api-keys.d.ts +19 -17
- package/dist/api-keys.js.map +1 -1
- package/dist/common.cjs.map +1 -1
- package/dist/common.d.cts +3 -2
- package/dist/common.d.ts +3 -2
- package/dist/common.js.map +1 -1
- package/dist/compliance.cjs.map +1 -1
- package/dist/compliance.d.cts +8 -8
- package/dist/compliance.d.ts +8 -8
- package/dist/compliance.js.map +1 -1
- package/dist/customers.cjs.map +1 -1
- package/dist/customers.d.cts +10 -9
- package/dist/customers.d.ts +10 -9
- package/dist/customers.js.map +1 -1
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +1936 -1936
- package/dist/events.d.ts +1936 -1936
- package/dist/events.js.map +1 -1
- package/dist/index.cjs +216 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -22
- package/dist/index.d.ts +25 -22
- package/dist/index.js +190 -1
- package/dist/index.js.map +1 -1
- package/dist/invoices.cjs.map +1 -1
- package/dist/invoices.d.cts +19 -18
- package/dist/invoices.d.ts +19 -18
- package/dist/invoices.js.map +1 -1
- package/dist/merchants.cjs.map +1 -1
- package/dist/merchants.d.cts +42 -36
- package/dist/merchants.d.ts +42 -36
- package/dist/merchants.js.map +1 -1
- package/dist/payment-sessions.cjs.map +1 -1
- package/dist/payment-sessions.d.cts +24 -22
- package/dist/payment-sessions.d.ts +24 -22
- package/dist/payment-sessions.js.map +1 -1
- package/dist/refunds.cjs.map +1 -1
- package/dist/refunds.d.cts +55 -53
- package/dist/refunds.d.ts +55 -53
- package/dist/refunds.js.map +1 -1
- package/dist/storefronts.cjs.map +1 -1
- package/dist/storefronts.d.cts +31 -28
- package/dist/storefronts.d.ts +31 -28
- package/dist/storefronts.js.map +1 -1
- package/dist/subscriptions.cjs.map +1 -1
- package/dist/subscriptions.d.cts +49 -46
- package/dist/subscriptions.d.ts +49 -46
- package/dist/subscriptions.js.map +1 -1
- package/dist/transactions.cjs.map +1 -1
- package/dist/transactions.d.cts +14 -14
- package/dist/transactions.d.ts +14 -14
- package/dist/transactions.js.map +1 -1
- package/dist/webhooks.cjs.map +1 -1
- package/dist/webhooks.d.cts +33 -31
- package/dist/webhooks.d.ts +33 -31
- package/dist/webhooks.js.map +1 -1
- package/package.json +6 -1
- package/src/agents.ts +4 -2
- package/src/analytics.ts +275 -0
- package/src/api-keys.ts +4 -2
- package/src/common.ts +2 -1
- package/src/contact.ts +2 -1
- package/src/customers.ts +2 -1
- package/src/index.ts +1 -0
- package/src/invoices.ts +2 -1
- package/src/merchants.ts +12 -6
- package/src/notifications.ts +2 -1
- package/src/payment-sessions.ts +4 -2
- package/src/refunds.ts +4 -2
- package/src/storefronts.ts +6 -3
- package/src/subscriptions.ts +6 -3
- package/src/webhooks.ts +4 -2
package/dist/storefronts.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common.ts","../src/subscriptions.ts","../src/storefronts.ts"],"names":["z"],"mappings":";;;;;AAQO,IAAM,QAAA,GAAWA,KAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAG3C,IAAM,gBAAA,GAAmBA,KAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACj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,CAAY,CAAC,KAAA,EAAO,GAAA,KAAQ;AAC3B,EAAA,IAAI,KAAA,CAAM,IAAA,KAAS,cAAA,IAAkB,CAAC,MAAM,MAAA,EAAQ;AAClD,IAAA,GAAA,CAAI,QAAA,CAAS;AAAA,MACX,IAAA,EAAMA,MAAE,YAAA,CAAa,MAAA;AAAA,MACrB,IAAA,EAAM,CAAC,QAAQ,CAAA;AAAA,MACf,OAAA,EAAS;AAAA,KACV,CAAA;AAAA,EACH;AACA,EAAA,IAAI,KAAA,CAAM,IAAA,KAAS,UAAA,IAAc,KAAA,CAAM,MAAA,EAAQ;AAC7C,IAAA,GAAA,CAAI,QAAA,CAAS;AAAA,MACX,IAAA,EAAMA,MAAE,YAAA,CAAa,MAAA;AAAA,MACrB,IAAA,EAAM,CAAC,QAAQ,CAAA;AAAA,MACf,OAAA,EAAS;AAAA,KACV,CAAA;AAAA,EACH;AACF,CAAC;AAUI,IAAM,6BAAA,GAAgCA,MAAE,MAAA,CAAO;AAAA,EACpD,eAAeA,KAAAA,CAAE,MAAA,EAAO,CAAE,KAAA,GAAQ,QAAA,EAAS;AAAA,EAC3C,YAAYA,KAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA;AAClC,CAAC;AAIM,IAAM,gCAAA,GAAmCA,MAAE,MAAA,CAAO;AAAA;AAAA,EAEvD,WAAA,EAAaA,KAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI;AAAA;AAAA,EAE5B,GAAA,EAAK,QAAA;AAAA;AAAA,EAEL,MAAMA,KAAAA,CAAE,IAAA,CAAK,CAAC,iBAAA,EAAmB,mBAAmB,CAAC;AACvD,CAAC","file":"storefronts.cjs","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.infer<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum. */\nexport const merchantTierSchema = z.enum(['free', 'growth', 'business', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * Subscriptions: plans, active subscriptions, and individual charges.\n *\n * Design notes:\n * - A SubscriptionPlan is the template a merchant defines.\n * - A Subscription is an active, customer-scoped instance of a plan.\n * - Each billing period produces a SubscriptionCharge with a unique\n * chargeAttemptId used to enforce idempotency at the contract level.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n metadataSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\n\n// ---------- Plans ----------\n\nexport const subscriptionIntervalSchema = z.enum([\n 'daily',\n 'weekly',\n 'monthly',\n 'quarterly',\n 'yearly',\n])\nexport type SubscriptionInterval = z.infer<typeof subscriptionIntervalSchema>\n\nexport const subscriptionPlanStatusSchema = z.enum(['active', 'archived'])\nexport type SubscriptionPlanStatus = z.infer<typeof subscriptionPlanStatusSchema>\n\nexport const subscriptionPlanSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n /**\n * On-chain StrimzRegistry merchant id (uint96) as a decimal string.\n * See `paymentSessionSchema.chainMerchantId`. Null when the merchant\n * hasn't been registered on-chain yet. The hosted enrolment page\n * refuses to take signatures in that state.\n */\n chainMerchantId: z\n .string()\n .regex(/^[0-9]+$/u, 'must be a non-negative decimal integer string')\n .nullable(),\n /**\n * ERC-20 token contract address resolved from `currency`. This is the\n * EIP-2612 `verifyingContract` the wallet signs over.\n */\n tokenAddress: evmAddressSchema.nullable(),\n /**\n * Charge cadence in seconds, derived from `interval` + `intervalCount`\n * so the meta-tx layer can pass a uint32 to StrimzSubscriptions\n * without re-deriving the conversion on the client.\n */\n intervalSeconds: z.number().int().positive(),\n name: z.string().min(1).max(120),\n description: z.string().max(500).nullable(),\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n interval: subscriptionIntervalSchema,\n intervalCount: z.number().int().min(1).max(365),\n trialPeriodDays: z.number().int().min(0).max(365).nullable(),\n status: subscriptionPlanStatusSchema,\n metadata: metadataSchema,\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type SubscriptionPlan = z.infer<typeof subscriptionPlanSchema>\n\nexport const createSubscriptionPlanInputSchema = z.object({\n name: z.string().min(1).max(120),\n description: z.string().max(500).optional(),\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n interval: subscriptionIntervalSchema,\n intervalCount: z.number().int().min(1).max(365).default(1),\n trialPeriodDays: z.number().int().min(0).max(365).optional(),\n metadata: metadataSchema.optional(),\n})\nexport type CreateSubscriptionPlanInput = z.infer<typeof createSubscriptionPlanInputSchema>\n\n// ---------- Subscriptions ----------\n\nexport const subscriptionStatusSchema = z.enum([\n 'trialing',\n 'active',\n 'at_risk',\n 'paused',\n 'cancelled',\n 'lapsed',\n])\nexport type SubscriptionStatus = z.infer<typeof subscriptionStatusSchema>\n\nexport const subscriptionSchema = z.object({\n id: idSchema,\n onchainSubscriptionId: z.number().int().nonnegative().nullable(),\n merchantId: idSchema,\n customerId: idSchema,\n planId: idSchema,\n status: subscriptionStatusSchema,\n payerAddress: evmAddressSchema,\n currency: paymentCurrencySchema,\n amount: tokenAmountSchema,\n interval: subscriptionIntervalSchema,\n intervalCount: z.number().int().min(1),\n trialEndsAt: isoTimestampSchema.nullable(),\n currentPeriodStartAt: isoTimestampSchema,\n currentPeriodEndAt: isoTimestampSchema,\n nextChargeAt: isoTimestampSchema.nullable(),\n gracePeriodHours: z.number().int().min(0).max(72),\n cancelledAt: isoTimestampSchema.nullable(),\n metadata: metadataSchema,\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type Subscription = z.infer<typeof subscriptionSchema>\n\n/** Whether a wallet already subscribes to a given plan, and which one. */\nexport const subscriptionStatusResultSchema = z.object({\n active: z.boolean(),\n subscriptionId: idSchema.nullable(),\n})\nexport type SubscriptionStatusResult = z.infer<typeof subscriptionStatusResultSchema>\n\nexport const subscriptionEnrolmentTermsSchema = z.object({\n startAt: z.string().regex(/^\\d+$/),\n trialDays: z.number().int().min(0),\n trialEndsAt: isoTimestampSchema.nullable(),\n})\nexport type SubscriptionEnrolmentTerms = z.infer<typeof subscriptionEnrolmentTermsSchema>\n\nexport const createSubscriptionInputSchema = z.object({\n planId: idSchema,\n customer: z.object({\n walletAddress: evmAddressSchema,\n email: z.string().email().optional(),\n externalRef: z.string().max(120).optional(),\n }),\n gracePeriodHours: z.union([z.literal(24), z.literal(48), z.literal(72)]).default(48),\n metadata: metadataSchema.optional(),\n})\nexport type CreateSubscriptionInput = z.infer<typeof createSubscriptionInputSchema>\n\nexport const cancelSubscriptionInputSchema = z.object({\n id: idSchema,\n reason: z.string().max(500).optional(),\n})\nexport type CancelSubscriptionInput = z.infer<typeof cancelSubscriptionInputSchema>\n\n// ---------- Charges ----------\n\n// One value per contract ChargeOutcome. `skipped` is the fallback for\n// outcomes a future contract appends.\nexport const subscriptionChargeOutcomeSchema = z.enum([\n 'charged',\n 'insufficient_funds',\n 'revoked_approval',\n 'cancelled',\n 'not_due',\n 'ended',\n 'duplicate',\n 'unknown',\n 'merchant_inactive',\n 'transfer_failed',\n 'skipped',\n])\nexport type SubscriptionChargeOutcome = z.infer<typeof subscriptionChargeOutcomeSchema>\n\nexport const subscriptionChargeStatusSchema = z.enum([\n 'pending',\n 'in_flight',\n 'succeeded',\n 'failed',\n 'retrying',\n 'abandoned',\n])\nexport type SubscriptionChargeStatus = z.infer<typeof subscriptionChargeStatusSchema>\n\nexport const subscriptionChargeSchema = z.object({\n id: idSchema,\n subscriptionId: idSchema,\n merchantId: idSchema,\n chargeAttemptId: z.string().length(66, 'must be a 32-byte 0x-prefixed hex string'),\n periodStartAt: isoTimestampSchema,\n periodEndAt: isoTimestampSchema,\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n status: subscriptionChargeStatusSchema,\n outcome: subscriptionChargeOutcomeSchema.nullable(),\n attemptNumber: z.number().int().min(1),\n scheduledAt: isoTimestampSchema,\n executedAt: isoTimestampSchema.nullable(),\n onchainTxHash: evmTxHashSchema.nullable(),\n failureReason: z.string().max(500).nullable(),\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type SubscriptionCharge = z.infer<typeof subscriptionChargeSchema>\n","/**\n * Storefronts. Hosted product catalog with checkout baked in.\n */\n\nimport { z } from 'zod'\nimport {\n httpsUrlSchema,\n idSchema,\n isoTimestampSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\nimport { subscriptionIntervalSchema } from './subscriptions.js'\n\nexport const storefrontStatusSchema = z.enum(['draft', 'published', 'archived'])\nexport type StorefrontStatus = z.infer<typeof storefrontStatusSchema>\n\nexport const storefrontSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n slug: z\n .string()\n .min(3)\n .max(40)\n .regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, 'slug must be lowercase alphanumeric with hyphens'),\n name: z.string().min(2).max(120),\n description: z.string().max(2000).nullable(),\n logoUrl: httpsUrlSchema.nullable(),\n coverImageUrl: httpsUrlSchema.nullable(),\n accentColor: z\n .string()\n .regex(/^#[0-9a-fA-F]{6}$/)\n .nullable(),\n socialLinks: z.array(httpsUrlSchema).max(10).default([]),\n status: storefrontStatusSchema,\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type Storefront = z.infer<typeof storefrontSchema>\n\nexport const createStorefrontInputSchema = storefrontSchema.pick({\n slug: true,\n name: true,\n description: true,\n logoUrl: true,\n coverImageUrl: true,\n accentColor: true,\n socialLinks: true,\n})\nexport type CreateStorefrontInput = z.infer<typeof createStorefrontInputSchema>\n\n// ---------- Products ----------\n\nexport const storefrontProductTypeSchema = z.enum(['one_time', 'subscription'])\nexport type StorefrontProductType = z.infer<typeof storefrontProductTypeSchema>\n\nexport const storefrontProductSchema = z.object({\n id: idSchema,\n storefrontId: idSchema,\n name: z.string().min(1).max(120),\n description: z.string().max(2000).nullable(),\n imageUrl: httpsUrlSchema.nullable(),\n price: tokenAmountSchema,\n currency: paymentCurrencySchema,\n type: storefrontProductTypeSchema,\n interval: subscriptionIntervalSchema.nullable(),\n intervalCount: z.number().int().min(1).max(365).nullable(),\n /** null = unlimited stock. */\n stock: z.number().int().min(0).nullable(),\n planId: idSchema.nullable(),\n isActive: z.boolean(),\n sortOrder: z.number().int().nonnegative().default(0),\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type StorefrontProduct = z.infer<typeof storefrontProductSchema>\n\nexport const createStorefrontProductInputSchema = storefrontProductSchema\n .omit({\n id: true,\n storefrontId: true,\n planId: true,\n createdAt: true,\n updatedAt: true,\n })\n .extend({\n imageUrl: httpsUrlSchema.optional(),\n planId: idSchema.optional(),\n })\n .superRefine((input, ctx) => {\n if (input.type === 'subscription' && !input.planId) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['planId'],\n message: 'subscription products need a planId',\n })\n }\n if (input.type === 'one_time' && input.planId) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['planId'],\n message: 'one_time products cannot carry a planId',\n })\n }\n })\nexport type CreateStorefrontProductInput = z.infer<typeof createStorefrontProductInputSchema>\n\n/**\n * Payload for the public `/store/:slug/products/:id/checkout` endpoint.\n * Optional customer email flows through into the payment session so\n * the receipt lands in the buyer's inbox after the tx confirms.\n * `returnPath` is used to synthesise the success + cancel URLs when\n * the merchant hasn't wired their own.\n */\nexport const storefrontCheckoutInputSchema = z.object({\n customerEmail: z.string().email().optional(),\n returnPath: z.string().max(200).optional(),\n})\nexport type StorefrontCheckoutInput = z.infer<typeof storefrontCheckoutInputSchema>\n\n/** Response shape from the public product-checkout endpoint. */\nexport const storefrontCheckoutResponseSchema = z.object({\n /** Fully-qualified checkout URL — payer redirects here to sign. */\n checkoutUrl: z.string().url(),\n /** Payment-session id (one-time) or plan id (subscription). */\n ref: idSchema,\n /** Which downstream checkout the URL points at. */\n kind: z.enum(['payment_session', 'subscription_plan']),\n})\nexport type StorefrontCheckoutResponse = z.infer<typeof storefrontCheckoutResponseSchema>\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/common.ts","../src/subscriptions.ts","../src/storefronts.ts"],"names":["z"],"mappings":";;;;;AAQO,IAAM,QAAA,GAAWA,KAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAG3C,IAAM,gBAAA,GAAmBA,KAAA,CAC7B,MAAA,EAAO,CACP,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Q,SAAS,QAAA;AACnB,CAAC,CAAA,CACA,WAAA,CAAY,CAAC,KAAA,EAAO,GAAA,KAAQ;AAC3B,EAAA,IAAI,KAAA,CAAM,IAAA,KAAS,cAAA,IAAkB,CAAC,MAAM,MAAA,EAAQ;AAClD,IAAA,GAAA,CAAI,QAAA,CAAS;AAAA,MACX,IAAA,EAAMA,MAAE,YAAA,CAAa,MAAA;AAAA,MACrB,IAAA,EAAM,CAAC,QAAQ,CAAA;AAAA,MACf,OAAA,EAAS;AAAA,KACV,CAAA;AAAA,EACH;AACA,EAAA,IAAI,KAAA,CAAM,IAAA,KAAS,UAAA,IAAc,KAAA,CAAM,MAAA,EAAQ;AAC7C,IAAA,GAAA,CAAI,QAAA,CAAS;AAAA,MACX,IAAA,EAAMA,MAAE,YAAA,CAAa,MAAA;AAAA,MACrB,IAAA,EAAM,CAAC,QAAQ,CAAA;AAAA,MACf,OAAA,EAAS;AAAA,KACV,CAAA;AAAA,EACH;AACF,CAAC;AAWI,IAAM,6BAAA,GAAgCA,MAAE,MAAA,CAAO;AAAA,EACpD,eAAeA,KAAAA,CAAE,MAAA,EAAO,CAAE,KAAA,GAAQ,QAAA,EAAS;AAAA,EAC3C,YAAYA,KAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA;AAClC,CAAC;AAKM,IAAM,gCAAA,GAAmCA,MAAE,MAAA,CAAO;AAAA;AAAA,EAEvD,WAAA,EAAaA,KAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI;AAAA;AAAA,EAE5B,GAAA,EAAK,QAAA;AAAA;AAAA,EAEL,MAAMA,KAAAA,CAAE,IAAA,CAAK,CAAC,iBAAA,EAAmB,mBAAmB,CAAC;AACvD,CAAC","file":"storefronts.cjs","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.input<typeof paginationInputSchema>\nexport type PaginationParsed = z.output<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum. */\nexport const merchantTierSchema = z.enum(['free', 'growth', 'business', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * Subscriptions: plans, active subscriptions, and individual charges.\n *\n * Design notes:\n * - A SubscriptionPlan is the template a merchant defines.\n * - A Subscription is an active, customer-scoped instance of a plan.\n * - Each billing period produces a SubscriptionCharge with a unique\n * chargeAttemptId used to enforce idempotency at the contract level.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n metadataSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\n\n// ---------- Plans ----------\n\nexport const subscriptionIntervalSchema = z.enum([\n 'daily',\n 'weekly',\n 'monthly',\n 'quarterly',\n 'yearly',\n])\nexport type SubscriptionInterval = z.infer<typeof subscriptionIntervalSchema>\n\nexport const subscriptionPlanStatusSchema = z.enum(['active', 'archived'])\nexport type SubscriptionPlanStatus = z.infer<typeof subscriptionPlanStatusSchema>\n\nexport const subscriptionPlanSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n /**\n * On-chain StrimzRegistry merchant id (uint96) as a decimal string.\n * See `paymentSessionSchema.chainMerchantId`. Null when the merchant\n * hasn't been registered on-chain yet. The hosted enrolment page\n * refuses to take signatures in that state.\n */\n chainMerchantId: z\n .string()\n .regex(/^[0-9]+$/u, 'must be a non-negative decimal integer string')\n .nullable(),\n /**\n * ERC-20 token contract address resolved from `currency`. This is the\n * EIP-2612 `verifyingContract` the wallet signs over.\n */\n tokenAddress: evmAddressSchema.nullable(),\n /**\n * Charge cadence in seconds, derived from `interval` + `intervalCount`\n * so the meta-tx layer can pass a uint32 to StrimzSubscriptions\n * without re-deriving the conversion on the client.\n */\n intervalSeconds: z.number().int().positive(),\n name: z.string().min(1).max(120),\n description: z.string().max(500).nullable(),\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n interval: subscriptionIntervalSchema,\n intervalCount: z.number().int().min(1).max(365),\n trialPeriodDays: z.number().int().min(0).max(365).nullable(),\n status: subscriptionPlanStatusSchema,\n metadata: metadataSchema,\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type SubscriptionPlan = z.infer<typeof subscriptionPlanSchema>\n\nexport const createSubscriptionPlanInputSchema = z.object({\n name: z.string().min(1).max(120),\n description: z.string().max(500).optional(),\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n interval: subscriptionIntervalSchema,\n intervalCount: z.number().int().min(1).max(365).default(1),\n trialPeriodDays: z.number().int().min(0).max(365).optional(),\n metadata: metadataSchema.optional(),\n})\nexport type CreateSubscriptionPlanInput = z.input<typeof createSubscriptionPlanInputSchema>\nexport type CreateSubscriptionPlanParsed = z.output<typeof createSubscriptionPlanInputSchema>\n\n// ---------- Subscriptions ----------\n\nexport const subscriptionStatusSchema = z.enum([\n 'trialing',\n 'active',\n 'at_risk',\n 'paused',\n 'cancelled',\n 'lapsed',\n])\nexport type SubscriptionStatus = z.infer<typeof subscriptionStatusSchema>\n\nexport const subscriptionSchema = z.object({\n id: idSchema,\n onchainSubscriptionId: z.number().int().nonnegative().nullable(),\n merchantId: idSchema,\n customerId: idSchema,\n planId: idSchema,\n status: subscriptionStatusSchema,\n payerAddress: evmAddressSchema,\n currency: paymentCurrencySchema,\n amount: tokenAmountSchema,\n interval: subscriptionIntervalSchema,\n intervalCount: z.number().int().min(1),\n trialEndsAt: isoTimestampSchema.nullable(),\n currentPeriodStartAt: isoTimestampSchema,\n currentPeriodEndAt: isoTimestampSchema,\n nextChargeAt: isoTimestampSchema.nullable(),\n gracePeriodHours: z.number().int().min(0).max(72),\n cancelledAt: isoTimestampSchema.nullable(),\n metadata: metadataSchema,\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type Subscription = z.infer<typeof subscriptionSchema>\n\n/** Whether a wallet already subscribes to a given plan, and which one. */\nexport const subscriptionStatusResultSchema = z.object({\n active: z.boolean(),\n subscriptionId: idSchema.nullable(),\n})\nexport type SubscriptionStatusResult = z.infer<typeof subscriptionStatusResultSchema>\n\nexport const subscriptionEnrolmentTermsSchema = z.object({\n startAt: z.string().regex(/^\\d+$/),\n trialDays: z.number().int().min(0),\n trialEndsAt: isoTimestampSchema.nullable(),\n})\nexport type SubscriptionEnrolmentTerms = z.infer<typeof subscriptionEnrolmentTermsSchema>\n\nexport const createSubscriptionInputSchema = z.object({\n planId: idSchema,\n customer: z.object({\n walletAddress: evmAddressSchema,\n email: z.string().email().optional(),\n externalRef: z.string().max(120).optional(),\n }),\n gracePeriodHours: z.union([z.literal(24), z.literal(48), z.literal(72)]).default(48),\n metadata: metadataSchema.optional(),\n})\nexport type CreateSubscriptionInput = z.input<typeof createSubscriptionInputSchema>\nexport type CreateSubscriptionParsed = z.output<typeof createSubscriptionInputSchema>\n\nexport const cancelSubscriptionInputSchema = z.object({\n id: idSchema,\n reason: z.string().max(500).optional(),\n})\nexport type CancelSubscriptionInput = z.input<typeof cancelSubscriptionInputSchema>\nexport type CancelSubscriptionParsed = z.output<typeof cancelSubscriptionInputSchema>\n\n// ---------- Charges ----------\n\n// One value per contract ChargeOutcome. `skipped` is the fallback for\n// outcomes a future contract appends.\nexport const subscriptionChargeOutcomeSchema = z.enum([\n 'charged',\n 'insufficient_funds',\n 'revoked_approval',\n 'cancelled',\n 'not_due',\n 'ended',\n 'duplicate',\n 'unknown',\n 'merchant_inactive',\n 'transfer_failed',\n 'skipped',\n])\nexport type SubscriptionChargeOutcome = z.infer<typeof subscriptionChargeOutcomeSchema>\n\nexport const subscriptionChargeStatusSchema = z.enum([\n 'pending',\n 'in_flight',\n 'succeeded',\n 'failed',\n 'retrying',\n 'abandoned',\n])\nexport type SubscriptionChargeStatus = z.infer<typeof subscriptionChargeStatusSchema>\n\nexport const subscriptionChargeSchema = z.object({\n id: idSchema,\n subscriptionId: idSchema,\n merchantId: idSchema,\n chargeAttemptId: z.string().length(66, 'must be a 32-byte 0x-prefixed hex string'),\n periodStartAt: isoTimestampSchema,\n periodEndAt: isoTimestampSchema,\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n status: subscriptionChargeStatusSchema,\n outcome: subscriptionChargeOutcomeSchema.nullable(),\n attemptNumber: z.number().int().min(1),\n scheduledAt: isoTimestampSchema,\n executedAt: isoTimestampSchema.nullable(),\n onchainTxHash: evmTxHashSchema.nullable(),\n failureReason: z.string().max(500).nullable(),\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type SubscriptionCharge = z.infer<typeof subscriptionChargeSchema>\n","/**\n * Storefronts. Hosted product catalog with checkout baked in.\n */\n\nimport { z } from 'zod'\nimport {\n httpsUrlSchema,\n idSchema,\n isoTimestampSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\nimport { subscriptionIntervalSchema } from './subscriptions.js'\n\nexport const storefrontStatusSchema = z.enum(['draft', 'published', 'archived'])\nexport type StorefrontStatus = z.infer<typeof storefrontStatusSchema>\n\nexport const storefrontSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n slug: z\n .string()\n .min(3)\n .max(40)\n .regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, 'slug must be lowercase alphanumeric with hyphens'),\n name: z.string().min(2).max(120),\n description: z.string().max(2000).nullable(),\n logoUrl: httpsUrlSchema.nullable(),\n coverImageUrl: httpsUrlSchema.nullable(),\n accentColor: z\n .string()\n .regex(/^#[0-9a-fA-F]{6}$/)\n .nullable(),\n socialLinks: z.array(httpsUrlSchema).max(10).default([]),\n status: storefrontStatusSchema,\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type Storefront = z.infer<typeof storefrontSchema>\n\nexport const createStorefrontInputSchema = storefrontSchema.pick({\n slug: true,\n name: true,\n description: true,\n logoUrl: true,\n coverImageUrl: true,\n accentColor: true,\n socialLinks: true,\n})\nexport type CreateStorefrontInput = z.input<typeof createStorefrontInputSchema>\nexport type CreateStorefrontParsed = z.output<typeof createStorefrontInputSchema>\n\n// ---------- Products ----------\n\nexport const storefrontProductTypeSchema = z.enum(['one_time', 'subscription'])\nexport type StorefrontProductType = z.infer<typeof storefrontProductTypeSchema>\n\nexport const storefrontProductSchema = z.object({\n id: idSchema,\n storefrontId: idSchema,\n name: z.string().min(1).max(120),\n description: z.string().max(2000).nullable(),\n imageUrl: httpsUrlSchema.nullable(),\n price: tokenAmountSchema,\n currency: paymentCurrencySchema,\n type: storefrontProductTypeSchema,\n interval: subscriptionIntervalSchema.nullable(),\n intervalCount: z.number().int().min(1).max(365).nullable(),\n /** null = unlimited stock. */\n stock: z.number().int().min(0).nullable(),\n planId: idSchema.nullable(),\n isActive: z.boolean(),\n sortOrder: z.number().int().nonnegative().default(0),\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type StorefrontProduct = z.infer<typeof storefrontProductSchema>\n\nexport const createStorefrontProductInputSchema = storefrontProductSchema\n .omit({\n id: true,\n storefrontId: true,\n planId: true,\n createdAt: true,\n updatedAt: true,\n })\n .extend({\n imageUrl: httpsUrlSchema.optional(),\n planId: idSchema.optional(),\n })\n .superRefine((input, ctx) => {\n if (input.type === 'subscription' && !input.planId) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['planId'],\n message: 'subscription products need a planId',\n })\n }\n if (input.type === 'one_time' && input.planId) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['planId'],\n message: 'one_time products cannot carry a planId',\n })\n }\n })\nexport type CreateStorefrontProductInput = z.input<typeof createStorefrontProductInputSchema>\nexport type CreateStorefrontProductParsed = z.output<typeof createStorefrontProductInputSchema>\n\n/**\n * Payload for the public `/store/:slug/products/:id/checkout` endpoint.\n * Optional customer email flows through into the payment session so\n * the receipt lands in the buyer's inbox after the tx confirms.\n * `returnPath` is used to synthesise the success + cancel URLs when\n * the merchant hasn't wired their own.\n */\nexport const storefrontCheckoutInputSchema = z.object({\n customerEmail: z.string().email().optional(),\n returnPath: z.string().max(200).optional(),\n})\nexport type StorefrontCheckoutInput = z.input<typeof storefrontCheckoutInputSchema>\nexport type StorefrontCheckoutParsed = z.output<typeof storefrontCheckoutInputSchema>\n\n/** Response shape from the public product-checkout endpoint. */\nexport const storefrontCheckoutResponseSchema = z.object({\n /** Fully-qualified checkout URL — payer redirects here to sign. */\n checkoutUrl: z.string().url(),\n /** Payment-session id (one-time) or plan id (subscription). */\n ref: idSchema,\n /** Which downstream checkout the URL points at. */\n kind: z.enum(['payment_session', 'subscription_plan']),\n})\nexport type StorefrontCheckoutResponse = z.infer<typeof storefrontCheckoutResponseSchema>\n"]}
|
package/dist/storefronts.d.cts
CHANGED
|
@@ -20,26 +20,26 @@ declare const storefrontSchema: z.ZodObject<{
|
|
|
20
20
|
createdAt: z.ZodString;
|
|
21
21
|
updatedAt: z.ZodString;
|
|
22
22
|
}, "strip", z.ZodTypeAny, {
|
|
23
|
-
status: "
|
|
24
|
-
id: string;
|
|
23
|
+
status: "draft" | "archived" | "published";
|
|
25
24
|
merchantId: string;
|
|
26
|
-
createdAt: string;
|
|
27
|
-
name: string;
|
|
28
25
|
description: string | null;
|
|
26
|
+
id: string;
|
|
27
|
+
createdAt: string;
|
|
29
28
|
updatedAt: string;
|
|
29
|
+
name: string;
|
|
30
30
|
logoUrl: string | null;
|
|
31
31
|
slug: string;
|
|
32
32
|
coverImageUrl: string | null;
|
|
33
33
|
accentColor: string | null;
|
|
34
34
|
socialLinks: string[];
|
|
35
35
|
}, {
|
|
36
|
-
status: "
|
|
37
|
-
id: string;
|
|
36
|
+
status: "draft" | "archived" | "published";
|
|
38
37
|
merchantId: string;
|
|
39
|
-
createdAt: string;
|
|
40
|
-
name: string;
|
|
41
38
|
description: string | null;
|
|
39
|
+
id: string;
|
|
40
|
+
createdAt: string;
|
|
42
41
|
updatedAt: string;
|
|
42
|
+
name: string;
|
|
43
43
|
logoUrl: string | null;
|
|
44
44
|
slug: string;
|
|
45
45
|
coverImageUrl: string | null;
|
|
@@ -60,24 +60,25 @@ declare const createStorefrontInputSchema: z.ZodObject<Pick<{
|
|
|
60
60
|
status: z.ZodEnum<["draft", "published", "archived"]>;
|
|
61
61
|
createdAt: z.ZodString;
|
|
62
62
|
updatedAt: z.ZodString;
|
|
63
|
-
}, "
|
|
64
|
-
name: string;
|
|
63
|
+
}, "description" | "name" | "logoUrl" | "slug" | "coverImageUrl" | "accentColor" | "socialLinks">, "strip", z.ZodTypeAny, {
|
|
65
64
|
description: string | null;
|
|
65
|
+
name: string;
|
|
66
66
|
logoUrl: string | null;
|
|
67
67
|
slug: string;
|
|
68
68
|
coverImageUrl: string | null;
|
|
69
69
|
accentColor: string | null;
|
|
70
70
|
socialLinks: string[];
|
|
71
71
|
}, {
|
|
72
|
-
name: string;
|
|
73
72
|
description: string | null;
|
|
73
|
+
name: string;
|
|
74
74
|
logoUrl: string | null;
|
|
75
75
|
slug: string;
|
|
76
76
|
coverImageUrl: string | null;
|
|
77
77
|
accentColor: string | null;
|
|
78
78
|
socialLinks?: string[] | undefined;
|
|
79
79
|
}>;
|
|
80
|
-
type CreateStorefrontInput = z.
|
|
80
|
+
type CreateStorefrontInput = z.input<typeof createStorefrontInputSchema>;
|
|
81
|
+
type CreateStorefrontParsed = z.output<typeof createStorefrontInputSchema>;
|
|
81
82
|
declare const storefrontProductTypeSchema: z.ZodEnum<["one_time", "subscription"]>;
|
|
82
83
|
type StorefrontProductType = z.infer<typeof storefrontProductTypeSchema>;
|
|
83
84
|
declare const storefrontProductSchema: z.ZodObject<{
|
|
@@ -100,12 +101,12 @@ declare const storefrontProductSchema: z.ZodObject<{
|
|
|
100
101
|
updatedAt: z.ZodString;
|
|
101
102
|
}, "strip", z.ZodTypeAny, {
|
|
102
103
|
type: "subscription" | "one_time";
|
|
103
|
-
id: string;
|
|
104
|
-
createdAt: string;
|
|
105
|
-
name: string;
|
|
106
104
|
currency: "USDC" | "EURC";
|
|
107
105
|
description: string | null;
|
|
106
|
+
id: string;
|
|
107
|
+
createdAt: string;
|
|
108
108
|
updatedAt: string;
|
|
109
|
+
name: string;
|
|
109
110
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly" | null;
|
|
110
111
|
intervalCount: number | null;
|
|
111
112
|
planId: string | null;
|
|
@@ -117,12 +118,12 @@ declare const storefrontProductSchema: z.ZodObject<{
|
|
|
117
118
|
sortOrder: number;
|
|
118
119
|
}, {
|
|
119
120
|
type: "subscription" | "one_time";
|
|
120
|
-
id: string;
|
|
121
|
-
createdAt: string;
|
|
122
|
-
name: string;
|
|
123
121
|
currency: "USDC" | "EURC";
|
|
124
122
|
description: string | null;
|
|
123
|
+
id: string;
|
|
124
|
+
createdAt: string;
|
|
125
125
|
updatedAt: string;
|
|
126
|
+
name: string;
|
|
126
127
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly" | null;
|
|
127
128
|
intervalCount: number | null;
|
|
128
129
|
planId: string | null;
|
|
@@ -136,9 +137,9 @@ declare const storefrontProductSchema: z.ZodObject<{
|
|
|
136
137
|
type StorefrontProduct = z.infer<typeof storefrontProductSchema>;
|
|
137
138
|
declare const createStorefrontProductInputSchema: z.ZodEffects<z.ZodObject<{
|
|
138
139
|
type: z.ZodEnum<["one_time", "subscription"]>;
|
|
139
|
-
name: z.ZodString;
|
|
140
140
|
currency: z.ZodEnum<["USDC", "EURC"]>;
|
|
141
141
|
description: z.ZodNullable<z.ZodString>;
|
|
142
|
+
name: z.ZodString;
|
|
142
143
|
interval: z.ZodNullable<z.ZodEnum<["daily", "weekly", "monthly", "quarterly", "yearly"]>>;
|
|
143
144
|
intervalCount: z.ZodNullable<z.ZodNumber>;
|
|
144
145
|
price: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -150,9 +151,9 @@ declare const createStorefrontProductInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
150
151
|
planId: z.ZodOptional<z.ZodString>;
|
|
151
152
|
}, "strip", z.ZodTypeAny, {
|
|
152
153
|
type: "subscription" | "one_time";
|
|
153
|
-
name: string;
|
|
154
154
|
currency: "USDC" | "EURC";
|
|
155
155
|
description: string | null;
|
|
156
|
+
name: string;
|
|
156
157
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly" | null;
|
|
157
158
|
intervalCount: number | null;
|
|
158
159
|
price: string;
|
|
@@ -163,9 +164,9 @@ declare const createStorefrontProductInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
163
164
|
imageUrl?: string | undefined;
|
|
164
165
|
}, {
|
|
165
166
|
type: "subscription" | "one_time";
|
|
166
|
-
name: string;
|
|
167
167
|
currency: "USDC" | "EURC";
|
|
168
168
|
description: string | null;
|
|
169
|
+
name: string;
|
|
169
170
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly" | null;
|
|
170
171
|
intervalCount: number | null;
|
|
171
172
|
price: string;
|
|
@@ -176,9 +177,9 @@ declare const createStorefrontProductInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
176
177
|
sortOrder?: number | undefined;
|
|
177
178
|
}>, {
|
|
178
179
|
type: "subscription" | "one_time";
|
|
179
|
-
name: string;
|
|
180
180
|
currency: "USDC" | "EURC";
|
|
181
181
|
description: string | null;
|
|
182
|
+
name: string;
|
|
182
183
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly" | null;
|
|
183
184
|
intervalCount: number | null;
|
|
184
185
|
price: string;
|
|
@@ -189,9 +190,9 @@ declare const createStorefrontProductInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
189
190
|
imageUrl?: string | undefined;
|
|
190
191
|
}, {
|
|
191
192
|
type: "subscription" | "one_time";
|
|
192
|
-
name: string;
|
|
193
193
|
currency: "USDC" | "EURC";
|
|
194
194
|
description: string | null;
|
|
195
|
+
name: string;
|
|
195
196
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly" | null;
|
|
196
197
|
intervalCount: number | null;
|
|
197
198
|
price: string;
|
|
@@ -201,7 +202,8 @@ declare const createStorefrontProductInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
201
202
|
imageUrl?: string | undefined;
|
|
202
203
|
sortOrder?: number | undefined;
|
|
203
204
|
}>;
|
|
204
|
-
type CreateStorefrontProductInput = z.
|
|
205
|
+
type CreateStorefrontProductInput = z.input<typeof createStorefrontProductInputSchema>;
|
|
206
|
+
type CreateStorefrontProductParsed = z.output<typeof createStorefrontProductInputSchema>;
|
|
205
207
|
/**
|
|
206
208
|
* Payload for the public `/store/:slug/products/:id/checkout` endpoint.
|
|
207
209
|
* Optional customer email flows through into the payment session so
|
|
@@ -219,7 +221,8 @@ declare const storefrontCheckoutInputSchema: z.ZodObject<{
|
|
|
219
221
|
customerEmail?: string | undefined;
|
|
220
222
|
returnPath?: string | undefined;
|
|
221
223
|
}>;
|
|
222
|
-
type StorefrontCheckoutInput = z.
|
|
224
|
+
type StorefrontCheckoutInput = z.input<typeof storefrontCheckoutInputSchema>;
|
|
225
|
+
type StorefrontCheckoutParsed = z.output<typeof storefrontCheckoutInputSchema>;
|
|
223
226
|
/** Response shape from the public product-checkout endpoint. */
|
|
224
227
|
declare const storefrontCheckoutResponseSchema: z.ZodObject<{
|
|
225
228
|
/** Fully-qualified checkout URL — payer redirects here to sign. */
|
|
@@ -229,14 +232,14 @@ declare const storefrontCheckoutResponseSchema: z.ZodObject<{
|
|
|
229
232
|
/** Which downstream checkout the URL points at. */
|
|
230
233
|
kind: z.ZodEnum<["payment_session", "subscription_plan"]>;
|
|
231
234
|
}, "strip", z.ZodTypeAny, {
|
|
232
|
-
kind: "payment_session" | "subscription_plan";
|
|
233
235
|
checkoutUrl: string;
|
|
236
|
+
kind: "payment_session" | "subscription_plan";
|
|
234
237
|
ref: string;
|
|
235
238
|
}, {
|
|
236
|
-
kind: "payment_session" | "subscription_plan";
|
|
237
239
|
checkoutUrl: string;
|
|
240
|
+
kind: "payment_session" | "subscription_plan";
|
|
238
241
|
ref: string;
|
|
239
242
|
}>;
|
|
240
243
|
type StorefrontCheckoutResponse = z.infer<typeof storefrontCheckoutResponseSchema>;
|
|
241
244
|
|
|
242
|
-
export { type CreateStorefrontInput, type CreateStorefrontProductInput, type Storefront, type StorefrontCheckoutInput, type StorefrontCheckoutResponse, type StorefrontProduct, type StorefrontProductType, type StorefrontStatus, createStorefrontInputSchema, createStorefrontProductInputSchema, storefrontCheckoutInputSchema, storefrontCheckoutResponseSchema, storefrontProductSchema, storefrontProductTypeSchema, storefrontSchema, storefrontStatusSchema };
|
|
245
|
+
export { type CreateStorefrontInput, type CreateStorefrontParsed, type CreateStorefrontProductInput, type CreateStorefrontProductParsed, type Storefront, type StorefrontCheckoutInput, type StorefrontCheckoutParsed, type StorefrontCheckoutResponse, type StorefrontProduct, type StorefrontProductType, type StorefrontStatus, createStorefrontInputSchema, createStorefrontProductInputSchema, storefrontCheckoutInputSchema, storefrontCheckoutResponseSchema, storefrontProductSchema, storefrontProductTypeSchema, storefrontSchema, storefrontStatusSchema };
|
package/dist/storefronts.d.ts
CHANGED
|
@@ -20,26 +20,26 @@ declare const storefrontSchema: z.ZodObject<{
|
|
|
20
20
|
createdAt: z.ZodString;
|
|
21
21
|
updatedAt: z.ZodString;
|
|
22
22
|
}, "strip", z.ZodTypeAny, {
|
|
23
|
-
status: "
|
|
24
|
-
id: string;
|
|
23
|
+
status: "draft" | "archived" | "published";
|
|
25
24
|
merchantId: string;
|
|
26
|
-
createdAt: string;
|
|
27
|
-
name: string;
|
|
28
25
|
description: string | null;
|
|
26
|
+
id: string;
|
|
27
|
+
createdAt: string;
|
|
29
28
|
updatedAt: string;
|
|
29
|
+
name: string;
|
|
30
30
|
logoUrl: string | null;
|
|
31
31
|
slug: string;
|
|
32
32
|
coverImageUrl: string | null;
|
|
33
33
|
accentColor: string | null;
|
|
34
34
|
socialLinks: string[];
|
|
35
35
|
}, {
|
|
36
|
-
status: "
|
|
37
|
-
id: string;
|
|
36
|
+
status: "draft" | "archived" | "published";
|
|
38
37
|
merchantId: string;
|
|
39
|
-
createdAt: string;
|
|
40
|
-
name: string;
|
|
41
38
|
description: string | null;
|
|
39
|
+
id: string;
|
|
40
|
+
createdAt: string;
|
|
42
41
|
updatedAt: string;
|
|
42
|
+
name: string;
|
|
43
43
|
logoUrl: string | null;
|
|
44
44
|
slug: string;
|
|
45
45
|
coverImageUrl: string | null;
|
|
@@ -60,24 +60,25 @@ declare const createStorefrontInputSchema: z.ZodObject<Pick<{
|
|
|
60
60
|
status: z.ZodEnum<["draft", "published", "archived"]>;
|
|
61
61
|
createdAt: z.ZodString;
|
|
62
62
|
updatedAt: z.ZodString;
|
|
63
|
-
}, "
|
|
64
|
-
name: string;
|
|
63
|
+
}, "description" | "name" | "logoUrl" | "slug" | "coverImageUrl" | "accentColor" | "socialLinks">, "strip", z.ZodTypeAny, {
|
|
65
64
|
description: string | null;
|
|
65
|
+
name: string;
|
|
66
66
|
logoUrl: string | null;
|
|
67
67
|
slug: string;
|
|
68
68
|
coverImageUrl: string | null;
|
|
69
69
|
accentColor: string | null;
|
|
70
70
|
socialLinks: string[];
|
|
71
71
|
}, {
|
|
72
|
-
name: string;
|
|
73
72
|
description: string | null;
|
|
73
|
+
name: string;
|
|
74
74
|
logoUrl: string | null;
|
|
75
75
|
slug: string;
|
|
76
76
|
coverImageUrl: string | null;
|
|
77
77
|
accentColor: string | null;
|
|
78
78
|
socialLinks?: string[] | undefined;
|
|
79
79
|
}>;
|
|
80
|
-
type CreateStorefrontInput = z.
|
|
80
|
+
type CreateStorefrontInput = z.input<typeof createStorefrontInputSchema>;
|
|
81
|
+
type CreateStorefrontParsed = z.output<typeof createStorefrontInputSchema>;
|
|
81
82
|
declare const storefrontProductTypeSchema: z.ZodEnum<["one_time", "subscription"]>;
|
|
82
83
|
type StorefrontProductType = z.infer<typeof storefrontProductTypeSchema>;
|
|
83
84
|
declare const storefrontProductSchema: z.ZodObject<{
|
|
@@ -100,12 +101,12 @@ declare const storefrontProductSchema: z.ZodObject<{
|
|
|
100
101
|
updatedAt: z.ZodString;
|
|
101
102
|
}, "strip", z.ZodTypeAny, {
|
|
102
103
|
type: "subscription" | "one_time";
|
|
103
|
-
id: string;
|
|
104
|
-
createdAt: string;
|
|
105
|
-
name: string;
|
|
106
104
|
currency: "USDC" | "EURC";
|
|
107
105
|
description: string | null;
|
|
106
|
+
id: string;
|
|
107
|
+
createdAt: string;
|
|
108
108
|
updatedAt: string;
|
|
109
|
+
name: string;
|
|
109
110
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly" | null;
|
|
110
111
|
intervalCount: number | null;
|
|
111
112
|
planId: string | null;
|
|
@@ -117,12 +118,12 @@ declare const storefrontProductSchema: z.ZodObject<{
|
|
|
117
118
|
sortOrder: number;
|
|
118
119
|
}, {
|
|
119
120
|
type: "subscription" | "one_time";
|
|
120
|
-
id: string;
|
|
121
|
-
createdAt: string;
|
|
122
|
-
name: string;
|
|
123
121
|
currency: "USDC" | "EURC";
|
|
124
122
|
description: string | null;
|
|
123
|
+
id: string;
|
|
124
|
+
createdAt: string;
|
|
125
125
|
updatedAt: string;
|
|
126
|
+
name: string;
|
|
126
127
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly" | null;
|
|
127
128
|
intervalCount: number | null;
|
|
128
129
|
planId: string | null;
|
|
@@ -136,9 +137,9 @@ declare const storefrontProductSchema: z.ZodObject<{
|
|
|
136
137
|
type StorefrontProduct = z.infer<typeof storefrontProductSchema>;
|
|
137
138
|
declare const createStorefrontProductInputSchema: z.ZodEffects<z.ZodObject<{
|
|
138
139
|
type: z.ZodEnum<["one_time", "subscription"]>;
|
|
139
|
-
name: z.ZodString;
|
|
140
140
|
currency: z.ZodEnum<["USDC", "EURC"]>;
|
|
141
141
|
description: z.ZodNullable<z.ZodString>;
|
|
142
|
+
name: z.ZodString;
|
|
142
143
|
interval: z.ZodNullable<z.ZodEnum<["daily", "weekly", "monthly", "quarterly", "yearly"]>>;
|
|
143
144
|
intervalCount: z.ZodNullable<z.ZodNumber>;
|
|
144
145
|
price: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -150,9 +151,9 @@ declare const createStorefrontProductInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
150
151
|
planId: z.ZodOptional<z.ZodString>;
|
|
151
152
|
}, "strip", z.ZodTypeAny, {
|
|
152
153
|
type: "subscription" | "one_time";
|
|
153
|
-
name: string;
|
|
154
154
|
currency: "USDC" | "EURC";
|
|
155
155
|
description: string | null;
|
|
156
|
+
name: string;
|
|
156
157
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly" | null;
|
|
157
158
|
intervalCount: number | null;
|
|
158
159
|
price: string;
|
|
@@ -163,9 +164,9 @@ declare const createStorefrontProductInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
163
164
|
imageUrl?: string | undefined;
|
|
164
165
|
}, {
|
|
165
166
|
type: "subscription" | "one_time";
|
|
166
|
-
name: string;
|
|
167
167
|
currency: "USDC" | "EURC";
|
|
168
168
|
description: string | null;
|
|
169
|
+
name: string;
|
|
169
170
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly" | null;
|
|
170
171
|
intervalCount: number | null;
|
|
171
172
|
price: string;
|
|
@@ -176,9 +177,9 @@ declare const createStorefrontProductInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
176
177
|
sortOrder?: number | undefined;
|
|
177
178
|
}>, {
|
|
178
179
|
type: "subscription" | "one_time";
|
|
179
|
-
name: string;
|
|
180
180
|
currency: "USDC" | "EURC";
|
|
181
181
|
description: string | null;
|
|
182
|
+
name: string;
|
|
182
183
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly" | null;
|
|
183
184
|
intervalCount: number | null;
|
|
184
185
|
price: string;
|
|
@@ -189,9 +190,9 @@ declare const createStorefrontProductInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
189
190
|
imageUrl?: string | undefined;
|
|
190
191
|
}, {
|
|
191
192
|
type: "subscription" | "one_time";
|
|
192
|
-
name: string;
|
|
193
193
|
currency: "USDC" | "EURC";
|
|
194
194
|
description: string | null;
|
|
195
|
+
name: string;
|
|
195
196
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly" | null;
|
|
196
197
|
intervalCount: number | null;
|
|
197
198
|
price: string;
|
|
@@ -201,7 +202,8 @@ declare const createStorefrontProductInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
201
202
|
imageUrl?: string | undefined;
|
|
202
203
|
sortOrder?: number | undefined;
|
|
203
204
|
}>;
|
|
204
|
-
type CreateStorefrontProductInput = z.
|
|
205
|
+
type CreateStorefrontProductInput = z.input<typeof createStorefrontProductInputSchema>;
|
|
206
|
+
type CreateStorefrontProductParsed = z.output<typeof createStorefrontProductInputSchema>;
|
|
205
207
|
/**
|
|
206
208
|
* Payload for the public `/store/:slug/products/:id/checkout` endpoint.
|
|
207
209
|
* Optional customer email flows through into the payment session so
|
|
@@ -219,7 +221,8 @@ declare const storefrontCheckoutInputSchema: z.ZodObject<{
|
|
|
219
221
|
customerEmail?: string | undefined;
|
|
220
222
|
returnPath?: string | undefined;
|
|
221
223
|
}>;
|
|
222
|
-
type StorefrontCheckoutInput = z.
|
|
224
|
+
type StorefrontCheckoutInput = z.input<typeof storefrontCheckoutInputSchema>;
|
|
225
|
+
type StorefrontCheckoutParsed = z.output<typeof storefrontCheckoutInputSchema>;
|
|
223
226
|
/** Response shape from the public product-checkout endpoint. */
|
|
224
227
|
declare const storefrontCheckoutResponseSchema: z.ZodObject<{
|
|
225
228
|
/** Fully-qualified checkout URL — payer redirects here to sign. */
|
|
@@ -229,14 +232,14 @@ declare const storefrontCheckoutResponseSchema: z.ZodObject<{
|
|
|
229
232
|
/** Which downstream checkout the URL points at. */
|
|
230
233
|
kind: z.ZodEnum<["payment_session", "subscription_plan"]>;
|
|
231
234
|
}, "strip", z.ZodTypeAny, {
|
|
232
|
-
kind: "payment_session" | "subscription_plan";
|
|
233
235
|
checkoutUrl: string;
|
|
236
|
+
kind: "payment_session" | "subscription_plan";
|
|
234
237
|
ref: string;
|
|
235
238
|
}, {
|
|
236
|
-
kind: "payment_session" | "subscription_plan";
|
|
237
239
|
checkoutUrl: string;
|
|
240
|
+
kind: "payment_session" | "subscription_plan";
|
|
238
241
|
ref: string;
|
|
239
242
|
}>;
|
|
240
243
|
type StorefrontCheckoutResponse = z.infer<typeof storefrontCheckoutResponseSchema>;
|
|
241
244
|
|
|
242
|
-
export { type CreateStorefrontInput, type CreateStorefrontProductInput, type Storefront, type StorefrontCheckoutInput, type StorefrontCheckoutResponse, type StorefrontProduct, type StorefrontProductType, type StorefrontStatus, createStorefrontInputSchema, createStorefrontProductInputSchema, storefrontCheckoutInputSchema, storefrontCheckoutResponseSchema, storefrontProductSchema, storefrontProductTypeSchema, storefrontSchema, storefrontStatusSchema };
|
|
245
|
+
export { type CreateStorefrontInput, type CreateStorefrontParsed, type CreateStorefrontProductInput, type CreateStorefrontProductParsed, type Storefront, type StorefrontCheckoutInput, type StorefrontCheckoutParsed, type StorefrontCheckoutResponse, type StorefrontProduct, type StorefrontProductType, type StorefrontStatus, createStorefrontInputSchema, createStorefrontProductInputSchema, storefrontCheckoutInputSchema, storefrontCheckoutResponseSchema, storefrontProductSchema, storefrontProductTypeSchema, storefrontSchema, storefrontStatusSchema };
|
package/dist/storefronts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common.ts","../src/subscriptions.ts","../src/storefronts.ts"],"names":["z"],"mappings":";;;AAQO,IAAM,QAAA,GAAW,CAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAG3C,IAAM,gBAAA,GAAmB,CAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkB,CAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlE,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAGnE,IAAM,cAAA,GAAiB,CAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC,CAAA;AAG0B,CAAA,CAAE,MAAA,EAAO,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,CAAA;AAAA,MACf,OAAA,EAAS;AAAA,KACV,CAAA;AAAA,EACH;AACF,CAAC;AAUI,IAAM,6BAAA,GAAgCA,EAAE,MAAA,CAAO;AAAA,EACpD,eAAeA,CAAAA,CAAE,MAAA,EAAO,CAAE,KAAA,GAAQ,QAAA,EAAS;AAAA,EAC3C,YAAYA,CAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA;AAClC,CAAC;AAIM,IAAM,gCAAA,GAAmCA,EAAE,MAAA,CAAO;AAAA;AAAA,EAEvD,WAAA,EAAaA,CAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI;AAAA;AAAA,EAE5B,GAAA,EAAK,QAAA;AAAA;AAAA,EAEL,MAAMA,CAAAA,CAAE,IAAA,CAAK,CAAC,iBAAA,EAAmB,mBAAmB,CAAC;AACvD,CAAC","file":"storefronts.js","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.infer<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum. */\nexport const merchantTierSchema = z.enum(['free', 'growth', 'business', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * Subscriptions: plans, active subscriptions, and individual charges.\n *\n * Design notes:\n * - A SubscriptionPlan is the template a merchant defines.\n * - A Subscription is an active, customer-scoped instance of a plan.\n * - Each billing period produces a SubscriptionCharge with a unique\n * chargeAttemptId used to enforce idempotency at the contract level.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n metadataSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\n\n// ---------- Plans ----------\n\nexport const subscriptionIntervalSchema = z.enum([\n 'daily',\n 'weekly',\n 'monthly',\n 'quarterly',\n 'yearly',\n])\nexport type SubscriptionInterval = z.infer<typeof subscriptionIntervalSchema>\n\nexport const subscriptionPlanStatusSchema = z.enum(['active', 'archived'])\nexport type SubscriptionPlanStatus = z.infer<typeof subscriptionPlanStatusSchema>\n\nexport const subscriptionPlanSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n /**\n * On-chain StrimzRegistry merchant id (uint96) as a decimal string.\n * See `paymentSessionSchema.chainMerchantId`. Null when the merchant\n * hasn't been registered on-chain yet. The hosted enrolment page\n * refuses to take signatures in that state.\n */\n chainMerchantId: z\n .string()\n .regex(/^[0-9]+$/u, 'must be a non-negative decimal integer string')\n .nullable(),\n /**\n * ERC-20 token contract address resolved from `currency`. This is the\n * EIP-2612 `verifyingContract` the wallet signs over.\n */\n tokenAddress: evmAddressSchema.nullable(),\n /**\n * Charge cadence in seconds, derived from `interval` + `intervalCount`\n * so the meta-tx layer can pass a uint32 to StrimzSubscriptions\n * without re-deriving the conversion on the client.\n */\n intervalSeconds: z.number().int().positive(),\n name: z.string().min(1).max(120),\n description: z.string().max(500).nullable(),\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n interval: subscriptionIntervalSchema,\n intervalCount: z.number().int().min(1).max(365),\n trialPeriodDays: z.number().int().min(0).max(365).nullable(),\n status: subscriptionPlanStatusSchema,\n metadata: metadataSchema,\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type SubscriptionPlan = z.infer<typeof subscriptionPlanSchema>\n\nexport const createSubscriptionPlanInputSchema = z.object({\n name: z.string().min(1).max(120),\n description: z.string().max(500).optional(),\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n interval: subscriptionIntervalSchema,\n intervalCount: z.number().int().min(1).max(365).default(1),\n trialPeriodDays: z.number().int().min(0).max(365).optional(),\n metadata: metadataSchema.optional(),\n})\nexport type CreateSubscriptionPlanInput = z.infer<typeof createSubscriptionPlanInputSchema>\n\n// ---------- Subscriptions ----------\n\nexport const subscriptionStatusSchema = z.enum([\n 'trialing',\n 'active',\n 'at_risk',\n 'paused',\n 'cancelled',\n 'lapsed',\n])\nexport type SubscriptionStatus = z.infer<typeof subscriptionStatusSchema>\n\nexport const subscriptionSchema = z.object({\n id: idSchema,\n onchainSubscriptionId: z.number().int().nonnegative().nullable(),\n merchantId: idSchema,\n customerId: idSchema,\n planId: idSchema,\n status: subscriptionStatusSchema,\n payerAddress: evmAddressSchema,\n currency: paymentCurrencySchema,\n amount: tokenAmountSchema,\n interval: subscriptionIntervalSchema,\n intervalCount: z.number().int().min(1),\n trialEndsAt: isoTimestampSchema.nullable(),\n currentPeriodStartAt: isoTimestampSchema,\n currentPeriodEndAt: isoTimestampSchema,\n nextChargeAt: isoTimestampSchema.nullable(),\n gracePeriodHours: z.number().int().min(0).max(72),\n cancelledAt: isoTimestampSchema.nullable(),\n metadata: metadataSchema,\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type Subscription = z.infer<typeof subscriptionSchema>\n\n/** Whether a wallet already subscribes to a given plan, and which one. */\nexport const subscriptionStatusResultSchema = z.object({\n active: z.boolean(),\n subscriptionId: idSchema.nullable(),\n})\nexport type SubscriptionStatusResult = z.infer<typeof subscriptionStatusResultSchema>\n\nexport const subscriptionEnrolmentTermsSchema = z.object({\n startAt: z.string().regex(/^\\d+$/),\n trialDays: z.number().int().min(0),\n trialEndsAt: isoTimestampSchema.nullable(),\n})\nexport type SubscriptionEnrolmentTerms = z.infer<typeof subscriptionEnrolmentTermsSchema>\n\nexport const createSubscriptionInputSchema = z.object({\n planId: idSchema,\n customer: z.object({\n walletAddress: evmAddressSchema,\n email: z.string().email().optional(),\n externalRef: z.string().max(120).optional(),\n }),\n gracePeriodHours: z.union([z.literal(24), z.literal(48), z.literal(72)]).default(48),\n metadata: metadataSchema.optional(),\n})\nexport type CreateSubscriptionInput = z.infer<typeof createSubscriptionInputSchema>\n\nexport const cancelSubscriptionInputSchema = z.object({\n id: idSchema,\n reason: z.string().max(500).optional(),\n})\nexport type CancelSubscriptionInput = z.infer<typeof cancelSubscriptionInputSchema>\n\n// ---------- Charges ----------\n\n// One value per contract ChargeOutcome. `skipped` is the fallback for\n// outcomes a future contract appends.\nexport const subscriptionChargeOutcomeSchema = z.enum([\n 'charged',\n 'insufficient_funds',\n 'revoked_approval',\n 'cancelled',\n 'not_due',\n 'ended',\n 'duplicate',\n 'unknown',\n 'merchant_inactive',\n 'transfer_failed',\n 'skipped',\n])\nexport type SubscriptionChargeOutcome = z.infer<typeof subscriptionChargeOutcomeSchema>\n\nexport const subscriptionChargeStatusSchema = z.enum([\n 'pending',\n 'in_flight',\n 'succeeded',\n 'failed',\n 'retrying',\n 'abandoned',\n])\nexport type SubscriptionChargeStatus = z.infer<typeof subscriptionChargeStatusSchema>\n\nexport const subscriptionChargeSchema = z.object({\n id: idSchema,\n subscriptionId: idSchema,\n merchantId: idSchema,\n chargeAttemptId: z.string().length(66, 'must be a 32-byte 0x-prefixed hex string'),\n periodStartAt: isoTimestampSchema,\n periodEndAt: isoTimestampSchema,\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n status: subscriptionChargeStatusSchema,\n outcome: subscriptionChargeOutcomeSchema.nullable(),\n attemptNumber: z.number().int().min(1),\n scheduledAt: isoTimestampSchema,\n executedAt: isoTimestampSchema.nullable(),\n onchainTxHash: evmTxHashSchema.nullable(),\n failureReason: z.string().max(500).nullable(),\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type SubscriptionCharge = z.infer<typeof subscriptionChargeSchema>\n","/**\n * Storefronts. Hosted product catalog with checkout baked in.\n */\n\nimport { z } from 'zod'\nimport {\n httpsUrlSchema,\n idSchema,\n isoTimestampSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\nimport { subscriptionIntervalSchema } from './subscriptions.js'\n\nexport const storefrontStatusSchema = z.enum(['draft', 'published', 'archived'])\nexport type StorefrontStatus = z.infer<typeof storefrontStatusSchema>\n\nexport const storefrontSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n slug: z\n .string()\n .min(3)\n .max(40)\n .regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, 'slug must be lowercase alphanumeric with hyphens'),\n name: z.string().min(2).max(120),\n description: z.string().max(2000).nullable(),\n logoUrl: httpsUrlSchema.nullable(),\n coverImageUrl: httpsUrlSchema.nullable(),\n accentColor: z\n .string()\n .regex(/^#[0-9a-fA-F]{6}$/)\n .nullable(),\n socialLinks: z.array(httpsUrlSchema).max(10).default([]),\n status: storefrontStatusSchema,\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type Storefront = z.infer<typeof storefrontSchema>\n\nexport const createStorefrontInputSchema = storefrontSchema.pick({\n slug: true,\n name: true,\n description: true,\n logoUrl: true,\n coverImageUrl: true,\n accentColor: true,\n socialLinks: true,\n})\nexport type CreateStorefrontInput = z.infer<typeof createStorefrontInputSchema>\n\n// ---------- Products ----------\n\nexport const storefrontProductTypeSchema = z.enum(['one_time', 'subscription'])\nexport type StorefrontProductType = z.infer<typeof storefrontProductTypeSchema>\n\nexport const storefrontProductSchema = z.object({\n id: idSchema,\n storefrontId: idSchema,\n name: z.string().min(1).max(120),\n description: z.string().max(2000).nullable(),\n imageUrl: httpsUrlSchema.nullable(),\n price: tokenAmountSchema,\n currency: paymentCurrencySchema,\n type: storefrontProductTypeSchema,\n interval: subscriptionIntervalSchema.nullable(),\n intervalCount: z.number().int().min(1).max(365).nullable(),\n /** null = unlimited stock. */\n stock: z.number().int().min(0).nullable(),\n planId: idSchema.nullable(),\n isActive: z.boolean(),\n sortOrder: z.number().int().nonnegative().default(0),\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type StorefrontProduct = z.infer<typeof storefrontProductSchema>\n\nexport const createStorefrontProductInputSchema = storefrontProductSchema\n .omit({\n id: true,\n storefrontId: true,\n planId: true,\n createdAt: true,\n updatedAt: true,\n })\n .extend({\n imageUrl: httpsUrlSchema.optional(),\n planId: idSchema.optional(),\n })\n .superRefine((input, ctx) => {\n if (input.type === 'subscription' && !input.planId) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['planId'],\n message: 'subscription products need a planId',\n })\n }\n if (input.type === 'one_time' && input.planId) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['planId'],\n message: 'one_time products cannot carry a planId',\n })\n }\n })\nexport type CreateStorefrontProductInput = z.infer<typeof createStorefrontProductInputSchema>\n\n/**\n * Payload for the public `/store/:slug/products/:id/checkout` endpoint.\n * Optional customer email flows through into the payment session so\n * the receipt lands in the buyer's inbox after the tx confirms.\n * `returnPath` is used to synthesise the success + cancel URLs when\n * the merchant hasn't wired their own.\n */\nexport const storefrontCheckoutInputSchema = z.object({\n customerEmail: z.string().email().optional(),\n returnPath: z.string().max(200).optional(),\n})\nexport type StorefrontCheckoutInput = z.infer<typeof storefrontCheckoutInputSchema>\n\n/** Response shape from the public product-checkout endpoint. */\nexport const storefrontCheckoutResponseSchema = z.object({\n /** Fully-qualified checkout URL — payer redirects here to sign. */\n checkoutUrl: z.string().url(),\n /** Payment-session id (one-time) or plan id (subscription). */\n ref: idSchema,\n /** Which downstream checkout the URL points at. */\n kind: z.enum(['payment_session', 'subscription_plan']),\n})\nexport type StorefrontCheckoutResponse = z.infer<typeof storefrontCheckoutResponseSchema>\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/common.ts","../src/subscriptions.ts","../src/storefronts.ts"],"names":["z"],"mappings":";;;AAQO,IAAM,QAAA,GAAW,CAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAG3C,IAAM,gBAAA,GAAmB,CAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkB,CAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlE,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAGnE,IAAM,cAAA,GAAiB,CAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC,CAAA;AAG0B,CAAA,CAAE,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CAAC,QAAQ,CAAA;AAAA,MACf,OAAA,EAAS;AAAA,KACV,CAAA;AAAA,EACH;AACF,CAAC;AAWI,IAAM,6BAAA,GAAgCA,EAAE,MAAA,CAAO;AAAA,EACpD,eAAeA,CAAAA,CAAE,MAAA,EAAO,CAAE,KAAA,GAAQ,QAAA,EAAS;AAAA,EAC3C,YAAYA,CAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA;AAClC,CAAC;AAKM,IAAM,gCAAA,GAAmCA,EAAE,MAAA,CAAO;AAAA;AAAA,EAEvD,WAAA,EAAaA,CAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI;AAAA;AAAA,EAE5B,GAAA,EAAK,QAAA;AAAA;AAAA,EAEL,MAAMA,CAAAA,CAAE,IAAA,CAAK,CAAC,iBAAA,EAAmB,mBAAmB,CAAC;AACvD,CAAC","file":"storefronts.js","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.input<typeof paginationInputSchema>\nexport type PaginationParsed = z.output<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum. */\nexport const merchantTierSchema = z.enum(['free', 'growth', 'business', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * Subscriptions: plans, active subscriptions, and individual charges.\n *\n * Design notes:\n * - A SubscriptionPlan is the template a merchant defines.\n * - A Subscription is an active, customer-scoped instance of a plan.\n * - Each billing period produces a SubscriptionCharge with a unique\n * chargeAttemptId used to enforce idempotency at the contract level.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n metadataSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\n\n// ---------- Plans ----------\n\nexport const subscriptionIntervalSchema = z.enum([\n 'daily',\n 'weekly',\n 'monthly',\n 'quarterly',\n 'yearly',\n])\nexport type SubscriptionInterval = z.infer<typeof subscriptionIntervalSchema>\n\nexport const subscriptionPlanStatusSchema = z.enum(['active', 'archived'])\nexport type SubscriptionPlanStatus = z.infer<typeof subscriptionPlanStatusSchema>\n\nexport const subscriptionPlanSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n /**\n * On-chain StrimzRegistry merchant id (uint96) as a decimal string.\n * See `paymentSessionSchema.chainMerchantId`. Null when the merchant\n * hasn't been registered on-chain yet. The hosted enrolment page\n * refuses to take signatures in that state.\n */\n chainMerchantId: z\n .string()\n .regex(/^[0-9]+$/u, 'must be a non-negative decimal integer string')\n .nullable(),\n /**\n * ERC-20 token contract address resolved from `currency`. This is the\n * EIP-2612 `verifyingContract` the wallet signs over.\n */\n tokenAddress: evmAddressSchema.nullable(),\n /**\n * Charge cadence in seconds, derived from `interval` + `intervalCount`\n * so the meta-tx layer can pass a uint32 to StrimzSubscriptions\n * without re-deriving the conversion on the client.\n */\n intervalSeconds: z.number().int().positive(),\n name: z.string().min(1).max(120),\n description: z.string().max(500).nullable(),\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n interval: subscriptionIntervalSchema,\n intervalCount: z.number().int().min(1).max(365),\n trialPeriodDays: z.number().int().min(0).max(365).nullable(),\n status: subscriptionPlanStatusSchema,\n metadata: metadataSchema,\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type SubscriptionPlan = z.infer<typeof subscriptionPlanSchema>\n\nexport const createSubscriptionPlanInputSchema = z.object({\n name: z.string().min(1).max(120),\n description: z.string().max(500).optional(),\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n interval: subscriptionIntervalSchema,\n intervalCount: z.number().int().min(1).max(365).default(1),\n trialPeriodDays: z.number().int().min(0).max(365).optional(),\n metadata: metadataSchema.optional(),\n})\nexport type CreateSubscriptionPlanInput = z.input<typeof createSubscriptionPlanInputSchema>\nexport type CreateSubscriptionPlanParsed = z.output<typeof createSubscriptionPlanInputSchema>\n\n// ---------- Subscriptions ----------\n\nexport const subscriptionStatusSchema = z.enum([\n 'trialing',\n 'active',\n 'at_risk',\n 'paused',\n 'cancelled',\n 'lapsed',\n])\nexport type SubscriptionStatus = z.infer<typeof subscriptionStatusSchema>\n\nexport const subscriptionSchema = z.object({\n id: idSchema,\n onchainSubscriptionId: z.number().int().nonnegative().nullable(),\n merchantId: idSchema,\n customerId: idSchema,\n planId: idSchema,\n status: subscriptionStatusSchema,\n payerAddress: evmAddressSchema,\n currency: paymentCurrencySchema,\n amount: tokenAmountSchema,\n interval: subscriptionIntervalSchema,\n intervalCount: z.number().int().min(1),\n trialEndsAt: isoTimestampSchema.nullable(),\n currentPeriodStartAt: isoTimestampSchema,\n currentPeriodEndAt: isoTimestampSchema,\n nextChargeAt: isoTimestampSchema.nullable(),\n gracePeriodHours: z.number().int().min(0).max(72),\n cancelledAt: isoTimestampSchema.nullable(),\n metadata: metadataSchema,\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type Subscription = z.infer<typeof subscriptionSchema>\n\n/** Whether a wallet already subscribes to a given plan, and which one. */\nexport const subscriptionStatusResultSchema = z.object({\n active: z.boolean(),\n subscriptionId: idSchema.nullable(),\n})\nexport type SubscriptionStatusResult = z.infer<typeof subscriptionStatusResultSchema>\n\nexport const subscriptionEnrolmentTermsSchema = z.object({\n startAt: z.string().regex(/^\\d+$/),\n trialDays: z.number().int().min(0),\n trialEndsAt: isoTimestampSchema.nullable(),\n})\nexport type SubscriptionEnrolmentTerms = z.infer<typeof subscriptionEnrolmentTermsSchema>\n\nexport const createSubscriptionInputSchema = z.object({\n planId: idSchema,\n customer: z.object({\n walletAddress: evmAddressSchema,\n email: z.string().email().optional(),\n externalRef: z.string().max(120).optional(),\n }),\n gracePeriodHours: z.union([z.literal(24), z.literal(48), z.literal(72)]).default(48),\n metadata: metadataSchema.optional(),\n})\nexport type CreateSubscriptionInput = z.input<typeof createSubscriptionInputSchema>\nexport type CreateSubscriptionParsed = z.output<typeof createSubscriptionInputSchema>\n\nexport const cancelSubscriptionInputSchema = z.object({\n id: idSchema,\n reason: z.string().max(500).optional(),\n})\nexport type CancelSubscriptionInput = z.input<typeof cancelSubscriptionInputSchema>\nexport type CancelSubscriptionParsed = z.output<typeof cancelSubscriptionInputSchema>\n\n// ---------- Charges ----------\n\n// One value per contract ChargeOutcome. `skipped` is the fallback for\n// outcomes a future contract appends.\nexport const subscriptionChargeOutcomeSchema = z.enum([\n 'charged',\n 'insufficient_funds',\n 'revoked_approval',\n 'cancelled',\n 'not_due',\n 'ended',\n 'duplicate',\n 'unknown',\n 'merchant_inactive',\n 'transfer_failed',\n 'skipped',\n])\nexport type SubscriptionChargeOutcome = z.infer<typeof subscriptionChargeOutcomeSchema>\n\nexport const subscriptionChargeStatusSchema = z.enum([\n 'pending',\n 'in_flight',\n 'succeeded',\n 'failed',\n 'retrying',\n 'abandoned',\n])\nexport type SubscriptionChargeStatus = z.infer<typeof subscriptionChargeStatusSchema>\n\nexport const subscriptionChargeSchema = z.object({\n id: idSchema,\n subscriptionId: idSchema,\n merchantId: idSchema,\n chargeAttemptId: z.string().length(66, 'must be a 32-byte 0x-prefixed hex string'),\n periodStartAt: isoTimestampSchema,\n periodEndAt: isoTimestampSchema,\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n status: subscriptionChargeStatusSchema,\n outcome: subscriptionChargeOutcomeSchema.nullable(),\n attemptNumber: z.number().int().min(1),\n scheduledAt: isoTimestampSchema,\n executedAt: isoTimestampSchema.nullable(),\n onchainTxHash: evmTxHashSchema.nullable(),\n failureReason: z.string().max(500).nullable(),\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type SubscriptionCharge = z.infer<typeof subscriptionChargeSchema>\n","/**\n * Storefronts. Hosted product catalog with checkout baked in.\n */\n\nimport { z } from 'zod'\nimport {\n httpsUrlSchema,\n idSchema,\n isoTimestampSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\nimport { subscriptionIntervalSchema } from './subscriptions.js'\n\nexport const storefrontStatusSchema = z.enum(['draft', 'published', 'archived'])\nexport type StorefrontStatus = z.infer<typeof storefrontStatusSchema>\n\nexport const storefrontSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n slug: z\n .string()\n .min(3)\n .max(40)\n .regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, 'slug must be lowercase alphanumeric with hyphens'),\n name: z.string().min(2).max(120),\n description: z.string().max(2000).nullable(),\n logoUrl: httpsUrlSchema.nullable(),\n coverImageUrl: httpsUrlSchema.nullable(),\n accentColor: z\n .string()\n .regex(/^#[0-9a-fA-F]{6}$/)\n .nullable(),\n socialLinks: z.array(httpsUrlSchema).max(10).default([]),\n status: storefrontStatusSchema,\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type Storefront = z.infer<typeof storefrontSchema>\n\nexport const createStorefrontInputSchema = storefrontSchema.pick({\n slug: true,\n name: true,\n description: true,\n logoUrl: true,\n coverImageUrl: true,\n accentColor: true,\n socialLinks: true,\n})\nexport type CreateStorefrontInput = z.input<typeof createStorefrontInputSchema>\nexport type CreateStorefrontParsed = z.output<typeof createStorefrontInputSchema>\n\n// ---------- Products ----------\n\nexport const storefrontProductTypeSchema = z.enum(['one_time', 'subscription'])\nexport type StorefrontProductType = z.infer<typeof storefrontProductTypeSchema>\n\nexport const storefrontProductSchema = z.object({\n id: idSchema,\n storefrontId: idSchema,\n name: z.string().min(1).max(120),\n description: z.string().max(2000).nullable(),\n imageUrl: httpsUrlSchema.nullable(),\n price: tokenAmountSchema,\n currency: paymentCurrencySchema,\n type: storefrontProductTypeSchema,\n interval: subscriptionIntervalSchema.nullable(),\n intervalCount: z.number().int().min(1).max(365).nullable(),\n /** null = unlimited stock. */\n stock: z.number().int().min(0).nullable(),\n planId: idSchema.nullable(),\n isActive: z.boolean(),\n sortOrder: z.number().int().nonnegative().default(0),\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type StorefrontProduct = z.infer<typeof storefrontProductSchema>\n\nexport const createStorefrontProductInputSchema = storefrontProductSchema\n .omit({\n id: true,\n storefrontId: true,\n planId: true,\n createdAt: true,\n updatedAt: true,\n })\n .extend({\n imageUrl: httpsUrlSchema.optional(),\n planId: idSchema.optional(),\n })\n .superRefine((input, ctx) => {\n if (input.type === 'subscription' && !input.planId) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['planId'],\n message: 'subscription products need a planId',\n })\n }\n if (input.type === 'one_time' && input.planId) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['planId'],\n message: 'one_time products cannot carry a planId',\n })\n }\n })\nexport type CreateStorefrontProductInput = z.input<typeof createStorefrontProductInputSchema>\nexport type CreateStorefrontProductParsed = z.output<typeof createStorefrontProductInputSchema>\n\n/**\n * Payload for the public `/store/:slug/products/:id/checkout` endpoint.\n * Optional customer email flows through into the payment session so\n * the receipt lands in the buyer's inbox after the tx confirms.\n * `returnPath` is used to synthesise the success + cancel URLs when\n * the merchant hasn't wired their own.\n */\nexport const storefrontCheckoutInputSchema = z.object({\n customerEmail: z.string().email().optional(),\n returnPath: z.string().max(200).optional(),\n})\nexport type StorefrontCheckoutInput = z.input<typeof storefrontCheckoutInputSchema>\nexport type StorefrontCheckoutParsed = z.output<typeof storefrontCheckoutInputSchema>\n\n/** Response shape from the public product-checkout endpoint. */\nexport const storefrontCheckoutResponseSchema = z.object({\n /** Fully-qualified checkout URL — payer redirects here to sign. */\n checkoutUrl: z.string().url(),\n /** Payment-session id (one-time) or plan id (subscription). */\n ref: idSchema,\n /** Which downstream checkout the URL points at. */\n kind: z.enum(['payment_session', 'subscription_plan']),\n})\nexport type StorefrontCheckoutResponse = z.infer<typeof storefrontCheckoutResponseSchema>\n"]}
|