@tryheliumai/paywall-sdk-react-native 0.1.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.
Files changed (54) hide show
  1. package/LICENSE +20 -0
  2. package/PaywallSdkReactNative.podspec +28 -0
  3. package/README.md +224 -0
  4. package/android/build.gradle +88 -0
  5. package/android/gradle.properties +5 -0
  6. package/android/src/main/AndroidManifest.xml +3 -0
  7. package/android/src/main/AndroidManifestNew.xml +2 -0
  8. package/android/src/main/java/com/paywallsdkreactnative/PaywallSdkReactNativeModule.kt +25 -0
  9. package/android/src/main/java/com/paywallsdkreactnative/PaywallSdkReactNativePackage.kt +17 -0
  10. package/ios/HeliumSwiftInterface.swift +269 -0
  11. package/ios/HeliumUpsellViewManager.m +17 -0
  12. package/ios/HeliumUpsellViewManager.swift +95 -0
  13. package/ios/PaywallSdkReactNative-Bridging-Header.h +2 -0
  14. package/ios/RCTHeliumBridge.m +35 -0
  15. package/lib/commonjs/index.js +37 -0
  16. package/lib/commonjs/index.js.map +1 -0
  17. package/lib/commonjs/native-interface.js +128 -0
  18. package/lib/commonjs/native-interface.js.map +1 -0
  19. package/lib/commonjs/purchase-handlers.js +47 -0
  20. package/lib/commonjs/purchase-handlers.js.map +1 -0
  21. package/lib/commonjs/types.js +2 -0
  22. package/lib/commonjs/types.js.map +1 -0
  23. package/lib/module/index.js +4 -0
  24. package/lib/module/index.js.map +2 -0
  25. package/lib/module/native-interface.js +117 -0
  26. package/lib/module/native-interface.js.map +1 -0
  27. package/lib/module/purchase-handlers.js +42 -0
  28. package/lib/module/purchase-handlers.js.map +1 -0
  29. package/lib/module/types.js +2 -0
  30. package/lib/module/types.js.map +1 -0
  31. package/lib/typescript/commonjs/package.json +1 -0
  32. package/lib/typescript/commonjs/src/index.d.ts +3 -0
  33. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  34. package/lib/typescript/commonjs/src/native-interface.d.ts +13 -0
  35. package/lib/typescript/commonjs/src/native-interface.d.ts.map +1 -0
  36. package/lib/typescript/commonjs/src/purchase-handlers.d.ts +19 -0
  37. package/lib/typescript/commonjs/src/purchase-handlers.d.ts.map +1 -0
  38. package/lib/typescript/commonjs/src/types.d.ts +19 -0
  39. package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
  40. package/lib/typescript/module/package.json +1 -0
  41. package/lib/typescript/module/src/index.d.ts +3 -0
  42. package/lib/typescript/module/src/index.d.ts.map +1 -0
  43. package/lib/typescript/module/src/native-interface.d.ts +13 -0
  44. package/lib/typescript/module/src/native-interface.d.ts.map +1 -0
  45. package/lib/typescript/module/src/purchase-handlers.d.ts +19 -0
  46. package/lib/typescript/module/src/purchase-handlers.d.ts.map +1 -0
  47. package/lib/typescript/module/src/types.d.ts +19 -0
  48. package/lib/typescript/module/src/types.d.ts.map +1 -0
  49. package/package.json +188 -0
  50. package/src/index.ts +2 -0
  51. package/src/index.tsx +2 -0
  52. package/src/native-interface.tsx +134 -0
  53. package/src/purchase-handlers.ts +39 -0
  54. package/src/types.ts +21 -0
@@ -0,0 +1,17 @@
1
+ //
2
+ // HeliumUpsellViewManager.m
3
+ // HeliumBridgeNative
4
+ //
5
+ // Created by Anish Doshi on 2/11/25.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+ #import <React/RCTViewManager.h>
10
+
11
+ @interface RCT_EXTERN_MODULE(HeliumUpsellViewManager, RCTViewManager)
12
+ RCT_EXPORT_VIEW_PROPERTY(trigger, NSString)
13
+ + (BOOL)requiresMainQueueSetup
14
+ {
15
+ return YES;
16
+ }
17
+ @end
@@ -0,0 +1,95 @@
1
+ //
2
+ // HeliumUpsellViewManager.swift
3
+ // HeliumBridgeNative
4
+ //
5
+ // Created by Anish Doshi on 2/11/25.
6
+ //
7
+ import Foundation
8
+ import React
9
+ import Helium
10
+ import SwiftUI
11
+
12
+ // Helper extension to find parent view controller
13
+ extension UIView {
14
+ var parentViewController: UIViewController? {
15
+ var parentResponder: UIResponder? = self
16
+ while parentResponder != nil {
17
+ parentResponder = parentResponder?.next
18
+ if let viewController = parentResponder as? UIViewController {
19
+ return viewController
20
+ }
21
+ }
22
+ return nil
23
+ }
24
+ }
25
+
26
+ // Custom view that handles the SwiftUI hosting
27
+ class HeliumUpsellView: UIView {
28
+ private var hostingController: UIHostingController<AnyView>?
29
+
30
+ @objc var trigger: String = "" {
31
+ didSet {
32
+ updateView()
33
+ }
34
+ }
35
+
36
+ override init(frame: CGRect) {
37
+ super.init(frame: frame)
38
+ setupView()
39
+ }
40
+
41
+ required init?(coder: NSCoder) {
42
+ super.init(coder: coder)
43
+ setupView()
44
+ }
45
+
46
+ private func setupView() {
47
+ updateView()
48
+ }
49
+
50
+ private func updateView() {
51
+ // Remove existing hosting controller view if it exists
52
+ hostingController?.view.removeFromSuperview()
53
+ hostingController?.removeFromParent()
54
+
55
+ // Get the SwiftUI view with current trigger
56
+ let swiftUIView = Helium.shared.upsellViewForTrigger(trigger: trigger)
57
+
58
+ // Create new hosting controller
59
+ hostingController = UIHostingController(rootView: AnyView(swiftUIView))
60
+
61
+ if let hostingView = hostingController?.view {
62
+ // Add the hosting controller's view as a subview
63
+ hostingView.frame = bounds
64
+ hostingView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
65
+ hostingView.backgroundColor = .clear
66
+ addSubview(hostingView)
67
+
68
+ // If this view is being used in a view controller hierarchy
69
+ if let parentViewController = parentViewController {
70
+ parentViewController.addChild(hostingController!)
71
+ hostingController?.didMove(toParent: parentViewController)
72
+ }
73
+ }
74
+ }
75
+
76
+ override func layoutSubviews() {
77
+ super.layoutSubviews()
78
+ hostingController?.view.frame = bounds
79
+ }
80
+ }
81
+
82
+ @objc(HeliumUpsellViewManager)
83
+ class HeliumUpsellViewManager: RCTViewManager {
84
+ override static func requiresMainQueueSetup() -> Bool {
85
+ return true
86
+ }
87
+
88
+ override func view() -> UIView! {
89
+ return HeliumUpsellView()
90
+ }
91
+
92
+ @objc func setTrigger(_ view: HeliumUpsellView, trigger: NSString) {
93
+ view.trigger = trigger as String
94
+ }
95
+ }
@@ -0,0 +1,2 @@
1
+ #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTViewManager.h>
@@ -0,0 +1,35 @@
1
+ //
2
+ // RCTHeliumBridge.m
3
+ // HeliumBridgeNative
4
+ //
5
+ // Created by Anish Doshi on 2/11/25.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+ #import <React/RCTBridgeModule.h>
10
+ #import "PaywallSdkReactNative-Bridging-Header.h"
11
+
12
+ @interface RCT_EXTERN_MODULE(HeliumBridge, NSObject)
13
+
14
+ RCT_EXTERN_METHOD(
15
+ initialize:(NSDictionary *)config
16
+ customVariableValues:(NSDictionary *)config
17
+ )
18
+
19
+ RCT_EXTERN_METHOD(
20
+ presentUpsell:(NSString *)trigger
21
+ )
22
+
23
+ RCT_EXTERN_METHOD(
24
+ hideUpsell
25
+ )
26
+
27
+ RCT_EXTERN_METHOD(
28
+ handlePurchaseResponse:(NSDictionary *)response
29
+ )
30
+
31
+ RCT_EXTERN_METHOD(
32
+ handleRestoreResponse:(NSDictionary *)response
33
+ )
34
+
35
+ @end
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "HeliumProvider", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _nativeInterface.HeliumProvider;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "UpsellView", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _nativeInterface.UpsellView;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "hideUpsell", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _nativeInterface.hideUpsell;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "initialize", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _nativeInterface.initialize;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "presentUpsell", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _nativeInterface.presentUpsell;
34
+ }
35
+ });
36
+ var _nativeInterface = require("./native-interface.js");
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_nativeInterface","require"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA","ignoreList":[]}
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.presentUpsell = exports.initialize = exports.hideUpsell = exports.UpsellView = exports.HeliumProvider = void 0;
7
+ var _reactNative = require("react-native");
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
+ const {
13
+ HeliumBridge
14
+ } = _reactNative.NativeModules;
15
+ const heliumEventEmitter = new _reactNative.NativeEventEmitter(HeliumBridge);
16
+ let isProviderMounted = false;
17
+
18
+ // Move NativeHeliumUpsellView to a singleton pattern
19
+ let NativeHeliumUpsellView = null;
20
+ const getNativeHeliumUpsellView = () => {
21
+ if (!NativeHeliumUpsellView) {
22
+ NativeHeliumUpsellView = (0, _reactNative.requireNativeComponent)('HeliumUpsellView');
23
+ }
24
+ return NativeHeliumUpsellView;
25
+ };
26
+ // Create a ref to store the fallback view reference
27
+ const fallbackRef = /*#__PURE__*/(0, _react.createRef)();
28
+
29
+ // Provider component to be rendered at the app root
30
+ const HeliumProvider = ({
31
+ children,
32
+ fallbackView: FallbackView
33
+ }) => {
34
+ (0, _react.useEffect)(() => {
35
+ isProviderMounted = true;
36
+ return () => {
37
+ isProviderMounted = false;
38
+ };
39
+ }, []);
40
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
41
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
42
+ ref: fallbackRef,
43
+ style: {
44
+ position: 'absolute',
45
+ opacity: 0,
46
+ width: 1,
47
+ height: 1,
48
+ overflow: 'hidden'
49
+ },
50
+ collapsable: false,
51
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(FallbackView, {})
52
+ }), children]
53
+ });
54
+ };
55
+
56
+ // Update initialize to accept config
57
+ exports.HeliumProvider = HeliumProvider;
58
+ const initialize = (heliumCallbacks, config = {}) => {
59
+ if (!isProviderMounted) {
60
+ throw new Error('HeliumProvider is not mounted. Please wrap your app with HeliumProvider.');
61
+ }
62
+ const viewTag = (0, _reactNative.findNodeHandle)(fallbackRef.current);
63
+ if (!viewTag) {
64
+ throw new Error('Failed to get fallback view reference. Make sure HeliumProvider is mounted with a fallback view.');
65
+ }
66
+
67
+ // Set up purchase event listener
68
+ heliumEventEmitter.addListener('helium_make_purchase', async event => {
69
+ const status = await heliumCallbacks.makePurchase(event.productId);
70
+ HeliumBridge.handlePurchaseResponse({
71
+ transactionId: event.transactionId,
72
+ status: status
73
+ });
74
+ });
75
+
76
+ // Set up restore purchases event listener
77
+ heliumEventEmitter.addListener('helium_restore_purchases', async event => {
78
+ const success = await heliumCallbacks.restorePurchases();
79
+ HeliumBridge.handleRestoreResponse({
80
+ transactionId: event.transactionId,
81
+ status: success ? 'restored' : 'failed'
82
+ });
83
+ });
84
+
85
+ // Set up paywall event listener
86
+ heliumEventEmitter.addListener('helium_paywall_event', event => {
87
+ heliumCallbacks.onHeliumPaywallEvent(event);
88
+ });
89
+
90
+ // Initialize the bridge with merged config
91
+ HeliumBridge.initialize({
92
+ apiKey: config.apiKey,
93
+ fallbackPaywall: viewTag,
94
+ triggers: config.triggers || [],
95
+ customUserId: config.customUserId || null,
96
+ customAPIEndpoint: config.customAPIEndpoint || null,
97
+ customUserTraits: config.customUserTraits || {
98
+ "exampleUserTrait": "test_value"
99
+ }
100
+ }, {});
101
+ };
102
+
103
+ // Update the other methods to be synchronous
104
+ exports.initialize = initialize;
105
+ const presentUpsell = triggerName => {
106
+ HeliumBridge.presentUpsell(triggerName);
107
+ };
108
+ exports.presentUpsell = presentUpsell;
109
+ const hideUpsell = () => {
110
+ HeliumBridge.hideUpsell();
111
+ };
112
+
113
+ // Update the UpsellView component to handle the style prop
114
+ exports.hideUpsell = hideUpsell;
115
+ const UpsellView = ({
116
+ trigger,
117
+ style
118
+ }) => {
119
+ const NativeView = getNativeHeliumUpsellView();
120
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(NativeView, {
121
+ trigger: trigger,
122
+ style: [{
123
+ flex: 1
124
+ }, style]
125
+ });
126
+ };
127
+ exports.UpsellView = UpsellView;
128
+ //# sourceMappingURL=native-interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_react","_interopRequireWildcard","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","HeliumBridge","NativeModules","heliumEventEmitter","NativeEventEmitter","isProviderMounted","NativeHeliumUpsellView","getNativeHeliumUpsellView","requireNativeComponent","fallbackRef","createRef","HeliumProvider","children","fallbackView","FallbackView","useEffect","jsxs","Fragment","jsx","View","ref","style","position","opacity","width","height","overflow","collapsable","exports","initialize","heliumCallbacks","config","Error","viewTag","findNodeHandle","current","addListener","event","status","makePurchase","productId","handlePurchaseResponse","transactionId","success","restorePurchases","handleRestoreResponse","onHeliumPaywallEvent","apiKey","fallbackPaywall","triggers","customUserId","customAPIEndpoint","customUserTraits","presentUpsell","triggerName","hideUpsell","UpsellView","trigger","NativeView","flex"],"sourceRoot":"../../src","sources":["native-interface.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAoD,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,C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AO;IACxBgB,QAAQ,EAAElB,MAAM,CAACkB,QAAQ,IAAI,EAAE;IAC/BC,YAAY,EAAEnB,MAAM,CAACmB,YAAY,IAAI,IAAI;IACzCC,iBAAiB,EAAEpB,MAAM,CAACoB,iBAAiB,IAAI,IAAI;IACnDC,gBAAgB,EAAErB,MAAM,CAACqB,gBAAgB,IAAI;MAC3C,kBAAkB,EAAE;IACtB;EACF,CAAC,EACD,CAAC,CACH,CAAC;AACH,CAAC;;AAED;AAAAxB,OAAA,CAAAC,UAAA,GAAAA,UAAA;AACO,MAAMwB,aAAa,GAAIC,WAAmB,IAAK;EACpDrD,YAAY,CAACoD,aAAa,CAACC,WAAW,CAAC;AACzC,CAAC;AAAC1B,OAAA,CAAAyB,aAAA,GAAAA,aAAA;AAEK,MAAME,UAAU,GAAGA,CAAA,KAAM;EAC9BtD,YAAY,CAACsD,UAAU,CAAC,CAAC;AAC3B,CAAC;;AAED;AAAA3B,OAAA,CAAA2B,UAAA,GAAAA,UAAA;AACO,MAAMC,UAA2C,GAAGA,CAAC;EAAEC,OAAO;EAAEpC;AAAM,CAAC,KAAK;EACjF,MAAMqC,UAAU,GAAGnD,yBAAyB,CAAC,CAAC;EAC9C,oBACE,IAAA3B,WAAA,CAAAsC,GAAA,EAACwC,UAAU;IACTD,OAAO,EAAEA,OAAQ;IACjBpC,KAAK,EAAE,CAAC;MAAEsC,IAAI,EAAE;IAAE,CAAC,EAAEtC,KAAK;EAAE,CAC7B,CAAC;AAEN,CAAC;AAACO,OAAA,CAAA4B,UAAA,GAAAA,UAAA","ignoreList":[]}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DemoHeliumCallbacks = void 0;
7
+ // Update the implementation
8
+ class DemoHeliumCallbacks {
9
+ events = [];
10
+ async makePurchase(productId) {
11
+ this.events.push({
12
+ timestamp: new Date(),
13
+ event: {
14
+ type: 'purchase',
15
+ productId
16
+ }
17
+ });
18
+ return 'completed';
19
+ }
20
+ async restorePurchases() {
21
+ this.events.push({
22
+ timestamp: new Date(),
23
+ event: {
24
+ type: 'restore'
25
+ }
26
+ });
27
+ return true;
28
+ }
29
+ onHeliumPaywallEvent(event) {
30
+ this.events.push({
31
+ timestamp: new Date(),
32
+ event
33
+ });
34
+ }
35
+ getCustomVariableValues = () => {
36
+ console.log('getCustomVariableValues called');
37
+ return {
38
+ exampleVar1: 'value1',
39
+ exampleVar2: 'value2'
40
+ };
41
+ };
42
+ getEventHistory() {
43
+ return this.events;
44
+ }
45
+ }
46
+ exports.DemoHeliumCallbacks = DemoHeliumCallbacks;
47
+ //# sourceMappingURL=purchase-handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DemoHeliumCallbacks","events","makePurchase","productId","push","timestamp","Date","event","type","restorePurchases","onHeliumPaywallEvent","getCustomVariableValues","console","log","exampleVar1","exampleVar2","getEventHistory","exports"],"sourceRoot":"../../src","sources":["purchase-handlers.ts"],"mappings":";;;;;;AASE;AACO,MAAMA,mBAAmB,CAA4B;EAClDC,MAAM,GAAsC,EAAE;EAEtD,MAAMC,YAAYA,CAACC,SAAiB,EAAoC;IACtE,IAAI,CAACF,MAAM,CAACG,IAAI,CAAC;MAAEC,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC;MAAEC,KAAK,EAAE;QAAEC,IAAI,EAAE,UAAU;QAAEL;MAAU;IAAE,CAAC,CAAC;IACnF,OAAO,WAAW;EACpB;EAEA,MAAMM,gBAAgBA,CAAA,EAAqB;IACzC,IAAI,CAACR,MAAM,CAACG,IAAI,CAAC;MAAEC,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC;MAAEC,KAAK,EAAE;QAAEC,IAAI,EAAE;MAAU;IAAE,CAAC,CAAC;IACvE,OAAO,IAAI;EACb;EAEAE,oBAAoBA,CAACH,KAAU,EAAQ;IACrC,IAAI,CAACN,MAAM,CAACG,IAAI,CAAC;MAAEC,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC;MAAEC;IAAM,CAAC,CAAC;EACpD;EAEAI,uBAAuB,GAAGA,CAAA,KAA2B;IACnDC,OAAO,CAACC,GAAG,CAAC,gCAAgC,CAAC;IAC7C,OAAO;MACLC,WAAW,EAAE,QAAQ;MACrBC,WAAW,EAAE;IACf,CAAC;EACH,CAAC;EAEDC,eAAeA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACf,MAAM;EACpB;AACF;AAACgB,OAAA,CAAAjB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export { HeliumProvider, initialize, presentUpsell, hideUpsell, UpsellView } from "./native-interface.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ {"version":3,"names":["HeliumProvider","initialize","presentUpsell","hideUpsell","UpsellView"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,cAAc,EAAEC,UAAU,EAAEC,aAAa,EAAEC,UAAU,EAAEC,UAAU,QAAQ,uBAAoB","ignoreList":[]}
2
+
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+
3
+ import { findNodeHandle, NativeModules, View, NativeEventEmitter, requireNativeComponent } from 'react-native';
4
+ import React, { createRef, useEffect } from 'react';
5
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
6
+ const {
7
+ HeliumBridge
8
+ } = NativeModules;
9
+ const heliumEventEmitter = new NativeEventEmitter(HeliumBridge);
10
+ let isProviderMounted = false;
11
+
12
+ // Move NativeHeliumUpsellView to a singleton pattern
13
+ let NativeHeliumUpsellView = null;
14
+ const getNativeHeliumUpsellView = () => {
15
+ if (!NativeHeliumUpsellView) {
16
+ NativeHeliumUpsellView = requireNativeComponent('HeliumUpsellView');
17
+ }
18
+ return NativeHeliumUpsellView;
19
+ };
20
+ // Create a ref to store the fallback view reference
21
+ const fallbackRef = /*#__PURE__*/createRef();
22
+
23
+ // Provider component to be rendered at the app root
24
+ export const HeliumProvider = ({
25
+ children,
26
+ fallbackView: FallbackView
27
+ }) => {
28
+ useEffect(() => {
29
+ isProviderMounted = true;
30
+ return () => {
31
+ isProviderMounted = false;
32
+ };
33
+ }, []);
34
+ return /*#__PURE__*/_jsxs(_Fragment, {
35
+ children: [/*#__PURE__*/_jsx(View, {
36
+ ref: fallbackRef,
37
+ style: {
38
+ position: 'absolute',
39
+ opacity: 0,
40
+ width: 1,
41
+ height: 1,
42
+ overflow: 'hidden'
43
+ },
44
+ collapsable: false,
45
+ children: /*#__PURE__*/_jsx(FallbackView, {})
46
+ }), children]
47
+ });
48
+ };
49
+
50
+ // Update initialize to accept config
51
+ export const initialize = (heliumCallbacks, config = {}) => {
52
+ if (!isProviderMounted) {
53
+ throw new Error('HeliumProvider is not mounted. Please wrap your app with HeliumProvider.');
54
+ }
55
+ const viewTag = findNodeHandle(fallbackRef.current);
56
+ if (!viewTag) {
57
+ throw new Error('Failed to get fallback view reference. Make sure HeliumProvider is mounted with a fallback view.');
58
+ }
59
+
60
+ // Set up purchase event listener
61
+ heliumEventEmitter.addListener('helium_make_purchase', async event => {
62
+ const status = await heliumCallbacks.makePurchase(event.productId);
63
+ HeliumBridge.handlePurchaseResponse({
64
+ transactionId: event.transactionId,
65
+ status: status
66
+ });
67
+ });
68
+
69
+ // Set up restore purchases event listener
70
+ heliumEventEmitter.addListener('helium_restore_purchases', async event => {
71
+ const success = await heliumCallbacks.restorePurchases();
72
+ HeliumBridge.handleRestoreResponse({
73
+ transactionId: event.transactionId,
74
+ status: success ? 'restored' : 'failed'
75
+ });
76
+ });
77
+
78
+ // Set up paywall event listener
79
+ heliumEventEmitter.addListener('helium_paywall_event', event => {
80
+ heliumCallbacks.onHeliumPaywallEvent(event);
81
+ });
82
+
83
+ // Initialize the bridge with merged config
84
+ HeliumBridge.initialize({
85
+ apiKey: config.apiKey,
86
+ fallbackPaywall: viewTag,
87
+ triggers: config.triggers || [],
88
+ customUserId: config.customUserId || null,
89
+ customAPIEndpoint: config.customAPIEndpoint || null,
90
+ customUserTraits: config.customUserTraits || {
91
+ "exampleUserTrait": "test_value"
92
+ }
93
+ }, {});
94
+ };
95
+
96
+ // Update the other methods to be synchronous
97
+ export const presentUpsell = triggerName => {
98
+ HeliumBridge.presentUpsell(triggerName);
99
+ };
100
+ export const hideUpsell = () => {
101
+ HeliumBridge.hideUpsell();
102
+ };
103
+
104
+ // Update the UpsellView component to handle the style prop
105
+ export const UpsellView = ({
106
+ trigger,
107
+ style
108
+ }) => {
109
+ const NativeView = getNativeHeliumUpsellView();
110
+ return /*#__PURE__*/_jsx(NativeView, {
111
+ trigger: trigger,
112
+ style: [{
113
+ flex: 1
114
+ }, style]
115
+ });
116
+ };
117
+ //# sourceMappingURL=native-interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["findNodeHandle","NativeModules","View","NativeEventEmitter","requireNativeComponent","React","createRef","useEffect","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","HeliumBridge","heliumEventEmitter","isProviderMounted","NativeHeliumUpsellView","getNativeHeliumUpsellView","fallbackRef","HeliumProvider","children","fallbackView","FallbackView","ref","style","position","opacity","width","height","overflow","collapsable","initialize","heliumCallbacks","config","Error","viewTag","current","addListener","event","status","makePurchase","productId","handlePurchaseResponse","transactionId","success","restorePurchases","handleRestoreResponse","onHeliumPaywallEvent","apiKey","fallbackPaywall","triggers","customUserId","customAPIEndpoint","customUserTraits","presentUpsell","triggerName","hideUpsell","UpsellView","trigger","NativeView","flex"],"sourceRoot":"../../src","sources":["native-interface.tsx"],"mappings":";;AAAA,SAASA,cAAc,EAAEC,aAAa,EAAEC,IAAI,EAAEC,kBAAkB,EAAEC,sBAAsB,QAAQ,cAAc;AAC9G,OAAOC,KAAK,IAAIC,S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AAgB,EAAEpB,MAAM,CAACoB,gBAAgB,IAAI;MAC3C,kBAAkB,EAAE;IACtB;EACF,CAAC,EACD,CAAC,CACH,CAAC;AACH,CAAC;;AAED;AACA,OAAO,MAAMC,aAAa,GAAIC,WAAmB,IAAK;EACpD1C,YAAY,CAACyC,aAAa,CAACC,WAAW,CAAC;AACzC,CAAC;AAED,OAAO,MAAMC,UAAU,GAAGA,CAAA,KAAM;EAC9B3C,YAAY,CAAC2C,UAAU,CAAC,CAAC;AAC3B,CAAC;;AAED;AACA,OAAO,MAAMC,UAA2C,GAAGA,CAAC;EAAEC,OAAO;EAAElC;AAAM,CAAC,KAAK;EACjF,MAAMmC,UAAU,GAAG1C,yBAAyB,CAAC,CAAC;EAC9C,oBACET,IAAA,CAACmD,UAAU;IACTD,OAAO,EAAEA,OAAQ;IACjBlC,KAAK,EAAE,CAAC;MAAEoC,IAAI,EAAE;IAAE,CAAC,EAAEpC,KAAK;EAAE,CAC7B,CAAC;AAEN,CAAC","ignoreList":[]}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ // Update the implementation
4
+ export class DemoHeliumCallbacks {
5
+ events = [];
6
+ async makePurchase(productId) {
7
+ this.events.push({
8
+ timestamp: new Date(),
9
+ event: {
10
+ type: 'purchase',
11
+ productId
12
+ }
13
+ });
14
+ return 'completed';
15
+ }
16
+ async restorePurchases() {
17
+ this.events.push({
18
+ timestamp: new Date(),
19
+ event: {
20
+ type: 'restore'
21
+ }
22
+ });
23
+ return true;
24
+ }
25
+ onHeliumPaywallEvent(event) {
26
+ this.events.push({
27
+ timestamp: new Date(),
28
+ event
29
+ });
30
+ }
31
+ getCustomVariableValues = () => {
32
+ console.log('getCustomVariableValues called');
33
+ return {
34
+ exampleVar1: 'value1',
35
+ exampleVar2: 'value2'
36
+ };
37
+ };
38
+ getEventHistory() {
39
+ return this.events;
40
+ }
41
+ }
42
+ //# sourceMappingURL=purchase-handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DemoHeliumCallbacks","events","makePurchase","productId","push","timestamp","Date","event","type","restorePurchases","onHeliumPaywallEvent","getCustomVariableValues","console","log","exampleVar1","exampleVar2","getEventHistory"],"sourceRoot":"../../src","sources":["purchase-handlers.ts"],"mappings":";;AASE;AACA,OAAO,MAAMA,mBAAmB,CAA4B;EAClDC,MAAM,GAAsC,EAAE;EAEtD,MAAMC,YAAYA,CAACC,SAAiB,EAAoC;IACtE,IAAI,CAACF,MAAM,CAACG,IAAI,CAAC;MAAEC,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC;MAAEC,KAAK,EAAE;QAAEC,IAAI,EAAE,UAAU;QAAEL;MAAU;IAAE,CAAC,CAAC;IACnF,OAAO,WAAW;EACpB;EAEA,MAAMM,gBAAgBA,CAAA,EAAqB;IACzC,IAAI,CAACR,MAAM,CAACG,IAAI,CAAC;MAAEC,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC;MAAEC,KAAK,EAAE;QAAEC,IAAI,EAAE;MAAU;IAAE,CAAC,CAAC;IACvE,OAAO,IAAI;EACb;EAEAE,oBAAoBA,CAACH,KAAU,EAAQ;IACrC,IAAI,CAACN,MAAM,CAACG,IAAI,CAAC;MAAEC,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC;MAAEC;IAAM,CAAC,CAAC;EACpD;EAEAI,uBAAuB,GAAGA,CAAA,KAA2B;IACnDC,OAAO,CAACC,GAAG,CAAC,gCAAgC,CAAC;IAC7C,OAAO;MACLC,WAAW,EAAE,QAAQ;MACrBC,WAAW,EAAE;IACf,CAAC;EACH,CAAC;EAEDC,eAAeA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACf,MAAM;EACpB;AACF","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,3 @@
1
+ export { HeliumProvider, initialize, presentUpsell, hideUpsell, UpsellView } from './native-interface';
2
+ export type { HeliumTransactionStatus, HeliumCallbacks, HeliumConfig, HeliumUpsellViewProps } from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACvG,YAAY,EAAE,uBAAuB,EAAE,eAAe,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { HeliumCallbacks, HeliumConfig, HeliumUpsellViewProps } from './types';
3
+ interface HeliumProviderProps {
4
+ children: React.ReactNode;
5
+ fallbackView: React.ComponentType;
6
+ }
7
+ export declare const HeliumProvider: ({ children, fallbackView: FallbackView }: HeliumProviderProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const initialize: (heliumCallbacks: HeliumCallbacks, config?: Partial<HeliumConfig>) => void;
9
+ export declare const presentUpsell: (triggerName: string) => void;
10
+ export declare const hideUpsell: () => void;
11
+ export declare const UpsellView: React.FC<HeliumUpsellViewProps>;
12
+ export {};
13
+ //# sourceMappingURL=native-interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-interface.d.ts","sourceRoot":"","sources":["../../../../src/native-interface.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAgBpF,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,EAAE,KAAK,CAAC,aAAa,CAAC;CACnC;AAMD,eAAO,MAAM,cAAc,6CAA8C,mBAAmB,4CA2B3F,CAAC;AAGF,eAAO,MAAM,UAAU,oBAAqB,eAAe,WAAU,OAAO,CAAC,YAAY,CAAC,SAwDzF,CAAC;AAGF,eAAO,MAAM,aAAa,gBAAiB,MAAM,SAEhD,CAAC;AAEF,eAAO,MAAM,UAAU,YAEtB,CAAC;AAGF,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAQtD,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { HeliumTransactionStatus } from './types';
2
+ export interface HeliumCallbacks {
3
+ makePurchase: (productId: string) => Promise<string>;
4
+ restorePurchases: () => Promise<boolean>;
5
+ onHeliumPaywallEvent: (event: any) => void;
6
+ getCustomVariableValues: () => Record<string, any>;
7
+ }
8
+ export declare class DemoHeliumCallbacks implements HeliumCallbacks {
9
+ private events;
10
+ makePurchase(productId: string): Promise<HeliumTransactionStatus>;
11
+ restorePurchases(): Promise<boolean>;
12
+ onHeliumPaywallEvent(event: any): void;
13
+ getCustomVariableValues: () => Record<string, any>;
14
+ getEventHistory(): {
15
+ timestamp: Date;
16
+ event: any;
17
+ }[];
18
+ }
19
+ //# sourceMappingURL=purchase-handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"purchase-handlers.d.ts","sourceRoot":"","sources":["../../../../src/purchase-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD,MAAM,WAAW,eAAe;IAC5B,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,gBAAgB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,oBAAoB,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAC3C,uBAAuB,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACpD;AAGD,qBAAa,mBAAoB,YAAW,eAAe;IACzD,OAAO,CAAC,MAAM,CAAyC;IAEjD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAKjE,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;IAK1C,oBAAoB,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;IAItC,uBAAuB,QAAO,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAM/C;IAEF,eAAe;mBAxBc,IAAI;eAAS,GAAG;;CA2B9C"}
@@ -0,0 +1,19 @@
1
+ export type HeliumTransactionStatus = 'completed' | 'failed' | 'cancelled' | 'pending' | 'restored';
2
+ export interface HeliumCallbacks {
3
+ makePurchase: (productId: string) => Promise<HeliumTransactionStatus>;
4
+ restorePurchases: () => Promise<boolean>;
5
+ onHeliumPaywallEvent: (event: any) => void;
6
+ }
7
+ export interface HeliumConfig {
8
+ apiKey: string;
9
+ fallbackView?: number;
10
+ triggers?: string[];
11
+ customUserId?: string;
12
+ customAPIEndpoint?: string;
13
+ customUserTraits?: Record<string, any>;
14
+ }
15
+ export interface HeliumUpsellViewProps {
16
+ trigger: string;
17
+ style?: any;
18
+ }
19
+ //# sourceMappingURL=types.d.ts.map