@akinon/pz-gpay 2.0.0-beta.12 → 2.0.0-beta.14

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,63 +1,114 @@
1
1
  # @akinon/pz-gpay
2
2
 
3
- ## 2.0.0-beta.12
3
+ ## 2.0.0-beta.14
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - 1d79e32: ZERO-3540: Next.js Upgrade to 15.4.5
7
+ - 6ad72e8d: ZERO-4032: Add loading state management for payment submissions across multiple components and add safe guarding
8
8
 
9
- ## 2.0.0-beta.11
9
+ ## 2.0.0-beta.13
10
10
 
11
- ### Minor Changes
11
+ ## 1.118.0
12
12
 
13
- - ac783d6: ZERO-3482: Update tailwindcss to version 4.1.11 and enhance button cursor styles
13
+ ## 1.117.0
14
14
 
15
- ## 2.0.0-beta.10
15
+ ## 1.116.0
16
16
 
17
- ### Minor Changes
17
+ ## 1.115.0
18
18
 
19
- - 2806320: ZERO-3390: Update version tailwindcss, autoprefixer, tailwind-merge, postcss
19
+ ## 1.114.0
20
20
 
21
- ## 2.0.0-beta.9
21
+ ## 1.113.0
22
22
 
23
- ### Minor Changes
23
+ ## 1.112.0
24
+
25
+ ## 1.111.0
26
+
27
+ ## 1.110.0
28
+
29
+ ## 1.109.0
30
+
31
+ ## 1.108.0
32
+
33
+ ## 1.107.0
24
34
 
25
- - 0fe7711: ZERO-3387: Upgrade nextjs, eslint-config-next
35
+ ## 1.106.0
26
36
 
27
- ## 2.0.0-beta.8
37
+ ## 1.105.0
28
38
 
29
- ## 2.0.0-beta.7
39
+ ## 1.104.0
30
40
 
31
- ## 2.0.0-beta.6
41
+ ## 1.103.0
42
+
43
+ ## 1.102.0
44
+
45
+ ## 1.101.0
46
+
47
+ ## 1.100.0
48
+
49
+ ## 1.99.0
32
50
 
33
51
  ### Minor Changes
34
52
 
35
- - 8f05f9b: ZERO-3250: Beta branch synchronized with Main branch
53
+ - d58538b: ZERO-3638: Enhance RC pipeline: add fetch, merge, and pre-release setup with conditional commit
54
+
55
+ ## 1.98.0
56
+
57
+ ## 1.97.0
58
+
59
+ ## 1.96.0
36
60
 
37
- ## 2.0.0-beta.5
61
+ ## 1.95.0
38
62
 
39
- ## 2.0.0-beta.4
63
+ ## 1.94.0
40
64
 
41
- ## 2.0.0-beta.3
65
+ ## 1.93.0
42
66
 
43
- ## 2.0.0-beta.2
67
+ ## 1.92.0
68
+
69
+ ## 1.91.0
70
+
71
+ ## 1.90.0
44
72
 
45
73
  ### Minor Changes
46
74
 
47
- - a006015: ZERO-3116: Add not-found page and update default middleware.
48
- - 1eeb3d8: ZERO-3116: Add not found page
75
+ - a1463fd: ZERO-3381: Add customUIRender support for flexible UI rendering
49
76
 
50
- ## 2.0.0-beta.1
77
+ ## 1.89.0
51
78
 
52
79
  ### Minor Changes
53
80
 
54
- - ZERO-3091: Upgrade Next.js to v15 and React to v19
81
+ - 57a6184: ZERO-3332 :Add data-testid attribute to GPay payment button for testing
82
+
83
+ ## 1.88.0
84
+
85
+ ## 1.87.0
86
+
87
+ ## 1.86.0
88
+
89
+ ## 1.85.0
90
+
91
+ ## 1.84.0
92
+
93
+ ### Minor Changes
94
+
95
+ - 624a4eb: ZERO-3276: Update installation instructions across multiple README files to standardize format and improve clarity
96
+
97
+ ## 1.83.0
98
+
99
+ ## 1.82.0
100
+
101
+ ## 1.81.0
102
+
103
+ ## 1.80.0
104
+
105
+ ## 1.79.0
55
106
 
56
- ## 2.0.0-beta.0
107
+ ## 1.78.0
57
108
 
58
- ### Major Changes
109
+ ## 1.77.0
59
110
 
60
- - be6c09d: ZERO-3114: Create beta version.
111
+ ## 1.76.0
61
112
 
62
113
  ## 1.75.0
63
114
 
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@akinon/pz-gpay",
3
- "version": "2.0.0-beta.12",
3
+ "version": "2.0.0-beta.14",
4
4
  "license": "MIT",
5
5
  "main": "src/index.tsx",
6
6
  "peerDependencies": {
7
- "react": "^19.0.0",
8
- "react-dom": "^19.0.0"
7
+ "react": "^18.0.0 || ^19.0.0",
8
+ "react-dom": "^18.0.0 || ^19.0.0"
9
9
  },
10
10
  "devDependencies": {
11
- "@types/node": "^22.10.2",
12
- "@types/react": "^19.0.2",
13
- "@types/react-dom": "^19.0.2",
14
- "react": "^19.0.0",
15
- "react-dom": "^19.0.0",
16
- "typescript": "^5.7.2",
11
+ "@types/node": "^18.7.8",
12
+ "@types/react": "^18.0.17",
13
+ "@types/react-dom": "^18.0.6",
14
+ "react": "^19.2.4",
15
+ "react-dom": "^19.2.4",
16
+ "typescript": "^4.7.4",
17
17
  "react-hook-form": "7.31.3",
18
18
  "@hookform/resolvers": "2.9.0"
19
19
  }
@@ -19,7 +19,7 @@ import {
19
19
  } from '../endpoints';
20
20
  import { twMerge } from 'tailwind-merge';
21
21
  import { Button } from '@akinon/next/components/button';
22
- import { getPosError } from '@akinon/next/utils';
22
+ import { getPosError, checkPaymentWillRedirect } from '@akinon/next/utils';
23
23
 
24
24
  type GPayForm = Record<string, never>;
25
25
 
@@ -61,6 +61,7 @@ const defaultTranslations: GPayTranslations = {
61
61
  export function GPayOption(props: GPayOptionProps) {
62
62
  const [formError, setFormError] = useState<string | null>(null);
63
63
  const [errors, setErrors] = useState<string[]>([]);
64
+ const [isProcessing, setIsProcessing] = useState(false);
64
65
 
65
66
  const translations = { ...defaultTranslations, ...props.translations };
66
67
 
@@ -72,25 +73,46 @@ export function GPayOption(props: GPayOptionProps) {
72
73
  const {
73
74
  handleSubmit,
74
75
  control,
75
- formState: { errors: formErrors }
76
+ formState: { errors: formErrors, isSubmitting }
76
77
  } = useForm<GPayForm>({
77
- resolver: yupResolver(gpayFormSchema)
78
+ resolver: yupResolver(gpayFormSchema) as any
78
79
  });
79
80
 
80
81
  const [setPaymentOption] = useSetPaymentOptionMutation();
81
- const [setGPayMethod] = useSetGPayMethodMutation();
82
- const [setCompleteGPay] = useSetCompleteGPayMutation();
82
+ const [setGPayMethod, { isLoading: isSettingMethod }] =
83
+ useSetGPayMethodMutation();
84
+ const [setCompleteGPay, { isLoading: isCompleting }] =
85
+ useSetCompleteGPayMutation();
86
+
87
+ const isButtonDisabled =
88
+ isSubmitting ||
89
+ isPaymentStepBusy ||
90
+ isSettingMethod ||
91
+ isCompleting ||
92
+ isProcessing;
83
93
 
84
94
  const onSubmit: SubmitHandler<GPayForm> = async () => {
85
- if (isPaymentStepBusy) return;
95
+ if (isButtonDisabled) return;
86
96
 
97
+ setIsProcessing(true);
87
98
  setFormError(null);
88
- await setGPayMethod();
89
99
 
90
- const response = await setCompleteGPay().unwrap();
100
+ try {
101
+ await setGPayMethod();
91
102
 
92
- if (response?.errors?.non_field_errors) {
93
- setFormError(response.errors.non_field_errors);
103
+ const response = await setCompleteGPay().unwrap();
104
+
105
+ if (response?.errors?.non_field_errors) {
106
+ setFormError(response.errors.non_field_errors);
107
+ setIsProcessing(false);
108
+ return;
109
+ }
110
+
111
+ if (response?.errors || !checkPaymentWillRedirect(response)) {
112
+ setIsProcessing(false);
113
+ }
114
+ } catch (error) {
115
+ setIsProcessing(false);
94
116
  }
95
117
  };
96
118
 
@@ -137,6 +159,7 @@ export function GPayOption(props: GPayOptionProps) {
137
159
  data-testid="gpay-payment-button"
138
160
  className={twMerge('w-full mt-3', props.buttonClassName)}
139
161
  type="submit"
162
+ disabled={isButtonDisabled}
140
163
  >
141
164
  {translations.button}
142
165
  </Button>