@mercurjs/b2c-core 1.4.3 → 1.4.4
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/.medusa/server/src/admin/index.js +3 -1
- package/.medusa/server/src/admin/index.mjs +3 -1
- package/.medusa/server/src/api/admin/attributes/validators.d.ts +355 -59
- package/.medusa/server/src/api/admin/configuration/validators.d.ts +3 -2
- package/.medusa/server/src/api/admin/notifications/route.js +8 -2
- package/.medusa/server/src/api/admin/order-sets/validators.d.ts +5 -3
- package/.medusa/server/src/api/admin/products/validators.d.ts +909 -500
- package/.medusa/server/src/api/admin/sellers/validators.d.ts +20 -16
- package/.medusa/server/src/api/store/carts/[id]/promotions/route.d.ts +3 -0
- package/.medusa/server/src/api/store/carts/[id]/promotions/route.js +34 -0
- package/.medusa/server/src/api/store/order-set/validators.d.ts +3 -2
- package/.medusa/server/src/api/store/returns/validators.d.ts +3 -2
- package/.medusa/server/src/api/store/seller/validators.d.ts +3 -2
- package/.medusa/server/src/api/store/shipping-options/validators.d.ts +24 -26
- package/.medusa/server/src/api/store/wishlist/validators.d.ts +3 -2
- package/.medusa/server/src/api/vendor/attributes/validators.d.ts +9 -7
- package/.medusa/server/src/api/vendor/campaigns/[id]/promotions/route.d.ts +76 -0
- package/.medusa/server/src/api/vendor/campaigns/[id]/promotions/route.js +89 -0
- package/.medusa/server/src/api/vendor/campaigns/middlewares.js +11 -2
- package/.medusa/server/src/api/vendor/campaigns/route.d.ts +6 -0
- package/.medusa/server/src/api/vendor/campaigns/route.js +10 -4
- package/.medusa/server/src/api/vendor/campaigns/validators.d.ts +20 -12
- package/.medusa/server/src/api/vendor/campaigns/validators.js +10 -4
- package/.medusa/server/src/api/vendor/customer-groups/route.d.ts +2 -2
- package/.medusa/server/src/api/vendor/customer-groups/route.js +5 -5
- package/.medusa/server/src/api/vendor/customer-groups/validators.d.ts +604 -2
- package/.medusa/server/src/api/vendor/customer-groups/validators.js +37 -2
- package/.medusa/server/src/api/vendor/customers/validators.d.ts +6 -4
- package/.medusa/server/src/api/vendor/fulfillment-providers/validators.d.ts +3 -2
- package/.medusa/server/src/api/vendor/fulfillment-sets/validators.d.ts +22 -6
- package/.medusa/server/src/api/vendor/inventory-items/[id]/route.d.ts +23 -0
- package/.medusa/server/src/api/vendor/inventory-items/[id]/route.js +48 -2
- package/.medusa/server/src/api/vendor/inventory-items/middlewares.js +12 -1
- package/.medusa/server/src/api/vendor/inventory-items/validators.d.ts +37 -104
- package/.medusa/server/src/api/vendor/invites/validators.d.ts +3 -2
- package/.medusa/server/src/api/vendor/members/validators.d.ts +7 -6
- package/.medusa/server/src/api/vendor/notifications/validators.d.ts +3 -2
- package/.medusa/server/src/api/vendor/orders/validators.d.ts +13 -11
- package/.medusa/server/src/api/vendor/payouts/validators.d.ts +3 -2
- package/.medusa/server/src/api/vendor/price-lists/validators.d.ts +18 -16
- package/.medusa/server/src/api/vendor/price-preferences/validators.d.ts +37 -29
- package/.medusa/server/src/api/vendor/product-categories/validators.d.ts +317 -26
- package/.medusa/server/src/api/vendor/product-collections/validators.d.ts +6 -4
- package/.medusa/server/src/api/vendor/product-tags/route.js +8 -2
- package/.medusa/server/src/api/vendor/product-tags/validators.d.ts +31 -29
- package/.medusa/server/src/api/vendor/product-types/validators.d.ts +3 -2
- package/.medusa/server/src/api/vendor/products/route.js +7 -3
- package/.medusa/server/src/api/vendor/products/utils.d.ts +4 -1
- package/.medusa/server/src/api/vendor/products/utils.js +40 -2
- package/.medusa/server/src/api/vendor/products/validators.d.ts +905 -377
- package/.medusa/server/src/api/vendor/promotions/validators.d.ts +57 -53
- package/.medusa/server/src/api/vendor/regions/validators.d.ts +3 -2
- package/.medusa/server/src/api/vendor/reservations/validators.d.ts +7 -6
- package/.medusa/server/src/api/vendor/returns/validators.d.ts +9 -8
- package/.medusa/server/src/api/vendor/sellers/validators.d.ts +20 -20
- package/.medusa/server/src/api/vendor/shipping-options/validators.d.ts +27 -26
- package/.medusa/server/src/api/vendor/shipping-profiles/validators.d.ts +5 -4
- package/.medusa/server/src/api/vendor/stock-locations/validators.d.ts +49 -59
- package/.medusa/server/src/links/seller-campaign.js +1 -1
- package/.medusa/server/src/links/seller-customer-group.js +1 -1
- package/.medusa/server/src/modules/attribute/migrations/Migration20250617080244.d.ts +1 -1
- package/.medusa/server/src/modules/attribute/migrations/Migration20250617080244.js +2 -2
- package/.medusa/server/src/modules/attribute/migrations/Migration20250620110849.d.ts +1 -1
- package/.medusa/server/src/modules/attribute/migrations/Migration20250620110849.js +2 -2
- package/.medusa/server/src/modules/attribute/migrations/Migration20250828065431.d.ts +1 -1
- package/.medusa/server/src/modules/attribute/migrations/Migration20250828065431.js +2 -2
- package/.medusa/server/src/modules/attribute/service.d.ts +1 -1
- package/.medusa/server/src/modules/configuration/migrations/Migration20250114063624.d.ts +1 -1
- package/.medusa/server/src/modules/configuration/migrations/Migration20250114063624.js +2 -2
- package/.medusa/server/src/modules/configuration/migrations/Migration20250324131111.d.ts +1 -1
- package/.medusa/server/src/modules/configuration/migrations/Migration20250324131111.js +2 -2
- package/.medusa/server/src/modules/marketplace/migrations/Migration20241207151814.d.ts +1 -1
- package/.medusa/server/src/modules/marketplace/migrations/Migration20241207151814.js +2 -2
- package/.medusa/server/src/modules/payout/migrations/Migration20250317090626.d.ts +1 -1
- package/.medusa/server/src/modules/payout/migrations/Migration20250317090626.js +2 -2
- package/.medusa/server/src/modules/payout/migrations/Migration20250612144913.d.ts +1 -1
- package/.medusa/server/src/modules/payout/migrations/Migration20250612144913.js +2 -2
- package/.medusa/server/src/modules/payout/service.d.ts +1 -1
- package/.medusa/server/src/modules/secondary_categories/migrations/Migration20251014102054.d.ts +1 -1
- package/.medusa/server/src/modules/secondary_categories/migrations/Migration20251014102054.js +2 -2
- package/.medusa/server/src/modules/seller/migrations/Migration20241206125415.d.ts +1 -1
- package/.medusa/server/src/modules/seller/migrations/Migration20241206125415.js +2 -2
- package/.medusa/server/src/modules/seller/migrations/Migration20250212131627.d.ts +1 -1
- package/.medusa/server/src/modules/seller/migrations/Migration20250212131627.js +2 -2
- package/.medusa/server/src/modules/seller/migrations/Migration20250225083755.d.ts +1 -1
- package/.medusa/server/src/modules/seller/migrations/Migration20250225083755.js +2 -2
- package/.medusa/server/src/modules/seller/migrations/Migration20250225094708.d.ts +1 -1
- package/.medusa/server/src/modules/seller/migrations/Migration20250225094708.js +2 -2
- package/.medusa/server/src/modules/seller/migrations/Migration20250307091819.d.ts +1 -1
- package/.medusa/server/src/modules/seller/migrations/Migration20250307091819.js +2 -2
- package/.medusa/server/src/modules/seller/migrations/Migration20250313065552.d.ts +1 -1
- package/.medusa/server/src/modules/seller/migrations/Migration20250313065552.js +2 -2
- package/.medusa/server/src/modules/seller/migrations/Migration20250530111528.d.ts +1 -1
- package/.medusa/server/src/modules/seller/migrations/Migration20250530111528.js +2 -2
- package/.medusa/server/src/modules/seller/utils.d.ts +4 -0
- package/.medusa/server/src/modules/seller/utils.js +18 -1
- package/.medusa/server/src/modules/split-order-payment/migrations/Migration20250516075429.d.ts +1 -1
- package/.medusa/server/src/modules/split-order-payment/migrations/Migration20250516075429.js +2 -2
- package/.medusa/server/src/modules/taxcode/migrations/Migration20250116135408.d.ts +1 -1
- package/.medusa/server/src/modules/taxcode/migrations/Migration20250116135408.js +2 -2
- package/.medusa/server/src/modules/wishlist/migrations/Migration20250424110903.d.ts +1 -1
- package/.medusa/server/src/modules/wishlist/migrations/Migration20250424110903.js +2 -2
- package/.medusa/server/src/workflows/cart/workflows/split-and-complete-cart.js +2 -2
- package/.medusa/server/src/workflows/order/steps/calculate-payout-for-order.d.ts +1 -1
- package/.medusa/server/src/workflows/promotions/steps/register-usage-step.d.ts +7 -2
- package/.medusa/server/src/workflows/promotions/steps/register-usage-step.js +6 -6
- package/.medusa/server/src/workflows/seller/steps/validate-products-to-import.d.ts +10 -10
- package/package.json +15 -28
|
@@ -3,6 +3,7 @@ import { StoreStatus } from '@mercurjs/framework';
|
|
|
3
3
|
export type AdminSellerParamsType = z.infer<typeof AdminSellerParams>;
|
|
4
4
|
export declare const AdminSellerParams: z.ZodObject<{
|
|
5
5
|
fields: z.ZodOptional<z.ZodString>;
|
|
6
|
+
} & {
|
|
6
7
|
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
7
8
|
limit: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
8
9
|
order: z.ZodOptional<z.ZodString> | z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -10,19 +11,20 @@ export declare const AdminSellerParams: z.ZodObject<{
|
|
|
10
11
|
}, "strip", z.ZodTypeAny, {
|
|
11
12
|
offset: number;
|
|
12
13
|
limit: number;
|
|
13
|
-
fields?: string | undefined;
|
|
14
14
|
order?: string | undefined;
|
|
15
|
+
fields?: string | undefined;
|
|
15
16
|
with_deleted?: boolean | undefined;
|
|
16
17
|
}, {
|
|
18
|
+
order?: string | undefined;
|
|
17
19
|
fields?: string | undefined;
|
|
18
20
|
offset?: unknown;
|
|
19
21
|
limit?: unknown;
|
|
20
|
-
order?: string | undefined;
|
|
21
22
|
with_deleted?: unknown;
|
|
22
23
|
}>;
|
|
23
24
|
export type AdminGetSellerProductsParamsType = z.infer<typeof AdminGetSellerProductsParams>;
|
|
24
25
|
export declare const AdminGetSellerProductsParams: z.ZodObject<{
|
|
25
26
|
fields: z.ZodOptional<z.ZodString>;
|
|
27
|
+
} & {
|
|
26
28
|
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
27
29
|
limit: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
28
30
|
order: z.ZodOptional<z.ZodString> | z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -30,19 +32,20 @@ export declare const AdminGetSellerProductsParams: z.ZodObject<{
|
|
|
30
32
|
}, "strip", z.ZodTypeAny, {
|
|
31
33
|
offset: number;
|
|
32
34
|
limit: number;
|
|
33
|
-
fields?: string | undefined;
|
|
34
35
|
order?: string | undefined;
|
|
36
|
+
fields?: string | undefined;
|
|
35
37
|
with_deleted?: boolean | undefined;
|
|
36
38
|
}, {
|
|
39
|
+
order?: string | undefined;
|
|
37
40
|
fields?: string | undefined;
|
|
38
41
|
offset?: unknown;
|
|
39
42
|
limit?: unknown;
|
|
40
|
-
order?: string | undefined;
|
|
41
43
|
with_deleted?: unknown;
|
|
42
44
|
}>;
|
|
43
45
|
export type AdminGetSellerOrdersParamsType = z.infer<typeof AdminGetSellerOrdersParams>;
|
|
44
46
|
export declare const AdminGetSellerOrdersParams: z.ZodObject<{
|
|
45
47
|
fields: z.ZodOptional<z.ZodString>;
|
|
48
|
+
} & {
|
|
46
49
|
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
47
50
|
limit: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
48
51
|
order: z.ZodOptional<z.ZodString> | z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -50,19 +53,20 @@ export declare const AdminGetSellerOrdersParams: z.ZodObject<{
|
|
|
50
53
|
}, "strip", z.ZodTypeAny, {
|
|
51
54
|
offset: number;
|
|
52
55
|
limit: number;
|
|
53
|
-
fields?: string | undefined;
|
|
54
56
|
order?: string | undefined;
|
|
57
|
+
fields?: string | undefined;
|
|
55
58
|
with_deleted?: boolean | undefined;
|
|
56
59
|
}, {
|
|
60
|
+
order?: string | undefined;
|
|
57
61
|
fields?: string | undefined;
|
|
58
62
|
offset?: unknown;
|
|
59
63
|
limit?: unknown;
|
|
60
|
-
order?: string | undefined;
|
|
61
64
|
with_deleted?: unknown;
|
|
62
65
|
}>;
|
|
63
66
|
export type AdminGetSellerCustomerGroupsParamsType = z.infer<typeof AdminGetSellerCustomerGroupsParams>;
|
|
64
67
|
export declare const AdminGetSellerCustomerGroupsParams: z.ZodObject<{
|
|
65
68
|
fields: z.ZodOptional<z.ZodString>;
|
|
69
|
+
} & {
|
|
66
70
|
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
67
71
|
limit: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
68
72
|
order: z.ZodOptional<z.ZodString> | z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -70,14 +74,14 @@ export declare const AdminGetSellerCustomerGroupsParams: z.ZodObject<{
|
|
|
70
74
|
}, "strip", z.ZodTypeAny, {
|
|
71
75
|
offset: number;
|
|
72
76
|
limit: number;
|
|
73
|
-
fields?: string | undefined;
|
|
74
77
|
order?: string | undefined;
|
|
78
|
+
fields?: string | undefined;
|
|
75
79
|
with_deleted?: boolean | undefined;
|
|
76
80
|
}, {
|
|
81
|
+
order?: string | undefined;
|
|
77
82
|
fields?: string | undefined;
|
|
78
83
|
offset?: unknown;
|
|
79
84
|
limit?: unknown;
|
|
80
|
-
order?: string | undefined;
|
|
81
85
|
with_deleted?: unknown;
|
|
82
86
|
}>;
|
|
83
87
|
export type AdminUpdateSellerType = z.infer<typeof AdminUpdateSeller>;
|
|
@@ -95,31 +99,31 @@ export declare const AdminUpdateSeller: z.ZodObject<{
|
|
|
95
99
|
tax_id: z.ZodOptional<z.ZodString>;
|
|
96
100
|
store_status: z.ZodOptional<z.ZodNativeEnum<typeof StoreStatus>>;
|
|
97
101
|
}, "strict", z.ZodTypeAny, {
|
|
102
|
+
store_status?: StoreStatus | undefined;
|
|
98
103
|
name?: string | undefined;
|
|
99
104
|
description?: string | undefined;
|
|
100
105
|
photo?: string | undefined;
|
|
101
|
-
email?: string | undefined;
|
|
102
|
-
phone?: string | undefined;
|
|
103
106
|
address_line?: string | undefined;
|
|
104
107
|
city?: string | undefined;
|
|
105
|
-
state?: string | undefined;
|
|
106
108
|
postal_code?: string | undefined;
|
|
107
109
|
country_code?: string | undefined;
|
|
108
110
|
tax_id?: string | undefined;
|
|
109
|
-
|
|
111
|
+
email?: string | undefined;
|
|
112
|
+
phone?: string | undefined;
|
|
113
|
+
state?: string | undefined;
|
|
110
114
|
}, {
|
|
115
|
+
store_status?: StoreStatus | undefined;
|
|
111
116
|
name?: unknown;
|
|
112
117
|
description?: string | undefined;
|
|
113
118
|
photo?: string | undefined;
|
|
114
|
-
email?: string | undefined;
|
|
115
|
-
phone?: string | undefined;
|
|
116
119
|
address_line?: string | undefined;
|
|
117
120
|
city?: string | undefined;
|
|
118
|
-
state?: string | undefined;
|
|
119
121
|
postal_code?: string | undefined;
|
|
120
122
|
country_code?: string | undefined;
|
|
121
123
|
tax_id?: string | undefined;
|
|
122
|
-
|
|
124
|
+
email?: string | undefined;
|
|
125
|
+
phone?: string | undefined;
|
|
126
|
+
state?: string | undefined;
|
|
123
127
|
}>;
|
|
124
128
|
export type AdminInviteSellerType = z.infer<typeof AdminInviteSeller>;
|
|
125
129
|
export declare const AdminInviteSeller: z.ZodObject<{
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AuthenticatedMedusaRequest, MedusaResponse } from "@medusajs/framework";
|
|
2
|
+
import { StoreAddCartPromotionsType } from "@medusajs/medusa/api/store/carts/validators";
|
|
3
|
+
export declare const POST: (req: AuthenticatedMedusaRequest<StoreAddCartPromotionsType>, res: MedusaResponse) => Promise<void>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.POST = void 0;
|
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
5
|
+
const core_flows_1 = require("@medusajs/medusa/core-flows");
|
|
6
|
+
const framework_1 = require("@mercurjs/framework");
|
|
7
|
+
const seller_1 = require("../../../../../modules/seller");
|
|
8
|
+
const POST = async (req, res) => {
|
|
9
|
+
const query = req.scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
|
|
10
|
+
const seller = await (0, framework_1.fetchSellerByAuthActorId)(req.auth_context?.actor_id, req.scope);
|
|
11
|
+
const validatePromotions = await (0, seller_1.validateSellerPromotions)(req.validatedBody.promo_codes, req.scope, seller.id);
|
|
12
|
+
if (!validatePromotions.valid) {
|
|
13
|
+
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, 'Some of the promotion codes are invalid');
|
|
14
|
+
}
|
|
15
|
+
await core_flows_1.updateCartPromotionsWorkflow.run({
|
|
16
|
+
input: {
|
|
17
|
+
cart_id: req.params.id,
|
|
18
|
+
promo_codes: req.validatedBody.promo_codes,
|
|
19
|
+
action: req.validatedBody.promo_codes.length > 0
|
|
20
|
+
? utils_1.PromotionActions.ADD
|
|
21
|
+
: utils_1.PromotionActions.REPLACE,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
const { data: [cart] } = await query.graph({
|
|
25
|
+
entity: 'cart',
|
|
26
|
+
filters: {
|
|
27
|
+
id: req.params.id
|
|
28
|
+
},
|
|
29
|
+
fields: req.queryConfig.fields
|
|
30
|
+
});
|
|
31
|
+
res.json({ cart });
|
|
32
|
+
};
|
|
33
|
+
exports.POST = POST;
|
|
34
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvYXBpL3N0b3JlL2NhcnRzL1tpZF0vcHJvbW90aW9ucy9yb3V0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSxxREFBb0c7QUFFcEcsNERBQTBFO0FBQzFFLG1EQUE4RDtBQUM5RCwwREFBd0U7QUFFakUsTUFBTSxJQUFJLEdBQUcsS0FBSyxFQUNyQixHQUEyRCxFQUMzRCxHQUFtQixFQUNuQixFQUFFO0lBQ0YsTUFBTSxLQUFLLEdBQUcsR0FBRyxDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUMsaUNBQ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xFQUFFLEdBQUcsQ0FBQyxNQUFNLENBQUMsRUFBRTtTQUNsQjtRQUNELE1BQU0sRUFBRSxHQUFHLENBQUMsV0FBVyxDQUFDLE1BQU07S0FDL0IsQ0FBQyxDQUFBO0lBRUYsR0FBRyxDQUFDLElBQUksQ0FBQyxFQUFFLElBQUksRUFBRSxDQUFDLENBQUE7QUFDcEIsQ0FBQyxDQUFBO0FBM0NVLFFBQUEsSUFBSSxRQTJDZCJ9
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const StoreGetOrderSetParams: import("zod").ZodObject<{
|
|
2
2
|
fields: import("zod").ZodOptional<import("zod").ZodString>;
|
|
3
|
+
} & {
|
|
3
4
|
offset: import("zod").ZodEffects<import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>, number, unknown>;
|
|
4
5
|
limit: import("zod").ZodEffects<import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>, number, unknown>;
|
|
5
6
|
order: import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
@@ -7,13 +8,13 @@ export declare const StoreGetOrderSetParams: import("zod").ZodObject<{
|
|
|
7
8
|
}, "strip", import("zod").ZodTypeAny, {
|
|
8
9
|
offset: number;
|
|
9
10
|
limit: number;
|
|
10
|
-
fields?: string | undefined;
|
|
11
11
|
order?: string | undefined;
|
|
12
|
+
fields?: string | undefined;
|
|
12
13
|
with_deleted?: boolean | undefined;
|
|
13
14
|
}, {
|
|
15
|
+
order?: string | undefined;
|
|
14
16
|
fields?: string | undefined;
|
|
15
17
|
offset?: unknown;
|
|
16
18
|
limit?: unknown;
|
|
17
|
-
order?: string | undefined;
|
|
18
19
|
with_deleted?: unknown;
|
|
19
20
|
}>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const StoreGetReturnsParams: import("zod").ZodObject<{
|
|
2
2
|
fields: import("zod").ZodOptional<import("zod").ZodString>;
|
|
3
|
+
} & {
|
|
3
4
|
offset: import("zod").ZodEffects<import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>, number, unknown>;
|
|
4
5
|
limit: import("zod").ZodEffects<import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>, number, unknown>;
|
|
5
6
|
order: import("zod").ZodOptional<import("zod").ZodString> | import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
@@ -7,13 +8,13 @@ export declare const StoreGetReturnsParams: import("zod").ZodObject<{
|
|
|
7
8
|
}, "strip", import("zod").ZodTypeAny, {
|
|
8
9
|
offset: number;
|
|
9
10
|
limit: number;
|
|
10
|
-
fields?: string | undefined;
|
|
11
11
|
order?: string | undefined;
|
|
12
|
+
fields?: string | undefined;
|
|
12
13
|
with_deleted?: boolean | undefined;
|
|
13
14
|
}, {
|
|
15
|
+
order?: string | undefined;
|
|
14
16
|
fields?: string | undefined;
|
|
15
17
|
offset?: unknown;
|
|
16
18
|
limit?: unknown;
|
|
17
|
-
order?: string | undefined;
|
|
18
19
|
with_deleted?: unknown;
|
|
19
20
|
}>;
|
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
export type StoreGetSellersParamsType = z.infer<typeof StoreGetSellersParams>;
|
|
3
3
|
export declare const StoreGetSellersParams: z.ZodObject<{
|
|
4
4
|
fields: z.ZodOptional<z.ZodString>;
|
|
5
|
+
} & {
|
|
5
6
|
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
6
7
|
limit: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
7
8
|
order: z.ZodOptional<z.ZodString> | z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -9,13 +10,13 @@ export declare const StoreGetSellersParams: z.ZodObject<{
|
|
|
9
10
|
}, "strip", z.ZodTypeAny, {
|
|
10
11
|
offset: number;
|
|
11
12
|
limit: number;
|
|
12
|
-
fields?: string | undefined;
|
|
13
13
|
order?: string | undefined;
|
|
14
|
+
fields?: string | undefined;
|
|
14
15
|
with_deleted?: boolean | undefined;
|
|
15
16
|
}, {
|
|
17
|
+
order?: string | undefined;
|
|
16
18
|
fields?: string | undefined;
|
|
17
19
|
offset?: unknown;
|
|
18
20
|
limit?: unknown;
|
|
19
|
-
order?: string | undefined;
|
|
20
21
|
with_deleted?: unknown;
|
|
21
22
|
}>;
|
|
@@ -17,48 +17,46 @@ export declare const StoreGetShippingOptionsFields: z.ZodObject<{
|
|
|
17
17
|
is_return?: boolean | undefined;
|
|
18
18
|
}>;
|
|
19
19
|
export type StoreGetShippingOptionsType = z.infer<typeof StoreGetShippingOptions>;
|
|
20
|
-
export declare const StoreGetShippingOptions: z.ZodObject<{
|
|
20
|
+
export declare const StoreGetShippingOptions: z.ZodObject<{} & {
|
|
21
21
|
[x: string]: any;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
$and: z.ZodOptional<z.ZodLazy<z.ZodArray<z.ZodObject<{
|
|
23
|
+
cart_id: z.ZodString;
|
|
24
|
+
is_return: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
}, "strict", z.ZodTypeAny, {
|
|
26
|
+
cart_id: string;
|
|
27
|
+
is_return?: boolean | undefined;
|
|
26
28
|
}, {
|
|
27
|
-
|
|
29
|
+
cart_id: string;
|
|
30
|
+
is_return?: boolean | undefined;
|
|
28
31
|
}>, "many">>>;
|
|
29
|
-
$or: z.ZodOptional<z.ZodLazy<z.ZodArray<z.ZodObject<
|
|
30
|
-
|
|
32
|
+
$or: z.ZodOptional<z.ZodLazy<z.ZodArray<z.ZodObject<{
|
|
33
|
+
cart_id: z.ZodString;
|
|
34
|
+
is_return: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
}, "strict", z.ZodTypeAny, {
|
|
36
|
+
cart_id: string;
|
|
37
|
+
is_return?: boolean | undefined;
|
|
31
38
|
}, {
|
|
32
|
-
|
|
39
|
+
cart_id: string;
|
|
40
|
+
is_return?: boolean | undefined;
|
|
33
41
|
}>, "many">>>;
|
|
34
42
|
}, "strip", z.ZodTypeAny, {
|
|
35
43
|
[x: string]: any;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
$and?: {
|
|
39
|
-
[x: string]: any;
|
|
40
|
-
}[] | undefined;
|
|
41
|
-
$or?: {
|
|
42
|
-
[x: string]: any;
|
|
43
|
-
}[] | undefined;
|
|
44
|
+
$and?: unknown;
|
|
45
|
+
$or?: unknown;
|
|
44
46
|
}, {
|
|
45
47
|
[x: string]: any;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
$and?: {
|
|
49
|
-
[x: string]: any;
|
|
50
|
-
}[] | undefined;
|
|
51
|
-
$or?: {
|
|
52
|
-
[x: string]: any;
|
|
53
|
-
}[] | undefined;
|
|
48
|
+
$and?: unknown;
|
|
49
|
+
$or?: unknown;
|
|
54
50
|
}>;
|
|
55
51
|
export type StoreGetReturnShippingOptionsParamsType = z.infer<typeof StoreGetReturnShippingOptions>;
|
|
56
52
|
export declare const StoreGetReturnShippingOptions: z.ZodObject<{
|
|
53
|
+
fields: z.ZodOptional<z.ZodString>;
|
|
54
|
+
} & {
|
|
57
55
|
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
58
56
|
limit: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
59
|
-
fields: z.ZodOptional<z.ZodString>;
|
|
60
57
|
order: z.ZodOptional<z.ZodString> | z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
61
58
|
with_deleted: z.ZodEffects<z.ZodOptional<z.ZodBoolean>, boolean | undefined, unknown>;
|
|
59
|
+
} & {
|
|
62
60
|
order_id: z.ZodString;
|
|
63
61
|
}, "strict", z.ZodTypeAny, {
|
|
64
62
|
offset: number;
|
|
@@ -18,6 +18,7 @@ export type StoreGetWishlistsParamsType = z.infer<typeof StoreGetWishlistsParams
|
|
|
18
18
|
*/
|
|
19
19
|
export declare const StoreGetWishlistsParams: z.ZodObject<{
|
|
20
20
|
fields: z.ZodOptional<z.ZodString>;
|
|
21
|
+
} & {
|
|
21
22
|
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
22
23
|
limit: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
23
24
|
order: z.ZodOptional<z.ZodString> | z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -25,14 +26,14 @@ export declare const StoreGetWishlistsParams: z.ZodObject<{
|
|
|
25
26
|
}, "strip", z.ZodTypeAny, {
|
|
26
27
|
offset: number;
|
|
27
28
|
limit: number;
|
|
28
|
-
fields?: string | undefined;
|
|
29
29
|
order?: string | undefined;
|
|
30
|
+
fields?: string | undefined;
|
|
30
31
|
with_deleted?: boolean | undefined;
|
|
31
32
|
}, {
|
|
33
|
+
order?: string | undefined;
|
|
32
34
|
fields?: string | undefined;
|
|
33
35
|
offset?: unknown;
|
|
34
36
|
limit?: unknown;
|
|
35
|
-
order?: string | undefined;
|
|
36
37
|
with_deleted?: unknown;
|
|
37
38
|
}>;
|
|
38
39
|
export type StoreCreateWishlistType = z.infer<typeof StoreCreateWishlist>;
|
|
@@ -2,11 +2,13 @@ import { z } from 'zod';
|
|
|
2
2
|
import { AttributeUIComponent } from '@mercurjs/framework';
|
|
3
3
|
export type VendorGetAttributesParamsType = z.infer<typeof VendorGetAttributesParams>;
|
|
4
4
|
export declare const VendorGetAttributesParams: z.ZodObject<{
|
|
5
|
+
fields: z.ZodOptional<z.ZodString>;
|
|
6
|
+
} & {
|
|
5
7
|
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
6
8
|
limit: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
|
|
7
|
-
fields: z.ZodOptional<z.ZodString>;
|
|
8
9
|
order: z.ZodOptional<z.ZodString> | z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
9
10
|
with_deleted: z.ZodEffects<z.ZodOptional<z.ZodBoolean>, boolean | undefined, unknown>;
|
|
11
|
+
} & {
|
|
10
12
|
id: z.ZodOptional<z.ZodString>;
|
|
11
13
|
name: z.ZodOptional<z.ZodString>;
|
|
12
14
|
handle: z.ZodOptional<z.ZodString>;
|
|
@@ -14,21 +16,21 @@ export declare const VendorGetAttributesParams: z.ZodObject<{
|
|
|
14
16
|
}, "strip", z.ZodTypeAny, {
|
|
15
17
|
offset: number;
|
|
16
18
|
limit: number;
|
|
17
|
-
fields?: string | undefined;
|
|
18
|
-
order?: string | undefined;
|
|
19
|
-
with_deleted?: boolean | undefined;
|
|
20
19
|
id?: string | undefined;
|
|
21
20
|
name?: string | undefined;
|
|
22
21
|
handle?: string | undefined;
|
|
22
|
+
fields?: string | undefined;
|
|
23
|
+
order?: string | undefined;
|
|
24
|
+
with_deleted?: boolean | undefined;
|
|
23
25
|
ui_component?: AttributeUIComponent | undefined;
|
|
24
26
|
}, {
|
|
27
|
+
id?: string | undefined;
|
|
25
28
|
offset?: unknown;
|
|
26
29
|
limit?: unknown;
|
|
30
|
+
name?: string | undefined;
|
|
31
|
+
handle?: string | undefined;
|
|
27
32
|
fields?: string | undefined;
|
|
28
33
|
order?: string | undefined;
|
|
29
34
|
with_deleted?: unknown;
|
|
30
|
-
id?: string | undefined;
|
|
31
|
-
name?: string | undefined;
|
|
32
|
-
handle?: string | undefined;
|
|
33
35
|
ui_component?: AttributeUIComponent | undefined;
|
|
34
36
|
}>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { AuthenticatedMedusaRequest, MedusaResponse } from "@medusajs/framework/http";
|
|
2
|
+
import { LinkMethodRequest } from "@medusajs/framework/types";
|
|
3
|
+
/**
|
|
4
|
+
* @oas [post] /vendor/campaigns/{id}/promotions
|
|
5
|
+
* operationId: VendorPostCampaignsIdPromotions
|
|
6
|
+
* summary: Manage the Promotions of a Campaign
|
|
7
|
+
* description: Manage the promotions of a campaign, either by adding them or removing them from the campaign.
|
|
8
|
+
* x-authenticated: true
|
|
9
|
+
* parameters:
|
|
10
|
+
* - name: id
|
|
11
|
+
* in: path
|
|
12
|
+
* description: The campaign's ID.
|
|
13
|
+
* required: true
|
|
14
|
+
* schema:
|
|
15
|
+
* type: string
|
|
16
|
+
* - name: fields
|
|
17
|
+
* in: query
|
|
18
|
+
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
|
|
19
|
+
* fields. without prefix it will replace the entire default fields.
|
|
20
|
+
* required: false
|
|
21
|
+
* schema:
|
|
22
|
+
* type: string
|
|
23
|
+
* title: fields
|
|
24
|
+
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
|
|
25
|
+
* fields. without prefix it will replace the entire default fields.
|
|
26
|
+
* externalDocs:
|
|
27
|
+
* url: "#select-fields-and-relations"
|
|
28
|
+
* security:
|
|
29
|
+
* - api_token: []
|
|
30
|
+
* - cookie_auth: []
|
|
31
|
+
* - jwt_token: []
|
|
32
|
+
* requestBody:
|
|
33
|
+
* content:
|
|
34
|
+
* application/json:
|
|
35
|
+
* schema:
|
|
36
|
+
* type: object
|
|
37
|
+
* description: The promotions to add or remove from the campaign.
|
|
38
|
+
* properties:
|
|
39
|
+
* add:
|
|
40
|
+
* type: array
|
|
41
|
+
* description: The promotions to add to the campaign.
|
|
42
|
+
* items:
|
|
43
|
+
* type: string
|
|
44
|
+
* title: add
|
|
45
|
+
* description: A promotion's ID.
|
|
46
|
+
* remove:
|
|
47
|
+
* type: array
|
|
48
|
+
* description: The promotions to remove from the campaign.
|
|
49
|
+
* items:
|
|
50
|
+
* type: string
|
|
51
|
+
* title: remove
|
|
52
|
+
* description: A promotion's ID.
|
|
53
|
+
* tags:
|
|
54
|
+
* - Vendor Campaigns
|
|
55
|
+
* responses:
|
|
56
|
+
* "200":
|
|
57
|
+
* description: OK
|
|
58
|
+
* content:
|
|
59
|
+
* application/json:
|
|
60
|
+
* schema:
|
|
61
|
+
* $ref: "#/components/schemas/VendorCampaign"
|
|
62
|
+
* "400":
|
|
63
|
+
* $ref: "#/components/responses/400_error"
|
|
64
|
+
* "401":
|
|
65
|
+
* $ref: "#/components/responses/unauthorized"
|
|
66
|
+
* "404":
|
|
67
|
+
* $ref: "#/components/responses/not_found_error"
|
|
68
|
+
* "409":
|
|
69
|
+
* $ref: "#/components/responses/invalid_state_error"
|
|
70
|
+
* "422":
|
|
71
|
+
* $ref: "#/components/responses/invalid_request_error"
|
|
72
|
+
* "500":
|
|
73
|
+
* $ref: "#/components/responses/500_error"
|
|
74
|
+
*
|
|
75
|
+
*/
|
|
76
|
+
export declare const POST: (req: AuthenticatedMedusaRequest<LinkMethodRequest>, res: MedusaResponse) => Promise<void>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.POST = void 0;
|
|
4
|
+
const core_flows_1 = require("@medusajs/core-flows");
|
|
5
|
+
const helpers_1 = require("@medusajs/medusa/api/admin/campaigns/helpers");
|
|
6
|
+
/**
|
|
7
|
+
* @oas [post] /vendor/campaigns/{id}/promotions
|
|
8
|
+
* operationId: VendorPostCampaignsIdPromotions
|
|
9
|
+
* summary: Manage the Promotions of a Campaign
|
|
10
|
+
* description: Manage the promotions of a campaign, either by adding them or removing them from the campaign.
|
|
11
|
+
* x-authenticated: true
|
|
12
|
+
* parameters:
|
|
13
|
+
* - name: id
|
|
14
|
+
* in: path
|
|
15
|
+
* description: The campaign's ID.
|
|
16
|
+
* required: true
|
|
17
|
+
* schema:
|
|
18
|
+
* type: string
|
|
19
|
+
* - name: fields
|
|
20
|
+
* in: query
|
|
21
|
+
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
|
|
22
|
+
* fields. without prefix it will replace the entire default fields.
|
|
23
|
+
* required: false
|
|
24
|
+
* schema:
|
|
25
|
+
* type: string
|
|
26
|
+
* title: fields
|
|
27
|
+
* description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
|
|
28
|
+
* fields. without prefix it will replace the entire default fields.
|
|
29
|
+
* externalDocs:
|
|
30
|
+
* url: "#select-fields-and-relations"
|
|
31
|
+
* security:
|
|
32
|
+
* - api_token: []
|
|
33
|
+
* - cookie_auth: []
|
|
34
|
+
* - jwt_token: []
|
|
35
|
+
* requestBody:
|
|
36
|
+
* content:
|
|
37
|
+
* application/json:
|
|
38
|
+
* schema:
|
|
39
|
+
* type: object
|
|
40
|
+
* description: The promotions to add or remove from the campaign.
|
|
41
|
+
* properties:
|
|
42
|
+
* add:
|
|
43
|
+
* type: array
|
|
44
|
+
* description: The promotions to add to the campaign.
|
|
45
|
+
* items:
|
|
46
|
+
* type: string
|
|
47
|
+
* title: add
|
|
48
|
+
* description: A promotion's ID.
|
|
49
|
+
* remove:
|
|
50
|
+
* type: array
|
|
51
|
+
* description: The promotions to remove from the campaign.
|
|
52
|
+
* items:
|
|
53
|
+
* type: string
|
|
54
|
+
* title: remove
|
|
55
|
+
* description: A promotion's ID.
|
|
56
|
+
* tags:
|
|
57
|
+
* - Vendor Campaigns
|
|
58
|
+
* responses:
|
|
59
|
+
* "200":
|
|
60
|
+
* description: OK
|
|
61
|
+
* content:
|
|
62
|
+
* application/json:
|
|
63
|
+
* schema:
|
|
64
|
+
* $ref: "#/components/schemas/VendorCampaign"
|
|
65
|
+
* "400":
|
|
66
|
+
* $ref: "#/components/responses/400_error"
|
|
67
|
+
* "401":
|
|
68
|
+
* $ref: "#/components/responses/unauthorized"
|
|
69
|
+
* "404":
|
|
70
|
+
* $ref: "#/components/responses/not_found_error"
|
|
71
|
+
* "409":
|
|
72
|
+
* $ref: "#/components/responses/invalid_state_error"
|
|
73
|
+
* "422":
|
|
74
|
+
* $ref: "#/components/responses/invalid_request_error"
|
|
75
|
+
* "500":
|
|
76
|
+
* $ref: "#/components/responses/500_error"
|
|
77
|
+
*
|
|
78
|
+
*/
|
|
79
|
+
const POST = async (req, res) => {
|
|
80
|
+
const { id } = req.params;
|
|
81
|
+
const { add, remove } = req.validatedBody;
|
|
82
|
+
await (0, core_flows_1.addOrRemoveCampaignPromotionsWorkflow)(req.scope).run({
|
|
83
|
+
input: { id, add, remove },
|
|
84
|
+
});
|
|
85
|
+
const campaign = await (0, helpers_1.refetchCampaign)(req.params.id, req.scope, req.queryConfig.fields);
|
|
86
|
+
res.status(200).json({ campaign });
|
|
87
|
+
};
|
|
88
|
+
exports.POST = POST;
|
|
89
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvYXBpL3ZlbmRvci9jYW1wYWlnbnMvW2lkXS9wcm9tb3Rpb25zL3JvdXRlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUtFLHFEQUE0RTtBQUU1RSwwRUFBOEU7QUFFaEY7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztFQXdFRTtBQUVPLE1BQU0sSUFBSSxHQUFHLEtBQUssRUFDdkIsR0FBa0QsRUFDbEQsR0FBbUIsRUFDbkIsRUFBRTtJQUNGLE1BQU0sRUFBRSxFQUFFLEVBQUUsR0FBRyxHQUFHLENBQUMsTUFBTSxDQUFBO0lBQ3pCLE1BQU0sRUFBRSxHQUFHLEVBQUUsTUFBTSxFQUFFLEdBQUcsR0FBRyxDQUFDLGFBQWEsQ0FBQTtJQUN6QyxNQUFNLElBQUEsa0RBQXFDLEVBQUMsR0FBRyxDQUFDLEtBQUssQ0FBQyxDQUFDLEdBQUcsQ0FBQztRQUN6RCxLQUFLLEVBQUUsRUFBRSxFQUFFLEVBQUUsR0FBRyxFQUFFLE1BQU0sRUFBRTtLQUMzQixDQUFDLENBQUE7SUFFRixNQUFNLFFBQVEsR0FBRyxNQUFNLElBQUEseUJBQWUsRUFDcEMsR0FBRyxDQUFDLE1BQU0sQ0FBQyxFQUFFLEVBQ2IsR0FBRyxDQUFDLEtBQUssRUFDVCxHQUFHLENBQUMsV0FBVyxDQUFDLE1BQU0sQ0FDdkIsQ0FBQTtJQUVELEdBQUcsQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLENBQUMsSUFBSSxDQUFDLEVBQUUsUUFBUSxFQUFFLENBQUMsQ0FBQTtBQUNwQyxDQUFDLENBQUE7QUFqQlksUUFBQSxJQUFJLFFBaUJoQiJ9
|
|
@@ -9,6 +9,7 @@ const seller_campaign_1 = __importDefault(require("../../../links/seller-campaig
|
|
|
9
9
|
const middlewares_1 = require("../../../shared/infra/http/middlewares");
|
|
10
10
|
const query_config_1 = require("./query-config");
|
|
11
11
|
const validators_1 = require("./validators");
|
|
12
|
+
const validators_2 = require("@medusajs/medusa/api/utils/validators");
|
|
12
13
|
exports.vendorCampaignsMiddlewares = [
|
|
13
14
|
{
|
|
14
15
|
method: ['GET'],
|
|
@@ -58,6 +59,14 @@ exports.vendorCampaignsMiddlewares = [
|
|
|
58
59
|
(0, framework_1.validateAndTransformBody)(validators_1.VendorCreateCampaign),
|
|
59
60
|
(0, framework_1.validateAndTransformQuery)(validators_1.VendorGetCampaignsParams, query_config_1.vendorCampaignQueryConfig.retrieve)
|
|
60
61
|
]
|
|
61
|
-
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
method: ["POST"],
|
|
65
|
+
matcher: "/vendor/campaigns/:id/promotions",
|
|
66
|
+
middlewares: [
|
|
67
|
+
(0, framework_1.validateAndTransformBody)((0, validators_2.createLinkBody)()),
|
|
68
|
+
(0, framework_1.validateAndTransformQuery)(validators_1.VendorGetCampaignsParams, query_config_1.vendorCampaignQueryConfig.retrieve),
|
|
69
|
+
],
|
|
70
|
+
},
|
|
62
71
|
];
|
|
63
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
72
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWlkZGxld2FyZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvYXBpL3ZlbmRvci9jYW1wYWlnbnMvbWlkZGxld2FyZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsbURBSTRCO0FBRTVCLHFGQUEyRDtBQUMzRCx3RUFHK0M7QUFDL0MsaURBQTBEO0FBQzFELDZDQUlxQjtBQUNyQixzRUFBc0U7QUFFekQsUUFBQSwwQkFBMEIsR0FBc0I7SUFDM0Q7UUFDRSxNQUFNLEVBQUUsQ0FBQyxLQUFLLENBQUM7UUFDZixPQUFPLEVBQUUsbUJBQW1CO1FBQzVCLFdBQVcsRUFBRTtZQUNYLElBQUEscUNBQXlCLEVBQ3ZCLHFDQUF3QixFQUN4Qix3Q0FBeUIsQ0FBQyxJQUFJLENBQy9CO1lBQ0QsSUFBQSw4QkFBZ0IsR0FBRTtTQUNuQjtLQUNGO0lBQ0Q7UUFDRSxNQUFNLEVBQUUsQ0FBQyxLQUFLLENBQUM7UUFDZixPQUFPLEVBQUUsdUJBQXVCO1FBQ2hDLFdBQVcsRUFBRTtZQUNYLElBQUEscUNBQXlCLEVBQ3ZCLHFDQUF3QixFQUN4Qix3Q0FBeUIsQ0FBQyxRQUFRLENBQ25DO1lBQ0QsSUFBQSxnREFBa0MsRUFBQztnQkFDakMsVUFBVSxFQUFFLHlCQUFjLENBQUMsVUFBVTtnQkFDckMsV0FBVyxFQUFFLGFBQWE7YUFDM0IsQ0FBQztTQUNIO0tBQ0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Q0FBeUIsQ0FBQyxRQUFRLENBQ25DO1NBQ0Y7S0FDRjtDQUNGLENBQUEifQ==
|
|
@@ -7,6 +7,12 @@ import { VendorCreateCampaignType } from "./validators";
|
|
|
7
7
|
* description: "Retrieves a list of campaigns for the authenticated vendor."
|
|
8
8
|
* x-authenticated: true
|
|
9
9
|
* parameters:
|
|
10
|
+
* - name: q
|
|
11
|
+
* in: query
|
|
12
|
+
* schema:
|
|
13
|
+
* type: string
|
|
14
|
+
* required: false
|
|
15
|
+
* description: Search query to filter campaigns by name (case-insensitive).
|
|
10
16
|
* - name: offset
|
|
11
17
|
* in: query
|
|
12
18
|
* schema:
|
|
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.POST = exports.GET = void 0;
|
|
7
7
|
const utils_1 = require("@medusajs/framework/utils");
|
|
8
|
-
const
|
|
9
|
-
const utils_2 = require("../../../shared/infra/http/utils");
|
|
8
|
+
const framework_1 = require("@mercurjs/framework");
|
|
10
9
|
const workflows_1 = require("../../../workflows/campaigns/workflows");
|
|
10
|
+
const seller_campaign_1 = __importDefault(require("../../../links/seller-campaign"));
|
|
11
11
|
/**
|
|
12
12
|
* @oas [get] /vendor/campaigns
|
|
13
13
|
* operationId: "VendorListCampaigns"
|
|
@@ -15,6 +15,12 @@ const workflows_1 = require("../../../workflows/campaigns/workflows");
|
|
|
15
15
|
* description: "Retrieves a list of campaigns for the authenticated vendor."
|
|
16
16
|
* x-authenticated: true
|
|
17
17
|
* parameters:
|
|
18
|
+
* - name: q
|
|
19
|
+
* in: query
|
|
20
|
+
* schema:
|
|
21
|
+
* type: string
|
|
22
|
+
* required: false
|
|
23
|
+
* description: Search query to filter campaigns by name (case-insensitive).
|
|
18
24
|
* - name: offset
|
|
19
25
|
* in: query
|
|
20
26
|
* schema:
|
|
@@ -120,7 +126,7 @@ exports.GET = GET;
|
|
|
120
126
|
*/
|
|
121
127
|
const POST = async (req, res) => {
|
|
122
128
|
const query = req.scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
|
|
123
|
-
const seller = await (0,
|
|
129
|
+
const seller = await (0, framework_1.fetchSellerByAuthActorId)(req.auth_context?.actor_id, req.scope);
|
|
124
130
|
const { result } = await workflows_1.createVendorCampaignWorkflow.run({
|
|
125
131
|
container: req.scope,
|
|
126
132
|
input: { campaign: req.validatedBody, seller_id: seller.id },
|
|
@@ -135,4 +141,4 @@ const POST = async (req, res) => {
|
|
|
135
141
|
res.status(201).json({ campaign });
|
|
136
142
|
};
|
|
137
143
|
exports.POST = POST;
|
|
138
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
144
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvYXBpL3ZlbmRvci9jYW1wYWlnbnMvcm91dGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBSUEscURBQWdGO0FBQ2hGLG1EQUErRDtBQUMvRCxzRUFBc0Y7QUFFdEYscUZBQTREO0FBRTVEOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0F5REc7QUFDSSxNQUFNLEdBQUcsR0FBRyxLQUFLLEVBQ3RCLEdBQStCLEVBQy9CLEdBQW1CLEVBQ25CLEVBQUU7SUFDRixNQUFNLEtBQUssR0FBRyxHQUFHLENBQUMsS0FBSyxDQUFDLE9BQU8sQ0FBQyxpQ0FBeUIsQ0FBQyxLQUFLLENBQUMsQ0FBQztJQUVqRSxNQUFNLEVBQUUsSUFBSSxFQUFFLFNBQVMsRUFBRSxRQUFRLEVBQUUsR0FBRyxNQUFNLEtBQUssQ0FBQyxLQUFLLENBQUM7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