@akinon/next 1.104.0 → 1.105.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,5 +1,13 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 1.105.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c39c700: ZERO-3420: Refactor Modal component
8
+ - d512ea2: ZERO-3656: update setLoyaltyData mutation to accept string type
9
+ - 3b255fe: ZERO-3629 :edit warnings in build
10
+
3
11
  ## 1.104.0
4
12
 
5
13
  ### Minor Changes
@@ -4,16 +4,7 @@ import { ReactPortal } from './react-portal';
4
4
  import { Icon } from './icon';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import { useEffect } from 'react';
7
-
8
- export interface ModalProps {
9
- portalId: string;
10
- children?: React.ReactNode;
11
- open?: boolean;
12
- setOpen?: (open: boolean) => void;
13
- title?: React.ReactNode;
14
- showCloseButton?: React.ReactNode;
15
- className?: string;
16
- }
7
+ import { ModalProps } from '../types';
17
8
 
18
9
  export const Modal = (props: ModalProps) => {
19
10
  const {
@@ -23,7 +14,14 @@ export const Modal = (props: ModalProps) => {
23
14
  setOpen,
24
15
  title = '',
25
16
  showCloseButton = true,
26
- className
17
+ className,
18
+ overlayClassName,
19
+ headerWrapperClassName,
20
+ titleClassName,
21
+ closeButtonClassName,
22
+ iconName = 'close',
23
+ iconSize = 16,
24
+ iconClassName
27
25
  } = props;
28
26
 
29
27
  useEffect(() => {
@@ -38,7 +36,12 @@ export const Modal = (props: ModalProps) => {
38
36
 
39
37
  return (
40
38
  <ReactPortal wrapperId={portalId}>
41
- <div className="fixed top-0 left-0 w-screen h-screen bg-primary bg-opacity-60 z-50" />
39
+ <div
40
+ className={twMerge(
41
+ 'fixed top-0 left-0 w-screen h-screen bg-primary bg-opacity-60 z-50',
42
+ overlayClassName
43
+ )}
44
+ />
42
45
  <section
43
46
  className={twMerge(
44
47
  'fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-50 bg-white',
@@ -46,15 +49,28 @@ export const Modal = (props: ModalProps) => {
46
49
  )}
47
50
  >
48
51
  {(showCloseButton || title) && (
49
- <div className="flex px-6 py-4 border-b border-gray-400">
50
- {title && <h3 className="text-lg font-light">{title}</h3>}
52
+ <div
53
+ className={twMerge(
54
+ 'flex px-6 py-4 border-b border-gray-400',
55
+ headerWrapperClassName
56
+ )}
57
+ >
58
+ {title && (
59
+ <h3 className={twMerge('text-lg font-light', titleClassName)}>
60
+ {title}
61
+ </h3>
62
+ )}
51
63
  {showCloseButton && (
52
64
  <button
53
65
  type="button"
54
66
  onClick={() => setOpen(false)}
55
- className="ml-auto"
67
+ className={twMerge('ml-auto', closeButtonClassName)}
56
68
  >
57
- <Icon name="close" size={16} />
69
+ <Icon
70
+ name={iconName}
71
+ size={iconSize}
72
+ className={iconClassName}
73
+ />
58
74
  </button>
59
75
  )}
60
76
  </div>
@@ -21,6 +21,7 @@ enum Plugin {
21
21
  Akifast = 'pz-akifast',
22
22
  MultiBasket = 'pz-multi-basket',
23
23
  SavedCard = 'pz-saved-card',
24
+ Hepsipay = 'pz-hepsipay',
24
25
  FlowPayment = 'pz-flow-payment'
25
26
  }
26
27
 
@@ -47,6 +48,7 @@ export enum Component {
47
48
  AkifastCheckoutButton = 'CheckoutButton',
48
49
  MultiBasket = 'MultiBasket',
49
50
  SavedCard = 'SavedCardOption',
51
+ Hepsipay = 'Hepsipay',
50
52
  FlowPayment = 'FlowPayment'
51
53
  }
52
54
 
@@ -81,6 +83,7 @@ const PluginComponents = new Map([
81
83
  ],
82
84
  [Plugin.MultiBasket, [Component.MultiBasket]],
83
85
  [Plugin.SavedCard, [Component.SavedCard]],
86
+ [Plugin.Hepsipay, [Component.Hepsipay]],
84
87
  [Plugin.FlowPayment, [Component.FlowPayment]]
85
88
  ]);
86
89
 
@@ -146,6 +149,8 @@ export default function PluginModule({
146
149
  promise = import(`${'@akinon/pz-multi-basket'}`);
147
150
  } else if (plugin === Plugin.SavedCard) {
148
151
  promise = import(`${'@akinon/pz-saved-card'}`);
152
+ } else if (plugin === Plugin.Hepsipay) {
153
+ promise = import(`${'@akinon/pz-hepsipay'}`);
149
154
  } else if (plugin === Plugin.FlowPayment) {
150
155
  promise = import(`${'@akinon/pz-flow-payment'}`);
151
156
  }
@@ -839,7 +839,7 @@ export const checkoutApi = api.injectEndpoints({
839
839
  method: 'GET'
840
840
  })
841
841
  }),
842
- setLoyaltyData: build.mutation<CheckoutResponse, number>({
842
+ setLoyaltyData: build.mutation<CheckoutResponse, number | string>({
843
843
  query: (amount) => ({
844
844
  url: buildClientRequestUrl(checkout.loyaltyCardPage, {
845
845
  useFormData: true
@@ -4,7 +4,6 @@ import { Buffer } from 'buffer';
4
4
  import logger from '../utils/log';
5
5
  import { getUrlPathWithLocale } from '../utils/localization';
6
6
  import { PzNextRequest } from '.';
7
- import { ServerVariables } from '../utils/server-variables';
8
7
 
9
8
  const streamToString = async (stream: ReadableStream<Uint8Array> | null) => {
10
9
  if (stream) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@akinon/next",
3
3
  "description": "Core package for Project Zero Next",
4
- "version": "1.104.0",
4
+ "version": "1.105.0",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -35,7 +35,7 @@
35
35
  "set-cookie-parser": "2.6.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@akinon/eslint-plugin-projectzero": "1.104.0",
38
+ "@akinon/eslint-plugin-projectzero": "1.105.0",
39
39
  "@babel/core": "7.26.10",
40
40
  "@babel/preset-env": "7.26.9",
41
41
  "@babel/preset-typescript": "7.27.0",
package/plugins.js CHANGED
@@ -16,5 +16,6 @@ module.exports = [
16
16
  'pz-tabby-extension',
17
17
  'pz-apple-pay',
18
18
  'pz-tamara-extension',
19
+ 'pz-hepsipay',
19
20
  'pz-flow-payment'
20
21
  ];
package/types/index.ts CHANGED
@@ -346,3 +346,20 @@ export interface PaginationProps {
346
346
  direction?: 'next' | 'prev';
347
347
  isLoading?: boolean;
348
348
  }
349
+
350
+ export interface ModalProps {
351
+ portalId: string;
352
+ children?: React.ReactNode;
353
+ open?: boolean;
354
+ setOpen?: (open: boolean) => void;
355
+ title?: React.ReactNode;
356
+ showCloseButton?: React.ReactNode;
357
+ className?: string;
358
+ overlayClassName?: string;
359
+ headerWrapperClassName?: string;
360
+ titleClassName?: string;
361
+ closeButtonClassName?: string;
362
+ iconName?: string;
363
+ iconSize?: number;
364
+ iconClassName?: string;
365
+ }