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

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,18 +1,122 @@
1
1
  # @akinon/pz-one-click-checkout
2
2
 
3
- ## 2.0.0-beta.2
3
+ ## 2.0.0-beta.20
4
4
 
5
- ## 2.0.0-beta.1
5
+ ## 1.125.0
6
+
7
+ ## 1.124.0
8
+
9
+ ## 1.123.0
10
+
11
+ ## 1.122.0
12
+
13
+ ## 1.121.0
14
+
15
+ ## 1.120.0
16
+
17
+ ## 1.119.0
18
+
19
+ ## 1.118.0
20
+
21
+ ## 1.117.0
22
+
23
+ ## 1.116.0
24
+
25
+ ## 1.115.0
26
+
27
+ ## 1.114.0
28
+
29
+ ## 1.113.0
30
+
31
+ ## 1.112.0
32
+
33
+ ## 1.111.0
34
+
35
+ ## 1.110.0
36
+
37
+ ## 1.109.0
38
+
39
+ ## 1.108.0
40
+
41
+ ## 1.107.0
42
+
43
+ ## 1.106.0
44
+
45
+ ## 1.105.0
46
+
47
+ ## 1.104.0
48
+
49
+ ## 1.103.0
50
+
51
+ ## 1.102.0
52
+
53
+ ## 1.101.0
54
+
55
+ ## 1.100.0
56
+
57
+ ## 1.99.0
6
58
 
7
59
  ### Minor Changes
8
60
 
9
- - ZERO-3091: Upgrade Next.js to v15 and React to v19
61
+ - d58538b: ZERO-3638: Enhance RC pipeline: add fetch, merge, and pre-release setup with conditional commit
62
+
63
+ ## 1.98.0
64
+
65
+ ## 1.97.0
66
+
67
+ ## 1.96.0
68
+
69
+ ## 1.95.0
70
+
71
+ ## 1.94.0
72
+
73
+ ## 1.93.0
74
+
75
+ ## 1.92.0
76
+
77
+ ## 1.91.0
78
+
79
+ ## 1.90.0
80
+
81
+ ### Minor Changes
82
+
83
+ - 99b3fd6: ZERO-3375: Add custom UI rendering option for OneClickCheckoutButton
84
+
85
+ ## 1.89.0
86
+
87
+ ### Minor Changes
88
+
89
+ - c759d6b: ZERO-3336: Add data-testid attribute to OneClickCheckoutButton for improved testing
90
+
91
+ ## 1.88.0
92
+
93
+ ## 1.87.0
94
+
95
+ ## 1.86.0
96
+
97
+ ## 1.85.0
98
+
99
+ ## 1.84.0
100
+
101
+ ### Minor Changes
102
+
103
+ - 624a4eb: ZERO-3276: Update installation instructions across multiple README files to standardize format and improve clarity
104
+
105
+ ## 1.83.0
106
+
107
+ ## 1.82.0
108
+
109
+ ## 1.81.0
110
+
111
+ ## 1.80.0
112
+
113
+ ## 1.79.0
10
114
 
11
- ## 2.0.0-beta.0
115
+ ## 1.78.0
12
116
 
13
- ### Major Changes
117
+ ## 1.77.0
14
118
 
15
- - be6c09d: ZERO-3114: Create beta version.
119
+ ## 1.76.0
16
120
 
17
121
  ## 1.75.0
18
122
 
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # @akinon/pz-one-click-checkout
2
2
 
3
- ### Install the npm package
3
+ ## Installation method
4
+
5
+ You can use the following command to install the extension with the latest plugins:
4
6
 
5
7
  ```bash
6
- # For latest version
7
- yarn add @akinon/pz-one-click-checkout
8
8
 
9
- # Preferred installation method
10
9
  npx @akinon/projectzero@latest --plugins
10
+
11
11
  ```
12
12
 
13
13
  ## Props
@@ -25,3 +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. |
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>
57
+
58
+ {productError && (
59
+ <div className="mt-4 text-xs text-center text-[#d72b01]">
60
+ {productError}
61
+ </div>
62
+ )}
63
+ </>
64
+ )
65
+ }}
66
+ />;
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.2",
3
+ "version": "2.0.0-beta.20",
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.4",
17
+ "react-dom": "^19.2.4",
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">