@feedmepos/mf-order-setting 0.0.15-alpha.1 → 0.0.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-order-setting",
3
- "version": "0.0.15-alpha.1",
3
+ "version": "0.0.16",
4
4
  "type": "module",
5
5
  "module": "./dist/app.js",
6
6
  "license": "UNLICENSED",
package/src/Entry.vue CHANGED
@@ -17,7 +17,7 @@ onMounted(async () => {
17
17
  parent.postMessage({ event: 'ready' }, '*')
18
18
  }
19
19
 
20
- const loader = new Loader(import.meta.env.VITE_GOOGLE_MAP_API_KEY, {
20
+ const loader = new Loader(appApi.googleMap, {
21
21
  libraries: ['places']
22
22
  })
23
23
 
@@ -31,7 +31,7 @@ onMounted(async () => {
31
31
  <div v-if="!state.isIframe" style="height: 64px">
32
32
  <FmNavBar />
33
33
  </div>
34
- <App/>
34
+ <App />
35
35
  </div>
36
36
  </template>
37
37
 
@@ -101,7 +101,7 @@ export const useRestaurantStore = defineStore('restaurant', {
101
101
  await remoteOrderApi.integratedDelivery.updateInhouse(restaurantId, dto)
102
102
  },
103
103
  async updateFeedmeDelivery(restaurantId: string, dto: FdoRestaurantFeedmeDelivery) {
104
- await remoteOrderApi.integratedDelivery.updateFeedme(restaurantId, dto)
104
+ return await remoteOrderApi.integratedDelivery.updateFeedme(restaurantId, dto)
105
105
  },
106
106
  async updateIntegratedFoodpandaDelivery(restaurantId: string, dto: FdoFoodpandaSettings) {
107
107
  await remoteOrderApi.integratedDelivery.updateFoodpanda(restaurantId, dto)
@@ -126,7 +126,7 @@ export const useRestaurantStore = defineStore('restaurant', {
126
126
  })
127
127
 
128
128
  if (!validPosVersion)
129
- return t('order.payoutPosVersion', {version: Pos.minVersionToUse(F_FEATURE.enum.qrEPayment)})
129
+ return t('order.payoutPosVersion', { version: Pos.minVersionToUse(F_FEATURE.enum.qrEPayment) })
130
130
  if (!payoutAccount || !payoutAccount.enable) {
131
131
  return t('order.payoutAccountIsRequired')
132
132
  }
@@ -746,11 +746,16 @@ async function updateIntegratedDeliverySetting() {
746
746
 
747
747
  async function updateFeedmeExpressSetting() {
748
748
  sideSheetIntegrated.value = false
749
- await restaurantStore.updateFeedmeDelivery(currentRestaurant.value?._id ?? '', feedMeDoc.value)
750
- const res = (await readRestaurants())?.find((res) => res._id === currentRestaurant.value?._id)
751
- if (!!res) {
752
- changeRestaurant(res)
753
- }
749
+
750
+ await startAsyncCallWithErr(async () => {
751
+ const restaurant = await restaurantStore.updateFeedmeDelivery(
752
+ currentRestaurant.value?._id ?? '',
753
+ feedMeDoc.value
754
+ )
755
+ if (!!currentRestaurant.value?.feedmeDelivery) {
756
+ currentRestaurant.value.feedmeDelivery = restaurant.feedmeDelivery
757
+ }
758
+ })
754
759
  showSuccess('Delivery setting updated. ')
755
760
  }
756
761
 
@@ -759,7 +764,7 @@ async function updateInHouseSetting() {
759
764
  await restaurantStore.updateInhouseDelivery(currentRestaurant.value?._id ?? '', inHouseDoc.value)
760
765
  const res = (await readRestaurants())?.find((res) => res._id === currentRestaurant.value?._id)
761
766
  if (!!res) {
762
- changeRestaurant(res)
767
+ await changeRestaurant(res)
763
768
  }
764
769
  showSuccess('Delivery setting updated. ')
765
770
  }
@@ -800,11 +805,6 @@ async function updateDelivery(
800
805
  break
801
806
  }
802
807
  }
803
-
804
- const res = (await readRestaurants())?.find((res) => res._id === currentRestaurant.value?._id)
805
- if (!!res) {
806
- changeRestaurant(res)
807
- }
808
808
  }
809
809
 
810
810
  const feedMeDoc = computed(() => feedMeComponentProps.value.initialValue)
@@ -876,7 +876,6 @@ function convertIntegratedCompanyName(name: companyName): string {
876
876
 
877
877
  watch(
878
878
  () => currentRestaurant.value,
879
-
880
879
  async (newRestaurant) => {
881
880
  if (newRestaurant) {
882
881
  await readData()
@@ -247,7 +247,10 @@ watch(
247
247
  () => currentRestaurant.value,
248
248
  async (newValue) => {
249
249
  if (newValue) {
250
- const restaurantSetting = restaurantStore.restaurantSettings[newValue._id]
250
+ let restaurantSetting = restaurantStore.restaurantSettings[newValue._id]
251
+ if (!restaurantSetting) {
252
+ restaurantSetting = await restaurantStore.readRestaurantSetting(newValue._id)
253
+ }
251
254
  initialize(restaurantSetting)
252
255
  await startAsyncCallWithErr(tableSettingStore.readTables)
253
256
  }
package/vite.config.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import { fileURLToPath, URL } from 'node:url'
2
- import { defineConfig } from 'vite'
2
+ import { defineConfig, loadEnv } from 'vite'
3
3
  import vue from '@vitejs/plugin-vue'
4
4
  import { fmmfVitePresent } from "@feedmepos/mf-common/vite-preset";
5
5
 
6
6
 
7
7
  // https://vitejs.dev/config/
8
8
  export default defineConfig((env) => {
9
+ process.env = { ...process.env, ...loadEnv(env.mode, process.cwd(), "") }
9
10
  const config = {
10
11
  plugins: [vue()],
11
12
  resolve: {
@@ -18,10 +19,9 @@ export default defineConfig((env) => {
18
19
  },
19
20
  define: {
20
21
  devInfo: JSON.stringify({
21
-
22
22
  }),
23
23
  appApi: JSON.stringify({
24
- googleMap: process.env.GOOGLE_MAP_API_KEY,
24
+ googleMap: process.env.VITE_GOOGLE_MAP_API_KEY,
25
25
  firebase: {
26
26
  apiKey: process.env.FIREBASE_API_KEY,
27
27
  authDomain: process.env.FIREBASE_AUTH_DOMAIN,
@@ -1,4 +0,0 @@
1
- import { _ as f } from "./app-Cu7GdqUm.js";
2
- export {
3
- f as default
4
- };