@akinon/pz-flow-payment 1.96.0-snapshot-ZERO-3620-20250915165755 → 1.97.0-snapshot-ZERO-3634-20250918132143

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/CHANGELOG.md CHANGED
@@ -1,41 +1,12 @@
1
1
  # @akinon/pz-flow-payment
2
2
 
3
- ## 1.96.0-snapshot-ZERO-3620-20250915165755
3
+ ## 1.97.0-snapshot-ZERO-3634-20250918132143
4
4
 
5
- ### Minor Changes
6
-
7
- - 69e4cc5: BRDG-14604: Refactor FlowPayment component to optimize flow initialization and cleanup logic
8
- - d8be48fb: ZERO-3422: Update fetch method to use dynamic request method in wallet complete redirection middleware
9
- - 8b1d24eb: ZERO-3422: Update fetch method to use dynamic request method in wallet complete redirection middleware
10
-
11
- ## 1.96.0-rc.61
5
+ ## 1.96.0
12
6
 
13
7
  ### Minor Changes
14
8
 
15
9
  - 69e4cc5: BRDG-14604: Refactor FlowPayment component to optimize flow initialization and cleanup logic
16
- - d8be48fb: ZERO-3422: Update fetch method to use dynamic request method in wallet complete redirection middleware
17
- - 8b1d24eb: ZERO-3422: Update fetch method to use dynamic request method in wallet complete redirection middleware
18
-
19
- ## 1.96.0-rc.60
20
-
21
- ## 1.96.0-rc.59
22
-
23
- ## 1.96.0-rc.58
24
-
25
- ## 1.96.0-rc.57
26
-
27
- ## 1.96.0-rc.56
28
-
29
- ### Minor Changes
30
-
31
- - 69e4cc5: BRDG-14604: Refactor FlowPayment component to optimize flow initialization and cleanup logic
32
-
33
- ## 1.96.0-rc.55
34
-
35
- ### Minor Changes
36
-
37
- - d8be48fb: ZERO-3422: Update fetch method to use dynamic request method in wallet complete redirection middleware
38
- - 8b1d24eb: ZERO-3422: Update fetch method to use dynamic request method in wallet complete redirection middleware
39
10
 
40
11
  ## 1.95.0
41
12
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@akinon/pz-flow-payment",
3
3
  "license": "MIT",
4
- "version": "1.96.0-snapshot-ZERO-3620-20250915165755",
4
+ "version": "1.97.0-snapshot-ZERO-3634-20250918132143",
5
5
  "main": "src/index.tsx",
6
6
  "dependencies": {
7
7
  "@checkout.com/checkout-web-components": "0.7.0-beta"
@@ -59,7 +59,6 @@ export default function FlowPayment({
59
59
  const flowComponentRef = useRef<any>(null);
60
60
  const lastAmountRef = useRef<string | null>(null);
61
61
  const isInitializingRef = useRef<boolean>(false);
62
- const walletPaymentInitialized = useRef<boolean>(false);
63
62
 
64
63
  // Memoize the amount to track actual changes
65
64
  const currentAmount = useMemo(() => {
@@ -82,11 +81,7 @@ export default function FlowPayment({
82
81
  return;
83
82
  }
84
83
 
85
- // FIX: Only call setWalletPaymentPage if not already initialized
86
- if (!walletPaymentInitialized.current) {
87
- walletPaymentInitialized.current = true;
88
- dispatch(checkoutApi.endpoints.setWalletPaymentPage.initiate({}));
89
- }
84
+ dispatch(checkoutApi.endpoints.setWalletPaymentPage.initiate({}));
90
85
  };
91
86
 
92
87
  const initFlowPaymentWebComponents = async ({
@@ -123,24 +118,16 @@ export default function FlowPayment({
123
118
  container.innerHTML = '';
124
119
  }
125
120
 
126
- // FIX: Use existing payment session instead of making another API call
121
+ // Only get fresh payment data when amount has changed from the last recorded amount
127
122
  let paymentSession = preOrder.context_extras;
128
123
 
129
- // Only get fresh payment data if we don't have a valid session
130
- if (!paymentSession && lastAmountRef.current !== currentAmount) {
131
- // Check if another call is already in progress
132
- if (!walletPaymentInitialized.current) {
133
- walletPaymentInitialized.current = true;
134
- const walletPaymentResponse = await dispatch(
135
- checkoutApi.endpoints.setWalletPaymentPage.initiate({})
136
- ).unwrap();
137
- paymentSession =
138
- walletPaymentResponse?.pre_order?.context_extras ||
139
- preOrder.context_extras;
140
- } else {
141
- // Use existing context_extras if another call was already made
142
- paymentSession = preOrder.context_extras;
143
- }
124
+ if (lastAmountRef.current !== currentAmount || !paymentSession) {
125
+ const walletPaymentResponse = await dispatch(
126
+ checkoutApi.endpoints.setWalletPaymentPage.initiate({})
127
+ ).unwrap();
128
+ paymentSession =
129
+ walletPaymentResponse?.pre_order?.context_extras ||
130
+ preOrder.context_extras;
144
131
  }
145
132
 
146
133
  // Update the last amount reference after getting fresh data
@@ -205,8 +192,6 @@ export default function FlowPayment({
205
192
  console.warn('Error destroying flow component on unmount:', error);
206
193
  }
207
194
  }
208
- // Reset initialization flag on unmount
209
- walletPaymentInitialized.current = false;
210
195
  };
211
196
  }, []);
212
197