@burdenoff/microfe-billing 2026.1005.5 → 2026.1005.6
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,2 +1,19 @@
|
|
|
1
1
|
import { acknowledgeNativePurchase as e, getNativeProducts as t, getNativePurchases as n, installNativeIAP as r, isNativeIAPAvailable as i, purchaseNativeProduct as a, restoreNativePurchases as o } from "@burdenoff/fe-libs/shared/native/purchases";
|
|
2
|
-
|
|
2
|
+
//#region src/billing/lib/native-purchases.ts
|
|
3
|
+
function s() {
|
|
4
|
+
if (typeof window > "u") return !1;
|
|
5
|
+
let e = window.Capacitor;
|
|
6
|
+
if (!e) return window.location.protocol === "capacitor:";
|
|
7
|
+
try {
|
|
8
|
+
if (e.isNativePlatform?.() === !0) return !0;
|
|
9
|
+
} catch {}
|
|
10
|
+
let t = e.getPlatform?.() ?? e.platform;
|
|
11
|
+
return t === "ios" || t === "android";
|
|
12
|
+
}
|
|
13
|
+
function c() {
|
|
14
|
+
return i() || s();
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { e as acknowledgeNativePurchase, t as getNativeProducts, n as getNativePurchases, r as installNativeIAP, c as isNativeIAPAvailable, a as purchaseNativeProduct, o as restoreNativePurchases };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=native-purchases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-purchases.js","names":[],"sources":["../../../src/billing/lib/native-purchases.ts"],"sourcesContent":["/**\n * Native in-app purchase bridge for Apple StoreKit and Google Play Billing.\n *\n * The implementation now lives in the shared layer at\n * `@burdenoff/fe-libs/shared/native` so every app shell and the billing MFE use\n * one source of truth. This module re-exports it under the billing-domain path\n * the checkout hooks already import from, keeping their imports stable.\n *\n * On web the plugin is absent and every call is a safe no-op / empty result, so\n * callers route to the normal Stripe/Razorpay web checkout. After a successful\n * native purchase the receipt / JWS / purchaseToken is sent to the backend via\n * POST /rest/billing/iap/validate for server-side validation and activation.\n */\nimport {\n isNativeIAPAvailable as isSharedNativeIAPAvailable,\n getNativeProducts,\n purchaseNativeProduct,\n acknowledgeNativePurchase,\n restoreNativePurchases,\n getNativePurchases,\n installNativeIAP,\n type NativeProduct,\n type NativeTransaction,\n type NativePurchaseType,\n} from '@burdenoff/fe-libs/shared/native/purchases';\n\nfunction isCapacitorNativeRuntime(): boolean {\n if (typeof window === 'undefined') return false;\n\n const capacitor = (window as Window & {\n Capacitor?: {\n isNativePlatform?: () => boolean;\n getPlatform?: () => string;\n platform?: string;\n };\n }).Capacitor;\n if (!capacitor) return window.location.protocol === 'capacitor:';\n\n try {\n if (capacitor.isNativePlatform?.() === true) return true;\n } catch {\n // Fall through to the platform-name check.\n }\n\n const platform = capacitor.getPlatform?.() ?? capacitor.platform;\n return platform === 'ios' || platform === 'android';\n}\n\n/**\n * Capacitor injects its platform global before the shell's custom bridge is\n * installed. Accept both signals so checkout cannot fall back to Razorpay\n * during native boot.\n */\nexport function isNativeIAPAvailable(): boolean {\n return isSharedNativeIAPAvailable() || isCapacitorNativeRuntime();\n}\n\nexport {\n getNativeProducts,\n purchaseNativeProduct,\n acknowledgeNativePurchase,\n restoreNativePurchases,\n getNativePurchases,\n installNativeIAP,\n};\n\nexport type { NativeProduct, NativeTransaction, NativePurchaseType };\n"],"mappings":";;AA0BA,SAAS,IAAoC;CAC3C,IAAI,OAAO,SAAW,KAAa,OAAO;CAE1C,IAAM,IAAa,OAMhB;CACH,IAAI,CAAC,GAAW,OAAO,OAAO,SAAS,aAAa;CAEpD,IAAI;EACF,IAAI,EAAU,mBAAmB,MAAM,IAAM,OAAO;CACtD,QAAQ,CAER;CAEA,IAAM,IAAW,EAAU,cAAc,KAAK,EAAU;CACxD,OAAO,MAAa,SAAS,MAAa;AAC5C;AAOA,SAAgB,IAAgC;CAC9C,OAAO,EAA2B,KAAK,EAAyB;AAClE"}
|