cloudcommerce 2.6.4 → 2.7.3
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 +30 -0
- package/action.yml +2 -2
- package/{commitlint.config.cjs → commitlint.config.mjs} +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 +106 -8
- 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/ProductShelf.vue +8 -7
- 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 +5 -5
- 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 +2 -2
- 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 +7 -85
- package/packages/ssr/lib/lib/cron-ssr-save-views.js.map +1 -1
- package/packages/ssr/package.json +3 -3
- package/packages/ssr/src/lib/cron-ssr-save-views.ts +7 -91
- package/packages/storefront/dist/client/_astro/{AccountPage.B4WZaOzX.js → AccountPage.Cq0jrJE5.js} +1 -1
- package/packages/storefront/dist/client/_astro/{CartSidebar.DAGdpIcU.js → CartSidebar.DkX2BE1w.js} +1 -1
- package/packages/storefront/dist/client/_astro/{HeroSlider.Dq_9kcdU.js → HeroSlider.CZujn8cU.js} +1 -1
- package/packages/storefront/dist/client/_astro/{PitchBar.BwLlIs6F.js → PitchBar.DhcSEQPV.js} +1 -1
- package/packages/storefront/dist/client/_astro/{Prices.BgHTq5id.js → Prices.D1uItqV5.js} +1 -1
- package/packages/storefront/dist/client/_astro/{ProductDetails.CnYNdPl5.js → ProductDetails.DDNMc2oj.js} +1 -1
- package/packages/storefront/dist/client/_astro/ProductShelf.BwRDTU-V.js +1 -0
- package/packages/storefront/dist/client/_astro/{SearchModal.DcmvABes.js → SearchModal.DgrtGsIu.js} +1 -1
- package/packages/storefront/dist/client/_astro/{SearchShowcase.C9GWwOnF.js → SearchShowcase.DggdcmcI.js} +1 -1
- package/packages/storefront/dist/client/_astro/{ShippingCalculator.DE01D7dt.js → ShippingCalculator.B5JIh5xw.js} +1 -1
- package/packages/storefront/dist/client/_astro/{ShopHeader.Cf4t6O6z.js → ShopHeader.CIsQLhMR.js} +2 -2
- package/packages/storefront/dist/client/_astro/{_plugin-vue_export-helper.CBemkWnU.js → _plugin-vue_export-helper.3R8ooc_r.js} +3 -3
- package/packages/storefront/dist/client/_astro/{_slug_.DX_OkMX7.css → _slug_.CnXAH2gj.css} +1 -1
- package/packages/storefront/dist/client/_astro/client.mwowSQrH.js +1 -0
- package/packages/storefront/dist/client/_astro/{customer-session.CNe1heRH.js → customer-session.BAjMMoBA.js} +1 -1
- package/packages/storefront/dist/client/_astro/{format-money.DINpWB0x.js → format-money.vLicYTv9.js} +1 -1
- package/packages/storefront/dist/client/_astro/{grid-title.D4m7-g3h.js → grid-title.CxNZApGL.js} +1 -1
- package/packages/storefront/dist/client/_astro/{hoisted.EBqhuD5o.js → hoisted.B8Lw6O9a.js} +1 -1
- package/packages/storefront/dist/client/_astro/{hoisted.B2rH1xwX.js → hoisted.D4m7OTKi.js} +1 -1
- package/packages/storefront/dist/client/_astro/{hoisted.ut_nNM_H.js → hoisted.DSAg3dYh.js} +1 -1
- package/packages/storefront/dist/client/_astro/hoisted.D_dlmSy5.js +1 -0
- package/packages/storefront/dist/client/_astro/{i18n.B3skIOFg.js → i18n.BE5r_SIU.js} +1 -1
- package/packages/storefront/dist/client/_astro/{img.D5a6GzeE.js → img.CB-F9VLo.js} +1 -1
- package/packages/storefront/dist/client/_astro/{index.DBfgCyd-.js → index.BAyyMfaO.js} +1 -1
- package/packages/storefront/dist/client/_astro/{index.CFw6O-Kt.js → index.CTTHpJlV.js} +1 -1
- package/packages/storefront/dist/client/_astro/{modules-info.BHKiT6oA.js → modules-info.C6KJuGeB.js} +1 -1
- package/packages/storefront/dist/client/_astro/name.CIPngEFN.js +1 -0
- package/packages/storefront/dist/client/_astro/sf-utils.xmJHVMAX.js +13 -0
- package/packages/storefront/dist/client/_astro/{shopping-cart.D-w8Z-4p.js → shopping-cart.DGvCZWRZ.js} +1 -1
- package/packages/storefront/dist/client/_astro/{use-analytics.CQDdNgwF.js → use-analytics.BWhF_fCv.js} +1 -1
- package/packages/storefront/dist/client/_astro/{use-cms-preview.4Hq7LCmA.js → use-cms-preview.CPGTKut8.js} +1 -1
- package/packages/storefront/dist/client/_astro/{use-product-card.CQRlRsNX.js → use-product-card.C-RbCwna.js} +1 -1
- package/packages/storefront/dist/client/_astro/{use-text-value.UjCYLWjm.js → use-text-value.D4Rw7N4D.js} +1 -1
- package/packages/storefront/dist/server/chunks/{CartSidebar_BmwcZuxv.mjs → CartSidebar_lUckG0fs.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/{SearchModal_BvEnUvAx.mjs → SearchModal_B2f22Mff.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/{_.._DORZHe_Z.mjs → _.._CvgSOb3Z.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/{_page__DU3kNewy.mjs → _page__Ex4FhYrc.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/{account_CaTloREf.mjs → account_B7sLjsXD.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/astro/{assets-service_B77Hm2ue.mjs → assets-service_BOyOfKDQ.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/{astro_ISB6VLqs.mjs → astro_B5LBy7PI.mjs} +8 -4
- package/packages/storefront/dist/server/chunks/{index_BTDpenpc.mjs → index_BOh755yP.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/{index_D0q4ab_n.mjs → index_C2hkTn-w.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/{node_C7sdLKL4.mjs → node_DavlI8UF.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/pages/{__B4CsSrck.mjs → __RXg_hYeF.mjs} +57 -18
- package/packages/storefront/dist/server/chunks/pages/{_page__sb5Idhgp.mjs → _page__Dyte93f2.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/pages/{account_iWjHfkwu.mjs → account_C66y6_Y9.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/pages/{index_BZlpKBRL.mjs → index_EO1hhrt8.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/pages/{node_GFu-CQ19.mjs → node_hc25rqYt.mjs} +3 -3
- package/packages/storefront/dist/server/chunks/pages/{~fallback_C07rzeay.mjs → ~fallback_-K3esUV3.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/{~fallback_YpJa9BIL.mjs → ~fallback_DQ6yB81s.mjs} +1 -1
- package/packages/storefront/dist/server/entry.mjs +625 -601
- package/packages/storefront/dist/server/{manifest_KFjAaJaC.mjs → manifest_bZVxjk3o.mjs} +3 -3
- package/packages/storefront/dist/server/renderers.mjs +1 -1
- package/packages/storefront/package.json +3 -3
- package/packages/storefront/src/lib/components/Carousel.vue +6 -0
- package/packages/storefront/src/lib/composables/use-product-shelf.ts +23 -4
- package/packages/storefront/src/lib/layouts/use-page-main.ts +6 -7
- package/packages/test-base/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/_astro/ProductShelf.kfADQTUO.js +0 -1
- package/packages/storefront/dist/client/_astro/client.CdXC84C5.js +0 -1
- package/packages/storefront/dist/client/_astro/hoisted.DBPXHTEb.js +0 -1
- package/packages/storefront/dist/client/_astro/name.BZA9xqh-.js +0 -1
- package/packages/storefront/dist/client/_astro/sf-utils.Cigv01cN.js +0 -13
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/emails",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.7.3",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce email sender",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@cloudcommerce/firebase": "workspace:*",
|
|
26
26
|
"axios": "^1.6.7",
|
|
27
27
|
"ejs": "^3.1.9",
|
|
28
|
-
"nodemailer": "^6.9.
|
|
28
|
+
"nodemailer": "^6.9.11"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@cloudcommerce/types": "workspace:*",
|
|
@@ -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;AAClD,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,MAAM,
|
|
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,MA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I,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.
|
|
4
|
+
"version": "2.7.3",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront SSR",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -32,13 +32,13 @@
|
|
|
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",
|
|
39
39
|
"firebase-functions": "^4.7.0",
|
|
40
40
|
"mitt": "^3.0.1",
|
|
41
|
-
"vue": "^3.4.
|
|
41
|
+
"vue": "^3.4.21",
|
|
42
42
|
"yaml": "^2.4.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -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);
|