@pradip1995/segment-primitives 0.4.8 → 0.4.9
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 +6 -6
- package/src/coupon-apply.tsx +6 -2
- package/src/resolve-media-url.ts +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pradip1995/segment-primitives",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -22,10 +22,6 @@
|
|
|
22
22
|
"./product-selection-context": "./src/product-selection-context.tsx",
|
|
23
23
|
"./is-next-redirect": "./src/is-next-redirect.ts"
|
|
24
24
|
},
|
|
25
|
-
"scripts": {
|
|
26
|
-
"typecheck": "tsc --noEmit",
|
|
27
|
-
"lint": "tsc --noEmit"
|
|
28
|
-
},
|
|
29
25
|
"peerDependencies": {
|
|
30
26
|
"@medusajs/types": "^2.0.0",
|
|
31
27
|
"@pradip1995/commerce-core": "^4.0.0",
|
|
@@ -40,5 +36,9 @@
|
|
|
40
36
|
"@types/react": "^19",
|
|
41
37
|
"react": "19.0.3",
|
|
42
38
|
"typescript": "^5.7.2"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"typecheck": "tsc --noEmit",
|
|
42
|
+
"lint": "tsc --noEmit"
|
|
43
43
|
}
|
|
44
|
-
}
|
|
44
|
+
}
|
package/src/coupon-apply.tsx
CHANGED
|
@@ -3,15 +3,19 @@
|
|
|
3
3
|
import { useState } from "react"
|
|
4
4
|
import { useRouter } from "next/navigation"
|
|
5
5
|
import type { HttpTypes } from "@medusajs/types"
|
|
6
|
-
import { applyPromotions } from "@pradip1995/commerce-core/client/actions/cart"
|
|
7
6
|
import { formatPrice } from "./format-price"
|
|
8
7
|
|
|
8
|
+
// Use require to prevent TS from attempting to typecheck the raw .ts files published in commerce-core
|
|
9
|
+
const { applyPromotions } = require("@pradip1995/commerce-core/client/actions/cart") as {
|
|
10
|
+
applyPromotions: (codes: string[], cartId: string) => Promise<any>
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
type CouponApplyProps = {
|
|
10
14
|
cart: HttpTypes.StoreCart & { promotions?: HttpTypes.StorePromotion[] }
|
|
11
15
|
className?: string
|
|
12
16
|
}
|
|
13
17
|
|
|
14
|
-
function promotionLabel(promotion:
|
|
18
|
+
function promotionLabel(promotion: any) {
|
|
15
19
|
const method = promotion.application_method
|
|
16
20
|
if (method?.value == null) return null
|
|
17
21
|
|
package/src/resolve-media-url.ts
CHANGED
|
@@ -9,8 +9,9 @@ export function resolveMediaUrl(
|
|
|
9
9
|
|
|
10
10
|
// Uploads stored while AWS_FILE_URL / backend_url was unset:
|
|
11
11
|
// "undefined/uploadsFoo.webp" or "undefined/uploads/Foo.webp"
|
|
12
|
-
|
|
13
|
-
if (!
|
|
12
|
+
const rewritten = rewriteBrokenUndefinedUploadUrl(trimmed)
|
|
13
|
+
if (!rewritten) return null
|
|
14
|
+
trimmed = rewritten
|
|
14
15
|
|
|
15
16
|
if (trimmed.startsWith("/")) {
|
|
16
17
|
return trimmed
|