diff --git a/README.md b/README.md index 7d5bdce..ba02be9 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,8 @@ npx expo prebuild ### Initialization Wrap your app's root component with ContentpassSdkProvider. The provider requires a configuration object (contentpassConfig) with the following properties: -- `propertyId` - Your unique property ID +- `propertyId` - Your unique property ID (ask Contentpass team for details) +- `planId` - The ID of the plan you want to check the user's subscription status against (ask Contentpass team for details) - `issuer` - The OAuth 2.0 server URL (e.g. `https://my.contentpass.net`) - `redirectUrl` - the redirect URL of your app to which the OAuth2 server will redirect after the authentication @@ -47,7 +48,8 @@ import React from 'react'; import { ContentpassSdkProvider } from '@contentpass/react-native-contentpass'; const contentpassConfig = { - propertyId: 'your-property-id', + propertyId: 'property-id', + planId: 'plan-id', issuer: 'https://my.contentpass.net', redirectUrl: 'com.yourapp://oauthredirect', }; diff --git a/docs/SOURCEPOINT_SDK_INTEGRATION.md b/docs/SOURCEPOINT_SDK_INTEGRATION.md index 9323cef..a69bac6 100644 --- a/docs/SOURCEPOINT_SDK_INTEGRATION.md +++ b/docs/SOURCEPOINT_SDK_INTEGRATION.md @@ -110,17 +110,3 @@ const App = () => { ) } ``` - -## Troubleshooting -While integrating the Contentpass SDK with Sourcepoint SDK (version `0.3.0`), you may encounter known issues. Pull requests -addressing these issues have been submitted in the [Sourcepoint GitHub repository](https://github.com/SourcePointUSA/react-native-sourcepoint-cmp): -- [PR #10](https://github.com/SourcePointUSA/react-native-sourcepoint-cmp/pull/10) -- [PR #11](https://github.com/SourcePointUSA/react-native-sourcepoint-cmp/pull/11) - -### Temporary Fixes -If these fixes are not yet available in the latest version of the SDK, you can patch node_modules in your project using -tools like `yarn patch` or similar. The patch files can be found here: -- Patch for [PR #10](https://github.com/SourcePointUSA/react-native-sourcepoint-cmp/pull/10): [@sourcepoint-react-native-cmp-npm-0.3.0-2434c31dc9.patch](./sourcepoint-patches/@sourcepoint-react-native-cmp-npm-0.3.0-2434c31dc9.patch) -- Patch for [PR #11](https://github.com/SourcePointUSA/react-native-sourcepoint-cmp/pull/11): [@sourcepoint-react-native-cmp-patch-34fca36663.patch](./sourcepoint-patches/@sourcepoint-react-native-cmp-patch-34fca36663.patch) - -We hope these issues will be resolved in the next release of the Sourcepoint SDK, eliminating the need for manual patches. diff --git a/sharedExample/src/contentpassConfig.ts b/sharedExample/src/contentpassConfig.ts index 606d83c..ffd0270 100644 --- a/sharedExample/src/contentpassConfig.ts +++ b/sharedExample/src/contentpassConfig.ts @@ -3,9 +3,11 @@ import type { ContentpassConfig } from '@contentpass/react-native-contentpass'; export const contentpassConfig: ContentpassConfig = { // Testing app propertyId: 'cc3fc4ad-cbe5-4d09-bf85-a49796603b19', + planId: 'a4721db5-67df-4145-bbbf-cbd09f7e0397', issuer: 'https://my.contentpass.dev', // Staging app // propertyId: '78da2fd3-8b25-4642-b7b7-4a0193d00f89', + // planId: '50abfd7f-8a5d-43c9-8a8c-0cb4b0cefe96', // issuer: 'https://my.contentpass.io', redirectUrl: 'de.contentpass.demo://oauth', diff --git a/src/Contentpass.test.ts b/src/Contentpass.test.ts index c2e63e3..93cfc0b 100644 --- a/src/Contentpass.test.ts +++ b/src/Contentpass.test.ts @@ -11,6 +11,7 @@ import * as SentryIntegrationModule from './sentryIntegration'; const config: ContentpassConfig = { propertyId: 'propertyId-1', + planId: 'planId-1', redirectUrl: 'de.test.net://oauth', issuer: 'https://issuer.net', }; @@ -159,6 +160,7 @@ describe('Contentpass', () => { expect(authorizeSpy).toHaveBeenCalledWith({ additionalParameters: { cp_property: 'propertyId-1', + cp_plan: 'planId-1', cp_route: 'login', prompt: 'consent', }, diff --git a/src/Contentpass.ts b/src/Contentpass.ts index 413e1d0..eb49913 100644 --- a/src/Contentpass.ts +++ b/src/Contentpass.ts @@ -50,6 +50,7 @@ export default class Contentpass { cp_route: 'login', prompt: 'consent', cp_property: this.config.propertyId, + cp_plan: this.config.planId, }, }); } catch (err: any) { diff --git a/src/sdkContext/ContentpassSdkProvder.test.tsx b/src/sdkContext/ContentpassSdkProvder.test.tsx index f80f8b9..0a41988 100644 --- a/src/sdkContext/ContentpassSdkProvder.test.tsx +++ b/src/sdkContext/ContentpassSdkProvder.test.tsx @@ -10,6 +10,7 @@ describe('ContentpassSdkProvider', () => { const mockConfig: ContentpassConfig = { issuer: 'https://my.contentpass.me', propertyId: 'my-property-id', + planId: 'my-plan-id', redirectUrl: 'de.contentpass.test://oauth', }; diff --git a/src/types/ContentpassConfig.ts b/src/types/ContentpassConfig.ts index 03dacd6..44a080d 100644 --- a/src/types/ContentpassConfig.ts +++ b/src/types/ContentpassConfig.ts @@ -2,6 +2,7 @@ export type ContentpassConfig = { propertyId: string; + planId: string; redirectUrl: string; issuer: string; };