@strimz/shared-types 0.6.0 → 0.7.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/api-keys.cjs.map +1 -1
- package/dist/api-keys.d.cts +11 -9
- package/dist/api-keys.d.ts +11 -9
- 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 +4 -4
- package/dist/compliance.d.ts +4 -4
- package/dist/compliance.js.map +1 -1
- package/dist/customers.cjs.map +1 -1
- package/dist/customers.d.cts +5 -4
- package/dist/customers.d.ts +5 -4
- package/dist/customers.js.map +1 -1
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +276 -276
- package/dist/events.d.ts +276 -276
- package/dist/events.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -20
- package/dist/index.d.ts +22 -20
- package/dist/index.js.map +1 -1
- package/dist/invoices.cjs.map +1 -1
- package/dist/invoices.d.cts +5 -4
- package/dist/invoices.d.ts +5 -4
- package/dist/invoices.js.map +1 -1
- package/dist/merchants.cjs.map +1 -1
- package/dist/merchants.d.cts +19 -13
- package/dist/merchants.d.ts +19 -13
- package/dist/merchants.js.map +1 -1
- package/dist/payment-sessions.cjs.map +1 -1
- package/dist/payment-sessions.d.cts +5 -3
- package/dist/payment-sessions.d.ts +5 -3
- package/dist/payment-sessions.js.map +1 -1
- package/dist/refunds.cjs.map +1 -1
- package/dist/refunds.d.cts +5 -3
- package/dist/refunds.d.ts +5 -3
- package/dist/refunds.js.map +1 -1
- package/dist/storefronts.cjs.map +1 -1
- package/dist/storefronts.d.cts +11 -8
- package/dist/storefronts.d.ts +11 -8
- package/dist/storefronts.js.map +1 -1
- package/dist/subscriptions.cjs.map +1 -1
- package/dist/subscriptions.d.cts +11 -8
- package/dist/subscriptions.d.ts +11 -8
- package/dist/subscriptions.js.map +1 -1
- package/dist/transactions.cjs.map +1 -1
- package/dist/transactions.d.cts +4 -4
- package/dist/transactions.d.ts +4 -4
- package/dist/transactions.js.map +1 -1
- package/dist/webhooks.cjs.map +1 -1
- package/dist/webhooks.d.cts +11 -9
- package/dist/webhooks.d.ts +11 -9
- package/dist/webhooks.js.map +1 -1
- package/package.json +1 -1
- package/src/agents.ts +4 -2
- 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/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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common.ts","../src/payment-sessions.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;AAG5C,CAAA,C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AAO;AAAA,IACN,aAAA,EAAe,iBAAiB,QAAA,EAAS;AAAA,IACzC,OAAOA,CAAAA,CAAE,MAAA,EAAO,CAAE,KAAA,GAAQ,QAAA,EAAS;AAAA,IACnC,aAAaA,CAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA;AAAS,GAC3C,EACA,QAAA,EAAS;AAAA,EACZ,YAAYA,CAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,GAAM,QAAA,EAAS;AAAA,EACtC,WAAWA,CAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,GAAM,QAAA,EAAS;AAAA;AAAA,EAErC,gBAAA,EAAkBA,CAAAA,CACf,MAAA,EAAO,CACP,KAAI,CACJ,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAA,GAAK,EAAE,CAAA,CACX,QAAQ,EAAE,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKb,uBAAuBA,CAAAA,CACpB,KAAA;AAAA,IACCA,CAAAA,CAAE,IAAA,CAAK,CAAC,KAAA,EAAO,UAAA,EAAY,MAAA,EAAQ,SAAA,EAAW,UAAA,EAAY,UAAA,EAAY,WAAA,EAAa,QAAQ,CAAC;AAAA,IAE7F,QAAA,EAAS;AAAA,EACZ,QAAA,EAAU,eAAe,QAAA;AAC3B,CAAC;AAGM,IAAM,+BAAA,GAAkCA,EAAE,MAAA,CAAO;AAAA,EACtD,WAAA,EAAaA,EAAE,IAAA,CAAK;AAAA,IAClB,KAAA;AAAA,IACA,UAAA;AAAA,IACA,MAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACD,CAAA;AAAA,EACD,aAAA,EAAe,eAAA;AAAA,EACf,YAAA,EAAc,gBAAgB,QAAA,EAAS;AAAA,EACvC,kBAAA,EAAoB;AACtB,CAAC","file":"payment-sessions.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 * Payment session. A one-shot checkout intent.\n *\n * State machine:\n * created → awaiting_payment → submitted → confirmed\n * \\\n * → failed\n * → expired\n * → cancelled\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\nexport const paymentSessionStatusSchema = z.enum([\n 'created',\n 'awaiting_payment',\n 'submitted',\n 'confirmed',\n 'failed',\n 'expired',\n 'cancelled',\n])\nexport type PaymentSessionStatus = z.infer<typeof paymentSessionStatusSchema>\n\n/**\n * Merchant-supplied callback URL. The hosted checkout dispatches with\n * `window.location.href = redirectUrl` on completion / cancellation,\n * so we MUST reject anything other than `http://` and `https://`.\n *\n * Why this is a real risk: Zod's `.url()` validates RFC syntax, which\n * accepts `javascript:`, `data:`, `vbscript:`, `file:`, blob:`, etc.\n * A compromised merchant integration or an XSS upstream could ship a\n * session whose redirect URL executes script (or exfiltrates session\n * tokens) on every payer's browser. The damage is per-payer, but the\n * blast radius is \"every checkout the merchant runs.\"\n *\n * Mailto / tel and other handler protocols are also rejected — there\n * is no legitimate flow on a payment checkout that would benefit.\n */\nexport const callbackUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://') || v.startsWith('http://'), {\n message: 'must be an http:// or https:// URL',\n })\n\nexport const paymentSessionSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n /**\n * On-chain StrimzRegistry merchant id (uint96) as a decimal string.\n * Set when the merchant has been registered on-chain; null when the\n * merchant exists in our DB but the registry transaction hasn't\n * been broadcast yet. Hosted checkout uses this to populate the\n * meta-tx calldata; if null, the checkout refuses to accept\n * payments.\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` on the\n * active chain (Arc Testnet / Mainnet). Used as the `verifyingContract`\n * in the EIP-712 domain for both EIP-3009 and EIP-2612 signing.\n * Null on the (vanishingly unlikely) path where the API has no\n * configured address for the session's currency.\n */\n tokenAddress: evmAddressSchema.nullable(),\n customerId: idSchema.nullable(),\n status: paymentSessionStatusSchema,\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n feeAmount: tokenAmountSchema,\n netAmount: tokenAmountSchema,\n description: z.string().max(500).nullable(),\n payerWalletAddress: evmAddressSchema.nullable(),\n payerEmail: z.string().email().nullable(),\n successUrl: callbackUrlSchema.nullable(),\n cancelUrl: callbackUrlSchema.nullable(),\n sourceChain: z\n .enum(['arc', 'ethereum', 'base', 'polygon', 'arbitrum', 'optimism', 'avalanche', 'solana'])\n .nullable(),\n bridgeTxHash: evmTxHashSchema.nullable(),\n onchainTxHash: evmTxHashSchema.nullable(),\n checkoutUrl: z.string().url(),\n metadata: metadataSchema,\n expiresAt: isoTimestampSchema,\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type PaymentSession = z.infer<typeof paymentSessionSchema>\n\n// ---------- DTOs ----------\n\nexport const createPaymentSessionInputSchema = z.object({\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n description: z.string().max(500).optional(),\n customer: z\n .object({\n walletAddress: evmAddressSchema.optional(),\n email: z.string().email().optional(),\n externalRef: z.string().max(120).optional(),\n })\n .optional(),\n successUrl: z.string().url().optional(),\n cancelUrl: z.string().url().optional(),\n /** Minutes until the session expires. Default 30, max 60*24 (one day). */\n expiresInMinutes: z\n .number()\n .int()\n .min(1)\n .max(60 * 24)\n .default(30),\n /**\n * Allowed source chains a payer can bridge USDC from via CCTP. Omit to\n * accept every CCTP-supported chain.\n */\n supportedSourceChains: z\n .array(\n z.enum(['arc', 'ethereum', 'base', 'polygon', 'arbitrum', 'optimism', 'avalanche', 'solana']),\n )\n .optional(),\n metadata: metadataSchema.optional(),\n})\nexport type CreatePaymentSessionInput = z.infer<typeof createPaymentSessionInputSchema>\n\nexport const submitPaymentSessionInputSchema = z.object({\n sourceChain: z.enum([\n 'arc',\n 'ethereum',\n 'base',\n 'polygon',\n 'arbitrum',\n 'optimism',\n 'avalanche',\n 'solana',\n ]),\n onchainTxHash: evmTxHashSchema,\n bridgeTxHash: evmTxHashSchema.optional(),\n payerWalletAddress: evmAddressSchema,\n})\nexport type SubmitPaymentSessionInput = z.infer<typeof submitPaymentSessionInputSchema>\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/common.ts","../src/payment-sessions.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;AAG5C,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;AAG0B,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAOjC,IAAM,iBAAA,GAAoB,CAAA,CAC9B,MAAA,EAAO,CACP,MAAM,UAAA,EAAY,iDAAiD,CAAA,CACnE,MAAA,CAAO,CAAC,CAAA,KAAM,MAAA,CAAO,CAAC,CAAA,IAAK,IAAI,cAAc,CAAA;AAGtB,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CAAE,GAAA,CAAI,CAAC,CAAA,CAAE,GAAA,CAAI,MAAA,CAAO,gBAAgB;AAGtE,IAAM,kBAAA,GAAqB,CAAA,CAC/B,MAAA,EAAO,CACP,QAAA,CAAS,EAAE,MAAA,EAAQ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,EAKb,uBAAuBA,CAAAA,CACpB,KAAA;AAAA,IACCA,CAAAA,CAAE,IAAA,CAAK,CAAC,KAAA,EAAO,UAAA,EAAY,MAAA,EAAQ,SAAA,EAAW,UAAA,EAAY,UAAA,EAAY,WAAA,EAAa,QAAQ,CAAC;AAAA,IAE7F,QAAA,EAAS;AAAA,EACZ,QAAA,EAAU,eAAe,QAAA;AAC3B,CAAC;AAIM,IAAM,+BAAA,GAAkCA,EAAE,MAAA,CAAO;AAAA,EACtD,WAAA,EAAaA,EAAE,IAAA,CAAK;AAAA,IAClB,KAAA;AAAA,IACA,UAAA;AAAA,IACA,MAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACD,CAAA;AAAA,EACD,aAAA,EAAe,eAAA;AAAA,EACf,YAAA,EAAc,gBAAgB,QAAA,EAAS;AAAA,EACvC,kBAAA,EAAoB;AACtB,CAAC","file":"payment-sessions.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 * Payment session. A one-shot checkout intent.\n *\n * State machine:\n * created → awaiting_payment → submitted → confirmed\n * \\\n * → failed\n * → expired\n * → cancelled\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\nexport const paymentSessionStatusSchema = z.enum([\n 'created',\n 'awaiting_payment',\n 'submitted',\n 'confirmed',\n 'failed',\n 'expired',\n 'cancelled',\n])\nexport type PaymentSessionStatus = z.infer<typeof paymentSessionStatusSchema>\n\n/**\n * Merchant-supplied callback URL. The hosted checkout dispatches with\n * `window.location.href = redirectUrl` on completion / cancellation,\n * so we MUST reject anything other than `http://` and `https://`.\n *\n * Why this is a real risk: Zod's `.url()` validates RFC syntax, which\n * accepts `javascript:`, `data:`, `vbscript:`, `file:`, blob:`, etc.\n * A compromised merchant integration or an XSS upstream could ship a\n * session whose redirect URL executes script (or exfiltrates session\n * tokens) on every payer's browser. The damage is per-payer, but the\n * blast radius is \"every checkout the merchant runs.\"\n *\n * Mailto / tel and other handler protocols are also rejected — there\n * is no legitimate flow on a payment checkout that would benefit.\n */\nexport const callbackUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://') || v.startsWith('http://'), {\n message: 'must be an http:// or https:// URL',\n })\n\nexport const paymentSessionSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n /**\n * On-chain StrimzRegistry merchant id (uint96) as a decimal string.\n * Set when the merchant has been registered on-chain; null when the\n * merchant exists in our DB but the registry transaction hasn't\n * been broadcast yet. Hosted checkout uses this to populate the\n * meta-tx calldata; if null, the checkout refuses to accept\n * payments.\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` on the\n * active chain (Arc Testnet / Mainnet). Used as the `verifyingContract`\n * in the EIP-712 domain for both EIP-3009 and EIP-2612 signing.\n * Null on the (vanishingly unlikely) path where the API has no\n * configured address for the session's currency.\n */\n tokenAddress: evmAddressSchema.nullable(),\n customerId: idSchema.nullable(),\n status: paymentSessionStatusSchema,\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n feeAmount: tokenAmountSchema,\n netAmount: tokenAmountSchema,\n description: z.string().max(500).nullable(),\n payerWalletAddress: evmAddressSchema.nullable(),\n payerEmail: z.string().email().nullable(),\n successUrl: callbackUrlSchema.nullable(),\n cancelUrl: callbackUrlSchema.nullable(),\n sourceChain: z\n .enum(['arc', 'ethereum', 'base', 'polygon', 'arbitrum', 'optimism', 'avalanche', 'solana'])\n .nullable(),\n bridgeTxHash: evmTxHashSchema.nullable(),\n onchainTxHash: evmTxHashSchema.nullable(),\n checkoutUrl: z.string().url(),\n metadata: metadataSchema,\n expiresAt: isoTimestampSchema,\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type PaymentSession = z.infer<typeof paymentSessionSchema>\n\n// ---------- DTOs ----------\n\nexport const createPaymentSessionInputSchema = z.object({\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n description: z.string().max(500).optional(),\n customer: z\n .object({\n walletAddress: evmAddressSchema.optional(),\n email: z.string().email().optional(),\n externalRef: z.string().max(120).optional(),\n })\n .optional(),\n successUrl: z.string().url().optional(),\n cancelUrl: z.string().url().optional(),\n /** Minutes until the session expires. Default 30, max 60*24 (one day). */\n expiresInMinutes: z\n .number()\n .int()\n .min(1)\n .max(60 * 24)\n .default(30),\n /**\n * Allowed source chains a payer can bridge USDC from via CCTP. Omit to\n * accept every CCTP-supported chain.\n */\n supportedSourceChains: z\n .array(\n z.enum(['arc', 'ethereum', 'base', 'polygon', 'arbitrum', 'optimism', 'avalanche', 'solana']),\n )\n .optional(),\n metadata: metadataSchema.optional(),\n})\nexport type CreatePaymentSessionInput = z.input<typeof createPaymentSessionInputSchema>\nexport type CreatePaymentSessionParsed = z.output<typeof createPaymentSessionInputSchema>\n\nexport const submitPaymentSessionInputSchema = z.object({\n sourceChain: z.enum([\n 'arc',\n 'ethereum',\n 'base',\n 'polygon',\n 'arbitrum',\n 'optimism',\n 'avalanche',\n 'solana',\n ]),\n onchainTxHash: evmTxHashSchema,\n bridgeTxHash: evmTxHashSchema.optional(),\n payerWalletAddress: evmAddressSchema,\n})\nexport type SubmitPaymentSessionInput = z.input<typeof submitPaymentSessionInputSchema>\nexport type SubmitPaymentSessionParsed = z.output<typeof submitPaymentSessionInputSchema>\n"]}
|
package/dist/refunds.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common.ts","../src/refunds.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,CAC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,UAAA,EAAY,QAAA;AAAA,EACZ,aAAA,EAAe,QAAA;AAAA,EACf,MAAA,EAAQ,iBAAA;AAAA,EACR,QAAA,EAAU,qBAAA;AAAA,EACV,MAAA,EAAQ,kBAAA;AAAA,EACR,MAAMA,KAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA,EAAS;AAAA,EACnC,MAAA,EAAQ,kBAAA;AAAA,EACR,YAAA,EAAc,gBAAA;AAAA,EACd,YAAA,EAAc,gBAAgB,QAAA,EAAS;AAAA,EACvC,eAAeA,KAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA,EAAS;AAAA,EAC5C,WAAA,EAAa,QAAA;AAAA,EACb,SAAA,EAAW,kBAAA;AAAA,EACX,WAAA,EAAa,mBAAmB,QAAA;AAClC,CAAC;AAGM,IAAM,uBAAA,GAA0BA,MAAE,MAAA,CAAO;AAAA,EAC9C,aAAA,EAAe,QAAA;AAAA,EACf,MAAA,EAAQ,iBAAA;AAAA,EACR,MAAA,EAAQ,kBAAA;AAAA,EACR,MAAMA,KAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA;AAC5B,CAAC;AAGM,IAAM,gCAAA,GAAmCA,MAAE,MAAA,CAAO;AAAA,EACvD,EAAA,EAAI,QAAA;AAAA,EACJ,YAAA,EAAc;AAChB,CAAC;AAQM,IAAM,+BAAA,GAAkCA,MAAE,MAAA,CAAO;AAAA,EACtD,KAAA,EAAO,gBAAA;AAAA,EACP,EAAA,EAAI,gBAAA;AAAA,EACJ,MAAA,EAAQ,iBAAA;AAAA,EACR,IAAA,EAAMA,MAAE,MAAA;AACV,CAAC;AAGM,IAAM,wBAAA,GAA2BA,MAAE,MAAA,CAAO;AAAA,EAC/C,MAAA,EAAQ,YAAA;AAAA,EACR,mBAAA,EAAqB;AACvB,CAAC","file":"refunds.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 * Refund. A merchant-initiated return of funds to a payer.\n *\n * Refunds are executed off-chain (from the merchant's wallet to the payer's\n * wallet). Strimz records the intent, validates constraints, and reconciles\n * via the merchant-signed on-chain transfer.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\n\nexport const refundReasonSchema = z.enum([\n 'customer_request',\n 'product_issue',\n 'duplicate_charge',\n 'fraudulent',\n 'other',\n])\nexport type RefundReason = z.infer<typeof refundReasonSchema>\n\nexport const refundStatusSchema = z.enum([\n 'pending',\n 'awaiting_signature',\n 'submitted',\n 'completed',\n 'failed',\n 'cancelled',\n])\nexport type RefundStatus = z.infer<typeof refundStatusSchema>\n\nexport const refundSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n transactionId: idSchema,\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n reason: refundReasonSchema,\n note: z.string().max(500).nullable(),\n status: refundStatusSchema,\n payerAddress: evmAddressSchema,\n refundTxHash: evmTxHashSchema.nullable(),\n failureReason: z.string().max(500).nullable(),\n initiatedBy: idSchema,\n createdAt: isoTimestampSchema,\n completedAt: isoTimestampSchema.nullable(),\n})\nexport type Refund = z.infer<typeof refundSchema>\n\nexport const createRefundInputSchema = z.object({\n transactionId: idSchema,\n amount: tokenAmountSchema,\n reason: refundReasonSchema,\n note: z.string().max(500).optional(),\n})\nexport type CreateRefundInput = z.infer<typeof createRefundInputSchema>\n\nexport const submitRefundSignatureInputSchema = z.object({\n id: idSchema,\n refundTxHash: evmTxHashSchema,\n})\nexport type SubmitRefundSignatureInput = z.infer<typeof submitRefundSignatureInputSchema>\n\n/**\n * Response envelope for `POST /v1/refunds`. The API returns the newly\n * created refund plus the concrete ERC-20 transfer the merchant now\n * has to sign from their payout wallet.\n */\nexport const refundSigningInstructionsSchema = z.object({\n token: evmAddressSchema,\n to: evmAddressSchema,\n amount: tokenAmountSchema,\n note: z.string(),\n})\nexport type RefundSigningInstructions = z.infer<typeof refundSigningInstructionsSchema>\n\nexport const refundCreateOutputSchema = z.object({\n refund: refundSchema,\n signingInstructions: refundSigningInstructionsSchema,\n})\nexport type RefundCreateOutput = z.infer<typeof ref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E,MAAA,CAAO;AAAA,EACtD,KAAA,EAAO,gBAAA;AAAA,EACP,EAAA,EAAI,gBAAA;AAAA,EACJ,MAAA,EAAQ,iBAAA;AAAA,EACR,IAAA,EAAMA,MAAE,MAAA;AACV,CAAC;AAGM,IAAM,wBAAA,GAA2BA,MAAE,MAAA,CAAO;AAAA,EAC/C,MAAA,EAAQ,YAAA;AAAA,EACR,mBAAA,EAAqB;AACvB,CAAC","file":"refunds.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 * Refund. A merchant-initiated return of funds to a payer.\n *\n * Refunds are executed off-chain (from the merchant's wallet to the payer's\n * wallet). Strimz records the intent, validates constraints, and reconciles\n * via the merchant-signed on-chain transfer.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\n\nexport const refundReasonSchema = z.enum([\n 'customer_request',\n 'product_issue',\n 'duplicate_charge',\n 'fraudulent',\n 'other',\n])\nexport type RefundReason = z.infer<typeof refundReasonSchema>\n\nexport const refundStatusSchema = z.enum([\n 'pending',\n 'awaiting_signature',\n 'submitted',\n 'completed',\n 'failed',\n 'cancelled',\n])\nexport type RefundStatus = z.infer<typeof refundStatusSchema>\n\nexport const refundSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n transactionId: idSchema,\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n reason: refundReasonSchema,\n note: z.string().max(500).nullable(),\n status: refundStatusSchema,\n payerAddress: evmAddressSchema,\n refundTxHash: evmTxHashSchema.nullable(),\n failureReason: z.string().max(500).nullable(),\n initiatedBy: idSchema,\n createdAt: isoTimestampSchema,\n completedAt: isoTimestampSchema.nullable(),\n})\nexport type Refund = z.infer<typeof refundSchema>\n\nexport const createRefundInputSchema = z.object({\n transactionId: idSchema,\n amount: tokenAmountSchema,\n reason: refundReasonSchema,\n note: z.string().max(500).optional(),\n})\nexport type CreateRefundInput = z.input<typeof createRefundInputSchema>\nexport type CreateRefundParsed = z.output<typeof createRefundInputSchema>\n\nexport const submitRefundSignatureInputSchema = z.object({\n id: idSchema,\n refundTxHash: evmTxHashSchema,\n})\nexport type SubmitRefundSignatureInput = z.input<typeof submitRefundSignatureInputSchema>\nexport type SubmitRefundSignatureParsed = z.output<typeof submitRefundSignatureInputSchema>\n\n/**\n * Response envelope for `POST /v1/refunds`. The API returns the newly\n * created refund plus the concrete ERC-20 transfer the merchant now\n * has to sign from their payout wallet.\n */\nexport const refundSigningInstructionsSchema = z.object({\n token: evmAddressSchema,\n to: evmAddressSchema,\n amount: tokenAmountSchema,\n note: z.string(),\n})\nexport type RefundSigningInstructions = z.infer<typeof refundSigningInstructionsSchema>\n\nexport const refundCreateOutputSchema = z.object({\n refund: refundSchema,\n signingInstructions: refundSigningInstructionsSchema,\n})\nexport type RefundCreateOutput = z.infer<typeof refundCreateOutputSchema>\n"]}
|
package/dist/refunds.d.cts
CHANGED
|
@@ -75,7 +75,8 @@ declare const createRefundInputSchema: z.ZodObject<{
|
|
|
75
75
|
transactionId: string;
|
|
76
76
|
note?: string | undefined;
|
|
77
77
|
}>;
|
|
78
|
-
type CreateRefundInput = z.
|
|
78
|
+
type CreateRefundInput = z.input<typeof createRefundInputSchema>;
|
|
79
|
+
type CreateRefundParsed = z.output<typeof createRefundInputSchema>;
|
|
79
80
|
declare const submitRefundSignatureInputSchema: z.ZodObject<{
|
|
80
81
|
id: z.ZodString;
|
|
81
82
|
refundTxHash: z.ZodString;
|
|
@@ -86,7 +87,8 @@ declare const submitRefundSignatureInputSchema: z.ZodObject<{
|
|
|
86
87
|
id: string;
|
|
87
88
|
refundTxHash: string;
|
|
88
89
|
}>;
|
|
89
|
-
type SubmitRefundSignatureInput = z.
|
|
90
|
+
type SubmitRefundSignatureInput = z.input<typeof submitRefundSignatureInputSchema>;
|
|
91
|
+
type SubmitRefundSignatureParsed = z.output<typeof submitRefundSignatureInputSchema>;
|
|
90
92
|
/**
|
|
91
93
|
* Response envelope for `POST /v1/refunds`. The API returns the newly
|
|
92
94
|
* created refund plus the concrete ERC-20 transfer the merchant now
|
|
@@ -221,4 +223,4 @@ declare const refundCreateOutputSchema: z.ZodObject<{
|
|
|
221
223
|
}>;
|
|
222
224
|
type RefundCreateOutput = z.infer<typeof refundCreateOutputSchema>;
|
|
223
225
|
|
|
224
|
-
export { type CreateRefundInput, type Refund, type RefundCreateOutput, type RefundReason, type RefundSigningInstructions, type RefundStatus, type SubmitRefundSignatureInput, createRefundInputSchema, refundCreateOutputSchema, refundReasonSchema, refundSchema, refundSigningInstructionsSchema, refundStatusSchema, submitRefundSignatureInputSchema };
|
|
226
|
+
export { type CreateRefundInput, type CreateRefundParsed, type Refund, type RefundCreateOutput, type RefundReason, type RefundSigningInstructions, type RefundStatus, type SubmitRefundSignatureInput, type SubmitRefundSignatureParsed, createRefundInputSchema, refundCreateOutputSchema, refundReasonSchema, refundSchema, refundSigningInstructionsSchema, refundStatusSchema, submitRefundSignatureInputSchema };
|
package/dist/refunds.d.ts
CHANGED
|
@@ -75,7 +75,8 @@ declare const createRefundInputSchema: z.ZodObject<{
|
|
|
75
75
|
transactionId: string;
|
|
76
76
|
note?: string | undefined;
|
|
77
77
|
}>;
|
|
78
|
-
type CreateRefundInput = z.
|
|
78
|
+
type CreateRefundInput = z.input<typeof createRefundInputSchema>;
|
|
79
|
+
type CreateRefundParsed = z.output<typeof createRefundInputSchema>;
|
|
79
80
|
declare const submitRefundSignatureInputSchema: z.ZodObject<{
|
|
80
81
|
id: z.ZodString;
|
|
81
82
|
refundTxHash: z.ZodString;
|
|
@@ -86,7 +87,8 @@ declare const submitRefundSignatureInputSchema: z.ZodObject<{
|
|
|
86
87
|
id: string;
|
|
87
88
|
refundTxHash: string;
|
|
88
89
|
}>;
|
|
89
|
-
type SubmitRefundSignatureInput = z.
|
|
90
|
+
type SubmitRefundSignatureInput = z.input<typeof submitRefundSignatureInputSchema>;
|
|
91
|
+
type SubmitRefundSignatureParsed = z.output<typeof submitRefundSignatureInputSchema>;
|
|
90
92
|
/**
|
|
91
93
|
* Response envelope for `POST /v1/refunds`. The API returns the newly
|
|
92
94
|
* created refund plus the concrete ERC-20 transfer the merchant now
|
|
@@ -221,4 +223,4 @@ declare const refundCreateOutputSchema: z.ZodObject<{
|
|
|
221
223
|
}>;
|
|
222
224
|
type RefundCreateOutput = z.infer<typeof refundCreateOutputSchema>;
|
|
223
225
|
|
|
224
|
-
export { type CreateRefundInput, type Refund, type RefundCreateOutput, type RefundReason, type RefundSigningInstructions, type RefundStatus, type SubmitRefundSignatureInput, createRefundInputSchema, refundCreateOutputSchema, refundReasonSchema, refundSchema, refundSigningInstructionsSchema, refundStatusSchema, submitRefundSignatureInputSchema };
|
|
226
|
+
export { type CreateRefundInput, type CreateRefundParsed, type Refund, type RefundCreateOutput, type RefundReason, type RefundSigningInstructions, type RefundStatus, type SubmitRefundSignatureInput, type SubmitRefundSignatureParsed, createRefundInputSchema, refundCreateOutputSchema, refundReasonSchema, refundSchema, refundSigningInstructionsSchema, refundStatusSchema, submitRefundSignatureInputSchema };
|
package/dist/refunds.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common.ts","../src/refunds.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;AAG5C,CAAA,CAC3B,MAAA,EAA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BAAgB,QAAA,EAAS;AAAA,EACvC,eAAeA,CAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA,EAAS;AAAA,EAC5C,WAAA,EAAa,QAAA;AAAA,EACb,SAAA,EAAW,kBAAA;AAAA,EACX,WAAA,EAAa,mBAAmB,QAAA;AAClC,CAAC;AAGM,IAAM,uBAAA,GAA0BA,EAAE,MAAA,CAAO;AAAA,EAC9C,aAAA,EAAe,QAAA;AAAA,EACf,MAAA,EAAQ,iBAAA;AAAA,EACR,MAAA,EAAQ,kBAAA;AAAA,EACR,MAAMA,CAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA;AAC5B,CAAC;AAGM,IAAM,gCAAA,GAAmCA,EAAE,MAAA,CAAO;AAAA,EACvD,EAAA,EAAI,QAAA;AAAA,EACJ,YAAA,EAAc;AAChB,CAAC;AAQM,IAAM,+BAAA,GAAkCA,EAAE,MAAA,CAAO;AAAA,EACtD,KAAA,EAAO,gBAAA;AAAA,EACP,EAAA,EAAI,gBAAA;AAAA,EACJ,MAAA,EAAQ,iBAAA;AAAA,EACR,IAAA,EAAMA,EAAE,MAAA;AACV,CAAC;AAGM,IAAM,wBAAA,GAA2BA,EAAE,MAAA,CAAO;AAAA,EAC/C,MAAA,EAAQ,YAAA;AAAA,EACR,mBAAA,EAAqB;AACvB,CAAC","file":"refunds.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 * Refund. A merchant-initiated return of funds to a payer.\n *\n * Refunds are executed off-chain (from the merchant's wallet to the payer's\n * wallet). Strimz records the intent, validates constraints, and reconciles\n * via the merchant-signed on-chain transfer.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\n\nexport const refundReasonSchema = z.enum([\n 'customer_request',\n 'product_issue',\n 'duplicate_charge',\n 'fraudulent',\n 'other',\n])\nexport type RefundReason = z.infer<typeof refundReasonSchema>\n\nexport const refundStatusSchema = z.enum([\n 'pending',\n 'awaiting_signature',\n 'submitted',\n 'completed',\n 'failed',\n 'cancelled',\n])\nexport type RefundStatus = z.infer<typeof refundStatusSchema>\n\nexport const refundSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n transactionId: idSchema,\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n reason: refundReasonSchema,\n note: z.string().max(500).nullable(),\n status: refundStatusSchema,\n payerAddress: evmAddressSchema,\n refundTxHash: evmTxHashSchema.nullable(),\n failureReason: z.string().max(500).nullable(),\n initiatedBy: idSchema,\n createdAt: isoTimestampSchema,\n completedAt: isoTimestampSchema.nullable(),\n})\nexport type Refund = z.infer<typeof refundSchema>\n\nexport const createRefundInputSchema = z.object({\n transactionId: idSchema,\n amount: tokenAmountSchema,\n reason: refundReasonSchema,\n note: z.string().max(500).optional(),\n})\nexport type CreateRefundInput = z.infer<typeof createRefundInputSchema>\n\nexport const submitRefundSignatureInputSchema = z.object({\n id: idSchema,\n refundTxHash: evmTxHashSchema,\n})\nexport type SubmitRefundSignatureInput = z.infer<typeof submitRefundSignatureInputSchema>\n\n/**\n * Response envelope for `POST /v1/refunds`. The API returns the newly\n * created refund plus the concrete ERC-20 transfer the merchant now\n * has to sign from their payout wallet.\n */\nexport const refundSigningInstructionsSchema = z.object({\n token: evmAddressSchema,\n to: evmAddressSchema,\n amount: tokenAmountSchema,\n note: z.string(),\n})\nexport type RefundSigningInstructions = z.infer<typeof refundSigningInstructionsSchema>\n\nexport const refundCreateOutputSchema = z.object({\n refund: refundSchema,\n signingInstructions: refundSigningInstructionsSchema,\n})\nexport type RefundCreateOutput = z.infer<typeof refundCreateOutputSchema>\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/common.ts","../src/refunds.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,qBA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ACJ,UAAA,EAAY,QAAA;AAAA,EACZ,aAAA,EAAe,QAAA;AAAA,EACf,MAAA,EAAQ,iBAAA;AAAA,EACR,QAAA,EAAU,qBAAA;AAAA,EACV,MAAA,EAAQ,kBAAA;AAAA,EACR,MAAMA,CAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA,EAAS;AAAA,EACnC,MAAA,EAAQ,kBAAA;AAAA,EACR,YAAA,EAAc,gBAAA;AAAA,EACd,YAAA,EAAc,gBAAgB,QAAA,EAAS;AAAA,EACvC,eAAeA,CAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA,EAAS;AAAA,EAC5C,WAAA,EAAa,QAAA;AAAA,EACb,SAAA,EAAW,kBAAA;AAAA,EACX,WAAA,EAAa,mBAAmB,QAAA;AAClC,CAAC;AAGM,IAAM,uBAAA,GAA0BA,EAAE,MAAA,CAAO;AAAA,EAC9C,aAAA,EAAe,QAAA;AAAA,EACf,MAAA,EAAQ,iBAAA;AAAA,EACR,MAAA,EAAQ,kBAAA;AAAA,EACR,MAAMA,CAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA;AAC5B,CAAC;AAIM,IAAM,gCAAA,GAAmCA,EAAE,MAAA,CAAO;AAAA,EACvD,EAAA,EAAI,QAAA;AAAA,EACJ,YAAA,EAAc;AAChB,CAAC;AASM,IAAM,+BAAA,GAAkCA,EAAE,MAAA,CAAO;AAAA,EACtD,KAAA,EAAO,gBAAA;AAAA,EACP,EAAA,EAAI,gBAAA;AAAA,EACJ,MAAA,EAAQ,iBAAA;AAAA,EACR,IAAA,EAAMA,EAAE,MAAA;AACV,CAAC;AAGM,IAAM,wBAAA,GAA2BA,EAAE,MAAA,CAAO;AAAA,EAC/C,MAAA,EAAQ,YAAA;AAAA,EACR,mBAAA,EAAqB;AACvB,CAAC","file":"refunds.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 * Refund. A merchant-initiated return of funds to a payer.\n *\n * Refunds are executed off-chain (from the merchant's wallet to the payer's\n * wallet). Strimz records the intent, validates constraints, and reconciles\n * via the merchant-signed on-chain transfer.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\n\nexport const refundReasonSchema = z.enum([\n 'customer_request',\n 'product_issue',\n 'duplicate_charge',\n 'fraudulent',\n 'other',\n])\nexport type RefundReason = z.infer<typeof refundReasonSchema>\n\nexport const refundStatusSchema = z.enum([\n 'pending',\n 'awaiting_signature',\n 'submitted',\n 'completed',\n 'failed',\n 'cancelled',\n])\nexport type RefundStatus = z.infer<typeof refundStatusSchema>\n\nexport const refundSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n transactionId: idSchema,\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n reason: refundReasonSchema,\n note: z.string().max(500).nullable(),\n status: refundStatusSchema,\n payerAddress: evmAddressSchema,\n refundTxHash: evmTxHashSchema.nullable(),\n failureReason: z.string().max(500).nullable(),\n initiatedBy: idSchema,\n createdAt: isoTimestampSchema,\n completedAt: isoTimestampSchema.nullable(),\n})\nexport type Refund = z.infer<typeof refundSchema>\n\nexport const createRefundInputSchema = z.object({\n transactionId: idSchema,\n amount: tokenAmountSchema,\n reason: refundReasonSchema,\n note: z.string().max(500).optional(),\n})\nexport type CreateRefundInput = z.input<typeof createRefundInputSchema>\nexport type CreateRefundParsed = z.output<typeof createRefundInputSchema>\n\nexport const submitRefundSignatureInputSchema = z.object({\n id: idSchema,\n refundTxHash: evmTxHashSchema,\n})\nexport type SubmitRefundSignatureInput = z.input<typeof submitRefundSignatureInputSchema>\nexport type SubmitRefundSignatureParsed = z.output<typeof submitRefundSignatureInputSchema>\n\n/**\n * Response envelope for `POST /v1/refunds`. The API returns the newly\n * created refund plus the concrete ERC-20 transfer the merchant now\n * has to sign from their payout wallet.\n */\nexport const refundSigningInstructionsSchema = z.object({\n token: evmAddressSchema,\n to: evmAddressSchema,\n amount: tokenAmountSchema,\n note: z.string(),\n})\nexport type RefundSigningInstructions = z.infer<typeof refundSigningInstructionsSchema>\n\nexport const refundCreateOutputSchema = z.object({\n refund: refundSchema,\n signingInstructions: refundSigningInstructionsSchema,\n})\nexport type RefundCreateOutput = z.infer<typeof refundCreateOutputSchema>\n"]}
|
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,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkBA,KAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlEA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAGnE,IAAM,cAAA,GAAiBA,KAAA,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;AAG0BA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAOjC,IAAM,iBAAA,GAAoBA,KAAA,CAC9B,MAAA,EAAO,CACP,MAAM,UAAA,EAAY,iDAAiD,CAAA,CACnE,MAAA,CAAO,CAAC,CAAA,KAAM,MAAA,CAAO,CAAC,CAAA,IAAK,IAAI,cAAc,CAAA;AAGtBA,KAAA,CAAE,MAAA,EAAO,CAAE,G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AYA,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,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkBA,KAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlEA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAGnE,IAAM,cAAA,GAAiBA,KAAA,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;AAG0BA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAOjC,IAAM,iBAAA,GAAoBA,KAAA,CAC9B,MAAA,EAAO,CACP,MAAM,UAAA,EAAY,iDAAiD,CAAA,CACnE,MAAA,CAAO,CAAC,CAAA,KAAM,MAAA,CAAO,CAAC,CAAA,IAAK,IAAI,cAAc,C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E,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
|
@@ -23,8 +23,8 @@ declare const storefrontSchema: z.ZodObject<{
|
|
|
23
23
|
status: "archived" | "draft" | "published";
|
|
24
24
|
id: string;
|
|
25
25
|
merchantId: string;
|
|
26
|
-
createdAt: string;
|
|
27
26
|
name: string;
|
|
27
|
+
createdAt: string;
|
|
28
28
|
description: string | null;
|
|
29
29
|
updatedAt: string;
|
|
30
30
|
logoUrl: string | null;
|
|
@@ -36,8 +36,8 @@ declare const storefrontSchema: z.ZodObject<{
|
|
|
36
36
|
status: "archived" | "draft" | "published";
|
|
37
37
|
id: string;
|
|
38
38
|
merchantId: string;
|
|
39
|
-
createdAt: string;
|
|
40
39
|
name: string;
|
|
40
|
+
createdAt: string;
|
|
41
41
|
description: string | null;
|
|
42
42
|
updatedAt: string;
|
|
43
43
|
logoUrl: string | null;
|
|
@@ -77,7 +77,8 @@ declare const createStorefrontInputSchema: z.ZodObject<Pick<{
|
|
|
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<{
|
|
@@ -101,8 +102,8 @@ declare const storefrontProductSchema: z.ZodObject<{
|
|
|
101
102
|
}, "strip", z.ZodTypeAny, {
|
|
102
103
|
type: "subscription" | "one_time";
|
|
103
104
|
id: string;
|
|
104
|
-
createdAt: string;
|
|
105
105
|
name: string;
|
|
106
|
+
createdAt: string;
|
|
106
107
|
currency: "USDC" | "EURC";
|
|
107
108
|
description: string | null;
|
|
108
109
|
updatedAt: string;
|
|
@@ -118,8 +119,8 @@ declare const storefrontProductSchema: z.ZodObject<{
|
|
|
118
119
|
}, {
|
|
119
120
|
type: "subscription" | "one_time";
|
|
120
121
|
id: string;
|
|
121
|
-
createdAt: string;
|
|
122
122
|
name: string;
|
|
123
|
+
createdAt: string;
|
|
123
124
|
currency: "USDC" | "EURC";
|
|
124
125
|
description: string | null;
|
|
125
126
|
updatedAt: 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. */
|
|
@@ -239,4 +242,4 @@ declare const storefrontCheckoutResponseSchema: z.ZodObject<{
|
|
|
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
|
@@ -23,8 +23,8 @@ declare const storefrontSchema: z.ZodObject<{
|
|
|
23
23
|
status: "archived" | "draft" | "published";
|
|
24
24
|
id: string;
|
|
25
25
|
merchantId: string;
|
|
26
|
-
createdAt: string;
|
|
27
26
|
name: string;
|
|
27
|
+
createdAt: string;
|
|
28
28
|
description: string | null;
|
|
29
29
|
updatedAt: string;
|
|
30
30
|
logoUrl: string | null;
|
|
@@ -36,8 +36,8 @@ declare const storefrontSchema: z.ZodObject<{
|
|
|
36
36
|
status: "archived" | "draft" | "published";
|
|
37
37
|
id: string;
|
|
38
38
|
merchantId: string;
|
|
39
|
-
createdAt: string;
|
|
40
39
|
name: string;
|
|
40
|
+
createdAt: string;
|
|
41
41
|
description: string | null;
|
|
42
42
|
updatedAt: string;
|
|
43
43
|
logoUrl: string | null;
|
|
@@ -77,7 +77,8 @@ declare const createStorefrontInputSchema: z.ZodObject<Pick<{
|
|
|
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<{
|
|
@@ -101,8 +102,8 @@ declare const storefrontProductSchema: z.ZodObject<{
|
|
|
101
102
|
}, "strip", z.ZodTypeAny, {
|
|
102
103
|
type: "subscription" | "one_time";
|
|
103
104
|
id: string;
|
|
104
|
-
createdAt: string;
|
|
105
105
|
name: string;
|
|
106
|
+
createdAt: string;
|
|
106
107
|
currency: "USDC" | "EURC";
|
|
107
108
|
description: string | null;
|
|
108
109
|
updatedAt: string;
|
|
@@ -118,8 +119,8 @@ declare const storefrontProductSchema: z.ZodObject<{
|
|
|
118
119
|
}, {
|
|
119
120
|
type: "subscription" | "one_time";
|
|
120
121
|
id: string;
|
|
121
|
-
createdAt: string;
|
|
122
122
|
name: string;
|
|
123
|
+
createdAt: string;
|
|
123
124
|
currency: "USDC" | "EURC";
|
|
124
125
|
description: string | null;
|
|
125
126
|
updatedAt: 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. */
|
|
@@ -239,4 +242,4 @@ declare const storefrontCheckoutResponseSchema: z.ZodObject<{
|
|
|
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 };
|