Skip to content

Commit

Permalink
Merge pull request #2241 from lukeromanowicz/refactor/move-multistore…
Browse files Browse the repository at this point in the history
…-from-store-to-core-lib

Move multistore from store to core lib
  • Loading branch information
filrak committed Jan 21, 2019
2 parents 1574109 + b91e84b commit 2cb89e0
Show file tree
Hide file tree
Showing 39 changed files with 42 additions and 39 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Location of type files (#2226)
- Support regional characters in urls
- `store/lib/search` has been moved to `core/lib/search` (#2225)
- `store/lib/multistore` has been moved to `core/lib/multistore` (#2224)

## [1.6.0] - 2018.12.05

Expand Down
2 changes: 1 addition & 1 deletion core/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { getApolloProvider } from './scripts/resolvers/resolveGraphQL'
import { registerTheme } from '@vue-storefront/core/lib/themes'
import { themeEntry } from 'theme/index.js'
import { registerModules } from '@vue-storefront/core/lib/module'
import { prepareStoreView } from '@vue-storefront/store/lib/multistore'
import { prepareStoreView } from '@vue-storefront/core/lib/multistore'

import * as coreMixins from '@vue-storefront/core/mixins'
import * as coreFilters from '@vue-storefront/core/filters'
Expand Down
2 changes: 1 addition & 1 deletion core/client-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import buildTimeConfig from 'config'
import { execute } from '@vue-storefront/core/lib/sync/task'
import UniversalStorage from '@vue-storefront/store/lib/storage'
import i18n from '@vue-storefront/i18n'
import { prepareStoreView, storeCodeFromRoute, currentStoreView, localizedRoute } from '@vue-storefront/store/lib/multistore'
import { prepareStoreView, storeCodeFromRoute, currentStoreView, localizedRoute } from '@vue-storefront/core/lib/multistore'
import { onNetworkStatusChange } from '@vue-storefront/core/modules/offline-order/helpers/onNetworkStatusChange'
import '@vue-storefront/core/service-worker/registration' // register the service worker

Expand Down
2 changes: 1 addition & 1 deletion core/filters/date.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'

/**
* Converts date to format provided as an argument or defined in config file (if argument not provided)
Expand Down
2 changes: 1 addition & 1 deletion core/filters/price.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'

/**
* Converts number to price string
Expand Down
2 changes: 1 addition & 1 deletion core/helpers/initCacheStorage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as localForage from 'localforage'
import UniversalStorage from '@vue-storefront/store/lib/storage'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'
import rootStore from '@vue-storefront/store'

/** Inits cache storage for given module. By default via local storage */
Expand Down
2 changes: 1 addition & 1 deletion core/lib/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import merge from 'lodash-es/merge'
import RootState from '@vue-storefront/core/types/RootState'
import rootStore from '@vue-storefront/store'
import { Logger } from '@vue-storefront/core/lib/logger'
import { setupMultistoreRoutes } from '@vue-storefront/store/lib/multistore'
import { setupMultistoreRoutes } from './multistore'
import { router } from '@vue-storefront/core/app'

export interface VueStorefrontModuleConfig {
Expand Down
4 changes: 2 additions & 2 deletions core/store/lib/multistore.ts → core/lib/multistore.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import rootStore from '../'
import rootStore from '../store'
import { loadLanguageAsync } from '@vue-storefront/i18n'
import { initializeSyncTaskStorage } from '@vue-storefront/core//lib/sync/task'
import { initializeSyncTaskStorage } from './sync/task'
import Vue from 'vue'

export function currentStoreView () {
Expand Down
3 changes: 2 additions & 1 deletion core/lib/search.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Vue from 'vue'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'

import { currentStoreView } from '@vue-storefront/core/lib/multistore'
import { sha3_224 } from 'js-sha3'
import rootStore from '@vue-storefront/store'
import { getSearchAdapter } from './search/adapter/searchAdapterFactory'
Expand Down
2 changes: 1 addition & 1 deletion core/lib/search/adapter/api/searchAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import rootStore from '@vue-storefront/store'
import { prepareElasticsearchQueryBody } from './elasticsearchQuery'
import fetch from 'isomorphic-fetch'
import { slugify } from '@vue-storefront/core/helpers'
import { currentStoreView, prepareStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView, prepareStoreView } from '../../../multistore'
import SearchQuery from '@vue-storefront/core/lib/search/searchQuery'
import HttpQuery from '@vue-storefront/core/types/search/HttpQuery'
import { SearchResponse } from '@vue-storefront/core/types/search/SearchResponse'
Expand Down
2 changes: 1 addition & 1 deletion core/lib/search/adapter/graphql/searchAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import rootStore from '@vue-storefront/store'
import { prepareQueryVars } from './gqlQuery'
import { currentStoreView, prepareStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView, prepareStoreView } from '../../../multistore'
import fetch from 'isomorphic-fetch'
import {processESResponseType, processProductsType, processCmsType} from './processor/processType'
import SearchQuery from '../../searchQuery'
Expand Down
2 changes: 1 addition & 1 deletion core/lib/sync/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Logger } from '@vue-storefront/core/lib/logger'
import { execute as taskExecute, _prepareTask } from './task'
import * as localForage from 'localforage'
import UniversalStorage from '@vue-storefront/store/lib/storage'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '../multistore'

/** Syncs given task. If user is offline requiest will be sent to the server after restored connection */
function queue (task) {
Expand Down
2 changes: 1 addition & 1 deletion core/lib/sync/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import toString from 'lodash-es/toString'
import fetch from 'isomorphic-fetch'
import * as localForage from 'localforage'
import rootStore from '@vue-storefront/store'
import { adjustMultistoreApiUrl, currentStoreView } from '@vue-storefront/store/lib/multistore'
import { adjustMultistoreApiUrl, currentStoreView } from '@vue-storefront/core/lib/multistore'
import Task from '@vue-storefront/core/lib/sync/types/Task'
import { Logger } from '@vue-storefront/core/lib/logger'
import { TaskQueue } from '@vue-storefront/core/lib/sync'
Expand Down
2 changes: 1 addition & 1 deletion core/mixins/multistore.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { localizedRoute as localizedRouteHelper, currentStoreView } from '@vue-storefront/store/lib/multistore'
import { localizedRoute as localizedRouteHelper, currentStoreView } from '@vue-storefront/core/lib/multistore'

export const multistore = {
methods: {
Expand Down
2 changes: 1 addition & 1 deletion core/modules/cart/hooks/beforeRegistration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as localForage from 'localforage'
import UniversalStorage from '@vue-storefront/store/lib/storage'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'

export function beforeRegistration(Vue, config, store, isServer) {
const storeView = currentStoreView()
Expand Down
2 changes: 1 addition & 1 deletion core/modules/cart/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as types from './mutation-types'
import rootStore from '@vue-storefront/store'
import i18n from '@vue-storefront/i18n'
import { sha3_224 } from 'js-sha3'
import { currentStoreView, localizedRoute} from '@vue-storefront/store/lib/multistore'
import { currentStoreView, localizedRoute} from '@vue-storefront/core/lib/multistore'
import omit from 'lodash-es/omit'
import RootState from '@vue-storefront/core/types/RootState'
import CartState from '../types/CartState'
Expand Down
2 changes: 1 addition & 1 deletion core/modules/catalog/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import union from 'lodash-es/union'
// TODO: Remove this dep
import { optionLabel } from './optionLabel'
import i18n from '@vue-storefront/i18n'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'
import { getThumbnailPath } from '@vue-storefront/core/helpers'

function _filterRootProductByStockitem (context, stockItem, product, errorCallback) {
Expand Down
2 changes: 1 addition & 1 deletion core/modules/catalog/hooks/beforeRegistration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as localForage from 'localforage'
import UniversalStorage from '@vue-storefront/store/lib/storage'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'

export function beforeRegistration(Vue, config, store, isServer) {
const storeView = currentStoreView()
Expand Down
3 changes: 2 additions & 1 deletion core/modules/catalog/store/category/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { optionLabel } from '../../helpers/optionLabel'
import RootState from '@vue-storefront/core/types/RootState'
import CategoryState from '../../types/CategoryState'
import SearchQuery from '@vue-storefront/core/lib/search/searchQuery'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'


const actions: ActionTree<CategoryState, RootState> = {
/**
Expand Down
2 changes: 1 addition & 1 deletion core/modules/catalog/store/product/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Vue from 'vue'
import { ActionTree } from 'vuex'
import * as types from './mutation-types'
import { breadCrumbRoutes, productThumbnailPath } from '@vue-storefront/core/helpers'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'
import { configureProductAsync,
doPlatformPricesSync,
filterOutUnavailableVariants,
Expand Down
2 changes: 1 addition & 1 deletion core/modules/checkout/hooks/beforeRegistration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as localForage from 'localforage'
import UniversalStorage from '@vue-storefront/store/lib/storage'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'

export function beforeRegistration(Vue, config, store, isServer) {
const storeView = currentStoreView()
Expand Down
2 changes: 1 addition & 1 deletion core/modules/cms/hooks/beforeRegistration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as localForage from 'localforage'
import UniversalStorage from '@vue-storefront/store/lib/storage'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'

export function beforeRegistration(Vue, config, store, isServer) {
const storeView = currentStoreView()
Expand Down
2 changes: 1 addition & 1 deletion core/modules/compare/hooks/beforeRegistration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as localForage from 'localforage'
import UniversalStorage from '@vue-storefront/store/lib/storage'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'

export function beforeRegistration(Vue, config, store, isServer) {
const storeView = currentStoreView()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import store from '@vue-storefront/store'
import EventBus from '@vue-storefront/core/compatibility/plugins/event-bus/index'

import UniversalStorage from '@vue-storefront/store/lib/storage'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'

export function onNetworkStatusChange (store) {
console.log('Are we online: ' + navigator.onLine)
Expand Down
2 changes: 1 addition & 1 deletion core/modules/order/store/actions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Vue from 'vue'
import * as types from './mutation-types'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'
import { ActionTree } from 'vuex'
import RootState from '@vue-storefront/core/types/RootState'
import OrderState from '../types/OrderState'
Expand Down
2 changes: 1 addition & 1 deletion core/modules/review/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Vue from 'vue'
import { ActionTree } from 'vuex'
import { quickSearchByQuery } from '@vue-storefront/core/lib/search'
import SearchQuery from '@vue-storefront/core/lib/search/searchQuery'
import { adjustMultistoreApiUrl } from '@vue-storefront/store/lib/multistore'
import { adjustMultistoreApiUrl } from '@vue-storefront/core/lib/multistore'
import RootState from '@vue-storefront/core/types/RootState'
import ReviewState from '../types/ReviewState'
import * as types from './mutation-types'
Expand Down
2 changes: 1 addition & 1 deletion core/modules/user/hooks/beforeRegistration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as localForage from 'localforage'
import UniversalStorage from '@vue-storefront/store/lib/storage'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'

export function beforeRegistration(Vue, config, store, isServer) {
const storeView = currentStoreView()
Expand Down
2 changes: 1 addition & 1 deletion core/modules/user/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ActionTree } from 'vuex'
import * as types from './mutation-types'
import rootStore from '@vue-storefront/store'
import i18n from '@vue-storefront/i18n'
import { adjustMultistoreApiUrl } from '@vue-storefront/store/lib/multistore'
import { adjustMultistoreApiUrl } from '@vue-storefront/core/lib/multistore'
import RootState from '@vue-storefront/core/types/RootState'
import UserState from '../types/UserState'
import { Logger } from '@vue-storefront/core/lib/logger'
Expand Down
2 changes: 1 addition & 1 deletion core/pages/Category.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import store from '@vue-storefront/store'
import EventBus from '@vue-storefront/core/compatibility/plugins/event-bus'
import { baseFilterProductsQuery, buildFilterProductsQuery } from '@vue-storefront/core/helpers'
import { htmlDecode } from '@vue-storefront/core/filters/html-decode'
import { currentStoreView, localizedRoute } from '@vue-storefront/store/lib/multistore'
import { currentStoreView, localizedRoute } from '@vue-storefront/core/lib/multistore'
import Composite from '@vue-storefront/core/mixins/composite'
import { Logger } from '@vue-storefront/core/lib/logger'
import { mapGetters, mapActions } from 'vuex'
Expand Down
2 changes: 1 addition & 1 deletion core/pages/Checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import VueOfflineMixin from 'vue-offline/mixin'
import { mapGetters } from 'vuex'

import Composite from '@vue-storefront/core/mixins/composite'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'

export default {
name: 'Checkout',
Expand Down
2 changes: 1 addition & 1 deletion core/pages/Product.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { mapGetters } from 'vuex'
import store from '@vue-storefront/store'
import EventBus from '@vue-storefront/core/compatibility/plugins/event-bus'
import { htmlDecode } from '@vue-storefront/core/filters'
import { currentStoreView, localizedRoute } from '@vue-storefront/store/lib/multistore'
import { currentStoreView, localizedRoute } from '@vue-storefront/core/lib/multistore'
import { CompareProduct } from '@vue-storefront/core/modules/compare/components/Product.ts'
import { AddToCompare } from '@vue-storefront/core/modules/compare/components/AddToCompare.ts'
import { isOptionAvailableAsync } from '@vue-storefront/core/modules/catalog/helpers/index'
Expand Down
2 changes: 1 addition & 1 deletion core/server-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import union from 'lodash-es/union'

import { createApp } from '@vue-storefront/core/app'
import { HttpError } from '@vue-storefront/core/helpers/exceptions'
import { prepareStoreView, storeCodeFromRoute } from '@vue-storefront/store/lib/multistore'
import { prepareStoreView, storeCodeFromRoute } from '@vue-storefront/core/lib/multistore'
import omit from 'lodash-es/omit'
import pick from 'lodash-es/pick'
import buildTimeConfig from 'config'
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/upgrade-notes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ We're trying to keep the upgrade process as easy as it's possible. Unfortunately
## 1.7 -> next
- `store/types` have been moved to new module called `core/types`.
- `store/lib/search` has been moved to `core/lib/search`.

- `store/lib/multistore.ts` has been moved to `core/lib/multistore.ts`

## 1.6 -> 1.7

Expand Down
2 changes: 1 addition & 1 deletion src/modules/claims/hooks/beforeRegistration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as localForage from 'localforage'
import UniversalStorage from '@vue-storefront/store/lib/storage'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'

export function beforeRegistration(Vue, config, store, isServer) {
const storeView = currentStoreView()
Expand Down
2 changes: 1 addition & 1 deletion src/modules/magento-2-cms/components/CmsData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<script>
import store from '@vue-storefront/store'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'
export default {
name: 'CmsData',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import { getSearchAdapter } from '@vue-storefront/core/lib/search/adapter/searchAdapterFactory'
import { processESResponseType } from '@vue-storefront/core/lib/search/adapter/graphql/processor/processType'
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'
import SearchQuery from '@vue-storefront/core/lib/search/searchQuery'

const EXTENSION_KEY = 'sample-custom-entity-graphql-extension'
Expand Down
2 changes: 1 addition & 1 deletion src/themes/default-amp/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setupMultistoreRoutes } from '@vue-storefront/store/lib/multistore'
import { setupMultistoreRoutes } from '@vue-storefront/core/lib/multistore'
import config from 'config'
import routes from './router'

Expand Down
2 changes: 1 addition & 1 deletion src/themes/default/components/core/LanguageSwitcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</template>

<script>
import { currentStoreView } from '@vue-storefront/store/lib/multistore'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'
const ModalSwitcher = () => import(/* webpackChunkName: "vsf-languages-modal" */ 'theme/components/core/blocks/Switcher/Language.vue')
export default {
Expand Down
2 changes: 1 addition & 1 deletion src/themes/default/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setupMultistoreRoutes } from '@vue-storefront/store/lib/multistore'
import { setupMultistoreRoutes } from '@vue-storefront/core/lib/multistore'
import App from './App.vue'
import routes from './router'
import Vue from 'vue'
Expand Down

0 comments on commit 2cb89e0

Please sign in to comment.