cloudcommerce 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/extensions.json +3 -1
- package/.vscode/settings.json +5 -1
- package/CHANGELOG.md +30 -0
- package/action.yml +3 -0
- package/ecomplus-stores/monocard/.devcontainer/devcontainer.json +28 -1
- package/ecomplus-stores/monocard/.gitpod.yml +12 -0
- package/ecomplus-stores/monocard/functions/core/package.json +1 -1
- package/ecomplus-stores/monocard/functions/events/package.json +2 -2
- package/ecomplus-stores/monocard/functions/modules/package.json +2 -2
- package/ecomplus-stores/monocard/functions/passport/package.json +2 -2
- package/ecomplus-stores/monocard/functions/ssr/package.json +8 -8
- package/ecomplus-stores/monocard/package.json +1 -1
- package/ecomplus-stores/monocard/scripts/install.sh +6 -1
- package/ecomplus-stores/tia-sonia/.devcontainer/devcontainer.json +30 -0
- package/ecomplus-stores/tia-sonia/.gitpod.yml +12 -0
- package/ecomplus-stores/tia-sonia/scripts/install.sh +6 -1
- package/package.json +12 -12
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/package.json +2 -2
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/datafrete/package.json +4 -4
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +2 -2
- package/packages/apps/fb-conversions/package.json +4 -4
- package/packages/apps/frenet/package.json +4 -4
- package/packages/apps/galaxpay/package.json +4 -4
- package/packages/apps/google-analytics/package.json +4 -4
- package/packages/apps/infinitepay/package.json +4 -4
- package/packages/apps/jadlog/package.json +2 -2
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/melhor-envio/package.json +4 -4
- package/packages/apps/mercadopago/package.json +4 -4
- package/packages/apps/pagarme/package.json +4 -4
- package/packages/apps/paghiper/package.json +4 -4
- package/packages/apps/pix/package.json +4 -4
- package/packages/apps/tiny-erp/lib/tiny-erp.js +6 -4
- package/packages/apps/tiny-erp/lib/tiny-erp.js.map +1 -1
- package/packages/apps/tiny-erp/lib/tiny-webhook.js +7 -4
- package/packages/apps/tiny-erp/lib/tiny-webhook.js.map +1 -1
- package/packages/apps/tiny-erp/package.json +4 -4
- package/packages/apps/tiny-erp/src/tiny-erp.ts +6 -4
- package/packages/apps/tiny-erp/src/tiny-webhook.ts +7 -4
- package/packages/apps/webhooks/package.json +4 -4
- package/packages/cli/lib/build.js +2 -0
- package/packages/cli/lib/cli.js +4 -2
- package/packages/cli/package.json +1 -1
- package/packages/cli/src/build.ts +2 -0
- package/packages/cli/src/cli.ts +5 -2
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +2 -2
- package/packages/events/package.json +3 -3
- package/packages/firebase/lib/config.d.ts +5 -1
- package/packages/firebase/lib/config.js +6 -2
- package/packages/firebase/lib/config.js.map +1 -1
- package/packages/firebase/package.json +4 -4
- package/packages/firebase/src/config.ts +7 -1
- package/packages/i18n/package.json +1 -1
- package/packages/modules/lib/firebase.js +4 -3
- package/packages/modules/lib/firebase.js.map +1 -1
- package/packages/modules/package.json +4 -4
- package/packages/modules/src/firebase.ts +7 -3
- package/packages/passport/lib/firebase/serve-passport-api.js +8 -5
- package/packages/passport/lib/firebase/serve-passport-api.js.map +1 -1
- package/packages/passport/lib/firebase.js +11 -8
- package/packages/passport/lib/firebase.js.map +1 -1
- package/packages/passport/package.json +3 -3
- package/packages/passport/src/firebase/serve-passport-api.ts +8 -5
- package/packages/passport/src/firebase.ts +11 -8
- package/packages/ssr/lib/firebase.js +14 -11
- package/packages/ssr/lib/firebase.js.map +1 -1
- package/packages/ssr/package.json +6 -6
- package/packages/ssr/src/firebase.ts +14 -11
- package/packages/storefront/.astro/types.d.ts +117 -0
- package/packages/storefront/client.d.ts +1 -0
- package/packages/storefront/dist/client/_astro/Carousel.06e8cee5.js +1 -0
- package/packages/storefront/dist/client/_astro/HeroSlider.2c4563ee.js +1 -0
- package/packages/storefront/dist/client/_astro/PitchBar.8945ceb4.js +1 -0
- package/packages/storefront/dist/client/_astro/{Prices.70885f17.js → Prices.bc136725.js} +1 -1
- package/packages/storefront/dist/client/_astro/{ShopHeader.e901fad5.js → ShopHeader.5d83d6d5.js} +2 -2
- package/packages/storefront/dist/client/_astro/{_...slug_.9a31c59e.css → _...slug_.48ea2ee1.css} +1 -1
- package/packages/storefront/dist/client/_astro/_commonjsHelpers.725317a4.js +1 -0
- package/packages/storefront/dist/client/_astro/{_plugin-vue_export-helper.0c2b7f88.js → _plugin-vue_export-helper.d71c044e.js} +1 -1
- package/packages/storefront/dist/client/_astro/{client.4e825332.js → client.97e9e785.js} +1 -1
- package/packages/storefront/dist/client/_astro/client.f447e2e8.js +128 -0
- package/packages/storefront/dist/client/_astro/{firebase-app.247497b8.js → firebase-app.2840bd36.js} +111 -111
- package/packages/storefront/dist/client/_astro/{format-money.f09b89ed.js → format-money.d54c1237.js} +1 -1
- package/packages/storefront/dist/client/_astro/index.2899cbe4.js +9 -0
- package/packages/storefront/dist/client/_astro/{index.9018a8da.js → index.b12dff85.js} +1 -1
- package/packages/storefront/dist/client/_astro/index.es.28e34903.js +1 -0
- package/packages/storefront/dist/client/_astro/{modules-info.2a72e536.js → modules-info.ea748f9d.js} +1 -1
- package/packages/storefront/dist/client/_astro/runtime-dom.esm-bundler.e9908a78.js +1 -0
- package/packages/storefront/dist/client/_astro/server.browser.e1b1e312.js +27 -0
- package/packages/storefront/dist/client/admin/assets/Range.es-3e45690c.js +1 -0
- package/packages/storefront/dist/client/admin/assets/SchemaReference.es-68e2a833.js +1 -0
- package/packages/storefront/dist/client/admin/assets/brace-fold.es-f96db61f.js +1 -0
- package/packages/storefront/dist/client/admin/assets/closebrackets.es-0488b839.js +2 -0
- package/packages/storefront/dist/client/admin/assets/codemirror.es-15b9374a.js +24 -0
- package/packages/storefront/dist/client/admin/assets/comment.es-d4bed417.js +2 -0
- package/packages/storefront/dist/client/admin/assets/dialog.es-56aaee5b.js +1 -0
- package/packages/storefront/dist/client/admin/assets/foldgutter.es-55067bee.js +1 -0
- package/packages/storefront/dist/client/admin/assets/forEachState.es-1e367fb2.js +1 -0
- package/packages/storefront/dist/client/admin/assets/hint.es-07ec11aa.js +1 -0
- package/packages/storefront/dist/client/admin/assets/hint.es2-35fd7219.js +1 -0
- package/packages/storefront/dist/client/admin/assets/index-64cd926d.css +1 -0
- package/packages/storefront/dist/client/admin/assets/index-d5c6a1a9.js +6332 -0
- package/packages/storefront/dist/client/admin/assets/index-f1d880da.js +216 -0
- package/packages/storefront/dist/client/admin/assets/info-addon.es-eded2c26.js +1 -0
- package/packages/storefront/dist/client/admin/assets/info.es-93649208.js +1 -0
- package/packages/storefront/dist/client/admin/assets/javascript.es-634a06b1.js +1 -0
- package/packages/storefront/dist/client/admin/assets/jump-to-line.es-23d2d4a8.js +1 -0
- package/packages/storefront/dist/client/admin/assets/jump.es-732b233e.js +1 -0
- package/packages/storefront/dist/client/admin/assets/lint.es-240359bd.js +6 -0
- package/packages/storefront/dist/client/admin/assets/lint.es2-df11292b.js +1 -0
- package/packages/storefront/dist/client/admin/assets/lint.es3-aa543b52.js +1 -0
- package/packages/storefront/dist/client/admin/assets/matchbrackets.es-f5e3ac04.js +1 -0
- package/packages/storefront/dist/client/admin/assets/mode-indent.es-341daf63.js +1 -0
- package/packages/storefront/dist/client/admin/assets/mode.es-c74239d3.js +1 -0
- package/packages/storefront/dist/client/admin/assets/mode.es2-9319d2a9.js +1 -0
- package/packages/storefront/dist/client/admin/assets/mode.es3-deb92d78.js +1 -0
- package/packages/storefront/dist/client/admin/assets/search.es-143ba137.js +2 -0
- package/packages/storefront/dist/client/admin/assets/searchcursor.es-6069a13e.js +7 -0
- package/packages/storefront/dist/client/admin/assets/show-hint.es-ff4fde1d.js +1 -0
- package/packages/storefront/dist/client/admin/assets/sublime.es-23f726a0.js +6 -0
- package/packages/storefront/dist/client/admin/index.html +15 -0
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/chunks/pages/{all.b15cad2d.mjs → all.e51db7f0.mjs} +79 -55
- package/packages/storefront/dist/server/entry.mjs +3 -3
- package/packages/storefront/package.json +18 -10
- package/packages/storefront/scripts/prepare-monorepo.sh +2 -0
- package/packages/storefront/src/env.d.ts +1 -0
- package/packages/storefront/src/lib/components/Carousel.vue +9 -14
- package/packages/storefront/src/lib/components/Post.vue +107 -0
- package/packages/storefront/src/lib/composables/use-pitch-bar.ts +26 -2
- package/packages/storefront/src/lib/layouts/BaseStateJson.astro +5 -0
- package/packages/storefront/src/lib/layouts/use-page-layout.ts +5 -7
- package/packages/storefront/src/lib/ssr-context.ts +6 -1
- package/packages/storefront/src/lib/state/use-cms-preview.ts +101 -0
- package/packages/storefront/storefront.config.mjs +10 -2
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/_astro/Carousel.dfb3f26a.js +0 -1
- package/packages/storefront/dist/client/_astro/HeroSlider.34436243.js +0 -1
- package/packages/storefront/dist/client/_astro/PitchBar.1c993792.js +0 -1
- package/packages/storefront/dist/client/_astro/runtime-dom.esm-bundler.1fd80976.js +0 -1
- package/packages/storefront/dist/client/admin/config.json +0 -1
|
@@ -11,7 +11,7 @@ import 'magic-string';
|
|
|
11
11
|
import 'node:stream';
|
|
12
12
|
import { c as createAstro, a as createComponent, r as renderTemplate, b as addAttribute, d as renderComponent, u as unescapeHTML, F as Fragment, m as maybeRenderHead, s as spreadAttributes, e as renderSlot, f as renderHead } from '../astro.39f7f387.mjs';
|
|
13
13
|
import api from '@cloudcommerce/api';
|
|
14
|
-
import { reactive, computed, defineComponent, inject, useSSRContext, mergeProps, ref, watch, toRef, onMounted, onBeforeUnmount, provide, createVNode, resolveDynamicComponent, withCtx, renderSlot as renderSlot$1, withDirectives, vShow, openBlock, createBlock, createCommentVNode, Fragment as Fragment$1, renderList, resolveComponent, withModifiers, Teleport, createTextVNode, toDisplayString, setBlockTracking } from 'vue';
|
|
14
|
+
import { reactive, computed, shallowReactive, defineComponent, inject, useSSRContext, mergeProps, ref, watch, toRef, onMounted, onBeforeUnmount, provide, createVNode, resolveDynamicComponent, withCtx, renderSlot as renderSlot$1, withDirectives, vShow, openBlock, createBlock, createCommentVNode, Fragment as Fragment$1, renderList, resolveComponent, withModifiers, Teleport, createTextVNode, toDisplayString, setBlockTracking } from 'vue';
|
|
15
15
|
import { ssrRenderAttrs, ssrRenderSlot, ssrRenderClass, ssrRenderVNode, ssrRenderComponent, ssrRenderStyle, ssrRenderList, ssrIncludeBooleanAttr, ssrRenderAttr, ssrRenderTeleport, ssrInterpolate } from 'vue/server-renderer';
|
|
16
16
|
import { img, price, formatMoney, nickname, onPromotion } from '@ecomplus/utils';
|
|
17
17
|
/* empty css */import { EventEmitter } from 'node:events';
|
|
@@ -336,9 +336,17 @@ const _getConfig = () => {
|
|
|
336
336
|
const mergeConfig = JSON.parse(readFileSync(configFilepath), 'utf8');
|
|
337
337
|
if (mergeConfig.storeId) {
|
|
338
338
|
storeId = mergeConfig.storeId;
|
|
339
|
-
config.set({ storeId });
|
|
340
339
|
}
|
|
341
|
-
} catch {
|
|
340
|
+
} catch {
|
|
341
|
+
//
|
|
342
|
+
}
|
|
343
|
+
if (!storeId && false === true) {
|
|
344
|
+
storeId = 1011;
|
|
345
|
+
console.warn('> `storeId` is not set, using fallback 1011 for dev only\n');
|
|
346
|
+
}
|
|
347
|
+
if (storeId) {
|
|
348
|
+
config.set({ storeId });
|
|
349
|
+
}
|
|
342
350
|
}
|
|
343
351
|
const {
|
|
344
352
|
lang,
|
|
@@ -389,7 +397,11 @@ const loadPageContext = async (Astro, {
|
|
|
389
397
|
apiPrefetchEndpoints = globalThis.api_prefetch_endpoints
|
|
390
398
|
} = {}) => {
|
|
391
399
|
const startedAt = Date.now();
|
|
392
|
-
|
|
400
|
+
let urlPath = Astro.url.pathname;
|
|
401
|
+
const isPreview = urlPath.startsWith("/~preview");
|
|
402
|
+
if (isPreview) {
|
|
403
|
+
urlPath = urlPath.replace("/~preview", "");
|
|
404
|
+
}
|
|
393
405
|
const isHomepage = urlPath === "/";
|
|
394
406
|
const config = getConfig();
|
|
395
407
|
globalThis.storefront.settings = config.settings;
|
|
@@ -478,7 +490,8 @@ const loadPageContext = async (Astro, {
|
|
|
478
490
|
apiResource,
|
|
479
491
|
apiDoc,
|
|
480
492
|
apiState,
|
|
481
|
-
getContent: config.cms
|
|
493
|
+
getContent: config.cms,
|
|
494
|
+
isPreview
|
|
482
495
|
};
|
|
483
496
|
emitter.emit("load", pageContext);
|
|
484
497
|
return pageContext;
|
|
@@ -571,7 +584,8 @@ const $$BaseStateJson = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
571
584
|
currency,
|
|
572
585
|
currencySymbol,
|
|
573
586
|
domain,
|
|
574
|
-
settings
|
|
587
|
+
settings,
|
|
588
|
+
isPreview
|
|
575
589
|
}
|
|
576
590
|
} = Astro2.props;
|
|
577
591
|
let inlineClientJS = `
|
|
@@ -609,6 +623,10 @@ window.storefront.context = ${JSON.stringify({
|
|
|
609
623
|
timestamp: Date.now()
|
|
610
624
|
})};`;
|
|
611
625
|
}
|
|
626
|
+
if (isPreview) {
|
|
627
|
+
inlineClientJS += `
|
|
628
|
+
window.isCMSPreview = true;`;
|
|
629
|
+
}
|
|
612
630
|
const inlineJSONLd = JSON.stringify({
|
|
613
631
|
"@context": "http://schema.org",
|
|
614
632
|
"@type": "Organization",
|
|
@@ -1035,29 +1053,6 @@ const $$Base = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
1035
1053
|
` })}`;
|
|
1036
1054
|
}, "/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/layouts/Base.astro");
|
|
1037
1055
|
|
|
1038
|
-
const usePageLayout = async ({ pageContext }) => {
|
|
1039
|
-
const { apiState, cms } = pageContext;
|
|
1040
|
-
const {
|
|
1041
|
-
header: cmsHeader,
|
|
1042
|
-
service_links: cmsServiceLinks
|
|
1043
|
-
} = await cms("layout");
|
|
1044
|
-
const pitchBar = { slides: [] };
|
|
1045
|
-
if (cmsHeader?.pitch_bar) {
|
|
1046
|
-
pitchBar.slides = cmsHeader.pitch_bar;
|
|
1047
|
-
}
|
|
1048
|
-
const shopHeader = {
|
|
1049
|
-
categories: apiState.categories || [],
|
|
1050
|
-
menuCategorySlugs: cmsHeader.inline_menu_categories?.featured,
|
|
1051
|
-
menuRandomCategories: cmsHeader.inline_menu_categories?.random,
|
|
1052
|
-
isAlphabeticalSortSubmenu: cmsHeader.alphabetical_sort_submenu,
|
|
1053
|
-
serviceLinks: cmsServiceLinks
|
|
1054
|
-
};
|
|
1055
|
-
return {
|
|
1056
|
-
pitchBar,
|
|
1057
|
-
shopHeader
|
|
1058
|
-
};
|
|
1059
|
-
};
|
|
1060
|
-
|
|
1061
1056
|
const checkObjNotNull = (obj) => {
|
|
1062
1057
|
return Object.values(obj).filter((val) => val).length;
|
|
1063
1058
|
};
|
|
@@ -1137,10 +1132,24 @@ const parseShippingPhrase = (phrase) => {
|
|
|
1137
1132
|
return parsePhrase(phrase, "calculate_shipping", "free_shipping_from_value");
|
|
1138
1133
|
};
|
|
1139
1134
|
|
|
1135
|
+
const useCMSPreview = (fetchData) => {
|
|
1136
|
+
const liveContent = shallowReactive({});
|
|
1137
|
+
return { liveContent };
|
|
1138
|
+
};
|
|
1139
|
+
|
|
1140
|
+
const parseLayoutContent = (layoutContent) => {
|
|
1141
|
+
const pitchBar = { slides: [] };
|
|
1142
|
+
if (layoutContent.header?.pitch_bar) {
|
|
1143
|
+
pitchBar.slides = layoutContent.header.pitch_bar;
|
|
1144
|
+
}
|
|
1145
|
+
return pitchBar;
|
|
1146
|
+
};
|
|
1140
1147
|
const usePitchBar = (props) => {
|
|
1148
|
+
const { liveContent } = useCMSPreview();
|
|
1141
1149
|
const parsedContents = computed(() => {
|
|
1142
|
-
|
|
1143
|
-
|
|
1150
|
+
const slides = liveContent.layout ? parseLayoutContent(liveContent.layout).slides : props.slides;
|
|
1151
|
+
return slides.map(({ html }) => {
|
|
1152
|
+
return parseShippingPhrase(html).value.replace(/<\/?p>/g, "").replace(/<(\/?d-md)>/g, "<$1>");
|
|
1144
1153
|
});
|
|
1145
1154
|
});
|
|
1146
1155
|
const countValidSlides = computed(() => {
|
|
@@ -1152,6 +1161,27 @@ const usePitchBar = (props) => {
|
|
|
1152
1161
|
};
|
|
1153
1162
|
};
|
|
1154
1163
|
|
|
1164
|
+
const usePageLayout = async ({ pageContext }) => {
|
|
1165
|
+
const { apiState, cms } = pageContext;
|
|
1166
|
+
const cmsLayout = await cms("layout");
|
|
1167
|
+
const {
|
|
1168
|
+
header: cmsHeader,
|
|
1169
|
+
service_links: cmsServiceLinks
|
|
1170
|
+
} = cmsLayout;
|
|
1171
|
+
const pitchBar = parseLayoutContent(cmsLayout);
|
|
1172
|
+
const shopHeader = {
|
|
1173
|
+
categories: apiState.categories || [],
|
|
1174
|
+
menuCategorySlugs: cmsHeader.inline_menu_categories?.featured,
|
|
1175
|
+
menuRandomCategories: cmsHeader.inline_menu_categories?.random,
|
|
1176
|
+
isAlphabeticalSortSubmenu: cmsHeader.alphabetical_sort_submenu,
|
|
1177
|
+
serviceLinks: cmsServiceLinks
|
|
1178
|
+
};
|
|
1179
|
+
return {
|
|
1180
|
+
pitchBar,
|
|
1181
|
+
shopHeader
|
|
1182
|
+
};
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1155
1185
|
const carouselKey = Symbol("carousel");
|
|
1156
1186
|
|
|
1157
1187
|
const _sfc_main$f = defineComponent({
|
|
@@ -1236,7 +1266,14 @@ const _sfc_main$e = defineComponent({
|
|
|
1236
1266
|
}));
|
|
1237
1267
|
};
|
|
1238
1268
|
const calcNextWidth = (direction) => {
|
|
1239
|
-
|
|
1269
|
+
let nextSlideIndex = currentIndex.value + direction;
|
|
1270
|
+
if (nextSlideIndex >= slidesWidth.value.length) {
|
|
1271
|
+
nextSlideIndex = 0;
|
|
1272
|
+
direction = -direction;
|
|
1273
|
+
} else if (nextSlideIndex < 0) {
|
|
1274
|
+
nextSlideIndex = slidesWidth.value.length - 1;
|
|
1275
|
+
direction = -direction;
|
|
1276
|
+
}
|
|
1240
1277
|
const width = slidesWidth.value[nextSlideIndex]?.width || 0;
|
|
1241
1278
|
if (!width) {
|
|
1242
1279
|
return 0;
|
|
@@ -1265,18 +1302,6 @@ const _sfc_main$e = defineComponent({
|
|
|
1265
1302
|
}
|
|
1266
1303
|
};
|
|
1267
1304
|
const changeSlide = (direction) => {
|
|
1268
|
-
if (direction < 0) {
|
|
1269
|
-
if (isBoundLeft.value) {
|
|
1270
|
-
calcIndexCount();
|
|
1271
|
-
currentIndex.value = indexCount.value - 1;
|
|
1272
|
-
changeSlide(1);
|
|
1273
|
-
return;
|
|
1274
|
-
}
|
|
1275
|
-
} else if (isBoundRight.value) {
|
|
1276
|
-
currentIndex.value = 1;
|
|
1277
|
-
changeSlide(-1);
|
|
1278
|
-
return;
|
|
1279
|
-
}
|
|
1280
1305
|
const nextSlideWidth = calcNextWidth(direction);
|
|
1281
1306
|
if (nextSlideWidth) {
|
|
1282
1307
|
wrapper.value?.scrollBy({ left: nextSlideWidth, behavior: "smooth" });
|
|
@@ -2699,7 +2724,7 @@ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
2699
2724
|
_push2(ssrRenderComponent(_component_Fade, null, {
|
|
2700
2725
|
default: withCtx((_, _push3, _parent3, _scopeId2) => {
|
|
2701
2726
|
if (_push3) {
|
|
2702
|
-
_push3(ssrRenderComponent($setup["MenuItems"], { class: "absolute -right-8 mt-2 w-56 rounded-md shadow ring-1 ring-black
|
|
2727
|
+
_push3(ssrRenderComponent($setup["MenuItems"], { class: "absolute -right-8 mt-2 w-56 rounded-md shadow ring-1 ring-black/5 bg-white divide-y divide-base-100 focus:outline-none" }, {
|
|
2703
2728
|
default: withCtx((_2, _push4, _parent4, _scopeId3) => {
|
|
2704
2729
|
if (_push4) {
|
|
2705
2730
|
_push4(`<div class="p-3 text-base-600"${_scopeId3}>${ssrInterpolate(`${"Ol\xE1"} ${$setup.customerName || "Visitante"}`)} `);
|
|
@@ -3007,7 +3032,7 @@ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
3007
3032
|
}, _parent3, _scopeId2));
|
|
3008
3033
|
} else {
|
|
3009
3034
|
return [
|
|
3010
|
-
createVNode($setup["MenuItems"], { class: "absolute -right-8 mt-2 w-56 rounded-md shadow ring-1 ring-black
|
|
3035
|
+
createVNode($setup["MenuItems"], { class: "absolute -right-8 mt-2 w-56 rounded-md shadow ring-1 ring-black/5 bg-white divide-y divide-base-100 focus:outline-none" }, {
|
|
3011
3036
|
default: withCtx(() => [
|
|
3012
3037
|
createVNode("div", { class: "p-3 text-base-600" }, [
|
|
3013
3038
|
createTextVNode(toDisplayString(`${"Ol\xE1"} ${$setup.customerName || "Visitante"}`) + " ", 1),
|
|
@@ -3131,7 +3156,7 @@ function _sfc_ssrRender$3(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
3131
3156
|
}, 1024),
|
|
3132
3157
|
createVNode(_component_Fade, null, {
|
|
3133
3158
|
default: withCtx(() => [
|
|
3134
|
-
createVNode($setup["MenuItems"], { class: "absolute -right-8 mt-2 w-56 rounded-md shadow ring-1 ring-black
|
|
3159
|
+
createVNode($setup["MenuItems"], { class: "absolute -right-8 mt-2 w-56 rounded-md shadow ring-1 ring-black/5 bg-white divide-y divide-base-100 focus:outline-none" }, {
|
|
3135
3160
|
default: withCtx(() => [
|
|
3136
3161
|
createVNode("div", { class: "p-3 text-base-600" }, [
|
|
3137
3162
|
createTextVNode(toDisplayString(`${"Ol\xE1"} ${$setup.customerName || "Visitante"}`) + " ", 1),
|
|
@@ -3489,22 +3514,22 @@ function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
3489
3514
|
_push(ssrRenderComponent($setup["Carousel"], { autoplay: $props.autoplay }, {
|
|
3490
3515
|
controls: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
3491
3516
|
if (_push2) {
|
|
3492
|
-
_push2(`<div style="${ssrRenderStyle($setup.parsedSlides.length > 1 ? null : { display: "none" })}" class="absolute
|
|
3517
|
+
_push2(`<div style="${ssrRenderStyle($setup.parsedSlides.length > 1 ? null : { display: "none" })}" class="absolute z-10 bottom-5 flex justify-end items-center w-screen xl:max-w-screen-xl xl:left-1/2 -ms-[640px]"${_scopeId}><div class="relative w-20 h-10 rounded-full bg-white/50 text-primary shadow-sm ring-1 ring-black/5"${_scopeId}>`);
|
|
3493
3518
|
_push2(ssrRenderComponent($setup["CarouselControl"], {
|
|
3494
3519
|
direction: -1,
|
|
3495
|
-
class: "
|
|
3520
|
+
class: "w-10 h-10 rounded-full hover:bg-primary/10"
|
|
3496
3521
|
}, null, _parent2, _scopeId));
|
|
3497
|
-
_push2(ssrRenderComponent($setup["CarouselControl"], { class: "
|
|
3522
|
+
_push2(ssrRenderComponent($setup["CarouselControl"], { class: "w-10 h-10 rounded-full hover:bg-primary/10" }, null, _parent2, _scopeId));
|
|
3498
3523
|
_push2(`</div></div>`);
|
|
3499
3524
|
} else {
|
|
3500
3525
|
return [
|
|
3501
|
-
withDirectives(createVNode("div", { class: "absolute
|
|
3502
|
-
createVNode("div", { class: "relative" }, [
|
|
3526
|
+
withDirectives(createVNode("div", { class: "absolute z-10 bottom-5 flex justify-end items-center w-screen xl:max-w-screen-xl xl:left-1/2 -ms-[640px]" }, [
|
|
3527
|
+
createVNode("div", { class: "relative w-20 h-10 rounded-full bg-white/50 text-primary shadow-sm ring-1 ring-black/5" }, [
|
|
3503
3528
|
createVNode($setup["CarouselControl"], {
|
|
3504
3529
|
direction: -1,
|
|
3505
|
-
class: "
|
|
3530
|
+
class: "w-10 h-10 rounded-full hover:bg-primary/10"
|
|
3506
3531
|
}),
|
|
3507
|
-
createVNode($setup["CarouselControl"], { class: "
|
|
3532
|
+
createVNode($setup["CarouselControl"], { class: "w-10 h-10 rounded-full hover:bg-primary/10" })
|
|
3508
3533
|
])
|
|
3509
3534
|
], 512), [
|
|
3510
3535
|
[vShow, $setup.parsedSlides.length > 1]
|
|
@@ -3936,7 +3961,6 @@ const $$Home = createComponent(async ($$result, $$props, $$slots) => {
|
|
|
3936
3961
|
const { pageContext } = Astro2.props;
|
|
3937
3962
|
const { heroSlider } = await useHomeMain({ pageContext });
|
|
3938
3963
|
const heroSlides = heroSlider.slides;
|
|
3939
|
-
console.log({ heroSlides });
|
|
3940
3964
|
const products = (await api.get("products")).data.result;
|
|
3941
3965
|
return renderTemplate`${maybeRenderHead($$result)}<main>
|
|
3942
3966
|
${heroSlider.slides.length && renderTemplate`${renderComponent($$result, "HeroSlider", HeroSlider, { ...heroSlider, "client:load": true, "client:component-hydration": "load", "client:component-path": "~/components/HeroSlider.vue", "client:component-export": "default" }, { "picture-0": ($$result2) => renderTemplate`${heroSlides[0] && renderTemplate`${renderComponent($$result2, "HeroPicture", $$HeroPicture, { "slot": "picture-0", ...heroSlides[0], "index": 0 })}`}`, "picture-1": ($$result2) => renderTemplate`${heroSlides[1] && renderTemplate`${renderComponent($$result2, "HeroPicture", $$HeroPicture, { "slot": "picture-1", ...heroSlides[1], "index": 1 })}`}`, "picture-2": ($$result2) => renderTemplate`${heroSlides[2] && renderTemplate`${renderComponent($$result2, "HeroPicture", $$HeroPicture, { "slot": "picture-2", ...heroSlides[2], "index": 2 })}`}`, "picture-3": ($$result2) => renderTemplate`${heroSlides[3] && renderTemplate`${renderComponent($$result2, "HeroPicture", $$HeroPicture, { "slot": "picture-3", ...heroSlides[3], "index": 3 })}`}`, "picture-4": ($$result2) => renderTemplate`${heroSlides[4] && renderTemplate`${renderComponent($$result2, "HeroPicture", $$HeroPicture, { "slot": "picture-4", ...heroSlides[4], "index": 4 })}`}`, "picture-5": ($$result2) => renderTemplate`${heroSlides[5] && renderTemplate`${renderComponent($$result2, "HeroPicture", $$HeroPicture, { "slot": "picture-5", ...heroSlides[5], "index": 5 })}`}`, "picture-6": ($$result2) => renderTemplate`${heroSlides[6] && renderTemplate`${renderComponent($$result2, "HeroPicture", $$HeroPicture, { "slot": "picture-6", ...heroSlides[6], "index": 6 })}`}`, "picture-7": ($$result2) => renderTemplate`${heroSlides[7] && renderTemplate`${renderComponent($$result2, "HeroPicture", $$HeroPicture, { "slot": "picture-7", ...heroSlides[7], "index": 7 })}`}`, "picture-8": ($$result2) => renderTemplate`${heroSlides[8] && renderTemplate`${renderComponent($$result2, "HeroPicture", $$HeroPicture, { "slot": "picture-8", ...heroSlides[8], "index": 8 })}`}`, "picture-9": ($$result2) => renderTemplate`${heroSlides[9] && renderTemplate`${renderComponent($$result2, "HeroPicture", $$HeroPicture, { "slot": "picture-9", ...heroSlides[9], "index": 9 })}`}` })}`}
|
|
@@ -14,7 +14,7 @@ import enableDestroy from 'server-destroy';
|
|
|
14
14
|
import { defineComponent, computed, useSSRContext, mergeProps, h as h$1, createSSRApp } from 'vue';
|
|
15
15
|
import { ssrRenderSlotInner, ssrRenderAttrs, ssrRenderSlot, renderToString } from 'vue/server-renderer';
|
|
16
16
|
import { img, imgSizes, i18n, formatMoney } from '@ecomplus/utils';
|
|
17
|
-
/* empty css */import { _ as _export_sfc, a as _page0, b as _page1, c as _page2, d as _page3, e as _page4, f as _page5 } from './chunks/pages/all.
|
|
17
|
+
/* empty css */import { _ as _export_sfc, a as _page0, b as _page1, c as _page2, d as _page3, e as _page4, f as _page5 } from './chunks/pages/all.e51db7f0.mjs';
|
|
18
18
|
import 'mime';
|
|
19
19
|
import 'cookie';
|
|
20
20
|
import 'kleur/colors';
|
|
@@ -3072,10 +3072,10 @@ const _renderer1 = {
|
|
|
3072
3072
|
renderToStaticMarkup,
|
|
3073
3073
|
};
|
|
3074
3074
|
|
|
3075
|
-
const pageMap = new Map([["../../node_modules/.pnpm/@astrojs+image@0.16.6_astro@2.3.0_sharp@0.
|
|
3075
|
+
const pageMap = new Map([["../../node_modules/.pnpm/@astrojs+image@0.16.6_astro@2.3.0_sharp@0.32.0/node_modules/@astrojs/image/dist/endpoint.js", _page0],["src/pages/index.astro", _page1],["src/pages/fallback.astro", _page2],["src/pages/app/index.astro", _page3],["src/pages/app/account.astro", _page4],["src/pages/[...slug].astro", _page5],]);
|
|
3076
3076
|
const renderers = [Object.assign({"name":"astro:jsx","serverEntrypoint":"astro/jsx/server.js","jsxImportSource":"astro"}, { ssr: server_default }),Object.assign({"name":"@astrojs/vue","clientEntrypoint":"@astrojs/vue/client.js","serverEntrypoint":"@astrojs/vue/server.js"}, { ssr: _renderer1 }),];
|
|
3077
3077
|
|
|
3078
|
-
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":[],"scripts":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.16.6_astro@2.3.0_sharp@0.
|
|
3078
|
+
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":[],"scripts":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.16.6_astro@2.3.0_sharp@0.32.0/node_modules/@astrojs/image/dist/endpoint.js","pathname":"/_image","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["/_astro/_...slug_.48ea2ee1.css","/_astro/index.e56fc6b3.css","/_astro/index.1eaf97c3.css"],"scripts":[{"type":"external","value":"/_astro/hoisted.56fa2eff.js"}],"routeData":{"route":"/","type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["/_astro/_...slug_.48ea2ee1.css","/_astro/index.1eaf97c3.css"],"scripts":[{"type":"external","value":"/_astro/hoisted.56fa2eff.js"}],"routeData":{"route":"/fallback","type":"page","pattern":"^\\/fallback\\/?$","segments":[[{"content":"fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/fallback.astro","pathname":"/fallback","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"routeData":{"route":"/app","type":"page","pattern":"^\\/app\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/index.astro","pathname":"/app","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"routeData":{"route":"/app/account","type":"page","pattern":"^\\/app\\/account\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}],[{"content":"account","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/account.astro","pathname":"/app/account","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["/_astro/_...slug_.48ea2ee1.css","/_astro/index.1eaf97c3.css"],"scripts":[{"type":"external","value":"/_astro/hoisted.56fa2eff.js"}],"routeData":{"route":"/[...slug]","type":"page","pattern":"^(?:\\/(.*?))?\\/?$","segments":[[{"content":"...slug","dynamic":true,"spread":true}]],"params":["...slug"],"component":"src/pages/[...slug].astro","prerender":false,"_meta":{"trailingSlash":"ignore"}}}],"site":"https://ecom2-002.web.app","base":"/","markdown":{"drafts":false,"syntaxHighlight":"shiki","shikiConfig":{"langs":[],"theme":"github-dark","wrap":false},"remarkPlugins":[],"rehypePlugins":[],"remarkRehype":{},"gfm":true,"smartypants":true},"pageMap":null,"componentMetadata":[["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro",{"propagation":"none","containsHead":true}],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/fallback.astro",{"propagation":"none","containsHead":true}],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro",{"propagation":"none","containsHead":true}]],"renderers":[],"entryModules":{"\u0000@astrojs-ssr-virtual-entry":"_@astrojs-ssr-virtual-entry.mjs","~/components/PitchBar.vue":"_astro/PitchBar.8945ceb4.js","~/components/HeroSlider.vue":"_astro/HeroSlider.2c4563ee.js","~/components/Prices.vue":"_astro/Prices.bc136725.js","/astro/hoisted.js?q=0":"_astro/hoisted.56fa2eff.js","@astrojs/vue/client.js":"_astro/client.97e9e785.js","/home/leo/code/ecomplus/cloud-commerce/packages/storefront/node_modules/tinacms/dist/rich-text/index.es.js":"_astro/index.es.28e34903.js","/home/leo/code/ecomplus/cloud-commerce/packages/storefront/tina/__generated__/client.ts":"_astro/client.f447e2e8.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/workbox-window/build/workbox-window.prod.es5.mjs":"_astro/workbox-window.prod.es5.dc90f814.js","~/components/ShopHeader.vue":"_astro/ShopHeader.5d83d6d5.js","/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/scripts/firebase-app.ts":"_astro/firebase-app.2840bd36.js","astro:scripts/before-hydration.js":""},"assets":["/_astro/index.1eaf97c3.css","/_astro/index.e56fc6b3.css","/_astro/server.1dabec03.css","/_astro/_...slug_.48ea2ee1.css","/manifest.webmanifest","/robots.txt","/sw.js","/workbox-e0d788d4.js","/_astro/Carousel.06e8cee5.js","/_astro/HeroSlider.2c4563ee.js","/_astro/PitchBar.8945ceb4.js","/_astro/Prices.bc136725.js","/_astro/ShopHeader.5d83d6d5.js","/_astro/_commonjsHelpers.725317a4.js","/_astro/_plugin-vue_export-helper.d71c044e.js","/_astro/client.97e9e785.js","/_astro/client.f447e2e8.js","/_astro/firebase-app.2840bd36.js","/_astro/format-money.d54c1237.js","/_astro/hoisted.56fa2eff.js","/_astro/idle-callback.889bf0ea.js","/_astro/index.2899cbe4.js","/_astro/index.b12dff85.js","/_astro/index.es.28e34903.js","/_astro/modules-info.ea748f9d.js","/_astro/preload-helper.101896b7.js","/_astro/runtime-dom.esm-bundler.e9908a78.js","/_astro/server.browser.e1b1e312.js","/_astro/session-utm.ac492493.js","/_astro/workbox-window.prod.es5.dc90f814.js","/admin/index.html","/assets/cms-preview.css","/assets/cms.css","/assets/cvv.png","/assets/img-placeholder.png","/assets/payments.png","/assets/ssl-safe.png","/img/icon.png","/img/large-icon.png","/admin/assets/Range.es-3e45690c.js","/admin/assets/SchemaReference.es-68e2a833.js","/admin/assets/brace-fold.es-f96db61f.js","/admin/assets/closebrackets.es-0488b839.js","/admin/assets/codemirror.es-15b9374a.js","/admin/assets/comment.es-d4bed417.js","/admin/assets/dialog.es-56aaee5b.js","/admin/assets/foldgutter.es-55067bee.js","/admin/assets/forEachState.es-1e367fb2.js","/admin/assets/hint.es-07ec11aa.js","/admin/assets/hint.es2-35fd7219.js","/admin/assets/index-64cd926d.css","/admin/assets/index-d5c6a1a9.js","/admin/assets/index-f1d880da.js","/admin/assets/info-addon.es-eded2c26.js","/admin/assets/info.es-93649208.js","/admin/assets/javascript.es-634a06b1.js","/admin/assets/jump-to-line.es-23d2d4a8.js","/admin/assets/jump.es-732b233e.js","/admin/assets/lint.es-240359bd.js","/admin/assets/lint.es2-df11292b.js","/admin/assets/lint.es3-aa543b52.js","/admin/assets/matchbrackets.es-f5e3ac04.js","/admin/assets/mode-indent.es-341daf63.js","/admin/assets/mode.es-c74239d3.js","/admin/assets/mode.es2-9319d2a9.js","/admin/assets/mode.es3-deb92d78.js","/admin/assets/search.es-143ba137.js","/admin/assets/searchcursor.es-6069a13e.js","/admin/assets/show-hint.es-ff4fde1d.js","/admin/assets/sublime.es-23f726a0.js","/img/uploads/banner1.png","/img/uploads/banner2.png","/img/uploads/banner2.webp","/img/uploads/ecom-icon.png","/img/uploads/favicon.png","/img/uploads/headless.png","/img/uploads/headphone.png","/img/uploads/headphone.webp","/img/uploads/logo.png","/img/uploads/og-image.png","/img/uploads/passion.png","/img/uploads/passion.webp","/img/uploads/pwa-reliable.png","/img/uploads/rect8589.png","/img/uploads/rect859.png","/img/uploads/rect89.png","/img/uploads/rect89.webp","/img/uploads/ssl-safe.png"]}), {
|
|
3079
3079
|
pageMap: pageMap,
|
|
3080
3080
|
renderers: renderers
|
|
3081
3081
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/storefront",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.10.0",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront with Astro",
|
|
6
6
|
"bin": {
|
|
7
7
|
"storefront": "./scripts/build-prod.sh"
|
|
@@ -20,10 +20,13 @@
|
|
|
20
20
|
"homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/storefront#readme",
|
|
21
21
|
"scripts": {
|
|
22
22
|
"dev": "astro dev",
|
|
23
|
-
"
|
|
23
|
+
"dev:cms": "tinacms dev -c \"astro dev\"",
|
|
24
|
+
"start": "tinacms build && astro dev --host",
|
|
24
25
|
"build": "astro build",
|
|
25
26
|
"build:static": "BUILD_OUTPUT=static astro build",
|
|
26
27
|
"build:prod": "bash scripts/build-prod.sh",
|
|
28
|
+
"build:cms": "tinacms build",
|
|
29
|
+
"build:all": "concurrently \"npm run build:prod\" \"npm run build:cms\"",
|
|
27
30
|
"preview": "astro preview",
|
|
28
31
|
"astro": "astro",
|
|
29
32
|
"prepare-monorepo": "bash scripts/prepare-monorepo.sh"
|
|
@@ -40,20 +43,25 @@
|
|
|
40
43
|
"@headlessui/vue": "^1.7.13",
|
|
41
44
|
"@iconify-json/fa6-brands": "^1.1.11",
|
|
42
45
|
"@iconify-json/heroicons": "^1.1.10",
|
|
43
|
-
"@iconify-json/logos": "^1.1.
|
|
46
|
+
"@iconify-json/logos": "^1.1.25",
|
|
47
|
+
"@tinacms/cli": "^1.5.6",
|
|
44
48
|
"@vite-pwa/astro": "^0.0.5",
|
|
45
|
-
"@vueuse/core": "10.0
|
|
49
|
+
"@vueuse/core": "10.1.0",
|
|
46
50
|
"astro": "2.3.0",
|
|
47
51
|
"chroma-js": "^2.4.2",
|
|
52
|
+
"concurrently": "^8.0.1",
|
|
48
53
|
"dotenv": "^16.0.3",
|
|
49
|
-
"firebase": "^9.
|
|
54
|
+
"firebase": "^9.20.0",
|
|
50
55
|
"image-size": "^1.0.2",
|
|
51
56
|
"mime": "^3.0.0",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
+
"react": "^18.2.0",
|
|
58
|
+
"react-dom": "^18.2.0",
|
|
59
|
+
"semver": "^7.5.0",
|
|
60
|
+
"sharp": "^0.32.0",
|
|
61
|
+
"tailwindcss": "^3.3.2",
|
|
62
|
+
"tinacms": "^1.4.6",
|
|
63
|
+
"unocss": "^0.51.8",
|
|
64
|
+
"vite": "^4.3.2",
|
|
57
65
|
"vite-plugin-pwa": "^0.14.7",
|
|
58
66
|
"vue": "^3.2.47"
|
|
59
67
|
},
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
rm -rf content && ln -s ../../store/functions/ssr/content content
|
|
4
4
|
rm -rf public && ln -s ../../store/functions/ssr/public public
|
|
5
|
+
rm -rf src/content && ln -s ../../../store/functions/ssr/src/content src/content
|
|
5
6
|
rm -rf src/pages && ln -s ../../../store/functions/ssr/src/pages src/pages
|
|
6
7
|
rm -rf src/layouts && ln -s ../../../store/functions/ssr/src/layouts src/layouts
|
|
7
8
|
rm -rf src/main && ln -s ../../../store/functions/ssr/src/main src/main
|
|
8
9
|
rm -rf src/components && ln -s ../../../store/functions/ssr/src/components src/components
|
|
9
10
|
rm -rf src/scripts && ln -s ../../../store/functions/ssr/src/scripts src/scripts
|
|
10
11
|
rm -rf src/assets && ln -s ../../../store/functions/ssr/src/assets src/assets
|
|
12
|
+
rm -rf tina && ln -s ../../store/functions/ssr/tina tina
|
|
@@ -60,8 +60,15 @@ const calcSlidesWidth = () => {
|
|
|
60
60
|
width: node.offsetWidth,
|
|
61
61
|
}));
|
|
62
62
|
};
|
|
63
|
-
const calcNextWidth = (direction) => {
|
|
64
|
-
|
|
63
|
+
const calcNextWidth = (direction: number) => {
|
|
64
|
+
let nextSlideIndex = currentIndex.value + direction;
|
|
65
|
+
if (nextSlideIndex >= slidesWidth.value.length) {
|
|
66
|
+
nextSlideIndex = 0;
|
|
67
|
+
direction = -direction;
|
|
68
|
+
} else if (nextSlideIndex < 0) {
|
|
69
|
+
nextSlideIndex = slidesWidth.value.length - 1;
|
|
70
|
+
direction = -direction;
|
|
71
|
+
}
|
|
65
72
|
const width = slidesWidth.value[nextSlideIndex]?.width || 0;
|
|
66
73
|
if (!width) {
|
|
67
74
|
return 0;
|
|
@@ -93,18 +100,6 @@ const restartAutoplay = () => {
|
|
|
93
100
|
}
|
|
94
101
|
};
|
|
95
102
|
const changeSlide = (direction: number) => {
|
|
96
|
-
if (direction < 0) {
|
|
97
|
-
if (isBoundLeft.value) {
|
|
98
|
-
calcIndexCount();
|
|
99
|
-
currentIndex.value = indexCount.value - 1;
|
|
100
|
-
changeSlide(1);
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
} else if (isBoundRight.value) {
|
|
104
|
-
currentIndex.value = 1;
|
|
105
|
-
changeSlide(-1);
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
103
|
const nextSlideWidth = calcNextWidth(direction);
|
|
109
104
|
if (nextSlideWidth) {
|
|
110
105
|
wrapper.value?.scrollBy({ left: nextSlideWidth, behavior: 'smooth' });
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<main>
|
|
3
|
+
<h1>{{ data?.data?.post.title }}</h1>
|
|
4
|
+
<pre>
|
|
5
|
+
<!-- @ts-ignore -->
|
|
6
|
+
{{ JSON.stringify(data?.data?.post?.body, null, 2) }}
|
|
7
|
+
</pre>
|
|
8
|
+
</main>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { defineComponent } from 'vue'
|
|
13
|
+
|
|
14
|
+
import { client } from '../../../tina/__generated__/client'
|
|
15
|
+
import type { PostQuery, Exact } from '../../../tina/__generated__/types'
|
|
16
|
+
|
|
17
|
+
interface Data {
|
|
18
|
+
data: PostQuery
|
|
19
|
+
variables: Exact<{
|
|
20
|
+
relativePath: string
|
|
21
|
+
}>
|
|
22
|
+
query: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getTinaUpdates<T extends object>({
|
|
26
|
+
data,
|
|
27
|
+
query,
|
|
28
|
+
variables,
|
|
29
|
+
cb,
|
|
30
|
+
}: {
|
|
31
|
+
query: string
|
|
32
|
+
variables: object
|
|
33
|
+
data: T
|
|
34
|
+
cb: (data: T) => void
|
|
35
|
+
}) {
|
|
36
|
+
if (!import.meta.env.SSR) {
|
|
37
|
+
const id = btoa(JSON.stringify({ query: query }))
|
|
38
|
+
window.parent.postMessage(
|
|
39
|
+
// was getting errors in vue here. Is it OK to parse and stringify?
|
|
40
|
+
JSON.parse(JSON.stringify({ type: 'open', data, query, variables, id })),
|
|
41
|
+
window.location.origin
|
|
42
|
+
)
|
|
43
|
+
window.addEventListener('message', (event) => {
|
|
44
|
+
if (event.data.id === id) {
|
|
45
|
+
console.log('child: event received')
|
|
46
|
+
cb(event.data.data)
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const closeTinaConnection = ({
|
|
52
|
+
query,
|
|
53
|
+
id,
|
|
54
|
+
}: {
|
|
55
|
+
query: string
|
|
56
|
+
id?: string
|
|
57
|
+
}) => {
|
|
58
|
+
if (!import.meta.env.SSR) {
|
|
59
|
+
window.parent.postMessage(
|
|
60
|
+
{ type: 'close', id: id || btoa(JSON.stringify({ query: query })) },
|
|
61
|
+
window.location.origin
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default defineComponent<
|
|
67
|
+
{},
|
|
68
|
+
{ fetchPost: () => Promise<void> },
|
|
69
|
+
{ data: Data; loading: boolean }
|
|
70
|
+
>({
|
|
71
|
+
name: 'Post',
|
|
72
|
+
data() {
|
|
73
|
+
return {
|
|
74
|
+
loading: false,
|
|
75
|
+
data: null as unknown as Data,
|
|
76
|
+
error: null,
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
created() {
|
|
80
|
+
// watch the params of the route to fetch the data again
|
|
81
|
+
this.fetchPost().then(() => {
|
|
82
|
+
getTinaUpdates({
|
|
83
|
+
cb: (newData) => {
|
|
84
|
+
this.$data.data = {
|
|
85
|
+
...this.$data.data,
|
|
86
|
+
data: newData,
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
data: this.data.data,
|
|
90
|
+
query: this.data.query,
|
|
91
|
+
variables: this.data.variables,
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
},
|
|
95
|
+
unmounted() {
|
|
96
|
+
closeTinaConnection({ query: this.data.query })
|
|
97
|
+
},
|
|
98
|
+
methods: {
|
|
99
|
+
async fetchPost() {
|
|
100
|
+
this.loading = true
|
|
101
|
+
this.data = await client.queries.post({
|
|
102
|
+
relativePath: 'hello-tinacms.md',
|
|
103
|
+
})
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
|
+
</script>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { CmsLayout } from '@@sf/cms';
|
|
1
2
|
import { computed } from 'vue';
|
|
2
3
|
import { parseShippingPhrase } from '@@sf/state/modules-info';
|
|
4
|
+
import { useCMSPreview } from '@@sf/state/use-cms-preview';
|
|
3
5
|
|
|
4
6
|
export interface Props {
|
|
5
7
|
slides: Array<{
|
|
@@ -9,10 +11,27 @@ export interface Props {
|
|
|
9
11
|
}>;
|
|
10
12
|
}
|
|
11
13
|
|
|
14
|
+
const parseLayoutContent = (layoutContent: CmsLayout) => {
|
|
15
|
+
const pitchBar: Props = { slides: [] };
|
|
16
|
+
if (layoutContent.header?.pitch_bar) {
|
|
17
|
+
pitchBar.slides = layoutContent.header.pitch_bar;
|
|
18
|
+
}
|
|
19
|
+
return pitchBar;
|
|
20
|
+
};
|
|
21
|
+
|
|
12
22
|
const usePitchBar = (props: Props) => {
|
|
23
|
+
const { liveContent } = useCMSPreview(async (tinaClient) => {
|
|
24
|
+
return tinaClient.queries.layout({ relativePath: 'layout.json' });
|
|
25
|
+
});
|
|
13
26
|
const parsedContents = computed(() => {
|
|
14
|
-
|
|
15
|
-
|
|
27
|
+
const slides = liveContent.layout
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
? parseLayoutContent(liveContent.layout).slides
|
|
30
|
+
: props.slides;
|
|
31
|
+
return slides.map(({ html }) => {
|
|
32
|
+
return parseShippingPhrase(html).value
|
|
33
|
+
.replace(/<\/?p>/g, '')
|
|
34
|
+
.replace(/<(\/?d-md)>/g, '<$1>');
|
|
16
35
|
});
|
|
17
36
|
});
|
|
18
37
|
const countValidSlides = computed(() => {
|
|
@@ -25,3 +44,8 @@ const usePitchBar = (props: Props) => {
|
|
|
25
44
|
};
|
|
26
45
|
|
|
27
46
|
export default usePitchBar;
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
parseLayoutContent,
|
|
50
|
+
usePitchBar,
|
|
51
|
+
};
|
|
@@ -17,6 +17,7 @@ const {
|
|
|
17
17
|
currencySymbol,
|
|
18
18
|
domain,
|
|
19
19
|
settings,
|
|
20
|
+
isPreview,
|
|
20
21
|
},
|
|
21
22
|
} = Astro.props as Props;
|
|
22
23
|
|
|
@@ -56,6 +57,10 @@ window.storefront.context = ${JSON.stringify({
|
|
|
56
57
|
timestamp: Date.now(),
|
|
57
58
|
})};`;
|
|
58
59
|
}
|
|
60
|
+
if (isPreview) {
|
|
61
|
+
inlineClientJS += `
|
|
62
|
+
window.isCMSPreview = true;`;
|
|
63
|
+
}
|
|
59
64
|
|
|
60
65
|
const inlineJSONLd = JSON.stringify({
|
|
61
66
|
'@context': 'http://schema.org',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PageContext } from '@@sf/ssr-context';
|
|
2
2
|
import type { CmsLayout } from '@@sf/cms';
|
|
3
|
-
import type { Props as PitchBarProps } from '@@sf/composables/use-pitch-bar';
|
|
4
3
|
import type { Props as UseShopHeaderProps } from '@@sf/composables/use-shop-header';
|
|
4
|
+
import { parseLayoutContent } from '@@sf/composables/use-pitch-bar';
|
|
5
5
|
|
|
6
6
|
type ShopHeaderProps = Omit<UseShopHeaderProps, 'header'> & {
|
|
7
7
|
serviceLinks?: CmsLayout['service_links'],
|
|
@@ -13,14 +13,12 @@ export interface Props {
|
|
|
13
13
|
|
|
14
14
|
const usePageLayout = async ({ pageContext }: Props) => {
|
|
15
15
|
const { apiState, cms } = pageContext;
|
|
16
|
+
const cmsLayout = await cms('layout');
|
|
16
17
|
const {
|
|
17
18
|
header: cmsHeader,
|
|
18
19
|
service_links: cmsServiceLinks,
|
|
19
|
-
} =
|
|
20
|
-
const pitchBar
|
|
21
|
-
if (cmsHeader?.pitch_bar) {
|
|
22
|
-
pitchBar.slides = cmsHeader.pitch_bar;
|
|
23
|
-
}
|
|
20
|
+
} = cmsLayout;
|
|
21
|
+
const pitchBar = parseLayoutContent(cmsLayout);
|
|
24
22
|
const shopHeader: ShopHeaderProps = {
|
|
25
23
|
categories: apiState.categories || [],
|
|
26
24
|
menuCategorySlugs: cmsHeader.inline_menu_categories?.featured,
|
|
@@ -38,4 +36,4 @@ export default usePageLayout;
|
|
|
38
36
|
|
|
39
37
|
export { usePageLayout };
|
|
40
38
|
|
|
41
|
-
export type {
|
|
39
|
+
export type { ShopHeaderProps };
|