Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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',
};
Expand Down
14 changes: 0 additions & 14 deletions docs/SOURCEPOINT_SDK_INTEGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions sharedExample/src/contentpassConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions src/Contentpass.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};
Expand Down Expand Up @@ -159,6 +160,7 @@ describe('Contentpass', () => {
expect(authorizeSpy).toHaveBeenCalledWith({
additionalParameters: {
cp_property: 'propertyId-1',
cp_plan: 'planId-1',
cp_route: 'login',
prompt: 'consent',
},
Expand Down
1 change: 1 addition & 0 deletions src/Contentpass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/sdkContext/ContentpassSdkProvder.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};

Expand Down
1 change: 1 addition & 0 deletions src/types/ContentpassConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export type ContentpassConfig = {
propertyId: string;
planId: string;
redirectUrl: string;
issuer: string;
};