cloudcommerce 2.6.4 → 2.6.5
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/.github/workflows/test-apps.yml +2 -2
- package/CHANGELOG.md +9 -0
- package/action.yml +2 -2
- package/ecomplus-stores/barradoce/.gitpod.yml +1 -1
- package/ecomplus-stores/barradoce/.idx/dev.nix +5 -4
- package/ecomplus-stores/barradoce/functions/many/package.json +3 -3
- package/ecomplus-stores/barradoce/functions/ssr/content/pages/home.json +3 -0
- package/ecomplus-stores/barradoce/functions/ssr/content/pages/products.json +3 -0
- package/ecomplus-stores/barradoce/functions/ssr/content/types.d.ts +1 -1
- package/ecomplus-stores/barradoce/functions/ssr/package.json +6 -6
- package/ecomplus-stores/barradoce/functions/ssr/src/components/BuyerReviews.vue +83 -0
- package/ecomplus-stores/barradoce/functions/ssr/src/components/CheckoutPage.vue +6 -6
- package/ecomplus-stores/barradoce/functions/ssr/src/components/FooterStamps.vue +4 -4
- package/ecomplus-stores/barradoce/functions/ssr/src/components/ProductDetails.vue +36 -5
- package/ecomplus-stores/barradoce/functions/ssr/src/components/ShippingCalculator.vue +1 -1
- package/ecomplus-stores/barradoce/functions/ssr/src/main/content/Sections.astro +4 -0
- package/ecomplus-stores/barradoce/functions/with-apps/package.json +3 -3
- package/ecomplus-stores/barradoce/package.json +2 -2
- package/package.json +2 -2
- package/packages/api/package.json +1 -1
- package/packages/apps/affiliate-program/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/datafrete/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +1 -1
- package/packages/apps/fb-conversions/package.json +1 -1
- package/packages/apps/flash-courier/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/galaxpay/package.json +1 -1
- package/packages/apps/google-analytics/package.json +1 -1
- package/packages/apps/jadlog/package.json +1 -1
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/mandae/package.json +1 -1
- package/packages/apps/melhor-envio/package.json +1 -1
- package/packages/apps/mercadopago/package.json +1 -1
- package/packages/apps/pagarme/package.json +1 -1
- package/packages/apps/pagarme-v5/package.json +1 -1
- package/packages/apps/paghiper/package.json +1 -1
- package/packages/apps/pix/package.json +1 -1
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/apps/webhooks/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +1 -1
- package/packages/eslint/package.json +1 -1
- package/packages/events/package.json +1 -1
- package/packages/feeds/package.json +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/i18n/package.json +1 -1
- package/packages/modules/package.json +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/ssr/lib/lib/cron-ssr-save-views.js +8 -86
- package/packages/ssr/lib/lib/cron-ssr-save-views.js.map +1 -1
- package/packages/ssr/package.json +2 -2
- package/packages/ssr/src/lib/cron-ssr-save-views.ts +8 -92
- package/packages/storefront/package.json +2 -2
- package/packages/storefront/src/lib/components/Carousel.vue +6 -0
- package/packages/test-base/package.json +1 -1
- package/packages/types/package.json +1 -1
|
@@ -104,11 +104,11 @@ jobs:
|
|
|
104
104
|
${{ steps.npm-paths.outputs.LIB_PATH }}
|
|
105
105
|
${{ steps.npm-paths.outputs.BIN_PATH }}
|
|
106
106
|
~/.npm-global/bin
|
|
107
|
-
key: ${{ runner.os }}-npm-globals-firebase-tools-13.
|
|
107
|
+
key: ${{ runner.os }}-npm-globals-firebase-tools-13.4.0
|
|
108
108
|
|
|
109
109
|
- if: steps.npm-g-cache.outputs.cache-hit != 'true'
|
|
110
110
|
shell: bash
|
|
111
|
-
run: npm install -g firebase-tools@13.
|
|
111
|
+
run: npm install -g firebase-tools@13.4.0
|
|
112
112
|
|
|
113
113
|
- name: Initialize Firebase emulators
|
|
114
114
|
shell: bash
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [2.6.5](https://github.com/ecomplus/cloud-commerce/compare/v2.6.4...v2.6.5) (2024-02-29)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **ssr:** Revert bump bunny.net CDN cache with /purge request only, then refresh with simple URL get ([72518e0](https://github.com/ecomplus/cloud-commerce/commit/72518e0bdfcfca308696f47a10699f8b9c53239b))
|
|
11
|
+
* **storefront:** Bump Astro to latest v4.4.6 ([be8239b](https://github.com/ecomplus/cloud-commerce/commit/be8239bf7966cb742ddac0365163d3281ea0c41a))
|
|
12
|
+
* **storefront:** Prevent `<Carousel>` scroll reset on mobile browser bar toogle ([9817280](https://github.com/ecomplus/cloud-commerce/commit/9817280dd4f16931de50dddb662208a21a83ed56))
|
|
13
|
+
|
|
5
14
|
### [2.6.4](https://github.com/ecomplus/cloud-commerce/compare/v2.6.3...v2.6.4) (2024-02-27)
|
|
6
15
|
|
|
7
16
|
|
package/action.yml
CHANGED
|
@@ -138,11 +138,11 @@ runs:
|
|
|
138
138
|
${{ steps.npm-paths.outputs.LIB_PATH }}
|
|
139
139
|
${{ steps.npm-paths.outputs.BIN_PATH }}
|
|
140
140
|
~/.npm-global/bin
|
|
141
|
-
key: ${{ runner.os }}-npm-g-firebase-tools-13.
|
|
141
|
+
key: ${{ runner.os }}-npm-g-firebase-tools-13.4.0
|
|
142
142
|
|
|
143
143
|
- if: github.event_name == 'push' && steps.npm-g-cache.outputs.cache-hit != 'true'
|
|
144
144
|
shell: bash
|
|
145
|
-
run: npm i --location=global firebase-tools@13.
|
|
145
|
+
run: npm i --location=global firebase-tools@13.4.0
|
|
146
146
|
|
|
147
147
|
- if: github.event_name == 'push'
|
|
148
148
|
uses: dorny/paths-filter@v3.0.1
|
|
@@ -6,11 +6,12 @@
|
|
|
6
6
|
];
|
|
7
7
|
idx.extensions = [
|
|
8
8
|
"vue.volar"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
# "astro-build.astro-vscode",
|
|
12
|
-
# "bradlc.vscode-tailwindcss",
|
|
9
|
+
"astro-build.astro-vscode"
|
|
10
|
+
"bradlc.vscode-tailwindcss"
|
|
13
11
|
];
|
|
12
|
+
idx.workspace.onCreate = {
|
|
13
|
+
npm-install = "npm install && npm install --prefix functions/ssr";
|
|
14
|
+
};
|
|
14
15
|
idx.previews = {
|
|
15
16
|
enable = true;
|
|
16
17
|
previews = [
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"main": "index.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cloudcommerce/feeds": "^2.6.
|
|
19
|
-
"@cloudcommerce/firebase": "^2.6.
|
|
20
|
-
"@cloudcommerce/passport": "^2.6.
|
|
18
|
+
"@cloudcommerce/feeds": "^2.6.4",
|
|
19
|
+
"@cloudcommerce/firebase": "^2.6.4",
|
|
20
|
+
"@cloudcommerce/passport": "^2.6.4"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
},
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@cloudcommerce/api": "^2.6.
|
|
23
|
-
"@cloudcommerce/firebase": "^2.6.
|
|
24
|
-
"@cloudcommerce/ssr": "^2.6.
|
|
22
|
+
"@cloudcommerce/api": "^2.6.4",
|
|
23
|
+
"@cloudcommerce/firebase": "^2.6.4",
|
|
24
|
+
"@cloudcommerce/ssr": "^2.6.4",
|
|
25
25
|
"@headlessui/vue": "^1.7.18",
|
|
26
26
|
"micromark": "^4.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@cloudcommerce/i18n": "^2.6.
|
|
30
|
-
"@cloudcommerce/storefront": "^2.6.
|
|
31
|
-
"@cloudcommerce/types": "^2.6.
|
|
29
|
+
"@cloudcommerce/i18n": "^2.6.4",
|
|
30
|
+
"@cloudcommerce/storefront": "^2.6.4",
|
|
31
|
+
"@cloudcommerce/types": "^2.6.4",
|
|
32
32
|
"@iconify-json/mingcute": "^1.1.16",
|
|
33
33
|
"photoswipe": "^5.4.3"
|
|
34
34
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section id="reviews" class="bg-white">
|
|
3
|
+
<div class="ui-section">
|
|
4
|
+
<div class="text-center">
|
|
5
|
+
<h4
|
|
6
|
+
v-if="title"
|
|
7
|
+
class="text-center text-base-900 ui-title"
|
|
8
|
+
>
|
|
9
|
+
{{ title }}
|
|
10
|
+
</h4>
|
|
11
|
+
<ALink
|
|
12
|
+
class="mt-1.5 inline-block text-sm text-base-600 ui-link"
|
|
13
|
+
href="https://customerreviews.google.com/v/merchant?q=barradoce.com.br&c=BR&v=19&hl=pt_BR"
|
|
14
|
+
>
|
|
15
|
+
<i class="mr-0.5 i-external-link-line"></i>
|
|
16
|
+
Ver avaliações no Google
|
|
17
|
+
</ALink>
|
|
18
|
+
</div>
|
|
19
|
+
<Carousel class="mt-8 pb-9">
|
|
20
|
+
<li
|
|
21
|
+
v-for="({ name, avatar, comment }, i) in reviews" :key="i"
|
|
22
|
+
class="shrink-0 basis-full px-1.5 md:basis-1/3 md:px-3"
|
|
23
|
+
>
|
|
24
|
+
<blockquote class="h-full rounded bg-secondary-100/10 p-6 sm:p-8">
|
|
25
|
+
<div class="flex items-center gap-4">
|
|
26
|
+
<AImg
|
|
27
|
+
v-if="avatar"
|
|
28
|
+
:picture="{ url: avatar }"
|
|
29
|
+
:alt="`Avatar no comentário de ${name}`"
|
|
30
|
+
class="size-11 rounded-full object-cover"
|
|
31
|
+
/>
|
|
32
|
+
<div>
|
|
33
|
+
<div class="flex gap-0.5 text-yellow-400">
|
|
34
|
+
<i v-for="n in 5" :key="`${i}-${n}`" class="i-star-solid"></i>
|
|
35
|
+
</div>
|
|
36
|
+
<p class="mt-0.5 line-clamp-1 text-sm
|
|
37
|
+
font-medium text-base-800">
|
|
38
|
+
{{ name }}
|
|
39
|
+
</p>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
<p
|
|
43
|
+
class="mt-5 line-clamp-5 text-base-600 md:line-clamp-6"
|
|
44
|
+
:class="[
|
|
45
|
+
comment.length < 40 && 'text-xl',
|
|
46
|
+
comment.length > 39 && comment.length < 60 && 'text-lg',
|
|
47
|
+
]"
|
|
48
|
+
>
|
|
49
|
+
{{ comment }}
|
|
50
|
+
</p>
|
|
51
|
+
</blockquote>
|
|
52
|
+
</li>
|
|
53
|
+
<template #controls>
|
|
54
|
+
<div class="relative mx-auto mt-3 max-w-20
|
|
55
|
+
text-3xl text-primary-400">
|
|
56
|
+
<CarouselControl is-prev>
|
|
57
|
+
<i class="rotate-180 i-arrow-right-line
|
|
58
|
+
hover:scale-110 hover:text-primary"></i>
|
|
59
|
+
</CarouselControl>
|
|
60
|
+
<CarouselControl>
|
|
61
|
+
<i class="i-arrow-right-line
|
|
62
|
+
hover:scale-110 hover:text-primary"></i>
|
|
63
|
+
</CarouselControl>
|
|
64
|
+
</div>
|
|
65
|
+
</template>
|
|
66
|
+
</Carousel>
|
|
67
|
+
</div>
|
|
68
|
+
</section>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<script setup lang="ts">
|
|
72
|
+
export interface Props {
|
|
73
|
+
autoplay?: number;
|
|
74
|
+
title?: string;
|
|
75
|
+
reviews: {
|
|
76
|
+
name: string;
|
|
77
|
+
avatar?: string;
|
|
78
|
+
comment: string;
|
|
79
|
+
}[];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
defineProps<Props>();
|
|
83
|
+
</script>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<article class="flex min-h-screen flex-col justify-end">
|
|
3
3
|
<section class="bg-base-50">
|
|
4
|
-
<div class="
|
|
5
|
-
|
|
4
|
+
<div class="flex flex-wrap items-center
|
|
5
|
+
justify-center gap-6 ui-section lg:gap-12">
|
|
6
6
|
<a href="/">
|
|
7
7
|
<slot name="logo" />
|
|
8
8
|
</a>
|
|
9
9
|
<div class="flex items-center gap-2">
|
|
10
|
-
<i class="bg-success-400 i-shield-check-solid
|
|
11
|
-
<span class="text-base
|
|
10
|
+
<i class="m-0 bg-success-400 text-3xl i-shield-check-solid"></i>
|
|
11
|
+
<span class="text-base text-base-600">
|
|
12
12
|
{{ $t.i19safeBuy }}
|
|
13
13
|
</span>
|
|
14
14
|
</div>
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<section class="grow">
|
|
18
18
|
<article id="storefront-app"></article>
|
|
19
19
|
</section>
|
|
20
|
-
<section class="bg-base-50
|
|
20
|
+
<section class="mt-4 bg-base-50 lg:mt-8">
|
|
21
21
|
<nav class="ui-section-slim">
|
|
22
22
|
<ul class="mt-6 flex flex-wrap justify-center gap-6 lg:gap-8">
|
|
23
23
|
<li
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
>
|
|
27
27
|
<ALink :href="href" target="blank" class="text-base-700 ui-link">
|
|
28
28
|
{{ title }}
|
|
29
|
-
<i class="bg-base-300 i-
|
|
29
|
+
<i class="ml-0.5 bg-base-300 i-external-link-line"></i>
|
|
30
30
|
</ALink>
|
|
31
31
|
</li>
|
|
32
32
|
</ul>
|
|
@@ -10,18 +10,18 @@
|
|
|
10
10
|
<span v-if="!stamp.img" class="flex items-center">
|
|
11
11
|
<span
|
|
12
12
|
v-if="stamp.icon"
|
|
13
|
-
class="
|
|
14
|
-
|
|
13
|
+
class="mr-2 text-4xl [&>*]:bg-gradient-to-br
|
|
14
|
+
[&>*]:from-success-200 [&>*]:to-success-700"
|
|
15
15
|
>
|
|
16
16
|
<i v-if="stamp.icon === 'lock'" class="i-lock-closed"></i>
|
|
17
17
|
<i v-else-if="stamp.icon === 'check'" class="i-check-badge"></i>
|
|
18
18
|
<i v-else class="i-arrow-path-rounded-square"></i>
|
|
19
19
|
</span>
|
|
20
|
-
<span class="
|
|
20
|
+
<span class="max-w-[140px] text-sm font-medium text-base-600">
|
|
21
21
|
{{ stamp.alt }}
|
|
22
22
|
<i
|
|
23
23
|
v-if="stamp.href && stamp.href.charAt(0) !== '/'"
|
|
24
|
-
class="bg-base-400 i-
|
|
24
|
+
class="ml-0.5 bg-base-400 i-external-link-line"
|
|
25
25
|
></i>
|
|
26
26
|
</span>
|
|
27
27
|
</span>
|
|
@@ -8,16 +8,30 @@
|
|
|
8
8
|
</div>
|
|
9
9
|
<div class="top-0 pt-4 transition-transform
|
|
10
10
|
lg:sticky lg:pb-4 lg:sticky-header:translate-y-24">
|
|
11
|
-
<ul class="flax-wrap mb-3 flex gap-2">
|
|
11
|
+
<ul class="flax-wrap mb-3 flex gap-2 overflow-hidden lg:grid xl:flex">
|
|
12
12
|
<li class="flex items-center gap-1 py-1 font-normal ui-badge-pill">
|
|
13
|
-
<i class="m-0 text-secondary-700
|
|
13
|
+
<i class="m-0 text-secondary-700
|
|
14
|
+
i-arrow-path-rounded-square-16-solid"></i>
|
|
14
15
|
<span class="whitespace-nowrap text-sm">devolução grátis</span>
|
|
15
16
|
</li>
|
|
16
|
-
<li class="flex items-center gap-1 py-1
|
|
17
|
+
<li class="flex items-center gap-1 bg-transparent py-1
|
|
18
|
+
font-normal ui-badge-pill">
|
|
17
19
|
<i class="m-0 text-secondary-700 i-building-storefront-solid"></i>
|
|
18
20
|
<span class="whitespace-nowrap text-sm">desde 1984</span>
|
|
19
21
|
</li>
|
|
20
22
|
</ul>
|
|
23
|
+
<a class="my-2 flex items-center gap-2 xl:my-3" href="#reviews">
|
|
24
|
+
<div class="flex gap-0.5 text-yellow-400">
|
|
25
|
+
<i v-for="n in 5" :key="`s${n}`" class="m-0 i-star-solid"></i>
|
|
26
|
+
</div>
|
|
27
|
+
<span class="flex flex-wrap items-end gap-x-1.5">
|
|
28
|
+
<span>
|
|
29
|
+
<span class="font-medium">4,9</span>
|
|
30
|
+
<span class="font-light text-base-500">/5</span>
|
|
31
|
+
</span>
|
|
32
|
+
<small class="shrink-0 text-base-700">(470+ avaliações)</small>
|
|
33
|
+
</span>
|
|
34
|
+
</a>
|
|
21
35
|
<h1 class="text-lg text-base-600 ui-text-brand">
|
|
22
36
|
{{ title }}
|
|
23
37
|
</h1>
|
|
@@ -66,8 +80,25 @@
|
|
|
66
80
|
{{ $t.i19addToCart }}
|
|
67
81
|
</button>
|
|
68
82
|
</div>
|
|
69
|
-
<div class="mt-6
|
|
70
|
-
|
|
83
|
+
<div class="mt-6 flex flex-col
|
|
84
|
+
items-start justify-start gap-3 rounded
|
|
85
|
+
border-2 border-base-50 border-t-secondary-100 p-4 sm:flex-row
|
|
86
|
+
sm:justify-between lg:mt-4 lg:grid">
|
|
87
|
+
<div
|
|
88
|
+
v-if="!product.production_time"
|
|
89
|
+
class="flex items-center gap-2.5 sm:order-last lg:order-none"
|
|
90
|
+
>
|
|
91
|
+
<div class="relative flex size-3">
|
|
92
|
+
<span class="absolute inline-flex size-full animate-ping rounded-full
|
|
93
|
+
bg-success-200 opacity-75"></span>
|
|
94
|
+
<span class="relative inline-flex
|
|
95
|
+
size-3 rounded-full bg-success-300"></span>
|
|
96
|
+
</div>
|
|
97
|
+
<span class="text-balance text-sm
|
|
98
|
+
font-medium lowercase text-base-800">
|
|
99
|
+
Em estoque, pronto para envio
|
|
100
|
+
</span>
|
|
101
|
+
</div>
|
|
71
102
|
<ShippingCalculator
|
|
72
103
|
:shipped-items="[{ ...product, quantity }]"
|
|
73
104
|
has-label
|
|
@@ -13,6 +13,7 @@ import SearchShowcase from '~/components/SearchShowcase.vue';
|
|
|
13
13
|
import PageTitle from '~/components/PageTitle.vue';
|
|
14
14
|
import ContentEntry from '~/components/ContentEntry.vue';
|
|
15
15
|
import middSearchEngine from '~/state/midd-search-engine';
|
|
16
|
+
import BuyerReviews from '~/components/BuyerReviews.vue';
|
|
16
17
|
|
|
17
18
|
const { routeContext } = Astro.locals;
|
|
18
19
|
const { sections } = await usePageSections({
|
|
@@ -72,6 +73,9 @@ cause route resource is required to define sections from content. */
|
|
|
72
73
|
return <ContentEntry {...props} />;
|
|
73
74
|
case 'custom-html':
|
|
74
75
|
return <ContentClearfix html={props.html} />;
|
|
76
|
+
case 'c:reviews':
|
|
77
|
+
const reviewsContent = await routeContext.getContent('reviews');
|
|
78
|
+
return <BuyerReviews {...reviewsContent} client:sf="lazy,interaction" />;
|
|
75
79
|
case 'c:foo':
|
|
76
80
|
return <div data-foo={props.foo}></div>;
|
|
77
81
|
default:
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"main": "index.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cloudcommerce/events": "^2.6.
|
|
19
|
-
"@cloudcommerce/firebase": "^2.6.
|
|
20
|
-
"@cloudcommerce/modules": "^2.6.
|
|
18
|
+
"@cloudcommerce/events": "^2.6.4",
|
|
19
|
+
"@cloudcommerce/firebase": "^2.6.4",
|
|
20
|
+
"@cloudcommerce/modules": "^2.6.4"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"url": "https://github.com/ecomplus/cloud-commerce/issues"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@cloudcommerce/cli": "^2.6.
|
|
29
|
+
"@cloudcommerce/cli": "^2.6.4"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@cloudcommerce/eslint": "^2.6.
|
|
32
|
+
"@cloudcommerce/eslint": "^2.6.4",
|
|
33
33
|
"husky": "^9.0.10",
|
|
34
34
|
"lint-staged": "^15.2.2"
|
|
35
35
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcommerce",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.6.
|
|
4
|
+
"version": "2.6.5",
|
|
5
5
|
"description": "Open fair-code headless commerce platform: API-first, microservices based, event driven and cloud native",
|
|
6
6
|
"main": "packages/api/lib/index.js",
|
|
7
7
|
"author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"vite": "^5.1.4",
|
|
37
37
|
"vitest": "^1.3.1",
|
|
38
38
|
"zx": "^7.2.3",
|
|
39
|
-
"@cloudcommerce/eslint": "2.6.
|
|
39
|
+
"@cloudcommerce/eslint": "2.6.5"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"fix-install": "bash scripts/pre-install.sh && pnpm i",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getFirestore } from 'firebase-admin/firestore';
|
|
2
|
-
import { error } from 'firebase-functions/logger';
|
|
2
|
+
import { info, error } from 'firebase-functions/logger';
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import api from '@cloudcommerce/api';
|
|
5
5
|
import config from '@cloudcommerce/firebase/lib/config';
|
|
@@ -7,7 +7,6 @@ import { deleteQueryBatch } from '@cloudcommerce/firebase/lib/helpers/firestore'
|
|
|
7
7
|
|
|
8
8
|
const saveViews = async () => {
|
|
9
9
|
const deployRand = process.env.DEPLOY_RAND || '_';
|
|
10
|
-
const projectId = process.env.GCLOUD_PROJECT;
|
|
11
10
|
const db = getFirestore();
|
|
12
11
|
const productViewsSnapshot = await db.collection('ssrProductViews')
|
|
13
12
|
.limit(500).get();
|
|
@@ -32,10 +31,6 @@ const saveViews = async () => {
|
|
|
32
31
|
}
|
|
33
32
|
const { domain } = config.get().settingsContent;
|
|
34
33
|
if (domain && process.env.BUNNYNET_API_KEY) {
|
|
35
|
-
let bunnyStorageName = process.env.BUNNYNET_STORAGE_NAME;
|
|
36
|
-
let bunnyStoragePass = process.env.BUNNYNET_STORAGE_PASS;
|
|
37
|
-
let bunnyZoneName = process.env.BUNNYNET_ZONE_NAME;
|
|
38
|
-
let permaCacheZoneFolder = '';
|
|
39
34
|
const bunnyAxios = axios.create({
|
|
40
35
|
baseURL: 'https://api.bunny.net/',
|
|
41
36
|
headers: {
|
|
@@ -43,53 +38,6 @@ const saveViews = async () => {
|
|
|
43
38
|
},
|
|
44
39
|
});
|
|
45
40
|
try {
|
|
46
|
-
const storageAuthReqs = [];
|
|
47
|
-
if (!bunnyStorageName || !bunnyStoragePass) {
|
|
48
|
-
storageAuthReqs.push(bunnyAxios.get('/storagezone').then(({ data }) => {
|
|
49
|
-
for (let i = 0; i < data.length; i++) {
|
|
50
|
-
const bunnyStorage = data[i];
|
|
51
|
-
if (bunnyStorageName) {
|
|
52
|
-
if (bunnyStorage.Name === bunnyStorageName) {
|
|
53
|
-
bunnyStoragePass = bunnyStorage.Password;
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
if (bunnyStorage.Name.startsWith('storefront-isr-')) {
|
|
59
|
-
bunnyStorageName = bunnyStorage.Name;
|
|
60
|
-
bunnyStoragePass = bunnyStorage.Password;
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}));
|
|
65
|
-
}
|
|
66
|
-
if (!bunnyZoneName) {
|
|
67
|
-
storageAuthReqs.push(bunnyAxios.get('/pullzone').then(({ data }) => {
|
|
68
|
-
for (let i = 0; i < data.length; i++) {
|
|
69
|
-
const pullZone = data[i];
|
|
70
|
-
if (pullZone.Hostnames.find(({ Value }) => Value === domain)) {
|
|
71
|
-
bunnyZoneName = pullZone.Name;
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}));
|
|
76
|
-
}
|
|
77
|
-
await Promise.all(storageAuthReqs);
|
|
78
|
-
if (bunnyStorageName && bunnyStoragePass && bunnyZoneName) {
|
|
79
|
-
const { data } = await axios({
|
|
80
|
-
url: `https://storage.bunnycdn.com/${bunnyStorageName}/__bcdn_perma_cache__/`,
|
|
81
|
-
headers: {
|
|
82
|
-
AccessKey: bunnyStoragePass,
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
for (let i = 0; i < data.length; i++) {
|
|
86
|
-
const { ObjectName } = data[i];
|
|
87
|
-
if (ObjectName.startsWith(`pullzone__${bunnyZoneName}__`)
|
|
88
|
-
&& (!permaCacheZoneFolder || permaCacheZoneFolder < ObjectName)) {
|
|
89
|
-
permaCacheZoneFolder = ObjectName;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
41
|
const sMaxAge = Number(process.env.SSR_CACHE_MAX_AGE) || 179;
|
|
94
42
|
const pageViewsSnapshot = await db.collection('ssrPageViews')
|
|
95
43
|
.where('at', '>', new Date(Date.now() - 1000 * 60 * 20))
|
|
@@ -103,47 +51,21 @@ const saveViews = async () => {
|
|
|
103
51
|
if (data.isCachePurged) {
|
|
104
52
|
continue;
|
|
105
53
|
}
|
|
106
|
-
const url = data.url.replace(/\?.*$/, '');
|
|
107
|
-
doc.ref.update({ isCachePurged: true });
|
|
54
|
+
const url = data.url.replace(/\?.*$/, '').replace(/#.*$/, '');
|
|
108
55
|
if (url?.startsWith(`https://${domain}`) && !purgedUrls.includes(url)) {
|
|
109
56
|
purgeReqs.push(bunnyAxios('/purge', {
|
|
110
57
|
method: 'POST',
|
|
111
58
|
params: {
|
|
112
|
-
async: 'false',
|
|
59
|
+
// async: 'false',
|
|
113
60
|
url,
|
|
114
61
|
},
|
|
62
|
+
}).then(async () => {
|
|
63
|
+
doc.ref.update({ isCachePurged: true });
|
|
64
|
+
const freshHtmlUrl = `${url}?__isrV=${deployRand}&t=${Date.now()}`;
|
|
65
|
+
await axios.get(freshHtmlUrl);
|
|
66
|
+
info(`Cache bump ${url}`);
|
|
115
67
|
}));
|
|
116
68
|
purgedUrls.push(url);
|
|
117
|
-
if (permaCacheZoneFolder) {
|
|
118
|
-
let pathname = url.replace(`https://${domain}`, '');
|
|
119
|
-
const freshHtmlUrl = `https://${projectId}.web.app${pathname}`
|
|
120
|
-
+ `?__isrV=${deployRand}&t=${Date.now()}`;
|
|
121
|
-
purgeReqs.push(
|
|
122
|
-
// eslint-disable-next-line no-loop-func
|
|
123
|
-
axios.get(freshHtmlUrl).then(({ data: freshHtml }) => {
|
|
124
|
-
if (pathname.charAt(0) === '/') {
|
|
125
|
-
pathname = pathname.slice(1);
|
|
126
|
-
}
|
|
127
|
-
const paths = pathname.split('/');
|
|
128
|
-
const filename = paths.pop() || '';
|
|
129
|
-
let folderpath = paths.join('/');
|
|
130
|
-
if (folderpath) folderpath += '/';
|
|
131
|
-
// https://support.bunny.net/hc/en-us/articles/360017048720-Perma-Cache-Folder-Structure-Explained
|
|
132
|
-
const permaCachePath = `__bcdn_perma_cache__/${permaCacheZoneFolder}`
|
|
133
|
-
+ `/${folderpath}___${filename}___/___file___`;
|
|
134
|
-
axios({
|
|
135
|
-
method: 'PUT',
|
|
136
|
-
url: `https://storage.bunnycdn.com/${bunnyStorageName}/${permaCachePath}`,
|
|
137
|
-
headers: {
|
|
138
|
-
'Content-Type': 'application/octet-stream',
|
|
139
|
-
Accept: 'application/json',
|
|
140
|
-
AccessKey: bunnyStoragePass,
|
|
141
|
-
},
|
|
142
|
-
data: freshHtml,
|
|
143
|
-
});
|
|
144
|
-
}),
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
69
|
}
|
|
148
70
|
}
|
|
149
71
|
await Promise.all(purgeReqs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron-ssr-save-views.js","sourceRoot":"","sources":["../../src/lib/cron-ssr-save-views.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"cron-ssr-save-views.js","sourceRoot":"","sources":["../../src/lib/cron-ssr-save-views.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,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CAAC,CAAC;aACZ;SACF;KACF;IACD,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;IACxB,IAAI,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;QAAE,OAAO;IAChC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE;QACvC,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACtC,IAAI,WAAW,GAAG,EAAE,IAAI,WAAW,GAAG,EAAE;YAAE,OAAO;KAClD;IACD,MAAM,cAAc,GAAG,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC;SACjD,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;IACrE,MAAM,gBAAgB,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/ssr",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.6.
|
|
4
|
+
"version": "2.6.5",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront SSR",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@cloudcommerce/i18n": "workspace:*",
|
|
33
33
|
"@ecomplus/utils": "1.5.0-rc.6",
|
|
34
34
|
"@vueuse/core": "10.8.0",
|
|
35
|
-
"astro": "4.4.
|
|
35
|
+
"astro": "4.4.6",
|
|
36
36
|
"astro-capo": "^0.0.1",
|
|
37
37
|
"axios": "^1.6.7",
|
|
38
38
|
"firebase-admin": "^12.0.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getFirestore } from 'firebase-admin/firestore';
|
|
2
|
-
import { error } from 'firebase-functions/logger';
|
|
2
|
+
import { info, error } from 'firebase-functions/logger';
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import api from '@cloudcommerce/api';
|
|
5
5
|
import config from '@cloudcommerce/firebase/lib/config';
|
|
@@ -7,7 +7,6 @@ import { deleteQueryBatch } from '@cloudcommerce/firebase/lib/helpers/firestore'
|
|
|
7
7
|
|
|
8
8
|
const saveViews = async () => {
|
|
9
9
|
const deployRand = process.env.DEPLOY_RAND || '_';
|
|
10
|
-
const projectId = process.env.GCLOUD_PROJECT as string;
|
|
11
10
|
const db = getFirestore();
|
|
12
11
|
const productViewsSnapshot = await db.collection('ssrProductViews')
|
|
13
12
|
.limit(500).get();
|
|
@@ -32,10 +31,6 @@ const saveViews = async () => {
|
|
|
32
31
|
}
|
|
33
32
|
const { domain } = config.get().settingsContent;
|
|
34
33
|
if (domain && process.env.BUNNYNET_API_KEY) {
|
|
35
|
-
let bunnyStorageName = process.env.BUNNYNET_STORAGE_NAME;
|
|
36
|
-
let bunnyStoragePass = process.env.BUNNYNET_STORAGE_PASS;
|
|
37
|
-
let bunnyZoneName = process.env.BUNNYNET_ZONE_NAME;
|
|
38
|
-
let permaCacheZoneFolder = '';
|
|
39
34
|
const bunnyAxios = axios.create({
|
|
40
35
|
baseURL: 'https://api.bunny.net/',
|
|
41
36
|
headers: {
|
|
@@ -43,59 +38,6 @@ const saveViews = async () => {
|
|
|
43
38
|
},
|
|
44
39
|
});
|
|
45
40
|
try {
|
|
46
|
-
const storageAuthReqs: Promise<any>[] = [];
|
|
47
|
-
if (!bunnyStorageName || !bunnyStoragePass) {
|
|
48
|
-
storageAuthReqs.push(
|
|
49
|
-
bunnyAxios.get('/storagezone').then(({ data }) => {
|
|
50
|
-
for (let i = 0; i < data.length; i++) {
|
|
51
|
-
const bunnyStorage = data[i];
|
|
52
|
-
if (bunnyStorageName) {
|
|
53
|
-
if (bunnyStorage.Name === bunnyStorageName) {
|
|
54
|
-
bunnyStoragePass = bunnyStorage.Password;
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
if (bunnyStorage.Name.startsWith('storefront-isr-')) {
|
|
60
|
-
bunnyStorageName = bunnyStorage.Name;
|
|
61
|
-
bunnyStoragePass = bunnyStorage.Password;
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}),
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
if (!bunnyZoneName) {
|
|
69
|
-
storageAuthReqs.push(
|
|
70
|
-
bunnyAxios.get('/pullzone').then(({ data }) => {
|
|
71
|
-
for (let i = 0; i < data.length; i++) {
|
|
72
|
-
const pullZone = data[i];
|
|
73
|
-
if (pullZone.Hostnames.find(({ Value }) => Value === domain)) {
|
|
74
|
-
bunnyZoneName = pullZone.Name;
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}),
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
await Promise.all(storageAuthReqs);
|
|
82
|
-
if (bunnyStorageName && bunnyStoragePass && bunnyZoneName) {
|
|
83
|
-
const { data } = await axios({
|
|
84
|
-
url: `https://storage.bunnycdn.com/${bunnyStorageName}/__bcdn_perma_cache__/`,
|
|
85
|
-
headers: {
|
|
86
|
-
AccessKey: bunnyStoragePass,
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
for (let i = 0; i < data.length; i++) {
|
|
90
|
-
const { ObjectName } = data[i];
|
|
91
|
-
if (
|
|
92
|
-
ObjectName.startsWith(`pullzone__${bunnyZoneName}__`)
|
|
93
|
-
&& (!permaCacheZoneFolder || permaCacheZoneFolder < ObjectName)
|
|
94
|
-
) {
|
|
95
|
-
permaCacheZoneFolder = ObjectName;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
41
|
const sMaxAge = Number(process.env.SSR_CACHE_MAX_AGE) || 179;
|
|
100
42
|
const pageViewsSnapshot = await db.collection('ssrPageViews')
|
|
101
43
|
.where('at', '>', new Date(Date.now() - 1000 * 60 * 20))
|
|
@@ -109,47 +51,21 @@ const saveViews = async () => {
|
|
|
109
51
|
if (data.isCachePurged) {
|
|
110
52
|
continue;
|
|
111
53
|
}
|
|
112
|
-
const url = data.url.replace(/\?.*$/, '');
|
|
113
|
-
doc.ref.update({ isCachePurged: true });
|
|
54
|
+
const url = data.url.replace(/\?.*$/, '').replace(/#.*$/, '');
|
|
114
55
|
if (url?.startsWith(`https://${domain}`) && !purgedUrls.includes(url)) {
|
|
115
56
|
purgeReqs.push(bunnyAxios('/purge', {
|
|
116
57
|
method: 'POST',
|
|
117
58
|
params: {
|
|
118
|
-
async: 'false',
|
|
59
|
+
// async: 'false',
|
|
119
60
|
url,
|
|
120
61
|
},
|
|
62
|
+
}).then(async () => {
|
|
63
|
+
doc.ref.update({ isCachePurged: true });
|
|
64
|
+
const freshHtmlUrl = `${url}?__isrV=${deployRand}&t=${Date.now()}`;
|
|
65
|
+
await axios.get(freshHtmlUrl);
|
|
66
|
+
info(`Cache bump ${url}`);
|
|
121
67
|
}));
|
|
122
68
|
purgedUrls.push(url);
|
|
123
|
-
if (permaCacheZoneFolder) {
|
|
124
|
-
let pathname = url.replace(`https://${domain}`, '');
|
|
125
|
-
const freshHtmlUrl = `https://${projectId}.web.app${pathname}`
|
|
126
|
-
+ `?__isrV=${deployRand}&t=${Date.now()}`;
|
|
127
|
-
purgeReqs.push(
|
|
128
|
-
// eslint-disable-next-line no-loop-func
|
|
129
|
-
axios.get(freshHtmlUrl).then(({ data: freshHtml }: { data: string }) => {
|
|
130
|
-
if (pathname.charAt(0) === '/') {
|
|
131
|
-
pathname = pathname.slice(1);
|
|
132
|
-
}
|
|
133
|
-
const paths = pathname.split('/');
|
|
134
|
-
const filename = paths.pop() || '';
|
|
135
|
-
let folderpath = paths.join('/');
|
|
136
|
-
if (folderpath) folderpath += '/';
|
|
137
|
-
// https://support.bunny.net/hc/en-us/articles/360017048720-Perma-Cache-Folder-Structure-Explained
|
|
138
|
-
const permaCachePath = `__bcdn_perma_cache__/${permaCacheZoneFolder}`
|
|
139
|
-
+ `/${folderpath}___${filename}___/___file___`;
|
|
140
|
-
axios({
|
|
141
|
-
method: 'PUT',
|
|
142
|
-
url: `https://storage.bunnycdn.com/${bunnyStorageName}/${permaCachePath}`,
|
|
143
|
-
headers: {
|
|
144
|
-
'Content-Type': 'application/octet-stream',
|
|
145
|
-
Accept: 'application/json',
|
|
146
|
-
AccessKey: bunnyStoragePass,
|
|
147
|
-
},
|
|
148
|
-
data: freshHtml,
|
|
149
|
-
});
|
|
150
|
-
}),
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
69
|
}
|
|
154
70
|
}
|
|
155
71
|
await Promise.all(purgeReqs);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/storefront",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.6.
|
|
4
|
+
"version": "2.6.5",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront with Astro",
|
|
6
6
|
"bin": {
|
|
7
7
|
"storefront": "./scripts/build-prod.sh"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@vite-pwa/astro": "^0.3.0",
|
|
45
45
|
"@vueuse/core": "10.8.0",
|
|
46
46
|
"@webcontainer/api": "^1.1.9",
|
|
47
|
-
"astro": "4.4.
|
|
47
|
+
"astro": "4.4.6",
|
|
48
48
|
"astro-capo": "^0.0.1",
|
|
49
49
|
"chroma-js": "^2.4.2",
|
|
50
50
|
"dotenv": "^16.4.5",
|
|
@@ -174,16 +174,22 @@ watch(isHovered, (_isHovered: boolean) => {
|
|
|
174
174
|
restartAutoplay();
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
|
+
let initWrapperWidth = 0;
|
|
178
|
+
let initWrapperHeight = 0;
|
|
177
179
|
const calcOnInit = () => {
|
|
178
180
|
if (!wrapper.value) {
|
|
179
181
|
return;
|
|
180
182
|
}
|
|
183
|
+
initWrapperWidth = wrapper.value.clientWidth;
|
|
184
|
+
initWrapperHeight = wrapper.value.clientHeight;
|
|
181
185
|
calcWrapperSize();
|
|
182
186
|
calcSlidesSize();
|
|
183
187
|
calcCurrentIndex();
|
|
184
188
|
};
|
|
185
189
|
const onResize = useDebounceFn(() => {
|
|
186
190
|
if (!wrapper.value) return;
|
|
191
|
+
const { clientWidth, clientHeight } = wrapper.value;
|
|
192
|
+
if (clientWidth === initWrapperWidth && clientHeight === initWrapperHeight) return;
|
|
187
193
|
if (isX) {
|
|
188
194
|
wrapper.value.scrollLeft = 0;
|
|
189
195
|
} else {
|