@gem-sdk/plugin-cart-drawer 1.0.5 → 1.5.15

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.
@@ -7,6 +7,7 @@ var core = require('@gem-sdk/core');
7
7
  var react = require('react');
8
8
 
9
9
  const CartFooter = ({ checkoutUrl, price, openMode }) => {
10
+ const urlCheckout = core.useCheckoutUrl(checkoutUrl);
10
11
  const checkoutPopup = react.useRef(null);
11
12
  const money = core.useMoney(price ?? 0);
12
13
  const openCheckout = (w, h) => {
@@ -26,11 +27,11 @@ const CartFooter = ({ checkoutUrl, price, openMode }) => {
26
27
  const systemZoom = width / window.screen.availWidth;
27
28
  const left = (width - w) / 2 / systemZoom + dualScreenLeft;
28
29
  const top = (height - h) / 2 / systemZoom + dualScreenTop;
29
- checkoutPopup.current = window.open(checkoutUrl, 'checkout', `scrollbars=yes, width=${w / systemZoom}, height=${h / systemZoom}, top=${top}, left=${left}`);
30
+ checkoutPopup.current = window.open(urlCheckout, 'checkout', `scrollbars=yes, width=${w / systemZoom}, height=${h / systemZoom}, top=${top}, left=${left}`);
30
31
  checkoutPopup.current?.focus();
31
32
  }
32
33
  else {
33
- window.open(checkoutUrl);
34
+ window.open(urlCheckout);
34
35
  }
35
36
  };
36
37
  return (jsxRuntime.jsxs("div", { className: "flex flex-col gap-4 border-t border-t-g-line-3 bg-g-bg-2 px-6 pt-4 pb-8", children: [jsxRuntime.jsxs("div", { className: "g-paragraph-1 flex justify-between font-semibold", children: [jsxRuntime.jsx("span", { children: "Subtotal:" }), jsxRuntime.jsx("span", { "aria-label": "Total price", children: money.localizedString })] }), jsxRuntime.jsxs("div", { "aria-label": "Checkout", role: "button", "aria-hidden": "true", className: "g-paragraph-1 flex justify-between bg-g-brand py-3 px-4 font-semibold text-g-text-3", onClick: () => openCheckout(600, 600), style: {
@@ -1,8 +1,9 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useMoney, composeRadius } from '@gem-sdk/core';
2
+ import { useCheckoutUrl, useMoney, composeRadius } from '@gem-sdk/core';
3
3
  import { useRef } from 'react';
4
4
 
5
5
  const CartFooter = ({ checkoutUrl, price, openMode }) => {
6
+ const urlCheckout = useCheckoutUrl(checkoutUrl);
6
7
  const checkoutPopup = useRef(null);
7
8
  const money = useMoney(price ?? 0);
8
9
  const openCheckout = (w, h) => {
@@ -22,11 +23,11 @@ const CartFooter = ({ checkoutUrl, price, openMode }) => {
22
23
  const systemZoom = width / window.screen.availWidth;
23
24
  const left = (width - w) / 2 / systemZoom + dualScreenLeft;
24
25
  const top = (height - h) / 2 / systemZoom + dualScreenTop;
25
- checkoutPopup.current = window.open(checkoutUrl, 'checkout', `scrollbars=yes, width=${w / systemZoom}, height=${h / systemZoom}, top=${top}, left=${left}`);
26
+ checkoutPopup.current = window.open(urlCheckout, 'checkout', `scrollbars=yes, width=${w / systemZoom}, height=${h / systemZoom}, top=${top}, left=${left}`);
26
27
  checkoutPopup.current?.focus();
27
28
  }
28
29
  else {
29
- window.open(checkoutUrl);
30
+ window.open(urlCheckout);
30
31
  }
31
32
  };
32
33
  return (jsxs("div", { className: "flex flex-col gap-4 border-t border-t-g-line-3 bg-g-bg-2 px-6 pt-4 pb-8", children: [jsxs("div", { className: "g-paragraph-1 flex justify-between font-semibold", children: [jsx("span", { children: "Subtotal:" }), jsx("span", { "aria-label": "Total price", children: money.localizedString })] }), jsxs("div", { "aria-label": "Checkout", role: "button", "aria-hidden": "true", className: "g-paragraph-1 flex justify-between bg-g-brand py-3 px-4 font-semibold text-g-text-3", onClick: () => openCheckout(600, 600), style: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/plugin-cart-drawer",
3
- "version": "1.0.5",
3
+ "version": "1.5.15",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",