@akinon/pz-akifast 1.41.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/.gitattributes +15 -0
- package/.prettierrc +13 -0
- package/CHANGELOG.md +7 -0
- package/README.md +66 -0
- package/package.json +22 -0
- package/src/index.ts +2 -0
- package/src/views/CheckoutButton.tsx +45 -0
- package/src/views/QuickLoginButton.tsx +34 -0
package/.gitattributes
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
*.js text eol=lf
|
|
2
|
+
*.jsx text eol=lf
|
|
3
|
+
*.ts text eol=lf
|
|
4
|
+
*.tsx text eol=lf
|
|
5
|
+
*.json text eol=lf
|
|
6
|
+
*.md text eol=lf
|
|
7
|
+
|
|
8
|
+
.eslintignore text eol=lf
|
|
9
|
+
.eslintrc text eol=lf
|
|
10
|
+
.gitignore text eol=lf
|
|
11
|
+
.prettierrc text eol=lf
|
|
12
|
+
.yarnrc text eol=lf
|
|
13
|
+
|
|
14
|
+
* text=auto
|
|
15
|
+
|
package/.prettierrc
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bracketSameLine": false,
|
|
3
|
+
"tabWidth": 2,
|
|
4
|
+
"singleQuote": true,
|
|
5
|
+
"jsxSingleQuote": false,
|
|
6
|
+
"bracketSpacing": true,
|
|
7
|
+
"semi": true,
|
|
8
|
+
"useTabs": false,
|
|
9
|
+
"arrowParens": "always",
|
|
10
|
+
"endOfLine": "lf",
|
|
11
|
+
"proseWrap": "never",
|
|
12
|
+
"trailingComma": "none"
|
|
13
|
+
}
|
package/CHANGELOG.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# pz-akifast
|
|
2
|
+
|
|
3
|
+
### Setting the Visibility of Buttons
|
|
4
|
+
(all buttons are visible by default)
|
|
5
|
+
|
|
6
|
+
```javascript
|
|
7
|
+
// settings.js file
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
// other settings
|
|
11
|
+
plugins: {
|
|
12
|
+
// other plugin settings
|
|
13
|
+
'pz-akifast': {
|
|
14
|
+
quickLogin: false,
|
|
15
|
+
pdp: false,
|
|
16
|
+
basket: false,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Usage in Plugin Module System
|
|
23
|
+
|
|
24
|
+
## Checkout Button
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
import PluginModule, { Component } from '@akinon/next/components/plugin-module';
|
|
28
|
+
|
|
29
|
+
<PluginModule
|
|
30
|
+
component={Component.AkifastCheckoutButton}
|
|
31
|
+
props={{
|
|
32
|
+
...checkoutProviderProps, // same with one click checkout props
|
|
33
|
+
isPdp: true
|
|
34
|
+
}}
|
|
35
|
+
/>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick Login Button
|
|
39
|
+
|
|
40
|
+
```javascript
|
|
41
|
+
import PluginModule, { Component } from '@akinon/next/components/plugin-module';
|
|
42
|
+
|
|
43
|
+
<PluginModule
|
|
44
|
+
component={Component.AkifastQuickLoginButton}
|
|
45
|
+
props={{
|
|
46
|
+
isCaptchaVisible,
|
|
47
|
+
captchaValidated
|
|
48
|
+
}}
|
|
49
|
+
/>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Checkout Button Props
|
|
53
|
+
|
|
54
|
+
You can see other props for the button in the `pz-one-click-checkout` package.
|
|
55
|
+
|
|
56
|
+
| Property | Type | Description |
|
|
57
|
+
|----------|-----------|----------------------------------------|
|
|
58
|
+
| isPdp | `boolean` | Indicates if it's a product info page. |
|
|
59
|
+
|
|
60
|
+
## Quick Login Props
|
|
61
|
+
|
|
62
|
+
| Property | Type | Description |
|
|
63
|
+
|------------------|-----------|------------------------------------|
|
|
64
|
+
| buttonText | `string` | Text displayed on the button. |
|
|
65
|
+
| isCaptchaVisible | `boolean` | Indicates if captcha is visible. |
|
|
66
|
+
| captchaValidated | `boolean` | Indicates if captcha is validated. |
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@akinon/pz-akifast",
|
|
3
|
+
"version": "1.41.0",
|
|
4
|
+
"main": "./src/index.ts",
|
|
5
|
+
"module": "./src/index.ts",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"react": "^18.0.0",
|
|
9
|
+
"react-dom": "^18.0.0",
|
|
10
|
+
"@reduxjs/toolkit": "^1.8.3",
|
|
11
|
+
"pz-one-click-checkout": "^1.40.0"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@types/node": "^18.7.8",
|
|
15
|
+
"@types/react": "^18.0.17",
|
|
16
|
+
"@types/react-dom": "^18.0.6",
|
|
17
|
+
"react": "^18.2.0",
|
|
18
|
+
"react-dom": "^18.2.0",
|
|
19
|
+
"typescript": "^5.2.2",
|
|
20
|
+
"@reduxjs/toolkit": "^1.8.3"
|
|
21
|
+
}
|
|
22
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PluginModuleComponentProps } from '@akinon/next/types';
|
|
3
|
+
import PluginModule, { Component } from '@akinon/next/components/plugin-module';
|
|
4
|
+
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
|
+
}
|
|
15
|
+
|
|
16
|
+
export const CheckoutButton = ({
|
|
17
|
+
settings,
|
|
18
|
+
isPdp = false,
|
|
19
|
+
...rest
|
|
20
|
+
}: CheckoutButtonProps) => {
|
|
21
|
+
const { data: checkoutProviders } = useGetCheckoutProvidersQuery(null, {});
|
|
22
|
+
const provider = checkoutProviders?.find(
|
|
23
|
+
(provider: ProvidersType) => provider.slug === 'akifast'
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
if (
|
|
27
|
+
!provider ||
|
|
28
|
+
(isPdp && settings?.pdp === false) ||
|
|
29
|
+
(!isPdp && settings?.basket === false)
|
|
30
|
+
) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<PluginModule
|
|
36
|
+
component={Component.OneClickProviderButton}
|
|
37
|
+
props={{
|
|
38
|
+
...rest,
|
|
39
|
+
provider
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default CheckoutButton;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button } from 'projectzeronext/src/components';
|
|
3
|
+
import { PluginModuleComponentProps } from '@akinon/next/types';
|
|
4
|
+
|
|
5
|
+
interface QuickLoginButtonProps extends PluginModuleComponentProps {
|
|
6
|
+
isCaptchaVisible: boolean;
|
|
7
|
+
captchaValidated: boolean;
|
|
8
|
+
buttonText?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const QuickLoginButton = ({
|
|
12
|
+
buttonText = 'Quick Login',
|
|
13
|
+
isCaptchaVisible,
|
|
14
|
+
captchaValidated,
|
|
15
|
+
settings
|
|
16
|
+
}: QuickLoginButtonProps) => {
|
|
17
|
+
if (settings?.quickLogin === false) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Button
|
|
23
|
+
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"
|
|
24
|
+
type="submit"
|
|
25
|
+
appearance="outlined"
|
|
26
|
+
disabled={isCaptchaVisible && !captchaValidated}
|
|
27
|
+
onClick={() => {
|
|
28
|
+
location.href = `/akifast/login/`;
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
{buttonText}
|
|
32
|
+
</Button>
|
|
33
|
+
);
|
|
34
|
+
};
|