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
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ If you want to use Android Studio or XCode to edit the native code, you can open
- `example/ios`
- `expoExample/android`
- `expoExample/ios`
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 > react-native-contentpass`.
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`.

To edit the Java or Kotlin files, open `android` in Android studio and find the source files at `react-native-contentpass` under `Android`.
To edit the Java or Kotlin files, open `android` in Android studio and find the source files at `@contentpass/react-native-contentpass` under `Android`.

You can use various commands from the root directory to work with the project.

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# react-native-contentpass
# @contentpass/react-native-contentpass

Contentpass React Native SDK enables easy integration of Contentpass functionality into your React Native applications.

## Installation
Install the package using npm or Yarn:

```sh
npm install react-native-contentpass
npm install @contentpass/react-native-contentpass
```

or

```sh
yarn add react-native-contentpass
yarn add @contentpass/react-native-contentpass
```

### Peer Dependencies
Expand Down Expand Up @@ -44,7 +44,7 @@ Wrap your app's root component with ContentpassSdkProvider. The provider require

```jsx
import React from 'react';
import { ContentpassSdkProvider } from 'react-native-contentpass';
import { ContentpassSdkProvider } from '@contentpass/react-native-contentpass';

const contentpassConfig = {
propertyId: 'your-property-id',
Expand Down Expand Up @@ -88,7 +88,7 @@ or improved. The SDK will then refresh and revalidate the user's authentication

```jsx
import React, { useEffect } from 'react';
import { useContentpassSdk } from 'react-native-contentpass';
import { useContentpassSdk } from '@contentpass/react-native-contentpass';
import { Button, View } from 'react-native';

const YourApp = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'

Pod::Spec.new do |s|
s.name = "react-native-contentpass"
s.name = "contentpass-react-native-contentpass"
s.version = package["version"]
s.summary = package["description"]
s.homepage = package["homepage"]
Expand Down
10 changes: 5 additions & 5 deletions example/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ GEM
httpclient (2.8.3)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
json (2.8.2)
logger (1.6.1)
minitest (5.25.1)
json (2.9.0)
logger (1.6.2)
minitest (5.25.4)
molinillo (0.8.0)
nanaimo (0.3.0)
nap (1.1.0)
Expand All @@ -89,7 +89,7 @@ GEM
public_suffix (4.0.7)
rexml (3.3.9)
ruby-macho (2.5.1)
securerandom (0.3.2)
securerandom (0.4.0)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
Expand All @@ -114,4 +114,4 @@ RUBY VERSION
ruby 3.1.6p260

BUNDLED WITH
2.3.27
2.5.23
68 changes: 34 additions & 34 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
PODS:
- AppAuth (1.7.5):
- AppAuth/Core (= 1.7.5)
- AppAuth/ExternalUserAgent (= 1.7.5)
- AppAuth/Core (1.7.5)
- AppAuth/ExternalUserAgent (1.7.5):
- AppAuth (1.7.6):
- AppAuth/Core (= 1.7.6)
- AppAuth/ExternalUserAgent (= 1.7.6)
- AppAuth/Core (1.7.6)
- AppAuth/ExternalUserAgent (1.7.6):
- AppAuth/Core
- boost (1.84.0)
- ConsentViewController (7.6.7):
- Down (~> 0.11.0)
- contentpass-react-native-contentpass (0.2.4):
- DoubleConversion
- glog
- hermes-engine
- RCT-Folly (= 2024.01.01.00)
- RCTRequired
- RCTTypeSafety
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-NativeModulesApple
- React-RCTFabric
- React-rendererdebug
- React-utils
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- DoubleConversion (1.1.6)
- FBLazyVector (0.76.2)
- fmt (9.1.0)
Expand Down Expand Up @@ -1250,30 +1271,9 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- react-native-app-auth (8.0.0):
- AppAuth (>= 1.7.3)
- React-Core
- react-native-contentpass (0.1.0):
- DoubleConversion
- glog
- hermes-engine
- RCT-Folly (= 2024.01.01.00)
- RCTRequired
- RCTTypeSafety
- react-native-app-auth (8.0.1):
- AppAuth (>= 1.7.6)
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-NativeModulesApple
- React-RCTFabric
- React-rendererdebug
- React-utils
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- react-native-encrypted-storage (4.0.3):
- React-Core
- React-nativeconfig (0.76.2)
Expand Down Expand Up @@ -1570,6 +1570,7 @@ PODS:

DEPENDENCIES:
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
- contentpass-react-native-contentpass (from `../..`)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- fmt (from `../node_modules/react-native/third-party-podspecs/fmt.podspec`)
Expand Down Expand Up @@ -1607,7 +1608,6 @@ DEPENDENCIES:
- React-Mapbuffer (from `../node_modules/react-native/ReactCommon`)
- React-microtasksnativemodule (from `../node_modules/react-native/ReactCommon/react/nativemodule/microtasks`)
- react-native-app-auth (from `../node_modules/react-native-app-auth`)
- react-native-contentpass (from `../..`)
- react-native-encrypted-storage (from `../node_modules/react-native-encrypted-storage`)
- React-nativeconfig (from `../node_modules/react-native/ReactCommon`)
- React-NativeModulesApple (from `../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`)
Expand Down Expand Up @@ -1648,6 +1648,8 @@ SPEC REPOS:
EXTERNAL SOURCES:
boost:
:podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec"
contentpass-react-native-contentpass:
:path: "../.."
DoubleConversion:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
FBLazyVector:
Expand Down Expand Up @@ -1719,8 +1721,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/react/nativemodule/microtasks"
react-native-app-auth:
:path: "../node_modules/react-native-app-auth"
react-native-contentpass:
:path: "../.."
react-native-encrypted-storage:
:path: "../node_modules/react-native-encrypted-storage"
React-nativeconfig:
Expand Down Expand Up @@ -1783,9 +1783,10 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa
AppAuth: d4f13a8fe0baf391b2108511793e4b479691fb73
boost: 1dca942403ed9342f98334bf4c3621f011aa7946
ConsentViewController: 243f7bfcde4b6ec71a5033486465b7c17448493c
contentpass-react-native-contentpass: 27dd53dddc86eb602a6c4d74eea5dc52674061dc
DoubleConversion: f16ae600a246532c4020132d54af21d0ddb2a385
FBLazyVector: bc70dcb22ad30ce734a7cce7210791dc737e230f
fmt: 10c6e61f4be25dc963c36bd73fc7b1705fe975be
Expand Down Expand Up @@ -1820,8 +1821,7 @@ SPEC CHECKSUMS:
React-logger: addd140841248966c2547eb94836399cc1061f4d
React-Mapbuffer: 029b5332e78af8c67c4b5e65edfc717068b8eac1
React-microtasksnativemodule: ee9ac93cdd64745dfd3f3e5fa7cb1d0f6a5b89cd
react-native-app-auth: 58e24517e55368bee2950c5a4d0699ed80f0bff7
react-native-contentpass: 491cee39ada3d0b087246234752249e617a0c0db
react-native-app-auth: 0dd956abd9201fc06f7b4a71f0740836e2532014
react-native-encrypted-storage: 569d114e329b1c2c2d9f8c84bcdbe4478dda2258
React-nativeconfig: 470fce6d871c02dc5eff250a362d56391b7f52d6
React-NativeModulesApple: 1586448c61a7c2bd4040cc03ccde66a72037e77e
Expand Down
8 changes: 4 additions & 4 deletions expoExample/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ PODS:
- DoubleConversion (1.1.6)
- EXConstants (17.0.3):
- ExpoModulesCore
- Expo (52.0.11):
- Expo (52.0.14):
- ExpoModulesCore
- ExpoAsset (11.0.1):
- ExpoModulesCore
Expand All @@ -21,7 +21,7 @@ PODS:
- ExpoModulesCore
- ExpoKeepAwake (14.0.1):
- ExpoModulesCore
- ExpoModulesCore (2.0.6):
- ExpoModulesCore (2.1.1):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -1820,12 +1820,12 @@ SPEC CHECKSUMS:
ConsentViewController: 243f7bfcde4b6ec71a5033486465b7c17448493c
DoubleConversion: f16ae600a246532c4020132d54af21d0ddb2a385
EXConstants: dd2fe64c6cdb1383b694c309a63028a8e9f2be6d
Expo: 148aac4ce0da148c63447d09ae41ddb153f35506
Expo: 0e7b52be71a24a38d5e919e3040d8f51a8739cd0
ExpoAsset: 8138f2a9ec55ae1ad7c3871448379f7d97692d15
ExpoFileSystem: dc2679a2b5d4c465ca881129074da95faee943d5
ExpoFont: 7522d869d84ee2ee8093ee997fef5b86f85d856b
ExpoKeepAwake: 783e68647b969b210a786047c3daa7b753dcac1f
ExpoModulesCore: f71914f0725f2f4ca7a8d25dc551263e730d5d7f
ExpoModulesCore: 6b1ed7e4e5ab279a1825f40ef0140db84f6aad0f
FBLazyVector: be7314029d6ec6b90f0f75ce1195b8130ed9ac4f
fmt: 10c6e61f4be25dc963c36bd73fc7b1705fe975be
glog: 08b301085f15bcbb6ff8632a8ebaf239aae04e6a
Expand Down
2 changes: 1 addition & 1 deletion expoExample/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"target": "ESNext",
"verbatimModuleSyntax": true,
"paths": {
"react-native-contentpass": [
"@contentpass/react-native-contentpass": [
"../src/index"
]
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "react-native-contentpass",
"name": "@contentpass/react-native-contentpass",
"version": "0.2.4",
"description": "Contentpass React Native SDK",
"source": "./src/index.tsx",
Expand Down Expand Up @@ -85,7 +85,7 @@
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"jest": "^29.7.0",
"prettier": "^3.0.3",
"prettier": "^3.4.2",
"react": "18.3.1",
"react-native": "0.76.2",
"react-native-app-auth": "^8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion sharedExample/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { StyleSheet, View } from 'react-native';
import ContentpassUsage from './ContentpassUsage';
import { ContentpassSdkProvider } from 'react-native-contentpass';
import { ContentpassSdkProvider } from '@contentpass/react-native-contentpass';
import { contentpassConfig } from './contentpassConfig';

const styles = StyleSheet.create({
Expand Down
8 changes: 7 additions & 1 deletion sharedExample/src/ContentpassUsage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { Button, ScrollView, StyleSheet, Text, View } from 'react-native';
import { useEffect, useRef, useState } from 'react';
import {
type ContentpassState,
ContentpassStateType,
useContentpassSdk,
} from 'react-native-contentpass';
} from '@contentpass/react-native-contentpass';
import {
SPConsentManager,
type SPUserData,
Expand Down Expand Up @@ -39,6 +40,11 @@ export default function ContentpassUsage() {
>();

useEffect(() => {
// wait for the authResult to be set before setting up Sourcepoint
if (!authResult || authResult.state === ContentpassStateType.INITIALISING) {
return;
}

spConsentManager.current = setupSourcepoint(
authResult?.hasValidSubscription ?? false
);
Expand Down
2 changes: 1 addition & 1 deletion sharedExample/src/contentpassConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ContentpassConfig } from 'react-native-contentpass';
import type { ContentpassConfig } from '@contentpass/react-native-contentpass';

export const contentpassConfig: ContentpassConfig = {
// Testing app
Expand Down
3 changes: 2 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
export type {
ContentpassState,
ContentpassStateType,
ErrorState,
AuthenticatedState,
InitialisingState,
UnauthenticatedState,
} from './types/ContentpassState';

export { ContentpassStateType } from './types/ContentpassState';

export type { ContentpassConfig } from './types/ContentpassConfig';

export {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"rootDir": ".",
"paths": {
"react-native-contentpass": ["./src/index"]
"@contentpass/react-native-contentpass": ["./src/index"]
},
"allowUnreachableCode": false,
"allowUnusedLabels": false,
Expand Down
Loading