@codetunezstudios/token-kit 0.1.0-beta.4 → 0.1.0-beta.6

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 CHANGED
@@ -127,13 +127,13 @@ interface TokenKitConfig {
127
127
  * ```typescript
128
128
  * import { connectViaPortal } from '@codetunezstudios/token-kit';
129
129
  *
130
- * const userToken = await connectViaPortal({ appId: 'dev_abc123...' });
130
+ * const userToken = await connectViaPortal({ clientId: 'app_abc123...' });
131
131
  * tokenKit.setUserToken(userToken);
132
132
  * ```
133
133
  */
134
134
  interface ConnectViaPortalOptions {
135
- /** The developerId of the requesting app (shown in admin CLI output). */
136
- appId: string;
135
+ /** The clientId of the developer app (created in the token-kit.com Apps dashboard). */
136
+ clientId: string;
137
137
  /**
138
138
  * Base URL of the Token-Kit portal.
139
139
  * Defaults to 'https://ai-tokens.me'.
package/dist/index.d.ts CHANGED
@@ -127,13 +127,13 @@ interface TokenKitConfig {
127
127
  * ```typescript
128
128
  * import { connectViaPortal } from '@codetunezstudios/token-kit';
129
129
  *
130
- * const userToken = await connectViaPortal({ appId: 'dev_abc123...' });
130
+ * const userToken = await connectViaPortal({ clientId: 'app_abc123...' });
131
131
  * tokenKit.setUserToken(userToken);
132
132
  * ```
133
133
  */
134
134
  interface ConnectViaPortalOptions {
135
- /** The developerId of the requesting app (shown in admin CLI output). */
136
- appId: string;
135
+ /** The clientId of the developer app (created in the token-kit.com Apps dashboard). */
136
+ clientId: string;
137
137
  /**
138
138
  * Base URL of the Token-Kit portal.
139
139
  * Defaults to 'https://ai-tokens.me'.
package/dist/index.js CHANGED
@@ -219,7 +219,9 @@ var STORAGE_KEY = "tokenkit_user_token";
219
219
  async function connectViaPortal(options) {
220
220
  const portalUrl = (options.portalUrl ?? "https://ai-tokens.me").replace(/\/$/, "");
221
221
  const currentOrigin = encodeURIComponent(window.location.origin);
222
- const url = `${portalUrl}/connect?appId=${encodeURIComponent(options.appId)}&origin=${currentOrigin}`;
222
+ const existingToken = getStoredUserToken();
223
+ const reconnectParam = existingToken ? "&reconnect=true" : "";
224
+ const url = `${portalUrl}/connect?clientId=${encodeURIComponent(options.clientId)}&origin=${currentOrigin}${reconnectParam}`;
223
225
  const popup = window.open(
224
226
  url,
225
227
  "tokenkit-connect",
package/dist/index.mjs CHANGED
@@ -176,7 +176,9 @@ var STORAGE_KEY = "tokenkit_user_token";
176
176
  async function connectViaPortal(options) {
177
177
  const portalUrl = (options.portalUrl ?? "https://ai-tokens.me").replace(/\/$/, "");
178
178
  const currentOrigin = encodeURIComponent(window.location.origin);
179
- const url = `${portalUrl}/connect?appId=${encodeURIComponent(options.appId)}&origin=${currentOrigin}`;
179
+ const existingToken = getStoredUserToken();
180
+ const reconnectParam = existingToken ? "&reconnect=true" : "";
181
+ const url = `${portalUrl}/connect?clientId=${encodeURIComponent(options.clientId)}&origin=${currentOrigin}${reconnectParam}`;
180
182
  const popup = window.open(
181
183
  url,
182
184
  "tokenkit-connect",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codetunezstudios/token-kit",
3
- "version": "0.1.0-beta.4",
3
+ "version": "0.1.0-beta.6",
4
4
  "description": "Official TypeScript SDK for token-kit - AI token infrastructure for developers",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",