@pradip1995/framework-runtime 0.2.8 → 0.2.11

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pradip1995/framework-runtime",
3
- "version": "0.2.8",
3
+ "version": "0.2.11",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -16,7 +16,8 @@
16
16
  "dependencies": {
17
17
  "@pradip1995/framework-core": "^0.2.1",
18
18
  "@pradip1995/plugin-sdk": "^0.2.2",
19
- "@pradip1995/medusa-connector": "^0.2.4"
19
+ "@pradip1995/medusa-connector": "^0.2.4",
20
+ "@pradip1995/segment-analytics": "^0.2.0"
20
21
  },
21
22
  "peerDependencies": {
22
23
  "next": ">=15",
@@ -1,4 +1,5 @@
1
1
  import { buildRouteContext } from "@pradip1995/framework-core"
2
+ import { PageAnalytics } from "@pradip1995/segment-analytics"
2
3
  import { resolveServices } from "./register-services"
3
4
  import {
4
5
  applyChromeSegmentData,
@@ -71,6 +72,15 @@ export async function renderConfiguredPage(input: RenderConfiguredPageInput): Pr
71
72
 
72
73
  const Layout = input.page.layout
73
74
 
75
+ const pathname = input.slug.length ? `/${input.slug.join("/")}` : "/"
76
+ const analytics = (
77
+ <PageAnalytics
78
+ pathname={pathname}
79
+ searchParams={input.searchParams}
80
+ data={data}
81
+ />
82
+ )
83
+
74
84
  if (data.notFound) {
75
85
  const message =
76
86
  data.emptyCart === true
@@ -78,9 +88,12 @@ export async function renderConfiguredPage(input: RenderConfiguredPageInput): Pr
78
88
  : "The page you're looking for doesn't exist or is temporarily unavailable."
79
89
 
80
90
  return (
81
- <Layout data={data}>
82
- <NotFoundPanel message={message} />
83
- </Layout>
91
+ <>
92
+ {analytics}
93
+ <Layout data={data}>
94
+ <NotFoundPanel message={message} />
95
+ </Layout>
96
+ </>
84
97
  )
85
98
  }
86
99
 
@@ -89,7 +102,12 @@ export async function renderConfiguredPage(input: RenderConfiguredPageInput): Pr
89
102
  return <Segment key={pkg} {...props} />
90
103
  })
91
104
 
92
- return <Layout data={data}>{segmentElements}</Layout>
105
+ return (
106
+ <>
107
+ {analytics}
108
+ <Layout data={data}>{segmentElements}</Layout>
109
+ </>
110
+ )
93
111
  } catch (error) {
94
112
  console.error("[storefront] renderConfiguredPage error:", error)
95
113
  const message = error instanceof Error ? error.message : "Unknown error"