@atlasauth/solid 0.9.0 → 0.10.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 +4 -0
- package/dist/ciba.d.ts +7 -0
- package/dist/ciba.js +71 -0
- package/dist/ciba.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
package/dist/ciba.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type JSX } from 'solid-js';
|
|
2
|
+
/**
|
|
3
|
+
* `<ManageCiba/>` — sign-in requests apps start on the user's behalf (CIBA), with approve and deny, and the
|
|
4
|
+
* optional CIBA PIN apps must send as the user code. Renders nothing when there is no request, no PIN and no
|
|
5
|
+
* app that could ask.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ManageCiba(): JSX.Element;
|
package/dist/ciba.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createSignal, onMount } from 'solid-js';
|
|
2
|
+
import { FapiClient, clearCibaPin, decideCibaRequest, getCibaPin, listCibaRequests, setCibaPin, } from '@atlasauth/js';
|
|
3
|
+
import { h } from './h';
|
|
4
|
+
import { useAtlas } from './context';
|
|
5
|
+
import { ATLAS_SOLID_SDK } from './version';
|
|
6
|
+
/**
|
|
7
|
+
* `<ManageCiba/>` — sign-in requests apps start on the user's behalf (CIBA), with approve and deny, and the
|
|
8
|
+
* optional CIBA PIN apps must send as the user code. Renders nothing when there is no request, no PIN and no
|
|
9
|
+
* app that could ask.
|
|
10
|
+
*/
|
|
11
|
+
export function ManageCiba() {
|
|
12
|
+
const atlas = useAtlas();
|
|
13
|
+
const client = new FapiClient({ publishableKey: atlas.publishableKey, baseUrl: atlas.frontendApi, locale: atlas.locale, sdk: ATLAS_SOLID_SDK });
|
|
14
|
+
const [requests, setRequests] = createSignal([]);
|
|
15
|
+
const [pin, setPin] = createSignal(null);
|
|
16
|
+
const [newPin, setNewPin] = createSignal('');
|
|
17
|
+
const [password, setPassword] = createSignal('');
|
|
18
|
+
const [message, setMessage] = createSignal(null);
|
|
19
|
+
const load = async () => {
|
|
20
|
+
const [r, p] = await Promise.all([listCibaRequests(client).catch(() => []), getCibaPin(client).catch(() => null)]);
|
|
21
|
+
setRequests(r);
|
|
22
|
+
setPin(p);
|
|
23
|
+
};
|
|
24
|
+
onMount(() => void load());
|
|
25
|
+
const run = async (fn, fallback) => {
|
|
26
|
+
setMessage(null);
|
|
27
|
+
try {
|
|
28
|
+
await fn();
|
|
29
|
+
setNewPin('');
|
|
30
|
+
setPassword('');
|
|
31
|
+
await load();
|
|
32
|
+
}
|
|
33
|
+
catch (e) {
|
|
34
|
+
setMessage(e instanceof Error && e.message ? e.message : fallback);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const button = 'atlas-button-secondary';
|
|
38
|
+
return (() => {
|
|
39
|
+
const p = pin();
|
|
40
|
+
if (!requests().length && !(p && (p.set || p.available)))
|
|
41
|
+
return null;
|
|
42
|
+
return h('section', { class: 'atlas-card', 'data-atlas': 'manage-ciba' }, [
|
|
43
|
+
requests().length
|
|
44
|
+
? [
|
|
45
|
+
h('h2', 'Sign-in requests from apps'),
|
|
46
|
+
h('ul', requests().map((r) => h('li', [
|
|
47
|
+
h('strong', r.client_name),
|
|
48
|
+
r.binding_message ? h('div', r.binding_message) : null,
|
|
49
|
+
h('small', r.scope.join(', ')),
|
|
50
|
+
h('button', { class: button, type: 'button', onClick: () => void run(() => decideCibaRequest(client, r.id, 'approve'), 'Could not approve.') }, 'Approve'),
|
|
51
|
+
h('button', { class: button, type: 'button', onClick: () => void run(() => decideCibaRequest(client, r.id, 'deny'), 'Could not deny.') }, 'Deny'),
|
|
52
|
+
]))),
|
|
53
|
+
]
|
|
54
|
+
: null,
|
|
55
|
+
p && (p.set || p.available)
|
|
56
|
+
? h('form', { onSubmit: (e) => { e.preventDefault(); void run(() => setCibaPin(client, { pin: newPin(), currentPassword: password() }), 'Could not save the PIN.'); } }, [
|
|
57
|
+
h('h2', 'CIBA PIN'),
|
|
58
|
+
h('p', `${p.set ? 'You have a CIBA PIN.' : 'You have not set a CIBA PIN.'} Apps that start a sign-in request for you must send it.`),
|
|
59
|
+
h('input', { type: 'password', autocomplete: 'current-password', placeholder: 'Current password', 'aria-label': 'Current password', value: password(), onInput: (e) => setPassword(e.target.value) }),
|
|
60
|
+
h('input', { type: 'password', inputmode: 'numeric', autocomplete: 'off', placeholder: '6 to 12 digits', 'aria-label': 'New CIBA PIN', value: newPin(), onInput: (e) => setNewPin(e.target.value) }),
|
|
61
|
+
h('button', { class: button, type: 'submit' }, p.set ? 'Change PIN' : 'Set PIN'),
|
|
62
|
+
p.set ? h('button', { class: button, type: 'button', onClick: () => void run(() => clearCibaPin(client, { currentPassword: password() }), 'Could not remove the PIN.') }, 'Remove PIN') : null,
|
|
63
|
+
message() ? h('small', { role: 'status' }, message()) : null,
|
|
64
|
+
])
|
|
65
|
+
: message()
|
|
66
|
+
? h('small', { role: 'status' }, message())
|
|
67
|
+
: null,
|
|
68
|
+
]);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=ciba.js.map
|
package/dist/ciba.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ciba.js","sourceRoot":"","sources":["../src/ciba.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAY,MAAM,UAAU,CAAC;AAC3D,OAAO,EACL,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,UAAU,GAGX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;GAIG;AACH,M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CAA2B,CAAC;AAC/B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './control-components';
|
|
|
6
6
|
export * from './widgets';
|
|
7
7
|
export { policyHost, policyText, mountPolicyGateWidget } from './policies';
|
|
8
8
|
export * from './organization';
|
|
9
|
+
export { ManageCiba } from './ciba';
|
|
9
10
|
export type { OrganizationAuditLogEntry, OrganizationAuditLogState } from '@atlasauth/js';
|
|
10
11
|
export { SIGN_OUT_EVENT, onAtlasSignOut } from '@atlasauth/js';
|
|
11
12
|
export type { SignOutEvent, SignOutReason } from '@atlasauth/js';
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export * from './control-components';
|
|
|
6
6
|
export * from './widgets';
|
|
7
7
|
export { policyHost, policyText, mountPolicyGateWidget } from './policies';
|
|
8
8
|
export * from './organization';
|
|
9
|
+
export { ManageCiba } from './ciba';
|
|
9
10
|
// `onSignOut({ reason })` event types + the `atlas:signout` window event; this SDK's version.
|
|
10
11
|
export { SIGN_OUT_EVENT, onAtlasSignOut } from '@atlasauth/js';
|
|
11
12
|
export { ATLAS_SOLID_SDK, ATLAS_SOLID_VERSION } from './version';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAC3E,cAAc,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAC3E,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGpC,8FAA8F;AAC9F,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlasauth/solid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@atlasauth/js": "0.
|
|
14
|
+
"@atlasauth/js": "0.26.1"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"solid-js": ">=1.8"
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"dist",
|
|
31
|
+
"!dist/*.tsbuildinfo",
|
|
31
32
|
"README.md",
|
|
32
33
|
"CHANGELOG.md"
|
|
33
34
|
],
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
},
|
|
43
44
|
"scripts": {
|
|
44
45
|
"build": "tsc -p tsconfig.build.json",
|
|
45
|
-
"typecheck": "
|
|
46
|
+
"typecheck": "tsgo -p tsconfig.json --noEmit --incremental --tsBuildInfoFile node_modules/.cache/typecheck.tsbuildinfo",
|
|
46
47
|
"test": "vitest run"
|
|
47
48
|
}
|
|
48
49
|
}
|