@akinon/projectzero 1.89.0-rc.12 → 1.89.0-rc.14

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.89.0-rc.14
4
+
5
+ ## 1.89.0-rc.13
6
+
3
7
  ## 1.89.0-rc.12
4
8
 
5
9
  ## 1.89.0-rc.11
@@ -1,5 +1,56 @@
1
1
  # projectzeronext
2
2
 
3
+ ## 1.89.0-rc.14
4
+
5
+ ### Patch Changes
6
+
7
+ - @akinon/next@1.89.0-rc.14
8
+ - @akinon/pz-akifast@1.89.0-rc.14
9
+ - @akinon/pz-b2b@1.89.0-rc.14
10
+ - @akinon/pz-basket-gift-pack@1.89.0-rc.14
11
+ - @akinon/pz-bkm@1.89.0-rc.14
12
+ - @akinon/pz-checkout-gift-pack@1.89.0-rc.14
13
+ - @akinon/pz-click-collect@1.89.0-rc.14
14
+ - @akinon/pz-credit-payment@1.89.0-rc.14
15
+ - @akinon/pz-gpay@1.89.0-rc.14
16
+ - @akinon/pz-masterpass@1.89.0-rc.14
17
+ - @akinon/pz-one-click-checkout@1.89.0-rc.14
18
+ - @akinon/pz-otp@1.89.0-rc.14
19
+ - @akinon/pz-pay-on-delivery@1.89.0-rc.14
20
+ - @akinon/pz-saved-card@1.89.0-rc.14
21
+ - @akinon/pz-tabby-extension@1.89.0-rc.14
22
+ - @akinon/pz-tamara-extension@1.89.0-rc.14
23
+
24
+ ## 1.89.0-rc.13
25
+
26
+ ### Minor Changes
27
+
28
+ - 4e379cd: ZERO-3365: Added variant selection completion check
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies [2657d0c]
33
+ - Updated dependencies [1044bce]
34
+ - Updated dependencies [ec9ff89]
35
+ - Updated dependencies [9c3a22a]
36
+ - Updated dependencies [a1463fd]
37
+ - @akinon/pz-akifast@1.89.0-rc.13
38
+ - @akinon/pz-bkm@1.89.0-rc.13
39
+ - @akinon/pz-checkout-gift-pack@1.89.0-rc.13
40
+ - @akinon/pz-otp@1.89.0-rc.13
41
+ - @akinon/pz-gpay@1.89.0-rc.13
42
+ - @akinon/next@1.89.0-rc.13
43
+ - @akinon/pz-b2b@1.89.0-rc.13
44
+ - @akinon/pz-basket-gift-pack@1.89.0-rc.13
45
+ - @akinon/pz-click-collect@1.89.0-rc.13
46
+ - @akinon/pz-credit-payment@1.89.0-rc.13
47
+ - @akinon/pz-masterpass@1.89.0-rc.13
48
+ - @akinon/pz-one-click-checkout@1.89.0-rc.13
49
+ - @akinon/pz-pay-on-delivery@1.89.0-rc.13
50
+ - @akinon/pz-saved-card@1.89.0-rc.13
51
+ - @akinon/pz-tabby-extension@1.89.0-rc.13
52
+ - @akinon/pz-tamara-extension@1.89.0-rc.13
53
+
3
54
  ## 1.89.0-rc.12
4
55
 
5
56
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projectzeronext",
3
- "version": "1.89.0-rc.12",
3
+ "version": "1.89.0-rc.14",
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.89.0-rc.12",
28
- "@akinon/pz-akifast": "1.89.0-rc.12",
29
- "@akinon/pz-b2b": "1.89.0-rc.12",
30
- "@akinon/pz-basket-gift-pack": "1.89.0-rc.12",
31
- "@akinon/pz-bkm": "1.89.0-rc.12",
32
- "@akinon/pz-checkout-gift-pack": "1.89.0-rc.12",
33
- "@akinon/pz-click-collect": "1.89.0-rc.12",
34
- "@akinon/pz-credit-payment": "1.89.0-rc.12",
35
- "@akinon/pz-gpay": "1.89.0-rc.12",
36
- "@akinon/pz-masterpass": "1.89.0-rc.12",
37
- "@akinon/pz-one-click-checkout": "1.89.0-rc.12",
38
- "@akinon/pz-otp": "1.89.0-rc.12",
39
- "@akinon/pz-pay-on-delivery": "1.89.0-rc.12",
40
- "@akinon/pz-saved-card": "1.89.0-rc.12",
41
- "@akinon/pz-tabby-extension": "1.89.0-rc.12",
42
- "@akinon/pz-tamara-extension": "1.89.0-rc.12",
27
+ "@akinon/next": "1.89.0-rc.14",
28
+ "@akinon/pz-akifast": "1.89.0-rc.14",
29
+ "@akinon/pz-b2b": "1.89.0-rc.14",
30
+ "@akinon/pz-basket-gift-pack": "1.89.0-rc.14",
31
+ "@akinon/pz-bkm": "1.89.0-rc.14",
32
+ "@akinon/pz-checkout-gift-pack": "1.89.0-rc.14",
33
+ "@akinon/pz-click-collect": "1.89.0-rc.14",
34
+ "@akinon/pz-credit-payment": "1.89.0-rc.14",
35
+ "@akinon/pz-gpay": "1.89.0-rc.14",
36
+ "@akinon/pz-masterpass": "1.89.0-rc.14",
37
+ "@akinon/pz-one-click-checkout": "1.89.0-rc.14",
38
+ "@akinon/pz-otp": "1.89.0-rc.14",
39
+ "@akinon/pz-pay-on-delivery": "1.89.0-rc.14",
40
+ "@akinon/pz-saved-card": "1.89.0-rc.14",
41
+ "@akinon/pz-tabby-extension": "1.89.0-rc.14",
42
+ "@akinon/pz-tamara-extension": "1.89.0-rc.14",
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.89.0-rc.12",
65
+ "@akinon/eslint-plugin-projectzero": "1.89.0-rc.14",
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={() => setProductError(null)}
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={isAddToCartLoading || isAddToStockAlertLoading}
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
- {inStock ? (
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/projectzero",
3
- "version": "1.89.0-rc.12",
3
+ "version": "1.89.0-rc.14",
4
4
  "private": false,
5
5
  "description": "CLI tool to manage your Project Zero Next project",
6
6
  "bin": {