Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for VSF 1.11 #89

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Try to make tests run
benjick committed May 5, 2020
commit 99ece39aabca8d592aba61904f2efe5a4260cf0f
9 changes: 9 additions & 0 deletions .docker/frontend/modules.ts
Original file line number Diff line number Diff line change
@@ -19,9 +19,18 @@ import { Storyblok } from './vsf-storyblok-module'

import { registerModule } from '@vue-storefront/core/lib/modules'

import { extendMappingFallback } from './vsf-mapping-fallback'
import { forProduct, forCategory, tap } from './vsf-mapping-fallback/builtin'
import { forStoryblok } from './vsf-storyblok-module/mappingFallback'

const extendUrlModule = extendMappingFallback(
tap, forProduct, forCategory, forStoryblok
)

// TODO:distributed across proper pages BEFORE 1.11
export function registerClientModules () {
registerModule(UrlModule)
registerModule(extendUrlModule)
registerModule(CatalogModule)
registerModule(CheckoutModule) // To Checkout
registerModule(CartModule)
2 changes: 1 addition & 1 deletion .docker/vsf-mapping-fallback
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -79,6 +79,7 @@ services:
- './theme/components/storyblok:/var/www/src/themes/default/components/storyblok'
- './theme/head.js:/var/www/src/themes/default/head.js'
- './theme/index.js:/var/www/src/themes/default/index.js'
- './.docker/vsf-mapping-fallback:/var/www/src/modules/vsf-mapping-fallback'
# Module
- './packages/vsf-storyblok-module:/var/www/src/modules/vsf-storyblok-module:delegated'
healthcheck:
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
</template>

<script>
import { Blok } from '.'
import { Blok } from '..'

export default {
name: 'DebugBlok',
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
</template>

<script>
import { Blok } from '.'
import { Blok } from '..'

export default {
extends: Blok,
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
</template>

<script>
import { Blok } from '.'
import { Blok } from '..'

export default {
extends: Blok,
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
</template>

<script>
import { Blok } from '.'
import { Blok } from '..'

export default {
name: 'TileBlok',
8 changes: 4 additions & 4 deletions packages/vsf-storyblok-module/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export const components = {
debug: () => import('./Debug.vue'),
page: () => import('./Page.vue'),
grid: () => import('./Grid.vue'),
tile: () => import('./Tile.vue')
debug: () => import('./defaults/Debug.vue'),
page: () => import('./defaults/Page.vue'),
grid: () => import('./defaults/Grid.vue'),
tile: () => import('./defaults/Tile.vue'),
}

export function add (key: string, component: any, options: any = {}) {
4 changes: 2 additions & 2 deletions packages/vsf-storyblok-module/store/actions.ts
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ import { TaskQueue } from '@vue-storefront/core/lib/sync'
import qs from 'qs'

const fetchStory = async url => {
const { result: { story } }: any = await TaskQueue.execute({
const { result: story }: any = await TaskQueue.execute({
url,
payload: {
headers: { 'Content-Type': 'application/json' },
@@ -66,7 +66,7 @@ export const actions: ActionTree<StoryblokState, RootState> = {
return cachedStory
}

const url = `${config.storyblok.endpoint}/story/${key}`
const url = `${config.storyblok.endpoint}/story/${key}`.replace(/([^:]\/)\/+/g, "$1")
const story = await fetchStory(url)

commit('setStory', { key, story })
5 changes: 2 additions & 3 deletions theme/components/storyblok/RichText.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<template>
<div>
<sb-rich-text v-if="item.text" :text="item.text" />
</div>
<sb-rich-text v-if="item.text" :text="item.text" />
</template>

<script>
import { Blok } from 'src/modules/vsf-storyblok-module/components'

export default {
name: 'RichTextBlok',
extends: Blok
1 change: 1 addition & 0 deletions theme/components/storyblok/index.ts
Original file line number Diff line number Diff line change
@@ -4,5 +4,6 @@ add('hero', () => import('./Hero.vue'))
add('Image', () => import('./Image.vue'))
add('RichText', () => import('./RichText.vue'))
add('ciLink', () => import('./Link.vue'))
add('RichText', () => import('./RichText.vue'))
// Overwrite an existing component
// add('tile', () => import('./Tile.vue'), { force: true })