@reactionary/acp 0.0.0-stage → 0.10.31
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 +21 -0
- package/README.md +156 -2
- package/index.js +2 -0
- package/lib/acp-schemas.js +123 -0
- package/lib/reactionary-acp-server.js +815 -0
- package/package.json +17 -3
- package/src/index.d.ts +2 -0
- package/src/lib/acp-schemas.d.ts +303 -0
- package/src/lib/reactionary-acp-server.d.ts +100 -0
package/package.json
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/acp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.10.31",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Solteq/reactionary.git"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@reactionary/core": "0.10.31",
|
|
13
|
+
"@reactionary/feeds": "0.10.31",
|
|
14
|
+
"zod": "4.1.9"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"vitest": "^4.0.9"
|
|
18
|
+
},
|
|
19
|
+
"sideEffects": false
|
|
6
20
|
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
export declare const ACPItemSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
quantity: z.ZodInt;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export declare const ACPBuyerSchema: z.ZodObject<{
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
email: z.ZodEmail;
|
|
9
|
+
phone_number: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export declare const ACPAddressSchema: z.ZodObject<{
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
line_one: z.ZodString;
|
|
14
|
+
line_two: z.ZodOptional<z.ZodString>;
|
|
15
|
+
city: z.ZodString;
|
|
16
|
+
state: z.ZodString;
|
|
17
|
+
country: z.ZodString;
|
|
18
|
+
postal_code: z.ZodString;
|
|
19
|
+
phone_number: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export declare const ACPCreateCheckoutSessionRequestSchema: z.ZodObject<{
|
|
22
|
+
buyer: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
name: z.ZodString;
|
|
24
|
+
email: z.ZodEmail;
|
|
25
|
+
phone_number: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
items: z.ZodArray<z.ZodObject<{
|
|
28
|
+
id: z.ZodString;
|
|
29
|
+
quantity: z.ZodInt;
|
|
30
|
+
}, z.core.$strip>>;
|
|
31
|
+
fulfillment_address: z.ZodOptional<z.ZodObject<{
|
|
32
|
+
name: z.ZodString;
|
|
33
|
+
line_one: z.ZodString;
|
|
34
|
+
line_two: z.ZodOptional<z.ZodString>;
|
|
35
|
+
city: z.ZodString;
|
|
36
|
+
state: z.ZodString;
|
|
37
|
+
country: z.ZodString;
|
|
38
|
+
postal_code: z.ZodString;
|
|
39
|
+
phone_number: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strip>>;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
export declare const ACPUpdateCheckoutSessionRequestSchema: z.ZodObject<{
|
|
43
|
+
buyer: z.ZodOptional<z.ZodObject<{
|
|
44
|
+
name: z.ZodString;
|
|
45
|
+
email: z.ZodEmail;
|
|
46
|
+
phone_number: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
49
|
+
id: z.ZodString;
|
|
50
|
+
quantity: z.ZodInt;
|
|
51
|
+
}, z.core.$strip>>>;
|
|
52
|
+
fulfillment_address: z.ZodOptional<z.ZodObject<{
|
|
53
|
+
name: z.ZodString;
|
|
54
|
+
line_one: z.ZodString;
|
|
55
|
+
line_two: z.ZodOptional<z.ZodString>;
|
|
56
|
+
city: z.ZodString;
|
|
57
|
+
state: z.ZodString;
|
|
58
|
+
country: z.ZodString;
|
|
59
|
+
postal_code: z.ZodString;
|
|
60
|
+
phone_number: z.ZodOptional<z.ZodString>;
|
|
61
|
+
}, z.core.$strip>>;
|
|
62
|
+
fulfillment_option_id: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export declare const ACPPaymentDataSchema: z.ZodObject<{
|
|
65
|
+
token: z.ZodString;
|
|
66
|
+
provider: z.ZodEnum<{
|
|
67
|
+
stripe: "stripe";
|
|
68
|
+
adyen: "adyen";
|
|
69
|
+
braintree: "braintree";
|
|
70
|
+
}>;
|
|
71
|
+
billing_address: z.ZodOptional<z.ZodObject<{
|
|
72
|
+
name: z.ZodString;
|
|
73
|
+
line_one: z.ZodString;
|
|
74
|
+
line_two: z.ZodOptional<z.ZodString>;
|
|
75
|
+
city: z.ZodString;
|
|
76
|
+
state: z.ZodString;
|
|
77
|
+
country: z.ZodString;
|
|
78
|
+
postal_code: z.ZodString;
|
|
79
|
+
phone_number: z.ZodOptional<z.ZodString>;
|
|
80
|
+
}, z.core.$strip>>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
export declare const ACPCompleteCheckoutSessionRequestSchema: z.ZodObject<{
|
|
83
|
+
buyer: z.ZodOptional<z.ZodObject<{
|
|
84
|
+
name: z.ZodString;
|
|
85
|
+
email: z.ZodEmail;
|
|
86
|
+
phone_number: z.ZodOptional<z.ZodString>;
|
|
87
|
+
}, z.core.$strip>>;
|
|
88
|
+
payment_data: z.ZodObject<{
|
|
89
|
+
token: z.ZodString;
|
|
90
|
+
provider: z.ZodEnum<{
|
|
91
|
+
stripe: "stripe";
|
|
92
|
+
adyen: "adyen";
|
|
93
|
+
braintree: "braintree";
|
|
94
|
+
}>;
|
|
95
|
+
billing_address: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
name: z.ZodString;
|
|
97
|
+
line_one: z.ZodString;
|
|
98
|
+
line_two: z.ZodOptional<z.ZodString>;
|
|
99
|
+
city: z.ZodString;
|
|
100
|
+
state: z.ZodString;
|
|
101
|
+
country: z.ZodString;
|
|
102
|
+
postal_code: z.ZodString;
|
|
103
|
+
phone_number: z.ZodOptional<z.ZodString>;
|
|
104
|
+
}, z.core.$strip>>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
export declare const ACPCheckoutSessionStateSchema: z.ZodObject<{
|
|
108
|
+
id: z.ZodString;
|
|
109
|
+
cartId: z.ZodString;
|
|
110
|
+
checkoutId: z.ZodString;
|
|
111
|
+
status: z.ZodEnum<{
|
|
112
|
+
not_ready_for_payment: "not_ready_for_payment";
|
|
113
|
+
ready_for_payment: "ready_for_payment";
|
|
114
|
+
completed: "completed";
|
|
115
|
+
canceled: "canceled";
|
|
116
|
+
}>;
|
|
117
|
+
buyer: z.ZodOptional<z.ZodObject<{
|
|
118
|
+
name: z.ZodString;
|
|
119
|
+
email: z.ZodEmail;
|
|
120
|
+
phone_number: z.ZodOptional<z.ZodString>;
|
|
121
|
+
}, z.core.$strip>>;
|
|
122
|
+
fulfillmentAddress: z.ZodOptional<z.ZodObject<{
|
|
123
|
+
name: z.ZodString;
|
|
124
|
+
line_one: z.ZodString;
|
|
125
|
+
line_two: z.ZodOptional<z.ZodString>;
|
|
126
|
+
city: z.ZodString;
|
|
127
|
+
state: z.ZodString;
|
|
128
|
+
country: z.ZodString;
|
|
129
|
+
postal_code: z.ZodString;
|
|
130
|
+
phone_number: z.ZodOptional<z.ZodString>;
|
|
131
|
+
}, z.core.$strip>>;
|
|
132
|
+
fulfillmentOptionId: z.ZodOptional<z.ZodString>;
|
|
133
|
+
orderId: z.ZodOptional<z.ZodString>;
|
|
134
|
+
}, z.core.$loose>;
|
|
135
|
+
export declare const ACPDescriptionSchema: z.ZodObject<{
|
|
136
|
+
plain: z.ZodOptional<z.ZodString>;
|
|
137
|
+
html: z.ZodOptional<z.ZodString>;
|
|
138
|
+
markdown: z.ZodOptional<z.ZodString>;
|
|
139
|
+
}, z.core.$strip>;
|
|
140
|
+
export declare const ACPMediaSchema: z.ZodObject<{
|
|
141
|
+
url: z.ZodString;
|
|
142
|
+
alt_text: z.ZodOptional<z.ZodString>;
|
|
143
|
+
}, z.core.$strip>;
|
|
144
|
+
export declare const ACPFeedPriceSchema: z.ZodObject<{
|
|
145
|
+
amount: z.ZodInt;
|
|
146
|
+
currency: z.ZodString;
|
|
147
|
+
}, z.core.$strip>;
|
|
148
|
+
export declare const ACPAvailabilitySchema: z.ZodObject<{
|
|
149
|
+
available: z.ZodOptional<z.ZodBoolean>;
|
|
150
|
+
status: z.ZodOptional<z.ZodString>;
|
|
151
|
+
}, z.core.$strip>;
|
|
152
|
+
export declare const ACPBarcodeSchema: z.ZodObject<{
|
|
153
|
+
type: z.ZodString;
|
|
154
|
+
value: z.ZodString;
|
|
155
|
+
}, z.core.$strip>;
|
|
156
|
+
export declare const ACPVariantOptionSchema: z.ZodObject<{
|
|
157
|
+
name: z.ZodString;
|
|
158
|
+
value: z.ZodString;
|
|
159
|
+
}, z.core.$strip>;
|
|
160
|
+
export declare const ACPFeedVariantSchema: z.ZodObject<{
|
|
161
|
+
id: z.ZodString;
|
|
162
|
+
title: z.ZodString;
|
|
163
|
+
description: z.ZodOptional<z.ZodObject<{
|
|
164
|
+
plain: z.ZodOptional<z.ZodString>;
|
|
165
|
+
html: z.ZodOptional<z.ZodString>;
|
|
166
|
+
markdown: z.ZodOptional<z.ZodString>;
|
|
167
|
+
}, z.core.$strip>>;
|
|
168
|
+
url: z.ZodOptional<z.ZodString>;
|
|
169
|
+
barcodes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
170
|
+
type: z.ZodString;
|
|
171
|
+
value: z.ZodString;
|
|
172
|
+
}, z.core.$strip>>>;
|
|
173
|
+
price: z.ZodOptional<z.ZodObject<{
|
|
174
|
+
amount: z.ZodInt;
|
|
175
|
+
currency: z.ZodString;
|
|
176
|
+
}, z.core.$strip>>;
|
|
177
|
+
list_price: z.ZodOptional<z.ZodObject<{
|
|
178
|
+
amount: z.ZodInt;
|
|
179
|
+
currency: z.ZodString;
|
|
180
|
+
}, z.core.$strip>>;
|
|
181
|
+
availability: z.ZodOptional<z.ZodObject<{
|
|
182
|
+
available: z.ZodOptional<z.ZodBoolean>;
|
|
183
|
+
status: z.ZodOptional<z.ZodString>;
|
|
184
|
+
}, z.core.$strip>>;
|
|
185
|
+
variant_options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
186
|
+
name: z.ZodString;
|
|
187
|
+
value: z.ZodString;
|
|
188
|
+
}, z.core.$strip>>>;
|
|
189
|
+
media: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
190
|
+
url: z.ZodString;
|
|
191
|
+
alt_text: z.ZodOptional<z.ZodString>;
|
|
192
|
+
}, z.core.$strip>>>;
|
|
193
|
+
}, z.core.$strip>;
|
|
194
|
+
export declare const ACPFeedProductSchema: z.ZodObject<{
|
|
195
|
+
id: z.ZodString;
|
|
196
|
+
title: z.ZodOptional<z.ZodString>;
|
|
197
|
+
description: z.ZodOptional<z.ZodObject<{
|
|
198
|
+
plain: z.ZodOptional<z.ZodString>;
|
|
199
|
+
html: z.ZodOptional<z.ZodString>;
|
|
200
|
+
markdown: z.ZodOptional<z.ZodString>;
|
|
201
|
+
}, z.core.$strip>>;
|
|
202
|
+
url: z.ZodOptional<z.ZodString>;
|
|
203
|
+
media: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
204
|
+
url: z.ZodString;
|
|
205
|
+
alt_text: z.ZodOptional<z.ZodString>;
|
|
206
|
+
}, z.core.$strip>>>;
|
|
207
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
208
|
+
id: z.ZodString;
|
|
209
|
+
title: z.ZodString;
|
|
210
|
+
description: z.ZodOptional<z.ZodObject<{
|
|
211
|
+
plain: z.ZodOptional<z.ZodString>;
|
|
212
|
+
html: z.ZodOptional<z.ZodString>;
|
|
213
|
+
markdown: z.ZodOptional<z.ZodString>;
|
|
214
|
+
}, z.core.$strip>>;
|
|
215
|
+
url: z.ZodOptional<z.ZodString>;
|
|
216
|
+
barcodes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
217
|
+
type: z.ZodString;
|
|
218
|
+
value: z.ZodString;
|
|
219
|
+
}, z.core.$strip>>>;
|
|
220
|
+
price: z.ZodOptional<z.ZodObject<{
|
|
221
|
+
amount: z.ZodInt;
|
|
222
|
+
currency: z.ZodString;
|
|
223
|
+
}, z.core.$strip>>;
|
|
224
|
+
list_price: z.ZodOptional<z.ZodObject<{
|
|
225
|
+
amount: z.ZodInt;
|
|
226
|
+
currency: z.ZodString;
|
|
227
|
+
}, z.core.$strip>>;
|
|
228
|
+
availability: z.ZodOptional<z.ZodObject<{
|
|
229
|
+
available: z.ZodOptional<z.ZodBoolean>;
|
|
230
|
+
status: z.ZodOptional<z.ZodString>;
|
|
231
|
+
}, z.core.$strip>>;
|
|
232
|
+
variant_options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
233
|
+
name: z.ZodString;
|
|
234
|
+
value: z.ZodString;
|
|
235
|
+
}, z.core.$strip>>>;
|
|
236
|
+
media: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
237
|
+
url: z.ZodString;
|
|
238
|
+
alt_text: z.ZodOptional<z.ZodString>;
|
|
239
|
+
}, z.core.$strip>>>;
|
|
240
|
+
}, z.core.$strip>>;
|
|
241
|
+
}, z.core.$strip>;
|
|
242
|
+
export declare const ACPProductFeedResponseSchema: z.ZodObject<{
|
|
243
|
+
target_country: z.ZodOptional<z.ZodString>;
|
|
244
|
+
products: z.ZodArray<z.ZodObject<{
|
|
245
|
+
id: z.ZodString;
|
|
246
|
+
title: z.ZodOptional<z.ZodString>;
|
|
247
|
+
description: z.ZodOptional<z.ZodObject<{
|
|
248
|
+
plain: z.ZodOptional<z.ZodString>;
|
|
249
|
+
html: z.ZodOptional<z.ZodString>;
|
|
250
|
+
markdown: z.ZodOptional<z.ZodString>;
|
|
251
|
+
}, z.core.$strip>>;
|
|
252
|
+
url: z.ZodOptional<z.ZodString>;
|
|
253
|
+
media: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
254
|
+
url: z.ZodString;
|
|
255
|
+
alt_text: z.ZodOptional<z.ZodString>;
|
|
256
|
+
}, z.core.$strip>>>;
|
|
257
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
258
|
+
id: z.ZodString;
|
|
259
|
+
title: z.ZodString;
|
|
260
|
+
description: z.ZodOptional<z.ZodObject<{
|
|
261
|
+
plain: z.ZodOptional<z.ZodString>;
|
|
262
|
+
html: z.ZodOptional<z.ZodString>;
|
|
263
|
+
markdown: z.ZodOptional<z.ZodString>;
|
|
264
|
+
}, z.core.$strip>>;
|
|
265
|
+
url: z.ZodOptional<z.ZodString>;
|
|
266
|
+
barcodes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
267
|
+
type: z.ZodString;
|
|
268
|
+
value: z.ZodString;
|
|
269
|
+
}, z.core.$strip>>>;
|
|
270
|
+
price: z.ZodOptional<z.ZodObject<{
|
|
271
|
+
amount: z.ZodInt;
|
|
272
|
+
currency: z.ZodString;
|
|
273
|
+
}, z.core.$strip>>;
|
|
274
|
+
list_price: z.ZodOptional<z.ZodObject<{
|
|
275
|
+
amount: z.ZodInt;
|
|
276
|
+
currency: z.ZodString;
|
|
277
|
+
}, z.core.$strip>>;
|
|
278
|
+
availability: z.ZodOptional<z.ZodObject<{
|
|
279
|
+
available: z.ZodOptional<z.ZodBoolean>;
|
|
280
|
+
status: z.ZodOptional<z.ZodString>;
|
|
281
|
+
}, z.core.$strip>>;
|
|
282
|
+
variant_options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
283
|
+
name: z.ZodString;
|
|
284
|
+
value: z.ZodString;
|
|
285
|
+
}, z.core.$strip>>>;
|
|
286
|
+
media: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
287
|
+
url: z.ZodString;
|
|
288
|
+
alt_text: z.ZodOptional<z.ZodString>;
|
|
289
|
+
}, z.core.$strip>>>;
|
|
290
|
+
}, z.core.$strip>>;
|
|
291
|
+
}, z.core.$strip>>;
|
|
292
|
+
}, z.core.$strip>;
|
|
293
|
+
export type ACPItem = z.infer<typeof ACPItemSchema>;
|
|
294
|
+
export type ACPBuyer = z.infer<typeof ACPBuyerSchema>;
|
|
295
|
+
export type ACPAddress = z.infer<typeof ACPAddressSchema>;
|
|
296
|
+
export type ACPCreateCheckoutSessionRequest = z.infer<typeof ACPCreateCheckoutSessionRequestSchema>;
|
|
297
|
+
export type ACPUpdateCheckoutSessionRequest = z.infer<typeof ACPUpdateCheckoutSessionRequestSchema>;
|
|
298
|
+
export type ACPCompleteCheckoutSessionRequest = z.infer<typeof ACPCompleteCheckoutSessionRequestSchema>;
|
|
299
|
+
export type ACPPaymentData = z.infer<typeof ACPPaymentDataSchema>;
|
|
300
|
+
export type ACPCheckoutSessionState = z.infer<typeof ACPCheckoutSessionStateSchema>;
|
|
301
|
+
export type ACPFeedProduct = z.infer<typeof ACPFeedProductSchema>;
|
|
302
|
+
export type ACPFeedVariant = z.infer<typeof ACPFeedVariantSchema>;
|
|
303
|
+
export type ACPProductFeedResponse = z.infer<typeof ACPProductFeedResponseSchema>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { type Cache, type Cart, type Checkout, type Inventory, type LanguageContext, type PaymentMethod, type Price, type Product, type ProductSearchResult, type RequestContext, type Result, type SearchIdentifier, type ShippingMethod } from '@reactionary/core';
|
|
2
|
+
import { type ReactionaryFeedInventoryOptions, type ReactionaryFeedProcessingOptions } from '@reactionary/feeds';
|
|
3
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
4
|
+
export interface ReactionaryACPClient {
|
|
5
|
+
cart?: {
|
|
6
|
+
createCart(payload: unknown): Promise<Result<Cart>>;
|
|
7
|
+
add(payload: unknown): Promise<Result<Cart>>;
|
|
8
|
+
getById(payload: unknown): Promise<Result<Cart>>;
|
|
9
|
+
};
|
|
10
|
+
checkout?: {
|
|
11
|
+
initiateCheckoutForCart(payload: unknown): Promise<Result<Checkout>>;
|
|
12
|
+
getById(payload: unknown): Promise<Result<Checkout>>;
|
|
13
|
+
setShippingAddress(payload: unknown): Promise<Result<Checkout>>;
|
|
14
|
+
getAvailableShippingMethods(payload: unknown): Promise<Result<ShippingMethod[]>>;
|
|
15
|
+
getAvailablePaymentMethods(payload: unknown): Promise<Result<PaymentMethod[]>>;
|
|
16
|
+
setShippingInstruction(payload: unknown): Promise<Result<Checkout>>;
|
|
17
|
+
addPaymentInstruction(payload: unknown): Promise<Result<Checkout>>;
|
|
18
|
+
finalizeCheckout(payload: unknown): Promise<Result<Checkout>>;
|
|
19
|
+
};
|
|
20
|
+
productSearch?: {
|
|
21
|
+
queryByTerm(payload: unknown): Promise<Result<ProductSearchResult>>;
|
|
22
|
+
};
|
|
23
|
+
product?: {
|
|
24
|
+
getBySKU(payload: unknown): Promise<Result<Product>>;
|
|
25
|
+
};
|
|
26
|
+
price?: {
|
|
27
|
+
getListPrice(payload: unknown): Promise<Result<Price>>;
|
|
28
|
+
getCustomerPrice(payload: unknown): Promise<Result<Price>>;
|
|
29
|
+
};
|
|
30
|
+
inventory?: {
|
|
31
|
+
getBySKU(payload: unknown): Promise<Result<Inventory>>;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export type ReactionaryACPClientFactory<TClient extends ReactionaryACPClient = ReactionaryACPClient> = (requestContext: RequestContext) => TClient;
|
|
35
|
+
export interface ReactionaryACPServerOptions {
|
|
36
|
+
name?: string;
|
|
37
|
+
version?: string;
|
|
38
|
+
basePath?: string;
|
|
39
|
+
sessionCache?: Cache;
|
|
40
|
+
sessionTtlSeconds?: number;
|
|
41
|
+
checkoutSessionTtlSeconds?: number;
|
|
42
|
+
paymentProvider?: ACPPaymentProvider;
|
|
43
|
+
links?: ACPLink[];
|
|
44
|
+
productFeed?: ACPProductFeedOptions;
|
|
45
|
+
}
|
|
46
|
+
export type ACPPaymentProcessor = 'stripe' | 'adyen' | 'braintree';
|
|
47
|
+
export interface ACPPaymentProvider {
|
|
48
|
+
provider: ACPPaymentProcessor;
|
|
49
|
+
supported_payment_methods: ['card'];
|
|
50
|
+
}
|
|
51
|
+
export interface ACPLink {
|
|
52
|
+
type: 'terms_of_use' | 'privacy_policy' | 'seller_shop_policies';
|
|
53
|
+
url: string;
|
|
54
|
+
}
|
|
55
|
+
export interface ACPProductFeedOptions extends ReactionaryFeedInventoryOptions, ReactionaryFeedProcessingOptions {
|
|
56
|
+
feeds: Record<string, ACPProductFeedDefinition>;
|
|
57
|
+
}
|
|
58
|
+
export interface ACPProductFeedDefinition {
|
|
59
|
+
languageContext: LanguageContext;
|
|
60
|
+
search: SearchIdentifier;
|
|
61
|
+
pageSize?: number;
|
|
62
|
+
maxPages?: number;
|
|
63
|
+
productUrlBase?: string;
|
|
64
|
+
fulfillmentCenterKeys?: string[];
|
|
65
|
+
fulfillmentCenterKey?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface ReactionaryACPHttpHandler {
|
|
68
|
+
fetch(request: Request): Promise<Response>;
|
|
69
|
+
close(): Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
export type ReactionaryACPNodeRequestHandler = (request: IncomingMessage, response: ServerResponse) => Promise<void>;
|
|
72
|
+
export declare class ReactionaryACPServer<TClient extends ReactionaryACPClient = ReactionaryACPClient> {
|
|
73
|
+
private readonly clientFactory;
|
|
74
|
+
private readonly options;
|
|
75
|
+
private readonly sessionStore;
|
|
76
|
+
private readonly checkoutSessionStore;
|
|
77
|
+
constructor(clientFactory: ReactionaryACPClientFactory<TClient>, options?: ReactionaryACPServerOptions);
|
|
78
|
+
fetch(request: Request): Promise<Response>;
|
|
79
|
+
getHandler(): ReactionaryACPHttpHandler;
|
|
80
|
+
toNodeHandler(): ReactionaryACPNodeRequestHandler;
|
|
81
|
+
close(): Promise<void>;
|
|
82
|
+
private createRequestContext;
|
|
83
|
+
private handleRequest;
|
|
84
|
+
private getReadinessDocument;
|
|
85
|
+
private getProductFeed;
|
|
86
|
+
private getRequestedProductFeed;
|
|
87
|
+
private getProductFeedDefinition;
|
|
88
|
+
private handlePost;
|
|
89
|
+
private createCheckoutSession;
|
|
90
|
+
private updateCheckoutSession;
|
|
91
|
+
private getCheckoutSession;
|
|
92
|
+
private completeCheckoutSession;
|
|
93
|
+
private cancelCheckoutSession;
|
|
94
|
+
private createCartForItems;
|
|
95
|
+
private getRequiredCheckoutSessionState;
|
|
96
|
+
private getReactionaryCheckout;
|
|
97
|
+
private toACPCheckoutSession;
|
|
98
|
+
private getFulfillmentOptions;
|
|
99
|
+
private getPaymentProvider;
|
|
100
|
+
}
|