cloudcommerce 0.0.125 → 0.0.127
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/.eslintrc.cjs +26 -7
- package/.gitmodules +3 -0
- package/.vscode/settings.json +3 -0
- package/CHANGELOG.md +56 -0
- package/action.yml +51 -7
- package/ecomplus-stores/monocard/README.md +0 -15
- package/ecomplus-stores/monocard/README.pt-BR.md +0 -15
- package/ecomplus-stores/monocard/functions/core/package.json +1 -1
- package/ecomplus-stores/monocard/functions/events/package.json +2 -2
- package/ecomplus-stores/monocard/functions/modules/package.json +2 -2
- package/ecomplus-stores/monocard/functions/passport/package.json +2 -2
- package/ecomplus-stores/monocard/functions/ssr/package.json +8 -5
- package/ecomplus-stores/monocard/functions/ssr/src/main/Home.astro +1 -1
- package/ecomplus-stores/monocard/functions/ssr/tailwind.config.cjs +1 -3
- package/ecomplus-stores/monocard/functions/ssr/{uno.config.ts → uno.config.cjs} +1 -1
- package/ecomplus-stores/monocard/package.json +1 -1
- package/ecomplus-stores/tia-sonia/.github/renovate.json +5 -0
- package/ecomplus-stores/tia-sonia/.github/workflows/build-and-deploy.yml +41 -0
- package/ecomplus-stores/tia-sonia/.github/workflows/calibreapp-image-actions.yml +23 -0
- package/ecomplus-stores/tia-sonia/.vscode/extensions.json +8 -0
- package/ecomplus-stores/tia-sonia/.vscode/settings.json +5 -0
- package/ecomplus-stores/tia-sonia/LICENSE.md +230 -0
- package/ecomplus-stores/tia-sonia/README.md +102 -0
- package/ecomplus-stores/tia-sonia/README.pt-BR.md +102 -0
- package/ecomplus-stores/tia-sonia/functions/config.json +3 -0
- package/ecomplus-stores/tia-sonia/functions/core/index.js +9 -0
- package/ecomplus-stores/tia-sonia/functions/core/package.json +20 -0
- package/ecomplus-stores/tia-sonia/functions/events/index.js +9 -0
- package/ecomplus-stores/tia-sonia/functions/events/package.json +21 -0
- package/ecomplus-stores/tia-sonia/functions/example.env +10 -0
- package/ecomplus-stores/tia-sonia/functions/modules/index.js +9 -0
- package/ecomplus-stores/tia-sonia/functions/modules/package.json +21 -0
- package/ecomplus-stores/tia-sonia/functions/passport/index.js +9 -0
- package/ecomplus-stores/tia-sonia/functions/passport/package.json +21 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/.eslintrc.cjs +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/astro.config.mjs +4 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/blog.json +18 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/brands.json +24 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/categories.json +24 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/code.json +5 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/collections.json +24 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/contacts.json +13 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/footer.json +46 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/header.json +35 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/home.json +45 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/info.json +18 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/maintenance.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/menu.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/pages/contato.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/pages/entrega.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/pages/faq.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/pages/pagamentos.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/pages/privacidade.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/pages/sobre-nos.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/pages/termos.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/pages/trocas.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/posts/esta-loja-e-um-pwa.json +9 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/products.json +32 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/search.json +8 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/settings.json +14 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/social.json +5 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/analytics.json +11 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/compre-confie.json +11 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/ebit.json +11 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/fb-pixel.json +12 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/gmc-ratings.json +12 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/minicart.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/offers-notification.json +11 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/opinioes-verificadas.json +18 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/product-card.json +10 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/product.json +13 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/search-engine.json +8 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/search.json +6 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/tag-manager.json +12 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/tawkto.json +12 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/trustvox.json +15 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/content/widgets/user.json +5 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/index.js +18 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/package.json +30 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/admin/config.json +1 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/cms-preview.css +274 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/cms.css +114 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/cvv.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/icons/bootstrap-icons/font/storefront-icons.woff2 +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/icons/feather-icons/font/storefront-icons.woff2 +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/icons/font-awesome/font/storefront-icons.woff2 +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/icons/line-awesome/font/storefront-icons.woff2 +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/icons/tabler-icons/font/storefront-icons.woff2 +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/img-placeholder.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/payments.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/assets/ssl-safe.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/icon.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/large-icon.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/banner1.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/banner2.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/banner2.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/favicon.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/headless.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/headphone.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/headphone.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/icon.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/large-icon.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/logo.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/logo.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/og-image.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/passion.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/passion.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/pwa-reliable.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/rect8589.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/rect859.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/rect89.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/rect89.webp +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/img/uploads/ssl-safe.png +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/public/robots.txt +8 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/assets/.gitkeep +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/TheHeader.vue +42 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/TopBar.vue +133 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/header/HeaderButtonLink.vue +5 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/header/HeaderButtons.vue +46 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/header/HeaderNav.vue +9 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/components/header/HeaderNavLink.vue +5 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/env.d.ts +3 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/layouts/Base.astro +34 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/layouts/Checkout.astro +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/layouts/Pages.astro +19 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/layouts/PagesHeader.astro +117 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/main/Fallback.astro +15 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/main/Home.astro +19 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/main/Wildcard.astro +21 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/pages/[...slug].astro +36 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/pages/app/account.astro +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/pages/app/index.astro +0 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/pages/fallback.astro +19 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/pages/index.astro +31 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/src/scripts/InlineScripts.astro +11 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/tailwind.config.cjs +2 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/tsconfig.json +16 -0
- package/ecomplus-stores/tia-sonia/functions/ssr/uno.config.cjs +4 -0
- package/ecomplus-stores/tia-sonia/package.json +28 -0
- package/ecomplus-stores/tia-sonia/scripts/install.sh +9 -0
- package/package.json +17 -17
- package/packages/api/lib/api.d.ts +4 -4
- package/packages/api/lib/types.d.ts +41 -41
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/package.json +2 -2
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/discounts/lib-mjs/apply-discount.mjs +94 -20
- package/packages/apps/discounts/package.json +2 -2
- package/packages/apps/emails/CHANGELOG.md +1 -0
- package/packages/apps/emails/README.md +1 -0
- package/packages/apps/emails/lib/events-to-app-emails.js +19 -0
- package/packages/apps/emails/lib/events-to-app-emails.js.map +1 -0
- package/packages/apps/emails/lib/firebase.js +19 -0
- package/packages/apps/emails/lib/firebase.js.map +1 -0
- package/packages/apps/emails/lib/functios-lib/abandoned-carts.js +86 -0
- package/packages/apps/emails/lib/functios-lib/abandoned-carts.js.map +1 -0
- package/packages/apps/emails/lib/functios-lib/handle-orders.js +174 -0
- package/packages/apps/emails/lib/functios-lib/handle-orders.js.map +1 -0
- package/packages/apps/emails/lib/functios-lib/trigger-actions.js +178 -0
- package/packages/apps/emails/lib/functios-lib/trigger-actions.js.map +1 -0
- package/packages/apps/emails/lib/functios-lib/utils.js +33 -0
- package/packages/apps/emails/lib/functios-lib/utils.js.map +1 -0
- package/packages/apps/emails/lib/index.js +2 -0
- package/packages/apps/emails/lib/index.js.map +1 -0
- package/packages/apps/emails/package.json +33 -0
- package/packages/apps/emails/src/events-to-app-emails.ts +27 -0
- package/packages/apps/emails/src/firebase.ts +25 -0
- package/packages/apps/emails/src/functios-lib/abandoned-carts.ts +100 -0
- package/packages/apps/emails/src/functios-lib/handle-orders.ts +232 -0
- package/packages/apps/emails/src/functios-lib/trigger-actions.ts +177 -0
- package/packages/apps/emails/src/functios-lib/utils.ts +44 -0
- package/packages/apps/emails/src/index.ts +1 -0
- package/packages/apps/emails/tsconfig.json +3 -0
- package/packages/apps/frenet/package.json +2 -2
- package/packages/apps/infinitepay/CHANGELOG.md +1 -0
- package/packages/apps/infinitepay/README.md +1 -0
- package/packages/apps/infinitepay/assets/onload-expression.js +57 -0
- package/packages/apps/infinitepay/lib/functions-lib/add-installments.d.ts +55 -0
- package/packages/apps/infinitepay/lib/functions-lib/add-installments.js +63 -0
- package/packages/apps/infinitepay/lib/functions-lib/add-installments.js.map +1 -0
- package/packages/apps/infinitepay/lib/functions-lib/ip-auth/create-access.d.ts +14 -0
- package/packages/apps/infinitepay/lib/functions-lib/ip-auth/create-access.js +63 -0
- package/packages/apps/infinitepay/lib/functions-lib/ip-auth/create-access.js.map +1 -0
- package/packages/apps/infinitepay/lib/functions-lib/ip-auth/create-axios.d.ts +2 -0
- package/packages/apps/infinitepay/lib/functions-lib/ip-auth/create-axios.js +19 -0
- package/packages/apps/infinitepay/lib/functions-lib/ip-auth/create-axios.js.map +1 -0
- package/packages/apps/infinitepay/lib/functions-lib/ip-auth/oauth.d.ts +2 -0
- package/packages/apps/infinitepay/lib/functions-lib/ip-auth/oauth.js +25 -0
- package/packages/apps/infinitepay/lib/functions-lib/ip-auth/oauth.js.map +1 -0
- package/packages/apps/infinitepay/lib/functions-lib/utils.d.ts +8 -0
- package/packages/apps/infinitepay/lib/functions-lib/utils.js +17 -0
- package/packages/apps/infinitepay/lib/functions-lib/utils.js.map +1 -0
- package/packages/apps/infinitepay/lib/index.d.ts +1 -0
- package/packages/apps/infinitepay/lib/index.js +3 -0
- package/packages/apps/infinitepay/lib/index.js.map +1 -0
- package/packages/apps/infinitepay/lib/infinitepay.d.ts +76 -0
- package/packages/apps/infinitepay/lib/infinitepay.js +13 -0
- package/packages/apps/infinitepay/lib/infinitepay.js.map +1 -0
- package/packages/apps/infinitepay/lib/ip-create-transaction.d.ts +72 -0
- package/packages/apps/infinitepay/lib/ip-create-transaction.js +305 -0
- package/packages/apps/infinitepay/lib/ip-create-transaction.js.map +1 -0
- package/packages/apps/infinitepay/lib/ip-list-payments.d.ts +8 -0
- package/packages/apps/infinitepay/lib/ip-list-payments.js +130 -0
- package/packages/apps/infinitepay/lib/ip-list-payments.js.map +1 -0
- package/packages/apps/infinitepay/lib/ip-webhook.d.ts +5 -0
- package/packages/apps/infinitepay/lib/ip-webhook.js +152 -0
- package/packages/apps/infinitepay/lib/ip-webhook.js.map +1 -0
- package/packages/apps/infinitepay/package.json +38 -0
- package/packages/apps/infinitepay/scripts/build.sh +5 -0
- package/packages/apps/infinitepay/src/functions-lib/add-installments.ts +78 -0
- package/packages/apps/infinitepay/src/functions-lib/ip-auth/create-access.ts +85 -0
- package/packages/apps/infinitepay/src/functions-lib/ip-auth/create-axios.ts +20 -0
- package/packages/apps/infinitepay/src/functions-lib/ip-auth/oauth.ts +30 -0
- package/packages/apps/infinitepay/src/functions-lib/utils.ts +23 -0
- package/packages/apps/infinitepay/src/index.ts +2 -0
- package/packages/apps/infinitepay/src/infinitepay.ts +13 -0
- package/packages/apps/infinitepay/src/ip-create-transaction.ts +418 -0
- package/packages/apps/infinitepay/src/ip-list-payments.ts +158 -0
- package/packages/apps/infinitepay/src/ip-webhook.ts +184 -0
- package/packages/apps/infinitepay/tsconfig.json +6 -0
- package/packages/apps/infinitepay/webhook.js +1 -0
- package/packages/apps/mercadopago/lib/mercadopago.js +0 -2
- package/packages/apps/mercadopago/lib/mercadopago.js.map +1 -1
- package/packages/apps/mercadopago/lib/mp-create-transaction.js +1 -1
- package/packages/apps/mercadopago/lib/mp-create-transaction.js.map +1 -1
- package/packages/apps/mercadopago/lib/mp-webhook.js +1 -3
- package/packages/apps/mercadopago/lib/mp-webhook.js.map +1 -1
- package/packages/apps/mercadopago/package.json +5 -5
- package/packages/apps/mercadopago/src/mercadopago.ts +0 -3
- package/packages/apps/mercadopago/src/mp-create-transaction.ts +1 -1
- package/packages/apps/mercadopago/src/mp-webhook.ts +1 -3
- package/packages/apps/pagarme/CHANGELOG.md +1 -0
- package/packages/apps/pagarme/README.md +1 -0
- package/packages/apps/pagarme/assets/onload-expression.js +18 -0
- package/packages/apps/pagarme/lib/functions-lib/add-installments.d.ts +55 -0
- package/packages/apps/pagarme/lib/functions-lib/add-installments.js +48 -0
- package/packages/apps/pagarme/lib/functions-lib/add-installments.js.map +1 -0
- package/packages/apps/pagarme/lib/functions-lib/parse-status-to-ecom.d.ts +2 -0
- package/packages/apps/pagarme/lib/functions-lib/parse-status-to-ecom.js +24 -0
- package/packages/apps/pagarme/lib/functions-lib/parse-status-to-ecom.js.map +1 -0
- package/packages/apps/pagarme/lib/index.d.ts +1 -0
- package/packages/apps/pagarme/lib/index.js +3 -0
- package/packages/apps/pagarme/lib/index.js.map +1 -0
- package/packages/apps/pagarme/lib/pagarme-create-transaction.d.ts +82 -0
- package/packages/apps/pagarme/lib/pagarme-create-transaction.js +275 -0
- package/packages/apps/pagarme/lib/pagarme-create-transaction.js.map +1 -0
- package/packages/apps/pagarme/lib/pagarme-list-payments.d.ts +7 -0
- package/packages/apps/pagarme/lib/pagarme-list-payments.js +139 -0
- package/packages/apps/pagarme/lib/pagarme-list-payments.js.map +1 -0
- package/packages/apps/pagarme/lib/pagarme-webhook.d.ts +4 -0
- package/packages/apps/pagarme/lib/pagarme-webhook.js +80 -0
- package/packages/apps/pagarme/lib/pagarme-webhook.js.map +1 -0
- package/packages/apps/pagarme/lib/pagarme.d.ts +86 -0
- package/packages/apps/pagarme/lib/pagarme.js +12 -0
- package/packages/apps/pagarme/lib/pagarme.js.map +1 -0
- package/packages/apps/pagarme/package.json +38 -0
- package/packages/apps/pagarme/scripts/build.sh +5 -0
- package/packages/apps/pagarme/src/functions-lib/add-installments.ts +59 -0
- package/packages/apps/pagarme/src/functions-lib/parse-status-to-ecom.ts +23 -0
- package/packages/apps/pagarme/src/index.ts +2 -0
- package/packages/apps/pagarme/src/pagarme-create-transaction.ts +307 -0
- package/packages/apps/pagarme/src/pagarme-list-payments.ts +158 -0
- package/packages/apps/pagarme/src/pagarme-webhook.ts +88 -0
- package/packages/apps/pagarme/src/pagarme.ts +12 -0
- package/packages/apps/pagarme/tsconfig.json +6 -0
- package/packages/apps/pagarme/webhook.js +1 -0
- package/packages/apps/pix/CHANGELOG.md +1 -0
- package/packages/apps/pix/README.md +1 -0
- package/packages/apps/pix/lib/functions-lib/get-certificate.d.ts +2 -0
- package/packages/apps/pix/lib/functions-lib/get-certificate.js +21 -0
- package/packages/apps/pix/lib/functions-lib/get-certificate.js.map +1 -0
- package/packages/apps/pix/lib/functions-lib/pix-auth/construtor.d.ts +15 -0
- package/packages/apps/pix/lib/functions-lib/pix-auth/construtor.js +65 -0
- package/packages/apps/pix/lib/functions-lib/pix-auth/construtor.js.map +1 -0
- package/packages/apps/pix/lib/functions-lib/pix-auth/create-axios.d.ts +6 -0
- package/packages/apps/pix/lib/functions-lib/pix-auth/create-axios.js +20 -0
- package/packages/apps/pix/lib/functions-lib/pix-auth/create-axios.js.map +1 -0
- package/packages/apps/pix/lib/functions-lib/pix-auth/oauth.d.ts +12 -0
- package/packages/apps/pix/lib/functions-lib/pix-auth/oauth.js +36 -0
- package/packages/apps/pix/lib/functions-lib/pix-auth/oauth.js.map +1 -0
- package/packages/apps/pix/lib/index.d.ts +1 -0
- package/packages/apps/pix/lib/index.js +3 -0
- package/packages/apps/pix/lib/index.js.map +1 -0
- package/packages/apps/pix/lib/pix-create-transaction.d.ts +73 -0
- package/packages/apps/pix/lib/pix-create-transaction.js +221 -0
- package/packages/apps/pix/lib/pix-create-transaction.js.map +1 -0
- package/packages/apps/pix/lib/pix-list-payments.d.ts +14 -0
- package/packages/apps/pix/lib/pix-list-payments.js +80 -0
- package/packages/apps/pix/lib/pix-list-payments.js.map +1 -0
- package/packages/apps/pix/lib/pix-webhook.d.ts +5 -0
- package/packages/apps/pix/lib/pix-webhook.js +146 -0
- package/packages/apps/pix/lib/pix-webhook.js.map +1 -0
- package/packages/apps/pix/lib/pix.d.ts +77 -0
- package/packages/apps/pix/lib/pix.js +13 -0
- package/packages/apps/pix/lib/pix.js.map +1 -0
- package/packages/apps/pix/package.json +36 -0
- package/packages/apps/pix/src/functions-lib/get-certificate.ts +24 -0
- package/packages/apps/pix/src/functions-lib/pix-auth/construtor.ts +87 -0
- package/packages/apps/pix/src/functions-lib/pix-auth/create-axios.ts +24 -0
- package/packages/apps/pix/src/functions-lib/pix-auth/oauth.ts +50 -0
- package/packages/apps/pix/src/index.ts +2 -0
- package/packages/apps/pix/src/pix-create-transaction.ts +261 -0
- package/packages/apps/pix/src/pix-list-payments.ts +93 -0
- package/packages/apps/pix/src/pix-webhook.ts +171 -0
- package/packages/apps/pix/src/pix.ts +13 -0
- package/packages/apps/pix/tsconfig.json +6 -0
- package/packages/apps/pix/webhook.js +1 -0
- package/packages/apps/tiny-erp/lib/event-to-tiny.js +1 -1
- package/packages/apps/tiny-erp/lib/event-to-tiny.js.map +1 -1
- package/packages/apps/tiny-erp/lib/integration/after-tiny-queue.js +1 -1
- package/packages/apps/tiny-erp/lib/integration/after-tiny-queue.js.map +1 -1
- package/packages/apps/tiny-erp/lib/integration/export-order-to-tiny.js +1 -1
- package/packages/apps/tiny-erp/lib/integration/export-order-to-tiny.js.map +1 -1
- package/packages/apps/tiny-erp/lib/integration/import-order-from-tiny.js +1 -2
- package/packages/apps/tiny-erp/lib/integration/import-order-from-tiny.js.map +1 -1
- package/packages/apps/tiny-erp/lib/integration/import-product-from-tiny.js +1 -1
- package/packages/apps/tiny-erp/lib/integration/import-product-from-tiny.js.map +1 -1
- package/packages/apps/tiny-erp/lib/integration/parsers/product-from-tiny.js +1 -1
- package/packages/apps/tiny-erp/lib/integration/parsers/product-from-tiny.js.map +1 -1
- package/packages/apps/tiny-erp/lib/tiny-erp.js +0 -1
- package/packages/apps/tiny-erp/lib/tiny-erp.js.map +1 -1
- package/packages/apps/tiny-erp/lib/tiny-webhook.js +1 -1
- package/packages/apps/tiny-erp/lib/tiny-webhook.js.map +1 -1
- package/packages/apps/tiny-erp/package.json +6 -6
- package/packages/apps/tiny-erp/src/event-to-tiny.ts +1 -1
- package/packages/apps/tiny-erp/src/integration/after-tiny-queue.ts +1 -1
- package/packages/apps/tiny-erp/src/integration/export-order-to-tiny.ts +1 -1
- package/packages/apps/tiny-erp/src/integration/import-order-from-tiny.ts +1 -2
- package/packages/apps/tiny-erp/src/integration/import-product-from-tiny.ts +1 -1
- package/packages/apps/tiny-erp/src/integration/parsers/product-from-tiny.ts +1 -1
- package/packages/apps/tiny-erp/src/tiny-erp.ts +0 -1
- package/packages/apps/tiny-erp/src/tiny-webhook.ts +1 -1
- package/packages/cli/bin/run.mjs +1 -1
- package/packages/cli/lib/build.js +14 -7
- package/packages/cli/lib/{index.js → cli.js} +2 -2
- package/packages/cli/lib/setup-gcloud.js +1 -1
- package/packages/cli/package.json +3 -3
- package/packages/cli/src/build.ts +17 -10
- package/packages/cli/src/{index.ts → cli.ts} +2 -2
- package/packages/cli/src/setup-gcloud.ts +1 -1
- package/packages/config/lib/config.d.ts +4 -2
- package/packages/config/lib/config.js +11 -4
- package/packages/config/lib/config.js.map +1 -1
- package/packages/config/lib/env.d.ts +1 -1
- package/packages/config/package.json +2 -2
- package/packages/config/src/config.ts +14 -5
- package/packages/emails/CHANGELOG.md +1 -0
- package/packages/emails/README.md +1 -0
- package/packages/emails/lib/index.d.ts +56 -0
- package/packages/emails/lib/index.js +83 -0
- package/packages/emails/lib/index.js.map +1 -0
- package/packages/emails/lib/parse-template-to-html.d.ts +3 -0
- package/packages/emails/lib/parse-template-to-html.js +16 -0
- package/packages/emails/lib/parse-template-to-html.js.map +1 -0
- package/packages/emails/lib/providers/sendgrid/index.d.ts +8 -0
- package/packages/emails/lib/providers/sendgrid/index.js +54 -0
- package/packages/emails/lib/providers/sendgrid/index.js.map +1 -0
- package/packages/emails/lib/providers/sendgrid/parse-to-data.d.ts +5 -0
- package/packages/emails/lib/providers/sendgrid/parse-to-data.js +55 -0
- package/packages/emails/lib/providers/sendgrid/parse-to-data.js.map +1 -0
- package/packages/emails/lib/providers/smtp/index.d.ts +13 -0
- package/packages/emails/lib/providers/smtp/index.js +79 -0
- package/packages/emails/lib/providers/smtp/index.js.map +1 -0
- package/packages/emails/package.json +35 -0
- package/packages/emails/src/index.ts +144 -0
- package/packages/emails/src/parse-template-to-html.ts +19 -0
- package/packages/emails/src/providers/sendgrid/index.ts +78 -0
- package/packages/emails/src/providers/sendgrid/parse-to-data.ts +92 -0
- package/packages/emails/src/providers/smtp/index.ts +115 -0
- package/packages/emails/tests/assets/customer.json +68 -0
- package/packages/emails/tests/assets/order.json +190 -0
- package/packages/emails/tests/assets/store.json +25 -0
- package/packages/emails/tests/ex.config-sendgrid.json +19 -0
- package/packages/emails/tests/ex.config-smtp.json +21 -0
- package/packages/emails/tests/sendgrid.test.ts +156 -0
- package/packages/emails/tests/smtp.test.ts +147 -0
- package/packages/emails/tests/templates/new-order.ejs +37 -0
- package/packages/emails/tsconfig.json +6 -0
- package/packages/emails/types/index.d.ts +84 -0
- package/packages/emails/types/sendgrid.d.ts +28 -0
- package/packages/events/lib/firebase.js +8 -0
- package/packages/events/lib/firebase.js.map +1 -1
- package/packages/events/package.json +8 -4
- package/packages/events/src/firebase.ts +8 -0
- package/packages/firebase/lib/config.d.ts +15 -1
- package/packages/firebase/lib/config.js +25 -3
- package/packages/firebase/lib/config.js.map +1 -1
- package/packages/firebase/lib/handlers/check-store-events.js +1 -2
- package/packages/firebase/lib/handlers/check-store-events.js.map +1 -1
- package/packages/firebase/lib/helpers/pubsub.d.ts +2 -2
- package/packages/firebase/lib/helpers/update-app-data.js +1 -1
- package/packages/firebase/lib/helpers/update-app-data.js.map +1 -1
- package/packages/firebase/lib/init.js +0 -2
- package/packages/firebase/lib/init.js.map +1 -1
- package/packages/firebase/package.json +6 -6
- package/packages/firebase/src/config.ts +28 -4
- package/packages/firebase/src/handlers/check-store-events.ts +1 -2
- package/packages/firebase/src/helpers/update-app-data.ts +1 -1
- package/packages/firebase/src/init.ts +0 -2
- package/packages/i18n/package.json +1 -1
- package/packages/modules/lib/firebase/call-app-module.js +37 -1
- package/packages/modules/lib/firebase/call-app-module.js.map +1 -1
- package/packages/modules/lib/firebase/checkout.js +9 -7
- package/packages/modules/lib/firebase/checkout.js.map +1 -1
- package/packages/modules/lib/firebase/functions-checkout/fix-items.js +80 -18
- package/packages/modules/lib/firebase/functions-checkout/fix-items.js.map +1 -1
- package/packages/modules/lib/firebase/functions-checkout/get-custumerId.js +1 -1
- package/packages/modules/lib/firebase/functions-checkout/get-custumerId.js.map +1 -1
- package/packages/modules/lib/firebase/functions-checkout/handle-order-transaction.js +16 -16
- package/packages/modules/lib/firebase/functions-checkout/handle-order-transaction.js.map +1 -1
- package/packages/modules/lib/firebase/functions-checkout/new-order.js +8 -8
- package/packages/modules/lib/firebase/functions-checkout/new-order.js.map +1 -1
- package/packages/modules/lib/firebase/functions-checkout/request-to-module.js +23 -6
- package/packages/modules/lib/firebase/functions-checkout/request-to-module.js.map +1 -1
- package/packages/modules/lib/firebase/functions-checkout/utils.js +1 -2
- package/packages/modules/lib/firebase/functions-checkout/utils.js.map +1 -1
- package/packages/modules/lib/firebase/handle-module.js +1 -1
- package/packages/modules/lib/firebase/handle-module.js.map +1 -1
- package/packages/modules/lib/firebase.js +0 -1
- package/packages/modules/lib/firebase.js.map +1 -1
- package/packages/modules/package.json +10 -7
- package/packages/modules/schemas/apply_discount.cjs +47 -0
- package/packages/modules/src/firebase/call-app-module.ts +37 -1
- package/packages/modules/src/firebase/checkout.ts +13 -10
- package/packages/modules/src/firebase/functions-checkout/fix-items.ts +88 -20
- package/packages/modules/src/firebase/functions-checkout/get-custumerId.ts +1 -1
- package/packages/modules/src/firebase/functions-checkout/handle-order-transaction.ts +24 -23
- package/packages/modules/src/firebase/functions-checkout/new-order.ts +15 -14
- package/packages/modules/src/firebase/functions-checkout/request-to-module.ts +30 -8
- package/packages/modules/src/firebase/functions-checkout/utils.ts +3 -5
- package/packages/modules/src/firebase/handle-module.ts +1 -1
- package/packages/modules/src/firebase.ts +0 -1
- package/packages/modules/src/types/index.d.ts +7 -6
- package/packages/passport/lib/firebase/authenticate-customer.js +1 -1
- package/packages/passport/lib/firebase/authenticate-customer.js.map +1 -1
- package/packages/passport/lib/firebase/serve-passport-api.js +1 -1
- package/packages/passport/lib/firebase/serve-passport-api.js.map +1 -1
- package/packages/passport/lib/firebase.js +0 -1
- package/packages/passport/lib/firebase.js.map +1 -1
- package/packages/passport/package.json +4 -4
- package/packages/passport/src/firebase/authenticate-customer.ts +2 -2
- package/packages/passport/src/firebase/serve-passport-api.ts +1 -1
- package/packages/passport/src/firebase.ts +0 -1
- package/packages/ssr/package.json +9 -9
- package/packages/storefront/.eslintrc.cjs +4 -1
- package/packages/storefront/astro.config.mjs +15 -8
- package/packages/storefront/dist/client/HeaderButtons.bc4a5c97.js +1 -0
- package/packages/storefront/dist/client/assets/_...slug_.acb18581.css +1 -0
- package/packages/storefront/dist/client/chunks/HeaderButtons.861af799.js +1 -0
- package/packages/storefront/dist/client/chunks/{LoginForm.e02dee3d.js → LoginForm.7e9c481c.js} +95 -95
- package/packages/storefront/dist/client/chunks/preload-helper.1de719f8.js +1 -0
- package/packages/storefront/dist/client/chunks/runtime-dom.esm-bundler.1b578f5a.js +1 -0
- package/packages/storefront/dist/client/client.75c18572.js +1 -0
- package/packages/storefront/dist/client/{hoisted.3f1cf839.js → hoisted.4f689abe.js} +1 -1
- package/packages/storefront/dist/client/manifest.webmanifest +1 -1
- package/packages/storefront/dist/client/page.5a6f3db5.js +1 -0
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/{avif → chunks/avif}/avif_node_dec.wasm +0 -0
- package/packages/storefront/dist/server/{avif → chunks/avif}/avif_node_enc.wasm +0 -0
- package/packages/storefront/dist/server/chunks/image-pool.f66f99fb.mjs +10791 -0
- package/packages/storefront/dist/server/{mozjpeg → chunks/mozjpeg}/mozjpeg_node_dec.wasm +0 -0
- package/packages/storefront/dist/server/{mozjpeg → chunks/mozjpeg}/mozjpeg_node_enc.wasm +0 -0
- package/packages/storefront/dist/server/{png → chunks/png}/squoosh_oxipng_bg.wasm +0 -0
- package/packages/storefront/dist/server/{png → chunks/png}/squoosh_png_bg.wasm +0 -0
- package/packages/storefront/dist/server/{resize → chunks/resize}/squoosh_resize_bg.wasm +0 -0
- package/packages/storefront/dist/server/{rotate → chunks/rotate}/rotate.wasm +0 -0
- package/packages/storefront/dist/server/{webp → chunks/webp}/webp_node_dec.wasm +0 -0
- package/packages/storefront/dist/server/{webp → chunks/webp}/webp_node_enc.wasm +0 -0
- package/packages/storefront/dist/server/entry.mjs +10835 -14275
- package/packages/storefront/dist/server/manifest.webmanifest +1 -1
- package/packages/storefront/package.json +23 -22
- package/packages/storefront/src/lib/assets/base.css +110 -0
- package/packages/storefront/src/lib/assets/dark.css +92 -0
- package/packages/storefront/src/lib/assets/forms.css +0 -0
- package/packages/storefront/src/lib/assets/pico.css +48 -154
- package/packages/storefront/src/lib/assets/preflight.css +362 -0
- package/packages/storefront/src/lib/assets/typography.css +15 -0
- package/packages/storefront/src/lib/components/ADrawer.vue +11 -11
- package/packages/storefront/src/lib/components/LoginDrawer.vue +1 -1
- package/packages/storefront/src/lib/components/LoginForm.vue +4 -13
- package/packages/storefront/src/lib/layouts/BaseBody.astro +2 -1
- package/packages/storefront/src/lib/layouts/BaseHead.astro +13 -3
- package/packages/storefront/src/lib/layouts/BaseStateJson.astro +3 -12
- package/packages/storefront/src/lib/ssr/image.ts +11 -6
- package/packages/storefront/src/lib/ssr-context.ts +3 -3
- package/packages/storefront/src/lib/state/customer-session.ts +29 -37
- package/packages/storefront/src/lib/state/shopping-cart/add-cart-item.ts +69 -0
- package/packages/storefront/src/lib/state/shopping-cart/parse-product.ts +36 -0
- package/packages/storefront/src/lib/state/shopping-cart.ts +83 -0
- package/packages/storefront/src/lib/state/use-storage.ts +19 -0
- package/packages/storefront/src/lib/types/cms-settings.d.ts +3 -1
- package/packages/storefront/storefront.cms.cjs +41 -0
- package/packages/storefront/storefront.cms.mjs +7 -2
- package/packages/storefront/storefront.config.mjs +1 -0
- package/packages/storefront/tailwind.config.cjs +143 -109
- package/packages/storefront/uno.config.cjs +126 -0
- package/packages/types/index.ts +21 -0
- package/packages/types/modules/apply_discount:response.d.ts +32 -0
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/HeaderButtons.75084c8f.js +0 -1
- package/packages/storefront/dist/client/assets/_...slug_.5d8e6131.css +0 -4
- package/packages/storefront/dist/client/chunks/HeaderButtons.d1f8a21f.js +0 -1
- package/packages/storefront/dist/client/chunks/preload-helper.f15ab524.js +0 -1
- package/packages/storefront/dist/client/chunks/runtime-dom.esm-bundler.9119f0ff.js +0 -1
- package/packages/storefront/dist/client/client.671d7334.js +0 -1
- package/packages/storefront/dist/client/page.b906f867.js +0 -1
- package/packages/storefront/uno.config.ts +0 -167
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
EmailHeaders,
|
|
3
|
+
SmtpConfig,
|
|
4
|
+
EmailAdrress,
|
|
5
|
+
TemplateData,
|
|
6
|
+
Template,
|
|
7
|
+
} from '../../../types/index';
|
|
8
|
+
import type SMTPTransport from 'nodemailer/lib/smtp-transport';
|
|
9
|
+
import nodemailer from 'nodemailer';
|
|
10
|
+
import parseTemplateToHtml from '../../parse-template-to-html';
|
|
11
|
+
|
|
12
|
+
const parseEmailsToString = (emails: EmailAdrress | EmailAdrress[]) => {
|
|
13
|
+
if (Array.isArray(emails)) {
|
|
14
|
+
return emails.reduce((value: string, emailAdrress: EmailAdrress) => {
|
|
15
|
+
return `${value}, ${emailAdrress.email}`;
|
|
16
|
+
}, '');
|
|
17
|
+
}
|
|
18
|
+
return `"${emails.name}" <${emails.email}>`;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
let smtpConfig: SmtpConfig | undefined;
|
|
22
|
+
|
|
23
|
+
let transporter: nodemailer.Transporter<SMTPTransport.SentMessageInfo> | undefined;
|
|
24
|
+
|
|
25
|
+
const setConfigSmtp = (config: SmtpConfig) => {
|
|
26
|
+
smtpConfig = config;
|
|
27
|
+
// create reusable transporter object using the default SMTP transport
|
|
28
|
+
transporter = nodemailer.createTransport(config);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const sendEmail = async (
|
|
32
|
+
emailHeaders: EmailHeaders,
|
|
33
|
+
dataOptions: {
|
|
34
|
+
text?: string,
|
|
35
|
+
html?: string,
|
|
36
|
+
templateData?: TemplateData,
|
|
37
|
+
template?: Template,
|
|
38
|
+
},
|
|
39
|
+
) => {
|
|
40
|
+
const {
|
|
41
|
+
text,
|
|
42
|
+
templateData,
|
|
43
|
+
template,
|
|
44
|
+
} = dataOptions;
|
|
45
|
+
let { html } = dataOptions;
|
|
46
|
+
const { from, to } = emailHeaders;
|
|
47
|
+
|
|
48
|
+
if (!template && !html) {
|
|
49
|
+
throw new Error('Template or html not found');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (template && !templateData) {
|
|
53
|
+
throw new Error('Data for template not found');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (template && templateData) {
|
|
57
|
+
html = parseTemplateToHtml(templateData, template);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!html) {
|
|
61
|
+
throw new Error(`Email body for template: #${template}, not found`);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// send mail with defined transport object
|
|
65
|
+
const mailOptions = {
|
|
66
|
+
from: `"${from.name}" <${from.email}>`,
|
|
67
|
+
to: parseEmailsToString(to),
|
|
68
|
+
subject: emailHeaders.subject,
|
|
69
|
+
html,
|
|
70
|
+
};
|
|
71
|
+
if (text) {
|
|
72
|
+
Object.assign(mailOptions, text);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (emailHeaders.sender) {
|
|
76
|
+
Object.assign(mailOptions, {
|
|
77
|
+
sender: `"${emailHeaders.sender.name}" <${emailHeaders.sender.email}>`,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (emailHeaders.cc) {
|
|
82
|
+
Object.assign(mailOptions, {
|
|
83
|
+
cc: parseEmailsToString(emailHeaders.cc),
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (emailHeaders.bcc) {
|
|
88
|
+
Object.assign(mailOptions, {
|
|
89
|
+
bcc: parseEmailsToString(emailHeaders.bcc),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (emailHeaders.replyTo) {
|
|
94
|
+
const replyTo = parseEmailsToString(emailHeaders.replyTo);
|
|
95
|
+
Object.assign(mailOptions, {
|
|
96
|
+
replyTo,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (!transporter && smtpConfig) {
|
|
101
|
+
setConfigSmtp(smtpConfig);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (transporter) {
|
|
105
|
+
const info = await transporter.sendMail(mailOptions);
|
|
106
|
+
return { status: 202, message: `messageId: #${info.messageId}` };
|
|
107
|
+
}
|
|
108
|
+
throw new Error('Error configuring SMTP settings');
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export default sendEmail;
|
|
112
|
+
|
|
113
|
+
export {
|
|
114
|
+
setConfigSmtp,
|
|
115
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"oauth_providers": [
|
|
3
|
+
{
|
|
4
|
+
"_id": "3c2a00000000000000000003",
|
|
5
|
+
"provider": "facebook",
|
|
6
|
+
"user_id": "1234567890"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"main_email": "mail@sample.ex",
|
|
10
|
+
"emails": [
|
|
11
|
+
{
|
|
12
|
+
"address": "mail@sample.ex",
|
|
13
|
+
"type": "personal",
|
|
14
|
+
"verified": true
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"address": "janedue@inc.sample",
|
|
18
|
+
"type": "work",
|
|
19
|
+
"verified": false
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"accepts_marketing": true,
|
|
23
|
+
"display_name": "Jane",
|
|
24
|
+
"name": {
|
|
25
|
+
"family_name": "Due",
|
|
26
|
+
"given_name": "Jane"
|
|
27
|
+
},
|
|
28
|
+
"gender": "f",
|
|
29
|
+
"phones": [
|
|
30
|
+
{
|
|
31
|
+
"country_code": 55,
|
|
32
|
+
"number": "31999889988",
|
|
33
|
+
"type": "personal"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"country_code": 55,
|
|
37
|
+
"number": "3133443344",
|
|
38
|
+
"type": "home"
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"registry_type": "p",
|
|
42
|
+
"doc_country": "BR",
|
|
43
|
+
"doc_number": "11111111111",
|
|
44
|
+
"addresses": [
|
|
45
|
+
{
|
|
46
|
+
"_id": "4d2b00000000000000000003",
|
|
47
|
+
"zip": "30111222",
|
|
48
|
+
"street": "Rua Augusta",
|
|
49
|
+
"number": 92200,
|
|
50
|
+
"complement": "Apto. 200",
|
|
51
|
+
"borough": "Jardins",
|
|
52
|
+
"near_to": "Supermercado Exemplifica",
|
|
53
|
+
"line_address": "Rua Augusta 922200 Apto. 200, Jardins, Belo Horizonte, MG",
|
|
54
|
+
"city": "Belo Horizonte",
|
|
55
|
+
"country": "Brasil",
|
|
56
|
+
"country_code": "BR",
|
|
57
|
+
"province": "Minas Gerais",
|
|
58
|
+
"province_code": "MG",
|
|
59
|
+
"name": "Fulano",
|
|
60
|
+
"last_name": "Beltrano",
|
|
61
|
+
"phone": {
|
|
62
|
+
"country_code": 55,
|
|
63
|
+
"number": "31999889988"
|
|
64
|
+
},
|
|
65
|
+
"default": true
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
{
|
|
2
|
+
"checkout_link": "https://www.sampleshop.com.br/checkout?_id=(_id)",
|
|
3
|
+
"status_link": "https://www.sampleshop.com.br/order/status?_id=(_id)",
|
|
4
|
+
"utm": {
|
|
5
|
+
"campaign": "adwords_example"
|
|
6
|
+
},
|
|
7
|
+
"browser_ip": "8.8.8.8",
|
|
8
|
+
"channel_id": "10001",
|
|
9
|
+
"domain": "www.sampleshop.com.br",
|
|
10
|
+
"opened_at": "2017-11-19T13:10:00.612Z",
|
|
11
|
+
"seller_status": "pending",
|
|
12
|
+
"financial_status": {
|
|
13
|
+
"updated_at": "2017-11-19T13:10:00.612Z",
|
|
14
|
+
"current": "pending"
|
|
15
|
+
},
|
|
16
|
+
"amount": {
|
|
17
|
+
"total": 48.05,
|
|
18
|
+
"subtotal": 42.9,
|
|
19
|
+
"freight": 5.15,
|
|
20
|
+
"discount": 0
|
|
21
|
+
},
|
|
22
|
+
"payment_method_label": "PayPal",
|
|
23
|
+
"shipping_method_label": "PAC",
|
|
24
|
+
"buyers": [
|
|
25
|
+
{
|
|
26
|
+
"_id": "3c1000000000000000000001",
|
|
27
|
+
"locale": "pt_br",
|
|
28
|
+
"main_email": "123@mail.com",
|
|
29
|
+
"display_name": "Fulano",
|
|
30
|
+
"name": {
|
|
31
|
+
"family_name": "Beltrano",
|
|
32
|
+
"given_name": "Fulano",
|
|
33
|
+
"middle_name": "Sicrano"
|
|
34
|
+
},
|
|
35
|
+
"gender": "m",
|
|
36
|
+
"phones": [
|
|
37
|
+
{
|
|
38
|
+
"country_code": 55,
|
|
39
|
+
"number": "31999889988",
|
|
40
|
+
"type": "personal"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"registry_type": "p",
|
|
44
|
+
"doc_country": "BR",
|
|
45
|
+
"doc_number": "11111111111"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"shipping_lines": [
|
|
49
|
+
{
|
|
50
|
+
"from": {
|
|
51
|
+
"zip": "10111222",
|
|
52
|
+
"street": "Rua Exemplar",
|
|
53
|
+
"number": 100,
|
|
54
|
+
"borough": "Bairro Examplar",
|
|
55
|
+
"city": "São Paulo",
|
|
56
|
+
"province": "São Paulo",
|
|
57
|
+
"province_code": "SP"
|
|
58
|
+
},
|
|
59
|
+
"to": {
|
|
60
|
+
"zip": "30111222",
|
|
61
|
+
"street": "Rua Augusta",
|
|
62
|
+
"number": 92200,
|
|
63
|
+
"complement": "Apto. 200",
|
|
64
|
+
"borough": "Jardins",
|
|
65
|
+
"near_to": "Supermercado Exemplifica",
|
|
66
|
+
"line_address": "Rua Augusta 922200 Apto. 200, Jardins, Belo Horizonte, MG",
|
|
67
|
+
"city": "Belo Horizonte",
|
|
68
|
+
"country": "Brasil",
|
|
69
|
+
"country_code": "BR",
|
|
70
|
+
"province": "Minas Gerais",
|
|
71
|
+
"province_code": "MG",
|
|
72
|
+
"name": "Fulano",
|
|
73
|
+
"last_name": "Beltrano",
|
|
74
|
+
"phone": {
|
|
75
|
+
"country_code": 55,
|
|
76
|
+
"number": "31999889988"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"package": {
|
|
80
|
+
"dimensions": {
|
|
81
|
+
"width": {
|
|
82
|
+
"value": 10
|
|
83
|
+
},
|
|
84
|
+
"height": {
|
|
85
|
+
"value": 8
|
|
86
|
+
},
|
|
87
|
+
"length": {
|
|
88
|
+
"value": 8
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"weight": {
|
|
92
|
+
"value": 400,
|
|
93
|
+
"unit": "g"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"app": {
|
|
97
|
+
"_id": "77f000000000000000000001",
|
|
98
|
+
"label": "PAC",
|
|
99
|
+
"carrier": "Correios",
|
|
100
|
+
"service_name": "PAC",
|
|
101
|
+
"service_code": "44000",
|
|
102
|
+
"tracking_url": "http://www2.correios.com.br/sistemas/rastreamento/"
|
|
103
|
+
},
|
|
104
|
+
"price": 5,
|
|
105
|
+
"declared_value": 42.9,
|
|
106
|
+
"declared_value_price": 0.15,
|
|
107
|
+
"total_price": 5.15,
|
|
108
|
+
"posting_deadline": {
|
|
109
|
+
"days": 3
|
|
110
|
+
},
|
|
111
|
+
"delivery_time": {
|
|
112
|
+
"days": 5
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
"transactions": [
|
|
117
|
+
{
|
|
118
|
+
"_id": "3ab0000000000000000000f1",
|
|
119
|
+
"created_at": "2017-11-19T13:10:00.612Z",
|
|
120
|
+
"payment_method": {
|
|
121
|
+
"code": "credit_card",
|
|
122
|
+
"name": "PayPal"
|
|
123
|
+
},
|
|
124
|
+
"billing_address": {
|
|
125
|
+
"zip": "30111222",
|
|
126
|
+
"street": "Rua Augusta",
|
|
127
|
+
"number": 92200,
|
|
128
|
+
"complement": "Apto. 200",
|
|
129
|
+
"borough": "Jardins",
|
|
130
|
+
"near_to": "Supermercado Exemplifica",
|
|
131
|
+
"line_address": "Rua Augusta 922200 Apto. 200, Jardins, Belo Horizonte, MG",
|
|
132
|
+
"city": "Belo Horizonte",
|
|
133
|
+
"country": "Brasil",
|
|
134
|
+
"country_code": "BR",
|
|
135
|
+
"province": "Minas Gerais",
|
|
136
|
+
"province_code": "MG",
|
|
137
|
+
"name": "Fulano",
|
|
138
|
+
"last_name": "Beltrano",
|
|
139
|
+
"phone": {
|
|
140
|
+
"country_code": 55,
|
|
141
|
+
"number": "31999889988"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"app": {
|
|
145
|
+
"_id": "77f000000000000000000011",
|
|
146
|
+
"label": "PayPal",
|
|
147
|
+
"icon": "https://www.paypal-brasil.com.br/logocenter/util/img/selo_aceitacao_horizontal.png",
|
|
148
|
+
"intermediator": {
|
|
149
|
+
"name": "PayPal",
|
|
150
|
+
"link": "https://www.paypal.com/br/home",
|
|
151
|
+
"code": "paypal"
|
|
152
|
+
},
|
|
153
|
+
"payment_url": "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=1abc"
|
|
154
|
+
},
|
|
155
|
+
"intermediator": {
|
|
156
|
+
"transaction_code": "1abc"
|
|
157
|
+
},
|
|
158
|
+
"amount": 48.05,
|
|
159
|
+
"installments": {
|
|
160
|
+
"number": 2,
|
|
161
|
+
"value": 24.03,
|
|
162
|
+
"total": 48.06
|
|
163
|
+
},
|
|
164
|
+
"status": {
|
|
165
|
+
"updated_at": "2017-11-19T13:10:00.612Z",
|
|
166
|
+
"current": "pending"
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
"payments_history": [
|
|
171
|
+
{
|
|
172
|
+
"_id": "4ab0000000000000000000f1",
|
|
173
|
+
"transaction_id": "3ab0000000000000000000f1",
|
|
174
|
+
"date_time": "2017-11-19T13:10:00.612Z",
|
|
175
|
+
"status": "pending",
|
|
176
|
+
"notification_code": "1abcde"
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
"items": [
|
|
180
|
+
{
|
|
181
|
+
"_id": "3120000000000000000000a1",
|
|
182
|
+
"product_id": "123a5432109876543210cdef",
|
|
183
|
+
"sku": "s-MP_2B4",
|
|
184
|
+
"name": "Mens Pique Polo Shirt",
|
|
185
|
+
"quantity": 1,
|
|
186
|
+
"price": 42.9
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
"notes": "Sample order notes by customer"
|
|
190
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_id": "5a674f224e0dcec2c3353d9d",
|
|
3
|
+
"created_at": "2017-11-19T13:10:00.612Z",
|
|
4
|
+
"store_id": 100,
|
|
5
|
+
"name": "Minha Loja Online",
|
|
6
|
+
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
|
7
|
+
"segment_id": 23,
|
|
8
|
+
"doc_type": "CNPJ",
|
|
9
|
+
"doc_number": "12345678901234",
|
|
10
|
+
"corporate_name": "Minha Loja Online LTDA",
|
|
11
|
+
"address": "Rua Exemplar 100, Bairro Examplar, São Paulo, SP",
|
|
12
|
+
"phone": "31988887777",
|
|
13
|
+
"representant_name": "Fulano Ciclano",
|
|
14
|
+
"representant_email": "fulano@sample.shop.eg",
|
|
15
|
+
"contact_email": "contato@sample.shop.eg",
|
|
16
|
+
"financial_email": "financeiro@sample.shop.eg",
|
|
17
|
+
"logo": {
|
|
18
|
+
"url": "https://sample.shop.eg/assets/logo.png",
|
|
19
|
+
"size": "120x80"
|
|
20
|
+
},
|
|
21
|
+
"brand_colors": {
|
|
22
|
+
"primary": "#03a9b3",
|
|
23
|
+
"secondary": "#ffffff"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"ecomAuthenticationId": "",
|
|
3
|
+
"ecomApiKey": "",
|
|
4
|
+
"ecomStoreId": "",
|
|
5
|
+
"apiKey": "",
|
|
6
|
+
"from": {
|
|
7
|
+
"email": "",
|
|
8
|
+
"name": ""
|
|
9
|
+
},
|
|
10
|
+
"to": [
|
|
11
|
+
{
|
|
12
|
+
"email": "",
|
|
13
|
+
"name": ""
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"templateIdOrders": "",
|
|
17
|
+
"templateIdCarts": "",
|
|
18
|
+
"templateIdProducts": ""
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"ecomAuthenticationId": "",
|
|
3
|
+
"ecomApiKey": "",
|
|
4
|
+
"ecomStoreId": "",
|
|
5
|
+
"smtp": {
|
|
6
|
+
"host": "",
|
|
7
|
+
"port": "",
|
|
8
|
+
"user": "",
|
|
9
|
+
"pass": ""
|
|
10
|
+
},
|
|
11
|
+
"from": {
|
|
12
|
+
"email": "",
|
|
13
|
+
"name": ""
|
|
14
|
+
},
|
|
15
|
+
"to": [
|
|
16
|
+
{
|
|
17
|
+
"email": "",
|
|
18
|
+
"name": ""
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
+
import url from 'url';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import { test, expect } from 'vitest';
|
|
5
|
+
import email, { sendGrid } from '../src/index';
|
|
6
|
+
|
|
7
|
+
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
|
8
|
+
|
|
9
|
+
const readFile = (path: string) => fs.readFileSync(`${__dirname}/${path}`, 'utf-8');
|
|
10
|
+
|
|
11
|
+
const readJson = (path: string) => JSON.parse(readFile(path));
|
|
12
|
+
|
|
13
|
+
const config = readJson('config-sendgrid.json');
|
|
14
|
+
const order = readJson('assets/order.json');
|
|
15
|
+
const store = readJson('/assets/store.json');
|
|
16
|
+
const customer = readJson('/assets/customer.json');
|
|
17
|
+
const templateNewOrder = readFile('templates/new-order.ejs');
|
|
18
|
+
|
|
19
|
+
const header = {
|
|
20
|
+
to: config.to,
|
|
21
|
+
subject: '',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
process.env.ECOM_STORE_ID = config.ecomStoreId;
|
|
25
|
+
process.env.ECOM_AUTHENTICATION_ID = config.ecomAuthenticationId;
|
|
26
|
+
process.env.ECOM_API_KEY = config.ecomApiKey;
|
|
27
|
+
|
|
28
|
+
process.env.MAIL_SENDER = config.from.email;
|
|
29
|
+
process.env.MAIL_SENDER_NAME = config.from.name;
|
|
30
|
+
|
|
31
|
+
const timeOut = 10000;
|
|
32
|
+
|
|
33
|
+
test('Error settings not found', async () => {
|
|
34
|
+
try {
|
|
35
|
+
await email.send({
|
|
36
|
+
...header,
|
|
37
|
+
templateData: {
|
|
38
|
+
store,
|
|
39
|
+
order,
|
|
40
|
+
customer,
|
|
41
|
+
},
|
|
42
|
+
template: templateNewOrder,
|
|
43
|
+
});
|
|
44
|
+
} catch (err: any) {
|
|
45
|
+
expect(err.message).toBe('Provider settings or smtp not found');
|
|
46
|
+
}
|
|
47
|
+
}, timeOut);
|
|
48
|
+
|
|
49
|
+
test('Error template not found', async () => {
|
|
50
|
+
process.env.SENDGRID_API_KEY = config.apiKey;
|
|
51
|
+
try {
|
|
52
|
+
await email.send({
|
|
53
|
+
...header,
|
|
54
|
+
templateData: {
|
|
55
|
+
store,
|
|
56
|
+
order,
|
|
57
|
+
customer,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
} catch (err: any) {
|
|
61
|
+
expect(err.message).toBe('TemplateId, template or html not found');
|
|
62
|
+
}
|
|
63
|
+
}, timeOut);
|
|
64
|
+
|
|
65
|
+
test('Send email with templateId for order', async () => {
|
|
66
|
+
header.subject = 'Test email with order templateId';
|
|
67
|
+
const data = await email.send({
|
|
68
|
+
...header,
|
|
69
|
+
templateData: {
|
|
70
|
+
store,
|
|
71
|
+
order,
|
|
72
|
+
customer,
|
|
73
|
+
},
|
|
74
|
+
templateId: config.templateIdOrders,
|
|
75
|
+
});
|
|
76
|
+
expect(data?.status).toBe(202);
|
|
77
|
+
}, timeOut);
|
|
78
|
+
|
|
79
|
+
test('Send email with template for order', async () => {
|
|
80
|
+
header.subject = 'Test email with order template';
|
|
81
|
+
const data = await email.send({
|
|
82
|
+
...header,
|
|
83
|
+
templateData: {
|
|
84
|
+
store,
|
|
85
|
+
order,
|
|
86
|
+
customer,
|
|
87
|
+
},
|
|
88
|
+
template: templateNewOrder,
|
|
89
|
+
});
|
|
90
|
+
expect(data?.status).toBe(202);
|
|
91
|
+
}, timeOut);
|
|
92
|
+
|
|
93
|
+
test('Send email retry with template for templateId error', async () => {
|
|
94
|
+
header.subject = 'Test retry email';
|
|
95
|
+
const data = await email.send({
|
|
96
|
+
...header,
|
|
97
|
+
templateData: {
|
|
98
|
+
store,
|
|
99
|
+
order,
|
|
100
|
+
customer,
|
|
101
|
+
},
|
|
102
|
+
templateId: 'd-00000000000000000000000000000000',
|
|
103
|
+
template: templateNewOrder,
|
|
104
|
+
});
|
|
105
|
+
expect(data?.status).toBe(202);
|
|
106
|
+
}, timeOut * 1.5);
|
|
107
|
+
|
|
108
|
+
test('Error templateId not found', async () => {
|
|
109
|
+
header.subject = 'Test email, templateId error';
|
|
110
|
+
try {
|
|
111
|
+
await email.send({
|
|
112
|
+
...header,
|
|
113
|
+
templateData: {
|
|
114
|
+
store,
|
|
115
|
+
order,
|
|
116
|
+
customer,
|
|
117
|
+
},
|
|
118
|
+
templateId: 'd-00000000000000000000000000000000',
|
|
119
|
+
});
|
|
120
|
+
} catch (err: any) {
|
|
121
|
+
expect(err.response.status).toBe(400);
|
|
122
|
+
}
|
|
123
|
+
}, timeOut);
|
|
124
|
+
|
|
125
|
+
test('Unauthorized Error API Key', async () => {
|
|
126
|
+
sendGrid.setConfig('dadasdas');
|
|
127
|
+
header.subject = 'Test email, Unauthorized Error API Key';
|
|
128
|
+
try {
|
|
129
|
+
await email.send({
|
|
130
|
+
...header,
|
|
131
|
+
templateData: {
|
|
132
|
+
store,
|
|
133
|
+
order,
|
|
134
|
+
customer,
|
|
135
|
+
},
|
|
136
|
+
template: templateNewOrder,
|
|
137
|
+
});
|
|
138
|
+
} catch (err: any) {
|
|
139
|
+
expect(err.response.status).toBe(401);
|
|
140
|
+
}
|
|
141
|
+
}, timeOut);
|
|
142
|
+
|
|
143
|
+
test('Back to original sendGrid settings', async () => {
|
|
144
|
+
sendGrid.setConfig(config.apiKey);
|
|
145
|
+
header.subject = 'Test email with order templateId';
|
|
146
|
+
const data = await email.send({
|
|
147
|
+
...header,
|
|
148
|
+
templateData: {
|
|
149
|
+
store,
|
|
150
|
+
order,
|
|
151
|
+
customer,
|
|
152
|
+
},
|
|
153
|
+
templateId: config.templateIdOrders,
|
|
154
|
+
});
|
|
155
|
+
expect(data?.status).toBe(202);
|
|
156
|
+
}, timeOut);
|