cloudcommerce 2.6.0 → 2.6.2
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/settings.json +4 -1
- package/CHANGELOG.md +18 -0
- package/ecomplus-stores/barradoce/.devcontainer/devcontainer.json +10 -4
- package/ecomplus-stores/barradoce/.vscode/settings.json +3 -0
- package/ecomplus-stores/barradoce/functions/many/package.json +3 -3
- package/ecomplus-stores/barradoce/functions/ssr/package.json +6 -6
- package/ecomplus-stores/barradoce/functions/ssr/src/components/CartSidebar.vue +11 -11
- package/ecomplus-stores/barradoce/functions/ssr/src/components/ProductDetails.vue +23 -13
- package/ecomplus-stores/barradoce/functions/ssr/src/components/SearchModal.vue +9 -6
- package/ecomplus-stores/barradoce/functions/ssr/src/components/SearchShowcase.vue +19 -17
- package/ecomplus-stores/barradoce/functions/ssr/src/components/ShippingCalculator.vue +10 -10
- package/ecomplus-stores/barradoce/functions/ssr/src/main/content/Sections.astro +3 -0
- package/ecomplus-stores/barradoce/functions/ssr/src/state/midd-search-engine.ts +19 -0
- package/ecomplus-stores/barradoce/functions/with-apps/package.json +3 -3
- package/ecomplus-stores/barradoce/package.json +2 -2
- package/ecomplus-stores/barradoce/tailwind.config.cjs +5 -3
- 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 +21 -16
- package/packages/ssr/lib/lib/cron-ssr-save-views.js.map +1 -1
- package/packages/ssr/package.json +1 -1
- package/packages/ssr/src/lib/cron-ssr-save-views.ts +27 -20
- package/packages/storefront/package.json +1 -1
- package/packages/storefront/src/lib/composables/use-search-modal.ts +3 -1
- package/packages/storefront/src/lib/composables/use-search-showcase.ts +2 -1
- package/packages/storefront/src/lib/layouts/BaseHead.astro +2 -1
- package/packages/storefront/src/lib/layouts/use-page-main.ts +9 -5
- package/packages/storefront/src/lib/state/search-engine.ts +21 -11
- package/packages/test-base/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/packages/storefront/src/lib/scripts/experimental-web-ide.ts +0 -29
- package/packages/storefront/src/web-ide/webcontainer.ts +0 -104
|
@@ -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';
|
|
@@ -101,13 +101,15 @@ const saveViews = async () => {
|
|
|
101
101
|
const url = data.url.replace(/\?.*$/, '');
|
|
102
102
|
doc.ref.update({ isCachePurged: true });
|
|
103
103
|
if (url?.startsWith(`https://${domain}`) && !purgedUrls.includes(url)) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
104
|
+
const reqs = [
|
|
105
|
+
bunnyAxios('/purge', {
|
|
106
|
+
method: 'POST',
|
|
107
|
+
params: {
|
|
108
|
+
async: permaCacheZoneFolder ? 'true' : 'false',
|
|
109
|
+
url,
|
|
110
|
+
},
|
|
111
|
+
}),
|
|
112
|
+
];
|
|
111
113
|
purgedUrls.push(url);
|
|
112
114
|
if (permaCacheZoneFolder) {
|
|
113
115
|
let pathname = url.replace(`https://${domain}`, '');
|
|
@@ -121,20 +123,23 @@ const saveViews = async () => {
|
|
|
121
123
|
// https://support.bunny.net/hc/en-us/articles/360017048720-Perma-Cache-Folder-Structure-Explained
|
|
122
124
|
const permaCachePath = `__bcdn_perma_cache__/${permaCacheZoneFolder}`
|
|
123
125
|
+ `/${folderpath}___${filename}___/___file___`;
|
|
124
|
-
|
|
126
|
+
reqs.push(axios({
|
|
125
127
|
method: 'DELETE',
|
|
126
128
|
url: `https://storage.bunnycdn.com/${bunnyStorageName}/${permaCachePath}`,
|
|
127
129
|
headers: {
|
|
128
130
|
AccessKey: bunnyStoragePass,
|
|
129
131
|
},
|
|
130
|
-
})
|
|
131
|
-
.
|
|
132
|
-
|
|
133
|
-
})
|
|
134
|
-
.catch((err) => {
|
|
135
|
-
if (err.response?.status !== 404) throw err;
|
|
136
|
-
});
|
|
132
|
+
}).catch((err) => {
|
|
133
|
+
if (err.response?.status !== 404) throw err;
|
|
134
|
+
}));
|
|
137
135
|
}
|
|
136
|
+
await Promise.all(reqs).then(([, deletePermaCacheRes]) => {
|
|
137
|
+
if (deletePermaCacheRes) {
|
|
138
|
+
info(`Full cache bump ${url}`);
|
|
139
|
+
return axios.get(`${url}?__isrV=${deployRand}`).catch(error);
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
});
|
|
138
143
|
}
|
|
139
144
|
}
|
|
140
145
|
} catch (err) {
|
|
@@ -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,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,oBAAoB,CAAC;AACrC,OAAO,MAAM,MAAM,oCAAoC,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AAEjF,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE;IAC3B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC;IAClD,qCAAqC;IACrC,MAAM,EAAE,GAAG,YAAY,EAAE,CAAC;IAC1B,MAAM,oBAAoB,GAAG,MAAM,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC;SAChE,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,oBAAoB,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACzD,MAAM,GAAG,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACzC,MAAM,EAAE,YAAY,EAAE,GAAG,GAAG,CAAC,I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;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,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';
|
|
@@ -103,13 +103,15 @@ const saveViews = async () => {
|
|
|
103
103
|
const url = data.url.replace(/\?.*$/, '');
|
|
104
104
|
doc.ref.update({ isCachePurged: true });
|
|
105
105
|
if (url?.startsWith(`https://${domain}`) && !purgedUrls.includes(url)) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
const reqs: Promise<any>[] = [
|
|
107
|
+
bunnyAxios('/purge', {
|
|
108
|
+
method: 'POST',
|
|
109
|
+
params: {
|
|
110
|
+
async: permaCacheZoneFolder ? 'true' : 'false',
|
|
111
|
+
url,
|
|
112
|
+
},
|
|
113
|
+
}),
|
|
114
|
+
];
|
|
113
115
|
purgedUrls.push(url);
|
|
114
116
|
if (permaCacheZoneFolder) {
|
|
115
117
|
let pathname = url.replace(`https://${domain}`, '');
|
|
@@ -123,20 +125,25 @@ const saveViews = async () => {
|
|
|
123
125
|
// https://support.bunny.net/hc/en-us/articles/360017048720-Perma-Cache-Folder-Structure-Explained
|
|
124
126
|
const permaCachePath = `__bcdn_perma_cache__/${permaCacheZoneFolder}`
|
|
125
127
|
+ `/${folderpath}___${filename}___/___file___`;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
.
|
|
134
|
-
axios.get(`${url}?__isrV=${deployRand}`).catch(error);
|
|
135
|
-
})
|
|
136
|
-
.catch((err) => {
|
|
128
|
+
reqs.push(
|
|
129
|
+
axios({
|
|
130
|
+
method: 'DELETE',
|
|
131
|
+
url: `https://storage.bunnycdn.com/${bunnyStorageName}/${permaCachePath}`,
|
|
132
|
+
headers: {
|
|
133
|
+
AccessKey: bunnyStoragePass,
|
|
134
|
+
},
|
|
135
|
+
}).catch((err) => {
|
|
137
136
|
if (err.response?.status !== 404) throw err;
|
|
138
|
-
})
|
|
137
|
+
}),
|
|
138
|
+
);
|
|
139
139
|
}
|
|
140
|
+
await Promise.all(reqs).then(([, deletePermaCacheRes]) => {
|
|
141
|
+
if (deletePermaCacheRes) {
|
|
142
|
+
info(`Full cache bump ${url}`);
|
|
143
|
+
return axios.get(`${url}?__isrV=${deployRand}`).catch(error);
|
|
144
|
+
}
|
|
145
|
+
return null;
|
|
146
|
+
});
|
|
140
147
|
}
|
|
141
148
|
}
|
|
142
149
|
} catch (err: any) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Categories } from '@cloudcommerce/api/types';
|
|
2
|
+
import type { SearchEngineInstance } from '@@sf/state/search-engine';
|
|
2
3
|
import { ref, watch, toRef } from 'vue';
|
|
3
4
|
import Wade from 'wade';
|
|
4
5
|
import { clearAccents } from '@@sf/sf-lib';
|
|
@@ -8,6 +9,7 @@ export interface Props {
|
|
|
8
9
|
term: string;
|
|
9
10
|
fetchDebounce?: number;
|
|
10
11
|
productsLimit?: number;
|
|
12
|
+
searchEngine?: SearchEngineInstance;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
const wadeDocs: Array<{
|
|
@@ -39,7 +41,7 @@ if (wadeDocs.length) {
|
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
export const useSearchModal = (props: Props) => {
|
|
42
|
-
const searchEngine = new SearchEngine({
|
|
44
|
+
const searchEngine = props.searchEngine || new SearchEngine({
|
|
43
45
|
debounce: props.fetchDebounce || 300,
|
|
44
46
|
});
|
|
45
47
|
searchEngine.pageSize.value = props.productsLimit || 12;
|
|
@@ -30,6 +30,7 @@ export interface Props {
|
|
|
30
30
|
ssrError?: string | null;
|
|
31
31
|
canUseUrlParams?: boolean;
|
|
32
32
|
showcase?: Ref<HTMLElement | null>;
|
|
33
|
+
searchEngine?: SearchEngineInstance;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
const useSearchShowcase = (props: Props) => {
|
|
@@ -43,7 +44,7 @@ const useSearchShowcase = (props: Props) => {
|
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
const products = shallowReactive<SearchItem[]>(props.products || []);
|
|
46
|
-
const searchEngine = new SearchEngine({ debounce: 50 });
|
|
47
|
+
const searchEngine = props.searchEngine || new SearchEngine({ debounce: 50 });
|
|
47
48
|
if (term === undefined && !import.meta.env.SSR) {
|
|
48
49
|
term = new URLSearchParams(window.location.search).get('q') || null;
|
|
49
50
|
}
|
|
@@ -168,6 +168,7 @@ const inlineJSONLd = JSON.stringify({
|
|
|
168
168
|
url: `https://${domain}/`,
|
|
169
169
|
logo: `https://${domain}${settings.logo}`,
|
|
170
170
|
});
|
|
171
|
+
const generator = `e-com.plus @cloudcommerce/storefront, ${Astro.generator}`;
|
|
171
172
|
---
|
|
172
173
|
|
|
173
174
|
<meta charset="UTF-8">
|
|
@@ -179,7 +180,7 @@ const inlineJSONLd = JSON.stringify({
|
|
|
179
180
|
{title && <title>{title}</title>}
|
|
180
181
|
{description && <meta name="description" content={description}>}
|
|
181
182
|
<meta name="author" content={settings.name}>
|
|
182
|
-
<meta name="generator" content={
|
|
183
|
+
<meta name="generator" content={generator}>
|
|
183
184
|
<link rel="canonical" href={canonicalUrl} />
|
|
184
185
|
{shortcutIcon && <link rel="apple-touch-icon" href={shortcutIcon} />}
|
|
185
186
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
@@ -12,6 +12,7 @@ export interface Props {
|
|
|
12
12
|
routeContext: RouteContext;
|
|
13
13
|
handleCustomSection?: (type: `${string}:${string}`, content: Record<string, any>) =>
|
|
14
14
|
Promise<{ props: Record<string, any> }>;
|
|
15
|
+
searchEngine?: UseSearchShowcaseProps['searchEngine'];
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
type PageContentHero = Exclude<PageContent['hero'], undefined>;
|
|
@@ -48,7 +49,7 @@ type CustomSection = { type: `${string}:${string}`, props: any };
|
|
|
48
49
|
type ProductDetailsProps = { hasDescription?: boolean, hasSpecifications?: boolean };
|
|
49
50
|
|
|
50
51
|
export const usePageSections = async <T extends CustomSection = CustomSection>
|
|
51
|
-
({ routeContext, handleCustomSection }: Props) => {
|
|
52
|
+
({ routeContext, handleCustomSection, searchEngine }: Props) => {
|
|
52
53
|
const { cmsContent } = routeContext;
|
|
53
54
|
let sectionsContent = cmsContent?.sections;
|
|
54
55
|
if (
|
|
@@ -181,11 +182,14 @@ export const usePageSections = async <T extends CustomSection = CustomSection>
|
|
|
181
182
|
props.term = routeContext.searchPageTerm || null;
|
|
182
183
|
}
|
|
183
184
|
if (props.term !== undefined || props.fixedParams) {
|
|
184
|
-
const {
|
|
185
|
+
const {
|
|
186
|
+
searchEngine: resultSearchEngine,
|
|
187
|
+
fetching,
|
|
188
|
+
} = useSearchShowcase({ ...props, searchEngine });
|
|
185
189
|
await fetching;
|
|
186
|
-
props.products =
|
|
187
|
-
props.resultMeta =
|
|
188
|
-
props.ssrError =
|
|
190
|
+
props.products = resultSearchEngine.products;
|
|
191
|
+
props.resultMeta = resultSearchEngine.meta;
|
|
192
|
+
props.ssrError = resultSearchEngine.fetchError.value?.message;
|
|
189
193
|
}
|
|
190
194
|
sections[index] = { type, props };
|
|
191
195
|
return;
|
|
@@ -68,6 +68,8 @@ export const search = async ({
|
|
|
68
68
|
return response;
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
+
type SearchOptions = Parameters<typeof search>[0];
|
|
72
|
+
|
|
71
73
|
export class SearchEngine {
|
|
72
74
|
fields?: readonly string[];
|
|
73
75
|
term = ref<string | null>(null);
|
|
@@ -76,6 +78,7 @@ export class SearchEngine {
|
|
|
76
78
|
params = reactive<Exclude<ApiConfig['params'], string | undefined>>({});
|
|
77
79
|
pageSize = ref(24);
|
|
78
80
|
pageNumber = ref(1);
|
|
81
|
+
#middlewares: Array<(opt: SearchOptions) => void> = [];
|
|
79
82
|
#isFetching = ref(false);
|
|
80
83
|
isFetching = computed(() => this.#isFetching.value);
|
|
81
84
|
#wasFetched = ref(false);
|
|
@@ -130,18 +133,22 @@ export class SearchEngine {
|
|
|
130
133
|
});
|
|
131
134
|
}
|
|
132
135
|
let response: Awaited<ReturnType<typeof search>> | null | undefined;
|
|
136
|
+
const searchOptions = {
|
|
137
|
+
term: this.term.value,
|
|
138
|
+
params: {
|
|
139
|
+
...this.params,
|
|
140
|
+
limit,
|
|
141
|
+
offset,
|
|
142
|
+
count: this.isWithCount.value || undefined,
|
|
143
|
+
buckets: this.isWithBuckets.value || undefined,
|
|
144
|
+
},
|
|
145
|
+
fields: this.fields,
|
|
146
|
+
};
|
|
133
147
|
try {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
limit,
|
|
139
|
-
offset,
|
|
140
|
-
count: this.isWithCount.value || undefined,
|
|
141
|
-
buckets: this.isWithBuckets.value || undefined,
|
|
142
|
-
},
|
|
143
|
-
fields: this.fields,
|
|
144
|
-
});
|
|
148
|
+
for (let i = 0; i < this.#middlewares.length; i++) {
|
|
149
|
+
this.#middlewares[i](searchOptions);
|
|
150
|
+
}
|
|
151
|
+
response = await this.#search(searchOptions);
|
|
145
152
|
} catch (err: any) {
|
|
146
153
|
if (this.#fulfillFetching) {
|
|
147
154
|
this.#fetchError.value = err;
|
|
@@ -162,6 +169,9 @@ export class SearchEngine {
|
|
|
162
169
|
}
|
|
163
170
|
}
|
|
164
171
|
|
|
172
|
+
addMiddleware(cb: (options: SearchOptions) => void) {
|
|
173
|
+
this.#middlewares.push(cb);
|
|
174
|
+
}
|
|
165
175
|
setResult(data: Partial<SearchResult<'v1'>>) {
|
|
166
176
|
if (data.meta) {
|
|
167
177
|
Object.assign(this.meta, data.meta);
|