@auth-link/web 0.0.1 → 0.0.3
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 +26 -4
- package/LICENSE +21 -0
- package/README.md +1386 -120
- package/dist/index.js +50 -11
- package/dist/index.js.map +2 -2
- package/dist/react.js.map +2 -2
- package/dist/types/core.d.ts +13 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/vue.js +12 -3
- package/dist/vue.js.map +2 -2
- package/docs/README.en.md +180 -25
- package/docs/README.ja.md +199 -44
- package/docs/README.zh-CN.md +251 -58
- package/docs/go-vue.en.md +254 -0
- package/docs/go-vue.ja.md +254 -0
- package/docs/go-vue.zh-CN.md +258 -0
- package/examples/vue-cms.vue +109 -0
- package/package.json +5 -3
package/dist/types/core.d.ts
CHANGED
|
@@ -7,9 +7,20 @@ export declare function validateDisplayCode(value: unknown): DisplayCode;
|
|
|
7
7
|
export declare function validateTicket(value: unknown, expectedMode?: Mode, trustedOrigin?: string): Ticket;
|
|
8
8
|
export declare function qrImage(ticket: Ticket): string;
|
|
9
9
|
export interface ClientOptions {
|
|
10
|
-
/**
|
|
10
|
+
/** Application backend URL, never the AuthLink tenant API. Defaults to /api/authlink. */
|
|
11
11
|
baseUrl?: string;
|
|
12
|
-
|
|
12
|
+
/** Explicit extra backend origins, e.g. https://api.example.com (no path or wildcard). */
|
|
13
|
+
allowedBackendOrigins?: readonly string[];
|
|
14
|
+
/** Defaults to same-origin, or omit when accessToken is provided. */
|
|
15
|
+
credentials?: RequestCredentials;
|
|
16
|
+
/** Required for cookie/session authentication, including mixed cookie + Bearer mode. */
|
|
17
|
+
csrfToken?: () => string | Promise<string>;
|
|
18
|
+
/** Defaults to X-CSRF-Token; adapt this to your backend framework. */
|
|
19
|
+
csrfHeaderName?: string;
|
|
20
|
+
/** Current website login token, read on each request. Never an AuthLink tenant key. */
|
|
21
|
+
accessToken?: () => string | Promise<string>;
|
|
22
|
+
/** Extra headers. SDK-controlled authentication and protocol headers cannot be replaced. */
|
|
23
|
+
headers?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
|
|
13
24
|
authLinkOrigin?: string;
|
|
14
25
|
fetch?: typeof fetch;
|
|
15
26
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export { AuthLinkError, createAuthLinkClient, requestKey, validateTicket, qrImag
|
|
|
3
3
|
export { supportedLocales } from './i18n.js';
|
|
4
4
|
export { openAuthLink, openAuthLinkBind, openAuthLinkConfirm } from './modal.js';
|
|
5
5
|
export type { AuthLinkModal, AuthLinkModalOptions } from './modal.js';
|
|
6
|
+
export type { ClientOptions } from './core.js';
|
package/dist/vue.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/vue.ts
|
|
2
|
-
import { defineComponent, onBeforeUnmount, onMounted, shallowRef, watch } from "vue";
|
|
2
|
+
import { defineComponent, normalizeClass, onBeforeUnmount, onMounted, shallowRef, watch } from "vue";
|
|
3
3
|
|
|
4
4
|
// node_modules/qrcode-generator/dist/qrcode.mjs
|
|
5
5
|
var qrcode = function(typeNumber, errorCorrectionLevel) {
|
|
@@ -2490,6 +2490,7 @@ function widget(mode) {
|
|
|
2490
2490
|
variant: { type: String, default: "A" },
|
|
2491
2491
|
intervalMs: Number,
|
|
2492
2492
|
showQr: Boolean,
|
|
2493
|
+
className: String,
|
|
2493
2494
|
onRefresh: Function
|
|
2494
2495
|
},
|
|
2495
2496
|
emits: ["confirmed", "rejected", "expired", "error", "close"],
|
|
@@ -2508,7 +2509,8 @@ function widget(mode) {
|
|
|
2508
2509
|
modal = openAuthLink({
|
|
2509
2510
|
...props,
|
|
2510
2511
|
mode,
|
|
2511
|
-
className:
|
|
2512
|
+
className: normalizeClass([props.className, attrs.class]),
|
|
2513
|
+
onRefresh: props.onRefresh ? () => props.onRefresh?.() : void 0,
|
|
2512
2514
|
onConfirmed: (value) => once("confirmed", () => emit("confirmed", value)),
|
|
2513
2515
|
onRejected: (result) => once("rejected", () => emit("rejected", result)),
|
|
2514
2516
|
onExpired: () => once("expired", () => emit("expired")),
|
|
@@ -2520,7 +2522,14 @@ function widget(mode) {
|
|
|
2520
2522
|
mounted = true;
|
|
2521
2523
|
open();
|
|
2522
2524
|
});
|
|
2523
|
-
watch([
|
|
2525
|
+
watch([
|
|
2526
|
+
() => props.ticket,
|
|
2527
|
+
() => props.client,
|
|
2528
|
+
() => props.intervalMs,
|
|
2529
|
+
() => props.showQr,
|
|
2530
|
+
() => props.className,
|
|
2531
|
+
() => Boolean(props.onRefresh)
|
|
2532
|
+
], open);
|
|
2524
2533
|
watch(() => props.locale, (value) => modal?.setLocale(value));
|
|
2525
2534
|
watch(() => props.variant, (value) => modal?.setVariant(value));
|
|
2526
2535
|
onBeforeUnmount(() => {
|