@syzy/apphost 1.0.1 → 1.0.2

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 (213) hide show
  1. package/dist/App.js +83 -0
  2. package/dist/AppHostProvider.js +4 -0
  3. package/dist/AppHostRoutes.js +7 -0
  4. package/dist/api/image-api.js +45 -0
  5. package/dist/api/mapping-api.js +427 -0
  6. package/dist/bookingModule/components/AmenityForm.js +19 -0
  7. package/dist/bookingModule/components/BillingManagement.js +17 -0
  8. package/dist/bookingModule/components/CreateRoomForm.js +19 -0
  9. package/dist/bookingModule/components/ExtraRequirementForm.js +19 -0
  10. package/dist/bookingModule/components/ReservationForm.js +18 -0
  11. package/dist/bookingModule/components/RoomCategoryForm.js +19 -0
  12. package/dist/bookingModule/components/RoomCategoryPriceForm.js +20 -0
  13. package/dist/bookingModule/components/RoomExtraRequirementCapture.js +18 -0
  14. package/dist/bookingModule/components/RoomFacilityForm.js +19 -0
  15. package/dist/bookingModule/components/RoomReservationAction.js +18 -0
  16. package/dist/components/Home/Home.js +14 -0
  17. package/dist/components/Loader/Loader.js +5 -0
  18. package/dist/components/Login/Login.js +149 -0
  19. package/dist/components/Login/loginSchema.js +41 -0
  20. package/dist/components/Mappings/BranchMapping/Branch.js +135 -0
  21. package/dist/components/Mappings/BranchMapping/BranchTableColumns.js +21 -0
  22. package/dist/components/Mappings/BranchMapping/MappingFormBranchUser.js +150 -0
  23. package/dist/components/Mappings/BranchMapping/MappingTableColumns.js +29 -0
  24. package/dist/components/Mappings/BranchMapping/branchSchema.js +34 -0
  25. package/dist/components/Mappings/ComponentMapping/ComponentRoleMapping.js +98 -0
  26. package/dist/components/Mappings/ComponentMapping/componentRoleColumns.js +29 -0
  27. package/dist/components/Mappings/MappingForm/MappingForm.js +142 -0
  28. package/dist/components/Mappings/MappingForm/mappingSchema.js +32 -0
  29. package/dist/components/Mappings/RoleMapping/MappingFormUserRole.js +194 -0
  30. package/dist/components/Mappings/RoleMapping/UserRoleTableColumns.js +33 -0
  31. package/dist/components/NavBar/Sidebar.js +56 -0
  32. package/dist/components/ProfileForm/ProfileForm.js +190 -0
  33. package/dist/components/ProfileForm/ProfileList.js +33 -0
  34. package/dist/components/ProfileForm/profileColumns.js +67 -0
  35. package/dist/components/ProfileForm/profileSchema.js +50 -0
  36. package/dist/components/SettingsPage/SettingsPage.js +240 -0
  37. package/dist/components/api/settings-api.js +131 -0
  38. package/dist/components/common/Form/FormActionButtons.js +6 -0
  39. package/dist/components/common/Form/FormLabel.js +6 -0
  40. package/dist/components/common/ListTable/ListHeader.js +5 -0
  41. package/dist/components/common/ListTable/ListTable.js +31 -0
  42. package/dist/components/common/Modal/Modal.js +6 -0
  43. package/dist/config/EnvConfig.js +13 -0
  44. package/dist/config/amplifyConfig.js +45 -0
  45. package/dist/configureAppHost.js +5 -0
  46. package/dist/customGraphQL/customMutations.js +53 -0
  47. package/dist/customGraphQL/customQueries.js +104 -0
  48. package/dist/domain/input/input-types.js +1 -0
  49. package/dist/domain/model/BranchDto.js +8 -0
  50. package/dist/domain/model/ComponentMappingDto.js +19 -0
  51. package/dist/domain/model/MappingDto.js +16 -0
  52. package/dist/domain/model/PrefixDescriptionDto.js +13 -0
  53. package/dist/domain/model/ProfileDto.js +20 -0
  54. package/dist/domain/model/RoleMappingDto.js +19 -0
  55. package/dist/domain/model/SettingsDto.js +7 -0
  56. package/dist/domain/model/UserMappingDto.js +28 -0
  57. package/dist/domain/model/imageDto.js +1 -0
  58. package/dist/domain/type/EntityTypes.js +6 -0
  59. package/dist/domain/type/MappingOptions.js +1 -0
  60. package/dist/domain/type/MappingTypes.js +7 -0
  61. package/dist/domain/type/Nullable.js +1 -0
  62. package/dist/domain/type/ResettingPeriodOptions.js +8 -0
  63. package/dist/domain/type/RolesEnum.js +7 -0
  64. package/dist/domain/type/SelectType.js +1 -0
  65. package/dist/domain/type/StatusEnum.js +6 -0
  66. package/dist/domain/type/signUpOptions.js +4 -0
  67. package/dist/domain/type/statusOptions.js +4 -0
  68. package/dist/graphql/profileQueries.js +89 -0
  69. package/dist/hoc/withSyzyAuth.js +87 -0
  70. package/dist/hooks/useCurrentUser.js +6 -0
  71. package/dist/hooks/useDispatch.js +7 -0
  72. package/dist/hooks/usePermission.js +7 -0
  73. package/dist/index.js +3 -15
  74. package/dist/main.js +60 -0
  75. package/dist/services/Client.Service.js +96 -0
  76. package/dist/services/Storage-service.js +26 -0
  77. package/dist/services/navigationMenu.js +9 -0
  78. package/dist/static/constants.js +34 -0
  79. package/dist/store/AppAction.js +5 -0
  80. package/dist/store/AppContext.js +3 -0
  81. package/dist/store/AppContextType.js +6 -0
  82. package/dist/store/AppProvider.js +32 -0
  83. package/dist/store/HostedInContainerContext.js +11 -0
  84. package/dist/store/SesssionReducer.js +16 -0
  85. package/dist/types/App.d.ts +4 -0
  86. package/dist/types/AppHostProvider.d.ts +6 -0
  87. package/dist/types/AppHostRoutes.d.ts +1 -0
  88. package/dist/types/api/image-api.d.ts +8 -0
  89. package/dist/types/api/mapping-api.d.ts +80 -0
  90. package/dist/types/bookingModule/components/AmenityForm.d.ts +3 -0
  91. package/dist/types/bookingModule/components/BillingManagement.d.ts +3 -0
  92. package/dist/types/bookingModule/components/CreateRoomForm.d.ts +3 -0
  93. package/dist/types/bookingModule/components/ExtraRequirementForm.d.ts +3 -0
  94. package/dist/types/bookingModule/components/ReservationForm.d.ts +3 -0
  95. package/dist/types/bookingModule/components/RoomCategoryForm.d.ts +3 -0
  96. package/dist/types/bookingModule/components/RoomCategoryPriceForm.d.ts +3 -0
  97. package/dist/types/bookingModule/components/RoomExtraRequirementCapture.d.ts +3 -0
  98. package/dist/types/bookingModule/components/RoomFacilityForm.d.ts +3 -0
  99. package/dist/types/bookingModule/components/RoomReservationAction.d.ts +3 -0
  100. package/dist/types/components/Home/Home.d.ts +3 -0
  101. package/dist/types/components/Loader/Loader.d.ts +2 -0
  102. package/dist/types/components/Login/Login.d.ts +7 -0
  103. package/dist/types/components/Login/loginSchema.d.ts +27 -0
  104. package/dist/types/components/Mappings/BranchMapping/Branch.d.ts +5 -0
  105. package/dist/types/components/Mappings/BranchMapping/BranchTableColumns.d.ts +10 -0
  106. package/dist/types/components/Mappings/BranchMapping/MappingFormBranchUser.d.ts +3 -0
  107. package/dist/types/components/Mappings/BranchMapping/MappingTableColumns.d.ts +14 -0
  108. package/dist/types/components/Mappings/BranchMapping/branchSchema.d.ts +37 -0
  109. package/dist/types/components/Mappings/ComponentMapping/ComponentRoleMapping.d.ts +3 -0
  110. package/dist/types/components/Mappings/ComponentMapping/componentRoleColumns.d.ts +3 -0
  111. package/dist/types/components/Mappings/MappingForm/MappingForm.d.ts +35 -0
  112. package/dist/types/components/Mappings/MappingForm/mappingSchema.d.ts +23 -0
  113. package/dist/types/components/Mappings/RoleMapping/MappingFormUserRole.d.ts +5 -0
  114. package/dist/types/components/Mappings/RoleMapping/UserRoleTableColumns.d.ts +3 -0
  115. package/dist/types/components/NavBar/Sidebar.d.ts +4 -0
  116. package/dist/types/components/ProfileForm/ProfileForm.d.ts +3 -0
  117. package/dist/types/components/ProfileForm/ProfileList.d.ts +3 -0
  118. package/dist/types/components/ProfileForm/profileColumns.d.ts +3 -0
  119. package/dist/types/components/ProfileForm/profileSchema.d.ts +52 -0
  120. package/dist/types/components/SettingsPage/SettingsPage.d.ts +3 -0
  121. package/dist/types/components/api/settings-api.d.ts +26 -0
  122. package/dist/types/components/common/Form/FormActionButtons.d.ts +11 -0
  123. package/dist/types/components/common/Form/FormLabel.d.ts +8 -0
  124. package/dist/types/components/common/ListTable/ListHeader.d.ts +8 -0
  125. package/dist/types/components/common/ListTable/ListTable.d.ts +17 -0
  126. package/dist/types/components/common/Modal/Modal.d.ts +11 -0
  127. package/dist/types/config/EnvConfig.d.ts +13 -0
  128. package/dist/types/config/amplifyConfig.d.ts +1 -0
  129. package/dist/types/configureAppHost.d.ts +6 -0
  130. package/dist/types/customGraphQL/customMutations.d.ts +3 -0
  131. package/dist/types/customGraphQL/customQueries.d.ts +7 -0
  132. package/dist/types/domain/input/input-types.d.ts +47 -0
  133. package/dist/types/domain/model/BranchDto.d.ts +9 -0
  134. package/dist/types/domain/model/ComponentMappingDto.d.ts +24 -0
  135. package/dist/types/domain/model/MappingDto.d.ts +30 -0
  136. package/dist/types/domain/model/PrefixDescriptionDto.d.ts +16 -0
  137. package/dist/types/domain/model/ProfileDto.d.ts +21 -0
  138. package/dist/types/domain/model/RoleMappingDto.d.ts +14 -0
  139. package/dist/types/domain/model/SettingsDto.d.ts +8 -0
  140. package/dist/types/domain/model/UserMappingDto.d.ts +14 -0
  141. package/dist/types/domain/model/imageDto.d.ts +4 -0
  142. package/dist/types/domain/type/EntityTypes.d.ts +5 -0
  143. package/dist/types/domain/type/MappingOptions.d.ts +5 -0
  144. package/dist/types/domain/type/MappingTypes.d.ts +6 -0
  145. package/dist/types/domain/type/Nullable.d.ts +13 -0
  146. package/dist/types/domain/type/ResettingPeriodOptions.d.ts +2 -0
  147. package/dist/types/domain/type/RolesEnum.d.ts +6 -0
  148. package/dist/types/domain/type/SelectType.d.ts +16 -0
  149. package/dist/types/domain/type/StatusEnum.d.ts +5 -0
  150. package/dist/types/domain/type/signUpOptions.d.ts +2 -0
  151. package/dist/types/domain/type/statusOptions.d.ts +2 -0
  152. package/dist/types/graphql/profileQueries.d.ts +4 -0
  153. package/dist/types/hoc/withSyzyAuth.d.ts +2 -0
  154. package/dist/types/hooks/useCurrentUser.d.ts +3 -0
  155. package/dist/types/hooks/useDispatch.d.ts +3 -0
  156. package/dist/types/hooks/usePermission.d.ts +1 -0
  157. package/dist/types/index.d.ts +3 -0
  158. package/dist/types/main.d.ts +4 -0
  159. package/dist/types/services/Client.Service.d.ts +12 -0
  160. package/dist/types/services/Storage-service.d.ts +2 -0
  161. package/dist/types/services/navigationMenu.d.ts +1 -0
  162. package/dist/types/static/constants.d.ts +34 -0
  163. package/dist/types/store/AppAction.d.ts +11 -0
  164. package/dist/types/store/AppContext.d.ts +3 -0
  165. package/dist/types/store/AppContextType.d.ts +12 -0
  166. package/dist/types/store/AppProvider.d.ts +7 -0
  167. package/dist/types/store/HostedInContainerContext.d.ts +5 -0
  168. package/dist/types/store/SesssionReducer.d.ts +4 -0
  169. package/dist/types/types.d.ts +26 -0
  170. package/dist/types/util/AuthUtils.d.ts +1 -0
  171. package/dist/types/util/LogEnum.d.ts +6 -0
  172. package/dist/types/util/Logger.d.ts +6 -0
  173. package/dist/types/util/SyzyDate.d.ts +69 -0
  174. package/dist/types/util/dateUtils.d.ts +10 -0
  175. package/dist/types/util/hostedinContainer.d.ts +1 -0
  176. package/dist/types/util/model-types.d.ts +96 -0
  177. package/dist/types/util/prefixAndResettingValidation.d.ts +9 -0
  178. package/dist/types/util/transformToData.d.ts +1 -0
  179. package/dist/types.js +14 -0
  180. package/dist/util/AuthUtils.js +10 -0
  181. package/dist/util/LogEnum.js +7 -0
  182. package/dist/util/Logger.js +18 -0
  183. package/dist/util/SyzyDate.js +265 -0
  184. package/dist/util/dateUtils.js +24 -0
  185. package/dist/util/hostedinContainer.js +9 -0
  186. package/dist/util/model-types.js +18 -0
  187. package/dist/util/prefixAndResettingValidation.js +54 -0
  188. package/dist/util/transformToData.js +9 -0
  189. package/package.json +14 -9
  190. package/dist/__federation_shared_@tanstack/react-query-DHuUsaNz.js +0 -2517
  191. package/dist/__federation_shared_react-CikWE6qG.js +0 -7
  192. package/dist/__federation_shared_react-bootstrap-BKlZRvMR.js +0 -7516
  193. package/dist/__federation_shared_react-dom-vrQ70Ay8.js +0 -372
  194. package/dist/__federation_shared_react-router-dom-BKminmS4.js +0 -10448
  195. package/dist/__federation_shared_react-select-B6kehBDI.js +0 -4056
  196. package/dist/__federation_shared_react-toastify-B0S0UGr3.js +0 -412
  197. package/dist/_commonjsHelpers-C6fGbg64.js +0 -6
  198. package/dist/_virtual___federation_fn_import-XZCKozko.js +0 -217
  199. package/dist/favicon.ico +0 -0
  200. package/dist/index-DgtWMtjZ.js +0 -184
  201. package/dist/index-eZknuYwc.js +0 -1219
  202. package/dist/jsx-runtime-D_t4bG-_.js +0 -264
  203. package/dist/manifest.webmanifest +0 -1
  204. package/dist/pwa/Hotel-icon.jpg +0 -0
  205. package/dist/pwa/apple-touch-icon-180x180.png +0 -0
  206. package/dist/pwa/favicon.ico +0 -0
  207. package/dist/pwa/maskable-icon-512x512.png +0 -0
  208. package/dist/pwa/pwa-192x192.png +0 -0
  209. package/dist/pwa/pwa-512x512.png +0 -0
  210. package/dist/pwa/pwa-64x64.png +0 -0
  211. package/dist/registerSW.js +0 -1
  212. package/dist/sw.js +0 -1
  213. package/dist/workbox-1ef09536.js +0 -1
@@ -0,0 +1,265 @@
1
+ import { DATE_FORMAT_ISO_YYYY_MM_DD } from "./dateUtils";
2
+ export class SyzyDate extends Date {
3
+ static months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
4
+ addDays = (days) => {
5
+ if (!days)
6
+ return this;
7
+ this.setDate(this.getDate() + days);
8
+ return this;
9
+ };
10
+ reduceDays = (days) => {
11
+ if (!days)
12
+ return this;
13
+ this.setDate(this.getDate() - days);
14
+ return this;
15
+ };
16
+ isSameDate = (date) => {
17
+ return date && this.getFullYear() === date.getFullYear() && this.getMonth() === date.getMonth() && this.getDate() === date.getDate();
18
+ };
19
+ isToday = () => {
20
+ const today = new Date();
21
+ return this.isSameDate(today);
22
+ };
23
+ clone = () => {
24
+ return new Date(+this);
25
+ };
26
+ isAnotherMonth = (date) => {
27
+ return date && this.getMonth() !== date.getMonth();
28
+ };
29
+ isWeekend = () => {
30
+ return this.getDay() === 0 || this.getDay() === 6;
31
+ };
32
+ toISODate = () => {
33
+ return this.toISOString().split('T')[0];
34
+ };
35
+ /**
36
+ *
37
+ * @returns Current Date as ISO string with T between date and time
38
+ */
39
+ toISODateTime = () => {
40
+ let dt = this.toISOString();
41
+ dt = dt.replace('T', ' ');
42
+ dt = dt.substring(0, dt.indexOf('.'));
43
+ return dt;
44
+ };
45
+ toISODateString() {
46
+ return this.toDateFormatString(DATE_FORMAT_ISO_YYYY_MM_DD);
47
+ }
48
+ /***
49
+ * To Given Format
50
+ * DD- Date
51
+ * MM- Month in 2 digits
52
+ * Mon- Month in 3 letters
53
+ * mm- Minutes
54
+ * HH- Hours in 24 hour format
55
+ * hh- Hours in 12 hour format
56
+ * ss- Seconds
57
+ * YYYY- Year in 4 digits
58
+ * YY- Year in 2 digits
59
+ */
60
+ toDateFormatString(format) {
61
+ let formatString = format;
62
+ // HH - 24 hour format
63
+ if (formatString.includes("HH")) {
64
+ formatString = formatString.replace("HH", this.getHours().toString().padStart(2, '0'));
65
+ }
66
+ if (formatString.includes("mm")) {
67
+ formatString = formatString.replace("mm", this.getMinutes().toString().padStart(2, '0'));
68
+ }
69
+ if (formatString.includes("ss")) {
70
+ formatString = formatString.replace("ss", this.getSeconds().toString().padStart(2, '0'));
71
+ }
72
+ if (formatString.includes("DD")) {
73
+ formatString = formatString.replace("DD", this.getDate().toString().padStart(2, '0'));
74
+ }
75
+ if (formatString.includes("MM")) {
76
+ formatString = formatString.replace("MM", (this.getMonth() + 1).toString().padStart(2, '0'));
77
+ }
78
+ if (formatString.includes("YYYY")) {
79
+ formatString = formatString.replace("YYYY", this.getFullYear().toString().padStart(2, '0'));
80
+ }
81
+ if (formatString.includes("YY")) {
82
+ formatString = formatString.replace("YY", this.getFullYear().toString().substring(2));
83
+ }
84
+ if (formatString.includes("Mon")) {
85
+ formatString = formatString.replace("Mon", SyzyDate.months[this.getMonth()]);
86
+ }
87
+ // hh will have am/pm
88
+ if (formatString.includes("hh")) {
89
+ const hr = this.getHours();
90
+ formatString = formatString.replace("hh", (hr % 12).toString());
91
+ const am_pm = hr < 12 ? "AM" : "PM";
92
+ formatString = `${formatString} ${am_pm}`;
93
+ }
94
+ return formatString;
95
+ }
96
+ getCurrentISODate = () => {
97
+ return this.toISODate();
98
+ };
99
+ toDate = () => {
100
+ const dateOnly = this.toISODate();
101
+ return new Date(Date.parse(dateOnly));
102
+ };
103
+ getCurrentDate = () => {
104
+ return new SyzyDate();
105
+ };
106
+ currentWeek = () => {
107
+ const tempDate = new Date(this.getTime());
108
+ const startOfYear = new Date(tempDate.getFullYear(), 0, 1);
109
+ const pastDaysOfYear = Math.floor((tempDate.getTime() - startOfYear.getTime()) / 86400000);
110
+ // Calculate the day of the week (0 for Sunday, 1 for Monday, ..., 6 for Saturday)
111
+ const dayOfWeek = tempDate.getDay();
112
+ // Adjust the day count based on the day of the week to align with Sunday as the start of the week
113
+ const adjustedDayOfYear = pastDaysOfYear - dayOfWeek + (dayOfWeek === 0 ? 0 : 7);
114
+ const weekNumber = Math.ceil(adjustedDayOfYear / 7);
115
+ return weekNumber;
116
+ };
117
+ currentTerm = () => {
118
+ let term = 0;
119
+ const currentMon = this.getMonth() + 1;
120
+ if (currentMon && currentMon <= 6) {
121
+ term = 1;
122
+ }
123
+ else {
124
+ term = 2;
125
+ }
126
+ return term;
127
+ };
128
+ currentQuarter = () => {
129
+ let quarter = 0;
130
+ const currentMon = this.getMonth() + 1;
131
+ if (currentMon >= 1 && currentMon <= 3) {
132
+ quarter = 1;
133
+ }
134
+ else if (currentMon >= 4 && currentMon <= 6) {
135
+ quarter = 2;
136
+ }
137
+ else if (currentMon >= 7 && currentMon <= 9) {
138
+ quarter = 3;
139
+ }
140
+ else if (currentMon >= 10 && currentMon <= 12) {
141
+ quarter = 4;
142
+ }
143
+ return quarter;
144
+ };
145
+ getCurrentYrAndMonAndQuarterAndTerm = () => {
146
+ const currentYr = this.getFullYear();
147
+ const currentMon = this.getMonth() + 1;
148
+ const currTerm = this.currentTerm();
149
+ const currentQuarter = this.currentQuarter();
150
+ return { currentYr, currentMon, currTerm, currentQuarter };
151
+ };
152
+ getWeekNo = () => {
153
+ const startOfYear = new Date(this.getFullYear(), 0, 1);
154
+ const pastDaysOfYear = Math.floor((this.getTime() - startOfYear.getTime()) / 86400000);
155
+ // Calculate the day of the week (0 for Sunday, 1 for Monday, ..., 6 for Saturday)
156
+ const dayOfWeek = this.getDay();
157
+ // Adjust the day count based on the day of the week to align with Sunday as the start of the week
158
+ const adjustedDayOfYear = pastDaysOfYear - dayOfWeek + (dayOfWeek === 0 ? 0 : 7);
159
+ const weekNumber = Math.ceil(adjustedDayOfYear / 7);
160
+ return weekNumber;
161
+ };
162
+ getcurrentTerm = () => {
163
+ let term = 0;
164
+ const currentMon = this.getMonth() + 1;
165
+ if (currentMon >= 1 && currentMon <= 6) {
166
+ term = 1; // First term (Jan-Jun)
167
+ }
168
+ else {
169
+ term = 2; // Second term (Jul-Dec)
170
+ }
171
+ return term;
172
+ };
173
+ getCurrentQuarter = () => {
174
+ let quarter = 0;
175
+ const currentMon = this.getMonth() + 1;
176
+ if (currentMon >= 1 && currentMon <= 3) {
177
+ quarter = 1; // First quarter (Jan-Mar)
178
+ }
179
+ else if (currentMon >= 4 && currentMon <= 6) {
180
+ quarter = 2; // Second quarter (Apr-Jun)
181
+ }
182
+ else if (currentMon >= 7 && currentMon <= 9) {
183
+ quarter = 3; // Third quarter (Jul-Sep)
184
+ }
185
+ else if (currentMon >= 10 && currentMon <= 12) {
186
+ quarter = 4; // Fourth quarter (Oct-Dec)
187
+ }
188
+ return quarter;
189
+ };
190
+ getCurrentMonthStartAndEnd = () => {
191
+ const dt = new Date();
192
+ const startOfMonth = new Date(dt.getFullYear(), dt.getMonth(), 1);
193
+ const endOfMonth = new Date(dt.getFullYear(), dt.getMonth() + 1, 0);
194
+ return { startOfMonth, endOfMonth };
195
+ };
196
+ getCurrentTermStartAndEnd = () => {
197
+ const currentYear = this.getFullYear();
198
+ let startOfTerm;
199
+ let endDateOfTerm;
200
+ if (this.getMonth() < 6) {
201
+ startOfTerm = new Date(currentYear, 0, 1);
202
+ endDateOfTerm = new Date(currentYear, 5, 30);
203
+ }
204
+ else {
205
+ // Second term: July to December
206
+ startOfTerm = new Date(currentYear, 6, 1);
207
+ endDateOfTerm = new Date(currentYear, 11, 31);
208
+ }
209
+ return { startOfTerm, endDateOfTerm };
210
+ };
211
+ getCurrentYearStartAndEnd = () => {
212
+ const currentYear = this.getFullYear();
213
+ // Start of the year: January 1st
214
+ const startOfYear = new Date(currentYear, 0, 1);
215
+ // End of the year: December 31st
216
+ const endOfYear = new Date(currentYear, 11, 31);
217
+ return { startOfYear, endOfYear };
218
+ };
219
+ getCurrentQuarterStartAndEnd = () => {
220
+ const currentYear = this.getFullYear();
221
+ const currentQuarter = this.currentQuarter();
222
+ let startMonth = 0, endMonth = 0;
223
+ if (currentQuarter === 1) {
224
+ startMonth = 1;
225
+ endMonth = 3;
226
+ }
227
+ else if (currentQuarter === 2) {
228
+ startMonth = 4;
229
+ endMonth = 6;
230
+ }
231
+ else if (currentQuarter === 3) {
232
+ startMonth = 7;
233
+ endMonth = 9;
234
+ }
235
+ else if (currentQuarter === 4) {
236
+ startMonth = 10;
237
+ endMonth = 12;
238
+ }
239
+ const startDateOfQuarter = new Date(currentYear, startMonth - 1, 1);
240
+ const endDateOfQuarter = new Date(currentYear, endMonth, 0);
241
+ return { startDateOfQuarter, endDateOfQuarter };
242
+ };
243
+ getCurrentWeekStartAndEnd = () => {
244
+ const today = new Date();
245
+ // Sunday = 0, Monday = 1, ..., Saturday = 6
246
+ const dayOfWeek = today.getDay();
247
+ // Calculate Sunday (start of week)
248
+ const startDateOfWeek = new Date(today);
249
+ startDateOfWeek.setDate(today.getDate() - dayOfWeek);
250
+ // Calculate Saturday (end of week)
251
+ const endDateOfWeek = new Date(today);
252
+ endDateOfWeek.setDate(today.getDate() + (6 - dayOfWeek));
253
+ // Clear time part for consistency
254
+ startDateOfWeek.setHours(0, 0, 0, 0);
255
+ endDateOfWeek.setHours(23, 59, 59, 999);
256
+ return { startDateOfWeek, endDateOfWeek };
257
+ };
258
+ getSelectedMonthStartAndEnd = (month) => {
259
+ const dt = new Date();
260
+ const year = dt.getFullYear(); // You can optionally pass year as well
261
+ const startOfSelectedMonth = new Date(year, month - 1, 1);
262
+ const endOfSelectedMonth = new Date(year, month, 0); // 0th day of next month = last day of current month
263
+ return { startOfSelectedMonth, endOfSelectedMonth };
264
+ };
265
+ }
@@ -0,0 +1,24 @@
1
+ import { logger } from "./Logger";
2
+ export const DATE_FORMAT_ISO_DD_MON_YYYY = 'DD-Mon-YYYY';
3
+ export const DATE_FORMAT_ISO_YYYY_MM_DD = 'YYYY-MM-DD';
4
+ export const DATE_FORMAT_DD_MM_YYYY = 'DD-MM-YYYY';
5
+ export const DATE_FORMAT_ISO_YYYY_MM_DD_HH_MM = 'YYYY-MM-DD HH:mm';
6
+ export const DATE_FORMAT_ISO_YYYY_MM_DD_HH_MM_SS = 'YYYY-MM-DD HH:mm:ss';
7
+ export const DATE_FORMAT_ISO_DD_MON_YYYY_HH_MM = 'DD-Mon-YYYY HH:mm';
8
+ export const DATE_FORMAT_ISO_DD_MON_YYYY_HH_MM_SS = 'DD-Mon-YYYY HH:mm:ss';
9
+ export const formatDateWithShortMonth = (isoDateString) => {
10
+ const date = new Date(isoDateString);
11
+ return new Intl.DateTimeFormat('en-gb', {
12
+ day: '2-digit',
13
+ month: 'short',
14
+ year: 'numeric',
15
+ }).format(date);
16
+ };
17
+ export const compareDate = (date1, date2) => {
18
+ const dateOnly1 = date1.toISODate();
19
+ const dateOnly2 = date2.toISODate();
20
+ logger.error("dateOnly1", dateOnly1);
21
+ logger.error("dateOnly2", dateOnly2);
22
+ const result = dateOnly1 >= dateOnly2;
23
+ return result;
24
+ };
@@ -0,0 +1,9 @@
1
+ export const isHostedInContainer = () => {
2
+ let returnValue = false;
3
+ const urlParams = new URLSearchParams(window.location.search);
4
+ if (urlParams.get('hosted_in_container') === 'true') {
5
+ window.hosted_in_container = true;
6
+ returnValue = true;
7
+ }
8
+ return returnValue;
9
+ };
@@ -0,0 +1,18 @@
1
+ export var ModelSortDirection;
2
+ (function (ModelSortDirection) {
3
+ ModelSortDirection["ASC"] = "ASC";
4
+ ModelSortDirection["DESC"] = "DESC";
5
+ })(ModelSortDirection || (ModelSortDirection = {}));
6
+ export var ModelAttributeTypes;
7
+ (function (ModelAttributeTypes) {
8
+ ModelAttributeTypes["binary"] = "binary";
9
+ ModelAttributeTypes["binarySet"] = "binarySet";
10
+ ModelAttributeTypes["bool"] = "bool";
11
+ ModelAttributeTypes["list"] = "list";
12
+ ModelAttributeTypes["map"] = "map";
13
+ ModelAttributeTypes["number"] = "number";
14
+ ModelAttributeTypes["numberSet"] = "numberSet";
15
+ ModelAttributeTypes["string"] = "string";
16
+ ModelAttributeTypes["stringSet"] = "stringSet";
17
+ ModelAttributeTypes["_null"] = "_null";
18
+ })(ModelAttributeTypes || (ModelAttributeTypes = {}));
@@ -0,0 +1,54 @@
1
+ import { DAILY, FINANCIAL_YEARLY, MONTHLY, NEVER, PREFIX_CONSTANT_D, PREFIX_CONSTANT_fy, PREFIX_CONSTANT_FY, PREFIX_CONSTANT_fyminus1, PREFIX_CONSTANT_FYMINUS1, PREFIX_CONSTANT_fyplus1, PREFIX_CONSTANT_FYPLUS1, PREFIX_CONSTANT_M, PREFIX_CONSTANT_y, PREFIX_CONSTANT_Y, YEARLY } from "../static/constants";
2
+ // Find all {...} wrappers in the string
3
+ export const validateFullWrapper = (val) => {
4
+ const matches = val?.match(/\{.*?\}/g) || [];
5
+ const validTokens = [
6
+ PREFIX_CONSTANT_FY, // "{FY}"
7
+ PREFIX_CONSTANT_fy, // "{fy}"
8
+ PREFIX_CONSTANT_FYPLUS1, // full next financial year
9
+ PREFIX_CONSTANT_fyplus1, // short next financial year
10
+ PREFIX_CONSTANT_FYMINUS1, // full previous financial year
11
+ PREFIX_CONSTANT_fyminus1, // short previous financial year
12
+ PREFIX_CONSTANT_Y, // "{Y}"
13
+ PREFIX_CONSTANT_y, // "{y}"
14
+ PREFIX_CONSTANT_M, // "{M}"
15
+ PREFIX_CONSTANT_D // "{D}"
16
+ ];
17
+ // Check that each wrapper is valid
18
+ const invalidWrapper = matches.find(wrapper => !validTokens.includes(wrapper));
19
+ return invalidWrapper;
20
+ };
21
+ // Find first {...} wrapper using regex
22
+ export const validateFirstOccurance = (val) => {
23
+ const match = val?.match(/\{.*?\}/); // first wrapper like {FY}, {M}, etc.
24
+ const firstWrapper = match ? match[0] : null;
25
+ const validTokens = [
26
+ PREFIX_CONSTANT_FY, // "{FY}"
27
+ PREFIX_CONSTANT_fy, // "{fy}"
28
+ PREFIX_CONSTANT_Y, // "{Y}"
29
+ PREFIX_CONSTANT_y, // "{y}"
30
+ PREFIX_CONSTANT_M, // "{M}"
31
+ PREFIX_CONSTANT_D // "{D}"
32
+ ];
33
+ return { firstWrapper, validTokens };
34
+ };
35
+ export const resettingOptions = (prefix) => {
36
+ // Define possible constants in order of priority
37
+ const constants = [
38
+ { tokens: [PREFIX_CONSTANT_FY, PREFIX_CONSTANT_fy], periods: [FINANCIAL_YEARLY, NEVER] },
39
+ { tokens: [PREFIX_CONSTANT_Y, PREFIX_CONSTANT_y], periods: [YEARLY, NEVER] },
40
+ { tokens: [PREFIX_CONSTANT_M], periods: [MONTHLY, NEVER] },
41
+ { tokens: [PREFIX_CONSTANT_D], periods: [DAILY, NEVER] }
42
+ ];
43
+ // Find the first occurring token and return its allowed periods
44
+ let firstMatch = null;
45
+ for (const group of constants) {
46
+ for (const token of group.tokens) {
47
+ const idx = prefix.indexOf(token);
48
+ if (idx !== -1 && (firstMatch === null || idx < firstMatch.index)) {
49
+ firstMatch = { index: idx, periods: group.periods };
50
+ }
51
+ }
52
+ }
53
+ return firstMatch;
54
+ };
@@ -0,0 +1,9 @@
1
+ // import { LogCategoryEnum } from "./LogEnum";
2
+ // import { log } from "./Logger";
3
+ export const transformToData = (data) => {
4
+ // log(LogCategoryEnum.Info, `before transformation`, data)
5
+ const { __typename, createdAt, updatedAt, ...itm } = data;
6
+ const transformedData = { ...itm };
7
+ // log(LogCategoryEnum.Info, "after transformed data", transformedData)
8
+ return transformedData;
9
+ };
package/package.json CHANGED
@@ -1,35 +1,40 @@
1
1
  {
2
2
  "name": "@syzy/apphost",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
- "files": ["dist"],
9
+ "files": [
10
+ "dist"
11
+ ],
10
12
  "scripts": {
11
13
  "clean": "rimraf dist",
12
- "build": "npm run clean && tsc && vite build",
14
+ "build": "npm run clean && tsc -p tsconfig.app.json && vite build",
13
15
  "dev": "vite"
14
16
  },
15
17
  "peerDependencies": {
16
- "react": "^19.0.0",
17
- "react-dom": "^19.0.0",
18
+ "react": "^18 || ^19",
19
+ "react-dom": "^18 || ^19",
18
20
  "react-router-dom": "^6.0.0"
19
21
  },
20
22
  "dependencies": {
21
23
  "@tanstack/react-query": "^5.89.0",
24
+ "@tanstack/react-query-devtools": "^5.91.3",
25
+ "aws-amplify": "^6.16.2",
22
26
  "react-bootstrap": "^2.10.10",
23
27
  "react-select": "^5.10.2",
24
28
  "react-toastify": "^11.0.5",
25
29
  "zod": "^4.1.9"
26
30
  },
27
31
  "devDependencies": {
32
+ "@types/node": "^25.3.3",
28
33
  "@types/react": "^19.1.13",
29
34
  "@types/react-dom": "^19.1.9",
30
- "typescript": "^5.9.3",
31
- "vite": "^7.1.6",
32
35
  "@vitejs/plugin-react": "^5.1.1",
33
- "rimraf": "^6.0.1"
36
+ "rimraf": "^6.0.1",
37
+ "typescript": "^5.9.3",
38
+ "vite": "^7.1.6"
34
39
  }
35
- }
40
+ }