Skip to content

Commit 4cb7f16

Browse files
authored
Merge pull request #29 from contentpass/chore-pass-planId-in-authorize
Pass plan id in authorize
2 parents b6eef93 + d863822 commit 4cb7f16

File tree

7 files changed

+11
-16
lines changed

7 files changed

+11
-16
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ npx expo prebuild
3737

3838
### Initialization
3939
Wrap your app's root component with ContentpassSdkProvider. The provider requires a configuration object (contentpassConfig) with the following properties:
40-
- `propertyId` - Your unique property ID
40+
- `propertyId` - Your unique property ID (ask Contentpass team for details)
41+
- `planId` - The ID of the plan you want to check the user's subscription status against (ask Contentpass team for details)
4142
- `issuer` - The OAuth 2.0 server URL (e.g. `https://my.contentpass.net`)
4243
- `redirectUrl` - the redirect URL of your app to which the OAuth2 server will redirect after the authentication
4344

@@ -47,7 +48,8 @@ import React from 'react';
4748
import { ContentpassSdkProvider } from '@contentpass/react-native-contentpass';
4849

4950
const contentpassConfig = {
50-
propertyId: 'your-property-id',
51+
propertyId: 'property-id',
52+
planId: 'plan-id',
5153
issuer: 'https://my.contentpass.net',
5254
redirectUrl: 'com.yourapp://oauthredirect',
5355
};

docs/SOURCEPOINT_SDK_INTEGRATION.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,3 @@ const App = () => {
110110
)
111111
}
112112
```
113-
114-
## Troubleshooting
115-
While integrating the Contentpass SDK with Sourcepoint SDK (version `0.3.0`), you may encounter known issues. Pull requests
116-
addressing these issues have been submitted in the [Sourcepoint GitHub repository](https://github.com/SourcePointUSA/react-native-sourcepoint-cmp):
117-
- [PR #10](https://github.com/SourcePointUSA/react-native-sourcepoint-cmp/pull/10)
118-
- [PR #11](https://github.com/SourcePointUSA/react-native-sourcepoint-cmp/pull/11)
119-
120-
### Temporary Fixes
121-
If these fixes are not yet available in the latest version of the SDK, you can patch node_modules in your project using
122-
tools like `yarn patch` or similar. The patch files can be found here:
123-
- 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)
124-
- 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)
125-
126-
We hope these issues will be resolved in the next release of the Sourcepoint SDK, eliminating the need for manual patches.

sharedExample/src/contentpassConfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import type { ContentpassConfig } from '@contentpass/react-native-contentpass';
33
export const contentpassConfig: ContentpassConfig = {
44
// Testing app
55
propertyId: 'cc3fc4ad-cbe5-4d09-bf85-a49796603b19',
6+
planId: 'a4721db5-67df-4145-bbbf-cbd09f7e0397',
67
issuer: 'https://my.contentpass.dev',
78
// Staging app
89
// propertyId: '78da2fd3-8b25-4642-b7b7-4a0193d00f89',
10+
// planId: '50abfd7f-8a5d-43c9-8a8c-0cb4b0cefe96',
911
// issuer: 'https://my.contentpass.io',
1012

1113
redirectUrl: 'de.contentpass.demo://oauth',

src/Contentpass.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import * as SentryIntegrationModule from './sentryIntegration';
1111

1212
const config: ContentpassConfig = {
1313
propertyId: 'propertyId-1',
14+
planId: 'planId-1',
1415
redirectUrl: 'de.test.net://oauth',
1516
issuer: 'https://issuer.net',
1617
};
@@ -159,6 +160,7 @@ describe('Contentpass', () => {
159160
expect(authorizeSpy).toHaveBeenCalledWith({
160161
additionalParameters: {
161162
cp_property: 'propertyId-1',
163+
cp_plan: 'planId-1',
162164
cp_route: 'login',
163165
prompt: 'consent',
164166
},

src/Contentpass.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export default class Contentpass {
5050
cp_route: 'login',
5151
prompt: 'consent',
5252
cp_property: this.config.propertyId,
53+
cp_plan: this.config.planId,
5354
},
5455
});
5556
} catch (err: any) {

src/sdkContext/ContentpassSdkProvder.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ describe('ContentpassSdkProvider', () => {
1010
const mockConfig: ContentpassConfig = {
1111
issuer: 'https://my.contentpass.me',
1212
propertyId: 'my-property-id',
13+
planId: 'my-plan-id',
1314
redirectUrl: 'de.contentpass.test://oauth',
1415
};
1516

src/types/ContentpassConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
export type ContentpassConfig = {
44
propertyId: string;
5+
planId: string;
56
redirectUrl: string;
67
issuer: string;
78
};

0 commit comments

Comments
 (0)