@antscorp/antsomi-ui 1.3.6-beta.4 → 1.3.6-beta.40
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/es/components/atoms/Input/Input.d.ts +11 -17
- package/es/components/atoms/Input/Input.js +7 -11
- package/es/components/atoms/SelectAssociatedTag/constants.d.ts +1 -1
- package/es/components/atoms/SelectAssociatedTag/constants.js +4 -4
- package/es/components/atoms/Switch/Switch.js +2 -1
- package/es/components/icons/LazyIcon/LazyIcon.d.ts +3 -0
- package/es/components/icons/LazyIcon/LazyIcon.js +3 -0
- package/es/components/icons/TaskAltIcon.d.ts +3 -0
- package/es/components/icons/TaskAltIcon.js +7 -0
- package/es/components/icons/UnsubscribeIcon.d.ts +3 -0
- package/es/components/icons/UnsubscribeIcon.js +7 -0
- package/es/components/icons/UnsubscribersIcon.d.ts +3 -0
- package/es/components/icons/UnsubscribersIcon.js +7 -0
- package/es/components/icons/index.d.ts +3 -0
- package/es/components/icons/index.js +3 -0
- package/es/components/molecules/CodeStructure/CodeStructure.d.ts +23 -2
- package/es/components/molecules/CodeStructure/CodeStructure.js +136 -26
- package/es/components/molecules/CodeStructure/constants.js +2 -2
- package/es/components/molecules/CodeStructure/styled.d.ts +3 -0
- package/es/components/molecules/CodeStructure/styled.js +6 -0
- package/es/components/molecules/CodeStructure/type.d.ts +2 -2
- package/es/components/molecules/CodeStructure/type.js +2 -2
- package/es/components/molecules/CodeStructure/utils.d.ts +12 -2
- package/es/components/molecules/CodeStructure/utils.js +5 -3
- package/es/components/molecules/DrawerDetail/DrawerDetail.js +10 -5
- package/es/components/molecules/DrawerDetail/types.d.ts +1 -0
- package/es/components/molecules/Dropdown/style.scss +6 -4
- package/es/components/molecules/EditingListV2/EditingList.js +5 -2
- package/es/components/molecules/EditingListV2/components/List/List.js +16 -6
- package/es/components/molecules/EditingListV2/components/Loadable.d.ts +0 -6
- package/es/components/molecules/EditingListV2/components/Loadable.js +0 -1
- package/es/components/molecules/EditingListV2/components/Popover/Popover.js +6 -12
- package/es/components/molecules/EditingListV2/components/index.d.ts +0 -3
- package/es/components/molecules/EditingListV2/components/index.js +0 -3
- package/es/components/molecules/EditingListV2/types.d.ts +2 -0
- package/es/components/molecules/InputSelectAttribute/index.js +5 -2
- package/es/components/molecules/InputSelectAttribute/styled.js +7 -2
- package/es/components/molecules/SearchPopover/SearchPopover.d.ts +0 -1
- package/es/components/molecules/SearchPopover/SearchPopover.js +1 -2
- package/es/components/molecules/SearchPopover/components/PopoverAddField/PopoverAddField.js +2 -2
- package/es/components/molecules/SearchPopover/components/PopoverSelect/PopoverSelect.js +2 -2
- package/es/components/molecules/SearchPopover/types.d.ts +1 -0
- package/es/components/molecules/TagifyInput/TagifyInput.js +27 -10
- package/es/components/molecules/TagifyInput/constants.d.ts +2 -1
- package/es/components/molecules/TagifyInput/constants.js +2 -1
- package/es/components/molecules/TagifyInput/utils.js +5 -2
- package/es/components/molecules/TagifyInput/utils.style.js +3 -2
- package/es/components/molecules/UploadImage/index.d.ts +102 -3
- package/es/components/molecules/UploadImage/index.js +48 -110
- package/es/components/molecules/UploadImage/styled.d.ts +2 -1
- package/es/components/molecules/VirtualizedMenu/types.d.ts +1 -0
- package/es/components/organism/TicketEditorV2/Content.d.ts +27 -0
- package/es/components/organism/TicketEditorV2/Content.js +296 -0
- package/es/components/organism/TicketEditorV2/Service.d.ts +49 -0
- package/es/components/organism/TicketEditorV2/Service.js +58 -0
- package/es/components/organism/TicketEditorV2/TicketEditorV2.d.ts +20 -0
- package/es/components/organism/TicketEditorV2/TicketEditorV2.js +124 -0
- package/es/components/organism/TicketEditorV2/components/DropdownComponent.d.ts +9 -0
- package/es/components/organism/TicketEditorV2/components/DropdownComponent.js +45 -0
- package/es/components/organism/TicketEditorV2/components/Message.d.ts +2 -0
- package/es/components/organism/TicketEditorV2/components/Message.js +31 -0
- package/es/components/organism/TicketEditorV2/components/MessageComponent.d.ts +10 -0
- package/es/components/organism/TicketEditorV2/components/MessageComponent.js +64 -0
- package/es/components/organism/TicketEditorV2/components/icons/AddTicketIcon.d.ts +2 -0
- package/es/components/organism/TicketEditorV2/components/icons/AddTicketIcon.js +5 -0
- package/es/components/organism/TicketEditorV2/components/icons/TicketIcon.d.ts +2 -0
- package/es/components/organism/TicketEditorV2/components/icons/TicketIcon.js +5 -0
- package/es/components/organism/TicketEditorV2/constant.d.ts +17 -0
- package/es/components/organism/TicketEditorV2/constant.js +17 -0
- package/es/components/organism/TicketEditorV2/constants/index.d.ts +1 -0
- package/es/components/organism/TicketEditorV2/constants/index.js +1 -0
- package/es/components/organism/TicketEditorV2/constants/queryKeys.d.ts +5 -0
- package/es/components/organism/TicketEditorV2/constants/queryKeys.js +5 -0
- package/es/components/organism/TicketEditorV2/index.d.ts +1 -0
- package/es/components/organism/TicketEditorV2/index.js +1 -0
- package/es/components/organism/TicketEditorV2/queries/index.d.ts +3 -0
- package/es/components/organism/TicketEditorV2/queries/index.js +3 -0
- package/es/components/organism/TicketEditorV2/queries/useGetDetailTicket.d.ts +12 -0
- package/es/components/organism/TicketEditorV2/queries/useGetDetailTicket.js +14 -0
- package/es/components/organism/TicketEditorV2/queries/useGetListComments.d.ts +13 -0
- package/es/components/organism/TicketEditorV2/queries/useGetListComments.js +18 -0
- package/es/components/organism/TicketEditorV2/queries/useGetListUser.d.ts +11 -0
- package/es/components/organism/TicketEditorV2/queries/useGetListUser.js +14 -0
- package/es/components/organism/TicketEditorV2/styled.d.ts +54 -0
- package/es/components/organism/TicketEditorV2/styled.js +871 -0
- package/es/components/organism/TicketEditorV2/util.d.ts +46 -0
- package/es/components/organism/TicketEditorV2/util.js +408 -0
- package/es/components/organism/index.d.ts +1 -0
- package/es/components/organism/index.js +1 -0
- package/es/constants/queries.d.ts +1 -0
- package/es/constants/queries.js +1 -0
- package/es/locales/en/translation.json +2 -1
- package/es/locales/i18n.d.ts +2 -0
- package/es/locales/vi/translation.json +2 -1
- package/es/queries/ThirdParty/index.d.ts +1 -0
- package/es/queries/ThirdParty/index.js +1 -0
- package/es/queries/ThirdParty/useStoreSavedMedia.d.ts +1 -0
- package/es/queries/ThirdParty/useStoreSavedMedia.js +12 -0
- package/es/queries/index.d.ts +0 -1
- package/es/queries/index.js +0 -1
- package/es/services/MediaTemplateDesign/UploadFile/index.d.ts +1 -1
- package/es/services/MediaTemplateDesign/UploadFile/index.js +2 -2
- package/package.json +2 -2
- package/es/components/molecules/EditingListV2/components/Action/Action.d.ts +0 -6
- package/es/components/molecules/EditingListV2/components/Action/Action.js +0 -10
- package/es/components/molecules/EditingListV2/components/Action/index.d.ts +0 -1
- package/es/components/molecules/EditingListV2/components/Action/index.js +0 -1
- package/es/components/molecules/EditingListV2/components/Search/Search.d.ts +0 -4
- package/es/components/molecules/EditingListV2/components/Search/Search.js +0 -8
- package/es/components/molecules/EditingListV2/components/Search/index.d.ts +0 -1
- package/es/components/molecules/EditingListV2/components/Search/index.js +0 -1
- package/es/components/molecules/EditingListV2/components/Title/Title.d.ts +0 -9
- package/es/components/molecules/EditingListV2/components/Title/Title.js +0 -16
- package/es/components/molecules/EditingListV2/components/Title/index.d.ts +0 -1
- package/es/components/molecules/EditingListV2/components/Title/index.js +0 -1
- package/es/components/molecules/EditingListV2/styled.d.ts +0 -5
- package/es/components/molecules/EditingListV2/styled.js +0 -38
- package/es/components/molecules/SearchPopover/styles.scss +0 -7
- package/es/queries/Media/index.d.ts +0 -1
- package/es/queries/Media/index.js +0 -1
- package/es/queries/Media/useGetListingSavedMedia.d.ts +0 -12
- package/es/queries/Media/useGetListingSavedMedia.js +0 -15
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare function getObjectPropSafely(fn: any, defaultValue?: string): any;
|
|
2
|
+
export declare function isNumeric(num: any): boolean;
|
|
3
|
+
export declare function getUserLocaleLanguage(config: any): any;
|
|
4
|
+
export declare function callApiWithAuth(endpoint: any, method: string | undefined, body: any, domain?: string, config?: {}, token?: string, userId?: string, isTicket?: boolean, type?: string, isAccount?: boolean, isPermission?: boolean, others?: {}): Promise<import("axios").AxiosResponse<any, any>>;
|
|
5
|
+
export declare function isUrlEmbedded(): boolean;
|
|
6
|
+
export declare const safeParse: (val: any, defaultVal: any) => any;
|
|
7
|
+
export declare const safeParseInt: (val: any, defaultVal: any) => any;
|
|
8
|
+
export declare function getPortalId(config: any): any;
|
|
9
|
+
export declare function getWindowParam(name: any, config: any): any;
|
|
10
|
+
export declare function getSessionStorage(key: any, config?: {}): any;
|
|
11
|
+
export declare function getAppParamURL(pathname: any, forceVersionV2: boolean | undefined, config: any): {
|
|
12
|
+
portalId: number;
|
|
13
|
+
accessUserId: number;
|
|
14
|
+
};
|
|
15
|
+
export declare function urlHasQueryString(url: any): boolean;
|
|
16
|
+
export declare function getCookie(name: any): any;
|
|
17
|
+
export declare function getAppSession(key: any, config: any): any;
|
|
18
|
+
export declare function getEntriesV2(res: any, def: any): {
|
|
19
|
+
code: number;
|
|
20
|
+
codeMessage: any;
|
|
21
|
+
messageAPI: any;
|
|
22
|
+
data: any;
|
|
23
|
+
} | {
|
|
24
|
+
code: number;
|
|
25
|
+
codeMessage: string;
|
|
26
|
+
data: any;
|
|
27
|
+
messageAPI?: undefined;
|
|
28
|
+
};
|
|
29
|
+
export declare const formatAccountId: (data: any) => any;
|
|
30
|
+
export declare const formatParams: (data: any) => {
|
|
31
|
+
title: string;
|
|
32
|
+
ownerId: undefined;
|
|
33
|
+
followers: never[];
|
|
34
|
+
referenceUrl: string;
|
|
35
|
+
priority: string;
|
|
36
|
+
feature: string;
|
|
37
|
+
ticketType: string;
|
|
38
|
+
category: string;
|
|
39
|
+
message: string;
|
|
40
|
+
attachments: never[];
|
|
41
|
+
};
|
|
42
|
+
export declare const formatDatarender: (data: any, listSelect: any, listAccount: any) => any;
|
|
43
|
+
export declare const handleValidateContent: (stringHTML: any) => string | undefined;
|
|
44
|
+
export declare const compareArrays: (a: any, b: any) => boolean;
|
|
45
|
+
export declare const convertDateToTimestamp: (time: any, timeZone: any) => string;
|
|
46
|
+
export declare const postCustomEvent: (type: any, data: any) => void;
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { PORTAL_KEYS } from './constant';
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
import timezone from 'dayjs/plugin/timezone';
|
|
5
|
+
import utc from 'dayjs/plugin/utc';
|
|
6
|
+
dayjs.extend(utc);
|
|
7
|
+
dayjs.extend(timezone);
|
|
8
|
+
export function getObjectPropSafely(fn, defaultValue = '') {
|
|
9
|
+
try {
|
|
10
|
+
return fn();
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
return defaultValue;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function isNumeric(num) {
|
|
17
|
+
return !isNaN(num) && num !== '';
|
|
18
|
+
}
|
|
19
|
+
export function getUserLocaleLanguage(config) {
|
|
20
|
+
return safeParse(getWindowParam(PORTAL_KEYS.USER_LANGUAGE, config), 'en');
|
|
21
|
+
}
|
|
22
|
+
export function callApiWithAuth(endpoint, method = 'GET', body, domain = '', config = {}, token = '', userId = '', isTicket = false, type = '', isAccount = false, isPermission = false, others = {}) {
|
|
23
|
+
const apiPid = getPortalId(config);
|
|
24
|
+
const apiToken = token;
|
|
25
|
+
// const _user_id = userId;
|
|
26
|
+
let ownerId = userId;
|
|
27
|
+
// get from other params
|
|
28
|
+
if (isTicket) {
|
|
29
|
+
const params = {
|
|
30
|
+
_token: apiToken,
|
|
31
|
+
_account_id: ownerId,
|
|
32
|
+
_user_id: userId,
|
|
33
|
+
};
|
|
34
|
+
// endpoint += `${apiToken}&_account_id=${_owner_id}&_user_id=${_user_id}`;
|
|
35
|
+
if (type) {
|
|
36
|
+
params.type = type;
|
|
37
|
+
// endpoint += `&type=${type}`
|
|
38
|
+
}
|
|
39
|
+
return axios({
|
|
40
|
+
method,
|
|
41
|
+
url: `${domain}/${endpoint}`,
|
|
42
|
+
params,
|
|
43
|
+
data: body,
|
|
44
|
+
});
|
|
45
|
+
// .catch(err => serviceUnavailbale);
|
|
46
|
+
}
|
|
47
|
+
if (isAccount) {
|
|
48
|
+
const params = {
|
|
49
|
+
_token: apiToken,
|
|
50
|
+
_account_id: ownerId,
|
|
51
|
+
_user_id: userId,
|
|
52
|
+
account_type: type,
|
|
53
|
+
};
|
|
54
|
+
return axios({
|
|
55
|
+
method,
|
|
56
|
+
url: `${domain}/${endpoint}`,
|
|
57
|
+
params,
|
|
58
|
+
data: body,
|
|
59
|
+
});
|
|
60
|
+
// .catch(err => serviceUnavailbale);
|
|
61
|
+
}
|
|
62
|
+
if (isPermission) {
|
|
63
|
+
const params = {
|
|
64
|
+
type,
|
|
65
|
+
appCode: body.appCode,
|
|
66
|
+
menuCode: body.menuCode,
|
|
67
|
+
fullParent: body.fullParent,
|
|
68
|
+
_token: apiToken,
|
|
69
|
+
_user_id: body.ownerId || userId,
|
|
70
|
+
_account_id: userId,
|
|
71
|
+
};
|
|
72
|
+
return axios({
|
|
73
|
+
method,
|
|
74
|
+
url: `${domain}/${endpoint}`,
|
|
75
|
+
params,
|
|
76
|
+
data: body,
|
|
77
|
+
});
|
|
78
|
+
// .catch(err => serviceUnavailbale);
|
|
79
|
+
}
|
|
80
|
+
if (Object.prototype.hasOwnProperty.call(others, '_owner_id')) {
|
|
81
|
+
ownerId = safeParse(others['_owner_id'], '');
|
|
82
|
+
}
|
|
83
|
+
const isJourney = window.location.href.includes('marketing-hub/journeys');
|
|
84
|
+
if (ownerId === 'all' && !isJourney) {
|
|
85
|
+
ownerId = userId;
|
|
86
|
+
}
|
|
87
|
+
const headers = {
|
|
88
|
+
'Content-Type': 'application/json; charset=utf-8',
|
|
89
|
+
token: apiToken,
|
|
90
|
+
};
|
|
91
|
+
if (urlHasQueryString(endpoint)) {
|
|
92
|
+
endpoint += `&portalId=${apiPid}&languageCode=${getUserLocaleLanguage(config)}&_user_id=${userId}`;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
endpoint += `?portalId=${apiPid}&languageCode=${getUserLocaleLanguage(config)}&_user_id=${userId}`;
|
|
96
|
+
}
|
|
97
|
+
if (isNumeric(ownerId)) {
|
|
98
|
+
endpoint += `&_owner_id=${ownerId}`;
|
|
99
|
+
}
|
|
100
|
+
if (endpoint.includes('journey-histories')) {
|
|
101
|
+
endpoint += `&token=${apiToken}`;
|
|
102
|
+
}
|
|
103
|
+
return axios({
|
|
104
|
+
method,
|
|
105
|
+
url: `${domain}/${endpoint}`,
|
|
106
|
+
data: body,
|
|
107
|
+
headers,
|
|
108
|
+
});
|
|
109
|
+
// .catch(
|
|
110
|
+
// err =>
|
|
111
|
+
// serviceUnavailbale,
|
|
112
|
+
// );
|
|
113
|
+
}
|
|
114
|
+
export function isUrlEmbedded() {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
export const safeParse = (val, defaultVal) => {
|
|
118
|
+
if (typeof val === 'undefined' ||
|
|
119
|
+
val === 'undefined' ||
|
|
120
|
+
val === null ||
|
|
121
|
+
val.length === 0 ||
|
|
122
|
+
val === 'NaN') {
|
|
123
|
+
return defaultVal;
|
|
124
|
+
}
|
|
125
|
+
return val;
|
|
126
|
+
};
|
|
127
|
+
export const safeParseInt = (val, defaultVal) => {
|
|
128
|
+
let tempt = safeParse(val, 0);
|
|
129
|
+
if (tempt !== 0) {
|
|
130
|
+
tempt = parseInt(tempt);
|
|
131
|
+
if (Number.isNaN(tempt)) {
|
|
132
|
+
return defaultVal;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return tempt;
|
|
136
|
+
};
|
|
137
|
+
export function getPortalId(config) {
|
|
138
|
+
const portalId = safeParse(getSessionStorage('api_pid', config), 0);
|
|
139
|
+
if (portalId === 0) {
|
|
140
|
+
return getAppParamURL(window.location.pathname, false, config).portalId;
|
|
141
|
+
}
|
|
142
|
+
return portalId;
|
|
143
|
+
// return safeParse(getAppSession('api_pid'), 0);
|
|
144
|
+
}
|
|
145
|
+
export function getWindowParam(name, config) {
|
|
146
|
+
return config[name];
|
|
147
|
+
}
|
|
148
|
+
export function getSessionStorage(key, config = {}) {
|
|
149
|
+
if (isUrlEmbedded()) {
|
|
150
|
+
return getDataWithEmbeddedPublic(key, config);
|
|
151
|
+
}
|
|
152
|
+
const tempt = getWindowParam(key, config);
|
|
153
|
+
if (tempt !== undefined) {
|
|
154
|
+
return tempt;
|
|
155
|
+
}
|
|
156
|
+
if (typeof Storage !== 'undefined') {
|
|
157
|
+
return sessionStorage.getItem(key);
|
|
158
|
+
}
|
|
159
|
+
return '';
|
|
160
|
+
}
|
|
161
|
+
export function getAppParamURL(pathname, forceVersionV2 = false, config) {
|
|
162
|
+
const output = {
|
|
163
|
+
portalId: 0,
|
|
164
|
+
accessUserId: 0,
|
|
165
|
+
};
|
|
166
|
+
const isV3 = pathname.indexOf('marketing-hub') > -1;
|
|
167
|
+
let portalId = 0;
|
|
168
|
+
let accessUserId = 0;
|
|
169
|
+
if (forceVersionV2 || !isV3) {
|
|
170
|
+
try {
|
|
171
|
+
// const arr = pathname.split('/');
|
|
172
|
+
const arr = pathname.split('v2');
|
|
173
|
+
if (arr.length >= 2) {
|
|
174
|
+
const arrTmp = arr[1].split('/');
|
|
175
|
+
// console.log('arrTmp', arrTmp);
|
|
176
|
+
if (arrTmp.length >= 2) {
|
|
177
|
+
// console.log('arr', arrTmp);
|
|
178
|
+
portalId = safeParseInt(arrTmp[2], 0);
|
|
179
|
+
if (portalId <= 0) {
|
|
180
|
+
portalId = safeParseInt(arrTmp[1], 0);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (portalId <= 0) {
|
|
185
|
+
portalId = safeParseInt(getAppSession('api_pid', config), 0);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
catch (e) {
|
|
189
|
+
// console.error(e);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// V3 thêm param userid trên URL
|
|
193
|
+
// http://localhost:5000/gen2/33167/marketing-hub/journeys/3/create
|
|
194
|
+
// => http://localhost:5000/gen2/33167/1600082431/marketing-hub/journeys/3/create
|
|
195
|
+
if (isV3) {
|
|
196
|
+
try {
|
|
197
|
+
// const arr = pathname.split('/');
|
|
198
|
+
const arr = pathname.split('v2');
|
|
199
|
+
if (arr.length >= 2) {
|
|
200
|
+
const arrTmp = arr[1].split('/');
|
|
201
|
+
if (arrTmp.length >= 2) {
|
|
202
|
+
portalId = safeParseInt(arrTmp[1], 0);
|
|
203
|
+
accessUserId = safeParseInt(arrTmp[2], 0);
|
|
204
|
+
// if (portalId <= 0) {
|
|
205
|
+
// portalId = safeParseInt(arrTmp[1], 0);
|
|
206
|
+
// }
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (portalId <= 0) {
|
|
210
|
+
portalId = safeParseInt(getAppSession('api_pid', config), 0);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
catch (e) {
|
|
214
|
+
// console.error(e);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
output.portalId = portalId;
|
|
218
|
+
output.accessUserId = accessUserId;
|
|
219
|
+
return output;
|
|
220
|
+
}
|
|
221
|
+
export function urlHasQueryString(url) {
|
|
222
|
+
const arr = url.split('?');
|
|
223
|
+
if (arr.length > 1 && arr[1] !== '') {
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
function getDataWithEmbeddedPublic(key, config = {}) {
|
|
229
|
+
const data = safeParse(config.embeddedData, {});
|
|
230
|
+
return data[key];
|
|
231
|
+
}
|
|
232
|
+
export function getCookie(name) {
|
|
233
|
+
if (isUrlEmbedded()) {
|
|
234
|
+
return getDataWithEmbeddedPublic(name);
|
|
235
|
+
}
|
|
236
|
+
const cname = `${name}=`;
|
|
237
|
+
const decodedCookie = decodeURIComponent(document.cookie);
|
|
238
|
+
const ca = decodedCookie.split(';');
|
|
239
|
+
for (let i = 0; i < ca.length; i += 1) {
|
|
240
|
+
let c = ca[i];
|
|
241
|
+
while (c.charAt(0) === ' ') {
|
|
242
|
+
c = c.substring(1);
|
|
243
|
+
}
|
|
244
|
+
if (c.indexOf(cname) === 0) {
|
|
245
|
+
return c.substring(cname.length, c.length);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return '';
|
|
249
|
+
}
|
|
250
|
+
export function getAppSession(key, config) {
|
|
251
|
+
if (isUrlEmbedded()) {
|
|
252
|
+
return getDataWithEmbeddedPublic(key, config);
|
|
253
|
+
}
|
|
254
|
+
let tempt = safeParse(getSessionStorage(key.config), '');
|
|
255
|
+
if (tempt === '') {
|
|
256
|
+
// console.error('------CAN"T NOT GET APP SESSION');
|
|
257
|
+
tempt = getCookie(key);
|
|
258
|
+
}
|
|
259
|
+
return window.decodeURIComponent(tempt);
|
|
260
|
+
}
|
|
261
|
+
export function getEntriesV2(res, def) {
|
|
262
|
+
if (typeof res !== 'undefined') {
|
|
263
|
+
const code = parseInt(safeParse(res.data.code, 500));
|
|
264
|
+
const message = safeParse(res.data.message, '');
|
|
265
|
+
// validateRedirect(code, message);
|
|
266
|
+
let codeMessage = safeParse(res.data.codeMessage, 'INTERNAL_SERVER_ERROR');
|
|
267
|
+
let entries = def;
|
|
268
|
+
if (code === 200) {
|
|
269
|
+
const data = safeParse(res.data.data, {});
|
|
270
|
+
entries = safeParse(data.entries, []);
|
|
271
|
+
codeMessage = 'SUCCESS';
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
const data = safeParse(res.data.data, {});
|
|
275
|
+
entries = safeParse(data.entries, def);
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
code,
|
|
279
|
+
codeMessage,
|
|
280
|
+
// message: getMessageByCode(codeMessage),
|
|
281
|
+
messageAPI: message,
|
|
282
|
+
data: entries,
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
return {
|
|
286
|
+
code: 500,
|
|
287
|
+
codeMessage: 'INTERNAL_SERVER_ERROR',
|
|
288
|
+
// message: getMessageByCode('INTERNAL_SERVER_ERROR'),
|
|
289
|
+
data: def,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
export const formatAccountId = data => {
|
|
293
|
+
const results = data?.map(item => item?.userId);
|
|
294
|
+
return results;
|
|
295
|
+
};
|
|
296
|
+
export const formatParams = data => {
|
|
297
|
+
const params = {
|
|
298
|
+
title: '',
|
|
299
|
+
ownerId: undefined,
|
|
300
|
+
followers: [],
|
|
301
|
+
referenceUrl: '',
|
|
302
|
+
priority: '',
|
|
303
|
+
feature: '',
|
|
304
|
+
ticketType: '',
|
|
305
|
+
category: '',
|
|
306
|
+
message: '',
|
|
307
|
+
attachments: [],
|
|
308
|
+
};
|
|
309
|
+
if (data?.ownerId) {
|
|
310
|
+
params.ownerId = data?.ownerId[0]?.userId;
|
|
311
|
+
}
|
|
312
|
+
if (data?.title) {
|
|
313
|
+
params.title = data?.title;
|
|
314
|
+
}
|
|
315
|
+
if (data?.followers?.length) {
|
|
316
|
+
params.followers = formatAccountId(data?.followers);
|
|
317
|
+
}
|
|
318
|
+
if (data?.referenceUrl) {
|
|
319
|
+
params.referenceUrl = data?.referenceUrl;
|
|
320
|
+
}
|
|
321
|
+
if (Object.keys(data?.priority).length) {
|
|
322
|
+
params.priority = data?.priority?.value;
|
|
323
|
+
}
|
|
324
|
+
if (Object.keys(data?.feature).length) {
|
|
325
|
+
params.feature = data?.feature?.value;
|
|
326
|
+
}
|
|
327
|
+
if (Object.keys(data?.ticketType).length) {
|
|
328
|
+
params.ticketType = data?.ticketType?.value;
|
|
329
|
+
}
|
|
330
|
+
if (Object.keys(data?.category).length) {
|
|
331
|
+
params.category = data?.category?.value;
|
|
332
|
+
}
|
|
333
|
+
if (data?.message?.length) {
|
|
334
|
+
params.message = data?.message;
|
|
335
|
+
}
|
|
336
|
+
if (data?.files?.length) {
|
|
337
|
+
params.attachments = data?.files?.map(file => file?.token);
|
|
338
|
+
}
|
|
339
|
+
return params;
|
|
340
|
+
};
|
|
341
|
+
export const formatDatarender = (data, listSelect, listAccount) => {
|
|
342
|
+
if (data?.ownerId) {
|
|
343
|
+
data.ownerId = listAccount?.filter(acc => acc.userId === data?.ownerId);
|
|
344
|
+
}
|
|
345
|
+
if (data?.followers?.length) {
|
|
346
|
+
const newFollowers = [];
|
|
347
|
+
data.followers?.forEach(fol => {
|
|
348
|
+
listAccount.forEach(acc => {
|
|
349
|
+
if (fol === acc.userId) {
|
|
350
|
+
newFollowers.push(acc);
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
data.followers = newFollowers;
|
|
355
|
+
}
|
|
356
|
+
if (data?.priority) {
|
|
357
|
+
const newPriority = listSelect
|
|
358
|
+
?.filter(sel => sel.value === 'priority')[0]
|
|
359
|
+
?.field_options?.filter(opt => opt.value === data.priority);
|
|
360
|
+
[data.priority] = newPriority;
|
|
361
|
+
}
|
|
362
|
+
if (data?.feature) {
|
|
363
|
+
const newFeature = listSelect
|
|
364
|
+
?.filter(sel => sel.value === 'feature')[0]
|
|
365
|
+
?.field_options?.filter(opt => opt.value === data.feature);
|
|
366
|
+
[data.feature] = newFeature;
|
|
367
|
+
}
|
|
368
|
+
if (data?.ticketType) {
|
|
369
|
+
const newTicket = listSelect
|
|
370
|
+
?.filter(sel => sel.value === 'ticketType')[0]
|
|
371
|
+
?.field_options?.filter(opt => opt.value === data.ticketType);
|
|
372
|
+
[data.ticketType] = newTicket;
|
|
373
|
+
}
|
|
374
|
+
if (data?.category) {
|
|
375
|
+
const newCategory = listSelect
|
|
376
|
+
?.filter(sel => sel.value === 'category')[0]
|
|
377
|
+
?.field_options?.filter(opt => opt.value === data.category);
|
|
378
|
+
[data.category] = newCategory;
|
|
379
|
+
}
|
|
380
|
+
// if(data?.files?.length) {
|
|
381
|
+
// params.files = data?.files
|
|
382
|
+
// }
|
|
383
|
+
return data;
|
|
384
|
+
};
|
|
385
|
+
export const handleValidateContent = stringHTML => {
|
|
386
|
+
if (stringHTML) {
|
|
387
|
+
const elment = document.createElement('div');
|
|
388
|
+
elment.innerHTML = stringHTML;
|
|
389
|
+
return elment?.firstChild?.innerHTML?.replace(/ /g, '')?.trim();
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
export const compareArrays = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
393
|
+
export const convertDateToTimestamp = (time, timeZone) => dayjs(time).tz(timeZone).format('MMM DD YYYY hh:mm');
|
|
394
|
+
export const postCustomEvent = (type, data) => {
|
|
395
|
+
if (!type) {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
try {
|
|
399
|
+
document.dispatchEvent(new CustomEvent(type, {
|
|
400
|
+
detail: data,
|
|
401
|
+
bubbles: true,
|
|
402
|
+
cancelable: true,
|
|
403
|
+
composed: false,
|
|
404
|
+
// data,
|
|
405
|
+
}));
|
|
406
|
+
}
|
|
407
|
+
catch (error) { }
|
|
408
|
+
};
|
|
@@ -9,6 +9,7 @@ export { default as ContentSources } from './ContentSources';
|
|
|
9
9
|
export * from './ContentSources/provider';
|
|
10
10
|
export { LeftMenu, type LeftMenuProps } from './LeftMenu';
|
|
11
11
|
export { TicketEditor } from './TicketEditor';
|
|
12
|
+
export { TicketEditorV2 } from './TicketEditorV2';
|
|
12
13
|
export * from './DataTable';
|
|
13
14
|
export * from './ModifyColumnModal';
|
|
14
15
|
export { AccountProfile, type AccountSettingProps } from './AccountProfile';
|
|
@@ -9,6 +9,7 @@ export { default as ContentSources } from './ContentSources';
|
|
|
9
9
|
export * from './ContentSources/provider';
|
|
10
10
|
export { LeftMenu } from './LeftMenu';
|
|
11
11
|
export { TicketEditor } from './TicketEditor';
|
|
12
|
+
export { TicketEditorV2 } from './TicketEditorV2';
|
|
12
13
|
export * from './DataTable';
|
|
13
14
|
export * from './ModifyColumnModal';
|
|
14
15
|
export { AccountProfile } from './AccountProfile';
|
|
@@ -19,6 +19,7 @@ export declare const QUERY_KEYS: {
|
|
|
19
19
|
GET_SAVE_AS_GALLERY_PERMISSION_EMAILS: string;
|
|
20
20
|
GET_LISTING_SAVED_MEDIA: string;
|
|
21
21
|
GET_LIST_FALLBACK_BO: string;
|
|
22
|
+
GET_LIST_SAVED_MEDIA: string;
|
|
22
23
|
GET_DASHBOARD: string;
|
|
23
24
|
GET_LIST_MENU: string;
|
|
24
25
|
GET_LIST_MENU_PERMISSION: string;
|
package/es/constants/queries.js
CHANGED
|
@@ -28,6 +28,7 @@ export const QUERY_KEYS = {
|
|
|
28
28
|
GET_LISTING_SAVED_MEDIA: 'GET_LISTING_SAVED_MEDIA',
|
|
29
29
|
// THIRD PARTY
|
|
30
30
|
GET_LIST_FALLBACK_BO: 'GET_LIST_FALLBACK_BO',
|
|
31
|
+
GET_LIST_SAVED_MEDIA: 'GET_LIST_SAVED_MEDIA',
|
|
31
32
|
// Left menu
|
|
32
33
|
GET_DASHBOARD: 'GET_DASHBOARD',
|
|
33
34
|
GET_LIST_MENU: 'GET_LIST_MENU',
|
package/es/locales/i18n.d.ts
CHANGED
|
@@ -3409,6 +3409,7 @@ export declare const translationsJson: {
|
|
|
3409
3409
|
_builtIn: string;
|
|
3410
3410
|
_standard: string;
|
|
3411
3411
|
_ipRestriction: string;
|
|
3412
|
+
_unsubscribers: string;
|
|
3412
3413
|
};
|
|
3413
3414
|
};
|
|
3414
3415
|
layout: {
|
|
@@ -6392,6 +6393,7 @@ export declare const translationsJson: {
|
|
|
6392
6393
|
_builtIn: string;
|
|
6393
6394
|
_standard: string;
|
|
6394
6395
|
_ipRestriction: string;
|
|
6396
|
+
_unsubscribers: string;
|
|
6395
6397
|
};
|
|
6396
6398
|
};
|
|
6397
6399
|
layout: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStoreSavedMedia: (domain: string, slug: string, infos: any) => import("@tanstack/react-query").UseInfiniteQueryResult<import("../../models/SavedMedia").SavedMedia[], unknown>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Libraries
|
|
2
|
+
import { useInfiniteQuery } from '@tanstack/react-query';
|
|
3
|
+
// Services
|
|
4
|
+
import { getListingSavedMedia } from '../../services/MediaTemplateDesign/UploadFile';
|
|
5
|
+
// Constants
|
|
6
|
+
import { QUERY_KEYS } from '../../constants';
|
|
7
|
+
// Hook to fetch data with infinite scrolling
|
|
8
|
+
export const useStoreSavedMedia = (domain, slug, infos) => useInfiniteQuery({
|
|
9
|
+
queryKey: [QUERY_KEYS.GET_LIST_SAVED_MEDIA, domain, slug, infos],
|
|
10
|
+
queryFn: ({ pageParam }) => getListingSavedMedia(domain, slug, infos, pageParam),
|
|
11
|
+
getNextPageParam: (lastPage, pages) => (lastPage.length >= 10 ? pages.length + 1 : undefined),
|
|
12
|
+
});
|
package/es/queries/index.d.ts
CHANGED
package/es/queries/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SavedMedia } from '@antscorp/antsomi-ui/es/models/SavedMedia';
|
|
2
2
|
import { Upload } from '@antscorp/antsomi-ui/es/models/Upload';
|
|
3
|
-
export declare const getListingSavedMedia: (domainUrl: string, slug: string, infos: any) => Promise<SavedMedia[]>;
|
|
3
|
+
export declare const getListingSavedMedia: (domainUrl: string, slug: string, infos: any, page?: number) => Promise<SavedMedia[]>;
|
|
4
4
|
export declare const createSavedMedia: (domainUrl: string, slug: string, infos: any, data: any) => Promise<any>;
|
|
5
5
|
export declare const deleteSavedMedia: (domainUrl: string, slug: string, infos: any, id: string | number) => Promise<any>;
|
|
6
6
|
export declare const uploadFile: (domainUrl: string, slug: string, infos: any, files: any) => Promise<Upload[]>;
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import { SavedMedia } from '@antscorp/antsomi-ui/es/models/SavedMedia';
|
|
4
4
|
import { Upload } from '@antscorp/antsomi-ui/es/models/Upload';
|
|
5
5
|
import { services } from '@antscorp/antsomi-ui/es/services';
|
|
6
|
-
export const getListingSavedMedia = async (domainUrl, slug, infos) => {
|
|
6
|
+
export const getListingSavedMedia = async (domainUrl, slug, infos, page = 1) => {
|
|
7
7
|
try {
|
|
8
8
|
const { type = '', ...restInfos } = infos || {};
|
|
9
9
|
const { data } = await services.mediaTemplateDesign.getList({
|
|
10
|
-
API_HOST: `${domainUrl}/${slug}/saved-media/index?type=${type}`,
|
|
10
|
+
API_HOST: `${domainUrl}/${slug}/saved-media/index?type=${type}&page=${page}&limit=10`,
|
|
11
11
|
}, restInfos);
|
|
12
12
|
let savedImages = data?.data || [];
|
|
13
13
|
savedImages = savedImages.map((savedImage) => new SavedMedia(savedImage));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antscorp/antsomi-ui",
|
|
3
|
-
"version": "1.3.6-beta.
|
|
3
|
+
"version": "1.3.6-beta.40",
|
|
4
4
|
"description": "An enterprise-class UI design language and React UI library.",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"dist/*",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"not op_mini all"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@antscorp/antsomi-locales": "1.0.35",
|
|
65
64
|
"@ant-design/cssinjs": "^1.6.2",
|
|
66
65
|
"@antscorp/icons": "0.27.56",
|
|
66
|
+
"@antscorp/antsomi-locales": "1.0.49",
|
|
67
67
|
"@antscorp/image-editor": "1.0.2",
|
|
68
68
|
"@antscorp/processing-notification": "^1.0.3",
|
|
69
69
|
"bignumber.js": "9.1.2",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { CloseIcon } from '@antscorp/antsomi-ui/es/components/icons';
|
|
3
|
-
import { globalToken } from '@antscorp/antsomi-ui/es/constants';
|
|
4
|
-
import { CLS } from '../../utils';
|
|
5
|
-
export const Action = (props) => {
|
|
6
|
-
const { removable, onClickRemove } = props;
|
|
7
|
-
if (!removable)
|
|
8
|
-
return null;
|
|
9
|
-
return (_jsx(CloseIcon, { className: CLS.RemoveButton.default, size: 20, color: globalToken?.bw8, onClick: onClickRemove }));
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Action } from './Action';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Action } from './Action';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import { InputSearch } from '../../../InputSearch';
|
|
4
|
-
import { CLS } from '../../utils';
|
|
5
|
-
export const Search = (props) => {
|
|
6
|
-
const { className, placeholder, onChange } = props;
|
|
7
|
-
return (_jsx(InputSearch, { className: clsx(CLS.Search, className), placeholder: placeholder || 'Search...', onChange: onChange }));
|
|
8
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Search } from './Search';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Search } from './Search';
|