@springmicro/cart 0.7.2 → 0.7.4

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@springmicro/cart",
3
3
  "private": false,
4
- "version": "0.7.2",
4
+ "version": "0.7.4",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "@nanostores/persistent": "^0.10.1",
25
25
  "@nanostores/query": "^0.3.3",
26
26
  "@nanostores/react": "^0.7.2",
27
- "@springmicro/utils": "0.7.2",
27
+ "@springmicro/utils": "0.7.4",
28
28
  "dotenv": "^16.4.5",
29
29
  "nanostores": "^0.10.3",
30
30
  "react": "^18.2.0",
@@ -49,5 +49,5 @@
49
49
  "vite-plugin-css-injected-by-js": "^3.5.1",
50
50
  "yup": "^1.4.0"
51
51
  },
52
- "gitHead": "baedb0de00a8f238a2356a747e69eb1754606d58"
52
+ "gitHead": "b786438d6e75f39145e05d4583a7926eda3c4bf3"
53
53
  }
@@ -39,7 +39,7 @@ import { postCheckout } from "../utils/api";
39
39
  import { CheckoutFieldsType } from ".";
40
40
  import CloseIcon from "@mui/icons-material/Close";
41
41
 
42
- async function createOrder(cart, apiBaseUrl, dev) {
42
+ async function createOrder(cart, customer_create, apiBaseUrl, dev) {
43
43
  dev && console.log("Creating order");
44
44
  // If an order has already been created and hasn't been changed, get the previous order.
45
45
  if (cart.order && cart.order.id && cart.order.reference) {
@@ -63,7 +63,7 @@ async function createOrder(cart, apiBaseUrl, dev) {
63
63
  "Content-Type": "application/json",
64
64
  },
65
65
  body: JSON.stringify({
66
- customer_id: 1,
66
+ customer_create,
67
67
  cart_data: {
68
68
  items: cart.items.map((li) => ({
69
69
  ...li,
@@ -72,6 +72,7 @@ async function createOrder(cart, apiBaseUrl, dev) {
72
72
  })),
73
73
  },
74
74
  }),
75
+ credentials: "include",
75
76
  });
76
77
  const order = await res.json();
77
78
 
@@ -146,7 +147,7 @@ export default function ReviewAndCalculateTaxes({
146
147
  dev,
147
148
  hideFields = [],
148
149
  }) {
149
- dev && console.log({ products, prices });
150
+ // dev && console.log({ products, prices });
150
151
  const [formDisabled, setFormDisabled] = useState(true);
151
152
  const [formError, setFormError] = useState(undefined);
152
153
  const theme = useTheme();
@@ -165,7 +166,15 @@ export default function ReviewAndCalculateTaxes({
165
166
  // Creates an order and calculates tax.
166
167
  dev && console.log("Cart items", cart.items);
167
168
  Promise.all([
168
- createOrder(cart, apiBaseUrl, dev),
169
+ createOrder(
170
+ cart,
171
+ {
172
+ email: values.email,
173
+ name: values.name,
174
+ },
175
+ apiBaseUrl,
176
+ dev
177
+ ),
169
178
  getTax(
170
179
  apiBaseUrl,
171
180
  taxProvider,
@@ -480,7 +489,7 @@ function CheckoutActionFields({ formik, products, prices, hideFields = [] }) {
480
489
  // console.log({ checkoutFields });
481
490
  return (
482
491
  <Box sx={{ display: "flex", flexDirection: "column", mx: 3, gap: 2 }}>
483
- {Object.keys((console.log(checkoutFields), checkoutFields))
492
+ {Object.keys(checkoutFields)
484
493
  .filter(
485
494
  (key) =>
486
495
  !["email", ...hideFields].includes(key) &&