@portablecore/commerce 0.1.1 → 0.2.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/connect.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Stripe Connect Onboarding
3
3
  *
4
- * Shared infrastructure for onboarding marketplace creators across all
4
+ * Shared infrastructure for onboarding marketplace partners across all
5
5
  * Portable platforms. Each platform (Expert, Team, Theater, Coach) uses
6
6
  * these same helpers to create Connect Express accounts, generate
7
7
  * onboarding links, and check account status.
@@ -11,9 +11,9 @@
11
11
  import type Stripe from "stripe";
12
12
  import type { ConnectAccountStatus, MarketplacePlatform } from "@portablecore/types";
13
13
  export interface CreateConnectAccountParams {
14
- /** Creator's email */
15
- email: string;
16
- /** Connect account type — Express is recommended for marketplace creators */
14
+ /** Partner's email */
15
+ email?: string;
16
+ /** Connect account type — Express is recommended for marketplace partners */
17
17
  account_type?: "express" | "standard";
18
18
  /** Business type */
19
19
  business_type?: "individual" | "company";
@@ -21,8 +21,8 @@ export interface CreateConnectAccountParams {
21
21
  country?: string;
22
22
  /** Which platform marketplace */
23
23
  platform: MarketplacePlatform;
24
- /** Platform-specific creator ID */
25
- creator_id: string;
24
+ /** Platform-specific partner ID */
25
+ partner_id: string;
26
26
  /** Additional metadata */
27
27
  metadata?: Record<string, string>;
28
28
  }
@@ -37,12 +37,12 @@ export interface CreateOnboardingLinkParams {
37
37
  type?: "account_onboarding" | "account_update";
38
38
  }
39
39
  /**
40
- * Create a Stripe Connect Express account for a marketplace creator.
41
- * Returns the Stripe account ID, which should be stored on the creator record.
40
+ * Create a Stripe Connect Express account for a marketplace partner.
41
+ * Returns the Stripe account, whose ID should be stored on the partner record.
42
42
  */
43
43
  export declare function createConnectAccount(stripe: Stripe, params: CreateConnectAccountParams): Promise<Stripe.Account>;
44
44
  /**
45
- * Create an account onboarding link. Redirect the creator to this URL
45
+ * Create an account onboarding link. Redirect the partner to this URL
46
46
  * to complete their Stripe Connect setup.
47
47
  */
48
48
  export declare function createOnboardingLink(stripe: Stripe, params: CreateOnboardingLinkParams): Promise<Stripe.AccountLink>;
@@ -53,8 +53,8 @@ export declare function createOnboardingLink(stripe: Stripe, params: CreateOnboa
53
53
  export declare function getConnectAccountStatus(stripe: Stripe, accountId: string): Promise<ConnectAccountStatus>;
54
54
  /**
55
55
  * Generate a login link for a Connect Express account.
56
- * Lets creators access their Stripe Express Dashboard to manage
56
+ * Lets partners access their Stripe Express Dashboard to manage
57
57
  * payouts, bank accounts, and tax information.
58
58
  */
59
- export declare function createDashboardLoginLink(stripe: Stripe, accountId: string): Promise<string>;
59
+ export declare function createDashboardLoginLink(stripe: Stripe, accountId: string): Promise<Stripe.LoginLink>;
60
60
  //# sourceMappingURL=connect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,qBAAqB,CAAA;AAM5B,MAAM,WAAW,0BAA0B;IACzC,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,6EAA6E;IAC7E,YAAY,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;IACrC,oBAAoB;IACpB,aAAa,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;IACxC,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iCAAiC;IACjC,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAA;IAClB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAClC;AAED,MAAM,WAAW,0BAA0B;IACzC,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAA;IAClB,6DAA6D;IAC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1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAClC;AAED,MAAM,WAAW,0BAA0B;IACzC,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAA;IAClB,6DAA6D;IAC7D,WAAW,EAAE,MAAM,CAAA;IACnB,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB;IAChB,IAAI,CAAC,EAAE,oBAAoB,GAAG,gBAAgB,CAAA;CAC/C;AAMD;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,0BAA0B,GACjC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CA0BzB;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,0BAA0B,GACjC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAU7B;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,oBAAoB,CAAC,CAY/B;AAED;;;;GAIG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAE3B"}
package/dist/connect.js CHANGED
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * Stripe Connect Onboarding
4
4
  *
5
- * Shared infrastructure for onboarding marketplace creators across all
5
+ * Shared infrastructure for onboarding marketplace partners across all
6
6
  * Portable platforms. Each platform (Expert, Team, Theater, Coach) uses
7
7
  * these same helpers to create Connect Express accounts, generate
8
8
  * onboarding links, and check account status.
@@ -18,11 +18,11 @@ exports.createDashboardLoginLink = createDashboardLoginLink;
18
18
  // Connect account management
19
19
  // ---------------------------------------------------------------------------
20
20
  /**
21
- * Create a Stripe Connect Express account for a marketplace creator.
22
- * Returns the Stripe account ID, which should be stored on the creator record.
21
+ * Create a Stripe Connect Express account for a marketplace partner.
22
+ * Returns the Stripe account, whose ID should be stored on the partner record.
23
23
  */
24
24
  async function createConnectAccount(stripe, params) {
25
- const { email, account_type = "express", business_type = "individual", country = "US", platform, creator_id, metadata = {}, } = params;
25
+ const { email, account_type = "express", business_type = "individual", country = "US", platform, partner_id, metadata = {}, } = params;
26
26
  return stripe.accounts.create({
27
27
  type: account_type,
28
28
  country,
@@ -34,13 +34,13 @@ async function createConnectAccount(stripe, params) {
34
34
  },
35
35
  metadata: {
36
36
  portable_platform: platform,
37
- portable_creator_id: creator_id,
37
+ portable_partner_id: partner_id,
38
38
  ...metadata,
39
39
  },
40
40
  });
41
41
  }
42
42
  /**
43
- * Create an account onboarding link. Redirect the creator to this URL
43
+ * Create an account onboarding link. Redirect the partner to this URL
44
44
  * to complete their Stripe Connect setup.
45
45
  */
46
46
  async function createOnboardingLink(stripe, params) {
@@ -63,20 +63,17 @@ async function getConnectAccountStatus(stripe, accountId) {
63
63
  details_submitted: account.details_submitted || false,
64
64
  charges_enabled: account.charges_enabled || false,
65
65
  payouts_enabled: account.payouts_enabled || false,
66
- requirements: {
67
- currently_due: account.requirements?.currently_due || [],
68
- eventually_due: account.requirements?.eventually_due || [],
69
- past_due: account.requirements?.past_due || [],
70
- },
66
+ currently_due: account.requirements?.currently_due || [],
67
+ eventually_due: account.requirements?.eventually_due || [],
68
+ past_due: account.requirements?.past_due || [],
71
69
  };
72
70
  }
73
71
  /**
74
72
  * Generate a login link for a Connect Express account.
75
- * Lets creators access their Stripe Express Dashboard to manage
73
+ * Lets partners access their Stripe Express Dashboard to manage
76
74
  * payouts, bank accounts, and tax information.
77
75
  */
78
76
  async function createDashboardLoginLink(stripe, accountId) {
79
- const loginLink = await stripe.accounts.createLoginLink(accountId);
80
- return loginLink.url;
77
+ return stripe.accounts.createLoginLink(accountId);
81
78
  }
82
79
  //# sourceMappingURL=connect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"connect.js","sourceRo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QAAQ,EAAE;YACR,iBAAiB,EAAE,QAAQ;YAC3B,mBAAmB,EAAE,UAAU;YAC/B,GAAG,QAAQ;SACZ;KACF,CAAC,CAAA;AACJ,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,oBAAoB,CACxC,MAAc,EACd,MAAkC;IAElC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,GAAG,oBAAoB,EAAE,GACxE,MAAM,CAAA;IAER,OAAO,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC;QAChC,OAAO,EAAE,UAAU;QACnB,WAAW;QACX,UAAU;QACV,IAAI;KACL,CAAC,CAAA;AACJ,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,uBAAuB,CAC3C,MAAc,EACd,SAAiB;IAEjB,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;IAEzD,OAAO;QACL,UAAU,EAAE,SAAS;QACrB,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,IAAI,KAAK;QACrD,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,KAAK;QACjD,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,KAAK;QACjD,aAAa,EAAE,OAAO,CAAC,YAAY,EAAE,aAAa,IAAI,EAAE;QACxD,cAAc,EAAE,OAAO,CAAC,YAAY,EAAE,cAAc,IAAI,EAAE;QAC1D,QAAQ,EAAE,OAAO,CAAC,YAAY,EAAE,QAAQ,IAAI,EAAE;KAC/C,CAAA;AACH,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,wBAAwB,CAC5C,MAAc,EACd,SAAiB;IAEjB,OAAO,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,SAAS,CAAC,CAAA;AACnD,CAAC"}
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  */
14
14
  export { createConnectAccount, createOnboardingLink, getConnectAccountStatus, createDashboardLoginLink, } from "./connect.js";
15
15
  export type { CreateConnectAccountParams, CreateOnboardingLinkParams, } from "./connect.js";
16
- export { calculateRevenueSplit, calculateApplicationFee, validateRevenueSplit, formatCents, DEFAULT_REVENUE_CONFIG, } from "./revenue.js";
16
+ export { calculateRevenueSplit, calculateApplicationFee, validateRevenueSplit, formatCents, DEFAULT_REVENUE_CONFIG, PRODUCT_FEE_DEFAULTS, getProductFeePercent, getProductRevenueSplitConfig, } from "./revenue.js";
17
17
  export { createDestinationCharge, createConnectCheckoutSession, createTransfer, getTransfer, } from "./payout.js";
18
18
  export type { DestinationChargeParams, TransferParams, CheckoutWithConnectParams, } from "./payout.js";
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,cAAc,CAAA;AACrB,YAAY,EACV,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,cAAc,CAAA;AAGrB,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,WAAW,EACX,sBAAsB,GACvB,MAAM,cAAc,CAAA;AAGrB,OAAO,EACL,uBAAuB,EACvB,4BAA4B,EAC5B,cAAc,EACd,WAAW,GACZ,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,uBAAuB,EACvB,cAAc,EACd,yBAAyB,GAC1B,MAAM,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,cAAc,CAAA;AACrB,YAAY,EACV,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,cAAc,CAAA;AAGrB,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,cAAc,CAAA;AAGrB,OAAO,EACL,uBAAuB,EACvB,4BAA4B,EAC5B,cAAc,EACd,WAAW,GACZ,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,uBAAuB,EACvB,cAAc,EACd,yBAAyB,GAC1B,MAAM,aAAa,CAAA"}
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@
13
13
  * "One engine, many marketplaces."
14
14
  */
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.getTransfer = exports.createTransfer = exports.createConnectCheckoutSession = exports.createDestinationCharge = exports.DEFAULT_REVENUE_CONFIG = exports.formatCents = exports.validateRevenueSplit = exports.calculateApplicationFee = exports.calculateRevenueSplit = exports.createDashboardLoginLink = exports.getConnectAccountStatus = exports.createOnboardingLink = exports.createConnectAccount = void 0;
16
+ exports.getTransfer = exports.createTransfer = exports.createConnectCheckoutSession = exports.createDestinationCharge = exports.getProductRevenueSplitConfig = exports.getProductFeePercent = exports.PRODUCT_FEE_DEFAULTS = exports.DEFAULT_REVENUE_CONFIG = exports.formatCents = exports.validateRevenueSplit = exports.calculateApplicationFee = exports.calculateRevenueSplit = exports.createDashboardLoginLink = exports.getConnectAccountStatus = exports.createOnboardingLink = exports.createConnectAccount = void 0;
17
17
  // Stripe Connect onboarding
18
18
  var connect_js_1 = require("./connect.js");
19
19
  Object.defineProperty(exports, "createConnectAccount", { enumerable: true, get: function () { return connect_js_1.createConnectAccount; } });
@@ -27,6 +27,9 @@ Object.defineProperty(exports, "calculateApplicationFee", { enumerable: true, ge
27
27
  Object.defineProperty(exports, "validateRevenueSplit", { enumerable: true, get: function () { return revenue_js_1.validateRevenueSplit; } });
28
28
  Object.defineProperty(exports, "formatCents", { enumerable: true, get: function () { return revenue_js_1.formatCents; } });
29
29
  Object.defineProperty(exports, "DEFAULT_REVENUE_CONFIG", { enumerable: true, get: function () { return revenue_js_1.DEFAULT_REVENUE_CONFIG; } });
30
+ Object.defineProperty(exports, "PRODUCT_FEE_DEFAULTS", { enumerable: true, get: function () { return revenue_js_1.PRODUCT_FEE_DEFAULTS; } });
31
+ Object.defineProperty(exports, "getProductFeePercent", { enumerable: true, get: function () { return revenue_js_1.getProductFeePercent; } });
32
+ Object.defineProperty(exports, "getProductRevenueSplitConfig", { enumerable: true, get: function () { return revenue_js_1.getProductRevenueSplitConfig; } });
30
33
  // Payout execution
31
34
  var payout_js_1 = require("./payout.js");
32
35
  Object.defineProperty(exports, "createDestinationCharge", { enumerable: true, get: function () { return payout_js_1.createDestinationCharge; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAEH,4BAA4B;AAC5B,2CAKqB;AAJnB,kHAAA,oBAAoB,OAAA;AACpB,kHAAA,oBAAoB,OAAA;AACpB,qHAAA,uBAAuB,OAAA;AACvB,sHAAA,wBAAwB,OAAA;AAO1B,4BAA4B;AAC5B,2CAMqB;AALnB,mHAAA,qBAAqB,OAAA;AACrB,qHAAA,uBAAuB,OAAA;AACvB,kHAAA,oBAAoB,OAAA;AACpB,yGAAA,WAAW,OAAA;AACX,oHAAA,sBAAsB,OAAA;AAGxB,mBAAmB;AACnB,yCAKoB;AAJlB,oHAAA,uBAAuB,OAAA;AACvB,yHAAA,4BAA4B,OAAA;AAC5B,2GAAA,cAAc,OAAA;AACd,wGAAA,WAAW,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAEH,4BAA4B;AAC5B,2CAKqB;AAJnB,kHAAA,oBAAoB,OAAA;AACpB,kHAAA,oBAAoB,OAAA;AACpB,qHAAA,uBAAuB,OAAA;AACvB,sHAAA,wBAAwB,OAAA;AAO1B,4BAA4B;AAC5B,2CASqB;AARnB,mHAAA,qBAAqB,OAAA;AACrB,qHAAA,uBAAuB,OAAA;AACvB,kHAAA,oBAAoB,OAAA;AACpB,yGAAA,WAAW,OAAA;AACX,oHAAA,sBAAsB,OAAA;AACtB,kHAAA,oBAAoB,OAAA;AACpB,kHAAA,oBAAoB,OAAA;AACpB,0HAAA,4BAA4B,OAAA;AAG9B,mBAAmB;AACnB,yCAKoB;AAJlB,oHAAA,uBAAuB,OAAA;AACvB,yHAAA,4BAA4B,OAAA;AAC5B,2GAAA,cAAc,OAAA;AACd,wGAAA,WAAW,OAAA"}
package/dist/payout.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Payout Execution
3
3
  *
4
- * Handles the actual movement of money from Portable to creators
5
- * via Stripe Connect. Supports both immediate (per-transaction)
6
- * and batched (periodic) payouts.
4
+ * Handles the actual movement of money from Portable to partners
5
+ * via Stripe Connect. Uses immediate destination charges by default
6
+ * (partner gets paid per-transaction, no batching needed).
7
7
  */
8
8
  import type Stripe from "stripe";
9
9
  import type { MarketplacePlatform } from "@portablecore/types";
@@ -14,7 +14,7 @@ export interface DestinationChargeParams {
14
14
  currency?: string;
15
15
  /** Stripe customer ID (the buyer) */
16
16
  customer_id: string;
17
- /** Creator's Stripe Connect account ID (receives the payout) */
17
+ /** Partner's Stripe Connect account ID (receives the payout) */
18
18
  destination_account_id: string;
19
19
  /** Platform fee percentage (defaults to 20%) */
20
20
  platform_fee_percent?: number;
@@ -32,9 +32,9 @@ export interface TransferParams {
32
32
  amount_cents: number;
33
33
  /** Currency */
34
34
  currency?: string;
35
- /** Creator's Stripe Connect account ID */
35
+ /** Partner's Stripe Connect account ID */
36
36
  destination_account_id: string;
37
- /** Description visible to the creator */
37
+ /** Description visible to the partner */
38
38
  description?: string;
39
39
  /** Which platform marketplace */
40
40
  platform: MarketplacePlatform;
@@ -44,32 +44,28 @@ export interface TransferParams {
44
44
  metadata?: Record<string, string>;
45
45
  }
46
46
  export interface CheckoutWithConnectParams {
47
- /** Stripe customer ID (the buyer) */
48
- customer_id: string;
49
- /** Stripe Price ID for the product */
50
- price_id: string;
47
+ /** Partner's Stripe Connect account ID */
48
+ connected_account_id: string;
49
+ /** Line items for the checkout session */
50
+ line_items: Stripe.Checkout.SessionCreateParams.LineItem[];
51
51
  /** Checkout mode */
52
52
  mode: "payment" | "subscription";
53
- /** Creator's Stripe Connect account ID */
54
- destination_account_id: string;
55
- /** Platform fee percentage */
56
- platform_fee_percent?: number;
53
+ /** Application fee amount in cents (for payment mode) */
54
+ application_fee_amount?: number;
55
+ /** Application fee percent (for subscription mode) */
56
+ application_fee_percent?: number;
57
57
  /** Success redirect URL */
58
58
  success_url: string;
59
59
  /** Cancel redirect URL */
60
60
  cancel_url: string;
61
- /** Which platform marketplace */
62
- platform: MarketplacePlatform;
63
- /** Platform-specific product ID */
64
- product_id: string;
65
61
  /** Additional metadata */
66
62
  metadata?: Record<string, string>;
67
63
  }
68
64
  /**
69
65
  * Create a destination charge — the buyer pays, Portable takes the
70
- * application fee, and the rest goes to the creator's Connect account.
66
+ * application fee, and the rest goes to the partner's Connect account.
71
67
  *
72
- * This is the recommended approach for immediate per-transaction payouts.
68
+ * This is the default approach: immediate per-transaction payouts.
73
69
  */
74
70
  export declare function createDestinationCharge(stripe: Stripe, params: DestinationChargeParams): Promise<Stripe.PaymentIntent>;
75
71
  /**
@@ -78,9 +74,9 @@ export declare function createDestinationCharge(stripe: Stripe, params: Destinat
78
74
  */
79
75
  export declare function createConnectCheckoutSession(stripe: Stripe, params: CheckoutWithConnectParams): Promise<Stripe.Checkout.Session>;
80
76
  /**
81
- * Create a manual transfer to a creator's Connect account.
82
- * Used for batched payouts (e.g., monthly IAP revenue distribution)
83
- * where we don't use destination charges.
77
+ * Create a manual transfer to a partner's Connect account.
78
+ * Used when destination charges aren't possible (e.g., IAP revenue
79
+ * where Portable receives the money and needs to forward it).
84
80
  */
85
81
  export declare function createTransfer(stripe: Stripe, params: TransferParams): Promise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3B,WAAW,EAAE,MAAM,CAAA;IACnB,0BAA0B;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAClC;AAMD;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAoC/B;AAED;;;GAGG;AACH,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAuClC;AAMD;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAsB1B;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAE1B"}
package/dist/payout.js CHANGED
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * Payout Execution
4
4
  *
5
- * Handles the actual movement of money from Portable to creators
6
- * via Stripe Connect. Supports both immediate (per-transaction)
7
- * and batched (periodic) payouts.
5
+ * Handles the actual movement of money from Portable to partners
6
+ * via Stripe Connect. Uses immediate destination charges by default
7
+ * (partner gets paid per-transaction, no batching needed).
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.createDestinationCharge = createDestinationCharge;
@@ -17,9 +17,9 @@ const revenue_js_1 = require("./revenue.js");
17
17
  // ---------------------------------------------------------------------------
18
18
  /**
19
19
  * Create a destination charge — the buyer pays, Portable takes the
20
- * application fee, and the rest goes to the creator's Connect account.
20
+ * application fee, and the rest goes to the partner's Connect account.
21
21
  *
22
- * This is the recommended approach for immediate per-transaction payouts.
22
+ * This is the default approach: immediate per-transaction payouts.
23
23
  */
24
24
  async function createDestinationCharge(stripe, params) {
25
25
  const { amount_cents, currency = "usd", customer_id, destination_account_id, platform_fee_percent = revenue_js_1.DEFAULT_REVENUE_CONFIG.platform_fee_percent, platform, product_id, product_name, metadata = {}, } = params;
@@ -48,44 +48,39 @@ async function createDestinationCharge(stripe, params) {
48
48
  * For marketplace purchases that go through Stripe Checkout.
49
49
  */
50
50
  async function createConnectCheckoutSession(stripe, params) {
51
- const { customer_id, price_id, mode, destination_account_id, platform_fee_percent = revenue_js_1.DEFAULT_REVENUE_CONFIG.platform_fee_percent, success_url, cancel_url, platform, product_id, metadata = {}, } = params;
51
+ const { connected_account_id, line_items, mode, application_fee_amount, application_fee_percent, success_url, cancel_url, metadata = {}, } = params;
52
52
  const sessionParams = {
53
- customer: customer_id,
54
53
  mode,
55
- line_items: [{ price: price_id, quantity: 1 }],
54
+ line_items,
56
55
  success_url,
57
56
  cancel_url,
58
57
  payment_intent_data: mode === "payment"
59
58
  ? {
60
- application_fee_amount: undefined, // calculated by Stripe from transfer
59
+ application_fee_amount,
61
60
  transfer_data: {
62
- destination: destination_account_id,
61
+ destination: connected_account_id,
63
62
  },
64
63
  }
65
64
  : undefined,
66
65
  subscription_data: mode === "subscription"
67
66
  ? {
68
- application_fee_percent: platform_fee_percent,
67
+ application_fee_percent,
69
68
  transfer_data: {
70
- destination: destination_account_id,
69
+ destination: connected_account_id,
71
70
  },
72
71
  }
73
72
  : undefined,
74
- metadata: {
75
- portable_platform: platform,
76
- portable_product_id: product_id,
77
- ...metadata,
78
- },
73
+ metadata,
79
74
  };
80
75
  return stripe.checkout.sessions.create(sessionParams);
81
76
  }
82
77
  // ---------------------------------------------------------------------------
83
- // Manual transfers (for batched payouts)
78
+ // Manual transfers (for batched payouts, e.g., IAP revenue distribution)
84
79
  // ---------------------------------------------------------------------------
85
80
  /**
86
- * Create a manual transfer to a creator's Connect account.
87
- * Used for batched payouts (e.g., monthly IAP revenue distribution)
88
- * where we don't use destination charges.
81
+ * Create a manual transfer to a partner's Connect account.
82
+ * Used when destination charges aren't possible (e.g., IAP revenue
83
+ * where Portable receives the money and needs to forward it).
89
84
  */
90
85
  async function createTransfer(stripe, params) {
91
86
  const { amount_cents, currency = "usd", destination_account_id, description, platform, sale_ids = [], metadata = {}, } = params;
@@ -1 +1 @@
1
- {"version":3,"file":"payout.js","sourceRoot":"","sources":["../src/payout.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAiFH,0DAuCC;AAMD,oEAiDC;AAWD,wCAyBC;AAKD,kCAKC;AAzND,6CAA8E;AAmE9E,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E;;;;;GAKG;AACI,KAAK,UAAU,uBAAuB,CAC3C,MAAc,EACd,MAA+B;IAE/B,MAAM,EACJ,YAAY,EACZ,QAAQ,GAAG,KAAK,EAChB,WAAW,EACX,sBAAsB,EACtB,oBAAoB,GAAG,mCAAsB,CAAC,oBAAoB,EAClE,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,QAAQ,GAAG,EAAE,GACd,GAAG,MAAM,CAAA;IAEV,MAAM,cAAc,GAAG,IAAA,oCAAuB,EAC5C,YAAY,EACZ,oBAAoB,CACrB,CAAA;IAED,OAAO,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC;QAClC,MAAM,EAAE,YAAY;QACpB,QAAQ;QACR,QAAQ,EAAE,WAAW;QACrB,sBAAsB,EAAE,cAAc;QACtC,aAAa,EAAE;YACb,WAAW,EAAE,sBAAsB;SACpC;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,QAAQ;YAC3B,mBAAmB,EAAE,UAAU;YAC/B,qBAAqB,EAAE,YAAY,IAAI,EAAE;YACzC,GAAG,QAAQ;SACZ;QACD,yBAAyB,EAAE;YACzB,OAAO,EAAE,IAAI;SACd;KACF,CAAC,CAAA;AACJ,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,4BAA4B,CAChD,M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AW,EAAE,WAAW,IAAI,YAAY,QAAQ,SAAS;QACzD,QAAQ,EAAE;YACR,iBAAiB,EAAE,QAAQ;YAC3B,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;YAC5B,GAAG,QAAQ;SACZ;KACF,CAAC,CAAA;AACJ,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,WAAW,CAC/B,MAAc,EACd,UAAkB;IAElB,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;AAC9C,CAAC"}
package/dist/revenue.d.ts CHANGED
@@ -2,21 +2,43 @@
2
2
  * Revenue Split Engine
3
3
  *
4
4
  * Calculates how marketplace revenue is divided between the platform
5
- * (Portable) and the creator. Supports different revenue sources
6
- * (Stripe, Apple IAP, Google IAP) with appropriate fee adjustments.
5
+ * (Portable) and the partner. Supports different revenue sources
6
+ * (Stripe, Apple IAP, Google IAP) and per-product-type fee schedules.
7
7
  *
8
- * Default split: 80% creator / 20% platform (more generous than
9
- * app stores' 70/30, acknowledging that creators provide the
10
- * differentiated value).
8
+ * Fee schedule (per product type, with per-partner overrides):
9
+ * Expert skills: 20%
10
+ * Team modules: 20%
11
+ * Coach consultations: 20%
12
+ * Theater content: 30% on Stripe, platform absorbs Apple's 15% IAP fee
11
13
  */
12
- import type { RevenueSplitConfig, RevenueSplitResult, RevenueSource } from "@portablecore/types";
13
- /** Default revenue split configuration */
14
+ import type { RevenueSplitConfig, RevenueSplitResult, RevenueSource, ProductFeeKey } from "@portablecore/types";
15
+ /** Default platform fee by platform:product_type */
16
+ export declare const PRODUCT_FEE_DEFAULTS: Record<ProductFeeKey, number>;
17
+ /**
18
+ * Resolve the platform fee for a given product type.
19
+ * Per-partner overrides take precedence over product defaults.
20
+ */
21
+ export declare function getProductFeePercent(platform: string, productType: string, partnerOverridePercent?: number | null): number;
22
+ /**
23
+ * Build a full RevenueSplitConfig from a product fee lookup.
24
+ */
25
+ export declare function getProductRevenueSplitConfig(platform: string, productType: string, partnerOverridePercent?: number | null): RevenueSplitConfig;
26
+ /** Default revenue split configuration (generic 20/80) */
14
27
  export declare const DEFAULT_REVENUE_CONFIG: RevenueSplitConfig;
15
28
  /**
16
29
  * Calculate the revenue split for a marketplace transaction.
17
30
  *
18
- * For Stripe purchases: Portable takes platform_fee_percent, creator gets the rest.
19
- * For IAP purchases: Store takes their cut first, then Portable and creator split the remainder.
31
+ * For Stripe purchases:
32
+ * Portable takes platform_fee_percent, partner gets the rest.
33
+ *
34
+ * For IAP purchases (platform absorbs Apple/Google fee):
35
+ * Partner always gets their full share of the gross.
36
+ * Platform absorbs the store fee — its effective take is reduced.
37
+ *
38
+ * Example (Theater, $10, Apple Small Business 15%):
39
+ * Partner share: 70% of $10 = $7.00
40
+ * Apple takes: 15% of $10 = $1.50
41
+ * Platform gets: $10 - $7.00 - $1.50 = $1.50 (effectively 15%)
20
42
  */
21
43
  export declare function calculateRevenueSplit(totalCents: number, config?: Partial<RevenueSplitConfig>, revenueSource?: RevenueSource, options?: {
22
44
  apple_small_business?: boolean;
@@ -24,8 +46,10 @@ export declare function calculateRevenueSplit(totalCents: number, config?: Parti
24
46
  /**
25
47
  * Calculate the Stripe application fee amount for a Connect destination charge.
26
48
  * This is what Stripe deducts from the payment and sends to the platform.
49
+ *
50
+ * Accepts either a full config or a plain percentage number.
27
51
  */
28
- export declare function calculateApplicationFee(totalCents: number, platformFeePercent?: number): number;
52
+ export declare function calculateApplicationFee(totalCents: number, configOrPercent?: Partial<RevenueSplitConfig> | number): number;
29
53
  /**
30
54
  * Validate that a revenue split adds up correctly.
31
55
  */
@@ -1 +1 @@
1
- {"version":3,"file":"revenue.d.ts","sourceRoot":"","sources":["../src/revenue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACd,MAAM,qBAAqB,CAAA;AAM5B,0CAA0C;AAC1C,eAAO,MAAM,sBAAsB,EAAE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,OAAO,CAAC,kBAAkB,CAAM,EACxC,aAAa,GAAE,aAAwB,EACvC,OAAO,CAAC,EAAE;IAAE,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAAE,GAC3C,kBAAkB,CAyDpB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,EAClB,eAAe,GACX,OAAO,CAAC,kBAAkB,CAAC,GAC3B,MAAoD,GACvD,MAAM,CAOR;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CASxE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD"}
package/dist/revenue.js CHANGED
@@ -3,35 +3,69 @@
3
3
  * Revenue Split Engine
4
4
  *
5
5
  * Calculates how marketplace revenue is divided between the platform
6
- * (Portable) and the creator. Supports different revenue sources
7
- * (Stripe, Apple IAP, Google IAP) with appropriate fee adjustments.
6
+ * (Portable) and the partner. Supports different revenue sources
7
+ * (Stripe, Apple IAP, Google IAP) and per-product-type fee schedules.
8
8
  *
9
- * Default split: 80% creator / 20% platform (more generous than
10
- * app stores' 70/30, acknowledging that creators provide the
11
- * differentiated value).
9
+ * Fee schedule (per product type, with per-partner overrides):
10
+ * Expert skills: 20%
11
+ * Team modules: 20%
12
+ * Coach consultations: 20%
13
+ * Theater content: 30% on Stripe, platform absorbs Apple's 15% IAP fee
12
14
  */
13
15
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.DEFAULT_REVENUE_CONFIG = void 0;
16
+ exports.DEFAULT_REVENUE_CONFIG = exports.PRODUCT_FEE_DEFAULTS = void 0;
17
+ exports.getProductFeePercent = getProductFeePercent;
18
+ exports.getProductRevenueSplitConfig = getProductRevenueSplitConfig;
15
19
  exports.calculateRevenueSplit = calculateRevenueSplit;
16
20
  exports.calculateApplicationFee = calculateApplicationFee;
17
21
  exports.validateRevenueSplit = validateRevenueSplit;
18
22
  exports.formatCents = formatCents;
19
23
  // ---------------------------------------------------------------------------
20
- // Defaults
24
+ // Per-product fee defaults
21
25
  // ---------------------------------------------------------------------------
22
- /** Default revenue split configuration */
26
+ /** Default platform fee by platform:product_type */
27
+ exports.PRODUCT_FEE_DEFAULTS = {
28
+ "expert:skill": 20,
29
+ "expert:consultation": 20,
30
+ "studio:module": 20,
31
+ "theater:content": 30,
32
+ };
33
+ /**
34
+ * Resolve the platform fee for a given product type.
35
+ * Per-partner overrides take precedence over product defaults.
36
+ */
37
+ function getProductFeePercent(platform, productType, partnerOverridePercent) {
38
+ if (partnerOverridePercent != null)
39
+ return partnerOverridePercent;
40
+ const key = `${platform}:${productType}`;
41
+ return exports.PRODUCT_FEE_DEFAULTS[key] ?? 20; // fallback to 20%
42
+ }
43
+ /**
44
+ * Build a full RevenueSplitConfig from a product fee lookup.
45
+ */
46
+ function getProductRevenueSplitConfig(platform, productType, partnerOverridePercent) {
47
+ const fee = getProductFeePercent(platform, productType, partnerOverridePercent);
48
+ return {
49
+ platform_fee_percent: fee,
50
+ partner_share_percent: 100 - fee,
51
+ payout_schedule: "immediate",
52
+ };
53
+ }
54
+ // ---------------------------------------------------------------------------
55
+ // Defaults (backward-compatible)
56
+ // ---------------------------------------------------------------------------
57
+ /** Default revenue split configuration (generic 20/80) */
23
58
  exports.DEFAULT_REVENUE_CONFIG = {
24
59
  platform_fee_percent: 20,
25
- creator_share_percent: 80,
26
- minimum_payout_cents: 5000, // $50 minimum
27
- payout_schedule: "monthly",
60
+ partner_share_percent: 80,
61
+ payout_schedule: "immediate",
28
62
  };
29
- /** Stripe processing fee: ~2.9% + 30¢ */
63
+ /** Stripe processing fee: ~2.9% + 30c */
30
64
  const STRIPE_FEE_PERCENT = 2.9;
31
65
  const STRIPE_FEE_FIXED_CENTS = 30;
32
66
  /** Apple IAP fee (standard rate) */
33
67
  const APPLE_IAP_FEE_PERCENT = 30;
34
- /** Apple IAP fee (small business program) */
68
+ /** Apple IAP fee (small business program — under $1M revenue) */
35
69
  const APPLE_IAP_SMALL_BUSINESS_FEE_PERCENT = 15;
36
70
  /** Google Play fee */
37
71
  const GOOGLE_IAP_FEE_PERCENT = 15;
@@ -41,75 +75,90 @@ const GOOGLE_IAP_FEE_PERCENT = 15;
41
75
  /**
42
76
  * Calculate the revenue split for a marketplace transaction.
43
77
  *
44
- * For Stripe purchases: Portable takes platform_fee_percent, creator gets the rest.
45
- * For IAP purchases: Store takes their cut first, then Portable and creator split the remainder.
78
+ * For Stripe purchases:
79
+ * Portable takes platform_fee_percent, partner gets the rest.
80
+ *
81
+ * For IAP purchases (platform absorbs Apple/Google fee):
82
+ * Partner always gets their full share of the gross.
83
+ * Platform absorbs the store fee — its effective take is reduced.
84
+ *
85
+ * Example (Theater, $10, Apple Small Business 15%):
86
+ * Partner share: 70% of $10 = $7.00
87
+ * Apple takes: 15% of $10 = $1.50
88
+ * Platform gets: $10 - $7.00 - $1.50 = $1.50 (effectively 15%)
46
89
  */
47
90
  function calculateRevenueSplit(totalCents, config = {}, revenueSource = "stripe", options) {
48
91
  const platformFeePercent = config.platform_fee_percent ?? exports.DEFAULT_REVENUE_CONFIG.platform_fee_percent;
49
- const creatorSharePercent = 100 - platformFeePercent;
92
+ const partnerSharePercent = 100 - platformFeePercent;
50
93
  let platformFeeCents;
51
- let creatorShareCents;
94
+ let partnerShareCents;
52
95
  let stripeFeeCents;
53
96
  if (revenueSource === "stripe") {
54
- // Stripe: platform takes fee, creator gets the rest
97
+ // Stripe: platform takes fee, partner gets the rest
55
98
  platformFeeCents = Math.round(totalCents * (platformFeePercent / 100));
56
- creatorShareCents = totalCents - platformFeeCents;
57
- // Stripe processing fee is typically absorbed by the platform
99
+ partnerShareCents = totalCents - platformFeeCents;
100
+ // Stripe processing fee (informational absorbed by platform)
58
101
  stripeFeeCents = Math.round(totalCents * (STRIPE_FEE_PERCENT / 100) + STRIPE_FEE_FIXED_CENTS);
59
102
  }
60
103
  else if (revenueSource === "apple_iap") {
61
- // Apple takes their cut first
104
+ // Platform absorbs Apple's cut. Partner gets the same share
105
+ // of gross as they would on Stripe.
62
106
  const applePercent = options?.apple_small_business
63
107
  ? APPLE_IAP_SMALL_BUSINESS_FEE_PERCENT
64
108
  : APPLE_IAP_FEE_PERCENT;
65
109
  const appleCut = Math.round(totalCents * (applePercent / 100));
66
- const afterApple = totalCents - appleCut;
67
- // Then Portable and creator split the remainder
68
- platformFeeCents = Math.round(afterApple * (platformFeePercent / 100));
69
- creatorShareCents = afterApple - platformFeeCents;
70
- // No additional Stripe fee for IAP (Apple handles payment processing)
110
+ // Partner gets their percentage of the full gross price
111
+ partnerShareCents = Math.round(totalCents * (partnerSharePercent / 100));
112
+ // Platform gets whatever's left after Apple and partner
113
+ platformFeeCents = totalCents - appleCut - partnerShareCents;
114
+ // Clamp: if Apple + partner > total, platform takes $0
115
+ if (platformFeeCents < 0)
116
+ platformFeeCents = 0;
71
117
  stripeFeeCents = 0;
72
118
  }
73
119
  else {
74
- // Google IAP
120
+ // Google IAP — same absorption logic
75
121
  const googleCut = Math.round(totalCents * (GOOGLE_IAP_FEE_PERCENT / 100));
76
- const afterGoogle = totalCents - googleCut;
77
- platformFeeCents = Math.round(afterGoogle * (platformFeePercent / 100));
78
- creatorShareCents = afterGoogle - platformFeeCents;
122
+ partnerShareCents = Math.round(totalCents * (partnerSharePercent / 100));
123
+ platformFeeCents = totalCents - googleCut - partnerShareCents;
124
+ if (platformFeeCents < 0)
125
+ platformFeeCents = 0;
79
126
  stripeFeeCents = 0;
80
127
  }
81
- // Creator's estimated net (after Stripe payout fees for Connect transfers)
82
- // Connect transfers have a small fee, but for simplicity we estimate ~0
83
- // since Stripe charges Connect fees to the connected account
84
- const creatorNetCents = creatorShareCents;
85
128
  return {
86
129
  total_cents: totalCents,
87
130
  platform_fee_cents: platformFeeCents,
88
- creator_share_cents: creatorShareCents,
131
+ partner_share_cents: partnerShareCents,
89
132
  stripe_fee_cents: stripeFeeCents,
90
- creator_net_cents: creatorNetCents,
133
+ partner_net_cents: partnerShareCents,
91
134
  platform_fee_percent: platformFeePercent,
92
- creator_share_percent: creatorSharePercent,
135
+ partner_share_percent: partnerSharePercent,
93
136
  revenue_source: revenueSource,
94
137
  };
95
138
  }
96
139
  /**
97
140
  * Calculate the Stripe application fee amount for a Connect destination charge.
98
141
  * This is what Stripe deducts from the payment and sends to the platform.
142
+ *
143
+ * Accepts either a full config or a plain percentage number.
99
144
  */
100
- function calculateApplicationFee(totalCents, platformFeePercent = exports.DEFAULT_REVENUE_CONFIG.platform_fee_percent) {
101
- return Math.round(totalCents * (platformFeePercent / 100));
145
+ function calculateApplicationFee(totalCents, configOrPercent = exports.DEFAULT_REVENUE_CONFIG.platform_fee_percent) {
146
+ const percent = typeof configOrPercent === "number"
147
+ ? configOrPercent
148
+ : configOrPercent.platform_fee_percent ??
149
+ exports.DEFAULT_REVENUE_CONFIG.platform_fee_percent;
150
+ return Math.round(totalCents * (percent / 100));
102
151
  }
103
152
  /**
104
153
  * Validate that a revenue split adds up correctly.
105
154
  */
106
155
  function validateRevenueSplit(result) {
107
156
  if (result.revenue_source === "stripe") {
108
- return (result.platform_fee_cents + result.creator_share_cents ===
157
+ return (result.platform_fee_cents + result.partner_share_cents ===
109
158
  result.total_cents);
110
159
  }
111
- // For IAP, platform + creator should equal total minus store cut
112
- return result.platform_fee_cents >= 0 && result.creator_share_cents >= 0;
160
+ // For IAP, platform + partner + store should equal total
161
+ return result.platform_fee_cents >= 0 && result.partner_share_cents >= 0;
113
162
  }
114
163
  /**
115
164
  * Format cents to a human-readable dollar string.
@@ -1 +1 @@
1
- {"version":3,"file":"revenue.js","sourceRoot":"","sources":["../src/revenue.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AA2CH,sDA4DC;AAMD,0DAKC;AAKD,oDASC;AAKD,kCAEC;AA/HD,8EAA8E;AAC9E,WAAW;AACX,8EAA8E;AAE9E,0CAA0C;AAC7B,QAAA,sBAAsB,GAAuB;IACxD,oBAAoB,EAAE,EAAE;IAC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mB,EAAE,iBAAiB;QACtC,gBAAgB,EAAE,cAAc;QAChC,iBAAiB,EAAE,iBAAiB;QACpC,oBAAoB,EAAE,kBAAkB;QACxC,qBAAqB,EAAE,mBAAmB;QAC1C,cAAc,EAAE,aAAa;KAC9B,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAgB,uBAAuB,CACrC,UAAkB,EAClB,kBAEa,8BAAsB,CAAC,oBAAoB;IAExD,MAAM,OAAO,GACX,OAAO,eAAe,KAAK,QAAQ;QACjC,CAAC,CAAC,eAAe;QACjB,CAAC,CAAC,eAAe,CAAC,oBAAoB;YACpC,8BAAsB,CAAC,oBAAoB,CAAA;IACjD,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAA;AACjD,CAAC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAAC,MAA0B;IAC7D,IAAI,MAAM,CAAC,cAAc,KAAK,QAAQ,EAAE,CAAC;QACvC,OAAO,CACL,MAAM,CAAC,kBAAkB,GAAG,MAAM,CAAC,mBAAmB;YACtD,MAAM,CAAC,WAAW,CACnB,CAAA;IACH,CAAC;IACD,yDAAyD;IACzD,OAAO,MAAM,CAAC,kBAAkB,IAAI,CAAC,IAAI,MAAM,CAAC,mBAAmB,IAAI,CAAC,CAAA;AAC1E,CAAC;AAED;;GAEG;AACH,SAAgB,WAAW,CAAC,KAAa;IACvC,OAAO,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAA;AACvC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portablecore/commerce",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Shared marketplace commerce infrastructure for Portable platforms — Connect onboarding, revenue splits, and payout execution",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -42,7 +42,7 @@
42
42
  "author": "Portable",
43
43
  "license": "UNLICENSED",
44
44
  "dependencies": {
45
- "@portablecore/types": "^0.5.0"
45
+ "@portablecore/types": "^0.6.0"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "stripe": ">=14.0.0"