@akinon/pz-one-click-checkout 2.0.0-beta.9 → 2.0.0

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,45 +1,144 @@
1
1
  # @akinon/pz-one-click-checkout
2
2
 
3
- ## 2.0.0-beta.9
3
+ ## 2.0.0
4
4
 
5
- ### Minor Changes
5
+ ## 2.0.0-beta.27
6
+
7
+ ## 2.0.0-beta.26
8
+
9
+ ## 2.0.0-beta.25
10
+
11
+ ## 2.0.0-beta.24
12
+
13
+ ## 2.0.0-beta.23
14
+
15
+ ## 2.0.0-beta.22
16
+
17
+ ## 2.0.0-beta.21
18
+
19
+ ## 2.0.0-beta.20
20
+
21
+ ## 1.126.0
22
+
23
+ ## 1.125.2
24
+
25
+ ## 1.125.1
26
+
27
+ ## 1.125.0
28
+
29
+ ## 1.124.0
30
+
31
+ ## 1.123.0
32
+
33
+ ## 1.122.0
34
+
35
+ ## 1.121.0
36
+
37
+ ## 1.120.0
38
+
39
+ ## 1.119.0
40
+
41
+ ## 1.118.0
42
+
43
+ ## 1.117.0
44
+
45
+ ## 1.116.0
46
+
47
+ ## 1.115.0
48
+
49
+ ## 1.114.0
50
+
51
+ ## 1.113.0
52
+
53
+ ## 1.112.0
54
+
55
+ ## 1.111.0
6
56
 
7
- - 0fe7711: ZERO-3387: Upgrade nextjs, eslint-config-next
57
+ ## 1.110.0
8
58
 
9
- ## 2.0.0-beta.8
59
+ ## 1.109.0
10
60
 
11
- ## 2.0.0-beta.7
61
+ ## 1.108.0
12
62
 
13
- ## 2.0.0-beta.6
63
+ ## 1.107.0
64
+
65
+ ## 1.106.0
66
+
67
+ ## 1.105.0
68
+
69
+ ## 1.104.0
70
+
71
+ ## 1.103.0
72
+
73
+ ## 1.102.0
74
+
75
+ ## 1.101.0
76
+
77
+ ## 1.100.0
78
+
79
+ ## 1.99.0
14
80
 
15
81
  ### Minor Changes
16
82
 
17
- - 8f05f9b: ZERO-3250: Beta branch synchronized with Main branch
83
+ - d58538b: ZERO-3638: Enhance RC pipeline: add fetch, merge, and pre-release setup with conditional commit
84
+
85
+ ## 1.98.0
86
+
87
+ ## 1.97.0
88
+
89
+ ## 1.96.0
90
+
91
+ ## 1.95.0
92
+
93
+ ## 1.94.0
18
94
 
19
- ## 2.0.0-beta.5
95
+ ## 1.93.0
20
96
 
21
- ## 2.0.0-beta.4
97
+ ## 1.92.0
22
98
 
23
- ## 2.0.0-beta.3
99
+ ## 1.91.0
24
100
 
25
- ## 2.0.0-beta.2
101
+ ## 1.90.0
26
102
 
27
103
  ### Minor Changes
28
104
 
29
- - a006015: ZERO-3116: Add not-found page and update default middleware.
30
- - 1eeb3d8: ZERO-3116: Add not found page
105
+ - 99b3fd6: ZERO-3375: Add custom UI rendering option for OneClickCheckoutButton
31
106
 
32
- ## 2.0.0-beta.1
107
+ ## 1.89.0
33
108
 
34
109
  ### Minor Changes
35
110
 
36
- - ZERO-3091: Upgrade Next.js to v15 and React to v19
111
+ - c759d6b: ZERO-3336: Add data-testid attribute to OneClickCheckoutButton for improved testing
112
+
113
+ ## 1.88.0
114
+
115
+ ## 1.87.0
116
+
117
+ ## 1.86.0
118
+
119
+ ## 1.85.0
120
+
121
+ ## 1.84.0
122
+
123
+ ### Minor Changes
124
+
125
+ - 624a4eb: ZERO-3276: Update installation instructions across multiple README files to standardize format and improve clarity
126
+
127
+ ## 1.83.0
128
+
129
+ ## 1.82.0
130
+
131
+ ## 1.81.0
132
+
133
+ ## 1.80.0
134
+
135
+ ## 1.79.0
37
136
 
38
- ## 2.0.0-beta.0
137
+ ## 1.78.0
39
138
 
40
- ### Major Changes
139
+ ## 1.77.0
41
140
 
42
- - be6c09d: ZERO-3114: Create beta version.
141
+ ## 1.76.0
43
142
 
44
143
  ## 1.75.0
45
144
 
package/README.md CHANGED
@@ -25,7 +25,43 @@ npx @akinon/projectzero@latest --plugins
25
25
  | content | `React.ReactNode` | It is used to create custom content. |
26
26
  | openMiniBasket | `boolean` | Manages the opening status of the minibasket. |
27
27
  | translations.buttonText | `string` | The text of the button. |
28
+ | customUIRender | `React.ReactNode` | Optional function to fully customize the button rendering. Receives onClick, disabled, loading, provider, productError and content props. |
28
29
 
29
- ```
30
+ ### Customizing Checkout Button
31
+
32
+ ```javascript
33
+ import PluginModule, { Component } from '@akinon/next/components/plugin-module';
34
+
35
+ <PluginModule
36
+ component={Component.OneClickCheckoutButtons}
37
+ props={{
38
+ customUIRender: ({
39
+ onClick,
40
+ disabled,
41
+ loading,
42
+ provider,
43
+ productError,
44
+ content
45
+ }) => (
46
+ <>
47
+ <button
48
+ onClick={onClick}
49
+ disabled={disabled}
50
+ className="relative w-full py-3 bg-[#ff2000] text-black hover:bg-[#547ee7] text-sm font-semibold flex items-center justify-center"
51
+ >
52
+ {loading && (
53
+ <span className="absolute left-3 w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin" />
54
+ )}
55
+ {loading ? 'Please wait...' : content ?? `Buy with ${provider.name}`}
56
+ </button>
30
57
 
58
+ {productError && (
59
+ <div className="mt-4 text-xs text-center text-[#d72b01]">
60
+ {productError}
61
+ </div>
62
+ )}
63
+ </>
64
+ )
65
+ }}
66
+ />;
31
67
  ```
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@akinon/pz-one-click-checkout",
3
- "version": "2.0.0-beta.9",
3
+ "version": "2.0.0",
4
4
  "main": "./src/index.ts",
5
5
  "module": "./src/index.ts",
6
6
  "license": "MIT",
7
7
  "peerDependencies": {
8
- "react": "^19.0.0",
9
- "react-dom": "^19.0.0",
8
+ "react": "^18.0.0 || ^19.0.0",
9
+ "react-dom": "^18.0.0 || ^19.0.0",
10
10
  "@reduxjs/toolkit": "^1.8.3"
11
11
  },
12
12
  "devDependencies": {
13
- "@types/node": "^22.10.2",
14
- "@types/react": "^19.0.2",
15
- "@types/react-dom": "^19.0.2",
16
- "react": "^19.0.0",
17
- "react-dom": "^19.0.0",
18
- "typescript": "^5.7.2",
13
+ "@types/node": "^18.7.8",
14
+ "@types/react": "^18.0.17",
15
+ "@types/react-dom": "^18.0.6",
16
+ "react": "19.2.5",
17
+ "react-dom": "19.2.5",
18
+ "typescript": "^4.7.4",
19
19
  "@reduxjs/toolkit": "^1.8.3",
20
20
  "express": "4.17.3",
21
21
  "node-fetch": "2.6.7",
@@ -19,6 +19,14 @@ export interface OneClickCheckoutProps {
19
19
  buttonText?: string;
20
20
  };
21
21
  content?: React.ReactNode;
22
+ customUIRender?: (props: {
23
+ onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
24
+ disabled: boolean;
25
+ loading: boolean;
26
+ provider: OneClickCheckoutButtonProps['provider'];
27
+ productError?: string | null;
28
+ content?: React.ReactNode;
29
+ }) => React.ReactNode;
22
30
  }
23
31
 
24
32
  export interface OneClickCheckoutButtonProps extends OneClickCheckoutProps {
@@ -27,7 +27,8 @@ export const OneClickCheckoutButton = (props: OneClickCheckoutButtonProps) => {
27
27
  onError,
28
28
  provider,
29
29
  translations,
30
- content
30
+ content,
31
+ customUIRender
31
32
  } = props;
32
33
 
33
34
  const [disabled, setDisabled] = useState(isDisabled);
@@ -101,9 +102,21 @@ export const OneClickCheckoutButton = (props: OneClickCheckoutButtonProps) => {
101
102
  setDisabled(false);
102
103
  };
103
104
 
105
+ if (customUIRender) {
106
+ return customUIRender({
107
+ onClick: (e) => handleOnClick(e, provider?.pk),
108
+ disabled,
109
+ loading: disabled,
110
+ provider,
111
+ content,
112
+ productError
113
+ });
114
+ }
115
+
104
116
  return (
105
117
  <>
106
118
  <Button
119
+ data-testid={`one-click-checkout-${provider?.slug}`}
107
120
  onClick={(e) => handleOnClick(e, provider.pk)}
108
121
  className={twMerge(
109
122
  clsx(
@@ -119,7 +132,7 @@ export const OneClickCheckoutButton = (props: OneClickCheckoutButtonProps) => {
119
132
  >
120
133
  {content
121
134
  ? content
122
- : translations?.buttonText ?? `${provider.name} Checkout`}
135
+ : translations?.buttonText ?? `${provider?.name} Checkout`}
123
136
 
124
137
  {disabled && (
125
138
  <div className="absolute flex justify-center items-center bg-[#000000] opacity-50 w-full h-full">