@thunderid/browser 1.2.1 → 1.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/dist/FetchHttpClient.d.ts.map +1 -1
- package/dist/cjs/index.cjs +28 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -3
- package/dist/index.js.map +1 -1
- package/dist/utils/copyTextToClipboard.d.ts +9 -0
- package/dist/utils/copyTextToClipboard.d.ts.map +1 -0
- package/dist/utils/createHttpClientFetcher.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchHttpClient.d.ts","sourceRoot":"","sources":["../src/FetchHttpClient.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,UAAU,EAAa,iBAAiB,EAAE,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAE7F;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,OAAO,CAAC,MAAM,CAAC,SAAS,CAAoE;IAE5F,MAAM,CAAC,WAAW,CAChB,UAAU,SAAI,EACd,gBAAgB,UAAO,EACvB,WAAW,GAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAA0C,GAClG,eAAe;IAOlB,MAAM,CAAC,eAAe,CAAC,UAAU,SAAI,GAAG,IAAI;cAI5B,SAAS,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"FetchHttpClient.d.ts","sourceRoot":"","sources":["../src/FetchHttpClient.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,UAAU,EAAa,iBAAiB,EAAE,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAE7F;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,OAAO,CAAC,MAAM,CAAC,SAAS,CAAoE;IAE5F,MAAM,CAAC,WAAW,CAChB,UAAU,SAAI,EACd,gBAAgB,UAAO,EACvB,WAAW,GAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAA0C,GAClG,eAAe;IAOlB,MAAM,CAAC,eAAe,CAAC,UAAU,SAAI,GAAG,IAAI;cAI5B,SAAS,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CAuFxF;AAED,eAAe,eAAe,CAAC"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -91,9 +91,11 @@ var FetchHttpClient = class FetchHttpClient extends __thunderid_javascript.HttpC
|
|
|
91
91
|
method: (method ?? "GET").toUpperCase()
|
|
92
92
|
});
|
|
93
93
|
} catch (networkError) {
|
|
94
|
+
const isAbort = networkError?.name === "AbortError";
|
|
94
95
|
throw Object.assign(new Error(networkError.message), {
|
|
95
|
-
code: "NETWORK_ERROR",
|
|
96
|
-
config
|
|
96
|
+
code: isAbort ? "ABORT_ERROR" : "NETWORK_ERROR",
|
|
97
|
+
config,
|
|
98
|
+
name: isAbort ? "AbortError" : "Error"
|
|
97
99
|
});
|
|
98
100
|
}
|
|
99
101
|
const responseData = (fetchResponse.headers.get("content-type") ?? "").includes("application/json") ? await fetchResponse.json() : await fetchResponse.text();
|
|
@@ -2899,6 +2901,7 @@ const createHttpClientFetcher = (instanceId = 0) => {
|
|
|
2899
2901
|
data: config.body ? JSON.parse(config.body) : void 0,
|
|
2900
2902
|
headers: config.headers,
|
|
2901
2903
|
method: config.method || "POST",
|
|
2904
|
+
signal: config.signal,
|
|
2902
2905
|
url
|
|
2903
2906
|
});
|
|
2904
2907
|
return toResponse(response.data, response.status, response.statusText || "");
|
|
@@ -2911,6 +2914,28 @@ const createHttpClientFetcher = (instanceId = 0) => {
|
|
|
2911
2914
|
};
|
|
2912
2915
|
var createHttpClientFetcher_default = createHttpClientFetcher;
|
|
2913
2916
|
|
|
2917
|
+
//#endregion
|
|
2918
|
+
//#region src/utils/copyTextToClipboard.ts
|
|
2919
|
+
/**
|
|
2920
|
+
* Copies text to the clipboard. It uses the Clipboard API, and falls back to a hidden textarea and
|
|
2921
|
+
* `document.execCommand('copy')` where the API is missing or refuses, such as on a page without a secure context.
|
|
2922
|
+
*
|
|
2923
|
+
* @param text - The text to copy.
|
|
2924
|
+
*/
|
|
2925
|
+
const copyTextToClipboard = async (text) => {
|
|
2926
|
+
try {
|
|
2927
|
+
await navigator.clipboard.writeText(text);
|
|
2928
|
+
} catch {
|
|
2929
|
+
const textArea = document.createElement("textarea");
|
|
2930
|
+
textArea.value = text;
|
|
2931
|
+
document.body.appendChild(textArea);
|
|
2932
|
+
textArea.select();
|
|
2933
|
+
document.execCommand("copy");
|
|
2934
|
+
document.body.removeChild(textArea);
|
|
2935
|
+
}
|
|
2936
|
+
};
|
|
2937
|
+
var copyTextToClipboard_default = copyTextToClipboard;
|
|
2938
|
+
|
|
2914
2939
|
//#endregion
|
|
2915
2940
|
//#region src/utils/handleWebAuthnAuthentication.ts
|
|
2916
2941
|
const logger$1 = (0, __thunderid_javascript.createPackageComponentLogger)("@thunderid/browser", "WebAuthn");
|
|
@@ -3772,6 +3797,7 @@ exports.SessionStore = SessionStore_default;
|
|
|
3772
3797
|
exports.TOKEN_REQUEST_CONFIG_KEY = TOKEN_REQUEST_CONFIG_KEY;
|
|
3773
3798
|
exports.ThunderIDBrowserClient = ThunderIDBrowserClient_default;
|
|
3774
3799
|
exports.buildAvatarSpec = buildAvatarSpec_default;
|
|
3800
|
+
exports.copyTextToClipboard = copyTextToClipboard_default;
|
|
3775
3801
|
exports.createClassObserver = createClassObserver;
|
|
3776
3802
|
exports.createHttpClientFetcher = createHttpClientFetcher_default;
|
|
3777
3803
|
exports.createMediaQueryListener = createMediaQueryListener;
|