@akinon/projectzero 1.54.0 → 1.55.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,11 @@
1
1
  # @akinon/projectzero
2
2
 
3
+ ## 1.55.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 00ffde2: ZERO-2637: enhance create command with improved messaging
8
+
3
9
  ## 1.54.0
4
10
 
5
11
  ### Minor Changes
@@ -1,5 +1,32 @@
1
1
  # projectzeronext
2
2
 
3
+ ## 1.55.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 97b8bdc: ZERO-2724: Remove onClick event in shipping options component
8
+ - 75080fd: ZERO-2630: Add max limit to postcode area
9
+ - eecb282: ZERO-2607: Update address-related functions to include invalidateTag option
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [1448a96]
14
+ - Updated dependencies [75080fd]
15
+ - Updated dependencies [eecb282]
16
+ - @akinon/next@1.55.0
17
+ - @akinon/pz-akifast@1.55.0
18
+ - @akinon/pz-b2b@1.55.0
19
+ - @akinon/pz-basket-gift-pack@1.55.0
20
+ - @akinon/pz-bkm@1.55.0
21
+ - @akinon/pz-checkout-gift-pack@1.55.0
22
+ - @akinon/pz-click-collect@1.55.0
23
+ - @akinon/pz-credit-payment@1.55.0
24
+ - @akinon/pz-gpay@1.55.0
25
+ - @akinon/pz-masterpass@1.55.0
26
+ - @akinon/pz-one-click-checkout@1.55.0
27
+ - @akinon/pz-otp@1.55.0
28
+ - @akinon/pz-pay-on-delivery@1.55.0
29
+
3
30
  ## 1.54.0
4
31
 
5
32
  ### Minor Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projectzeronext",
3
- "version": "1.54.0",
3
+ "version": "1.55.0",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -22,19 +22,19 @@
22
22
  "prestart": "pz-prestart"
23
23
  },
24
24
  "dependencies": {
25
- "@akinon/next": "1.54.0",
26
- "@akinon/pz-akifast": "1.54.0",
27
- "@akinon/pz-b2b": "1.54.0",
28
- "@akinon/pz-basket-gift-pack": "1.54.0",
29
- "@akinon/pz-bkm": "1.54.0",
30
- "@akinon/pz-checkout-gift-pack": "1.54.0",
31
- "@akinon/pz-click-collect": "1.54.0",
32
- "@akinon/pz-credit-payment": "1.54.0",
33
- "@akinon/pz-gpay": "1.54.0",
34
- "@akinon/pz-masterpass": "1.54.0",
35
- "@akinon/pz-one-click-checkout": "1.54.0",
36
- "@akinon/pz-otp": "1.54.0",
37
- "@akinon/pz-pay-on-delivery": "1.54.0",
25
+ "@akinon/next": "1.55.0",
26
+ "@akinon/pz-akifast": "1.55.0",
27
+ "@akinon/pz-b2b": "1.55.0",
28
+ "@akinon/pz-basket-gift-pack": "1.55.0",
29
+ "@akinon/pz-bkm": "1.55.0",
30
+ "@akinon/pz-checkout-gift-pack": "1.55.0",
31
+ "@akinon/pz-click-collect": "1.55.0",
32
+ "@akinon/pz-credit-payment": "1.55.0",
33
+ "@akinon/pz-gpay": "1.55.0",
34
+ "@akinon/pz-masterpass": "1.55.0",
35
+ "@akinon/pz-one-click-checkout": "1.55.0",
36
+ "@akinon/pz-otp": "1.55.0",
37
+ "@akinon/pz-pay-on-delivery": "1.55.0",
38
38
  "@hookform/resolvers": "2.9.0",
39
39
  "@next/third-parties": "14.1.0",
40
40
  "@react-google-maps/api": "2.17.1",
@@ -59,7 +59,7 @@
59
59
  "yup": "0.32.11"
60
60
  },
61
61
  "devDependencies": {
62
- "@akinon/eslint-plugin-projectzero": "1.54.0",
62
+ "@akinon/eslint-plugin-projectzero": "1.55.0",
63
63
  "@semantic-release/changelog": "6.0.2",
64
64
  "@semantic-release/exec": "6.0.3",
65
65
  "@semantic-release/git": "10.0.1",
@@ -17,7 +17,7 @@ export default function Page() {
17
17
  const [addAddress] = useAddAddressMutation();
18
18
 
19
19
  const onSubmit = async (data) => {
20
- await addAddress(data);
20
+ await addAddress({ ...data, invalidateTag: 'Addresses' });
21
21
  setIsNewAddressModalOpen(false);
22
22
  };
23
23
 
@@ -27,13 +27,13 @@ export const AddressCard = (props: Props) => {
27
27
  const [isRemoveAddressModalOpen, setRemoveAddressModalOpen] = useState(false);
28
28
 
29
29
  const onSubmit = async (data) => {
30
- await editAddress(data);
30
+ await editAddress({ ...data, invalidateTag: 'Addresses' });
31
31
  setIsEditAddressModalOpen(false);
32
32
  };
33
33
 
34
34
  const handleRemoveAddress = async (pk: number) => {
35
35
  try {
36
- await removeAddress(pk)
36
+ await removeAddress({ id: pk, invalidateTag: 'Addresses' })
37
37
  .unwrap()
38
38
  .then(() => setRemoveAddressModalOpen(false))
39
39
  .catch((err) => console.error(err));
@@ -31,7 +31,7 @@ interface Props {
31
31
  onSubmit: (data: any) => void;
32
32
  }
33
33
 
34
- const makeAddressFormSchema = (t, { phoneNumberLength }) =>
34
+ const makeAddressFormSchema = (t, { phoneNumberLength, postCodeLength }) =>
35
35
  yup.object().shape({
36
36
  title: yup.string().required(t('account.address_book.form.error.required')),
37
37
  first_name: yup
@@ -65,8 +65,9 @@ const makeAddressFormSchema = (t, { phoneNumberLength }) =>
65
65
  .max(255, t('account.address_book.form.error.line_max')),
66
66
  postcode: yup
67
67
  .string()
68
- .min(5, t('account.address_book.form.error.postcode_min'))
69
- .max(5, t('account.address_book.form.error.postcode_max'))
68
+ .transform((value: string) => value.replace(/_/g, '').replace(/ /g, ''))
69
+ .min(postCodeLength, t('account.address_book.form.error.postcode_min'))
70
+ .max(postCodeLength, t('account.address_book.form.error.postcode_max'))
70
71
  .required(t('account.address_book.form.error.required')),
71
72
  company_name: yup.string().nullable(),
72
73
  tax_no: yup.string().nullable(),
@@ -80,7 +81,8 @@ export const AddressForm = (props: Props) => {
80
81
  const { data, onSubmit } = props;
81
82
  const config = useAppSelector((state) => state.config);
82
83
  const addressFormSchema = makeAddressFormSchema(t, {
83
- phoneNumberLength: config.user_phone_format.length
84
+ phoneNumberLength: config.user_phone_format.length,
85
+ postCodeLength: config.user_post_code_format.length
84
86
  });
85
87
  const {
86
88
  register,
@@ -322,12 +324,15 @@ export const AddressForm = (props: Props) => {
322
324
  )}
323
325
  </label>
324
326
  <Input
325
- type="number"
326
327
  label={t('account.address_book.form.post_code.placeholder')}
327
328
  {...register('postcode')}
328
329
  error={errors.postcode}
329
330
  data-testid="address-form-post-code"
330
331
  required
332
+ format={config.user_post_code_format.replaceAll(/\9/g, '#')}
333
+ control={control}
334
+ mask="_"
335
+ allowEmptyFormatting
331
336
  />
332
337
  {selectedFormType === AddressType.company && (
333
338
  <>
@@ -85,7 +85,7 @@ const AddressBox = ({
85
85
  };
86
86
 
87
87
  const onSubmit = (data) => {
88
- editAddress(data)
88
+ editAddress({ ...data, invalidateTag: 'Addresses' })
89
89
  .unwrap()
90
90
  .then((editAddressResponse) => {
91
91
  handleAddressClick(addressType, editAddressResponse);
@@ -96,7 +96,7 @@ const AddressBox = ({
96
96
  };
97
97
 
98
98
  const handleRemoveAddress = async (addressPk: number) => {
99
- await removeAddress(addressPk);
99
+ await removeAddress({ id: addressPk, invalidateTag: 'Addresses' });
100
100
  setRemoveAddressModalOpen(false);
101
101
  dispatch(resetCheckoutState());
102
102
 
@@ -77,7 +77,7 @@ const Addresses = () => {
77
77
  }, [billing_and_shipping_same]);
78
78
 
79
79
  const onSubmit = (data) => {
80
- addAddress(data)
80
+ addAddress({ ...data, invalidateTag: 'Addresses' })
81
81
  .unwrap()
82
82
  .then((addAddressResponse) => {
83
83
  if (addressList.length === 0) {
@@ -43,9 +43,6 @@ const ShippingOptions = () => {
43
43
  onChange={() => {
44
44
  setShippingOption(option.pk);
45
45
  }}
46
- onClick={() => {
47
- setShippingOption(option?.pk);
48
- }}
49
46
  data-testid={`checkout-shipping-option-${option.pk}`}
50
47
  >
51
48
  {option.name}
@@ -3,6 +3,7 @@ import * as fs from 'fs';
3
3
  import * as readline from 'readline';
4
4
  import { slugify } from '../utils';
5
5
 
6
+ const { execSync } = require('child_process');
6
7
  const loadingSpinner = require('loading-spinner');
7
8
 
8
9
  interface Question {
@@ -139,7 +140,8 @@ export default async (): Promise<void> => {
139
140
  const answers = await getAnswers();
140
141
  const brandName =
141
142
  answers.brandName === '.' ? path.basename(workingDir) : answers.brandName;
142
- const projectDir = path.resolve(workingDir, slugify(brandName));
143
+ const projectDir = answers.brandName === '.' ? workingDir : path.resolve(workingDir, slugify(brandName));
144
+ const relativeProjectDir = answers.brandName === '.' ? '.' : slugify(brandName);
143
145
 
144
146
  if (!fs.existsSync(projectDir)) {
145
147
  fs.mkdirSync(projectDir, { recursive: true });
@@ -174,12 +176,34 @@ export default async (): Promise<void> => {
174
176
  name: slugify(brandName)
175
177
  });
176
178
 
179
+
180
+ console.log('\x1b[34m%s\x1b[0m', '\nšŸš€ Installing packages...\n');
181
+
182
+ execSync(`cd ${relativeProjectDir} && yarn install`, { stdio: 'ignore' });
183
+
177
184
  loadingSpinner.stop();
178
185
 
179
- console.log(
180
- '\x1b[32m%s\x1b[0m',
181
- `\n āœ“ ${answers.brandName} project is ready.\n`
182
- );
186
+ const successMessage = `
187
+ ✨ ${brandName} project is ready at \x1b[4m${projectDir}\x1b[0m
188
+
189
+ Within the directory, the following commands are available:
190
+
191
+ \x1b[35m$ yarn dev\x1b[0m
192
+ \x1b[32mLaunches the development server.\x1b[0m
193
+
194
+ \x1b[35m$ yarn build\x1b[0m
195
+ \x1b[32mCompiles the app into static files for production.\x1b[0m
196
+
197
+ \x1b[35m$ yarn start\x1b[0m
198
+ \x1b[32mRuns the production server.\x1b[0m
199
+ `;
200
+
201
+ const getStartedMessage = answers.brandName === '.'
202
+ ? 'To get started, you can type:\n\n \x1b[35m$ yarn dev\x1b[0m\n'
203
+ : `To get started, you can type:\n\n \x1b[35m$ cd ${relativeProjectDir}\x1b[0m\n \x1b[35m$ yarn dev\x1b[0m\n`;
183
204
 
205
+ console.log('\x1b[32m%s\x1b[0m', successMessage);
206
+ console.log('\x1b[36m%s\x1b[0m', getStartedMessage);
207
+ console.log('\x1b[33m%s\x1b[0m', 'Project setup is complete\n');
184
208
  console.log('\x1b[33m%s\x1b[0m', 'Project Zero - Akinon\n');
185
209
  };
@@ -39,6 +39,7 @@ const path_1 = __importDefault(require("path"));
39
39
  const fs = __importStar(require("fs"));
40
40
  const readline = __importStar(require("readline"));
41
41
  const utils_1 = require("../utils");
42
+ const { execSync } = require('child_process');
42
43
  const loadingSpinner = require('loading-spinner');
43
44
  const workingDir = path_1.default.resolve(process.cwd());
44
45
  const rl = readline.createInterface({
@@ -131,7 +132,8 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
131
132
  }
132
133
  const answers = yield getAnswers();
133
134
  const brandName = answers.brandName === '.' ? path_1.default.basename(workingDir) : answers.brandName;
134
- const projectDir = path_1.default.resolve(workingDir, (0, utils_1.slugify)(brandName));
135
+ const projectDir = answers.brandName === '.' ? workingDir : path_1.default.resolve(workingDir, (0, utils_1.slugify)(brandName));
136
+ const relativeProjectDir = answers.brandName === '.' ? '.' : (0, utils_1.slugify)(brandName);
135
137
  if (!fs.existsSync(projectDir)) {
136
138
  fs.mkdirSync(projectDir, { recursive: true });
137
139
  }
@@ -154,7 +156,28 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
154
156
  updateFileContents(path_1.default.join(projectDir, 'package.json'), {
155
157
  name: (0, utils_1.slugify)(brandName)
156
158
  });
159
+ console.log('\x1b[34m%s\x1b[0m', '\nšŸš€ Installing packages...\n');
160
+ execSync(`cd ${relativeProjectDir} && yarn install`, { stdio: 'ignore' });
157
161
  loadingSpinner.stop();
158
- console.log('\x1b[32m%s\x1b[0m', `\n āœ“ ${answers.brandName} project is ready.\n`);
162
+ const successMessage = `
163
+ ✨ ${brandName} project is ready at \x1b[4m${projectDir}\x1b[0m
164
+
165
+ Within the directory, the following commands are available:
166
+
167
+ \x1b[35m$ yarn dev\x1b[0m
168
+ \x1b[32mLaunches the development server.\x1b[0m
169
+
170
+ \x1b[35m$ yarn build\x1b[0m
171
+ \x1b[32mCompiles the app into static files for production.\x1b[0m
172
+
173
+ \x1b[35m$ yarn start\x1b[0m
174
+ \x1b[32mRuns the production server.\x1b[0m
175
+ `;
176
+ const getStartedMessage = answers.brandName === '.'
177
+ ? 'To get started, you can type:\n\n \x1b[35m$ yarn dev\x1b[0m\n'
178
+ : `To get started, you can type:\n\n \x1b[35m$ cd ${relativeProjectDir}\x1b[0m\n \x1b[35m$ yarn dev\x1b[0m\n`;
179
+ console.log('\x1b[32m%s\x1b[0m', successMessage);
180
+ console.log('\x1b[36m%s\x1b[0m', getStartedMessage);
181
+ console.log('\x1b[33m%s\x1b[0m', 'Project setup is complete\n');
159
182
  console.log('\x1b[33m%s\x1b[0m', 'Project Zero - Akinon\n');
160
183
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/projectzero",
3
- "version": "1.54.0",
3
+ "version": "1.55.0",
4
4
  "private": false,
5
5
  "description": "CLI tool to manage your Project Zero Next project",
6
6
  "bin": {