woodsportal-client-sdk 1.1.4-dev.55 → 1.1.4-dev.57
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/README.md +16 -0
- package/dist/adapters/angular/index.js +3 -3
- package/dist/adapters/react/index.js +3 -3
- package/dist/adapters/vue/index.js +3 -3
- package/dist/auth-utils-TZSW6BVD.js +3 -0
- package/dist/{auth-utils-5VOTIENT.js.map → auth-utils-TZSW6BVD.js.map} +1 -1
- package/dist/{chunk-24HIDVUO.js → chunk-2SYUOWTT.js} +4 -4
- package/dist/chunk-2SYUOWTT.js.map +1 -0
- package/dist/{chunk-BF22MF22.js → chunk-HSJU2Z2S.js} +224 -6
- package/dist/chunk-HSJU2Z2S.js.map +1 -0
- package/dist/{chunk-FU5YZ6LI.js → chunk-YQLDJJ5M.js} +3 -3
- package/dist/{chunk-FU5YZ6LI.js.map → chunk-YQLDJJ5M.js.map} +1 -1
- package/dist/index.d.ts +97 -1
- package/dist/index.js +2 -2
- package/package.json +2 -1
- package/dist/auth-utils-5VOTIENT.js +0 -3
- package/dist/chunk-24HIDVUO.js.map +0 -1
- package/dist/chunk-BF22MF22.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { uploaderStore, actions2, syncStore, actions5, emailStore, actions4, noteStore, actions3, multiObjectStore, actions6, tableStore, actions } from './chunk-
|
|
1
|
+
import { uploaderStore, actions2, syncStore, actions5, emailStore, actions4, noteStore, actions3, multiObjectStore, actions6, tableStore, actions } from './chunk-HSJU2Z2S.js';
|
|
2
2
|
|
|
3
3
|
// src/adapters/shared/createAdapterHooks.ts
|
|
4
4
|
function createAdapterHooks(createComposable) {
|
|
@@ -13,5 +13,5 @@ function createAdapterHooks(createComposable) {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export { createAdapterHooks };
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-YQLDJJ5M.js.map
|
|
17
|
+
//# sourceMappingURL=chunk-YQLDJJ5M.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/adapters/shared/createAdapterHooks.ts"],"names":["actions"],"mappings":";;;AA0BO,SAAS,mBAAmB,gBAAA,EAAqC;AACpE,EAAA,OAAO;AAAA,IACH,QAAA,EAAU,gBAAA,CAAkD,UAAA,EAAY,OAAY,CAAA;AAAA,IACpF,qBAAA,EAAuB,gBAAA,CAAiB,gBAAA,EAAkBA,QAAkB,CAAA;AAAA,IAC5E,OAAA,EAAS,gBAAA,CAAgD,SAAA,EAAWA,QAAW,CAAA;AAAA,IAC/E,QAAA,EAAU,gBAAA,CAAkD,UAAA,EAAYA,QAAY,CAAA;AAAA,IACpF,OAAA,EAAS,gBAAA,CAAgD,SAAA,EAAWA,QAAW,CAAA;AAAA,IAC/E,WAAA,EAAa,gBAAA,CAAwD,aAAA,EAAeA,QAAe;AAAA,GACvG;AACJ","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/adapters/shared/createAdapterHooks.ts"],"names":["actions"],"mappings":";;;AA0BO,SAAS,mBAAmB,gBAAA,EAAqC;AACpE,EAAA,OAAO;AAAA,IACH,QAAA,EAAU,gBAAA,CAAkD,UAAA,EAAY,OAAY,CAAA;AAAA,IACpF,qBAAA,EAAuB,gBAAA,CAAiB,gBAAA,EAAkBA,QAAkB,CAAA;AAAA,IAC5E,OAAA,EAAS,gBAAA,CAAgD,SAAA,EAAWA,QAAW,CAAA;AAAA,IAC/E,QAAA,EAAU,gBAAA,CAAkD,UAAA,EAAYA,QAAY,CAAA;AAAA,IACpF,OAAA,EAAS,gBAAA,CAAgD,SAAA,EAAWA,QAAW,CAAA;AAAA,IAC/E,WAAA,EAAa,gBAAA,CAAwD,aAAA,EAAeA,QAAe;AAAA,GACvG;AACJ","file":"chunk-YQLDJJ5M.js","sourcesContent":["import type { SubscribableStore } from \"./bindStoreWithActions\";\nimport {\n tableStore,\n tableActions,\n type TableState,\n multiObjectStore,\n multiObjectActions,\n noteStore,\n noteActions,\n type NoteState,\n emailStore,\n emailActions,\n type EmailState,\n syncStore,\n syncActions,\n type SyncState,\n uploaderStore,\n uploaderActions,\n type UploaderState,\n} from \"./stores\";\n\ntype ComposableFactory = <TState extends object, TActions extends object>(\n store: SubscribableStore<TState>,\n actions: TActions,\n) => () => TState & TActions;\n\nexport function createAdapterHooks(createComposable: ComposableFactory) {\n return {\n useTable: createComposable<TableState, typeof tableActions>(tableStore, tableActions),\n useMultiObjectActions: createComposable(multiObjectStore, multiObjectActions),\n useNote: createComposable<NoteState, typeof noteActions>(noteStore, noteActions),\n useEmail: createComposable<EmailState, typeof emailActions>(emailStore, emailActions),\n useSync: createComposable<SyncState, typeof syncActions>(syncStore, syncActions),\n useUploader: createComposable<UploaderState, typeof uploaderActions>(uploaderStore, uploaderActions),\n };\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -298,6 +298,102 @@ type HubSpotActivityDateTimeParts = {
|
|
|
298
298
|
declare function formatHubSpotActivityDateTimeParts(timestamp: unknown, timeZone?: string): HubSpotActivityDateTimeParts | null;
|
|
299
299
|
declare function formatHubSpotActivityDateTime(timestamp: unknown, timeZone?: string): string;
|
|
300
300
|
|
|
301
|
+
type CachePurgeMode = "soft" | "hard";
|
|
302
|
+
type CachePurgeDomain = "crm_object_data" | "portal_object_config" | "user_session";
|
|
303
|
+
type CachePurgeView = "list" | "single" | "board" | "notes" | "emails" | "files";
|
|
304
|
+
type CachePurgeListQuery = {
|
|
305
|
+
sort?: string;
|
|
306
|
+
search?: string;
|
|
307
|
+
filterPropertyName?: string;
|
|
308
|
+
filterOperator?: string;
|
|
309
|
+
filterValue?: string;
|
|
310
|
+
page?: number;
|
|
311
|
+
limit?: number;
|
|
312
|
+
view?: "LIST" | "BOARD";
|
|
313
|
+
mediatorObjectTypeId?: string;
|
|
314
|
+
mediatorObjectRecordId?: string;
|
|
315
|
+
parentObjectTypeId?: string;
|
|
316
|
+
parentObjectRecordId?: string;
|
|
317
|
+
isPrimaryCompany?: boolean;
|
|
318
|
+
};
|
|
319
|
+
type CachePurgeTarget = {
|
|
320
|
+
domain: CachePurgeDomain;
|
|
321
|
+
objectTypeId?: string;
|
|
322
|
+
objectTypeIds?: string[];
|
|
323
|
+
recordIds?: string[];
|
|
324
|
+
fileIds?: string[];
|
|
325
|
+
views?: CachePurgeView[];
|
|
326
|
+
listQuery?: CachePurgeListQuery;
|
|
327
|
+
};
|
|
328
|
+
type CachePurgeRequest = {
|
|
329
|
+
mode: CachePurgeMode;
|
|
330
|
+
warm?: boolean;
|
|
331
|
+
confirmPortalWide?: boolean;
|
|
332
|
+
includeShortOnHard?: boolean;
|
|
333
|
+
includeContactAccess?: boolean;
|
|
334
|
+
targets: CachePurgeTarget[];
|
|
335
|
+
};
|
|
336
|
+
type CachePurgeJobStatus = "warming" | "completed" | "failed";
|
|
337
|
+
type PurgeResult = {
|
|
338
|
+
ok: boolean;
|
|
339
|
+
purgeJobId?: string;
|
|
340
|
+
status?: CachePurgeJobStatus;
|
|
341
|
+
evicted?: Record<string, string[]>;
|
|
342
|
+
warnings?: string[];
|
|
343
|
+
errorCode?: "PURGE_API_DISABLED" | "RATE_LIMITED" | "VALIDATION" | "WARM_FAILED" | "NETWORK" | "UNKNOWN";
|
|
344
|
+
message?: string;
|
|
345
|
+
};
|
|
346
|
+
type CreateCachePurgeJobOptions = {
|
|
347
|
+
idempotencyKey?: string;
|
|
348
|
+
waitForWarm?: boolean;
|
|
349
|
+
pollTimeoutMs?: number;
|
|
350
|
+
pollIntervalMs?: number;
|
|
351
|
+
};
|
|
352
|
+
type CrmCachePurgeOptions = {
|
|
353
|
+
objectTypeId: string;
|
|
354
|
+
objectTypeIds?: string[];
|
|
355
|
+
mode?: CachePurgeMode;
|
|
356
|
+
warm?: boolean;
|
|
357
|
+
listQuery?: CachePurgeListQuery;
|
|
358
|
+
views?: CachePurgeView[];
|
|
359
|
+
recordIds?: string[];
|
|
360
|
+
fileIds?: string[];
|
|
361
|
+
waitForWarm?: boolean;
|
|
362
|
+
idempotencyKey?: string;
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
declare function buildCrmListPurgeTarget(objectTypeId: string, listQuery?: CachePurgeListQuery): CachePurgeTarget;
|
|
366
|
+
declare function buildCrmSinglePurgeTarget(objectTypeId: string, recordIds: string[], listQuery?: CachePurgeListQuery): CachePurgeTarget;
|
|
367
|
+
declare function buildEngagementPurgeTarget(objectTypeId: string, recordIds: string[], views: Extract<CachePurgeView, "notes" | "emails" | "files">[], options?: {
|
|
368
|
+
fileIds?: string[];
|
|
369
|
+
listQuery?: CachePurgeListQuery;
|
|
370
|
+
}): CachePurgeTarget;
|
|
371
|
+
declare function buildUserSessionPurgeTarget(): CachePurgeTarget;
|
|
372
|
+
declare function buildPortalConfigPurgeTarget(objectTypeIds: string[]): CachePurgeTarget;
|
|
373
|
+
declare function mergePurgeTargets(...targets: CachePurgeTarget[]): CachePurgeTarget[];
|
|
374
|
+
declare function buildCachePurgeRequest(targets: CachePurgeTarget[], options?: {
|
|
375
|
+
mode?: "soft" | "hard";
|
|
376
|
+
warm?: boolean;
|
|
377
|
+
includeContactAccess?: boolean;
|
|
378
|
+
includeShortOnHard?: boolean;
|
|
379
|
+
confirmPortalWide?: boolean;
|
|
380
|
+
}): CachePurgeRequest;
|
|
381
|
+
|
|
382
|
+
declare function createCachePurgeJob(request: CachePurgeRequest, options?: CreateCachePurgeJobOptions): Promise<PurgeResult>;
|
|
383
|
+
|
|
384
|
+
declare function purgeCrmObjectDataCache(options: CrmCachePurgeOptions): Promise<boolean>;
|
|
385
|
+
declare function purgeCrmListCache(options: CrmCachePurgeOptions): Promise<PurgeResult>;
|
|
386
|
+
declare function purgeCrmRecordCache(options: CrmCachePurgeOptions & {
|
|
387
|
+
recordIds: string[];
|
|
388
|
+
}): Promise<PurgeResult>;
|
|
389
|
+
declare function purgeEngagementCaches(options: CrmCachePurgeOptions & {
|
|
390
|
+
recordIds: string[];
|
|
391
|
+
views: ("notes" | "emails" | "files")[];
|
|
392
|
+
}): Promise<PurgeResult>;
|
|
393
|
+
declare function purgeCrmCombined(options: CrmCachePurgeOptions & {
|
|
394
|
+
targets: CachePurgeTarget[];
|
|
395
|
+
}): Promise<PurgeResult>;
|
|
396
|
+
|
|
301
397
|
declare const Client: {
|
|
302
398
|
authentication: {
|
|
303
399
|
preLogin: (data: PreLoginPayload) => Promise<unknown>;
|
|
@@ -467,4 +563,4 @@ declare const routeParam: {
|
|
|
467
563
|
};
|
|
468
564
|
};
|
|
469
565
|
|
|
470
|
-
export { type ChangePasswordPayload, type Config, DEFAULT_HUBSPOT_TIMEZONE, type ForgetPasswordPayload, type HttpClientConfig, type HubSpotActivityDateTimeParts, type LoginPayload, type MutationOptions, type PreLoginPayload, type ResetPasswordPayload, type ResetPasswordVerifyTokenPayload, type VerifyEmailPayload, api, breadcrumbsDetails, index as clint, formatGmtOffset, formatHubSpotActivityDateTime, formatHubSpotActivityDateTimeParts, getCurrentTimeZone, getFieldErrors, getFormErrors, initializeHttpClient, normalizeToTimestamp, routeParam, store, url };
|
|
566
|
+
export { type CachePurgeDomain, type CachePurgeListQuery, type CachePurgeMode, type CachePurgeRequest, type CachePurgeTarget, type CachePurgeView, type ChangePasswordPayload, type Config, type CreateCachePurgeJobOptions, type CrmCachePurgeOptions, DEFAULT_HUBSPOT_TIMEZONE, type ForgetPasswordPayload, type HttpClientConfig, type HubSpotActivityDateTimeParts, type LoginPayload, type MutationOptions, type PreLoginPayload, type PurgeResult, type ResetPasswordPayload, type ResetPasswordVerifyTokenPayload, type VerifyEmailPayload, api, breadcrumbsDetails, buildCachePurgeRequest, buildCrmListPurgeTarget, buildCrmSinglePurgeTarget, buildEngagementPurgeTarget, buildPortalConfigPurgeTarget, buildUserSessionPurgeTarget, index as clint, createCachePurgeJob, formatGmtOffset, formatHubSpotActivityDateTime, formatHubSpotActivityDateTimeParts, getCurrentTimeZone, getFieldErrors, getFormErrors, initializeHttpClient, mergePurgeTargets, normalizeToTimestamp, purgeCrmCombined, purgeCrmListCache, purgeCrmObjectDataCache, purgeCrmRecordCache, purgeEngagementCaches, routeParam, store, url };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { DEFAULT_HUBSPOT_TIMEZONE, api, breadcrumbsDetails, client_exports as clint, formatGmtOffset, formatHubSpotActivityDateTime, formatHubSpotActivityDateTimeParts, getCurrentTimeZone, getFieldErrors, getFormErrors, initializeHttpClient, normalizeToTimestamp, routeParam, store, url } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { DEFAULT_HUBSPOT_TIMEZONE, api, breadcrumbsDetails, buildCachePurgeRequest, buildCrmListPurgeTarget, buildCrmSinglePurgeTarget, buildEngagementPurgeTarget, buildPortalConfigPurgeTarget, buildUserSessionPurgeTarget, client_exports as clint, createCachePurgeJob, formatGmtOffset, formatHubSpotActivityDateTime, formatHubSpotActivityDateTimeParts, getCurrentTimeZone, getFieldErrors, getFormErrors, initializeHttpClient, mergePurgeTargets, normalizeToTimestamp, purgeCrmCombined, purgeCrmListCache, purgeCrmObjectDataCache, purgeCrmRecordCache, purgeEngagementCaches, routeParam, store, url } from './chunk-HSJU2Z2S.js';
|
|
2
|
+
import './chunk-2SYUOWTT.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "woodsportal-client-sdk",
|
|
3
|
-
"version": "1.1.4-dev.
|
|
3
|
+
"version": "1.1.4-dev.57",
|
|
4
4
|
"description": "Official TypeScript/JavaScript SDK for WoodsPortal API - Authentication, user management, pipelines, and more",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"clean": "rimraf dist",
|
|
41
41
|
"build": "npm run clean && tsup",
|
|
42
42
|
"type-check": "tsc --noEmit",
|
|
43
|
+
"test": "node --import tsx --test 'src/**/*.test.ts'",
|
|
43
44
|
"test:consumer": "npm run build && cd examples/smoke-consumer && npm install && npm run smoke",
|
|
44
45
|
"test:consumer:live": "npm run build && cd examples/smoke-consumer && npm install && npm run smoke:live",
|
|
45
46
|
"prepublishOnly": "npm run build && npm run type-check && npm run test:consumer"
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { getPortal, getProfile, getRefreshToken, getSubscriptionType, setAccessToken, setLoggedInDetails, setPortal, setRefreshToken, setSubscriptionType } from './chunk-24HIDVUO.js';
|
|
2
|
-
//# sourceMappingURL=auth-utils-5VOTIENT.js.map
|
|
3
|
-
//# sourceMappingURL=auth-utils-5VOTIENT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/constants.ts","../src/utils/cookie.ts","../src/client/token-store.ts","../src/client/auth-utils.ts"],"names":["getRefreshToken"],"mappings":";;;;;;;;;AACO,IAAM,aAAA,GAAgB,cAAA;AACtB,IAAM,aAAA,GAAgB,cAAA;AACtB,IAAM,MAAA,GAAS,QAAA;AACf,IAAM,iBAAA,GAAoB,mBAAA;AAG1B,IAAM,YAAA,GAAe;AACrB,IAAM,MAAA,GAAS;AACf,IAAM,aAAA,GAAgB;AACtB,IAAM,SAAA,GAAY;AAClB,IAAM,WAAA,GAAc;ACTpB,IAAM,SAAA,GAAY,CAAC,GAAA,EAAa,KAAA,EAAe,MAAA,KAA2B;AAC7E,EAAA,OAAO,OAAA,CAAQ,GAAA,CAAI,GAAA,EAAK,KAAA,EAAO;AAAA,IAC3B,OAAA,EAAS,MAAA;AAAA,IACT,QAAA,EAAU,MAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACX,CAAA;AACL,CAAA;AAEO,IAAM,SAAA,GAAiB,CAAC,GAAA,KAAa;AACxC,EAAA,OAAO,OAAA,CAAQ,IAAI,GAAG,CAAA;AAC1B;AAMO,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AA,CAAQ,CAAC,OAAA,KAAiB;AACnC,IAAA,eAAA,CAAgB,OAAO,SAAS,CAAA;AAChC,IAAA,OAAA,EAAQ;AAAA,EACV,CAAC,CAAA;AACH;AAEO,IAAM,SAAA,GAAY,OAAO,IAAA,KAAc;AAC5C,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,OAAA,KAAiB;AACnC,IAAA,SAAA,CAAU,MAAA,EAAQ,IAAA,CAAK,SAAA,CAAU,IAAI,CAAC,CAAA;AACtC,IAAA,OAAA,EAAQ;AAAA,EACV,CAAC,CAAA;AACH;AAEO,IAAM,mBAAA,GAAsB,OAAO,IAAA,KAAc;AACtD,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,OAAA,KAAiB;AACnC,IAAA,SAAA,CAAU,iBAAA,EAAmB,IAAA,CAAK,SAAA,CAAU,IAAI,CAAC,CAAA;AACjD,IAAA,OAAA,EAAQ;AAAA,EACV,CAAC,CAAA;AACH;AAGO,SAAS,UAAA,GAA4B;AAC1C,EAAA,OAAO,KAAK,KAAA,CAAM,SAAA,CAAU,aAAqB,KAAK,IAAI,CAAA;AAC5D;AAEO,SAAS,eAAA,GAAiC;AAC/C,EAAA,OAAO,KAAK,KAAA,CAAM,SAAA,CAAU,aAAqB,KAAK,IAAI,CAAA;AAC5D;AAEO,SAAS,SAAA,GAAwB;AACtC,EAAA,OAAO,KAAK,KAAA,CAAM,SAAA,CAAU,MAAc,KAAK,IAAI,CAAA;AACrD;AAEO,SAAS,mBAAA,GAAqC;AACnD,EAAA,OAAO,KAAK,KAAA,CAAM,SAAA,CAAU,iBAAyB,KAAK,IAAI,CAAA;AAChE","file":"chunk-24HIDVUO.js","sourcesContent":["// cookies\nexport const LOGIN_DETAILS = \"loginDetails\";\nexport const REFRESH_TOKEN = \"refreshToken\";\nexport const PORTAL = \"portal\";\nexport const SUBSCRIPTION_TYPE = \"ssubscriptionType\";\n\n// variables\nexport const HUBSPOT_DATA = \"hubSpotData\";\nexport const HUB_ID = \"hubId\";\nexport const DEV_PORTAL_ID = \"devPortalId\";\nexport const PORTAL_ID = \"portalId\";\nexport const DEV_API_URL = \"devApiUrl\";\n","import Cookies from 'js-cookie';\n\nexport const setCookie = (key: string, value: string, expire?: number | Date) => {\n return Cookies.set(key, value, {\n expires: expire,\n sameSite: 'none',\n secure: true,\n });\n}\n\nexport const getCookie: any = (key: any) => {\n return Cookies.get(key);\n}\n\nexport const removeCookie = (key: any) => {\n return Cookies.remove(key);\n}\n\nexport const removeAllCookie = () => {\n Object.keys(Cookies.get()).forEach((cookieName) => {\n Cookies.remove(cookieName);\n });\n}\n\n// export const isCookieExpired = (key: string): boolean => {\n// const value = Cookies.get(key);\n// return value === undefined; // true means expired or never set\n// };\n\n\nexport const isCookieExpired = (key: string): boolean => {\n const value = Cookies.get(key);\n if (value === undefined) {\n return true;\n }\n try {\n const parsed = JSON.parse(value);\n if (parsed && typeof parsed === 'object' && 'expiresAt' in parsed) {\n const expiresAt = (parsed as { expiresAt?: number }).expiresAt;\n return typeof expiresAt === 'number' && Date.now() > expiresAt;\n }\n // Refresh/auth cookies store a JSON-encoded string token; rely on browser cookie expiry.\n return false;\n } catch {\n return true;\n }\n};","/**\n * Token storage utilities\n * These functions handle access token management\n */\n\nimport { isCookieExpired } from '../utils/cookie.js';\nimport { REFRESH_TOKEN } from '../utils/constants';\n\nlet accessToken: string | null = null;\nlet tokenExpiresAt: number | null = null;\nlet refreshCallback: ((refreshToken: string) => Promise<{ token: string | null; success: boolean }>) | null = null;\n\nexport function getAccessToken(): string | null {\n return accessToken;\n}\n\nexport function storAccessToken(token: string, expiresIn?: number): void {\n accessToken = token;\n if (expiresIn) {\n tokenExpiresAt = Date.now() + expiresIn * 1000;\n } else {\n tokenExpiresAt = null;\n }\n}\n\nexport function clearAccessToken(): void {\n accessToken = null;\n tokenExpiresAt = null;\n}\n\nexport function isExpiresAccessToken(): boolean {\n if (!tokenExpiresAt) return true;\n return Date.now() >= tokenExpiresAt;\n}\n\n/**\n * Set the refresh callback function\n * This is called by the HTTP client during initialization\n */\nexport function setRefreshCallback(callback: (refreshToken: string) => Promise<{ token: string | null; success: boolean }>): void {\n refreshCallback = callback;\n}\n\n/**\n * Ensures the access token is valid, refreshing if necessary\n */\nexport async function ensureValidRefresh(): Promise<void> {\n if (isExpiresAccessToken() && refreshCallback) {\n const { getRefreshToken } = await import('./auth-utils.js');\n const refreshToken = getRefreshToken();\n if (refreshToken) {\n await refreshCallback(refreshToken);\n }\n }\n}\n\nexport function isAuthenticateApp() {\n if (isCookieExpired(REFRESH_TOKEN) || isExpiresAccessToken()) {\n return false;\n }\n return true;\n}","/**\n * Authentication utility functions\n * These handle refresh token management\n */\n\nimport { LOGIN_DETAILS, REFRESH_TOKEN, PORTAL, SUBSCRIPTION_TYPE } from '../utils/constants';\nimport { setCookie, getCookie } from '../utils/cookie';\nimport { storAccessToken } from './token-store';\n\n// Set data\nexport const setLoggedInDetails = async (data: any) => {\n return new Promise((resolve: any) => {\n setCookie(LOGIN_DETAILS, JSON.stringify(data));\n resolve();\n });\n};\n\nexport function setRefreshToken(token: string, expiresAt: number) {\n return new Promise((resolve: any) => {\n setCookie(REFRESH_TOKEN, JSON.stringify(token), expiresAt);\n resolve();\n });\n}\n\nexport function setAccessToken(token: string, expiresIn?: number) {\n return new Promise((resolve: any) => {\n storAccessToken(token, expiresIn);\n resolve();\n });\n}\n\nexport const setPortal = async (data: any) => {\n return new Promise((resolve: any) => {\n setCookie(PORTAL, JSON.stringify(data));\n resolve();\n });\n};\n\nexport const setSubscriptionType = async (data: any) => {\n return new Promise((resolve: any) => {\n setCookie(SUBSCRIPTION_TYPE, JSON.stringify(data));\n resolve();\n });\n};\n\n// Get data\nexport function getProfile(): string | null {\n return JSON.parse(getCookie(LOGIN_DETAILS || null) || null);\n}\n\nexport function getRefreshToken(): string | null {\n return JSON.parse(getCookie(REFRESH_TOKEN || null) || null);\n}\n\nexport function getPortal(): any | null {\n return JSON.parse(getCookie(PORTAL || null) || null);\n}\n\nexport function getSubscriptionType(): string | null {\n return JSON.parse(getCookie(SUBSCRIPTION_TYPE || null) || null);\n}\n\n// Remove data\n// export const removeAllCookies = () => {\n// const cookies = document.cookie.split(\"; \");\n// cookies.forEach((cookie) => {\n// const name = cookie.split(\"=\")[0];\n// removeCookie(name);\n// });\n// };"]}
|