cloudcommerce 0.0.70 → 0.0.73

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.
Files changed (108) hide show
  1. package/.eslintrc.cjs +1 -0
  2. package/CHANGELOG.md +27 -0
  3. package/package.json +2 -2
  4. package/packages/api/package.json +1 -1
  5. package/packages/apps/correios/package.json +1 -1
  6. package/packages/apps/custom-shipping/package.json +1 -1
  7. package/packages/apps/discounts/package.json +1 -1
  8. package/packages/apps/frenet/CHANGELOG.md +1 -0
  9. package/packages/apps/frenet/README.md +1 -0
  10. package/packages/apps/frenet/lib/frenet.d.ts +2 -0
  11. package/packages/apps/frenet/lib/frenet.js +6 -0
  12. package/packages/apps/frenet/lib/frenet.js.map +1 -0
  13. package/packages/apps/frenet/lib/index.d.ts +1 -0
  14. package/packages/apps/frenet/lib/index.js +2 -0
  15. package/packages/apps/frenet/lib/index.js.map +1 -0
  16. package/packages/apps/frenet/lib-mjs/calculate-frenet.mjs +152 -0
  17. package/packages/apps/frenet/package.json +28 -0
  18. package/packages/apps/frenet/src/frenet.ts +7 -0
  19. package/packages/apps/frenet/src/index.ts +1 -0
  20. package/packages/apps/frenet/tsconfig.json +6 -0
  21. package/packages/apps/tiny-erp/package.json +1 -1
  22. package/packages/cli/package.json +1 -1
  23. package/packages/config/lib/config.js +9 -8
  24. package/packages/config/lib/config.js.map +1 -1
  25. package/packages/config/package.json +1 -1
  26. package/packages/config/src/config.ts +11 -10
  27. package/packages/events/package.json +1 -1
  28. package/packages/firebase/lib/config.d.ts +3 -0
  29. package/packages/firebase/lib/config.js +3 -0
  30. package/packages/firebase/lib/config.js.map +1 -1
  31. package/packages/firebase/package.json +1 -1
  32. package/packages/firebase/src/config.ts +3 -0
  33. package/packages/modules/lib/firebase/call-app-module.js +5 -0
  34. package/packages/modules/lib/firebase/call-app-module.js.map +1 -1
  35. package/packages/modules/package.json +2 -1
  36. package/packages/modules/src/firebase/call-app-module.ts +5 -0
  37. package/packages/passport/package.json +1 -1
  38. package/packages/ssr/lib/firebase/serve-storefront.js +13 -31
  39. package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
  40. package/packages/ssr/package.json +1 -1
  41. package/packages/ssr/src/firebase/serve-storefront.ts +13 -36
  42. package/packages/storefront/content/blog.json +18 -0
  43. package/packages/storefront/content/brands.json +24 -0
  44. package/packages/storefront/content/categories.json +24 -0
  45. package/packages/storefront/content/code.json +5 -0
  46. package/packages/storefront/content/collections.json +24 -0
  47. package/packages/storefront/content/contacts.json +13 -0
  48. package/packages/storefront/content/footer.json +46 -0
  49. package/packages/storefront/content/header.json +27 -0
  50. package/packages/storefront/content/home.json +45 -0
  51. package/packages/storefront/content/info.json +18 -0
  52. package/packages/storefront/content/maintenance.json +6 -0
  53. package/packages/storefront/content/menu.json +6 -0
  54. package/packages/storefront/content/pages/contato.json +6 -0
  55. package/packages/storefront/content/pages/entrega.json +6 -0
  56. package/packages/storefront/content/pages/faq.json +6 -0
  57. package/packages/storefront/content/pages/pagamentos.json +6 -0
  58. package/packages/storefront/content/pages/privacidade.json +6 -0
  59. package/packages/storefront/content/pages/sobre-nos.json +6 -0
  60. package/packages/storefront/content/pages/termos.json +6 -0
  61. package/packages/storefront/content/pages/trocas.json +6 -0
  62. package/packages/storefront/content/posts/esta-loja-e-um-pwa.json +9 -0
  63. package/packages/storefront/content/products.json +32 -0
  64. package/packages/storefront/content/search.json +8 -0
  65. package/packages/storefront/content/settings.json +21 -0
  66. package/packages/storefront/content/social.json +5 -0
  67. package/packages/storefront/content/widgets/analytics.json +11 -0
  68. package/packages/storefront/content/widgets/compre-confie.json +11 -0
  69. package/packages/storefront/content/widgets/ebit.json +11 -0
  70. package/packages/storefront/content/widgets/fb-pixel.json +12 -0
  71. package/packages/storefront/content/widgets/gmc-ratings.json +12 -0
  72. package/packages/storefront/content/widgets/minicart.json +6 -0
  73. package/packages/storefront/content/widgets/offers-notification.json +11 -0
  74. package/packages/storefront/content/widgets/opinioes-verificadas.json +18 -0
  75. package/packages/storefront/content/widgets/product-card.json +10 -0
  76. package/packages/storefront/content/widgets/product.json +13 -0
  77. package/packages/storefront/content/widgets/search-engine.json +8 -0
  78. package/packages/storefront/content/widgets/search.json +6 -0
  79. package/packages/storefront/content/widgets/tag-manager.json +12 -0
  80. package/packages/storefront/content/widgets/tawkto.json +12 -0
  81. package/packages/storefront/content/widgets/trustvox.json +15 -0
  82. package/packages/storefront/content/widgets/user.json +5 -0
  83. package/packages/storefront/dist/client/assets/{index.53a3a3e0.css → _...c08e0a75.css} +1 -1
  84. package/packages/storefront/dist/client/assets/{404-_...d4aa8aff.css → _...d4aa8aff.css} +0 -0
  85. package/packages/storefront/dist/client/assets/{404-index.d9230d24.css → fallback-index.d9230d24.css} +0 -0
  86. package/packages/storefront/dist/client/assets/{_...98510c96.css → fallback.9745a8aa.css} +1 -1
  87. package/packages/storefront/dist/client/assets/{404.530428e5.css → index.9745690c.css} +1 -1
  88. package/packages/storefront/dist/server/entry.mjs +370 -115
  89. package/packages/storefront/package.json +3 -3
  90. package/packages/storefront/src/env.d.ts +1 -0
  91. package/packages/storefront/src/{components → lib/components}/Card.astro +0 -0
  92. package/packages/storefront/src/lib/components/LoginModal.vue +56 -0
  93. package/packages/storefront/src/{layouts → lib/layouts}/Layout.astro +8 -11
  94. package/packages/storefront/src/lib/layouts/meta/Head.astro +7 -0
  95. package/packages/storefront/src/lib/layouts/meta/Json.astro +34 -0
  96. package/packages/storefront/src/lib/ssr-context.ts +131 -0
  97. package/packages/storefront/src/lib/views/[...slug].astro +77 -0
  98. package/packages/storefront/src/lib/views/app/index.astro +0 -0
  99. package/packages/storefront/src/{pages/404.astro → lib/views/fallback.astro} +6 -1
  100. package/packages/storefront/src/lib/views/index.astro +87 -0
  101. package/packages/storefront/src/pages/[...slug].astro +12 -76
  102. package/packages/storefront/src/pages/fallback.astro +13 -0
  103. package/packages/storefront/src/pages/index.astro +15 -79
  104. package/packages/storefront/storefront.config.mjs +23 -6
  105. package/packages/storefront/tsconfig.json +4 -1
  106. package/packages/types/package.json +1 -1
  107. package/turbo.json +0 -6
  108. package/packages/storefront/src/types.ts +0 -18
@@ -1,10 +1,9 @@
1
1
  import { join as joinPath } from 'path';
2
2
  import { readFile } from 'fs/promises';
3
3
 
4
- const { STOREFRONT_BASE_DIR, STOREFRONT_LONG_CACHE } = process.env;
4
+ const { STOREFRONT_BASE_DIR } = process.env;
5
5
  const baseDir = STOREFRONT_BASE_DIR || process.cwd();
6
6
  const clientRoot = new URL(joinPath(baseDir, 'dist/client/'), import.meta.url);
7
- const isLongCache = String(STOREFRONT_LONG_CACHE).toLowerCase() === 'true';
8
7
 
9
8
  export default (req, res) => {
10
9
  const url = req.url.replace(/\?.*$/, '').replace(/\.html$/, '');
@@ -14,31 +13,16 @@ export default (req, res) => {
14
13
  .set('Cache-Control', (typeof global.cache_control === 'function' && global.cache_control(status))
15
14
  || defaultCache);
16
15
  };
17
- const redirect = (toUrl, status = 302) => {
18
- let sMaxAge = status === 301 ? 360 : 12;
19
- if (isLongCache) {
20
- sMaxAge *= 10;
21
- }
22
- let cacheControl = `public, max-age=30, s-maxage=${sMaxAge}`;
23
- if (status === 302) {
24
- cacheControl += ', proxy-revalidate';
25
- }
26
- setStatusAndCache(status, cacheControl)
27
- .set('Location', toUrl).end();
28
- };
29
- const fallback = (status = 404) => {
30
- if (url.slice(-1) === '/') {
31
- redirect(url.slice(0, -1));
32
- } else if (url !== '/404' && (/\/[^/.]+$/.test(url) || /\.x?html$/.test(url))) {
33
- setStatusAndCache(status, `public, max-age=${(isLongCache ? 120 : 30)}`)
16
+ const fallback = (err, status = 500) => {
17
+ if (url !== '/fallback' && (/\/[^/.]+$/.test(url) || /\.x?html$/.test(url))) {
18
+ setStatusAndCache(status, 'public, max-age=120')
34
19
  .send('<html><head>'
35
- + `<meta http-equiv="refresh" content="0; url=/404?url=${encodeURIComponent(url)}"/>`
36
- + '</head><body></body></html>');
20
+ + '<meta http-equiv="refresh" content="0; '
21
+ + `url=/fallback?status=${status}&url=${encodeURIComponent(url)}"/>`
22
+ + `</head><body>${err.toString()}</body></html>`);
37
23
  } else {
38
- setStatusAndCache(status, isLongCache
39
- ? 'public, max-age=60, s-maxage=86400'
40
- : 'public, max-age=60, s-maxage=300')
41
- .end();
24
+ setStatusAndCache(status, 'public, max-age=120, s-maxage=600')
25
+ .send(err.toString());
42
26
  }
43
27
  };
44
28
  /*
@@ -48,19 +32,17 @@ export default (req, res) => {
48
32
  */
49
33
  global.ssr_handler(req, res, async (err) => {
50
34
  if (err) {
51
- res.set('X-SSR-ERROR', err.stack);
52
- fallback(500);
35
+ res.set('X-SSR-Error', err.message);
36
+ fallback(err);
53
37
  return;
54
38
  }
55
39
  const local = new URL(`.${url}`, clientRoot);
56
40
  try {
57
41
  const data = await readFile(local);
58
- setStatusAndCache(200, isLongCache
59
- ? 'public, max-age=60, s-maxage=604800'
60
- : 'public, max-age=60, s-maxage=600, stale-while-revalidate=2592000')
42
+ setStatusAndCache(200, 'public, max-age=60, s-maxage=600')
61
43
  .send(data);
62
44
  } catch {
63
- fallback();
45
+ fallback(err, 404);
64
46
  }
65
47
  });
66
48
  };
@@ -1 +1 @@
1
- {"version":3,"file":"serve-storefront.js","sourceRoot":"","sources":["../../src/firebase/serve-storefront.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,EACJ,mBAAmB,EACnB,qBAAqB,GACtB,GAAG,OAAO,CAAC,GAAG,CAAC;AAEhB,MAAM,OAAO,GAAG,mBAAmB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;AACrD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/E,MAAM,WAAW,GAAG,MAAM,CAAC,qBA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yC;kBACvC,wBAAwB,MAAM,QAAQ,kBAAkB,CAAC,GAAG,CAAC,KAAK;kBACpE,gBAAgB,GAAG,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;SACvD;aAAM;YACL,iBAAiB,CAAC,MAAM,EAAE,mCAAmC,CAAC;iBAC3D,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;SACzB;IACH,CAAC,CAAC;IAEF;;;;MAIE;IACF,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAQ,EAAE,EAAE;QAC9C,IAAI,GAAG,EAAE;YACP,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;YACpC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACd,OAAO;SACR;QACD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,IAAI,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;QAC7C,IAAI;YACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC;YACnC,iBAAiB,CAAC,GAAG,EAAE,kCAAkC,CAAC;iBACvD,IAAI,CAAC,IAAI,CAAC,CAAC;SACf;QAAC,MAAM;YACN,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;SACpB;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/ssr",
3
3
  "type": "module",
4
- "version": "0.0.70",
4
+ "version": "0.0.73",
5
5
  "description": "E-Com Plus Cloud Commerce storefront SSR",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -2,14 +2,9 @@ import type { Request, Response } from 'firebase-functions';
2
2
  import { join as joinPath } from 'path';
3
3
  import { readFile } from 'fs/promises';
4
4
 
5
- const {
6
- STOREFRONT_BASE_DIR,
7
- STOREFRONT_LONG_CACHE,
8
- } = process.env;
9
-
5
+ const { STOREFRONT_BASE_DIR } = process.env;
10
6
  const baseDir = STOREFRONT_BASE_DIR || process.cwd();
11
7
  const clientRoot = new URL(joinPath(baseDir, 'dist/client/'), import.meta.url);
12
- const isLongCache = String(STOREFRONT_LONG_CACHE).toLowerCase() === 'true';
13
8
 
14
9
  export default (req: Request, res: Response) => {
15
10
  const url = req.url.replace(/\?.*$/, '').replace(/\.html$/, '');
@@ -24,32 +19,16 @@ export default (req: Request, res: Response) => {
24
19
  );
25
20
  };
26
21
 
27
- const redirect = (toUrl: string, status = 302) => {
28
- let sMaxAge = status === 301 ? 360 : 12;
29
- if (isLongCache) {
30
- sMaxAge *= 10;
31
- }
32
- let cacheControl = `public, max-age=30, s-maxage=${sMaxAge}`;
33
- if (status === 302) {
34
- cacheControl += ', proxy-revalidate';
35
- }
36
- setStatusAndCache(status, cacheControl)
37
- .set('Location', toUrl).end();
38
- };
39
-
40
- const fallback = (status = 404) => {
41
- if (url.slice(-1) === '/') {
42
- redirect(url.slice(0, -1));
43
- } else if (url !== '/404' && (/\/[^/.]+$/.test(url) || /\.x?html$/.test(url))) {
44
- setStatusAndCache(status, `public, max-age=${(isLongCache ? 120 : 30)}`)
22
+ const fallback = (err: any, status = 500) => {
23
+ if (url !== '/fallback' && (/\/[^/.]+$/.test(url) || /\.x?html$/.test(url))) {
24
+ setStatusAndCache(status, 'public, max-age=120')
45
25
  .send('<html><head>'
46
- + `<meta http-equiv="refresh" content="0; url=/404?url=${encodeURIComponent(url)}"/>`
47
- + '</head><body></body></html>');
26
+ + '<meta http-equiv="refresh" content="0; '
27
+ + `url=/fallback?status=${status}&url=${encodeURIComponent(url)}"/>`
28
+ + `</head><body>${err.toString()}</body></html>`);
48
29
  } else {
49
- setStatusAndCache(status, isLongCache
50
- ? 'public, max-age=60, s-maxage=86400'
51
- : 'public, max-age=60, s-maxage=300')
52
- .end();
30
+ setStatusAndCache(status, 'public, max-age=120, s-maxage=600')
31
+ .send(err.toString());
53
32
  }
54
33
  };
55
34
 
@@ -60,19 +39,17 @@ export default (req: Request, res: Response) => {
60
39
  */
61
40
  global.ssr_handler(req, res, async (err: any) => {
62
41
  if (err) {
63
- res.set('X-SSR-ERROR', err.stack);
64
- fallback(500);
42
+ res.set('X-SSR-Error', err.message);
43
+ fallback(err);
65
44
  return;
66
45
  }
67
46
  const local = new URL(`.${url}`, clientRoot);
68
47
  try {
69
48
  const data = await readFile(local);
70
- setStatusAndCache(200, isLongCache
71
- ? 'public, max-age=60, s-maxage=604800'
72
- : 'public, max-age=60, s-maxage=600, stale-while-revalidate=2592000')
49
+ setStatusAndCache(200, 'public, max-age=60, s-maxage=600')
73
50
  .send(data);
74
51
  } catch {
75
- fallback();
52
+ fallback(err, 404);
76
53
  }
77
54
  });
78
55
  };
@@ -0,0 +1,18 @@
1
+ {
2
+ "title": "Blog",
3
+ "meta_title": "Blog",
4
+ "meta_description": "Blog",
5
+ "sections": [
6
+ {
7
+ "type": "breadcrumbs",
8
+ "enabled": true
9
+ },
10
+ {
11
+ "type": "page-title"
12
+ },
13
+ {
14
+ "type": "blog",
15
+ "enabled": true
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "sections": [
3
+ {
4
+ "type": "breadcrumbs",
5
+ "enabled": true
6
+ },
7
+ {
8
+ "type": "page-title"
9
+ },
10
+ {
11
+ "type": "document-banner",
12
+ "enabled": true
13
+ },
14
+ {
15
+ "type": "brand-retail",
16
+ "enabled": true,
17
+ "sort": "sales"
18
+ },
19
+ {
20
+ "type": "document-description",
21
+ "enabled": true
22
+ }
23
+ ]
24
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "sections": [
3
+ {
4
+ "type": "breadcrumbs",
5
+ "enabled": true
6
+ },
7
+ {
8
+ "type": "page-title"
9
+ },
10
+ {
11
+ "type": "document-banner",
12
+ "enabled": true
13
+ },
14
+ {
15
+ "type": "category-retail",
16
+ "enabled": true,
17
+ "sort": "sales"
18
+ },
19
+ {
20
+ "type": "document-description",
21
+ "enabled": true
22
+ }
23
+ ]
24
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "css": "",
3
+ "html_head": "",
4
+ "html_body": ""
5
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "sections": [
3
+ {
4
+ "type": "breadcrumbs",
5
+ "enabled": true
6
+ },
7
+ {
8
+ "type": "page-title"
9
+ },
10
+ {
11
+ "type": "document-banner",
12
+ "enabled": true
13
+ },
14
+ {
15
+ "type": "collection-retail",
16
+ "enabled": true,
17
+ "sort": "sales"
18
+ },
19
+ {
20
+ "type": "document-description",
21
+ "enabled": true
22
+ }
23
+ ]
24
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "email": "vitor@e-com.club",
3
+ "phone": "(31) 9 8272-1558",
4
+ "whatsapp": "(31) 9 8272-1558",
5
+ "address": "Endereço",
6
+ "doc_number": "123",
7
+ "facebook": "https://www.facebook.com/ecom.clubpage/",
8
+ "twitter": "",
9
+ "youtube": "https://www.youtube.com/channel/UCBlIxK5JAub0E1EX_qHdzmA",
10
+ "tiktok": "",
11
+ "instagram": "https://www.instagram.com/ecomclub/",
12
+ "pinterest": ""
13
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "description": {
3
+ "title": "",
4
+ "text": ""
5
+ },
6
+ "links_1": {
7
+ "list_pages": true,
8
+ "title": "Pages",
9
+ "list": []
10
+ },
11
+ "links_2": {
12
+ "list_categories": true,
13
+ "title": "Categories",
14
+ "list": []
15
+ },
16
+ "contacts": {
17
+ "title": "Contacts",
18
+ "phone_wpp": true,
19
+ "socials": true,
20
+ "email": true,
21
+ "address": true
22
+ },
23
+ "stamps": [
24
+ {
25
+ "src": "/img/uploads/ssl-safe.png",
26
+ "alt": "Secure connection"
27
+ }
28
+ ],
29
+ "payment_methods": {
30
+ "bb": true,
31
+ "visa": true,
32
+ "boleto": true,
33
+ "aura": false,
34
+ "banrisul": false,
35
+ "elo": true,
36
+ "hipercard": false,
37
+ "hsbc": false,
38
+ "bradesco": true,
39
+ "santander": false,
40
+ "mastercard": true,
41
+ "citibank": false,
42
+ "mais": false,
43
+ "itau": true
44
+ },
45
+ "credits": ""
46
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "marketing_stripe": {
3
+ "text": "Aproveite nossos descontos de até 50%!",
4
+ "link": "/promotion"
5
+ },
6
+ "contacts_stripe": {
7
+ "pages": [
8
+ {
9
+ "title": "Sobre nós",
10
+ "link": "/pages/sobre-nos"
11
+ },
12
+ {
13
+ "title": "Esta loja é um PWA",
14
+ "link": "/posts/esta-loja-e-um-pwa"
15
+ }
16
+ ],
17
+ "phone_wpp": true,
18
+ "socials": true
19
+ },
20
+ "categories_list": {
21
+ "featured": [],
22
+ "random": 6,
23
+ "full_width": false
24
+ },
25
+ "desktop_megamenu": false,
26
+ "search_input": true
27
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "meta_title": "",
3
+ "meta_description": "",
4
+ "sections": [
5
+ {
6
+ "type": "banner-slider",
7
+ "autoplay": 9000,
8
+ "full_width": false,
9
+ "slides": [
10
+ {
11
+ "img": "/img/uploads/rect89.webp",
12
+ "link": "/headset",
13
+ "alt": "Headset banner",
14
+ "start": "",
15
+ "end": "",
16
+ "mobile_img": "/img/uploads/headphone.webp"
17
+ },
18
+ {
19
+ "start": "",
20
+ "end": "",
21
+ "img": "/img/uploads/banner2.webp"
22
+ }
23
+ ]
24
+ },
25
+ {
26
+ "type": "info-bar",
27
+ "enabled": true
28
+ },
29
+ {
30
+ "type": "collection-shelf",
31
+ "shuffle": false,
32
+ "collection_id": null,
33
+ "sort": "offers",
34
+ "title": "",
35
+ "headless": false,
36
+ "limit": 12,
37
+ "page": 1
38
+ },
39
+ {
40
+ "type": "page-title",
41
+ "title": "Loja demo da E-Com Plus",
42
+ "description": "Loja de demonstração e testes da plataforma E-Com Plus e Storefront. Todos os produtos, preços e informações são meramente ilustrativos."
43
+ }
44
+ ]
45
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "shipping": {
3
+ "show": true,
4
+ "text": "Entregamos para todo o Brasil"
5
+ },
6
+ "installments": {
7
+ "show": true,
8
+ "text": "Parcele sem juros"
9
+ },
10
+ "exchange": {
11
+ "show": true,
12
+ "text": "Não gostou? A primeira troca é gratuita"
13
+ },
14
+ "promo": {
15
+ "show": true,
16
+ "text": "Diferentes promoções ao longo do ano!"
17
+ }
18
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "title": "Loja em manutenção",
3
+ "body": "*Voltamos em breve*",
4
+ "active": false,
5
+ "unlock_key": ""
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "sort_categories": [],
3
+ "alphabetical_order": false,
4
+ "phone_wpp": true,
5
+ "socials": true
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "title": "Contato",
3
+ "meta_title": "Contato",
4
+ "meta_description": "Contato",
5
+ "body": "### Lorem ipsum dolor sit amet"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "title": "Condições de entrega",
3
+ "meta_title": "Condições de entrega",
4
+ "meta_description": "Condições de entrega",
5
+ "body": "### Lorem ipsum dolor sit amet"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "title": "Dúvidas frequentes",
3
+ "meta_title": "Dúvidas frequentes",
4
+ "meta_description": "Dúvidas frequentes",
5
+ "body": "### Lorem ipsum dolor sit amet"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "title": "Formas de pagamento",
3
+ "meta_title": "Formas de pagamento",
4
+ "meta_description": "Formas de pagamento",
5
+ "body": "### Lorem ipsum dolor sit amet"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "title": "Política de privacidade",
3
+ "meta_title": "Política de privacidade",
4
+ "meta_description": "Política de privacidade",
5
+ "body": "Nos comprometemos a preservar os dados de todos os clientes, informações importantes como senha e CPF são criptografadas no momento do cadastro, antes de serem salvas. A finalização da sua compra será realizada em ambiente seguro e nenhuma informação relacionada a cartões de crédito ou contas bancárias será armazenada em nossos bancos de dados. Os dados cadastrais dos clientes não são vendidos, trocados ou divulgados para terceiros, exceto quando essas informações são necessárias para o processo de entrega, para cobrança, ou para participação em promoções solicitadas pelos clientes. Seus dados pessoais são peça fundamental para que seu pedido chegue em segurança, na sua casa, de acordo com nosso prazo de entrega. Nosso site utiliza cookies e informações de sua navegação (sessão do browser) com o objetivo de traçar um perfil do público que visita o site e aperfeiçoar sempre nossos serviços, produtos, conteúdos e garantir as melhores ofertas e promoções para você. Estas informações são registradas automaticamente e serão mantidas em sigilo absoluto. Qualquer alteração sobre nossa política de privacidade será devidamente informada nesta página."
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "title": "Sobre nós",
3
+ "meta_title": "Sobre nós",
4
+ "meta_description": "Sobre nós",
5
+ "body": "### Lorem ipsum dolor sit amet"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "title": "Termos de serviço",
3
+ "meta_title": "Termos de serviço",
4
+ "meta_description": "Termos de serviço",
5
+ "body": "### Lorem ipsum dolor sit amet"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "title": "Trocas e devoluções",
3
+ "meta_title": "Trocas e devoluções",
4
+ "meta_description": "Trocas e devoluções",
5
+ "body": "### Lorem ipsum dolor sit amet"
6
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "title": "Esta loja é um Progressive Web App",
3
+ "date": "2019-05-16T16:01:40.618Z",
4
+ "thumbnail": "/img/uploads/pwa-reliable.png",
5
+ "description": "PWA é uma evolução híbrida entre um aplicativo e uma página web, que torna a experiência de uso de uma página web pelo celular semelhante a de um aplicativo mobile.\n\n",
6
+ "body": "![PWA](/img/uploads/pwa-reliable.png)\n\nProgressive Web App (PWA) é uma criação da da Google que permite a criação de aplicações que são um meio termo entre uma página web e um aplicativo nativo. Nosso Storefront padrão é um PWA!\n\nCom o grande aumento de tráfego mobile no e-commerce um PWA commerce traz enormes vantagens. Veja abaixo as principais vantagens e com alguns exemplos de sucesso com estudos de caso feitos pelo Google\n\n**Digno de estar na tela inicial**\n\nQuando os critérios do Progressive Web App são atendidos, o Chrome solicita que os usuários adicionem o PWA à tela inicial. Com isso a loja se transforma em uma aplicação nativa sem a necessidade de download através de uma app store. Isso pode não funcionar perfeitamente em IOS que tem 13,57% do market share mobile brasileiro, sendo quase todo o resto dominado pelo Android.\n\n**Maior engajamento**\n\nO PWA da [eXtra Electronics](https://developers.google.com/web/showcase/2016/extra) aumentou o re-engajamento em 4X, esses usuários gastam o dobro do tempo no site.\n Com a [OLX ](https://developers.google.com/web/showcase/2017/olx) o aumento do o re-engajamento foi de 250%.\n\n**Aumento na taxa de conversão**\n\nA capacidade de fornecer de um PWA melhorar a experiência ao usuário, ajudou o [AliExpress](https://developers.google.com/web/showcase/2016/aliexpress) a aumentar a taxa de conversão de novos usuários em 104%.",
7
+ "meta_title": "PWA - My Shop",
8
+ "meta_description": "Esta loja é um JAMstack PWA"
9
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "sections": [
3
+ {
4
+ "type": "breadcrumbs",
5
+ "enabled": true
6
+ },
7
+ {
8
+ "type": "product-block",
9
+ "enabled": true,
10
+ "size_guide": {
11
+ "image": "",
12
+ "title": ""
13
+ }
14
+ },
15
+ {
16
+ "type": "related-products",
17
+ "title": "Produtos relacionados"
18
+ },
19
+ {
20
+ "type": "recommended-products",
21
+ "title": "Quem comprou este produto, também comprou:"
22
+ },
23
+ {
24
+ "type": "product-description",
25
+ "enabled": true
26
+ },
27
+ {
28
+ "type": "product-specifications",
29
+ "enabled": true
30
+ }
31
+ ]
32
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "sections": [
3
+ {
4
+ "type": "search-engine",
5
+ "enabled": true
6
+ }
7
+ ]
8
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "domain": "storefront-demo.e-com.plus",
3
+ "primary_color": "",
4
+ "theme": {
5
+ "bootswatch": "_",
6
+ "custom": "_"
7
+ },
8
+ "icons_font": "_",
9
+ "font_family": "_",
10
+ "bg_color": "#f5f6fa",
11
+ "repository": "",
12
+ "logo": "/img/uploads/logo.webp",
13
+ "name": "My Shop",
14
+ "short_name": "MyShop",
15
+ "mini_logo": "",
16
+ "favicon": "/img/uploads/favicon.png",
17
+ "secondary_color": "",
18
+ "icon": "/img/icon.png",
19
+ "description": "My PWA Shop",
20
+ "large_icon": "/img/large-icon.png"
21
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "og_image": "",
3
+ "fb_app_id": "",
4
+ "twitter_username": ""
5
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "pkg": "@ecomplus/widget-analytics",
3
+ "active": false,
4
+ "desktopOnly": false,
5
+ "enableCheckout": true,
6
+ "options": {
7
+ "gaTrackingId": "",
8
+ "googleAdsId": ""
9
+ },
10
+ "headAppend": "src/append/head"
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "pkg": "@ecomplus/widget-compre-confie",
3
+ "active": false,
4
+ "desktopOnly": false,
5
+ "enableCheckout": true,
6
+ "disablePages": true,
7
+ "options": {
8
+ "compreConfieStoreId": ""
9
+ },
10
+ "stampsAppend": "src/append/stamps"
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "pkg": "@ecomplus/widget-ebit",
3
+ "active": false,
4
+ "desktopOnly": false,
5
+ "enableCheckout": true,
6
+ "disablePages": true,
7
+ "options": {
8
+ "ebitStoreId": ""
9
+ },
10
+ "stampsAppend": "src/append/stamps"
11
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "pkg": "@ecomplus/widget-fb-pixel",
3
+ "active": false,
4
+ "desktopOnly": false,
5
+ "enableCheckout": true,
6
+ "options": {
7
+ "fbqContainerId": "",
8
+ "debug": false
9
+ },
10
+ "headAppend": "src/append/head",
11
+ "bodyAppend": "src/append/body"
12
+ }