@atlasauth/expo 0.2.1 → 0.3.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/CHANGELOG.md +9 -0
- package/README.md +20 -0
- package/dist/AtlasProvider.js +13 -1
- package/dist/AtlasProvider.js.map +1 -1
- package/dist/fapi-context.d.ts +3 -0
- package/dist/fapi-context.js +7 -0
- package/dist/fapi-context.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/policies.d.ts +57 -0
- package/dist/policies.js +86 -0
- package/dist/policies.js.map +1 -0
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlasauth/expo changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.0 — 2026-10-24
|
|
4
|
+
Requires `@atlasauth/react-native` with policy acceptance (new dependency).
|
|
5
|
+
- **Policy acceptance** (terms of service, privacy, any policy the app defines). `<PolicyConsent>`, `<PolicyClickwrap>`,
|
|
6
|
+
`<PolicyAcceptStep>`, `<PolicyScrollHost>`, `<PolicyScrollModal>`, `<PolicyViewer>` and `<PolicyDocument>` are the
|
|
7
|
+
`@atlasauth/react-native` components, re-exported; `usePolicies()`, `usePendingPolicies()`, `usePolicyGate()` and
|
|
8
|
+
`<PolicyGate>` are bound to this package's `<AtlasProvider>`. `<AtlasProvider>` now also provides the bearer client it
|
|
9
|
+
builds over the token cache: `useExpoFapiClient()`, for `@atlasauth/js` calls such as `startSignUp({ policyAcceptances })` and
|
|
10
|
+
`acceptAttemptPolicies(...)`.
|
|
11
|
+
|
|
3
12
|
## 0.2.1
|
|
4
13
|
- **Fixed:** depends on `@atlasauth/react` `^0.9.0` instead of one exact version. With an exact pin, an app that also
|
|
5
14
|
installed a newer `@atlasauth/react` got two copies, and hooks from one couldn't see the other's
|
package/README.md
CHANGED
|
@@ -134,6 +134,26 @@ if (session) mgr.setSession(session);
|
|
|
134
134
|
const headers = await mgr.authHeaders(); // { Authorization, 'x-publishable-key' }
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
+
## Policy acceptance (terms of service, privacy)
|
|
138
|
+
|
|
139
|
+
When the app defines policies in the Atlas dashboard, sign-up must carry the user's acceptance and sign-in can be held until a
|
|
140
|
+
newer version is accepted. The components are React Native views (see `@atlasauth/react-native`); the hooks use this package's
|
|
141
|
+
provider and bearer client.
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
import { usePolicies, PolicyConsent, PolicyClickwrap, PolicyScrollHost, useExpoFapiClient } from '@atlasauth/expo';
|
|
145
|
+
import { startSignUp } from '@atlasauth/js';
|
|
146
|
+
|
|
147
|
+
const { controller, canSubmit, build } = usePolicies();
|
|
148
|
+
const client = useExpoFapiClient();
|
|
149
|
+
// <PolicyConsent controller={controller} /> ... then, on submit (after <PolicyScrollHost> reads any `scroll` policies):
|
|
150
|
+
await startSignUp(client, { email, password, policyAcceptances: build() });
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
A sign-in held at `needs_policy_acceptance` is continued with `acceptAttemptPolicies(client, state, controller.build())` from
|
|
154
|
+
`@atlasauth/js` (`usePendingPolicies({ pendingPolicies })` builds the controller and `<PolicyAcceptStep>` draws the step).
|
|
155
|
+
`<PolicyGate>` shows a signed-in banner and re-acceptance modal.
|
|
156
|
+
|
|
137
157
|
## Companion packages
|
|
138
158
|
|
|
139
159
|
| Package | What it adds |
|
package/dist/AtlasProvider.js
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AtlasProvider = AtlasProvider;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
const js_1 = require("@atlasauth/js");
|
|
5
6
|
const react_2 = require("@atlasauth/react");
|
|
6
7
|
const cache_fetch_1 = require("./cache-fetch");
|
|
8
|
+
const fapi_context_1 = require("./fapi-context");
|
|
7
9
|
const token_cache_1 = require("./token-cache");
|
|
8
10
|
function AtlasProvider(props) {
|
|
9
11
|
const { tokenCache, tokenKey = token_cache_1.DEFAULT_SESSION_KEY, fetchImpl, ...rest } = props;
|
|
@@ -12,8 +14,17 @@ function AtlasProvider(props) {
|
|
|
12
14
|
// re-renders rather than being re-created and losing the session every render.
|
|
13
15
|
const [wiring] = (0, react_1.useState)(() => {
|
|
14
16
|
const cache = tokenCache ?? (0, token_cache_1.createInMemoryTokenCache)();
|
|
17
|
+
const cacheFetch = (0, cache_fetch_1.createCacheFetch)({ cache, key: tokenKey, fetchImpl: fetchImpl ?? fetch });
|
|
15
18
|
return {
|
|
16
|
-
cacheFetch
|
|
19
|
+
cacheFetch,
|
|
20
|
+
// The same bearer-authenticated transport for `@atlasauth/js` calls made outside the
|
|
21
|
+
// React provider's own client (policy acceptance, `useExpoFapiClient()`).
|
|
22
|
+
fapi: new js_1.FapiClient({
|
|
23
|
+
publishableKey: rest.publishableKey,
|
|
24
|
+
baseUrl: (0, js_1.resolveFrontendApi)(rest.frontendApi, { component: '<AtlasProvider> (expo)', allowSameOrigin: false }),
|
|
25
|
+
fetchImpl: cacheFetch,
|
|
26
|
+
locale: rest.locale,
|
|
27
|
+
}),
|
|
17
28
|
// Sign-out tombstones persist beside the token (there is no localStorage).
|
|
18
29
|
tombstoneStore: (0, token_cache_1.tombstoneStoreFor)(cache),
|
|
19
30
|
};
|
|
@@ -22,6 +33,7 @@ function AtlasProvider(props) {
|
|
|
22
33
|
...rest,
|
|
23
34
|
tombstoneStore: rest.tombstoneStore ?? wiring.tombstoneStore,
|
|
24
35
|
fetchImpl: wiring.cacheFetch,
|
|
36
|
+
children: (0, react_1.createElement)(fapi_context_1.ExpoFapiContext.Provider, { value: wiring.fapi }, rest.children),
|
|
25
37
|
});
|
|
26
38
|
}
|
|
27
39
|
//# sourceMappingURL=AtlasProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AtlasProvider.js","sourceRoot":"","sources":["../src/AtlasProvider.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"AtlasProvider.js","sourceRoot":"","sources":["../src/AtlasProvider.tsx"],"names":[],"mappings":";;AAwDA,sCA8BC;AAtFD,iCAAmE;AACnE,sCAA+D;AAC/D,4CAG0B;AAC1B,+CAAiD;AACjD,iDAAiD;AACjD,+CAKuB;AA2CvB,SAAgB,aAAa,CAAC,KAAyB;IACrD,MAAM,EAAE,UAAU,EAAE,QAAQ,GAAG,iCAAmB,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAEjF,+EAA+E;IAC/E,sEAAsE;IACtE,+EAA+E;IAC/E,MAAM,CAAC,MAAM,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE;QAC7B,MAAM,KAAK,GAAG,UAAU,IAAI,IAAA,sCAAwB,GAAE,CAAC;QACvD,MAAM,UAAU,GAAG,IAAA,8BAAgB,EAAC,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,IAAI,KAAK,EAAE,CAAC,CAAC;QAC7F,OAAO;YACL,UAAU;YACV,qFAAqF;YACrF,0EAA0E;YAC1E,IAAI,EAAE,IAAI,eAAU,CAAC;gBACnB,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,OAAO,EAAE,IAAA,uBAAkB,EAAC,IAAI,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,wBAAwB,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;gBAC9G,SAAS,EAAE,UAAU;gBACrB,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB,CAAC;YACF,2EAA2E;YAC3E,cAAc,EAAE,IAAA,+BAAiB,EAAC,KAAK,CAAC;SACzC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,IAAA,qBAAa,EAAC,qBAAkB,EAAE;QACvC,GAAG,IAAI;QACP,cAAc,EAAE,IAAI,CAAC,cAAc,IAAI,MAAM,CAAC,cAAc;QAC5D,SAAS,EAAE,MAAM,CAAC,UAAU;QAC5B,QAAQ,EAAE,IAAA,qBAAa,EAAC,8BAAe,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC;KACzF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExpoFapiContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
/** The bearer-authenticated client `<AtlasProvider>` provides (null outside it). */
|
|
6
|
+
exports.ExpoFapiContext = (0, react_1.createContext)(null);
|
|
7
|
+
//# sourceMappingURL=fapi-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fapi-context.js","sourceRoot":"","sources":["../src/fapi-context.ts"],"names":[],"mappings":";;;AAAA,iCAAsC;AAGtC,oFAAoF;AACvE,QAAA,eAAe,GAAG,IAAA,qBAAa,EAAoB,IAAI,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export * from './cache-fetch';
|
|
|
3
3
|
export * from './AtlasProvider';
|
|
4
4
|
export * from './native-session';
|
|
5
5
|
export { useAuth, useUser, useSession, useSessionList, useOrganization, SignedIn, SignedOut, Protect, AtlasLoading, AtlasLoaded, } from '@atlasauth/react';
|
|
6
|
+
export * from './policies';
|
package/dist/index.js
CHANGED
|
@@ -44,4 +44,6 @@ Object.defineProperty(exports, "SignedOut", { enumerable: true, get: function ()
|
|
|
44
44
|
Object.defineProperty(exports, "Protect", { enumerable: true, get: function () { return react_1.Protect; } });
|
|
45
45
|
Object.defineProperty(exports, "AtlasLoading", { enumerable: true, get: function () { return react_1.AtlasLoading; } });
|
|
46
46
|
Object.defineProperty(exports, "AtlasLoaded", { enumerable: true, get: function () { return react_1.AtlasLoaded; } });
|
|
47
|
+
// Policy acceptance (terms, privacy, any policy): native components + hooks bound to this provider.
|
|
48
|
+
__exportStar(require("./policies"), exports);
|
|
47
49
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2EAA2E;AAC3E,kEAAkE;AAClE,gDAA8B;AAC9B,gDAA8B;AAC9B,kDAAgC;AAEhC,8EAA8E;AAC9E,mDAAiC;AAEjC;;;;;;;;;;GAUG;AACH,0CAW0B;AAVxB,gGAAA,OAAO,OAAA;AACP,gGAAA,OAAO,OAAA;AACP,mGAAA,UAAU,OAAA;AACV,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,iGAAA,QAAQ,OAAA;AACR,kGAAA,SAAS,OAAA;AACT,gGAAA,OAAO,OAAA;AACP,qGAAA,YAAY,OAAA;AACZ,oGAAA,WAAW,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2EAA2E;AAC3E,kEAAkE;AAClE,gDAA8B;AAC9B,gDAA8B;AAC9B,kDAAgC;AAEhC,8EAA8E;AAC9E,mDAAiC;AAEjC;;;;;;;;;;GAUG;AACH,0CAW0B;AAVxB,gGAAA,OAAO,OAAA;AACP,gGAAA,OAAO,OAAA;AACP,mGAAA,UAAU,OAAA;AACV,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,iGAAA,QAAQ,OAAA;AACR,kGAAA,SAAS,OAAA;AACT,gGAAA,OAAO,OAAA;AACP,qGAAA,YAAY,OAAA;AACZ,oGAAA,WAAW,OAAA;AAGb,oGAAoG;AACpG,6CAA2B"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import type { FapiClient } from '@atlasauth/js';
|
|
3
|
+
import { type PolicyUiProps, type UsePoliciesResult, type UsePolicyGateResult } from '@atlasauth/react-native';
|
|
4
|
+
/**
|
|
5
|
+
* Policy acceptance (terms of service, privacy, any policy) for Expo.
|
|
6
|
+
*
|
|
7
|
+
* The native components are the ones in `@atlasauth/react-native` — they take a
|
|
8
|
+
* `PolicyAcceptanceController` and draw with React Native primitives — so they
|
|
9
|
+
* are re-exported here unchanged. The hooks are bound to THIS package's
|
|
10
|
+
* provider: they use the bearer-authenticated client `<AtlasProvider>` builds
|
|
11
|
+
* over the same token cache, never the DOM components `@atlasauth/react` ships.
|
|
12
|
+
*
|
|
13
|
+
* A sign-up / sign-in screen written with `@atlasauth/js` passes
|
|
14
|
+
* `useExpoFapiClient()` to `startSignUp({ policyAcceptances })` and
|
|
15
|
+
* `acceptAttemptPolicies(...)`.
|
|
16
|
+
*/
|
|
17
|
+
export { PolicyAcceptStep, PolicyClickwrap, PolicyConsent, PolicyDocument, PolicyGateView, PolicyScrollHost, PolicyScrollModal, PolicyViewer, parsePolicyHtml, policyPlainText, type PolicyUiProps, type UsePoliciesResult, type UsePolicyGateResult, } from '@atlasauth/react-native';
|
|
18
|
+
export { ExpoFapiContext } from './fapi-context';
|
|
19
|
+
/**
|
|
20
|
+
* The bearer-authenticated Frontend API client of the surrounding
|
|
21
|
+
* `<AtlasProvider>`: the same token cache and transport the session uses.
|
|
22
|
+
* Throws outside the provider, on purpose.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useExpoFapiClient(): FapiClient;
|
|
25
|
+
/**
|
|
26
|
+
* Load the instance's policies into a controller (`GET /v1/client/policies`)
|
|
27
|
+
* for a sign-up form; draw them with `<PolicyConsent>` / `<PolicyClickwrap>`,
|
|
28
|
+
* enable your submit with `canSubmit`, and send `build()` as `policyAcceptances`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function usePolicies(options?: {
|
|
31
|
+
combined?: boolean;
|
|
32
|
+
signIn?: boolean;
|
|
33
|
+
}): UsePoliciesResult;
|
|
34
|
+
/**
|
|
35
|
+
* The controller for a sign-in attempt the server holds at
|
|
36
|
+
* `needs_policy_acceptance`; pass `{ pendingPolicies }` from the held attempt
|
|
37
|
+
* (an empty object, from a redirect, shows every required policy), or null.
|
|
38
|
+
*/
|
|
39
|
+
export declare function usePendingPolicies(held: {
|
|
40
|
+
pendingPolicies?: unknown;
|
|
41
|
+
} | null | undefined, options?: {
|
|
42
|
+
combined?: boolean;
|
|
43
|
+
}): {
|
|
44
|
+
controller: import("@atlasauth/js").PolicyAcceptanceController | null;
|
|
45
|
+
loading: boolean;
|
|
46
|
+
};
|
|
47
|
+
/** In-app re-acceptance for the signed-in user (see `<PolicyGate>`). */
|
|
48
|
+
export declare function usePolicyGate(): UsePolicyGateResult;
|
|
49
|
+
/**
|
|
50
|
+
* A banner for a signed-in user whose policies need re-accepting. Draws nothing
|
|
51
|
+
* when there is nothing to accept; renders `children` always. "Review and
|
|
52
|
+
* accept" opens the acceptance step in a modal and posts the result.
|
|
53
|
+
*/
|
|
54
|
+
export declare function PolicyGate(props: {
|
|
55
|
+
children?: ReactNode;
|
|
56
|
+
onAccepted?: () => void;
|
|
57
|
+
} & PolicyUiProps): ReactElement;
|
package/dist/policies.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExpoFapiContext = exports.policyPlainText = exports.parsePolicyHtml = exports.PolicyViewer = exports.PolicyScrollModal = exports.PolicyScrollHost = exports.PolicyGateView = exports.PolicyDocument = exports.PolicyConsent = exports.PolicyClickwrap = exports.PolicyAcceptStep = void 0;
|
|
4
|
+
exports.useExpoFapiClient = useExpoFapiClient;
|
|
5
|
+
exports.usePolicies = usePolicies;
|
|
6
|
+
exports.usePendingPolicies = usePendingPolicies;
|
|
7
|
+
exports.usePolicyGate = usePolicyGate;
|
|
8
|
+
exports.PolicyGate = PolicyGate;
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const react_2 = require("@atlasauth/react");
|
|
11
|
+
const fapi_context_1 = require("./fapi-context");
|
|
12
|
+
const react_native_1 = require("@atlasauth/react-native");
|
|
13
|
+
/**
|
|
14
|
+
* Policy acceptance (terms of service, privacy, any policy) for Expo.
|
|
15
|
+
*
|
|
16
|
+
* The native components are the ones in `@atlasauth/react-native` — they take a
|
|
17
|
+
* `PolicyAcceptanceController` and draw with React Native primitives — so they
|
|
18
|
+
* are re-exported here unchanged. The hooks are bound to THIS package's
|
|
19
|
+
* provider: they use the bearer-authenticated client `<AtlasProvider>` builds
|
|
20
|
+
* over the same token cache, never the DOM components `@atlasauth/react` ships.
|
|
21
|
+
*
|
|
22
|
+
* A sign-up / sign-in screen written with `@atlasauth/js` passes
|
|
23
|
+
* `useExpoFapiClient()` to `startSignUp({ policyAcceptances })` and
|
|
24
|
+
* `acceptAttemptPolicies(...)`.
|
|
25
|
+
*/
|
|
26
|
+
var react_native_2 = require("@atlasauth/react-native");
|
|
27
|
+
Object.defineProperty(exports, "PolicyAcceptStep", { enumerable: true, get: function () { return react_native_2.PolicyAcceptStep; } });
|
|
28
|
+
Object.defineProperty(exports, "PolicyClickwrap", { enumerable: true, get: function () { return react_native_2.PolicyClickwrap; } });
|
|
29
|
+
Object.defineProperty(exports, "PolicyConsent", { enumerable: true, get: function () { return react_native_2.PolicyConsent; } });
|
|
30
|
+
Object.defineProperty(exports, "PolicyDocument", { enumerable: true, get: function () { return react_native_2.PolicyDocument; } });
|
|
31
|
+
Object.defineProperty(exports, "PolicyGateView", { enumerable: true, get: function () { return react_native_2.PolicyGateView; } });
|
|
32
|
+
Object.defineProperty(exports, "PolicyScrollHost", { enumerable: true, get: function () { return react_native_2.PolicyScrollHost; } });
|
|
33
|
+
Object.defineProperty(exports, "PolicyScrollModal", { enumerable: true, get: function () { return react_native_2.PolicyScrollModal; } });
|
|
34
|
+
Object.defineProperty(exports, "PolicyViewer", { enumerable: true, get: function () { return react_native_2.PolicyViewer; } });
|
|
35
|
+
Object.defineProperty(exports, "parsePolicyHtml", { enumerable: true, get: function () { return react_native_2.parsePolicyHtml; } });
|
|
36
|
+
Object.defineProperty(exports, "policyPlainText", { enumerable: true, get: function () { return react_native_2.policyPlainText; } });
|
|
37
|
+
var fapi_context_2 = require("./fapi-context");
|
|
38
|
+
Object.defineProperty(exports, "ExpoFapiContext", { enumerable: true, get: function () { return fapi_context_2.ExpoFapiContext; } });
|
|
39
|
+
/**
|
|
40
|
+
* The bearer-authenticated Frontend API client of the surrounding
|
|
41
|
+
* `<AtlasProvider>`: the same token cache and transport the session uses.
|
|
42
|
+
* Throws outside the provider, on purpose.
|
|
43
|
+
*/
|
|
44
|
+
function useExpoFapiClient() {
|
|
45
|
+
const client = (0, react_1.useContext)(fapi_context_1.ExpoFapiContext);
|
|
46
|
+
if (!client)
|
|
47
|
+
throw new Error('Atlas hooks must be used inside <AtlasProvider>.');
|
|
48
|
+
return client;
|
|
49
|
+
}
|
|
50
|
+
function useEnv() {
|
|
51
|
+
const client = useExpoFapiClient();
|
|
52
|
+
const { locale } = (0, react_2.useAtlas)();
|
|
53
|
+
return { client, locale: locale ?? undefined };
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Load the instance's policies into a controller (`GET /v1/client/policies`)
|
|
57
|
+
* for a sign-up form; draw them with `<PolicyConsent>` / `<PolicyClickwrap>`,
|
|
58
|
+
* enable your submit with `canSubmit`, and send `build()` as `policyAcceptances`.
|
|
59
|
+
*/
|
|
60
|
+
function usePolicies(options = {}) {
|
|
61
|
+
return (0, react_native_1.usePoliciesWith)(useEnv(), options);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The controller for a sign-in attempt the server holds at
|
|
65
|
+
* `needs_policy_acceptance`; pass `{ pendingPolicies }` from the held attempt
|
|
66
|
+
* (an empty object, from a redirect, shows every required policy), or null.
|
|
67
|
+
*/
|
|
68
|
+
function usePendingPolicies(held, options = {}) {
|
|
69
|
+
return (0, react_native_1.usePendingPoliciesWith)(useEnv(), held, options);
|
|
70
|
+
}
|
|
71
|
+
/** In-app re-acceptance for the signed-in user (see `<PolicyGate>`). */
|
|
72
|
+
function usePolicyGate() {
|
|
73
|
+
const env = useEnv();
|
|
74
|
+
const { status } = (0, react_2.useAtlas)();
|
|
75
|
+
return (0, react_native_1.usePolicyGateWith)(env, status === 'signed_in');
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A banner for a signed-in user whose policies need re-accepting. Draws nothing
|
|
79
|
+
* when there is nothing to accept; renders `children` always. "Review and
|
|
80
|
+
* accept" opens the acceptance step in a modal and posts the result.
|
|
81
|
+
*/
|
|
82
|
+
function PolicyGate(props) {
|
|
83
|
+
const gate = usePolicyGate();
|
|
84
|
+
return (0, react_1.createElement)(react_native_1.PolicyGateView, { ...props, gate });
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=policies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policies.js","sourceRoot":"","sources":["../src/policies.tsx"],"names":[],"mappings":";;;AAmDA,8CAIC;AAaD,kCAEC;AAOD,gDAKC;AAGD,sCAIC;AAOD,gCAGC;AAnGD,iCAAqF;AAErF,4CAA4C;AAC5C,iDAAiD;AACjD,0DAQiC;AAEjC;;;;;;;;;;;;GAYG;AAEH,wDAciC;AAb/B,gHAAA,gBAAgB,OAAA;AAChB,+GAAA,eAAe,OAAA;AACf,6GAAA,aAAa,OAAA;AACb,8GAAA,cAAc,OAAA;AACd,8GAAA,cAAc,OAAA;AACd,gHAAA,gBAAgB,OAAA;AAChB,iHAAA,iBAAiB,OAAA;AACjB,4GAAA,YAAY,OAAA;AACZ,+GAAA,eAAe,OAAA;AACf,+GAAA,eAAe,OAAA;AAMjB,+CAAiD;AAAxC,+GAAA,eAAe,OAAA;AAExB;;;;GAIG;AACH,SAAgB,iBAAiB;IAC/B,MAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,8BAAe,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACjF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,MAAM;IACb,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAC;IACnC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,gBAAQ,GAAE,CAAC;IAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,SAAS,EAAE,CAAC;AACjD,CAAC;AAED;;;;GAIG;AACH,SAAgB,WAAW,CAAC,UAAoD,EAAE;IAChF,OAAO,IAAA,8BAAe,EAAC,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED;;;;GAIG;AACH,SAAgB,kBAAkB,CAChC,IAAsD,EACtD,UAAkC,EAAE;IAEpC,OAAO,IAAA,qCAAsB,EAAC,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC;AAED,wEAAwE;AACxE,SAAgB,aAAa;IAC3B,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,gBAAQ,GAAE,CAAC;IAC9B,OAAO,IAAA,gCAAiB,EAAC,GAAG,EAAE,MAAM,KAAK,WAAW,CAAC,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,SAAgB,UAAU,CAAC,KAAwE;IACjG,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAC7B,OAAO,IAAA,qBAAa,EAAC,6BAAc,EAAE,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC3D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlasauth/expo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@atlasauth/react": "^0.
|
|
8
|
-
"@atlasauth/
|
|
7
|
+
"@atlasauth/react-native": "^0.6.0",
|
|
8
|
+
"@atlasauth/react": "^0.16.0",
|
|
9
|
+
"@atlasauth/js": "0.19.0"
|
|
9
10
|
},
|
|
10
11
|
"peerDependencies": {
|
|
11
12
|
"react": ">=18",
|