woodsportal-client-sdk 1.1.4-dev.62 → 1.1.4-dev.64

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.
@@ -1,4 +1,4 @@
1
- // src/adapters/shared/bindStoreWithActions.ts
1
+ // src/main/adapters/shared/bindStoreWithActions.ts
2
2
  function bindStoreWithActions(store, actions) {
3
3
  const getSnapshot = () => ({ ...store.getState(), ...actions });
4
4
  const subscribe = (onStoreChange) => store.subscribe(() => onStoreChange());
@@ -6,5 +6,5 @@ function bindStoreWithActions(store, actions) {
6
6
  }
7
7
 
8
8
  export { bindStoreWithActions };
9
- //# sourceMappingURL=chunk-Y5MRAAGK.js.map
10
- //# sourceMappingURL=chunk-Y5MRAAGK.js.map
9
+ //# sourceMappingURL=chunk-HBHT637F.js.map
10
+ //# sourceMappingURL=chunk-HBHT637F.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/main/adapters/shared/bindStoreWithActions.ts"],"names":[],"mappings":";AAKO,SAAS,oBAAA,CAIZ,OACA,OAAA,EACF;AACE,EAAA,MAAM,WAAA,GAAc,OAAO,EAAE,GAAG,MAAM,QAAA,EAAS,EAAG,GAAG,OAAA,EAAQ,CAAA;AAE7D,EAAA,MAAM,YAAY,CAAC,aAAA,KACf,MAAM,SAAA,CAAU,MAAM,eAAe,CAAA;AAEzC,EAAA,OAAO,EAAE,aAAa,SAAA,EAAU;AACpC","file":"chunk-HBHT637F.js","sourcesContent":["export interface SubscribableStore<TState> {\n getState(): TState;\n subscribe(listener: (state: TState) => void): () => void;\n}\n\nexport function bindStoreWithActions<\n TState extends object,\n TActions extends object,\n>(\n store: SubscribableStore<TState>,\n actions: TActions,\n) {\n const getSnapshot = () => ({ ...store.getState(), ...actions }) as TState & TActions;\n\n const subscribe = (onStoreChange: () => void) =>\n store.subscribe(() => onStoreChange());\n\n return { getSnapshot, subscribe };\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import { uploaderStore, actions3, syncStore, actions6, userStore, actions, emailStore, actions5, noteStore, actions4, multiObjectStore, actions7, tableStore, actions2 } from './chunk-C76BHDO4.js';
2
+
3
+ // src/main/adapters/shared/createAdapterHooks.ts
4
+ function createAdapterHooks(createComposable) {
5
+ return {
6
+ useTable: createComposable(tableStore, actions2),
7
+ useMultiObjectActions: createComposable(multiObjectStore, actions7),
8
+ useNote: createComposable(noteStore, actions4),
9
+ useEmail: createComposable(emailStore, actions5),
10
+ useUser: createComposable(userStore, actions),
11
+ useSync: createComposable(syncStore, actions6),
12
+ useUploader: createComposable(uploaderStore, actions3)
13
+ };
14
+ }
15
+
16
+ export { createAdapterHooks };
17
+ //# sourceMappingURL=chunk-K3YKUUNS.js.map
18
+ //# sourceMappingURL=chunk-K3YKUUNS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/main/adapters/shared/createAdapterHooks.ts"],"names":["actions"],"mappings":";;;AA6BO,SAAS,mBAAmB,gBAAA,EAAqC;AACpE,EAAA,OAAO;AAAA,IACH,QAAA,EAAU,gBAAA,CAAkD,UAAA,EAAYA,QAAY,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,EAAW,OAAW,CAAA;AAAA,IAC/E,OAAA,EAAS,gBAAA,CAAgD,SAAA,EAAWA,QAAW,CAAA;AAAA,IAC/E,WAAA,EAAa,gBAAA,CAAwD,aAAA,EAAeA,QAAe;AAAA,GACvG;AACJ","file":"chunk-K3YKUUNS.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 userStore,\n userActions,\n type UserState,\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 useUser: createComposable<UserState, typeof userActions>(userStore, userActions),\n useSync: createComposable<SyncState, typeof syncActions>(syncStore, syncActions),\n useUploader: createComposable<UploaderState, typeof uploaderActions>(uploaderStore, uploaderActions),\n };\n}\n"]}
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
  __defProp(target, name, { get: all[name], enumerable: true });
7
7
  };
8
8
 
9
- // src/utils/constants.ts
9
+ // src/main/utils/constants.ts
10
10
  var LOGIN_DETAILS = "loginDetails";
11
11
  var REFRESH_TOKEN = "refreshToken";
12
12
  var PORTAL = "portal";
@@ -48,7 +48,7 @@ var isCookieExpired = (key) => {
48
48
  }
49
49
  };
50
50
 
51
- // src/client/token-store.ts
51
+ // src/main/client/token-store.ts
52
52
  var accessToken = null;
53
53
  var tokenExpiresAt = null;
54
54
  var refreshCallback = null;
@@ -76,7 +76,7 @@ function setRefreshCallback(callback) {
76
76
  }
77
77
  async function ensureValidRefresh() {
78
78
  if (isExpiresAccessToken() && refreshCallback) {
79
- const { getRefreshToken: getRefreshToken2 } = await import('./auth-utils-TZSW6BVD.js');
79
+ const { getRefreshToken: getRefreshToken2 } = await import('./auth-utils-UU5PVRPL.js');
80
80
  const refreshToken = getRefreshToken2();
81
81
  if (refreshToken) {
82
82
  await refreshCallback(refreshToken);
@@ -90,13 +90,19 @@ function isAuthenticateApp() {
90
90
  return true;
91
91
  }
92
92
 
93
- // src/client/auth-utils.ts
93
+ // src/main/client/auth-utils.ts
94
94
  var setLoggedInDetails = async (data) => {
95
95
  return new Promise((resolve) => {
96
96
  setCookie(LOGIN_DETAILS, JSON.stringify(data));
97
97
  resolve();
98
98
  });
99
99
  };
100
+ var setProfileDetails = async (data) => {
101
+ return new Promise((resolve) => {
102
+ setCookie(LOGIN_DETAILS, JSON.stringify(data));
103
+ resolve();
104
+ });
105
+ };
100
106
  function setRefreshToken(token, expiresAt) {
101
107
  return new Promise((resolve) => {
102
108
  setCookie(REFRESH_TOKEN, JSON.stringify(token), expiresAt);
@@ -134,6 +140,6 @@ function getSubscriptionType() {
134
140
  return JSON.parse(getCookie(SUBSCRIPTION_TYPE) || null);
135
141
  }
136
142
 
137
- export { DEV_API_URL, DEV_PORTAL_ID, HUBSPOT_DATA, HUB_ID, PORTAL_ID, __export, clearAccessToken, ensureValidRefresh, getAccessToken, getCookie, getPortal, getProfile, getRefreshToken, getSubscriptionType, isAuthenticateApp, isCookieExpired, isExpiresAccessToken, removeAllCookie, setAccessToken, setLoggedInDetails, setPortal, setRefreshCallback, setRefreshToken, setSubscriptionType };
138
- //# sourceMappingURL=chunk-2SYUOWTT.js.map
139
- //# sourceMappingURL=chunk-2SYUOWTT.js.map
143
+ export { DEV_API_URL, DEV_PORTAL_ID, HUBSPOT_DATA, HUB_ID, PORTAL_ID, __export, clearAccessToken, ensureValidRefresh, getAccessToken, getCookie, getPortal, getProfile, getRefreshToken, getSubscriptionType, isAuthenticateApp, isCookieExpired, isExpiresAccessToken, removeAllCookie, setAccessToken, setLoggedInDetails, setPortal, setProfileDetails, setRefreshCallback, setRefreshToken, setSubscriptionType };
144
+ //# sourceMappingURL=chunk-S2NB4AXQ.js.map
145
+ //# sourceMappingURL=chunk-S2NB4AXQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/main/utils/constants.ts","../src/main/utils/cookie.ts","../src/main/client/token-store.ts","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C,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-S2NB4AXQ.js","sourcesContent":["// cookies\nexport const LOGIN_DETAILS = \"loginDetails\";\nexport const REFRESH_TOKEN = \"refreshToken\";\nexport const PORTAL = \"portal\";\nexport const SUBSCRIPTION_TYPE = \"subscriptionType\";\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 const setProfileDetails = async (data: any) => {\n return new Promise((resolve: any) => {\n setCookie(LOGIN_DETAILS, JSON.stringify(data));\n resolve();\n });\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// };"]}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,166 @@
1
+ type MfaMethod = "EMAIL_OTP" | "SMS_OTP" | "TOTP" | "BACKUP_CODE" | "PASSKEY" | "PASSKEY_PRIMARY";
2
+ type MfaMethodStatus = "READY" | "NOT_ENROLLED";
3
+ type MfaMethodNotReadyReason = "PHONE_NOT_VERIFIED" | "NOT_ENROLLED" | "POLICY_BLOCKED" | string;
4
+ interface MfaMethodOption {
5
+ method: MfaMethod;
6
+ status: MfaMethodStatus;
7
+ destinationMasked?: string;
8
+ reason?: MfaMethodNotReadyReason;
9
+ }
10
+ interface TokenResponse {
11
+ token?: string;
12
+ refreshToken?: string;
13
+ expiresIn?: number;
14
+ refreshExpiresIn?: number;
15
+ }
16
+ interface LoginResponseData {
17
+ tokenData?: TokenResponse;
18
+ loggedInDetails?: Record<string, unknown>;
19
+ twoFactorRequired?: boolean;
20
+ otpDelivery?: string;
21
+ otpDestinationMasked?: string;
22
+ mfaMethods?: MfaMethodOption[];
23
+ defaultMethod?: MfaMethod;
24
+ }
25
+ interface TwoFaVerificationRequest {
26
+ token: string;
27
+ otp: string;
28
+ method: MfaMethod;
29
+ }
30
+ interface MfaOtpSendRequest {
31
+ token: string;
32
+ method: MfaMethod;
33
+ }
34
+ interface MfaPendingPasskeyOptionsRequest {
35
+ token: string;
36
+ portalId?: string | number;
37
+ }
38
+ interface MfaPendingPasskeyVerifyRequest {
39
+ token: string;
40
+ challengeId: string;
41
+ credential: Record<string, unknown>;
42
+ portalId?: string | number;
43
+ }
44
+ interface MfaEnrollmentStatus {
45
+ policyAllowedMethods?: MfaMethod[];
46
+ enrolledMethods?: MfaMethod[];
47
+ readyMethods?: MfaMethod[];
48
+ totpEnrolled?: boolean;
49
+ phoneVerified?: boolean;
50
+ passkeyCount?: number;
51
+ unusedBackupCodes?: number;
52
+ defaultMethod?: MfaMethod;
53
+ preferredMethod?: MfaMethod;
54
+ methods?: MfaMethodOption[];
55
+ }
56
+ interface MfaPreferenceRequest {
57
+ defaultMethod: MfaMethod;
58
+ }
59
+ interface PhoneVerifyStartRequest {
60
+ phone: string;
61
+ }
62
+ interface PhoneVerifyConfirmRequest {
63
+ phone: string;
64
+ code: string;
65
+ }
66
+ interface TotpEnrollVerifyRequest {
67
+ code: string;
68
+ portalId?: string | number;
69
+ hubId?: string | number;
70
+ }
71
+ interface TotpDisableRequest {
72
+ password: string;
73
+ }
74
+ interface WebAuthnVerifyRequest {
75
+ challengeId: string;
76
+ credential: Record<string, unknown>;
77
+ nickname?: string;
78
+ portalId?: string | number;
79
+ }
80
+ interface PasskeyLoginOptionsRequest {
81
+ email: string;
82
+ hubId?: string | number;
83
+ portalId?: string | number;
84
+ }
85
+ interface PasskeyLoginVerifyRequest {
86
+ challengeId: string;
87
+ credential: Record<string, unknown>;
88
+ portalId?: string | number;
89
+ }
90
+ interface MfaStatusQuery {
91
+ portalId?: string | number;
92
+ }
93
+
94
+ type LoginPortal = "PORTAL_CLIENT" | "PORTAL_ADMIN" | "SUPER_ADMIN";
95
+ type LoginStatus = "SUCCESS" | "FAILURE" | string;
96
+ interface SecurityOverview {
97
+ passwordLastChanged?: string;
98
+ emailVerified?: boolean;
99
+ email?: string;
100
+ twoFactorAuthEnabled?: boolean;
101
+ mfaRequired?: boolean;
102
+ methods?: MfaMethodOption[];
103
+ readyMethods?: MfaMethod[];
104
+ preferredMethod?: MfaMethod;
105
+ defaultMethod?: MfaMethod;
106
+ totpEnrolled?: boolean;
107
+ phoneVerified?: boolean;
108
+ passkeyCount?: number;
109
+ unusedBackupCodes?: number;
110
+ }
111
+ interface LoginHistoryRow {
112
+ loginHistoryId?: number;
113
+ userId?: number;
114
+ portalId?: number;
115
+ hubspotId?: number;
116
+ ipAddress?: string;
117
+ userAgent?: string;
118
+ loginTime?: string;
119
+ loginStatus?: LoginStatus;
120
+ loginPortal?: LoginPortal;
121
+ logoutTime?: string;
122
+ failureReason?: string;
123
+ countryCode?: string;
124
+ deviceType?: string;
125
+ }
126
+ interface PaginationResponse<T> {
127
+ content?: T[];
128
+ page?: number;
129
+ limit?: number;
130
+ totalElements?: number;
131
+ totalPages?: number;
132
+ }
133
+ interface ActiveSession {
134
+ familyId?: string;
135
+ current?: boolean;
136
+ deviceType?: string;
137
+ userAgent?: string;
138
+ ipAddressMasked?: string;
139
+ countryCode?: string;
140
+ lastActiveAt?: string;
141
+ expiresAt?: number;
142
+ rememberMe?: boolean;
143
+ portalId?: number;
144
+ loginPortal?: LoginPortal;
145
+ }
146
+ interface SecurityOverviewQuery {
147
+ portalId?: string | number;
148
+ }
149
+ interface SecurityLoginActivityQuery {
150
+ page?: number;
151
+ limit?: number;
152
+ sort?: string;
153
+ loginPortal?: LoginPortal;
154
+ }
155
+ interface SecuritySessionsQuery {
156
+ currentFamilyId?: string;
157
+ refreshToken?: string;
158
+ }
159
+ interface RevokeSecuritySessionPayload {
160
+ familyId: string;
161
+ refreshToken?: string;
162
+ }
163
+
1
164
  interface Config {
2
165
  hubId: string;
3
166
  devPortalId: string;
@@ -86,6 +249,136 @@ declare function resendEmail(options?: MutationOptions<any, any>): {
86
249
  isLoading: () => boolean;
87
250
  };
88
251
 
252
+ declare function verifyOtp(options?: MutationOptions<any, any>): {
253
+ mutate: (payload?: TwoFaVerificationRequest | undefined) => Promise<any>;
254
+ verifyOtp: (payload?: TwoFaVerificationRequest | undefined) => Promise<any>;
255
+ isLoading: () => boolean;
256
+ };
257
+ declare function sendMfaOtp(options?: MutationOptions<any, any>): {
258
+ mutate: (payload?: MfaOtpSendRequest | undefined) => Promise<any>;
259
+ sendMfaOtp: (payload?: MfaOtpSendRequest | undefined) => Promise<any>;
260
+ isLoading: () => boolean;
261
+ };
262
+ declare function pendingPasskeyOptions(options?: MutationOptions<any, any>): {
263
+ mutate: (payload?: MfaPendingPasskeyOptionsRequest | undefined) => Promise<any>;
264
+ pendingPasskeyOptions: (payload?: MfaPendingPasskeyOptionsRequest | undefined) => Promise<any>;
265
+ isLoading: () => boolean;
266
+ };
267
+ declare function pendingPasskeyVerify(options?: MutationOptions<any, any>): {
268
+ mutate: (payload?: MfaPendingPasskeyVerifyRequest | undefined) => Promise<any>;
269
+ pendingPasskeyVerify: (payload?: MfaPendingPasskeyVerifyRequest | undefined) => Promise<any>;
270
+ isLoading: () => boolean;
271
+ };
272
+ declare function getMfaStatus(options?: MutationOptions<any, any>): {
273
+ mutate: (payload?: MfaStatusQuery | undefined) => Promise<any>;
274
+ getMfaStatus: (payload?: MfaStatusQuery | undefined) => Promise<any>;
275
+ isLoading: () => boolean;
276
+ };
277
+ declare function setMfaPreferences(options?: MutationOptions<any, any>): {
278
+ mutate: (payload?: (MfaPreferenceRequest & MfaStatusQuery) | undefined) => Promise<any>;
279
+ setMfaPreferences: (payload?: (MfaPreferenceRequest & MfaStatusQuery) | undefined) => Promise<any>;
280
+ isLoading: () => boolean;
281
+ };
282
+ declare function startPhoneVerify(options?: MutationOptions<any, any>): {
283
+ mutate: (payload?: PhoneVerifyStartRequest | undefined) => Promise<any>;
284
+ startPhoneVerify: (payload?: PhoneVerifyStartRequest | undefined) => Promise<any>;
285
+ isLoading: () => boolean;
286
+ };
287
+ declare function confirmPhoneVerify(options?: MutationOptions<any, any>): {
288
+ mutate: (payload?: PhoneVerifyConfirmRequest | undefined) => Promise<any>;
289
+ confirmPhoneVerify: (payload?: PhoneVerifyConfirmRequest | undefined) => Promise<any>;
290
+ isLoading: () => boolean;
291
+ };
292
+ declare function totpEnrollStart(options?: MutationOptions<any, any>): {
293
+ mutate: (payload?: MfaStatusQuery | undefined) => Promise<any>;
294
+ totpEnrollStart: (payload?: MfaStatusQuery | undefined) => Promise<any>;
295
+ isLoading: () => boolean;
296
+ };
297
+ declare function totpEnrollVerify(options?: MutationOptions<any, any>): {
298
+ mutate: (payload?: TotpEnrollVerifyRequest | undefined) => Promise<any>;
299
+ totpEnrollVerify: (payload?: TotpEnrollVerifyRequest | undefined) => Promise<any>;
300
+ isLoading: () => boolean;
301
+ };
302
+ declare function totpDisable(options?: MutationOptions<any, any>): {
303
+ mutate: (payload?: TotpDisableRequest | undefined) => Promise<any>;
304
+ totpDisable: (payload?: TotpDisableRequest | undefined) => Promise<any>;
305
+ isLoading: () => boolean;
306
+ };
307
+ declare function webauthnRegisterOptions(options?: MutationOptions<any, any>): {
308
+ mutate: (payload?: MfaStatusQuery | undefined) => Promise<any>;
309
+ webauthnRegisterOptions: (payload?: MfaStatusQuery | undefined) => Promise<any>;
310
+ isLoading: () => boolean;
311
+ };
312
+ declare function webauthnRegisterVerify(options?: MutationOptions<any, any>): {
313
+ mutate: (payload?: WebAuthnVerifyRequest | undefined) => Promise<any>;
314
+ webauthnRegisterVerify: (payload?: WebAuthnVerifyRequest | undefined) => Promise<any>;
315
+ isLoading: () => boolean;
316
+ };
317
+ declare function webauthnAuthOptions(options?: MutationOptions<any, any>): {
318
+ mutate: (payload?: MfaStatusQuery | undefined) => Promise<any>;
319
+ webauthnAuthOptions: (payload?: MfaStatusQuery | undefined) => Promise<any>;
320
+ isLoading: () => boolean;
321
+ };
322
+ declare function webauthnAuthVerify(options?: MutationOptions<any, any>): {
323
+ mutate: (payload?: WebAuthnVerifyRequest | undefined) => Promise<any>;
324
+ webauthnAuthVerify: (payload?: WebAuthnVerifyRequest | undefined) => Promise<any>;
325
+ isLoading: () => boolean;
326
+ };
327
+ declare function listWebauthnCredentials(options?: MutationOptions<any, any>): {
328
+ mutate: (payload?: MfaStatusQuery | undefined) => Promise<any>;
329
+ listWebauthnCredentials: (payload?: MfaStatusQuery | undefined) => Promise<any>;
330
+ isLoading: () => boolean;
331
+ };
332
+ declare function deleteWebauthnCredential(options?: MutationOptions<any, any>): {
333
+ mutate: (payload?: ({
334
+ credentialRecordId: string | number;
335
+ } & MfaStatusQuery) | undefined) => Promise<any>;
336
+ deleteWebauthnCredential: (payload?: ({
337
+ credentialRecordId: string | number;
338
+ } & MfaStatusQuery) | undefined) => Promise<any>;
339
+ isLoading: () => boolean;
340
+ };
341
+ declare function passkeyLoginOptions(options?: MutationOptions<any, any>): {
342
+ mutate: (payload?: PasskeyLoginOptionsRequest | undefined) => Promise<any>;
343
+ passkeyLoginOptions: (payload?: PasskeyLoginOptionsRequest | undefined) => Promise<any>;
344
+ isLoading: () => boolean;
345
+ };
346
+ declare function passkeyLoginVerify(options?: MutationOptions<any, any>): {
347
+ mutate: (payload?: PasskeyLoginVerifyRequest | undefined) => Promise<any>;
348
+ passkeyLoginVerify: (payload?: PasskeyLoginVerifyRequest | undefined) => Promise<any>;
349
+ isLoading: () => boolean;
350
+ };
351
+
352
+ declare function getSecurityOverview(options?: MutationOptions<any, any>): {
353
+ mutate: (payload?: SecurityOverviewQuery | undefined) => Promise<any>;
354
+ getSecurityOverview: (payload?: SecurityOverviewQuery | undefined) => Promise<any>;
355
+ isLoading: () => boolean;
356
+ };
357
+ declare function getSecurityLoginActivity(options?: MutationOptions<any, any>): {
358
+ mutate: (payload?: SecurityLoginActivityQuery | undefined) => Promise<any>;
359
+ getSecurityLoginActivity: (payload?: SecurityLoginActivityQuery | undefined) => Promise<any>;
360
+ isLoading: () => boolean;
361
+ };
362
+ declare function getSecuritySessions(options?: MutationOptions<any, any>): {
363
+ mutate: (payload?: SecuritySessionsQuery | undefined) => Promise<any>;
364
+ getSecuritySessions: (payload?: SecuritySessionsQuery | undefined) => Promise<any>;
365
+ isLoading: () => boolean;
366
+ };
367
+ declare function revokeSecuritySession(options?: MutationOptions<any, any>): {
368
+ mutate: (payload?: RevokeSecuritySessionPayload | undefined) => Promise<any>;
369
+ revokeSecuritySession: (payload?: RevokeSecuritySessionPayload | undefined) => Promise<any>;
370
+ isLoading: () => boolean;
371
+ };
372
+ declare function revokeOtherSecuritySessions(options?: MutationOptions<any, any>): {
373
+ mutate: (payload?: {
374
+ refreshToken?: string;
375
+ } | undefined) => Promise<any>;
376
+ revokeOtherSecuritySessions: (payload?: {
377
+ refreshToken?: string;
378
+ } | undefined) => Promise<any>;
379
+ isLoading: () => boolean;
380
+ };
381
+
89
382
  declare function getSsoDetails(options?: MutationOptions<any, any>): {
90
383
  mutate: (payload?: unknown) => Promise<any>;
91
384
  getSsoDetails: (payload?: unknown) => Promise<any>;
@@ -432,6 +725,7 @@ declare const Client: {
432
725
  authentication: {
433
726
  preLogin: (data: PreLoginPayload) => Promise<unknown>;
434
727
  login: (data: LoginPayload) => Promise<unknown>;
728
+ verifyOtp: (data: TwoFaVerificationRequest) => Promise<unknown>;
435
729
  verifyEmail: (data: VerifyEmailPayload) => Promise<unknown>;
436
730
  resetPasswordVerifyToken: (data: ResetPasswordVerifyTokenPayload) => Promise<unknown>;
437
731
  resetPassword: (data: ResetPasswordPayload) => Promise<unknown>;
@@ -493,6 +787,34 @@ declare const Client: {
493
787
  addFolder: (props?: any) => Promise<unknown>;
494
788
  addFile: (props?: any) => Promise<unknown>;
495
789
  };
790
+ mfa: {
791
+ verifyOtp: (data: TwoFaVerificationRequest) => Promise<unknown>;
792
+ sendPendingOtp: (data: MfaOtpSendRequest) => Promise<unknown>;
793
+ pendingPasskeyOptions: (data: MfaPendingPasskeyOptionsRequest) => Promise<unknown>;
794
+ pendingPasskeyVerify: (data: MfaPendingPasskeyVerifyRequest) => Promise<unknown>;
795
+ getStatus: (query?: MfaStatusQuery) => Promise<unknown>;
796
+ setPreferences: (data: MfaPreferenceRequest, query?: MfaStatusQuery) => Promise<unknown>;
797
+ startPhoneVerify: (data: PhoneVerifyStartRequest) => Promise<unknown>;
798
+ confirmPhoneVerify: (data: PhoneVerifyConfirmRequest) => Promise<unknown>;
799
+ totpEnrollStart: (query?: MfaStatusQuery) => Promise<unknown>;
800
+ totpEnrollVerify: (data: TotpEnrollVerifyRequest) => Promise<unknown>;
801
+ totpDisable: (data: TotpDisableRequest) => Promise<unknown>;
802
+ webauthnRegisterOptions: (query?: MfaStatusQuery) => Promise<unknown>;
803
+ webauthnRegisterVerify: (data: WebAuthnVerifyRequest) => Promise<unknown>;
804
+ webauthnAuthOptions: (query?: MfaStatusQuery) => Promise<unknown>;
805
+ webauthnAuthVerify: (data: WebAuthnVerifyRequest) => Promise<unknown>;
806
+ listWebauthnCredentials: (query?: MfaStatusQuery) => Promise<unknown>;
807
+ deleteWebauthnCredential: (credentialRecordId: string | number, query?: MfaStatusQuery) => Promise<unknown>;
808
+ passkeyLoginOptions: (data: PasskeyLoginOptionsRequest) => Promise<unknown>;
809
+ passkeyLoginVerify: (data: PasskeyLoginVerifyRequest) => Promise<unknown>;
810
+ };
811
+ security: {
812
+ getOverview: (query?: SecurityOverviewQuery) => Promise<unknown>;
813
+ getLoginActivity: (query?: SecurityLoginActivityQuery) => Promise<unknown>;
814
+ getSessions: (query?: SecuritySessionsQuery) => Promise<unknown>;
815
+ revokeSession: (payload: RevokeSecuritySessionPayload) => Promise<unknown>;
816
+ revokeOtherSessions: (refreshToken?: string) => Promise<unknown>;
817
+ };
496
818
  };
497
819
 
498
820
  declare const index_Client: typeof Client;
@@ -503,6 +825,7 @@ declare namespace index {
503
825
  declare const api: {
504
826
  preLogin: typeof preLogin;
505
827
  login: typeof login;
828
+ verifyOtp: typeof verifyOtp;
506
829
  verifyEmail: typeof verifyEmail;
507
830
  resetPasswordVerifyToken: typeof resetPasswordVerifyToken;
508
831
  resetPassword: typeof resetPassword;
@@ -517,6 +840,29 @@ declare const api: {
517
840
  me: typeof me;
518
841
  profile: typeof profile;
519
842
  changePassword: typeof changePassword;
843
+ sendMfaOtp: typeof sendMfaOtp;
844
+ pendingPasskeyOptions: typeof pendingPasskeyOptions;
845
+ pendingPasskeyVerify: typeof pendingPasskeyVerify;
846
+ getMfaStatus: typeof getMfaStatus;
847
+ setMfaPreferences: typeof setMfaPreferences;
848
+ startPhoneVerify: typeof startPhoneVerify;
849
+ confirmPhoneVerify: typeof confirmPhoneVerify;
850
+ totpEnrollStart: typeof totpEnrollStart;
851
+ totpEnrollVerify: typeof totpEnrollVerify;
852
+ totpDisable: typeof totpDisable;
853
+ webauthnRegisterOptions: typeof webauthnRegisterOptions;
854
+ webauthnRegisterVerify: typeof webauthnRegisterVerify;
855
+ webauthnAuthOptions: typeof webauthnAuthOptions;
856
+ webauthnAuthVerify: typeof webauthnAuthVerify;
857
+ listWebauthnCredentials: typeof listWebauthnCredentials;
858
+ deleteWebauthnCredential: typeof deleteWebauthnCredential;
859
+ passkeyLoginOptions: typeof passkeyLoginOptions;
860
+ passkeyLoginVerify: typeof passkeyLoginVerify;
861
+ getSecurityOverview: typeof getSecurityOverview;
862
+ getSecurityLoginActivity: typeof getSecurityLoginActivity;
863
+ getSecuritySessions: typeof getSecuritySessions;
864
+ revokeSecuritySession: typeof revokeSecuritySession;
865
+ revokeOtherSecuritySessions: typeof revokeOtherSecuritySessions;
520
866
  pipelines: typeof list$5;
521
867
  stages: typeof list$4;
522
868
  objects: typeof list$3;
@@ -597,4 +943,4 @@ declare const routeParam: {
597
943
  };
598
944
  };
599
945
 
600
- 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, extractEngagementItemIdFromWriteResponse, extractHubspotRecordIdFromWriteResponse, formatGmtOffset, formatHubSpotActivityDateTime, formatHubSpotActivityDateTimeParts, getCurrentTimeZone, getFieldErrors, getFormErrors, initializeHttpClient, mergePurgeTargets, normalizeToTimestamp, purgeCrmCombined, purgeCrmDetailAndListAfterCrmWrite, purgeCrmListCache, purgeCrmListCacheAfterCrmWrite, purgeCrmObjectDataCache, purgeCrmRecordCache, purgeEngagementCaches, purgeEngagementCachesAfterCrmWrite, resolveCrmListPurgeQuery, routeParam, store, toCachePurgeListQuery, url };
946
+ export { type ActiveSession, 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 LoginHistoryRow, type LoginPayload, type LoginResponseData, type MfaEnrollmentStatus, type MfaMethod, type MfaMethodOption, type MutationOptions, type PaginationResponse, type PreLoginPayload, type PurgeResult, type ResetPasswordPayload, type ResetPasswordVerifyTokenPayload, type SecurityOverview, type TwoFaVerificationRequest, type VerifyEmailPayload, api, breadcrumbsDetails, buildCachePurgeRequest, buildCrmListPurgeTarget, buildCrmSinglePurgeTarget, buildEngagementPurgeTarget, buildPortalConfigPurgeTarget, buildUserSessionPurgeTarget, index as clint, createCachePurgeJob, extractEngagementItemIdFromWriteResponse, extractHubspotRecordIdFromWriteResponse, formatGmtOffset, formatHubSpotActivityDateTime, formatHubSpotActivityDateTimeParts, getCurrentTimeZone, getFieldErrors, getFormErrors, initializeHttpClient, mergePurgeTargets, normalizeToTimestamp, purgeCrmCombined, purgeCrmDetailAndListAfterCrmWrite, purgeCrmListCache, purgeCrmListCacheAfterCrmWrite, purgeCrmObjectDataCache, purgeCrmRecordCache, purgeEngagementCaches, purgeEngagementCachesAfterCrmWrite, resolveCrmListPurgeQuery, routeParam, store, toCachePurgeListQuery, url };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { DEFAULT_HUBSPOT_TIMEZONE, api, breadcrumbsDetails, buildCachePurgeRequest, buildCrmListPurgeTarget, buildCrmSinglePurgeTarget, buildEngagementPurgeTarget, buildPortalConfigPurgeTarget, buildUserSessionPurgeTarget, client_exports as clint, createCachePurgeJob, extractEngagementItemIdFromWriteResponse, extractHubspotRecordIdFromWriteResponse, formatGmtOffset, formatHubSpotActivityDateTime, formatHubSpotActivityDateTimeParts, getCurrentTimeZone, getFieldErrors, getFormErrors, initializeHttpClient, mergePurgeTargets, normalizeToTimestamp, purgeCrmCombined, purgeCrmDetailAndListAfterCrmWrite, purgeCrmListCache, purgeCrmListCacheAfterCrmWrite, purgeCrmObjectDataCache, purgeCrmRecordCache, purgeEngagementCaches, purgeEngagementCachesAfterCrmWrite, resolveCrmListPurgeQuery, routeParam, store, toCachePurgeListQuery, url } from './chunk-XWIYW67P.js';
2
- import './chunk-2SYUOWTT.js';
1
+ export { DEFAULT_HUBSPOT_TIMEZONE, api, breadcrumbsDetails, buildCachePurgeRequest, buildCrmListPurgeTarget, buildCrmSinglePurgeTarget, buildEngagementPurgeTarget, buildPortalConfigPurgeTarget, buildUserSessionPurgeTarget, client_exports as clint, createCachePurgeJob, extractEngagementItemIdFromWriteResponse, extractHubspotRecordIdFromWriteResponse, formatGmtOffset, formatHubSpotActivityDateTime, formatHubSpotActivityDateTimeParts, getCurrentTimeZone, getFieldErrors, getFormErrors, initializeHttpClient, mergePurgeTargets, normalizeToTimestamp, purgeCrmCombined, purgeCrmDetailAndListAfterCrmWrite, purgeCrmListCache, purgeCrmListCacheAfterCrmWrite, purgeCrmObjectDataCache, purgeCrmRecordCache, purgeEngagementCaches, purgeEngagementCachesAfterCrmWrite, resolveCrmListPurgeQuery, routeParam, store, toCachePurgeListQuery, url } from './chunk-C76BHDO4.js';
2
+ import './chunk-S2NB4AXQ.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
@@ -32,6 +32,10 @@ interface EmailState {
32
32
  queryParams: any;
33
33
  }
34
34
 
35
+ interface UserState {
36
+ profile: any;
37
+ }
38
+
35
39
  interface SyncState {
36
40
  apiSync: boolean;
37
41
  sync: boolean;
@@ -52,4 +56,4 @@ interface UploaderState {
52
56
  attachments: AttachmentData[];
53
57
  }
54
58
 
55
- export type { EmailState as E, MultiObjectTableState as M, NoteState as N, SyncState as S, TableState as T, UploaderState as U };
59
+ export type { EmailState as E, MultiObjectTableState as M, NoteState as N, SyncState as S, TableState as T, UploaderState as U, UserState as a };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "woodsportal-client-sdk",
3
- "version": "1.1.4-dev.62",
3
+ "version": "1.1.4-dev.64",
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",
@@ -36,11 +36,11 @@
36
36
  },
37
37
  "scripts": {
38
38
  "dev": "npx tsc --watch",
39
- "start": "nodemon --watch src --ext ts --exec tsx src/index.ts",
39
+ "start": "nodemon --watch src/main --ext ts --exec tsx src/main/index.ts",
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
+ "test": "node --import tsx --test 'src/test/**/*.test.ts'",
44
44
  "test:consumer": "npm run build && cd examples/smoke-consumer && npm install && npm run smoke",
45
45
  "test:consumer:live": "npm run build && cd examples/smoke-consumer && npm install && npm run smoke:live",
46
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-2SYUOWTT.js';
2
- //# sourceMappingURL=auth-utils-TZSW6BVD.js.map
3
- //# sourceMappingURL=auth-utils-TZSW6BVD.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,kBAAA;AAG1B,IAAM,YAAA,GAAe;AACrB,IAAM,MAAA,GAAS;AACf,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EO,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-2SYUOWTT.js","sourcesContent":["// cookies\nexport const LOGIN_DETAILS = \"loginDetails\";\nexport const REFRESH_TOKEN = \"refreshToken\";\nexport const PORTAL = \"portal\";\nexport const SUBSCRIPTION_TYPE = \"subscriptionType\";\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// };"]}
@@ -1,17 +0,0 @@
1
- import { uploaderStore, actions2, syncStore, actions5, emailStore, actions4, noteStore, actions3, multiObjectStore, actions6, tableStore, actions } from './chunk-XWIYW67P.js';
2
-
3
- // src/adapters/shared/createAdapterHooks.ts
4
- function createAdapterHooks(createComposable) {
5
- return {
6
- useTable: createComposable(tableStore, actions),
7
- useMultiObjectActions: createComposable(multiObjectStore, actions6),
8
- useNote: createComposable(noteStore, actions3),
9
- useEmail: createComposable(emailStore, actions4),
10
- useSync: createComposable(syncStore, actions5),
11
- useUploader: createComposable(uploaderStore, actions2)
12
- };
13
- }
14
-
15
- export { createAdapterHooks };
16
- //# sourceMappingURL=chunk-XFNFPTU6.js.map
17
- //# sourceMappingURL=chunk-XFNFPTU6.js.map
@@ -1 +0,0 @@
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-XFNFPTU6.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"]}