cloudcommerce 2.12.2 → 2.13.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/.github/workflows/test-apps.yml +2 -2
- package/CHANGELOG.md +14 -0
- package/action.yml +10 -10
- package/ecomplus-stores/barradoce/.github/workflows/build-and-deploy.yml +4 -4
- 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/AccountPage.vue +1 -1
- package/ecomplus-stores/barradoce/functions/ssr/src/pages/app/account.astro +1 -1
- package/ecomplus-stores/barradoce/functions/with-apps/package.json +3 -3
- package/ecomplus-stores/barradoce/package.json +2 -2
- package/package.json +8 -8
- package/packages/api/package.json +1 -1
- package/packages/apps/affiliate-program/package.json +2 -2
- 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 +2 -2
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +2 -2
- package/packages/apps/fb-conversions/package.json +2 -2
- package/packages/apps/flash-courier/package.json +2 -2
- package/packages/apps/frenet/package.json +2 -2
- package/packages/apps/galaxpay/package.json +2 -2
- package/packages/apps/google-analytics/package.json +2 -2
- package/packages/apps/jadlog/package.json +1 -1
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/mandae/package.json +2 -2
- package/packages/apps/melhor-envio/package.json +2 -2
- package/packages/apps/mercadopago/package.json +2 -2
- package/packages/apps/pagaleve/package.json +2 -2
- package/packages/apps/pagarme/package.json +3 -3
- package/packages/apps/pagarme-v5/package.json +2 -2
- package/packages/apps/paghiper/package.json +2 -2
- package/packages/apps/pix/package.json +2 -2
- package/packages/apps/tiny-erp/package.json +2 -2
- package/packages/apps/webhooks/package.json +2 -2
- package/packages/cli/package.json +2 -2
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +2 -2
- package/packages/eslint/package.json +4 -4
- package/packages/events/package.json +2 -2
- package/packages/feeds/lib/firebase/serve-feeds.js +344 -3
- package/packages/feeds/lib/firebase/serve-feeds.js.map +1 -1
- package/packages/feeds/package.json +1 -1
- package/packages/feeds/src/firebase/serve-feeds.ts +367 -3
- package/packages/firebase/package.json +2 -2
- package/packages/i18n/package.json +1 -1
- package/packages/modules/package.json +2 -2
- package/packages/passport/package.json +2 -2
- package/packages/ssr/package.json +3 -3
- package/packages/storefront/package.json +4 -4
- package/packages/storefront/src/lib/scripts/vbeta-app.ts +1 -1
- package/packages/storefront/src/lib/state/customer-session.ts +8 -9
- package/packages/test-base/package.json +1 -1
- package/packages/types/package.json +1 -1
|
@@ -1,10 +1,374 @@
|
|
|
1
1
|
import type { Request, Response } from 'firebase-functions';
|
|
2
|
+
import { error } from 'firebase-functions/logger';
|
|
3
|
+
import api from '@cloudcommerce/api';
|
|
4
|
+
import config from '@cloudcommerce/firebase/lib/config';
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
const
|
|
6
|
+
const fetchProducts = async (page = 1) => {
|
|
7
|
+
const limit = 300;
|
|
8
|
+
const offset = limit * (page - 1);
|
|
9
|
+
const {
|
|
10
|
+
data: {
|
|
11
|
+
result: products,
|
|
12
|
+
meta: { count },
|
|
13
|
+
},
|
|
14
|
+
} = await api.get('products', {
|
|
15
|
+
limit,
|
|
16
|
+
offset,
|
|
17
|
+
count: true,
|
|
18
|
+
params: {
|
|
19
|
+
available: true,
|
|
20
|
+
visible: true,
|
|
21
|
+
},
|
|
22
|
+
fields: [
|
|
23
|
+
'_id',
|
|
24
|
+
'name',
|
|
25
|
+
'sku',
|
|
26
|
+
'slug',
|
|
27
|
+
'quantity',
|
|
28
|
+
'min_quantity',
|
|
29
|
+
'production_time',
|
|
30
|
+
'pictures',
|
|
31
|
+
'currency_id',
|
|
32
|
+
'price',
|
|
33
|
+
'base_price',
|
|
34
|
+
'category_tree',
|
|
35
|
+
'categories.0.name',
|
|
36
|
+
'brands.0.name',
|
|
37
|
+
'google_product_category_id',
|
|
38
|
+
'gtin',
|
|
39
|
+
'mpn',
|
|
40
|
+
'adult',
|
|
41
|
+
'condition',
|
|
42
|
+
'weight',
|
|
43
|
+
'dimensions',
|
|
44
|
+
'specifications',
|
|
45
|
+
'variations',
|
|
46
|
+
'short_description',
|
|
47
|
+
'body_html',
|
|
48
|
+
] as const,
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
products,
|
|
52
|
+
nextPage: (count && count > offset + limit) ? page + 1 : null,
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type FeedProducts = Awaited<ReturnType<typeof fetchProducts>>['products'];
|
|
57
|
+
|
|
58
|
+
const products: FeedProducts = [];
|
|
59
|
+
const fetchAllProducts = async () => {
|
|
60
|
+
let page: number | null = 1;
|
|
61
|
+
while (page) {
|
|
62
|
+
const {
|
|
63
|
+
products: _products,
|
|
64
|
+
nextPage,
|
|
65
|
+
// eslint-disable-next-line no-await-in-loop
|
|
66
|
+
} = await fetchProducts(page);
|
|
67
|
+
page = nextPage;
|
|
68
|
+
_products.forEach((product) => products.push(product));
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const fetching = new Promise((resolve, reject) => {
|
|
73
|
+
fetchAllProducts().then(resolve).catch(reject);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const serveFeeds = async (req: Request, res: Response) => {
|
|
77
|
+
const { method, url } = req;
|
|
5
78
|
if (method !== 'GET') {
|
|
6
79
|
res.sendStatus(405);
|
|
7
80
|
return;
|
|
8
81
|
}
|
|
9
|
-
|
|
82
|
+
if (url !== '/_feeds/catalog' && url !== '/catalog') {
|
|
83
|
+
res.sendStatus(404);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
await fetching;
|
|
88
|
+
} catch (err) {
|
|
89
|
+
error(err);
|
|
90
|
+
res.sendStatus(500);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const {
|
|
94
|
+
storeId,
|
|
95
|
+
settingsContent: { domain, name },
|
|
96
|
+
} = config.get();
|
|
97
|
+
const title = `Products feed - ${name}`;
|
|
98
|
+
const isSkipVariations = !!req.query.skip_variations;
|
|
99
|
+
const discount = Number(req.query.discount) || 0;
|
|
100
|
+
let querystring = String(req.query.qs) || '?_=feed';
|
|
101
|
+
if (querystring.charAt(0) !== '?') {
|
|
102
|
+
querystring = `?${querystring}`;
|
|
103
|
+
}
|
|
104
|
+
let propsSet: Record<string, any> = {};
|
|
105
|
+
if (typeof req.query.set_properties === 'string') {
|
|
106
|
+
try {
|
|
107
|
+
propsSet = JSON.parse(req.query.set_properties);
|
|
108
|
+
if (typeof propsSet !== 'object' || !propsSet) {
|
|
109
|
+
throw new Error('Invalid');
|
|
110
|
+
}
|
|
111
|
+
} catch {
|
|
112
|
+
res.sendStatus(400);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const isFacebook = (req.get('User-Agent') || '').includes('facebook');
|
|
117
|
+
|
|
118
|
+
let xml = `
|
|
119
|
+
<?xml version="1.0"?>
|
|
120
|
+
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0">
|
|
121
|
+
<title><![CDATA[${title}]]></title>
|
|
122
|
+
<link href="https://${domain}/" rel="alternate" type="text/html"/>
|
|
123
|
+
<updated>${new Date().toISOString()}</updated>
|
|
124
|
+
<id><![CDATA[#${storeId},${Math.random()}]]></id>
|
|
125
|
+
<author>
|
|
126
|
+
<name>e-com.plus Cloud Commerce</name>
|
|
127
|
+
</author>`;
|
|
128
|
+
|
|
129
|
+
const convertProduct = (p: (typeof products)[0], groupId?: string) => {
|
|
130
|
+
if (p.name) {
|
|
131
|
+
const entry: Record<string, any> = {
|
|
132
|
+
id: p.sku || p._id,
|
|
133
|
+
title: p.name,
|
|
134
|
+
item_group_id: groupId,
|
|
135
|
+
google_product_category: p.google_product_category_id,
|
|
136
|
+
};
|
|
137
|
+
if (p.short_description) {
|
|
138
|
+
entry.description = p.short_description;
|
|
139
|
+
} else if (p.body_html) {
|
|
140
|
+
entry.description = p.body_html
|
|
141
|
+
.replace(/<style\b[^>]*>.*?<\/style>/isg, '')
|
|
142
|
+
.replace(/<[^>]+>/g, '')
|
|
143
|
+
.replace(/ /g, '');
|
|
144
|
+
} else {
|
|
145
|
+
entry.description = p.name;
|
|
146
|
+
}
|
|
147
|
+
if (p.slug) {
|
|
148
|
+
entry.link = `https://${domain}/${p.slug}${querystring}`;
|
|
149
|
+
if (groupId) entry.link += `&var=${p._id}`;
|
|
150
|
+
if (discount > 0) entry.link += `&discount=${discount}`;
|
|
151
|
+
}
|
|
152
|
+
if (
|
|
153
|
+
(p.quantity === undefined || p.quantity)
|
|
154
|
+
&& (!p.min_quantity || p.quantity! >= p.min_quantity)
|
|
155
|
+
) {
|
|
156
|
+
entry.availability = 'in stock';
|
|
157
|
+
} else {
|
|
158
|
+
entry.availability = 'out of stock';
|
|
159
|
+
}
|
|
160
|
+
if (p.production_time?.days) {
|
|
161
|
+
entry.min_handling_time = p.production_time.days;
|
|
162
|
+
if (p.production_time.max_time) {
|
|
163
|
+
entry.max_handling_time = p.production_time.max_time;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (p.pictures?.length) {
|
|
167
|
+
const additionalImages: string[] = [];
|
|
168
|
+
for (let i = 0; i < p.pictures.length && i < 10; i++) {
|
|
169
|
+
const picture = p.pictures[i];
|
|
170
|
+
let img = picture.zoom?.url || picture.big?.url || picture.normal?.url;
|
|
171
|
+
if (img) {
|
|
172
|
+
img = img.replace(
|
|
173
|
+
/(\w+\.)?(ecoms\d)\.com/i,
|
|
174
|
+
'$2-nyc3.nyc3.cdn.digitaloceanspaces.com',
|
|
175
|
+
);
|
|
176
|
+
if (!entry.image_link) {
|
|
177
|
+
entry.image_link = img;
|
|
178
|
+
} else {
|
|
179
|
+
additionalImages.push(img);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (additionalImages.length) {
|
|
184
|
+
entry.additional_image_link = additionalImages;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (p.price) {
|
|
188
|
+
if (p.base_price && p.base_price > p.price) {
|
|
189
|
+
entry.price = `${p.base_price} ${p.currency_id}`;
|
|
190
|
+
entry.sale_price = (p.price * (1 - discount)).toFixed(2) + ` ${p.currency_id}`;
|
|
191
|
+
} else {
|
|
192
|
+
entry.price = (p.price * (1 - discount)).toFixed(2) + ` ${p.currency_id}`;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (p.category_tree) {
|
|
196
|
+
entry.product_type = p.category_tree;
|
|
197
|
+
} else if (p.categories?.length) {
|
|
198
|
+
entry.product_type = p.categories[0].name;
|
|
199
|
+
}
|
|
200
|
+
let isIdentifierExists = false;
|
|
201
|
+
if (p.brands?.length) {
|
|
202
|
+
isIdentifierExists = true;
|
|
203
|
+
entry.brand = p.brands[0].name;
|
|
204
|
+
}
|
|
205
|
+
(['gtin', 'mpn'] as const).forEach((field) => {
|
|
206
|
+
const codes = p[field];
|
|
207
|
+
if (Array.isArray(codes) && codes.length) {
|
|
208
|
+
entry[field] = codes[0];
|
|
209
|
+
isIdentifierExists = true;
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
entry.identifier_exists = isIdentifierExists ? 'yes' : 'no';
|
|
213
|
+
if (p.adult) {
|
|
214
|
+
entry.adult = 'yes';
|
|
215
|
+
}
|
|
216
|
+
if (p.condition) {
|
|
217
|
+
entry.condition = p.condition !== 'not_specified' ? p.condition : 'new';
|
|
218
|
+
}
|
|
219
|
+
if (p.weight) {
|
|
220
|
+
entry.shipping_weight = `${p.weight.value} ${p.weight.unit || ''}`;
|
|
221
|
+
}
|
|
222
|
+
if (p.dimensions && !isFacebook) {
|
|
223
|
+
(['length', 'width', 'height'] as const).forEach((side) => {
|
|
224
|
+
const dimension = p.dimensions![side];
|
|
225
|
+
if (dimension) {
|
|
226
|
+
entry[`shipping_${side}`] = `${dimension.value} ${dimension.unit || ''}`;
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
if (p.specifications) {
|
|
231
|
+
let customLabel = 0;
|
|
232
|
+
Object.keys(p.specifications).forEach((spec) => {
|
|
233
|
+
const values = p.specifications![spec];
|
|
234
|
+
if (!values.length) return;
|
|
235
|
+
const [val] = values;
|
|
236
|
+
/* eslint-disable no-case-declarations */
|
|
237
|
+
switch (spec) {
|
|
238
|
+
case 'energy_efficiency_class':
|
|
239
|
+
case 'age_group':
|
|
240
|
+
case 'gender':
|
|
241
|
+
case 'size_type':
|
|
242
|
+
case 'size_system':
|
|
243
|
+
entry[spec] = val.value || val.text;
|
|
244
|
+
break;
|
|
245
|
+
case 'size':
|
|
246
|
+
case 'pattern':
|
|
247
|
+
case 'material':
|
|
248
|
+
entry[spec] = val.text;
|
|
249
|
+
break;
|
|
250
|
+
case 'colors':
|
|
251
|
+
case 'color':
|
|
252
|
+
case 'cor':
|
|
253
|
+
case 'cores':
|
|
254
|
+
let colors = val.text.replace(/[/]/g, ' ');
|
|
255
|
+
for (let i = 1; i < values.length; i++) {
|
|
256
|
+
colors += `/${values[i].text.replace(/[/]/g, ' ')}`;
|
|
257
|
+
}
|
|
258
|
+
entry.color = colors;
|
|
259
|
+
break;
|
|
260
|
+
default:
|
|
261
|
+
let commonSpec: string | null = null;
|
|
262
|
+
let fixedText = val.value || val.text;
|
|
263
|
+
switch (fixedText.toLowerCase()) {
|
|
264
|
+
case 'm':
|
|
265
|
+
case 'l':
|
|
266
|
+
case 'g':
|
|
267
|
+
case 's':
|
|
268
|
+
case 'p':
|
|
269
|
+
case 'xs':
|
|
270
|
+
case 'pp':
|
|
271
|
+
case 'xl':
|
|
272
|
+
case 'gg':
|
|
273
|
+
case 'xxl':
|
|
274
|
+
case 'xg':
|
|
275
|
+
case 'u':
|
|
276
|
+
case 'Único':
|
|
277
|
+
case 'unico':
|
|
278
|
+
commonSpec = 'size';
|
|
279
|
+
break;
|
|
280
|
+
case 'adult':
|
|
281
|
+
case 'adulto':
|
|
282
|
+
case 'kids':
|
|
283
|
+
case 'criança':
|
|
284
|
+
case 'infant':
|
|
285
|
+
case 'infantil':
|
|
286
|
+
case 'newborn':
|
|
287
|
+
case 'recém-nascido':
|
|
288
|
+
case 'toddler':
|
|
289
|
+
commonSpec = 'age_group';
|
|
290
|
+
break;
|
|
291
|
+
case 'male':
|
|
292
|
+
case 'masculino':
|
|
293
|
+
case 'female':
|
|
294
|
+
case 'feminino':
|
|
295
|
+
case 'unisex':
|
|
296
|
+
commonSpec = 'gender';
|
|
297
|
+
break;
|
|
298
|
+
case 'homem':
|
|
299
|
+
commonSpec = 'gender';
|
|
300
|
+
fixedText = 'male';
|
|
301
|
+
break;
|
|
302
|
+
case 'mulher':
|
|
303
|
+
commonSpec = 'gender';
|
|
304
|
+
fixedText = 'female';
|
|
305
|
+
break;
|
|
306
|
+
default:
|
|
307
|
+
if (customLabel < 5) {
|
|
308
|
+
entry[`custom_label_${customLabel}`] = val.text;
|
|
309
|
+
customLabel += 1;
|
|
310
|
+
}
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
if (commonSpec !== null && !entry[commonSpec]) {
|
|
314
|
+
entry[commonSpec] = fixedText;
|
|
315
|
+
}
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
Object.keys(propsSet).forEach((key) => {
|
|
321
|
+
entry[key] = propsSet[key];
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
xml += `
|
|
325
|
+
<entry>`;
|
|
326
|
+
Object.keys(entry).forEach((key) => {
|
|
327
|
+
const val = entry[key];
|
|
328
|
+
if (val === undefined || val === null) return;
|
|
329
|
+
if (typeof val === 'object' && val) {
|
|
330
|
+
Object.keys(entry).forEach((nKey) => {
|
|
331
|
+
const nested = val[nKey];
|
|
332
|
+
xml += `<g:${key}><![CDATA[${nested}]]></g:${key}>`;
|
|
333
|
+
});
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
if (key === 'link') {
|
|
337
|
+
xml += `<g:${key}><!--${p._id}-->${val}</g:${key}>`;
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
xml += `<g:${key}><![CDATA[${val}]]></g:${key}>`;
|
|
341
|
+
});
|
|
342
|
+
xml += `
|
|
343
|
+
</entry>`;
|
|
344
|
+
|
|
345
|
+
if (p.variations && !isSkipVariations) {
|
|
346
|
+
p.variations.forEach((variation) => {
|
|
347
|
+
const mergedItem = { ...p, ...variation };
|
|
348
|
+
if (p.specifications) {
|
|
349
|
+
mergedItem.specifications = {
|
|
350
|
+
...p.specifications,
|
|
351
|
+
...variation.specifications,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
if (!variation.sku && p.sku) {
|
|
355
|
+
mergedItem.sku = `${p.sku}-${Math.ceil(Math.random() * 1000)}`;
|
|
356
|
+
}
|
|
357
|
+
if (variation.picture_id && p.pictures) {
|
|
358
|
+
const picture = p.pictures.find(({ _id }) => _id === variation.picture_id);
|
|
359
|
+
if (picture) mergedItem.pictures = [picture];
|
|
360
|
+
}
|
|
361
|
+
delete mergedItem.variations;
|
|
362
|
+
convertProduct(mergedItem as any, entry.id);
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
products.forEach((p) => convertProduct(p));
|
|
369
|
+
xml += `
|
|
370
|
+
</feed>`;
|
|
371
|
+
res.send(xml);
|
|
10
372
|
};
|
|
373
|
+
|
|
374
|
+
export default serveFeeds;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/firebase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.13.0",
|
|
5
5
|
"description": "e-com.plus Cloud Commerce on Firebase",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@google-cloud/pubsub": "^4.3.3",
|
|
41
41
|
"dotenv": "^16.4.5",
|
|
42
42
|
"firebase-admin": "^12.0.0",
|
|
43
|
-
"firebase-functions": "^4.
|
|
43
|
+
"firebase-functions": "^4.9.0",
|
|
44
44
|
"source-map-support": "^0.5.21"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/modules",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.13.0",
|
|
5
5
|
"description": "e-com.plus Cloud Commerce modules API",
|
|
6
6
|
"main": "lib/index.cjs",
|
|
7
7
|
"exports": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"ajv-formats": "^2.1.1",
|
|
57
57
|
"axios": "^1.6.8",
|
|
58
58
|
"firebase-admin": "^12.0.0",
|
|
59
|
-
"firebase-functions": "^4.
|
|
59
|
+
"firebase-functions": "^4.9.0",
|
|
60
60
|
"source-map-support": "^0.5.21"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/passport",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.13.0",
|
|
5
5
|
"description": "e-com.plus Cloud Commerce customers authentication (passport) API",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@cloudcommerce/api": "workspace:*",
|
|
32
32
|
"@cloudcommerce/firebase": "workspace:*",
|
|
33
33
|
"firebase-admin": "^12.0.0",
|
|
34
|
-
"firebase-functions": "^4.
|
|
34
|
+
"firebase-functions": "^4.9.0",
|
|
35
35
|
"source-map-support": "^0.5.21"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/ssr",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.13.0",
|
|
5
5
|
"description": "e-com.plus Cloud Commerce storefront SSR",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"astro-capo": "^0.0.1",
|
|
43
43
|
"axios": "^1.6.8",
|
|
44
44
|
"firebase-admin": "^12.0.0",
|
|
45
|
-
"firebase-functions": "^4.
|
|
45
|
+
"firebase-functions": "^4.9.0",
|
|
46
46
|
"mitt": "^3.0.1",
|
|
47
47
|
"vue": "^3.4.21",
|
|
48
48
|
"yaml": "^2.4.1"
|
|
@@ -50,6 +50,6 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@cloudcommerce/types": "workspace:*",
|
|
52
52
|
"@firebase/app-types": "^0.9.1",
|
|
53
|
-
"typescript": "~5.4.
|
|
53
|
+
"typescript": "~5.4.5"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/storefront",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.13.0",
|
|
5
5
|
"description": "e-com.plus Cloud Commerce storefront with Astro",
|
|
6
6
|
"bin": {
|
|
7
7
|
"storefront": "./scripts/build-prod.sh"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@cloudcommerce/i18n": "workspace:*",
|
|
49
49
|
"@ecomplus/utils": "1.5.0-rc.6",
|
|
50
50
|
"@fastify/deepmerge": "^1.3.0",
|
|
51
|
-
"@iconify-json/fa6-brands": "^1.1.
|
|
51
|
+
"@iconify-json/fa6-brands": "^1.1.19",
|
|
52
52
|
"@iconify-json/heroicons": "^1.1.20",
|
|
53
53
|
"@iconify-json/logos": "^1.1.42",
|
|
54
54
|
"@types/gtag.js": "^0.0.19",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"astro-capo": "^0.0.1",
|
|
58
58
|
"chroma-js": "^2.4.2",
|
|
59
59
|
"dotenv": "^16.4.5",
|
|
60
|
-
"firebase": "^10.
|
|
60
|
+
"firebase": "^10.11.0",
|
|
61
61
|
"image-size": "^1.1.1",
|
|
62
62
|
"mitt": "^3.0.1",
|
|
63
63
|
"semver": "^7.6.0",
|
|
@@ -72,6 +72,6 @@
|
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@cloudcommerce/eslint": "workspace:*",
|
|
74
74
|
"@cloudcommerce/types": "workspace:*",
|
|
75
|
-
"@types/react": "^18.2.
|
|
75
|
+
"@types/react": "^18.2.78"
|
|
76
76
|
}
|
|
77
77
|
}
|
|
@@ -240,7 +240,7 @@ if (!import.meta.env.SSR) {
|
|
|
240
240
|
};
|
|
241
241
|
|
|
242
242
|
const appScript = document.createElement('script');
|
|
243
|
-
appScript.src = 'https://cdn.jsdelivr.net/npm/@ecomplus/storefront-app@2.0.0-beta.
|
|
243
|
+
appScript.src = 'https://cdn.jsdelivr.net/npm/@ecomplus/storefront-app@2.0.0-beta.198/dist/lib/js/app.js';
|
|
244
244
|
appScript.onload = onLoad;
|
|
245
245
|
document.body.appendChild(appScript);
|
|
246
246
|
}
|
|
@@ -45,10 +45,11 @@ const isLogged = computed(() => {
|
|
|
45
45
|
return isAuthenticated.value || !!firebaseAuth?.currentUser?.emailVerified;
|
|
46
46
|
});
|
|
47
47
|
const logout = () => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
firebaseAuth.signOut().then(() => {
|
|
49
|
+
session.auth = emptySession.auth;
|
|
50
|
+
session.customer = emptySession.customer;
|
|
51
|
+
localStorage.removeItem(storageKey);
|
|
52
|
+
});
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
const throwNoAuth = (msg = 'Not authenticated') => {
|
|
@@ -123,13 +124,11 @@ const initializeFirebaseAuth = (canWaitIdle?: boolean) => {
|
|
|
123
124
|
const isEmailChanged = user.email !== customerEmail.value;
|
|
124
125
|
if (isEmailChanged || !isAuthenticated.value) {
|
|
125
126
|
await authenticate();
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
}
|
|
128
|
+
if (isEmailChanged || !session.customer.doc_number) {
|
|
129
|
+
await fetchCustomer();
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
|
-
} else {
|
|
132
|
-
logout();
|
|
133
132
|
}
|
|
134
133
|
});
|
|
135
134
|
if (isSignInWithEmailLink(firebaseAuth, window.location.href)) {
|