@akinon/projectzero 1.89.0 → 1.90.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 +6 -0
- package/app-template/CHANGELOG.md +34 -0
- package/app-template/package.json +18 -18
- package/app-template/src/views/product/product-info.tsx +33 -3
- package/commands/plugins.ts +20 -30
- package/dist/commands/plugins.js +19 -20
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# projectzeronext
|
|
2
2
|
|
|
3
|
+
## 1.90.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 4e379cd: ZERO-3365: Added variant selection completion check
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [2657d0c]
|
|
12
|
+
- Updated dependencies [1044bce]
|
|
13
|
+
- Updated dependencies [c9b8c6f]
|
|
14
|
+
- Updated dependencies [d662786]
|
|
15
|
+
- Updated dependencies [e68e120]
|
|
16
|
+
- Updated dependencies [ec9ff89]
|
|
17
|
+
- Updated dependencies [9c3a22a]
|
|
18
|
+
- Updated dependencies [a1463fd]
|
|
19
|
+
- Updated dependencies [99b3fd6]
|
|
20
|
+
- @akinon/pz-akifast@1.90.0
|
|
21
|
+
- @akinon/pz-bkm@1.90.0
|
|
22
|
+
- @akinon/pz-click-collect@1.90.0
|
|
23
|
+
- @akinon/pz-pay-on-delivery@1.90.0
|
|
24
|
+
- @akinon/next@1.90.0
|
|
25
|
+
- @akinon/pz-checkout-gift-pack@1.90.0
|
|
26
|
+
- @akinon/pz-otp@1.90.0
|
|
27
|
+
- @akinon/pz-gpay@1.90.0
|
|
28
|
+
- @akinon/pz-one-click-checkout@1.90.0
|
|
29
|
+
- @akinon/pz-b2b@1.90.0
|
|
30
|
+
- @akinon/pz-basket-gift-pack@1.90.0
|
|
31
|
+
- @akinon/pz-credit-payment@1.90.0
|
|
32
|
+
- @akinon/pz-masterpass@1.90.0
|
|
33
|
+
- @akinon/pz-saved-card@1.90.0
|
|
34
|
+
- @akinon/pz-tabby-extension@1.90.0
|
|
35
|
+
- @akinon/pz-tamara-extension@1.90.0
|
|
36
|
+
|
|
3
37
|
## 1.89.0
|
|
4
38
|
|
|
5
39
|
### Minor Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "projectzeronext",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.90.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -24,22 +24,22 @@
|
|
|
24
24
|
"test:middleware": "jest middleware-matcher.test.ts --bail"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@akinon/next": "1.
|
|
28
|
-
"@akinon/pz-akifast": "1.
|
|
29
|
-
"@akinon/pz-b2b": "1.
|
|
30
|
-
"@akinon/pz-basket-gift-pack": "1.
|
|
31
|
-
"@akinon/pz-bkm": "1.
|
|
32
|
-
"@akinon/pz-checkout-gift-pack": "1.
|
|
33
|
-
"@akinon/pz-click-collect": "1.
|
|
34
|
-
"@akinon/pz-credit-payment": "1.
|
|
35
|
-
"@akinon/pz-gpay": "1.
|
|
36
|
-
"@akinon/pz-masterpass": "1.
|
|
37
|
-
"@akinon/pz-one-click-checkout": "1.
|
|
38
|
-
"@akinon/pz-otp": "1.
|
|
39
|
-
"@akinon/pz-pay-on-delivery": "1.
|
|
40
|
-
"@akinon/pz-saved-card": "1.
|
|
41
|
-
"@akinon/pz-tabby-extension": "1.
|
|
42
|
-
"@akinon/pz-tamara-extension": "1.
|
|
27
|
+
"@akinon/next": "1.90.0",
|
|
28
|
+
"@akinon/pz-akifast": "1.90.0",
|
|
29
|
+
"@akinon/pz-b2b": "1.90.0",
|
|
30
|
+
"@akinon/pz-basket-gift-pack": "1.90.0",
|
|
31
|
+
"@akinon/pz-bkm": "1.90.0",
|
|
32
|
+
"@akinon/pz-checkout-gift-pack": "1.90.0",
|
|
33
|
+
"@akinon/pz-click-collect": "1.90.0",
|
|
34
|
+
"@akinon/pz-credit-payment": "1.90.0",
|
|
35
|
+
"@akinon/pz-gpay": "1.90.0",
|
|
36
|
+
"@akinon/pz-masterpass": "1.90.0",
|
|
37
|
+
"@akinon/pz-one-click-checkout": "1.90.0",
|
|
38
|
+
"@akinon/pz-otp": "1.90.0",
|
|
39
|
+
"@akinon/pz-pay-on-delivery": "1.90.0",
|
|
40
|
+
"@akinon/pz-saved-card": "1.90.0",
|
|
41
|
+
"@akinon/pz-tabby-extension": "1.90.0",
|
|
42
|
+
"@akinon/pz-tamara-extension": "1.90.0",
|
|
43
43
|
"@hookform/resolvers": "2.9.0",
|
|
44
44
|
"@next/third-parties": "14.1.0",
|
|
45
45
|
"@react-google-maps/api": "2.17.1",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"yup": "0.32.11"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@akinon/eslint-plugin-projectzero": "1.
|
|
65
|
+
"@akinon/eslint-plugin-projectzero": "1.90.0",
|
|
66
66
|
"@semantic-release/changelog": "6.0.2",
|
|
67
67
|
"@semantic-release/exec": "6.0.3",
|
|
68
68
|
"@semantic-release/git": "10.0.1",
|
|
@@ -23,6 +23,7 @@ export default function ProductInfo({ data }: ProductPageProps) {
|
|
|
23
23
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
24
24
|
const [stockAlertResponseMessage, setStockAlertResponseMessage] =
|
|
25
25
|
useState(null);
|
|
26
|
+
const [isVariantLoading, setIsVariantLoading] = useState(false);
|
|
26
27
|
|
|
27
28
|
const [addProduct, { isLoading: isAddToCartLoading }] =
|
|
28
29
|
useAddProductToBasket();
|
|
@@ -30,6 +31,18 @@ export default function ProductInfo({ data }: ProductPageProps) {
|
|
|
30
31
|
useAddStockAlertMutation();
|
|
31
32
|
const inStock = data.selected_variant !== null || data.product.in_stock;
|
|
32
33
|
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
isVariantSelectionComplete() && setIsVariantLoading(false);
|
|
36
|
+
|
|
37
|
+
!inStock && setIsVariantLoading(false);
|
|
38
|
+
}, [data]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (isVariantLoading) {
|
|
42
|
+
setProductError(null);
|
|
43
|
+
}
|
|
44
|
+
}, [isVariantLoading]);
|
|
45
|
+
|
|
33
46
|
useEffect(() => {
|
|
34
47
|
setCurrentUrl(window.location.href);
|
|
35
48
|
}, [currentUrl]);
|
|
@@ -82,6 +95,12 @@ export default function ProductInfo({ data }: ProductPageProps) {
|
|
|
82
95
|
return true;
|
|
83
96
|
};
|
|
84
97
|
|
|
98
|
+
const isVariantSelectionComplete = () => {
|
|
99
|
+
return data?.variants.every((variant) =>
|
|
100
|
+
variant?.options.some((opt) => opt.is_selected)
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
|
|
85
104
|
const addProductToStockAlertList = async () => {
|
|
86
105
|
try {
|
|
87
106
|
await addStockAlert({
|
|
@@ -174,7 +193,10 @@ export default function ProductInfo({ data }: ProductPageProps) {
|
|
|
174
193
|
key={variant.attribute_key}
|
|
175
194
|
{...variant}
|
|
176
195
|
className="items-center mt-8"
|
|
177
|
-
onChange={() =>
|
|
196
|
+
onChange={() => {
|
|
197
|
+
setProductError(null);
|
|
198
|
+
setIsVariantLoading(true);
|
|
199
|
+
}}
|
|
178
200
|
/>
|
|
179
201
|
))}
|
|
180
202
|
</div>
|
|
@@ -186,7 +208,9 @@ export default function ProductInfo({ data }: ProductPageProps) {
|
|
|
186
208
|
)}
|
|
187
209
|
|
|
188
210
|
<Button
|
|
189
|
-
disabled={
|
|
211
|
+
disabled={
|
|
212
|
+
isAddToCartLoading || isAddToStockAlertLoading || isVariantLoading
|
|
213
|
+
}
|
|
190
214
|
className={clsx(
|
|
191
215
|
'fixed bottom-0 right-0 w-1/2 h-14 z-[20] flex items-center justify-center fill-primary-foreground',
|
|
192
216
|
'hover:fill-primary sm:relative sm:w-full sm:mt-3 sm:font-semibold sm:h-12'
|
|
@@ -202,7 +226,13 @@ export default function ProductInfo({ data }: ProductPageProps) {
|
|
|
202
226
|
}}
|
|
203
227
|
data-testid="product-add-to-cart"
|
|
204
228
|
>
|
|
205
|
-
{
|
|
229
|
+
{isVariantLoading ? (
|
|
230
|
+
<Icon
|
|
231
|
+
name="spinner"
|
|
232
|
+
size={20}
|
|
233
|
+
className="animate-spin mr-4 fill-primary"
|
|
234
|
+
/>
|
|
235
|
+
) : inStock ? (
|
|
206
236
|
<span>{t('product.add_to_cart')}</span>
|
|
207
237
|
) : (
|
|
208
238
|
<>
|
package/commands/plugins.ts
CHANGED
|
@@ -2,8 +2,7 @@ import * as fs from 'fs';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { execSync } from 'child_process';
|
|
4
4
|
import semver from 'semver';
|
|
5
|
-
|
|
6
|
-
const Prompt = require('prompt-checkbox');
|
|
5
|
+
import { checkbox } from '@inquirer/prompts';
|
|
7
6
|
|
|
8
7
|
const rootDir = path.resolve(process.cwd());
|
|
9
8
|
|
|
@@ -120,36 +119,25 @@ export default async () => {
|
|
|
120
119
|
}
|
|
121
120
|
];
|
|
122
121
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
answer.replace(/\d\)\s/, '')
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
const values = formattedAnswers.map(
|
|
139
|
-
(answer) => definedPlugins.find((p) => p.name === answer)?.value
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
if (formattedAnswers.length) {
|
|
143
|
-
console.log(`\nInstalling ${formattedAnswers.join(', ')}.`);
|
|
144
|
-
} else {
|
|
145
|
-
console.log(`\nUninstalling all plugins.`);
|
|
122
|
+
try {
|
|
123
|
+
const answers = await checkbox({
|
|
124
|
+
message: 'Please check/uncheck plugins to install/uninstall.',
|
|
125
|
+
choices: definedPlugins.map((plugin) => ({
|
|
126
|
+
name: plugin.name,
|
|
127
|
+
value: plugin.value,
|
|
128
|
+
checked: installedPlugins.includes(plugin.value)
|
|
129
|
+
}))
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
if (!answers.length) {
|
|
133
|
+
console.log('\x1b[33m%s\x1b[0m', `\nUninstalling all plugins.`);
|
|
146
134
|
}
|
|
147
135
|
|
|
148
|
-
console.log(`\nPlease wait...`);
|
|
136
|
+
console.log('\x1b[36m%s\x1b[0m', `\nPlease wait...`);
|
|
149
137
|
|
|
150
138
|
fs.writeFileSync(
|
|
151
139
|
pluginsFilePath,
|
|
152
|
-
`module.exports = ${JSON.stringify(
|
|
140
|
+
`module.exports = ${JSON.stringify(answers)};\n`,
|
|
153
141
|
{
|
|
154
142
|
encoding: 'utf-8'
|
|
155
143
|
}
|
|
@@ -159,11 +147,13 @@ export default async () => {
|
|
|
159
147
|
|
|
160
148
|
console.log(
|
|
161
149
|
'\x1b[32m%s\x1b[0m',
|
|
162
|
-
`\n
|
|
163
|
-
|
|
150
|
+
`\n✓ ${
|
|
151
|
+
answers.length
|
|
164
152
|
? 'Installed selected plugins'
|
|
165
153
|
: 'Uninstalled all plugins'
|
|
166
154
|
}.\n`
|
|
167
155
|
);
|
|
168
|
-
})
|
|
156
|
+
} catch (error) {
|
|
157
|
+
process.exit(1);
|
|
158
|
+
}
|
|
169
159
|
};
|
package/dist/commands/plugins.js
CHANGED
|
@@ -39,7 +39,7 @@ const fs = __importStar(require("fs"));
|
|
|
39
39
|
const path_1 = __importDefault(require("path"));
|
|
40
40
|
const child_process_1 = require("child_process");
|
|
41
41
|
const semver_1 = __importDefault(require("semver"));
|
|
42
|
-
const
|
|
42
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
43
43
|
const rootDir = path_1.default.resolve(process.cwd());
|
|
44
44
|
function checkVersion(pkg) {
|
|
45
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -133,29 +133,28 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
133
133
|
value: 'pz-tamara-extension'
|
|
134
134
|
}
|
|
135
135
|
];
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
console.log(`\nInstalling ${formattedAnswers.join(', ')}.`);
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
console.log(`\nUninstalling all plugins.`);
|
|
136
|
+
try {
|
|
137
|
+
const answers = yield (0, prompts_1.checkbox)({
|
|
138
|
+
message: 'Please check/uncheck plugins to install/uninstall.',
|
|
139
|
+
choices: definedPlugins.map((plugin) => ({
|
|
140
|
+
name: plugin.name,
|
|
141
|
+
value: plugin.value,
|
|
142
|
+
checked: installedPlugins.includes(plugin.value)
|
|
143
|
+
}))
|
|
144
|
+
});
|
|
145
|
+
if (!answers.length) {
|
|
146
|
+
console.log('\x1b[33m%s\x1b[0m', `\nUninstalling all plugins.`);
|
|
151
147
|
}
|
|
152
|
-
console.log(`\nPlease wait...`);
|
|
153
|
-
fs.writeFileSync(pluginsFilePath, `module.exports = ${JSON.stringify(
|
|
148
|
+
console.log('\x1b[36m%s\x1b[0m', `\nPlease wait...`);
|
|
149
|
+
fs.writeFileSync(pluginsFilePath, `module.exports = ${JSON.stringify(answers)};\n`, {
|
|
154
150
|
encoding: 'utf-8'
|
|
155
151
|
});
|
|
156
152
|
(0, child_process_1.execSync)('yarn install', { stdio: 'pipe' });
|
|
157
|
-
console.log('\x1b[32m%s\x1b[0m', `\n
|
|
153
|
+
console.log('\x1b[32m%s\x1b[0m', `\n✓ ${answers.length
|
|
158
154
|
? 'Installed selected plugins'
|
|
159
155
|
: 'Uninstalled all plugins'}.\n`);
|
|
160
|
-
}
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
process.exit(1);
|
|
159
|
+
}
|
|
161
160
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/projectzero",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.90.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "CLI tool to manage your Project Zero Next project",
|
|
6
6
|
"bin": {
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"@types/temp": "0.9.4"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
+
"@inquirer/prompts": "7.5.0",
|
|
22
23
|
"loading-spinner": "1.2.1",
|
|
23
|
-
"prompt-checkbox": "2.2.0",
|
|
24
24
|
"semver": "7.6.2",
|
|
25
25
|
"temp": "0.9.4",
|
|
26
26
|
"yargs": "^17.6.0"
|