Merge branch 'main' of github.com:hainatravel/global-sales

dev/timezone
Jimmy Liow 1 year ago
commit fe674f403d

@ -233,11 +233,11 @@ const whatsappMsgMapped = {
return isEmpty(result?.whatsappMessage) ? null : { ...result.whatsappMessage, conversationid: result.conversationid, messageorigin: result.messageorigin };
},
contentToRender: (contentObj) => {
if ((contentObj?.status === 'failed' ) && contentObj.errorCode !== 'BAD_REQUEST') {
if (contentObj?.status === 'failed' && ['130472', 'BAD_REQUEST'].includes(contentObj.errorCode)) {
contentObj = {
...contentObj,
type: 'error',
text: {body: `${whatsappError?.[contentObj.errorCode] || contentObj.errorMessage}` }, // contentObj.errorMessage // Message failed to send.
text: { body: `${whatsappError?.[contentObj.errorCode] || contentObj.errorMessage}` }, // contentObj.errorMessage // Message failed to send.
id: contentObj.id,
wamid: contentObj.id,
};

@ -7,6 +7,7 @@ import useAuthStore from '@/stores/AuthStore';
const InputAssign = ({ initialValues, ...props }) => {
const [userId, username] = useAuthStore((state) => [state.loginUser.userId, state.loginUser.username]);
const actionDisabled = !['79', '383', '404', '227'].includes(String(userId));
const { message } = App.useApp();
const [form] = Form.useForm();
@ -16,6 +17,7 @@ const InputAssign = ({ initialValues, ...props }) => {
const valuesSub = {
...values,
opi_sn: values.opi_sn.value,
from_opi_sn: userId, //
};
setSubLoading(true);
await postAssignConversation(valuesSub);
@ -35,10 +37,11 @@ const InputAssign = ({ initialValues, ...props }) => {
<Input />
</Form.Item>
<div className='flex justify-end gap-4 items-end'>
<Button type='primary' ghost size={'small'} onClick={assignToMe} disabled={subLoading}>
{actionDisabled && <div className='text-yellow-400'>无权限操作, 请联系陆燕</div>}
<Button type='primary' ghost size={'small'} onClick={assignToMe} disabled={actionDisabled || subLoading}>
分配给我
</Button>
<Button type='primary' htmlType='submit' loading={subLoading}>
<Button type='primary' htmlType='submit' loading={subLoading} disabled={actionDisabled}>
确认
</Button>
</div>

@ -53,7 +53,7 @@ const MessagesWrapper = ({ updateRead = true, forceGetMessages }) => {
const getFirstPageMessages = async (item) => {
setMsgLoading(true);
const data = await fetchMessages({ opisn: forceGetMessages ? '' : userId, whatsappid: item.whatsapp_phone_number, lasttime: '' });
const data = await fetchMessages({ opisn: forceGetMessages ? (currentConversation.opi_sn || '') : userId, whatsappid: item.whatsapp_phone_number, lasttime: '' });
setMsgLoading(false);
receivedMessageList(item.sn, data);
const thisLastTime = data.length > 0 ? data[0].orgmsgtime : '';

@ -16,17 +16,15 @@ const buildDatePlugin = () => {
};
};
// PWA plugin
const manifestForPlugIn = {
const manifestForPWAPlugIn = {
// strategies: 'generateSW',
registerType: 'prompt',
// includeAssests: ['/src/assets/logo-gh.png'],
// registerType: 'autoUpdate',
devOptions: {
enabled: true
},
devOptions: { enabled: true },
workbox: {
// dontCacheBustURLsMatching: /\/maintenance/,
navigateFallbackDenylist: [/^\/maintenance/],
globPatterns: ['**/*.{json,css,js,html,ico,png,svg,woff2}'],
globIgnores: ['**/maintenance.html', '**/maintenance/*'],
maximumFileSizeToCacheInBytes: 3000000,
clientsClaim: true,
// skipWaiting: true,
@ -38,12 +36,12 @@ const manifestForPlugIn = {
cacheName: 'oss-cn-media',
expiration: {
maxEntries: 20,
maxAgeSeconds: 60 * 60 * 24 * 7 // <== 7 days
maxAgeSeconds: 60 * 60 * 24 * 7, // <== 7 days
},
cacheableResponse: {
statuses: [0, 200]
}
}
statuses: [0, 200],
},
},
},
{
urlPattern: /^https:\/\/hiana-crm\.oss-ap-southeast-1\.aliyuncs\.com\/.*/i,
@ -52,12 +50,12 @@ const manifestForPlugIn = {
cacheName: 'oss-ap-media',
expiration: {
maxEntries: 20,
maxAgeSeconds: 60 * 60 * 24 * 7 // <== 7 days
maxAgeSeconds: 60 * 60 * 24 * 7, // <== 7 days
},
cacheableResponse: {
statuses: [0, 200]
}
}
statuses: [0, 200],
},
},
},
{
urlPattern: /^https:\/\/static-legacy\.dingtalk.com\/.*/i,
@ -66,12 +64,12 @@ const manifestForPlugIn = {
cacheName: 'dingtalk-avatar-media',
expiration: {
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7 // <== 7 days
maxAgeSeconds: 60 * 60 * 24 * 7, // <== 7 days
},
cacheableResponse: {
statuses: [0, 200]
}
}
statuses: [0, 200],
},
},
},
],
},
@ -116,7 +114,7 @@ export default defineConfig({
__BUILD_DATE__: JSON.stringify(`${today}`),
__BUILD_VERSION__: JSON.stringify(`${packageJson.version}`),
},
plugins: [react(), WindiCSS(), buildDatePlugin(), VitePWA(manifestForPlugIn)],
plugins: [react(), WindiCSS(), buildDatePlugin(), VitePWA(manifestForPWAPlugIn)],
server: {
host: '0.0.0.0',
},
@ -137,6 +135,7 @@ export default defineConfig({
maintenance: './maintenance.html'
},
output: {
entryFileNames: '[name]/build.[hash].js',
// manualChunks(id) {
// if (id.includes('node_modules')) {
// return id.toString().split('node_modules/')[1].split('/')[0].toString();

Loading…
Cancel
Save