@kizlo/woocommerce 1.0.0-alpha.1
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 +10 -0
- package/dist/client-ChYuRMN-.cjs +684 -0
- package/dist/client-g0rDKQEG.js +511 -0
- package/dist/client-g0rDKQEG.js.map +1 -0
- package/dist/index-B70N6Qy2.d.ts +12797 -0
- package/dist/index-B70N6Qy2.d.ts.map +1 -0
- package/dist/index-DbjII-g1.d.cts +12797 -0
- package/dist/index-DbjII-g1.d.cts.map +1 -0
- package/dist/index.cjs +80 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/server.cjs +8 -0
- package/dist/server.d.cts +2 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +3 -0
- package/package.json +45 -0
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
import { PayPaymentInput, handleResult, type } from "kizlo";
|
|
2
|
+
import { defineServerExtension, defineSharedExtension, kz, procedureErrors } from "kizlo/extensions";
|
|
3
|
+
|
|
4
|
+
//#region src/client.extension.ts
|
|
5
|
+
const woocommerceSharedMiddleware = kz.shared.middleware(({ context, next }) => {
|
|
6
|
+
return next({ context: { woocommerce: new WooCommerceService(context) } });
|
|
7
|
+
});
|
|
8
|
+
const woocommerceSharedProcedure = kz.shared.use(woocommerceSharedMiddleware);
|
|
9
|
+
function woocommerce() {
|
|
10
|
+
return defineSharedExtension({
|
|
11
|
+
name: "woocommerce",
|
|
12
|
+
type: "router",
|
|
13
|
+
init() {
|
|
14
|
+
return woocommerceSharedRouter;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/cart/client.ts
|
|
21
|
+
var CartItemService = class {
|
|
22
|
+
constructor(kizlo) {
|
|
23
|
+
this.kizlo = kizlo;
|
|
24
|
+
}
|
|
25
|
+
async add(input) {
|
|
26
|
+
return this.kizlo.auth.withAuth(async ({ headers }) => {
|
|
27
|
+
const response = await this.kizlo._.http.post("/cart/items", {
|
|
28
|
+
body: input,
|
|
29
|
+
headers
|
|
30
|
+
});
|
|
31
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
32
|
+
return this.kizlo._.http.success(response.data);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async update(input) {
|
|
36
|
+
return this.kizlo.auth.withAuth(async ({ headers }) => {
|
|
37
|
+
const response = await this.kizlo._.http.put(`/cart/items/${input.key}`, {
|
|
38
|
+
body: input,
|
|
39
|
+
headers
|
|
40
|
+
});
|
|
41
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
42
|
+
return this.kizlo._.http.success(response.data);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async remove(input) {
|
|
46
|
+
return this.kizlo.auth.withAuth(async ({ headers }) => {
|
|
47
|
+
const response = await this.kizlo._.http.delete(`/cart/items/${input.key}`, { headers });
|
|
48
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
49
|
+
return this.kizlo._.http.success(response.data);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var CartCouponClient = class {
|
|
54
|
+
constructor(kizlo) {
|
|
55
|
+
this.kizlo = kizlo;
|
|
56
|
+
}
|
|
57
|
+
async apply(input) {
|
|
58
|
+
return this.kizlo.auth.withAuth(async ({ headers }) => {
|
|
59
|
+
const response = await this.kizlo._.http.post(`/cart/coupons/${input.code}`, { headers });
|
|
60
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
61
|
+
return this.kizlo._.http.success(response.data);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
async remove(input) {
|
|
65
|
+
return this.kizlo.auth.withAuth(async ({ headers }) => {
|
|
66
|
+
const response = await this.kizlo._.http.delete(`/cart/coupons/${input.code}`, { headers });
|
|
67
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
68
|
+
return this.kizlo._.http.success(response.data);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
var CartService = class {
|
|
73
|
+
items;
|
|
74
|
+
coupons;
|
|
75
|
+
constructor(kizlo) {
|
|
76
|
+
this.kizlo = kizlo;
|
|
77
|
+
this.items = new CartItemService(this.kizlo);
|
|
78
|
+
this.coupons = new CartCouponClient(this.kizlo);
|
|
79
|
+
}
|
|
80
|
+
async retrieve() {
|
|
81
|
+
return this.kizlo.auth.withAuth(async ({ headers }) => {
|
|
82
|
+
const response = await this.kizlo._.http.get("/cart", { headers });
|
|
83
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
84
|
+
return this.kizlo._.http.success(response.data);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
async update(input) {
|
|
88
|
+
return this.kizlo.auth.withAuth(async ({ headers }) => {
|
|
89
|
+
const response = await this.kizlo._.http.put("/cart", {
|
|
90
|
+
body: input,
|
|
91
|
+
headers
|
|
92
|
+
});
|
|
93
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
94
|
+
return this.kizlo._.http.success(response.data);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const cartRouter = {
|
|
99
|
+
retrieve: woocommerceSharedProcedure.output(type()).errors(procedureErrors()).handler(async ({ context }) => {
|
|
100
|
+
return handleResult(await context.woocommerce.cart.retrieve());
|
|
101
|
+
}),
|
|
102
|
+
update: woocommerceSharedProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
103
|
+
return handleResult(await context.woocommerce.cart.update(input));
|
|
104
|
+
}),
|
|
105
|
+
items: {
|
|
106
|
+
add: woocommerceSharedProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
107
|
+
return handleResult(await context.woocommerce.cart.items.add(input));
|
|
108
|
+
}),
|
|
109
|
+
update: woocommerceSharedProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
110
|
+
return handleResult(await context.woocommerce.cart.items.update(input));
|
|
111
|
+
}),
|
|
112
|
+
remove: woocommerceSharedProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
113
|
+
return handleResult(await context.woocommerce.cart.items.remove(input));
|
|
114
|
+
})
|
|
115
|
+
},
|
|
116
|
+
coupons: {
|
|
117
|
+
apply: woocommerceSharedProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
118
|
+
return handleResult(await context.woocommerce.cart.coupons.apply(input));
|
|
119
|
+
}),
|
|
120
|
+
remove: woocommerceSharedProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
121
|
+
return handleResult(await context.woocommerce.cart.coupons.remove(input));
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/customer/client.ts
|
|
128
|
+
var AddressService = class {
|
|
129
|
+
constructor(kizlo) {
|
|
130
|
+
this.kizlo = kizlo;
|
|
131
|
+
}
|
|
132
|
+
async create(input) {
|
|
133
|
+
return this.kizlo.auth.withAuth(async ({ headers }) => {
|
|
134
|
+
const response = await this.kizlo._.http.post("/customers/addresses", {
|
|
135
|
+
body: input,
|
|
136
|
+
headers
|
|
137
|
+
});
|
|
138
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
139
|
+
return this.kizlo._.http.success(response.data);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
async update(input) {
|
|
143
|
+
return this.kizlo.auth.withAuth(async ({ headers }) => {
|
|
144
|
+
const response = await this.kizlo._.http.put(`/customers/addresses/${input.id}`, {
|
|
145
|
+
body: input,
|
|
146
|
+
headers
|
|
147
|
+
});
|
|
148
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
149
|
+
return this.kizlo._.http.success(response.data);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
async delete(input) {
|
|
153
|
+
return this.kizlo.auth.withAuth(async ({ headers }) => {
|
|
154
|
+
const response = await this.kizlo._.http.delete(`/customers/addresses/${input.id}`, { headers });
|
|
155
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
156
|
+
return this.kizlo._.http.success(response.data);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
var CustomerService = class {
|
|
161
|
+
address;
|
|
162
|
+
constructor(kizlo) {
|
|
163
|
+
this.kizlo = kizlo;
|
|
164
|
+
this.address = new AddressService(this.kizlo);
|
|
165
|
+
}
|
|
166
|
+
async retrieve() {
|
|
167
|
+
return this.kizlo.auth.withAuth(async ({ headers }) => {
|
|
168
|
+
const response = await this.kizlo._.http.get("/customers", { headers });
|
|
169
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
170
|
+
return this.kizlo._.http.success(response.data);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const customerRouter = {
|
|
175
|
+
retrieve: woocommerceSharedProcedure.output(type()).errors(procedureErrors()).handler(async ({ context }) => {
|
|
176
|
+
return handleResult(await context.woocommerce.customer.retrieve());
|
|
177
|
+
}),
|
|
178
|
+
address: {
|
|
179
|
+
create: woocommerceSharedProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
180
|
+
return handleResult(await context.woocommerce.customer.address.create(input));
|
|
181
|
+
}),
|
|
182
|
+
update: woocommerceSharedProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
183
|
+
return handleResult(await context.woocommerce.customer.address.update(input));
|
|
184
|
+
}),
|
|
185
|
+
delete: woocommerceSharedProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
186
|
+
return handleResult(await context.woocommerce.customer.address.delete(input));
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region src/order/client.ts
|
|
193
|
+
var OrderService = class {
|
|
194
|
+
constructor(kizlo) {
|
|
195
|
+
this.kizlo = kizlo;
|
|
196
|
+
}
|
|
197
|
+
async retrieve(params) {
|
|
198
|
+
return this.kizlo.auth.withAuth(async ({ headers }) => {
|
|
199
|
+
const response = await this.kizlo._.http.get(`/orders/${params.id}`, { headers });
|
|
200
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
201
|
+
return this.kizlo._.http.success(response.data);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
async list(params) {
|
|
205
|
+
return this.kizlo.auth.withAuth(async ({ headers }) => {
|
|
206
|
+
const response = await this.kizlo._.http.get("/orders", {
|
|
207
|
+
headers,
|
|
208
|
+
query: params
|
|
209
|
+
});
|
|
210
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
211
|
+
return this.kizlo._.http.success(response.data);
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
const orderRouter = {
|
|
216
|
+
retrieve: woocommerceSharedProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
217
|
+
return handleResult(await context.woocommerce.orders.retrieve(input));
|
|
218
|
+
}),
|
|
219
|
+
list: woocommerceSharedProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
220
|
+
return handleResult(await context.woocommerce.orders.list(input));
|
|
221
|
+
})
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/server.client.ts
|
|
226
|
+
function createWoocommerceServerRouter(options) {
|
|
227
|
+
return {
|
|
228
|
+
...woocommerceSharedRouter,
|
|
229
|
+
payment: createPaymentRouter(options)
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
//#endregion
|
|
234
|
+
//#region src/server.extension.ts
|
|
235
|
+
const woocommerceServerMiddleware = kz.server.middleware(({ context, next }) => {
|
|
236
|
+
return next({ context: { woocommerce: new WooCommerceService(context) } });
|
|
237
|
+
});
|
|
238
|
+
const woocommerceServerProcedure = kz.server.use(woocommerceServerMiddleware);
|
|
239
|
+
const woocommerceHttpMiddleware = kz.http.middleware(({ context, next }) => {
|
|
240
|
+
return next({ context: { woocommerce: new WooCommerceService(context) } });
|
|
241
|
+
});
|
|
242
|
+
const woocommerceHttpProcedure = kz.http.use(woocommerceHttpMiddleware);
|
|
243
|
+
function woocommerceServer(options) {
|
|
244
|
+
return defineServerExtension({
|
|
245
|
+
name: "woocommerce",
|
|
246
|
+
init() {
|
|
247
|
+
return createWoocommerceServerRouter(options);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
//#endregion
|
|
253
|
+
//#region src/payment/server.ts
|
|
254
|
+
var PaymentService = class {
|
|
255
|
+
constructor(kizlo) {
|
|
256
|
+
this.kizlo = kizlo;
|
|
257
|
+
}
|
|
258
|
+
async confirm(input) {
|
|
259
|
+
const response = await this.kizlo._.http.post("/payment", { body: input });
|
|
260
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
261
|
+
return this.kizlo._.http.success(response.data);
|
|
262
|
+
}
|
|
263
|
+
async update(input) {
|
|
264
|
+
const response = await this.kizlo._.http.put(`/payment/${input.id}`, { body: input });
|
|
265
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
266
|
+
return this.kizlo._.http.success(response.data);
|
|
267
|
+
}
|
|
268
|
+
async listMethods(input) {
|
|
269
|
+
const groups = /* @__PURE__ */ new Map();
|
|
270
|
+
for (const adapter of input.adapters) {
|
|
271
|
+
const config = adapter;
|
|
272
|
+
if (!groups.has(config.type)) groups.set(config.type, []);
|
|
273
|
+
groups.get(config.type)?.push(config);
|
|
274
|
+
}
|
|
275
|
+
const getPrioritizedAdapter = (group) => {
|
|
276
|
+
let best = null;
|
|
277
|
+
for (const adapter of group) if (!best || adapter.priority > best.priority) best = adapter;
|
|
278
|
+
return best;
|
|
279
|
+
};
|
|
280
|
+
const methods = [];
|
|
281
|
+
for (const [, group] of groups) {
|
|
282
|
+
const selectedAdapters = [];
|
|
283
|
+
const combinableAdapters = group.filter((adapter) => adapter.isCombinable);
|
|
284
|
+
if (combinableAdapters.length > 1) for (const adapter of combinableAdapters) selectedAdapters.push(adapter);
|
|
285
|
+
else {
|
|
286
|
+
const bestAdapter = getPrioritizedAdapter(group);
|
|
287
|
+
if (bestAdapter) selectedAdapters.push(bestAdapter);
|
|
288
|
+
}
|
|
289
|
+
for (const adapter of selectedAdapters) {
|
|
290
|
+
const eligibility = await adapter.eligibility?.(input.context);
|
|
291
|
+
if (eligibility?.is_hidden) continue;
|
|
292
|
+
methods.push({
|
|
293
|
+
id: adapter.id,
|
|
294
|
+
type: adapter.type,
|
|
295
|
+
name: eligibility?.name ?? adapter.name,
|
|
296
|
+
is_disabled: eligibility?.is_disabled ?? false,
|
|
297
|
+
description: eligibility?.description ?? adapter.description
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
if (new Set(methods.map((method) => method.id)).size !== methods.length) return this.kizlo._.http.error("PAYMENT_DUPLICATE_ADAPTERS");
|
|
302
|
+
return this.kizlo._.http.success(methods);
|
|
303
|
+
}
|
|
304
|
+
async pay(input) {
|
|
305
|
+
const adapter = input.adapters.find((adp) => adp.id === input.payment_method_id);
|
|
306
|
+
if (!adapter) return this.kizlo._.http.error("PAYMENT_ADAPTER_NOT_FOUND");
|
|
307
|
+
const session = await this.kizlo.auth.getSession();
|
|
308
|
+
if (!session) return this.kizlo._.http.error("AUTH_REQUIRED");
|
|
309
|
+
const confirmResult = await this.confirm({
|
|
310
|
+
user_id: session.user.id,
|
|
311
|
+
payment_method_id: adapter.id,
|
|
312
|
+
payment_method_name: adapter.name,
|
|
313
|
+
payment_method_type: adapter.type
|
|
314
|
+
});
|
|
315
|
+
if (confirmResult.isError) return this.kizlo._.http.error(confirmResult.error);
|
|
316
|
+
if (adapter.type === "online") {
|
|
317
|
+
const intent = await adapter.create({ order: confirmResult.data }, input.context);
|
|
318
|
+
if (!intent || !intent.url) return this.kizlo._.http.error("PAYMENT_ADAPTER_NOT_FOUND");
|
|
319
|
+
const updateResult = await this.update({
|
|
320
|
+
id: confirmResult.data.id,
|
|
321
|
+
payment_status: intent.status,
|
|
322
|
+
payment_session_id: intent.id,
|
|
323
|
+
transaction_id: intent.transaction_id,
|
|
324
|
+
payment_url: intent.url
|
|
325
|
+
});
|
|
326
|
+
if (updateResult.isError) return this.kizlo._.http.error(updateResult.error);
|
|
327
|
+
return this.kizlo._.http.success({ redirect_url: intent.url });
|
|
328
|
+
}
|
|
329
|
+
return this.kizlo._.http.success({ redirect_url: "" });
|
|
330
|
+
}
|
|
331
|
+
listWebhookEndpoint(input) {
|
|
332
|
+
return input.adapters.reduce((acc, curr) => {
|
|
333
|
+
if (curr.type === "online") {
|
|
334
|
+
acc.push({
|
|
335
|
+
id: curr.id,
|
|
336
|
+
name: curr.name,
|
|
337
|
+
webhook_endpoint: new URL(`${input.context._.basePath}/payment/webhooks/${curr.id}`, this.kizlo._.baseUrl).toString()
|
|
338
|
+
});
|
|
339
|
+
return acc;
|
|
340
|
+
}
|
|
341
|
+
return acc;
|
|
342
|
+
}, []);
|
|
343
|
+
}
|
|
344
|
+
async handleWebhook(input) {
|
|
345
|
+
const adapter = input.adapters.find((a) => a.id === input.payment_method_id);
|
|
346
|
+
if (!adapter || adapter.type !== "online") return this.kizlo._.http.error("PAYMENT_ADAPTER_NOT_FOUND");
|
|
347
|
+
const data = await adapter.verify(input.context);
|
|
348
|
+
if (!data) return this.kizlo._.http.error("UNAUTHORIZED");
|
|
349
|
+
const updateResult = await this.update({
|
|
350
|
+
id: data.order_id,
|
|
351
|
+
payment_status: data.status,
|
|
352
|
+
transaction_id: data.transaction_id
|
|
353
|
+
});
|
|
354
|
+
if (updateResult.error) return this.kizlo._.http.error(updateResult.error);
|
|
355
|
+
return this.kizlo._.http.success({ success: true });
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
function createPaymentRouter(options) {
|
|
359
|
+
return {
|
|
360
|
+
confirm: woocommerceServerProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
361
|
+
return handleResult(await context.woocommerce.payment.confirm(input));
|
|
362
|
+
}),
|
|
363
|
+
update: woocommerceServerProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
364
|
+
return handleResult(await context.woocommerce.payment.update(input));
|
|
365
|
+
}),
|
|
366
|
+
methods: woocommerceHttpProcedure.output(type()).errors(procedureErrors()).handler(async ({ context }) => {
|
|
367
|
+
return handleResult(await context.woocommerce.payment.listMethods({
|
|
368
|
+
context,
|
|
369
|
+
adapters: options?.paymentAdapters ?? []
|
|
370
|
+
}));
|
|
371
|
+
}),
|
|
372
|
+
pay: woocommerceHttpProcedure.input(PayPaymentInput).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
373
|
+
return handleResult(await context.woocommerce.payment.pay({
|
|
374
|
+
context,
|
|
375
|
+
success_url: "",
|
|
376
|
+
adapters: options?.paymentAdapters ?? [],
|
|
377
|
+
payment_method_id: input.payment_method_id
|
|
378
|
+
}));
|
|
379
|
+
}),
|
|
380
|
+
webhooks: {
|
|
381
|
+
endpoints: woocommerceHttpProcedure.route({
|
|
382
|
+
method: "GET",
|
|
383
|
+
path: "/payment/webhooks"
|
|
384
|
+
}).output(type()).handler(async ({ context }) => {
|
|
385
|
+
return handleResult(context.woocommerce.payment.listWebhookEndpoint({
|
|
386
|
+
context,
|
|
387
|
+
adapters: options?.paymentAdapters ?? []
|
|
388
|
+
}));
|
|
389
|
+
}),
|
|
390
|
+
receive: woocommerceHttpProcedure.route({
|
|
391
|
+
method: "POST",
|
|
392
|
+
path: "/payment/webhooks/{id}",
|
|
393
|
+
inputStructure: "detailed"
|
|
394
|
+
}).input(type()).handler(async ({ input, context }) => {
|
|
395
|
+
return handleResult(context.woocommerce.payment.handleWebhook({
|
|
396
|
+
context,
|
|
397
|
+
payment_method_id: input.params.id,
|
|
398
|
+
adapters: options?.paymentAdapters ?? []
|
|
399
|
+
}));
|
|
400
|
+
})
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
//#endregion
|
|
406
|
+
//#region src/product/client.ts
|
|
407
|
+
var ProductService = class {
|
|
408
|
+
reviews;
|
|
409
|
+
constructor(kizlo) {
|
|
410
|
+
this.kizlo = kizlo;
|
|
411
|
+
this.reviews = new ReviewService(this.kizlo);
|
|
412
|
+
}
|
|
413
|
+
async retrieve(input) {
|
|
414
|
+
const response = await this.kizlo._.http.get(`/products/${input.slug}`, { query: { preview: input.preview } });
|
|
415
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
416
|
+
return this.kizlo._.http.success(response.data);
|
|
417
|
+
}
|
|
418
|
+
async list(input) {
|
|
419
|
+
const response = await this.kizlo._.http.get("/products", { query: input });
|
|
420
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
421
|
+
return this.kizlo._.http.success(response.data);
|
|
422
|
+
}
|
|
423
|
+
async collection(input) {
|
|
424
|
+
const response = await this.kizlo._.http.get("/products/collection", { query: input });
|
|
425
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
426
|
+
return this.kizlo._.http.success(response.data);
|
|
427
|
+
}
|
|
428
|
+
async categories(input) {
|
|
429
|
+
const response = await this.kizlo._.http.get("/products/categories", { query: input });
|
|
430
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
431
|
+
return this.kizlo._.http.success(response.data);
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
var ReviewService = class {
|
|
435
|
+
constructor(kizlo) {
|
|
436
|
+
this.kizlo = kizlo;
|
|
437
|
+
}
|
|
438
|
+
async retrieve(input) {
|
|
439
|
+
const response = await this.kizlo._.http.get(`/products/reviews/${input.id}`, { query: input });
|
|
440
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
441
|
+
return this.kizlo._.http.success(response.data);
|
|
442
|
+
}
|
|
443
|
+
async list(input) {
|
|
444
|
+
const response = await this.kizlo._.http.get("/products/reviews", { query: input });
|
|
445
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
446
|
+
return this.kizlo._.http.success(response.data);
|
|
447
|
+
}
|
|
448
|
+
async create(input) {
|
|
449
|
+
return this.kizlo.auth.withAuth(async ({ headers }) => {
|
|
450
|
+
const response = await this.kizlo._.http.post("/products/reviews", {
|
|
451
|
+
headers,
|
|
452
|
+
body: input
|
|
453
|
+
});
|
|
454
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
455
|
+
return this.kizlo._.http.success(response.data);
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
const productRouter = {
|
|
460
|
+
retrieve: woocommerceSharedProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
461
|
+
return handleResult(await context.woocommerce.products.retrieve(input));
|
|
462
|
+
}),
|
|
463
|
+
list: woocommerceSharedProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
464
|
+
return handleResult(await context.woocommerce.products.list(input));
|
|
465
|
+
}),
|
|
466
|
+
collection: woocommerceSharedProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
467
|
+
return handleResult(await context.woocommerce.products.collection(input));
|
|
468
|
+
}),
|
|
469
|
+
categories: woocommerceSharedProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
470
|
+
return handleResult(await context.woocommerce.products.categories(input));
|
|
471
|
+
}),
|
|
472
|
+
reviews: {
|
|
473
|
+
retrieve: woocommerceSharedProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
474
|
+
return handleResult(await context.woocommerce.products.reviews.retrieve(input));
|
|
475
|
+
}),
|
|
476
|
+
list: woocommerceSharedProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
477
|
+
return handleResult(await context.woocommerce.products.reviews.list(input));
|
|
478
|
+
}),
|
|
479
|
+
create: woocommerceSharedProcedure.input(type()).output(type()).errors(procedureErrors()).handler(async ({ input, context }) => {
|
|
480
|
+
return handleResult(await context.woocommerce.products.reviews.create(input));
|
|
481
|
+
})
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
//#endregion
|
|
486
|
+
//#region src/client.ts
|
|
487
|
+
var WooCommerceService = class {
|
|
488
|
+
cart;
|
|
489
|
+
orders;
|
|
490
|
+
customer;
|
|
491
|
+
products;
|
|
492
|
+
payment;
|
|
493
|
+
constructor(kizlo) {
|
|
494
|
+
this.kizlo = kizlo;
|
|
495
|
+
this.cart = new CartService(this.kizlo);
|
|
496
|
+
this.orders = new OrderService(this.kizlo);
|
|
497
|
+
this.customer = new CustomerService(this.kizlo);
|
|
498
|
+
this.products = new ProductService(this.kizlo);
|
|
499
|
+
this.payment = new PaymentService(this.kizlo);
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
const woocommerceSharedRouter = {
|
|
503
|
+
cart: cartRouter,
|
|
504
|
+
orders: orderRouter,
|
|
505
|
+
products: productRouter,
|
|
506
|
+
customer: customerRouter
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
//#endregion
|
|
510
|
+
export { woocommerce as C, cartRouter as S, woocommerceSharedProcedure as T, CustomerService as _, productRouter as a, CartItemService as b, woocommerceHttpMiddleware as c, woocommerceServerMiddleware as d, woocommerceServerProcedure as f, AddressService as g, orderRouter as h, ReviewService as i, woocommerceHttpProcedure as l, OrderService as m, woocommerceSharedRouter as n, PaymentService as o, createWoocommerceServerRouter as p, ProductService as r, createPaymentRouter as s, WooCommerceService as t, woocommerceServer as u, customerRouter as v, woocommerceSharedMiddleware as w, CartService as x, CartCouponClient as y };
|
|
511
|
+
//# sourceMappingURL=client-g0rDKQEG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-g0rDKQEG.js","names":["kizlo: KizloService","kizlo: KizloService","kizlo: KizloService","kizlo: KizloService","best: PaymentAdapter | null","methods: PaymentMethod[]","selectedAdapters: PaymentAdapter[]","kizlo: KizloService","kizlo: KizloService"],"sources":["../src/client.extension.ts","../src/cart/client.ts","../src/customer/client.ts","../src/order/client.ts","../src/server.client.ts","../src/server.extension.ts","../src/payment/server.ts","../src/product/client.ts","../src/client.ts"],"sourcesContent":["import type { SharedExtension, SharedProcedureContext } from \"kizlo\";\nimport { defineSharedExtension, kz } from \"kizlo/extensions\";\nimport { WooCommerceService, type WooCommerceSharedRouter, woocommerceSharedRouter } from \"./client\";\n\nexport interface WooCommerceSharedProcedureContext extends SharedProcedureContext {\n\twoocommerce: WooCommerceService;\n}\n\nexport const woocommerceSharedMiddleware = kz.shared.middleware(({ context, next }) => {\n\tconst woocommerce = new WooCommerceService(context);\n\treturn next({ context: { woocommerce } });\n});\n\nexport const woocommerceSharedProcedure = kz.shared.use(woocommerceSharedMiddleware);\n\nexport type WooCommerceClientExtension = SharedExtension<\"woocommerce\", WooCommerceSharedRouter>;\n\nexport function woocommerce(): WooCommerceClientExtension {\n\treturn defineSharedExtension({\n\t\tname: \"woocommerce\",\n\t\ttype: \"router\",\n\t\tinit() {\n\t\t\treturn woocommerceSharedRouter;\n\t\t},\n\t});\n}\n","import {\n\ttype AddCartItemErrorCode,\n\ttype AddCartItemInput,\n\ttype AddCartItemResponse,\n\ttype ApplyCartCouponErrorCode,\n\ttype ApplyCartCouponInput,\n\ttype ApplyCartCouponResponse,\n\thandleResult,\n\ttype KizloService,\n\ttype RemoveCartCouponErrorCode,\n\ttype RemoveCartCouponInput,\n\ttype RemoveCartCouponResponse,\n\ttype RemoveCartItemErrorCode,\n\ttype RemoveCartItemInput,\n\ttype RemoveCartItemResponse,\n\ttype RetrieveCartErrorCode,\n\ttype RetrieveCartResponse,\n\ttype,\n\ttype UpdateCartErrorCode,\n\ttype UpdateCartInput,\n\ttype UpdateCartItemErrorCode,\n\ttype UpdateCartItemInput,\n\ttype UpdateCartItemResponse,\n\ttype UpdateCartResponse,\n} from \"kizlo\";\nimport { procedureErrors } from \"kizlo/extensions\";\nimport { woocommerceSharedProcedure } from \"../client.extension\";\nimport type {\n\tAddCartItemResult,\n\tApplyCartCouponResult,\n\tRemoveCartCouponResult,\n\tRemoveCartItemResult,\n\tRetrieveCartResult,\n\tUpdateCartItemResult,\n\tUpdateCartResult,\n} from \"./types\";\n\nexport class CartItemService {\n\tconstructor(private readonly kizlo: KizloService) {}\n\n\tpublic async add(input: AddCartItemInput): Promise<AddCartItemResult> {\n\t\treturn this.kizlo.auth.withAuth(async ({ headers }) => {\n\t\t\tconst response = await this.kizlo._.http.post<AddCartItemResponse, AddCartItemErrorCode>(\"/cart/items\", {\n\t\t\t\tbody: input,\n\t\t\t\theaders,\n\t\t\t});\n\t\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\t\treturn this.kizlo._.http.success(response.data);\n\t\t});\n\t}\n\n\tpublic async update(input: UpdateCartItemInput): Promise<UpdateCartItemResult> {\n\t\treturn this.kizlo.auth.withAuth(async ({ headers }) => {\n\t\t\tconst response = await this.kizlo._.http.put<UpdateCartItemResponse, UpdateCartItemErrorCode>(`/cart/items/${input.key}`, {\n\t\t\t\tbody: input,\n\t\t\t\theaders,\n\t\t\t});\n\t\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\t\treturn this.kizlo._.http.success(response.data);\n\t\t});\n\t}\n\n\tpublic async remove(input: RemoveCartItemInput): Promise<RemoveCartItemResult> {\n\t\treturn this.kizlo.auth.withAuth(async ({ headers }) => {\n\t\t\tconst response = await this.kizlo._.http.delete<RemoveCartItemResponse, RemoveCartItemErrorCode>(`/cart/items/${input.key}`, {\n\t\t\t\theaders,\n\t\t\t});\n\t\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\t\treturn this.kizlo._.http.success(response.data);\n\t\t});\n\t}\n}\n\nexport class CartCouponClient {\n\tconstructor(private readonly kizlo: KizloService) {}\n\n\tpublic async apply(input: ApplyCartCouponInput): Promise<ApplyCartCouponResult> {\n\t\treturn this.kizlo.auth.withAuth(async ({ headers }) => {\n\t\t\tconst response = await this.kizlo._.http.post<ApplyCartCouponResponse, ApplyCartCouponErrorCode>(`/cart/coupons/${input.code}`, {\n\t\t\t\theaders,\n\t\t\t});\n\t\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\t\treturn this.kizlo._.http.success(response.data);\n\t\t});\n\t}\n\n\tpublic async remove(input: RemoveCartCouponInput): Promise<RemoveCartCouponResult> {\n\t\treturn this.kizlo.auth.withAuth(async ({ headers }) => {\n\t\t\tconst response = await this.kizlo._.http.delete<RemoveCartCouponResponse, RemoveCartCouponErrorCode>(`/cart/coupons/${input.code}`, {\n\t\t\t\theaders,\n\t\t\t});\n\t\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\t\treturn this.kizlo._.http.success(response.data);\n\t\t});\n\t}\n}\n\nexport class CartService {\n\tpublic items: CartItemService;\n\tpublic coupons: CartCouponClient;\n\n\tconstructor(private readonly kizlo: KizloService) {\n\t\tthis.items = new CartItemService(this.kizlo);\n\t\tthis.coupons = new CartCouponClient(this.kizlo);\n\t}\n\n\tpublic async retrieve(): Promise<RetrieveCartResult> {\n\t\treturn this.kizlo.auth.withAuth(async ({ headers }) => {\n\t\t\tconst response = await this.kizlo._.http.get<RetrieveCartResponse, RetrieveCartErrorCode>(\"/cart\", {\n\t\t\t\theaders,\n\t\t\t});\n\t\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\t\treturn this.kizlo._.http.success(response.data);\n\t\t});\n\t}\n\n\tpublic async update(input: UpdateCartInput): Promise<UpdateCartResult> {\n\t\treturn this.kizlo.auth.withAuth(async ({ headers }) => {\n\t\t\tconst response = await this.kizlo._.http.put<UpdateCartResponse, UpdateCartErrorCode>(\"/cart\", {\n\t\t\t\tbody: input,\n\t\t\t\theaders,\n\t\t\t});\n\n\t\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\t\treturn this.kizlo._.http.success(response.data);\n\t\t});\n\t}\n}\n\nexport const cartRouter = {\n\tretrieve: woocommerceSharedProcedure\n\t\t.output(type<RetrieveCartResponse>())\n\t\t.errors(procedureErrors<RetrieveCartErrorCode>())\n\t\t.handler(async ({ context }) => {\n\t\t\treturn handleResult(await context.woocommerce.cart.retrieve());\n\t\t}),\n\n\tupdate: woocommerceSharedProcedure\n\t\t.input(type<UpdateCartInput>())\n\t\t.output(type<UpdateCartResponse>())\n\t\t.errors(procedureErrors<UpdateCartErrorCode>())\n\t\t.handler(async ({ input, context }) => {\n\t\t\treturn handleResult(await context.woocommerce.cart.update(input));\n\t\t}),\n\n\titems: {\n\t\tadd: woocommerceSharedProcedure\n\t\t\t.input(type<AddCartItemInput>())\n\t\t\t.output(type<AddCartItemResponse>())\n\t\t\t.errors(procedureErrors<AddCartItemErrorCode>())\n\t\t\t.handler(async ({ input, context }) => {\n\t\t\t\treturn handleResult(await context.woocommerce.cart.items.add(input));\n\t\t\t}),\n\n\t\tupdate: woocommerceSharedProcedure\n\t\t\t.input(type<UpdateCartItemInput>())\n\t\t\t.output(type<UpdateCartItemResponse>())\n\t\t\t.errors(procedureErrors<UpdateCartItemErrorCode>())\n\t\t\t.handler(async ({ input, context }) => {\n\t\t\t\treturn handleResult(await context.woocommerce.cart.items.update(input));\n\t\t\t}),\n\n\t\tremove: woocommerceSharedProcedure\n\t\t\t.input(type<RemoveCartItemInput>())\n\t\t\t.output(type<RemoveCartItemResponse>())\n\t\t\t.errors(procedureErrors<RemoveCartItemErrorCode>())\n\t\t\t.handler(async ({ input, context }) => {\n\t\t\t\treturn handleResult(await context.woocommerce.cart.items.remove(input));\n\t\t\t}),\n\t},\n\n\tcoupons: {\n\t\tapply: woocommerceSharedProcedure\n\t\t\t.input(type<ApplyCartCouponInput>())\n\t\t\t.output(type<ApplyCartCouponResponse>())\n\t\t\t.errors(procedureErrors<ApplyCartCouponErrorCode>())\n\t\t\t.handler(async ({ input, context }) => {\n\t\t\t\treturn handleResult(await context.woocommerce.cart.coupons.apply(input));\n\t\t\t}),\n\n\t\tremove: woocommerceSharedProcedure\n\t\t\t.input(type<RemoveCartCouponInput>())\n\t\t\t.output(type<RemoveCartCouponResponse>())\n\t\t\t.errors(procedureErrors<RemoveCartCouponErrorCode>())\n\t\t\t.handler(async ({ input, context }) => {\n\t\t\t\treturn handleResult(await context.woocommerce.cart.coupons.remove(input));\n\t\t\t}),\n\t},\n};\n","import {\n\ttype CreateAddressErrorCode,\n\ttype CreateAddressInput,\n\ttype CreateAddressResponse,\n\ttype DeleteAddressErrorCode,\n\ttype DeleteAddressInput,\n\ttype DeleteAddressResponse,\n\thandleResult,\n\ttype KizloService,\n\ttype RetrieveCustomerErrorCode,\n\ttype RetrieveCustomerResponse,\n\ttype,\n\ttype UpdateAddressErrorCode,\n\ttype UpdateAddressInput,\n\ttype UpdateAddressResponse,\n} from \"kizlo\";\nimport { procedureErrors } from \"kizlo/extensions\";\nimport { woocommerceSharedProcedure } from \"../client.extension\";\nimport type { CreateAddressResult, DeleteAddressResult, RetrieveCustomerResult, UpdateAddressResult } from \"./types\";\n\nexport class AddressService {\n\tconstructor(private readonly kizlo: KizloService) {}\n\n\tpublic async create(input: CreateAddressInput): Promise<CreateAddressResult> {\n\t\treturn this.kizlo.auth.withAuth(async ({ headers }) => {\n\t\t\tconst response = await this.kizlo._.http.post<CreateAddressResponse, CreateAddressErrorCode>(\"/customers/addresses\", {\n\t\t\t\tbody: input,\n\t\t\t\theaders,\n\t\t\t});\n\t\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\t\treturn this.kizlo._.http.success(response.data);\n\t\t});\n\t}\n\n\tpublic async update(input: UpdateAddressInput): Promise<UpdateAddressResult> {\n\t\treturn this.kizlo.auth.withAuth(async ({ headers }) => {\n\t\t\tconst response = await this.kizlo._.http.put<UpdateAddressResponse, UpdateAddressErrorCode>(`/customers/addresses/${input.id}`, {\n\t\t\t\tbody: input,\n\t\t\t\theaders,\n\t\t\t});\n\t\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\t\treturn this.kizlo._.http.success(response.data);\n\t\t});\n\t}\n\n\tpublic async delete(input: DeleteAddressInput): Promise<DeleteAddressResult> {\n\t\treturn this.kizlo.auth.withAuth(async ({ headers }) => {\n\t\t\tconst response = await this.kizlo._.http.delete<DeleteAddressResponse, DeleteAddressErrorCode>(`/customers/addresses/${input.id}`, {\n\t\t\t\theaders,\n\t\t\t});\n\t\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\t\treturn this.kizlo._.http.success(response.data);\n\t\t});\n\t}\n}\n\nexport class CustomerService {\n\tpublic readonly address: AddressService;\n\n\tconstructor(private readonly kizlo: KizloService) {\n\t\tthis.address = new AddressService(this.kizlo);\n\t}\n\n\tpublic async retrieve(): Promise<RetrieveCustomerResult> {\n\t\treturn this.kizlo.auth.withAuth(async ({ headers }) => {\n\t\t\tconst response = await this.kizlo._.http.get<RetrieveCustomerResponse, RetrieveCustomerErrorCode>(\"/customers\", {\n\t\t\t\theaders,\n\t\t\t});\n\t\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\t\treturn this.kizlo._.http.success(response.data);\n\t\t});\n\t}\n}\n\nexport const customerRouter = {\n\tretrieve: woocommerceSharedProcedure\n\t\t.output(type<RetrieveCustomerResponse>())\n\t\t.errors(procedureErrors<RetrieveCustomerErrorCode>())\n\t\t.handler(async ({ context }) => {\n\t\t\treturn handleResult(await context.woocommerce.customer.retrieve());\n\t\t}),\n\n\taddress: {\n\t\tcreate: woocommerceSharedProcedure\n\t\t\t.input(type<CreateAddressInput>())\n\t\t\t.output(type<CreateAddressResponse>())\n\t\t\t.errors(procedureErrors<CreateAddressErrorCode>())\n\t\t\t.handler(async ({ input, context }) => {\n\t\t\t\treturn handleResult(await context.woocommerce.customer.address.create(input));\n\t\t\t}),\n\n\t\tupdate: woocommerceSharedProcedure\n\t\t\t.input(type<UpdateAddressInput>())\n\t\t\t.output(type<UpdateAddressResponse>())\n\t\t\t.errors(procedureErrors<UpdateAddressErrorCode>())\n\t\t\t.handler(async ({ input, context }) => {\n\t\t\t\treturn handleResult(await context.woocommerce.customer.address.update(input));\n\t\t\t}),\n\n\t\tdelete: woocommerceSharedProcedure\n\t\t\t.input(type<UpdateAddressInput>())\n\t\t\t.output(type<UpdateAddressResponse>())\n\t\t\t.errors(procedureErrors<UpdateAddressErrorCode>())\n\t\t\t.handler(async ({ input, context }) => {\n\t\t\t\treturn handleResult(await context.woocommerce.customer.address.delete(input));\n\t\t\t}),\n\t},\n};\n","import {\n\thandleResult,\n\ttype KizloService,\n\ttype ListOrderErrorCode,\n\ttype ListOrderInput,\n\ttype ListOrderResponse,\n\ttype RetrieveOrderErrorCode,\n\ttype RetrieveOrderInput,\n\ttype RetrieveOrderResponse,\n\ttype,\n} from \"kizlo\";\nimport { procedureErrors } from \"kizlo/extensions\";\nimport { woocommerceSharedProcedure } from \"../client.extension\";\nimport type { ListOrderResult, RetrieveOrderResult } from \"./types\";\n\nexport class OrderService {\n\tconstructor(private readonly kizlo: KizloService) {}\n\n\tpublic async retrieve(params: RetrieveOrderInput): Promise<RetrieveOrderResult> {\n\t\treturn this.kizlo.auth.withAuth(async ({ headers }) => {\n\t\t\tconst response = await this.kizlo._.http.get<RetrieveOrderResponse, RetrieveOrderErrorCode>(`/orders/${params.id}`, {\n\t\t\t\theaders,\n\t\t\t});\n\t\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\t\treturn this.kizlo._.http.success(response.data);\n\t\t});\n\t}\n\n\tpublic async list(params: ListOrderInput): Promise<ListOrderResult> {\n\t\treturn this.kizlo.auth.withAuth(async ({ headers }) => {\n\t\t\tconst response = await this.kizlo._.http.get<ListOrderResponse, ListOrderErrorCode>(\"/orders\", {\n\t\t\t\theaders,\n\t\t\t\tquery: params,\n\t\t\t});\n\t\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\t\treturn this.kizlo._.http.success(response.data);\n\t\t});\n\t}\n}\n\nexport const orderRouter = {\n\tretrieve: woocommerceSharedProcedure\n\t\t.input(type<RetrieveOrderInput>())\n\t\t.output(type<RetrieveOrderResponse>())\n\t\t.errors(procedureErrors<RetrieveOrderErrorCode>())\n\t\t.handler(async ({ input, context }) => {\n\t\t\treturn handleResult(await context.woocommerce.orders.retrieve(input));\n\t\t}),\n\n\tlist: woocommerceSharedProcedure\n\t\t.input(type<ListOrderInput>())\n\t\t.output(type<ListOrderResponse>())\n\t\t.errors(procedureErrors<ListOrderErrorCode>())\n\t\t.handler(async ({ input, context }) => {\n\t\t\treturn handleResult(await context.woocommerce.orders.list(input));\n\t\t}),\n};\n","import type { EnhancedRouter, HTTP_PROCEDURE } from \"kizlo\";\nimport { woocommerceSharedRouter } from \"./client\";\nimport { createPaymentRouter } from \"./payment/server\";\nimport type { WooCommerceServerExtensionOptions, WooCommerceServerProcedureContext } from \"./server.extension\";\n\nexport function createWoocommerceServerRouter(options?: WooCommerceServerExtensionOptions) {\n\treturn {\n\t\t...woocommerceSharedRouter,\n\t\tpayment: createPaymentRouter(options),\n\t};\n}\n\nexport type WooCommerceServerRouter = EnhancedRouter<\n\tReturnType<typeof createWoocommerceServerRouter>,\n\tany,\n\tWooCommerceServerProcedureContext,\n\tobject\n>;\n\nexport type { HTTP_PROCEDURE };\n","import type { HTTP_PROCEDURE, ServerExtension, ServerHttpProcedureContext, ServerProcedureContext } from \"kizlo\";\nimport { defineServerExtension, kz } from \"kizlo/extensions\";\nimport { WooCommerceService } from \"./client\";\nimport type { PaymentAdapter } from \"./payment/types\";\nimport { createWoocommerceServerRouter, type WooCommerceServerRouter } from \"./server\";\n\nexport interface WooCommerceServerProcedureContext extends ServerProcedureContext {\n\twoocommerce: WooCommerceService;\n}\n\nexport const woocommerceServerMiddleware = kz.server.middleware(({ context, next }) => {\n\tconst woocommerce = new WooCommerceService(context);\n\treturn next({ context: { woocommerce } });\n});\nexport const woocommerceServerProcedure = kz.server.use(woocommerceServerMiddleware);\n\nexport interface WooCommerceHttpProcedureContext extends ServerHttpProcedureContext {\n\twoocommerce: WooCommerceService;\n}\n\nexport const woocommerceHttpMiddleware = kz.http.middleware(({ context, next }) => {\n\tconst woocommerce = new WooCommerceService(context);\n\treturn next({ context: { woocommerce } });\n});\nexport const woocommerceHttpProcedure = kz.http.use(woocommerceHttpMiddleware);\n\nexport type WooCommerceServerExtension = ServerExtension<\"woocommerce\", WooCommerceServerRouter>;\n\nexport interface WooCommerceServerExtensionOptions {\n\tpaymentAdapters?: PaymentAdapter[];\n}\n\nexport function woocommerceServer(options?: WooCommerceServerExtensionOptions): WooCommerceServerExtension {\n\treturn defineServerExtension({\n\t\tname: \"woocommerce\",\n\t\tinit() {\n\t\t\treturn createWoocommerceServerRouter(options);\n\t\t},\n\t});\n}\n\nexport type { HTTP_PROCEDURE };\n","import {\n\ttype ConfirmPaymentErrorCode,\n\ttype ConfirmPaymentInput,\n\ttype ConfirmPaymentResponse,\n\ttype HTTP_PROCEDURE,\n\thandleResult,\n\ttype KizloService,\n\ttype ListPaymentMethodErrorCode,\n\ttype ListPaymentMethodResponse,\n\ttype ListPaymentWebhookResponse,\n\ttype PaymentMethod,\n\ttype PayPaymentErrorCode,\n\tPayPaymentInput,\n\ttype PayPaymentResponse,\n\ttype ServerHttpProcedureContext,\n\ttype,\n\ttype UpdatePaymentErrorCode,\n\ttype UpdatePaymentInput,\n\ttype UpdatePaymentResponse,\n} from \"kizlo\";\nimport { procedureErrors } from \"kizlo/extensions\";\nimport { type WooCommerceServerExtensionOptions, woocommerceHttpProcedure, woocommerceServerProcedure } from \"../server\";\nimport type { ConfirmPaymentResult, ListPaymentMethodResult, PaymentAdapter, PayPaymentResult, UpdatePaymentResult } from \"./types\";\n\nexport class PaymentService {\n\tconstructor(private readonly kizlo: KizloService) {}\n\n\tpublic async confirm(input: ConfirmPaymentInput): Promise<ConfirmPaymentResult> {\n\t\tconst response = await this.kizlo._.http.post<ConfirmPaymentResponse, ConfirmPaymentErrorCode>(\"/payment\", {\n\t\t\tbody: input,\n\t\t});\n\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\treturn this.kizlo._.http.success(response.data);\n\t}\n\n\tpublic async update(input: UpdatePaymentInput): Promise<UpdatePaymentResult> {\n\t\tconst response = await this.kizlo._.http.put<UpdatePaymentResponse, UpdatePaymentErrorCode>(`/payment/${input.id}`, {\n\t\t\tbody: input,\n\t\t});\n\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\treturn this.kizlo._.http.success(response.data);\n\t}\n\n\tpublic async listMethods(input: { adapters: PaymentAdapter[]; context: ServerHttpProcedureContext }): Promise<ListPaymentMethodResult> {\n\t\tconst groups = new Map<string, PaymentAdapter[]>();\n\n\t\tfor (const adapter of input.adapters) {\n\t\t\tconst config = adapter;\n\n\t\t\tif (!groups.has(config.type)) groups.set(config.type, []);\n\n\t\t\tgroups.get(config.type)?.push(config);\n\t\t}\n\n\t\tconst getPrioritizedAdapter = (group: PaymentAdapter[]): PaymentAdapter | null => {\n\t\t\tlet best: PaymentAdapter | null = null;\n\n\t\t\tfor (const adapter of group) {\n\t\t\t\tif (!best || adapter.priority > best.priority) best = adapter;\n\t\t\t}\n\n\t\t\treturn best;\n\t\t};\n\n\t\tconst methods: PaymentMethod[] = [];\n\n\t\tfor (const [, group] of groups) {\n\t\t\tconst selectedAdapters: PaymentAdapter[] = [];\n\n\t\t\tconst combinableAdapters = group.filter((adapter) => adapter.isCombinable);\n\n\t\t\tif (combinableAdapters.length > 1) {\n\t\t\t\tfor (const adapter of combinableAdapters) selectedAdapters.push(adapter);\n\t\t\t} else {\n\t\t\t\tconst bestAdapter = getPrioritizedAdapter(group);\n\n\t\t\t\tif (bestAdapter) selectedAdapters.push(bestAdapter);\n\t\t\t}\n\n\t\t\tfor (const adapter of selectedAdapters) {\n\t\t\t\tconst eligibility = await adapter.eligibility?.(input.context);\n\n\t\t\t\tif (eligibility?.is_hidden) continue;\n\n\t\t\t\tmethods.push({\n\t\t\t\t\tid: adapter.id,\n\t\t\t\t\ttype: adapter.type,\n\t\t\t\t\tname: eligibility?.name ?? adapter.name,\n\t\t\t\t\tis_disabled: eligibility?.is_disabled ?? false,\n\t\t\t\t\tdescription: eligibility?.description ?? adapter.description,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tconst uniqueIds = new Set(methods.map((method) => method.id));\n\t\tif (uniqueIds.size !== methods.length) return this.kizlo._.http.error(\"PAYMENT_DUPLICATE_ADAPTERS\");\n\n\t\treturn this.kizlo._.http.success(methods);\n\t}\n\n\tasync pay(input: {\n\t\tsuccess_url: string;\n\t\tpayment_method_id: string;\n\t\tadapters: PaymentAdapter[];\n\t\tcontext: ServerHttpProcedureContext;\n\t}): Promise<PayPaymentResult> {\n\t\tconst adapter = input.adapters.find((adp) => adp.id === input.payment_method_id);\n\t\tif (!adapter) return this.kizlo._.http.error(\"PAYMENT_ADAPTER_NOT_FOUND\");\n\n\t\tconst session = await this.kizlo.auth.getSession();\n\t\tif (!session) return this.kizlo._.http.error(\"AUTH_REQUIRED\");\n\n\t\tconst confirmResult = await this.confirm({\n\t\t\tuser_id: session.user.id,\n\t\t\tpayment_method_id: adapter.id,\n\t\t\tpayment_method_name: adapter.name,\n\t\t\tpayment_method_type: adapter.type,\n\t\t});\n\t\tif (confirmResult.isError) return this.kizlo._.http.error(confirmResult.error);\n\n\t\tif (adapter.type === \"online\") {\n\t\t\tconst intent = await adapter.create({ order: confirmResult.data }, input.context);\n\t\t\tif (!intent || !intent.url) return this.kizlo._.http.error(\"PAYMENT_ADAPTER_NOT_FOUND\");\n\n\t\t\tconst updateResult = await this.update({\n\t\t\t\tid: confirmResult.data.id,\n\t\t\t\tpayment_status: intent.status,\n\t\t\t\tpayment_session_id: intent.id,\n\t\t\t\ttransaction_id: intent.transaction_id,\n\t\t\t\tpayment_url: intent.url,\n\t\t\t});\n\t\t\tif (updateResult.isError) return this.kizlo._.http.error(updateResult.error);\n\n\t\t\treturn this.kizlo._.http.success({ redirect_url: intent.url });\n\t\t}\n\n\t\treturn this.kizlo._.http.success({ redirect_url: \"\" });\n\t}\n\n\tpublic listWebhookEndpoint(input: { adapters: PaymentAdapter[]; context: ServerHttpProcedureContext }) {\n\t\treturn input.adapters.reduce<ListPaymentWebhookResponse>((acc, curr) => {\n\t\t\tif (curr.type === \"online\") {\n\t\t\t\tacc.push({\n\t\t\t\t\tid: curr.id,\n\t\t\t\t\tname: curr.name,\n\t\t\t\t\twebhook_endpoint: new URL(`${input.context._.basePath}/payment/webhooks/${curr.id}`, this.kizlo._.baseUrl).toString(),\n\t\t\t\t});\n\n\t\t\t\treturn acc;\n\t\t\t}\n\n\t\t\treturn acc;\n\t\t}, []);\n\t}\n\n\tpublic async handleWebhook(input: { payment_method_id: string; adapters: PaymentAdapter[]; context: ServerHttpProcedureContext }) {\n\t\tconst adapter = input.adapters.find((a) => a.id === input.payment_method_id);\n\t\tif (!adapter || adapter.type !== \"online\") return this.kizlo._.http.error(\"PAYMENT_ADAPTER_NOT_FOUND\");\n\n\t\tconst data = await adapter.verify(input.context);\n\t\tif (!data) return this.kizlo._.http.error(\"UNAUTHORIZED\");\n\n\t\tconst updateResult = await this.update({ id: data.order_id, payment_status: data.status, transaction_id: data.transaction_id });\n\t\tif (updateResult.error) return this.kizlo._.http.error(updateResult.error);\n\n\t\treturn this.kizlo._.http.success({ success: true });\n\t}\n}\n\nexport function createPaymentRouter(options?: WooCommerceServerExtensionOptions) {\n\treturn {\n\t\tconfirm: woocommerceServerProcedure\n\t\t\t.input(type<ConfirmPaymentInput>())\n\t\t\t.output(type<ConfirmPaymentResponse>())\n\t\t\t.errors(procedureErrors<ConfirmPaymentErrorCode>())\n\t\t\t.handler(async ({ input, context }) => {\n\t\t\t\treturn handleResult(await context.woocommerce.payment.confirm(input));\n\t\t\t}),\n\n\t\tupdate: woocommerceServerProcedure\n\t\t\t.input(type<UpdatePaymentInput>())\n\t\t\t.output(type<UpdatePaymentResponse>())\n\t\t\t.errors(procedureErrors<UpdatePaymentErrorCode>())\n\t\t\t.handler(async ({ input, context }) => {\n\t\t\t\treturn handleResult(await context.woocommerce.payment.update(input));\n\t\t\t}),\n\n\t\tmethods: woocommerceHttpProcedure\n\t\t\t.output(type<ListPaymentMethodResponse>())\n\t\t\t.errors(procedureErrors<ListPaymentMethodErrorCode>())\n\t\t\t.handler(async ({ context }) => {\n\t\t\t\treturn handleResult(\n\t\t\t\t\tawait context.woocommerce.payment.listMethods({\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tadapters: options?.paymentAdapters ?? [],\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}),\n\n\t\tpay: woocommerceHttpProcedure\n\t\t\t.input(PayPaymentInput)\n\t\t\t.output(type<PayPaymentResponse>())\n\t\t\t.errors(procedureErrors<PayPaymentErrorCode>())\n\t\t\t.handler(async ({ input, context }) => {\n\t\t\t\treturn handleResult(\n\t\t\t\t\tawait context.woocommerce.payment.pay({\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tsuccess_url: \"\",\n\t\t\t\t\t\tadapters: options?.paymentAdapters ?? [],\n\t\t\t\t\t\tpayment_method_id: input.payment_method_id,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}),\n\n\t\twebhooks: {\n\t\t\tendpoints: woocommerceHttpProcedure\n\t\t\t\t.route({ method: \"GET\", path: \"/payment/webhooks\" })\n\t\t\t\t.output(type<ListPaymentWebhookResponse>())\n\t\t\t\t.handler(async ({ context }) => {\n\t\t\t\t\treturn handleResult(\n\t\t\t\t\t\tcontext.woocommerce.payment.listWebhookEndpoint({\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tadapters: options?.paymentAdapters ?? [],\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}),\n\n\t\t\treceive: woocommerceHttpProcedure\n\t\t\t\t.route({ method: \"POST\", path: \"/payment/webhooks/{id}\", inputStructure: \"detailed\" })\n\t\t\t\t// .output(type<ListPaymentWebhookResponse>())\n\t\t\t\t.input(type<{ params: { id: string } }>())\n\t\t\t\t.handler(async ({ input, context }) => {\n\t\t\t\t\treturn handleResult(\n\t\t\t\t\t\tcontext.woocommerce.payment.handleWebhook({\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tpayment_method_id: input.params.id,\n\t\t\t\t\t\t\tadapters: options?.paymentAdapters ?? [],\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}),\n\t\t},\n\t};\n}\n\nexport type { HTTP_PROCEDURE };\n","import {\n\ttype CreateReviewData,\n\ttype CreateReviewErrorCode,\n\ttype CreateReviewInput,\n\thandleResult,\n\ttype KizloService,\n\ttype ListCategoryErrorCode,\n\ttype ListCategoryInput,\n\ttype ListCategoryResponse,\n\ttype ListProductErrorCode,\n\ttype ListProductInput,\n\ttype ListProductResponse,\n\ttype ListReviewData,\n\ttype ListReviewErrorCode,\n\ttype ListReviewInput,\n\ttype RetrieveCollectionErrorCode,\n\ttype RetrieveCollectionInput,\n\ttype RetrieveCollectionResponse,\n\ttype RetrieveProductErrorCode,\n\ttype RetrieveProductInput,\n\ttype RetrieveProductResponse,\n\ttype RetrieveReviewData,\n\ttype RetrieveReviewErrorCode,\n\ttype RetrieveReviewInput,\n\ttype,\n} from \"kizlo\";\nimport { procedureErrors } from \"kizlo/extensions\";\nimport { woocommerceSharedProcedure } from \"../client.extension\";\nimport type {\n\tCreateReviewResult,\n\tListCategoryResult,\n\tListProductResult,\n\tListReviewResult,\n\tRetrieveCollectionResult,\n\tRetrieveProductResult,\n\tRetrieveReviewResult,\n} from \"./types\";\n\nexport class ProductService {\n\treadonly reviews: ReviewService;\n\n\tconstructor(private readonly kizlo: KizloService) {\n\t\tthis.reviews = new ReviewService(this.kizlo);\n\t}\n\n\tpublic async retrieve(input: RetrieveProductInput): Promise<RetrieveProductResult> {\n\t\tconst response = await this.kizlo._.http.get<RetrieveProductResponse, RetrieveProductErrorCode>(`/products/${input.slug}`, {\n\t\t\tquery: { preview: input.preview },\n\t\t});\n\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\treturn this.kizlo._.http.success(response.data);\n\t}\n\n\tpublic async list(input?: ListProductInput): Promise<ListProductResult> {\n\t\tconst response = await this.kizlo._.http.get<ListProductResponse, ListProductErrorCode>(\"/products\", {\n\t\t\tquery: input,\n\t\t});\n\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\treturn this.kizlo._.http.success(response.data);\n\t}\n\n\tpublic async collection(input?: RetrieveCollectionInput): Promise<RetrieveCollectionResult> {\n\t\tconst response = await this.kizlo._.http.get<RetrieveCollectionResponse, RetrieveCollectionErrorCode>(\"/products/collection\", {\n\t\t\tquery: input,\n\t\t});\n\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\treturn this.kizlo._.http.success(response.data);\n\t}\n\n\tpublic async categories(input?: ListCategoryInput): Promise<ListCategoryResult> {\n\t\tconst response = await this.kizlo._.http.get<ListCategoryResponse, ListCategoryErrorCode>(\"/products/categories\", {\n\t\t\tquery: input,\n\t\t});\n\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\treturn this.kizlo._.http.success(response.data);\n\t}\n}\n\nexport class ReviewService {\n\tconstructor(private readonly kizlo: KizloService) {}\n\n\tpublic async retrieve(input: RetrieveReviewInput): Promise<RetrieveReviewResult> {\n\t\tconst response = await this.kizlo._.http.get<RetrieveReviewData, RetrieveReviewErrorCode>(`/products/reviews/${input.id}`, {\n\t\t\tquery: input,\n\t\t});\n\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\treturn this.kizlo._.http.success(response.data);\n\t}\n\n\tpublic async list(input?: ListReviewInput): Promise<ListReviewResult> {\n\t\tconst response = await this.kizlo._.http.get<ListReviewData, ListReviewErrorCode>(\"/products/reviews\", {\n\t\t\tquery: input,\n\t\t});\n\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\treturn this.kizlo._.http.success(response.data);\n\t}\n\n\tpublic async create(input: CreateReviewInput): Promise<CreateReviewResult> {\n\t\treturn this.kizlo.auth.withAuth(async ({ headers }) => {\n\t\t\tconst response = await this.kizlo._.http.post<CreateReviewData, CreateReviewErrorCode>(\"/products/reviews\", {\n\t\t\t\theaders,\n\t\t\t\tbody: input,\n\t\t\t});\n\t\t\tif (response.error) return this.kizlo._.http.error(response.error);\n\t\t\treturn this.kizlo._.http.success(response.data);\n\t\t});\n\t}\n}\n\nexport const productRouter = {\n\tretrieve: woocommerceSharedProcedure\n\t\t.input(type<RetrieveProductInput>())\n\t\t.output(type<RetrieveProductResponse>())\n\t\t.errors(procedureErrors<RetrieveProductErrorCode>())\n\t\t.handler(async ({ input, context }) => {\n\t\t\treturn handleResult(await context.woocommerce.products.retrieve(input));\n\t\t}),\n\n\tlist: woocommerceSharedProcedure\n\t\t.input(type<ListProductInput | undefined>())\n\t\t.output(type<ListProductResponse>())\n\t\t.errors(procedureErrors<ListProductErrorCode>())\n\t\t.handler(async ({ input, context }) => {\n\t\t\treturn handleResult(await context.woocommerce.products.list(input));\n\t\t}),\n\n\tcollection: woocommerceSharedProcedure\n\t\t.input(type<RetrieveCollectionInput | undefined>())\n\t\t.output(type<RetrieveCollectionResponse>())\n\t\t.errors(procedureErrors<RetrieveCollectionErrorCode>())\n\t\t.handler(async ({ input, context }) => {\n\t\t\treturn handleResult(await context.woocommerce.products.collection(input));\n\t\t}),\n\n\tcategories: woocommerceSharedProcedure\n\t\t.input(type<ListCategoryInput | undefined>())\n\t\t.output(type<ListCategoryResponse>())\n\t\t.errors(procedureErrors<ListCategoryErrorCode>())\n\t\t.handler(async ({ input, context }) => {\n\t\t\treturn handleResult(await context.woocommerce.products.categories(input));\n\t\t}),\n\n\treviews: {\n\t\tretrieve: woocommerceSharedProcedure\n\t\t\t.input(type<RetrieveReviewInput>())\n\t\t\t.output(type<RetrieveReviewData>())\n\t\t\t.errors(procedureErrors<RetrieveReviewErrorCode>())\n\t\t\t.handler(async ({ input, context }) => {\n\t\t\t\treturn handleResult(await context.woocommerce.products.reviews.retrieve(input));\n\t\t\t}),\n\n\t\tlist: woocommerceSharedProcedure\n\t\t\t.input(type<ListReviewInput | undefined>())\n\t\t\t.output(type<ListReviewData>())\n\t\t\t.errors(procedureErrors<ListReviewErrorCode>())\n\t\t\t.handler(async ({ input, context }) => {\n\t\t\t\treturn handleResult(await context.woocommerce.products.reviews.list(input));\n\t\t\t}),\n\n\t\tcreate: woocommerceSharedProcedure\n\t\t\t.input(type<CreateReviewInput>())\n\t\t\t.output(type<CreateReviewData>())\n\t\t\t.errors(procedureErrors<CreateReviewErrorCode>())\n\t\t\t.handler(async ({ input, context }) => {\n\t\t\t\treturn handleResult(await context.woocommerce.products.reviews.create(input));\n\t\t\t}),\n\t},\n};\n","import type { KizloService } from \"kizlo\";\nimport { CartService, cartRouter } from \"./cart/client\";\nimport { CustomerService, customerRouter } from \"./customer/client\";\nimport { OrderService, orderRouter } from \"./order/client\";\nimport { PaymentService } from \"./payment/server\";\nimport { ProductService, productRouter } from \"./product/client\";\n\nexport class WooCommerceService {\n\tpublic readonly cart: CartService;\n\tpublic readonly orders: OrderService;\n\tpublic readonly customer: CustomerService;\n\tpublic readonly products: ProductService;\n\tpublic readonly payment: PaymentService;\n\n\tconstructor(private readonly kizlo: KizloService) {\n\t\tthis.cart = new CartService(this.kizlo);\n\t\tthis.orders = new OrderService(this.kizlo);\n\t\tthis.customer = new CustomerService(this.kizlo);\n\t\tthis.products = new ProductService(this.kizlo);\n\t\tthis.payment = new PaymentService(this.kizlo);\n\t}\n}\n\nexport const woocommerceSharedRouter = {\n\tcart: cartRouter,\n\torders: orderRouter,\n\tproducts: productRouter,\n\tcustomer: customerRouter,\n};\nexport type WooCommerceSharedRouter = typeof woocommerceSharedRouter;\n"],"mappings":";;;;AAQA,MAAa,8BAA8B,GAAG,OAAO,YAAY,EAAE,SAAS,WAAW;AAEtF,QAAO,KAAK,EAAE,SAAS,EAAE,aADL,IAAI,mBAAmB,QAAQ,EACb,EAAE,CAAC;EACxC;AAEF,MAAa,6BAA6B,GAAG,OAAO,IAAI,4BAA4B;AAIpF,SAAgB,cAA0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