@contentpass/react-native-contentpass 0.2.5

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.
Files changed (110) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +134 -0
  3. package/contentpass-react-native-contentpass.podspec +41 -0
  4. package/lib/commonjs/Contentpass.js +173 -0
  5. package/lib/commonjs/Contentpass.js.map +1 -0
  6. package/lib/commonjs/OidcAuthStateStorage.js +26 -0
  7. package/lib/commonjs/OidcAuthStateStorage.js.map +1 -0
  8. package/lib/commonjs/consts/oidcConsts.js +10 -0
  9. package/lib/commonjs/consts/oidcConsts.js.map +1 -0
  10. package/lib/commonjs/index.js +28 -0
  11. package/lib/commonjs/index.js.map +1 -0
  12. package/lib/commonjs/sdkContext/ContentpassSdkProvider.js +32 -0
  13. package/lib/commonjs/sdkContext/ContentpassSdkProvider.js.map +1 -0
  14. package/lib/commonjs/sdkContext/useContentpassSdk.js +17 -0
  15. package/lib/commonjs/sdkContext/useContentpassSdk.js.map +1 -0
  16. package/lib/commonjs/sentryIntegration.js +61 -0
  17. package/lib/commonjs/sentryIntegration.js.map +1 -0
  18. package/lib/commonjs/types/ContentpassConfig.js +2 -0
  19. package/lib/commonjs/types/ContentpassConfig.js.map +1 -0
  20. package/lib/commonjs/types/ContentpassState.js +15 -0
  21. package/lib/commonjs/types/ContentpassState.js.map +1 -0
  22. package/lib/commonjs/types/RefreshTokenStrategy.js +14 -0
  23. package/lib/commonjs/types/RefreshTokenStrategy.js.map +1 -0
  24. package/lib/commonjs/utils/fetchContentpassToken.js +29 -0
  25. package/lib/commonjs/utils/fetchContentpassToken.js.map +1 -0
  26. package/lib/commonjs/utils/parseContentpassToken.js +19 -0
  27. package/lib/commonjs/utils/parseContentpassToken.js.map +1 -0
  28. package/lib/commonjs/utils/validateSubscription.js +23 -0
  29. package/lib/commonjs/utils/validateSubscription.js.map +1 -0
  30. package/lib/module/Contentpass.js +167 -0
  31. package/lib/module/Contentpass.js.map +1 -0
  32. package/lib/module/OidcAuthStateStorage.js +20 -0
  33. package/lib/module/OidcAuthStateStorage.js.map +1 -0
  34. package/lib/module/consts/oidcConsts.js +6 -0
  35. package/lib/module/consts/oidcConsts.js.map +1 -0
  36. package/lib/module/index.js +6 -0
  37. package/lib/module/index.js.map +1 -0
  38. package/lib/module/sdkContext/ContentpassSdkProvider.js +24 -0
  39. package/lib/module/sdkContext/ContentpassSdkProvider.js.map +1 -0
  40. package/lib/module/sdkContext/useContentpassSdk.js +13 -0
  41. package/lib/module/sdkContext/useContentpassSdk.js.map +1 -0
  42. package/lib/module/sentryIntegration.js +54 -0
  43. package/lib/module/sentryIntegration.js.map +1 -0
  44. package/lib/module/types/ContentpassConfig.js +2 -0
  45. package/lib/module/types/ContentpassConfig.js.map +1 -0
  46. package/lib/module/types/ContentpassState.js +12 -0
  47. package/lib/module/types/ContentpassState.js.map +1 -0
  48. package/lib/module/types/RefreshTokenStrategy.js +11 -0
  49. package/lib/module/types/RefreshTokenStrategy.js.map +1 -0
  50. package/lib/module/utils/fetchContentpassToken.js +25 -0
  51. package/lib/module/utils/fetchContentpassToken.js.map +1 -0
  52. package/lib/module/utils/parseContentpassToken.js +15 -0
  53. package/lib/module/utils/parseContentpassToken.js.map +1 -0
  54. package/lib/module/utils/validateSubscription.js +18 -0
  55. package/lib/module/utils/validateSubscription.js.map +1 -0
  56. package/lib/typescript/commonjs/package.json +1 -0
  57. package/lib/typescript/commonjs/src/Contentpass.d.ts +24 -0
  58. package/lib/typescript/commonjs/src/Contentpass.d.ts.map +1 -0
  59. package/lib/typescript/commonjs/src/OidcAuthStateStorage.d.ts +15 -0
  60. package/lib/typescript/commonjs/src/OidcAuthStateStorage.d.ts.map +1 -0
  61. package/lib/typescript/commonjs/src/consts/oidcConsts.d.ts +4 -0
  62. package/lib/typescript/commonjs/src/consts/oidcConsts.d.ts.map +1 -0
  63. package/lib/typescript/commonjs/src/index.d.ts +7 -0
  64. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  65. package/lib/typescript/commonjs/src/sdkContext/ContentpassSdkProvider.d.ts +9 -0
  66. package/lib/typescript/commonjs/src/sdkContext/ContentpassSdkProvider.d.ts.map +1 -0
  67. package/lib/typescript/commonjs/src/sdkContext/useContentpassSdk.d.ts +3 -0
  68. package/lib/typescript/commonjs/src/sdkContext/useContentpassSdk.d.ts.map +1 -0
  69. package/lib/typescript/commonjs/src/sentryIntegration.d.ts +7 -0
  70. package/lib/typescript/commonjs/src/sentryIntegration.d.ts.map +1 -0
  71. package/lib/typescript/commonjs/src/types/ContentpassConfig.d.ts +6 -0
  72. package/lib/typescript/commonjs/src/types/ContentpassConfig.d.ts.map +1 -0
  73. package/lib/typescript/commonjs/src/types/ContentpassState.d.ts +28 -0
  74. package/lib/typescript/commonjs/src/types/ContentpassState.d.ts.map +1 -0
  75. package/lib/typescript/commonjs/src/types/RefreshTokenStrategy.d.ts +6 -0
  76. package/lib/typescript/commonjs/src/types/RefreshTokenStrategy.d.ts.map +1 -0
  77. package/lib/typescript/commonjs/src/utils/fetchContentpassToken.d.ts +6 -0
  78. package/lib/typescript/commonjs/src/utils/fetchContentpassToken.d.ts.map +1 -0
  79. package/lib/typescript/commonjs/src/utils/parseContentpassToken.d.ts +17 -0
  80. package/lib/typescript/commonjs/src/utils/parseContentpassToken.d.ts.map +1 -0
  81. package/lib/typescript/commonjs/src/utils/validateSubscription.d.ts +2 -0
  82. package/lib/typescript/commonjs/src/utils/validateSubscription.d.ts.map +1 -0
  83. package/lib/typescript/module/package.json +1 -0
  84. package/lib/typescript/module/src/Contentpass.d.ts +24 -0
  85. package/lib/typescript/module/src/Contentpass.d.ts.map +1 -0
  86. package/lib/typescript/module/src/OidcAuthStateStorage.d.ts +15 -0
  87. package/lib/typescript/module/src/OidcAuthStateStorage.d.ts.map +1 -0
  88. package/lib/typescript/module/src/consts/oidcConsts.d.ts +4 -0
  89. package/lib/typescript/module/src/consts/oidcConsts.d.ts.map +1 -0
  90. package/lib/typescript/module/src/index.d.ts +7 -0
  91. package/lib/typescript/module/src/index.d.ts.map +1 -0
  92. package/lib/typescript/module/src/sdkContext/ContentpassSdkProvider.d.ts +9 -0
  93. package/lib/typescript/module/src/sdkContext/ContentpassSdkProvider.d.ts.map +1 -0
  94. package/lib/typescript/module/src/sdkContext/useContentpassSdk.d.ts +3 -0
  95. package/lib/typescript/module/src/sdkContext/useContentpassSdk.d.ts.map +1 -0
  96. package/lib/typescript/module/src/sentryIntegration.d.ts +7 -0
  97. package/lib/typescript/module/src/sentryIntegration.d.ts.map +1 -0
  98. package/lib/typescript/module/src/types/ContentpassConfig.d.ts +6 -0
  99. package/lib/typescript/module/src/types/ContentpassConfig.d.ts.map +1 -0
  100. package/lib/typescript/module/src/types/ContentpassState.d.ts +28 -0
  101. package/lib/typescript/module/src/types/ContentpassState.d.ts.map +1 -0
  102. package/lib/typescript/module/src/types/RefreshTokenStrategy.d.ts +6 -0
  103. package/lib/typescript/module/src/types/RefreshTokenStrategy.d.ts.map +1 -0
  104. package/lib/typescript/module/src/utils/fetchContentpassToken.d.ts +6 -0
  105. package/lib/typescript/module/src/utils/fetchContentpassToken.d.ts.map +1 -0
  106. package/lib/typescript/module/src/utils/parseContentpassToken.d.ts +17 -0
  107. package/lib/typescript/module/src/utils/parseContentpassToken.d.ts.map +1 -0
  108. package/lib/typescript/module/src/utils/validateSubscription.d.ts +2 -0
  109. package/lib/typescript/module/src/utils/validateSubscription.d.ts.map +1 -0
  110. package/package.json +154 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentpassSdkProvider.d.ts","sourceRoot":"","sources":["../../../../../src/sdkContext/ContentpassSdkProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,eAAO,MAAM,qBAAqB,wCAEjC,CAAC;AAEF,eAAO,MAAM,sBAAsB,qCAGhC;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,iBAAiB,EAAE,iBAAiB,CAAC;CACtC,mDAoBA,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const useContentpassSdk: () => import("..").Contentpass;
2
+ export default useContentpassSdk;
3
+ //# sourceMappingURL=useContentpassSdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useContentpassSdk.d.ts","sourceRoot":"","sources":["../../../../../src/sdkContext/useContentpassSdk.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,iBAAiB,gCAUtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,7 @@
1
+ type ReportErrorOptions = {
2
+ msg?: string;
3
+ };
4
+ export declare const reportError: (err: Error, { msg }?: ReportErrorOptions) => void;
5
+ export declare const setSentryExtraAttribute: (key: string, value: string) => void;
6
+ export {};
7
+ //# sourceMappingURL=sentryIntegration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentryIntegration.d.ts","sourceRoot":"","sources":["../../../../src/sentryIntegration.ts"],"names":[],"mappings":"AAwCA,KAAK,kBAAkB,GAAG;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,WAAW,QAAS,KAAK,YAAW,kBAAkB,SAUlE,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAAS,MAAM,SAAS,MAAM,SAEjE,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type ContentpassConfig = {
2
+ propertyId: string;
3
+ redirectUrl: string;
4
+ issuer: string;
5
+ };
6
+ //# sourceMappingURL=ContentpassConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentpassConfig.d.ts","sourceRoot":"","sources":["../../../../../src/types/ContentpassConfig.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
@@ -0,0 +1,28 @@
1
+ export declare enum ContentpassStateType {
2
+ INITIALISING = "INITIALISING",
3
+ UNAUTHENTICATED = "UNAUTHENTICATED",
4
+ AUTHENTICATED = "AUTHENTICATED",
5
+ ERROR = "ERROR"
6
+ }
7
+ export type InitialisingState = {
8
+ state: ContentpassStateType.INITIALISING;
9
+ hasValidSubscription?: never;
10
+ error?: never;
11
+ };
12
+ export type UnauthenticatedState = {
13
+ state: ContentpassStateType.UNAUTHENTICATED;
14
+ hasValidSubscription: false;
15
+ error?: never;
16
+ };
17
+ export type AuthenticatedState = {
18
+ state: ContentpassStateType.AUTHENTICATED;
19
+ hasValidSubscription: boolean;
20
+ error?: never;
21
+ };
22
+ export type ErrorState = {
23
+ state: ContentpassStateType.ERROR;
24
+ hasValidSubscription?: never;
25
+ error: unknown;
26
+ };
27
+ export type ContentpassState = InitialisingState | UnauthenticatedState | AuthenticatedState | ErrorState;
28
+ //# sourceMappingURL=ContentpassState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentpassState.d.ts","sourceRoot":"","sources":["../../../../../src/types/ContentpassState.ts"],"names":[],"mappings":"AAEA,oBAAY,oBAAoB;IAC9B,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,aAAa,kBAAkB;IAC/B,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,oBAAoB,CAAC,YAAY,CAAC;IACzC,oBAAoB,CAAC,EAAE,KAAK,CAAC;IAC7B,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,oBAAoB,CAAC,eAAe,CAAC;IAC5C,oBAAoB,EAAE,KAAK,CAAC;IAC5B,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,oBAAoB,CAAC,aAAa,CAAC;IAC1C,oBAAoB,EAAE,OAAO,CAAC;IAC9B,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,oBAAoB,CAAC,KAAK,CAAC;IAClC,oBAAoB,CAAC,EAAE,KAAK,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,oBAAoB,GACpB,kBAAkB,GAClB,UAAU,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare enum RefreshTokenStrategy {
2
+ INSTANTLY = "INSTANTLY",
3
+ TIMER_SET = "TIMER_SET",
4
+ NO_REFRESH = "NO_REFRESH"
5
+ }
6
+ //# sourceMappingURL=RefreshTokenStrategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RefreshTokenStrategy.d.ts","sourceRoot":"","sources":["../../../../../src/types/RefreshTokenStrategy.ts"],"names":[],"mappings":"AAEA,oBAAY,oBAAoB;IAC9B,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,UAAU,eAAe;CAC1B"}
@@ -0,0 +1,6 @@
1
+ export default function fetchContentpassToken({ idToken, propertyId, issuer, }: {
2
+ idToken: string;
3
+ propertyId: string;
4
+ issuer: string;
5
+ }): Promise<any>;
6
+ //# sourceMappingURL=fetchContentpassToken.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchContentpassToken.d.ts","sourceRoot":"","sources":["../../../../../src/utils/fetchContentpassToken.ts"],"names":[],"mappings":"AAEA,wBAA8B,qBAAqB,CAAC,EAClD,OAAO,EACP,UAAU,EACV,MAAM,GACP,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,gBAgBA"}
@@ -0,0 +1,17 @@
1
+ type ParsedToken = {
2
+ body: {
3
+ aud: string;
4
+ auth: boolean;
5
+ exp: number;
6
+ iat: number;
7
+ plans: string[];
8
+ type: string;
9
+ };
10
+ header: {
11
+ alg: string;
12
+ kid: string;
13
+ };
14
+ };
15
+ export default function parseContentpassToken(contentpassToken: string): ParsedToken;
16
+ export {};
17
+ //# sourceMappingURL=parseContentpassToken.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseContentpassToken.d.ts","sourceRoot":"","sources":["../../../../../src/utils/parseContentpassToken.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,OAAO,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAC3C,gBAAgB,EAAE,MAAM,GACvB,WAAW,CAab"}
@@ -0,0 +1,2 @@
1
+ export default function validateSubscription(contentpassToken: string): boolean;
2
+ //# sourceMappingURL=validateSubscription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateSubscription.d.ts","sourceRoot":"","sources":["../../../../../src/utils/validateSubscription.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,gBAAgB,EAAE,MAAM,WAQpE"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,24 @@
1
+ import { type ContentpassState } from './types/ContentpassState';
2
+ import type { ContentpassConfig } from './types/ContentpassConfig';
3
+ export type ContentpassObserver = (state: ContentpassState) => void;
4
+ export default class Contentpass {
5
+ private authStateStorage;
6
+ private readonly config;
7
+ private contentpassState;
8
+ private contentpassStateObservers;
9
+ private oidcAuthState;
10
+ private refreshTimer;
11
+ constructor(config: ContentpassConfig);
12
+ authenticate: () => Promise<void>;
13
+ registerObserver(observer: ContentpassObserver): void;
14
+ unregisterObserver(observer: ContentpassObserver): void;
15
+ logout: () => Promise<void>;
16
+ recoverFromError: () => Promise<void>;
17
+ private initialiseAuthState;
18
+ private onNewAuthState;
19
+ private setupRefreshTimer;
20
+ private refreshToken;
21
+ private onRefreshTokenError;
22
+ private changeContentpassState;
23
+ }
24
+ //# sourceMappingURL=Contentpass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Contentpass.d.ts","sourceRoot":"","sources":["../../../../src/Contentpass.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,0BAA0B,CAAC;AAUlC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAGnE,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;AAEpE,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAE3C,OAAO,CAAC,gBAAgB,CAEtB;IACF,OAAO,CAAC,yBAAyB,CAA6B;IAC9D,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,YAAY,CAA+B;gBAEvC,MAAM,EAAE,iBAAiB;IAO9B,YAAY,QAAa,OAAO,CAAC,IAAI,CAAC,CA0B3C;IAEK,gBAAgB,CAAC,QAAQ,EAAE,mBAAmB;IAS9C,kBAAkB,CAAC,QAAQ,EAAE,mBAAmB;IAMhD,MAAM,sBAMX;IAEK,gBAAgB,sBAMrB;IAEF,OAAO,CAAC,mBAAmB,CAWzB;IAEF,OAAO,CAAC,cAAc,CA2BpB;IAEF,OAAO,CAAC,iBAAiB,CAyBvB;IAEF,OAAO,CAAC,YAAY,CAsBlB;IAEF,OAAO,CAAC,mBAAmB,CAazB;IAEF,OAAO,CAAC,sBAAsB,CAG5B;CACH"}
@@ -0,0 +1,15 @@
1
+ export type OidcAuthState = {
2
+ accessToken: string;
3
+ accessTokenExpirationDate: string;
4
+ idToken: string;
5
+ refreshToken: string | null;
6
+ tokenType: string;
7
+ };
8
+ export default class OidcAuthStateStorage {
9
+ private readonly key;
10
+ constructor(clientId: string);
11
+ storeOidcAuthState(authState: OidcAuthState): Promise<void>;
12
+ getOidcAuthState(): Promise<OidcAuthState | undefined>;
13
+ clearOidcAuthState(): Promise<void>;
14
+ }
15
+ //# sourceMappingURL=OidcAuthStateStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OidcAuthStateStorage.d.ts","sourceRoot":"","sources":["../../../../src/OidcAuthStateStorage.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,yBAAyB,EAAE,MAAM,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,oBAAoB;IACvC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;gBAET,QAAQ,EAAE,MAAM;IAIf,kBAAkB,CAAC,SAAS,EAAE,aAAa;IAI3C,gBAAgB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAMtD,kBAAkB;CAGhC"}
@@ -0,0 +1,4 @@
1
+ export declare const SCOPES: string[];
2
+ export declare const TOKEN_ENDPOINT = "/auth/oidc/token";
3
+ export declare const REFRESH_TOKEN_RETRIES = 6;
4
+ //# sourceMappingURL=oidcConsts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oidcConsts.d.ts","sourceRoot":"","sources":["../../../../../src/consts/oidcConsts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,UAA8C,CAAC;AAClE,eAAO,MAAM,cAAc,qBAAqB,CAAC;AACjD,eAAO,MAAM,qBAAqB,IAAI,CAAC"}
@@ -0,0 +1,7 @@
1
+ export type { ContentpassState, ErrorState, AuthenticatedState, InitialisingState, UnauthenticatedState, } from './types/ContentpassState';
2
+ export { ContentpassStateType } from './types/ContentpassState';
3
+ export type { ContentpassConfig } from './types/ContentpassConfig';
4
+ export { type default as Contentpass, type ContentpassObserver, } from './Contentpass';
5
+ export { ContentpassSdkProvider } from './sdkContext/ContentpassSdkProvider';
6
+ export { default as useContentpassSdk } from './sdkContext/useContentpassSdk';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,EACL,KAAK,OAAO,IAAI,WAAW,EAC3B,KAAK,mBAAmB,GACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { ContentpassConfig } from '../types/ContentpassConfig';
3
+ import Contentpass from '../Contentpass';
4
+ export declare const contentpassSdkContext: React.Context<Contentpass | undefined>;
5
+ export declare const ContentpassSdkProvider: ({ children, contentpassConfig, }: {
6
+ children: React.ReactNode;
7
+ contentpassConfig: ContentpassConfig;
8
+ }) => import("react/jsx-runtime").JSX.Element | null;
9
+ //# sourceMappingURL=ContentpassSdkProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentpassSdkProvider.d.ts","sourceRoot":"","sources":["../../../../../src/sdkContext/ContentpassSdkProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,eAAO,MAAM,qBAAqB,wCAEjC,CAAC;AAEF,eAAO,MAAM,sBAAsB,qCAGhC;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,iBAAiB,EAAE,iBAAiB,CAAC;CACtC,mDAoBA,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const useContentpassSdk: () => import("..").Contentpass;
2
+ export default useContentpassSdk;
3
+ //# sourceMappingURL=useContentpassSdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useContentpassSdk.d.ts","sourceRoot":"","sources":["../../../../../src/sdkContext/useContentpassSdk.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,iBAAiB,gCAUtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,7 @@
1
+ type ReportErrorOptions = {
2
+ msg?: string;
3
+ };
4
+ export declare const reportError: (err: Error, { msg }?: ReportErrorOptions) => void;
5
+ export declare const setSentryExtraAttribute: (key: string, value: string) => void;
6
+ export {};
7
+ //# sourceMappingURL=sentryIntegration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentryIntegration.d.ts","sourceRoot":"","sources":["../../../../src/sentryIntegration.ts"],"names":[],"mappings":"AAwCA,KAAK,kBAAkB,GAAG;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,WAAW,QAAS,KAAK,YAAW,kBAAkB,SAUlE,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAAS,MAAM,SAAS,MAAM,SAEjE,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type ContentpassConfig = {
2
+ propertyId: string;
3
+ redirectUrl: string;
4
+ issuer: string;
5
+ };
6
+ //# sourceMappingURL=ContentpassConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentpassConfig.d.ts","sourceRoot":"","sources":["../../../../../src/types/ContentpassConfig.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
@@ -0,0 +1,28 @@
1
+ export declare enum ContentpassStateType {
2
+ INITIALISING = "INITIALISING",
3
+ UNAUTHENTICATED = "UNAUTHENTICATED",
4
+ AUTHENTICATED = "AUTHENTICATED",
5
+ ERROR = "ERROR"
6
+ }
7
+ export type InitialisingState = {
8
+ state: ContentpassStateType.INITIALISING;
9
+ hasValidSubscription?: never;
10
+ error?: never;
11
+ };
12
+ export type UnauthenticatedState = {
13
+ state: ContentpassStateType.UNAUTHENTICATED;
14
+ hasValidSubscription: false;
15
+ error?: never;
16
+ };
17
+ export type AuthenticatedState = {
18
+ state: ContentpassStateType.AUTHENTICATED;
19
+ hasValidSubscription: boolean;
20
+ error?: never;
21
+ };
22
+ export type ErrorState = {
23
+ state: ContentpassStateType.ERROR;
24
+ hasValidSubscription?: never;
25
+ error: unknown;
26
+ };
27
+ export type ContentpassState = InitialisingState | UnauthenticatedState | AuthenticatedState | ErrorState;
28
+ //# sourceMappingURL=ContentpassState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentpassState.d.ts","sourceRoot":"","sources":["../../../../../src/types/ContentpassState.ts"],"names":[],"mappings":"AAEA,oBAAY,oBAAoB;IAC9B,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,aAAa,kBAAkB;IAC/B,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,oBAAoB,CAAC,YAAY,CAAC;IACzC,oBAAoB,CAAC,EAAE,KAAK,CAAC;IAC7B,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,oBAAoB,CAAC,eAAe,CAAC;IAC5C,oBAAoB,EAAE,KAAK,CAAC;IAC5B,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,oBAAoB,CAAC,aAAa,CAAC;IAC1C,oBAAoB,EAAE,OAAO,CAAC;IAC9B,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,oBAAoB,CAAC,KAAK,CAAC;IAClC,oBAAoB,CAAC,EAAE,KAAK,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,oBAAoB,GACpB,kBAAkB,GAClB,UAAU,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare enum RefreshTokenStrategy {
2
+ INSTANTLY = "INSTANTLY",
3
+ TIMER_SET = "TIMER_SET",
4
+ NO_REFRESH = "NO_REFRESH"
5
+ }
6
+ //# sourceMappingURL=RefreshTokenStrategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RefreshTokenStrategy.d.ts","sourceRoot":"","sources":["../../../../../src/types/RefreshTokenStrategy.ts"],"names":[],"mappings":"AAEA,oBAAY,oBAAoB;IAC9B,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,UAAU,eAAe;CAC1B"}
@@ -0,0 +1,6 @@
1
+ export default function fetchContentpassToken({ idToken, propertyId, issuer, }: {
2
+ idToken: string;
3
+ propertyId: string;
4
+ issuer: string;
5
+ }): Promise<any>;
6
+ //# sourceMappingURL=fetchContentpassToken.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchContentpassToken.d.ts","sourceRoot":"","sources":["../../../../../src/utils/fetchContentpassToken.ts"],"names":[],"mappings":"AAEA,wBAA8B,qBAAqB,CAAC,EAClD,OAAO,EACP,UAAU,EACV,MAAM,GACP,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,gBAgBA"}
@@ -0,0 +1,17 @@
1
+ type ParsedToken = {
2
+ body: {
3
+ aud: string;
4
+ auth: boolean;
5
+ exp: number;
6
+ iat: number;
7
+ plans: string[];
8
+ type: string;
9
+ };
10
+ header: {
11
+ alg: string;
12
+ kid: string;
13
+ };
14
+ };
15
+ export default function parseContentpassToken(contentpassToken: string): ParsedToken;
16
+ export {};
17
+ //# sourceMappingURL=parseContentpassToken.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseContentpassToken.d.ts","sourceRoot":"","sources":["../../../../../src/utils/parseContentpassToken.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,OAAO,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAC3C,gBAAgB,EAAE,MAAM,GACvB,WAAW,CAab"}
@@ -0,0 +1,2 @@
1
+ export default function validateSubscription(contentpassToken: string): boolean;
2
+ //# sourceMappingURL=validateSubscription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateSubscription.d.ts","sourceRoot":"","sources":["../../../../../src/utils/validateSubscription.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,gBAAgB,EAAE,MAAM,WAQpE"}
package/package.json ADDED
@@ -0,0 +1,154 @@
1
+ {
2
+ "name": "@contentpass/react-native-contentpass",
3
+ "version": "0.2.5",
4
+ "description": "Contentpass React Native SDK",
5
+ "source": "./src/index.tsx",
6
+ "main": "./lib/commonjs/index.js",
7
+ "module": "./lib/module/index.js",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./lib/typescript/module/src/index.d.ts",
12
+ "default": "./lib/module/index.js"
13
+ },
14
+ "require": {
15
+ "types": "./lib/typescript/commonjs/src/index.d.ts",
16
+ "default": "./lib/commonjs/index.js"
17
+ }
18
+ }
19
+ },
20
+ "types": "./lib/typescript/module/src/index.d.ts",
21
+ "files": [
22
+ "lib",
23
+ "android",
24
+ "ios",
25
+ "cpp",
26
+ "*.podspec",
27
+ "!ios/build",
28
+ "!android/build",
29
+ "!android/gradle",
30
+ "!android/gradlew",
31
+ "!android/gradlew.bat",
32
+ "!android/local.properties",
33
+ "!**/*.test.ts",
34
+ "!**/*.test.tsx",
35
+ "!**/__tests__",
36
+ "!**/__fixtures__",
37
+ "!**/__mocks__",
38
+ "!**/.*"
39
+ ],
40
+ "scripts": {
41
+ "example": "yarn workspace react-native-contentpass-example",
42
+ "expo-example": "yarn workspace react-native-contentpass-expo-example",
43
+ "test": "jest",
44
+ "typecheck": "tsc",
45
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
46
+ "prettier:check": "prettier --check \"**/*.{js,ts,tsx}\"",
47
+ "clean": "del-cli android/build example/android/build expoExample/android/build example/android/app/build expoExample/android/app/build example/ios/build exampleExample/ios/build lib",
48
+ "prepare": "bob build",
49
+ "release": "release-it"
50
+ },
51
+ "keywords": [
52
+ "contentpass",
53
+ "react-native",
54
+ "ios",
55
+ "android"
56
+ ],
57
+ "repository": {
58
+ "type": "git",
59
+ "url": "git+https://github.com/contentpass/react-native-contentpass.git"
60
+ },
61
+ "author": "contentpass <dev@contentpass.de> (https://github.com/contentpass)",
62
+ "license": "MIT",
63
+ "bugs": {
64
+ "url": "https://github.com/contentpass/react-native-contentpass/issues"
65
+ },
66
+ "homepage": "https://github.com/contentpass/react-native-contentpass#readme",
67
+ "publishConfig": {
68
+ "registry": "https://registry.npmjs.org/",
69
+ "access": "public"
70
+ },
71
+ "devDependencies": {
72
+ "@commitlint/config-conventional": "^17.0.2",
73
+ "@evilmartians/lefthook": "^1.5.0",
74
+ "@react-native-community/cli": "15.0.1",
75
+ "@react-native/babel-preset": "0.76.3",
76
+ "@react-native/eslint-config": "^0.73.1",
77
+ "@release-it/conventional-changelog": "^9.0.2",
78
+ "@testing-library/react-native": "^12.9.0",
79
+ "@types/jest": "^29.5.5",
80
+ "@types/lodash": "^4.17.13",
81
+ "@types/react": "^18.2.44",
82
+ "commitlint": "^17.0.2",
83
+ "conventional-changelog-angular": "^8.0.0",
84
+ "del-cli": "^5.1.0",
85
+ "eslint": "^8.51.0",
86
+ "eslint-config-prettier": "^9.0.0",
87
+ "eslint-plugin-prettier": "^5.0.1",
88
+ "jest": "^29.7.0",
89
+ "prettier": "^3.4.2",
90
+ "react": "18.3.1",
91
+ "react-native": "0.76.2",
92
+ "react-native-app-auth": "^8.0.0",
93
+ "react-native-builder-bob": "^0.32.1",
94
+ "react-native-encrypted-storage": "^4.0.3",
95
+ "react-test-renderer": "18.3.1",
96
+ "release-it": "^17.10.0",
97
+ "turbo": "^1.10.7",
98
+ "typescript": "^5.2.2"
99
+ },
100
+ "resolutions": {
101
+ "@types/react": "^18.2.44",
102
+ "@sourcepoint/react-native-cmp@^0.3.0": "patch:@sourcepoint/react-native-cmp@patch%3A@sourcepoint/react-native-cmp@npm%253A0.3.0%23./.yarn/patches/@sourcepoint-react-native-cmp-npm-0.3.0-2434c31dc9.patch%3A%3Aversion=0.3.0&hash=664e70&locator=react-native-contentpass%2540workspace%253A.#./.yarn/patches/@sourcepoint-react-native-cmp-patch-34fca36663.patch"
103
+ },
104
+ "peerDependencies": {
105
+ "react": "*",
106
+ "react-native": "*",
107
+ "react-native-app-auth": "*",
108
+ "react-native-encrypted-storage": "*"
109
+ },
110
+ "workspaces": [
111
+ "example",
112
+ "expoExample",
113
+ "sharedExample"
114
+ ],
115
+ "packageManager": "yarn@3.6.1",
116
+ "react-native-builder-bob": {
117
+ "source": "src",
118
+ "exclude": [
119
+ "**/{__tests__,__fixtures__,__mocks__}/**",
120
+ "**/*.test.ts",
121
+ "**/*.test.tsx"
122
+ ],
123
+ "output": "lib",
124
+ "targets": [
125
+ [
126
+ "commonjs",
127
+ {
128
+ "esm": true
129
+ }
130
+ ],
131
+ [
132
+ "module",
133
+ {
134
+ "esm": true
135
+ }
136
+ ],
137
+ [
138
+ "typescript",
139
+ {
140
+ "project": "tsconfig.build.json",
141
+ "esm": true
142
+ }
143
+ ]
144
+ ]
145
+ },
146
+ "create-react-native-library": {
147
+ "type": "module-legacy",
148
+ "languages": "kotlin-objc",
149
+ "version": "0.44.1"
150
+ },
151
+ "dependencies": {
152
+ "@sentry/react-native": "^6.3.0"
153
+ }
154
+ }