@akinon/pz-akifast 2.0.0-beta.8 → 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,39 +1,144 @@
1
1
  # @akinon/pz-akifast
2
2
 
3
- ## 2.0.0-beta.8
3
+ ## 2.0.0
4
4
 
5
- ## 2.0.0-beta.7
5
+ ## 2.0.0-beta.27
6
6
 
7
- ## 2.0.0-beta.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
+ ### Minor Changes
36
+
37
+ - 9cfbf6cd: ZERO-3397 :Update README.md to enhance button visibility management and add detailed usage examples for Checkout and Quick Login buttons
38
+
39
+ ## 1.121.0
40
+
41
+ ## 1.120.0
42
+
43
+ ## 1.119.0
44
+
45
+ ## 1.118.0
46
+
47
+ ## 1.117.0
48
+
49
+ ## 1.116.0
50
+
51
+ ## 1.115.0
52
+
53
+ ## 1.114.0
54
+
55
+ ## 1.113.0
56
+
57
+ ## 1.112.0
58
+
59
+ ## 1.111.0
60
+
61
+ ## 1.110.0
62
+
63
+ ## 1.109.0
64
+
65
+ ## 1.108.0
66
+
67
+ ## 1.107.0
68
+
69
+ ## 1.106.0
70
+
71
+ ## 1.105.0
72
+
73
+ ## 1.104.0
74
+
75
+ ## 1.103.0
76
+
77
+ ## 1.102.0
78
+
79
+ ## 1.101.0
80
+
81
+ ## 1.100.0
82
+
83
+ ## 1.99.0
8
84
 
9
85
  ### Minor Changes
10
86
 
11
- - 8f05f9b: ZERO-3250: Beta branch synchronized with Main branch
87
+ - d58538b: ZERO-3638: Enhance RC pipeline: add fetch, merge, and pre-release setup with conditional commit
88
+
89
+ ## 1.98.0
90
+
91
+ ## 1.97.0
12
92
 
13
- ## 2.0.0-beta.5
93
+ ## 1.96.0
14
94
 
15
- ## 2.0.0-beta.4
95
+ ## 1.95.0
16
96
 
17
- ## 2.0.0-beta.3
97
+ ## 1.94.0
18
98
 
19
- ## 2.0.0-beta.2
99
+ ## 1.93.0
100
+
101
+ ## 1.92.0
102
+
103
+ ## 1.91.0
104
+
105
+ ## 1.90.0
20
106
 
21
107
  ### Minor Changes
22
108
 
23
- - a006015: ZERO-3116: Add not-found page and update default middleware.
24
- - 1eeb3d8: ZERO-3116: Add not found page
109
+ - 2657d0c: ZERO-3376: Add customization options for QuickLoginButton and CheckoutButton components
110
+
111
+ ## 1.89.0
112
+
113
+ ## 1.88.0
114
+
115
+ ## 1.87.0
116
+
117
+ ## 1.86.0
25
118
 
26
- ## 2.0.0-beta.1
119
+ ## 1.85.0
120
+
121
+ ## 1.84.0
27
122
 
28
123
  ### Minor Changes
29
124
 
30
- - ZERO-3091: Upgrade Next.js to v15 and React to v19
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
31
136
 
32
- ## 2.0.0-beta.0
137
+ ## 1.78.0
33
138
 
34
- ### Major Changes
139
+ ## 1.77.0
35
140
 
36
- - be6c09d: ZERO-3114: Create beta version.
141
+ ## 1.76.0
37
142
 
38
143
  ## 1.75.0
39
144
 
package/README.md CHANGED
@@ -5,18 +5,22 @@
5
5
  You can use the following command to install the extension with the latest plugins:
6
6
 
7
7
  ```bash
8
-
9
8
  npx @akinon/projectzero@latest --plugins
10
-
11
9
  ```
12
10
 
11
+ ## Akifast
12
+
13
13
  ### Setting the Visibility of Buttons
14
14
 
15
- (all buttons are visible by default)
15
+ All buttons are visible by default.
16
16
 
17
- ```javascript
18
- // settings.js file
17
+ Manage the visibility of buttons:
19
18
 
19
+ ```bash
20
+ src/settings.js
21
+ ```
22
+
23
+ ```javascript
20
24
  module.exports = {
21
25
  // other settings
22
26
  plugins: {
@@ -30,10 +34,68 @@ module.exports = {
30
34
  };
31
35
  ```
32
36
 
33
- ### Usage in Plugin Module System
37
+ ## Checkout Button Props
38
+
39
+ You can see other props for the button in the `pz-one-click-checkout` package.
40
+
41
+ | Property | Type | Required | Description |
42
+ | -------- | --------- | -------- | -------------------------------------- |
43
+ | isPdp | `boolean` | Optional | Indicates if it's a product info page. |
44
+ | renderer | `object` | Optional | Custom rendering functions. |
45
+
46
+ ## Quick Login Props
47
+
48
+ | Property | Type | Required | Description |
49
+ | ---------------- | --------- | -------- | ---------------------------------- |
50
+ | buttonText | `string` | Optional | Text displayed on the button. |
51
+ | isCaptchaVisible | `boolean` | Required | Indicates if captcha is visible. |
52
+ | captchaValidated | `boolean` | Required | Indicates if captcha is validated. |
53
+ | renderer | `object` | Optional | Custom rendering functions. |
54
+
55
+ ## Renderer Props Types
56
+
57
+ The full type definitions for the renderer props:
58
+
59
+ ```typescript
60
+ interface AkifastRendererProps {
61
+ quickLoginButton?: {
62
+ renderButton?: (props: {
63
+ buttonText: string;
64
+ disabled: boolean;
65
+ onClick: () => void;
66
+ rest: React.ButtonHTMLAttributes<HTMLButtonElement>;
67
+ }) => React.ReactNode;
68
+ };
69
+ checkoutButton?: {
70
+ renderButton?: (props: {
71
+ provider: ProvidersType;
72
+ rest: OneClickCheckoutButtonProps;
73
+ }) => React.ReactNode;
74
+ renderEmptyState?: () => React.ReactNode;
75
+ };
76
+ }
77
+ ```
78
+
79
+ ### Usage Examples
80
+
81
+ Both the `CheckoutButton` and `QuickLoginButton` can be customized using the `renderer` prop. This allows you to fully customize the appearance and behavior of these components while maintaining their core functionality.
34
82
 
35
83
  ## Checkout Button
36
84
 
85
+ Summary:
86
+
87
+ ```bash
88
+ /src/views/basket/summary.tsx
89
+ ```
90
+
91
+ Product Info:
92
+
93
+ ```bash
94
+ /src/views/product/product-info.tsx
95
+ ```
96
+
97
+ ### Default Usage
98
+
37
99
  ```javascript
38
100
  import PluginModule, { Component } from '@akinon/next/components/plugin-module';
39
101
 
@@ -46,8 +108,49 @@ import PluginModule, { Component } from '@akinon/next/components/plugin-module';
46
108
  />;
47
109
  ```
48
110
 
111
+ ### Customized Usage with Renderer
112
+
113
+ ```javascript
114
+ import PluginModule, { Component } from '@akinon/next/components/plugin-module';
115
+
116
+ <PluginModule
117
+ component={Component.AkifastCheckoutButton}
118
+ props={{
119
+ isPdp: true,
120
+ renderer: {
121
+ renderButton: ({ provider, rest }) => (
122
+ <div className="custom-checkout-wrapper">
123
+ <button
124
+ className="custom-checkout-button"
125
+ onClick={() => {
126
+ // Your custom logic
127
+ console.log('Provider:', provider);
128
+ // You can still pass through all original props
129
+ console.log('Original props:', rest);
130
+ }}
131
+ >
132
+ Hemen Satın Al
133
+ </button>
134
+ </div>
135
+ ),
136
+ renderEmptyState: () => (
137
+ <div className="checkout-unavailable">
138
+ Akifast ile ödeme şu an mevcut değil
139
+ </div>
140
+ )
141
+ }
142
+ }}
143
+ />;
144
+ ```
145
+
49
146
  ## Quick Login Button
50
147
 
148
+ ```bash
149
+ /src/views/login/index.tsx
150
+ ```
151
+
152
+ ### Default Usage
153
+
51
154
  ```javascript
52
155
  import PluginModule, { Component } from '@akinon/next/components/plugin-module';
53
156
 
@@ -60,18 +163,32 @@ import PluginModule, { Component } from '@akinon/next/components/plugin-module';
60
163
  />;
61
164
  ```
62
165
 
63
- ## Checkout Button Props
166
+ ### Customized Usage with Renderer
64
167
 
65
- You can see other props for the button in the `pz-one-click-checkout` package.
66
-
67
- | Property | Type | Description |
68
- | -------- | --------- | -------------------------------------- |
69
- | isPdp | `boolean` | Indicates if it's a product info page. |
70
-
71
- ## Quick Login Props
168
+ ```javascript
169
+ import PluginModule, { Component } from '@akinon/next/components/plugin-module';
72
170
 
73
- | Property | Type | Description |
74
- | ---------------- | --------- | ---------------------------------- |
75
- | buttonText | `string` | Text displayed on the button. |
76
- | isCaptchaVisible | `boolean` | Indicates if captcha is visible. |
77
- | captchaValidated | `boolean` | Indicates if captcha is validated. |
171
+ <PluginModule
172
+ component={Component.AkifastQuickLoginButton}
173
+ props={{
174
+ isCaptchaVisible,
175
+ captchaValidated,
176
+ buttonText: 'Hızlı Giriş',
177
+ renderer: {
178
+ renderButton: ({ buttonText, disabled, onClick, rest }) => (
179
+ <button
180
+ className="custom-login-button"
181
+ disabled={disabled}
182
+ onClick={onClick}
183
+ {...rest}
184
+ >
185
+ <svg className="icon-login" viewBox="0 0 24 24">
186
+ {/* Your custom SVG icon */}
187
+ </svg>
188
+ {buttonText}
189
+ </button>
190
+ )
191
+ }
192
+ }}
193
+ />;
194
+ ```
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "@akinon/pz-akifast",
3
- "version": "2.0.0-beta.8",
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
  "pz-one-click-checkout": "^1.40.0"
12
12
  },
13
13
  "devDependencies": {
14
- "@types/node": "^22.10.2",
15
- "@types/react": "^19.0.2",
16
- "@types/react-dom": "^19.0.2",
17
- "react": "^19.0.0",
18
- "react-dom": "^19.0.0",
19
- "typescript": "^5.7.2",
14
+ "@types/node": "^18.7.8",
15
+ "@types/react": "^18.0.17",
16
+ "@types/react-dom": "^18.0.6",
17
+ "react": "19.2.5",
18
+ "react-dom": "19.2.5",
19
+ "typescript": "^5.2.2",
20
20
  "@reduxjs/toolkit": "^1.8.3"
21
21
  }
22
22
  }
package/src/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { QuickLoginButton } from './views/QuickLoginButton';
2
2
  export { CheckoutButton } from './views/CheckoutButton';
3
+ export type { QuickLoginButtonProps, AkifastRendererProps } from './types';
package/src/types.ts ADDED
@@ -0,0 +1,38 @@
1
+ import { PluginModuleComponentProps } from '@akinon/next/types';
2
+ import {
3
+ ProvidersType,
4
+ OneClickCheckoutButtonProps
5
+ } from '@akinon/pz-one-click-checkout/src/types';
6
+ import React from 'react';
7
+
8
+ export interface AkifastRendererProps {
9
+ quickLoginButton?: {
10
+ renderButton?: (props: {
11
+ buttonText: string;
12
+ disabled: boolean;
13
+ onClick: () => void;
14
+ rest: React.ButtonHTMLAttributes<HTMLButtonElement>;
15
+ }) => React.ReactNode;
16
+ };
17
+ checkoutButton?: {
18
+ renderButton?: (props: {
19
+ provider: ProvidersType;
20
+ rest: OneClickCheckoutButtonProps;
21
+ }) => React.ReactNode;
22
+ renderEmptyState?: () => React.ReactNode;
23
+ };
24
+ }
25
+
26
+ export interface QuickLoginButtonProps extends PluginModuleComponentProps {
27
+ isCaptchaVisible: boolean;
28
+ captchaValidated: boolean;
29
+ buttonText?: string;
30
+ renderer?: AkifastRendererProps['quickLoginButton'];
31
+ }
32
+
33
+ export interface CheckoutButtonProps
34
+ extends PluginModuleComponentProps,
35
+ OneClickCheckoutButtonProps {
36
+ isPdp?: boolean;
37
+ renderer?: AkifastRendererProps['checkoutButton'];
38
+ }
@@ -1,21 +1,13 @@
1
1
  import React from 'react';
2
- import { PluginModuleComponentProps } from '@akinon/next/types';
3
2
  import PluginModule, { Component } from '@akinon/next/components/plugin-module';
4
3
  import { useGetCheckoutProvidersQuery } from '@akinon/pz-one-click-checkout/src/endpoints';
5
- import {
6
- OneClickCheckoutButtonProps,
7
- ProvidersType
8
- } from '@akinon/pz-one-click-checkout/src/types';
9
-
10
- interface CheckoutButtonProps
11
- extends PluginModuleComponentProps,
12
- OneClickCheckoutButtonProps {
13
- isPdp?: boolean;
14
- }
4
+ import { ProvidersType } from '@akinon/pz-one-click-checkout/src/types';
5
+ import { CheckoutButtonProps } from '../types';
15
6
 
16
7
  export const CheckoutButton = ({
17
8
  settings,
18
9
  isPdp = false,
10
+ renderer,
19
11
  ...rest
20
12
  }: CheckoutButtonProps) => {
21
13
  const { data: checkoutProviders } = useGetCheckoutProvidersQuery(null, {});
@@ -28,7 +20,14 @@ export const CheckoutButton = ({
28
20
  (isPdp && settings?.pdp === false) ||
29
21
  (!isPdp && settings?.basket === false)
30
22
  ) {
31
- return;
23
+ return renderer?.renderEmptyState ? renderer.renderEmptyState() : null;
24
+ }
25
+
26
+ if (renderer?.renderButton) {
27
+ return renderer.renderButton({
28
+ provider,
29
+ rest: { ...rest }
30
+ });
32
31
  }
33
32
 
34
33
  return (
@@ -1,36 +1,56 @@
1
1
  import React from 'react';
2
2
  import { Button } from '@akinon/next/components';
3
- import { PluginModuleComponentProps } from '@akinon/next/types';
3
+ import { QuickLoginButtonProps } from '../types';
4
4
 
5
- interface QuickLoginButtonProps extends PluginModuleComponentProps {
6
- isCaptchaVisible: boolean;
7
- captchaValidated: boolean;
8
- buttonText?: string;
9
- }
5
+ const DefaultButton = ({
6
+ buttonText,
7
+ disabled,
8
+ onClick,
9
+ rest
10
+ }: {
11
+ buttonText: string;
12
+ disabled: boolean;
13
+ onClick: () => void;
14
+ rest: React.ButtonHTMLAttributes<HTMLButtonElement>;
15
+ }) => (
16
+ <Button
17
+ className="text-base text-black-750 h-auto py-4 border border-gray-650 leading-[0.94]"
18
+ type="submit"
19
+ appearance="outlined"
20
+ disabled={disabled}
21
+ onClick={onClick}
22
+ {...rest}
23
+ >
24
+ {buttonText}
25
+ </Button>
26
+ );
10
27
 
11
28
  export const QuickLoginButton = ({
12
29
  buttonText = 'Quick Login',
13
30
  isCaptchaVisible,
14
31
  captchaValidated,
15
32
  settings,
33
+ renderer,
16
34
  ...rest
17
35
  }: QuickLoginButtonProps & React.ButtonHTMLAttributes<HTMLButtonElement>) => {
18
36
  if (settings?.quickLogin === false) {
19
- return;
37
+ return null;
20
38
  }
21
39
 
40
+ const handleClick = () => {
41
+ location.href = `/akifast/login/`;
42
+ };
43
+
44
+ const isDisabled = isCaptchaVisible && !captchaValidated;
45
+
46
+ const RenderButton = renderer?.renderButton || DefaultButton;
47
+
22
48
  return (
23
- <Button
24
- className="w-full h-14 uppercase text-xs font-semibold flex items-center justify-center gap-2 hover:bg-transparent hover:border hover:border-primary-800 hover:text-primary"
25
- type="submit"
26
- appearance="outlined"
27
- disabled={isCaptchaVisible && !captchaValidated}
28
- onClick={() => {
29
- location.href = `/akifast/login/`;
30
- }}
31
- {...rest}
32
- >
33
- {buttonText}
34
- </Button>
49
+ <RenderButton
50
+ buttonText={buttonText}
51
+ disabled={isDisabled}
52
+ onClick={handleClick}
53
+ rest={rest}
54
+ />
35
55
  );
36
56
  };