@pradip1995/segment-powerhouse-cart 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/segment.tsx +6 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pradip1995/segment-powerhouse-cart",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
package/src/segment.tsx CHANGED
@@ -14,7 +14,10 @@ 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 from "@pradip1995/segment-login-popup/required"
17
+ import LoginRequiredModal, {
18
+ isAuthRequiredError,
19
+ promptLoginForWishlist,
20
+ } from "@pradip1995/segment-login-popup/required"
18
21
  import {
19
22
  DEFAULT_CHECKOUT_LABEL,
20
23
  DEFAULT_CONTINUE_HREF,
@@ -173,9 +176,9 @@ function LineItemRow({
173
176
  }
174
177
  startTransition(async () => {
175
178
  const result = await addToWishlist(productId)
176
- if (!result.success && result.error?.toLowerCase().includes("login")) {
179
+ if (!result.success && isAuthRequiredError(result.error)) {
177
180
  setConfirmOpen(false)
178
- setLoginRequired(true)
181
+ promptLoginForWishlist(() => setLoginRequired(true))
179
182
  return
180
183
  }
181
184
  if (!result.success) {