@akinon/pz-checkout-gift-pack 1.50.0-rc.1 → 1.51.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,14 +1,8 @@
1
1
  # @akinon/pz-checkout-gift-pack
2
2
 
3
- ## 1.50.0-rc.1
3
+ ## 1.51.0
4
4
 
5
- ## 1.50.0-rc.0
6
-
7
- ### Minor Changes
8
-
9
- - 50b90692: ZERO-2767: update plugin readme files
10
- - 64699d3: ZERO-2761: Fix invalid import for plugin module
11
- - 69ca080: ZERO-2780: add modal support for checkout gift pack
5
+ ## 1.50.0
12
6
 
13
7
  ## 1.49.0
14
8
 
package/README.md CHANGED
@@ -1,30 +1,29 @@
1
- # @akinon/pz-checkout-gift-package
1
+ # pz-checkout-gift-package
2
2
 
3
3
  ### Install the npm package
4
4
 
5
5
  ```bash
6
6
  # For latest version
7
- yarn add @akinon/pz-checkout-gift-package
7
+ yarn add ​git+ssh://git@bitbucket.org:akinonteam/pz-checkout-gift-package.git
8
8
 
9
- # Preferred installation method
10
- npx @akinon/projectzero@latest --plugins
9
+ # For specific version
10
+ yarn add ​git+ssh://git@bitbucket.org:akinonteam/pz-checkout-gift-package.git#445a9da
11
11
  ```
12
12
 
13
- ### Example Usage
13
+ ### Next Config Configuration
14
+
15
+ ##### apps/web/next.config.js**
16
+
17
+ ```javascript
18
+ const withTM = require("next-transpile-modules")(["pz-checkout-gift-package"]);
19
+ ```
14
20
 
21
+ ### Example Usage
15
22
  ##### File Path: src/views/checkout/summary.tsx
16
23
 
24
+
17
25
  ```javascript
18
26
  import { CheckoutGiftPackage } from 'pz-checkout-gift-package';
19
27
 
20
- <CheckoutGiftPackage />;
28
+ <CheckoutGiftPackage />
21
29
  ```
22
-
23
- ### Props
24
-
25
- | Properties | Type | Description |
26
- | --- | --- | --- |
27
- | useModal | `boolean` | This prop determines whether the gift pack form will be displayed inside a modal. When set to true, the form will open inside a modal. |
28
- | modalClassName | `string` | This prop is used to customize the overall style of the modal. |
29
- | modalTitle | `string` | This prop sets the title of the modal. |
30
- | modalContentClassName | `string` | This prop is used to customize the style of the modal content. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/pz-checkout-gift-pack",
3
- "version": "1.50.0-rc.1",
3
+ "version": "1.51.0",
4
4
  "license": "MIT",
5
5
  "main": "src/index.tsx",
6
6
  "peerDependencies": {
package/src/index.tsx CHANGED
@@ -1,8 +1,7 @@
1
1
  import { useAppSelector } from '@akinon/next/redux/hooks';
2
2
  import { yupResolver } from '@hookform/resolvers/yup';
3
3
  import clsx from 'clsx';
4
- import { twMerge } from 'tailwind-merge';
5
- import { Accordion, Button, Icon, Modal } from '@akinon/next/components';
4
+ import { Accordion, Button, Icon } from '@akinon/next/components';
6
5
  import { useEffect, useState } from 'react';
7
6
  import { SubmitHandler, useForm } from 'react-hook-form';
8
7
  import { RootState } from 'redux/store';
@@ -15,10 +14,6 @@ interface GiftPackForm {
15
14
 
16
15
  interface CheckoutGiftPackProps {
17
16
  className?: string;
18
- useModal?: boolean;
19
- modalClassName?: string;
20
- modalTitle?: string;
21
- modalContentClassName?: string;
22
17
  translations: {
23
18
  addGiftPackText: string;
24
19
  giftPackAdded: string;
@@ -36,10 +31,6 @@ interface CheckoutGiftPackProps {
36
31
 
37
32
  export const CheckoutGiftPack = ({
38
33
  className,
39
- useModal = false,
40
- modalClassName,
41
- modalContentClassName,
42
- modalTitle = 'Gift Note',
43
34
  translations
44
35
  }: CheckoutGiftPackProps) => {
45
36
  const [isNoteFormOpen, setIsNoteFormOpen] = useState(false);
@@ -111,51 +102,6 @@ export const CheckoutGiftPack = ({
111
102
  resetField('message');
112
103
  };
113
104
 
114
- const formContent = (
115
- <form
116
- className={clsx({
117
- hidden: !isNoteFormOpen
118
- })}
119
- onSubmit={handleSubmit(onSubmit)}
120
- >
121
- <textarea
122
- className={clsx(
123
- 'w-full border border-solid p-4 placeholder:text-[0.75rem] placeholder:text-[#9c9d9d] outline-none text-[0.75rem]',
124
- noteLength > 160 ? 'border-[#e85150]' : 'border-[#7b9d75]'
125
- )}
126
- rows={4}
127
- placeholder={_translations.placeholderInput}
128
- {...register('message')}
129
- />
130
- {errors.message && (
131
- <span className="text-sm text-[#d72a04] text-[0.875rem]">
132
- {errors.message.message}
133
- </span>
134
- )}
135
- <div className="text-[0.75rem]">
136
- {noteLength} / 160 {_translations.charactersLength}
137
- </div>
138
- <div className="flex justify-end items-end gap-2">
139
- {giftBox?.note !== DEFAULT_NOTE && (
140
- <Button
141
- appearance="ghost"
142
- className="text-[0.75rem] underline cursor-pointer border-0 px-0 py-0 h-auto hover:bg-transparent hover:text-[#e95151]"
143
- onClick={removeGiftNote}
144
- >
145
- {_translations.removeGiftNoteText}
146
- </Button>
147
- )}
148
- <Button
149
- type="submit"
150
- className="w-[7rem] h-[1.75rem] font-[0.75rem] uppercase"
151
- appearance="outlined"
152
- >
153
- {_translations.save}
154
- </Button>
155
- </div>
156
- </form>
157
- );
158
-
159
105
  useEffect(() => {
160
106
  if (giftBox?.note !== DEFAULT_NOTE) {
161
107
  setValue('message', giftBox?.note);
@@ -220,33 +166,54 @@ export const CheckoutGiftPack = ({
220
166
  </Button>
221
167
  </div>
222
168
  </div>
223
-
224
- {useModal ? (
225
- <Modal
226
- portalId="checkout-gift-pack-modal"
227
- title={modalTitle}
228
- className={twMerge(
229
- 'w-full sm:w-[28rem] max-h-[90vh] overflow-y-auto',
230
- modalClassName
231
- )}
232
- open={isNoteFormOpen}
233
- setOpen={setIsNoteFormOpen}
169
+ <form
170
+ className={clsx('py-2 px-5', {
171
+ hidden: !isNoteFormOpen
172
+ })}
173
+ onSubmit={handleSubmit(onSubmit)}
174
+ >
175
+ <Accordion
176
+ title={_translations.accordionTitle}
177
+ titleClassName="text-[0.75rem]"
178
+ isCollapse={true}
234
179
  >
235
- <div className={twMerge('px-6 py-4', modalContentClassName)}>
236
- {formContent}
180
+ <textarea
181
+ className={clsx(
182
+ 'w-full border border-solid p-4 placeholder:text-[0.75rem] placeholder:text-[#9c9d9d] outline-none text-[0.75rem]',
183
+ noteLength > 160 ? 'border-[#e85150]' : 'border-[#7b9d75]'
184
+ )}
185
+ rows={4}
186
+ placeholder={_translations.placeholderInput}
187
+ {...register('message')}
188
+ />
189
+ {errors.message && (
190
+ <span className="text-sm text-[#d72a04] text-[0.875rem]">
191
+ {errors.message.message}
192
+ </span>
193
+ )}
194
+ <div className="text-[0.75rem]">
195
+ {noteLength} / 160 {_translations.charactersLength}
237
196
  </div>
238
- </Modal>
239
- ) : (
240
- <div className={clsx('py-2 px-5', { hidden: !isNoteFormOpen })}>
241
- <Accordion
242
- title={_translations.accordionTitle}
243
- titleClassName="text-[0.75rem]"
244
- isCollapse={true}
245
- >
246
- {formContent}
247
- </Accordion>
248
- </div>
249
- )}
197
+ <div className="flex justify-end items-end gap-2">
198
+ {giftBox?.note !== DEFAULT_NOTE && (
199
+ <Button
200
+ appearance="ghost"
201
+ className="text-[0.75rem] underline cursor-pointer border-0 px-0 py-0 h-auto hover:bg-transparent hover:text-[#e95151]"
202
+ onClick={removeGiftNote}
203
+ >
204
+ {_translations.removeGiftNoteText}
205
+ </Button>
206
+ )}
207
+ <Button
208
+ type="submit"
209
+ className="w-[7rem] h-[1.75rem] font-[0.75rem] uppercase"
210
+ appearance="outlined"
211
+ >
212
+ {_translations.save}
213
+ </Button>
214
+ </div>
215
+ </Accordion>
216
+ </form>
250
217
  </div>
251
218
  );
252
219
  };