cloudcommerce 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +2 -1
- package/CHANGELOG.md +27 -0
- package/package.json +1 -1
- package/packages/api/package.json +1 -1
- package/packages/apps/affilate-program/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/datafrete/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +1 -1
- package/packages/apps/fb-conversions/package.json +1 -1
- package/packages/apps/flash-courier/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/galaxpay/package.json +1 -1
- package/packages/apps/google-analytics/package.json +1 -1
- package/packages/apps/jadlog/package.json +1 -1
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/melhor-envio/package.json +1 -1
- package/packages/apps/mercadopago/package.json +1 -1
- package/packages/apps/pagarme/package.json +1 -1
- package/packages/apps/paghiper/package.json +1 -1
- package/packages/apps/pix/package.json +1 -1
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/apps/webhooks/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +1 -1
- package/packages/events/lib/firebase.js +0 -2
- package/packages/events/lib/firebase.js.map +1 -1
- package/packages/events/package.json +1 -2
- package/packages/events/src/firebase.ts +0 -2
- package/packages/feeds/package.json +1 -1
- package/packages/firebase/lib/config.d.ts +0 -3
- package/packages/firebase/lib/config.js +0 -3
- package/packages/firebase/lib/config.js.map +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/firebase/src/config.ts +0 -3
- package/packages/i18n/package.json +1 -1
- package/packages/modules/lib/firebase/call-app-module.js +0 -12
- package/packages/modules/lib/firebase/call-app-module.js.map +1 -1
- package/packages/modules/package.json +1 -2
- package/packages/modules/src/firebase/call-app-module.ts +0 -12
- package/packages/passport/package.json +1 -1
- package/packages/ssr/lib/firebase/serve-storefront.js +144 -46
- package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
- package/packages/ssr/package.json +1 -1
- package/packages/ssr/src/firebase/serve-storefront.ts +153 -50
- package/packages/storefront/.eslintrc.cjs +1 -0
- package/packages/storefront/dist/client/_astro/{Carousel.f39be3c0.js → Carousel.533b4b19.js} +1 -1
- package/packages/storefront/dist/client/_astro/HeroSlider.359c76cc.js +1 -0
- package/packages/storefront/dist/client/_astro/PitchBar.75d2999f.js +1 -0
- package/packages/storefront/dist/client/_astro/Prices.bd0d3474.js +1 -0
- package/packages/storefront/dist/client/_astro/ProductShelf.83c66e3e.js +1 -0
- package/packages/storefront/dist/client/_astro/ShopHeader.f66a56cb.js +4 -0
- package/packages/storefront/dist/client/_astro/_...slug_.b19aabfc.css +1 -0
- package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.4e6dc3af.js +1 -0
- package/packages/storefront/dist/client/_astro/client.24201f93.js +1 -0
- package/packages/storefront/dist/client/_astro/{img.517fec8e.js → img.22ad29ec.js} +1 -1
- package/packages/storefront/dist/client/_astro/{index.33347cbd.js → index.ddc27a3a.js} +1 -1
- package/packages/storefront/dist/client/_astro/modules-info.d6bd555b.js +1 -0
- package/packages/storefront/dist/client/_astro/{runtime-dom.esm-bundler.00b967e0.js → runtime-dom.esm-bundler.578d6e91.js} +1 -1
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/chunks/{_...ac19792e.mjs → _...ed1d4ed7.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/{account@_@astro.d6c3fcbd.mjs → account@_@astro.97e06bd2.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/{endpoint@_@js.98745cd2.mjs → endpoint@_@js.e9171d18.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/{fallback@_@astro.08f4af85.mjs → fallback@_@astro.4a1f8c08.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/{index@_@astro.0fdfcad0.mjs → index@_@astro.7472fe37.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/{index@_@astro.8d90cfe1.mjs → index@_@astro.de13f221.mjs} +2 -2
- package/packages/storefront/dist/server/chunks/pages/{_...slug_.astro.75b11a3a.mjs → _...slug_.astro.9e731356.mjs} +252 -110
- package/packages/storefront/dist/server/chunks/pages/{endpoint.js.e6f912a7.mjs → endpoint.js.96a9b7f9.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/pages/{fallback.astro.dfe6d27b.mjs → fallback.astro.3ebb4e85.mjs} +1 -1
- package/packages/storefront/dist/server/chunks/pages/{index.astro.4ad20d64.mjs → index.astro.8d786fcb.mjs} +11 -10
- package/packages/storefront/dist/server/entry.mjs +8 -8
- package/packages/storefront/dist/server/renderers.mjs +4 -3
- package/packages/storefront/package.json +1 -1
- package/packages/storefront/src/lib/components/Drawer.vue +6 -2
- package/packages/storefront/src/lib/components/globals/AImg.vue +2 -1
- package/packages/storefront/src/lib/composables/use-prices.ts +10 -8
- package/packages/storefront/src/lib/layouts/BaseBody.astro +3 -3
- package/packages/storefront/src/lib/state/modules-info.ts +25 -0
- package/packages/storefront/src/lib/state/shopping-cart.ts +6 -0
- package/packages/types/package.json +1 -1
- package/packages/apps/infinitepay/CHANGELOG.md +0 -1
- package/packages/apps/infinitepay/README.md +0 -1
- package/packages/apps/infinitepay/assets/onload-expression.js +0 -57
- package/packages/apps/infinitepay/lib/functions-lib/add-installments.d.ts +0 -55
- package/packages/apps/infinitepay/lib/functions-lib/add-installments.js +0 -63
- package/packages/apps/infinitepay/lib/functions-lib/add-installments.js.map +0 -1
- package/packages/apps/infinitepay/lib/functions-lib/ip-auth/create-access.d.ts +0 -14
- package/packages/apps/infinitepay/lib/functions-lib/ip-auth/create-access.js +0 -67
- package/packages/apps/infinitepay/lib/functions-lib/ip-auth/create-access.js.map +0 -1
- package/packages/apps/infinitepay/lib/functions-lib/ip-auth/create-axios.d.ts +0 -2
- package/packages/apps/infinitepay/lib/functions-lib/ip-auth/create-axios.js +0 -19
- package/packages/apps/infinitepay/lib/functions-lib/ip-auth/create-axios.js.map +0 -1
- package/packages/apps/infinitepay/lib/functions-lib/ip-auth/oauth.d.ts +0 -2
- package/packages/apps/infinitepay/lib/functions-lib/ip-auth/oauth.js +0 -25
- package/packages/apps/infinitepay/lib/functions-lib/ip-auth/oauth.js.map +0 -1
- package/packages/apps/infinitepay/lib/functions-lib/utils.d.ts +0 -8
- package/packages/apps/infinitepay/lib/functions-lib/utils.js +0 -17
- package/packages/apps/infinitepay/lib/functions-lib/utils.js.map +0 -1
- package/packages/apps/infinitepay/lib/index.d.ts +0 -1
- package/packages/apps/infinitepay/lib/index.js +0 -3
- package/packages/apps/infinitepay/lib/index.js.map +0 -1
- package/packages/apps/infinitepay/lib/infinitepay.d.ts +0 -80
- package/packages/apps/infinitepay/lib/infinitepay.js +0 -12
- package/packages/apps/infinitepay/lib/infinitepay.js.map +0 -1
- package/packages/apps/infinitepay/lib/ip-create-transaction.d.ts +0 -75
- package/packages/apps/infinitepay/lib/ip-create-transaction.js +0 -324
- package/packages/apps/infinitepay/lib/ip-create-transaction.js.map +0 -1
- package/packages/apps/infinitepay/lib/ip-list-payments.d.ts +0 -7
- package/packages/apps/infinitepay/lib/ip-list-payments.js +0 -146
- package/packages/apps/infinitepay/lib/ip-list-payments.js.map +0 -1
- package/packages/apps/infinitepay/lib/ip-webhook.d.ts +0 -5
- package/packages/apps/infinitepay/lib/ip-webhook.js +0 -152
- package/packages/apps/infinitepay/lib/ip-webhook.js.map +0 -1
- package/packages/apps/infinitepay/package.json +0 -38
- package/packages/apps/infinitepay/scripts/build.sh +0 -4
- package/packages/apps/infinitepay/src/functions-lib/add-installments.ts +0 -78
- package/packages/apps/infinitepay/src/functions-lib/ip-auth/create-access.ts +0 -89
- package/packages/apps/infinitepay/src/functions-lib/ip-auth/create-axios.ts +0 -20
- package/packages/apps/infinitepay/src/functions-lib/ip-auth/oauth.ts +0 -30
- package/packages/apps/infinitepay/src/functions-lib/utils.ts +0 -23
- package/packages/apps/infinitepay/src/index.ts +0 -2
- package/packages/apps/infinitepay/src/infinitepay.ts +0 -12
- package/packages/apps/infinitepay/src/ip-create-transaction.ts +0 -441
- package/packages/apps/infinitepay/src/ip-list-payments.ts +0 -178
- package/packages/apps/infinitepay/src/ip-webhook.ts +0 -183
- package/packages/apps/infinitepay/tsconfig.json +0 -6
- package/packages/apps/infinitepay/webhook.js +0 -1
- package/packages/storefront/dist/client/_astro/HeroSlider.3d4a1d1c.js +0 -1
- package/packages/storefront/dist/client/_astro/PitchBar.c53e6d0b.js +0 -1
- package/packages/storefront/dist/client/_astro/Prices.de6df3cb.js +0 -1
- package/packages/storefront/dist/client/_astro/ProductShelf.c266a001.js +0 -1
- package/packages/storefront/dist/client/_astro/ShopHeader.c0ba5061.js +0 -4
- package/packages/storefront/dist/client/_astro/_...slug_.45bc69ca.css +0 -1
- package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.d3aaeb0d.js +0 -1
- package/packages/storefront/dist/client/_astro/client.2d950540.js +0 -1
- package/packages/storefront/dist/client/_astro/format-money.3b884fcb.js +0 -1
- package/packages/storefront/dist/client/_astro/idle-callback.889bf0ea.js +0 -1
- package/packages/storefront/dist/client/_astro/modules-info.ad27b027.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import mime from 'mime';
|
|
2
2
|
import sharp$1 from 'sharp';
|
|
3
|
-
import { B as BaseSSRService, i as isOutputFormatSupportsAlpha } from './_...slug_.astro.
|
|
3
|
+
import { B as BaseSSRService, i as isOutputFormatSupportsAlpha } from './_...slug_.astro.9e731356.mjs';
|
|
4
4
|
|
|
5
5
|
class SharpService extends BaseSSRService {
|
|
6
6
|
async transform(inputBuffer, transform) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as createAstro, a as createComponent, r as renderTemplate, m as maybeRenderHead, b as addAttribute, d as renderComponent } from '../astro.2df8d1c5.mjs';
|
|
2
|
-
import { l as loadRouteContext, $ as $$PageHeader, a as $$Base } from './_...slug_.astro.
|
|
2
|
+
import { l as loadRouteContext, $ as $$PageHeader, a as $$Base } from './_...slug_.astro.9e731356.mjs';
|
|
3
3
|
import 'path-to-regexp';
|
|
4
4
|
import 'cookie';
|
|
5
5
|
import '@astrojs/internal-helpers/path';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as createAstro, a as createComponent, r as renderTemplate, d as renderComponent, m as maybeRenderHead, b as addAttribute, u as unescapeHTML, F as Fragment$1 } from '../astro.2df8d1c5.mjs';
|
|
2
|
-
import { b as $$Picture, p as parseShippingPhrase, _ as _export_sfc, C as Carousel, c as CarouselControl,
|
|
2
|
+
import { b as $$Picture, p as parseShippingPhrase, _ as _export_sfc, C as Carousel, c as CarouselControl, d as availableExtraDiscount, e as installmentsOption, f as discountOption, g as loyaltyPointsPrograms, l as loadRouteContext, $ as $$PageHeader, a as $$Base } from './_...slug_.astro.9e731356.mjs';
|
|
3
3
|
import api from '@cloudcommerce/api';
|
|
4
4
|
import { computed, useSSRContext, defineComponent, mergeProps, withCtx, createVNode, withDirectives, vShow, resolveDynamicComponent, createTextVNode, toDisplayString, openBlock, createBlock, Fragment, renderList, renderSlot, createCommentVNode, ref, shallowReactive, resolveComponent, withAsyncContext } from 'vue';
|
|
5
5
|
import { ssrRenderAttrs, ssrRenderComponent, ssrRenderStyle, ssrRenderList, ssrRenderClass, ssrRenderAttr, ssrRenderSlot, ssrRenderVNode, ssrInterpolate } from 'vue/server-renderer';
|
|
@@ -515,12 +515,9 @@ const usePrices = (props) => {
|
|
|
515
515
|
}
|
|
516
516
|
return false;
|
|
517
517
|
});
|
|
518
|
-
const extraDiscount = computed(() => {
|
|
519
|
-
return modulesInfo.apply_discount.available_extra_discount;
|
|
520
|
-
});
|
|
521
518
|
const salePrice = computed(() => {
|
|
522
519
|
const price$1 = price(_product.value);
|
|
523
|
-
const discount =
|
|
520
|
+
const discount = availableExtraDiscount.value;
|
|
524
521
|
if (discount && (!discount.min_amount || price$1 > discount.min_amount)) {
|
|
525
522
|
return getPriceWithDiscount(price$1, discount);
|
|
526
523
|
}
|
|
@@ -537,7 +534,7 @@ const usePrices = (props) => {
|
|
|
537
534
|
return 0;
|
|
538
535
|
});
|
|
539
536
|
const installmentsObject = computed(() => {
|
|
540
|
-
return props.installmentsOption ||
|
|
537
|
+
return props.installmentsOption || installmentsOption.value || { max_number: 1 };
|
|
541
538
|
});
|
|
542
539
|
const installmentsNumber = computed(() => {
|
|
543
540
|
if (installmentsObject.value.max_number <= 1) {
|
|
@@ -561,7 +558,7 @@ const usePrices = (props) => {
|
|
|
561
558
|
return 0;
|
|
562
559
|
});
|
|
563
560
|
const discountObject = computed(() => {
|
|
564
|
-
const discount = props.discountOption ||
|
|
561
|
+
const discount = props.discountOption || discountOption.value;
|
|
565
562
|
if (discount && (!discount.min_amount || discount.min_amount <= salePrice.value) && (!props.isAmountTotal || discount.apply_at === "total")) {
|
|
566
563
|
return discount;
|
|
567
564
|
}
|
|
@@ -584,7 +581,7 @@ const usePrices = (props) => {
|
|
|
584
581
|
if (props.loyaltyPointsProgram) {
|
|
585
582
|
return props.loyaltyPointsProgram;
|
|
586
583
|
}
|
|
587
|
-
const pointsPrograms =
|
|
584
|
+
const pointsPrograms = loyaltyPointsPrograms.value;
|
|
588
585
|
if (pointsPrograms) {
|
|
589
586
|
const programIds = Object.keys(pointsPrograms);
|
|
590
587
|
for (let i = 0; i < programIds.length; i++) {
|
|
@@ -853,11 +850,13 @@ function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
853
850
|
_push2(`<!--[-->`);
|
|
854
851
|
_push2(ssrRenderComponent(_component_AImg, {
|
|
855
852
|
picture: $setup.images[0],
|
|
853
|
+
alt: $setup.title,
|
|
856
854
|
class: "absolute top-0 left-0 block w-full h-full object-cover"
|
|
857
855
|
}, null, _parent2, _scopeId));
|
|
858
856
|
if ($setup.images[1] && $setup.wasHoveredOnce) {
|
|
859
857
|
_push2(ssrRenderComponent(_component_AImg, {
|
|
860
858
|
picture: $setup.images[1],
|
|
859
|
+
alt: $setup.title,
|
|
861
860
|
class: "absolute top-0 left-0 block w-full h-full object-cover opacity-0 group-hover:opacity-100 transition-opacity motion-safe:duration-300 text-transparent z-10"
|
|
862
861
|
}, null, _parent2, _scopeId));
|
|
863
862
|
} else {
|
|
@@ -892,13 +891,15 @@ function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
|
|
|
892
891
|
$setup.images?.length ? (openBlock(), createBlock(Fragment, { key: 0 }, [
|
|
893
892
|
createVNode(_component_AImg, {
|
|
894
893
|
picture: $setup.images[0],
|
|
894
|
+
alt: $setup.title,
|
|
895
895
|
class: "absolute top-0 left-0 block w-full h-full object-cover"
|
|
896
|
-
}, null, 8, ["picture"]),
|
|
896
|
+
}, null, 8, ["picture", "alt"]),
|
|
897
897
|
$setup.images[1] && $setup.wasHoveredOnce ? (openBlock(), createBlock(_component_AImg, {
|
|
898
898
|
key: 0,
|
|
899
899
|
picture: $setup.images[1],
|
|
900
|
+
alt: $setup.title,
|
|
900
901
|
class: "absolute top-0 left-0 block w-full h-full object-cover opacity-0 group-hover:opacity-100 transition-opacity motion-safe:duration-300 text-transparent z-10"
|
|
901
|
-
}, null, 8, ["picture"])) : createCommentVNode("", true)
|
|
902
|
+
}, null, 8, ["picture", "alt"])) : createCommentVNode("", true)
|
|
902
903
|
], 64)) : (openBlock(), createBlock("div", {
|
|
903
904
|
key: 1,
|
|
904
905
|
class: "w-full h-full bg-gradient-to-br from-base-50/20 to-base-100"
|
|
@@ -24,7 +24,7 @@ import 'string-width';
|
|
|
24
24
|
import 'vue';
|
|
25
25
|
import 'vue/server-renderer';
|
|
26
26
|
import '@ecomplus/utils';
|
|
27
|
-
import './chunks/pages/_...slug_.astro.
|
|
27
|
+
import './chunks/pages/_...slug_.astro.9e731356.mjs';
|
|
28
28
|
import 'node:fs/promises';
|
|
29
29
|
import 'node:path';
|
|
30
30
|
import 'node:url';
|
|
@@ -2824,13 +2824,13 @@ const adapter = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
|
2824
2824
|
start
|
|
2825
2825
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2826
2826
|
|
|
2827
|
-
const _page0 = () => import('./chunks/endpoint@_@js.
|
|
2828
|
-
const _page1 = () => import('./chunks/index@_@astro.
|
|
2829
|
-
const _page2 = () => import('./chunks/fallback@_@astro.
|
|
2830
|
-
const _page3 = () => import('./chunks/index@_@astro.
|
|
2831
|
-
const _page4 = () => import('./chunks/account@_@astro.
|
|
2832
|
-
const _page5 = () => import('./chunks/_...
|
|
2833
|
-
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.17.2_astro@2.8.0_sharp@0.32.1/node_modules/@astrojs/image/dist/endpoint.js","pathname":"/_image","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[{"type":"external","value":"/_astro/hoisted.9d9d7ac4.js"}],"styles":[{"type":"external","src":"/_astro/_...slug_.
|
|
2827
|
+
const _page0 = () => import('./chunks/endpoint@_@js.e9171d18.mjs');
|
|
2828
|
+
const _page1 = () => import('./chunks/index@_@astro.de13f221.mjs');
|
|
2829
|
+
const _page2 = () => import('./chunks/fallback@_@astro.4a1f8c08.mjs');
|
|
2830
|
+
const _page3 = () => import('./chunks/index@_@astro.7472fe37.mjs');
|
|
2831
|
+
const _page4 = () => import('./chunks/account@_@astro.97e06bd2.mjs');
|
|
2832
|
+
const _page5 = () => import('./chunks/_...ed1d4ed7.mjs');const pageMap = new Map([["../../node_modules/.pnpm/@astrojs+image@0.17.2_astro@2.8.0_sharp@0.32.1/node_modules/@astrojs/image/dist/endpoint.js", _page0],["src/pages/index.astro", _page1],["src/pages/fallback.astro", _page2],["src/pages/app/index.astro", _page3],["src/pages/app/account.astro", _page4],["src/pages/[...slug].astro", _page5]]);
|
|
2833
|
+
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.17.2_astro@2.8.0_sharp@0.32.1/node_modules/@astrojs/image/dist/endpoint.js","pathname":"/_image","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[{"type":"external","value":"/_astro/hoisted.9d9d7ac4.js"}],"styles":[{"type":"external","src":"/_astro/_...slug_.b19aabfc.css"}],"routeData":{"route":"/","type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[{"type":"external","value":"/_astro/hoisted.9d9d7ac4.js"}],"styles":[{"type":"external","src":"/_astro/_...slug_.b19aabfc.css"}],"routeData":{"route":"/fallback","type":"page","pattern":"^\\/fallback\\/?$","segments":[[{"content":"fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/fallback.astro","pathname":"/fallback","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"route":"/app","type":"page","pattern":"^\\/app\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/index.astro","pathname":"/app","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"styles":[],"routeData":{"route":"/app/account","type":"page","pattern":"^\\/app\\/account\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}],[{"content":"account","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/account.astro","pathname":"/app/account","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[{"type":"external","value":"/_astro/hoisted.9d9d7ac4.js"}],"styles":[{"type":"external","src":"/_astro/_...slug_.b19aabfc.css"}],"routeData":{"route":"/[...slug]","type":"page","pattern":"^(?:\\/(.*?))?\\/?$","segments":[[{"content":"...slug","dynamic":true,"spread":true}]],"params":["...slug"],"component":"src/pages/[...slug].astro","prerender":false,"_meta":{"trailingSlash":"ignore"}}}],"site":"https://ecom2-demo.web.app","base":"/","compressHTML":false,"markdown":{"drafts":false,"syntaxHighlight":"shiki","shikiConfig":{"langs":[],"theme":"github-dark","wrap":false},"remarkPlugins":[],"rehypePlugins":[],"remarkRehype":{},"gfm":true,"smartypants":true},"componentMetadata":[["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro",{"propagation":"none","containsHead":true}],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/fallback.astro",{"propagation":"none","containsHead":true}],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro",{"propagation":"none","containsHead":true}]],"renderers":[],"clientDirectives":[["idle","(()=>{var i=t=>{let e=async()=>{await(await t())()};\"requestIdleCallback\"in window?window.requestIdleCallback(e):setTimeout(e,200)};(self.Astro||(self.Astro={})).idle=i;window.dispatchEvent(new Event(\"astro:idle\"));})();"],["load","(()=>{var e=async t=>{await(await t())()};(self.Astro||(self.Astro={})).load=e;window.dispatchEvent(new Event(\"astro:load\"));})();"],["media","(()=>{var s=(i,t)=>{let a=async()=>{await(await i())()};if(t.value){let e=matchMedia(t.value);e.matches?a():e.addEventListener(\"change\",a,{once:!0})}};(self.Astro||(self.Astro={})).media=s;window.dispatchEvent(new Event(\"astro:media\"));})();"],["only","(()=>{var e=async t=>{await(await t())()};(self.Astro||(self.Astro={})).only=e;window.dispatchEvent(new Event(\"astro:only\"));})();"],["visible","(()=>{var r=(i,c,n)=>{let s=async()=>{await(await i())()},t=new IntersectionObserver(e=>{for(let o of e)if(o.isIntersecting){t.disconnect(),s();break}});for(let e of n.children)t.observe(e)};(self.Astro||(self.Astro={})).visible=r;window.dispatchEvent(new Event(\"astro:visible\"));})();"]],"entryModules":{"\u0000@astrojs-ssr-virtual-entry":"_@astrojs-ssr-virtual-entry.mjs","\u0000@astro-renderers":"renderers.mjs","\u0000empty-middleware":"_empty-middleware.mjs","/src/pages/app/account.astro":"chunks/pages/account.astro.f630663e.mjs","/src/pages/fallback.astro":"chunks/pages/fallback.astro.3ebb4e85.mjs","\u0000@astro-page:../../node_modules/.pnpm/@astrojs+image@0.17.2_astro@2.8.0_sharp@0.32.1/node_modules/@astrojs/image/dist/endpoint@_@js":"chunks/endpoint@_@js.e9171d18.mjs","\u0000@astro-page:src/pages/index@_@astro":"chunks/index@_@astro.de13f221.mjs","\u0000@astro-page:src/pages/fallback@_@astro":"chunks/fallback@_@astro.4a1f8c08.mjs","\u0000@astro-page:src/pages/app/index@_@astro":"chunks/index@_@astro.7472fe37.mjs","\u0000@astro-page:src/pages/app/account@_@astro":"chunks/account@_@astro.97e06bd2.mjs","\u0000@astro-page:src/pages/[...slug]@_@astro":"chunks/_...ed1d4ed7.mjs","/astro/hoisted.js?q=0":"_astro/hoisted.9d9d7ac4.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/workbox-window/build/workbox-window.prod.es5.mjs":"_astro/workbox-window.prod.es5.a7b12eab.js","~/components/HeroSlider.vue":"_astro/HeroSlider.359c76cc.js","~/components/PitchBar.vue":"_astro/PitchBar.75d2999f.js","~/components/ProductShelf.vue":"_astro/ProductShelf.83c66e3e.js","@astrojs/vue/client.js":"_astro/client.24201f93.js","~/components/Prices.vue":"_astro/Prices.bd0d3474.js","~/components/ShopHeader.vue":"_astro/ShopHeader.f66a56cb.js","/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/scripts/firebase-app.ts":"_astro/firebase-app.84207480.js","astro:scripts/before-hydration.js":""},"assets":["/_astro/_...slug_.b19aabfc.css","/manifest.webmanifest","/robots.txt","/sw.js","/workbox-5e0bf4e4.js","/_astro/Carousel.533b4b19.js","/_astro/HeroSlider.359c76cc.js","/_astro/PitchBar.75d2999f.js","/_astro/Prices.bd0d3474.js","/_astro/ProductShelf.83c66e3e.js","/_astro/ShopHeader.f66a56cb.js","/_astro/_plugin-vue_export-helper.4e6dc3af.js","/_astro/api.7f62c1ff.js","/_astro/client.24201f93.js","/_astro/firebase-app.84207480.js","/_astro/hoisted.9d9d7ac4.js","/_astro/img.22ad29ec.js","/_astro/index.ddc27a3a.js","/_astro/modules-info.d6bd555b.js","/_astro/preload-helper.cf010ec4.js","/_astro/runtime-dom.esm-bundler.578d6e91.js","/_astro/session-utm.744b0db3.js","/_astro/workbox-window.prod.es5.a7b12eab.js","/assets/cms-preview.css","/assets/cms.css","/assets/cvv.png","/assets/img-placeholder.png","/assets/payments.png","/assets/ssl-safe.png","/img/icon.png","/img/large-icon.png","/img/uploads/banner1.png","/img/uploads/banner2.png","/img/uploads/banner2.webp","/img/uploads/ecom-icon.png","/img/uploads/favicon.png","/img/uploads/headless.png","/img/uploads/headphone.png","/img/uploads/headphone.webp","/img/uploads/logo.png","/img/uploads/og-image.png","/img/uploads/passion.png","/img/uploads/passion.webp","/img/uploads/pwa-reliable.png","/img/uploads/rect8589.png","/img/uploads/rect859.png","/img/uploads/rect89.png","/img/uploads/rect89.webp","/img/uploads/ssl-safe.png"]}), {
|
|
2834
2834
|
pageMap,
|
|
2835
2835
|
renderers,
|
|
2836
2836
|
});
|
|
@@ -2,7 +2,7 @@ import { h as server_default } from './chunks/astro.2df8d1c5.mjs';
|
|
|
2
2
|
import { useSSRContext, defineComponent, computed, mergeProps, h, createSSRApp } from 'vue';
|
|
3
3
|
import { ssrRenderSlotInner, ssrRenderAttrs, ssrRenderSlot, renderToString } from 'vue/server-renderer';
|
|
4
4
|
import { img, imgSizes, i18n, formatMoney } from '@ecomplus/utils';
|
|
5
|
-
import { _ as _export_sfc } from './chunks/pages/_...slug_.astro.
|
|
5
|
+
import { _ as _export_sfc } from './chunks/pages/_...slug_.astro.9e731356.mjs';
|
|
6
6
|
import 'path-to-regexp';
|
|
7
7
|
import 'cookie';
|
|
8
8
|
import '@astrojs/internal-helpers/path';
|
|
@@ -220,7 +220,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
220
220
|
props: {
|
|
221
221
|
picture: {},
|
|
222
222
|
loading: { default: "lazy" },
|
|
223
|
-
decoding: {}
|
|
223
|
+
decoding: {},
|
|
224
|
+
alt: {}
|
|
224
225
|
},
|
|
225
226
|
setup(__props, { expose: __expose }) {
|
|
226
227
|
__expose();
|
|
@@ -236,7 +237,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
236
237
|
});
|
|
237
238
|
const attrs = computed(() => ({
|
|
238
239
|
src: image.value.url,
|
|
239
|
-
alt: image.value.alt,
|
|
240
|
+
alt: image.value.alt || props.alt,
|
|
240
241
|
width: dimensions.value.width || void 0,
|
|
241
242
|
height: dimensions.value.height || void 0,
|
|
242
243
|
loading: props.loading,
|
|
@@ -11,6 +11,7 @@ export interface Props {
|
|
|
11
11
|
placement?: 'start' | 'end' | 'top' | 'bottom';
|
|
12
12
|
position?: 'fixed' | 'absolute';
|
|
13
13
|
hasCloseButton?: boolean;
|
|
14
|
+
backdropTarget?: string;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -18,6 +19,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
18
19
|
placement: 'start',
|
|
19
20
|
position: 'fixed',
|
|
20
21
|
hasCloseButton: true,
|
|
22
|
+
backdropTarget: '#teleported-top',
|
|
21
23
|
});
|
|
22
24
|
const emit = defineEmits([
|
|
23
25
|
'update:modelValue',
|
|
@@ -75,7 +77,9 @@ const isPlacementX = computed(() => {
|
|
|
75
77
|
class="w-screen shadow p-0 m-0 z-50"
|
|
76
78
|
:class="[
|
|
77
79
|
position,
|
|
78
|
-
isFixed ? `top-0
|
|
80
|
+
isFixed ? `top-0 ${(isPlacementX ? 'h-screen' : '')}` : null,
|
|
81
|
+
isFixed && placement !== 'end' ? 'left-0' : null,
|
|
82
|
+
isFixed && placement === 'end' ? 'left-auto right-0' : null,
|
|
79
83
|
isPlacementX ? 'max-w-sm' : null,
|
|
80
84
|
]"
|
|
81
85
|
:style="{
|
|
@@ -100,7 +104,7 @@ const isPlacementX = computed(() => {
|
|
|
100
104
|
</button>
|
|
101
105
|
<slot />
|
|
102
106
|
</div>
|
|
103
|
-
<Teleport to="
|
|
107
|
+
<Teleport :to="backdropTarget">
|
|
104
108
|
<Fade>
|
|
105
109
|
<div
|
|
106
110
|
v-if="modelValue"
|
|
@@ -22,6 +22,7 @@ export interface Props {
|
|
|
22
22
|
};
|
|
23
23
|
loading?: 'lazy' | 'eager';
|
|
24
24
|
decoding?: 'async' | 'sync' | 'auto';
|
|
25
|
+
alt?: string;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -38,7 +39,7 @@ const dimensions = computed(() => {
|
|
|
38
39
|
});
|
|
39
40
|
const attrs = computed<ImgHTMLAttributes>(() => ({
|
|
40
41
|
src: image.value.url,
|
|
41
|
-
alt: image.value.alt,
|
|
42
|
+
alt: image.value.alt || props.alt,
|
|
42
43
|
width: dimensions.value.width || undefined,
|
|
43
44
|
height: dimensions.value.height || undefined,
|
|
44
45
|
loading: props.loading,
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { Products, ListPaymentsResponse } from '@cloudcommerce/types';
|
|
2
2
|
import { computed } from 'vue';
|
|
3
3
|
import { price as getPrice, onPromotion as checkOnPromotion } from '@ecomplus/utils';
|
|
4
|
-
import
|
|
4
|
+
import {
|
|
5
|
+
installmentsOption,
|
|
6
|
+
discountOption,
|
|
7
|
+
loyaltyPointsPrograms,
|
|
8
|
+
availableExtraDiscount,
|
|
9
|
+
} from '@@sf/state/modules-info';
|
|
5
10
|
|
|
6
11
|
export interface Props {
|
|
7
12
|
product?: Partial<Products> & { final_price?: number } &
|
|
@@ -54,12 +59,9 @@ const usePrices = (props: Props) => {
|
|
|
54
59
|
}
|
|
55
60
|
return false;
|
|
56
61
|
});
|
|
57
|
-
const extraDiscount = computed(() => {
|
|
58
|
-
return modulesInfo.apply_discount.available_extra_discount;
|
|
59
|
-
});
|
|
60
62
|
const salePrice = computed(() => {
|
|
61
63
|
const price = getPrice(_product.value);
|
|
62
|
-
const discount =
|
|
64
|
+
const discount = availableExtraDiscount.value;
|
|
63
65
|
if (discount && (!discount.min_amount || price > discount.min_amount)) {
|
|
64
66
|
return getPriceWithDiscount(price, discount);
|
|
65
67
|
}
|
|
@@ -78,7 +80,7 @@ const usePrices = (props: Props) => {
|
|
|
78
80
|
|
|
79
81
|
const installmentsObject = computed(() => {
|
|
80
82
|
return props.installmentsOption
|
|
81
|
-
||
|
|
83
|
+
|| installmentsOption.value
|
|
82
84
|
|| { max_number: 1 };
|
|
83
85
|
});
|
|
84
86
|
const installmentsNumber = computed(() => {
|
|
@@ -105,7 +107,7 @@ const usePrices = (props: Props) => {
|
|
|
105
107
|
});
|
|
106
108
|
|
|
107
109
|
const discountObject = computed(() => {
|
|
108
|
-
const discount = props.discountOption ||
|
|
110
|
+
const discount = props.discountOption || discountOption.value;
|
|
109
111
|
if (
|
|
110
112
|
discount
|
|
111
113
|
&& (!discount.min_amount || discount.min_amount <= salePrice.value)
|
|
@@ -133,7 +135,7 @@ const usePrices = (props: Props) => {
|
|
|
133
135
|
if (props.loyaltyPointsProgram) {
|
|
134
136
|
return props.loyaltyPointsProgram;
|
|
135
137
|
}
|
|
136
|
-
const pointsPrograms =
|
|
138
|
+
const pointsPrograms = loyaltyPointsPrograms.value;
|
|
137
139
|
if (pointsPrograms) {
|
|
138
140
|
const programIds = Object.keys(pointsPrograms);
|
|
139
141
|
for (let i = 0; i < programIds.length; i++) {
|
|
@@ -11,11 +11,11 @@ const { settings } = Astro.locals.routeContext;
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
13
|
<body>
|
|
14
|
-
<div id="teleported-overlap" class="relative z-
|
|
15
|
-
<div id="teleported-top" class="relative z-
|
|
14
|
+
<div id="teleported-overlap" class="relative z-[59]"></div>
|
|
15
|
+
<div id="teleported-top" class="relative z-[19]"></div>
|
|
16
16
|
<slot />
|
|
17
17
|
<slot name="before-body-end" />
|
|
18
|
-
<div id="teleported-bottom" class="relative z-
|
|
18
|
+
<div id="teleported-bottom" class="relative z-[19]"></div>
|
|
19
19
|
{settings.icon &&
|
|
20
20
|
<Picture
|
|
21
21
|
src={settings.icon}
|
|
@@ -146,6 +146,31 @@ if (!import.meta.env.SSR) {
|
|
|
146
146
|
|
|
147
147
|
export default modulesInfo;
|
|
148
148
|
|
|
149
|
+
const freeShippingFromValue = computed(() => {
|
|
150
|
+
return modulesInfo.calculate_shipping.free_shipping_from_value;
|
|
151
|
+
});
|
|
152
|
+
const installmentsOption = computed(() => {
|
|
153
|
+
return modulesInfo.list_payments.installments_option;
|
|
154
|
+
});
|
|
155
|
+
const discountOption = computed(() => {
|
|
156
|
+
return modulesInfo.list_payments.discount_option;
|
|
157
|
+
});
|
|
158
|
+
const loyaltyPointsPrograms = computed(() => {
|
|
159
|
+
return modulesInfo.list_payments.loyalty_points_programs;
|
|
160
|
+
});
|
|
161
|
+
const availableExtraDiscount = computed(() => {
|
|
162
|
+
return modulesInfo.apply_discount.available_extra_discount;
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
export {
|
|
166
|
+
modulesInfo,
|
|
167
|
+
freeShippingFromValue,
|
|
168
|
+
installmentsOption,
|
|
169
|
+
discountOption,
|
|
170
|
+
loyaltyPointsPrograms,
|
|
171
|
+
availableExtraDiscount,
|
|
172
|
+
};
|
|
173
|
+
|
|
149
174
|
const parsePhrase = <T extends keyof typeof modulesInfo>(
|
|
150
175
|
phrase: string,
|
|
151
176
|
modName: T,
|
|
@@ -45,6 +45,11 @@ const subtotal = computed(() => {
|
|
|
45
45
|
return acc + (item.quantity * (item.final_price || item.price));
|
|
46
46
|
}, 0);
|
|
47
47
|
});
|
|
48
|
+
const totalItems = computed(() => {
|
|
49
|
+
return cartItems.value.reduce((acc, item) => {
|
|
50
|
+
return acc + item.quantity;
|
|
51
|
+
}, 0);
|
|
52
|
+
});
|
|
48
53
|
const shoppingCart = computed({
|
|
49
54
|
get() {
|
|
50
55
|
return {
|
|
@@ -77,6 +82,7 @@ const addProductToCart = (
|
|
|
77
82
|
export default shoppingCart;
|
|
78
83
|
|
|
79
84
|
export {
|
|
85
|
+
totalItems,
|
|
80
86
|
shoppingCart,
|
|
81
87
|
addCartItem,
|
|
82
88
|
parseProduct,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Please refer to GitHub [repository releases](https://github.com/ecomplus/cloud-commerce/releases) or monorepo unified [CHANGELOG.md](https://github.com/ecomplus/cloud-commerce/blob/main/CHANGELOG.md).
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# `@cloudcommerce/app-infinitepay`
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
(function () {
|
|
3
|
-
window._infiniteHashCard = function (cardClient) {
|
|
4
|
-
return new Promise((resolve, reject) => {
|
|
5
|
-
const elementsForm = `
|
|
6
|
-
<input type="text" data-ip="method" value="credit_card" style="display: none;>
|
|
7
|
-
<input type="text" data-ip="card-cvv" value="${cardClient.cvc}" style="display: none;">
|
|
8
|
-
<input type="text" data-ip="card-number" value="${cardClient.number}" style="display: none;">
|
|
9
|
-
<input type="text" data-ip="card-expiration-month" value="${cardClient.month.toString()}" style="display: none;">
|
|
10
|
-
<input type="text" data-ip="card-expiration-year" value="${cardClient.year.toString()}" style="display: none;">
|
|
11
|
-
<input type="text" data-ip="card-holder-name" value="${cardClient.name}" style="display: none;">
|
|
12
|
-
<input type="text" data-ip="card-holder-document" value="${cardClient.doc}" style="display: none;">`
|
|
13
|
-
|
|
14
|
-
const newForm = document.createElement('form')
|
|
15
|
-
newForm.setAttribute('id', 'formIP')
|
|
16
|
-
newForm.innerHTML = elementsForm
|
|
17
|
-
|
|
18
|
-
document.body.appendChild(newForm)
|
|
19
|
-
|
|
20
|
-
const access_token = window._infiniteJwtTokenCard
|
|
21
|
-
// const sandbox = window._infiniteCardSandbox
|
|
22
|
-
const form = document.querySelector('#formIP')
|
|
23
|
-
const ipay = new IPay({ access_token })
|
|
24
|
-
// console.log('ipay ', ipay)
|
|
25
|
-
ipay.listeners = {
|
|
26
|
-
'result:success': function () {
|
|
27
|
-
// form.submit() // sucesso, continue o pagamento
|
|
28
|
-
console.log('Tokenize OK')
|
|
29
|
-
const token = document.querySelector("[name='ip[token]']").value
|
|
30
|
-
const sessionId = document.querySelector("[name='ip[session_id]']").value
|
|
31
|
-
const card = {
|
|
32
|
-
token,
|
|
33
|
-
cvv: cardClient.cvc,
|
|
34
|
-
card_holder_name: cardClient.name
|
|
35
|
-
}
|
|
36
|
-
const metadata = {
|
|
37
|
-
origin: 'ecomplus',
|
|
38
|
-
store_url: window.location.hostname,
|
|
39
|
-
risk: {
|
|
40
|
-
session_id: sessionId
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const json = JSON.stringify({ card, metadata })
|
|
44
|
-
const data = window.btoa(json)
|
|
45
|
-
resolve(data)
|
|
46
|
-
},
|
|
47
|
-
'result:error': function (errors) {
|
|
48
|
-
console.log('error: ')
|
|
49
|
-
console.log(errors) // erro da tokenização, mostra no console
|
|
50
|
-
reject(errors)
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
ipay.generate(form)
|
|
55
|
-
})
|
|
56
|
-
}
|
|
57
|
-
}())
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { ListPaymentsResponse } from '@cloudcommerce/types';
|
|
2
|
-
type Gateway = ListPaymentsResponse['payment_gateways'][number];
|
|
3
|
-
declare const addInstallments: (total: number | undefined, installments: {
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
}, gateway: Gateway, response?: ListPaymentsResponse) => {
|
|
6
|
-
response: ListPaymentsResponse | undefined;
|
|
7
|
-
gateway: {
|
|
8
|
-
label: string;
|
|
9
|
-
text?: string | undefined;
|
|
10
|
-
icon?: string | undefined;
|
|
11
|
-
intermediator?: {
|
|
12
|
-
name?: string | undefined;
|
|
13
|
-
link?: string | undefined;
|
|
14
|
-
code: string;
|
|
15
|
-
} | undefined;
|
|
16
|
-
payment_url?: string | undefined;
|
|
17
|
-
type?: "payment" | "recurrence" | undefined;
|
|
18
|
-
payment_method: {
|
|
19
|
-
code: "credit_card" | "banking_billet" | "online_debit" | "account_deposit" | "debit_card" | "balance_on_intermediary" | "loyalty_points" | "other";
|
|
20
|
-
name?: string | undefined;
|
|
21
|
-
};
|
|
22
|
-
discount?: {
|
|
23
|
-
apply_at?: "total" | "subtotal" | "freight" | undefined;
|
|
24
|
-
type?: "fixed" | "percentage" | undefined;
|
|
25
|
-
value?: number | undefined;
|
|
26
|
-
} | undefined;
|
|
27
|
-
card_companies?: string[] | undefined;
|
|
28
|
-
installment_options?: {
|
|
29
|
-
number: number;
|
|
30
|
-
value: number;
|
|
31
|
-
tax?: boolean | undefined;
|
|
32
|
-
}[] | undefined;
|
|
33
|
-
js_client?: {
|
|
34
|
-
script_uri: string;
|
|
35
|
-
fallback_script_uri?: string | undefined;
|
|
36
|
-
onload_expression?: string | undefined;
|
|
37
|
-
container_html?: string | undefined;
|
|
38
|
-
transaction_promise?: string | undefined;
|
|
39
|
-
cc_hash?: {
|
|
40
|
-
function: string;
|
|
41
|
-
is_promise?: boolean | undefined;
|
|
42
|
-
} | undefined;
|
|
43
|
-
cc_installments?: {
|
|
44
|
-
function: string;
|
|
45
|
-
is_promise?: boolean | undefined;
|
|
46
|
-
} | undefined;
|
|
47
|
-
cc_brand?: {
|
|
48
|
-
function: string;
|
|
49
|
-
is_promise?: boolean | undefined;
|
|
50
|
-
} | undefined;
|
|
51
|
-
} | undefined;
|
|
52
|
-
fetch_when_selected?: boolean | undefined;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
export default addInstallments;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
const standardMonthlyInterest = [
|
|
2
|
-
4.20,
|
|
3
|
-
1.3390,
|
|
4
|
-
1.5041,
|
|
5
|
-
1.5992,
|
|
6
|
-
1.6630,
|
|
7
|
-
1.7057,
|
|
8
|
-
2.3454,
|
|
9
|
-
2.3053,
|
|
10
|
-
2.2755,
|
|
11
|
-
2.2490,
|
|
12
|
-
2.2306,
|
|
13
|
-
2.2111,
|
|
14
|
-
];
|
|
15
|
-
const addInstallments = (total, installments, gateway, response) => {
|
|
16
|
-
const maxInterestFree = installments.max_interest_free;
|
|
17
|
-
const minInstallment = installments.min_installment || 5;
|
|
18
|
-
const qtyPosssibleInstallment = total ? Math.floor((total / minInstallment)) : 12;
|
|
19
|
-
const maxInstallments = installments.max_number
|
|
20
|
-
|| (qtyPosssibleInstallment < 12 ? qtyPosssibleInstallment : 12);
|
|
21
|
-
const monthlyInterest = installments.monthly_interest || 0;
|
|
22
|
-
let monthlyInstallmentInterest = 0;
|
|
23
|
-
if (maxInterestFree <= 1) {
|
|
24
|
-
const IPInterestMonthly = standardMonthlyInterest[maxInstallments - 1];
|
|
25
|
-
monthlyInstallmentInterest = (monthlyInterest > IPInterestMonthly ? monthlyInterest
|
|
26
|
-
: IPInterestMonthly);
|
|
27
|
-
}
|
|
28
|
-
if (maxInstallments > 1) {
|
|
29
|
-
if (response) {
|
|
30
|
-
response.installments_option = {
|
|
31
|
-
min_installment: minInstallment,
|
|
32
|
-
max_number: maxInterestFree > 1 ? maxInterestFree : maxInstallments,
|
|
33
|
-
monthly_interest: monthlyInstallmentInterest,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
// list installment options
|
|
37
|
-
gateway.installment_options = [];
|
|
38
|
-
if (total) {
|
|
39
|
-
for (let number = 2; number <= maxInstallments; number++) {
|
|
40
|
-
const tax = !(maxInterestFree >= number);
|
|
41
|
-
let interest;
|
|
42
|
-
if (tax) {
|
|
43
|
-
const IPMonthInterestRate = standardMonthlyInterest[number - 1];
|
|
44
|
-
interest = (monthlyInterest > IPMonthInterestRate ? monthlyInterest : IPMonthInterestRate)
|
|
45
|
-
/ 100;
|
|
46
|
-
}
|
|
47
|
-
const value = !tax ? (total / number)
|
|
48
|
-
: total * (interest / (1 - (1 + interest) ** -number));
|
|
49
|
-
if (value && value >= 1) {
|
|
50
|
-
gateway.installment_options.push({
|
|
51
|
-
number,
|
|
52
|
-
value,
|
|
53
|
-
tax,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return { response, gateway };
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export default addInstallments;
|
|
63
|
-
// # sourceMappingURL=add-installments.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-installments.js","sourceRoot":"","sources":["../../src/functions-lib/add-installments.ts"],"names":[],"mappings":"AAEA,MAAM,uBAAuB,GAAG;IAC9B,IAAI;IACJ,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;CACP,CAAC;AAIF,MAAM,eAAe,GAAG,CACtB,KAAyB,EACzB,YAAoC,EACpC,OAAgB,EAChB,QAA+B,EAC/B,EAAE;IACF,MAAM,eAAe,GAAG,YAAY,CAAC,iBAAiB,CAAC;IACvD,MAAM,cAAc,GAAG,YAAY,CAAC,eAAe,IAAI,CAAC,CAAC;IACzD,MAAM,uBAAuB,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAClF,MAAM,eAAe,GAAG,YAAY,CAAC,UAAU;WAC1C,CAAC,uBAAuB,GAAG,EAAE,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAEnE,MAAM,eAAe,GAAG,YAAY,CAAC,gBAAgB,IAAI,CAAC,CAAC;IAC3D,IAAI,0BAA0B,GAAG,CAAC,CAAC;IAEnC,IAAI,eAAe,IAAI,CAAC,EAAE;QACxB,MAAM,iBAAiB,GAAG,uBAAuB,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC;QAEvE,0BAA0B,GAAG,CAAC,eAAe,GAAG,iBAAiB,CAAC,CAAC,CAAC,eAAe;YACjF,CAAC,CAAC,iBAAiB,CAAC,CAAC;KACxB;IAED,IAAI,eAAe,GAAG,CAAC,EAAE;QACvB,IAAI,QAAQ,EAAE;YACZ,QAAQ,CAAC,mBAAmB,GAAG;gBAC7B,eAAe,EAAE,cAAc;gBAC/B,UAAU,EAAE,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe;gBACnE,gBAAgB,EAAE,0BAA0B;aAC7C,CAAC;SACH;QAED,2BAA2B;QAC3B,OAAO,CAAC,mBAAmB,GAAG,EAAE,CAAC;QACjC,IAAI,KAAK,EAAE;YACT,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,EAAE,EAAE;gBACxD,MAAM,GAAG,GAAG,CAAC,CAAC,eAAe,IAAI,MAAM,CAAC,CAAC;gBACzC,IAAI,QAAQ,CAAC;gBACb,IAAI,GAAG,EAAE;oBACP,MAAM,mBAAmB,GAAG,uBAAuB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;oBAChE,QAAQ,GAAG,CAAC,eAAe,GAAG,mBAAmB,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,mBAAmB,CAAC;0BACtF,GAAG,CAAC;iBACT;gBACD,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC;oBACnC,CAAC,CAAC,KAAK,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;gBAEzD,IAAI,KAAK,IAAI,KAAK,IAAI,CAAC,EAAE;oBACvB,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC;wBAC/B,MAAM;wBACN,KAAK;wBACL,GAAG;qBACJ,CAAC,CAAC;iBACJ;aACF;SACF;KACF;IACD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAC/B,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { AxiosInstance } from 'axios';
|
|
2
|
-
type Option = {
|
|
3
|
-
clientId?: string;
|
|
4
|
-
clientSecret?: string;
|
|
5
|
-
typeScope: string;
|
|
6
|
-
isSandbox?: boolean;
|
|
7
|
-
};
|
|
8
|
-
export default class IPAxios {
|
|
9
|
-
preparing: Promise<unknown>;
|
|
10
|
-
axios: AxiosInstance | undefined;
|
|
11
|
-
cardTokenization: string | undefined;
|
|
12
|
-
constructor(options: Option);
|
|
13
|
-
}
|
|
14
|
-
export {};
|