@lookiero/checkout 10.0.0-beta.1 → 10.0.0-beta.2

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.
@@ -72,7 +72,7 @@ const useCheckoutFlow = ({ checkout: checkoutProjection, order: orderProjection,
72
72
  paymentFlowRef.current?.startLegacyBoxCheckout({
73
73
  ...paymentFlowPayload,
74
74
  userInformation: { email, name },
75
- returnUrl: `${basePath}/${Routes.CHECKOUT}`,
75
+ returnUrl: `${basePath}/${Routes.CHECKOUT}?foo=bar`,
76
76
  });
77
77
  }, [
78
78
  checkoutProjection?.checkoutBookingId,
@@ -84,10 +84,6 @@ const useCheckoutFlow = ({ checkout: checkoutProjection, order: orderProjection,
84
84
  blockCheckoutBooking,
85
85
  queryBus,
86
86
  ]);
87
- const handleOnCheckoutFlowSuccess = useCallback(() => {
88
- trackCheckout();
89
- onSuccess();
90
- }, [onSuccess, trackCheckout]);
91
87
  const onPaymentSuccess = useCallback(async () => {
92
88
  setStartLegacyBoxCheckoutStatus("success");
93
89
  await submitCheckoutCommand();
@@ -95,7 +91,9 @@ const useCheckoutFlow = ({ checkout: checkoutProjection, order: orderProjection,
95
91
  bodyI18nKey: I18nMessages.CHECKOUT_TOAST_PAYMENT_SUCCESS,
96
92
  level: NotificationLevel.SUCCESS,
97
93
  });
98
- }, [createNotification, submitCheckoutCommand]);
94
+ trackCheckout();
95
+ onSuccess();
96
+ }, [createNotification, onSuccess, submitCheckoutCommand, trackCheckout]);
99
97
  const onPaymentError = useCallback((payload) => {
100
98
  setStartLegacyBoxCheckoutStatus("error");
101
99
  createNotification({
@@ -123,12 +121,6 @@ const useCheckoutFlow = ({ checkout: checkoutProjection, order: orderProjection,
123
121
  }
124
122
  return "idle";
125
123
  }, [blockCheckoutBookingStatus, startLegacyBoxCheckoutStatus, submitCheckoutCommandStatus, checkoutBookingExpired]);
126
- useEffect(() => {
127
- if (checkoutFlowStatus !== "success") {
128
- return;
129
- }
130
- handleOnCheckoutFlowSuccess();
131
- }, [handleOnCheckoutFlowSuccess, checkoutFlowStatus]);
132
124
  const paymentFlow = useMemo(() => (authToken ? React.createElement(PaymentFlow, { ref: paymentFlowRef, section: Section.BOX_CHECKOUT, token: authToken }) : null), [authToken]);
133
125
  return useMemo(() => [checkoutFlow, checkoutFlowStatus, paymentFlow], [checkoutFlow, paymentFlow, checkoutFlowStatus]);
134
126
  };
@@ -1 +1 @@
1
- export declare const VERSION = "10.0.0-beta.1";
1
+ export declare const VERSION = "10.0.0-beta.2";
@@ -1 +1 @@
1
- export const VERSION = "10.0.0-beta.1";
1
+ export const VERSION = "10.0.0-beta.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "10.0.0-beta.1",
3
+ "version": "10.0.0-beta.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": "false",
@@ -120,7 +120,7 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
120
120
  paymentFlowRef.current?.startLegacyBoxCheckout({
121
121
  ...paymentFlowPayload,
122
122
  userInformation: { email, name },
123
- returnUrl: `${basePath}/${Routes.CHECKOUT}`,
123
+ returnUrl: `${basePath}/${Routes.CHECKOUT}?foo=bar`,
124
124
  } as unknown as LegacyBoxCheckoutStrategyPayload);
125
125
  }, [
126
126
  checkoutProjection?.checkoutBookingId,
@@ -132,10 +132,6 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
132
132
  blockCheckoutBooking,
133
133
  queryBus,
134
134
  ]);
135
- const handleOnCheckoutFlowSuccess = useCallback(() => {
136
- trackCheckout();
137
- onSuccess();
138
- }, [onSuccess, trackCheckout]);
139
135
 
140
136
  const onPaymentSuccess = useCallback(async () => {
141
137
  setStartLegacyBoxCheckoutStatus("success");
@@ -146,7 +142,10 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
146
142
  bodyI18nKey: I18nMessages.CHECKOUT_TOAST_PAYMENT_SUCCESS,
147
143
  level: NotificationLevel.SUCCESS,
148
144
  });
149
- }, [createNotification, submitCheckoutCommand]);
145
+
146
+ trackCheckout();
147
+ onSuccess();
148
+ }, [createNotification, onSuccess, submitCheckoutCommand, trackCheckout]);
150
149
  const onPaymentError = useCallback(
151
150
  (payload: PaymentPayload) => {
152
151
  setStartLegacyBoxCheckoutStatus("error");
@@ -189,14 +188,6 @@ const useCheckoutFlow: UseCheckoutFlowFunction = ({
189
188
  return "idle";
190
189
  }, [blockCheckoutBookingStatus, startLegacyBoxCheckoutStatus, submitCheckoutCommandStatus, checkoutBookingExpired]);
191
190
 
192
- useEffect(() => {
193
- if (checkoutFlowStatus !== "success") {
194
- return;
195
- }
196
-
197
- handleOnCheckoutFlowSuccess();
198
- }, [handleOnCheckoutFlowSuccess, checkoutFlowStatus]);
199
-
200
191
  const paymentFlow = useMemo(
201
192
  () => (authToken ? <PaymentFlow ref={paymentFlowRef} section={Section.BOX_CHECKOUT} token={authToken} /> : null),
202
193
  [authToken],