@dream-api/sdk 0.1.26 → 0.1.27
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 -13
- package/dist/index.mjs +7 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -38,17 +38,10 @@ var DreamAPIException = class extends Error {
|
|
|
38
38
|
|
|
39
39
|
// src/client.ts
|
|
40
40
|
var DEFAULT_BASE_URL = "https://api-multi.k-c-sheffield012376.workers.dev";
|
|
41
|
-
var
|
|
41
|
+
var SIGNUP_URL_TEST = "https://sign-up.k-c-sheffield012376.workers.dev";
|
|
42
42
|
var SIGNUP_URL_LIVE = "https://signup.users.panacea-tech.net";
|
|
43
|
-
var
|
|
43
|
+
var CLERK_URL_TEST = "https://composed-blowfish-76.clerk.accounts.dev";
|
|
44
44
|
var CLERK_URL_LIVE = "https://users.panacea-tech.net";
|
|
45
|
-
function isLocalhost() {
|
|
46
|
-
if (typeof window === "undefined") return false;
|
|
47
|
-
const hostname = window.location.hostname;
|
|
48
|
-
return hostname === "localhost" || hostname === "127.0.0.1";
|
|
49
|
-
}
|
|
50
|
-
var DEFAULT_SIGNUP_URL = isLocalhost() ? SIGNUP_URL_DEV : SIGNUP_URL_LIVE;
|
|
51
|
-
var DEFAULT_CLERK_URL = isLocalhost() ? CLERK_URL_DEV : CLERK_URL_LIVE;
|
|
52
45
|
var DreamClient = class {
|
|
53
46
|
constructor(config) {
|
|
54
47
|
this.userToken = null;
|
|
@@ -59,8 +52,9 @@ var DreamClient = class {
|
|
|
59
52
|
this.secretKey = config.secretKey;
|
|
60
53
|
this.publishableKey = config.publishableKey;
|
|
61
54
|
this.baseUrl = config.baseUrl || DEFAULT_BASE_URL;
|
|
62
|
-
|
|
63
|
-
this.
|
|
55
|
+
const isTestKey = this.publishableKey?.startsWith("pk_test_");
|
|
56
|
+
this.signupUrl = config.signupUrl || (isTestKey ? SIGNUP_URL_TEST : SIGNUP_URL_LIVE);
|
|
57
|
+
this.clerkUrl = config.clerkBaseUrl || (isTestKey ? CLERK_URL_TEST : CLERK_URL_LIVE);
|
|
64
58
|
this.frontendOnly = !config.secretKey && !!config.publishableKey;
|
|
65
59
|
if (this.frontendOnly) {
|
|
66
60
|
console.log("[DreamAPI] Running in frontend-only mode (PK auth)");
|
|
@@ -190,7 +184,7 @@ var DreamClient = class {
|
|
|
190
184
|
};
|
|
191
185
|
|
|
192
186
|
// src/clerk.ts
|
|
193
|
-
function
|
|
187
|
+
function isLocalhost() {
|
|
194
188
|
if (typeof window === "undefined") return false;
|
|
195
189
|
const hostname = window.location.hostname;
|
|
196
190
|
return hostname === "localhost" || hostname === "127.0.0.1";
|
|
@@ -198,7 +192,7 @@ function isLocalhost2() {
|
|
|
198
192
|
var CLERK_DEV_KEY = "pk_test_Y29tcG9zZWQtYmxvd2Zpc2gtNzYuY2xlcmsuYWNjb3VudHMuZGV2JA";
|
|
199
193
|
var CLERK_LIVE_KEY = "pk_live_Y2xlcmsudXNlcnMucGFuYWNlYS10ZWNoLm5ldCQ";
|
|
200
194
|
function getClerkKey() {
|
|
201
|
-
return
|
|
195
|
+
return isLocalhost() ? CLERK_DEV_KEY : CLERK_LIVE_KEY;
|
|
202
196
|
}
|
|
203
197
|
var CLERK_CDN_URL = "https://cdn.jsdelivr.net/npm/@clerk/clerk-js@5.118.0/dist/clerk.browser.js";
|
|
204
198
|
var JWT_TEMPLATE = "end-user-api";
|
package/dist/index.mjs
CHANGED
|
@@ -10,17 +10,10 @@ var DreamAPIException = class extends Error {
|
|
|
10
10
|
|
|
11
11
|
// src/client.ts
|
|
12
12
|
var DEFAULT_BASE_URL = "https://api-multi.k-c-sheffield012376.workers.dev";
|
|
13
|
-
var
|
|
13
|
+
var SIGNUP_URL_TEST = "https://sign-up.k-c-sheffield012376.workers.dev";
|
|
14
14
|
var SIGNUP_URL_LIVE = "https://signup.users.panacea-tech.net";
|
|
15
|
-
var
|
|
15
|
+
var CLERK_URL_TEST = "https://composed-blowfish-76.clerk.accounts.dev";
|
|
16
16
|
var CLERK_URL_LIVE = "https://users.panacea-tech.net";
|
|
17
|
-
function isLocalhost() {
|
|
18
|
-
if (typeof window === "undefined") return false;
|
|
19
|
-
const hostname = window.location.hostname;
|
|
20
|
-
return hostname === "localhost" || hostname === "127.0.0.1";
|
|
21
|
-
}
|
|
22
|
-
var DEFAULT_SIGNUP_URL = isLocalhost() ? SIGNUP_URL_DEV : SIGNUP_URL_LIVE;
|
|
23
|
-
var DEFAULT_CLERK_URL = isLocalhost() ? CLERK_URL_DEV : CLERK_URL_LIVE;
|
|
24
17
|
var DreamClient = class {
|
|
25
18
|
constructor(config) {
|
|
26
19
|
this.userToken = null;
|
|
@@ -31,8 +24,9 @@ var DreamClient = class {
|
|
|
31
24
|
this.secretKey = config.secretKey;
|
|
32
25
|
this.publishableKey = config.publishableKey;
|
|
33
26
|
this.baseUrl = config.baseUrl || DEFAULT_BASE_URL;
|
|
34
|
-
|
|
35
|
-
this.
|
|
27
|
+
const isTestKey = this.publishableKey?.startsWith("pk_test_");
|
|
28
|
+
this.signupUrl = config.signupUrl || (isTestKey ? SIGNUP_URL_TEST : SIGNUP_URL_LIVE);
|
|
29
|
+
this.clerkUrl = config.clerkBaseUrl || (isTestKey ? CLERK_URL_TEST : CLERK_URL_LIVE);
|
|
36
30
|
this.frontendOnly = !config.secretKey && !!config.publishableKey;
|
|
37
31
|
if (this.frontendOnly) {
|
|
38
32
|
console.log("[DreamAPI] Running in frontend-only mode (PK auth)");
|
|
@@ -162,7 +156,7 @@ var DreamClient = class {
|
|
|
162
156
|
};
|
|
163
157
|
|
|
164
158
|
// src/clerk.ts
|
|
165
|
-
function
|
|
159
|
+
function isLocalhost() {
|
|
166
160
|
if (typeof window === "undefined") return false;
|
|
167
161
|
const hostname = window.location.hostname;
|
|
168
162
|
return hostname === "localhost" || hostname === "127.0.0.1";
|
|
@@ -170,7 +164,7 @@ function isLocalhost2() {
|
|
|
170
164
|
var CLERK_DEV_KEY = "pk_test_Y29tcG9zZWQtYmxvd2Zpc2gtNzYuY2xlcmsuYWNjb3VudHMuZGV2JA";
|
|
171
165
|
var CLERK_LIVE_KEY = "pk_live_Y2xlcmsudXNlcnMucGFuYWNlYS10ZWNoLm5ldCQ";
|
|
172
166
|
function getClerkKey() {
|
|
173
|
-
return
|
|
167
|
+
return isLocalhost() ? CLERK_DEV_KEY : CLERK_LIVE_KEY;
|
|
174
168
|
}
|
|
175
169
|
var CLERK_CDN_URL = "https://cdn.jsdelivr.net/npm/@clerk/clerk-js@5.118.0/dist/clerk.browser.js";
|
|
176
170
|
var JWT_TEMPLATE = "end-user-api";
|