@syzy/apphost 1.0.1 → 1.0.3

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.d.ts +4 -0
  2. package/dist/App.js +83 -0
  3. package/dist/AppHostProvider.d.ts +6 -0
  4. package/dist/AppHostProvider.js +4 -0
  5. package/dist/AppHostRoutes.d.ts +1 -0
  6. package/dist/AppHostRoutes.js +7 -0
  7. package/dist/api/image-api.d.ts +8 -0
  8. package/dist/api/image-api.js +45 -0
  9. package/dist/api/mapping-api.d.ts +80 -0
  10. package/dist/api/mapping-api.js +427 -0
  11. package/dist/bookingModule/components/AmenityForm.d.ts +3 -0
  12. package/dist/bookingModule/components/AmenityForm.js +19 -0
  13. package/dist/bookingModule/components/BillingManagement.d.ts +3 -0
  14. package/dist/bookingModule/components/BillingManagement.js +17 -0
  15. package/dist/bookingModule/components/CreateRoomForm.d.ts +3 -0
  16. package/dist/bookingModule/components/CreateRoomForm.js +19 -0
  17. package/dist/bookingModule/components/ExtraRequirementForm.d.ts +3 -0
  18. package/dist/bookingModule/components/ExtraRequirementForm.js +19 -0
  19. package/dist/bookingModule/components/ReservationForm.d.ts +3 -0
  20. package/dist/bookingModule/components/ReservationForm.js +18 -0
  21. package/dist/bookingModule/components/RoomCategoryForm.d.ts +3 -0
  22. package/dist/bookingModule/components/RoomCategoryForm.js +19 -0
  23. package/dist/bookingModule/components/RoomCategoryPriceForm.d.ts +3 -0
  24. package/dist/bookingModule/components/RoomCategoryPriceForm.js +20 -0
  25. package/dist/bookingModule/components/RoomExtraRequirementCapture.d.ts +3 -0
  26. package/dist/bookingModule/components/RoomExtraRequirementCapture.js +18 -0
  27. package/dist/bookingModule/components/RoomFacilityForm.d.ts +3 -0
  28. package/dist/bookingModule/components/RoomFacilityForm.js +19 -0
  29. package/dist/bookingModule/components/RoomReservationAction.d.ts +3 -0
  30. package/dist/bookingModule/components/RoomReservationAction.js +18 -0
  31. package/dist/components/Home/Home.d.ts +3 -0
  32. package/dist/components/Home/Home.js +14 -0
  33. package/dist/components/Loader/Loader.d.ts +2 -0
  34. package/dist/components/Loader/Loader.js +5 -0
  35. package/dist/components/Login/Login.d.ts +7 -0
  36. package/dist/components/Login/Login.js +149 -0
  37. package/dist/components/Login/loginSchema.d.ts +27 -0
  38. package/dist/components/Login/loginSchema.js +41 -0
  39. package/dist/components/Mappings/BranchMapping/Branch.d.ts +5 -0
  40. package/dist/components/Mappings/BranchMapping/Branch.js +135 -0
  41. package/dist/components/Mappings/BranchMapping/BranchTableColumns.d.ts +10 -0
  42. package/dist/components/Mappings/BranchMapping/BranchTableColumns.js +21 -0
  43. package/dist/components/Mappings/BranchMapping/MappingFormBranchUser.d.ts +3 -0
  44. package/dist/components/Mappings/BranchMapping/MappingFormBranchUser.js +150 -0
  45. package/dist/components/Mappings/BranchMapping/MappingTableColumns.d.ts +14 -0
  46. package/dist/components/Mappings/BranchMapping/MappingTableColumns.js +29 -0
  47. package/dist/components/Mappings/BranchMapping/branchSchema.d.ts +37 -0
  48. package/dist/components/Mappings/BranchMapping/branchSchema.js +34 -0
  49. package/dist/components/Mappings/ComponentMapping/ComponentRoleMapping.d.ts +3 -0
  50. package/dist/components/Mappings/ComponentMapping/ComponentRoleMapping.js +98 -0
  51. package/dist/components/Mappings/ComponentMapping/componentRoleColumns.d.ts +3 -0
  52. package/dist/components/Mappings/ComponentMapping/componentRoleColumns.js +29 -0
  53. package/dist/components/Mappings/MappingForm/MappingForm.d.ts +35 -0
  54. package/dist/components/Mappings/MappingForm/MappingForm.js +142 -0
  55. package/dist/components/Mappings/MappingForm/mappingSchema.d.ts +23 -0
  56. package/dist/components/Mappings/MappingForm/mappingSchema.js +32 -0
  57. package/dist/components/Mappings/RoleMapping/MappingFormUserRole.d.ts +5 -0
  58. package/dist/components/Mappings/RoleMapping/MappingFormUserRole.js +194 -0
  59. package/dist/components/Mappings/RoleMapping/UserRoleTableColumns.d.ts +3 -0
  60. package/dist/components/Mappings/RoleMapping/UserRoleTableColumns.js +33 -0
  61. package/dist/components/NavBar/Sidebar.d.ts +4 -0
  62. package/dist/components/NavBar/Sidebar.js +56 -0
  63. package/dist/components/ProfileForm/ProfileForm.d.ts +3 -0
  64. package/dist/components/ProfileForm/ProfileForm.js +190 -0
  65. package/dist/components/ProfileForm/ProfileList.d.ts +3 -0
  66. package/dist/components/ProfileForm/ProfileList.js +33 -0
  67. package/dist/components/ProfileForm/profileColumns.d.ts +3 -0
  68. package/dist/components/ProfileForm/profileColumns.js +67 -0
  69. package/dist/components/ProfileForm/profileSchema.d.ts +52 -0
  70. package/dist/components/ProfileForm/profileSchema.js +50 -0
  71. package/dist/components/SettingsPage/SettingsPage.d.ts +3 -0
  72. package/dist/components/SettingsPage/SettingsPage.js +240 -0
  73. package/dist/components/api/settings-api.d.ts +26 -0
  74. package/dist/components/api/settings-api.js +131 -0
  75. package/dist/components/common/Form/FormActionButtons.d.ts +11 -0
  76. package/dist/components/common/Form/FormActionButtons.js +6 -0
  77. package/dist/components/common/Form/FormLabel.d.ts +8 -0
  78. package/dist/components/common/Form/FormLabel.js +6 -0
  79. package/dist/components/common/ListTable/ListHeader.d.ts +8 -0
  80. package/dist/components/common/ListTable/ListHeader.js +5 -0
  81. package/dist/components/common/ListTable/ListTable.d.ts +17 -0
  82. package/dist/components/common/ListTable/ListTable.js +31 -0
  83. package/dist/components/common/Modal/Modal.d.ts +11 -0
  84. package/dist/components/common/Modal/Modal.js +6 -0
  85. package/dist/config/EnvConfig.d.ts +13 -0
  86. package/dist/config/EnvConfig.js +13 -0
  87. package/dist/config/amplifyConfig.d.ts +1 -0
  88. package/dist/config/amplifyConfig.js +45 -0
  89. package/dist/configureAppHost.d.ts +6 -0
  90. package/dist/configureAppHost.js +5 -0
  91. package/dist/customGraphQL/customMutations.d.ts +3 -0
  92. package/dist/customGraphQL/customMutations.js +53 -0
  93. package/dist/customGraphQL/customQueries.d.ts +7 -0
  94. package/dist/customGraphQL/customQueries.js +104 -0
  95. package/dist/domain/input/input-types.d.ts +47 -0
  96. package/dist/domain/input/input-types.js +1 -0
  97. package/dist/domain/model/BranchDto.d.ts +9 -0
  98. package/dist/domain/model/BranchDto.js +8 -0
  99. package/dist/domain/model/ComponentMappingDto.d.ts +24 -0
  100. package/dist/domain/model/ComponentMappingDto.js +19 -0
  101. package/dist/domain/model/MappingDto.d.ts +30 -0
  102. package/dist/domain/model/MappingDto.js +16 -0
  103. package/dist/domain/model/PrefixDescriptionDto.d.ts +16 -0
  104. package/dist/domain/model/PrefixDescriptionDto.js +13 -0
  105. package/dist/domain/model/ProfileDto.d.ts +21 -0
  106. package/dist/domain/model/ProfileDto.js +20 -0
  107. package/dist/domain/model/RoleMappingDto.d.ts +14 -0
  108. package/dist/domain/model/RoleMappingDto.js +19 -0
  109. package/dist/domain/model/SettingsDto.d.ts +8 -0
  110. package/dist/domain/model/SettingsDto.js +7 -0
  111. package/dist/domain/model/UserMappingDto.d.ts +14 -0
  112. package/dist/domain/model/UserMappingDto.js +28 -0
  113. package/dist/domain/model/imageDto.d.ts +4 -0
  114. package/dist/domain/model/imageDto.js +1 -0
  115. package/dist/domain/type/EntityTypes.d.ts +5 -0
  116. package/dist/domain/type/EntityTypes.js +6 -0
  117. package/dist/domain/type/MappingOptions.d.ts +5 -0
  118. package/dist/domain/type/MappingOptions.js +1 -0
  119. package/dist/domain/type/MappingTypes.d.ts +6 -0
  120. package/dist/domain/type/MappingTypes.js +7 -0
  121. package/dist/domain/type/Nullable.d.ts +13 -0
  122. package/dist/domain/type/Nullable.js +1 -0
  123. package/dist/domain/type/ResettingPeriodOptions.d.ts +2 -0
  124. package/dist/domain/type/ResettingPeriodOptions.js +8 -0
  125. package/dist/domain/type/RolesEnum.d.ts +6 -0
  126. package/dist/domain/type/RolesEnum.js +7 -0
  127. package/dist/domain/type/SelectType.d.ts +16 -0
  128. package/dist/domain/type/SelectType.js +1 -0
  129. package/dist/domain/type/StatusEnum.d.ts +5 -0
  130. package/dist/domain/type/StatusEnum.js +6 -0
  131. package/dist/domain/type/signUpOptions.d.ts +2 -0
  132. package/dist/domain/type/signUpOptions.js +4 -0
  133. package/dist/domain/type/statusOptions.d.ts +2 -0
  134. package/dist/domain/type/statusOptions.js +4 -0
  135. package/dist/graphql/profileQueries.d.ts +4 -0
  136. package/dist/graphql/profileQueries.js +89 -0
  137. package/dist/hoc/withSyzyAuth.d.ts +2 -0
  138. package/dist/hoc/withSyzyAuth.js +87 -0
  139. package/dist/hooks/useCurrentUser.d.ts +3 -0
  140. package/dist/hooks/useCurrentUser.js +6 -0
  141. package/dist/hooks/useDispatch.d.ts +3 -0
  142. package/dist/hooks/useDispatch.js +7 -0
  143. package/dist/hooks/usePermission.d.ts +1 -0
  144. package/dist/hooks/usePermission.js +7 -0
  145. package/dist/index.d.ts +3 -0
  146. package/dist/index.js +3 -15
  147. package/dist/main.d.ts +4 -0
  148. package/dist/main.js +60 -0
  149. package/dist/services/Client.Service.d.ts +12 -0
  150. package/dist/services/Client.Service.js +96 -0
  151. package/dist/services/Storage-service.d.ts +2 -0
  152. package/dist/services/Storage-service.js +26 -0
  153. package/dist/services/navigationMenu.d.ts +1 -0
  154. package/dist/services/navigationMenu.js +9 -0
  155. package/dist/static/constants.d.ts +34 -0
  156. package/dist/static/constants.js +34 -0
  157. package/dist/store/AppAction.d.ts +11 -0
  158. package/dist/store/AppAction.js +5 -0
  159. package/dist/store/AppContext.d.ts +3 -0
  160. package/dist/store/AppContext.js +3 -0
  161. package/dist/store/AppContextType.d.ts +12 -0
  162. package/dist/store/AppContextType.js +6 -0
  163. package/dist/store/AppProvider.d.ts +7 -0
  164. package/dist/store/AppProvider.js +32 -0
  165. package/dist/store/HostedInContainerContext.d.ts +5 -0
  166. package/dist/store/HostedInContainerContext.js +11 -0
  167. package/dist/store/SesssionReducer.d.ts +4 -0
  168. package/dist/store/SesssionReducer.js +16 -0
  169. package/dist/types.d.ts +26 -0
  170. package/dist/types.js +14 -0
  171. package/dist/util/AuthUtils.d.ts +1 -0
  172. package/dist/util/AuthUtils.js +10 -0
  173. package/dist/util/LogEnum.d.ts +6 -0
  174. package/dist/util/LogEnum.js +7 -0
  175. package/dist/util/Logger.d.ts +6 -0
  176. package/dist/util/Logger.js +18 -0
  177. package/dist/util/SyzyDate.d.ts +69 -0
  178. package/dist/util/SyzyDate.js +265 -0
  179. package/dist/util/dateUtils.d.ts +10 -0
  180. package/dist/util/dateUtils.js +24 -0
  181. package/dist/util/hostedinContainer.d.ts +1 -0
  182. package/dist/util/hostedinContainer.js +9 -0
  183. package/dist/util/model-types.d.ts +96 -0
  184. package/dist/util/model-types.js +18 -0
  185. package/dist/util/prefixAndResettingValidation.d.ts +9 -0
  186. package/dist/util/prefixAndResettingValidation.js +54 -0
  187. package/dist/util/transformToData.d.ts +1 -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,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext } from 'react';
3
+ const HostedInContainerContext = createContext(false);
4
+ export const HostedInContainerProvider = ({ children }) => {
5
+ const isHosted = (() => {
6
+ const urlParams = new URLSearchParams(window.location.search);
7
+ return urlParams.get('hosted_in_container') === 'true';
8
+ })();
9
+ return (_jsx(HostedInContainerContext.Provider, { value: isHosted, children: children }));
10
+ };
11
+ export const useHostedInContainer = () => useContext(HostedInContainerContext);
@@ -0,0 +1,4 @@
1
+ import { Reducer, Dispatch } from 'react';
2
+ import { AppSession } from './AppContextType';
3
+ export declare const APPHOSTSESSION_KEY = "AppHostSession";
4
+ export declare const useSessionReducer: <T extends AppSession, A>(reducer: Reducer<T, A>, initialState: T, storageKey: string) => [T, Dispatch<A>];
@@ -0,0 +1,16 @@
1
+ import { useReducer, useEffect } from 'react';
2
+ export const APPHOSTSESSION_KEY = 'AppHostSession';
3
+ export const useSessionReducer = (reducer, initialState, storageKey) => {
4
+ const [state, dispatch] = useReducer(reducer, initialState, () => {
5
+ const value = localStorage.getItem(storageKey); // use storageKey here
6
+ let retState = { ...initialState };
7
+ if (value) {
8
+ retState = JSON.parse(value);
9
+ }
10
+ return retState;
11
+ });
12
+ useEffect(() => {
13
+ localStorage.setItem(storageKey, JSON.stringify(state)); // same key
14
+ }, [storageKey, state]);
15
+ return [state, dispatch];
16
+ };
@@ -0,0 +1,26 @@
1
+ export interface Route {
2
+ path: string;
3
+ component: React.ComponentType<any>;
4
+ title: string;
5
+ requiredComponent?: string;
6
+ exact?: boolean;
7
+ acl?: {
8
+ [key in Role]: {
9
+ type: DecisionType;
10
+ meta?: string;
11
+ };
12
+ };
13
+ props?: any;
14
+ }
15
+ export declare enum Role {
16
+ GUEST = "GUEST",
17
+ MEMBER = "MEMBER",
18
+ CHAPTERADMIN = "CHAPTERADMIN",
19
+ SUPPORTADMIN = "SUPPORTADMIN",
20
+ SUPERADMIN = "SUPERADMIN"
21
+ }
22
+ export declare enum DecisionType {
23
+ ALLOW = "allow",
24
+ DENY = "deny",
25
+ REDIRECT = "redirect"
26
+ }
package/dist/types.js ADDED
@@ -0,0 +1,14 @@
1
+ export var Role;
2
+ (function (Role) {
3
+ Role["GUEST"] = "GUEST";
4
+ Role["MEMBER"] = "MEMBER";
5
+ Role["CHAPTERADMIN"] = "CHAPTERADMIN";
6
+ Role["SUPPORTADMIN"] = "SUPPORTADMIN";
7
+ Role["SUPERADMIN"] = "SUPERADMIN";
8
+ })(Role || (Role = {}));
9
+ export var DecisionType;
10
+ (function (DecisionType) {
11
+ DecisionType["ALLOW"] = "allow";
12
+ DecisionType["DENY"] = "deny";
13
+ DecisionType["REDIRECT"] = "redirect";
14
+ })(DecisionType || (DecisionType = {}));
@@ -0,0 +1 @@
1
+ export declare function isSignedIn(): Promise<boolean>;
@@ -0,0 +1,10 @@
1
+ import { getCurrentUser } from "aws-amplify/auth";
2
+ export async function isSignedIn() {
3
+ try {
4
+ const session = await getCurrentUser();
5
+ return session !== null && session !== undefined && session.userId !== undefined;
6
+ }
7
+ catch {
8
+ return false;
9
+ }
10
+ }
@@ -0,0 +1,6 @@
1
+ export declare enum LogCategoryEnum {
2
+ Info = "info",
3
+ Warning = "warning",
4
+ Error = "error",
5
+ Warn = "Warn"
6
+ }
@@ -0,0 +1,7 @@
1
+ export var LogCategoryEnum;
2
+ (function (LogCategoryEnum) {
3
+ LogCategoryEnum["Info"] = "info";
4
+ LogCategoryEnum["Warning"] = "warning";
5
+ LogCategoryEnum["Error"] = "error";
6
+ LogCategoryEnum["Warn"] = "Warn";
7
+ })(LogCategoryEnum || (LogCategoryEnum = {}));
@@ -0,0 +1,6 @@
1
+ export declare const logger: {
2
+ debug: (...args: any[]) => false | void;
3
+ info: (...args: any[]) => false | void;
4
+ warn: (...args: any[]) => false | void;
5
+ error: (...args: any[]) => false | void;
6
+ };
@@ -0,0 +1,18 @@
1
+ const levels = {
2
+ debug: 1,
3
+ info: 2,
4
+ warn: 3,
5
+ error: 4,
6
+ none: 5,
7
+ };
8
+ // Current log level (from env)
9
+ const currentLevel = (import.meta.env.VITE_LOG_LEVEL || 'info');
10
+ function shouldLog(level) {
11
+ return levels[level] >= levels[currentLevel];
12
+ }
13
+ export const logger = {
14
+ debug: (...args) => shouldLog('debug') && console.debug('[DEBUG]', ...args),
15
+ info: (...args) => shouldLog('info') && console.info('[INFO]', ...args),
16
+ warn: (...args) => shouldLog('warn') && console.warn('[WARN]', ...args),
17
+ error: (...args) => shouldLog('error') && console.error('[ERROR]', ...args),
18
+ };
@@ -0,0 +1,69 @@
1
+ export declare class SyzyDate extends Date {
2
+ static months: string[];
3
+ addDays: (days: number) => Date;
4
+ reduceDays: (days: number) => Date;
5
+ isSameDate: (date: Date) => boolean;
6
+ isToday: () => boolean;
7
+ clone: () => Date;
8
+ isAnotherMonth: (date: Date) => boolean;
9
+ isWeekend: () => boolean;
10
+ toISODate: () => string;
11
+ /**
12
+ *
13
+ * @returns Current Date as ISO string with T between date and time
14
+ */
15
+ toISODateTime: () => string;
16
+ toISODateString(): string;
17
+ /***
18
+ * To Given Format
19
+ * DD- Date
20
+ * MM- Month in 2 digits
21
+ * Mon- Month in 3 letters
22
+ * mm- Minutes
23
+ * HH- Hours in 24 hour format
24
+ * hh- Hours in 12 hour format
25
+ * ss- Seconds
26
+ * YYYY- Year in 4 digits
27
+ * YY- Year in 2 digits
28
+ */
29
+ toDateFormatString(format: string): string;
30
+ getCurrentISODate: () => string;
31
+ toDate: () => Date;
32
+ getCurrentDate: () => SyzyDate;
33
+ currentWeek: () => number;
34
+ currentTerm: () => number;
35
+ currentQuarter: () => number;
36
+ getCurrentYrAndMonAndQuarterAndTerm: () => {
37
+ currentYr: number;
38
+ currentMon: number;
39
+ currTerm: number;
40
+ currentQuarter: number;
41
+ };
42
+ getWeekNo: () => number;
43
+ getcurrentTerm: () => number;
44
+ getCurrentQuarter: () => number;
45
+ getCurrentMonthStartAndEnd: () => {
46
+ startOfMonth: Date;
47
+ endOfMonth: Date;
48
+ };
49
+ getCurrentTermStartAndEnd: () => {
50
+ startOfTerm: Date;
51
+ endDateOfTerm: Date;
52
+ };
53
+ getCurrentYearStartAndEnd: () => {
54
+ startOfYear: Date;
55
+ endOfYear: Date;
56
+ };
57
+ getCurrentQuarterStartAndEnd: () => {
58
+ startDateOfQuarter: Date;
59
+ endDateOfQuarter: Date;
60
+ };
61
+ getCurrentWeekStartAndEnd: () => {
62
+ startDateOfWeek: Date;
63
+ endDateOfWeek: Date;
64
+ };
65
+ getSelectedMonthStartAndEnd: (month: number) => {
66
+ startOfSelectedMonth: Date;
67
+ endOfSelectedMonth: Date;
68
+ };
69
+ }
@@ -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,10 @@
1
+ import { SyzyDate } from "./SyzyDate";
2
+ export declare const DATE_FORMAT_ISO_DD_MON_YYYY = "DD-Mon-YYYY";
3
+ export declare const DATE_FORMAT_ISO_YYYY_MM_DD = "YYYY-MM-DD";
4
+ export declare const DATE_FORMAT_DD_MM_YYYY = "DD-MM-YYYY";
5
+ export declare const DATE_FORMAT_ISO_YYYY_MM_DD_HH_MM = "YYYY-MM-DD HH:mm";
6
+ export declare const DATE_FORMAT_ISO_YYYY_MM_DD_HH_MM_SS = "YYYY-MM-DD HH:mm:ss";
7
+ export declare const DATE_FORMAT_ISO_DD_MON_YYYY_HH_MM = "DD-Mon-YYYY HH:mm";
8
+ export declare const DATE_FORMAT_ISO_DD_MON_YYYY_HH_MM_SS = "DD-Mon-YYYY HH:mm:ss";
9
+ export declare const formatDateWithShortMonth: (isoDateString: string) => string;
10
+ export declare const compareDate: (date1: SyzyDate, date2: SyzyDate) => boolean;
@@ -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 @@
1
+ export declare const isHostedInContainer: () => boolean;
@@ -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,96 @@
1
+ export type ModelStringKeyConditionInput = {
2
+ eq?: string | null;
3
+ le?: string | null;
4
+ lt?: string | null;
5
+ ge?: string | null;
6
+ gt?: string | null;
7
+ between?: Array<string | null> | null;
8
+ beginsWith?: string | null;
9
+ };
10
+ export declare enum ModelSortDirection {
11
+ ASC = "ASC",
12
+ DESC = "DESC"
13
+ }
14
+ export declare enum ModelAttributeTypes {
15
+ binary = "binary",
16
+ binarySet = "binarySet",
17
+ bool = "bool",
18
+ list = "list",
19
+ map = "map",
20
+ number = "number",
21
+ numberSet = "numberSet",
22
+ string = "string",
23
+ stringSet = "stringSet",
24
+ _null = "_null"
25
+ }
26
+ export type ModelSizeInput = {
27
+ ne?: number | null;
28
+ eq?: number | null;
29
+ le?: number | null;
30
+ lt?: number | null;
31
+ ge?: number | null;
32
+ gt?: number | null;
33
+ between?: Array<number | null> | null;
34
+ };
35
+ export type ModelIDInput = {
36
+ ne?: string | null;
37
+ eq?: string | null;
38
+ le?: string | null;
39
+ lt?: string | null;
40
+ ge?: string | null;
41
+ gt?: string | null;
42
+ contains?: string | null;
43
+ notContains?: string | null;
44
+ between?: Array<string | null> | null;
45
+ in?: Array<string | null> | null;
46
+ beginsWith?: string | null;
47
+ attributeExists?: boolean | null;
48
+ attributeType?: ModelAttributeTypes | null;
49
+ size?: ModelSizeInput | null;
50
+ };
51
+ export type ModelStringInput = {
52
+ ne?: string | null;
53
+ eq?: string | null;
54
+ le?: string | null;
55
+ lt?: string | null;
56
+ ge?: string | null;
57
+ gt?: string | null;
58
+ contains?: string | null;
59
+ notContains?: string | null;
60
+ between?: Array<string | null> | null;
61
+ in?: Array<string | null> | null;
62
+ beginsWith?: string | null;
63
+ attributeExists?: boolean | null;
64
+ attributeType?: ModelAttributeTypes | null;
65
+ size?: ModelSizeInput | null;
66
+ };
67
+ export type ModelIntInput = {
68
+ ne?: number | null;
69
+ eq?: number | null;
70
+ le?: number | null;
71
+ lt?: number | null;
72
+ ge?: number | null;
73
+ gt?: number | null;
74
+ between?: Array<number | null> | null;
75
+ in?: Array<number | null> | null;
76
+ attributeExists?: boolean | null;
77
+ attributeType?: ModelAttributeTypes | null;
78
+ };
79
+ export type ModelFloatInput = {
80
+ ne?: number | null;
81
+ eq?: number | null;
82
+ le?: number | null;
83
+ lt?: number | null;
84
+ ge?: number | null;
85
+ gt?: number | null;
86
+ between?: Array<number | null> | null;
87
+ in?: Array<number | null> | null;
88
+ attributeExists?: boolean | null;
89
+ attributeType?: ModelAttributeTypes | null;
90
+ };
91
+ export type ModelBooleanInput = {
92
+ ne?: boolean | null;
93
+ eq?: boolean | null;
94
+ attributeExists?: boolean | null;
95
+ attributeType?: ModelAttributeTypes | null;
96
+ };
@@ -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,9 @@
1
+ export declare const validateFullWrapper: (val: string) => string | undefined;
2
+ export declare const validateFirstOccurance: (val: string) => {
3
+ firstWrapper: string | null;
4
+ validTokens: string[];
5
+ };
6
+ export declare const resettingOptions: (prefix: string) => {
7
+ index: number;
8
+ periods: string[];
9
+ } | null;