@dream-api/sdk 0.1.28 → 0.1.30
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.d.mts +8 -6
- package/dist/index.d.ts +8 -6
- package/dist/index.js +28 -11
- package/dist/index.mjs +28 -11
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -297,8 +297,8 @@ declare class AuthHelpers {
|
|
|
297
297
|
/**
|
|
298
298
|
* Get the sign-in URL for returning users.
|
|
299
299
|
*
|
|
300
|
-
* Redirects to
|
|
301
|
-
* users are redirected to your specified URL.
|
|
300
|
+
* Redirects to our auth worker which embeds Clerk. After sign-in,
|
|
301
|
+
* users are redirected to your specified URL with JWT.
|
|
302
302
|
*
|
|
303
303
|
* @example
|
|
304
304
|
* ```typescript
|
|
@@ -310,19 +310,21 @@ declare class AuthHelpers {
|
|
|
310
310
|
/**
|
|
311
311
|
* Get the customer portal URL for account management.
|
|
312
312
|
*
|
|
313
|
-
* Redirects to
|
|
314
|
-
* manage their profile, password, and security settings.
|
|
313
|
+
* Redirects to our auth worker which embeds Clerk's UserProfile.
|
|
314
|
+
* Users can manage their profile, password, and security settings.
|
|
315
315
|
*
|
|
316
316
|
* Note: This is separate from billing management.
|
|
317
317
|
* For billing, use api.billing.openPortal().
|
|
318
318
|
*
|
|
319
319
|
* @example
|
|
320
320
|
* ```typescript
|
|
321
|
-
* const portalUrl = api.auth.getCustomerPortalUrl();
|
|
321
|
+
* const portalUrl = api.auth.getCustomerPortalUrl({ returnUrl: '/dashboard' });
|
|
322
322
|
* window.location.href = portalUrl;
|
|
323
323
|
* ```
|
|
324
324
|
*/
|
|
325
|
-
getCustomerPortalUrl(
|
|
325
|
+
getCustomerPortalUrl(options?: {
|
|
326
|
+
returnUrl?: string;
|
|
327
|
+
}): string;
|
|
326
328
|
}
|
|
327
329
|
|
|
328
330
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -297,8 +297,8 @@ declare class AuthHelpers {
|
|
|
297
297
|
/**
|
|
298
298
|
* Get the sign-in URL for returning users.
|
|
299
299
|
*
|
|
300
|
-
* Redirects to
|
|
301
|
-
* users are redirected to your specified URL.
|
|
300
|
+
* Redirects to our auth worker which embeds Clerk. After sign-in,
|
|
301
|
+
* users are redirected to your specified URL with JWT.
|
|
302
302
|
*
|
|
303
303
|
* @example
|
|
304
304
|
* ```typescript
|
|
@@ -310,19 +310,21 @@ declare class AuthHelpers {
|
|
|
310
310
|
/**
|
|
311
311
|
* Get the customer portal URL for account management.
|
|
312
312
|
*
|
|
313
|
-
* Redirects to
|
|
314
|
-
* manage their profile, password, and security settings.
|
|
313
|
+
* Redirects to our auth worker which embeds Clerk's UserProfile.
|
|
314
|
+
* Users can manage their profile, password, and security settings.
|
|
315
315
|
*
|
|
316
316
|
* Note: This is separate from billing management.
|
|
317
317
|
* For billing, use api.billing.openPortal().
|
|
318
318
|
*
|
|
319
319
|
* @example
|
|
320
320
|
* ```typescript
|
|
321
|
-
* const portalUrl = api.auth.getCustomerPortalUrl();
|
|
321
|
+
* const portalUrl = api.auth.getCustomerPortalUrl({ returnUrl: '/dashboard' });
|
|
322
322
|
* window.location.href = portalUrl;
|
|
323
323
|
* ```
|
|
324
324
|
*/
|
|
325
|
-
getCustomerPortalUrl(
|
|
325
|
+
getCustomerPortalUrl(options?: {
|
|
326
|
+
returnUrl?: string;
|
|
327
|
+
}): string;
|
|
326
328
|
}
|
|
327
329
|
|
|
328
330
|
/**
|
package/dist/index.js
CHANGED
|
@@ -41,7 +41,7 @@ var DEFAULT_BASE_URL = "https://api-multi.k-c-sheffield012376.workers.dev";
|
|
|
41
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
43
|
var CLERK_URL_TEST = "https://composed-blowfish-76.clerk.accounts.dev";
|
|
44
|
-
var CLERK_URL_LIVE = "https://users.panacea-tech.net";
|
|
44
|
+
var CLERK_URL_LIVE = "https://clerk.users.panacea-tech.net";
|
|
45
45
|
var DreamClient = class {
|
|
46
46
|
constructor(config) {
|
|
47
47
|
this.userToken = null;
|
|
@@ -486,8 +486,8 @@ var AuthHelpers = class {
|
|
|
486
486
|
/**
|
|
487
487
|
* Get the sign-in URL for returning users.
|
|
488
488
|
*
|
|
489
|
-
* Redirects to
|
|
490
|
-
* users are redirected to your specified URL.
|
|
489
|
+
* Redirects to our auth worker which embeds Clerk. After sign-in,
|
|
490
|
+
* users are redirected to your specified URL with JWT.
|
|
491
491
|
*
|
|
492
492
|
* @example
|
|
493
493
|
* ```typescript
|
|
@@ -496,27 +496,44 @@ var AuthHelpers = class {
|
|
|
496
496
|
* ```
|
|
497
497
|
*/
|
|
498
498
|
getSignInUrl(options) {
|
|
499
|
-
const
|
|
500
|
-
|
|
499
|
+
const pk = this.client.getPublishableKey();
|
|
500
|
+
if (!pk) {
|
|
501
|
+
throw new Error("DreamAPI: publishableKey required for auth URLs");
|
|
502
|
+
}
|
|
503
|
+
const baseUrl = this.client.getSignupBaseUrl();
|
|
504
|
+
const params = new URLSearchParams({
|
|
505
|
+
pk,
|
|
506
|
+
redirect: options.redirect
|
|
507
|
+
});
|
|
508
|
+
return `${baseUrl}/signin?${params.toString()}`;
|
|
501
509
|
}
|
|
502
510
|
/**
|
|
503
511
|
* Get the customer portal URL for account management.
|
|
504
512
|
*
|
|
505
|
-
* Redirects to
|
|
506
|
-
* manage their profile, password, and security settings.
|
|
513
|
+
* Redirects to our auth worker which embeds Clerk's UserProfile.
|
|
514
|
+
* Users can manage their profile, password, and security settings.
|
|
507
515
|
*
|
|
508
516
|
* Note: This is separate from billing management.
|
|
509
517
|
* For billing, use api.billing.openPortal().
|
|
510
518
|
*
|
|
511
519
|
* @example
|
|
512
520
|
* ```typescript
|
|
513
|
-
* const portalUrl = api.auth.getCustomerPortalUrl();
|
|
521
|
+
* const portalUrl = api.auth.getCustomerPortalUrl({ returnUrl: '/dashboard' });
|
|
514
522
|
* window.location.href = portalUrl;
|
|
515
523
|
* ```
|
|
516
524
|
*/
|
|
517
|
-
getCustomerPortalUrl() {
|
|
518
|
-
const
|
|
519
|
-
|
|
525
|
+
getCustomerPortalUrl(options) {
|
|
526
|
+
const pk = this.client.getPublishableKey();
|
|
527
|
+
if (!pk) {
|
|
528
|
+
throw new Error("DreamAPI: publishableKey required for auth URLs");
|
|
529
|
+
}
|
|
530
|
+
const baseUrl = this.client.getSignupBaseUrl();
|
|
531
|
+
const returnUrl = options?.returnUrl || (typeof window !== "undefined" ? window.location.href : "/");
|
|
532
|
+
const params = new URLSearchParams({
|
|
533
|
+
pk,
|
|
534
|
+
redirect: returnUrl
|
|
535
|
+
});
|
|
536
|
+
return `${baseUrl}/account?${params.toString()}`;
|
|
520
537
|
}
|
|
521
538
|
};
|
|
522
539
|
|
package/dist/index.mjs
CHANGED
|
@@ -13,7 +13,7 @@ var DEFAULT_BASE_URL = "https://api-multi.k-c-sheffield012376.workers.dev";
|
|
|
13
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
15
|
var CLERK_URL_TEST = "https://composed-blowfish-76.clerk.accounts.dev";
|
|
16
|
-
var CLERK_URL_LIVE = "https://users.panacea-tech.net";
|
|
16
|
+
var CLERK_URL_LIVE = "https://clerk.users.panacea-tech.net";
|
|
17
17
|
var DreamClient = class {
|
|
18
18
|
constructor(config) {
|
|
19
19
|
this.userToken = null;
|
|
@@ -458,8 +458,8 @@ var AuthHelpers = class {
|
|
|
458
458
|
/**
|
|
459
459
|
* Get the sign-in URL for returning users.
|
|
460
460
|
*
|
|
461
|
-
* Redirects to
|
|
462
|
-
* users are redirected to your specified URL.
|
|
461
|
+
* Redirects to our auth worker which embeds Clerk. After sign-in,
|
|
462
|
+
* users are redirected to your specified URL with JWT.
|
|
463
463
|
*
|
|
464
464
|
* @example
|
|
465
465
|
* ```typescript
|
|
@@ -468,27 +468,44 @@ var AuthHelpers = class {
|
|
|
468
468
|
* ```
|
|
469
469
|
*/
|
|
470
470
|
getSignInUrl(options) {
|
|
471
|
-
const
|
|
472
|
-
|
|
471
|
+
const pk = this.client.getPublishableKey();
|
|
472
|
+
if (!pk) {
|
|
473
|
+
throw new Error("DreamAPI: publishableKey required for auth URLs");
|
|
474
|
+
}
|
|
475
|
+
const baseUrl = this.client.getSignupBaseUrl();
|
|
476
|
+
const params = new URLSearchParams({
|
|
477
|
+
pk,
|
|
478
|
+
redirect: options.redirect
|
|
479
|
+
});
|
|
480
|
+
return `${baseUrl}/signin?${params.toString()}`;
|
|
473
481
|
}
|
|
474
482
|
/**
|
|
475
483
|
* Get the customer portal URL for account management.
|
|
476
484
|
*
|
|
477
|
-
* Redirects to
|
|
478
|
-
* manage their profile, password, and security settings.
|
|
485
|
+
* Redirects to our auth worker which embeds Clerk's UserProfile.
|
|
486
|
+
* Users can manage their profile, password, and security settings.
|
|
479
487
|
*
|
|
480
488
|
* Note: This is separate from billing management.
|
|
481
489
|
* For billing, use api.billing.openPortal().
|
|
482
490
|
*
|
|
483
491
|
* @example
|
|
484
492
|
* ```typescript
|
|
485
|
-
* const portalUrl = api.auth.getCustomerPortalUrl();
|
|
493
|
+
* const portalUrl = api.auth.getCustomerPortalUrl({ returnUrl: '/dashboard' });
|
|
486
494
|
* window.location.href = portalUrl;
|
|
487
495
|
* ```
|
|
488
496
|
*/
|
|
489
|
-
getCustomerPortalUrl() {
|
|
490
|
-
const
|
|
491
|
-
|
|
497
|
+
getCustomerPortalUrl(options) {
|
|
498
|
+
const pk = this.client.getPublishableKey();
|
|
499
|
+
if (!pk) {
|
|
500
|
+
throw new Error("DreamAPI: publishableKey required for auth URLs");
|
|
501
|
+
}
|
|
502
|
+
const baseUrl = this.client.getSignupBaseUrl();
|
|
503
|
+
const returnUrl = options?.returnUrl || (typeof window !== "undefined" ? window.location.href : "/");
|
|
504
|
+
const params = new URLSearchParams({
|
|
505
|
+
pk,
|
|
506
|
+
redirect: returnUrl
|
|
507
|
+
});
|
|
508
|
+
return `${baseUrl}/account?${params.toString()}`;
|
|
492
509
|
}
|
|
493
510
|
};
|
|
494
511
|
|