@contentpass/react-native-contentpass 0.3.18 → 0.4.1
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/README.md +109 -79
- package/docs/CONTRIBUTING.md +7 -7
- package/lib/commonjs/Contentpass.js +38 -25
- package/lib/commonjs/Contentpass.js.map +1 -1
- package/lib/commonjs/Contentpass.test.js +455 -0
- package/lib/commonjs/Contentpass.test.js.map +1 -0
- package/lib/commonjs/OidcAuthStateStorage.test.js +59 -0
- package/lib/commonjs/OidcAuthStateStorage.test.js.map +1 -0
- package/lib/commonjs/contentpassTokenUtils/fetchContentpassToken.test.js +45 -0
- package/lib/commonjs/contentpassTokenUtils/fetchContentpassToken.test.js.map +1 -0
- package/lib/commonjs/contentpassTokenUtils/parseContentpassToken.test.js +31 -0
- package/lib/commonjs/contentpassTokenUtils/parseContentpassToken.test.js.map +1 -0
- package/lib/commonjs/contentpassTokenUtils/validateSubscription.test.js +73 -0
- package/lib/commonjs/contentpassTokenUtils/validateSubscription.test.js.map +1 -0
- package/lib/commonjs/countImpressionUtils/sendPageViewEvent.test.js +35 -0
- package/lib/commonjs/countImpressionUtils/sendPageViewEvent.test.js.map +1 -0
- package/lib/commonjs/countImpressionUtils/sendStats.js +1 -1
- package/lib/commonjs/countImpressionUtils/sendStats.js.map +1 -1
- package/lib/commonjs/countImpressionUtils/sendStats.test.js +39 -0
- package/lib/commonjs/countImpressionUtils/sendStats.test.js.map +1 -0
- package/lib/commonjs/index.js +2 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/logger.test.js +42 -0
- package/lib/commonjs/logger.test.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/sdkContext/ContentpassSdkProvder.test.js +33 -0
- package/lib/commonjs/sdkContext/ContentpassSdkProvder.test.js.map +1 -0
- package/lib/commonjs/sdkContext/useContentpassSdk.test.js +37 -0
- package/lib/commonjs/sdkContext/useContentpassSdk.test.js.map +1 -0
- package/lib/commonjs/sdkContext/useContentpassState.js +26 -0
- package/lib/commonjs/sdkContext/useContentpassState.js.map +1 -0
- package/lib/commonjs/sentryIntegration.test.js +131 -0
- package/lib/commonjs/sentryIntegration.test.js.map +1 -0
- package/lib/commonjs/types/CmpAdapter.js +2 -0
- package/lib/commonjs/types/CmpAdapter.js.map +1 -0
- package/lib/module/Contentpass.js +38 -25
- package/lib/module/Contentpass.js.map +1 -1
- package/lib/module/Contentpass.test.js +448 -0
- package/lib/module/Contentpass.test.js.map +1 -0
- package/lib/module/OidcAuthStateStorage.test.js +56 -0
- package/lib/module/OidcAuthStateStorage.test.js.map +1 -0
- package/lib/module/contentpassTokenUtils/fetchContentpassToken.test.js +44 -0
- package/lib/module/contentpassTokenUtils/fetchContentpassToken.test.js.map +1 -0
- package/lib/module/contentpassTokenUtils/parseContentpassToken.test.js +30 -0
- package/lib/module/contentpassTokenUtils/parseContentpassToken.test.js.map +1 -0
- package/lib/module/contentpassTokenUtils/validateSubscription.test.js +70 -0
- package/lib/module/contentpassTokenUtils/validateSubscription.test.js.map +1 -0
- package/lib/module/countImpressionUtils/sendPageViewEvent.test.js +34 -0
- package/lib/module/countImpressionUtils/sendPageViewEvent.test.js.map +1 -0
- package/lib/module/countImpressionUtils/sendStats.js +1 -1
- package/lib/module/countImpressionUtils/sendStats.js.map +1 -1
- package/lib/module/countImpressionUtils/sendStats.test.js +38 -0
- package/lib/module/countImpressionUtils/sendStats.test.js.map +1 -0
- package/lib/module/index.js +6 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/logger.test.js +40 -0
- package/lib/module/logger.test.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/sdkContext/ContentpassSdkProvder.test.js +32 -0
- package/lib/module/sdkContext/ContentpassSdkProvder.test.js.map +1 -0
- package/lib/module/sdkContext/useContentpassSdk.test.js +36 -0
- package/lib/module/sdkContext/useContentpassSdk.test.js.map +1 -0
- package/lib/module/sdkContext/useContentpassState.js +21 -0
- package/lib/module/sdkContext/useContentpassState.js.map +1 -0
- package/lib/module/sentryIntegration.test.js +128 -0
- package/lib/module/sentryIntegration.test.js.map +1 -0
- package/lib/module/types/CmpAdapter.js +2 -0
- package/lib/module/types/CmpAdapter.js.map +1 -0
- package/lib/typescript/commonjs/src/Contentpass.d.ts +8 -5
- package/lib/typescript/commonjs/src/Contentpass.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/countImpressionUtils/sendStats.d.ts +1 -0
- package/lib/typescript/commonjs/src/countImpressionUtils/sendStats.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +11 -6
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/logger.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/sdkContext/ContentpassSdkProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/sdkContext/useContentpassState.d.ts +4 -0
- package/lib/typescript/commonjs/src/sdkContext/useContentpassState.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/sentryIntegration.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/CmpAdapter.d.ts +14 -0
- package/lib/typescript/commonjs/src/types/CmpAdapter.d.ts.map +1 -0
- package/lib/typescript/module/src/Contentpass.d.ts +8 -5
- package/lib/typescript/module/src/Contentpass.d.ts.map +1 -1
- package/lib/typescript/module/src/countImpressionUtils/sendStats.d.ts +1 -0
- package/lib/typescript/module/src/countImpressionUtils/sendStats.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +11 -6
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/logger.d.ts.map +1 -1
- package/lib/typescript/module/src/sdkContext/ContentpassSdkProvider.d.ts.map +1 -1
- package/lib/typescript/module/src/sdkContext/useContentpassState.d.ts +4 -0
- package/lib/typescript/module/src/sdkContext/useContentpassState.d.ts.map +1 -0
- package/lib/typescript/module/src/sentryIntegration.d.ts.map +1 -1
- package/lib/typescript/module/src/types/CmpAdapter.d.ts +14 -0
- package/lib/typescript/module/src/types/CmpAdapter.d.ts.map +1 -0
- package/package.json +24 -59
- package/LICENSE +0 -20
package/README.md
CHANGED
|
@@ -1,150 +1,180 @@
|
|
|
1
1
|
# @contentpass/react-native-contentpass
|
|
2
2
|
|
|
3
|
-
Contentpass React Native
|
|
3
|
+
The core Contentpass SDK for React Native. Handles OAuth 2.0 authentication, subscription validation, and impression tracking for Contentpass-enabled apps.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
|
-
Install the package using npm or Yarn:
|
|
7
6
|
|
|
8
|
-
```
|
|
7
|
+
```bash
|
|
9
8
|
npm install @contentpass/react-native-contentpass
|
|
9
|
+
# or
|
|
10
|
+
yarn add @contentpass/react-native-contentpass
|
|
10
11
|
```
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
### Peer dependencies
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
yarn add @contentpass/react-native-contentpass
|
|
16
|
-
```
|
|
15
|
+
The following peer dependencies must be installed:
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- [react](https://github.com/
|
|
21
|
-
- [react-native](https://github.com/
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
- [react](https://github.com/facebook/react)
|
|
18
|
+
- [react-native](https://github.com/facebook/react-native)
|
|
19
|
+
- [react-native-app-auth](https://github.com/FormidableLabs/react-native-app-auth) — OAuth 2.0 authentication
|
|
20
|
+
- [react-native-encrypted-storage](https://github.com/emeraldsanto/react-native-encrypted-storage) — secure token storage
|
|
21
|
+
|
|
22
|
+
Some peer dependencies require additional native setup. Refer to their official guides:
|
|
24
23
|
|
|
25
|
-
Some dependencies require additional setup in the native code. Refer to their official guides:
|
|
26
24
|
- [react-native-app-auth setup](https://commerce.nearform.com/open-source/react-native-app-auth/docs#setup)
|
|
27
25
|
- [react-native-encrypted-storage setup](https://github.com/emeraldsanto/react-native-encrypted-storage?tab=readme-ov-file#installation)
|
|
28
26
|
|
|
29
27
|
### Expo support
|
|
30
|
-
If you are using Expo, you need to run the following command to enable modifications to the `ios` and `android` directories:
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
If you are using Expo, run the following command to enable native directory modifications:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
33
32
|
npx expo prebuild
|
|
34
33
|
```
|
|
35
34
|
|
|
36
35
|
## Usage
|
|
37
36
|
|
|
38
37
|
### Initialization
|
|
39
|
-
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 (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)
|
|
42
|
-
- `issuer` - The OAuth 2.0 server URL (e.g. `https://my.contentpass.net`)
|
|
43
|
-
- `redirectUrl` - the redirect URL of your app to which the OAuth2 server will redirect after the authentication
|
|
44
|
-
- `samplingRate` - Optional: The rate at which the SDK will send impression events for unauthenticated users. Default is 0.05 (5%)
|
|
45
|
-
- `logLevel` - Optional: The log level for the SDK. By default logger is disabled. Possible values are 'info', 'warn', 'error' and 'debug'
|
|
46
38
|
|
|
39
|
+
Wrap your app's root component with `ContentpassSdkProvider`:
|
|
47
40
|
|
|
48
|
-
```
|
|
49
|
-
import React from 'react';
|
|
41
|
+
```tsx
|
|
50
42
|
import { ContentpassSdkProvider } from '@contentpass/react-native-contentpass';
|
|
51
43
|
|
|
52
44
|
const contentpassConfig = {
|
|
53
45
|
propertyId: 'property-id',
|
|
54
46
|
planId: 'plan-id',
|
|
55
47
|
issuer: 'https://my.contentpass.net',
|
|
48
|
+
apiUrl: 'https://api.contentpass.net',
|
|
56
49
|
redirectUrl: 'com.yourapp://oauthredirect',
|
|
57
|
-
samplingRate: 0.1,
|
|
58
|
-
logLevel: 'info'
|
|
50
|
+
samplingRate: 0.1, // optional, default 0.05
|
|
51
|
+
logLevel: 'info', // optional, default disabled
|
|
59
52
|
};
|
|
60
53
|
|
|
61
|
-
|
|
54
|
+
export default function App() {
|
|
62
55
|
return (
|
|
63
56
|
<ContentpassSdkProvider contentpassConfig={contentpassConfig}>
|
|
64
57
|
<YourApp />
|
|
65
58
|
</ContentpassSdkProvider>
|
|
66
59
|
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export default App;
|
|
60
|
+
}
|
|
70
61
|
```
|
|
71
62
|
|
|
72
|
-
###
|
|
73
|
-
The SDK exposes the following methods through the `useContentpassSdk` hook:
|
|
74
|
-
|
|
75
|
-
### authenticate
|
|
76
|
-
Initiates the OAuth 2.0 authentication process via a modal interface. It validates the user’s active Contentpass subscriptions
|
|
77
|
-
upon successful authentication.
|
|
78
|
-
|
|
79
|
-
### countImpression
|
|
80
|
-
Tracks and increments the impression count for the current user. This method should be invoked whenever a user views a
|
|
81
|
-
piece of content. It applies to all users, whether authenticated or unauthenticated.
|
|
63
|
+
### Configuration
|
|
82
64
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
65
|
+
| Property | Type | Required | Description |
|
|
66
|
+
|----------|------|----------|-------------|
|
|
67
|
+
| `propertyId` | `string` | Yes | Your unique property ID (provided by Contentpass). |
|
|
68
|
+
| `planId` | `string` | Yes | The plan ID to check subscriptions against (provided by Contentpass). |
|
|
69
|
+
| `issuer` | `string` | Yes | The OAuth 2.0 server URL (e.g. `https://my.contentpass.net`). |
|
|
70
|
+
| `apiUrl` | `string` | Yes | The Contentpass API base URL. |
|
|
71
|
+
| `redirectUrl` | `string` | Yes | The deep-link URL your app registers for OAuth redirects. |
|
|
72
|
+
| `samplingRate` | `number` | No | Rate at which impression events are sent for unauthenticated users. Default `0.05` (5%). |
|
|
73
|
+
| `logLevel` | `'debug' \| 'info' \| 'warn' \| 'error'` | No | SDK log level. Logging is disabled by default. |
|
|
86
74
|
|
|
87
|
-
###
|
|
88
|
-
Unregisters a previously registered observer. The observer will no longer receive updates.
|
|
89
|
-
|
|
90
|
-
### logout
|
|
91
|
-
Logs the user out by clearing all stored authentication tokens.
|
|
75
|
+
### SDK methods
|
|
92
76
|
|
|
93
|
-
|
|
94
|
-
During background token refresh, an error state may occur due to poor or no internet connection. This is indicated by the
|
|
95
|
-
`state` switching to `ERROR`. The state object includes a reference to the original exception that was thrown. As the SDK
|
|
96
|
-
does not monitor the device's connection state, you must notify the SDK when the network connection has been reestablished
|
|
97
|
-
or improved. The SDK will then refresh and revalidate the user's authentication tokens.
|
|
77
|
+
Access the SDK via the `useContentpassSdk` hook:
|
|
98
78
|
|
|
99
|
-
```
|
|
100
|
-
import React, { useEffect } from 'react';
|
|
79
|
+
```tsx
|
|
101
80
|
import { useContentpassSdk } from '@contentpass/react-native-contentpass';
|
|
102
|
-
import { Button, View } from 'react-native';
|
|
103
81
|
|
|
104
|
-
|
|
82
|
+
function MyComponent() {
|
|
105
83
|
const {
|
|
106
84
|
authenticate,
|
|
107
85
|
countImpression,
|
|
108
86
|
registerObserver,
|
|
109
87
|
unregisterObserver,
|
|
110
88
|
logout,
|
|
111
|
-
recoverFromError
|
|
89
|
+
recoverFromError,
|
|
90
|
+
event,
|
|
112
91
|
} = useContentpassSdk();
|
|
113
92
|
|
|
93
|
+
// ...
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
#### `authenticate(route?)`
|
|
98
|
+
|
|
99
|
+
Initiates the OAuth 2.0 authentication flow via a modal interface. Validates the user's active Contentpass subscription upon success.
|
|
100
|
+
|
|
101
|
+
- `route` (optional): `'login'` or `'signup'` to pre-select the auth screen.
|
|
102
|
+
|
|
103
|
+
#### `countImpression()`
|
|
104
|
+
|
|
105
|
+
Tracks an impression for the current user. Call this whenever a user views a piece of content. Applies to both authenticated and unauthenticated users (subject to `samplingRate` for unauthenticated users).
|
|
106
|
+
|
|
107
|
+
#### `registerObserver(observer)`
|
|
108
|
+
|
|
109
|
+
Registers a callback that fires whenever the authentication/subscription state changes. The callback receives a `ContentpassState` object.
|
|
110
|
+
|
|
111
|
+
#### `unregisterObserver(observer)`
|
|
112
|
+
|
|
113
|
+
Removes a previously registered observer.
|
|
114
|
+
|
|
115
|
+
#### `logout()`
|
|
116
|
+
|
|
117
|
+
Logs the user out by clearing all stored authentication tokens.
|
|
118
|
+
|
|
119
|
+
#### `recoverFromError()`
|
|
120
|
+
|
|
121
|
+
When a background token refresh fails (e.g. due to network issues), the state transitions to `ERROR`. Call this method once connectivity is restored to retry token validation.
|
|
122
|
+
|
|
123
|
+
#### `event(eventCategory, eventAction, eventLabel?, samplingRate?)`
|
|
124
|
+
|
|
125
|
+
Sends a custom analytics event to Contentpass.
|
|
126
|
+
|
|
127
|
+
### State types
|
|
128
|
+
|
|
129
|
+
The observer callback receives one of the following states:
|
|
130
|
+
|
|
131
|
+
| State | `hasValidSubscription` | Description |
|
|
132
|
+
|-------|------------------------|-------------|
|
|
133
|
+
| `INITIALISING` | — | SDK is starting up and restoring any stored session. |
|
|
134
|
+
| `UNAUTHENTICATED` | `false` | No user is logged in. |
|
|
135
|
+
| `AUTHENTICATED` | `boolean` | User is logged in. `hasValidSubscription` indicates whether they have an active plan. |
|
|
136
|
+
| `ERROR` | — | A background token refresh failed. Contains an `error` property with the original exception. |
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
import {
|
|
140
|
+
ContentpassStateType,
|
|
141
|
+
useContentpassSdk,
|
|
142
|
+
} from '@contentpass/react-native-contentpass';
|
|
143
|
+
import { useEffect } from 'react';
|
|
144
|
+
|
|
145
|
+
function MyComponent() {
|
|
146
|
+
const { registerObserver, unregisterObserver } = useContentpassSdk();
|
|
147
|
+
|
|
114
148
|
useEffect(() => {
|
|
115
149
|
const observer = (state) => {
|
|
116
|
-
|
|
150
|
+
switch (state.state) {
|
|
151
|
+
case ContentpassStateType.AUTHENTICATED:
|
|
152
|
+
console.log('Subscription active:', state.hasValidSubscription);
|
|
153
|
+
break;
|
|
154
|
+
case ContentpassStateType.ERROR:
|
|
155
|
+
console.error('SDK error:', state.error);
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
117
158
|
};
|
|
118
159
|
|
|
119
160
|
registerObserver(observer);
|
|
161
|
+
return () => unregisterObserver(observer);
|
|
162
|
+
}, [registerObserver, unregisterObserver]);
|
|
163
|
+
}
|
|
164
|
+
```
|
|
120
165
|
|
|
121
|
-
|
|
122
|
-
unregisterObserver(observer);
|
|
123
|
-
};
|
|
124
|
-
}, []);
|
|
166
|
+
### CMP adapter interface
|
|
125
167
|
|
|
126
|
-
|
|
127
|
-
<View>
|
|
128
|
-
<Button onPress={authenticate} title={'Authenticate'} />
|
|
129
|
-
<Button onPress={countImpression} title={'Count Impression'} />
|
|
130
|
-
</View>
|
|
131
|
-
);
|
|
132
|
-
};
|
|
133
|
-
```
|
|
168
|
+
This package also exports the `CmpAdapter` type, which defines the interface that consent management platform adapters must implement to work with Contentpass. See [`@contentpass/react-native-contentpass-cmp-onetrust`](../react-native-contentpass-cmp-onetrust) for a ready-made OneTrust adapter.
|
|
134
169
|
|
|
135
170
|
## Integration with Sourcepoint SDK
|
|
136
171
|
|
|
137
|
-
See the [Sourcepoint SDK
|
|
172
|
+
See the [Sourcepoint SDK integration guide](./docs/SOURCEPOINT_SDK_INTEGRATION.md).
|
|
138
173
|
|
|
139
174
|
## Contributing
|
|
140
175
|
|
|
141
|
-
See the [contributing guide](docs/CONTRIBUTING.md)
|
|
142
|
-
|
|
176
|
+
See the [contributing guide](./docs/CONTRIBUTING.md).
|
|
143
177
|
|
|
144
178
|
## License
|
|
145
179
|
|
|
146
180
|
MIT
|
|
147
|
-
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
package/docs/CONTRIBUTING.md
CHANGED
|
@@ -41,18 +41,18 @@ yarn
|
|
|
41
41
|
|
|
42
42
|
> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development.
|
|
43
43
|
|
|
44
|
-
The [example app](/example/) and [expo example app](/expoExample/) demonstrates usage of the library. You need to run it to test any changes you make.
|
|
45
|
-
The default [configuration](
|
|
44
|
+
The [example app](/examples/example/) and [expo example app](/examples/expoExample/) demonstrates usage of the library. You need to run it to test any changes you make.
|
|
45
|
+
The default [configuration](../../../examples/sharedExample/src/contentpassConfig.ts) in example apps points to contentpass testing environment.
|
|
46
46
|
You can change it to any other environment by updating the `contentpassConfig.ts` file.
|
|
47
47
|
|
|
48
48
|
It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example apps.
|
|
49
49
|
Changes to the library's JavaScript code will be reflected in the example apps without a rebuild, but native code changes will require a rebuild of the example app.
|
|
50
50
|
|
|
51
51
|
If you want to use Android Studio or XCode to edit the native code, you can open the
|
|
52
|
-
- `example/android`
|
|
53
|
-
- `example/ios`
|
|
54
|
-
- `expoExample/android`
|
|
55
|
-
- `expoExample/ios`
|
|
52
|
+
- `examples/example/android`
|
|
53
|
+
- `examples/example/ios`
|
|
54
|
+
- `examples/expoExample/android`
|
|
55
|
+
- `examples/expoExample/ios`
|
|
56
56
|
directories respectively in those editors. To edit the Objective-C or Swift files, open `ios/ContentpassExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > contentpass-react-native-contentpass`.
|
|
57
57
|
|
|
58
58
|
To edit the Java or Kotlin files, open `android` in Android studio and find the source files at `@contentpass/react-native-contentpass` under `Android`.
|
|
@@ -88,7 +88,7 @@ yarn expo-example android
|
|
|
88
88
|
|
|
89
89
|
To run the example apps on iOS:
|
|
90
90
|
|
|
91
|
-
**NOTE**: You need to run `bundle install` in the `example/ios` directory before running the following command.
|
|
91
|
+
**NOTE**: You need to run `bundle install` in the `examples/example/ios` directory before running the following command.
|
|
92
92
|
`bundle install` commands is responsible for installing the required dependencies for the iOS project.
|
|
93
93
|
|
|
94
94
|
```sh
|
|
@@ -31,6 +31,8 @@ class Contentpass {
|
|
|
31
31
|
if (config.logLevel) {
|
|
32
32
|
(0, _logger.enableLogger)(config.logLevel);
|
|
33
33
|
}
|
|
34
|
+
this.config = config;
|
|
35
|
+
this.instanceId = _reactNativeUuid.default.v4();
|
|
34
36
|
_logger.default.debug('Contentpass initialised with config', config);
|
|
35
37
|
if (config.samplingRate && (config.samplingRate < 0 || config.samplingRate > 1)) {
|
|
36
38
|
_logger.default.error('Sampling rate must be between 0 and 1');
|
|
@@ -38,13 +40,12 @@ class Contentpass {
|
|
|
38
40
|
}
|
|
39
41
|
this.samplingRate = config.samplingRate || DEFAULT_SAMPLING_RATE;
|
|
40
42
|
this.authStateStorage = new _OidcAuthStateStorage.default(config.propertyId);
|
|
41
|
-
this.config = config;
|
|
42
43
|
(0, _sentryIntegration.initSentry)({
|
|
43
44
|
propertyId: config.propertyId
|
|
44
45
|
});
|
|
45
46
|
this.initialiseAuthState();
|
|
46
47
|
}
|
|
47
|
-
authenticate = async
|
|
48
|
+
authenticate = async route => {
|
|
48
49
|
_logger.default.info('Starting authentication flow');
|
|
49
50
|
let result;
|
|
50
51
|
try {
|
|
@@ -54,7 +55,7 @@ class Contentpass {
|
|
|
54
55
|
issuer: this.config.issuer,
|
|
55
56
|
scopes: _oidcConsts.SCOPES,
|
|
56
57
|
additionalParameters: {
|
|
57
|
-
cp_route: 'login',
|
|
58
|
+
cp_route: route || 'login',
|
|
58
59
|
prompt: 'consent',
|
|
59
60
|
cp_property: this.config.propertyId,
|
|
60
61
|
cp_plan: this.config.planId
|
|
@@ -73,6 +74,35 @@ class Contentpass {
|
|
|
73
74
|
_logger.default.info('Authentication flow finished, checking subscription...');
|
|
74
75
|
await this.onNewAuthState(result);
|
|
75
76
|
};
|
|
77
|
+
event = async (eventCategory, eventAction, eventLabel, samplingRate) => {
|
|
78
|
+
const generatedSample = Math.random();
|
|
79
|
+
const activeSamplingRate = samplingRate ?? this.samplingRate;
|
|
80
|
+
if (generatedSample >= activeSamplingRate) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
_logger.default.info('Sending event', {
|
|
84
|
+
eventCategory,
|
|
85
|
+
eventAction,
|
|
86
|
+
eventLabel,
|
|
87
|
+
samplingRate: activeSamplingRate
|
|
88
|
+
});
|
|
89
|
+
const publicId = this.config.propertyId.slice(0, 8);
|
|
90
|
+
const payload = {
|
|
91
|
+
ea: eventAction,
|
|
92
|
+
ec: eventCategory,
|
|
93
|
+
el: eventLabel,
|
|
94
|
+
cpabid: this.instanceId,
|
|
95
|
+
cppid: publicId,
|
|
96
|
+
cpsr: activeSamplingRate
|
|
97
|
+
};
|
|
98
|
+
try {
|
|
99
|
+
await (0, _sendStats.default)(this.config.apiUrl, payload);
|
|
100
|
+
} catch (err) {
|
|
101
|
+
(0, _sentryIntegration.reportError)(err, {
|
|
102
|
+
msg: 'Failed to send event'
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
};
|
|
76
106
|
registerObserver(observer) {
|
|
77
107
|
_logger.default.info('Registering observer');
|
|
78
108
|
if (this.contentpassStateObservers.includes(observer)) {
|
|
@@ -101,6 +131,9 @@ class Contentpass {
|
|
|
101
131
|
await this.initialiseAuthState();
|
|
102
132
|
};
|
|
103
133
|
countImpression = async () => {
|
|
134
|
+
// Generate a new impression id to be used per impression
|
|
135
|
+
// This mimics the behaviour of the web SDK when in SPA mode
|
|
136
|
+
this.instanceId = _reactNativeUuid.default.v4();
|
|
104
137
|
await Promise.all([this.countPaidImpressionWhenUserHasValidSub(), this.countSampledImpression()]);
|
|
105
138
|
};
|
|
106
139
|
countPaidImpressionWhenUserHasValidSub = async () => {
|
|
@@ -108,11 +141,10 @@ class Contentpass {
|
|
|
108
141
|
return;
|
|
109
142
|
}
|
|
110
143
|
_logger.default.info('Counting paid impression');
|
|
111
|
-
const impressionId = _reactNativeUuid.default.v4();
|
|
112
144
|
try {
|
|
113
145
|
await (0, _sendPageViewEvent.default)(this.config.apiUrl, {
|
|
114
146
|
propertyId: this.config.propertyId,
|
|
115
|
-
impressionId,
|
|
147
|
+
impressionId: this.instanceId,
|
|
116
148
|
accessToken: this.oidcAuthState.accessToken
|
|
117
149
|
});
|
|
118
150
|
} catch (err) {
|
|
@@ -122,26 +154,7 @@ class Contentpass {
|
|
|
122
154
|
}
|
|
123
155
|
};
|
|
124
156
|
countSampledImpression = async () => {
|
|
125
|
-
|
|
126
|
-
const publicId = this.config.propertyId.slice(0, 8);
|
|
127
|
-
const instanceId = _reactNativeUuid.default.v4();
|
|
128
|
-
if (generatedSample >= this.samplingRate) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
_logger.default.info('Counting sampled impression');
|
|
132
|
-
try {
|
|
133
|
-
await (0, _sendStats.default)(this.config.apiUrl, {
|
|
134
|
-
ea: 'load',
|
|
135
|
-
ec: 'tcf-sampled',
|
|
136
|
-
cpabid: instanceId,
|
|
137
|
-
cppid: publicId,
|
|
138
|
-
cpsr: this.samplingRate
|
|
139
|
-
});
|
|
140
|
-
} catch (err) {
|
|
141
|
-
(0, _sentryIntegration.reportError)(err, {
|
|
142
|
-
msg: 'Failed to count sampled impression'
|
|
143
|
-
});
|
|
144
|
-
}
|
|
157
|
+
this.event('tcf-sampled', 'load');
|
|
145
158
|
};
|
|
146
159
|
initialiseAuthState = async () => {
|
|
147
160
|
const authState = await this.authStateStorage.getOidcAuthState();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeUuid","_interopRequireDefault","require","_OidcAuthStateStorage","_ContentpassState","_reactNativeAppAuth","_oidcConsts","_RefreshTokenStrategy","_fetchContentpassToken","_validateSubscription","_sentryIntegration","_sendStats","_sendPageViewEvent","_logger","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DEFAULT_SAMPLING_RATE","Contentpass","contentpassState","state","ContentpassStateType","INITIALISING","contentpassStateObservers","oidcAuthState","refreshTimer","constructor","config","logLevel","enableLogger","logger","debug","samplingRate","error","Error","authStateStorage","OidcAuthStateStorage","propertyId","initSentry","initialiseAuthState","authenticate","info","result","authorize","clientId","redirectUrl","issuer","scopes","SCOPES","additionalParameters","cp_route","prompt","cp_property","cp_plan","planId","err","reportError","msg","changeContentpassState","ERROR","onNewAuthState","registerObserver","observer","includes","push","unregisterObserver","filter","o","logout","clearOidcAuthState","UNAUTHENTICATED","hasValidSubscription","recoverFromError","countImpression","Promise","all","countPaidImpressionWhenUserHasValidSub","countSampledImpression","hasValidSubscriptionAndAccessToken","impressionId","uuid","v4","sendPageViewEvent","apiUrl","accessToken","generatedSample","Math","random","publicId","slice","instanceId","sendStats","ea","ec","cpabid","cppid","cpsr","authState","getOidcAuthState","storeOidcAuthState","strategy","setupRefreshTimer","RefreshTokenStrategy","INSTANTLY","contentpassToken","fetchContentpassToken","idToken","validateSubscription","AUTHENTICATED","accessTokenExpirationDate","warn","NO_REFRESH","now","Date","expirationDate","timeDiff","getTime","refreshToken","clearTimeout","setTimeout","TIMER_SET","counter","refreshResult","refresh","onRefreshTokenError","REFRESH_TOKEN_RETRIES","delay","resolve","forEach","exports"],"sourceRoot":"../../src","sources":["Contentpass.ts"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAGA,IAAAE,iBAAA,GAAAF,OAAA;AAIA,IAAAG,mBAAA,GAAAH,OAAA;AAKA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,qBAAA,GAAAL,OAAA;AACA,IAAAM,sBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,qBAAA,GAAAR,sBAAA,CAAAC,OAAA;AAEA,IAAAQ,kBAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,kBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,OAAA,GAAAC,uBAAA,CAAAZ,OAAA;AAAgD,SAAAa,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAA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AO,EAAElE,GAAG,CAAC;IAC9C;EACF,CAAC;EAEOqE,mBAAmB,GAAG,MAAAA,CAAOH,OAAe,EAAElE,GAAU,KAAK;IACnE;IACA,IAAIkE,OAAO,GAAGI,iCAAqB,EAAE;MACnC/F,eAAM,CAACgF,IAAI,CAAC;QAAEvD,GAAG;QAAEkE;MAAQ,CAAC,EAAE,mCAAmC,CAAC;MAClE,MAAMK,KAAK,GAAGL,OAAO,GAAG,IAAI,GAAG,EAAE;MACjC,MAAM,IAAI/C,OAAO,CAAEqD,OAAO,IAAKR,UAAU,CAACQ,OAAO,EAAED,KAAK,CAAC,CAAC;MAC1D,MAAM,IAAI,CAACT,YAAY,CAACI,OAAO,GAAG,CAAC,CAAC;MACpC;IACF;IAEA,IAAAjE,8BAAW,EAACD,GAAG,EAAE;MACfE,GAAG,EAAE,iCAAiCgE,OAAO;IAC/C,CAAC,CAAC;IAEF,MAAM,IAAI,CAACrD,MAAM,CAAC,CAAC;EACrB,CAAC;EAEOV,sBAAsB,GAAItC,KAAuB,IAAK;IAC5D,IAAI,CAACD,gBAAgB,GAAGC,KAAK;IAC7B,IAAI,CAACG,yBAAyB,CAACyG,OAAO,CAAElE,QAAQ,IAAKA,QAAQ,CAAC1C,KAAK,CAAC,CAAC;EACvE,CAAC;EAEO0D,kCAAkC,GAAGA,CAAA,KAAM;IACjD,OACE,IAAI,CAAC3D,gBAAgB,CAACC,KAAK,KAAKC,sCAAoB,CAACuF,aAAa,IAClE,IAAI,CAACzF,gBAAgB,CAACoD,oBAAoB,IAC1C,IAAI,CAAC/C,aAAa,EAAE4D,WAAW;EAEnC,CAAC;AACH;AAAC6C,OAAA,CAAA9H,OAAA,GAAAe,WAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_reactNativeUuid","_interopRequireDefault","require","_OidcAuthStateStorage","_ContentpassState","_reactNativeAppAuth","_oidcConsts","_RefreshTokenStrategy","_fetchContentpassToken","_validateSubscription","_sentryIntegration","_sendStats","_sendPageViewEvent","_logger","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DEFAULT_SAMPLING_RATE","Contentpass","contentpassState","state","ContentpassStateType","INITIALISING","contentpassStateObservers","oidcAuthState","refreshTimer","constructor","config","logLevel","enableLogger","instanceId","uuid","v4","logger","debug","samplingRate","error","Error","authStateStorage","OidcAuthStateStorage","propertyId","initSentry","initialiseAuthState","authenticate","route","info","result","authorize","clientId","redirectUrl","issuer","scopes","SCOPES","additionalParameters","cp_route","prompt","cp_property","cp_plan","planId","err","reportError","msg","changeContentpassState","ERROR","onNewAuthState","event","eventCategory","eventAction","eventLabel","generatedSample","Math","random","activeSamplingRate","publicId","slice","payload","ea","ec","el","cpabid","cppid","cpsr","sendStats","apiUrl","registerObserver","observer","includes","push","unregisterObserver","filter","o","logout","clearOidcAuthState","UNAUTHENTICATED","hasValidSubscription","recoverFromError","countImpression","Promise","all","countPaidImpressionWhenUserHasValidSub","countSampledImpression","hasValidSubscriptionAndAccessToken","sendPageViewEvent","impressionId","accessToken","authState","getOidcAuthState","storeOidcAuthState","strategy","setupRefreshTimer","RefreshTokenStrategy","INSTANTLY","contentpassToken","fetchContentpassToken","idToken","validateSubscription","AUTHENTICATED","accessTokenExpirationDate","warn","NO_REFRESH","now","Date","expirationDate","timeDiff","getTime","refreshToken","clearTimeout","setTimeout","TIMER_SET","counter","refreshResult","refresh","onRefreshTokenError","REFRESH_TOKEN_RETRIES","delay","resolve","forEach","exports"],"sourceRoot":"../../src","sources":["Contentpass.ts"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAGA,IAAAE,iBAAA,GAAAF,OAAA;AAIA,IAAAG,mBAAA,GAAAH,OAAA;AAKA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,qBAAA,G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