Skip to content

Commit

Permalink
fix(storefront): Cant use named imports from @ecomplus/utils yet
Browse files Browse the repository at this point in the history
  • Loading branch information
leomp12 committed Sep 15, 2022
1 parent 6081183 commit d35a839
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 24 deletions.
34 changes: 14 additions & 20 deletions packages/storefront/src/lib/components/LoginModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
<div class="counter">
<button @click="subtract()">-</button>
<pre>{{ count }}</pre>
<button @click="add()">+</button>
<button @click="add()">
<div class="i-plus" text="cool-gray-100"></div>
</button>
</div>
<div class="counter-message">
<slot />
</div>
<div id="firebaseui-auth-container"></div>
</template>

<script lang="ts">
<script lang="ts" setup>
import { ref } from 'vue';
import config from '@cloudcommerce/config';
Expand All @@ -29,6 +31,7 @@ const setupFirebaseUi = async () => {
document.body.appendChild(script);
}),
]);
// @ts-ignore
const { firebase, firebaseui }: { firebase: any, firebaseui: any } = window;
const ui = new firebaseui.auth.AuthUI(firebase.auth());
console.log(firebase.auth);
Expand All @@ -54,24 +57,15 @@ const setupFirebaseUi = async () => {
ui.start('#firebaseui-auth-container', uiConfig);
};
export default {
setup() {
if (!import.meta.env.SSR) {
setupFirebaseUi();
}
const count = ref(0);
const add = () => {
count.value += 1;
};
const subtract = () => {
count.value -= 1;
};
return {
count,
add,
subtract,
};
},
if (!import.meta.env.SSR) {
setupFirebaseUi();
}
const count = ref(0);
const add = () => {
count.value += 1;
};
const subtract = () => {
count.value -= 1;
};
</script>

Expand Down
4 changes: 2 additions & 2 deletions packages/storefront/src/lib/layouts/meta/Head.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import type { PageContext } from '../../ssr-context';
import { img as getImg } from '@ecomplus/utils';
import ecomUtils from '@ecomplus/utils';
export interface Props {
pageContext: PageContext;
Expand All @@ -26,7 +26,7 @@ const cmsSocial = cms('social') as typeof import('../../../../content/social.jso
const ogLocale = lang.length === 2 ? lang : lang.substring(0, 2) + lang.slice(3).toUpperCase();
let ogImage: string | undefined;
if (apiDoc) {
const picture = getImg(state, null, 'zoom');
const picture = ecomUtils.img(state, null, 'zoom');
ogImage = picture && picture.url;
}
if (!ogImage) {
Expand Down
4 changes: 2 additions & 2 deletions packages/storefront/src/lib/layouts/meta/Json.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import type { PageContext } from '../../ssr-context';
import { price as fixPrice } from '@ecomplus/utils';
import ecomUtils from '@ecomplus/utils';
export interface Props {
pageContext: PageContext;
Expand Down Expand Up @@ -32,7 +32,7 @@ window.storefront = ${JSON.stringify({
})};`;
if (apiDoc) {
if (typeof apiDoc.price === 'number') {
apiDoc.price = fixPrice(apiDoc);
apiDoc.price = ecomUtils.price(apiDoc);
}
const slimDocRegex = globalThis.storefront_slim_doc_regex
|| /body|meta|records|description|i18n/;
Expand Down

0 comments on commit d35a839

Please sign in to comment.