@feedmepos/mf-order-setting 0.0.32 → 0.0.33

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.
Files changed (42) hide show
  1. package/dist/{KioskDevicesView-D2w5MMCg.js → KioskDevicesView-CxZI99me.js} +1 -1
  2. package/dist/{KioskDevicesView.vue_vue_type_script_setup_true_lang-BwxGSbuI.js → KioskDevicesView.vue_vue_type_script_setup_true_lang-EGj4fxeN.js} +2 -2
  3. package/dist/{KioskSettingView-CUMAS8OG.js → KioskSettingView-CTDY8__s.js} +1 -1
  4. package/dist/{KioskView-NetckXQx.js → KioskView-IUQTvUF8.js} +4 -4
  5. package/dist/{OrderSettingsView-CL0o1fHq.js → OrderSettingsView-VLE9yxNt.js} +5446 -5282
  6. package/dist/{app-DnvFFLBj.js → app-cd45Ryph.js} +12 -8
  7. package/dist/app.js +1 -1
  8. package/dist/{dayjs.min-BAx2Uba9.js → dayjs.min-CRAlrjJy.js} +1 -1
  9. package/dist/frontend/mf-order/src/api/remoteOrder/index.d.ts +5 -2
  10. package/dist/frontend/mf-order/src/app.d.ts +4 -0
  11. package/dist/frontend/mf-order/src/main.d.ts +4 -0
  12. package/dist/frontend/mf-order/src/stores/restaurant/index.d.ts +5 -2
  13. package/dist/frontend/mf-order/src/views/order-settings/delivery/DeliverySetting.vue.d.ts +1 -1
  14. package/dist/frontend/mf-order/src/views/order-settings/delivery/delivery.d.ts +3 -1
  15. package/dist/frontend/mf-order/src/views/order-settings/delivery/delivery.data.d.ts +3 -1
  16. package/dist/frontend/mf-order/src/views/order-settings/delivery/integrated-delivery/DeliverooSetting.vue.d.ts +46 -0
  17. package/dist/frontend/mf-order/src/views/order-settings/delivery/integrated-delivery/ExternalSetting.vue.d.ts +4 -4
  18. package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
  19. package/dist/{index-DuneL3VN.js → index-DLWAy-3K.js} +2 -2
  20. package/dist/{queue.do-B1npBXsB.js → menu.dto-DGDI6XwH.js} +15195 -14809
  21. package/dist/package/entity/index.d.ts +22 -1
  22. package/dist/package/entity/order/order-item/order-item.dto.d.ts +2 -2
  23. package/dist/package/entity/order-platform/deliveroo/deliveroo-dto.d.ts +523 -0
  24. package/dist/package/entity/order-platform/deliveroo/deliveroo-order.do.d.ts +7814 -0
  25. package/dist/package/entity/order-platform/deliveroo/deliveroo-order.dto.d.ts +15 -0
  26. package/dist/package/entity/order-platform/deliveroo/deliveroo-setting.do.d.ts +37 -0
  27. package/dist/package/entity/order-platform/deliveroo/deliveroo.enum.d.ts +31 -0
  28. package/dist/package/entity/order-platform/deliveroo/deliveroo.menu.dto.d.ts +2341 -0
  29. package/dist/package/entity/order-platform/external/setting/external-setting.do.d.ts +3 -3
  30. package/dist/package/entity/order-platform/external/setting/external-setting.dto.d.ts +3 -3
  31. package/dist/package/entity/order-platform/order-platform.enum.d.ts +6 -1
  32. package/package.json +1 -1
  33. package/src/api/remoteOrder/index.ts +20 -2
  34. package/src/locales/en-US.json +1 -0
  35. package/src/locales/th-TH.json +1 -0
  36. package/src/locales/zh-CN.json +2 -0
  37. package/src/stores/restaurant/index.ts +12 -7
  38. package/src/views/order-settings/delivery/DeliverySetting.vue +141 -57
  39. package/src/views/order-settings/delivery/delivery.data.ts +10 -1
  40. package/src/views/order-settings/delivery/delivery.ts +34 -9
  41. package/src/views/order-settings/delivery/integrated-delivery/DeliverooSetting.vue +109 -0
  42. package/src/views/order-settings/delivery/integrated-delivery/IntegratedDelivery.vue +11 -10
@@ -48,7 +48,7 @@ export declare const FdoExternalSetting: z.ZodObject<{
48
48
  autoSend: boolean;
49
49
  autoCloseBill: boolean;
50
50
  }>;
51
- platform: z.ZodEnum<["FOOD_PANDA", "GRAB_FOOD", "SHOPEE_FOOD", "DELIVEROO", "FEEDME", "IN_HOUSE", "ZUS"]>;
51
+ platform: z.ZodEnum<["DELIVEROO", "FOOD_PANDA", "GRAB_FOOD", "SHOPEE_FOOD", "DELIVEROO", "FEEDME", "IN_HOUSE", "ZUS"]>;
52
52
  delivery: z.ZodNullable<z.ZodOptional<z.ZodObject<{
53
53
  catalogId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
54
54
  deliveryFeeTax: z.ZodNullable<z.ZodOptional<z.ZodObject<{
@@ -100,7 +100,7 @@ export declare const FdoExternalSetting: z.ZodObject<{
100
100
  } | null | undefined;
101
101
  _id: string;
102
102
  enable: boolean;
103
- platform: "IN_HOUSE" | "FEEDME" | "FOOD_PANDA" | "GRAB_FOOD" | "SHOPEE_FOOD" | "DELIVEROO" | "ZUS";
103
+ platform: "IN_HOUSE" | "FEEDME" | "DELIVEROO" | "FOOD_PANDA" | "GRAB_FOOD" | "SHOPEE_FOOD" | "ZUS";
104
104
  config: {
105
105
  printReceiptAfterClose?: boolean | null | undefined;
106
106
  autoAccept: boolean;
@@ -121,7 +121,7 @@ export declare const FdoExternalSetting: z.ZodObject<{
121
121
  } | null | undefined;
122
122
  _id: string;
123
123
  enable: boolean;
124
- platform: "IN_HOUSE" | "FEEDME" | "FOOD_PANDA" | "GRAB_FOOD" | "SHOPEE_FOOD" | "DELIVEROO" | "ZUS";
124
+ platform: "IN_HOUSE" | "FEEDME" | "DELIVEROO" | "FOOD_PANDA" | "GRAB_FOOD" | "SHOPEE_FOOD" | "ZUS";
125
125
  config: {
126
126
  printReceiptAfterClose?: boolean | null | undefined;
127
127
  autoAccept: boolean;
@@ -18,7 +18,7 @@ export declare const FdtoExternalSettingCreateOrUpdate: z.ZodObject<Omit<{
18
18
  autoSend: boolean;
19
19
  autoCloseBill: boolean;
20
20
  }>;
21
- platform: z.ZodEnum<["FOOD_PANDA", "GRAB_FOOD", "SHOPEE_FOOD", "DELIVEROO", "FEEDME", "IN_HOUSE", "ZUS"]>;
21
+ platform: z.ZodEnum<["DELIVEROO", "FOOD_PANDA", "GRAB_FOOD", "SHOPEE_FOOD", "DELIVEROO", "FEEDME", "IN_HOUSE", "ZUS"]>;
22
22
  delivery: z.ZodNullable<z.ZodOptional<z.ZodObject<{
23
23
  catalogId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
24
24
  deliveryFeeTax: z.ZodNullable<z.ZodOptional<z.ZodObject<{
@@ -69,7 +69,7 @@ export declare const FdtoExternalSettingCreateOrUpdate: z.ZodObject<Omit<{
69
69
  } | null | undefined;
70
70
  } | null | undefined;
71
71
  enable: boolean;
72
- platform: "IN_HOUSE" | "FEEDME" | "FOOD_PANDA" | "GRAB_FOOD" | "SHOPEE_FOOD" | "DELIVEROO" | "ZUS";
72
+ platform: "IN_HOUSE" | "FEEDME" | "DELIVEROO" | "FOOD_PANDA" | "GRAB_FOOD" | "SHOPEE_FOOD" | "ZUS";
73
73
  config: {
74
74
  printReceiptAfterClose?: boolean | null | undefined;
75
75
  autoAccept: boolean;
@@ -89,7 +89,7 @@ export declare const FdtoExternalSettingCreateOrUpdate: z.ZodObject<Omit<{
89
89
  } | null | undefined;
90
90
  } | null | undefined;
91
91
  enable: boolean;
92
- platform: "IN_HOUSE" | "FEEDME" | "FOOD_PANDA" | "GRAB_FOOD" | "SHOPEE_FOOD" | "DELIVEROO" | "ZUS";
92
+ platform: "IN_HOUSE" | "FEEDME" | "DELIVEROO" | "FOOD_PANDA" | "GRAB_FOOD" | "SHOPEE_FOOD" | "ZUS";
93
93
  config: {
94
94
  printReceiptAfterClose?: boolean | null | undefined;
95
95
  autoAccept: boolean;
@@ -1,11 +1,15 @@
1
1
  import { z } from 'zod';
2
2
  export declare const F_ORDER_PLATFORM_ACTION: z.ZodEnum<["SYNC_MENU", "UPDATE_ORDER", "GET_OR_UPDATE_SETTING"]>;
3
- export declare const F_ORDER_PLATFORM: z.ZodEnum<["FOOD_PANDA", "GRAB_FOOD", "SHOPEE_FOOD", "DELIVEROO", "FEEDME", "IN_HOUSE", "ZUS"]>;
3
+ export declare const F_ORDER_PLATFORM: z.ZodEnum<["DELIVEROO", "FOOD_PANDA", "GRAB_FOOD", "SHOPEE_FOOD", "DELIVEROO", "FEEDME", "IN_HOUSE", "ZUS"]>;
4
4
  export declare const F_MENU_SYNCING_STATUS: z.ZodEnum<["SUCCESS", "FAILED", "PROCESSING"]>;
5
5
  export declare const F_SF_MENU_SYNCING_STATUS: z.ZodNativeEnum<{
6
6
  readonly SUCCESS: 0;
7
7
  readonly FAILED: 1;
8
8
  }>;
9
+ export declare const F_DR_MENU_SYNCING_STATUS: z.ZodNativeEnum<{
10
+ readonly SUCCESS: 200;
11
+ readonly FAILED: number;
12
+ }>;
9
13
  export declare const F_GF_MENU_SYNCING_STATUS: z.ZodEnum<["PROCESSING", "QUEUEING", "SUCCESS", "FAILED"]>;
10
14
  export declare const F_FP_MENU_SYNCING_STATUS: z.ZodEnum<["in_progress", "done", "failed", "done_with_errors"]>;
11
15
  export type F_ORDER_PLATFORM_ACTION = z.infer<typeof F_ORDER_PLATFORM_ACTION>;
@@ -14,3 +18,4 @@ export type F_MENU_SYNCING_STATUS = z.infer<typeof F_MENU_SYNCING_STATUS>;
14
18
  export type F_GF_MENU_SYNCING_STATUS = z.infer<typeof F_GF_MENU_SYNCING_STATUS>;
15
19
  export type F_SF_MENU_SYNCING_STATUS = z.infer<typeof F_SF_MENU_SYNCING_STATUS>;
16
20
  export type F_FP_MENU_SYNCING_STATUS = z.infer<typeof F_FP_MENU_SYNCING_STATUS>;
21
+ export type F_DR_MENU_SYNCING_STATUS = z.infer<typeof F_DR_MENU_SYNCING_STATUS>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-order-setting",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "type": "module",
5
5
  "module": "./dist/app.js",
6
6
  "license": "UNLICENSED",
@@ -2,13 +2,14 @@ import type { AxiosInstance } from 'axios';
2
2
  import { baseClientInstance, getData, SvcConfig } from '..';
3
3
  import type { DeliveryCompany, LinkedDeliveryDoc } from '../../views/order-settings/delivery/delivery';
4
4
  import { FdoFoodpandaSettings, FdoLinkedDelivery, FdoRestaurant, FdoRestaurantFeedmeDelivery, FdoRestaurantInHouseDelivery, FdoShopeeFoodOrder } from '@feedmepos/core/entity';
5
- import type { FdoExternalSetting, FdoFoodpandaOrderOutput, FdoGrabfoodOrderOutput, FdoGrabfoodSettings, FdoShopeeFoodOrderOutput, FdoShopeeFoodSettings, FdtoGetOrderReq } from '@entity';
5
+ import type { FdoDeliverooSettings, FdoExternalSetting, FdoFoodpandaOrderOutput, FdoGrabfoodOrderOutput, FdoGrabfoodSettings, FdoShopeeFoodOrderOutput, FdoShopeeFoodSettings, FdtoGetOrderReq } from '@entity';
6
6
 
7
- type DeliveryCompanyUrl = 'foodpanda' | 'grabfood' | 'shopeefood' | 'external'
7
+ type DeliveryCompanyUrl = 'foodpanda' | 'grabfood' | 'shopeefood' | 'deliveroo' | 'external'
8
8
 
9
9
  const deliveryClientInstance = (
10
10
  deliveryCompany: DeliveryCompanyUrl
11
11
  ): AxiosInstance => {
12
+ //https://portal-v2-dev.feedmeapi.com/deliveroo/setting/:restaurantId
12
13
  const path = `/${deliveryCompany}`;
13
14
  return baseClientInstance(path, 'portal');
14
15
  };
@@ -113,6 +114,23 @@ export const remoteOrderApi = {
113
114
  async syncShopeefoodMenu(storeId: string): Promise<FdoShopeeFoodSettings> {
114
115
  return getData(await deliveryClientInstance('shopeefood').get(`/menu-sync/${storeId}`));
115
116
  },
117
+ async updateDeliveroo(restaurantId: string, dto: FdoDeliverooSettings): Promise<FdoRestaurant> {
118
+ return getData(await deliveryClientInstance('deliveroo').put(`/setting/${restaurantId}`, {
119
+ _id: restaurantId,
120
+ ...dto
121
+ }))
122
+ },
123
+ async readDeliveroo(restaurantId: string): Promise<FdoDeliverooSettings | null> {
124
+ return getData(await deliveryClientInstance('deliveroo').get(`/setting/${restaurantId}`));
125
+ },
126
+ async syncDeliverooMernu(merchantID: string): Promise<FdoDeliverooSettings> {
127
+ try {
128
+ const res = getData(await deliveryClientInstance('deliveroo').get(`/menu-sync/${merchantID}`))
129
+ return res
130
+ } catch(err) {
131
+ throw err
132
+ }
133
+ },
116
134
  async readExternal(restaurantId: string): Promise<FdoExternalSetting | null> {
117
135
  return getData(await deliveryClientInstance('external').get(`/setting/${restaurantId}`))
118
136
  },
@@ -35,6 +35,7 @@
35
35
  "auto": "Auto",
36
36
  "autoIntegration": "Auto Integration",
37
37
  "autoIntegrationWarning": "Auto delivery integration not available, contact our staff for more information. Reason: {reason}",
38
+ "autoIntegrationCountryNotSupport": "Platform not support auto integration in current country.",
38
39
  "autoSendKitchen": "Auto Send Kitchen",
39
40
  "autoSendKitchenSublabel": "Required POS version 7 or above",
40
41
  "balance": "Balance",
@@ -35,6 +35,7 @@
35
35
  "auto": "อัตโนมัติ",
36
36
  "autoIntegration": "รวมอัตโนมัติ",
37
37
  "autoIntegrationWarning": "การรวมระบบการจัดส่งอัตโนมัติไม่พร้อมใช้งาน โปรดติดต่อเจ้าหน้าที่ของเราเพื่อขอข้อมูลเพิ่มเติม เหตุผล: {reason}",
38
+ "autoIntegrationCountryNotSupport": "แพลตฟอร์มไม่รองรับการเชื่อมต่อการจัดส่งแบบไดนามิกในประเทศ/ภูมิภาคปัจจุบัน",
38
39
  "autoSendKitchen": "ส่งอัตโนมัติครัว",
39
40
  "autoSendKitchenSublabel": "ต้องใช้ POS เวอร์ชัน 7 ขึ้นไป",
40
41
  "balance": "ยอดคงเหลือ",
@@ -35,6 +35,7 @@
35
35
  "auto": "自动",
36
36
  "autoIntegration": "自动对接",
37
37
  "autoIntegrationWarning": "自动配送对接不可用, 请联络我们的工作人员了解更多信息。 原因: {reason}",
38
+ "autoIntegrationCountryNotSupport": "平台不支持当前国家/地区的自动配送对接。",
38
39
  "autoSendKitchen": "自动发送至厨房",
39
40
  "autoSendKitchenSublabel": "需要POS版本7或以上",
40
41
  "balance": "余额",
@@ -274,6 +275,7 @@
274
275
  "DeliverySettingUpdated": "配送设置已更新",
275
276
  "selectPlatform": "选择平台",
276
277
  "platform": "平台",
278
+ "rateLimitWarning": "每分钟只允许一次请求。请稍后再试",
277
279
  "discountRule": {
278
280
  "add": "添加折扣规则",
279
281
  "description": "定义折扣在账单中如何应用。仅适用于POS版本{minPosVersion}或更高版本。",
@@ -16,12 +16,12 @@ import {
16
16
  FdoRestaurantSetting,
17
17
  type FdoEffectGroup
18
18
  } from '@feedmepos/core/entity'
19
- import { FdoExternalSetting, FdoGrabfoodSettings } from '@entity'
19
+ import { FdoDeliverooSettings, FdoGrabfoodSettings, FdoExternalSetting } from '@entity'
20
20
  import { FeatureFlag, Pos } from '@feedmepos/core'
21
21
  import { SvcConfig } from '@/api'
22
22
  import { remoteOrderApi } from '@/api/remoteOrder'
23
- import { useI18n, useCoreStore} from '@feedmepos/mf-common'
24
- import { computed, ref, watch} from 'vue'
23
+ import { useI18n, useCoreStore } from '@feedmepos/mf-common'
24
+ import { computed, ref, watch } from 'vue'
25
25
 
26
26
 
27
27
  export interface Profile extends FdoProfile {
@@ -56,10 +56,10 @@ function initRestaurantState(): RestaurantState {
56
56
  }
57
57
  }
58
58
 
59
- export const useRestaurantStore = defineStore('restaurant', () => {
59
+ export const useRestaurantStore = defineStore('restaurant', () => {
60
60
  const CoreStore = useCoreStore()
61
61
  const state = ref(initRestaurantState())
62
- const currentRestaurantSetting = computed<RestaurantSettingDoc| undefined>(() => state.value.restaurantSettings[CoreStore.currentRestaurant.value?._id || ''])
62
+ const currentRestaurantSetting = computed<RestaurantSettingDoc | undefined>(() => state.value.restaurantSettings[CoreStore.currentRestaurant.value?._id || ''])
63
63
 
64
64
  async function readRestaurantSetting(restaurantId: string) {
65
65
  const restaurantSetting = await restaurantApi.readRestaurantSetting(restaurantId)
@@ -103,10 +103,14 @@ export const useRestaurantStore = defineStore('restaurant', () => {
103
103
  async function updateIntegratedShopeefoodDelivery(restaurantId: string, dto: FdoShopeeFoodSettings) {
104
104
  await remoteOrderApi.integratedDelivery.updateShopeefood(restaurantId, dto)
105
105
  }
106
+
107
+ async function updateIntegratedDeliverooDelivery(restaurantId: string, dto: FdoDeliverooSettings) {
108
+ await remoteOrderApi.integratedDelivery.updateDeliveroo(restaurantId, dto)
109
+ }
106
110
  async function updateExternalDelivery(restaurantId: string, dto: FdoExternalSetting) {
107
111
  await remoteOrderApi.integratedDelivery.updateExternal(restaurantId, dto)
108
112
  }
109
-
113
+
110
114
  function getRestaurantEPayment(): true | string {
111
115
  const { t } = useI18n()
112
116
  if (!CoreStore.currentRestaurant.value) {
@@ -135,7 +139,7 @@ export const useRestaurantStore = defineStore('restaurant', () => {
135
139
 
136
140
  return {
137
141
  state: state.value,
138
- currentRestaurantSetting : currentRestaurantSetting.value,
142
+ currentRestaurantSetting: currentRestaurantSetting.value,
139
143
  readRestaurantSetting,
140
144
  selectRestaurant,
141
145
  updateServiceCharge,
@@ -146,6 +150,7 @@ export const useRestaurantStore = defineStore('restaurant', () => {
146
150
  updateIntegratedFoodpandaDelivery,
147
151
  updateIntegratedGrabfoodDelivery,
148
152
  updateIntegratedShopeefoodDelivery,
153
+ updateIntegratedDeliverooDelivery,
149
154
  updateExternalDelivery,
150
155
  getRestaurantEPayment,
151
156
  }
@@ -39,7 +39,7 @@
39
39
  dismiss-away
40
40
  :maxWidth="600"
41
41
  :model-value="sideSheetIntegrated"
42
- @update:model-value="sideSheetIntegrated = $event"
42
+ @update:model-value="(v: boolean) => handleSideSheet(v)"
43
43
  >
44
44
  <FoodpandaSetting
45
45
  v-if="componentProps.key === AUTO_INTEGRATION_CLIENT.foodpanda"
@@ -62,6 +62,14 @@
62
62
  :can-use-auto-delivery-integration="componentProps.canUseAuto"
63
63
  @update:model-value="handleModelValueUpdate"
64
64
  />
65
+ <DeliverooSetting
66
+ v-if="componentProps.key === AUTO_INTEGRATION_CLIENT.deliveroo"
67
+ :initial-value="componentProps.initialValue"
68
+ :company="componentProps.company"
69
+ :can-use-auto-delivery-integration="componentProps.canUseAuto"
70
+ @update:model-value="handleModelValueUpdate"
71
+ />
72
+
65
73
  <FeedmeDelivery
66
74
  v-if="feedMeComponentProps.key === F_ORDER_PLATFORM.enum.FEEDME"
67
75
  :initial-value="feedMeComponentProps.initialValue"
@@ -160,13 +168,14 @@
160
168
  import { computed, h, ref, watch } from 'vue'
161
169
  import RestaurantSelector from '../components/RestaurantSelector.vue'
162
170
  import { type ColumnDef } from '@feedmepos/ui-library'
163
- import type { FdoExternalSetting, FdoFoodpandaSettings } from '@entity'
171
+ import type { FdoDeliverooSettings, FdoFoodpandaSettings, FdoExternalSetting } from '@entity'
164
172
  import type {
165
173
  FdoLinkedDelivery,
166
174
  FdoRestaurantFeedmeDelivery,
167
175
  FdoRestaurantInHouseDelivery
168
176
  } from '@feedmepos/core/entity'
169
177
  import {
178
+ F_COUNTRY,
170
179
  F_DELIVERY_TYPE,
171
180
  F_FEATURE,
172
181
  F_ORDER_PLATFORM,
@@ -193,6 +202,7 @@ import { formatAddress } from '@/helpers/profile'
193
202
  import { useSnackbarFunctions } from '@/components/snackbar'
194
203
  import useSearch from '@/composables/search'
195
204
  import DeliveryList from './DeliveryList.vue'
205
+ import DeliverooSetting from './integrated-delivery/DeliverooSetting.vue'
196
206
  import { Pos } from '@feedmepos/core'
197
207
  import { useI18n, useCoreStore } from '@feedmepos/mf-common'
198
208
 
@@ -200,8 +210,14 @@ const { t } = useI18n()
200
210
  const { searchKey, filter } = useSearch()
201
211
  const { showSuccess } = useSnackbarFunctions()
202
212
  const restaurantStore = useRestaurantStore()
203
- const { currentRestaurant, currentBusiness, readRestaurants, changeRestaurant, sessionUser } =
204
- useCoreStore()
213
+ const {
214
+ currentRestaurant,
215
+ currentBusiness,
216
+ readRestaurants,
217
+ changeRestaurant,
218
+ sessionUser,
219
+ currentCountry
220
+ } = useCoreStore()
205
221
  const menuStore = useMenuStore()
206
222
  const linkedCompanies = ref<LinkedDeliveryDoc[]>([])
207
223
  const deliveryCompanies = ref<DeliveryCompany[]>([])
@@ -243,6 +259,11 @@ async function toggleLocalSidesheet(rowData: any) {
243
259
  }
244
260
 
245
261
  const title = ref('')
262
+
263
+ function handleSideSheet(v: boolean) {
264
+ sideSheetIntegrated.value = v
265
+ feedmeValidate.value = true
266
+ }
246
267
  async function toggleIntegratedSidesheet(data: any) {
247
268
  const rowData = data.original ?? data
248
269
 
@@ -261,6 +282,10 @@ async function toggleIntegratedSidesheet(data: any) {
261
282
  title.value = `${t('order.manageDelivery', { company: 'shopeefood' })}`
262
283
  updateIntegratedDeliveryType(rowData)
263
284
  break
285
+ case AUTO_INTEGRATION_CLIENT.deliveroo:
286
+ title.value = 'Manage deliveroo deivery'
287
+ updateIntegratedDeliveryType(rowData)
288
+ break
264
289
  case F_ORDER_PLATFORM.enum.FEEDME:
265
290
  title.value = `${t('order.feedmeExpressTitle')}`
266
291
  updateFeedmeExpress(rowData)
@@ -481,6 +506,13 @@ const shopee = computed<FdoShopeeFoodSettings>(() => {
481
506
  }
482
507
  })
483
508
 
509
+ const deliveroo = computed<FdoDeliverooSettings>(() => {
510
+ return {
511
+ ...deliveryData.initDeliverooDelivery(),
512
+ ...deliverooSetting.value
513
+ }
514
+ })
515
+
484
516
  const external = computed<FdoExternalSetting>(() => {
485
517
  return {
486
518
  ...deliveryData.initExternalDelivery(),
@@ -488,7 +520,7 @@ const external = computed<FdoExternalSetting>(() => {
488
520
  }
489
521
  })
490
522
  const localDeliveryCompanies = computed<DeliveryRow[]>(() => {
491
- const res = filterLocalDeliveryCompanies(deliveryCompanies.value).map<DeliveryRow>((company) => {
523
+ const res = deliveryCompanies.value.map<DeliveryRow>((company) => {
492
524
  const { name, paymentTypeKey, key } = company
493
525
  const doc = getLinkedDeliveryDoc(linkedCompanies.value, key)
494
526
 
@@ -506,20 +538,13 @@ const localDeliveryCompanies = computed<DeliveryRow[]>(() => {
506
538
  return res.filter((r) => filter([r.name, r.paymentType, r.status.join(' ')]))
507
539
  })
508
540
 
509
- const { getLinkedDeliveryDoc, filterLocalDeliveryCompanies, getPaymentType, equalKey } =
541
+ const { getLinkedDeliveryDoc, getPaymentType, equalKey, isIntegratedPlatformSupported } =
510
542
  useDelivery()
511
543
 
512
544
  function getCatalog(catalogId: string | null) {
513
545
  return menuStore.catalogOptions.find(({ value }) => value === catalogId)?.label || ''
514
546
  }
515
547
 
516
- const reachMinPosVersion = computed<string | boolean>(() => {
517
- const posVersion = currentRestaurant.value?.posVersion
518
- if (!posVersion) return t('order.invalidPosVersion')
519
- const res = Pos.canUse({ feature: F_FEATURE.enum.deliveryIntegration, posVersion })
520
- return res === true ? true : res.toString()
521
- })
522
-
523
548
  function hasPurchaseFeature(deliveryType: string) {
524
549
  const features = currentRestaurant.value?.features || []
525
550
  const featureKey = equalKey(deliveryType, AUTO_INTEGRATION_CLIENT.foodpanda)
@@ -528,30 +553,35 @@ function hasPurchaseFeature(deliveryType: string) {
528
553
  return features.includes(featureKey) || t('order.restaurantHaveNotPurchase', { featureKey })
529
554
  }
530
555
 
531
- function canUseAutoDeliveryIntegration(deliveryType: string) {
532
- if (reachMinPosVersion.value !== true) return reachMinPosVersion.value
533
- return hasPurchaseFeature(deliveryType)
556
+ const canUseAutoDeliveryIntegration = (client: string) => {
557
+ const hasFeature = hasPurchaseFeature(client)
558
+ if (typeof hasFeature === 'string') {
559
+ return hasFeature
560
+ }
561
+ switch (client) {
562
+ case 'deliveroo':
563
+ return (
564
+ currentCountry.value === F_COUNTRY.enum.SG ||
565
+ `${t('order.autoIntegrationCountryNotSupport')}`
566
+ )
567
+ default:
568
+ return true
569
+ }
534
570
  }
535
571
 
536
572
  const integratedCompanies = computed<IntegratedDeliveryRow[]>(() => {
537
- const fpManual = getLinkedDeliveryDoc(linkedCompanies.value, AUTO_INTEGRATION_CLIENT.foodpanda)
538
- const gfManual = getLinkedDeliveryDoc(linkedCompanies.value, AUTO_INTEGRATION_CLIENT.grabfood)
539
- const sfManual = getLinkedDeliveryDoc(linkedCompanies.value, AUTO_INTEGRATION_CLIENT.shopeefood)
540
-
541
573
  const getIntegrateDoc = (client: AUTO_INTEGRATION_CLIENT) =>
542
574
  deliveryCompanies.value.find(({ key }) => equalKey(key, client))
543
575
  const fpIntegrate = getIntegrateDoc(AUTO_INTEGRATION_CLIENT.foodpanda)
544
576
  const grabIntegrate = getIntegrateDoc(AUTO_INTEGRATION_CLIENT.grabfood)
545
577
  const sfIntegrate = getIntegrateDoc(AUTO_INTEGRATION_CLIENT.shopeefood)
578
+ const drIntegrate = getIntegrateDoc(AUTO_INTEGRATION_CLIENT.deliveroo)
546
579
 
547
- const generateStatus = (manualActive: boolean, integrateActive: boolean) => {
548
- if (manualActive && integrateActive) return 'Active'
549
- if (manualActive) return 'Manual'
550
- if (integrateActive) return 'Active'
551
- return 'Inactive'
580
+ const generateStatus = (integrateActive: boolean) => {
581
+ return integrateActive ? 'Active' : 'Inactive'
552
582
  }
553
583
 
554
- return [
584
+ const feedmeDelivery = [
555
585
  {
556
586
  id: loadingKey.value.inhouse,
557
587
  name: 'In house delivery',
@@ -571,31 +601,32 @@ const integratedCompanies = computed<IntegratedDeliveryRow[]>(() => {
571
601
  status: feedmeExpress.value.enable ? ['Active'] : ['Inactive'],
572
602
  setting: feedmeExpress.value,
573
603
  catalog: getCatalog(feedmeExpress.value.catalogId || null)
574
- },
604
+ }
605
+ ]
606
+
607
+ const integratedDelivery = [
575
608
  {
576
609
  id: loadingKey.value.fp,
577
- name: 'FoodPanda delivery',
610
+ name: 'Food Panda delivery',
578
611
  key: AUTO_INTEGRATION_CLIENT.foodpanda,
579
612
  company: fpIntegrate,
580
- paymentType: foodpanda.value.enable ? getPaymentType(fpManual?.paymentTypeKey) : '-',
581
- status: [generateStatus(!!fpManual, foodpanda.value.enable)],
613
+ paymentType: 'Default',
614
+ status: [generateStatus(foodpanda.value.enable)],
582
615
  setting: foodpanda.value,
583
- doc: fpManual,
584
- catalog: getCatalog(fpManual?.catalogId || null),
616
+ catalog: getCatalog(foodpanda.value.catalogId ?? null),
585
617
  canUseAutoDeliveryIntegration: canUseAutoDeliveryIntegration(
586
618
  AUTO_INTEGRATION_CLIENT.foodpanda
587
619
  )
588
620
  },
589
621
  {
590
622
  id: loadingKey.value.gf,
591
- name: 'GrabFood delivery',
623
+ name: 'Grab Food delivery',
592
624
  key: AUTO_INTEGRATION_CLIENT.grabfood,
593
625
  company: grabIntegrate,
594
- paymentType: grabfood.value.enable ? getPaymentType(gfManual?.paymentTypeKey) : '-',
595
- status: [generateStatus(!!gfManual, grabfood.value.enable)],
626
+ paymentType: 'Default',
627
+ status: [generateStatus(grabfood.value.enable)],
596
628
  setting: grabfood.value,
597
- doc: gfManual,
598
- catalog: getCatalog(gfManual?.catalogId || null),
629
+ catalog: getCatalog(grabfood.value?.catalogId || null),
599
630
  canUseAutoDeliveryIntegration: canUseAutoDeliveryIntegration(AUTO_INTEGRATION_CLIENT.grabfood)
600
631
  },
601
632
  {
@@ -603,15 +634,27 @@ const integratedCompanies = computed<IntegratedDeliveryRow[]>(() => {
603
634
  name: 'ShopeeFood delivery',
604
635
  key: AUTO_INTEGRATION_CLIENT.shopeefood,
605
636
  company: sfIntegrate,
606
- paymentType: shopee.value.enable ? getPaymentType(sfManual?.paymentTypeKey) : '-',
607
- status: [generateStatus(!!sfManual, shopee.value.enable)],
637
+ paymentType: 'Default',
638
+ status: [generateStatus(shopee.value.enable)],
608
639
  setting: shopee.value,
609
- doc: sfManual,
610
- catalog: getCatalog(sfManual?.catalogId || null),
640
+ catalog: getCatalog(shopee.value.catalogId || null),
611
641
  canUseAutoDeliveryIntegration: canUseAutoDeliveryIntegration(
612
642
  AUTO_INTEGRATION_CLIENT.shopeefood
613
643
  )
614
644
  },
645
+ {
646
+ id: loadingKey.value.dr,
647
+ name: 'Deliveroo delivery',
648
+ key: AUTO_INTEGRATION_CLIENT.deliveroo,
649
+ company: drIntegrate,
650
+ paymentType: 'Default',
651
+ status: [generateStatus(deliveroo.value.enable)],
652
+ setting: deliveroo.value,
653
+ catalog: getCatalog(deliveroo.value?.catalogId || null),
654
+ canUseAutoDeliveryIntegration: canUseAutoDeliveryIntegration(
655
+ AUTO_INTEGRATION_CLIENT.deliveroo
656
+ )
657
+ },
615
658
  {
616
659
  id: loadingKey.value.external,
617
660
  name: 'External delivery',
@@ -619,9 +662,16 @@ const integratedCompanies = computed<IntegratedDeliveryRow[]>(() => {
619
662
  setting: external.value,
620
663
  catalog: '-',
621
664
  paymentType: '-',
622
- status: [generateStatus(false, external.value.enable)]
665
+ status: [generateStatus(external.value.enable)]
623
666
  }
624
667
  ]
668
+
669
+ return [
670
+ ...feedmeDelivery,
671
+ ...integratedDelivery.filter((delivery) => {
672
+ return isIntegratedPlatformSupported(delivery.key, currentCountry.value)
673
+ })
674
+ ]
625
675
  })
626
676
 
627
677
  const loadingKey = computed(() => {
@@ -632,12 +682,13 @@ const loadingKey = computed(() => {
632
682
  gf: `${id}_gf`,
633
683
  sf: `${id}_sf`,
634
684
  fm: `${id}_fm`,
685
+ dr: `${id}_dr`,
635
686
  external: `${id}_external`,
636
687
  local: (deliveryName: string) => `${id}_${deliveryName}`
637
688
  }
638
689
  })
639
690
 
640
- async function updateIntegratedDeliveryCompany(company: IntegratedDeliveryRow) {
691
+ async function updateIntegratedDeliveryCompany() {
641
692
  switch (selectedIntegratedRow.value) {
642
693
  case AUTO_INTEGRATION_CLIENT.foodpanda:
643
694
  await updateIntegratedDeliverySetting()
@@ -648,6 +699,9 @@ async function updateIntegratedDeliveryCompany(company: IntegratedDeliveryRow) {
648
699
  case AUTO_INTEGRATION_CLIENT.shopeefood:
649
700
  await updateIntegratedDeliverySetting()
650
701
  break
702
+ case AUTO_INTEGRATION_CLIENT.deliveroo:
703
+ await updateIntegratedDeliverySetting()
704
+ break
651
705
  case F_ORDER_PLATFORM.enum.FEEDME:
652
706
  await updateFeedmeExpressSetting()
653
707
  break
@@ -678,6 +732,7 @@ const filteredCompanies = computed(() => {
678
732
  const grabfoodSetting = ref<FdoGrabfoodSettings | null>(null)
679
733
  const foodpandaSetting = ref<FdoFoodpandaSettings | null>(null)
680
734
  const shopeefoodSetting = ref<FdoShopeeFoodSettings | null>(null)
735
+ const deliverooSetting = ref<FdoDeliverooSettings | null>(null)
681
736
  const externalSetting = ref<FdoExternalSetting | null>(null)
682
737
  const loadingDpi = ref<boolean>(false)
683
738
 
@@ -685,20 +740,41 @@ async function readData() {
685
740
  await startAsyncCallWithErr(async () => {
686
741
  loadingDpi.value = true
687
742
  linkedCompanies.value = await remoteOrderApi.readLinkedDeliveryCompanies()
743
+
688
744
  const resp = await remoteOrderApi.readLocalDeliveryCompanies()
689
745
  deliveryCompanies.value = sort(resp, { selector: 'name' })
690
- grabfoodSetting.value = await remoteOrderApi.integratedDelivery.readGrabfood(
691
- currentRestaurant.value?._id || ''
746
+
747
+ grabfoodSetting.value = isIntegratedPlatformSupported(
748
+ AUTO_INTEGRATION_CLIENT.grabfood,
749
+ currentCountry.value
750
+ )
751
+ ? await remoteOrderApi.integratedDelivery.readGrabfood(currentRestaurant.value?._id || '')
752
+ : null
753
+
754
+ foodpandaSetting.value = isIntegratedPlatformSupported(
755
+ AUTO_INTEGRATION_CLIENT.foodpanda,
756
+ currentCountry.value
692
757
  )
693
- foodpandaSetting.value = await remoteOrderApi.integratedDelivery.readFoodpanda(
694
- currentRestaurant.value?._id || ''
758
+ ? await remoteOrderApi.integratedDelivery.readFoodpanda(currentRestaurant.value?._id || '')
759
+ : null
760
+ shopeefoodSetting.value = isIntegratedPlatformSupported(
761
+ AUTO_INTEGRATION_CLIENT.shopeefood,
762
+ currentCountry.value
695
763
  )
696
- shopeefoodSetting.value = await remoteOrderApi.integratedDelivery.readShopeefood(
697
- currentRestaurant.value?._id || ''
764
+ ? await remoteOrderApi.integratedDelivery.readShopeefood(currentRestaurant.value?._id || '')
765
+ : null
766
+ deliverooSetting.value = isIntegratedPlatformSupported(
767
+ AUTO_INTEGRATION_CLIENT.deliveroo,
768
+ currentCountry.value
698
769
  )
699
- externalSetting.value = await remoteOrderApi.integratedDelivery.readExternal(
700
- currentRestaurant.value?._id || ''
770
+ ? await remoteOrderApi.integratedDelivery.readDeliveroo(currentRestaurant.value?._id || '')
771
+ : null
772
+ externalSetting.value = isIntegratedPlatformSupported(
773
+ AUTO_INTEGRATION_CLIENT.external,
774
+ currentCountry.value
701
775
  )
776
+ ? await remoteOrderApi.integratedDelivery.readExternal(currentRestaurant.value?._id || '')
777
+ : null
702
778
  })
703
779
  loadingDpi.value = false
704
780
  }
@@ -872,6 +948,11 @@ async function updateDelivery(
872
948
  integrated as FdoShopeeFoodSettings
873
949
  )
874
950
  break
951
+ case AUTO_INTEGRATION_CLIENT.deliveroo:
952
+ await restaurantStore.updateIntegratedDeliverooDelivery(
953
+ currentRestaurant.value?._id ?? '',
954
+ integrated as FdoDeliverooSettings
955
+ )
875
956
  }
876
957
  }
877
958
  }
@@ -927,9 +1008,10 @@ function convertStatustoI18(status: status): [string] {
927
1008
  type companyName =
928
1009
  | 'In house delivery'
929
1010
  | 'FeedMe express'
930
- | 'FoodPanda delivery'
931
- | 'GrabFood delivery'
1011
+ | 'Food Panda delivery'
1012
+ | 'Grab Food delivery'
932
1013
  | 'ShopeeFood delivery'
1014
+ | 'Deliveroo delivery'
933
1015
  | 'External delivery'
934
1016
 
935
1017
  function convertIntegratedCompanyName(name: companyName): string {
@@ -938,12 +1020,14 @@ function convertIntegratedCompanyName(name: companyName): string {
938
1020
  return `${t('order.deliveryTitle', { company: 'In House' })}`
939
1021
  case 'FeedMe express':
940
1022
  return `${t('order.feedMeExpress')}`
941
- case 'FoodPanda delivery':
942
- return `${t('order.deliveryTitle', { company: 'FoodPanda' })}`
943
- case 'GrabFood delivery':
944
- return `${t('order.deliveryTitle', { company: 'GrabFood' })}`
1023
+ case 'Food Panda delivery':
1024
+ return `${t('order.deliveryTitle', { company: 'Food Panda' })}`
1025
+ case 'Grab Food delivery':
1026
+ return `${t('order.deliveryTitle', { company: 'Grab Food' })}`
945
1027
  case 'ShopeeFood delivery':
946
1028
  return `${t('order.deliveryTitle', { company: 'ShopeeFood' })}`
1029
+ case 'Deliveroo delivery':
1030
+ return `${t('order.deliveryTitle', { company: 'Deliveroo' })}`
947
1031
  case 'External delivery':
948
1032
  return `${t('order.externalDelivery')}`
949
1033
  default:
@@ -1,4 +1,4 @@
1
- import type { FdoExternalSetting } from '@entity';
1
+ import type { FdoDeliverooSettings, FdoExternalSetting } from '@entity';
2
2
  import {
3
3
  FdoRestaurantFeedmeDelivery,
4
4
  FdoGrabfoodSettings,
@@ -67,6 +67,14 @@ function initShopeefoodDelivery(): FdoShopeeFoodSettings {
67
67
  }
68
68
  }
69
69
 
70
+ function initDeliverooDelivery(): FdoDeliverooSettings {
71
+ return {
72
+ enable: false,
73
+ merchantID: '',
74
+ catalogId: null,
75
+ autoCloseBill: false
76
+ }
77
+ }
70
78
  function initExternalDelivery(): FdoExternalSetting {
71
79
  return {
72
80
  _id: '',
@@ -87,5 +95,6 @@ export default {
87
95
  initFoodpandaDelivery,
88
96
  initGrabfoodDelivery,
89
97
  initShopeefoodDelivery,
98
+ initDeliverooDelivery,
90
99
  initExternalDelivery
91
100
  }