@omnixhq/ucp-js-sdk 1.0.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/LICENSE +202 -0
- package/README.md +109 -0
- package/dist/index.cjs +1965 -0
- package/dist/index.d.cts +13876 -0
- package/dist/index.d.mts +13876 -0
- package/dist/index.mjs +1846 -0
- package/package.json +65 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1846 @@
|
|
|
1
|
+
import * as z$1 from "zod";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/spec_generated.ts
|
|
4
|
+
const CapabilityBaseSchema = z$1.intersection(z$1.object({
|
|
5
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
6
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
7
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
8
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
9
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
10
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({ "extends": z$1.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() }));
|
|
11
|
+
const CapabilityPlatformSchema = z$1.intersection(z$1.intersection(z$1.object({
|
|
12
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
13
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
14
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
15
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
16
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
17
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({ "extends": z$1.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })), z$1.record(z$1.string(), z$1.unknown())).describe("Full capability declaration for platform-level discovery. Includes spec/schema URLs for agent fetching.");
|
|
18
|
+
const CapabilityBusinessSchema = z$1.intersection(z$1.object({
|
|
19
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
20
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
21
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
22
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
23
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
24
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({ "extends": z$1.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })).describe("Capability configuration for business/merchant level. May include business-specific config overrides.");
|
|
25
|
+
const CapabilityResponseSchema = z$1.intersection(z$1.object({
|
|
26
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
27
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
28
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
29
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
30
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
31
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({ "extends": z$1.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })).describe("Capability reference in responses. Only name/version required to confirm active capabilities.");
|
|
32
|
+
const PaymentHandlerBaseSchema = z$1.intersection(z$1.object({
|
|
33
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
34
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
35
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
36
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
37
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
38
|
+
}).describe("Shared foundation for all UCP entities."), z$1.record(z$1.string(), z$1.unknown()));
|
|
39
|
+
const PaymentHandlerPlatformSchema = z$1.intersection(z$1.intersection(z$1.object({
|
|
40
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
41
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
42
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
43
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
44
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
45
|
+
}).describe("Shared foundation for all UCP entities."), z$1.record(z$1.string(), z$1.unknown())), z$1.record(z$1.string(), z$1.unknown())).describe("Platform declaration for discovery profiles. May include partial config state required for discovery.");
|
|
46
|
+
const PaymentHandlerBusinessSchema = z$1.intersection(z$1.object({
|
|
47
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
48
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
49
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
50
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
51
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
52
|
+
}).describe("Shared foundation for all UCP entities."), z$1.record(z$1.string(), z$1.unknown())).describe("Business declaration for discovery profiles. May include partial config state required for discovery.");
|
|
53
|
+
const PaymentHandlerResponseSchema = z$1.intersection(z$1.object({
|
|
54
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
55
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
56
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
57
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
58
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
59
|
+
}).describe("Shared foundation for all UCP entities."), z$1.record(z$1.string(), z$1.unknown())).describe("Handler reference in responses. May include full config state for runtime usage of the handler.");
|
|
60
|
+
const ServiceBaseSchema = z$1.intersection(z$1.object({
|
|
61
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
62
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
63
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
64
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
65
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
66
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({
|
|
67
|
+
"transport": z$1.enum([
|
|
68
|
+
"rest",
|
|
69
|
+
"mcp",
|
|
70
|
+
"a2a",
|
|
71
|
+
"embedded"
|
|
72
|
+
]).describe("Transport protocol for this service binding."),
|
|
73
|
+
"endpoint": z$1.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
74
|
+
}));
|
|
75
|
+
const ServicePlatformSchema = z$1.intersection(z$1.intersection(z$1.object({
|
|
76
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
77
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
78
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
79
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
80
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
81
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({
|
|
82
|
+
"transport": z$1.enum([
|
|
83
|
+
"rest",
|
|
84
|
+
"mcp",
|
|
85
|
+
"a2a",
|
|
86
|
+
"embedded"
|
|
87
|
+
]).describe("Transport protocol for this service binding."),
|
|
88
|
+
"endpoint": z$1.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
89
|
+
})), z$1.intersection(z$1.record(z$1.string(), z$1.unknown()), z$1.union([
|
|
90
|
+
z$1.object({ "transport": z$1.literal("rest").optional() }),
|
|
91
|
+
z$1.object({ "transport": z$1.literal("mcp").optional() }),
|
|
92
|
+
z$1.object({ "transport": z$1.literal("a2a").optional() }),
|
|
93
|
+
z$1.object({ "transport": z$1.literal("embedded").optional() })
|
|
94
|
+
]))).describe("Full service declaration for platform-level discovery. Different transports require different fields.");
|
|
95
|
+
const ServiceBusinessSchema = z$1.intersection(z$1.intersection(z$1.object({
|
|
96
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
97
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
98
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
99
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
100
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
101
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({
|
|
102
|
+
"transport": z$1.enum([
|
|
103
|
+
"rest",
|
|
104
|
+
"mcp",
|
|
105
|
+
"a2a",
|
|
106
|
+
"embedded"
|
|
107
|
+
]).describe("Transport protocol for this service binding."),
|
|
108
|
+
"endpoint": z$1.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
109
|
+
})), z$1.union([
|
|
110
|
+
z$1.object({ "transport": z$1.literal("rest").optional() }),
|
|
111
|
+
z$1.object({ "transport": z$1.literal("mcp").optional() }),
|
|
112
|
+
z$1.object({ "transport": z$1.literal("a2a").optional() }),
|
|
113
|
+
z$1.object({
|
|
114
|
+
"transport": z$1.literal("embedded").optional(),
|
|
115
|
+
"config": z$1.object({ "delegate": z$1.array(z$1.string()).describe("Delegations the business allows. At service-level, declares available delegations. In checkout responses, confirms accepted delegations for this session.").optional() }).describe("Per-checkout configuration for embedded transport binding. Allows businesses to vary ECP availability and delegations based on cart contents, agent authorization, or policy.").optional()
|
|
116
|
+
})
|
|
117
|
+
])).describe("Service binding for business/merchant configuration. May override platform endpoints.");
|
|
118
|
+
const ServiceResponseSchema = z$1.intersection(z$1.intersection(z$1.object({
|
|
119
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
120
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
121
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
122
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
123
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
124
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({
|
|
125
|
+
"transport": z$1.enum([
|
|
126
|
+
"rest",
|
|
127
|
+
"mcp",
|
|
128
|
+
"a2a",
|
|
129
|
+
"embedded"
|
|
130
|
+
]).describe("Transport protocol for this service binding."),
|
|
131
|
+
"endpoint": z$1.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
132
|
+
})), z$1.union([
|
|
133
|
+
z$1.object({ "transport": z$1.literal("rest").optional() }),
|
|
134
|
+
z$1.object({ "transport": z$1.literal("mcp").optional() }),
|
|
135
|
+
z$1.object({ "transport": z$1.literal("a2a").optional() }),
|
|
136
|
+
z$1.object({
|
|
137
|
+
"transport": z$1.literal("embedded").optional(),
|
|
138
|
+
"config": z$1.object({ "delegate": z$1.array(z$1.string()).describe("Delegations the business allows. At service-level, declares available delegations. In checkout responses, confirms accepted delegations for this session.").optional() }).describe("Per-checkout configuration for embedded transport binding. Allows businesses to vary ECP availability and delegations based on cart contents, agent authorization, or policy.").optional()
|
|
139
|
+
})
|
|
140
|
+
])).describe("Service binding in API responses. Includes per-resource transport configuration via typed config.");
|
|
141
|
+
const Ap2MandateMerchantAuthorizationSchema = z$1.string().regex(/* @__PURE__ */ new RegExp("^[A-Za-z0-9_-]+\\.\\.[A-Za-z0-9_-]+$")).describe("JWS Detached Content signature (RFC 7515 Appendix F) over the checkout response body (excluding ap2 field). Format: `<base64url-header>..<base64url-signature>`. The header MUST contain 'alg' (ES256/ES384/ES512) and 'kid' claims. The signature covers both the header and JCS-canonicalized checkout payload.");
|
|
142
|
+
const Ap2MandateCheckoutMandateSchema = z$1.string().regex(/* @__PURE__ */ new RegExp("^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]*\\.[A-Za-z0-9_-]+(~[A-Za-z0-9_-]+)*$")).describe("SD-JWT+kb credential in `ap2.checkout_mandate`. Proving user authorization for the checkout. Contains the full checkout including `ap2.merchant_authorization`.");
|
|
143
|
+
const Ap2MandateAp2WithMerchantAuthorizationSchema = z$1.object({ "merchant_authorization": z$1.string().regex(/* @__PURE__ */ new RegExp("^[A-Za-z0-9_-]+\\.\\.[A-Za-z0-9_-]+$")).describe("Merchant's signature proving checkout terms are authentic.").optional() }).describe("AP2 extension data including merchant authorization.");
|
|
144
|
+
const Ap2MandateAp2WithCheckoutMandateSchema = z$1.object({ "checkout_mandate": z$1.string().regex(/* @__PURE__ */ new RegExp("^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]*\\.[A-Za-z0-9_-]+(~[A-Za-z0-9_-]+)*$")).describe("SD-JWT+kb proving user authorized this checkout.").optional() }).describe("AP2 extension data including checkout mandate.");
|
|
145
|
+
const Ap2MandateErrorCodeSchema = z$1.enum([
|
|
146
|
+
"mandate_required",
|
|
147
|
+
"agent_missing_key",
|
|
148
|
+
"mandate_invalid_signature",
|
|
149
|
+
"mandate_expired",
|
|
150
|
+
"mandate_scope_mismatch",
|
|
151
|
+
"merchant_authorization_invalid",
|
|
152
|
+
"merchant_authorization_missing"
|
|
153
|
+
]).describe("Error codes specific to AP2 mandate verification.");
|
|
154
|
+
const BuyerConsentConsentSchema = z$1.object({
|
|
155
|
+
"analytics": z$1.boolean().describe("Consent for analytics and performance tracking.").optional(),
|
|
156
|
+
"preferences": z$1.boolean().describe("Consent for storing user preferences.").optional(),
|
|
157
|
+
"marketing": z$1.boolean().describe("Consent for marketing communications.").optional(),
|
|
158
|
+
"sale_of_data": z$1.boolean().describe("Consent for selling data to third parties (CCPA).").optional()
|
|
159
|
+
}).describe("User consent states for data processing");
|
|
160
|
+
const BuyerConsentBuyerSchema = z$1.intersection(z$1.object({
|
|
161
|
+
"first_name": z$1.string().describe("First name of the buyer.").optional(),
|
|
162
|
+
"last_name": z$1.string().describe("Last name of the buyer.").optional(),
|
|
163
|
+
"email": z$1.string().describe("Email of the buyer.").optional(),
|
|
164
|
+
"phone_number": z$1.string().describe("E.164 standard.").optional()
|
|
165
|
+
}), z$1.object({ "consent": z$1.object({
|
|
166
|
+
"analytics": z$1.boolean().describe("Consent for analytics and performance tracking.").optional(),
|
|
167
|
+
"preferences": z$1.boolean().describe("Consent for storing user preferences.").optional(),
|
|
168
|
+
"marketing": z$1.boolean().describe("Consent for marketing communications.").optional(),
|
|
169
|
+
"sale_of_data": z$1.boolean().describe("Consent for selling data to third parties (CCPA).").optional()
|
|
170
|
+
}).describe("Consent tracking fields.").optional() })).describe("Buyer object extended with consent tracking.");
|
|
171
|
+
const CheckoutSchema = z$1.object({
|
|
172
|
+
"ucp": z$1.intersection(z$1.object({
|
|
173
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
174
|
+
"services": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
175
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
176
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
177
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
178
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
179
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
180
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({
|
|
181
|
+
"transport": z$1.enum([
|
|
182
|
+
"rest",
|
|
183
|
+
"mcp",
|
|
184
|
+
"a2a",
|
|
185
|
+
"embedded"
|
|
186
|
+
]).describe("Transport protocol for this service binding."),
|
|
187
|
+
"endpoint": z$1.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
188
|
+
})))).describe("Service registry keyed by reverse-domain name.").optional(),
|
|
189
|
+
"capabilities": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
190
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
191
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
192
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
193
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
194
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
195
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({ "extends": z$1.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
196
|
+
"payment_handlers": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
197
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
198
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
199
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
200
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
201
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
202
|
+
}).describe("Shared foundation for all UCP entities."), z$1.record(z$1.string(), z$1.unknown())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
203
|
+
}).describe("Base UCP metadata with shared properties for all schema types."), z$1.object({
|
|
204
|
+
"services": z$1.record(z$1.array(z$1.intersection(z$1.intersection(z$1.object({
|
|
205
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
206
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
207
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
208
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
209
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
210
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({
|
|
211
|
+
"transport": z$1.enum([
|
|
212
|
+
"rest",
|
|
213
|
+
"mcp",
|
|
214
|
+
"a2a",
|
|
215
|
+
"embedded"
|
|
216
|
+
]).describe("Transport protocol for this service binding."),
|
|
217
|
+
"endpoint": z$1.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
218
|
+
})), z$1.union([
|
|
219
|
+
z$1.object({ "transport": z$1.literal("rest").optional() }),
|
|
220
|
+
z$1.object({ "transport": z$1.literal("mcp").optional() }),
|
|
221
|
+
z$1.object({ "transport": z$1.literal("a2a").optional() }),
|
|
222
|
+
z$1.object({
|
|
223
|
+
"transport": z$1.literal("embedded").optional(),
|
|
224
|
+
"config": z$1.object({ "delegate": z$1.array(z$1.string()).describe("Delegations the business allows. At service-level, declares available delegations. In checkout responses, confirms accepted delegations for this session.").optional() }).describe("Per-checkout configuration for embedded transport binding. Allows businesses to vary ECP availability and delegations based on cart contents, agent authorization, or policy.").optional()
|
|
225
|
+
})
|
|
226
|
+
])).describe("Service binding in API responses. Includes per-resource transport configuration via typed config."))).optional(),
|
|
227
|
+
"capabilities": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
228
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
229
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
230
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
231
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
232
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
233
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({ "extends": z$1.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })).describe("Capability reference in responses. Only name/version required to confirm active capabilities."))).optional(),
|
|
234
|
+
"payment_handlers": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
235
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
236
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
237
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
238
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
239
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
240
|
+
}).describe("Shared foundation for all UCP entities."), z$1.record(z$1.string(), z$1.unknown())).describe("Handler reference in responses. May include full config state for runtime usage of the handler.")))
|
|
241
|
+
})).describe("UCP metadata for checkout responses."),
|
|
242
|
+
"id": z$1.string().describe("Unique identifier of the checkout session."),
|
|
243
|
+
"line_items": z$1.array(z$1.object({
|
|
244
|
+
"id": z$1.string(),
|
|
245
|
+
"item": z$1.object({
|
|
246
|
+
"id": z$1.string().describe("Should be recognized by both the Platform, and the Business. For Google it should match the id provided in the \"id\" field in the product feed."),
|
|
247
|
+
"title": z$1.string().describe("Product title."),
|
|
248
|
+
"price": z$1.number().int().gte(0).describe("Unit price in minor (cents) currency units."),
|
|
249
|
+
"image_url": z$1.string().url().describe("Product image URI.").optional()
|
|
250
|
+
}),
|
|
251
|
+
"quantity": z$1.number().int().gte(1).describe("Quantity of the item being purchased."),
|
|
252
|
+
"totals": z$1.array(z$1.object({
|
|
253
|
+
"type": z$1.enum([
|
|
254
|
+
"items_discount",
|
|
255
|
+
"subtotal",
|
|
256
|
+
"discount",
|
|
257
|
+
"fulfillment",
|
|
258
|
+
"tax",
|
|
259
|
+
"fee",
|
|
260
|
+
"total"
|
|
261
|
+
]).describe("Type of total categorization."),
|
|
262
|
+
"display_text": z$1.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
263
|
+
"amount": z$1.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
264
|
+
})).describe("Line item totals breakdown."),
|
|
265
|
+
"parent_id": z$1.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
266
|
+
}).describe("Line item object. Expected to use the currency of the parent object.")).describe("List of line items being checked out."),
|
|
267
|
+
"buyer": z$1.object({
|
|
268
|
+
"first_name": z$1.string().describe("First name of the buyer.").optional(),
|
|
269
|
+
"last_name": z$1.string().describe("Last name of the buyer.").optional(),
|
|
270
|
+
"email": z$1.string().describe("Email of the buyer.").optional(),
|
|
271
|
+
"phone_number": z$1.string().describe("E.164 standard.").optional()
|
|
272
|
+
}).describe("Representation of the buyer.").optional(),
|
|
273
|
+
"context": z$1.object({
|
|
274
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used. Optional hint for market context (currency, availability, pricing)—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
275
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. For example, California or another appropriate first-level Administrative division. Optional hint for progressive localization—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
276
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043. Optional hint for regional refinement—higher-resolution data (e.g., shipping address) supersedes this value.").optional()
|
|
277
|
+
}).describe("Provisional buyer signals for relevance and localization: product availability, pricing, currency, tax, shipping, payment methods, and eligibility (e.g., student or affiliation discounts). Businesses SHOULD use these values when authoritative data (e.g., address) is absent, and MAY ignore unsupported values without returning errors. Context can be disclosed progressively—coarse signals early, finer resolution as the session progresses. Higher-resolution data (shipping address, billing address) supersedes context. Platforms SHOULD progressively enhance context throughout the buyer journey.").optional(),
|
|
278
|
+
"status": z$1.enum([
|
|
279
|
+
"incomplete",
|
|
280
|
+
"requires_escalation",
|
|
281
|
+
"ready_for_complete",
|
|
282
|
+
"complete_in_progress",
|
|
283
|
+
"completed",
|
|
284
|
+
"canceled"
|
|
285
|
+
]).describe("Checkout state indicating the current phase and required action. See Checkout Status lifecycle documentation for state transition details."),
|
|
286
|
+
"currency": z$1.string().describe("ISO 4217 currency code reflecting the merchant's market determination. Derived from address, context, and geo IP—buyers provide signals, merchants determine currency."),
|
|
287
|
+
"totals": z$1.array(z$1.object({
|
|
288
|
+
"type": z$1.enum([
|
|
289
|
+
"items_discount",
|
|
290
|
+
"subtotal",
|
|
291
|
+
"discount",
|
|
292
|
+
"fulfillment",
|
|
293
|
+
"tax",
|
|
294
|
+
"fee",
|
|
295
|
+
"total"
|
|
296
|
+
]).describe("Type of total categorization."),
|
|
297
|
+
"display_text": z$1.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
298
|
+
"amount": z$1.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
299
|
+
})).describe("Different cart totals."),
|
|
300
|
+
"messages": z$1.array(z$1.record(z$1.string(), z$1.unknown()).and(z$1.unknown().superRefine((x, ctx) => {
|
|
301
|
+
const schemas = [
|
|
302
|
+
z$1.object({
|
|
303
|
+
"type": z$1.literal("error").describe("Message type discriminator."),
|
|
304
|
+
"code": z$1.string().describe("Error code. Possible values include: missing, invalid, out_of_stock, payment_declined, requires_sign_in, requires_3ds, requires_identity_linking. Freeform codes also allowed."),
|
|
305
|
+
"path": z$1.string().describe("RFC 9535 JSONPath to the component the message refers to (e.g., $.items[1]).").optional(),
|
|
306
|
+
"content_type": z$1.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
307
|
+
"content": z$1.string().describe("Human-readable message."),
|
|
308
|
+
"severity": z$1.enum([
|
|
309
|
+
"recoverable",
|
|
310
|
+
"requires_buyer_input",
|
|
311
|
+
"requires_buyer_review"
|
|
312
|
+
]).describe("Declares who resolves this error. 'recoverable': agent can fix via API. 'requires_buyer_input': merchant requires information their API doesn't support collecting programmatically (checkout incomplete). 'requires_buyer_review': buyer must authorize before order placement due to policy, regulatory, or entitlement rules (checkout complete). Errors with 'requires_*' severity contribute to 'status: requires_escalation'.")
|
|
313
|
+
}),
|
|
314
|
+
z$1.object({
|
|
315
|
+
"type": z$1.literal("warning").describe("Message type discriminator."),
|
|
316
|
+
"path": z$1.string().describe("JSONPath (RFC 9535) to related field (e.g., $.line_items[0]).").optional(),
|
|
317
|
+
"code": z$1.string().describe("Warning code. Machine-readable identifier for the warning type (e.g., final_sale, prop65, fulfillment_changed, age_restricted, etc.)."),
|
|
318
|
+
"content": z$1.string().describe("Human-readable warning message that MUST be displayed."),
|
|
319
|
+
"content_type": z$1.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain")
|
|
320
|
+
}),
|
|
321
|
+
z$1.object({
|
|
322
|
+
"type": z$1.literal("info").describe("Message type discriminator."),
|
|
323
|
+
"path": z$1.string().describe("RFC 9535 JSONPath to the component the message refers to.").optional(),
|
|
324
|
+
"code": z$1.string().describe("Info code for programmatic handling.").optional(),
|
|
325
|
+
"content_type": z$1.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
326
|
+
"content": z$1.string().describe("Human-readable message.")
|
|
327
|
+
})
|
|
328
|
+
];
|
|
329
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
330
|
+
const passed = schemas.length - errors.length;
|
|
331
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
332
|
+
path: ctx.path,
|
|
333
|
+
code: "invalid_union",
|
|
334
|
+
unionErrors: errors,
|
|
335
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
336
|
+
} : {
|
|
337
|
+
path: ctx.path,
|
|
338
|
+
code: "custom",
|
|
339
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
340
|
+
});
|
|
341
|
+
})).describe("Container for error, warning, or info messages.")).describe("List of messages with error and info about the checkout session state.").optional(),
|
|
342
|
+
"links": z$1.array(z$1.object({
|
|
343
|
+
"type": z$1.string().describe("Type of link. Well-known values: `privacy_policy`, `terms_of_service`, `refund_policy`, `shipping_policy`, `faq`. Consumers SHOULD handle unknown values gracefully by displaying them using the `title` field or omitting the link."),
|
|
344
|
+
"url": z$1.string().url().describe("The actual URL pointing to the content to be displayed."),
|
|
345
|
+
"title": z$1.string().describe("Optional display text for the link. When provided, use this instead of generating from type.").optional()
|
|
346
|
+
})).describe("Links to be displayed by the platform (Privacy Policy, TOS). Mandatory for legal compliance."),
|
|
347
|
+
"expires_at": z$1.string().datetime({ offset: true }).describe("RFC 3339 expiry timestamp. Default TTL is 6 hours from creation if not sent.").optional(),
|
|
348
|
+
"continue_url": z$1.string().url().describe("URL for checkout handoff and session recovery. MUST be provided when status is requires_escalation. See specification for format and availability requirements.").optional(),
|
|
349
|
+
"payment": z$1.object({ "instruments": z$1.array(z$1.intersection(z$1.object({
|
|
350
|
+
"id": z$1.string().describe("A unique identifier for this instrument instance, assigned by the platform."),
|
|
351
|
+
"handler_id": z$1.string().describe("The unique identifier for the handler instance that produced this instrument. This corresponds to the 'id' field in the Payment Handler definition."),
|
|
352
|
+
"type": z$1.string().describe("The broad category of the instrument (e.g., 'card', 'tokenized_card'). Specific schemas will constrain this to a constant value."),
|
|
353
|
+
"billing_address": z$1.object({
|
|
354
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
355
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
356
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
357
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
358
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
359
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
360
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
361
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
362
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
363
|
+
}).describe("The billing address associated with this payment method.").optional(),
|
|
364
|
+
"credential": z$1.object({ "type": z$1.string().describe("The credential type discriminator. Specific schemas will constrain this to a constant value.") }).describe("The base definition for any payment credential. Handlers define specific credential types.").optional(),
|
|
365
|
+
"display": z$1.record(z$1.string(), z$1.unknown()).describe("Display information for this payment instrument. Each payment instrument schema defines its specific display properties, as outlined by the payment handler.").optional()
|
|
366
|
+
}).describe("The base definition for any payment instrument. It links the instrument to a specific payment handler."), z$1.object({ "selected": z$1.boolean().describe("Whether this instrument is selected by the user.").optional() })).describe("A payment instrument with selection state.")).describe("The payment instruments available for this payment. Each instrument is associated with a specific handler via the handler_id field. Handlers can extend the base payment_instrument schema to add handler-specific fields.").optional() }).describe("Payment configuration containing handlers.").optional(),
|
|
367
|
+
"order": z$1.object({
|
|
368
|
+
"id": z$1.string().describe("Unique order identifier."),
|
|
369
|
+
"permalink_url": z$1.string().url().describe("Permalink to access the order on merchant site.")
|
|
370
|
+
}).describe("Details about an order created for this checkout session.").optional()
|
|
371
|
+
}).describe("Base checkout schema. Extensions compose onto this using allOf.");
|
|
372
|
+
const CheckoutCreateRequestSchema = z$1.object({
|
|
373
|
+
"line_items": z$1.array(z$1.object({
|
|
374
|
+
"id": z$1.string(),
|
|
375
|
+
"item": z$1.object({
|
|
376
|
+
"id": z$1.string().describe("Should be recognized by both the Platform, and the Business. For Google it should match the id provided in the \"id\" field in the product feed."),
|
|
377
|
+
"title": z$1.string().describe("Product title."),
|
|
378
|
+
"price": z$1.number().int().gte(0).describe("Unit price in minor (cents) currency units."),
|
|
379
|
+
"image_url": z$1.string().url().describe("Product image URI.").optional()
|
|
380
|
+
}),
|
|
381
|
+
"quantity": z$1.number().int().gte(1).describe("Quantity of the item being purchased."),
|
|
382
|
+
"totals": z$1.array(z$1.object({
|
|
383
|
+
"type": z$1.enum([
|
|
384
|
+
"items_discount",
|
|
385
|
+
"subtotal",
|
|
386
|
+
"discount",
|
|
387
|
+
"fulfillment",
|
|
388
|
+
"tax",
|
|
389
|
+
"fee",
|
|
390
|
+
"total"
|
|
391
|
+
]).describe("Type of total categorization."),
|
|
392
|
+
"display_text": z$1.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
393
|
+
"amount": z$1.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
394
|
+
})).describe("Line item totals breakdown."),
|
|
395
|
+
"parent_id": z$1.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
396
|
+
}).describe("Line item object. Expected to use the currency of the parent object.")).describe("List of line items being checked out."),
|
|
397
|
+
"buyer": z$1.object({
|
|
398
|
+
"first_name": z$1.string().describe("First name of the buyer.").optional(),
|
|
399
|
+
"last_name": z$1.string().describe("Last name of the buyer.").optional(),
|
|
400
|
+
"email": z$1.string().describe("Email of the buyer.").optional(),
|
|
401
|
+
"phone_number": z$1.string().describe("E.164 standard.").optional()
|
|
402
|
+
}).describe("Representation of the buyer.").optional(),
|
|
403
|
+
"context": z$1.object({
|
|
404
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used. Optional hint for market context (currency, availability, pricing)—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
405
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. For example, California or another appropriate first-level Administrative division. Optional hint for progressive localization—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
406
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043. Optional hint for regional refinement—higher-resolution data (e.g., shipping address) supersedes this value.").optional()
|
|
407
|
+
}).describe("Provisional buyer signals for relevance and localization: product availability, pricing, currency, tax, shipping, payment methods, and eligibility (e.g., student or affiliation discounts). Businesses SHOULD use these values when authoritative data (e.g., address) is absent, and MAY ignore unsupported values without returning errors. Context can be disclosed progressively—coarse signals early, finer resolution as the session progresses. Higher-resolution data (shipping address, billing address) supersedes context. Platforms SHOULD progressively enhance context throughout the buyer journey.").optional(),
|
|
408
|
+
"payment": z$1.object({ "instruments": z$1.array(z$1.intersection(z$1.object({
|
|
409
|
+
"id": z$1.string().describe("A unique identifier for this instrument instance, assigned by the platform."),
|
|
410
|
+
"handler_id": z$1.string().describe("The unique identifier for the handler instance that produced this instrument. This corresponds to the 'id' field in the Payment Handler definition."),
|
|
411
|
+
"type": z$1.string().describe("The broad category of the instrument (e.g., 'card', 'tokenized_card'). Specific schemas will constrain this to a constant value."),
|
|
412
|
+
"billing_address": z$1.object({
|
|
413
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
414
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
415
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
416
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
417
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
418
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
419
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
420
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
421
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
422
|
+
}).describe("The billing address associated with this payment method.").optional(),
|
|
423
|
+
"credential": z$1.object({ "type": z$1.string().describe("The credential type discriminator. Specific schemas will constrain this to a constant value.") }).describe("The base definition for any payment credential. Handlers define specific credential types.").optional(),
|
|
424
|
+
"display": z$1.record(z$1.string(), z$1.unknown()).describe("Display information for this payment instrument. Each payment instrument schema defines its specific display properties, as outlined by the payment handler.").optional()
|
|
425
|
+
}).describe("The base definition for any payment instrument. It links the instrument to a specific payment handler."), z$1.object({ "selected": z$1.boolean().describe("Whether this instrument is selected by the user.").optional() })).describe("A payment instrument with selection state.")).describe("The payment instruments available for this payment. Each instrument is associated with a specific handler via the handler_id field. Handlers can extend the base payment_instrument schema to add handler-specific fields.").optional() }).describe("Payment configuration containing handlers.").optional()
|
|
426
|
+
}).strict();
|
|
427
|
+
const CheckoutUpdateRequestSchema = z$1.object({
|
|
428
|
+
"id": z$1.string().describe("Unique identifier of the checkout session."),
|
|
429
|
+
"line_items": z$1.array(z$1.object({
|
|
430
|
+
"id": z$1.string(),
|
|
431
|
+
"item": z$1.object({
|
|
432
|
+
"id": z$1.string().describe("Should be recognized by both the Platform, and the Business. For Google it should match the id provided in the \"id\" field in the product feed."),
|
|
433
|
+
"title": z$1.string().describe("Product title."),
|
|
434
|
+
"price": z$1.number().int().gte(0).describe("Unit price in minor (cents) currency units."),
|
|
435
|
+
"image_url": z$1.string().url().describe("Product image URI.").optional()
|
|
436
|
+
}),
|
|
437
|
+
"quantity": z$1.number().int().gte(1).describe("Quantity of the item being purchased."),
|
|
438
|
+
"totals": z$1.array(z$1.object({
|
|
439
|
+
"type": z$1.enum([
|
|
440
|
+
"items_discount",
|
|
441
|
+
"subtotal",
|
|
442
|
+
"discount",
|
|
443
|
+
"fulfillment",
|
|
444
|
+
"tax",
|
|
445
|
+
"fee",
|
|
446
|
+
"total"
|
|
447
|
+
]).describe("Type of total categorization."),
|
|
448
|
+
"display_text": z$1.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
449
|
+
"amount": z$1.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
450
|
+
})).describe("Line item totals breakdown."),
|
|
451
|
+
"parent_id": z$1.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
452
|
+
}).describe("Line item object. Expected to use the currency of the parent object.")).describe("List of line items being checked out."),
|
|
453
|
+
"buyer": z$1.object({
|
|
454
|
+
"first_name": z$1.string().describe("First name of the buyer.").optional(),
|
|
455
|
+
"last_name": z$1.string().describe("Last name of the buyer.").optional(),
|
|
456
|
+
"email": z$1.string().describe("Email of the buyer.").optional(),
|
|
457
|
+
"phone_number": z$1.string().describe("E.164 standard.").optional()
|
|
458
|
+
}).describe("Representation of the buyer.").optional(),
|
|
459
|
+
"context": z$1.object({
|
|
460
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used. Optional hint for market context (currency, availability, pricing)—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
461
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. For example, California or another appropriate first-level Administrative division. Optional hint for progressive localization—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
462
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043. Optional hint for regional refinement—higher-resolution data (e.g., shipping address) supersedes this value.").optional()
|
|
463
|
+
}).describe("Provisional buyer signals for relevance and localization: product availability, pricing, currency, tax, shipping, payment methods, and eligibility (e.g., student or affiliation discounts). Businesses SHOULD use these values when authoritative data (e.g., address) is absent, and MAY ignore unsupported values without returning errors. Context can be disclosed progressively—coarse signals early, finer resolution as the session progresses. Higher-resolution data (shipping address, billing address) supersedes context. Platforms SHOULD progressively enhance context throughout the buyer journey.").optional(),
|
|
464
|
+
"payment": z$1.object({ "instruments": z$1.array(z$1.intersection(z$1.object({
|
|
465
|
+
"id": z$1.string().describe("A unique identifier for this instrument instance, assigned by the platform."),
|
|
466
|
+
"handler_id": z$1.string().describe("The unique identifier for the handler instance that produced this instrument. This corresponds to the 'id' field in the Payment Handler definition."),
|
|
467
|
+
"type": z$1.string().describe("The broad category of the instrument (e.g., 'card', 'tokenized_card'). Specific schemas will constrain this to a constant value."),
|
|
468
|
+
"billing_address": z$1.object({
|
|
469
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
470
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
471
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
472
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
473
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
474
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
475
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
476
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
477
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
478
|
+
}).describe("The billing address associated with this payment method.").optional(),
|
|
479
|
+
"credential": z$1.object({ "type": z$1.string().describe("The credential type discriminator. Specific schemas will constrain this to a constant value.") }).describe("The base definition for any payment credential. Handlers define specific credential types.").optional(),
|
|
480
|
+
"display": z$1.record(z$1.string(), z$1.unknown()).describe("Display information for this payment instrument. Each payment instrument schema defines its specific display properties, as outlined by the payment handler.").optional()
|
|
481
|
+
}).describe("The base definition for any payment instrument. It links the instrument to a specific payment handler."), z$1.object({ "selected": z$1.boolean().describe("Whether this instrument is selected by the user.").optional() })).describe("A payment instrument with selection state.")).describe("The payment instruments available for this payment. Each instrument is associated with a specific handler via the handler_id field. Handlers can extend the base payment_instrument schema to add handler-specific fields.").optional() }).describe("Payment configuration containing handlers.").optional()
|
|
482
|
+
}).strict();
|
|
483
|
+
const CheckoutCompleteRequestSchema = z$1.object({ "payment": z$1.object({ "instruments": z$1.array(z$1.intersection(z$1.object({
|
|
484
|
+
"id": z$1.string().describe("A unique identifier for this instrument instance, assigned by the platform."),
|
|
485
|
+
"handler_id": z$1.string().describe("The unique identifier for the handler instance that produced this instrument. This corresponds to the 'id' field in the Payment Handler definition."),
|
|
486
|
+
"type": z$1.string().describe("The broad category of the instrument (e.g., 'card', 'tokenized_card'). Specific schemas will constrain this to a constant value."),
|
|
487
|
+
"billing_address": z$1.object({
|
|
488
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
489
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
490
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
491
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
492
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
493
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
494
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
495
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
496
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
497
|
+
}).describe("The billing address associated with this payment method.").optional(),
|
|
498
|
+
"credential": z$1.object({ "type": z$1.string().describe("The credential type discriminator. Specific schemas will constrain this to a constant value.") }).describe("The base definition for any payment credential. Handlers define specific credential types.").optional(),
|
|
499
|
+
"display": z$1.record(z$1.string(), z$1.unknown()).describe("Display information for this payment instrument. Each payment instrument schema defines its specific display properties, as outlined by the payment handler.").optional()
|
|
500
|
+
}).describe("The base definition for any payment instrument. It links the instrument to a specific payment handler."), z$1.object({ "selected": z$1.boolean().describe("Whether this instrument is selected by the user.").optional() })).describe("A payment instrument with selection state.")).describe("The payment instruments available for this payment. Each instrument is associated with a specific handler via the handler_id field. Handlers can extend the base payment_instrument schema to add handler-specific fields.").optional() }).describe("Payment configuration containing handlers.") }).strict();
|
|
501
|
+
const DiscountAllocationSchema = z$1.object({
|
|
502
|
+
"path": z$1.string().describe("JSONPath to the allocation target (e.g., '$.line_items[0]', '$.totals.shipping')."),
|
|
503
|
+
"amount": z$1.number().int().gte(0).describe("Amount allocated to this target in minor (cents) currency units.")
|
|
504
|
+
}).describe("Breakdown of how a discount amount was allocated to a specific target.");
|
|
505
|
+
const DiscountAppliedDiscountSchema = z$1.object({
|
|
506
|
+
"code": z$1.string().describe("The discount code. Omitted for automatic discounts.").optional(),
|
|
507
|
+
"title": z$1.string().describe("Human-readable discount name (e.g., 'Summer Sale 20% Off')."),
|
|
508
|
+
"amount": z$1.number().int().gte(0).describe("Total discount amount in minor (cents) currency units."),
|
|
509
|
+
"automatic": z$1.boolean().describe("True if applied automatically by merchant rules (no code required).").default(false),
|
|
510
|
+
"method": z$1.enum(["each", "across"]).describe("Allocation method. 'each' = applied independently per item. 'across' = split proportionally by value.").optional(),
|
|
511
|
+
"priority": z$1.number().int().gte(1).describe("Stacking order for discount calculation. Lower numbers applied first (1 = first).").optional(),
|
|
512
|
+
"allocations": z$1.array(z$1.object({
|
|
513
|
+
"path": z$1.string().describe("JSONPath to the allocation target (e.g., '$.line_items[0]', '$.totals.shipping')."),
|
|
514
|
+
"amount": z$1.number().int().gte(0).describe("Amount allocated to this target in minor (cents) currency units.")
|
|
515
|
+
}).describe("Breakdown of how a discount amount was allocated to a specific target.")).describe("Breakdown of where this discount was allocated. Sum of allocation amounts equals total amount.").optional()
|
|
516
|
+
}).describe("A discount that was successfully applied.");
|
|
517
|
+
const DiscountDiscountsObjectSchema = z$1.object({
|
|
518
|
+
"codes": z$1.array(z$1.string()).describe("Discount codes to apply. Case-insensitive. Replaces previously submitted codes. Send empty array to clear.").optional(),
|
|
519
|
+
"applied": z$1.array(z$1.object({
|
|
520
|
+
"code": z$1.string().describe("The discount code. Omitted for automatic discounts.").optional(),
|
|
521
|
+
"title": z$1.string().describe("Human-readable discount name (e.g., 'Summer Sale 20% Off')."),
|
|
522
|
+
"amount": z$1.number().int().gte(0).describe("Total discount amount in minor (cents) currency units."),
|
|
523
|
+
"automatic": z$1.boolean().describe("True if applied automatically by merchant rules (no code required).").default(false),
|
|
524
|
+
"method": z$1.enum(["each", "across"]).describe("Allocation method. 'each' = applied independently per item. 'across' = split proportionally by value.").optional(),
|
|
525
|
+
"priority": z$1.number().int().gte(1).describe("Stacking order for discount calculation. Lower numbers applied first (1 = first).").optional(),
|
|
526
|
+
"allocations": z$1.array(z$1.object({
|
|
527
|
+
"path": z$1.string().describe("JSONPath to the allocation target (e.g., '$.line_items[0]', '$.totals.shipping')."),
|
|
528
|
+
"amount": z$1.number().int().gte(0).describe("Amount allocated to this target in minor (cents) currency units.")
|
|
529
|
+
}).describe("Breakdown of how a discount amount was allocated to a specific target.")).describe("Breakdown of where this discount was allocated. Sum of allocation amounts equals total amount.").optional()
|
|
530
|
+
}).describe("A discount that was successfully applied.")).describe("Discounts successfully applied (code-based and automatic).").readonly().optional()
|
|
531
|
+
}).describe("Discount codes input and applied discounts output.");
|
|
532
|
+
const FulfillmentExtensionFulfillmentOptionSchema = z$1.object({
|
|
533
|
+
"id": z$1.string().describe("Unique fulfillment option identifier."),
|
|
534
|
+
"title": z$1.string().describe("Short label (e.g., 'Express Shipping', 'Curbside Pickup')."),
|
|
535
|
+
"description": z$1.string().describe("Complete context for buyer decision (e.g., 'Arrives Dec 12-15 via FedEx').").optional(),
|
|
536
|
+
"carrier": z$1.string().describe("Carrier name (for shipping).").optional(),
|
|
537
|
+
"earliest_fulfillment_time": z$1.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
538
|
+
"latest_fulfillment_time": z$1.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
539
|
+
"totals": z$1.array(z$1.object({
|
|
540
|
+
"type": z$1.enum([
|
|
541
|
+
"items_discount",
|
|
542
|
+
"subtotal",
|
|
543
|
+
"discount",
|
|
544
|
+
"fulfillment",
|
|
545
|
+
"tax",
|
|
546
|
+
"fee",
|
|
547
|
+
"total"
|
|
548
|
+
]).describe("Type of total categorization."),
|
|
549
|
+
"display_text": z$1.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
550
|
+
"amount": z$1.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
551
|
+
})).describe("Fulfillment option totals breakdown.")
|
|
552
|
+
}).describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).");
|
|
553
|
+
const FulfillmentExtensionFulfillmentGroupSchema = z$1.object({
|
|
554
|
+
"id": z$1.string().describe("Group identifier for referencing merchant-generated groups in updates."),
|
|
555
|
+
"line_item_ids": z$1.array(z$1.string()).describe("Line item IDs included in this group/package."),
|
|
556
|
+
"options": z$1.array(z$1.object({
|
|
557
|
+
"id": z$1.string().describe("Unique fulfillment option identifier."),
|
|
558
|
+
"title": z$1.string().describe("Short label (e.g., 'Express Shipping', 'Curbside Pickup')."),
|
|
559
|
+
"description": z$1.string().describe("Complete context for buyer decision (e.g., 'Arrives Dec 12-15 via FedEx').").optional(),
|
|
560
|
+
"carrier": z$1.string().describe("Carrier name (for shipping).").optional(),
|
|
561
|
+
"earliest_fulfillment_time": z$1.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
562
|
+
"latest_fulfillment_time": z$1.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
563
|
+
"totals": z$1.array(z$1.object({
|
|
564
|
+
"type": z$1.enum([
|
|
565
|
+
"items_discount",
|
|
566
|
+
"subtotal",
|
|
567
|
+
"discount",
|
|
568
|
+
"fulfillment",
|
|
569
|
+
"tax",
|
|
570
|
+
"fee",
|
|
571
|
+
"total"
|
|
572
|
+
]).describe("Type of total categorization."),
|
|
573
|
+
"display_text": z$1.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
574
|
+
"amount": z$1.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
575
|
+
})).describe("Fulfillment option totals breakdown.")
|
|
576
|
+
}).describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).")).describe("Available fulfillment options for this group.").optional(),
|
|
577
|
+
"selected_option_id": z$1.union([z$1.string().describe("ID of the selected fulfillment option for this group."), z$1.null().describe("ID of the selected fulfillment option for this group.")]).describe("ID of the selected fulfillment option for this group.").optional()
|
|
578
|
+
}).describe("A merchant-generated package/group of line items with fulfillment options.");
|
|
579
|
+
const FulfillmentExtensionFulfillmentMethodSchema = z$1.object({
|
|
580
|
+
"id": z$1.string().describe("Unique fulfillment method identifier."),
|
|
581
|
+
"type": z$1.enum(["shipping", "pickup"]).describe("Fulfillment method type."),
|
|
582
|
+
"line_item_ids": z$1.array(z$1.string()).describe("Line item IDs fulfilled via this method."),
|
|
583
|
+
"destinations": z$1.array(z$1.record(z$1.string(), z$1.unknown()).and(z$1.unknown().superRefine((x, ctx) => {
|
|
584
|
+
const schemas = [z$1.record(z$1.string(), z$1.unknown()).and(z$1.intersection(z$1.object({
|
|
585
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
586
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
587
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
588
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
589
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
590
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
591
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
592
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
593
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
594
|
+
}), z$1.object({ "id": z$1.string().describe("ID specific to this shipping destination.") }))).describe("Shipping destination."), z$1.object({
|
|
595
|
+
"id": z$1.string().describe("Unique location identifier."),
|
|
596
|
+
"name": z$1.string().describe("Location name (e.g., store name)."),
|
|
597
|
+
"address": z$1.object({
|
|
598
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
599
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
600
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
601
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
602
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
603
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
604
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
605
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
606
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
607
|
+
}).describe("Physical address of the location.").optional()
|
|
608
|
+
}).describe("A pickup location (retail store, locker, etc.).")];
|
|
609
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
610
|
+
const passed = schemas.length - errors.length;
|
|
611
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
612
|
+
path: ctx.path,
|
|
613
|
+
code: "invalid_union",
|
|
614
|
+
unionErrors: errors,
|
|
615
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
616
|
+
} : {
|
|
617
|
+
path: ctx.path,
|
|
618
|
+
code: "custom",
|
|
619
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
620
|
+
});
|
|
621
|
+
})).describe("A destination for fulfillment.")).describe("Available destinations. For shipping: addresses. For pickup: retail locations.").optional(),
|
|
622
|
+
"selected_destination_id": z$1.union([z$1.string().describe("ID of the selected destination."), z$1.null().describe("ID of the selected destination.")]).describe("ID of the selected destination.").optional(),
|
|
623
|
+
"groups": z$1.array(z$1.object({
|
|
624
|
+
"id": z$1.string().describe("Group identifier for referencing merchant-generated groups in updates."),
|
|
625
|
+
"line_item_ids": z$1.array(z$1.string()).describe("Line item IDs included in this group/package."),
|
|
626
|
+
"options": z$1.array(z$1.object({
|
|
627
|
+
"id": z$1.string().describe("Unique fulfillment option identifier."),
|
|
628
|
+
"title": z$1.string().describe("Short label (e.g., 'Express Shipping', 'Curbside Pickup')."),
|
|
629
|
+
"description": z$1.string().describe("Complete context for buyer decision (e.g., 'Arrives Dec 12-15 via FedEx').").optional(),
|
|
630
|
+
"carrier": z$1.string().describe("Carrier name (for shipping).").optional(),
|
|
631
|
+
"earliest_fulfillment_time": z$1.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
632
|
+
"latest_fulfillment_time": z$1.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
633
|
+
"totals": z$1.array(z$1.object({
|
|
634
|
+
"type": z$1.enum([
|
|
635
|
+
"items_discount",
|
|
636
|
+
"subtotal",
|
|
637
|
+
"discount",
|
|
638
|
+
"fulfillment",
|
|
639
|
+
"tax",
|
|
640
|
+
"fee",
|
|
641
|
+
"total"
|
|
642
|
+
]).describe("Type of total categorization."),
|
|
643
|
+
"display_text": z$1.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
644
|
+
"amount": z$1.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
645
|
+
})).describe("Fulfillment option totals breakdown.")
|
|
646
|
+
}).describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).")).describe("Available fulfillment options for this group.").optional(),
|
|
647
|
+
"selected_option_id": z$1.union([z$1.string().describe("ID of the selected fulfillment option for this group."), z$1.null().describe("ID of the selected fulfillment option for this group.")]).describe("ID of the selected fulfillment option for this group.").optional()
|
|
648
|
+
}).describe("A merchant-generated package/group of line items with fulfillment options.")).describe("Fulfillment groups for selecting options. Agent sets selected_option_id on groups to choose shipping method.").optional()
|
|
649
|
+
}).describe("A fulfillment method (shipping or pickup) with destinations and groups.");
|
|
650
|
+
const FulfillmentExtensionFulfillmentAvailableMethodSchema = z$1.object({
|
|
651
|
+
"type": z$1.enum(["shipping", "pickup"]).describe("Fulfillment method type this availability applies to."),
|
|
652
|
+
"line_item_ids": z$1.array(z$1.string()).describe("Line items available for this fulfillment method."),
|
|
653
|
+
"fulfillable_on": z$1.union([z$1.string().describe("'now' for immediate availability, or ISO 8601 date for future (preorders, transfers)."), z$1.null().describe("'now' for immediate availability, or ISO 8601 date for future (preorders, transfers).")]).describe("'now' for immediate availability, or ISO 8601 date for future (preorders, transfers).").optional(),
|
|
654
|
+
"description": z$1.string().describe("Human-readable availability info (e.g., 'Available for pickup at Downtown Store today').").optional()
|
|
655
|
+
}).describe("Inventory availability hint for a fulfillment method type.");
|
|
656
|
+
const FulfillmentExtensionFulfillmentSchema = z$1.object({
|
|
657
|
+
"methods": z$1.array(z$1.object({
|
|
658
|
+
"id": z$1.string().describe("Unique fulfillment method identifier."),
|
|
659
|
+
"type": z$1.enum(["shipping", "pickup"]).describe("Fulfillment method type."),
|
|
660
|
+
"line_item_ids": z$1.array(z$1.string()).describe("Line item IDs fulfilled via this method."),
|
|
661
|
+
"destinations": z$1.array(z$1.record(z$1.string(), z$1.unknown()).and(z$1.unknown().superRefine((x, ctx) => {
|
|
662
|
+
const schemas = [z$1.record(z$1.string(), z$1.unknown()).and(z$1.intersection(z$1.object({
|
|
663
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
664
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
665
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
666
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
667
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
668
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
669
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
670
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
671
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
672
|
+
}), z$1.object({ "id": z$1.string().describe("ID specific to this shipping destination.") }))).describe("Shipping destination."), z$1.object({
|
|
673
|
+
"id": z$1.string().describe("Unique location identifier."),
|
|
674
|
+
"name": z$1.string().describe("Location name (e.g., store name)."),
|
|
675
|
+
"address": z$1.object({
|
|
676
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
677
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
678
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
679
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
680
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
681
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
682
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
683
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
684
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
685
|
+
}).describe("Physical address of the location.").optional()
|
|
686
|
+
}).describe("A pickup location (retail store, locker, etc.).")];
|
|
687
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
688
|
+
const passed = schemas.length - errors.length;
|
|
689
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
690
|
+
path: ctx.path,
|
|
691
|
+
code: "invalid_union",
|
|
692
|
+
unionErrors: errors,
|
|
693
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
694
|
+
} : {
|
|
695
|
+
path: ctx.path,
|
|
696
|
+
code: "custom",
|
|
697
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
698
|
+
});
|
|
699
|
+
})).describe("A destination for fulfillment.")).describe("Available destinations. For shipping: addresses. For pickup: retail locations.").optional(),
|
|
700
|
+
"selected_destination_id": z$1.union([z$1.string().describe("ID of the selected destination."), z$1.null().describe("ID of the selected destination.")]).describe("ID of the selected destination.").optional(),
|
|
701
|
+
"groups": z$1.array(z$1.object({
|
|
702
|
+
"id": z$1.string().describe("Group identifier for referencing merchant-generated groups in updates."),
|
|
703
|
+
"line_item_ids": z$1.array(z$1.string()).describe("Line item IDs included in this group/package."),
|
|
704
|
+
"options": z$1.array(z$1.object({
|
|
705
|
+
"id": z$1.string().describe("Unique fulfillment option identifier."),
|
|
706
|
+
"title": z$1.string().describe("Short label (e.g., 'Express Shipping', 'Curbside Pickup')."),
|
|
707
|
+
"description": z$1.string().describe("Complete context for buyer decision (e.g., 'Arrives Dec 12-15 via FedEx').").optional(),
|
|
708
|
+
"carrier": z$1.string().describe("Carrier name (for shipping).").optional(),
|
|
709
|
+
"earliest_fulfillment_time": z$1.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
710
|
+
"latest_fulfillment_time": z$1.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
711
|
+
"totals": z$1.array(z$1.object({
|
|
712
|
+
"type": z$1.enum([
|
|
713
|
+
"items_discount",
|
|
714
|
+
"subtotal",
|
|
715
|
+
"discount",
|
|
716
|
+
"fulfillment",
|
|
717
|
+
"tax",
|
|
718
|
+
"fee",
|
|
719
|
+
"total"
|
|
720
|
+
]).describe("Type of total categorization."),
|
|
721
|
+
"display_text": z$1.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
722
|
+
"amount": z$1.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
723
|
+
})).describe("Fulfillment option totals breakdown.")
|
|
724
|
+
}).describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).")).describe("Available fulfillment options for this group.").optional(),
|
|
725
|
+
"selected_option_id": z$1.union([z$1.string().describe("ID of the selected fulfillment option for this group."), z$1.null().describe("ID of the selected fulfillment option for this group.")]).describe("ID of the selected fulfillment option for this group.").optional()
|
|
726
|
+
}).describe("A merchant-generated package/group of line items with fulfillment options.")).describe("Fulfillment groups for selecting options. Agent sets selected_option_id on groups to choose shipping method.").optional()
|
|
727
|
+
}).describe("A fulfillment method (shipping or pickup) with destinations and groups.")).describe("Fulfillment methods for cart items.").optional(),
|
|
728
|
+
"available_methods": z$1.array(z$1.object({
|
|
729
|
+
"type": z$1.enum(["shipping", "pickup"]).describe("Fulfillment method type this availability applies to."),
|
|
730
|
+
"line_item_ids": z$1.array(z$1.string()).describe("Line items available for this fulfillment method."),
|
|
731
|
+
"fulfillable_on": z$1.union([z$1.string().describe("'now' for immediate availability, or ISO 8601 date for future (preorders, transfers)."), z$1.null().describe("'now' for immediate availability, or ISO 8601 date for future (preorders, transfers).")]).describe("'now' for immediate availability, or ISO 8601 date for future (preorders, transfers).").optional(),
|
|
732
|
+
"description": z$1.string().describe("Human-readable availability info (e.g., 'Available for pickup at Downtown Store today').").optional()
|
|
733
|
+
}).describe("Inventory availability hint for a fulfillment method type.")).describe("Inventory availability hints.").optional()
|
|
734
|
+
}).describe("Container for fulfillment methods and availability.");
|
|
735
|
+
const OrderSchema = z$1.object({
|
|
736
|
+
"ucp": z$1.intersection(z$1.object({
|
|
737
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
738
|
+
"services": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
739
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
740
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
741
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
742
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
743
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
744
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({
|
|
745
|
+
"transport": z$1.enum([
|
|
746
|
+
"rest",
|
|
747
|
+
"mcp",
|
|
748
|
+
"a2a",
|
|
749
|
+
"embedded"
|
|
750
|
+
]).describe("Transport protocol for this service binding."),
|
|
751
|
+
"endpoint": z$1.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
752
|
+
})))).describe("Service registry keyed by reverse-domain name.").optional(),
|
|
753
|
+
"capabilities": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
754
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
755
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
756
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
757
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
758
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
759
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({ "extends": z$1.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
760
|
+
"payment_handlers": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
761
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
762
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
763
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
764
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
765
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
766
|
+
}).describe("Shared foundation for all UCP entities."), z$1.record(z$1.string(), z$1.unknown())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
767
|
+
}).describe("Base UCP metadata with shared properties for all schema types."), z$1.object({ "capabilities": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
768
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
769
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
770
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
771
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
772
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
773
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({ "extends": z$1.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })).describe("Capability reference in responses. Only name/version required to confirm active capabilities."))).optional() })).describe("UCP metadata for order responses. No payment handlers needed post-purchase."),
|
|
774
|
+
"id": z$1.string().describe("Unique order identifier."),
|
|
775
|
+
"checkout_id": z$1.string().describe("Associated checkout ID for reconciliation."),
|
|
776
|
+
"permalink_url": z$1.string().url().describe("Permalink to access the order on merchant site."),
|
|
777
|
+
"line_items": z$1.array(z$1.object({
|
|
778
|
+
"id": z$1.string().describe("Line item identifier."),
|
|
779
|
+
"item": z$1.object({
|
|
780
|
+
"id": z$1.string().describe("Should be recognized by both the Platform, and the Business. For Google it should match the id provided in the \"id\" field in the product feed."),
|
|
781
|
+
"title": z$1.string().describe("Product title."),
|
|
782
|
+
"price": z$1.number().int().gte(0).describe("Unit price in minor (cents) currency units."),
|
|
783
|
+
"image_url": z$1.string().url().describe("Product image URI.").optional()
|
|
784
|
+
}).describe("Product data (id, title, price, image_url)."),
|
|
785
|
+
"quantity": z$1.object({
|
|
786
|
+
"total": z$1.number().int().gte(0).describe("Current total quantity."),
|
|
787
|
+
"fulfilled": z$1.number().int().gte(0).describe("Quantity fulfilled (sum from fulfillment events).")
|
|
788
|
+
}).describe("Quantity tracking. Both total and fulfilled are derived from events."),
|
|
789
|
+
"totals": z$1.array(z$1.object({
|
|
790
|
+
"type": z$1.enum([
|
|
791
|
+
"items_discount",
|
|
792
|
+
"subtotal",
|
|
793
|
+
"discount",
|
|
794
|
+
"fulfillment",
|
|
795
|
+
"tax",
|
|
796
|
+
"fee",
|
|
797
|
+
"total"
|
|
798
|
+
]).describe("Type of total categorization."),
|
|
799
|
+
"display_text": z$1.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
800
|
+
"amount": z$1.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
801
|
+
})).describe("Line item totals breakdown."),
|
|
802
|
+
"status": z$1.enum([
|
|
803
|
+
"processing",
|
|
804
|
+
"partial",
|
|
805
|
+
"fulfilled"
|
|
806
|
+
]).describe("Derived status: fulfilled if quantity.fulfilled == quantity.total, partial if quantity.fulfilled > 0, otherwise processing."),
|
|
807
|
+
"parent_id": z$1.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
808
|
+
})).describe("Immutable line items — source of truth for what was ordered."),
|
|
809
|
+
"fulfillment": z$1.object({
|
|
810
|
+
"expectations": z$1.array(z$1.object({
|
|
811
|
+
"id": z$1.string().describe("Expectation identifier."),
|
|
812
|
+
"line_items": z$1.array(z$1.object({
|
|
813
|
+
"id": z$1.string().describe("Line item ID reference."),
|
|
814
|
+
"quantity": z$1.number().int().gte(1).describe("Quantity of this item in this expectation.")
|
|
815
|
+
})).describe("Which line items and quantities are in this expectation."),
|
|
816
|
+
"method_type": z$1.enum([
|
|
817
|
+
"shipping",
|
|
818
|
+
"pickup",
|
|
819
|
+
"digital"
|
|
820
|
+
]).describe("Delivery method type (shipping, pickup, digital)."),
|
|
821
|
+
"destination": z$1.object({
|
|
822
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
823
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
824
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
825
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
826
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
827
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
828
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
829
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
830
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
831
|
+
}).describe("Delivery destination address."),
|
|
832
|
+
"description": z$1.string().describe("Human-readable delivery description (e.g., 'Arrives in 5-8 business days').").optional(),
|
|
833
|
+
"fulfillable_on": z$1.string().describe("When this expectation can be fulfilled: 'now' or ISO 8601 timestamp for future date (backorder, pre-order).").optional()
|
|
834
|
+
}).describe("Buyer-facing fulfillment expectation representing logical groupings of items (e.g., 'package'). Can be split, merged, or adjusted post-order to set buyer expectations for when/how items arrive.")).describe("Buyer-facing groups representing when/how items will be delivered. Can be split, merged, or adjusted post-order.").optional(),
|
|
835
|
+
"events": z$1.array(z$1.object({
|
|
836
|
+
"id": z$1.string().describe("Fulfillment event identifier."),
|
|
837
|
+
"occurred_at": z$1.string().datetime({ offset: true }).describe("RFC 3339 timestamp when this fulfillment event occurred."),
|
|
838
|
+
"type": z$1.string().describe("Fulfillment event type. Common values include: processing (preparing to ship), shipped (handed to carrier), in_transit (in delivery network), delivered (received by buyer), failed_attempt (delivery attempt failed), canceled (fulfillment canceled), undeliverable (cannot be delivered), returned_to_sender (returned to merchant)."),
|
|
839
|
+
"line_items": z$1.array(z$1.object({
|
|
840
|
+
"id": z$1.string().describe("Line item ID reference."),
|
|
841
|
+
"quantity": z$1.number().int().gte(1).describe("Quantity fulfilled in this event.")
|
|
842
|
+
})).describe("Which line items and quantities are fulfilled in this event."),
|
|
843
|
+
"tracking_number": z$1.string().describe("Carrier tracking number (required if type != processing).").optional(),
|
|
844
|
+
"tracking_url": z$1.string().url().describe("URL to track this shipment (required if type != processing).").optional(),
|
|
845
|
+
"carrier": z$1.string().describe("Carrier name (e.g., 'FedEx', 'USPS').").optional(),
|
|
846
|
+
"description": z$1.string().describe("Human-readable description of the shipment status or delivery information (e.g., 'Delivered to front door', 'Out for delivery').").optional()
|
|
847
|
+
}).describe("Append-only fulfillment event representing an actual shipment. References line items by ID.")).describe("Append-only event log of actual shipments. Each event references line items by ID.").optional()
|
|
848
|
+
}).describe("Fulfillment data: buyer expectations and what actually happened."),
|
|
849
|
+
"adjustments": z$1.array(z$1.object({
|
|
850
|
+
"id": z$1.string().describe("Adjustment event identifier."),
|
|
851
|
+
"type": z$1.string().describe("Type of adjustment (open string). Typically money-related like: refund, return, credit, price_adjustment, dispute, cancellation. Can be any value that makes sense for the merchant's business."),
|
|
852
|
+
"occurred_at": z$1.string().datetime({ offset: true }).describe("RFC 3339 timestamp when this adjustment occurred."),
|
|
853
|
+
"status": z$1.enum([
|
|
854
|
+
"pending",
|
|
855
|
+
"completed",
|
|
856
|
+
"failed"
|
|
857
|
+
]).describe("Adjustment status."),
|
|
858
|
+
"line_items": z$1.array(z$1.object({
|
|
859
|
+
"id": z$1.string().describe("Line item ID reference."),
|
|
860
|
+
"quantity": z$1.number().int().gte(1).describe("Quantity affected by this adjustment.")
|
|
861
|
+
})).describe("Which line items and quantities are affected (optional).").optional(),
|
|
862
|
+
"amount": z$1.number().int().describe("Amount in minor units (cents) for refunds, credits, price adjustments (optional).").optional(),
|
|
863
|
+
"description": z$1.string().describe("Human-readable reason or description (e.g., 'Defective item', 'Customer requested').").optional()
|
|
864
|
+
}).describe("Append-only event that exists independently of fulfillment. Typically represents money movements but can be any post-order change. Polymorphic type that can optionally reference line items.")).describe("Append-only event log of money movements (refunds, returns, credits, disputes, cancellations, etc.) that exist independently of fulfillment.").optional(),
|
|
865
|
+
"totals": z$1.array(z$1.object({
|
|
866
|
+
"type": z$1.enum([
|
|
867
|
+
"items_discount",
|
|
868
|
+
"subtotal",
|
|
869
|
+
"discount",
|
|
870
|
+
"fulfillment",
|
|
871
|
+
"tax",
|
|
872
|
+
"fee",
|
|
873
|
+
"total"
|
|
874
|
+
]).describe("Type of total categorization."),
|
|
875
|
+
"display_text": z$1.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
876
|
+
"amount": z$1.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
877
|
+
})).describe("Different totals for the order.")
|
|
878
|
+
}).describe("Order schema with immutable line items, buyer-facing fulfillment expectations, and append-only event logs.");
|
|
879
|
+
const PaymentSchema = z$1.object({ "instruments": z$1.array(z$1.intersection(z$1.object({
|
|
880
|
+
"id": z$1.string().describe("A unique identifier for this instrument instance, assigned by the platform."),
|
|
881
|
+
"handler_id": z$1.string().describe("The unique identifier for the handler instance that produced this instrument. This corresponds to the 'id' field in the Payment Handler definition."),
|
|
882
|
+
"type": z$1.string().describe("The broad category of the instrument (e.g., 'card', 'tokenized_card'). Specific schemas will constrain this to a constant value."),
|
|
883
|
+
"billing_address": z$1.object({
|
|
884
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
885
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
886
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
887
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
888
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
889
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
890
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
891
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
892
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
893
|
+
}).describe("The billing address associated with this payment method.").optional(),
|
|
894
|
+
"credential": z$1.object({ "type": z$1.string().describe("The credential type discriminator. Specific schemas will constrain this to a constant value.") }).describe("The base definition for any payment credential. Handlers define specific credential types.").optional(),
|
|
895
|
+
"display": z$1.record(z$1.string(), z$1.unknown()).describe("Display information for this payment instrument. Each payment instrument schema defines its specific display properties, as outlined by the payment handler.").optional()
|
|
896
|
+
}).describe("The base definition for any payment instrument. It links the instrument to a specific payment handler."), z$1.object({ "selected": z$1.boolean().describe("Whether this instrument is selected by the user.").optional() })).describe("A payment instrument with selection state.")).describe("The payment instruments available for this payment. Each instrument is associated with a specific handler via the handler_id field. Handlers can extend the base payment_instrument schema to add handler-specific fields.").optional() }).describe("Payment configuration containing handlers.");
|
|
897
|
+
const AccountInfoSchema = z$1.object({ "payment_account_reference": z$1.string().describe("EMVCo PAR. A unique identifier linking a payment card to a specific account, enabling tracking across tokens (Apple Pay, physical card, etc).").optional() }).describe("Non-sensitive backend identifiers for linking.");
|
|
898
|
+
const AdjustmentSchema = z$1.object({
|
|
899
|
+
"id": z$1.string().describe("Adjustment event identifier."),
|
|
900
|
+
"type": z$1.string().describe("Type of adjustment (open string). Typically money-related like: refund, return, credit, price_adjustment, dispute, cancellation. Can be any value that makes sense for the merchant's business."),
|
|
901
|
+
"occurred_at": z$1.string().datetime({ offset: true }).describe("RFC 3339 timestamp when this adjustment occurred."),
|
|
902
|
+
"status": z$1.enum([
|
|
903
|
+
"pending",
|
|
904
|
+
"completed",
|
|
905
|
+
"failed"
|
|
906
|
+
]).describe("Adjustment status."),
|
|
907
|
+
"line_items": z$1.array(z$1.object({
|
|
908
|
+
"id": z$1.string().describe("Line item ID reference."),
|
|
909
|
+
"quantity": z$1.number().int().gte(1).describe("Quantity affected by this adjustment.")
|
|
910
|
+
})).describe("Which line items and quantities are affected (optional).").optional(),
|
|
911
|
+
"amount": z$1.number().int().describe("Amount in minor units (cents) for refunds, credits, price adjustments (optional).").optional(),
|
|
912
|
+
"description": z$1.string().describe("Human-readable reason or description (e.g., 'Defective item', 'Customer requested').").optional()
|
|
913
|
+
}).describe("Append-only event that exists independently of fulfillment. Typically represents money movements but can be any post-order change. Polymorphic type that can optionally reference line items.");
|
|
914
|
+
const BindingSchema = z$1.object({
|
|
915
|
+
"checkout_id": z$1.string().describe("The checkout session identifier this token is bound to."),
|
|
916
|
+
"identity": z$1.object({ "access_token": z$1.string().describe("Unique identifier for this participant, obtained during onboarding with the tokenizer.") }).describe("The participant this token is bound to. Required when acting on behalf of another participant (e.g., agent tokenizing for merchant). Omit when the authenticated caller is the binding target.").optional()
|
|
917
|
+
}).describe("Binds a token to a specific checkout session and participant. Prevents token reuse across different checkouts or participants.");
|
|
918
|
+
const BusinessFulfillmentConfigSchema = z$1.object({
|
|
919
|
+
"allows_multi_destination": z$1.object({
|
|
920
|
+
"shipping": z$1.boolean().describe("Multiple shipping destinations allowed.").optional(),
|
|
921
|
+
"pickup": z$1.boolean().describe("Multiple pickup locations allowed.").optional()
|
|
922
|
+
}).strict().describe("Permits multiple destinations per method type.").optional(),
|
|
923
|
+
"allows_method_combinations": z$1.array(z$1.array(z$1.enum(["shipping", "pickup"]))).describe("Allowed method type combinations.").optional()
|
|
924
|
+
}).describe("Business's fulfillment configuration.");
|
|
925
|
+
const BuyerSchema = z$1.object({
|
|
926
|
+
"first_name": z$1.string().describe("First name of the buyer.").optional(),
|
|
927
|
+
"last_name": z$1.string().describe("Last name of the buyer.").optional(),
|
|
928
|
+
"email": z$1.string().describe("Email of the buyer.").optional(),
|
|
929
|
+
"phone_number": z$1.string().describe("E.164 standard.").optional()
|
|
930
|
+
});
|
|
931
|
+
const CardCredentialSchema = z$1.intersection(z$1.object({ "type": z$1.string().describe("The credential type discriminator. Specific schemas will constrain this to a constant value.") }).describe("The base definition for any payment credential. Handlers define specific credential types."), z$1.object({
|
|
932
|
+
"type": z$1.literal("card").describe("The credential type identifier for card credentials."),
|
|
933
|
+
"card_number_type": z$1.enum([
|
|
934
|
+
"fpan",
|
|
935
|
+
"network_token",
|
|
936
|
+
"dpan"
|
|
937
|
+
]).describe("The type of card number. Network tokens are preferred with fallback to FPAN. See PCI Scope for more details."),
|
|
938
|
+
"number": z$1.string().describe("Card number.").optional(),
|
|
939
|
+
"expiry_month": z$1.number().int().describe("The month of the card's expiration date (1-12).").optional(),
|
|
940
|
+
"expiry_year": z$1.number().int().describe("The year of the card's expiration date.").optional(),
|
|
941
|
+
"name": z$1.string().describe("Cardholder name.").optional(),
|
|
942
|
+
"cvc": z$1.string().max(4).describe("Card CVC number.").optional(),
|
|
943
|
+
"cryptogram": z$1.string().describe("Cryptogram provided with network tokens.").optional(),
|
|
944
|
+
"eci_value": z$1.string().describe("Electronic Commerce Indicator / Security Level Indicator provided with network tokens.").optional()
|
|
945
|
+
})).describe("A card credential containing sensitive payment card details including raw Primary Account Numbers (PANs). This credential type MUST NOT be used for checkout, only with payment handlers that tokenize or encrypt credentials. CRITICAL: Both parties handling CardCredential (sender and receiver) MUST be PCI DSS compliant. Transmission MUST use HTTPS/TLS with strong cipher suites.");
|
|
946
|
+
const CardPaymentInstrumentSchema = z$1.intersection(z$1.object({
|
|
947
|
+
"id": z$1.string().describe("A unique identifier for this instrument instance, assigned by the platform."),
|
|
948
|
+
"handler_id": z$1.string().describe("The unique identifier for the handler instance that produced this instrument. This corresponds to the 'id' field in the Payment Handler definition."),
|
|
949
|
+
"type": z$1.string().describe("The broad category of the instrument (e.g., 'card', 'tokenized_card'). Specific schemas will constrain this to a constant value."),
|
|
950
|
+
"billing_address": z$1.object({
|
|
951
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
952
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
953
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
954
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
955
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
956
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
957
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
958
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
959
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
960
|
+
}).describe("The billing address associated with this payment method.").optional(),
|
|
961
|
+
"credential": z$1.object({ "type": z$1.string().describe("The credential type discriminator. Specific schemas will constrain this to a constant value.") }).describe("The base definition for any payment credential. Handlers define specific credential types.").optional(),
|
|
962
|
+
"display": z$1.record(z$1.string(), z$1.unknown()).describe("Display information for this payment instrument. Each payment instrument schema defines its specific display properties, as outlined by the payment handler.").optional()
|
|
963
|
+
}).describe("The base definition for any payment instrument. It links the instrument to a specific payment handler."), z$1.object({
|
|
964
|
+
"type": z$1.literal("card").describe("Indicates this is a card payment instrument."),
|
|
965
|
+
"display": z$1.object({
|
|
966
|
+
"brand": z$1.string().describe("The card brand/network (e.g., visa, mastercard, amex).").optional(),
|
|
967
|
+
"last_digits": z$1.string().describe("Last 4 digits of the card number.").optional(),
|
|
968
|
+
"expiry_month": z$1.number().int().describe("The month of the card's expiration date (1-12).").optional(),
|
|
969
|
+
"expiry_year": z$1.number().int().describe("The year of the card's expiration date.").optional(),
|
|
970
|
+
"description": z$1.string().describe("An optional rich text description of the card to display to the user (e.g., 'Visa ending in 1234, expires 12/2025').").optional(),
|
|
971
|
+
"card_art": z$1.string().url().describe("An optional URI to a rich image representing the card (e.g., card art provided by the issuer).").optional()
|
|
972
|
+
}).describe("Display information for this card payment instrument.").optional()
|
|
973
|
+
})).describe("A basic card payment instrument with visible card details. Can be inherited by a handler's instrument schema to define handler-specific display details or more complex credential structures.");
|
|
974
|
+
const ContextSchema = z$1.object({
|
|
975
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used. Optional hint for market context (currency, availability, pricing)—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
976
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. For example, California or another appropriate first-level Administrative division. Optional hint for progressive localization—higher-resolution data (e.g., shipping address) supersedes this value.").optional(),
|
|
977
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043. Optional hint for regional refinement—higher-resolution data (e.g., shipping address) supersedes this value.").optional()
|
|
978
|
+
}).describe("Provisional buyer signals for relevance and localization: product availability, pricing, currency, tax, shipping, payment methods, and eligibility (e.g., student or affiliation discounts). Businesses SHOULD use these values when authoritative data (e.g., address) is absent, and MAY ignore unsupported values without returning errors. Context can be disclosed progressively—coarse signals early, finer resolution as the session progresses. Higher-resolution data (shipping address, billing address) supersedes context. Platforms SHOULD progressively enhance context throughout the buyer journey.");
|
|
979
|
+
const ExpectationSchema = z$1.object({
|
|
980
|
+
"id": z$1.string().describe("Expectation identifier."),
|
|
981
|
+
"line_items": z$1.array(z$1.object({
|
|
982
|
+
"id": z$1.string().describe("Line item ID reference."),
|
|
983
|
+
"quantity": z$1.number().int().gte(1).describe("Quantity of this item in this expectation.")
|
|
984
|
+
})).describe("Which line items and quantities are in this expectation."),
|
|
985
|
+
"method_type": z$1.enum([
|
|
986
|
+
"shipping",
|
|
987
|
+
"pickup",
|
|
988
|
+
"digital"
|
|
989
|
+
]).describe("Delivery method type (shipping, pickup, digital)."),
|
|
990
|
+
"destination": z$1.object({
|
|
991
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
992
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
993
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
994
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
995
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
996
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
997
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
998
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
999
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
1000
|
+
}).describe("Delivery destination address."),
|
|
1001
|
+
"description": z$1.string().describe("Human-readable delivery description (e.g., 'Arrives in 5-8 business days').").optional(),
|
|
1002
|
+
"fulfillable_on": z$1.string().describe("When this expectation can be fulfilled: 'now' or ISO 8601 timestamp for future date (backorder, pre-order).").optional()
|
|
1003
|
+
}).describe("Buyer-facing fulfillment expectation representing logical groupings of items (e.g., 'package'). Can be split, merged, or adjusted post-order to set buyer expectations for when/how items arrive.");
|
|
1004
|
+
const FulfillmentSchema = z$1.object({
|
|
1005
|
+
"methods": z$1.array(z$1.object({
|
|
1006
|
+
"id": z$1.string().describe("Unique fulfillment method identifier."),
|
|
1007
|
+
"type": z$1.enum(["shipping", "pickup"]).describe("Fulfillment method type."),
|
|
1008
|
+
"line_item_ids": z$1.array(z$1.string()).describe("Line item IDs fulfilled via this method."),
|
|
1009
|
+
"destinations": z$1.array(z$1.record(z$1.string(), z$1.unknown()).and(z$1.unknown().superRefine((x, ctx) => {
|
|
1010
|
+
const schemas = [z$1.record(z$1.string(), z$1.unknown()).and(z$1.intersection(z$1.object({
|
|
1011
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
1012
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
1013
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
1014
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
1015
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
1016
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
1017
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
1018
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
1019
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
1020
|
+
}), z$1.object({ "id": z$1.string().describe("ID specific to this shipping destination.") }))).describe("Shipping destination."), z$1.object({
|
|
1021
|
+
"id": z$1.string().describe("Unique location identifier."),
|
|
1022
|
+
"name": z$1.string().describe("Location name (e.g., store name)."),
|
|
1023
|
+
"address": z$1.object({
|
|
1024
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
1025
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
1026
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
1027
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
1028
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
1029
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
1030
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
1031
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
1032
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
1033
|
+
}).describe("Physical address of the location.").optional()
|
|
1034
|
+
}).describe("A pickup location (retail store, locker, etc.).")];
|
|
1035
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
1036
|
+
const passed = schemas.length - errors.length;
|
|
1037
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
1038
|
+
path: ctx.path,
|
|
1039
|
+
code: "invalid_union",
|
|
1040
|
+
unionErrors: errors,
|
|
1041
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1042
|
+
} : {
|
|
1043
|
+
path: ctx.path,
|
|
1044
|
+
code: "custom",
|
|
1045
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1046
|
+
});
|
|
1047
|
+
})).describe("A destination for fulfillment.")).describe("Available destinations. For shipping: addresses. For pickup: retail locations.").optional(),
|
|
1048
|
+
"selected_destination_id": z$1.union([z$1.string().describe("ID of the selected destination."), z$1.null().describe("ID of the selected destination.")]).describe("ID of the selected destination.").optional(),
|
|
1049
|
+
"groups": z$1.array(z$1.object({
|
|
1050
|
+
"id": z$1.string().describe("Group identifier for referencing merchant-generated groups in updates."),
|
|
1051
|
+
"line_item_ids": z$1.array(z$1.string()).describe("Line item IDs included in this group/package."),
|
|
1052
|
+
"options": z$1.array(z$1.object({
|
|
1053
|
+
"id": z$1.string().describe("Unique fulfillment option identifier."),
|
|
1054
|
+
"title": z$1.string().describe("Short label (e.g., 'Express Shipping', 'Curbside Pickup')."),
|
|
1055
|
+
"description": z$1.string().describe("Complete context for buyer decision (e.g., 'Arrives Dec 12-15 via FedEx').").optional(),
|
|
1056
|
+
"carrier": z$1.string().describe("Carrier name (for shipping).").optional(),
|
|
1057
|
+
"earliest_fulfillment_time": z$1.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
1058
|
+
"latest_fulfillment_time": z$1.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
1059
|
+
"totals": z$1.array(z$1.object({
|
|
1060
|
+
"type": z$1.enum([
|
|
1061
|
+
"items_discount",
|
|
1062
|
+
"subtotal",
|
|
1063
|
+
"discount",
|
|
1064
|
+
"fulfillment",
|
|
1065
|
+
"tax",
|
|
1066
|
+
"fee",
|
|
1067
|
+
"total"
|
|
1068
|
+
]).describe("Type of total categorization."),
|
|
1069
|
+
"display_text": z$1.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1070
|
+
"amount": z$1.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
1071
|
+
})).describe("Fulfillment option totals breakdown.")
|
|
1072
|
+
}).describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).")).describe("Available fulfillment options for this group.").optional(),
|
|
1073
|
+
"selected_option_id": z$1.union([z$1.string().describe("ID of the selected fulfillment option for this group."), z$1.null().describe("ID of the selected fulfillment option for this group.")]).describe("ID of the selected fulfillment option for this group.").optional()
|
|
1074
|
+
}).describe("A merchant-generated package/group of line items with fulfillment options.")).describe("Fulfillment groups for selecting options. Agent sets selected_option_id on groups to choose shipping method.").optional()
|
|
1075
|
+
}).describe("A fulfillment method (shipping or pickup) with destinations and groups.")).describe("Fulfillment methods for cart items.").optional(),
|
|
1076
|
+
"available_methods": z$1.array(z$1.object({
|
|
1077
|
+
"type": z$1.enum(["shipping", "pickup"]).describe("Fulfillment method type this availability applies to."),
|
|
1078
|
+
"line_item_ids": z$1.array(z$1.string()).describe("Line items available for this fulfillment method."),
|
|
1079
|
+
"fulfillable_on": z$1.union([z$1.string().describe("'now' for immediate availability, or ISO 8601 date for future (preorders, transfers)."), z$1.null().describe("'now' for immediate availability, or ISO 8601 date for future (preorders, transfers).")]).describe("'now' for immediate availability, or ISO 8601 date for future (preorders, transfers).").optional(),
|
|
1080
|
+
"description": z$1.string().describe("Human-readable availability info (e.g., 'Available for pickup at Downtown Store today').").optional()
|
|
1081
|
+
}).describe("Inventory availability hint for a fulfillment method type.")).describe("Inventory availability hints.").optional()
|
|
1082
|
+
}).describe("Container for fulfillment methods and availability.");
|
|
1083
|
+
const FulfillmentAvailableMethodSchema = z$1.object({
|
|
1084
|
+
"type": z$1.enum(["shipping", "pickup"]).describe("Fulfillment method type this availability applies to."),
|
|
1085
|
+
"line_item_ids": z$1.array(z$1.string()).describe("Line items available for this fulfillment method."),
|
|
1086
|
+
"fulfillable_on": z$1.union([z$1.string().describe("'now' for immediate availability, or ISO 8601 date for future (preorders, transfers)."), z$1.null().describe("'now' for immediate availability, or ISO 8601 date for future (preorders, transfers).")]).describe("'now' for immediate availability, or ISO 8601 date for future (preorders, transfers).").optional(),
|
|
1087
|
+
"description": z$1.string().describe("Human-readable availability info (e.g., 'Available for pickup at Downtown Store today').").optional()
|
|
1088
|
+
}).describe("Inventory availability hint for a fulfillment method type.");
|
|
1089
|
+
const FulfillmentDestinationSchema = z$1.record(z$1.string(), z$1.unknown()).and(z$1.unknown().superRefine((x, ctx) => {
|
|
1090
|
+
const schemas = [z$1.record(z$1.string(), z$1.unknown()).and(z$1.intersection(z$1.object({
|
|
1091
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
1092
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
1093
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
1094
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
1095
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
1096
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
1097
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
1098
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
1099
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
1100
|
+
}), z$1.object({ "id": z$1.string().describe("ID specific to this shipping destination.") }))).describe("Shipping destination."), z$1.object({
|
|
1101
|
+
"id": z$1.string().describe("Unique location identifier."),
|
|
1102
|
+
"name": z$1.string().describe("Location name (e.g., store name)."),
|
|
1103
|
+
"address": z$1.object({
|
|
1104
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
1105
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
1106
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
1107
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
1108
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
1109
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
1110
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
1111
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
1112
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
1113
|
+
}).describe("Physical address of the location.").optional()
|
|
1114
|
+
}).describe("A pickup location (retail store, locker, etc.).")];
|
|
1115
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
1116
|
+
const passed = schemas.length - errors.length;
|
|
1117
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
1118
|
+
path: ctx.path,
|
|
1119
|
+
code: "invalid_union",
|
|
1120
|
+
unionErrors: errors,
|
|
1121
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1122
|
+
} : {
|
|
1123
|
+
path: ctx.path,
|
|
1124
|
+
code: "custom",
|
|
1125
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1126
|
+
});
|
|
1127
|
+
})).describe("A destination for fulfillment.");
|
|
1128
|
+
const FulfillmentEventSchema = z$1.object({
|
|
1129
|
+
"id": z$1.string().describe("Fulfillment event identifier."),
|
|
1130
|
+
"occurred_at": z$1.string().datetime({ offset: true }).describe("RFC 3339 timestamp when this fulfillment event occurred."),
|
|
1131
|
+
"type": z$1.string().describe("Fulfillment event type. Common values include: processing (preparing to ship), shipped (handed to carrier), in_transit (in delivery network), delivered (received by buyer), failed_attempt (delivery attempt failed), canceled (fulfillment canceled), undeliverable (cannot be delivered), returned_to_sender (returned to merchant)."),
|
|
1132
|
+
"line_items": z$1.array(z$1.object({
|
|
1133
|
+
"id": z$1.string().describe("Line item ID reference."),
|
|
1134
|
+
"quantity": z$1.number().int().gte(1).describe("Quantity fulfilled in this event.")
|
|
1135
|
+
})).describe("Which line items and quantities are fulfilled in this event."),
|
|
1136
|
+
"tracking_number": z$1.string().describe("Carrier tracking number (required if type != processing).").optional(),
|
|
1137
|
+
"tracking_url": z$1.string().url().describe("URL to track this shipment (required if type != processing).").optional(),
|
|
1138
|
+
"carrier": z$1.string().describe("Carrier name (e.g., 'FedEx', 'USPS').").optional(),
|
|
1139
|
+
"description": z$1.string().describe("Human-readable description of the shipment status or delivery information (e.g., 'Delivered to front door', 'Out for delivery').").optional()
|
|
1140
|
+
}).describe("Append-only fulfillment event representing an actual shipment. References line items by ID.");
|
|
1141
|
+
const FulfillmentGroupSchema = z$1.object({
|
|
1142
|
+
"id": z$1.string().describe("Group identifier for referencing merchant-generated groups in updates."),
|
|
1143
|
+
"line_item_ids": z$1.array(z$1.string()).describe("Line item IDs included in this group/package."),
|
|
1144
|
+
"options": z$1.array(z$1.object({
|
|
1145
|
+
"id": z$1.string().describe("Unique fulfillment option identifier."),
|
|
1146
|
+
"title": z$1.string().describe("Short label (e.g., 'Express Shipping', 'Curbside Pickup')."),
|
|
1147
|
+
"description": z$1.string().describe("Complete context for buyer decision (e.g., 'Arrives Dec 12-15 via FedEx').").optional(),
|
|
1148
|
+
"carrier": z$1.string().describe("Carrier name (for shipping).").optional(),
|
|
1149
|
+
"earliest_fulfillment_time": z$1.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
1150
|
+
"latest_fulfillment_time": z$1.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
1151
|
+
"totals": z$1.array(z$1.object({
|
|
1152
|
+
"type": z$1.enum([
|
|
1153
|
+
"items_discount",
|
|
1154
|
+
"subtotal",
|
|
1155
|
+
"discount",
|
|
1156
|
+
"fulfillment",
|
|
1157
|
+
"tax",
|
|
1158
|
+
"fee",
|
|
1159
|
+
"total"
|
|
1160
|
+
]).describe("Type of total categorization."),
|
|
1161
|
+
"display_text": z$1.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1162
|
+
"amount": z$1.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
1163
|
+
})).describe("Fulfillment option totals breakdown.")
|
|
1164
|
+
}).describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).")).describe("Available fulfillment options for this group.").optional(),
|
|
1165
|
+
"selected_option_id": z$1.union([z$1.string().describe("ID of the selected fulfillment option for this group."), z$1.null().describe("ID of the selected fulfillment option for this group.")]).describe("ID of the selected fulfillment option for this group.").optional()
|
|
1166
|
+
}).describe("A merchant-generated package/group of line items with fulfillment options.");
|
|
1167
|
+
const FulfillmentGroupUpdateRequestSchema = z$1.object({ "id": z$1.string().describe("Group identifier for referencing merchant-generated groups in updates.") }).strict();
|
|
1168
|
+
const FulfillmentMethodSchema = z$1.object({
|
|
1169
|
+
"id": z$1.string().describe("Unique fulfillment method identifier."),
|
|
1170
|
+
"type": z$1.enum(["shipping", "pickup"]).describe("Fulfillment method type."),
|
|
1171
|
+
"line_item_ids": z$1.array(z$1.string()).describe("Line item IDs fulfilled via this method."),
|
|
1172
|
+
"destinations": z$1.array(z$1.record(z$1.string(), z$1.unknown()).and(z$1.unknown().superRefine((x, ctx) => {
|
|
1173
|
+
const schemas = [z$1.record(z$1.string(), z$1.unknown()).and(z$1.intersection(z$1.object({
|
|
1174
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
1175
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
1176
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
1177
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
1178
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
1179
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
1180
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
1181
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
1182
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
1183
|
+
}), z$1.object({ "id": z$1.string().describe("ID specific to this shipping destination.") }))).describe("Shipping destination."), z$1.object({
|
|
1184
|
+
"id": z$1.string().describe("Unique location identifier."),
|
|
1185
|
+
"name": z$1.string().describe("Location name (e.g., store name)."),
|
|
1186
|
+
"address": z$1.object({
|
|
1187
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
1188
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
1189
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
1190
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
1191
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
1192
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
1193
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
1194
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
1195
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
1196
|
+
}).describe("Physical address of the location.").optional()
|
|
1197
|
+
}).describe("A pickup location (retail store, locker, etc.).")];
|
|
1198
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
1199
|
+
const passed = schemas.length - errors.length;
|
|
1200
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
1201
|
+
path: ctx.path,
|
|
1202
|
+
code: "invalid_union",
|
|
1203
|
+
unionErrors: errors,
|
|
1204
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1205
|
+
} : {
|
|
1206
|
+
path: ctx.path,
|
|
1207
|
+
code: "custom",
|
|
1208
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1209
|
+
});
|
|
1210
|
+
})).describe("A destination for fulfillment.")).describe("Available destinations. For shipping: addresses. For pickup: retail locations.").optional(),
|
|
1211
|
+
"selected_destination_id": z$1.union([z$1.string().describe("ID of the selected destination."), z$1.null().describe("ID of the selected destination.")]).describe("ID of the selected destination.").optional(),
|
|
1212
|
+
"groups": z$1.array(z$1.object({
|
|
1213
|
+
"id": z$1.string().describe("Group identifier for referencing merchant-generated groups in updates."),
|
|
1214
|
+
"line_item_ids": z$1.array(z$1.string()).describe("Line item IDs included in this group/package."),
|
|
1215
|
+
"options": z$1.array(z$1.object({
|
|
1216
|
+
"id": z$1.string().describe("Unique fulfillment option identifier."),
|
|
1217
|
+
"title": z$1.string().describe("Short label (e.g., 'Express Shipping', 'Curbside Pickup')."),
|
|
1218
|
+
"description": z$1.string().describe("Complete context for buyer decision (e.g., 'Arrives Dec 12-15 via FedEx').").optional(),
|
|
1219
|
+
"carrier": z$1.string().describe("Carrier name (for shipping).").optional(),
|
|
1220
|
+
"earliest_fulfillment_time": z$1.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
1221
|
+
"latest_fulfillment_time": z$1.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
1222
|
+
"totals": z$1.array(z$1.object({
|
|
1223
|
+
"type": z$1.enum([
|
|
1224
|
+
"items_discount",
|
|
1225
|
+
"subtotal",
|
|
1226
|
+
"discount",
|
|
1227
|
+
"fulfillment",
|
|
1228
|
+
"tax",
|
|
1229
|
+
"fee",
|
|
1230
|
+
"total"
|
|
1231
|
+
]).describe("Type of total categorization."),
|
|
1232
|
+
"display_text": z$1.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1233
|
+
"amount": z$1.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
1234
|
+
})).describe("Fulfillment option totals breakdown.")
|
|
1235
|
+
}).describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).")).describe("Available fulfillment options for this group.").optional(),
|
|
1236
|
+
"selected_option_id": z$1.union([z$1.string().describe("ID of the selected fulfillment option for this group."), z$1.null().describe("ID of the selected fulfillment option for this group.")]).describe("ID of the selected fulfillment option for this group.").optional()
|
|
1237
|
+
}).describe("A merchant-generated package/group of line items with fulfillment options.")).describe("Fulfillment groups for selecting options. Agent sets selected_option_id on groups to choose shipping method.").optional()
|
|
1238
|
+
}).describe("A fulfillment method (shipping or pickup) with destinations and groups.");
|
|
1239
|
+
const FulfillmentMethodCreateRequestSchema = z$1.object({
|
|
1240
|
+
"type": z$1.enum(["shipping", "pickup"]).describe("Fulfillment method type."),
|
|
1241
|
+
"line_item_ids": z$1.array(z$1.string()).describe("Line item IDs fulfilled via this method.").optional()
|
|
1242
|
+
}).strict();
|
|
1243
|
+
const FulfillmentMethodUpdateRequestSchema = z$1.object({
|
|
1244
|
+
"id": z$1.string().describe("Unique fulfillment method identifier."),
|
|
1245
|
+
"line_item_ids": z$1.array(z$1.string()).describe("Line item IDs fulfilled via this method.")
|
|
1246
|
+
}).strict();
|
|
1247
|
+
const FulfillmentOptionSchema = z$1.object({
|
|
1248
|
+
"id": z$1.string().describe("Unique fulfillment option identifier."),
|
|
1249
|
+
"title": z$1.string().describe("Short label (e.g., 'Express Shipping', 'Curbside Pickup')."),
|
|
1250
|
+
"description": z$1.string().describe("Complete context for buyer decision (e.g., 'Arrives Dec 12-15 via FedEx').").optional(),
|
|
1251
|
+
"carrier": z$1.string().describe("Carrier name (for shipping).").optional(),
|
|
1252
|
+
"earliest_fulfillment_time": z$1.string().datetime({ offset: true }).describe("Earliest fulfillment date.").optional(),
|
|
1253
|
+
"latest_fulfillment_time": z$1.string().datetime({ offset: true }).describe("Latest fulfillment date.").optional(),
|
|
1254
|
+
"totals": z$1.array(z$1.object({
|
|
1255
|
+
"type": z$1.enum([
|
|
1256
|
+
"items_discount",
|
|
1257
|
+
"subtotal",
|
|
1258
|
+
"discount",
|
|
1259
|
+
"fulfillment",
|
|
1260
|
+
"tax",
|
|
1261
|
+
"fee",
|
|
1262
|
+
"total"
|
|
1263
|
+
]).describe("Type of total categorization."),
|
|
1264
|
+
"display_text": z$1.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1265
|
+
"amount": z$1.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
1266
|
+
})).describe("Fulfillment option totals breakdown.")
|
|
1267
|
+
}).describe("A fulfillment option within a group (e.g., Standard Shipping $5, Express $15).");
|
|
1268
|
+
const ItemSchema = z$1.object({
|
|
1269
|
+
"id": z$1.string().describe("Should be recognized by both the Platform, and the Business. For Google it should match the id provided in the \"id\" field in the product feed."),
|
|
1270
|
+
"title": z$1.string().describe("Product title."),
|
|
1271
|
+
"price": z$1.number().int().gte(0).describe("Unit price in minor (cents) currency units."),
|
|
1272
|
+
"image_url": z$1.string().url().describe("Product image URI.").optional()
|
|
1273
|
+
});
|
|
1274
|
+
const LineItemSchema = z$1.object({
|
|
1275
|
+
"id": z$1.string(),
|
|
1276
|
+
"item": z$1.object({
|
|
1277
|
+
"id": z$1.string().describe("Should be recognized by both the Platform, and the Business. For Google it should match the id provided in the \"id\" field in the product feed."),
|
|
1278
|
+
"title": z$1.string().describe("Product title."),
|
|
1279
|
+
"price": z$1.number().int().gte(0).describe("Unit price in minor (cents) currency units."),
|
|
1280
|
+
"image_url": z$1.string().url().describe("Product image URI.").optional()
|
|
1281
|
+
}),
|
|
1282
|
+
"quantity": z$1.number().int().gte(1).describe("Quantity of the item being purchased."),
|
|
1283
|
+
"totals": z$1.array(z$1.object({
|
|
1284
|
+
"type": z$1.enum([
|
|
1285
|
+
"items_discount",
|
|
1286
|
+
"subtotal",
|
|
1287
|
+
"discount",
|
|
1288
|
+
"fulfillment",
|
|
1289
|
+
"tax",
|
|
1290
|
+
"fee",
|
|
1291
|
+
"total"
|
|
1292
|
+
]).describe("Type of total categorization."),
|
|
1293
|
+
"display_text": z$1.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1294
|
+
"amount": z$1.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
1295
|
+
})).describe("Line item totals breakdown."),
|
|
1296
|
+
"parent_id": z$1.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
1297
|
+
}).describe("Line item object. Expected to use the currency of the parent object.");
|
|
1298
|
+
const LineItemUpdateRequestSchema = z$1.object({
|
|
1299
|
+
"id": z$1.string().optional(),
|
|
1300
|
+
"parent_id": z$1.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
1301
|
+
}).strict();
|
|
1302
|
+
const LinkSchema = z$1.object({
|
|
1303
|
+
"type": z$1.string().describe("Type of link. Well-known values: `privacy_policy`, `terms_of_service`, `refund_policy`, `shipping_policy`, `faq`. Consumers SHOULD handle unknown values gracefully by displaying them using the `title` field or omitting the link."),
|
|
1304
|
+
"url": z$1.string().url().describe("The actual URL pointing to the content to be displayed."),
|
|
1305
|
+
"title": z$1.string().describe("Optional display text for the link. When provided, use this instead of generating from type.").optional()
|
|
1306
|
+
});
|
|
1307
|
+
const MerchantFulfillmentConfigSchema = z$1.object({
|
|
1308
|
+
"allows_multi_destination": z$1.object({
|
|
1309
|
+
"shipping": z$1.boolean().describe("Multiple shipping destinations allowed.").optional(),
|
|
1310
|
+
"pickup": z$1.boolean().describe("Multiple pickup locations allowed.").optional()
|
|
1311
|
+
}).strict().describe("Permits multiple destinations per method type.").optional(),
|
|
1312
|
+
"allows_method_combinations": z$1.array(z$1.array(z$1.enum(["shipping", "pickup"]))).describe("Allowed method type combinations.").optional()
|
|
1313
|
+
}).describe("Merchant's fulfillment configuration.");
|
|
1314
|
+
const MessageSchema = z$1.record(z$1.string(), z$1.unknown()).and(z$1.unknown().superRefine((x, ctx) => {
|
|
1315
|
+
const schemas = [
|
|
1316
|
+
z$1.object({
|
|
1317
|
+
"type": z$1.literal("error").describe("Message type discriminator."),
|
|
1318
|
+
"code": z$1.string().describe("Error code. Possible values include: missing, invalid, out_of_stock, payment_declined, requires_sign_in, requires_3ds, requires_identity_linking. Freeform codes also allowed."),
|
|
1319
|
+
"path": z$1.string().describe("RFC 9535 JSONPath to the component the message refers to (e.g., $.items[1]).").optional(),
|
|
1320
|
+
"content_type": z$1.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1321
|
+
"content": z$1.string().describe("Human-readable message."),
|
|
1322
|
+
"severity": z$1.enum([
|
|
1323
|
+
"recoverable",
|
|
1324
|
+
"requires_buyer_input",
|
|
1325
|
+
"requires_buyer_review"
|
|
1326
|
+
]).describe("Declares who resolves this error. 'recoverable': agent can fix via API. 'requires_buyer_input': merchant requires information their API doesn't support collecting programmatically (checkout incomplete). 'requires_buyer_review': buyer must authorize before order placement due to policy, regulatory, or entitlement rules (checkout complete). Errors with 'requires_*' severity contribute to 'status: requires_escalation'.")
|
|
1327
|
+
}),
|
|
1328
|
+
z$1.object({
|
|
1329
|
+
"type": z$1.literal("warning").describe("Message type discriminator."),
|
|
1330
|
+
"path": z$1.string().describe("JSONPath (RFC 9535) to related field (e.g., $.line_items[0]).").optional(),
|
|
1331
|
+
"code": z$1.string().describe("Warning code. Machine-readable identifier for the warning type (e.g., final_sale, prop65, fulfillment_changed, age_restricted, etc.)."),
|
|
1332
|
+
"content": z$1.string().describe("Human-readable warning message that MUST be displayed."),
|
|
1333
|
+
"content_type": z$1.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain")
|
|
1334
|
+
}),
|
|
1335
|
+
z$1.object({
|
|
1336
|
+
"type": z$1.literal("info").describe("Message type discriminator."),
|
|
1337
|
+
"path": z$1.string().describe("RFC 9535 JSONPath to the component the message refers to.").optional(),
|
|
1338
|
+
"code": z$1.string().describe("Info code for programmatic handling.").optional(),
|
|
1339
|
+
"content_type": z$1.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1340
|
+
"content": z$1.string().describe("Human-readable message.")
|
|
1341
|
+
})
|
|
1342
|
+
];
|
|
1343
|
+
const errors = schemas.reduce((errors, schema) => ((result) => result.error ? [...errors, result.error] : errors)(schema.safeParse(x)), []);
|
|
1344
|
+
const passed = schemas.length - errors.length;
|
|
1345
|
+
if (passed !== 1) ctx.addIssue(errors.length ? {
|
|
1346
|
+
path: ctx.path,
|
|
1347
|
+
code: "invalid_union",
|
|
1348
|
+
unionErrors: errors,
|
|
1349
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1350
|
+
} : {
|
|
1351
|
+
path: ctx.path,
|
|
1352
|
+
code: "custom",
|
|
1353
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1354
|
+
});
|
|
1355
|
+
})).describe("Container for error, warning, or info messages.");
|
|
1356
|
+
const MessageErrorSchema = z$1.object({
|
|
1357
|
+
"type": z$1.literal("error").describe("Message type discriminator."),
|
|
1358
|
+
"code": z$1.string().describe("Error code. Possible values include: missing, invalid, out_of_stock, payment_declined, requires_sign_in, requires_3ds, requires_identity_linking. Freeform codes also allowed."),
|
|
1359
|
+
"path": z$1.string().describe("RFC 9535 JSONPath to the component the message refers to (e.g., $.items[1]).").optional(),
|
|
1360
|
+
"content_type": z$1.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1361
|
+
"content": z$1.string().describe("Human-readable message."),
|
|
1362
|
+
"severity": z$1.enum([
|
|
1363
|
+
"recoverable",
|
|
1364
|
+
"requires_buyer_input",
|
|
1365
|
+
"requires_buyer_review"
|
|
1366
|
+
]).describe("Declares who resolves this error. 'recoverable': agent can fix via API. 'requires_buyer_input': merchant requires information their API doesn't support collecting programmatically (checkout incomplete). 'requires_buyer_review': buyer must authorize before order placement due to policy, regulatory, or entitlement rules (checkout complete). Errors with 'requires_*' severity contribute to 'status: requires_escalation'.")
|
|
1367
|
+
});
|
|
1368
|
+
const MessageInfoSchema = z$1.object({
|
|
1369
|
+
"type": z$1.literal("info").describe("Message type discriminator."),
|
|
1370
|
+
"path": z$1.string().describe("RFC 9535 JSONPath to the component the message refers to.").optional(),
|
|
1371
|
+
"code": z$1.string().describe("Info code for programmatic handling.").optional(),
|
|
1372
|
+
"content_type": z$1.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain"),
|
|
1373
|
+
"content": z$1.string().describe("Human-readable message.")
|
|
1374
|
+
});
|
|
1375
|
+
const MessageWarningSchema = z$1.object({
|
|
1376
|
+
"type": z$1.literal("warning").describe("Message type discriminator."),
|
|
1377
|
+
"path": z$1.string().describe("JSONPath (RFC 9535) to related field (e.g., $.line_items[0]).").optional(),
|
|
1378
|
+
"code": z$1.string().describe("Warning code. Machine-readable identifier for the warning type (e.g., final_sale, prop65, fulfillment_changed, age_restricted, etc.)."),
|
|
1379
|
+
"content": z$1.string().describe("Human-readable warning message that MUST be displayed."),
|
|
1380
|
+
"content_type": z$1.enum(["plain", "markdown"]).describe("Content format, default = plain.").default("plain")
|
|
1381
|
+
});
|
|
1382
|
+
const OrderConfirmationSchema = z$1.object({
|
|
1383
|
+
"id": z$1.string().describe("Unique order identifier."),
|
|
1384
|
+
"permalink_url": z$1.string().url().describe("Permalink to access the order on merchant site.")
|
|
1385
|
+
}).describe("Order details available at the time of checkout completion.");
|
|
1386
|
+
const OrderLineItemSchema = z$1.object({
|
|
1387
|
+
"id": z$1.string().describe("Line item identifier."),
|
|
1388
|
+
"item": z$1.object({
|
|
1389
|
+
"id": z$1.string().describe("Should be recognized by both the Platform, and the Business. For Google it should match the id provided in the \"id\" field in the product feed."),
|
|
1390
|
+
"title": z$1.string().describe("Product title."),
|
|
1391
|
+
"price": z$1.number().int().gte(0).describe("Unit price in minor (cents) currency units."),
|
|
1392
|
+
"image_url": z$1.string().url().describe("Product image URI.").optional()
|
|
1393
|
+
}).describe("Product data (id, title, price, image_url)."),
|
|
1394
|
+
"quantity": z$1.object({
|
|
1395
|
+
"total": z$1.number().int().gte(0).describe("Current total quantity."),
|
|
1396
|
+
"fulfilled": z$1.number().int().gte(0).describe("Quantity fulfilled (sum from fulfillment events).")
|
|
1397
|
+
}).describe("Quantity tracking. Both total and fulfilled are derived from events."),
|
|
1398
|
+
"totals": z$1.array(z$1.object({
|
|
1399
|
+
"type": z$1.enum([
|
|
1400
|
+
"items_discount",
|
|
1401
|
+
"subtotal",
|
|
1402
|
+
"discount",
|
|
1403
|
+
"fulfillment",
|
|
1404
|
+
"tax",
|
|
1405
|
+
"fee",
|
|
1406
|
+
"total"
|
|
1407
|
+
]).describe("Type of total categorization."),
|
|
1408
|
+
"display_text": z$1.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1409
|
+
"amount": z$1.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
1410
|
+
})).describe("Line item totals breakdown."),
|
|
1411
|
+
"status": z$1.enum([
|
|
1412
|
+
"processing",
|
|
1413
|
+
"partial",
|
|
1414
|
+
"fulfilled"
|
|
1415
|
+
]).describe("Derived status: fulfilled if quantity.fulfilled == quantity.total, partial if quantity.fulfilled > 0, otherwise processing."),
|
|
1416
|
+
"parent_id": z$1.string().describe("Parent line item identifier for any nested structures.").optional()
|
|
1417
|
+
});
|
|
1418
|
+
const PaymentCredentialSchema = z$1.object({ "type": z$1.string().describe("The credential type discriminator. Specific schemas will constrain this to a constant value.") }).describe("The base definition for any payment credential. Handlers define specific credential types.");
|
|
1419
|
+
const PaymentIdentitySchema = z$1.object({ "access_token": z$1.string().describe("Unique identifier for this participant, obtained during onboarding with the tokenizer.") }).describe("Identity of a participant for token binding. The access_token uniquely identifies the participant who tokens should be bound to.");
|
|
1420
|
+
const PaymentInstrumentSchema = z$1.object({
|
|
1421
|
+
"id": z$1.string().describe("A unique identifier for this instrument instance, assigned by the platform."),
|
|
1422
|
+
"handler_id": z$1.string().describe("The unique identifier for the handler instance that produced this instrument. This corresponds to the 'id' field in the Payment Handler definition."),
|
|
1423
|
+
"type": z$1.string().describe("The broad category of the instrument (e.g., 'card', 'tokenized_card'). Specific schemas will constrain this to a constant value."),
|
|
1424
|
+
"billing_address": z$1.object({
|
|
1425
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
1426
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
1427
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
1428
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
1429
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
1430
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
1431
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
1432
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
1433
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
1434
|
+
}).describe("The billing address associated with this payment method.").optional(),
|
|
1435
|
+
"credential": z$1.object({ "type": z$1.string().describe("The credential type discriminator. Specific schemas will constrain this to a constant value.") }).describe("The base definition for any payment credential. Handlers define specific credential types.").optional(),
|
|
1436
|
+
"display": z$1.record(z$1.string(), z$1.unknown()).describe("Display information for this payment instrument. Each payment instrument schema defines its specific display properties, as outlined by the payment handler.").optional()
|
|
1437
|
+
}).describe("The base definition for any payment instrument. It links the instrument to a specific payment handler.");
|
|
1438
|
+
const PlatformFulfillmentConfigSchema = z$1.object({ "supports_multi_group": z$1.boolean().describe("Enables multiple groups per method.").default(false) }).describe("Platform's fulfillment configuration.");
|
|
1439
|
+
const PostalAddressSchema = z$1.object({
|
|
1440
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
1441
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
1442
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
1443
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
1444
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
1445
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
1446
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
1447
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
1448
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
1449
|
+
});
|
|
1450
|
+
const RetailLocationSchema = z$1.object({
|
|
1451
|
+
"id": z$1.string().describe("Unique location identifier."),
|
|
1452
|
+
"name": z$1.string().describe("Location name (e.g., store name)."),
|
|
1453
|
+
"address": z$1.object({
|
|
1454
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
1455
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
1456
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
1457
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
1458
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
1459
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
1460
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
1461
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
1462
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
1463
|
+
}).describe("Physical address of the location.").optional()
|
|
1464
|
+
}).describe("A pickup location (retail store, locker, etc.).");
|
|
1465
|
+
const ShippingDestinationSchema = z$1.record(z$1.string(), z$1.unknown()).and(z$1.intersection(z$1.object({
|
|
1466
|
+
"extended_address": z$1.string().describe("An address extension such as an apartment number, C/O or alternative name.").optional(),
|
|
1467
|
+
"street_address": z$1.string().describe("The street address.").optional(),
|
|
1468
|
+
"address_locality": z$1.string().describe("The locality in which the street address is, and which is in the region. For example, Mountain View.").optional(),
|
|
1469
|
+
"address_region": z$1.string().describe("The region in which the locality is, and which is in the country. Required for applicable countries (i.e. state in US, province in CA). For example, California or another appropriate first-level Administrative division.").optional(),
|
|
1470
|
+
"address_country": z$1.string().describe("The country. Recommended to be in 2-letter ISO 3166-1 alpha-2 format, for example \"US\". For backward compatibility, a 3-letter ISO 3166-1 alpha-3 country code such as \"SGP\" or a full country name such as \"Singapore\" can also be used.").optional(),
|
|
1471
|
+
"postal_code": z$1.string().describe("The postal code. For example, 94043.").optional(),
|
|
1472
|
+
"first_name": z$1.string().describe("Optional. First name of the contact associated with the address.").optional(),
|
|
1473
|
+
"last_name": z$1.string().describe("Optional. Last name of the contact associated with the address.").optional(),
|
|
1474
|
+
"phone_number": z$1.string().describe("Optional. Phone number of the contact associated with the address.").optional()
|
|
1475
|
+
}), z$1.object({ "id": z$1.string().describe("ID specific to this shipping destination.") }))).describe("Shipping destination.");
|
|
1476
|
+
const TokenCredentialSchema = z$1.intersection(z$1.object({ "type": z$1.string().describe("The credential type discriminator. Specific schemas will constrain this to a constant value.") }).describe("The base definition for any payment credential. Handlers define specific credential types."), z$1.object({
|
|
1477
|
+
"type": z$1.string().describe("The specific type of token produced by the handler (e.g., 'stripe_token')."),
|
|
1478
|
+
"token": z$1.string().describe("The token value.")
|
|
1479
|
+
})).describe("Base token credential schema. Concrete payment handlers may extend this schema with additional fields and define their own constraints.");
|
|
1480
|
+
const TotalSchema = z$1.object({
|
|
1481
|
+
"type": z$1.enum([
|
|
1482
|
+
"items_discount",
|
|
1483
|
+
"subtotal",
|
|
1484
|
+
"discount",
|
|
1485
|
+
"fulfillment",
|
|
1486
|
+
"tax",
|
|
1487
|
+
"fee",
|
|
1488
|
+
"total"
|
|
1489
|
+
]).describe("Type of total categorization."),
|
|
1490
|
+
"display_text": z$1.string().describe("Text to display against the amount. Should reflect appropriate method (e.g., 'Shipping', 'Delivery').").optional(),
|
|
1491
|
+
"amount": z$1.number().int().gte(0).describe("If type == total, sums subtotal - discount + fulfillment + tax + fee. Should be >= 0. Amount in minor (cents) currency units.")
|
|
1492
|
+
});
|
|
1493
|
+
const EmbeddedConfigSchema = z$1.object({ "delegate": z$1.array(z$1.string()).describe("Delegations the business allows. At service-level, declares available delegations. In checkout responses, confirms accepted delegations for this session.").optional() }).describe("Per-checkout configuration for embedded transport binding. Allows businesses to vary ECP availability and delegations based on cart contents, agent authorization, or policy.");
|
|
1494
|
+
const UcpVersionSchema = z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format.");
|
|
1495
|
+
const UcpReverseDomainNameSchema = z$1.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Reverse-domain identifier (e.g., com.google.pay, dev.ucp.shopping.checkout)");
|
|
1496
|
+
const UcpEntitySchema = z$1.object({
|
|
1497
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1498
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1499
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1500
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1501
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1502
|
+
}).describe("Shared foundation for all UCP entities.");
|
|
1503
|
+
const UcpBaseSchema = z$1.object({
|
|
1504
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1505
|
+
"services": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1506
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1507
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1508
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1509
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1510
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1511
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({
|
|
1512
|
+
"transport": z$1.enum([
|
|
1513
|
+
"rest",
|
|
1514
|
+
"mcp",
|
|
1515
|
+
"a2a",
|
|
1516
|
+
"embedded"
|
|
1517
|
+
]).describe("Transport protocol for this service binding."),
|
|
1518
|
+
"endpoint": z$1.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
1519
|
+
})))).describe("Service registry keyed by reverse-domain name.").optional(),
|
|
1520
|
+
"capabilities": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1521
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1522
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1523
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1524
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1525
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1526
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({ "extends": z$1.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
1527
|
+
"payment_handlers": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1528
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1529
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1530
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1531
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1532
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1533
|
+
}).describe("Shared foundation for all UCP entities."), z$1.record(z$1.string(), z$1.unknown())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
1534
|
+
}).describe("Base UCP metadata with shared properties for all schema types.");
|
|
1535
|
+
const UcpPlatformSchema = z$1.intersection(z$1.object({
|
|
1536
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1537
|
+
"services": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1538
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1539
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1540
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1541
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1542
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1543
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({
|
|
1544
|
+
"transport": z$1.enum([
|
|
1545
|
+
"rest",
|
|
1546
|
+
"mcp",
|
|
1547
|
+
"a2a",
|
|
1548
|
+
"embedded"
|
|
1549
|
+
]).describe("Transport protocol for this service binding."),
|
|
1550
|
+
"endpoint": z$1.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
1551
|
+
})))).describe("Service registry keyed by reverse-domain name.").optional(),
|
|
1552
|
+
"capabilities": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1553
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1554
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1555
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1556
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1557
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1558
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({ "extends": z$1.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
1559
|
+
"payment_handlers": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1560
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1561
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1562
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1563
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1564
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1565
|
+
}).describe("Shared foundation for all UCP entities."), z$1.record(z$1.string(), z$1.unknown())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
1566
|
+
}).describe("Base UCP metadata with shared properties for all schema types."), z$1.object({
|
|
1567
|
+
"services": z$1.record(z$1.array(z$1.intersection(z$1.intersection(z$1.object({
|
|
1568
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1569
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1570
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1571
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1572
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1573
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({
|
|
1574
|
+
"transport": z$1.enum([
|
|
1575
|
+
"rest",
|
|
1576
|
+
"mcp",
|
|
1577
|
+
"a2a",
|
|
1578
|
+
"embedded"
|
|
1579
|
+
]).describe("Transport protocol for this service binding."),
|
|
1580
|
+
"endpoint": z$1.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
1581
|
+
})), z$1.intersection(z$1.record(z$1.string(), z$1.unknown()), z$1.union([
|
|
1582
|
+
z$1.object({ "transport": z$1.literal("rest").optional() }),
|
|
1583
|
+
z$1.object({ "transport": z$1.literal("mcp").optional() }),
|
|
1584
|
+
z$1.object({ "transport": z$1.literal("a2a").optional() }),
|
|
1585
|
+
z$1.object({ "transport": z$1.literal("embedded").optional() })
|
|
1586
|
+
]))).describe("Full service declaration for platform-level discovery. Different transports require different fields."))),
|
|
1587
|
+
"capabilities": z$1.record(z$1.array(z$1.intersection(z$1.intersection(z$1.object({
|
|
1588
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1589
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1590
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1591
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1592
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1593
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({ "extends": z$1.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })), z$1.record(z$1.string(), z$1.unknown())).describe("Full capability declaration for platform-level discovery. Includes spec/schema URLs for agent fetching."))).optional(),
|
|
1594
|
+
"payment_handlers": z$1.record(z$1.array(z$1.intersection(z$1.intersection(z$1.object({
|
|
1595
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1596
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1597
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1598
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1599
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1600
|
+
}).describe("Shared foundation for all UCP entities."), z$1.record(z$1.string(), z$1.unknown())), z$1.record(z$1.string(), z$1.unknown())).describe("Platform declaration for discovery profiles. May include partial config state required for discovery.")))
|
|
1601
|
+
})).describe("Full UCP metadata for platform-level configuration. Hosted at a URI advertised by the platform in request headers.");
|
|
1602
|
+
const UcpBusinessSchema = z$1.intersection(z$1.object({
|
|
1603
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1604
|
+
"services": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1605
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1606
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1607
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1608
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1609
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1610
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({
|
|
1611
|
+
"transport": z$1.enum([
|
|
1612
|
+
"rest",
|
|
1613
|
+
"mcp",
|
|
1614
|
+
"a2a",
|
|
1615
|
+
"embedded"
|
|
1616
|
+
]).describe("Transport protocol for this service binding."),
|
|
1617
|
+
"endpoint": z$1.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
1618
|
+
})))).describe("Service registry keyed by reverse-domain name.").optional(),
|
|
1619
|
+
"capabilities": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1620
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1621
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1622
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1623
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1624
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1625
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({ "extends": z$1.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
1626
|
+
"payment_handlers": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1627
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1628
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1629
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1630
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1631
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1632
|
+
}).describe("Shared foundation for all UCP entities."), z$1.record(z$1.string(), z$1.unknown())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
1633
|
+
}).describe("Base UCP metadata with shared properties for all schema types."), z$1.object({
|
|
1634
|
+
"services": z$1.record(z$1.array(z$1.intersection(z$1.intersection(z$1.object({
|
|
1635
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1636
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1637
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1638
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1639
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1640
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({
|
|
1641
|
+
"transport": z$1.enum([
|
|
1642
|
+
"rest",
|
|
1643
|
+
"mcp",
|
|
1644
|
+
"a2a",
|
|
1645
|
+
"embedded"
|
|
1646
|
+
]).describe("Transport protocol for this service binding."),
|
|
1647
|
+
"endpoint": z$1.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
1648
|
+
})), z$1.union([
|
|
1649
|
+
z$1.object({ "transport": z$1.literal("rest").optional() }),
|
|
1650
|
+
z$1.object({ "transport": z$1.literal("mcp").optional() }),
|
|
1651
|
+
z$1.object({ "transport": z$1.literal("a2a").optional() }),
|
|
1652
|
+
z$1.object({
|
|
1653
|
+
"transport": z$1.literal("embedded").optional(),
|
|
1654
|
+
"config": z$1.object({ "delegate": z$1.array(z$1.string()).describe("Delegations the business allows. At service-level, declares available delegations. In checkout responses, confirms accepted delegations for this session.").optional() }).describe("Per-checkout configuration for embedded transport binding. Allows businesses to vary ECP availability and delegations based on cart contents, agent authorization, or policy.").optional()
|
|
1655
|
+
})
|
|
1656
|
+
])).describe("Service binding for business/merchant configuration. May override platform endpoints."))),
|
|
1657
|
+
"capabilities": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1658
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1659
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1660
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1661
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1662
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1663
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({ "extends": z$1.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })).describe("Capability configuration for business/merchant level. May include business-specific config overrides."))).optional(),
|
|
1664
|
+
"payment_handlers": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1665
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1666
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1667
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1668
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1669
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1670
|
+
}).describe("Shared foundation for all UCP entities."), z$1.record(z$1.string(), z$1.unknown())).describe("Business declaration for discovery profiles. May include partial config state required for discovery.")))
|
|
1671
|
+
})).describe("UCP metadata for business/merchant-level configuration. Subset of platform schema with business-specific settings.");
|
|
1672
|
+
const UcpResponseCheckoutSchema = z$1.intersection(z$1.object({
|
|
1673
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1674
|
+
"services": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1675
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1676
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1677
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1678
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1679
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1680
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({
|
|
1681
|
+
"transport": z$1.enum([
|
|
1682
|
+
"rest",
|
|
1683
|
+
"mcp",
|
|
1684
|
+
"a2a",
|
|
1685
|
+
"embedded"
|
|
1686
|
+
]).describe("Transport protocol for this service binding."),
|
|
1687
|
+
"endpoint": z$1.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
1688
|
+
})))).describe("Service registry keyed by reverse-domain name.").optional(),
|
|
1689
|
+
"capabilities": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1690
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1691
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1692
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1693
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1694
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1695
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({ "extends": z$1.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
1696
|
+
"payment_handlers": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1697
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1698
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1699
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1700
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1701
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1702
|
+
}).describe("Shared foundation for all UCP entities."), z$1.record(z$1.string(), z$1.unknown())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
1703
|
+
}).describe("Base UCP metadata with shared properties for all schema types."), z$1.object({
|
|
1704
|
+
"services": z$1.record(z$1.array(z$1.intersection(z$1.intersection(z$1.object({
|
|
1705
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1706
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1707
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1708
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1709
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1710
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({
|
|
1711
|
+
"transport": z$1.enum([
|
|
1712
|
+
"rest",
|
|
1713
|
+
"mcp",
|
|
1714
|
+
"a2a",
|
|
1715
|
+
"embedded"
|
|
1716
|
+
]).describe("Transport protocol for this service binding."),
|
|
1717
|
+
"endpoint": z$1.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
1718
|
+
})), z$1.union([
|
|
1719
|
+
z$1.object({ "transport": z$1.literal("rest").optional() }),
|
|
1720
|
+
z$1.object({ "transport": z$1.literal("mcp").optional() }),
|
|
1721
|
+
z$1.object({ "transport": z$1.literal("a2a").optional() }),
|
|
1722
|
+
z$1.object({
|
|
1723
|
+
"transport": z$1.literal("embedded").optional(),
|
|
1724
|
+
"config": z$1.object({ "delegate": z$1.array(z$1.string()).describe("Delegations the business allows. At service-level, declares available delegations. In checkout responses, confirms accepted delegations for this session.").optional() }).describe("Per-checkout configuration for embedded transport binding. Allows businesses to vary ECP availability and delegations based on cart contents, agent authorization, or policy.").optional()
|
|
1725
|
+
})
|
|
1726
|
+
])).describe("Service binding in API responses. Includes per-resource transport configuration via typed config."))).optional(),
|
|
1727
|
+
"capabilities": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1728
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1729
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1730
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1731
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1732
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1733
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({ "extends": z$1.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })).describe("Capability reference in responses. Only name/version required to confirm active capabilities."))).optional(),
|
|
1734
|
+
"payment_handlers": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1735
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1736
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1737
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1738
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1739
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1740
|
+
}).describe("Shared foundation for all UCP entities."), z$1.record(z$1.string(), z$1.unknown())).describe("Handler reference in responses. May include full config state for runtime usage of the handler.")))
|
|
1741
|
+
})).describe("UCP metadata for checkout responses.");
|
|
1742
|
+
const UcpResponseOrderSchema = z$1.intersection(z$1.object({
|
|
1743
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("UCP version in YYYY-MM-DD format."),
|
|
1744
|
+
"services": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1745
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1746
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1747
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1748
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1749
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1750
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({
|
|
1751
|
+
"transport": z$1.enum([
|
|
1752
|
+
"rest",
|
|
1753
|
+
"mcp",
|
|
1754
|
+
"a2a",
|
|
1755
|
+
"embedded"
|
|
1756
|
+
]).describe("Transport protocol for this service binding."),
|
|
1757
|
+
"endpoint": z$1.string().url().describe("Endpoint URL for this transport binding.").optional()
|
|
1758
|
+
})))).describe("Service registry keyed by reverse-domain name.").optional(),
|
|
1759
|
+
"capabilities": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1760
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1761
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1762
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1763
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1764
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1765
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({ "extends": z$1.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })))).describe("Capability registry keyed by reverse-domain name.").optional(),
|
|
1766
|
+
"payment_handlers": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1767
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1768
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1769
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1770
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1771
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1772
|
+
}).describe("Shared foundation for all UCP entities."), z$1.record(z$1.string(), z$1.unknown())))).describe("Payment handler registry keyed by reverse-domain name.").optional()
|
|
1773
|
+
}).describe("Base UCP metadata with shared properties for all schema types."), z$1.object({ "capabilities": z$1.record(z$1.array(z$1.intersection(z$1.object({
|
|
1774
|
+
"version": z$1.string().regex(/* @__PURE__ */ new RegExp("^\\d{4}-\\d{2}-\\d{2}$")).describe("Entity version in YYYY-MM-DD format."),
|
|
1775
|
+
"spec": z$1.string().url().describe("URL to human-readable specification document.").optional(),
|
|
1776
|
+
"schema": z$1.string().url().describe("URL to JSON Schema defining this entity's structure and payloads.").optional(),
|
|
1777
|
+
"id": z$1.string().describe("Unique identifier for this entity instance. Used to disambiguate when multiple instances exist.").optional(),
|
|
1778
|
+
"config": z$1.record(z$1.string(), z$1.unknown()).describe("Entity-specific configuration. Structure defined by each entity's schema.").optional()
|
|
1779
|
+
}).describe("Shared foundation for all UCP entities."), z$1.object({ "extends": z$1.string().regex(/* @__PURE__ */ new RegExp("^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$")).describe("Parent capability this extends. Present for extensions, absent for root capabilities.").optional() })).describe("Capability reference in responses. Only name/version required to confirm active capabilities."))).optional() })).describe("UCP metadata for order responses. No payment handlers needed post-purchase.");
|
|
1780
|
+
//#endregion
|
|
1781
|
+
//#region src/extensions.ts
|
|
1782
|
+
const ItemResponseSchema = ItemSchema;
|
|
1783
|
+
const TotalResponseSchema = TotalSchema;
|
|
1784
|
+
const LineItemResponseSchema = LineItemSchema;
|
|
1785
|
+
const FulfillmentResponseSchema = FulfillmentSchema;
|
|
1786
|
+
const FulfillmentMethodResponseSchema = FulfillmentMethodSchema;
|
|
1787
|
+
const CheckoutResponseStatusSchema = z.enum([
|
|
1788
|
+
"incomplete",
|
|
1789
|
+
"requires_escalation",
|
|
1790
|
+
"ready_for_complete",
|
|
1791
|
+
"complete_in_progress",
|
|
1792
|
+
"completed",
|
|
1793
|
+
"canceled"
|
|
1794
|
+
]);
|
|
1795
|
+
const ExtendedPaymentCredentialSchema = PaymentCredentialSchema.extend({ token: z.string().optional() });
|
|
1796
|
+
const PaymentResponseSchema = PaymentSchema.passthrough();
|
|
1797
|
+
const PaymentInstrumentResponseSchema = PaymentInstrumentSchema.passthrough();
|
|
1798
|
+
const UcpDiscoveryProfileSchema = z.object({ ucp: z.object({
|
|
1799
|
+
version: z.string(),
|
|
1800
|
+
capabilities: z.record(z.string(), z.array(UcpEntitySchema)).optional(),
|
|
1801
|
+
services: z.record(z.string(), z.array(UcpEntitySchema)).optional(),
|
|
1802
|
+
payment_handlers: z.array(PaymentHandlerResponseSchema).optional()
|
|
1803
|
+
}) });
|
|
1804
|
+
const PlatformConfigSchema = z.object({ webhook_url: z.string().url().optional() });
|
|
1805
|
+
const FulfillmentRequestSchema = z.object({ methods: z.array(z.object({
|
|
1806
|
+
id: z.string(),
|
|
1807
|
+
type: z.enum(["shipping", "pickup"]),
|
|
1808
|
+
line_item_ids: z.array(z.string()),
|
|
1809
|
+
selected_destination_id: z.string().nullable().optional(),
|
|
1810
|
+
groups: z.array(z.object({
|
|
1811
|
+
id: z.string(),
|
|
1812
|
+
selected_option_id: z.string().nullable().optional()
|
|
1813
|
+
}).passthrough()).optional()
|
|
1814
|
+
}).passthrough()).optional() }).passthrough();
|
|
1815
|
+
const DiscountsObjectSchema = z.object({ codes: z.array(z.string()).optional() }).passthrough();
|
|
1816
|
+
const ConsentSchema = z.object({
|
|
1817
|
+
marketing: z.boolean().optional(),
|
|
1818
|
+
sms: z.boolean().optional(),
|
|
1819
|
+
terms: z.boolean().optional()
|
|
1820
|
+
}).passthrough();
|
|
1821
|
+
const Ap2ResponseSchema = z.object({
|
|
1822
|
+
mandate: z.string().optional(),
|
|
1823
|
+
status: z.string().optional()
|
|
1824
|
+
}).passthrough();
|
|
1825
|
+
const CheckoutResponseSchema = CheckoutSchema.passthrough();
|
|
1826
|
+
const ExtendedCheckoutResponseSchema = CheckoutSchema.extend({
|
|
1827
|
+
fulfillment: FulfillmentResponseSchema.optional(),
|
|
1828
|
+
discounts: DiscountsObjectSchema.optional(),
|
|
1829
|
+
ap2: Ap2ResponseSchema.optional(),
|
|
1830
|
+
order_id: z.string().optional(),
|
|
1831
|
+
order_permalink_url: z.string().optional(),
|
|
1832
|
+
platform: PlatformConfigSchema.optional()
|
|
1833
|
+
}).passthrough();
|
|
1834
|
+
const ExtendedCheckoutCreateRequestSchema = CheckoutCreateRequestSchema.extend({
|
|
1835
|
+
fulfillment: FulfillmentRequestSchema.optional(),
|
|
1836
|
+
discounts: DiscountsObjectSchema.optional(),
|
|
1837
|
+
buyer: BuyerSchema.extend({ consent: ConsentSchema.optional() }).optional()
|
|
1838
|
+
});
|
|
1839
|
+
const ExtendedCheckoutUpdateRequestSchema = CheckoutUpdateRequestSchema.extend({
|
|
1840
|
+
fulfillment: FulfillmentRequestSchema.optional(),
|
|
1841
|
+
discounts: DiscountsObjectSchema.optional(),
|
|
1842
|
+
buyer: BuyerSchema.extend({ consent: ConsentSchema.optional() }).optional()
|
|
1843
|
+
});
|
|
1844
|
+
const OrderUpdateSchema = OrderSchema;
|
|
1845
|
+
//#endregion
|
|
1846
|
+
export { AccountInfoSchema, AdjustmentSchema, Ap2MandateAp2WithCheckoutMandateSchema, Ap2MandateAp2WithMerchantAuthorizationSchema, Ap2MandateCheckoutMandateSchema, Ap2MandateErrorCodeSchema, Ap2MandateMerchantAuthorizationSchema, BindingSchema, BusinessFulfillmentConfigSchema, BuyerConsentBuyerSchema, BuyerConsentConsentSchema, BuyerSchema, CapabilityBaseSchema, CapabilityBusinessSchema, CapabilityPlatformSchema, CapabilityResponseSchema, CardCredentialSchema, CardPaymentInstrumentSchema, CheckoutCompleteRequestSchema, CheckoutCreateRequestSchema, CheckoutResponseSchema, CheckoutResponseStatusSchema, CheckoutSchema, CheckoutUpdateRequestSchema, ContextSchema, DiscountAllocationSchema, DiscountAppliedDiscountSchema, DiscountDiscountsObjectSchema, EmbeddedConfigSchema, ExpectationSchema, ExtendedCheckoutCreateRequestSchema, ExtendedCheckoutResponseSchema, ExtendedCheckoutUpdateRequestSchema, ExtendedPaymentCredentialSchema, FulfillmentAvailableMethodSchema, FulfillmentDestinationSchema, FulfillmentEventSchema, FulfillmentExtensionFulfillmentAvailableMethodSchema, FulfillmentExtensionFulfillmentGroupSchema, FulfillmentExtensionFulfillmentMethodSchema, FulfillmentExtensionFulfillmentOptionSchema, FulfillmentExtensionFulfillmentSchema, FulfillmentGroupSchema, FulfillmentGroupUpdateRequestSchema, FulfillmentMethodCreateRequestSchema, FulfillmentMethodResponseSchema, FulfillmentMethodSchema, FulfillmentMethodUpdateRequestSchema, FulfillmentOptionSchema, FulfillmentResponseSchema, FulfillmentSchema, ItemResponseSchema, ItemSchema, LineItemResponseSchema, LineItemSchema, LineItemUpdateRequestSchema, LinkSchema, MerchantFulfillmentConfigSchema, MessageErrorSchema, MessageInfoSchema, MessageSchema, MessageWarningSchema, OrderConfirmationSchema, OrderLineItemSchema, OrderSchema, OrderUpdateSchema, PaymentCredentialSchema, PaymentHandlerBaseSchema, PaymentHandlerBusinessSchema, PaymentHandlerPlatformSchema, PaymentHandlerResponseSchema, PaymentIdentitySchema, PaymentInstrumentResponseSchema, PaymentInstrumentSchema, PaymentResponseSchema, PaymentSchema, PlatformConfigSchema, PlatformFulfillmentConfigSchema, PostalAddressSchema, RetailLocationSchema, ServiceBaseSchema, ServiceBusinessSchema, ServicePlatformSchema, ServiceResponseSchema, ShippingDestinationSchema, TokenCredentialSchema, TotalResponseSchema, TotalSchema, UcpBaseSchema, UcpBusinessSchema, UcpDiscoveryProfileSchema, UcpEntitySchema, UcpPlatformSchema, UcpResponseCheckoutSchema, UcpResponseOrderSchema, UcpReverseDomainNameSchema, UcpVersionSchema };
|