@deflectbot/deflect-sdk 1.1.13 → 1.1.15
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/index.js +7 -2
- package/package.json +1 -1
- package/src/index.ts +7 -2
package/dist/index.js
CHANGED
|
@@ -49,7 +49,6 @@ class Deflect {
|
|
|
49
49
|
throw new Error("siteKey is required in configuration");
|
|
50
50
|
}
|
|
51
51
|
window.Deflect.siteKey = params.siteKey;
|
|
52
|
-
console.log("Deflect configured with siteKey");
|
|
53
52
|
}
|
|
54
53
|
solveChallenge() {
|
|
55
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -92,7 +91,13 @@ class Deflect {
|
|
|
92
91
|
typeof window.Deflect.getToken !== "function") {
|
|
93
92
|
throw new Error("Deflect script did not load properly");
|
|
94
93
|
}
|
|
95
|
-
|
|
94
|
+
let token;
|
|
95
|
+
try {
|
|
96
|
+
token = yield window.Deflect.getToken();
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
throw new Error(`Deflect script execution failed: ${error}`);
|
|
100
|
+
}
|
|
96
101
|
URL.revokeObjectURL(blobUrl);
|
|
97
102
|
scriptEl.remove();
|
|
98
103
|
delete window.Deflect.getToken;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -49,7 +49,6 @@ class Deflect {
|
|
|
49
49
|
throw new Error("siteKey is required in configuration");
|
|
50
50
|
}
|
|
51
51
|
window.Deflect.siteKey = params.siteKey;
|
|
52
|
-
console.log("Deflect configured with siteKey");
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
async solveChallenge(): Promise<string> {
|
|
@@ -105,7 +104,13 @@ class Deflect {
|
|
|
105
104
|
throw new Error("Deflect script did not load properly");
|
|
106
105
|
}
|
|
107
106
|
|
|
108
|
-
|
|
107
|
+
let token: string;
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
token = await window.Deflect.getToken();
|
|
111
|
+
} catch (error) {
|
|
112
|
+
throw new Error(`Deflect script execution failed: ${error}`);
|
|
113
|
+
}
|
|
109
114
|
|
|
110
115
|
URL.revokeObjectURL(blobUrl);
|
|
111
116
|
scriptEl.remove();
|