@kizlo/woocommerce 1.0.0-alpha.2 → 1.0.0-alpha.3
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/dist/{client-CWtBT_hK.cjs → client-6WCc4I7s.cjs} +107 -117
- package/dist/{client-BJuv_NtE.js → client-DwegaoKJ.js} +97 -119
- package/dist/client-DwegaoKJ.js.map +1 -0
- package/dist/{index-DUK75443.d.ts → index-C7fqYN3y.d.ts} +500 -690
- package/dist/index-C7fqYN3y.d.ts.map +1 -0
- package/dist/{index-D6PQxlBF.d.cts → index-M1U-RzXY.d.cts} +500 -690
- package/dist/index-M1U-RzXY.d.cts.map +1 -0
- package/dist/index.cjs +3 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/package.json +4 -4
- package/dist/client-BJuv_NtE.js.map +0 -1
- package/dist/index-D6PQxlBF.d.cts.map +0 -1
- package/dist/index-DUK75443.d.ts.map +0 -1
|
@@ -47,31 +47,25 @@ var KizloCartItem = class {
|
|
|
47
47
|
this.kizlo = kizlo$1;
|
|
48
48
|
}
|
|
49
49
|
async add(input) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
headers
|
|
54
|
-
});
|
|
55
|
-
if (response.error) return this.kizlo._.http.error(response.error);
|
|
56
|
-
return this.kizlo._.http.success(response.data);
|
|
50
|
+
const response = await this.kizlo._.http.post("/cart/items", {
|
|
51
|
+
auth: true,
|
|
52
|
+
body: input
|
|
57
53
|
});
|
|
54
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
55
|
+
return this.kizlo._.http.success(response.data);
|
|
58
56
|
}
|
|
59
57
|
async update(input) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
headers
|
|
64
|
-
});
|
|
65
|
-
if (response.error) return this.kizlo._.http.error(response.error);
|
|
66
|
-
return this.kizlo._.http.success(response.data);
|
|
58
|
+
const response = await this.kizlo._.http.put(`/cart/items/${input.key}`, {
|
|
59
|
+
body: input,
|
|
60
|
+
auth: true
|
|
67
61
|
});
|
|
62
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
63
|
+
return this.kizlo._.http.success(response.data);
|
|
68
64
|
}
|
|
69
65
|
async remove(input) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return this.kizlo._.http.success(response.data);
|
|
74
|
-
});
|
|
66
|
+
const response = await this.kizlo._.http.delete(`/cart/items/${input.key}`, { auth: true });
|
|
67
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
68
|
+
return this.kizlo._.http.success(response.data);
|
|
75
69
|
}
|
|
76
70
|
};
|
|
77
71
|
var KizloCoupon = class {
|
|
@@ -79,18 +73,14 @@ var KizloCoupon = class {
|
|
|
79
73
|
this.kizlo = kizlo$1;
|
|
80
74
|
}
|
|
81
75
|
async apply(input) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return this.kizlo._.http.success(response.data);
|
|
86
|
-
});
|
|
76
|
+
const response = await this.kizlo._.http.post(`/cart/coupons/${input.code}`, { auth: true });
|
|
77
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
78
|
+
return this.kizlo._.http.success(response.data);
|
|
87
79
|
}
|
|
88
80
|
async remove(input) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return this.kizlo._.http.success(response.data);
|
|
93
|
-
});
|
|
81
|
+
const response = await this.kizlo._.http.delete(`/cart/coupons/${input.code}`, { auth: true });
|
|
82
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
83
|
+
return this.kizlo._.http.success(response.data);
|
|
94
84
|
}
|
|
95
85
|
};
|
|
96
86
|
var KizloCart = class {
|
|
@@ -102,21 +92,17 @@ var KizloCart = class {
|
|
|
102
92
|
this.coupons = new KizloCoupon(this.kizlo);
|
|
103
93
|
}
|
|
104
94
|
async retrieve() {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return this.kizlo._.http.success(response.data);
|
|
109
|
-
});
|
|
95
|
+
const response = await this.kizlo._.http.get("/cart", { auth: true });
|
|
96
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
97
|
+
return this.kizlo._.http.success(response.data);
|
|
110
98
|
}
|
|
111
99
|
async update(input) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
headers
|
|
116
|
-
});
|
|
117
|
-
if (response.error) return this.kizlo._.http.error(response.error);
|
|
118
|
-
return this.kizlo._.http.success(response.data);
|
|
100
|
+
const response = await this.kizlo._.http.put("/cart", {
|
|
101
|
+
auth: true,
|
|
102
|
+
body: input
|
|
119
103
|
});
|
|
104
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
105
|
+
return this.kizlo._.http.success(response.data);
|
|
120
106
|
}
|
|
121
107
|
};
|
|
122
108
|
const cart = {
|
|
@@ -149,50 +135,42 @@ const cart = {
|
|
|
149
135
|
|
|
150
136
|
//#endregion
|
|
151
137
|
//#region src/customer/client.ts
|
|
138
|
+
var KizloCustomer = class {
|
|
139
|
+
address;
|
|
140
|
+
constructor(kizlo$1) {
|
|
141
|
+
this.kizlo = kizlo$1;
|
|
142
|
+
this.address = new KizloAddress(this.kizlo);
|
|
143
|
+
}
|
|
144
|
+
async retrieve() {
|
|
145
|
+
const response = await this.kizlo._.http.get("/customers", { auth: true });
|
|
146
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
147
|
+
return this.kizlo._.http.success(response.data);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
152
150
|
var KizloAddress = class {
|
|
153
151
|
constructor(kizlo$1) {
|
|
154
152
|
this.kizlo = kizlo$1;
|
|
155
153
|
}
|
|
156
154
|
async create(input) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
body: input
|
|
161
|
-
});
|
|
162
|
-
if (response.error) return this.kizlo._.http.error(response.error);
|
|
163
|
-
return this.kizlo._.http.success(response.data);
|
|
155
|
+
const response = await this.kizlo._.http.post("/customers/addresses", {
|
|
156
|
+
auth: true,
|
|
157
|
+
body: input
|
|
164
158
|
});
|
|
159
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
160
|
+
return this.kizlo._.http.success(response.data);
|
|
165
161
|
}
|
|
166
162
|
async update(input) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
headers
|
|
171
|
-
});
|
|
172
|
-
if (response.error) return this.kizlo._.http.error(response.error);
|
|
173
|
-
return this.kizlo._.http.success(response.data);
|
|
163
|
+
const response = await this.kizlo._.http.put(`/customers/addresses/${input.id}`, {
|
|
164
|
+
body: input,
|
|
165
|
+
auth: true
|
|
174
166
|
});
|
|
167
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
168
|
+
return this.kizlo._.http.success(response.data);
|
|
175
169
|
}
|
|
176
170
|
async delete(input) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
return this.kizlo._.http.success(response.data);
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
var KizloCustomer = class {
|
|
185
|
-
address;
|
|
186
|
-
constructor(kizlo$1) {
|
|
187
|
-
this.kizlo = kizlo$1;
|
|
188
|
-
this.address = new KizloAddress(this.kizlo);
|
|
189
|
-
}
|
|
190
|
-
async retrieve() {
|
|
191
|
-
return this.kizlo.auth.session.ensure(async ({ headers }) => {
|
|
192
|
-
const response = await this.kizlo._.http.get("/customers", { headers });
|
|
193
|
-
if (response.error) return this.kizlo._.http.error(response.error);
|
|
194
|
-
return this.kizlo._.http.success(response.data);
|
|
195
|
-
});
|
|
171
|
+
const response = await this.kizlo._.http.delete(`/customers/addresses/${input.id}`, { auth: true });
|
|
172
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
173
|
+
return this.kizlo._.http.success(response.data);
|
|
196
174
|
}
|
|
197
175
|
};
|
|
198
176
|
const customer = {
|
|
@@ -219,21 +197,17 @@ var KizloOrder = class {
|
|
|
219
197
|
this.kizlo = kizlo$1;
|
|
220
198
|
}
|
|
221
199
|
async retrieve(input) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
return this.kizlo._.http.success(response.data);
|
|
226
|
-
});
|
|
200
|
+
const response = await this.kizlo._.http.get(`/orders/${input.id}`, { auth: true });
|
|
201
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
202
|
+
return this.kizlo._.http.success(response.data);
|
|
227
203
|
}
|
|
228
204
|
async list(input) {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
query: input
|
|
233
|
-
});
|
|
234
|
-
if (response.error) return this.kizlo._.http.error(response.error);
|
|
235
|
-
return this.kizlo._.http.success(response.data);
|
|
205
|
+
const response = await this.kizlo._.http.get("/orders", {
|
|
206
|
+
auth: true,
|
|
207
|
+
query: input
|
|
236
208
|
});
|
|
209
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
210
|
+
return this.kizlo._.http.success(response.data);
|
|
237
211
|
}
|
|
238
212
|
};
|
|
239
213
|
const orders = {
|
|
@@ -336,7 +310,7 @@ var contract_server_default = {
|
|
|
336
310
|
"meta": {},
|
|
337
311
|
"route": {}
|
|
338
312
|
} },
|
|
339
|
-
"
|
|
313
|
+
"filters": { "~orpc": {
|
|
340
314
|
"errorMap": {},
|
|
341
315
|
"meta": {},
|
|
342
316
|
"route": {}
|
|
@@ -511,10 +485,8 @@ var KizloPaymentAdmin = class {
|
|
|
511
485
|
async pay(input) {
|
|
512
486
|
const adapter = input.adapters.find((adp) => adp.id === input.payment_method_id);
|
|
513
487
|
if (!adapter) return this.kizlo._.http.error("PAYMENT_ADAPTER_NOT_FOUND");
|
|
514
|
-
const session = await this.kizlo.auth.session.retrieve();
|
|
515
|
-
if (!session) return this.kizlo._.http.error("AUTH_REQUIRED");
|
|
516
488
|
const confirmResult = await this.confirm({
|
|
517
|
-
user_id:
|
|
489
|
+
user_id: {},
|
|
518
490
|
payment_method_id: adapter.id,
|
|
519
491
|
payment_method_name: adapter.name,
|
|
520
492
|
payment_method_type: adapter.type
|
|
@@ -593,7 +565,7 @@ function createPaymentServerRouter(options) {
|
|
|
593
565
|
}
|
|
594
566
|
|
|
595
567
|
//#endregion
|
|
596
|
-
//#region src/product/
|
|
568
|
+
//#region src/product/category.ts
|
|
597
569
|
var KizloProductCategory = class {
|
|
598
570
|
constructor(kizlo$1) {
|
|
599
571
|
this.kizlo = kizlo$1;
|
|
@@ -604,6 +576,12 @@ var KizloProductCategory = class {
|
|
|
604
576
|
return this.kizlo._.http.success(response.data);
|
|
605
577
|
}
|
|
606
578
|
};
|
|
579
|
+
const categories = { list: woocommerceProcedure.input((0, kizlo.type)()).output((0, kizlo.type)()).errors((0, kizlo_extensions.procedureErrors)()).handler(async ({ input, context }) => {
|
|
580
|
+
return (0, kizlo.ensureProcedureResult)(await context.woocommerce.products.categories.list(input));
|
|
581
|
+
}) };
|
|
582
|
+
|
|
583
|
+
//#endregion
|
|
584
|
+
//#region src/product/review.ts
|
|
607
585
|
var KizloProductReview = class {
|
|
608
586
|
constructor(kizlo$1) {
|
|
609
587
|
this.kizlo = kizlo$1;
|
|
@@ -619,16 +597,28 @@ var KizloProductReview = class {
|
|
|
619
597
|
return this.kizlo._.http.success(response.data);
|
|
620
598
|
}
|
|
621
599
|
async create(input) {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
body: input
|
|
626
|
-
});
|
|
627
|
-
if (response.error) return this.kizlo._.http.error(response.error);
|
|
628
|
-
return this.kizlo._.http.success(response.data);
|
|
600
|
+
const response = await this.kizlo._.http.post("/products/reviews", {
|
|
601
|
+
auth: true,
|
|
602
|
+
body: input
|
|
629
603
|
});
|
|
604
|
+
if (response.error) return this.kizlo._.http.error(response.error);
|
|
605
|
+
return this.kizlo._.http.success(response.data);
|
|
630
606
|
}
|
|
631
607
|
};
|
|
608
|
+
const reviews = {
|
|
609
|
+
retrieve: woocommerceProcedure.input((0, kizlo.type)()).output((0, kizlo.type)()).errors((0, kizlo_extensions.procedureErrors)()).handler(async ({ input, context }) => {
|
|
610
|
+
return (0, kizlo.ensureProcedureResult)(await context.woocommerce.products.reviews.retrieve(input));
|
|
611
|
+
}),
|
|
612
|
+
list: woocommerceProcedure.input((0, kizlo.type)()).output((0, kizlo.type)()).errors((0, kizlo_extensions.procedureErrors)()).handler(async ({ input, context }) => {
|
|
613
|
+
return (0, kizlo.ensureProcedureResult)(await context.woocommerce.products.reviews.list(input));
|
|
614
|
+
}),
|
|
615
|
+
create: woocommerceProcedure.input((0, kizlo.type)()).output((0, kizlo.type)()).errors((0, kizlo_extensions.procedureErrors)()).handler(async ({ input, context }) => {
|
|
616
|
+
return (0, kizlo.ensureProcedureResult)(await context.woocommerce.products.reviews.create(input));
|
|
617
|
+
})
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
//#endregion
|
|
621
|
+
//#region src/product/product.ts
|
|
632
622
|
var KizloProduct = class {
|
|
633
623
|
reviews;
|
|
634
624
|
categories;
|
|
@@ -638,7 +628,7 @@ var KizloProduct = class {
|
|
|
638
628
|
this.categories = new KizloProductCategory(this.kizlo);
|
|
639
629
|
}
|
|
640
630
|
async retrieve(input) {
|
|
641
|
-
const response = await this.kizlo._.http.get(`/products/${input.
|
|
631
|
+
const response = await this.kizlo._.http.get(`/products/${input.identifier}`, { query: { preview_token: input.preview_token } });
|
|
642
632
|
if (response.error) return this.kizlo._.http.error(response.error);
|
|
643
633
|
return this.kizlo._.http.success(response.data);
|
|
644
634
|
}
|
|
@@ -647,8 +637,8 @@ var KizloProduct = class {
|
|
|
647
637
|
if (response.error) return this.kizlo._.http.error(response.error);
|
|
648
638
|
return this.kizlo._.http.success(response.data);
|
|
649
639
|
}
|
|
650
|
-
async
|
|
651
|
-
const response = await this.kizlo._.http.get("/products/
|
|
640
|
+
async filters(input) {
|
|
641
|
+
const response = await this.kizlo._.http.get("/products/filters", { query: input });
|
|
652
642
|
if (response.error) return this.kizlo._.http.error(response.error);
|
|
653
643
|
return this.kizlo._.http.success(response.data);
|
|
654
644
|
}
|
|
@@ -660,23 +650,11 @@ const products = {
|
|
|
660
650
|
list: woocommerceProcedure.input((0, kizlo.type)()).output((0, kizlo.type)()).errors((0, kizlo_extensions.procedureErrors)()).handler(async ({ input, context }) => {
|
|
661
651
|
return (0, kizlo.ensureProcedureResult)(await context.woocommerce.products.list(input));
|
|
662
652
|
}),
|
|
663
|
-
|
|
664
|
-
return (0, kizlo.ensureProcedureResult)(await context.woocommerce.products.
|
|
653
|
+
filters: woocommerceProcedure.input((0, kizlo.type)()).output((0, kizlo.type)()).errors((0, kizlo_extensions.procedureErrors)()).handler(async ({ input, context }) => {
|
|
654
|
+
return (0, kizlo.ensureProcedureResult)(await context.woocommerce.products.filters(input));
|
|
665
655
|
}),
|
|
666
|
-
categories
|
|
667
|
-
|
|
668
|
-
}) },
|
|
669
|
-
reviews: {
|
|
670
|
-
retrieve: woocommerceProcedure.input((0, kizlo.type)()).output((0, kizlo.type)()).errors((0, kizlo_extensions.procedureErrors)()).handler(async ({ input, context }) => {
|
|
671
|
-
return (0, kizlo.ensureProcedureResult)(await context.woocommerce.products.reviews.retrieve(input));
|
|
672
|
-
}),
|
|
673
|
-
list: woocommerceProcedure.input((0, kizlo.type)()).output((0, kizlo.type)()).errors((0, kizlo_extensions.procedureErrors)()).handler(async ({ input, context }) => {
|
|
674
|
-
return (0, kizlo.ensureProcedureResult)(await context.woocommerce.products.reviews.list(input));
|
|
675
|
-
}),
|
|
676
|
-
create: woocommerceProcedure.input((0, kizlo.type)()).output((0, kizlo.type)()).errors((0, kizlo_extensions.procedureErrors)()).handler(async ({ input, context }) => {
|
|
677
|
-
return (0, kizlo.ensureProcedureResult)(await context.woocommerce.products.reviews.create(input));
|
|
678
|
-
})
|
|
679
|
-
}
|
|
656
|
+
categories,
|
|
657
|
+
reviews
|
|
680
658
|
};
|
|
681
659
|
|
|
682
660
|
//#endregion
|
|
@@ -783,6 +761,12 @@ Object.defineProperty(exports, 'cart', {
|
|
|
783
761
|
return cart;
|
|
784
762
|
}
|
|
785
763
|
});
|
|
764
|
+
Object.defineProperty(exports, 'categories', {
|
|
765
|
+
enumerable: true,
|
|
766
|
+
get: function () {
|
|
767
|
+
return categories;
|
|
768
|
+
}
|
|
769
|
+
});
|
|
786
770
|
Object.defineProperty(exports, 'createPaymentServerRouter', {
|
|
787
771
|
enumerable: true,
|
|
788
772
|
get: function () {
|
|
@@ -819,6 +803,12 @@ Object.defineProperty(exports, 'products', {
|
|
|
819
803
|
return products;
|
|
820
804
|
}
|
|
821
805
|
});
|
|
806
|
+
Object.defineProperty(exports, 'reviews', {
|
|
807
|
+
enumerable: true,
|
|
808
|
+
get: function () {
|
|
809
|
+
return reviews;
|
|
810
|
+
}
|
|
811
|
+
});
|
|
822
812
|
Object.defineProperty(exports, 'woocommerce', {
|
|
823
813
|
enumerable: true,
|
|
824
814
|
get: function () {
|