Skip to content

Commit

Permalink
Merge branch 'release/v6.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
demtario committed Mar 12, 2024
2 parents ee371a3 + 8f65784 commit cdbb490
Show file tree
Hide file tree
Showing 167 changed files with 6,373 additions and 2,289 deletions.
19 changes: 19 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
image: node:16-buster

stages:
- trigger
- test
- build
- deploy
Expand Down Expand Up @@ -58,3 +59,21 @@ test-e2e:
expire_in: 1 day
rules:
- when: manual

trigger-***REMOVED***-repo:
stage: trigger
rules:
- if: $CI_COMMIT_REF_NAME == $MPTECH_TRIGGER_BRANCH
when: always
- if: $CI_COMMIT_TAG
when: always
script:
- if [ "$CI_COMMIT_TAG" != "" ]; then
export IMAGE_NAME=$CI_COMMIT_TAG;
export TARGET_BRANCH=$CI_COMMIT_TAG;
else
export IMAGE_NAME=$MPTECH_IMAGE_NAME;
export TARGET_BRANCH=$CI_COMMIT_BRANCH;
fi
- apt update -y && apt install -y curl
- curl -X POST -F token=$MPTECH_TRIGGER_TOKEN -F ref=main -F variables[IMAGE_NAME]=$IMAGE_NAME -F variables[CI_BRANCH]=$TARGET_BRANCH "***REMOVED***/api/v4/projects/928/trigger/pipeline"
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<meta name="apple-mobile-web-app-title" content="Heseya" />
<meta name="msapplication-TileImage" content="/img/mstile-150x150.png" />
<meta name="msapplication-TileColor" content="#8f022c" />
<script>
window.apiUrl = 'REPLACE_ME_API_URL'
</script>
</head>
<body>
<noscript>
Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "store-admin",
"version": "5.3.1",
"version": "6.0.0",
"private": true,
"description": "Admin panel for Heseya Store API",
"author": "Heseya",
"scripts": {
"dev": "vite --port 8080",
"dev": "vite --port 8080 --force",
"serve": "yarn dev",
"build": "vite build",
"preview": "vite preview",
Expand All @@ -15,10 +15,11 @@
"lint:eslint": "eslint --ext .js,.ts,.vue ./src",
"lint:vue": "vue-tsc --noEmit",
"lint": "yarn lint:eslint && yarn lint:vue",
"lint:eslint:fix": "eslint --ext .js,.ts,.vue --fix ./src"
"lint:eslint:fix": "eslint --ext .js,.ts,.vue --fix ./src",
"postinstall": "patch-package"
},
"dependencies": {
"@heseya/store-core": "5.3.0",
"@heseya/store-core": "6.0.0",
"@sentry/tracing": "^7.6.0",
"@sentry/vue": "^7.6.0",
"ant-design-vue": "^1.7.8",
Expand All @@ -32,6 +33,8 @@
"date-fns": "^2.28.0",
"flat": "^5.0.2",
"lodash": "^4.17.21",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"qr-scanner": "^1.4.1",
"register-service-worker": "^1.7.2",
"slugify": "^1.6.5",
Expand All @@ -47,7 +50,6 @@
"vue-meta": "^2.4.0",
"vue-router": "^3.5.4",
"vue-toast-notification": "^0.6.3",
"vue-typed-mixins": "^0.2.0",
"vue-xlsx": "^0.2.1",
"vuedraggable": "^2.24.3",
"vuex": "^3.6.2",
Expand Down
12 changes: 12 additions & 0 deletions patches/moment+2.29.4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/node_modules/moment/package.json b/node_modules/moment/package.json
index 6c1205c..3eb02b5 100644
--- a/node_modules/moment/package.json
+++ b/node_modules/moment/package.json
@@ -23,7 +23,6 @@
"ender"
],
"main": "./moment.js",
- "jsnext:main": "./dist/moment.js",
"typings": "./moment.d.ts",
"typesVersions": {
">=3.1": {
Binary file added public/img/unknown-flag.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 8 additions & 34 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<main class="app__content">
<transition name="fade" mode="out-in">
<router-view :key="$route.path" />
<router-view :key="viewKey" />
</transition>
</main>

Expand Down Expand Up @@ -39,7 +39,7 @@
import { defineComponent } from 'vue'
import { first } from 'lodash'
import pkg from '../package.json'
import { init as initMicroApps, onMounted, openCommunicationChannel } from 'bout'
import { init as initMicroApps } from 'bout'
import DesktopNavigation from './components/root/DesktopNavigation.vue'
import MobileNavigation from './components/root/MobileNavigation.vue'
Expand All @@ -50,7 +50,6 @@ import FloatingQrScanner from './components/modules/qrCode/FloatingScanner.vue'
import OfflineBanner from './components/root/OfflineBanner.vue'
import { onTokensSync } from './utils/authSync'
import { getApiURL } from './utils/api'
export default defineComponent({
metaInfo: {
Expand All @@ -69,18 +68,15 @@ export default defineComponent({
FloatingQrScanner,
},
computed: {
viewKey(): string {
return `${this.$accessor.config.apiLanguage}:${this.$route.path}`
},
isLoading(): boolean {
return this.$accessor.loading
},
isNavHidden(): boolean {
return !!this.$route.meta?.hiddenNav || false
},
tokenChannel() {
return openCommunicationChannel('Token')
},
mainChannel() {
return openCommunicationChannel('Main')
},
currentYear(): string {
return new Date().getFullYear().toString()
},
Expand All @@ -93,38 +89,16 @@ export default defineComponent({
'$accessor.auth.permissionsError'(_permissionsError) {
this.$toast.error(this.$t('noPermissionError') as string)
},
'$accessor.auth.getIdentityToken'(token: string) {
this.tokenChannel.emit('set', token)
},
'$i18n.locale'(locale: string) {
this.mainChannel.emit('uiLanguage:set', locale)
},
},
created() {
initMicroApps()
this.$accessor.config.fetchSettings()
this.$accessor.config.fetchCurrencies()
this.$accessor.salesChannels.fetch()
this.$accessor.config.initLanguages()
this.$accessor.menuItems.initMicrofrontendMenuItems()
if (this.$accessor.auth.isLogged) this.$accessor.auth.fetchProfile()
// MicroFrontend Events Start
onMounted(() => {
this.mainChannel.emit('init', {
coreUrl: getApiURL(),
token: this.$accessor.auth.getIdentityToken,
user: this.$accessor.auth.user,
uiLanguage: this.$i18n.locale,
})
})
this.tokenChannel.on<undefined>('refresh', async () => {
const { identityToken } = await this.$accessor.auth.refreshToken()
return identityToken
})
// MicroFrontend Events End
// MultiTabs Token Sync Start
onTokensSync(async (tokens) => {
if (tokens) {
Expand Down
7 changes: 4 additions & 3 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import router from './router'
import { getApiURL } from './utils/api'
import { broadcastTokensUpdate } from './utils/authSync'
import { createHeseyaApiService } from '@heseya/store-core'
import { trimSlash } from './utils/trimSlash'

const CORE_API_URL = getApiURL()

Expand All @@ -16,7 +17,7 @@ type OnRefreshFunction = (
) => void

export const createApiInstance = (baseURL: string, useAccessToken = true) => {
const apiInstance = axios.create({ baseURL })
const apiInstance = axios.create({ baseURL: trimSlash(baseURL) })

let isRefreshing = false
let subscribers: OnRefreshFunction[] = []
Expand All @@ -38,8 +39,8 @@ export const createApiInstance = (baseURL: string, useAccessToken = true) => {
config.headers.Authorization = `Bearer ${token}`

config.headers['Cache-Control'] = 'no-cache, no-store'
config.headers['X-Core-Url'] = CORE_API_URL
config.headers['X-Language'] = 'pl'
config.headers['X-Core-Url'] = trimSlash(CORE_API_URL)
if (accessor.config.apiLanguage) config.headers['Accept-Language'] = accessor.config.apiLanguage

return config
})
Expand Down
1 change: 1 addition & 0 deletions src/components/Autocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export default defineComponent({
.autocomplete {
&__label {
font-size: 0.8em;
margin-bottom: 3px;
}
&__items {
Expand Down
12 changes: 6 additions & 6 deletions src/components/AutocompleteInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import { api } from '@/api'
import Empty from '@/components/layout/Empty.vue'
import { UUID } from '@/interfaces/UUID'
import { SelectType } from '@/enums/select'
import { stringifyQueryParams } from '@/utils/stringifyQuery'
interface BaseItem {
id: UUID
Expand Down Expand Up @@ -145,13 +146,13 @@ export default defineComponent({
options(): BaseItem[] {
if (this.mode === this.SelectType.Multiple)
return (
uniqBy([...this.multiOptionsIds, ...this.searchedOptions], 'id').filter(
uniqBy([...this.multiOptionsIds, ...this.searchedOptions], this.propMode || 'id').filter(
(item) => !this.bannedSetIds.includes(item.id),
) || []
)
else
return (
uniqBy([...this.searchedOptions], 'id').filter(
uniqBy([...this.searchedOptions], this.propMode || 'id').filter(
(item) => !this.bannedSetIds.includes(item.id),
) || []
)
Expand Down Expand Up @@ -186,13 +187,12 @@ export default defineComponent({
}
},
async fetchItems(query: string = '') {
async fetchItems(search: string = '') {
this.isLoading = true
const query = stringifyQueryParams({ search, limit: this.limit, lang_fallback: 'any' })
const {
data: { data: data },
} = await api.get<{ data: BaseItem[] }>(
`/${this.modelUrl}?search=${query}&limit=${this.limit}`,
)
} = await api.get<{ data: BaseItem[] }>(`/${this.modelUrl}${query}`)
this.searchedOptions = data
Expand Down
64 changes: 64 additions & 0 deletions src/components/CountriesSelect.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<template>
<validated-select
v-model="selected"
:options="countries"
option-key="code"
:disabled="disabled"
:loading="isLoading"
mode="multiple"
:label="label"
option-filter-prop="label"
filter-option
:rules="{ required: !blockList && value.length === 0 }"
/>
</template>

<script lang="ts">
import { PropType, defineComponent } from 'vue'
import { ShippingCountry } from '@heseya/store-core'
import { sdk } from '@/api'
export default defineComponent({
props: {
value: {
type: Array as PropType<string[]>,
default: () => [],
},
blockList: {
type: Boolean,
default: false,
},
disabled: {
type: Boolean,
default: false,
},
label: {
type: String,
default: () => '',
},
},
data: () => ({
isLoading: false,
countries: [] as ShippingCountry[],
}),
computed: {
selected: {
get() {
return this.value
},
set(value: string[]) {
this.$emit('input', value)
},
},
},
async created() {
this.isLoading = true
const countries = await sdk.ShippingMethods.getCountries()
this.countries = countries.sort((a, b) => a.name.localeCompare(b.name))
this.isLoading = false
},
})
</script>
Loading

0 comments on commit cdbb490

Please sign in to comment.