@akinon/projectzero 1.71.0-rc.4 → 1.71.0-rc.6

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,5 +1,9 @@
1
1
  # @akinon/projectzero
2
2
 
3
+ ## 1.71.0-rc.6
4
+
5
+ ## 1.71.0-rc.5
6
+
3
7
  ## 1.71.0-rc.4
4
8
 
5
9
  ## 1.71.0-rc.3
@@ -1,5 +1,51 @@
1
1
  # projectzeronext
2
2
 
3
+ ## 1.71.0-rc.6
4
+
5
+ ### Minor Changes
6
+
7
+ - f34454a: ZERO-2953: Add hepsipay payment method
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [f34454a]
12
+ - @akinon/next@1.71.0-rc.6
13
+ - @akinon/pz-akifast@1.71.0-rc.6
14
+ - @akinon/pz-b2b@1.71.0-rc.6
15
+ - @akinon/pz-basket-gift-pack@1.71.0-rc.6
16
+ - @akinon/pz-bkm@1.71.0-rc.6
17
+ - @akinon/pz-checkout-gift-pack@1.71.0-rc.6
18
+ - @akinon/pz-click-collect@1.71.0-rc.6
19
+ - @akinon/pz-credit-payment@1.71.0-rc.6
20
+ - @akinon/pz-gpay@1.71.0-rc.6
21
+ - @akinon/pz-masterpass@1.71.0-rc.6
22
+ - @akinon/pz-one-click-checkout@1.71.0-rc.6
23
+ - @akinon/pz-otp@1.71.0-rc.6
24
+ - @akinon/pz-pay-on-delivery@1.71.0-rc.6
25
+ - @akinon/pz-saved-card@1.71.0-rc.6
26
+ - @akinon/pz-tabby-extension@1.71.0-rc.6
27
+
28
+ ## 1.71.0-rc.5
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies [0ab91e5]
33
+ - @akinon/pz-akifast@1.71.0-rc.5
34
+ - @akinon/next@1.71.0-rc.5
35
+ - @akinon/pz-b2b@1.71.0-rc.5
36
+ - @akinon/pz-basket-gift-pack@1.71.0-rc.5
37
+ - @akinon/pz-bkm@1.71.0-rc.5
38
+ - @akinon/pz-checkout-gift-pack@1.71.0-rc.5
39
+ - @akinon/pz-click-collect@1.71.0-rc.5
40
+ - @akinon/pz-credit-payment@1.71.0-rc.5
41
+ - @akinon/pz-gpay@1.71.0-rc.5
42
+ - @akinon/pz-masterpass@1.71.0-rc.5
43
+ - @akinon/pz-one-click-checkout@1.71.0-rc.5
44
+ - @akinon/pz-otp@1.71.0-rc.5
45
+ - @akinon/pz-pay-on-delivery@1.71.0-rc.5
46
+ - @akinon/pz-saved-card@1.71.0-rc.5
47
+ - @akinon/pz-tabby-extension@1.71.0-rc.5
48
+
3
49
  ## 1.71.0-rc.4
4
50
 
5
51
  ### Minor Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projectzeronext",
3
- "version": "1.71.0-rc.4",
3
+ "version": "1.71.0-rc.6",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -22,21 +22,21 @@
22
22
  "prestart": "pz-prestart"
23
23
  },
24
24
  "dependencies": {
25
- "@akinon/next": "1.71.0-rc.4",
26
- "@akinon/pz-akifast": "1.71.0-rc.4",
27
- "@akinon/pz-b2b": "1.71.0-rc.4",
28
- "@akinon/pz-basket-gift-pack": "1.71.0-rc.4",
29
- "@akinon/pz-bkm": "1.71.0-rc.4",
30
- "@akinon/pz-checkout-gift-pack": "1.71.0-rc.4",
31
- "@akinon/pz-click-collect": "1.71.0-rc.4",
32
- "@akinon/pz-credit-payment": "1.71.0-rc.4",
33
- "@akinon/pz-gpay": "1.71.0-rc.4",
34
- "@akinon/pz-masterpass": "1.71.0-rc.4",
35
- "@akinon/pz-one-click-checkout": "1.71.0-rc.4",
36
- "@akinon/pz-otp": "1.71.0-rc.4",
37
- "@akinon/pz-pay-on-delivery": "1.71.0-rc.4",
38
- "@akinon/pz-saved-card": "1.71.0-rc.4",
39
- "@akinon/pz-tabby-extension": "1.71.0-rc.4",
25
+ "@akinon/next": "1.71.0-rc.6",
26
+ "@akinon/pz-akifast": "1.71.0-rc.6",
27
+ "@akinon/pz-b2b": "1.71.0-rc.6",
28
+ "@akinon/pz-basket-gift-pack": "1.71.0-rc.6",
29
+ "@akinon/pz-bkm": "1.71.0-rc.6",
30
+ "@akinon/pz-checkout-gift-pack": "1.71.0-rc.6",
31
+ "@akinon/pz-click-collect": "1.71.0-rc.6",
32
+ "@akinon/pz-credit-payment": "1.71.0-rc.6",
33
+ "@akinon/pz-gpay": "1.71.0-rc.6",
34
+ "@akinon/pz-masterpass": "1.71.0-rc.6",
35
+ "@akinon/pz-one-click-checkout": "1.71.0-rc.6",
36
+ "@akinon/pz-otp": "1.71.0-rc.6",
37
+ "@akinon/pz-pay-on-delivery": "1.71.0-rc.6",
38
+ "@akinon/pz-saved-card": "1.71.0-rc.6",
39
+ "@akinon/pz-tabby-extension": "1.71.0-rc.6",
40
40
  "@hookform/resolvers": "2.9.0",
41
41
  "@next/third-parties": "14.1.0",
42
42
  "@react-google-maps/api": "2.17.1",
@@ -60,7 +60,7 @@
60
60
  "yup": "0.32.11"
61
61
  },
62
62
  "devDependencies": {
63
- "@akinon/eslint-plugin-projectzero": "1.71.0-rc.4",
63
+ "@akinon/eslint-plugin-projectzero": "1.71.0-rc.6",
64
64
  "@semantic-release/changelog": "6.0.2",
65
65
  "@semantic-release/exec": "6.0.3",
66
66
  "@semantic-release/git": "10.0.1",
@@ -4,8 +4,14 @@ import { CheckoutPaymentOption } from '@akinon/next/types';
4
4
  import clsx from 'clsx';
5
5
  import { RootState } from '@theme/redux/store';
6
6
  import PaymentOptionButtons from './payment-option-buttons';
7
+ import HepsiPay from './options/hepsipay';
7
8
 
8
- export const PaymentOptionViews: Array<CheckoutPaymentOption> = [];
9
+ export const PaymentOptionViews: Array<CheckoutPaymentOption> = [
10
+ {
11
+ slug: 'hepsipay',
12
+ view: HepsiPay
13
+ }
14
+ ];
9
15
 
10
16
  const PaymentStep = () => {
11
17
  const isPaymentStepBusy = useAppSelector(
@@ -0,0 +1,135 @@
1
+ import { Button, Icon } from '@theme/components';
2
+ import Script from 'next/script';
3
+ import { useEffect, useCallback, useState } from 'react';
4
+ import { RootState } from '@theme/redux/store';
5
+ import { useAppSelector } from '@akinon/next/redux/hooks';
6
+ import { useSetWalletCompletePageMutation } from '@akinon/next/data/client/checkout';
7
+ import * as yup from 'yup';
8
+ import { SubmitHandler, useForm } from 'react-hook-form';
9
+ import { yupResolver } from '@hookform/resolvers/yup';
10
+ import CheckoutAgreements from '../agreements';
11
+
12
+ interface InitOptions {
13
+ frameUrl: string;
14
+ frameDivId: string;
15
+ paymentStatusCallback: (isPaymentAllowed: boolean) => void;
16
+ frameFailureCallback: () => void;
17
+ onPaymentSuccessCallback: (payload: any) => void;
18
+ maxHeight: string;
19
+ disableDynamicHeight: boolean;
20
+ showFramePaymentButton: boolean;
21
+ useApiCallOnSuccessCallback: boolean;
22
+ selectedPaymentInfoCallback: (payload: any) => void;
23
+ overrideFontFamily: string;
24
+ hideHeader: boolean;
25
+ }
26
+
27
+ const hepsiPayFormSchema = () =>
28
+ yup.object().shape({
29
+ agreement: yup.boolean().oneOf([true], 'Bu Alan Zorunlu')
30
+ });
31
+
32
+ export default function HepsiPay() {
33
+ const {
34
+ handleSubmit,
35
+ control,
36
+ formState: { errors }
37
+ } = useForm({
38
+ resolver: yupResolver(hepsiPayFormSchema())
39
+ });
40
+
41
+ const [isPaymentSuccessful, setIsPaymentSuccessful] = useState(false);
42
+
43
+ const context_extras = useAppSelector(
44
+ (state: RootState) => state.checkout.preOrder?.context_extras
45
+ );
46
+
47
+ const hepsipayAvailability = useAppSelector(
48
+ (state: RootState) => state.checkout?.hepsipayAvailability
49
+ );
50
+
51
+ const frameUrl = context_extras?.FrameUrl;
52
+
53
+ const [setWalletCompletePage] = useSetWalletCompletePageMutation();
54
+
55
+ const initHepsipay = useCallback(() => {
56
+ if (!frameUrl || !window.HepsipaySdk) return;
57
+
58
+ const initOptions: InitOptions = {
59
+ frameUrl,
60
+ frameDivId: 'hepsipay-frame',
61
+ paymentStatusCallback: () => {},
62
+ frameFailureCallback: () => {},
63
+ onPaymentSuccessCallback: () => {
64
+ setIsPaymentSuccessful(true);
65
+ setWalletCompletePage();
66
+ },
67
+ maxHeight: '800',
68
+ disableDynamicHeight: false,
69
+ showFramePaymentButton: false,
70
+ useApiCallOnSuccessCallback: false,
71
+ selectedPaymentInfoCallback: () => {},
72
+ overrideFontFamily: 'Inter',
73
+ hideHeader: false
74
+ };
75
+
76
+ window.HepsipaySdk.init(initOptions);
77
+ }, [frameUrl, setWalletCompletePage]);
78
+
79
+ useEffect(() => {
80
+ if (window.HepsipaySdk) {
81
+ initHepsipay();
82
+ }
83
+ }, [initHepsipay]);
84
+
85
+ const onSubmit: SubmitHandler<null> = async () => {
86
+ if (window.HepsipaySdk) {
87
+ window.HepsipaySdk.initPayment();
88
+ } else {
89
+ console.error('Hepsipay SDK is not available');
90
+ }
91
+ };
92
+
93
+ return (
94
+ <div className="p-4 sm:px-6">
95
+ {isPaymentSuccessful ? (
96
+ <></>
97
+ ) : hepsipayAvailability ? (
98
+ <>
99
+ <div id="hepsipay-frame"></div>
100
+ <form onSubmit={handleSubmit(onSubmit)}>
101
+ <div className="flex items-start flex-col border-t border-solid border-gray-400 py-4 space-y-4">
102
+ <CheckoutAgreements
103
+ control={control}
104
+ error={errors.agreement}
105
+ fieldId="agreement"
106
+ />
107
+ <Button
108
+ className="group uppercase mt-4 inline-flex items-center justify-center w-full"
109
+ type="submit"
110
+ data-testid="checkout-bank-account-place-order"
111
+ >
112
+ <span>PLACE ORDER</span>
113
+ <Icon
114
+ name="chevron-end"
115
+ size={12}
116
+ className="fill-primary-foreground ml-2 h-3 group-hover:fill-primary"
117
+ />
118
+ </Button>
119
+ </div>
120
+ </form>
121
+
122
+ <Script
123
+ src="https://images.hepsiburada.net/hepsipay/packages/pf/hepsipay-latest.min.js"
124
+ defer
125
+ />
126
+ </>
127
+ ) : (
128
+ <div className="py-12 px-4">
129
+ Bu kullanıcı için hepsipay kullanılamıyor. Lütfen başka bir ödeme
130
+ yöntemi seçin.
131
+ </div>
132
+ )}
133
+ </div>
134
+ );
135
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/projectzero",
3
- "version": "1.71.0-rc.4",
3
+ "version": "1.71.0-rc.6",
4
4
  "private": false,
5
5
  "description": "CLI tool to manage your Project Zero Next project",
6
6
  "bin": {