woodsportal-client-sdk 1.1.4-dev.2 → 1.1.4-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -1
- package/dist/index.js +165 -80
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface Config {
|
|
2
2
|
hubId: string;
|
|
3
3
|
devPortalId: string;
|
|
4
|
+
portalId: string;
|
|
4
5
|
}
|
|
5
6
|
interface MutationOptions<TSuccess, TError = unknown> {
|
|
6
7
|
onSuccess?: (data: TSuccess, payload: any) => void | Promise<void>;
|
|
@@ -334,7 +335,7 @@ declare const url: {
|
|
|
334
335
|
makeLink: (props: any) => string;
|
|
335
336
|
};
|
|
336
337
|
useUpdateLink: () => {
|
|
337
|
-
updateLink: (props: any, displayName?: string) => void
|
|
338
|
+
updateLink: (props: any, displayName?: string) => Promise<void>;
|
|
338
339
|
getLinkParams: (displayName?: string) => {
|
|
339
340
|
[k: string]: any;
|
|
340
341
|
} | null;
|
package/dist/index.js
CHANGED
|
@@ -3,13 +3,18 @@ import axios from 'axios';
|
|
|
3
3
|
import pako from 'pako';
|
|
4
4
|
import { Base64 } from 'js-base64';
|
|
5
5
|
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
6
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
8
|
var __esm = (fn, res) => function __init() {
|
|
8
9
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
10
|
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
10
15
|
|
|
11
16
|
// src/utils/constants.ts
|
|
12
|
-
var LOGIN_DETAILS, REFRESH_TOKEN, PORTAL, SUBSCRIPTION_TYPE, HUBSPOT_DATA, HUB_ID, DEV_PORTAL_ID;
|
|
17
|
+
var LOGIN_DETAILS, REFRESH_TOKEN, PORTAL, SUBSCRIPTION_TYPE, HUBSPOT_DATA, HUB_ID, DEV_PORTAL_ID, PORTAL_ID;
|
|
13
18
|
var init_constants = __esm({
|
|
14
19
|
"src/utils/constants.ts"() {
|
|
15
20
|
LOGIN_DETAILS = "loginDetails";
|
|
@@ -19,6 +24,7 @@ var init_constants = __esm({
|
|
|
19
24
|
HUBSPOT_DATA = "hubSpotData";
|
|
20
25
|
HUB_ID = "hubId";
|
|
21
26
|
DEV_PORTAL_ID = "devPortalId";
|
|
27
|
+
PORTAL_ID = "portalId";
|
|
22
28
|
}
|
|
23
29
|
});
|
|
24
30
|
var setCookie, getCookie, removeAllCookie, isCookieExpired;
|
|
@@ -51,43 +57,19 @@ var init_cookie = __esm({
|
|
|
51
57
|
}
|
|
52
58
|
});
|
|
53
59
|
|
|
54
|
-
// src/clint/token-store.ts
|
|
55
|
-
function getAccessToken() {
|
|
56
|
-
return accessToken;
|
|
57
|
-
}
|
|
58
|
-
function storAccessToken(token, expiresIn) {
|
|
59
|
-
accessToken = token;
|
|
60
|
-
if (expiresIn) {
|
|
61
|
-
tokenExpiresAt = Date.now() + expiresIn * 1e3;
|
|
62
|
-
} else {
|
|
63
|
-
tokenExpiresAt = null;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function clearAccessToken() {
|
|
67
|
-
accessToken = null;
|
|
68
|
-
tokenExpiresAt = null;
|
|
69
|
-
}
|
|
70
|
-
function isExpiresAccessToken() {
|
|
71
|
-
if (!tokenExpiresAt) return true;
|
|
72
|
-
return Date.now() >= tokenExpiresAt;
|
|
73
|
-
}
|
|
74
|
-
function isAuthenticateApp() {
|
|
75
|
-
if (isCookieExpired(REFRESH_TOKEN) || isExpiresAccessToken()) {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
var accessToken, tokenExpiresAt;
|
|
81
|
-
var init_token_store = __esm({
|
|
82
|
-
"src/clint/token-store.ts"() {
|
|
83
|
-
init_cookie();
|
|
84
|
-
init_constants();
|
|
85
|
-
accessToken = null;
|
|
86
|
-
tokenExpiresAt = null;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
|
|
90
60
|
// src/clint/auth-utils.ts
|
|
61
|
+
var auth_utils_exports = {};
|
|
62
|
+
__export(auth_utils_exports, {
|
|
63
|
+
getPortal: () => getPortal,
|
|
64
|
+
getProfile: () => getProfile,
|
|
65
|
+
getRefreshToken: () => getRefreshToken,
|
|
66
|
+
getSubscriptionType: () => getSubscriptionType,
|
|
67
|
+
setAccessToken: () => setAccessToken,
|
|
68
|
+
setLoggedInDetails: () => setLoggedInDetails,
|
|
69
|
+
setPortal: () => setPortal,
|
|
70
|
+
setRefreshToken: () => setRefreshToken,
|
|
71
|
+
setSubscriptionType: () => setSubscriptionType
|
|
72
|
+
});
|
|
91
73
|
function setRefreshToken(token, expiresAt) {
|
|
92
74
|
return new Promise((resolve) => {
|
|
93
75
|
setCookie(REFRESH_TOKEN, JSON.stringify(token), expiresAt);
|
|
@@ -100,12 +82,18 @@ function setAccessToken(token, expiresIn) {
|
|
|
100
82
|
resolve();
|
|
101
83
|
});
|
|
102
84
|
}
|
|
85
|
+
function getProfile() {
|
|
86
|
+
return JSON.parse(getCookie(LOGIN_DETAILS || null) || null);
|
|
87
|
+
}
|
|
103
88
|
function getRefreshToken() {
|
|
104
89
|
return JSON.parse(getCookie(REFRESH_TOKEN || null) || null);
|
|
105
90
|
}
|
|
106
91
|
function getPortal() {
|
|
107
92
|
return JSON.parse(getCookie(PORTAL || null) || null);
|
|
108
93
|
}
|
|
94
|
+
function getSubscriptionType() {
|
|
95
|
+
return JSON.parse(getCookie(SUBSCRIPTION_TYPE || null) || null);
|
|
96
|
+
}
|
|
109
97
|
var setLoggedInDetails, setPortal, setSubscriptionType;
|
|
110
98
|
var init_auth_utils = __esm({
|
|
111
99
|
"src/clint/auth-utils.ts"() {
|
|
@@ -133,6 +121,55 @@ var init_auth_utils = __esm({
|
|
|
133
121
|
}
|
|
134
122
|
});
|
|
135
123
|
|
|
124
|
+
// src/clint/token-store.ts
|
|
125
|
+
function getAccessToken() {
|
|
126
|
+
return accessToken;
|
|
127
|
+
}
|
|
128
|
+
function storAccessToken(token, expiresIn) {
|
|
129
|
+
accessToken = token;
|
|
130
|
+
if (expiresIn) {
|
|
131
|
+
tokenExpiresAt = Date.now() + expiresIn * 1e3;
|
|
132
|
+
} else {
|
|
133
|
+
tokenExpiresAt = null;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function clearAccessToken() {
|
|
137
|
+
accessToken = null;
|
|
138
|
+
tokenExpiresAt = null;
|
|
139
|
+
}
|
|
140
|
+
function isExpiresAccessToken() {
|
|
141
|
+
if (!tokenExpiresAt) return true;
|
|
142
|
+
return Date.now() >= tokenExpiresAt;
|
|
143
|
+
}
|
|
144
|
+
function setRefreshCallback(callback) {
|
|
145
|
+
refreshCallback = callback;
|
|
146
|
+
}
|
|
147
|
+
async function ensureValidRefresh() {
|
|
148
|
+
if (isExpiresAccessToken() && refreshCallback) {
|
|
149
|
+
const { getRefreshToken: getRefreshToken2 } = await Promise.resolve().then(() => (init_auth_utils(), auth_utils_exports));
|
|
150
|
+
const refreshToken = getRefreshToken2();
|
|
151
|
+
if (refreshToken) {
|
|
152
|
+
await refreshCallback(refreshToken);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function isAuthenticateApp() {
|
|
157
|
+
if (isCookieExpired(REFRESH_TOKEN) || isExpiresAccessToken()) {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
var accessToken, tokenExpiresAt, refreshCallback;
|
|
163
|
+
var init_token_store = __esm({
|
|
164
|
+
"src/clint/token-store.ts"() {
|
|
165
|
+
init_cookie();
|
|
166
|
+
init_constants();
|
|
167
|
+
accessToken = null;
|
|
168
|
+
tokenExpiresAt = null;
|
|
169
|
+
refreshCallback = null;
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
|
|
136
173
|
// src/utils/config.ts
|
|
137
174
|
init_constants();
|
|
138
175
|
|
|
@@ -159,15 +196,18 @@ var config = {
|
|
|
159
196
|
get devPortalId() {
|
|
160
197
|
const hubSpotData = storage.get(HUBSPOT_DATA);
|
|
161
198
|
return hubSpotData?.[DEV_PORTAL_ID] || "";
|
|
199
|
+
},
|
|
200
|
+
get portalId() {
|
|
201
|
+
const hubSpotData = storage.get(HUBSPOT_DATA);
|
|
202
|
+
return hubSpotData?.[PORTAL_ID] || "";
|
|
162
203
|
}
|
|
163
204
|
};
|
|
164
205
|
var setConfig = {
|
|
165
206
|
setDevPortalId(portalId) {
|
|
166
207
|
const existing = storage.get(HUBSPOT_DATA) || {};
|
|
167
|
-
console.log("portalId", portalId);
|
|
168
208
|
storage.set(HUBSPOT_DATA, {
|
|
169
209
|
...existing,
|
|
170
|
-
[
|
|
210
|
+
[PORTAL_ID]: portalId
|
|
171
211
|
});
|
|
172
212
|
}
|
|
173
213
|
};
|
|
@@ -180,7 +220,7 @@ var generateApiUrl = ({
|
|
|
180
220
|
}) => {
|
|
181
221
|
const defaultParams = {
|
|
182
222
|
hubId: config.hubId,
|
|
183
|
-
portalId: config.
|
|
223
|
+
portalId: config.portalId
|
|
184
224
|
};
|
|
185
225
|
params = { ...defaultParams, ...params };
|
|
186
226
|
const url2 = replaceParams(route, params);
|
|
@@ -274,6 +314,7 @@ function initializeHttpClient(clientConfig) {
|
|
|
274
314
|
...config3.headers
|
|
275
315
|
}
|
|
276
316
|
});
|
|
317
|
+
setRefreshCallback(getAuthRefreshToken);
|
|
277
318
|
axiosInstance.interceptors.request.use((config4) => {
|
|
278
319
|
const token = getAccessToken();
|
|
279
320
|
if (token) {
|
|
@@ -300,6 +341,44 @@ function getAxiosInstance() {
|
|
|
300
341
|
}
|
|
301
342
|
return axiosInstance;
|
|
302
343
|
}
|
|
344
|
+
function formatBooleanSearchParam(key, value) {
|
|
345
|
+
return value ? `${key}:1` : `${key}:`;
|
|
346
|
+
}
|
|
347
|
+
var HttpClient = class {
|
|
348
|
+
static async get(url2, params) {
|
|
349
|
+
await ensureValidRefresh();
|
|
350
|
+
const response = await getAxiosInstance().get(url2, { params });
|
|
351
|
+
return response.data;
|
|
352
|
+
}
|
|
353
|
+
static async post(url2, data, options) {
|
|
354
|
+
await ensureValidRefresh();
|
|
355
|
+
const response = await getAxiosInstance().post(url2, data, options);
|
|
356
|
+
return response.data;
|
|
357
|
+
}
|
|
358
|
+
static async put(url2, data) {
|
|
359
|
+
await ensureValidRefresh();
|
|
360
|
+
const response = await getAxiosInstance().put(url2, data);
|
|
361
|
+
return response.data;
|
|
362
|
+
}
|
|
363
|
+
static async delete(url2) {
|
|
364
|
+
await ensureValidRefresh();
|
|
365
|
+
const response = await getAxiosInstance().delete(url2);
|
|
366
|
+
return response.data;
|
|
367
|
+
}
|
|
368
|
+
static formatSearchParams(params) {
|
|
369
|
+
return Object.entries(params).filter(([, value]) => Boolean(value)).map(
|
|
370
|
+
([k, v]) => [
|
|
371
|
+
"type",
|
|
372
|
+
"categories",
|
|
373
|
+
"tags",
|
|
374
|
+
"author",
|
|
375
|
+
"manufacturer",
|
|
376
|
+
"shops",
|
|
377
|
+
"refund_reason"
|
|
378
|
+
].includes(k) ? `${k}.slug:${v}` : ["is_approved"].includes(k) ? formatBooleanSearchParam(k, v) : `${k}:${v}`
|
|
379
|
+
).join(";");
|
|
380
|
+
}
|
|
381
|
+
};
|
|
303
382
|
var AuthHttpClient = class {
|
|
304
383
|
static async get(url2, params) {
|
|
305
384
|
const response = await getAxiosInstance().get(url2, { params });
|
|
@@ -621,9 +700,9 @@ init_auth_utils();
|
|
|
621
700
|
|
|
622
701
|
// src/breadcrumb/url.ts
|
|
623
702
|
var useUpdateLink = () => {
|
|
624
|
-
const
|
|
625
|
-
|
|
626
|
-
|
|
703
|
+
const updateLink = async (props, displayName = "prm") => {
|
|
704
|
+
const search = getParam("b");
|
|
705
|
+
const pathname = getPath();
|
|
627
706
|
let breadcrumbs = decodeToBase64(search) || [];
|
|
628
707
|
if (breadcrumbs.length < 1) {
|
|
629
708
|
const routeMenu = getRouteMenu(pathname);
|
|
@@ -635,14 +714,17 @@ var useUpdateLink = () => {
|
|
|
635
714
|
];
|
|
636
715
|
}
|
|
637
716
|
const lastBreadcrumb = breadcrumbs[breadcrumbs.length - 1];
|
|
717
|
+
let udatedBreadcrumb = null;
|
|
638
718
|
if (displayName) {
|
|
639
|
-
|
|
640
|
-
|
|
719
|
+
const ex = await getDeep(lastBreadcrumb, displayName) || {};
|
|
720
|
+
udatedBreadcrumb = await setDeep(lastBreadcrumb, displayName, {
|
|
721
|
+
...ex,
|
|
641
722
|
...props
|
|
642
723
|
});
|
|
643
724
|
} else {
|
|
644
|
-
Object.assign(lastBreadcrumb, props);
|
|
725
|
+
udatedBreadcrumb = Object.assign(lastBreadcrumb, props);
|
|
645
726
|
}
|
|
727
|
+
breadcrumbs[breadcrumbs.length - 1] = udatedBreadcrumb;
|
|
646
728
|
const newBase64 = convertToBase64(breadcrumbs);
|
|
647
729
|
updateBParam(newBase64);
|
|
648
730
|
};
|
|
@@ -656,11 +738,13 @@ var useUpdateLink = () => {
|
|
|
656
738
|
curr = curr[keys[i]];
|
|
657
739
|
}
|
|
658
740
|
curr[keys[keys.length - 1]] = value;
|
|
741
|
+
return curr;
|
|
659
742
|
}
|
|
660
743
|
function getDeep(obj, path) {
|
|
661
744
|
return path.split(".").reduce((acc, key) => acc?.[key], obj);
|
|
662
745
|
}
|
|
663
746
|
const getLinkParams = (displayName = "prm") => {
|
|
747
|
+
const search = getParam("b");
|
|
664
748
|
let breadcrumbs = decodeToBase64(search) || [];
|
|
665
749
|
if (breadcrumbs.length < 1) return null;
|
|
666
750
|
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
|
@@ -681,6 +765,7 @@ var useUpdateLink = () => {
|
|
|
681
765
|
return output;
|
|
682
766
|
};
|
|
683
767
|
const filterParams = (displayName = "prm") => {
|
|
768
|
+
const search = getParam("b");
|
|
684
769
|
let breadcrumbs = decodeToBase64(search) || [];
|
|
685
770
|
if (breadcrumbs.length < 1) return null;
|
|
686
771
|
const lastItem = breadcrumbs[breadcrumbs.length - 1];
|
|
@@ -739,7 +824,7 @@ var Client = {
|
|
|
739
824
|
registerExistingUser: (data) => AuthHttpClient.post(API_ENDPOINTS.REGISTER_EXISTING_USER, data),
|
|
740
825
|
verifyEmailResend: (data) => AuthHttpClient.post(API_ENDPOINTS.REGISTER_EXISTING_USER, data),
|
|
741
826
|
resendEmail: (data) => AuthHttpClient.post(API_ENDPOINTS.RESEND_EMAIL, data),
|
|
742
|
-
logout: () =>
|
|
827
|
+
logout: () => HttpClient.post(API_ENDPOINTS.LOGOUT, null)
|
|
743
828
|
},
|
|
744
829
|
sso: {
|
|
745
830
|
getSsoDetails: () => AuthHttpClient.get(API_ENDPOINTS.SSO_DETAILS),
|
|
@@ -747,9 +832,9 @@ var Client = {
|
|
|
747
832
|
ssoCallback: (payload) => AuthHttpClient.get(generateApiUrl({ route: API_ENDPOINTS.SSO_CALLBACK, queryParams: payload?.queryParams }))
|
|
748
833
|
},
|
|
749
834
|
user: {
|
|
750
|
-
me: () =>
|
|
751
|
-
profile: (payload) =>
|
|
752
|
-
changePassword: (data) =>
|
|
835
|
+
me: () => HttpClient.get(generateApiUrl({ route: API_ENDPOINTS.ME })),
|
|
836
|
+
profile: (payload) => HttpClient.get(generateApiUrl({ route: API_ENDPOINTS.PROFILE, queryParams: payload })),
|
|
837
|
+
changePassword: (data) => HttpClient.post(API_ENDPOINTS.CHANGE_PASSWORD, data)
|
|
753
838
|
},
|
|
754
839
|
pipeline: {
|
|
755
840
|
list: (payload = null, param = null) => {
|
|
@@ -768,7 +853,7 @@ var Client = {
|
|
|
768
853
|
apiParams.isPrimaryCompany = param?.isPrimaryCompany;
|
|
769
854
|
apiParams.cache = payload?.sync ? false : true;
|
|
770
855
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.PIPELINES, params, queryParams: apiParams });
|
|
771
|
-
return
|
|
856
|
+
return HttpClient.get(apiUrl);
|
|
772
857
|
}
|
|
773
858
|
},
|
|
774
859
|
stage: {
|
|
@@ -781,11 +866,11 @@ var Client = {
|
|
|
781
866
|
pipelineId: props?.params?.pipelineId
|
|
782
867
|
};
|
|
783
868
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.STAGES, params });
|
|
784
|
-
return
|
|
869
|
+
return HttpClient.get(apiUrl);
|
|
785
870
|
}
|
|
786
871
|
},
|
|
787
872
|
object: {
|
|
788
|
-
list: (payload = null, param = null) => {
|
|
873
|
+
list: async (payload = null, param = null) => {
|
|
789
874
|
const params = { hubspotObjectTypeId: payload?.hubspotObjectTypeId };
|
|
790
875
|
const { updateLink, getLinkParams } = useUpdateLink();
|
|
791
876
|
const { getParamDetails: getParamDetails2 } = routeParam;
|
|
@@ -804,7 +889,7 @@ var Client = {
|
|
|
804
889
|
const fParams = getLinkParams();
|
|
805
890
|
param = { ...payload?.isFristTimeLoadData && fParams && !payload?.isHome ? fParams : param, ...paramsObject };
|
|
806
891
|
if (!payload?.isFristTimeLoadData || !fParams) {
|
|
807
|
-
updateLink({
|
|
892
|
+
await updateLink({
|
|
808
893
|
"sort": param?.sort,
|
|
809
894
|
"s": param?.search,
|
|
810
895
|
"fPn": param?.filterPropertyName,
|
|
@@ -820,13 +905,13 @@ var Client = {
|
|
|
820
905
|
}
|
|
821
906
|
if (mPipelines != void 0 && mPipelines?.length === 0 && !payload?.specPipeLine) {
|
|
822
907
|
param.filterValue = "";
|
|
823
|
-
updateLink({
|
|
908
|
+
await updateLink({
|
|
824
909
|
"fV": param?.filterValue
|
|
825
910
|
});
|
|
826
911
|
}
|
|
827
912
|
if (mPipelines != void 0 && mPipelines?.length === 1 && !payload?.specPipeLine && mSelectedPipeline != null) {
|
|
828
913
|
param.filterValue = mPipelines[0].pipelineId;
|
|
829
|
-
updateLink({
|
|
914
|
+
await updateLink({
|
|
830
915
|
"fV": param?.filterValue
|
|
831
916
|
});
|
|
832
917
|
}
|
|
@@ -841,38 +926,38 @@ var Client = {
|
|
|
841
926
|
}
|
|
842
927
|
param.parentAccessLabel = parentAccessLabel;
|
|
843
928
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS, params, queryParams: param });
|
|
844
|
-
return
|
|
929
|
+
return HttpClient.get(apiUrl);
|
|
845
930
|
},
|
|
846
931
|
form: (payload = null) => {
|
|
847
932
|
const params = { hubspotObjectTypeId: payload?.hubspotObjectTypeId };
|
|
848
933
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_CREATE, params, queryParams: payload?.params });
|
|
849
|
-
return
|
|
934
|
+
return HttpClient.get(apiUrl);
|
|
850
935
|
},
|
|
851
936
|
objectFormOptions: (payload = null) => {
|
|
852
937
|
const params = { hubspotObjectTypeId: payload?.hubspotObjectTypeId };
|
|
853
938
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_FORM_OPTIONS, params, queryParams: payload?.params });
|
|
854
|
-
return
|
|
939
|
+
return HttpClient.get(apiUrl);
|
|
855
940
|
},
|
|
856
941
|
create: (props = null) => {
|
|
857
942
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId };
|
|
858
943
|
const queryParams = props.params;
|
|
859
944
|
const payload = props.payload;
|
|
860
945
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_CREATE, params, queryParams });
|
|
861
|
-
return
|
|
946
|
+
return HttpClient.post(apiUrl, payload);
|
|
862
947
|
},
|
|
863
948
|
createExisting: (props = null) => {
|
|
864
949
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId };
|
|
865
950
|
const queryParams = props.params;
|
|
866
951
|
const payload = props.payload;
|
|
867
952
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_CREATE_EXISTING, params, queryParams });
|
|
868
|
-
return
|
|
953
|
+
return HttpClient.post(apiUrl, payload);
|
|
869
954
|
},
|
|
870
955
|
removeExisting: (props = null) => {
|
|
871
956
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId };
|
|
872
957
|
const queryParams = props.params;
|
|
873
958
|
const payload = props.payload;
|
|
874
959
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_REMOVE_EXISTING, params, queryParams });
|
|
875
|
-
return
|
|
960
|
+
return HttpClient.post(apiUrl, payload);
|
|
876
961
|
},
|
|
877
962
|
details: (props = null) => {
|
|
878
963
|
const { paramsObject: urlParam, parentAccessLabel } = getParamDetails("", true);
|
|
@@ -889,7 +974,7 @@ var Client = {
|
|
|
889
974
|
...urlParam
|
|
890
975
|
};
|
|
891
976
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_DETAILS, params, queryParams });
|
|
892
|
-
return
|
|
977
|
+
return HttpClient.get(apiUrl);
|
|
893
978
|
},
|
|
894
979
|
update: (props = null) => {
|
|
895
980
|
const portalId = getPortal()?.portalId;
|
|
@@ -901,7 +986,7 @@ var Client = {
|
|
|
901
986
|
};
|
|
902
987
|
const { paramsObject: queryParams } = getParamDetails();
|
|
903
988
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.OBJECTS_DETAILS_UPDATE, params, queryParams });
|
|
904
|
-
return
|
|
989
|
+
return HttpClient.put(apiUrl, props.payload);
|
|
905
990
|
}
|
|
906
991
|
},
|
|
907
992
|
note: {
|
|
@@ -914,14 +999,14 @@ var Client = {
|
|
|
914
999
|
id: props?.params?.id
|
|
915
1000
|
};
|
|
916
1001
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES, params, queryParams: props?.queryParams });
|
|
917
|
-
return
|
|
1002
|
+
return HttpClient.get(apiUrl);
|
|
918
1003
|
},
|
|
919
1004
|
create: (props = null) => {
|
|
920
1005
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
921
1006
|
const queryParams = props.queryParams;
|
|
922
1007
|
const payload = props.payload;
|
|
923
1008
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES_CREATE, params, queryParams });
|
|
924
|
-
return
|
|
1009
|
+
return HttpClient.post(apiUrl, payload);
|
|
925
1010
|
},
|
|
926
1011
|
update: (props = null) => {
|
|
927
1012
|
const portalId = getPortal()?.portalId;
|
|
@@ -934,7 +1019,7 @@ var Client = {
|
|
|
934
1019
|
};
|
|
935
1020
|
const { paramsObject: queryParams } = getParamDetails();
|
|
936
1021
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES_DETAILS_UPDATE, params, queryParams });
|
|
937
|
-
return
|
|
1022
|
+
return HttpClient.put(apiUrl, props.payload);
|
|
938
1023
|
},
|
|
939
1024
|
image: (props = null) => {
|
|
940
1025
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
@@ -942,7 +1027,7 @@ var Client = {
|
|
|
942
1027
|
const payload = props.payload;
|
|
943
1028
|
const axiosConfig = props.config || {};
|
|
944
1029
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES_IMAGE_UPLOAD, params, queryParams });
|
|
945
|
-
return
|
|
1030
|
+
return HttpClient.post(apiUrl, payload, {
|
|
946
1031
|
headers: {
|
|
947
1032
|
"Content-Type": "multipart/form-data"
|
|
948
1033
|
},
|
|
@@ -955,7 +1040,7 @@ var Client = {
|
|
|
955
1040
|
const payload = props.payload;
|
|
956
1041
|
const axiosConfig = props.config || {};
|
|
957
1042
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.NOTES_ATTACHMENT_UPLOAD, params, queryParams });
|
|
958
|
-
return
|
|
1043
|
+
return HttpClient.post(apiUrl, payload, {
|
|
959
1044
|
headers: {
|
|
960
1045
|
"Content-Type": "multipart/form-data"
|
|
961
1046
|
},
|
|
@@ -973,14 +1058,14 @@ var Client = {
|
|
|
973
1058
|
id: props?.params?.id
|
|
974
1059
|
};
|
|
975
1060
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS, params, queryParams: props?.queryParams });
|
|
976
|
-
return
|
|
1061
|
+
return HttpClient.get(apiUrl);
|
|
977
1062
|
},
|
|
978
1063
|
create: (props = null) => {
|
|
979
1064
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
980
1065
|
const queryParams = props.queryParams;
|
|
981
1066
|
const payload = props.payload;
|
|
982
1067
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS_CREATE, params, queryParams });
|
|
983
|
-
return
|
|
1068
|
+
return HttpClient.post(apiUrl, payload);
|
|
984
1069
|
},
|
|
985
1070
|
update: (props = null) => {
|
|
986
1071
|
const portalId = getPortal()?.portalId;
|
|
@@ -993,7 +1078,7 @@ var Client = {
|
|
|
993
1078
|
};
|
|
994
1079
|
const { paramsObject: queryParams } = getParamDetails();
|
|
995
1080
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS_DETAILS_UPDATE, params, queryParams });
|
|
996
|
-
return
|
|
1081
|
+
return HttpClient.put(apiUrl, props.payload);
|
|
997
1082
|
},
|
|
998
1083
|
image: (props = null) => {
|
|
999
1084
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
@@ -1001,7 +1086,7 @@ var Client = {
|
|
|
1001
1086
|
const payload = props.payload;
|
|
1002
1087
|
const axiosConfig = props.config || {};
|
|
1003
1088
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS_IMAGE_UPLOAD, params, queryParams });
|
|
1004
|
-
return
|
|
1089
|
+
return HttpClient.post(apiUrl, payload, {
|
|
1005
1090
|
headers: {
|
|
1006
1091
|
"Content-Type": "multipart/form-data"
|
|
1007
1092
|
},
|
|
@@ -1014,7 +1099,7 @@ var Client = {
|
|
|
1014
1099
|
const payload = props.payload;
|
|
1015
1100
|
const axiosConfig = props.config || {};
|
|
1016
1101
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.EMAILS_ATTACHMENT_UPLOAD, params, queryParams });
|
|
1017
|
-
return
|
|
1102
|
+
return HttpClient.post(apiUrl, payload, {
|
|
1018
1103
|
headers: {
|
|
1019
1104
|
"Content-Type": "multipart/form-data"
|
|
1020
1105
|
},
|
|
@@ -1032,7 +1117,7 @@ var Client = {
|
|
|
1032
1117
|
id: props?.params?.id
|
|
1033
1118
|
};
|
|
1034
1119
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.FILES, params, queryParams: props?.queryParams });
|
|
1035
|
-
return
|
|
1120
|
+
return HttpClient.get(apiUrl);
|
|
1036
1121
|
},
|
|
1037
1122
|
details: (props = null) => {
|
|
1038
1123
|
const portalId = getPortal()?.portalId;
|
|
@@ -1044,14 +1129,14 @@ var Client = {
|
|
|
1044
1129
|
rowId: props?.params?.rowId
|
|
1045
1130
|
};
|
|
1046
1131
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.FILE, params, queryParams: props?.queryParams });
|
|
1047
|
-
return
|
|
1132
|
+
return HttpClient.get(apiUrl);
|
|
1048
1133
|
},
|
|
1049
1134
|
addFolder: (props = null) => {
|
|
1050
1135
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
1051
1136
|
const queryParams = props.queryParams;
|
|
1052
1137
|
const payload = props.payload;
|
|
1053
1138
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.FILES_CREATE_FOLDER, params, queryParams });
|
|
1054
|
-
return
|
|
1139
|
+
return HttpClient.post(apiUrl, payload);
|
|
1055
1140
|
},
|
|
1056
1141
|
addFile: (props = null) => {
|
|
1057
1142
|
const params = { hubspotObjectTypeId: props?.hubspotObjectTypeId, ...props.params };
|
|
@@ -1059,7 +1144,7 @@ var Client = {
|
|
|
1059
1144
|
const payload = props.payload;
|
|
1060
1145
|
const axiosConfig = props.config || {};
|
|
1061
1146
|
const apiUrl = generateApiUrl({ route: API_ENDPOINTS.FILES_UPLOAD, params, queryParams });
|
|
1062
|
-
return
|
|
1147
|
+
return HttpClient.post(apiUrl, payload, {
|
|
1063
1148
|
headers: {
|
|
1064
1149
|
"Content-Type": "multipart/form-data"
|
|
1065
1150
|
},
|
|
@@ -1600,7 +1685,7 @@ function list(options) {
|
|
|
1600
1685
|
} = useTable();
|
|
1601
1686
|
const { mutate, isLoading } = createMutation(
|
|
1602
1687
|
async (payload) => {
|
|
1603
|
-
const param = getTableParam(payload?.companyAsMediator);
|
|
1688
|
+
const param = await getTableParam(payload?.companyAsMediator);
|
|
1604
1689
|
const response = await Client.pipeline.list(payload, param);
|
|
1605
1690
|
return response;
|
|
1606
1691
|
},
|
|
@@ -1636,7 +1721,7 @@ function list3(options) {
|
|
|
1636
1721
|
} = useTable();
|
|
1637
1722
|
const { mutate, isLoading } = createMutation(
|
|
1638
1723
|
async (payload) => {
|
|
1639
|
-
const param = getTableParam(payload?.companyAsMediator);
|
|
1724
|
+
const param = await getTableParam(payload?.companyAsMediator);
|
|
1640
1725
|
const response = await Client.object.list(payload, param);
|
|
1641
1726
|
return response;
|
|
1642
1727
|
},
|