@porulle/plugin-marketplace 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -81,7 +81,7 @@ export function marketplacePlugin(options = {}) {
81
81
  if (!services)
82
82
  return [];
83
83
  return [
84
- ...buildVendorRoutes(services, options),
84
+ ...buildVendorRoutes(services, options, ctx.config),
85
85
  ...buildVendorPortalRoutes(services),
86
86
  ...buildSubOrderRoutes(services),
87
87
  ...buildCommissionRoutes(services),
@@ -1,3 +1,4 @@
1
+ import type { CommerceConfig } from "@porulle/core";
1
2
  import type { PluginRouteRegistration } from "@porulle/core";
2
3
  import type { VendorService } from "../services/vendor.js";
3
4
  import type { PayoutService } from "../services/payout.js";
@@ -7,5 +8,5 @@ export declare function buildVendorRoutes(services: {
7
8
  vendor: VendorService;
8
9
  payout: PayoutService;
9
10
  review: ReviewService;
10
- }, options?: MarketplacePluginOptions): PluginRouteRegistration[];
11
+ }, options: MarketplacePluginOptions | undefined, config: CommerceConfig): PluginRouteRegistration[];
11
12
  //# sourceMappingURL=vendors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vendors.d.ts","sourceRoot":"","sources":["../../src/routes/vendors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAU5D,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE;IAC1C,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,aAAa,CAAC;CACvB,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,uBAAuB,EAAE,CAoLhE"}
1
+ {"version":3,"file":"vendors.d.ts","sourceRoot":"","sources":["../../src/routes/vendors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAU5D,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE;IAC1C,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,aAAa,CAAC;CACvB,EAAE,OAAO,EAAE,wBAAwB,GAAG,SAAS,EAAE,MAAM,EAAE,cAAc,GAAG,uBAAuB,EAAE,CAoLnG"}
@@ -1,7 +1,7 @@
1
- import { router, resolveOrgId } from "@porulle/core";
1
+ import { router, resolveOrgIdForCommerce } from "@porulle/core";
2
2
  import { CreateVendorBodySchema, UpdateVendorBodySchema, RejectVendorBodySchema, SuspendVendorBodySchema, UploadDocumentBodySchema, } from "../schemas/vendors.js";
3
3
  import { stripUndefined, stripVendorSecrets } from "./util.js";
4
- export function buildVendorRoutes(services, options) {
4
+ export function buildVendorRoutes(services, options, config) {
5
5
  const r = router("Marketplace - Vendors", "/marketplace/vendors");
6
6
  // ─── List vendors ──────────────────────────────────────────────────────────
7
7
  r.get("/")
@@ -23,7 +23,7 @@ export function buildVendorRoutes(services, options) {
23
23
  .handler(async ({ input, actor }) => {
24
24
  const body = input;
25
25
  const defaultBps = options?.defaultCommissionRateBps ?? 1000;
26
- return services.vendor.create(resolveOrgId(actor), stripUndefined({
26
+ return services.vendor.create(resolveOrgIdForCommerce(actor, config), stripUndefined({
27
27
  ...body,
28
28
  commissionRateBps: body.commissionRateBps ?? defaultBps,
29
29
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@porulle/plugin-marketplace",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "@hono/zod-openapi": "^1.2.2",
22
22
  "hono": "^4.12.5",
23
- "@porulle/core": "0.11.0"
23
+ "@porulle/core": "0.13.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^24.5.2",
package/src/index.ts CHANGED
@@ -99,7 +99,7 @@ export function marketplacePlugin(options: MarketplacePluginOptions = {}) {
99
99
  if (!services) return [];
100
100
 
101
101
  return [
102
- ...buildVendorRoutes(services, options),
102
+ ...buildVendorRoutes(services, options, ctx.config),
103
103
  ...buildVendorPortalRoutes(services),
104
104
  ...buildSubOrderRoutes(services),
105
105
  ...buildCommissionRoutes(services),
@@ -1,4 +1,5 @@
1
- import { router, resolveOrgId } from "@porulle/core";
1
+ import { router, resolveOrgIdForCommerce } from "@porulle/core";
2
+ import type { CommerceConfig } from "@porulle/core";
2
3
  import type { PluginRouteRegistration } from "@porulle/core";
3
4
  import type { z } from "@hono/zod-openapi";
4
5
  import type { VendorService } from "../services/vendor.js";
@@ -18,7 +19,7 @@ export function buildVendorRoutes(services: {
18
19
  vendor: VendorService;
19
20
  payout: PayoutService;
20
21
  review: ReviewService;
21
- }, options?: MarketplacePluginOptions): PluginRouteRegistration[] {
22
+ }, options: MarketplacePluginOptions | undefined, config: CommerceConfig): PluginRouteRegistration[] {
22
23
  const r = router("Marketplace - Vendors", "/marketplace/vendors");
23
24
 
24
25
  // ─── List vendors ──────────────────────────────────────────────────────────
@@ -42,7 +43,7 @@ export function buildVendorRoutes(services: {
42
43
  .handler(async ({ input, actor }) => {
43
44
  const body = input as z.infer<typeof CreateVendorBodySchema>;
44
45
  const defaultBps = options?.defaultCommissionRateBps ?? 1000;
45
- return services.vendor.create(resolveOrgId(actor), stripUndefined({
46
+ return services.vendor.create(resolveOrgIdForCommerce(actor, config), stripUndefined({
46
47
  ...body,
47
48
  commissionRateBps: body.commissionRateBps ?? defaultBps,
48
49
  }));