Skip to content

Commit 6e08248

Browse files
authored
Merge pull request #57 from contentstack/feat/ECO-2972-azure-eu
feat:updated ts support and azure eu support [ECO-2972]
2 parents 1f9dd24 + 6339402 commit 6e08248

28 files changed

+762
-494
lines changed

package-lock.json

Lines changed: 111 additions & 105 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "contentstack-vuejs-starter-app",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"description": "A simple starter app build using VueJS and Contentstack",
55
"author": "Contentstack",
66
"license": "MIT",
@@ -13,31 +13,31 @@
1313
},
1414
"dependencies": {
1515
"@alenaksu/json-viewer": "^2.0.0",
16-
"@contentstack/live-preview-utils": "^1.2.1",
17-
"@contentstack/utils": "^1.1.3",
18-
"contentstack": "^3.15.4",
19-
"core-js": "^3.26.0",
16+
"@contentstack/live-preview-utils": "^1.3.2",
17+
"@contentstack/utils": "^1.3.0",
18+
"contentstack": "^3.17.1",
19+
"core-js": "^3.30.2",
2020
"moment": "^2.29.4",
2121
"register-service-worker": "^1.7.2",
22-
"vue": "^3.2.41",
22+
"vue": "^3.3.4",
2323
"vue-class-component": "^8.0.0-0",
2424
"vue-json-pretty": "^2.2.3",
2525
"vue-json-tree-viewer": "^1.0.2",
2626
"vue-meta": "^2.4.0",
27-
"vue-router": "^4.1.6",
27+
"vue-router": "^4.2.2",
2828
"vue-skeletor": "^1.0.6",
2929
"vuex": "^4.1.0"
3030
},
3131
"devDependencies": {
32-
"@types/node": "^18.11.9",
32+
"@types/node": "^18.16.16",
3333
"@typescript-eslint/eslint-plugin": "^5.42.0",
3434
"@typescript-eslint/parser": "^5.42.0",
3535
"@vue/cli-plugin-babel": "~5.0.8",
3636
"@vue/cli-plugin-eslint": "~5.0.8",
3737
"@vue/cli-plugin-typescript": "~5.0.8",
3838
"@vue/cli-plugin-vuex": "~5.0.8",
3939
"@vue/cli-service": "~5.0.8",
40-
"@vue/compiler-sfc": "^3.2.37",
40+
"@vue/compiler-sfc": "^3.3.4",
4141
"@vue/eslint-config-typescript": "^11.0.2",
4242
"babel-eslint": "^10.1.0",
4343
"eslint": "^8.27.0",

src/components/AboutSectionBucket.vue

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,15 @@
3535
</template>
3636

3737
<script lang="ts">
38-
39-
import { defineComponent, PropType } from 'vue'
40-
import Data from '../typescript/data'
38+
import { defineComponent, PropType } from 'vue';
39+
import { SectionWithBuckets } from '../typescript/components';
4140
4241
export default defineComponent({
4342
props: {
44-
data:{
43+
data: {
4544
required: true,
46-
type: Object as PropType<Data>
47-
}
48-
}
45+
type: Object as PropType<SectionWithBuckets>,
46+
},
47+
},
4948
});
5049
</script>

src/components/BlogBanner.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
2121
import { defineComponent, PropType } from 'vue';
2222
import Devtools from './DevTools.vue';
23-
import Data from '../typescript/data'
23+
import {HeroBanner} from '../typescript/components'
2424
2525
export default defineComponent({
2626
props:{
2727
data:{
2828
required: true,
29-
type: Object as PropType<Data>
29+
type: Object as PropType<HeroBanner>
3030
}
3131
},
3232
components: { Devtools }

src/components/BlogSection.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@
3939

4040
<script lang="ts">
4141
42-
import Data from '../typescript/data';
42+
import {FromBlog} from '../typescript/components';
4343
import { defineComponent, PropType } from 'vue';
4444
4545
export default defineComponent({
4646
props:{
4747
data:{
4848
required: true,
49-
type: Object as PropType<Data>
49+
type: Object as PropType<FromBlog>
5050
}
5151
}
5252
});

src/components/FooterContent.vue

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<template>
2-
<footer v-if="data">
2+
<footer v-if="!!data">
33
<div class="max-width footer-div">
44
<div class="col-quarter">
55
<router-link aria-current="page" class="logo-tag" to="/">
66
<img
7+
v-if="data.logo"
78
:src="data.logo.url"
89
:alt="data.logo.title"
910
:title="data.logo.title"
@@ -13,7 +14,7 @@
1314
</div>
1415
<div class="col-half">
1516
<nav>
16-
<ul class="nav-ul">
17+
<ul class="nav-ul" v-if="data.navigation">
1718
<li
1819
v-for="index in data.navigation.link"
1920
:key="index"
@@ -28,7 +29,7 @@
2829
</div>
2930
<div class="col-quarter social-link">
3031
<div class="social-nav">
31-
<div class="social-nav">
32+
<div class="social-nav" v-if="data.social">
3233
<a
3334
v-for="socialLinks in data.social.social_share"
3435
:key="socialLinks"
@@ -49,55 +50,52 @@
4950
</template>
5051

5152
<script lang="ts">
52-
interface navFooterList {
53-
title: string;
54-
url: string;
55-
}
56-
5753
import { defineComponent } from 'vue';
58-
import Stack from '../plugins/contentstack';
5954
import { onEntryChange } from '../plugins/contentstack';
60-
import Links from '../typescript/data';
55+
import { getAllEntries, getFooter } from '../helper';
6156
6257
export default defineComponent({
6358
name: 'FooterContent',
6459
data() {
6560
return {
66-
data: null,
61+
data: {},
6762
};
6863
},
69-
created() {
70-
this.getData();
64+
async created() {
65+
try {
66+
await this.getData();
67+
} catch (error) {
68+
console.error(error);
69+
}
7170
},
7271
methods: {
7372
async getData() {
74-
const response = await Stack.getEntries({
75-
contentTypeUid: 'footer',
76-
jsonRtePath: ['copyright'],
77-
});
78-
const responsePages: [navFooterList] = await Stack.getEntries({
79-
contentTypeUid: 'page',
80-
});
81-
82-
const navFooterList = response[0].navigation.link;
83-
if (responsePages.length !== response.length) {
73+
const response = await getFooter();
74+
const responsePages = await getAllEntries();
75+
const navFooterList = response.navigation.link;
76+
if (responsePages.length !== response.navigation.link.length) {
8477
responsePages.forEach((entry) => {
85-
const fFound = response[0].navigation.link.find(
86-
(link: Links) => link.title === entry.title
78+
const fFound = response.navigation.link.find(
79+
(link) => link.title === entry.title
8780
);
8881
if (!fFound) {
8982
navFooterList.push({ title: entry.title, href: entry.url });
9083
}
9184
});
9285
}
93-
this.data = response[0];
94-
this.$store.dispatch('setFooter', response[0]);
86+
response.navigation.link = navFooterList;
87+
this.data = response;
88+
this.$store.dispatch('setFooter', response);
9589
},
9690
},
9791
mounted() {
98-
onEntryChange(() => {
92+
onEntryChange(async () => {
9993
if (process.env.VUE_APP_CONTENTSTACK_LIVE_PREVIEW === 'true') {
100-
this.getData();
94+
try {
95+
await this.getData();
96+
} catch (error) {
97+
console.error(error);
98+
}
10199
}
102100
});
103101
},

src/components/HeaderContent.vue

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<header v-if="data" class="header">
2+
<header v-if="!!data" class="header">
33
<div class="note-div" v-if="data.notification_bar.show_announcement">
44
<span
55
v-if="typeof data.notification_bar.announcement_text === 'string'"
@@ -51,16 +51,11 @@
5151
</template>
5252

5353
<script lang="ts">
54-
interface navHeaderList {
55-
title: string;
56-
url: string;
57-
}
58-
5954
import { defineComponent } from 'vue';
60-
import Stack from '../plugins/contentstack';
6155
import { onEntryChange } from '../plugins/contentstack';
6256
import Tooltip from '../components/ToolTip.vue';
63-
import Links from '../typescript/data';
57+
import { getAllEntries, getHeader } from '@/helper';
58+
import { HeaderRes } from "@/typescript/response";
6459
6560
export default defineComponent({
6661
name: 'HeaderContent',
@@ -69,27 +64,26 @@ export default defineComponent({
6964
},
7065
data() {
7166
return {
72-
data: null,
67+
data: null as HeaderRes | null,
7368
};
7469
},
75-
created() {
76-
this.getData();
70+
async created() {
71+
try {
72+
this.data = await this.getData();
73+
this.$store.dispatch('setHeader', this.data);
74+
} catch (error) {
75+
console.error(error);
76+
}
7777
},
7878
methods: {
7979
async getData() {
80-
const response = await Stack.getEntries({
81-
contentTypeUid: 'header',
82-
referenceFieldPath: `navigation_menu.page_reference`,
83-
jsonRtePath: ['notification_bar.announcement_text'],
84-
});
85-
const responsePages: [navHeaderList] = await Stack.getEntries({
86-
contentTypeUid: 'page',
87-
});
88-
const navHeaderList = response[0].navigation_menu;
89-
if (responsePages.length !== response.length) {
80+
const response = await getHeader();
81+
const responsePages = await getAllEntries();
82+
const navHeaderList = response.navigation_menu;
83+
if (responsePages.length !== response.navigation_menu.length) {
9084
responsePages.forEach((entry) => {
91-
const hFound = response[0].navigation_menu.find(
92-
(navLink: Links) => navLink.label === entry.title
85+
const hFound = response.navigation_menu.find(
86+
(navLink) => navLink.page_reference[0].title === entry.title
9387
);
9488
9589
if (!hFound) {
@@ -100,14 +94,15 @@ export default defineComponent({
10094
}
10195
});
10296
}
103-
this.data = response[0];
104-
this.$store.dispatch('setHeader', response[0]);
97+
response.navigation_menu = navHeaderList;
98+
return response;
10599
},
106100
},
107101
mounted() {
108-
onEntryChange(() => {
102+
onEntryChange(async () => {
109103
if (process.env.VUE_APP_CONTENTSTACK_LIVE_PREVIEW === 'true') {
110-
this.getData();
104+
this.data = await this.getData();
105+
this.$store.dispatch('setHeader', this.data);
111106
}
112107
});
113108
},

src/components/HeroBanner.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ interface Title {
3737
title: string;
3838
}
3939
40-
import Data from '../typescript/data';
40+
import {HeroBanner} from '../typescript/components';
4141
import { defineComponent, PropType } from 'vue';
4242
4343
export default defineComponent({
4444
4545
props:{
4646
data:{
4747
required: true,
48-
type: Object as PropType<Data>
48+
type: Object as PropType<HeroBanner>
4949
},
5050
title:{
5151
required: true,

src/components/RenderComponents.vue

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
title="home-content"
1616
:data="component.hero_banner"
1717
/>
18-
<HeroBanner
19-
v-if="component.hero_banner && page !== 'Home'"
18+
<BlogBanner
19+
v-if="component.hero_banner && page === 'Blog'"
2020
:key="index"
21-
title="about-content"
2221
:data="component.hero_banner"
2322
/>
2423
<SectionComponent
@@ -52,12 +51,7 @@
5251
:data="component.our_team"
5352
/>
5453
<SectionWithEmbedObject
55-
v-if="component.section_with_html_code && page === 'Contact Us'"
56-
:key="index"
57-
:data="component.section_with_html_code"
58-
/>
59-
<SectionWithEmbedObject
60-
v-if="component.section_with_html_code && page !== 'Contact Us'"
54+
v-if="component.section_with_html_code"
6155
:key="index"
6256
:data="component.section_with_html_code"
6357
/>
@@ -66,18 +60,6 @@
6660
</template>
6761

6862
<script lang="ts">
69-
interface Component {
70-
HeroBanner: object;
71-
Section: object;
72-
SectionWithBuckets: object;
73-
SectionWithCards: object;
74-
AboutSectionBucket: object;
75-
TeamSection: object;
76-
BlogSection: object;
77-
SectionWithEmbedObject: object;
78-
Devtools: object;
79-
}
80-
8163
interface Page {
8264
page: string;
8365
}
@@ -92,6 +74,7 @@ interface Locale {
9274
9375
import { defineComponent, PropType } from 'vue';
9476
import HeroBanner from '../components/HeroBanner.vue';
77+
import BlogBanner from "../components/BlogBanner.vue";
9578
import SectionComponent from '../components/SectionContent.vue';
9679
import SectionWithCards from '../components/SectionWithCards.vue';
9780
import AboutSectionBucket from '../components/AboutSectionBucket.vue';
@@ -100,9 +83,11 @@ import SectionWithEmbedObject from '../components/SectionWithEmbedObject.vue';
10083
import SectionWithBuckets from '../components/SectionWithBuckets.vue';
10184
import BlogSection from '../components/BlogSection.vue';
10285
import Devtools from '../components/DevTools.vue';
86+
import { ComponentsProps } from '../typescript/pages';
10387
export default defineComponent({
10488
components: {
10589
HeroBanner,
90+
BlogBanner,
10691
SectionComponent,
10792
SectionWithBuckets,
10893
SectionWithCards,
@@ -116,7 +101,7 @@ export default defineComponent({
116101
props: {
117102
components: {
118103
required: true,
119-
type: Object as PropType<Component>,
104+
type: Object as PropType<ComponentsProps>,
120105
},
121106
page: {
122107
required: true,

0 commit comments

Comments
 (0)