@sonic-equipment/ui 258.0.1 → 258.0.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.
package/dist/index.js CHANGED
@@ -237,7 +237,7 @@ export { CheckoutPageSectionHeader } from './pages/checkout/layouts/checkout-pag
237
237
  export { CheckoutPageSectionLink } from './pages/checkout/layouts/checkout-page-layout/components/checkout-page-section-link.js';
238
238
  export { OrderConfirmationPage } from './pages/checkout/order-confirmation-page/order-confirmation-page.js';
239
239
  export { OrderConfirmationPageContent } from './pages/checkout/order-confirmation-page/order-confirmation-page-content.js';
240
- export { AdyenPayment, getAdyenQueryParams } from './pages/checkout/payment-page/components/adyen-payment.js';
240
+ export { AdyenPayment, getAdyenQueryParams, removeAdyenQueryParamsFromUrl } from './pages/checkout/payment-page/components/adyen-payment.js';
241
241
  export { Payment } from './pages/checkout/payment-page/components/payment.js';
242
242
  export { useGetAdyenRedirectResult } from './pages/checkout/payment-page/hooks/use-get-adyen-redirect-result.js';
243
243
  export { useHasReturnedFromAdyen } from './pages/checkout/payment-page/hooks/use-has-returned-from-adyen.js';
@@ -27,4 +27,5 @@ export declare function getAdyenQueryParams(): {
27
27
  customerId: string | undefined;
28
28
  redirectResult: string | undefined;
29
29
  };
30
+ export declare function removeAdyenQueryParamsFromUrl(): void;
30
31
  export {};
@@ -105,6 +105,8 @@ function AdyenPayment({ amount, cartId, countryCode, currencyCode, customerId, d
105
105
  const dropIn = checkout.create('dropin');
106
106
  if (redirectResult) {
107
107
  checkout.submitDetails({ details: { redirectResult } });
108
+ removeAdyenQueryParamsFromUrl();
109
+ queryStringParams.current = {};
108
110
  }
109
111
  if (dropinRef.current)
110
112
  dropinRef.current.unmount();
@@ -176,6 +178,20 @@ async function handlePaymentResponse(result, onSubmit, onError) {
176
178
  onError(error, result);
177
179
  }
178
180
  }
181
+ function removeAdyenQueryParamsFromUrl() {
182
+ if (typeof window === 'undefined')
183
+ return;
184
+ try {
185
+ const url = new URL(window.location.href);
186
+ url.searchParams.delete('amount');
187
+ url.searchParams.delete('customerId');
188
+ url.searchParams.delete('redirectResult');
189
+ window.history.replaceState(null, '', url.toString());
190
+ }
191
+ catch (error) {
192
+ logger.error(error);
193
+ }
194
+ }
179
195
  function handleRedirectPaymentAction(adyenPaymentResult) {
180
196
  if (typeof window === 'undefined' || typeof document === 'undefined')
181
197
  return;
@@ -198,4 +214,4 @@ function handleRedirectPaymentAction(adyenPaymentResult) {
198
214
  }
199
215
  }
200
216
 
201
- export { AdyenPayment, getAdyenQueryParams };
217
+ export { AdyenPayment, getAdyenQueryParams, removeAdyenQueryParamsFromUrl };
@@ -22,23 +22,9 @@ import { useDataLayer } from '../../../../shared/ga/use-data-layer.js';
22
22
  import { getCurrencyCodeBySymbol } from '../../../../shared/model/currency.js';
23
23
  import { isProductionEnvironment } from '../../../../shared/utils/environment.js';
24
24
  import { BillingAndInvoiceInformation } from '../../components/billing-and-invoice-information.js';
25
- import { AdyenPayment } from './adyen-payment.js';
25
+ import { removeAdyenQueryParamsFromUrl, AdyenPayment } from './adyen-payment.js';
26
26
  import styles from './payment.module.css.js';
27
27
 
28
- function removeAdyenQueryParamsFromUrl() {
29
- if (typeof window === 'undefined')
30
- return;
31
- try {
32
- const url = new URL(window.location.href);
33
- url.searchParams.delete('amount');
34
- url.searchParams.delete('customerId');
35
- url.searchParams.delete('redirectResult');
36
- window.history.replaceState(null, '', url.toString());
37
- }
38
- catch (error) {
39
- logger.error(error);
40
- }
41
- }
42
28
  function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPaymentComplete, onProcessing, }) {
43
29
  const { createEcommerceEvent, dataLayer } = useDataLayer();
44
30
  const { mutate: patchCart } = usePatchCart();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonic-equipment/ui",
3
- "version": "258.0.1",
3
+ "version": "258.0.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "engines": {