@stigg/react-sdk 5.26.0 → 5.28.0
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/dist/components/BooleanEntitlementGuard.d.ts +8 -0
- package/dist/components/MeteredEntitlementGuard.d.ts +8 -0
- package/dist/components/NumericEntitlementGuard.d.ts +8 -0
- package/dist/components/StiggProvider.d.ts +1 -1
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/useActiveSubscriptions.d.ts +6 -0
- package/dist/hooks/useBooleanEntitlement.d.ts +5 -0
- package/dist/hooks/useCustomerPortal.d.ts +6 -0
- package/dist/hooks/useFetch.d.ts +8 -0
- package/dist/hooks/useMeteredEntitlement.d.ts +6 -0
- package/dist/hooks/useNumericEntitlement.d.ts +6 -0
- package/dist/hooks/usePaywall.d.ts +6 -0
- package/dist/hooks/useStiggContext.d.ts +7 -0
- package/dist/index.d.ts +5 -1
- package/dist/react-sdk.cjs.development.js +449 -200
- package/dist/react-sdk.cjs.development.js.map +1 -1
- package/dist/react-sdk.cjs.production.min.js +1 -1
- package/dist/react-sdk.cjs.production.min.js.map +1 -1
- package/dist/react-sdk.esm.js +442 -202
- package/dist/react-sdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/BooleanEntitlementGuard.tsx +22 -0
- package/src/components/MeteredEntitlementGuard.tsx +22 -0
- package/src/components/NumericEntitlementGuard.tsx +22 -0
- package/src/components/StiggProvider.tsx +4 -9
- package/src/components/checkout/hooks/useLoadCheckout.ts +1 -1
- package/src/components/checkout/hooks/usePreviewSubscription.ts +1 -1
- package/src/components/customerPortal/hooks/useCustomerPortal.ts +1 -1
- package/src/components/hooks/useWaitForCheckoutCompleted.ts +1 -1
- package/src/components/paywall/hooks/useLoadPaywallData.ts +1 -1
- package/src/hooks/index.ts +7 -0
- package/src/hooks/useActiveSubscriptions.ts +21 -0
- package/src/hooks/useBooleanEntitlement.ts +20 -0
- package/src/hooks/useCustomerPortal.ts +21 -0
- package/src/hooks/useFetch.ts +31 -0
- package/src/hooks/useMeteredEntitlement.ts +20 -0
- package/src/hooks/useNumericEntitlement.ts +20 -0
- package/src/hooks/usePaywall.ts +21 -0
- package/src/hooks/useStiggContext.ts +13 -0
- package/src/index.ts +13 -7
- package/src/theme/Theme.tsx +2 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.
|
|
2
|
+
"version": "5.28.0",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"@emotion/react": "^11.10.5",
|
|
115
115
|
"@emotion/styled": "^11.10.5",
|
|
116
116
|
"@mui/material": "^5.12.0",
|
|
117
|
-
"@stigg/js-client-sdk": "3.
|
|
117
|
+
"@stigg/js-client-sdk": "3.35.0",
|
|
118
118
|
"@stripe/react-stripe-js": "^2.1.1",
|
|
119
119
|
"@stripe/stripe-js": "^1.54.1",
|
|
120
120
|
"@types/styled-components": "^5.1.26",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GetBooleanEntitlement } from '@stigg/js-client-sdk';
|
|
3
|
+
import { useBooleanEntitlement } from '../hooks';
|
|
4
|
+
|
|
5
|
+
type BooleanEntitlementGuardProps = GetBooleanEntitlement & {
|
|
6
|
+
noAccessComponent?: React.ReactNode;
|
|
7
|
+
children: React.ReactElement;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function BooleanEntitlementGuard({
|
|
11
|
+
noAccessComponent,
|
|
12
|
+
children,
|
|
13
|
+
...rest
|
|
14
|
+
}: BooleanEntitlementGuardProps): JSX.Element {
|
|
15
|
+
const { hasAccess } = useBooleanEntitlement(rest);
|
|
16
|
+
|
|
17
|
+
if (!hasAccess) {
|
|
18
|
+
return <>{noAccessComponent ?? null}</>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return children;
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GetMeteredEntitlement } from '@stigg/js-client-sdk';
|
|
3
|
+
import { useMeteredEntitlement } from '../hooks';
|
|
4
|
+
|
|
5
|
+
type MeteredEntitlementGuardProps = GetMeteredEntitlement & {
|
|
6
|
+
noAccessComponent?: React.ReactNode;
|
|
7
|
+
children: React.ReactElement;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function MeteredEntitlementGuard({
|
|
11
|
+
noAccessComponent,
|
|
12
|
+
children,
|
|
13
|
+
...rest
|
|
14
|
+
}: MeteredEntitlementGuardProps): JSX.Element {
|
|
15
|
+
const { hasAccess } = useMeteredEntitlement(rest);
|
|
16
|
+
|
|
17
|
+
if (!hasAccess) {
|
|
18
|
+
return <>{noAccessComponent ?? null}</>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return children;
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GetNumericEntitlement } from '@stigg/js-client-sdk';
|
|
3
|
+
import { useNumericEntitlement } from '../hooks';
|
|
4
|
+
|
|
5
|
+
type NumericEntitlementGuardProps = GetNumericEntitlement & {
|
|
6
|
+
noAccessComponent?: React.ReactNode;
|
|
7
|
+
children: React.ReactElement;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function NumericEntitlementGuard({
|
|
11
|
+
noAccessComponent,
|
|
12
|
+
children,
|
|
13
|
+
...rest
|
|
14
|
+
}: NumericEntitlementGuardProps): JSX.Element {
|
|
15
|
+
const { hasAccess } = useNumericEntitlement(rest);
|
|
16
|
+
|
|
17
|
+
if (!hasAccess) {
|
|
18
|
+
return <>{noAccessComponent ?? null}</>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return children;
|
|
22
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useState, PropsWithChildren,
|
|
1
|
+
import React, { useEffect, useState, PropsWithChildren, useRef } from 'react';
|
|
2
2
|
import * as StiggJs from '@stigg/js-client-sdk';
|
|
3
3
|
import Stigg, { ClientConfiguration, EntitlementsFallback } from '@stigg/js-client-sdk';
|
|
4
4
|
import { SkeletonTheme } from 'react-loading-skeleton';
|
|
@@ -30,6 +30,7 @@ export type StiggProviderProps = {
|
|
|
30
30
|
resourceId?: string;
|
|
31
31
|
theme?: CustomizedTheme;
|
|
32
32
|
locale?: string;
|
|
33
|
+
offline?: boolean;
|
|
33
34
|
cacheTtlMs?: number;
|
|
34
35
|
/** @deprecated not longer in use */
|
|
35
36
|
useEntitlementPolling?: boolean;
|
|
@@ -58,6 +59,7 @@ export const StiggProvider: React.FC<PropsWithChildren<StiggProviderProps>> = ({
|
|
|
58
59
|
entitlementsFallback,
|
|
59
60
|
stiggClient,
|
|
60
61
|
children,
|
|
62
|
+
offline,
|
|
61
63
|
clientName = CLIENT_NAME,
|
|
62
64
|
clientVersion = CLIENT_VERSION,
|
|
63
65
|
}) => {
|
|
@@ -76,6 +78,7 @@ export const StiggProvider: React.FC<PropsWithChildren<StiggProviderProps>> = ({
|
|
|
76
78
|
entitlementPollingInterval,
|
|
77
79
|
clientName,
|
|
78
80
|
clientVersion,
|
|
81
|
+
offline,
|
|
79
82
|
};
|
|
80
83
|
const [ctx, setContext] = useState<StiggContextValue>(() => ({
|
|
81
84
|
stigg:
|
|
@@ -165,11 +168,3 @@ export const StiggProvider: React.FC<PropsWithChildren<StiggProviderProps>> = ({
|
|
|
165
168
|
</StiggContext.Provider>
|
|
166
169
|
);
|
|
167
170
|
};
|
|
168
|
-
|
|
169
|
-
export const useStiggContext = (): StiggContextValue => {
|
|
170
|
-
const ctx = useContext(StiggContext);
|
|
171
|
-
if (!ctx) {
|
|
172
|
-
throw new Error('Could not find Stigg context; You need to wrap your app in an <StiggProvider> component.');
|
|
173
|
-
}
|
|
174
|
-
return ctx;
|
|
175
|
-
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { GetCheckoutStateResults } from '@stigg/js-client-sdk';
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import logger from '../../../services/logger';
|
|
4
|
-
import { useStiggContext } from '../../StiggProvider';
|
|
5
4
|
import { MockCheckoutStateCallback } from '../types';
|
|
5
|
+
import { useStiggContext } from '../../../hooks/useStiggContext';
|
|
6
6
|
|
|
7
7
|
type UseLoadCheckoutProps = {
|
|
8
8
|
planId: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import isEmpty from 'lodash/isEmpty';
|
|
3
3
|
import { BillingAddress, PreviewSubscription, StiggClient, SubscriptionPreviewV2 } from '@stigg/js-client-sdk';
|
|
4
|
-
import { useStiggContext } from '../../StiggProvider';
|
|
5
4
|
import { useCheckoutContext } from '../CheckoutProvider';
|
|
6
5
|
import { useCheckoutModel } from './useCheckoutModel';
|
|
7
6
|
import { SubscriptionState, useSubscriptionModel } from './useSubscriptionModel';
|
|
8
7
|
import { MockCheckoutPreviewCallback } from '../types';
|
|
8
|
+
import { useStiggContext } from '../../../hooks/useStiggContext';
|
|
9
9
|
|
|
10
10
|
function mapBillingInformation({
|
|
11
11
|
billingAddress,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CustomerPortal } from '@stigg/js-client-sdk';
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import logger from '../../../services/logger';
|
|
4
|
-
import { useStiggContext } from '
|
|
4
|
+
import { useStiggContext } from '../../../hooks/useStiggContext';
|
|
5
5
|
|
|
6
6
|
type UseCustomerPortalProps = {
|
|
7
7
|
resourceId?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Subscription } from '@stigg/js-client-sdk';
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import { useStiggContext } from '
|
|
3
|
+
import { useStiggContext } from '../../hooks/useStiggContext';
|
|
4
4
|
|
|
5
5
|
function useQueryParams(paramName?: string) {
|
|
6
6
|
return useMemo(() => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BillingPeriod, Paywall } from '@stigg/js-client-sdk';
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import logger from '../../../services/logger';
|
|
4
|
-
import { useStiggContext } from '../../StiggProvider';
|
|
5
4
|
import { PaywallData } from '../types';
|
|
6
5
|
import { computeBillingPeriods } from '../utils/computeDefaultBillingPeriod';
|
|
7
6
|
import { mapPaywallData } from '../utils/mapPaywallData';
|
|
7
|
+
import { useStiggContext } from '../../../hooks/useStiggContext';
|
|
8
8
|
|
|
9
9
|
type UseLoadPaywallDataProps = {
|
|
10
10
|
productId?: string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { useBooleanEntitlement } from './useBooleanEntitlement';
|
|
2
|
+
export { useNumericEntitlement } from './useNumericEntitlement';
|
|
3
|
+
export { useMeteredEntitlement } from './useMeteredEntitlement';
|
|
4
|
+
export { useActiveSubscriptions } from './useActiveSubscriptions';
|
|
5
|
+
export { usePaywall } from './usePaywall';
|
|
6
|
+
export { useCustomerPortal } from './useCustomerPortal';
|
|
7
|
+
export { useStiggContext } from './useStiggContext';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useMemo, useCallback } from 'react';
|
|
2
|
+
import { GetActiveSubscriptions } from '@stigg/js-client-sdk';
|
|
3
|
+
import { useStiggContext } from './useStiggContext';
|
|
4
|
+
import { useFetch } from './useFetch';
|
|
5
|
+
|
|
6
|
+
export function useActiveSubscriptions(params?: GetActiveSubscriptions) {
|
|
7
|
+
const stiggContext = useStiggContext({ optional: true });
|
|
8
|
+
const stigg = stiggContext?.stigg;
|
|
9
|
+
|
|
10
|
+
const func = useCallback(() => (stigg ? stigg.getActiveSubscriptions(params) : Promise.resolve([])), [params, stigg]);
|
|
11
|
+
const { data, error, isLoaded } = useFetch({ func });
|
|
12
|
+
|
|
13
|
+
return useMemo(
|
|
14
|
+
() => ({
|
|
15
|
+
activeSubscriptions: data,
|
|
16
|
+
isLoaded,
|
|
17
|
+
error,
|
|
18
|
+
}),
|
|
19
|
+
[data, error, isLoaded],
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BooleanEntitlement, GetBooleanEntitlement, BOOLEAN_DEFAULT_FALLBACK_ENTITLEMENT } from '@stigg/js-client-sdk';
|
|
2
|
+
import { useStiggContext } from './useStiggContext';
|
|
3
|
+
|
|
4
|
+
export type TypedGetBooleanEntitlement<T> = Omit<GetBooleanEntitlement, 'featureId'> & {
|
|
5
|
+
featureId: T;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export function useBooleanEntitlement<T extends string>(params: TypedGetBooleanEntitlement<T>): BooleanEntitlement {
|
|
9
|
+
const stiggContext = useStiggContext({ optional: true });
|
|
10
|
+
const stigg = stiggContext?.stigg;
|
|
11
|
+
|
|
12
|
+
if (!stigg) {
|
|
13
|
+
return {
|
|
14
|
+
...BOOLEAN_DEFAULT_FALLBACK_ENTITLEMENT,
|
|
15
|
+
...params.options?.fallback,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return stigg.getBooleanEntitlement(params);
|
|
20
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useMemo, useCallback } from 'react';
|
|
2
|
+
import { GetCustomerPortal } from '@stigg/js-client-sdk';
|
|
3
|
+
import { useStiggContext } from './useStiggContext';
|
|
4
|
+
import { useFetch } from './useFetch';
|
|
5
|
+
|
|
6
|
+
export function useCustomerPortal(params?: GetCustomerPortal) {
|
|
7
|
+
const stiggContext = useStiggContext({ optional: true });
|
|
8
|
+
const stigg = stiggContext?.stigg;
|
|
9
|
+
|
|
10
|
+
const func = useCallback(() => (stigg ? stigg.getCustomerPortal(params) : Promise.resolve(null)), [params, stigg]);
|
|
11
|
+
const { data, error, isLoaded } = useFetch({ func });
|
|
12
|
+
|
|
13
|
+
return useMemo(
|
|
14
|
+
() => ({
|
|
15
|
+
customerPortal: data,
|
|
16
|
+
isLoaded,
|
|
17
|
+
error,
|
|
18
|
+
}),
|
|
19
|
+
[data, error, isLoaded],
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
export type FetchResult<T> = {
|
|
4
|
+
isLoaded: boolean;
|
|
5
|
+
error: Error | null;
|
|
6
|
+
data: T | null;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export function useFetch<T>({ func }: { func: () => Promise<T> }): FetchResult<T> {
|
|
10
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
11
|
+
const [error, setError] = useState<Error | null>(null);
|
|
12
|
+
const [data, setData] = useState<T | null>(null);
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const fetchData = async () => {
|
|
16
|
+
setIsLoaded(true);
|
|
17
|
+
try {
|
|
18
|
+
const result = await func();
|
|
19
|
+
setData(result);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
setError(error as Error);
|
|
22
|
+
} finally {
|
|
23
|
+
setIsLoaded(false);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
void fetchData();
|
|
28
|
+
}, [func]);
|
|
29
|
+
|
|
30
|
+
return { isLoaded, error, data };
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { GetMeteredEntitlement, METERED_DEFAULT_FALLBACK_ENTITLEMENT, MeteredEntitlement } from '@stigg/js-client-sdk';
|
|
2
|
+
import { useStiggContext } from './useStiggContext';
|
|
3
|
+
|
|
4
|
+
type TypedGetMeteredEntitlement<T> = Omit<GetMeteredEntitlement, 'featureId'> & {
|
|
5
|
+
featureId: T;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export function useMeteredEntitlement<T extends string>(params: TypedGetMeteredEntitlement<T>): MeteredEntitlement {
|
|
9
|
+
const stiggContext = useStiggContext({ optional: true });
|
|
10
|
+
const stigg = stiggContext?.stigg;
|
|
11
|
+
|
|
12
|
+
if (!stigg) {
|
|
13
|
+
return {
|
|
14
|
+
...METERED_DEFAULT_FALLBACK_ENTITLEMENT,
|
|
15
|
+
...params.options?.fallback,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return stigg.getMeteredEntitlement(params);
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { NumericEntitlement, GetNumericEntitlement, NUMERIC_DEFAULT_FALLBACK_ENTITLEMENT } from '@stigg/js-client-sdk';
|
|
2
|
+
import { useStiggContext } from './useStiggContext';
|
|
3
|
+
|
|
4
|
+
type TypedGetNumericEntitlement<T> = Omit<GetNumericEntitlement, 'featureId'> & {
|
|
5
|
+
featureId: T;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export function useNumericEntitlement<T extends string>(params: TypedGetNumericEntitlement<T>): NumericEntitlement {
|
|
9
|
+
const stiggContext = useStiggContext({ optional: true });
|
|
10
|
+
const stigg = stiggContext?.stigg;
|
|
11
|
+
|
|
12
|
+
if (!stigg) {
|
|
13
|
+
return {
|
|
14
|
+
...NUMERIC_DEFAULT_FALLBACK_ENTITLEMENT,
|
|
15
|
+
...params.options?.fallback,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return stigg.getNumericEntitlement(params);
|
|
20
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useMemo, useCallback } from 'react';
|
|
2
|
+
import { GetPaywall } from '@stigg/js-client-sdk';
|
|
3
|
+
import { useStiggContext } from './useStiggContext';
|
|
4
|
+
import { useFetch } from './useFetch';
|
|
5
|
+
|
|
6
|
+
export function usePaywall(params?: GetPaywall) {
|
|
7
|
+
const stiggContext = useStiggContext({ optional: true });
|
|
8
|
+
const stigg = stiggContext?.stigg;
|
|
9
|
+
|
|
10
|
+
const func = useCallback(() => (stigg ? stigg.getPaywall(params) : Promise.resolve(null)), [params, stigg]);
|
|
11
|
+
const { data, error, isLoaded } = useFetch({ func });
|
|
12
|
+
|
|
13
|
+
return useMemo(
|
|
14
|
+
() => ({
|
|
15
|
+
paywall: data,
|
|
16
|
+
isLoaded,
|
|
17
|
+
error,
|
|
18
|
+
}),
|
|
19
|
+
[data, error, isLoaded],
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { StiggContext, StiggContextValue } from '../components/StiggProvider';
|
|
3
|
+
|
|
4
|
+
export function useStiggContext(options?: { optional?: false }): StiggContextValue;
|
|
5
|
+
export function useStiggContext(options: { optional: true }): StiggContextValue | null;
|
|
6
|
+
export function useStiggContext(options?: { optional?: boolean }): StiggContextValue | null {
|
|
7
|
+
const { optional } = options || {};
|
|
8
|
+
const ctx = useContext(StiggContext);
|
|
9
|
+
if (!ctx && !optional) {
|
|
10
|
+
throw new Error('Could not find Stigg context; You need to wrap your app in an <StiggProvider> component.');
|
|
11
|
+
}
|
|
12
|
+
return ctx;
|
|
13
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -33,13 +33,7 @@ export {
|
|
|
33
33
|
CustomerPortalLocalization,
|
|
34
34
|
CustomerPortalTheme,
|
|
35
35
|
} from './components/customerPortal';
|
|
36
|
-
export {
|
|
37
|
-
StiggProvider,
|
|
38
|
-
StiggProviderProps,
|
|
39
|
-
useStiggContext,
|
|
40
|
-
StiggContextValue,
|
|
41
|
-
StiggContext,
|
|
42
|
-
} from './components/StiggProvider';
|
|
36
|
+
export { StiggProvider, StiggProviderProps, StiggContextValue, StiggContext } from './components/StiggProvider';
|
|
43
37
|
export {
|
|
44
38
|
Checkout,
|
|
45
39
|
CheckoutProps,
|
|
@@ -57,5 +51,17 @@ export {
|
|
|
57
51
|
TaxDetailsInput,
|
|
58
52
|
} from './components/checkout';
|
|
59
53
|
export { useWaitForCheckoutCompleted, ProvisionStatus } from './components/hooks';
|
|
54
|
+
export {
|
|
55
|
+
useBooleanEntitlement,
|
|
56
|
+
useMeteredEntitlement,
|
|
57
|
+
useNumericEntitlement,
|
|
58
|
+
useActiveSubscriptions,
|
|
59
|
+
useCustomerPortal,
|
|
60
|
+
useStiggContext,
|
|
61
|
+
usePaywall,
|
|
62
|
+
} from './hooks';
|
|
60
63
|
export { HorizontalAlignment, TextAlignment, FontVariant, FontWeight, StiggTheme } from './theme/types';
|
|
61
64
|
export { CustomizedTheme as Theme } from './theme/Theme';
|
|
65
|
+
export { BooleanEntitlementGuard } from './components/BooleanEntitlementGuard';
|
|
66
|
+
export { NumericEntitlementGuard } from './components/NumericEntitlementGuard';
|
|
67
|
+
export { MeteredEntitlementGuard } from './components/MeteredEntitlementGuard';
|
package/src/theme/Theme.tsx
CHANGED
|
@@ -5,11 +5,12 @@ import { TypographyProps } from 'styled-typography';
|
|
|
5
5
|
import { css, ThemeProvider } from '@emotion/react';
|
|
6
6
|
import styled from '@emotion/styled/macro';
|
|
7
7
|
import { createTheme, ThemeProvider as MuiThemeProvider, THEME_ID } from '@mui/material/styles';
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
import { DeepPartial } from '../types';
|
|
10
10
|
import { Fonts } from './Fonts';
|
|
11
11
|
import { getResolvedTheme } from './getResolvedTheme';
|
|
12
12
|
import { StiggTheme } from './types';
|
|
13
|
+
import { useStiggContext } from '../hooks/useStiggContext';
|
|
13
14
|
|
|
14
15
|
export type CustomizedTheme = DeepPartial<StiggTheme>;
|
|
15
16
|
|