@akinon/pz-akifast 2.0.0-beta.2 → 2.0.0-beta.21

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,130 @@
1
1
  # @akinon/pz-akifast
2
2
 
3
- ## 2.0.0-beta.2
3
+ ## 2.0.0-beta.21
4
4
 
5
- ## 2.0.0-beta.1
5
+ ## 2.0.0-beta.20
6
+
7
+ ## 1.126.0
8
+
9
+ ## 1.125.2
10
+
11
+ ## 1.125.1
12
+
13
+ ## 1.125.0
14
+
15
+ ## 1.124.0
16
+
17
+ ## 1.123.0
18
+
19
+ ## 1.122.0
6
20
 
7
21
  ### Minor Changes
8
22
 
9
- - ZERO-3091: Upgrade Next.js to v15 and React to v19
23
+ - 9cfbf6cd: ZERO-3397 :Update README.md to enhance button visibility management and add detailed usage examples for Checkout and Quick Login buttons
24
+
25
+ ## 1.121.0
26
+
27
+ ## 1.120.0
28
+
29
+ ## 1.119.0
30
+
31
+ ## 1.118.0
32
+
33
+ ## 1.117.0
34
+
35
+ ## 1.116.0
36
+
37
+ ## 1.115.0
38
+
39
+ ## 1.114.0
40
+
41
+ ## 1.113.0
42
+
43
+ ## 1.112.0
44
+
45
+ ## 1.111.0
46
+
47
+ ## 1.110.0
48
+
49
+ ## 1.109.0
50
+
51
+ ## 1.108.0
52
+
53
+ ## 1.107.0
54
+
55
+ ## 1.106.0
56
+
57
+ ## 1.105.0
58
+
59
+ ## 1.104.0
60
+
61
+ ## 1.103.0
62
+
63
+ ## 1.102.0
64
+
65
+ ## 1.101.0
66
+
67
+ ## 1.100.0
68
+
69
+ ## 1.99.0
70
+
71
+ ### Minor Changes
72
+
73
+ - d58538b: ZERO-3638: Enhance RC pipeline: add fetch, merge, and pre-release setup with conditional commit
74
+
75
+ ## 1.98.0
76
+
77
+ ## 1.97.0
78
+
79
+ ## 1.96.0
80
+
81
+ ## 1.95.0
82
+
83
+ ## 1.94.0
84
+
85
+ ## 1.93.0
86
+
87
+ ## 1.92.0
88
+
89
+ ## 1.91.0
90
+
91
+ ## 1.90.0
92
+
93
+ ### Minor Changes
94
+
95
+ - 2657d0c: ZERO-3376: Add customization options for QuickLoginButton and CheckoutButton components
96
+
97
+ ## 1.89.0
98
+
99
+ ## 1.88.0
100
+
101
+ ## 1.87.0
102
+
103
+ ## 1.86.0
104
+
105
+ ## 1.85.0
106
+
107
+ ## 1.84.0
108
+
109
+ ### Minor Changes
110
+
111
+ - 624a4eb: ZERO-3276: Update installation instructions across multiple README files to standardize format and improve clarity
112
+
113
+ ## 1.83.0
114
+
115
+ ## 1.82.0
116
+
117
+ ## 1.81.0
118
+
119
+ ## 1.80.0
120
+
121
+ ## 1.79.0
10
122
 
11
- ## 2.0.0-beta.0
123
+ ## 1.78.0
12
124
 
13
- ### Major Changes
125
+ ## 1.77.0
14
126
 
15
- - be6c09d: ZERO-3114: Create beta version.
127
+ ## 1.76.0
16
128
 
17
129
  ## 1.75.0
18
130
 
package/README.md CHANGED
@@ -1,21 +1,26 @@
1
1
  # @akinon/pz-akifast
2
2
 
3
- ### Install the npm package
3
+ ## Installation
4
4
 
5
- ```bash
6
- # For latest version
7
- yarn add @akinon/pz-akifast
5
+ You can use the following command to install the extension with the latest plugins:
8
6
 
9
- # Preferred installation method
7
+ ```bash
10
8
  npx @akinon/projectzero@latest --plugins
11
9
  ```
12
10
 
11
+ ## Akifast
12
+
13
13
  ### Setting the Visibility of Buttons
14
- (all buttons are visible by default)
15
14
 
16
- ```javascript
17
- // settings.js file
15
+ All buttons are visible by default.
16
+
17
+ Manage the visibility of buttons:
18
+
19
+ ```bash
20
+ src/settings.js
21
+ ```
18
22
 
23
+ ```javascript
19
24
  module.exports = {
20
25
  // other settings
21
26
  plugins: {
@@ -23,16 +28,74 @@ module.exports = {
23
28
  'pz-akifast': {
24
29
  quickLogin: false,
25
30
  pdp: false,
26
- basket: false,
27
- },
28
- },
31
+ basket: false
32
+ }
33
+ }
29
34
  };
30
35
  ```
31
36
 
32
- ### 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.
33
82
 
34
83
  ## Checkout Button
35
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
+
36
99
  ```javascript
37
100
  import PluginModule, { Component } from '@akinon/next/components/plugin-module';
38
101
 
@@ -42,11 +105,52 @@ import PluginModule, { Component } from '@akinon/next/components/plugin-module';
42
105
  ...checkoutProviderProps, // same with one click checkout props
43
106
  isPdp: true
44
107
  }}
45
- />
108
+ />;
109
+ ```
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
+ />;
46
144
  ```
47
145
 
48
146
  ## Quick Login Button
49
147
 
148
+ ```bash
149
+ /src/views/login/index.tsx
150
+ ```
151
+
152
+ ### Default Usage
153
+
50
154
  ```javascript
51
155
  import PluginModule, { Component } from '@akinon/next/components/plugin-module';
52
156
 
@@ -56,21 +160,35 @@ import PluginModule, { Component } from '@akinon/next/components/plugin-module';
56
160
  isCaptchaVisible,
57
161
  captchaValidated
58
162
  }}
59
- />
163
+ />;
60
164
  ```
61
165
 
62
- ## Checkout Button Props
63
-
64
- You can see other props for the button in the `pz-one-click-checkout` package.
65
-
66
- | Property | Type | Description |
67
- |----------|-----------|----------------------------------------|
68
- | isPdp | `boolean` | Indicates if it's a product info page. |
166
+ ### Customized Usage with Renderer
69
167
 
70
- ## Quick Login Props
168
+ ```javascript
169
+ import PluginModule, { Component } from '@akinon/next/components/plugin-module';
71
170
 
72
- | Property | Type | Description |
73
- |------------------|-----------|------------------------------------|
74
- | buttonText | `string` | Text displayed on the button. |
75
- | isCaptchaVisible | `boolean` | Indicates if captcha is visible. |
76
- | 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.2",
3
+ "version": "2.0.0-beta.21",
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
  };