woodsportal-client-sdk 1.1.4-dev.63 → 1.1.4-dev.65
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/CHANGELOG.md +12 -0
- package/README.md +74 -1
- package/dist/adapters/angular/index.js +5 -5
- package/dist/adapters/angular/index.js.map +1 -1
- package/dist/adapters/react/index.js +4 -4
- package/dist/adapters/react/index.js.map +1 -1
- package/dist/adapters/vue/index.js +5 -5
- package/dist/adapters/vue/index.js.map +1 -1
- package/dist/auth-utils-UU5PVRPL.js +3 -0
- package/dist/{auth-utils-BPOQZCAA.js.map → auth-utils-UU5PVRPL.js.map} +1 -1
- package/dist/{chunk-YEHZZGAU.js → chunk-FBCBJGCE.js} +531 -72
- package/dist/chunk-FBCBJGCE.js.map +1 -0
- package/dist/{chunk-ALQCX7KV.js → chunk-GMM4A727.js} +4 -4
- package/dist/chunk-GMM4A727.js.map +1 -0
- package/dist/{chunk-Y5MRAAGK.js → chunk-HBHT637F.js} +3 -3
- package/dist/chunk-HBHT637F.js.map +1 -0
- package/dist/{chunk-UGSUUZLT.js → chunk-S2NB4AXQ.js} +6 -6
- package/dist/chunk-S2NB4AXQ.js.map +1 -0
- package/dist/index.d.ts +354 -1
- package/dist/index.js +2 -2
- package/package.json +3 -3
- package/dist/auth-utils-BPOQZCAA.js +0 -3
- package/dist/chunk-ALQCX7KV.js.map +0 -1
- package/dist/chunk-UGSUUZLT.js.map +0 -1
- package/dist/chunk-Y5MRAAGK.js.map +0 -1
- package/dist/chunk-YEHZZGAU.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { uploaderStore, actions3, syncStore, actions6, userStore, actions, emailStore, actions5, noteStore, actions4, multiObjectStore, actions7, tableStore, actions2 } from './chunk-
|
|
1
|
+
import { uploaderStore, actions3, syncStore, actions6, userStore, actions, emailStore, actions5, noteStore, actions4, multiObjectStore, actions7, tableStore, actions2 } from './chunk-FBCBJGCE.js';
|
|
2
2
|
|
|
3
|
-
// src/adapters/shared/createAdapterHooks.ts
|
|
3
|
+
// src/main/adapters/shared/createAdapterHooks.ts
|
|
4
4
|
function createAdapterHooks(createComposable) {
|
|
5
5
|
return {
|
|
6
6
|
useTable: createComposable(tableStore, actions2),
|
|
@@ -14,5 +14,5 @@ function createAdapterHooks(createComposable) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export { createAdapterHooks };
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
17
|
+
//# sourceMappingURL=chunk-GMM4A727.js.map
|
|
18
|
+
//# sourceMappingURL=chunk-GMM4A727.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-GMM4A727.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"]}
|
|
@@ -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-
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
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"]}
|
|
@@ -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-
|
|
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,7 +90,7 @@ 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));
|
|
@@ -141,5 +141,5 @@ function getSubscriptionType() {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
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-
|
|
145
|
-
//# sourceMappingURL=chunk-
|
|
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","../src/main/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,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,GA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AK,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>;
|
|
@@ -112,6 +405,11 @@ declare function profile(options?: MutationOptions<any, any>): {
|
|
|
112
405
|
profile: (payload?: any) => Promise<any>;
|
|
113
406
|
isLoading: () => boolean;
|
|
114
407
|
};
|
|
408
|
+
declare function profileUpdate(options?: MutationOptions<any, any>): {
|
|
409
|
+
mutate: (payload?: any) => Promise<any>;
|
|
410
|
+
profileUpdate: (payload?: any) => Promise<any>;
|
|
411
|
+
isLoading: () => boolean;
|
|
412
|
+
};
|
|
115
413
|
declare function changePassword(options?: MutationOptions<any, any>): {
|
|
116
414
|
mutate: (payload?: ChangePasswordPayload | undefined) => Promise<any>;
|
|
117
415
|
changePassword: (payload?: ChangePasswordPayload | undefined) => Promise<any>;
|
|
@@ -432,6 +730,7 @@ declare const Client: {
|
|
|
432
730
|
authentication: {
|
|
433
731
|
preLogin: (data: PreLoginPayload) => Promise<unknown>;
|
|
434
732
|
login: (data: LoginPayload) => Promise<unknown>;
|
|
733
|
+
verifyOtp: (data: TwoFaVerificationRequest) => Promise<unknown>;
|
|
435
734
|
verifyEmail: (data: VerifyEmailPayload) => Promise<unknown>;
|
|
436
735
|
resetPasswordVerifyToken: (data: ResetPasswordVerifyTokenPayload) => Promise<unknown>;
|
|
437
736
|
resetPassword: (data: ResetPasswordPayload) => Promise<unknown>;
|
|
@@ -449,6 +748,7 @@ declare const Client: {
|
|
|
449
748
|
user: {
|
|
450
749
|
me: () => Promise<unknown>;
|
|
451
750
|
profile: (payload: any) => Promise<unknown>;
|
|
751
|
+
profileUpdate: (props: any) => Promise<unknown>;
|
|
452
752
|
changePassword: (data: ChangePasswordPayload) => Promise<unknown>;
|
|
453
753
|
};
|
|
454
754
|
pipeline: {
|
|
@@ -493,6 +793,34 @@ declare const Client: {
|
|
|
493
793
|
addFolder: (props?: any) => Promise<unknown>;
|
|
494
794
|
addFile: (props?: any) => Promise<unknown>;
|
|
495
795
|
};
|
|
796
|
+
mfa: {
|
|
797
|
+
verifyOtp: (data: TwoFaVerificationRequest) => Promise<unknown>;
|
|
798
|
+
sendPendingOtp: (data: MfaOtpSendRequest) => Promise<unknown>;
|
|
799
|
+
pendingPasskeyOptions: (data: MfaPendingPasskeyOptionsRequest) => Promise<unknown>;
|
|
800
|
+
pendingPasskeyVerify: (data: MfaPendingPasskeyVerifyRequest) => Promise<unknown>;
|
|
801
|
+
getStatus: (query?: MfaStatusQuery) => Promise<unknown>;
|
|
802
|
+
setPreferences: (data: MfaPreferenceRequest, query?: MfaStatusQuery) => Promise<unknown>;
|
|
803
|
+
startPhoneVerify: (data: PhoneVerifyStartRequest) => Promise<unknown>;
|
|
804
|
+
confirmPhoneVerify: (data: PhoneVerifyConfirmRequest) => Promise<unknown>;
|
|
805
|
+
totpEnrollStart: (query?: MfaStatusQuery) => Promise<unknown>;
|
|
806
|
+
totpEnrollVerify: (data: TotpEnrollVerifyRequest) => Promise<unknown>;
|
|
807
|
+
totpDisable: (data: TotpDisableRequest) => Promise<unknown>;
|
|
808
|
+
webauthnRegisterOptions: (query?: MfaStatusQuery) => Promise<unknown>;
|
|
809
|
+
webauthnRegisterVerify: (data: WebAuthnVerifyRequest) => Promise<unknown>;
|
|
810
|
+
webauthnAuthOptions: (query?: MfaStatusQuery) => Promise<unknown>;
|
|
811
|
+
webauthnAuthVerify: (data: WebAuthnVerifyRequest) => Promise<unknown>;
|
|
812
|
+
listWebauthnCredentials: (query?: MfaStatusQuery) => Promise<unknown>;
|
|
813
|
+
deleteWebauthnCredential: (credentialRecordId: string | number, query?: MfaStatusQuery) => Promise<unknown>;
|
|
814
|
+
passkeyLoginOptions: (data: PasskeyLoginOptionsRequest) => Promise<unknown>;
|
|
815
|
+
passkeyLoginVerify: (data: PasskeyLoginVerifyRequest) => Promise<unknown>;
|
|
816
|
+
};
|
|
817
|
+
security: {
|
|
818
|
+
getOverview: (query?: SecurityOverviewQuery) => Promise<unknown>;
|
|
819
|
+
getLoginActivity: (query?: SecurityLoginActivityQuery) => Promise<unknown>;
|
|
820
|
+
getSessions: (query?: SecuritySessionsQuery) => Promise<unknown>;
|
|
821
|
+
revokeSession: (payload: RevokeSecuritySessionPayload) => Promise<unknown>;
|
|
822
|
+
revokeOtherSessions: (refreshToken?: string) => Promise<unknown>;
|
|
823
|
+
};
|
|
496
824
|
};
|
|
497
825
|
|
|
498
826
|
declare const index_Client: typeof Client;
|
|
@@ -503,6 +831,7 @@ declare namespace index {
|
|
|
503
831
|
declare const api: {
|
|
504
832
|
preLogin: typeof preLogin;
|
|
505
833
|
login: typeof login;
|
|
834
|
+
verifyOtp: typeof verifyOtp;
|
|
506
835
|
verifyEmail: typeof verifyEmail;
|
|
507
836
|
resetPasswordVerifyToken: typeof resetPasswordVerifyToken;
|
|
508
837
|
resetPassword: typeof resetPassword;
|
|
@@ -516,7 +845,31 @@ declare const api: {
|
|
|
516
845
|
logout: typeof logout;
|
|
517
846
|
me: typeof me;
|
|
518
847
|
profile: typeof profile;
|
|
848
|
+
profileUpdate: typeof profileUpdate;
|
|
519
849
|
changePassword: typeof changePassword;
|
|
850
|
+
sendMfaOtp: typeof sendMfaOtp;
|
|
851
|
+
pendingPasskeyOptions: typeof pendingPasskeyOptions;
|
|
852
|
+
pendingPasskeyVerify: typeof pendingPasskeyVerify;
|
|
853
|
+
getMfaStatus: typeof getMfaStatus;
|
|
854
|
+
setMfaPreferences: typeof setMfaPreferences;
|
|
855
|
+
startPhoneVerify: typeof startPhoneVerify;
|
|
856
|
+
confirmPhoneVerify: typeof confirmPhoneVerify;
|
|
857
|
+
totpEnrollStart: typeof totpEnrollStart;
|
|
858
|
+
totpEnrollVerify: typeof totpEnrollVerify;
|
|
859
|
+
totpDisable: typeof totpDisable;
|
|
860
|
+
webauthnRegisterOptions: typeof webauthnRegisterOptions;
|
|
861
|
+
webauthnRegisterVerify: typeof webauthnRegisterVerify;
|
|
862
|
+
webauthnAuthOptions: typeof webauthnAuthOptions;
|
|
863
|
+
webauthnAuthVerify: typeof webauthnAuthVerify;
|
|
864
|
+
listWebauthnCredentials: typeof listWebauthnCredentials;
|
|
865
|
+
deleteWebauthnCredential: typeof deleteWebauthnCredential;
|
|
866
|
+
passkeyLoginOptions: typeof passkeyLoginOptions;
|
|
867
|
+
passkeyLoginVerify: typeof passkeyLoginVerify;
|
|
868
|
+
getSecurityOverview: typeof getSecurityOverview;
|
|
869
|
+
getSecurityLoginActivity: typeof getSecurityLoginActivity;
|
|
870
|
+
getSecuritySessions: typeof getSecuritySessions;
|
|
871
|
+
revokeSecuritySession: typeof revokeSecuritySession;
|
|
872
|
+
revokeOtherSecuritySessions: typeof revokeOtherSecuritySessions;
|
|
520
873
|
pipelines: typeof list$5;
|
|
521
874
|
stages: typeof list$4;
|
|
522
875
|
objects: typeof list$3;
|
|
@@ -597,4 +950,4 @@ declare const routeParam: {
|
|
|
597
950
|
};
|
|
598
951
|
};
|
|
599
952
|
|
|
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 };
|
|
953
|
+
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-
|
|
2
|
-
import './chunk-
|
|
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-FBCBJGCE.js';
|
|
2
|
+
import './chunk-S2NB4AXQ.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.65",
|
|
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, setProfileDetails, setRefreshToken, setSubscriptionType } from './chunk-UGSUUZLT.js';
|
|
2
|
-
//# sourceMappingURL=auth-utils-BPOQZCAA.js.map
|
|
3
|
-
//# sourceMappingURL=auth-utils-BPOQZCAA.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/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-ALQCX7KV.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"]}
|
|
@@ -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,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,IAAM,kBAAkB,MAAM;AACjC,EAAA,MAAA,CAAO,KAAK,OAAA,CAAQ,GAAA,EAAK,CAAA,CAAE,OAAA,CAAQ,CAAC,UAAA,KAAe;AAC/C,IAAA,OAAA,CAAQ,OAAO,UAAU,CAAA;AAAA,EAC7B,CAAC,CAAA;AACL;AAQO,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EAAoB;AAChE,EAAA,OAAO,IAAI,OAAA,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-UGSUUZLT.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// };"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/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-Y5MRAAGK.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"]}
|