impaktapps-ui-builder 0.0.101-alpha.117 → 0.0.101-alpha.119

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": "impaktapps-ui-builder",
3
- "version": "0.0.101-alpha.117",
3
+ "version": "0.0.101-alpha.119",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -89,12 +89,27 @@ export default (funcParams: funcParamsProps) => {
89
89
  }))
90
90
  }
91
91
  const config = pageData?.config;
92
- if(config?.programIdRequired && !funcParams.store.location.pathname.includes('ProgramId')){
93
- funcParams.store.navigate(funcParams.store.location.pathname+`/ProgramId${JSON.parse(window.sessionStorage.getItem("ProgramID"))?.label}`)
94
- }
95
- else{
96
- funcParams.store.navigate(funcParams.store.location.pathname+`/${JSON.parse(window.sessionStorage.getItem("ProgramID"))?.label}`)
92
+ const pathParts = funcParams.store.location.pathname.split("/");
93
+ const programId = JSON.parse(window.sessionStorage.getItem("ProgramID") || "null")?.value;
94
+ if (config?.programIdRequired && programId) {
95
+ if (pathParts.length < 2) {
96
+ // Case: programId not in path, just append it
97
+ funcParams.store.navigate(
98
+ `${funcParams.store.location.pathname}/${programId}`
99
+ );
100
+ } else {
101
+ // Case: already has some value — replace last segment with programId
102
+ pathParts[2] = programId; // Assuming path like /:id/:programId
103
+ const newPath = pathParts.slice(0, 3).join("/") + "/";
104
+ funcParams.store.navigate(newPath);
105
+ }
97
106
  }
107
+ // if(config?.programIdRequired && !funcParams.store.location.pathname.includes(`ProgramId${JSON.parse(window.sessionStorage.getItem("ProgramID"))?.value}`)){
108
+ // funcParams.store.navigate(funcParams.store.location.pathname+`/ProgramId${JSON.parse(window.sessionStorage.getItem("ProgramID"))?.value}`)
109
+ // }
110
+ // else{
111
+ // funcParams.store.navigate(funcParams.store.location.pathname+`/${JSON.parse(window.sessionStorage.getItem("ProgramID"))?.value}`)
112
+ // }
98
113
  const uiSchema = pageData?.uiSchema;
99
114
  const event = new CustomEvent('pageNameChanged', {
100
115
  detail: { pageName: config.label }