cloudcommerce 2.0.8 → 2.1.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.
Files changed (214) hide show
  1. package/.husky/pre-commit +4 -0
  2. package/.vscode/settings.json +7 -2
  3. package/CHANGELOG.md +24 -0
  4. package/LICENSE +21 -0
  5. package/action.yml +43 -3
  6. package/ecomplus-stores/barra-doce/.github/workflows/build-and-deploy.yml +1 -0
  7. package/ecomplus-stores/barra-doce/.husky/pre-commit +4 -0
  8. package/ecomplus-stores/barra-doce/.vscode/settings.json +7 -1
  9. package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
  10. package/ecomplus-stores/barra-doce/functions/ssr/.staged.eslintrc.cjs +6 -0
  11. package/ecomplus-stores/barra-doce/functions/ssr/package.json +8 -7
  12. package/ecomplus-stores/barra-doce/functions/ssr/src/components/AccountMenu.vue +4 -1
  13. package/ecomplus-stores/barra-doce/functions/ssr/src/components/AccountPage.vue +6 -3
  14. package/ecomplus-stores/barra-doce/functions/ssr/src/components/Banner.vue +2 -1
  15. package/ecomplus-stores/barra-doce/functions/ssr/src/components/BlogPosts.vue +8 -2
  16. package/ecomplus-stores/barra-doce/functions/ssr/src/components/Breadcrumbs.vue +4 -1
  17. package/ecomplus-stores/barra-doce/functions/ssr/src/components/CartItem.vue +4 -3
  18. package/ecomplus-stores/barra-doce/functions/ssr/src/components/CartSidebar.vue +1 -1
  19. package/ecomplus-stores/barra-doce/functions/ssr/src/components/CheckoutPage.vue +2 -2
  20. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ContentEntry.vue +1 -1
  21. package/ecomplus-stores/barra-doce/functions/ssr/src/components/FooterStamps.vue +8 -6
  22. package/ecomplus-stores/barra-doce/functions/ssr/src/components/HeroSlider.vue +7 -3
  23. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ImagesGallery.vue +13 -11
  24. package/ecomplus-stores/barra-doce/functions/ssr/src/components/LoginForm.vue +1 -1
  25. package/ecomplus-stores/barra-doce/functions/ssr/src/components/PitchBar.vue +5 -2
  26. package/ecomplus-stores/barra-doce/functions/ssr/src/components/Prices.vue +1 -1
  27. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ProductCard.vue +13 -13
  28. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ProductDetails.vue +1 -1
  29. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ProductShelf.vue +9 -6
  30. package/ecomplus-stores/barra-doce/functions/ssr/src/components/SearchModal.vue +1 -1
  31. package/ecomplus-stores/barra-doce/functions/ssr/src/components/SearchShowcase.vue +8 -9
  32. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopFooter.vue +15 -6
  33. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopHeader.vue +11 -15
  34. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopHeaderMenu.vue +6 -3
  35. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopHeaderSubmenu.vue +7 -4
  36. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopSidenav.vue +5 -2
  37. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopSidenavCategory.vue +3 -2
  38. package/ecomplus-stores/barra-doce/functions/ssr/src/components/SkuSelector.vue +8 -5
  39. package/ecomplus-stores/barra-doce/functions/ssr/src/layouts/PageFooter.astro +1 -2
  40. package/ecomplus-stores/barra-doce/functions/ssr/src/layouts/PageHeader.astro +2 -1
  41. package/ecomplus-stores/barra-doce/functions/ssr/src/main/Fallback.astro +3 -3
  42. package/ecomplus-stores/barra-doce/functions/ssr/src/main/Main.astro +2 -2
  43. package/ecomplus-stores/barra-doce/functions/ssr/src/pages/[...slug].astro +13 -5
  44. package/ecomplus-stores/barra-doce/functions/ssr/src/scripts/InlineScripts.astro +8 -8
  45. package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
  46. package/ecomplus-stores/barra-doce/package.json +10 -3
  47. package/ecomplus-stores/barra-doce/tailwind.config.cjs +5 -0
  48. package/ecomplus-stores/tia-sonia/.vscode/settings.json +7 -1
  49. package/package.json +13 -8
  50. package/packages/__skeleton/package.json +1 -1
  51. package/packages/api/lib/api.js +1 -1
  52. package/packages/api/lib/api.js.map +1 -1
  53. package/packages/api/package.json +2 -2
  54. package/packages/api/src/api.ts +1 -1
  55. package/packages/apps/affiliate-program/package.json +2 -2
  56. package/packages/apps/correios/package.json +2 -2
  57. package/packages/apps/custom-payment/package.json +2 -2
  58. package/packages/apps/custom-shipping/package.json +2 -2
  59. package/packages/apps/datafrete/package.json +2 -2
  60. package/packages/apps/discounts/package.json +2 -2
  61. package/packages/apps/emails/package.json +2 -2
  62. package/packages/apps/fb-conversions/package.json +2 -2
  63. package/packages/apps/flash-courier/package.json +2 -2
  64. package/packages/apps/frenet/package.json +2 -2
  65. package/packages/apps/galaxpay/package.json +2 -2
  66. package/packages/apps/google-analytics/package.json +2 -2
  67. package/packages/apps/jadlog/package.json +2 -2
  68. package/packages/apps/loyalty-points/package.json +2 -2
  69. package/packages/apps/mandae/package.json +2 -2
  70. package/packages/apps/melhor-envio/package.json +2 -2
  71. package/packages/apps/mercadopago/package.json +2 -2
  72. package/packages/apps/pagarme/package.json +2 -2
  73. package/packages/apps/pagarme-v5/package.json +2 -2
  74. package/packages/apps/paghiper/package.json +2 -2
  75. package/packages/apps/pix/package.json +2 -2
  76. package/packages/apps/tiny-erp/package.json +2 -2
  77. package/packages/apps/webhooks/package.json +2 -2
  78. package/packages/cli/ci/bunny-config-base.sh +169 -0
  79. package/packages/cli/ci/bunny-prepare-ab.sh +164 -0
  80. package/packages/cli/config/firebase.json +13 -0
  81. package/packages/cli/lib/cli.js +17 -3
  82. package/packages/cli/package.json +3 -2
  83. package/packages/cli/src/cli.ts +17 -7
  84. package/packages/config/package.json +2 -2
  85. package/packages/emails/package.json +2 -2
  86. package/packages/eslint/base.eslintrc.cjs +3 -2
  87. package/packages/eslint/package.json +5 -4
  88. package/packages/eslint/storefront.eslintrc.cjs +17 -2
  89. package/packages/eslint/storefront.staged.eslintrc.cjs +9 -0
  90. package/packages/events/package.json +2 -2
  91. package/packages/feeds/package.json +2 -2
  92. package/packages/firebase/package.json +3 -3
  93. package/packages/i18n/package.json +2 -2
  94. package/packages/modules/package.json +2 -2
  95. package/packages/passport/package.json +2 -2
  96. package/packages/ssr/package.json +6 -6
  97. package/packages/storefront/dist/client/_astro/{AccountPage.sfdU6Ju1.js → AccountPage.9BlGHXT3.js} +1 -1
  98. package/packages/storefront/dist/client/_astro/CartSidebar.55UgTcV0.js +1 -0
  99. package/packages/storefront/dist/client/_astro/{HeroSlider.GWgaYE3A.js → HeroSlider.XZb2xsyV.js} +1 -1
  100. package/packages/storefront/dist/client/_astro/{PitchBar._m4Oyh26.js → PitchBar.Nr7T3S3T.js} +1 -1
  101. package/packages/storefront/dist/client/_astro/{Prices.ij-wiXyI.js → Prices.Ye-m2HTo.js} +1 -1
  102. package/packages/storefront/dist/client/_astro/ProductDetails.ENLKdSz_.js +7 -0
  103. package/packages/storefront/dist/client/_astro/ProductShelf.CNf5JDrU.js +1 -0
  104. package/packages/storefront/dist/client/_astro/ProductShelf.lCBJky3e.js +1 -0
  105. package/packages/storefront/dist/client/_astro/{QuantitySelector.BLGwL_-E.js → QuantitySelector.tumfWDjC.js} +1 -1
  106. package/packages/storefront/dist/client/_astro/{SearchModal.3j8PYOg4.js → SearchModal.4osqtafp.js} +1 -1
  107. package/packages/storefront/dist/client/_astro/{SearchShowcase.na8UFES5.js → SearchShowcase.hg6TWrz3.js} +1 -1
  108. package/packages/storefront/dist/client/_astro/ShopHeader.xLMeJpqV.js +7 -0
  109. package/packages/storefront/dist/client/_astro/{_plugin-vue_export-helper.zwYIxbLv.js → _plugin-vue_export-helper.SO-0jCqa.js} +2 -2
  110. package/packages/storefront/dist/client/_astro/{_slug_.gHu56-HX.css → _slug_.r344YGqG.css} +1 -1
  111. package/packages/storefront/dist/client/_astro/client.ZhEmw4hZ.js +1 -0
  112. package/packages/storefront/dist/client/_astro/{customer-session.zys3PDaD.js → customer-session.hXdZh5Ii.js} +1 -1
  113. package/packages/storefront/dist/client/_astro/{format-money.85X7Tchr.js → format-money.iK5LGydz.js} +1 -1
  114. package/packages/storefront/dist/client/_astro/{grid-title.tJFKNjnT.js → grid-title.vGKBy72g.js} +1 -1
  115. package/packages/storefront/dist/client/_astro/{hoisted.J3ui9KfA.js → hoisted.HGTzAuTI.js} +1 -1
  116. package/packages/storefront/dist/client/_astro/{hoisted.3l9XzKQq.js → hoisted.J15ErMtK.js} +1 -1
  117. package/packages/storefront/dist/client/_astro/hoisted.KYhwGfsv.js +1 -0
  118. package/packages/storefront/dist/client/_astro/{i18n.vH3oaO8m.js → i18n.Lxnz1oF-.js} +1 -1
  119. package/packages/storefront/dist/client/_astro/{img.PXVYiEi4.js → img.WnsidxCx.js} +1 -1
  120. package/packages/storefront/dist/client/_astro/{index._z3KfWlu.js → index.R7A-Pg5V.js} +1 -1
  121. package/packages/storefront/dist/client/_astro/{index.ZVw4Qnet.js → index.q6KIyKlJ.js} +1 -1
  122. package/packages/storefront/dist/client/_astro/{modules-info.39sWCsAH.js → modules-info.tVRhvxNm.js} +1 -1
  123. package/packages/storefront/dist/client/_astro/name.urFqJ5yn.js +1 -0
  124. package/packages/storefront/dist/client/_astro/runtime-core.esm-bundler.XTSAdOlw.js +13 -0
  125. package/packages/storefront/dist/client/_astro/{shopping-cart.bLFDGb3i.js → shopping-cart.ZdSCrjS6.js} +1 -1
  126. package/packages/storefront/dist/client/_astro/{use-analytics.qryUNUh7.js → use-analytics.tCrQbW8O.js} +1 -1
  127. package/packages/storefront/dist/client/_astro/{use-product-card.h3dJsLOD.js → use-product-card.-9TsgDDW.js} +1 -1
  128. package/packages/storefront/dist/client/_astro/use-text-value.XE_A2nDM.js +4 -0
  129. package/packages/storefront/dist/server/chunks/{CartSidebar_8VAKl-jR.mjs → CartSidebar_7UWmGIF6.mjs} +5 -5
  130. package/packages/storefront/dist/server/chunks/{SearchModal_7debttOi.mjs → SearchModal_MNdcYMws.mjs} +4 -4
  131. package/packages/storefront/dist/server/chunks/{_.._D6rq0cLa.mjs → _.._h5R83hoK.mjs} +1 -1
  132. package/packages/storefront/dist/server/chunks/{_page__WXDIwV7g.mjs → _page__lWVlZyRe.mjs} +1 -1
  133. package/packages/storefront/dist/server/chunks/{account_DOT2RzND.mjs → account_jmelxnlw.mjs} +1 -1
  134. package/packages/storefront/dist/server/chunks/astro/{assets-service_gJYJeEDH.mjs → assets-service_xNulQtBO.mjs} +1 -1
  135. package/packages/storefront/dist/server/chunks/{astro_H-6uiAAG.mjs → astro_tggR3S_9.mjs} +2 -2
  136. package/packages/storefront/dist/server/chunks/{index_eXlHIU83.mjs → index_e3ytAL8v.mjs} +1 -1
  137. package/packages/storefront/dist/server/chunks/{node_-eQO2yOn.mjs → node_kUJIRL0c.mjs} +1 -1
  138. package/packages/storefront/dist/server/chunks/pages/{__fI3NeWvy.mjs → __wihn0dYD.mjs} +864 -856
  139. package/packages/storefront/dist/server/chunks/pages/{_page__Piz8geXW.mjs → _page__Sb1eYhpz.mjs} +2 -2
  140. package/packages/storefront/dist/server/chunks/pages/{account_6pD7OYw-.mjs → account_-mULVQUB.mjs} +2 -2
  141. package/packages/storefront/dist/server/chunks/pages/{index_2F5yi6YO.mjs → index_mQXYNYRg.mjs} +4 -4
  142. package/packages/storefront/dist/server/chunks/pages/{node_-Buhxl8v.mjs → node_-qe5LuQh.mjs} +3 -3
  143. package/packages/storefront/dist/server/chunks/pages/{~fallback_okEL1qQ3.mjs → ~fallback_ad_xyGHU.mjs} +4 -4
  144. package/packages/storefront/dist/server/chunks/~fallback_EZqiEAFE.mjs +6 -0
  145. package/packages/storefront/dist/server/entry.mjs +376 -307
  146. package/packages/storefront/dist/server/manifest_RrmXPEuL.mjs +196 -0
  147. package/packages/storefront/dist/server/renderers.mjs +1 -1
  148. package/packages/storefront/package.json +9 -8
  149. package/packages/storefront/src/lib/components/BannerPictures.astro +7 -6
  150. package/packages/storefront/src/lib/components/CarouselControl.vue +2 -2
  151. package/packages/storefront/src/lib/components/ContentClearfix.vue +1 -1
  152. package/packages/storefront/src/lib/components/Drawer.vue +2 -2
  153. package/packages/storefront/src/lib/components/Picture.astro +2 -2
  154. package/packages/storefront/src/lib/components/QuantitySelectorControl.vue +2 -2
  155. package/packages/storefront/src/lib/components/ViewTransitions.astro +1 -0
  156. package/packages/storefront/src/lib/layouts/BaseBody.astro +3 -3
  157. package/packages/storefront/src/lib/layouts/BaseHead.astro +29 -29
  158. package/packages/test-base/package.json +2 -2
  159. package/packages/types/package.json +2 -2
  160. package/tailwind.config.cjs +5 -0
  161. package/LICENSE.md +0 -230
  162. package/packages/storefront/dist/client/_astro/CartSidebar.1fFe2RGR.js +0 -1
  163. package/packages/storefront/dist/client/_astro/ProductDetails.WXj4miM3.js +0 -7
  164. package/packages/storefront/dist/client/_astro/ProductShelf.GkYOYehE.js +0 -1
  165. package/packages/storefront/dist/client/_astro/ProductShelf.I8ZQzwkT.js +0 -1
  166. package/packages/storefront/dist/client/_astro/ShopHeader.27oTzgGP.js +0 -7
  167. package/packages/storefront/dist/client/_astro/client.guyl5T6O.js +0 -1
  168. package/packages/storefront/dist/client/_astro/ecom-icon_12falx.png +0 -0
  169. package/packages/storefront/dist/client/_astro/ecom-icon_15pqnO.png +0 -0
  170. package/packages/storefront/dist/client/_astro/ecom-icon_t3guw.png +0 -0
  171. package/packages/storefront/dist/client/_astro/headphone_T2Jjc.avif +0 -0
  172. package/packages/storefront/dist/client/_astro/headphone_Z1CG18r.webp +0 -0
  173. package/packages/storefront/dist/client/_astro/hoisted.X6EeZJCY.js +0 -1
  174. package/packages/storefront/dist/client/_astro/logo_1UBsBq.webp +0 -0
  175. package/packages/storefront/dist/client/_astro/logo_Z1K5PE9.png +0 -0
  176. package/packages/storefront/dist/client/_astro/logo_Z1KIIl1.avif +0 -0
  177. package/packages/storefront/dist/client/_astro/name.LjTu3VQY.js +0 -1
  178. package/packages/storefront/dist/client/_astro/passion_LHbe9.webp +0 -0
  179. package/packages/storefront/dist/client/_astro/passion_Z23MeUb.avif +0 -0
  180. package/packages/storefront/dist/client/_astro/rect8589_1TtOHY.png +0 -0
  181. package/packages/storefront/dist/client/_astro/rect8589_1f5opX.webp +0 -0
  182. package/packages/storefront/dist/client/_astro/rect8589_IUskt.webp +0 -0
  183. package/packages/storefront/dist/client/_astro/rect8589_Uxfdf.png +0 -0
  184. package/packages/storefront/dist/client/_astro/rect8589_Z15uApA.png +0 -0
  185. package/packages/storefront/dist/client/_astro/rect8589_Z1Ap1Im.avif +0 -0
  186. package/packages/storefront/dist/client/_astro/rect8589_Z1JT1HB.webp +0 -0
  187. package/packages/storefront/dist/client/_astro/rect8589_ZY9mtN.avif +0 -0
  188. package/packages/storefront/dist/client/_astro/rect8589_tMFW0.avif +0 -0
  189. package/packages/storefront/dist/client/_astro/rect859_1TgQXS.avif +0 -0
  190. package/packages/storefront/dist/client/_astro/rect859_2Nm1z.avif +0 -0
  191. package/packages/storefront/dist/client/_astro/rect859_DIqwR.png +0 -0
  192. package/packages/storefront/dist/client/_astro/rect859_Z1IKDb2.png +0 -0
  193. package/packages/storefront/dist/client/_astro/rect859_Z29FI4V.webp +0 -0
  194. package/packages/storefront/dist/client/_astro/rect859_Z2kFHGk.avif +0 -0
  195. package/packages/storefront/dist/client/_astro/rect859_ZkpPFI.webp +0 -0
  196. package/packages/storefront/dist/client/_astro/rect859_jXzBi.png +0 -0
  197. package/packages/storefront/dist/client/_astro/rect859_x1l16.webp +0 -0
  198. package/packages/storefront/dist/client/_astro/rect89_1TSfW7.avif +0 -0
  199. package/packages/storefront/dist/client/_astro/rect89_Z1re32x.webp +0 -0
  200. package/packages/storefront/dist/client/_astro/runtime-core.esm-bundler.arxvxBux.js +0 -13
  201. package/packages/storefront/dist/client/_astro/use-text-value.dpiQwgOv.js +0 -4
  202. package/packages/storefront/dist/client/app/account/index.html +0 -56
  203. package/packages/storefront/dist/client/app/index.html +0 -96
  204. package/packages/storefront/dist/client/blog/1/index.html +0 -82
  205. package/packages/storefront/dist/client/index.html +0 -122
  206. package/packages/storefront/dist/client/macbook-apple-pro-15.4-intel-core-i7-2.6ghz-ram-16gb-ssd-512gb-mr972ll/a-prata/index.html +0 -89
  207. package/packages/storefront/dist/client/mouse-gamer-corsair-optico-harpoon-rgb-ch-9301011-na/index.html +0 -89
  208. package/packages/storefront/dist/client/p/contato/index.html +0 -86
  209. package/packages/storefront/dist/client/p/terms/index.html +0 -97
  210. package/packages/storefront/dist/client/posts/3/index.html +0 -97
  211. package/packages/storefront/dist/client/posts/4/index.html +0 -97
  212. package/packages/storefront/dist/client/~fallback/index.html +0 -97
  213. package/packages/storefront/dist/server/chunks/~fallback_M-xiy2GE.mjs +0 -6
  214. package/packages/storefront/dist/server/manifest_oV2meNKS.mjs +0 -196
@@ -0,0 +1,164 @@
1
+ #!/bin/bash
2
+
3
+ if [ -z "$BUNNYNET_API_KEY" ]; then
4
+ echo "BUNNYNET_API_KEY env var must be set"
5
+ exit 1
6
+ fi
7
+ if [ $# -eq 0 ]; then
8
+ echo "Provide the domain as the first argument"
9
+ exit 1
10
+ fi
11
+
12
+ domain=$1
13
+ channel_url=$2
14
+
15
+ curl --request POST \
16
+ --url "https://api.bunny.net/purge?url=https://$domain/&async=false" \
17
+ --header "AccessKey: $BUNNYNET_API_KEY"
18
+ echo "> Purged https://$domain/ cache"
19
+
20
+ base_uri=""
21
+ additional_patterns=()
22
+
23
+ fetch_and_purge() {
24
+ local endpoint=$1
25
+ local response=$(curl --silent "$base_uri$endpoint")
26
+ local slugs=$(echo $response | jq -r '.result[].slug')
27
+
28
+ for slug in $slugs; do
29
+ if [ -n "$slug" ]; then
30
+ curl --request POST \
31
+ --url "https://api.bunny.net/purge?url=https://$domain/$slug" \
32
+ --header "AccessKey: $BUNNYNET_API_KEY"
33
+ additional_patterns+=("\"https://$domain/$slug\"")
34
+ echo "> Purged https://$domain/$slug cache"
35
+ fi
36
+ done
37
+ }
38
+
39
+ if [ ! -z "$ECOM_STORE_ID" ]; then
40
+ base_uri="https://ecomplus.io/v2/:$ECOM_STORE_ID/"
41
+
42
+ fetch_and_purge 'products?fields=slug&sort=-sales&limit=2'
43
+ fetch_and_purge 'categories?fields=slug&sort=created_at&limit=1'
44
+ fi
45
+
46
+ if [ -z "$GIT_BRANCH" ]; then
47
+ echo "GIT_BRANCH env not set, skipping edge rules config"
48
+ exit 0
49
+ fi
50
+ if [ -z "$channel_url" ]; then
51
+ echo "Channel URL not set (second argument), skipping edge rules config"
52
+ exit 0
53
+ fi
54
+ channel_url="${channel_url%/}"
55
+
56
+ response=$(curl --silent --request GET \
57
+ --url https://api.bunny.net/pullzone \
58
+ --header "AccessKey: $BUNNYNET_API_KEY" \
59
+ --header 'accept: application/json')
60
+
61
+ pull_zone_id=$(echo $response | jq --arg domain "$domain" '[.[] | select(.Hostnames[].Value | contains($domain)).Id][0]')
62
+ if [ -z "$pull_zone_id" ]; then
63
+ echo "bunny.net pull zone not found for domain $domain"
64
+ exit 1
65
+ fi
66
+
67
+ edge_rules=$(echo $response | jq --arg id "$pull_zone_id" '.[] | select(.Id == ($id | tonumber)).EdgeRules')
68
+
69
+ configure_edge_rule() {
70
+ printf "\n"
71
+ local description=$1
72
+ local rule_data=$2
73
+ local is_additional_patterns=${3:-true}
74
+ local found_rule=$(echo $edge_rules | jq --arg description "$description" '.[] | select(.Description == $description)')
75
+ local guid=$(echo $found_rule | jq -r '.Guid // empty')
76
+
77
+ local json_data="$rule_data"
78
+ if [ "$is_additional_patterns" = true ]; then
79
+ local additional_patterns_json=$(printf '%s\n' "${additional_patterns[@]}" | jq -s '.')
80
+ json_data=$(echo $json_data | jq --argjson additionalPatterns "$additional_patterns_json" '.Triggers[0].PatternMatches += $additionalPatterns')
81
+ fi
82
+ if [ -n "$guid" ]; then
83
+ json_data=$(echo $json_data | jq --arg guid "$guid" '. + {Guid: $guid}')
84
+ fi
85
+
86
+ curl --silent --request POST \
87
+ --url "https://api.bunny.net/pullzone/$pull_zone_id/edgerules/addOrUpdate" \
88
+ --header "AccessKey: $BUNNYNET_API_KEY" \
89
+ --header 'content-type: application/json' \
90
+ --data "$json_data"
91
+ printf "\n\n> Configured edge rule \"$description\"\n"
92
+ }
93
+
94
+ ab_testing_data="
95
+ {
96
+ \"ActionType\": 2,
97
+ \"ActionParameter1\": \"$channel_url\",
98
+ \"ActionParameter2\": \"\",
99
+ \"Triggers\": [
100
+ {
101
+ \"Type\": 0,
102
+ \"PatternMatches\": [
103
+ \"https://$domain/\"
104
+ ],
105
+ \"PatternMatchingType\": 0,
106
+ \"Parameter1\": \"\"
107
+ },
108
+ {
109
+ \"Type\": 7,
110
+ \"PatternMatches\": [
111
+ \"50\"
112
+ ],
113
+ \"PatternMatchingType\": 0,
114
+ \"Parameter1\": \"\"
115
+ }
116
+ ],
117
+ \"TriggerMatchingType\": 1,
118
+ \"Description\": \"A/B testing [$GIT_BRANCH]\",
119
+ \"Enabled\": true
120
+ }"
121
+
122
+ ab_testing_cookie_data="
123
+ {
124
+ \"ActionType\": 2,
125
+ \"ActionParameter1\": \"$channel_url\",
126
+ \"ActionParameter2\": \"\",
127
+ \"Triggers\": [
128
+ {
129
+ \"Type\": 10,
130
+ \"PatternMatches\": [
131
+ \"$GIT_BRANCH\"
132
+ ],
133
+ \"PatternMatchingType\": 0,
134
+ \"Parameter1\": \"branch\"
135
+ }
136
+ ],
137
+ \"TriggerMatchingType\": 1,
138
+ \"Description\": \"A/B testing cookie [$GIT_BRANCH]\",
139
+ \"Enabled\": true
140
+ }"
141
+
142
+ ab_testing_bypass_data="
143
+ {
144
+ \"ActionType\": 3,
145
+ \"ActionParameter1\": \"0\",
146
+ \"ActionParameter2\": \"\",
147
+ \"Triggers\": [
148
+ {
149
+ \"Type\": 0,
150
+ \"PatternMatches\": [
151
+ \"https://$domain/\"
152
+ ],
153
+ \"PatternMatchingType\": 0,
154
+ \"Parameter1\": \"\"
155
+ }
156
+ ],
157
+ \"TriggerMatchingType\": 1,
158
+ \"Description\": \"A/B testing cache bypass\",
159
+ \"Enabled\": true
160
+ }"
161
+
162
+ configure_edge_rule "A/B testing [$GIT_BRANCH]" "$ab_testing_data"
163
+ configure_edge_rule "A/B testing cookie [$GIT_BRANCH]" "$ab_testing_cookie_data" false
164
+ configure_edge_rule "A/B testing cache bypass" "$ab_testing_bypass_data"
@@ -88,6 +88,19 @@
88
88
  }
89
89
  ],
90
90
  "headers": [
91
+ {
92
+ "source": "/**",
93
+ "headers": [
94
+ {
95
+ "key": "Set-Cookie",
96
+ "value": "bid={{BUILD_ID}}"
97
+ },
98
+ {
99
+ "key": "Set-Cookie",
100
+ "value": "branch={{GIT_BRANCH}}"
101
+ }
102
+ ]
103
+ },
91
104
  {
92
105
  "source": "/img/**",
93
106
  "headers": [
@@ -3,13 +3,21 @@ import { join as joinPath } from 'node:path';
3
3
  import {
4
4
  $, argv, fs, echo, chalk,
5
5
  } from 'zx';
6
+ import * as dotenv from 'dotenv';
6
7
  import Deepmerge from '@fastify/deepmerge';
7
8
  import login from './login.js';
8
9
  import build, { prepareCodebases } from './build.js';
9
10
  import { siginGcloudAndSetIAM, createServiceAccountKey } from './setup-gcloud.js';
10
11
  import createGhSecrets from './setup-gh.js';
11
12
 
12
- const { FIREBASE_PROJECT_ID, GOOGLE_APPLICATION_CREDENTIALS, GITHUB_TOKEN } = process.env;
13
+ if (!process.env.FIREBASE_PROJECT_ID && !process.env.ECOM_STORE_ID) {
14
+ const pwd = process.cwd();
15
+ dotenv.config();
16
+ dotenv.config({ path: joinPath(pwd, 'functions/.env') });
17
+ }
18
+ const {
19
+ FIREBASE_PROJECT_ID, GOOGLE_APPLICATION_CREDENTIALS, GITHUB_TOKEN, BUILD_ID, DEPLOY_RAND, GIT_BRANCH,
20
+ } = process.env;
13
21
  // https://github.com/google/zx/issues/124
14
22
  process.env.FORCE_COLOR = '3';
15
23
  const __dirname = fileURLToPath(new URL('.', import.meta.url));
@@ -39,8 +47,14 @@ if (projectId) {
39
47
  }
40
48
 
41
49
  export default async () => {
50
+ const buildId = BUILD_ID || DEPLOY_RAND || `${Math.random()}`;
42
51
  const baseConfigDir = joinPath(__dirname, '..', 'config');
43
52
  await fs.copy(baseConfigDir, pwd);
53
+ const firebaseJsonPath = joinPath(pwd, 'firebase.json');
54
+ const firebaseJson = fs.readFileSync(firebaseJsonPath, 'utf8')
55
+ .replace('{{BUILD_ID}}', buildId)
56
+ .replace('{{GIT_BRANCH}}', GIT_BRANCH || '_');
57
+ fs.writeFileSync(firebaseJsonPath, firebaseJson);
44
58
  const userConfigDir = joinPath(pwd, 'conf');
45
59
  if (fs.existsSync(userConfigDir) && fs.lstatSync(userConfigDir).isDirectory()) {
46
60
  await fs.copy(userConfigDir, pwd);
@@ -54,9 +68,9 @@ export default async () => {
54
68
  }
55
69
  if (userFirebaseConfig) {
56
70
  const deepmerge = Deepmerge();
57
- const baseFirebaseConfig = JSON.parse(fs.readFileSync(joinPath(baseConfigDir, 'firebase.json'), 'utf8'));
71
+ const baseFirebaseConfig = JSON.parse(firebaseJson);
58
72
  const mergedConfig = deepmerge(baseFirebaseConfig, userFirebaseConfig);
59
- fs.writeFileSync(joinPath(pwd, 'firebase.json'), JSON.stringify(mergedConfig, null, 2));
73
+ fs.writeFileSync(firebaseJsonPath, JSON.stringify(mergedConfig, null, 2));
60
74
  }
61
75
  }
62
76
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/cli",
3
3
  "type": "module",
4
- "version": "2.0.8",
4
+ "version": "2.1.0",
5
5
  "description": "E-Com Plus Cloud Commerce CLI tools",
6
6
  "bin": {
7
7
  "cloudcommerce": "./bin/run.mjs"
@@ -17,7 +17,7 @@
17
17
  "directory": "packages/cli"
18
18
  },
19
19
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
20
- "license": "Apache 2.0 with Commons Clause",
20
+ "license": "MIT",
21
21
  "bugs": {
22
22
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
23
23
  },
@@ -28,6 +28,7 @@
28
28
  "dependencies": {
29
29
  "@cloudcommerce/api": "workspace:*",
30
30
  "@fastify/deepmerge": "^1.3.0",
31
+ "dotenv": "^16.3.2",
31
32
  "libsodium-wrappers": "^0.7.13",
32
33
  "md5": "^2.3.0",
33
34
  "typescript": "~5.2.2",
@@ -7,16 +7,25 @@ import {
7
7
  echo,
8
8
  chalk,
9
9
  } from 'zx';
10
+ import * as dotenv from 'dotenv';
10
11
  import Deepmerge from '@fastify/deepmerge';
11
12
  import login from './login';
12
13
  import build, { prepareCodebases } from './build';
13
14
  import { siginGcloudAndSetIAM, createServiceAccountKey } from './setup-gcloud';
14
15
  import createGhSecrets from './setup-gh';
15
16
 
17
+ if (!process.env.FIREBASE_PROJECT_ID && !process.env.ECOM_STORE_ID) {
18
+ const pwd = process.cwd();
19
+ dotenv.config();
20
+ dotenv.config({ path: joinPath(pwd, 'functions/.env') });
21
+ }
16
22
  const {
17
23
  FIREBASE_PROJECT_ID,
18
24
  GOOGLE_APPLICATION_CREDENTIALS,
19
25
  GITHUB_TOKEN,
26
+ BUILD_ID,
27
+ DEPLOY_RAND,
28
+ GIT_BRANCH,
20
29
  } = process.env;
21
30
 
22
31
  // https://github.com/google/zx/issues/124
@@ -53,8 +62,14 @@ if (projectId) {
53
62
  }
54
63
 
55
64
  export default async () => {
65
+ const buildId = BUILD_ID || DEPLOY_RAND || `${Math.random()}`;
56
66
  const baseConfigDir = joinPath(__dirname, '..', 'config');
57
67
  await fs.copy(baseConfigDir, pwd);
68
+ const firebaseJsonPath = joinPath(pwd, 'firebase.json');
69
+ const firebaseJson = fs.readFileSync(firebaseJsonPath, 'utf8')
70
+ .replace('{{BUILD_ID}}', buildId)
71
+ .replace('{{GIT_BRANCH}}', GIT_BRANCH || '_');
72
+ fs.writeFileSync(firebaseJsonPath, firebaseJson);
58
73
  const userConfigDir = joinPath(pwd, 'conf');
59
74
  if (fs.existsSync(userConfigDir) && fs.lstatSync(userConfigDir).isDirectory()) {
60
75
  await fs.copy(userConfigDir, pwd);
@@ -70,14 +85,9 @@ export default async () => {
70
85
  }
71
86
  if (userFirebaseConfig) {
72
87
  const deepmerge = Deepmerge();
73
- const baseFirebaseConfig = JSON.parse(
74
- fs.readFileSync(joinPath(baseConfigDir, 'firebase.json'), 'utf8'),
75
- );
88
+ const baseFirebaseConfig = JSON.parse(firebaseJson);
76
89
  const mergedConfig = deepmerge(baseFirebaseConfig, userFirebaseConfig);
77
- fs.writeFileSync(
78
- joinPath(pwd, 'firebase.json'),
79
- JSON.stringify(mergedConfig, null, 2),
80
- );
90
+ fs.writeFileSync(firebaseJsonPath, JSON.stringify(mergedConfig, null, 2));
81
91
  }
82
92
  }
83
93
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/config",
3
3
  "type": "module",
4
- "version": "2.0.8",
4
+ "version": "2.1.0",
5
5
  "description": "E-Com Plus Cloud Commerce base config",
6
6
  "main": "lib/config.js",
7
7
  "exports": {
@@ -15,7 +15,7 @@
15
15
  "directory": "packages/config"
16
16
  },
17
17
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
18
- "license": "Apache 2.0 with Commons Clause",
18
+ "license": "MIT",
19
19
  "bugs": {
20
20
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
21
21
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/emails",
3
3
  "type": "module",
4
- "version": "2.0.8",
4
+ "version": "2.1.0",
5
5
  "description": "E-Com Plus Cloud Commerce email sender",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "directory": "packages/emails"
12
12
  },
13
13
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
14
- "license": "Apache 2.0 with Commons Clause",
14
+ "license": "MIT",
15
15
  "bugs": {
16
16
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
17
17
  },
@@ -14,7 +14,6 @@ module.exports = {
14
14
  sourceType: 'module',
15
15
  },
16
16
  plugins: [
17
- 'vue',
18
17
  '@typescript-eslint',
19
18
  ],
20
19
  ignorePatterns: [
@@ -33,6 +32,9 @@ module.exports = {
33
32
  'error',
34
33
  {
35
34
  ignore: [
35
+ 'virtual:*',
36
+ 'astro:*',
37
+ 'uno.css',
36
38
  // https://github.com/import-js/eslint-plugin-import/issues/1810
37
39
  'firebase-functions/logger',
38
40
  'firebase-functions/v2/https',
@@ -43,7 +45,6 @@ module.exports = {
43
45
  '@astrojs/[^/]+$',
44
46
  'astro/config',
45
47
  'astro/middleware',
46
- 'astro:content',
47
48
  'unocss/astro',
48
49
  'unplugin-auto-import/astro',
49
50
  '@@.*',
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/eslint",
3
3
  "type": "module",
4
- "version": "2.0.8",
4
+ "version": "2.1.0",
5
5
  "description": "E-Com Plus Cloud Commerce ESLint config",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -10,7 +10,7 @@
10
10
  "directory": "packages/eslint"
11
11
  },
12
12
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
13
- "license": "Apache 2.0 with Commons Clause",
13
+ "license": "MIT",
14
14
  "bugs": {
15
15
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
16
16
  },
@@ -19,10 +19,11 @@
19
19
  "build": "echo '@ecomplus/eslint'"
20
20
  },
21
21
  "dependencies": {
22
- "@typescript-eslint/eslint-plugin": "^6.18.1",
23
- "@typescript-eslint/parser": "^6.18.1",
22
+ "@typescript-eslint/eslint-plugin": "^6.19.1",
23
+ "@typescript-eslint/parser": "^6.19.1",
24
24
  "eslint": "^8.56.0",
25
25
  "eslint-config-airbnb-base": "^15.0.0",
26
+ "eslint-plugin-astro": "^0.31.3",
26
27
  "eslint-plugin-import": "^2.29.1",
27
28
  "eslint-plugin-tailwindcss": "3.14.0",
28
29
  "eslint-plugin-vue": "^9.20.1"
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
2
  extends: [
3
3
  './base.eslintrc.cjs',
4
- 'plugin:tailwindcss/recommended',
4
+ 'plugin:astro/recommended',
5
5
  ],
6
6
  rules: {
7
7
  'no-console': 'off',
@@ -34,6 +34,21 @@ module.exports = {
34
34
  'Pagination',
35
35
  ],
36
36
  }],
37
- 'tailwindcss/no-custom-classname': 'off',
38
37
  },
38
+ overrides: [
39
+ {
40
+ files: ['*.astro'],
41
+ parser: 'astro-eslint-parser',
42
+ parserOptions: {
43
+ parser: '@typescript-eslint/parser',
44
+ extraFileExtensions: ['.astro'],
45
+ },
46
+ rules: {
47
+ 'no-await-in-loop': 'off',
48
+ 'import/prefer-default-export': 'off',
49
+ 'consistent-return': 'off',
50
+ 'no-shadow': 'off',
51
+ },
52
+ },
53
+ ],
39
54
  };
@@ -0,0 +1,9 @@
1
+ module.exports = {
2
+ extends: [
3
+ './storefront.eslintrc.cjs',
4
+ 'plugin:tailwindcss/recommended',
5
+ ],
6
+ rules: {
7
+ 'tailwindcss/no-custom-classname': 'off',
8
+ },
9
+ };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/events",
3
3
  "type": "module",
4
- "version": "2.0.8",
4
+ "version": "2.1.0",
5
5
  "description": "E-Com Plus Cloud Commerce app events",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -14,7 +14,7 @@
14
14
  "directory": "packages/events"
15
15
  },
16
16
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
17
- "license": "Apache 2.0 with Commons Clause",
17
+ "license": "MIT",
18
18
  "bugs": {
19
19
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
20
20
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/feeds",
3
3
  "type": "module",
4
- "version": "2.0.8",
4
+ "version": "2.1.0",
5
5
  "description": "E-Com Plus Cloud Commerce catalog feeds",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -14,7 +14,7 @@
14
14
  "directory": "packages/feeds"
15
15
  },
16
16
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
17
- "license": "Apache 2.0 with Commons Clause",
17
+ "license": "MIT",
18
18
  "bugs": {
19
19
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
20
20
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/firebase",
3
3
  "type": "module",
4
- "version": "2.0.8",
4
+ "version": "2.1.0",
5
5
  "description": "E-Com Plus Cloud Commerce on Firebase",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  "directory": "packages/firebase"
22
22
  },
23
23
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
24
- "license": "Apache 2.0 with Commons Clause",
24
+ "license": "MIT",
25
25
  "bugs": {
26
26
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
27
27
  },
@@ -33,7 +33,7 @@
33
33
  "@cloudcommerce/api": "workspace:*",
34
34
  "@cloudcommerce/config": "workspace:*",
35
35
  "@google-cloud/pubsub": "^4.1.1",
36
- "dotenv": "^16.3.1",
36
+ "dotenv": "^16.3.2",
37
37
  "firebase-admin": "^12.0.0",
38
38
  "firebase-functions": "^4.6.0",
39
39
  "source-map-support": "^0.5.21"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/i18n",
3
3
  "type": "module",
4
- "version": "2.0.8",
4
+ "version": "2.1.0",
5
5
  "description": "E-Com Plus Cloud Commerce i18n",
6
6
  "main": "lib/all.js",
7
7
  "exports": {
@@ -17,7 +17,7 @@
17
17
  "directory": "packages/i18n"
18
18
  },
19
19
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
20
- "license": "Apache 2.0 with Commons Clause",
20
+ "license": "MIT",
21
21
  "bugs": {
22
22
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
23
23
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/modules",
3
3
  "type": "module",
4
- "version": "2.0.8",
4
+ "version": "2.1.0",
5
5
  "description": "E-Com Plus Cloud Commerce modules API",
6
6
  "main": "lib/index.cjs",
7
7
  "exports": {
@@ -14,7 +14,7 @@
14
14
  "directory": "packages/modules"
15
15
  },
16
16
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
17
- "license": "Apache 2.0 with Commons Clause",
17
+ "license": "MIT",
18
18
  "bugs": {
19
19
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
20
20
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/passport",
3
3
  "type": "module",
4
- "version": "2.0.8",
4
+ "version": "2.1.0",
5
5
  "description": "E-Com Plus Cloud Commerce customers authentication (passport) API",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -14,7 +14,7 @@
14
14
  "directory": "packages/passport"
15
15
  },
16
16
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
17
- "license": "Apache 2.0 with Commons Clause",
17
+ "license": "MIT",
18
18
  "bugs": {
19
19
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
20
20
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/ssr",
3
3
  "type": "module",
4
- "version": "2.0.8",
4
+ "version": "2.1.0",
5
5
  "description": "E-Com Plus Cloud Commerce storefront SSR",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -16,7 +16,7 @@
16
16
  "directory": "packages/ssr"
17
17
  },
18
18
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
19
- "license": "Apache 2.0 with Commons Clause",
19
+ "license": "MIT",
20
20
  "bugs": {
21
21
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
22
22
  },
@@ -26,24 +26,24 @@
26
26
  "build:workers": "npx tsc -p src/cloudflare --outDir cloudflare && npx eslint --ext .js cloudflare --fix"
27
27
  },
28
28
  "dependencies": {
29
- "@astrojs/node": "7.0.4",
29
+ "@astrojs/node": "8.0.0",
30
30
  "@cloudcommerce/api": "workspace:*",
31
31
  "@cloudcommerce/firebase": "workspace:*",
32
32
  "@cloudcommerce/i18n": "workspace:*",
33
33
  "@ecomplus/utils": "1.5.0-rc.6",
34
34
  "@vueuse/core": "10.7.2",
35
- "astro": "4.1.2",
35
+ "astro": "4.2.1",
36
36
  "astro-capo": "^0.0.1",
37
37
  "axios": "^1.6.5",
38
38
  "firebase-admin": "^12.0.0",
39
39
  "firebase-functions": "^4.6.0",
40
40
  "mitt": "^3.0.1",
41
- "vue": "^3.4.14",
41
+ "vue": "^3.4.15",
42
42
  "yaml": "^2.3.4"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@cloudcommerce/types": "workspace:*",
46
- "@cloudflare/workers-types": "^4.20231218.0",
46
+ "@cloudflare/workers-types": "^4.20240117.0",
47
47
  "@firebase/app-types": "^0.9.0",
48
48
  "typescript": "~5.2.2"
49
49
  }
@@ -1 +1 @@
1
- import{_ as P,a as A,v as M,w as k}from"./_plugin-vue_export-helper.zwYIxbLv.js";import{e as T,f as _,E as V,a as R,d as I}from"./customer-session.zys3PDaD.js";import{u as j}from"./index._z3KfWlu.js";import{g as B,b as O,c as q}from"./index-dd468b12.D5s8VdAL.js";import{b as D}from"./index.ZVw4Qnet.js";import{a as f,w as h,d as C,c as z,M as F,N as l,O as c,Z as N,R as i,S as b,P as r,Q as S,W as x,T as E,U as L,V as U,a2 as W,a3 as Y,X as G,Y as K}from"./runtime-core.esm-bundler.arxvxBux.js";import"./sf-utils.Z4H-dRBJ.js";const Q=m=>{T();const s=m?.canUseUrlParams!==!1?j("history"):{},e=s.sign_up!==void 0&&s.sign_up!=="0",a=s.password!==void 0&&s.password!=="0",u=f(e),n=f(!e&&!a);h(u,p=>{p?(n.value=!0,s.sign_up="1"):s.sign_up="0"}),h(n,p=>{s.password=p?"0":"1"});const o=f(""),d=f(!1),g=D(async p=>{d.value=!0;const v=Date.now(),y=B();if(_.value){window.localStorage.setItem(V,_.value);try{if(n.value){const w=new URL(p||window.location.toString());w.searchParams.append("email",_.value),await O(y,_.value,{url:w.toString(),handleCodeInApp:!0})}else await q(y,_.value,o.value)}catch(w){console.warn(w.code),console.error(w)}setTimeout(()=>{d.value=!1},Math.min(2e3-(Date.now()-v),1))}},2e3);return{isLinkSignIn:n,isSignUp:u,email:_,password:o,isSubmitting:d,submitLogin:g}},X=C({__name:"LoginForm",props:{loginLinkActionUrl:{}},setup(m,{expose:t}){t();const{isLinkSignIn:s,isSignUp:e,email:a,password:u,isSubmitting:n,submitLogin:o}=Q(),d=f(!1),g=f(0),p=z(()=>g.value>9);h(n,()=>{!n.value&&s.value&&(d.value=!0,g.value+=1)}),h([a,e],()=>{d.value=!1}),h(p,()=>{s.value=!1});const v={isLinkSignIn:s,isSignUp:e,email:a,password:u,isSubmitting:n,submitLogin:o,isEmailSentMsg:d,countEmailsSent:g,isLinkSignInBlocked:p,get customerName(){return R}};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),Z={class:"text-base-600 mb-4 text-2xl font-light"},$={key:0},H={key:1,class:"lowercase"},J={key:0,for:"login-form-email"},ee={class:"relative"},se=["disabled"],te={key:0,class:"text-success-800 absolute left-0 top-0 mt-4 font-medium"},ne=i("i",{class:"i-check mr-1"},null,-1);function ie(m,t,s,e,a,u){const n=F("Fade");return l(),c("form",{class:"text-base-800 w-full max-w-sm bg-white p-6 text-base md:p-8",onSubmit:t[4]||(t[4]=k(()=>e.submitLogin(s.loginLinkActionUrl),["prevent"]))},[N(m.$slots,"head"),i("p",Z,[b(r("Olá")+" "),e.customerName?(l(),c("span",$,r(e.customerName),1)):(l(),c("span",H,r("Visitante")))]),e.isLinkSignIn?(l(),c("label",J,r("Enviar link de acesso por e-mail"))):S("",!0),x(i("input",{id:"login-form-email",type:"email",placeholder:"email@mail.com","onUpdate:modelValue":t[0]||(t[0]=o=>e.email=o),class:"mb-0.5 mt-2 w-full",required:""},null,512),[[A,e.email]]),e.isLinkSignIn?S("",!0):x((l(),c("input",{key:1,type:"password",placeholder:"Senha","onUpdate:modelValue":t[1]||(t[1]=o=>e.password=o),class:"mb-0.5 mt-2 w-full lowercase",required:""},null,512)),[[A,e.password]]),i("div",ee,[i("div",{class:E(["transition-opacity",e.isEmailSentMsg&&"opacity-0 invisible"])},[x(i("a",{href:"?password",class:"ui-link text-base-500 text-right text-sm lowercase",onClick:t[2]||(t[2]=k(o=>e.isLinkSignIn=!e.isLinkSignIn,["prevent"]))},r(e.isLinkSignIn?"Entrar com senha":"Esqueci minha senha"),513),[[M,!e.isSignUp&&!e.isLinkSignInBlocked]]),i("button",{type:"submit",disabled:e.isSubmitting,class:E(["ui-btn-lg ui-btn-primary mb-2 mt-5 w-full",e.isSubmitting&&"opacity-50"])},r(e.isSignUp?"Cadastrar":"Acessar minha conta"),11,se)],2),L(n,{speed:"slow"},{default:U(()=>[e.isEmailSentMsg?(l(),c("p",te,[ne,b(" "+r("Te enviamos o e-mail, verifique sua caixa de entrada e spam se necessário."),1)])):S("",!0)]),_:1}),i("a",{href:"?sign_up",class:"ui-btn-lg ui-btn-contrast block w-full text-center",onClick:t[3]||(t[3]=k(o=>e.isSignUp=!e.isSignUp,["prevent"]))},r(e.isSignUp?"Acessar minha conta":"Criar uma conta"),1)])],32)}const ae=P(X,[["render",ie]]),oe=C({__name:"AccountPage",setup(m,{expose:t}){t();let s=null;{const{location:a}=window,u=new URLSearchParams(a.search).get("return_url");if(!u){const n=new URL(a.toString());n.pathname="/app/",n.hash=`#${a.pathname.replace("/app/","/")}`,s=n.toString()}h(I,()=>{I.value&&(a.href=u||s)},{immediate:!0})}const e={get loginLinkActionUrl(){return s},set loginLinkActionUrl(a){s=a},LoginForm:ae};return Object.defineProperty(e,"__isScriptSetup",{enumerable:!1,value:!0}),e}}),re={class:"from-secondary-700 to-secondary-950 flex min-h-screen w-full flex-col justify-center bg-gradient-to-br"},le={class:"mx-auto p-4"},ce=i("section",{class:"ui-section text-center"},[i("a",{href:"/",class:"text-base-200 hover:text-white"},[i("i",{class:"i-arrow-right mr-1 rotate-180"}),b(" "+r("Ir para a loja"))])],-1),me={class:"overflow-hidden rounded-md shadow-md ring-4 ring-black/10"},ue={class:"mb-5 text-center"},de={href:"/",class:"inline-block"},pe={key:0,class:"ui-section px-0"},ge={class:"mx-auto flex max-w-sm flex-wrap items-center justify-evenly gap-4 px-3"};function _e(m,t,s,e,a,u){const n=F("ALink");return l(),c("article",re,[i("div",le,[ce,i("section",me,[L(e.LoginForm,W(Y({loginLinkActionUrl:e.loginLinkActionUrl})),{head:U(()=>[i("div",ue,[i("a",de,[N(m.$slots,"logo")])])]),_:3},16)]),m.$settings.serviceLinks?.length?(l(),c("nav",pe,[i("ul",ge,[(l(!0),c(G,null,K(m.$settings.serviceLinks,({title:o,href:d},g)=>(l(),c("li",{key:`s-${g}`},[L(n,{href:d,class:"ui-link text-base-200 hover:text-white"},{default:U(()=>[b(r(o),1)]),_:2},1032,["href"])]))),128))])])):S("",!0)])])}const xe=P(oe,[["render",_e]]);export{xe as default};
1
+ import{_ as P,a as A,v as M,w as k}from"./_plugin-vue_export-helper.SO-0jCqa.js";import{e as T,f as _,E as V,a as R,d as I}from"./customer-session.hXdZh5Ii.js";import{u as j}from"./index.R7A-Pg5V.js";import{g as B,b as O,c as q}from"./index-dd468b12.D5s8VdAL.js";import{b as D}from"./index.q6KIyKlJ.js";import{a as f,w as h,d as C,c as z,M as F,N as l,O as c,Z as N,R as i,S as b,P as r,Q as S,W as x,T as E,U as L,V as U,a2 as W,a3 as Y,X as G,Y as K}from"./runtime-core.esm-bundler.XTSAdOlw.js";import"./sf-utils.Z4H-dRBJ.js";const Q=m=>{T();const s=m?.canUseUrlParams!==!1?j("history"):{},e=s.sign_up!==void 0&&s.sign_up!=="0",a=s.password!==void 0&&s.password!=="0",u=f(e),n=f(!e&&!a);h(u,p=>{p?(n.value=!0,s.sign_up="1"):s.sign_up="0"}),h(n,p=>{s.password=p?"0":"1"});const o=f(""),d=f(!1),g=D(async p=>{d.value=!0;const v=Date.now(),y=B();if(_.value){window.localStorage.setItem(V,_.value);try{if(n.value){const w=new URL(p||window.location.toString());w.searchParams.append("email",_.value),await O(y,_.value,{url:w.toString(),handleCodeInApp:!0})}else await q(y,_.value,o.value)}catch(w){console.warn(w.code),console.error(w)}setTimeout(()=>{d.value=!1},Math.min(2e3-(Date.now()-v),1))}},2e3);return{isLinkSignIn:n,isSignUp:u,email:_,password:o,isSubmitting:d,submitLogin:g}},X=C({__name:"LoginForm",props:{loginLinkActionUrl:{}},setup(m,{expose:t}){t();const{isLinkSignIn:s,isSignUp:e,email:a,password:u,isSubmitting:n,submitLogin:o}=Q(),d=f(!1),g=f(0),p=z(()=>g.value>9);h(n,()=>{!n.value&&s.value&&(d.value=!0,g.value+=1)}),h([a,e],()=>{d.value=!1}),h(p,()=>{s.value=!1});const v={isLinkSignIn:s,isSignUp:e,email:a,password:u,isSubmitting:n,submitLogin:o,isEmailSentMsg:d,countEmailsSent:g,isLinkSignInBlocked:p,get customerName(){return R}};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),Z={class:"text-base-600 mb-4 text-2xl font-light"},$={key:0},H={key:1,class:"lowercase"},J={key:0,for:"login-form-email"},ee={class:"relative"},se=["disabled"],te={key:0,class:"text-success-800 absolute left-0 top-0 mt-4 font-medium"},ne=i("i",{class:"i-check mr-1"},null,-1);function ie(m,t,s,e,a,u){const n=F("Fade");return l(),c("form",{class:"text-base-800 w-full max-w-sm bg-white p-6 text-base md:p-8",onSubmit:t[4]||(t[4]=k(()=>e.submitLogin(s.loginLinkActionUrl),["prevent"]))},[N(m.$slots,"head"),i("p",Z,[b(r("Olá")+" "),e.customerName?(l(),c("span",$,r(e.customerName),1)):(l(),c("span",H,r("Visitante")))]),e.isLinkSignIn?(l(),c("label",J,r("Enviar link de acesso por e-mail"))):S("",!0),x(i("input",{id:"login-form-email",type:"email",placeholder:"email@mail.com","onUpdate:modelValue":t[0]||(t[0]=o=>e.email=o),class:"mb-0.5 mt-2 w-full",required:""},null,512),[[A,e.email]]),e.isLinkSignIn?S("",!0):x((l(),c("input",{key:1,type:"password",placeholder:"Senha","onUpdate:modelValue":t[1]||(t[1]=o=>e.password=o),class:"mb-0.5 mt-2 w-full lowercase",required:""},null,512)),[[A,e.password]]),i("div",ee,[i("div",{class:E(["transition-opacity",e.isEmailSentMsg&&"opacity-0 invisible"])},[x(i("a",{href:"?password",class:"text-base-500 ui-link text-right text-sm lowercase",onClick:t[2]||(t[2]=k(o=>e.isLinkSignIn=!e.isLinkSignIn,["prevent"]))},r(e.isLinkSignIn?"Entrar com senha":"Esqueci minha senha"),513),[[M,!e.isSignUp&&!e.isLinkSignInBlocked]]),i("button",{type:"submit",disabled:e.isSubmitting,class:E(["ui-btn-lg ui-btn-primary mb-2 mt-5 w-full",e.isSubmitting&&"opacity-50"])},r(e.isSignUp?"Cadastrar":"Acessar minha conta"),11,se)],2),L(n,{speed:"slow"},{default:U(()=>[e.isEmailSentMsg?(l(),c("p",te,[ne,b(" "+r("Te enviamos o e-mail, verifique sua caixa de entrada e spam se necessário."),1)])):S("",!0)]),_:1}),i("a",{href:"?sign_up",class:"ui-btn-lg ui-btn-contrast block w-full text-center",onClick:t[3]||(t[3]=k(o=>e.isSignUp=!e.isSignUp,["prevent"]))},r(e.isSignUp?"Acessar minha conta":"Criar uma conta"),1)])],32)}const ae=P(X,[["render",ie]]),oe=C({__name:"AccountPage",setup(m,{expose:t}){t();let s=null;{const{location:a}=window,u=new URLSearchParams(a.search).get("return_url");if(!u){const n=new URL(a.toString());n.pathname="/app/",n.hash=`#${a.pathname.replace("/app/","/")}`,s=n.toString()}h(I,()=>{I.value&&(a.href=u||s)},{immediate:!0})}const e={get loginLinkActionUrl(){return s},set loginLinkActionUrl(a){s=a},LoginForm:ae};return Object.defineProperty(e,"__isScriptSetup",{enumerable:!1,value:!0}),e}}),re={class:"from-secondary-700 to-secondary-950 flex min-h-screen w-full flex-col justify-center bg-gradient-to-br"},le={class:"mx-auto p-4"},ce=i("section",{class:"ui-section text-center"},[i("a",{href:"/",class:"text-base-200 hover:text-white"},[i("i",{class:"i-arrow-right mr-1 rotate-180"}),b(" "+r("Ir para a loja"))])],-1),me={class:"overflow-hidden rounded-md shadow-md ring-4 ring-black/10"},ue={class:"mb-5 text-center"},de={href:"/",class:"inline-block"},pe={key:0,class:"ui-section px-0"},ge={class:"mx-auto flex max-w-sm flex-wrap items-center justify-evenly gap-4 px-3"};function _e(m,t,s,e,a,u){const n=F("ALink");return l(),c("article",re,[i("div",le,[ce,i("section",me,[L(e.LoginForm,W(Y({loginLinkActionUrl:e.loginLinkActionUrl})),{head:U(()=>[i("div",ue,[i("a",de,[N(m.$slots,"logo")])])]),_:3},16)]),m.$settings.serviceLinks?.length?(l(),c("nav",pe,[i("ul",ge,[(l(!0),c(G,null,K(m.$settings.serviceLinks,({title:o,href:d},g)=>(l(),c("li",{key:`s-${g}`},[L(n,{href:d,class:"text-base-200 ui-link hover:text-white"},{default:U(()=>[b(r(o),1)]),_:2},1032,["href"])]))),128))])])):S("",!0)])])}const xe=P(oe,[["render",_e]]);export{xe as default};