@burdenoff/microfe-billing 2026.1023.2 → 2026.1026.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,41 +1,47 @@
1
- import { createContext as e, useContext as t } from "react";
2
- import { MemoryRouter as n } from "react-router";
3
- import { PermissionProvider as r } from "@burdenoff/fe-libs/shared/providers/shell";
4
- import { jsx as i } from "react/jsx-runtime";
1
+ import { installNativeIAP as e } from "../lib/native-purchases.js";
2
+ import { createContext as t, useContext as n, useEffect as r } from "react";
3
+ import { MemoryRouter as i } from "react-router";
4
+ import { PermissionProvider as a } from "@burdenoff/fe-libs/shared/providers/shell";
5
+ import { jsx as o } from "react/jsx-runtime";
5
6
  //#region src/billing/providers/BillingProvider.tsx
6
- var a = e(null), o = () => {
7
- let e = t(a);
7
+ var s = "burdenoff:nativeIapTransaction", c = t(null), l = () => {
8
+ let e = n(c);
8
9
  if (!e) throw Error("useBilling must be used within BillingProvider");
9
10
  return e;
10
- }, s = ({ children: e, basePath: t, navigate: o, currentUser: s, workspaceId: c, orgId: l, productId: u, plansDocsUrl: d, apiGatewayUrl: f, authToken: p, stripePublishableKey: m, razorpayKey: h, onSubscriptionCreate: g, onSubscriptionUpdate: _, onPaymentProcess: v, registerNavItems: y, registerFooterItems: b }) => {
11
- let x = {
12
- basePath: t,
13
- navigate: o,
14
- currentUser: s,
15
- workspaceId: c,
16
- orgId: l,
17
- productId: u,
18
- plansDocsUrl: d,
19
- apiGatewayUrl: f,
20
- authToken: p,
21
- stripePublishableKey: m,
22
- razorpayKey: h,
23
- onSubscriptionCreate: g,
24
- onSubscriptionUpdate: _,
25
- onPaymentProcess: v,
26
- registerNavItems: y,
27
- registerFooterItems: b
28
- }, S = /* @__PURE__ */ i(a.Provider, {
29
- value: x,
30
- children: /* @__PURE__ */ i(r, {
31
- scopeId: l,
11
+ }, u = ({ children: t, basePath: n, navigate: l, currentUser: u, workspaceId: d, orgId: f, productId: p, plansDocsUrl: m, apiGatewayUrl: h, authToken: g, stripePublishableKey: _, razorpayKey: v, onSubscriptionCreate: y, onSubscriptionUpdate: b, onPaymentProcess: x, registerNavItems: S, registerFooterItems: C }) => {
12
+ r(() => {
13
+ e((e) => {
14
+ typeof window > "u" || window.dispatchEvent(new CustomEvent(s, { detail: e }));
15
+ });
16
+ }, []);
17
+ let w = {
18
+ basePath: n,
19
+ navigate: l,
20
+ currentUser: u,
21
+ workspaceId: d,
22
+ orgId: f,
23
+ productId: p,
24
+ plansDocsUrl: m,
25
+ apiGatewayUrl: h,
26
+ authToken: g,
27
+ stripePublishableKey: _,
28
+ razorpayKey: v,
29
+ onSubscriptionCreate: y,
30
+ onSubscriptionUpdate: b,
31
+ onPaymentProcess: x,
32
+ registerNavItems: S,
33
+ registerFooterItems: C
34
+ }, T = /* @__PURE__ */ o(c.Provider, {
35
+ value: w,
36
+ children: /* @__PURE__ */ o(a, {
37
+ scopeId: f,
32
38
  gateway: "global",
33
- children: e
39
+ children: t
34
40
  })
35
41
  });
36
- return t ? S : /* @__PURE__ */ i(n, { children: S });
42
+ return n ? T : /* @__PURE__ */ o(i, { children: T });
37
43
  };
38
44
  //#endregion
39
- export { s as BillingProvider, o as useBilling };
45
+ export { u as BillingProvider, l as useBilling };
40
46
 
41
47
  //# sourceMappingURL=BillingProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BillingProvider.js","names":[],"sources":["../../../src/billing/providers/BillingProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from 'react';\nimport { createContext, useContext } from 'react';\nimport { MemoryRouter } from 'react-router';\nimport { PermissionProvider } from '@burdenoff/fe-libs/shared/providers/shell';\nimport type { BillingRootProps } from '../types';\n\n/**\n * Context value for Billing microfrontend\n */\ntype BillingContextValue = BillingRootProps;\n\nconst BillingContext = createContext<BillingContextValue | null>(null);\n\n/**\n * Hook to access Billing context\n */\nexport const useBilling = () => {\n const context = useContext(BillingContext);\n if (!context) {\n throw new Error('useBilling must be used within BillingProvider');\n }\n return context;\n};\n\n/**\n * Provider component for Billing microfrontend\n * Sets up routing and context\n *\n * When integrated into a shell (basePath provided), the shell already has a router\n * so we don't create another one. When standalone (no basePath), use MemoryRouter.\n */\nexport const BillingProvider: FC<PropsWithChildren<BillingRootProps>> = ({\n children,\n basePath,\n navigate,\n currentUser,\n workspaceId,\n orgId,\n productId,\n plansDocsUrl,\n apiGatewayUrl,\n authToken,\n stripePublishableKey,\n razorpayKey,\n onSubscriptionCreate,\n onSubscriptionUpdate,\n onPaymentProcess,\n registerNavItems,\n registerFooterItems,\n}) => {\n const contextValue: BillingContextValue = {\n basePath,\n navigate,\n currentUser,\n workspaceId,\n orgId,\n productId,\n plansDocsUrl,\n apiGatewayUrl,\n authToken,\n stripePublishableKey,\n razorpayKey,\n onSubscriptionCreate,\n onSubscriptionUpdate,\n onPaymentProcess,\n registerNavItems,\n registerFooterItems,\n };\n\n const content = (\n <BillingContext.Provider value={contextValue}>\n <PermissionProvider scopeId={orgId} gateway=\"global\">\n {children}\n </PermissionProvider>\n </BillingContext.Provider>\n );\n\n // When integrated into a shell (basePath provided), the shell already has a router\n // so we don't create another one. When standalone (no basePath), use MemoryRouter.\n if (basePath) {\n return content;\n }\n\n // Standalone mode: create MemoryRouter for independent operation\n return <MemoryRouter>{content}</MemoryRouter>;\n};\n"],"mappings":";;;;;AAWA,IAAM,IAAiB,EAA0C,IAAI,GAKxD,UAAmB;CAC9B,IAAM,IAAU,EAAW,CAAc;CACzC,IAAI,CAAC,GACH,MAAU,MAAM,gDAAgD;CAElE,OAAO;AACT,GASa,KAA4D,EACvE,aACA,aACA,aACA,gBACA,gBACA,UACA,cACA,iBACA,kBACA,cACA,yBACA,gBACA,yBACA,yBACA,qBACA,qBACA,6BACI;CACJ,IAAM,IAAoC;EACxC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,GAEM,IACJ,kBAAC,EAAe,UAAhB;EAAyB,OAAO;YAC9B,kBAAC,GAAD;GAAoB,SAAS;GAAO,SAAQ;GACzC;EACiB,CAAA;CACG,CAAA;CAU3B,OALI,IACK,IAIF,kBAAC,GAAD,EAAA,UAAe,EAAsB,CAAA;AAC9C"}
1
+ {"version":3,"file":"BillingProvider.js","names":[],"sources":["../../../src/billing/providers/BillingProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from 'react';\nimport { createContext, useContext, useEffect } from 'react';\nimport { MemoryRouter } from 'react-router';\nimport { PermissionProvider } from '@burdenoff/fe-libs/shared/providers/shell';\nimport type { BillingRootProps } from '../types';\nimport { installNativeIAP, type NativeTransaction } from '../lib/native-purchases';\n\n/** Dispatched when the background StoreKit 2/Play Billing listener observes a\n * transaction (renewal, restore, or an interrupted purchase resumed on launch).\n * Background transactions are reconciled authoritatively server-side via the\n * Apple/Google webhooks; this just lets mounted UI react (e.g. refresh entitlements). */\nexport const NATIVE_IAP_TRANSACTION_EVENT = 'burdenoff:nativeIapTransaction';\n\n/**\n * Context value for Billing microfrontend\n */\ntype BillingContextValue = BillingRootProps;\n\nconst BillingContext = createContext<BillingContextValue | null>(null);\n\n/**\n * Hook to access Billing context\n */\nexport const useBilling = () => {\n const context = useContext(BillingContext);\n if (!context) {\n throw new Error('useBilling must be used within BillingProvider');\n }\n return context;\n};\n\n/**\n * Provider component for Billing microfrontend\n * Sets up routing and context\n *\n * When integrated into a shell (basePath provided), the shell already has a router\n * so we don't create another one. When standalone (no basePath), use MemoryRouter.\n */\nexport const BillingProvider: FC<PropsWithChildren<BillingRootProps>> = ({\n children,\n basePath,\n navigate,\n currentUser,\n workspaceId,\n orgId,\n productId,\n plansDocsUrl,\n apiGatewayUrl,\n authToken,\n stripePublishableKey,\n razorpayKey,\n onSubscriptionCreate,\n onSubscriptionUpdate,\n onPaymentProcess,\n registerNavItems,\n registerFooterItems,\n}) => {\n // Register the native IAP background listener once billing context (and\n // therefore the signed-in user) is known. No-op on web. See `NATIVE_IAP_TRANSACTION_EVENT`.\n useEffect(() => {\n void installNativeIAP((transaction: NativeTransaction) => {\n if (typeof window === 'undefined') return;\n window.dispatchEvent(\n new CustomEvent<NativeTransaction>(NATIVE_IAP_TRANSACTION_EVENT, { detail: transaction })\n );\n });\n }, []);\n\n const contextValue: BillingContextValue = {\n basePath,\n navigate,\n currentUser,\n workspaceId,\n orgId,\n productId,\n plansDocsUrl,\n apiGatewayUrl,\n authToken,\n stripePublishableKey,\n razorpayKey,\n onSubscriptionCreate,\n onSubscriptionUpdate,\n onPaymentProcess,\n registerNavItems,\n registerFooterItems,\n };\n\n const content = (\n <BillingContext.Provider value={contextValue}>\n <PermissionProvider scopeId={orgId} gateway=\"global\">\n {children}\n </PermissionProvider>\n </BillingContext.Provider>\n );\n\n // When integrated into a shell (basePath provided), the shell already has a router\n // so we don't create another one. When standalone (no basePath), use MemoryRouter.\n if (basePath) {\n return content;\n }\n\n // Standalone mode: create MemoryRouter for independent operation\n return <MemoryRouter>{content}</MemoryRouter>;\n};\n"],"mappings":";;;;;;AAWA,IAAa,IAA+B,kCAOtC,IAAiB,EAA0C,IAAI,GAKxD,UAAmB;CAC9B,IAAM,IAAU,EAAW,CAAc;CACzC,IAAI,CAAC,GACH,MAAU,MAAM,gDAAgD;CAElE,OAAO;AACT,GASa,KAA4D,EACvE,aACA,aACA,aACA,gBACA,gBACA,UACA,cACA,iBACA,kBACA,cACA,yBACA,gBACA,yBACA,yBACA,qBACA,qBACA,6BACI;CAGJ,QAAgB;EACd,GAAuB,MAAmC;GACpD,OAAO,SAAW,OACtB,OAAO,cACL,IAAI,YAA+B,GAA8B,EAAE,QAAQ,EAAY,CAAC,CAC1F;EACF,CAAC;CACH,GAAG,CAAC,CAAC;CAEL,IAAM,IAAoC;EACxC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,GAEM,IACJ,kBAAC,EAAe,UAAhB;EAAyB,OAAO;YAC9B,kBAAC,GAAD;GAAoB,SAAS;GAAO,SAAQ;GACzC;EACiB,CAAA;CACG,CAAA;CAU3B,OALI,IACK,IAIF,kBAAC,GAAD,EAAA,UAAe,EAAsB,CAAA;AAC9C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-billing",
3
- "version": "2026.1023.2",
3
+ "version": "2026.1026.1",
4
4
  "description": "Billing microfrontend for Burdenoff products",
5
5
  "type": "module",
6
6
  "files": [