@admin-layout/gluestack-ui-mobile 7.3.8-alpha.8 → 8.5.3-alpha.0

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 (100) hide show
  1. package/CHANGELOG.md +1 -17
  2. package/lib/components/ApplicationErrorFillWrapper.js +1 -1
  3. package/lib/components/ApplicationErrorFillWrapper.js.map +1 -1
  4. package/lib/components/ApplicationErrorHandler.js +3 -3
  5. package/lib/components/ApplicationErrorHandler.js.map +1 -1
  6. package/lib/components/AuthWrapper.d.ts +1 -0
  7. package/lib/components/AuthWrapper.js +27 -0
  8. package/lib/components/AuthWrapper.js.map +1 -0
  9. package/lib/components/ErrorBounday.js.map +1 -1
  10. package/lib/components/Fallback.js +1 -2
  11. package/lib/components/Fallback.js.map +1 -1
  12. package/lib/components/Layout/components/BasicLayout.js +3 -1
  13. package/lib/components/Layout/components/BasicLayout.js.map +1 -1
  14. package/lib/components/Layout/components/BottomTabBar.d.ts +1 -0
  15. package/lib/components/Layout/components/BottomTabBar.js +11 -24
  16. package/lib/components/Layout/components/BottomTabBar.js.map +1 -1
  17. package/lib/components/Layout/components/Drawer.d.ts +1 -0
  18. package/lib/components/Layout/components/Drawer.js +101 -117
  19. package/lib/components/Layout/components/Drawer.js.map +1 -1
  20. package/lib/components/Layout/components/Header.d.ts +2 -1
  21. package/lib/components/Layout/components/Header.js +5 -4
  22. package/lib/components/Layout/components/Header.js.map +1 -1
  23. package/lib/components/Layout/components/SettingDrawer/LayoutButton.js +26 -19
  24. package/lib/components/Layout/components/SettingDrawer/LayoutButton.js.map +1 -1
  25. package/lib/components/Layout/components/SettingDrawer/ThemeColorButton.js +5 -13
  26. package/lib/components/Layout/components/SettingDrawer/ThemeColorButton.js.map +1 -1
  27. package/lib/components/Layout/components/SideBar.js +2 -2
  28. package/lib/components/Layout/components/SideBar.js.map +1 -1
  29. package/lib/components/Layout/components/util.js.map +1 -1
  30. package/lib/components/Layout/compute.js +51 -52
  31. package/lib/components/Layout/compute.js.map +1 -1
  32. package/lib/components/NavigationComponent.js +24 -31
  33. package/lib/components/NavigationComponent.js.map +1 -1
  34. package/lib/components/ToastAlert.js +1 -1
  35. package/lib/components/ToastAlert.js.map +1 -1
  36. package/lib/components/UnAuthenticatedComponent.d.ts +3 -0
  37. package/lib/components/UnAuthenticatedComponent.js +16 -0
  38. package/lib/components/UnAuthenticatedComponent.js.map +1 -0
  39. package/lib/components/index.d.ts +1 -0
  40. package/lib/components/index.js +1 -0
  41. package/lib/components/index.js.map +1 -1
  42. package/lib/components/with-interactions-lifecycle-managed.d.ts +4 -0
  43. package/lib/components/with-interactions-lifecycle-managed.js +50 -0
  44. package/lib/components/with-interactions-lifecycle-managed.js.map +1 -0
  45. package/lib/components/with-interactions-managed.js +2 -2
  46. package/lib/components/with-interactions-managed.js.map +1 -1
  47. package/lib/config/config.js +2 -2
  48. package/lib/config/config.js.map +1 -1
  49. package/lib/config/i18next.js +1 -2
  50. package/lib/config/i18next.js.map +1 -1
  51. package/lib/containers/layout/BasicLayout.d.ts +2 -2
  52. package/lib/containers/layout/BasicLayout.js +3 -3
  53. package/lib/containers/layout/BasicLayout.js.map +1 -1
  54. package/lib/containers/layout/DrawerBottomNavigationConfig.d.ts +2 -2
  55. package/lib/containers/layout/DrawerBottomNavigationConfig.js +2 -2
  56. package/lib/containers/layout/DrawerBottomNavigationConfig.js.map +1 -1
  57. package/lib/containers/layout/DrawerConfig.d.ts +1 -1
  58. package/lib/containers/layout/DrawerConfig.js +1 -1
  59. package/lib/containers/layout/DrawerConfig.js.map +1 -1
  60. package/lib/containers/layout/Lifecycle.js +2 -14
  61. package/lib/containers/layout/Lifecycle.js.map +1 -1
  62. package/lib/containers/layout/ProLayout.js +4 -5
  63. package/lib/containers/layout/ProLayout.js.map +1 -1
  64. package/lib/hooks/use-after-interactions.d.ts +0 -1
  65. package/lib/hooks/use-after-interactions.js +1 -1
  66. package/lib/hooks/use-after-interactions.js.map +1 -1
  67. package/lib/hooks/useIsReady.js.map +1 -1
  68. package/lib/hooks/useLayoutSetting/index.js +16 -14
  69. package/lib/hooks/useLayoutSetting/index.js.map +1 -1
  70. package/lib/index.d.ts +3 -1
  71. package/lib/index.js +3 -1
  72. package/lib/index.js.map +1 -1
  73. package/lib/layout.json +153 -0
  74. package/lib/redux/settings.d.ts +8 -8
  75. package/lib/redux/settings.js +8 -2
  76. package/lib/redux/settings.js.map +1 -1
  77. package/lib/utils/generateAppNavigations.d.mts +43 -0
  78. package/lib/utils/generateAppNavigations.mjs +958 -0
  79. package/lib/utils/generateAppNavigations.mjs.map +1 -0
  80. package/lib/utils/getReplacedRouteConfig.d.ts +11 -0
  81. package/lib/utils/getReplacedRouteConfig.js +276 -0
  82. package/lib/utils/getReplacedRouteConfig.js.map +1 -0
  83. package/lib/utils/getReplacedRouteConfig.mjs +265 -0
  84. package/lib/utils/routeConfigKeyReplace.js +17 -19
  85. package/lib/utils/routeConfigKeyReplace.js.map +1 -1
  86. package/package.json +7 -5
  87. package/src/components/ApplicationErrorHandler.tsx +26 -21
  88. package/src/components/AuthWrapper.tsx +29 -0
  89. package/src/components/Layout/components/BottomTabBar.tsx +2 -0
  90. package/src/components/Layout/components/Drawer.tsx +4 -1
  91. package/src/components/Layout/components/Header.tsx +7 -3
  92. package/src/components/UnAuthenticatedComponent.tsx +38 -0
  93. package/src/components/index.ts +1 -0
  94. package/src/components/with-interactions-lifecycle-managed.tsx +105 -0
  95. package/src/index.ts +4 -1
  96. package/src/layout.json +153 -0
  97. package/src/utils/generateAppNavigations.mjs +990 -0
  98. package/src/utils/getReplacedRouteConfig.mjs_ok +317 -0
  99. package/src/utils/getReplacedRouteConfig.ts +330 -0
  100. package/tsconfig.json +4 -1
@@ -0,0 +1,265 @@
1
+ const getReplacedRouteConfig = ({ layoutType, layoutConfigData, routeConfig = [], initialRouteName = null, }) => {
2
+ let modulesRouteConfig = [];
3
+ const modulesRouteConfigObj = Object.assign({}, ...(routeConfig?.flat(1) || []));
4
+ const layoutOrgLength = Object.keys(modulesRouteConfigObj)?.filter((r) => r?.startsWith('/:orgName/l/'))?.length;
5
+ const hostOrgLength = Object.keys(modulesRouteConfigObj)?.filter((r) => r?.startsWith('/:orgName/h/'))?.length;
6
+ const isLayoutOrgExists = layoutOrgLength > 0 ? true : false;
7
+ const isHostOrgExists = hostOrgLength > 0 ? true : false;
8
+ const layoutRouteConfig = layoutConfigData[layoutType];
9
+ const hostRouteConfig = layoutConfigData['host-bottom'];
10
+ const layoutRouteKey = Object.keys(layoutRouteConfig)[1];
11
+ const hostRouteKey = Object.keys(hostRouteConfig)[1];
12
+ const appLayout = layoutRouteConfig[layoutRouteKey];
13
+ const hostLayout = hostRouteConfig[hostRouteKey];
14
+ const keyToReplace = appLayout.key || 'bottom_tab';
15
+ const hostFilteredRouteConfig = routeConfig?.map((rcArry) => rcArry.filter(((obj) => !Object.keys(obj)?.[0]?.startsWith('/l/') && !Object.keys(obj)?.[0].startsWith('/:orgName/l/'))));
16
+ let filteredRouteConfig = routeConfig;
17
+ if (keyToReplace == 'host_tab') {
18
+ filteredRouteConfig = hostFilteredRouteConfig;
19
+ }
20
+ const hostModuleRouteConfigLength = Object.entries(modulesRouteConfigObj)?.filter(([key, value]) => key?.startsWith('/:orgName/h/') || key?.startsWith('/h/'))?.flat(1)?.filter((rc) => rc.length)?.length ?? 0;
21
+ if (hostModuleRouteConfigLength && hostModuleRouteConfigLength > 0) {
22
+ modulesRouteConfig = [[layoutRouteConfig || []], [hostRouteConfig || []], ...filteredRouteConfig];
23
+ }
24
+ else {
25
+ modulesRouteConfig = [[layoutRouteConfig || []], ...filteredRouteConfig];
26
+ }
27
+ // const layoutRouteConfigObj = Object.assign(
28
+ // {},
29
+ // ...(modulesRouteConfig?.flat(1) || [])
30
+ // );
31
+ //const mainStackConfig:any = Object.entries(layoutRouteConfigObj)?.filter(([key,val])=> key == '/')?.reduce((acc,val)=>{ return val[1]},{});
32
+ // const mainStackPath = mainStackConfig?.name?.toLowerCase()??'';
33
+ // const mainStackName = mainStackConfig?.name??'MainStack';
34
+ const lConfig = Object.keys(layoutRouteConfig).map((k) => layoutRouteConfig[k]);
35
+ const mainStackConfig = lConfig[0] || {};
36
+ const layoutConfig = lConfig[1] || {};
37
+ const mainStackPath = mainStackConfig?.name?.toLowerCase() ?? '';
38
+ const mainStackName = mainStackConfig?.name ?? 'MainStack';
39
+ const layoutName = layoutConfig?.name ?? 'Layout';
40
+ const layoutRootName = mainStackName + '.' + layoutName;
41
+ const hConfig = Object.keys(hostRouteConfig).map((k) => hostRouteConfig[k]);
42
+ const hostConfig = hConfig[1] || {};
43
+ const hostName = hostConfig?.name ?? 'Layout';
44
+ const hostRootName = mainStackName + '.' + hostName;
45
+ const replacedNavigationRouteConfig = modulesRouteConfig?.map((innerArray) => innerArray?.map((obj) => Object.fromEntries(Object.entries(obj).map(([key, val]) => {
46
+ let originalVal = Object.assign({}, val);
47
+ let objKey = key;
48
+ let path = originalVal.path || key;
49
+ let pathObj = { path: path };
50
+ let objVal = Object.assign({}, val, pathObj);
51
+ let name = objVal.name;
52
+ if (key === '/' && initialRouteName)
53
+ objVal.props.initialRouteName = initialRouteName;
54
+ if (key == '/' + keyToReplace && initialRouteName)
55
+ objVal.props.initialRouteName = initialRouteName;
56
+ let initialParams = objVal?.props?.initialParams ?? {};
57
+ if (objVal?.props?.options) {
58
+ initialParams.auth = objVal?.auth ?? false;
59
+ initialParams.menu_position = objVal?.menu_position ?? 'bottom';
60
+ initialParams.priority = objVal?.props?.options?.priority ?? 0;
61
+ // initialParams.options = objVal.props.options ? JSON.stringify(objVal?.props?.options) : null;
62
+ objVal.props.initialParams = initialParams;
63
+ }
64
+ if (isLayoutOrgExists && objKey == `/${keyToReplace}`) {
65
+ objKey = objKey.replace(objKey, `/:orgName${objKey}`);
66
+ path = path.replace(path, `/:orgName${path}`);
67
+ }
68
+ if (isHostOrgExists && key == `/${hostLayout.key}`) {
69
+ objKey = key.replace(objKey, `/:orgName${objKey}`);
70
+ path = path.replace(path, `/:orgName${path}`);
71
+ }
72
+ if (keyToReplace == 'host_tab') {
73
+ name = path.startsWith('/:orgName/l/')
74
+ ? name.replace(name, `${layoutRootName}.${name}`)
75
+ : path.startsWith('/l/')
76
+ ? name.replace(name, `${layoutRootName}.${name}`)
77
+ : path.startsWith('/:orgName/h/')
78
+ ? name.replace(name, `${hostRootName}.${name}`)
79
+ : path.startsWith('/h/')
80
+ ? name.replace(name, `${hostRootName}.${name}`)
81
+ : path.startsWith('//')
82
+ ? name.startsWith(`${mainStackName}`)
83
+ ? name
84
+ : name.replace(name, `${mainStackName}.${name}`)
85
+ : path.startsWith(`/${mainStackPath}`)
86
+ ? name
87
+ : path === '/'
88
+ ? name
89
+ : name.startsWith(`${mainStackName}`)
90
+ ? name
91
+ : name.replace(name, `${mainStackName}.${name}`);
92
+ objKey = objKey.startsWith('/:orgName/h/')
93
+ ? objKey.replace('/:orgName/h/', '//:orgName/' + keyToReplace + '/')
94
+ : objKey.startsWith('/h/')
95
+ ? objKey.replace('/h/', '//' + keyToReplace + '/')
96
+ : objKey.startsWith('/:orgName/l/')
97
+ ? null
98
+ : objKey.startsWith('/l/')
99
+ ? null
100
+ : objKey === '/'
101
+ ? objKey
102
+ : objKey.startsWith('//')
103
+ ? objKey
104
+ : objKey.replace('/', '//');
105
+ path = path.startsWith('/:orgName/h/')
106
+ ? path.replace('/:orgName/h/', '/:orgName/' + keyToReplace + '/')
107
+ : path.startsWith('/h/')
108
+ ? path.replace('/h/', '/' + keyToReplace + '/')
109
+ : path.startsWith('/:orgName/l/')
110
+ ? null
111
+ : path.startsWith('/l/')
112
+ ? null
113
+ : path.startsWith('//')
114
+ ? path.replace('//', '/')
115
+ : path.startsWith(`/${mainStackPath}`)
116
+ ? path
117
+ : path === '/'
118
+ ? path
119
+ : path.replace('/', `/${mainStackPath}/`);
120
+ }
121
+ else {
122
+ name = path.startsWith('/:orgName/l/')
123
+ ? name.replace(name, `${layoutRootName}.${name}`)
124
+ : path.startsWith('/l/')
125
+ ? name.replace(name, `${layoutRootName}.${name}`)
126
+ : path.startsWith('/:orgName/h/')
127
+ ? name.replace(name, `${hostRootName}.${name}`)
128
+ : path.startsWith('/h/')
129
+ ? name.replace(name, `${hostRootName}.${name}`)
130
+ : path.startsWith('//')
131
+ ? name.startsWith(`${mainStackName}`)
132
+ ? name
133
+ : name.replace(name, `${mainStackName}.${name}`)
134
+ : path.startsWith(`/${mainStackPath}`)
135
+ ? name
136
+ : path === '/'
137
+ ? name
138
+ : name.startsWith(`${mainStackName}`)
139
+ ? name
140
+ : name.replace(name, `${mainStackName}.${name}`);
141
+ objKey = objKey.startsWith('/:orgName/l/')
142
+ ? objKey.replace('/:orgName/l/', '//:orgName/' + keyToReplace + '/')
143
+ : objKey.startsWith('/l/')
144
+ ? objKey.replace('/l/', '//' + keyToReplace + '/')
145
+ : objKey.startsWith('/:orgName/h/')
146
+ ? objKey.replace('/:orgName/h/', '//:orgName/host_tab/')
147
+ : objKey.startsWith('/h/')
148
+ ? objKey.replace('/h/', '//host_tab/')
149
+ : objKey === '/'
150
+ ? objKey
151
+ : objKey.startsWith('//')
152
+ ? objKey
153
+ : objKey.replace('/', '//');
154
+ path = path.startsWith('/:orgName/l/')
155
+ ? path.replace('/:orgName/l/', '/:orgName/' + keyToReplace + '/')
156
+ : path.startsWith('/l/')
157
+ ? path.replace('/l/', '/' + keyToReplace + '/')
158
+ : path.startsWith('/:orgName/h/')
159
+ ? path.replace('/:orgName/h/', '/:orgName/host_tab/')
160
+ : path.startsWith('/h/')
161
+ ? path.replace('/h/', '/host_tab/')
162
+ : path.startsWith('//')
163
+ ? path.replace('//', '/')
164
+ : path.startsWith(`/${mainStackPath}`)
165
+ ? path
166
+ : path;
167
+ // : path === '/' ? path : path.replace('/',`/${mainStackPath}/`);
168
+ //name = name.startsWith(`${mainStackName}`) ? name : name.replace(name,`${mainStackName}.${name}`);
169
+ }
170
+ objVal.path = path;
171
+ objVal.name = name;
172
+ return [objKey, objVal];
173
+ }))));
174
+ const replacedConfiguredRouteConfig = modulesRouteConfig.map((innerArray) => innerArray.map((obj) => Object.fromEntries(Object.entries(obj).map(([key, val]) => {
175
+ let originalVal = Object.assign({}, val);
176
+ let objKey = key;
177
+ let path = originalVal.path || key;
178
+ let pathObj = { path: path };
179
+ let objVal = Object.assign({}, val, pathObj);
180
+ let name = objVal.name;
181
+ if (key === '/' && initialRouteName)
182
+ objVal.props.initialRouteName = initialRouteName;
183
+ if (key == '/' + keyToReplace && initialRouteName)
184
+ objVal.props.initialRouteName = initialRouteName;
185
+ let initialParams = objVal?.props?.initialParams ?? {};
186
+ if (objVal?.props?.options) {
187
+ initialParams.menu_position = objVal?.menu_position ?? 'bottom';
188
+ initialParams.priority = objVal?.props?.options?.priority ?? 0;
189
+ // initialParams.options = objVal.props.options ? JSON.stringify(objVal?.props?.options) : null;
190
+ objVal.props.initialParams = initialParams;
191
+ }
192
+ if (isLayoutOrgExists && objKey == `/${keyToReplace}`) {
193
+ objKey = objKey.replace(objKey, `/:orgName${objKey}`);
194
+ path = path.replace(path, `/:orgName${path}`);
195
+ }
196
+ if (isHostOrgExists && key == `/${hostLayout.key}`) {
197
+ objKey = key.replace(objKey, `/:orgName${objKey}`);
198
+ path = path.replace(path, `/:orgName${path}`);
199
+ }
200
+ if (keyToReplace == 'host_tab') {
201
+ objKey = objKey.startsWith('/:orgName/h/')
202
+ ? objKey.replace('/:orgName/h/', '//:orgName/' + keyToReplace + '/')
203
+ : objKey.startsWith('/h/')
204
+ ? objKey.replace('/h/', '//' + keyToReplace + '/')
205
+ : objKey.startsWith('/:orgName/l/')
206
+ ? null
207
+ : objKey.startsWith('/l/')
208
+ ? null
209
+ : objKey === '/'
210
+ ? objKey
211
+ : objKey.startsWith('//')
212
+ ? objKey
213
+ : objKey.replace('/', '//');
214
+ path = path.startsWith('/:orgName/h/')
215
+ ? path.replace('/:orgName/h/', '/:orgName/' + keyToReplace + '/')
216
+ : path.startsWith('/h/')
217
+ ? path.replace('/h/', '/' + keyToReplace + '/')
218
+ : path.startsWith('/:orgName/l/')
219
+ ? null
220
+ : path.startsWith('/l/')
221
+ ? null
222
+ : path.startsWith('//')
223
+ ? path.replace('//', '/')
224
+ : path.startsWith(`/${mainStackPath}`)
225
+ ? path
226
+ : path === '/'
227
+ ? path
228
+ : path.replace('/', `/${mainStackPath}/`);
229
+ }
230
+ else {
231
+ objKey = objKey.startsWith('/:orgName/l/')
232
+ ? objKey.replace('/:orgName/l/', '//:orgName/' + keyToReplace + '/')
233
+ : objKey.startsWith('/l/')
234
+ ? objKey.replace('/l/', '//' + keyToReplace + '/')
235
+ : objKey.startsWith('/:orgName/h/')
236
+ ? objKey.replace('/:orgName/h/', '//:orgName/host_tab/')
237
+ : objKey.startsWith('/h/')
238
+ ? objKey.replace('/h/', '//host_tab/')
239
+ : objKey === '/'
240
+ ? objKey
241
+ : objKey.startsWith('//')
242
+ ? objKey
243
+ : objKey.replace('/', '//');
244
+ path = path.startsWith('/:orgName/l/')
245
+ ? path.replace('/:orgName/l/', '/:orgName/' + keyToReplace + '/')
246
+ : path.startsWith('/l/')
247
+ ? path.replace('/l/', '/' + keyToReplace + '/')
248
+ : path.startsWith('/:orgName/h/')
249
+ ? path.replace('/:orgName/h/', '/:orgName/host_tab/')
250
+ : path.startsWith('/h/')
251
+ ? path.replace('/h/', '/host_tab/')
252
+ : path.startsWith('//')
253
+ ? path.replace('//', '/')
254
+ : path.startsWith(`/${mainStackPath}`)
255
+ ? path
256
+ : path;
257
+ }
258
+ objVal.path = path;
259
+ objVal.name = name;
260
+ return [objKey, objVal];
261
+ }))));
262
+ return { replacedNavigationRouteConfig, replacedConfiguredRouteConfig };
263
+ };
264
+
265
+ export { getReplacedRouteConfig };
@@ -1,25 +1,23 @@
1
1
  import { Feature } from '@common-stack/client-react';
2
2
  const routeConfigKeyReplace = (keyReplacedWith, features, appLayout = null, intialRouteName = 'MainStack.Layout') => {
3
- var _a, _b, _c, _d, _e;
4
- let appLayoutFeatures = Object.assign({}, features);
5
- appLayoutFeatures.routeConfig = (_a = appLayoutFeatures === null || appLayoutFeatures === void 0 ? void 0 : appLayoutFeatures.routeConfig) === null || _a === void 0 ? void 0 : _a.map((obj) => {
6
- let rObj = Object.assign({}, obj);
3
+ let appLayoutFeatures = { ...features };
4
+ appLayoutFeatures.routeConfig = appLayoutFeatures?.routeConfig?.map((obj) => {
5
+ let rObj = { ...obj };
7
6
  if (rObj.hasOwnProperty('/'))
8
7
  rObj['/'].props.initialRouteName = intialRouteName;
9
8
  let objectEntries = Object.entries(rObj).map(([key, val]) => {
10
- var _a, _b, _c, _d, _e, _f, _g, _h;
11
9
  let objVal = Object.assign({}, val);
12
- let initialParams = (_b = (_a = objVal === null || objVal === void 0 ? void 0 : objVal.props) === null || _a === void 0 ? void 0 : _a.initialParams) !== null && _b !== void 0 ? _b : {};
13
- if ((_c = objVal === null || objVal === void 0 ? void 0 : objVal.props) === null || _c === void 0 ? void 0 : _c.options) {
14
- initialParams.menu_position = (_d = objVal === null || objVal === void 0 ? void 0 : objVal.menu_position) !== null && _d !== void 0 ? _d : 'bottom';
15
- initialParams.priority = (_g = (_f = (_e = objVal === null || objVal === void 0 ? void 0 : objVal.props) === null || _e === void 0 ? void 0 : _e.options) === null || _f === void 0 ? void 0 : _f.priority) !== null && _g !== void 0 ? _g : 0;
16
- initialParams.options = objVal.props.options ? JSON.stringify((_h = objVal === null || objVal === void 0 ? void 0 : objVal.props) === null || _h === void 0 ? void 0 : _h.options) : null;
10
+ let initialParams = objVal?.props?.initialParams ?? {};
11
+ if (objVal?.props?.options) {
12
+ initialParams.menu_position = objVal?.menu_position ?? 'bottom';
13
+ initialParams.priority = objVal?.props?.options?.priority ?? 0;
14
+ initialParams.options = objVal.props.options ? JSON.stringify(objVal?.props?.options) : null;
17
15
  objVal.props.initialParams = initialParams;
18
16
  }
19
17
  let objKey;
20
18
  if (keyReplacedWith == '//host_tab/') {
21
19
  objKey = key.startsWith('//:orgName/h/')
22
- ? key.replace('//:orgName/h/', '//:orgName' + (keyReplacedWith === null || keyReplacedWith === void 0 ? void 0 : keyReplacedWith.replace('//', '/')))
20
+ ? key.replace('//:orgName/h/', '//:orgName' + keyReplacedWith?.replace('//', '/'))
23
21
  : key.startsWith('//h/')
24
22
  ? key.replace('//h/', keyReplacedWith)
25
23
  : key.startsWith('//:orgName/l/') ? null
@@ -27,7 +25,7 @@ const routeConfigKeyReplace = (keyReplacedWith, features, appLayout = null, inti
27
25
  : key;
28
26
  }
29
27
  else {
30
- objKey = key.startsWith('//:orgName/l/') ? key.replace('//:orgName/l/', '//:orgName' + (keyReplacedWith === null || keyReplacedWith === void 0 ? void 0 : keyReplacedWith.replace('//', '/')))
28
+ objKey = key.startsWith('//:orgName/l/') ? key.replace('//:orgName/l/', '//:orgName' + keyReplacedWith?.replace('//', '/'))
31
29
  : key.startsWith('//l/') ? key.replace('//l/', keyReplacedWith)
32
30
  : key.startsWith('//:orgName/h/') ? null
33
31
  : key.startsWith('//h/') ? null
@@ -39,9 +37,9 @@ const routeConfigKeyReplace = (keyReplacedWith, features, appLayout = null, inti
39
37
  });
40
38
  let appLayoutConfig = null;
41
39
  if (appLayout) {
42
- let layoutFeatures = [...features === null || features === void 0 ? void 0 : features.routeConfig];
40
+ let layoutFeatures = [...features?.routeConfig];
43
41
  //const intialRoutename = layoutFeatures?.map((obj:any)=>obj.hasOwnProperty('/') && obj['/'].props.initialRouteName)?.filter((obj:any)=>obj)[0]??'MainStack.MainDrawer';
44
- const isOrgName = (_d = (_c = (_b = layoutFeatures === null || layoutFeatures === void 0 ? void 0 : layoutFeatures.map((obj) => {
42
+ const isOrgName = layoutFeatures?.map((obj) => {
45
43
  return Object.entries(obj).map(([key, val]) => {
46
44
  if (keyReplacedWith == '//host_tab/') {
47
45
  if (key.startsWith('//:orgName/h/'))
@@ -56,15 +54,15 @@ const routeConfigKeyReplace = (keyReplacedWith, features, appLayout = null, inti
56
54
  null;
57
55
  }
58
56
  });
59
- })) === null || _b === void 0 ? void 0 : _b.flat(1)) === null || _c === void 0 ? void 0 : _c.filter((obj) => obj)) !== null && _d !== void 0 ? _d : [];
60
- appLayoutConfig = Object.assign({}, appLayout);
61
- appLayoutConfig.routeConfig = (_e = appLayoutConfig === null || appLayoutConfig === void 0 ? void 0 : appLayoutConfig.routeConfig) === null || _e === void 0 ? void 0 : _e.map((obj) => {
62
- let rObj = Object.assign({}, obj);
57
+ })?.flat(1)?.filter((obj) => obj) ?? [];
58
+ appLayoutConfig = { ...appLayout };
59
+ appLayoutConfig.routeConfig = appLayoutConfig?.routeConfig?.map((obj) => {
60
+ let rObj = { ...obj };
63
61
  //if (rObj.hasOwnProperty('/')) rObj['/'].props.initialRouteName = intialRoutename;
64
62
  let objectEntries = Object.entries(rObj).map(([key, val]) => {
65
63
  let objVal = Object.assign({}, val);
66
64
  let objKey;
67
- objKey = (isOrgName === null || isOrgName === void 0 ? void 0 : isOrgName.length) > 0 ? key.startsWith('//') ? key.replace('//', '//:orgName/') : key : key;
65
+ objKey = isOrgName?.length > 0 ? key.startsWith('//') ? key.replace('//', '//:orgName/') : key : key;
68
66
  return [objKey, objVal];
69
67
  });
70
68
  return Object.fromEntries(objectEntries);
@@ -1 +1 @@
1
- {"version":3,"file":"routeConfigKeyReplace.js","sourceRoot":"","sources":["../../src/utils/routeConfigKeyReplace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,MAAM,qBAAqB,GAAG,CAAC,eAAoB,EAAE,QAAa,EAAC,YAAU,IAAW,EAAC,kBAAgB,kBAAyB,EAAE,EAAE;;IAClI,IAAI,iBAAiB,qBAAQ,QAAQ,CAAE,CAAC;IACxC,iBAAiB,CAAC,WAAW,GAAG,MAAA,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,WAAW,0CAAE,GAAG,CAAC,CAAC,GAAQ,EAAE,EAAE;QAC7E,IAAI,IAAI,qBAAa,GAAG,CAAE,CAAC;QAC3B,IAAI,IAAI,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ustack-ui for mobile component layout",
5
5
  "main": "lib/index.js",
6
+ "type": "module",
6
7
  "scripts": {
7
8
  "jest": "./node_modules/.bin/jest",
8
9
  "test:debug": "npm test -- --runInBand",
@@ -11,7 +12,8 @@
11
12
  "watch": "npm run build:lib:watch",
12
13
  "build": "npm run build:clean && npm run build:lib",
13
14
  "build:clean": "rimraf lib",
14
- "build:lib": "tsc",
15
+ "build:replacedRouteConfig": "npx rollup lib/utils/getReplacedRouteConfig.js --file lib/utils/getReplacedRouteConfig.mjs",
16
+ "build:lib": "tsc && yarn build:replacedRouteConfig",
15
17
  "build:lib:watch": "npm run build:lib -- --watch",
16
18
  "test": "yarn tests && yarn lint",
17
19
  "tests": "jest --updateSnapshot",
@@ -23,8 +25,8 @@
23
25
  "author": "CDMBase LLC",
24
26
  "license": "ISC",
25
27
  "dependencies": {
26
- "@admin-layout/client": "7.3.8-alpha.8",
27
- "@common-stack/remix-router-redux": "^5.0.2-alpha.1",
28
+ "@admin-layout/client": "8.5.3-alpha.0",
29
+ "@common-stack/remix-router-redux": "^5.0.4-alpha.5",
28
30
  "@gluestack-style/react": "^1.0.53",
29
31
  "@gluestack-ui/config": "^1.1.18",
30
32
  "@gluestack-ui/themed": "^1.1.22",
@@ -38,5 +40,5 @@
38
40
  "typescript": {
39
41
  "definition": "lib/index.d.ts"
40
42
  },
41
- "gitHead": "b6a69125a955d5fe0c3fec14100ccf9edde3f0e2"
43
+ "gitHead": "299897d5ba3d293244a8786fc09e4134480e2cb4"
42
44
  }
@@ -1,30 +1,35 @@
1
- import { ApplicationErrorHandlerCommon, APPLICATION_ERROR_SLOT_FILL } from '@admin-layout/client'
2
- import { Slot } from '@common-stack/components-pro'
1
+ import { ApplicationErrorHandlerCommon, APPLICATION_ERROR_SLOT_FILL } from '@admin-layout/client';
2
+ import { Slot } from '@common-stack/components-pro';
3
3
  import Toast from 'react-native-toast-message';
4
4
  import * as React from 'react';
5
5
 
6
6
  const FallbackComponent = () => {
7
- React.useLayoutEffect(() => {
8
- Toast.show({
9
- type: 'error',
10
- text1: 'Something went wrong...'
11
- });
12
- }, [])
7
+ React.useLayoutEffect(() => {
8
+ Toast.show({
9
+ type: 'error',
10
+ text1: 'Something went wrong...',
11
+ });
12
+ }, []);
13
13
 
14
- return null;
15
- }
14
+ return null;
15
+ };
16
16
 
17
17
  const RendererComponent = (props) => {
18
- const { applicationErrors, backendError } = props;
19
- return (
20
- <>
21
- {!!backendError && <FallbackComponent />}
22
- {!!applicationErrors?.length && <Slot name={APPLICATION_ERROR_SLOT_FILL} fillProps={{ active: true, applicationErrors: applicationErrors }} />}
23
- </>
24
- )
25
- }
18
+ const { applicationErrors, backendError } = props;
19
+ return (
20
+ <>
21
+ {!!backendError && <FallbackComponent />}
22
+ {!!applicationErrors?.length && (
23
+ <Slot
24
+ name={APPLICATION_ERROR_SLOT_FILL}
25
+ fillProps={{ active: true, applicationErrors: applicationErrors }}
26
+ />
27
+ )}
28
+ </>
29
+ );
30
+ };
26
31
 
27
32
  export const ApplicationErrorHandler = (props) => {
28
- const CommonHandler = ApplicationErrorHandlerCommon(FallbackComponent, Slot, RendererComponent);
29
- return <CommonHandler {...props} />
30
- }
33
+ const CommonHandler = (ApplicationErrorHandlerCommon as any)(FallbackComponent, Slot, RendererComponent);
34
+ return <CommonHandler {...props} />;
35
+ };
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { isUserAuthenticated } from '@adminide-stack/user-auth0-client';
3
+ import { useNavigation } from '@react-navigation/native';
4
+ import { useSelector } from 'react-redux';
5
+ import DefaultAuthComponent from './UnAuthenticatedComponent';
6
+ import {withLifeCycleManaged,withInteractionsManaged,withLifeCycleInteractionsManaged} from './with-interactions-lifecycle-managed';
7
+
8
+ export const AuthWrapper = ({auth=false,component,unauthenticatedComponent=null,withLifeCycle=null,withInteraction=null,withLifeCycleInteraction=null}: any) => {
9
+ const user = useSelector((state: any) => state.user);
10
+ const { authenticated } = isUserAuthenticated();
11
+ const navigation = useNavigation<any>();
12
+
13
+ React.useEffect(()=>{
14
+ if(auth && !user?.profile) navigation.navigate('MainStack.Login')
15
+ },[auth,user])
16
+
17
+ const wrapperComponent = withLifeCycle
18
+ ? withLifeCycleManaged(component)
19
+ : withInteraction
20
+ ? withInteractionsManaged(component,withInteraction?.duration??null)
21
+ : withLifeCycleInteraction
22
+ ? withLifeCycleInteractionsManaged(component,withLifeCycleInteraction?.duration??null)
23
+ :component;
24
+
25
+
26
+ if (auth && !user?.profile)
27
+ return unauthenticatedComponent ? unauthenticatedComponent :<DefaultAuthComponent />;
28
+ else return wrapperComponent;
29
+ };
@@ -136,3 +136,5 @@ export const BottomTabBar = ({ state, descriptors, navigation,...props }: any) =
136
136
  </SafeAreaView>
137
137
  );
138
138
  };
139
+
140
+ export default BottomTabBar;
@@ -27,6 +27,7 @@ export const Drawer = (props: any) => {
27
27
  const settings = useSelector<any>((state) => state.settings) as any;
28
28
  const platform = useSelector<any>((state) => state.platform) as any;
29
29
  const user = useSelector<any>((state) => state.user) as any;
30
+ const isShowDefaultRoutes = props?.showDefaultRoutes??false;
30
31
  const dispatch = useDispatch();
31
32
  const navigation = useNavigation<any>();
32
33
  const route = useRoute<any>();
@@ -35,7 +36,7 @@ export const Drawer = (props: any) => {
35
36
  let getRootState: any = null;
36
37
  let allRoutes: any = null;
37
38
  let tabRoutes: any = null;
38
- if (settings && settings.layout == 'mixSide') {
39
+ if (settings && settings.layout == 'mixSide' && !isShowDefaultRoutes) {
39
40
  getRootState = navigationRef.isReady() ? navigationRef?.getRootState() : null;
40
41
  if (getRootState) {
41
42
  allRoutes = getRootState?.routes[0]?.state?.routes ?? null;
@@ -410,3 +411,5 @@ export const Drawer = (props: any) => {
410
411
  </Box>
411
412
  );
412
413
  };
414
+
415
+ export default Drawer;
@@ -17,8 +17,10 @@ export const Header = React.memo(({
17
17
  theme = 'light',
18
18
  right = null,
19
19
  rightComponent,
20
+ isMixedLayout=null,
21
+ ...rest
20
22
  }: any)=>{
21
- const title = getHeaderTitle(options, route.name);
23
+ const title = rest?.title || getHeaderTitle(options, route.name);
22
24
 
23
25
  const matches: any = title.match(/\b(\w)/g);
24
26
  const acronym: any = matches.join('').substring(0, 2); // JSON
@@ -47,7 +49,7 @@ export const Header = React.memo(({
47
49
  // settings?.layout === 'bottom' || settings?.layout === 'host-bottom' ? 'center' : 'space-between'
48
50
  // }
49
51
  justifyContent={
50
- (settings?.layout === 'bottom' || settings?.layout === 'host-bottom') && !right
52
+ (settings?.layout === 'bottom' || settings?.layout === 'host-bottom') &&!isMixedLayout && !right
51
53
  ? 'center'
52
54
  : 'space-between'
53
55
  }
@@ -61,7 +63,7 @@ export const Header = React.memo(({
61
63
  <Button size="xs" bg={'transparent'} onPress={() => navigation.goBack()}>
62
64
  <Ionicons name={'arrow-back'} color={theme === 'light' ? 'black' : 'white'} size={20} />
63
65
  </Button>
64
- ) : showToggle && settings?.layout !== 'bottom' ? (
66
+ ) : (showToggle && settings?.layout !== 'bottom') || (showToggle && settings?.layout !== 'host-bottom') ? (
65
67
  <Button size="xs" bg={'transparent'} onPress={() => navigation.toggleDrawer()}>
66
68
  <Ionicons name={'menu'} color={theme === 'light' ? 'black' : 'white'} size={20} />
67
69
  </Button>
@@ -101,6 +103,8 @@ export const Header = React.memo(({
101
103
  );
102
104
  });
103
105
 
106
+ export default Header;
107
+
104
108
  // export const Header = ({
105
109
  // navigation,
106
110
  // route,
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import {
3
+ Box,
4
+ Button,
5
+ Heading,
6
+ Text,
7
+ HStack,
8
+ Pressable,
9
+ Divider,
10
+ ButtonText,
11
+ SafeAreaView,
12
+ } from '@gluestack-ui/themed';
13
+ import { useNavigation } from '@react-navigation/native';
14
+ import { Ionicons } from '@expo/vector-icons';
15
+ import { Linking } from 'react-native';
16
+
17
+ const UnAuthenticatedComponent = () => {
18
+ const navigation = useNavigation<any>();
19
+ return (
20
+ <SafeAreaView flex={1}>
21
+ <Box flex={1} borderTopWidth={'$1'} borderTopColor={'$trueGray200'}>
22
+ {/* <Box h={'$1'} bg={Colors.primaryBgColor} /> */}
23
+ <Box flex={1} p={'$6'} bg="$white" justifyContent={'center'}>
24
+ <Heading mt={'$2'}>Login</Heading>
25
+ <Text fontSize="$md" mt={'$2'}>
26
+ Log in to continue.
27
+ </Text>
28
+ <Button bg={'$blue500'} size="lg" my={'$3'} onPress={() => navigation.navigate('MainStack.Login')}>
29
+ <ButtonText color="$white">Login</ButtonText>
30
+ </Button>
31
+ <Divider my={'$3'} />
32
+ </Box>
33
+ </Box>
34
+ </SafeAreaView>
35
+ );
36
+ };
37
+
38
+ export default UnAuthenticatedComponent;
@@ -7,3 +7,4 @@ export * from './ErrorBounday';
7
7
  export * from './NavigationComponent';
8
8
  export * from './ToastAlert';
9
9
  export * from './with-interactions-managed';
10
+ export * from './AuthWrapper'