@revenuecat/purchases-capacitor-ui 11.2.16 → 11.3.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/Package.swift ADDED
@@ -0,0 +1,26 @@
1
+ // swift-tools-version: 5.9
2
+ import PackageDescription
3
+
4
+ let package = Package(
5
+ name: "RevenuecatPurchasesCapacitorUi",
6
+ platforms: [.iOS(.v14)],
7
+ products: [
8
+ .library(
9
+ name: "RevenuecatPurchasesCapacitorUi",
10
+ targets: ["RevenuecatPurchasesCapacitorUi"])
11
+ ],
12
+ dependencies: [
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"),
14
+ .package(url: "https://github.com/RevenueCat/purchases-hybrid-common.git", exact: "17.21.0")
15
+ ],
16
+ targets: [
17
+ .target(
18
+ name: "RevenuecatPurchasesCapacitorUi",
19
+ dependencies: [
20
+ .product(name: "Capacitor", package: "capacitor-swift-pm"),
21
+ .product(name: "Cordova", package: "capacitor-swift-pm"),
22
+ .product(name: "PurchasesHybridCommonUI", package: "purchases-hybrid-common")
23
+ ],
24
+ path: "ios/Sources/RevenuecatPurchasesCapacitorUI")
25
+ ]
26
+ )
@@ -10,9 +10,9 @@ Pod::Spec.new do |s|
10
10
  s.homepage = package['repository']['url']
11
11
  s.author = package['author']
12
12
  s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
- s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
13
+ s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
14
  s.ios.deployment_target = '15.0'
15
15
  s.dependency 'Capacitor'
16
- s.dependency 'PurchasesHybridCommonUI', '17.21.0'
16
+ s.dependency 'PurchasesHybridCommonUI', '17.23.0'
17
17
  s.swift_version = '5.1'
18
18
  end
@@ -51,6 +51,6 @@ repositories {
51
51
  dependencies {
52
52
  implementation project(':capacitor-android')
53
53
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
54
- implementation 'com.revenuecat.purchases:purchases-hybrid-common-ui:17.21.0'
54
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common-ui:17.23.0'
55
55
  implementation "org.jetbrains.kotlin:kotlin-stdlib:1.8.20"
56
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAS/E,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAI5C;QACE,KAAK,EAAE,CAAC;QAJF,yBAAoB,GAAG,KAAK,CAAC;QAC7B,gCAA2B,GAAG,iDAAiD,CAAC;IAIxF,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,OAA0C;QAChE,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;QACzD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAA+B;QAClD,OAAO,IAAI,CAAC,8BAA8B,CACxC,gBAAgB,EAChB;YACE,MAAM,EAAE,cAAc,CAAC,aAAa;SACrC,EACD,OAAO,CACR,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,sBAAsB,CAAC,OAAsC;QACjE,OAAO,IAAI,CAAC,8BAA8B,CACxC,wBAAwB,EACxB;YACE,MAAM,EAAE,cAAc,CAAC,aAAa;SACrC,EACD,OAAO,CACR,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,qBAAqB;QACzB,OAAO,IAAI,CAAC,iCAAiC,CAAC,uBAAuB,CAAC,CAAC;IACzE,CAAC;IAED,WAAW,CAAC,SAAiB,EAAE,QAAkC;QAC/D,IAAI,SAAS,KAAK,kBAAkB,IAAI,SAAS,KAAK,kBAAkB,EAAE;YACxE,OAAO,CAAC,IAAI,CAAC,sBAAsB,SAAS,EAAE,CAAC,CAAC;SACjD;QACD,OAAO,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAChD,CAAC;IAED,kBAAkB;QAChB,OAAO,KAAK,CAAC,kBAAkB,EAAE,CAAC;IACpC,CAAC;IAEO,iCAAiC,CAAC,YAAoB;QAC5D,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC9B,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;SACzD;QACD,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,4CAA4C,CAAC,CAAC;QACzE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAEO,8BAA8B,CAAI,YAAoB,EAAE,WAAc,EAAE,OAAa;QAC3F,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC9B,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;SACzD;QACD,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,6DAA6D,EAAE,OAAO,CAAC,CAAC;QACnG,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { PluginListenerHandle } from '@capacitor/core';\nimport { PAYWALL_RESULT } from '@revenuecat/purchases-typescript-internal-esm';\n\nimport type {\n PaywallResult,\n PresentPaywallIfNeededOptions,\n PresentPaywallOptions,\n RevenueCatUIPlugin,\n} from './definitions';\n\nexport class RevenueCatUIWeb extends WebPlugin implements RevenueCatUIPlugin {\n private shouldMockWebResults = false;\n private webNotSupportedErrorMessage = 'RevenueCatUI is not supported on web platforms.';\n\n constructor() {\n super();\n }\n\n async setMockWebResults(options: { shouldMockWebResults: boolean }): Promise<void> {\n this.shouldMockWebResults = options.shouldMockWebResults;\n return Promise.resolve();\n }\n\n async presentPaywall(options?: PresentPaywallOptions): Promise<PaywallResult> {\n return this.mockReturningFunctionIfEnabled(\n 'presentPaywall',\n {\n result: PAYWALL_RESULT.NOT_PRESENTED,\n },\n options,\n );\n }\n\n async presentPaywallIfNeeded(options: PresentPaywallIfNeededOptions): Promise<PaywallResult> {\n return this.mockReturningFunctionIfEnabled(\n 'presentPaywallIfNeeded',\n {\n result: PAYWALL_RESULT.NOT_PRESENTED,\n },\n options,\n );\n }\n\n async presentCustomerCenter(): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('presentCustomerCenter');\n }\n\n addListener(eventName: string, listener: (...args: any[]) => void): Promise<PluginListenerHandle> {\n if (eventName !== 'paywallDisplayed' && eventName !== 'paywallDismissed') {\n console.warn(`Unsupported event: ${eventName}`);\n }\n return super.addListener(eventName, listener);\n }\n\n removeAllListeners(): Promise<void> {\n return super.removeAllListeners();\n }\n\n private mockNonReturningFunctionIfEnabled(functionName: string): Promise<void> {\n if (!this.shouldMockWebResults) {\n return Promise.reject(this.webNotSupportedErrorMessage);\n }\n console.log(`${functionName} called on web with mocking enabled. No-op`);\n return Promise.resolve();\n }\n\n private mockReturningFunctionIfEnabled<T>(functionName: string, returnValue: T, options?: any): Promise<T> {\n if (!this.shouldMockWebResults) {\n return Promise.reject(this.webNotSupportedErrorMessage);\n }\n console.log(`${functionName} called on web with mocking enabled. Returning mocked value`, options);\n return Promise.resolve(returnValue);\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAS/E,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAI5C;QACE,KAAK,EAAE,CAAC;QAJF,yBAAoB,GAAG,KAAK,CAAC;QAC7B,gCAA2B,GAAG,iDAAiD,CAAC;IAIxF,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,OAA0C;QAChE,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC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AAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,6DAA6D,EAAE,OAAO,CAAC,CAAC;QACnG,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { PluginListenerHandle } from '@capacitor/core';\nimport { PAYWALL_RESULT } from '@revenuecat/purchases-typescript-internal-esm';\n\nimport type {\n PaywallResult,\n PresentPaywallIfNeededOptions,\n PresentPaywallOptions,\n RevenueCatUIPlugin,\n} from './definitions';\n\nexport class RevenueCatUIWeb extends WebPlugin implements RevenueCatUIPlugin {\n private shouldMockWebResults = false;\n private webNotSupportedErrorMessage = 'RevenueCatUI is not supported on web platforms.';\n\n constructor() {\n super();\n }\n\n async setMockWebResults(options: { shouldMockWebResults: boolean }): Promise<void> {\n this.shouldMockWebResults = options.shouldMockWebResults;\n return Promise.resolve();\n }\n\n async presentPaywall(options?: PresentPaywallOptions): Promise<PaywallResult> {\n return this.mockReturningFunctionIfEnabled(\n 'presentPaywall',\n {\n result: PAYWALL_RESULT.NOT_PRESENTED,\n },\n options,\n );\n }\n\n async presentPaywallIfNeeded(options: PresentPaywallIfNeededOptions): Promise<PaywallResult> {\n return this.mockReturningFunctionIfEnabled(\n 'presentPaywallIfNeeded',\n {\n result: PAYWALL_RESULT.NOT_PRESENTED,\n },\n options,\n );\n }\n\n async presentCustomerCenter(): Promise<void> {\n return this.mockNonReturningFunctionIfEnabled('presentCustomerCenter');\n }\n\n addListener(eventName: string, listener: (...args: any[]) => void): Promise<PluginListenerHandle> {\n if (eventName !== 'paywallDisplayed' && eventName !== 'paywallDismissed') {\n console.warn(`Unsupported event: ${eventName}`);\n }\n return super.addListener(eventName, listener);\n }\n\n removeAllListeners(): Promise<void> {\n return super.removeAllListeners();\n }\n\n private mockNonReturningFunctionIfEnabled(functionName: string): Promise<void> {\n if (!this.shouldMockWebResults) {\n return Promise.reject(this.webNotSupportedErrorMessage);\n }\n console.log(`${functionName} called on web with mocking enabled. No-op`);\n return Promise.resolve();\n }\n\n private mockReturningFunctionIfEnabled<T>(functionName: string, returnValue: T, options?: any): Promise<T> {\n if (!this.shouldMockWebResults) {\n return Promise.reject(this.webNotSupportedErrorMessage);\n }\n console.log(`${functionName} called on web with mocking enabled. Returning mocked value`, options);\n return Promise.resolve(returnValue);\n }\n}\n"]}
@@ -7,7 +7,14 @@ import PurchasesHybridCommonUI
7
7
  * Based on the official RevenueCat Flutter UI SDK approach
8
8
  */
9
9
  @objc(RevenueCatUIPlugin)
10
- public class RevenueCatUIPlugin: CAPPlugin {
10
+ public class RevenueCatUIPlugin: CAPPlugin, CAPBridgedPlugin {
11
+ public let identifier = "RevenueCatUIPlugin"
12
+ public let jsName = "RevenueCatUI"
13
+ public let pluginMethods: [CAPPluginMethod] = [
14
+ CAPPluginMethod(name: "presentPaywall", returnType: CAPPluginReturnPromise),
15
+ CAPPluginMethod(name: "presentPaywallIfNeeded", returnType: CAPPluginReturnPromise),
16
+ CAPPluginMethod(name: "presentCustomerCenter", returnType: CAPPluginReturnPromise),
17
+ ]
11
18
 
12
19
  // MARK: - Properties
13
20
 
@@ -141,6 +148,7 @@ public class RevenueCatUIPlugin: CAPPlugin {
141
148
  }
142
149
  }
143
150
 
151
+ @available(iOS 15.0, *)
144
152
  private extension RevenueCatUIPlugin {
145
153
 
146
154
  func processOfferingOptions(_ call: CAPPluginCall) -> [String: Any]? {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revenuecat/purchases-capacitor-ui",
3
- "version": "11.2.16",
3
+ "version": "11.3.0",
4
4
  "description": "UI components for RevenueCat Capacitor SDK",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -10,8 +10,9 @@
10
10
  "android/src/main/",
11
11
  "android/build.gradle",
12
12
  "dist/",
13
- "ios/Plugin/",
14
- "RevenuecatPurchasesCapacitorUI.podspec"
13
+ "RevenuecatPurchasesCapacitorUI.podspec",
14
+ "ios/Sources",
15
+ "Package.swift"
15
16
  ],
16
17
  "author": "RevenueCat, Inc.",
17
18
  "license": "MIT",
@@ -45,7 +46,8 @@
45
46
  },
46
47
  "scripts": {
47
48
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
48
- "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..",
49
+ "verify:ios": "xcodebuild -scheme RevenuecatPurchasesCapacitorUi -destination generic/platform=iOS && npm run verify:ios:cocoapods",
50
+ "verify:ios:cocoapods": "cd ios/CocoapodsInstallationTest && pod install && xcodebuild -workspace CocoapodsInstallationTest.xcworkspace -scheme CocoapodsInstallationTest -destination 'generic/platform=iOS' CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY=\"\" build",
49
51
  "verify:android": "cd android && ./gradlew clean build test && cd ..",
50
52
  "verify:web": "npm run build",
51
53
  "lint": "npm run eslint && npm run prettier -- --check",
@@ -61,7 +63,7 @@
61
63
  "dependencies": {
62
64
  "@capacitor/core": "^7.0.0",
63
65
  "@revenuecat/purchases-capacitor": "^10.2.4",
64
- "@revenuecat/purchases-typescript-internal-esm": "17.21.0"
66
+ "@revenuecat/purchases-typescript-internal-esm": "17.23.0"
65
67
  },
66
68
  "peerDependencies": {
67
69
  "@capacitor/core": "^7.0.0"
@@ -71,11 +73,12 @@
71
73
  "@capacitor/docgen": "^0.3.0",
72
74
  "@ionic/eslint-config": "^0.4.0",
73
75
  "@ionic/prettier-config": "^4.0.0",
76
+ "@types/node": "^24.0.0",
74
77
  "eslint": "^8.57.0",
75
78
  "prettier": "^3.4.2",
76
79
  "prettier-plugin-java": "^2.6.6",
77
80
  "rimraf": "^6.0.1",
78
81
  "rollup": "^4.30.1",
79
- "typescript": "~4.1.5"
82
+ "typescript": "^5.2.2"
80
83
  }
81
84
  }
@@ -1,10 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
- #import <Capacitor/Capacitor.h>
3
-
4
- // Define the plugin using the CAP_PLUGIN Macro, and
5
- // each method the plugin supports using the CAP_PLUGIN_METHOD macro.
6
- CAP_PLUGIN(RevenueCatUIPlugin, "RevenueCatUI",
7
- CAP_PLUGIN_METHOD(presentPaywall, CAPPluginReturnPromise);
8
- CAP_PLUGIN_METHOD(presentPaywallIfNeeded, CAPPluginReturnPromise);
9
- CAP_PLUGIN_METHOD(presentCustomerCenter, CAPPluginReturnPromise);
10
- )