@pradip1995/segment-powerhouse-cart 0.1.3 → 0.1.5
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/package.json +2 -2
- package/src/segment.tsx +11 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pradip1995/segment-powerhouse-cart",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@pradip1995/segment-analytics": "^0.2.4",
|
|
29
|
-
"@pradip1995/segment-login-popup": "^0.1.
|
|
29
|
+
"@pradip1995/segment-login-popup": "^0.1.6",
|
|
30
30
|
"@pradip1995/segment-primitives": "^0.4.11"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
package/src/segment.tsx
CHANGED
|
@@ -14,7 +14,11 @@ import {
|
|
|
14
14
|
import LocalizedLink from "@pradip1995/segment-primitives/localized-link"
|
|
15
15
|
import { formatPrice } from "@pradip1995/segment-primitives/format-price"
|
|
16
16
|
import { resolveMediaUrl } from "@pradip1995/segment-primitives/resolve-media-url"
|
|
17
|
-
import LoginRequiredModal
|
|
17
|
+
import LoginRequiredModal, {
|
|
18
|
+
isAuthRequiredError,
|
|
19
|
+
promptLoginForWishlist,
|
|
20
|
+
requireLoginForWishlist,
|
|
21
|
+
} from "@pradip1995/segment-login-popup/required"
|
|
18
22
|
import {
|
|
19
23
|
DEFAULT_CHECKOUT_LABEL,
|
|
20
24
|
DEFAULT_CONTINUE_HREF,
|
|
@@ -171,11 +175,15 @@ function LineItemRow({
|
|
|
171
175
|
removeFromCart()
|
|
172
176
|
return
|
|
173
177
|
}
|
|
178
|
+
if (requireLoginForWishlist()) {
|
|
179
|
+
setConfirmOpen(false)
|
|
180
|
+
return
|
|
181
|
+
}
|
|
174
182
|
startTransition(async () => {
|
|
175
183
|
const result = await addToWishlist(productId)
|
|
176
|
-
if (!result.success && result.error
|
|
184
|
+
if (!result.success && isAuthRequiredError(result.error)) {
|
|
177
185
|
setConfirmOpen(false)
|
|
178
|
-
setLoginRequired(true)
|
|
186
|
+
promptLoginForWishlist(() => setLoginRequired(true))
|
|
179
187
|
return
|
|
180
188
|
}
|
|
181
189
|
if (!result.success) {
|