eiam-user-preference 0.0.13

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 (83) hide show
  1. package/LICENSE +22 -0
  2. package/dist/cjs/app-globals-V2Kpy_OQ.js +8 -0
  3. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -0
  4. package/dist/cjs/eiam-user-preference.cjs.entry.js +380 -0
  5. package/dist/cjs/eiam-user-preference.cjs.entry.js.map +1 -0
  6. package/dist/cjs/eiam-user-preference.cjs.js +28 -0
  7. package/dist/cjs/eiam-user-preference.cjs.js.map +1 -0
  8. package/dist/cjs/eiam-user-preference.entry.cjs.js.map +1 -0
  9. package/dist/cjs/index-CpBvGZoy.js +1355 -0
  10. package/dist/cjs/index-CpBvGZoy.js.map +1 -0
  11. package/dist/cjs/index.cjs.js +10 -0
  12. package/dist/cjs/index.cjs.js.map +1 -0
  13. package/dist/cjs/loader.cjs.js +16 -0
  14. package/dist/cjs/loader.cjs.js.map +1 -0
  15. package/dist/cjs/my-component.cjs.entry.js +36 -0
  16. package/dist/cjs/my-component.cjs.entry.js.map +1 -0
  17. package/dist/cjs/my-component.entry.cjs.js.map +1 -0
  18. package/dist/collection/collection-manifest.json +13 -0
  19. package/dist/collection/components/eiam-user-preference/eiam-user-preference.css +34 -0
  20. package/dist/collection/components/eiam-user-preference/eiam-user-preference.js +446 -0
  21. package/dist/collection/components/eiam-user-preference/eiam-user-preference.js.map +1 -0
  22. package/dist/collection/components/my-component/my-component.css +3 -0
  23. package/dist/collection/components/my-component/my-component.js +96 -0
  24. package/dist/collection/components/my-component/my-component.js.map +1 -0
  25. package/dist/collection/index.js +11 -0
  26. package/dist/collection/index.js.map +1 -0
  27. package/dist/collection/utils/utils.js +4 -0
  28. package/dist/collection/utils/utils.js.map +1 -0
  29. package/dist/components/eiam-user-preference.d.ts +11 -0
  30. package/dist/components/eiam-user-preference.js +418 -0
  31. package/dist/components/eiam-user-preference.js.map +1 -0
  32. package/dist/components/index.d.ts +33 -0
  33. package/dist/components/index.js +10 -0
  34. package/dist/components/index.js.map +1 -0
  35. package/dist/components/my-component.d.ts +11 -0
  36. package/dist/components/my-component.js +57 -0
  37. package/dist/components/my-component.js.map +1 -0
  38. package/dist/components/p-CkpXNKI5.js +1150 -0
  39. package/dist/components/p-CkpXNKI5.js.map +1 -0
  40. package/dist/eiam-user-preference/eiam-user-preference.entry.esm.js.map +1 -0
  41. package/dist/eiam-user-preference/eiam-user-preference.esm.js +2 -0
  42. package/dist/eiam-user-preference/eiam-user-preference.esm.js.map +1 -0
  43. package/dist/eiam-user-preference/index.esm.js +2 -0
  44. package/dist/eiam-user-preference/index.esm.js.map +1 -0
  45. package/dist/eiam-user-preference/loader.esm.js.map +1 -0
  46. package/dist/eiam-user-preference/my-component.entry.esm.js.map +1 -0
  47. package/dist/eiam-user-preference/p-92b5e823.entry.js +2 -0
  48. package/dist/eiam-user-preference/p-92b5e823.entry.js.map +1 -0
  49. package/dist/eiam-user-preference/p-Chl3oIcU.js +3 -0
  50. package/dist/eiam-user-preference/p-Chl3oIcU.js.map +1 -0
  51. package/dist/eiam-user-preference/p-DQuL1Twl.js +2 -0
  52. package/dist/eiam-user-preference/p-DQuL1Twl.js.map +1 -0
  53. package/dist/eiam-user-preference/p-d0510b8c.entry.js +2 -0
  54. package/dist/eiam-user-preference/p-d0510b8c.entry.js.map +1 -0
  55. package/dist/esm/app-globals-DQuL1Twl.js +6 -0
  56. package/dist/esm/app-globals-DQuL1Twl.js.map +1 -0
  57. package/dist/esm/eiam-user-preference.entry.js +378 -0
  58. package/dist/esm/eiam-user-preference.entry.js.map +1 -0
  59. package/dist/esm/eiam-user-preference.js +24 -0
  60. package/dist/esm/eiam-user-preference.js.map +1 -0
  61. package/dist/esm/index-Chl3oIcU.js +1347 -0
  62. package/dist/esm/index-Chl3oIcU.js.map +1 -0
  63. package/dist/esm/index.js +8 -0
  64. package/dist/esm/index.js.map +1 -0
  65. package/dist/esm/loader.js +14 -0
  66. package/dist/esm/loader.js.map +1 -0
  67. package/dist/esm/my-component.entry.js +34 -0
  68. package/dist/esm/my-component.entry.js.map +1 -0
  69. package/dist/index.cjs.js +1 -0
  70. package/dist/index.js +1 -0
  71. package/dist/types/components/eiam-user-preference/eiam-user-preference.d.ts +68 -0
  72. package/dist/types/components/my-component/my-component.d.ts +16 -0
  73. package/dist/types/components.d.ts +78 -0
  74. package/dist/types/index.d.ts +11 -0
  75. package/dist/types/stencil-public-runtime.d.ts +1683 -0
  76. package/dist/types/utils/utils.d.ts +1 -0
  77. package/loader/cdn.js +1 -0
  78. package/loader/index.cjs.js +1 -0
  79. package/loader/index.d.ts +24 -0
  80. package/loader/index.es2017.js +1 -0
  81. package/loader/index.js +2 -0
  82. package/package.json +53 -0
  83. package/readme.md +111 -0
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-CpBvGZoy.js');
4
+ var index$1 = require('./index.cjs.js');
5
+
6
+ const myComponentCss = ":host{display:block}";
7
+
8
+ const MyComponent = class {
9
+ constructor(hostRef) {
10
+ index.registerInstance(this, hostRef);
11
+ }
12
+ /**
13
+ * The first name
14
+ */
15
+ first;
16
+ /**
17
+ * The middle name
18
+ */
19
+ middle;
20
+ /**
21
+ * The last name
22
+ */
23
+ last;
24
+ getText() {
25
+ return index$1.format(this.first, this.middle, this.last);
26
+ }
27
+ render() {
28
+ return index.h("div", { key: '76b1efbfabf4194a3615ca3c9f0af80d326fed1c' }, "Hello, World! I'm ", this.getText());
29
+ }
30
+ };
31
+ MyComponent.style = myComponentCss;
32
+
33
+ exports.my_component = MyComponent;
34
+ //# sourceMappingURL=my-component.entry.cjs.js.map
35
+
36
+ //# sourceMappingURL=my-component.cjs.entry.js.map
@@ -0,0 +1 @@
1
+ {"file":"my-component.entry.cjs.js","mappings":";;;;;AAAA,MAAM,cAAc,GAAG,sBAAsB;;MCQhC,WAAW,GAAA,MAAA;;;;AACtB;;AAEG;AACK,IAAA,KAAK;AAEb;;AAEG;AACK,IAAA,MAAM;AAEd;;AAEG;AACK,IAAA,IAAI;IAEJ,OAAO,GAAA;AACb,QAAA,OAAOA,cAAM,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC;;IAGnD,MAAM,GAAA;AACJ,QAAA,OAAOC,OAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,wBAAwB,IAAI,CAAC,OAAO,EAAE,CAAO;;;;;;;","names":["format","h"],"sources":["src/components/my-component/my-component.css?tag=my-component&encapsulation=shadow","src/components/my-component/my-component.tsx"],"sourcesContent":[":host {\n display: block;\n}\n","import { Component, Prop, h } from '@stencil/core';\nimport { format } from '../../utils/utils';\n\n@Component({\n tag: 'my-component',\n styleUrl: 'my-component.css',\n shadow: true,\n})\nexport class MyComponent {\n /**\n * The first name\n */\n @Prop() first: string;\n\n /**\n * The middle name\n */\n @Prop() middle: string;\n\n /**\n * The last name\n */\n @Prop() last: string;\n\n private getText(): string {\n return format(this.first, this.middle, this.last);\n }\n\n render() {\n return <div>Hello, World! I'm {this.getText()}</div>;\n }\n}\n"],"version":3}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"my-component.entry.cjs.js","sources":["src/components/my-component/my-component.css?tag=my-component&encapsulation=shadow","src/components/my-component/my-component.tsx"],"sourcesContent":[":host {\n display: block;\n}\n","import { Component, Prop, h } from '@stencil/core';\nimport { format } from '../../utils/utils';\n\n@Component({\n tag: 'my-component',\n styleUrl: 'my-component.css',\n shadow: true,\n})\nexport class MyComponent {\n /**\n * The first name\n */\n @Prop() first: string;\n\n /**\n * The middle name\n */\n @Prop() middle: string;\n\n /**\n * The last name\n */\n @Prop() last: string;\n\n private getText(): string {\n return format(this.first, this.middle, this.last);\n }\n\n render() {\n return <div>Hello, World! I'm {this.getText()}</div>;\n }\n}\n"],"names":["format","h"],"mappings":";;;;;AAAA,MAAM,cAAc,GAAG,sBAAsB;;MCQhC,WAAW,GAAA,MAAA;;;;AACtB;;AAEG;AACK,IAAA,KAAK;AAEb;;AAEG;AACK,IAAA,MAAM;AAEd;;AAEG;AACK,IAAA,IAAI;IAEJ,OAAO,GAAA;AACb,QAAA,OAAOA,cAAM,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC;;IAGnD,MAAM,GAAA;AACJ,QAAA,OAAOC,OAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,wBAAwB,IAAI,CAAC,OAAO,EAAE,CAAO;;;;;;;"}
@@ -0,0 +1,13 @@
1
+ {
2
+ "entries": [
3
+ "components/eiam-user-preference/eiam-user-preference.js",
4
+ "components/my-component/my-component.js"
5
+ ],
6
+ "compiler": {
7
+ "name": "@stencil/core",
8
+ "version": "4.29.1",
9
+ "typescriptVersion": "5.5.4"
10
+ },
11
+ "collections": [],
12
+ "bundles": []
13
+ }
@@ -0,0 +1,34 @@
1
+
2
+ .kt-quick-panel.kt-quick-panel--on {
3
+ -webkit-transition: left 0.3s ease, right 0.3s ease;
4
+ transition: left 0.3s ease, right 0.3s ease;
5
+ right: 0;
6
+ left: auto;
7
+ }
8
+
9
+ .kt-quick-panel-close {
10
+ width: 25px;
11
+ height: 25px;
12
+ top: 1px;
13
+ z-index: 1002;
14
+ -webkit-transition: left 0.3s ease, right 0.3s ease;
15
+ transition: left 0.3s ease, right 0.3s ease;
16
+ position: fixed;
17
+ border: 0;
18
+ -webkit-box-shadow: none;
19
+ box-shadow: none;
20
+ border-radius: 3px;
21
+ cursor: pointer;
22
+ outline: none !important;
23
+ display: -webkit-box;
24
+ display: -ms-flexbox;
25
+ display: flex;
26
+ -webkit-box-pack: center;
27
+ -ms-flex-pack: center;
28
+ justify-content: center;
29
+ -webkit-box-align: center;
30
+ -ms-flex-align: center;
31
+ align-items: center;
32
+ left: -25px;
33
+ }
34
+
@@ -0,0 +1,446 @@
1
+ import { Host, h } from "@stencil/core";
2
+ export class EiamUserPreference {
3
+ host;
4
+ apiUrl = window['config']?.apiUrl || 'http://localhost:5000';
5
+ currentRouteSlug;
6
+ payload = {
7
+ pagination: {
8
+ pageIndex: 0,
9
+ pageSize: 1000,
10
+ },
11
+ search: {
12
+ pageName: '',
13
+ },
14
+ };
15
+ userPreferences = {
16
+ dateFormate: 'dd/MM/yyyy',
17
+ timeFormate: '',
18
+ fontSize: null,
19
+ displayFormat: 4,
20
+ defaultLandingPageId: '',
21
+ pageName: '',
22
+ };
23
+ dateFormates = ['dd/MM/yyyy', 'MM/dd/yyyy', 'yyyy-MM-dd'];
24
+ timeFormats = ['h:mm a'];
25
+ fontSizes = [
26
+ { label: 'Small', value: '14' },
27
+ { label: 'Medium', value: '16' },
28
+ { label: 'Large', value: '18' },
29
+ ];
30
+ displayFormats = [];
31
+ userApplications = [];
32
+ pages = [];
33
+ totalPages = 0;
34
+ isModalOpen = false;
35
+ isPageModalOpen = false; // Controls the visibility of the secondary modal
36
+ selectedPage = { id: null, name: '' }; // To store selected page
37
+ pageParams = {
38
+ pageName: '',
39
+ status: 0,
40
+ pageCategory: 0,
41
+ cultureId: 0,
42
+ cultureCode: '',
43
+ pageNumber: 0,
44
+ pageSize: 10,
45
+ applicationId: 0,
46
+ searchText: '',
47
+ };
48
+ pageId;
49
+ cultureCode;
50
+ applicationId;
51
+ async componentWillLoad() {
52
+ await this.getDisplayFormats();
53
+ await this.getUserPreferences();
54
+ await this.getUserApplications();
55
+ }
56
+ componentDidLoad() {
57
+ if (this.host.shadowRoot) {
58
+ const existingLink = this.host.shadowRoot.querySelector('link[rel="stylesheet"]');
59
+ if (!existingLink) {
60
+ const link = document.createElement('link');
61
+ link.rel = 'stylesheet';
62
+ link.href = 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css';
63
+ this.host.shadowRoot.appendChild(link);
64
+ // console.log('FontAwesome added to shadow DOM');
65
+ }
66
+ else {
67
+ console.log('FontAwesome already added to shadow DOM');
68
+ }
69
+ }
70
+ else {
71
+ console.warn('shadowRoot is null');
72
+ }
73
+ }
74
+ async getDisplayFormats() {
75
+ try {
76
+ const headers = {
77
+ 'Content-Type': 'application/json',
78
+ 'IntegrationPermission': '0f5d983d203189bbffc5f686d01f6680bc6a83718a515fe42639347efc92478e',
79
+ 'CultureCode': this.cultureCode,
80
+ 'Source': '2',
81
+ 'applicationId': this.applicationId,
82
+ };
83
+ const response = await fetch(`${this.apiUrl}/api/UserPreferences/DisplayFormats`, {
84
+ method: 'GET', // Specify GET method
85
+ headers: headers,
86
+ credentials: 'include', // Include credentials (cookies) in the request
87
+ });
88
+ const data = await response.json();
89
+ if (Array.isArray(data.content)) {
90
+ this.displayFormats = data.content;
91
+ }
92
+ else {
93
+ console.error('Invalid response structure:', data);
94
+ }
95
+ }
96
+ catch (error) {
97
+ console.error('Error fetching display formats:', error);
98
+ }
99
+ }
100
+ async getUserPreferences() {
101
+ try {
102
+ const headers = {
103
+ 'Content-Type': 'application/json',
104
+ 'IntegrationPermission': '0f5d983d203189bbffc5f686d01f6680bc6a83718a515fe42639347efc92478e',
105
+ 'CultureCode': this.cultureCode,
106
+ 'Source': '2',
107
+ 'applicationId': this.applicationId,
108
+ };
109
+ const response = await fetch(`${this.apiUrl}/api/UserPreferences/GetUserPreferences`, {
110
+ method: 'GET',
111
+ headers: headers,
112
+ credentials: 'include',
113
+ });
114
+ const data = await response.json();
115
+ if (data && typeof data !== 'string') {
116
+ const fontSizeValue = parseFloat(data.fontSize);
117
+ this.userPreferences = {
118
+ ...this.userPreferences,
119
+ dateFormate: data.dateFormate || 'dd/MM/yyyy',
120
+ timeFormate: data.timeFormate || this.timeFormats[0], // fallback!
121
+ fontSize: !isNaN(fontSizeValue) ? fontSizeValue : this.fontSizes[0]?.value,
122
+ displayFormat: data.displayFormat || 1,
123
+ defaultLandingPageId: data.defaultLandingPageId,
124
+ pageName: data?.defaultLandingPageDetails?.name || '',
125
+ };
126
+ }
127
+ }
128
+ catch (error) {
129
+ console.error('Error fetching user preferences:', error);
130
+ }
131
+ }
132
+ async getUserApplications() {
133
+ try {
134
+ const headers = {
135
+ 'Content-Type': 'application/json',
136
+ 'IntegrationPermission': '0f5d983d203189bbffc5f686d01f6680bc6a83718a515fe42639347efc92478e',
137
+ 'CultureCode': this.cultureCode,
138
+ 'Source': '2',
139
+ 'applicationId': this.applicationId,
140
+ };
141
+ const response = await fetch(`${this.apiUrl}/api/OrganizationApplicationsApi/GetAssigndApplicationForUser`, {
142
+ method: 'GET',
143
+ headers: headers,
144
+ credentials: 'include',
145
+ });
146
+ const data = await response.json();
147
+ if (data && Array.isArray(data.content)) {
148
+ this.userApplications = data.content;
149
+ }
150
+ else {
151
+ console.error('Invalid response structure:', data);
152
+ }
153
+ }
154
+ catch (error) {
155
+ console.error('Error fetching applications:', error);
156
+ }
157
+ }
158
+ changeApplication(application) {
159
+ if (application.applicationId) {
160
+ this.pageParams.applicationId = application.applicationId;
161
+ this.getPagesSApplications();
162
+ }
163
+ }
164
+ async getPagesSApplications() {
165
+ const requestBody = {}; // Create the request body (you can modify based on your needs)
166
+ try {
167
+ const response = await fetch(`${this.apiUrl}/api/Pages/GetPages`, {
168
+ method: 'POST',
169
+ headers: {
170
+ 'Content-Type': 'application/json',
171
+ 'IntegrationPermission': '0f5d983d203189bbffc5f686d01f6680bc6a83718a515fe42639347efc92478e',
172
+ 'CultureCode': this.cultureCode,
173
+ 'Source': '2',
174
+ 'applicationId': this.applicationId,
175
+ },
176
+ credentials: 'include',
177
+ body: JSON.stringify(requestBody),
178
+ });
179
+ if (!response.ok) {
180
+ console.error('Failed to fetch pages');
181
+ return;
182
+ }
183
+ const data = await response.json();
184
+ console.log(data, 'data of all pages ');
185
+ }
186
+ catch (error) {
187
+ console.error('Error fetching pages:', error);
188
+ }
189
+ }
190
+ // async submitPreferences() {
191
+ // const fontSize = this.userPreferences.fontSize ? this.userPreferences.fontSize + 'px' : null;
192
+ // const headers = {
193
+ // 'Content-Type': 'application/json',
194
+ // 'IntegrationPermission': '0f5d983d203189bbffc5f686d01f6680bc6a83718a515fe42639347efc92478e',
195
+ // 'CultureCode': this.cultureCode,
196
+ // 'Source': '2',
197
+ // 'applicationId': this.applicationId,
198
+ // };
199
+ // try {
200
+ // const response = await fetch(`${this.apiUrl}/api/UserPreferences/SaveUserPreferences`, {
201
+ // method: 'POST',
202
+ // headers: headers,
203
+ // body: JSON.stringify({ ...this.userPreferences, fontSize }),
204
+ // credentials: 'include',
205
+ // });
206
+ // if (!response.ok) {
207
+ // console.error('Failed to save preferences:', response.statusText);
208
+ // return;
209
+ // }
210
+ // await this.getUserPreferences();
211
+ // } catch (error) {
212
+ // console.error('Error submitting preferences:', error);
213
+ // }
214
+ // }
215
+ async submitPreferences() {
216
+ const fontSizeValue = parseFloat(this.userPreferences.fontSize);
217
+ const fontSize = !isNaN(fontSizeValue) ? `${fontSizeValue}px` : null;
218
+ const headers = {
219
+ 'Content-Type': 'application/json',
220
+ 'IntegrationPermission': '0f5d983d203189bbffc5f686d01f6680bc6a83718a515fe42639347efc92478e',
221
+ 'CultureCode': this.cultureCode,
222
+ 'Source': '2',
223
+ 'applicationId': this.applicationId,
224
+ };
225
+ try {
226
+ const response = await fetch(`${this.apiUrl}/api/UserPreferences/SaveUserPreferences`, {
227
+ method: 'POST',
228
+ headers,
229
+ body: JSON.stringify({ ...this.userPreferences, fontSize }),
230
+ credentials: 'include',
231
+ });
232
+ if (!response.ok) {
233
+ console.error('Failed to save preferences:', response.statusText);
234
+ return;
235
+ }
236
+ // Fetch updated preferences
237
+ const newPrefs = await this.getUserPreferences();
238
+ if (!newPrefs || typeof newPrefs === 'string')
239
+ return;
240
+ // Apply updated preferences like Angular code
241
+ const { displayFormat, fontSize: newFontSize, dateFormate, timeFormate } = newPrefs;
242
+ if (displayFormat) {
243
+ localStorage.setItem('displayFormat', displayFormat);
244
+ // this.emit('displayFormatUpdated', displayFormat);
245
+ }
246
+ if (newFontSize) {
247
+ document.body.setAttribute('style', `font-size: ${newFontSize} !important`);
248
+ }
249
+ localStorage.setItem('dateFormat', dateFormate || 'dd/MM/yyyy');
250
+ localStorage.setItem('timeFormat', timeFormate || '');
251
+ // this.emit('dateFormatUpdated', dateFormate || 'dd/MM/yyyy');
252
+ // this.emit('timeFormatUpdated', timeFormate || '');
253
+ }
254
+ catch (error) {
255
+ console.error('Error submitting preferences:', error);
256
+ }
257
+ }
258
+ async resetPreferences() {
259
+ try {
260
+ await fetch(`${this.apiUrl}/api/UserPreferences/Delete`, {
261
+ method: 'DELETE',
262
+ credentials: 'include',
263
+ });
264
+ this.userPreferences = {
265
+ dateFormate: 'dd/MM/yyyy',
266
+ timeFormate: '',
267
+ fontSize: '',
268
+ displayFormat: 4,
269
+ defaultLandingPageId: '',
270
+ pageName: '',
271
+ };
272
+ localStorage.removeItem('dateFormat');
273
+ localStorage.removeItem('displayFormat');
274
+ localStorage.removeItem('fontSize');
275
+ location.reload(); // If you want to refresh the UI
276
+ }
277
+ catch (error) {
278
+ console.error('Failed to reset preferences', error);
279
+ }
280
+ }
281
+ toggleModal() {
282
+ this.isModalOpen = !this.isModalOpen;
283
+ }
284
+ togglePageModal() {
285
+ this.isPageModalOpen = !this.isPageModalOpen;
286
+ }
287
+ selectPage(page) {
288
+ this.selectedPage = page;
289
+ this.userPreferences.defaultLandingPageId = page.id; // Update default landing page
290
+ this.togglePageModal(); // Close the page selection modal
291
+ }
292
+ // render() {
293
+ // return (
294
+ // <Host>
295
+ // <div>
296
+ // <i class="fas fa-cogs" onClick={() => this.toggleModal()} style={{ cursor: 'pointer', fontSize: '24px' }}></i>
297
+ // {/* Modal */}
298
+ // {this.isModalOpen && (
299
+ // <div class="modal">
300
+ // <div class="modal-content">
301
+ // <span class="close" onClick={() => this.toggleModal()}>
302
+ // &times;
303
+ // </span>
304
+ // <h2>User Preferences</h2>
305
+ // <div>
306
+ // <label>Date Format</label>
307
+ // <select onInput={e => (this.userPreferences.dateFormate = (e.target as HTMLSelectElement).value)}>
308
+ // {this.dateFormates.map(format => (
309
+ // <option value={format} selected={this.userPreferences.dateFormate === format}>
310
+ // {format}
311
+ // </option>
312
+ // ))}
313
+ // </select>
314
+ // <label>Time Format</label>
315
+ // <select onInput={e => (this.userPreferences.timeFormate = (e.target as HTMLSelectElement).value)}>
316
+ // {this.timeFormats.map(format => (
317
+ // <option value={format} selected={this.userPreferences.timeFormate === format}>
318
+ // {format}
319
+ // </option>
320
+ // ))}
321
+ // </select>
322
+ // <label>Font Size</label>
323
+ // <select onInput={e => (this.userPreferences.fontSize = (e.target as HTMLSelectElement).value)}>
324
+ // {this.fontSizes.map(size => (
325
+ // <option value={size.value} selected={this.userPreferences.fontSize === size.value}>
326
+ // {size.label}
327
+ // </option>
328
+ // ))}
329
+ // </select>
330
+ // <label>User Display Format</label>
331
+ // <select onInput={e => (this.userPreferences.displayFormat = parseInt((e.target as HTMLSelectElement).value))}>
332
+ // {this.displayFormats.map(format => (
333
+ // <option value={format.value} selected={this.userPreferences.displayFormat === format.value}>
334
+ // {format.label}
335
+ // </option>
336
+ // ))}
337
+ // </select>
338
+ // <label>Default Landing Page</label>
339
+ // <select onInput={e => (this.userPreferences.defaultLandingPageId = (e.target as HTMLSelectElement).value)}>
340
+ // {this.pages.map(page => (
341
+ // <option value={page.id} selected={this.userPreferences.defaultLandingPageId === page.id}>
342
+ // {page.name}
343
+ // </option>
344
+ // ))}
345
+ // </select>
346
+ // <button onClick={() => this.submitPreferences()}>Save</button>
347
+ // <button onClick={() => this.resetPreferences()}>Reset</button>
348
+ // </div>
349
+ // </div>
350
+ // </div>
351
+ // )}
352
+ // </div>
353
+ // </Host>
354
+ // );
355
+ // }
356
+ render() {
357
+ return (h(Host, { key: '73268d667553094939f061bcb072bda06c14b214' }, h("div", { key: '9eb1fd24078089437f64a4840f738a1f942452b0' }, h("i", { key: '8ad9ea93263a7695eed25fb3fe33893c22e2a989', class: "fas fa-cogs", onClick: () => this.toggleModal(), style: { cursor: 'pointer', fontSize: '24px' } }), this.isModalOpen && (h("div", { key: '988a1a24b362afc61f0e9398a6c401dacfc42837', class: "kt-quick-panel kt-quick-panel--on" }, h("a", { key: 'd969cf578cab9d74ce3bc9203beab91d7d47f1b2', onClick: () => this.toggleModal(), id: "kt_quick_panel_close_btn", class: "kt-quick-panel__close" }, h("i", { key: 'a575b9ee906bd938bfb324835e56b04f9ce256f1', class: "fas fa-times" })), h("div", { key: 'e35452dc147593b9b10707c8efa15e600d8b38c2', class: "kt-quick-panel__nav" }, h("ul", { key: 'b5eb70a8f79b795e53dd364e6c518f623ea0680c', role: "tablist", class: "nav nav-tabs nav-tabs-line nav-tabs-bold nav-tabs-line-3x nav-tabs-line-brand kt-notification-item-padding-x" }, h("li", { key: '2a4efe276341c924f7c3437643c9aa23f2739ca6', class: "nav-item active" }, h("a", { key: 'a301c57cc56e752b21881037f02abbaf5e721060', "data-toggle": "tab", role: "tab", class: "nav-link active" }, "User Preference")))), h("div", { key: '2a2a0a8df42f12ae43290fa82649492faf118a1a', class: "kt-quick-panel__content" }, h("div", { key: 'df7abede8ff8e7c6219939f32bb097e4126b513c', class: "tab-content" }, h("div", { key: 'aef7806fef44acb6179007e5af991ec1a9ef1148', id: "kt_quick_panel_tab_notifications", role: "tabpanel", class: "tab-pane fade show kt-scroll active ps ps--active-y" }, h("div", { key: 'ceb62ff2e5d97947c7746cc3ba8359a903106261', class: "kt-notification" }, h("div", { key: '345c04d2b76a353e6336d87d6cf7fb0ba831183f', class: "kt-portlet__body" }, h("div", { key: 'e8f3b6eaacea413e7f8fa9a05d7e4a1ecd4f3abf', class: "form-group" }, h("label", { key: '7f4f8b89e8bb8fce52da354579c305edfdbfbd7b' }, "Date Format"), h("select", { key: '802e4604185a71450e19fe0ff80091c11aa607aa', onInput: e => (this.userPreferences.dateFormate = e.target.value) }, this.dateFormates.map(format => (h("option", { value: format, selected: this.userPreferences.dateFormate === format }, format))))), h("div", { key: 'da29120fb40a409f143a212b592455ee0a3e9486', class: "form-group" }, h("label", { key: 'db8adfe511a9647822add835b2e79b35551e8ae8' }, "Time Format"), h("select", { key: 'aa335e039c7509388ae5b0ebb95e38a2dd26dd84', onInput: e => (this.userPreferences.timeFormate = e.target.value) }, this.timeFormats.map(format => (h("option", { value: format, selected: this.userPreferences.timeFormate === format }, format))))), h("div", { key: '95591ac88b995c9a2bc9c7e85dc4d86fabd49111', class: "form-group" }, h("label", { key: 'abcc1107a38ab88df414cb6e0b0f89d30db14edb' }, "Font Size"), h("select", { key: '2500ac6ead59cdfd696fb70de46d80395f09b7ba', onInput: e => (this.userPreferences.fontSize = e.target.value) }, this.fontSizes.map(size => (h("option", { value: size.value, selected: this.userPreferences.fontSize === size.value }, size.label))))), h("div", { key: '8e28e4ea701c85a9df01c6e377ff41e0775d217f', class: "form-group" }, h("label", { key: '63a1fca56a0bdae7c4aa91f97e00e764d130b61d' }, "User Display Format"), h("select", { key: 'd637292ae9df0ad9694119d3ed9eb653aa318350', onInput: e => (this.userPreferences.displayFormat = parseInt(e.target.value)) }, this.displayFormats.map(format => (h("option", { value: format.value, selected: this.userPreferences.displayFormat === format.value }, format.label))))), h("div", { key: 'a05f5a4620222485b3d70e662675f79a344cbfc6', class: "form-group" }, h("label", { key: '163feb5c4c8707d3b5de2e7ece82d725de954814' }, "Default Landing Page"), h("div", { key: 'f45690926ace8996450fc90856d725c49ad87efd', class: "input-group", onClick: () => this.togglePageModal() }, h("div", { key: '96be1b6688f8b8d354662e2978d5d767c2d097b5', class: "input-group-prepend" }, h("span", { key: '71f477fe498f90e3b440fdde31fb17e7ffa6743e', class: "input-group-text" }, h("i", { key: '5491f0b4b917a953590e9d3b40ac04fcf767a357', class: "fas fa-link" }))), h("input", { key: '8ab0f12f72e0a2911a8803c79409de0fdbc9a935', type: "text", class: "form-control", readonly: true, value: this.selectedPage.name || 'Select page', placeholder: "Select page" })))), h("div", { key: 'd031e47045efa5108f70e7d1e97700b348c34654', class: "kt-portlet__foot" }, h("div", { key: 'fc41e360f1331381d73bac4f9bb0c6c89ae3262c', class: "kt-form__actions" }, h("button", { key: 'f6e0948a440fbd83885bd20549ddc2bbddf3219c', class: "btn btn-primary", onClick: () => this.submitPreferences() }, "Save"), h("button", { key: 'db3e6b974e20adb93c7dcca03fa52dfdbea57d82', class: "btn btn-secondary", onClick: () => this.resetPreferences() }, "Reset"))))))))), this.isPageModalOpen && (h("div", { key: '36ed3547d24490064ad098ff6893f64abafa612f', class: "modal-dialog modal-md landing-modal" }, h("div", { key: '425a4cdbe00179fb0628ddd46f1ea8699c52aa8b', class: "modal-content landing-page" }, h("div", { key: '0ea6be6c543941262e28a029990bf3d5a3d65f6b', class: "modal-header" }, h("h4", { key: '36644da5cf638a4c24179cc553ec74db1705315e', class: "modal-title pull-left" }, " Default Landing Page "), h("button", { key: 'e59f82a9c151a80ae4300e432172d767e819ba9a', onClick: () => this.togglePageModal(), type: "button", "aria-label": "Close", class: "close pull-right" }, h("span", { key: '6c36480c025d8c7a9ddbee1ca2c3d8c15b01b917' }, h("i", { key: '22e67e915e5dc2cdee997c48b548710c9038941f', class: "fas fa-times" })))), h("div", { key: '5afc1b174e337ac3656d7f2a268d245acb65a8a2', class: "modal-body" }, h("div", { key: '08b55625de4683aad5c3eeede962029701b7d8c6', class: "row" }, h("div", { key: 'f7eebf3e41024676b42c956addef734e18aa2d05', class: "col-12" }, h("div", { key: '2e4bec9be8c15162b43e202623ebf79367783ff0', class: "row" }, h("div", { key: 'd10ec0ce280235ad7bdad74d65f1158e53966519', class: "form-group" }, h("label", { key: 'c67179f8a27436aeec5a209a4b6a169f31bc367b', htmlFor: "" }, " Default Landing Page "), h("select", { key: 'bf0f2664891f7b581ee60cba7c14296e25f2e218', onInput: e => this.changeApplication(e) }, this.userApplications.map(application => (h("option", { value: application.applicationId }, application.applicationName)))))), h("label", { key: '17fa28c79845986510a0d2a538251673cdde4dc6' }, "Select Page"), h("div", { key: 'ceaf84ad32062d5b3a6c125b77f4b8c37c82ca37', style: { maxHeight: '300px', overflowY: 'auto', overflowX: 'hidden' } }, this.pages.map(page => (h("div", { class: "slug-item", onClick: () => this.selectPage(page) }, h("div", { class: "row" }, h("span", { class: "text-brand", style: { fontWeight: '600', lineHeight: '1' } }, page.name), h("small", { class: {
358
+ 'culture-unpublished': page.pageCultureStatus == 1,
359
+ 'culture-published': page.pageCultureStatus == 2,
360
+ } }, "| ", page.cultureCode)))))), h("div", { key: 'fe6fd591d3f70ed1903b49d927b6efd3006d82cf', class: "d-flex justify-content-center mt-2 pagination-class" }))))))))));
361
+ }
362
+ static get is() { return "eiam-user-preference"; }
363
+ static get encapsulation() { return "shadow"; }
364
+ static get originalStyleUrls() {
365
+ return {
366
+ "$": ["eiam-user-preference.css"]
367
+ };
368
+ }
369
+ static get styleUrls() {
370
+ return {
371
+ "$": ["eiam-user-preference.css"]
372
+ };
373
+ }
374
+ static get properties() {
375
+ return {
376
+ "cultureCode": {
377
+ "type": "string",
378
+ "attribute": "culture-code",
379
+ "mutable": false,
380
+ "complexType": {
381
+ "original": "string",
382
+ "resolved": "string",
383
+ "references": {}
384
+ },
385
+ "required": false,
386
+ "optional": false,
387
+ "docs": {
388
+ "tags": [],
389
+ "text": ""
390
+ },
391
+ "getter": false,
392
+ "setter": false,
393
+ "reflect": false
394
+ },
395
+ "applicationId": {
396
+ "type": "string",
397
+ "attribute": "application-id",
398
+ "mutable": false,
399
+ "complexType": {
400
+ "original": "string",
401
+ "resolved": "string",
402
+ "references": {}
403
+ },
404
+ "required": false,
405
+ "optional": false,
406
+ "docs": {
407
+ "tags": [],
408
+ "text": ""
409
+ },
410
+ "getter": false,
411
+ "setter": false,
412
+ "reflect": false
413
+ }
414
+ };
415
+ }
416
+ static get states() {
417
+ return {
418
+ "currentRouteSlug": {},
419
+ "payload": {},
420
+ "userPreferences": {},
421
+ "dateFormates": {},
422
+ "timeFormats": {},
423
+ "fontSizes": {},
424
+ "displayFormats": {},
425
+ "userApplications": {},
426
+ "pages": {},
427
+ "totalPages": {},
428
+ "isModalOpen": {},
429
+ "isPageModalOpen": {},
430
+ "selectedPage": {},
431
+ "pageParams": {},
432
+ "pageId": {}
433
+ };
434
+ }
435
+ static get elementRef() { return "host"; }
436
+ static get watchers() {
437
+ return [{
438
+ "propName": "cultureCode",
439
+ "methodName": "componentWillLoad"
440
+ }, {
441
+ "propName": "applicationId",
442
+ "methodName": "componentWillLoad"
443
+ }];
444
+ }
445
+ }
446
+ //# sourceMappingURL=eiam-user-preference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eiam-user-preference.js","sourceRoot":"","sources":["../../../src/components/eiam-user-preference/eiam-user-preference.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAOhF,MAAM,OAAO,kBAAkB;IAClB,IAAI,CAAc;IAC7B,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,uBAAuB,CAAC;IACpD,gBAAgB,CAAS;IACzB,OAAO,GAAG;QACjB,UAAU,EAAE;YACV,SAAS,EAAE,CAAC;YACZ,QAAQ,EAAE,IAAI;SACf;QACD,MAAM,EAAE;YACN,QAAQ,EAAE,EAAE;SACb;KACF,CAAC;IACO,eAAe,GAAG;QACzB,WAAW,EAAE,YAAY;QACzB,WAAW,EAAE,EAAE;QACf,QAAQ,EAAE,IAAI;QACd,aAAa,EAAE,CAAC;QAChB,oBAAoB,EAAE,EAAE;QACxB,QAAQ,EAAE,EAAE;KACb,CAAC;IAEO,YAAY,GAAa,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IACpE,WAAW,GAAa,CAAC,QAAQ,CAAC,CAAC;IACnC,SAAS,GAAG;QACnB,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE;QAC/B,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE;QAChC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,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oCAEN,8EAA0B;oCAC1B,4DAAK,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,IACvE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CACtB,WAAK,KAAK,EAAC,WAAW,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;wCACzD,WAAK,KAAK,EAAC,KAAK;4CACd,YAAM,KAAK,EAAC,YAAY,EAAC,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,IACnE,IAAI,CAAC,IAAI,CACL;4CACP,aACE,KAAK,EAAE;oDACL,qBAAqB,EAAE,IAAI,CAAC,iBAAiB,IAAI,CAAC;oDAClD,mBAAmB,EAAE,IAAI,CAAC,iBAAiB,IAAI,CAAC;iDACjD;;gDAEE,IAAI,CAAC,WAAW,CACb,CACJ,CACF,CACP,CAAC,CACE;oCACN,4DAAK,KAAK,EAAC,qDAAqD,GAQ1D,CACF,CACF,CACF,CACF,CACF,CACP,CACG,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, Prop, State, Watch, h, Element } from '@stencil/core';\r\n\r\n@Component({\r\n tag: 'eiam-user-preference',\r\n styleUrl: 'eiam-user-preference.css',\r\n shadow: true,\r\n})\r\nexport class EiamUserPreference {\r\n @Element() host: HTMLElement;\r\n apiUrl = window['config']?.apiUrl || 'http://localhost:5000';\r\n @State() currentRouteSlug: string;\r\n @State() payload = {\r\n pagination: {\r\n pageIndex: 0,\r\n pageSize: 1000,\r\n },\r\n search: {\r\n pageName: '',\r\n },\r\n };\r\n @State() userPreferences = {\r\n dateFormate: 'dd/MM/yyyy',\r\n timeFormate: '',\r\n fontSize: null,\r\n displayFormat: 4,\r\n defaultLandingPageId: '',\r\n pageName: '',\r\n };\r\n\r\n @State() dateFormates: string[] = ['dd/MM/yyyy', 'MM/dd/yyyy', 'yyyy-MM-dd'];\r\n @State() timeFormats: string[] = ['h:mm a'];\r\n @State() fontSizes = [\r\n { label: 'Small', value: '14' },\r\n { label: 'Medium', value: '16' },\r\n { label: 'Large', value: '18' },\r\n ];\r\n @State() displayFormats: any[] = [];\r\n @State() userApplications: any[] = [];\r\n @State() pages: any[] = [];\r\n @State() totalPages: number = 0;\r\n @State() isModalOpen = false;\r\n @State() isPageModalOpen: boolean = false; // Controls the visibility of the secondary modal\r\n @State() selectedPage: { id: number; name: string } = { id: null, name: '' }; // To store selected page\r\n\r\n @State() pageParams = {\r\n pageName: '',\r\n status: 0,\r\n pageCategory: 0,\r\n cultureId: 0,\r\n cultureCode: '',\r\n pageNumber: 0,\r\n pageSize: 10,\r\n applicationId: 0,\r\n searchText: '',\r\n };\r\n @State() pageId: any;\r\n @Prop() cultureCode: string;\r\n @Prop() applicationId: string;\r\n\r\n @Watch('cultureCode')\r\n @Watch('applicationId')\r\n async componentWillLoad() {\r\n await this.getDisplayFormats();\r\n await this.getUserPreferences();\r\n await this.getUserApplications();\r\n }\r\n componentDidLoad() {\r\n if (this.host.shadowRoot) {\r\n const existingLink = this.host.shadowRoot.querySelector('link[rel=\"stylesheet\"]');\r\n if (!existingLink) {\r\n const link = document.createElement('link');\r\n link.rel = 'stylesheet';\r\n link.href = 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css';\r\n this.host.shadowRoot.appendChild(link);\r\n // console.log('FontAwesome added to shadow DOM');\r\n } else {\r\n console.log('FontAwesome already added to shadow DOM');\r\n }\r\n } else {\r\n console.warn('shadowRoot is null');\r\n }\r\n }\r\n async getDisplayFormats() {\r\n try {\r\n const headers = {\r\n 'Content-Type': 'application/json',\r\n 'IntegrationPermission': '0f5d983d203189bbffc5f686d01f6680bc6a83718a515fe42639347efc92478e',\r\n 'CultureCode': this.cultureCode,\r\n 'Source': '2',\r\n 'applicationId': this.applicationId,\r\n };\r\n\r\n const response = await fetch(`${this.apiUrl}/api/UserPreferences/DisplayFormats`, {\r\n method: 'GET', // Specify GET method\r\n headers: headers,\r\n credentials: 'include', // Include credentials (cookies) in the request\r\n });\r\n\r\n const data = await response.json();\r\n\r\n if (Array.isArray(data.content)) {\r\n this.displayFormats = data.content;\r\n } else {\r\n console.error('Invalid response structure:', data);\r\n }\r\n } catch (error) {\r\n console.error('Error fetching display formats:', error);\r\n }\r\n }\r\n\r\n async getUserPreferences() {\r\n try {\r\n const headers = {\r\n 'Content-Type': 'application/json',\r\n 'IntegrationPermission': '0f5d983d203189bbffc5f686d01f6680bc6a83718a515fe42639347efc92478e',\r\n 'CultureCode': this.cultureCode,\r\n 'Source': '2',\r\n 'applicationId': this.applicationId,\r\n };\r\n\r\n const response = await fetch(`${this.apiUrl}/api/UserPreferences/GetUserPreferences`, {\r\n method: 'GET',\r\n headers: headers,\r\n credentials: 'include',\r\n });\r\n\r\n const data = await response.json();\r\n\r\n if (data && typeof data !== 'string') {\r\n const fontSizeValue = parseFloat(data.fontSize);\r\n this.userPreferences = {\r\n ...this.userPreferences,\r\n dateFormate: data.dateFormate || 'dd/MM/yyyy',\r\n timeFormate: data.timeFormate || this.timeFormats[0], // fallback!\r\n fontSize: !isNaN(fontSizeValue) ? fontSizeValue : this.fontSizes[0]?.value,\r\n displayFormat: data.displayFormat || 1,\r\n defaultLandingPageId: data.defaultLandingPageId,\r\n pageName: data?.defaultLandingPageDetails?.name || '',\r\n };\r\n }\r\n } catch (error) {\r\n console.error('Error fetching user preferences:', error);\r\n }\r\n }\r\n\r\n async getUserApplications() {\r\n try {\r\n const headers = {\r\n 'Content-Type': 'application/json',\r\n 'IntegrationPermission': '0f5d983d203189bbffc5f686d01f6680bc6a83718a515fe42639347efc92478e',\r\n 'CultureCode': this.cultureCode,\r\n 'Source': '2',\r\n 'applicationId': this.applicationId,\r\n };\r\n\r\n const response = await fetch(`${this.apiUrl}/api/OrganizationApplicationsApi/GetAssigndApplicationForUser`, {\r\n method: 'GET',\r\n headers: headers,\r\n credentials: 'include',\r\n });\r\n\r\n const data = await response.json();\r\n\r\n if (data && Array.isArray(data.content)) {\r\n this.userApplications = data.content;\r\n } else {\r\n console.error('Invalid response structure:', data);\r\n }\r\n } catch (error) {\r\n console.error('Error fetching applications:', error);\r\n }\r\n }\r\n changeApplication(application) {\r\n if (application.applicationId) {\r\n this.pageParams.applicationId = application.applicationId;\r\n this.getPagesSApplications();\r\n }\r\n }\r\n\r\n async getPagesSApplications() {\r\n const requestBody = {}; // Create the request body (you can modify based on your needs)\r\n\r\n try {\r\n const response = await fetch(`${this.apiUrl}/api/Pages/GetPages`, {\r\n method: 'POST',\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'IntegrationPermission': '0f5d983d203189bbffc5f686d01f6680bc6a83718a515fe42639347efc92478e',\r\n 'CultureCode': this.cultureCode,\r\n 'Source': '2',\r\n 'applicationId': this.applicationId,\r\n },\r\n credentials: 'include',\r\n body: JSON.stringify(requestBody),\r\n });\r\n\r\n if (!response.ok) {\r\n console.error('Failed to fetch pages');\r\n return;\r\n }\r\n\r\n const data = await response.json();\r\n console.log(data, 'data of all pages ');\r\n } catch (error) {\r\n console.error('Error fetching pages:', error);\r\n }\r\n }\r\n\r\n // async submitPreferences() {\r\n // const fontSize = this.userPreferences.fontSize ? this.userPreferences.fontSize + 'px' : null;\r\n\r\n // const headers = {\r\n // 'Content-Type': 'application/json',\r\n // 'IntegrationPermission': '0f5d983d203189bbffc5f686d01f6680bc6a83718a515fe42639347efc92478e',\r\n // 'CultureCode': this.cultureCode,\r\n // 'Source': '2',\r\n // 'applicationId': this.applicationId,\r\n // };\r\n\r\n // try {\r\n // const response = await fetch(`${this.apiUrl}/api/UserPreferences/SaveUserPreferences`, {\r\n // method: 'POST',\r\n // headers: headers,\r\n // body: JSON.stringify({ ...this.userPreferences, fontSize }),\r\n // credentials: 'include',\r\n // });\r\n\r\n // if (!response.ok) {\r\n // console.error('Failed to save preferences:', response.statusText);\r\n // return;\r\n // }\r\n\r\n // await this.getUserPreferences();\r\n // } catch (error) {\r\n // console.error('Error submitting preferences:', error);\r\n // }\r\n // }\r\n async submitPreferences() {\r\n const fontSizeValue = parseFloat(this.userPreferences.fontSize);\r\n const fontSize = !isNaN(fontSizeValue) ? `${fontSizeValue}px` : null;\r\n\r\n const headers = {\r\n 'Content-Type': 'application/json',\r\n 'IntegrationPermission': '0f5d983d203189bbffc5f686d01f6680bc6a83718a515fe42639347efc92478e',\r\n 'CultureCode': this.cultureCode,\r\n 'Source': '2',\r\n 'applicationId': this.applicationId,\r\n };\r\n\r\n try {\r\n const response = await fetch(`${this.apiUrl}/api/UserPreferences/SaveUserPreferences`, {\r\n method: 'POST',\r\n headers,\r\n body: JSON.stringify({ ...this.userPreferences, fontSize }),\r\n credentials: 'include',\r\n });\r\n\r\n if (!response.ok) {\r\n console.error('Failed to save preferences:', response.statusText);\r\n return;\r\n }\r\n\r\n // Fetch updated preferences\r\n const newPrefs: any = await this.getUserPreferences();\r\n if (!newPrefs || typeof newPrefs === 'string') return;\r\n\r\n // Apply updated preferences like Angular code\r\n const { displayFormat, fontSize: newFontSize, dateFormate, timeFormate } = newPrefs;\r\n\r\n if (displayFormat) {\r\n localStorage.setItem('displayFormat', displayFormat);\r\n // this.emit('displayFormatUpdated', displayFormat);\r\n }\r\n\r\n if (newFontSize) {\r\n document.body.setAttribute('style', `font-size: ${newFontSize} !important`);\r\n }\r\n\r\n localStorage.setItem('dateFormat', dateFormate || 'dd/MM/yyyy');\r\n localStorage.setItem('timeFormat', timeFormate || '');\r\n\r\n // this.emit('dateFormatUpdated', dateFormate || 'dd/MM/yyyy');\r\n // this.emit('timeFormatUpdated', timeFormate || '');\r\n } catch (error) {\r\n console.error('Error submitting preferences:', error);\r\n }\r\n }\r\n\r\n async resetPreferences() {\r\n try {\r\n await fetch(`${this.apiUrl}/api/UserPreferences/Delete`, {\r\n method: 'DELETE',\r\n credentials: 'include',\r\n });\r\n\r\n this.userPreferences = {\r\n dateFormate: 'dd/MM/yyyy',\r\n timeFormate: '',\r\n fontSize: '',\r\n displayFormat: 4,\r\n defaultLandingPageId: '',\r\n pageName: '',\r\n };\r\n\r\n localStorage.removeItem('dateFormat');\r\n localStorage.removeItem('displayFormat');\r\n localStorage.removeItem('fontSize');\r\n\r\n location.reload(); // If you want to refresh the UI\r\n } catch (error) {\r\n console.error('Failed to reset preferences', error);\r\n }\r\n }\r\n toggleModal() {\r\n this.isModalOpen = !this.isModalOpen;\r\n }\r\n togglePageModal() {\r\n this.isPageModalOpen = !this.isPageModalOpen;\r\n }\r\n selectPage(page: { id: any; name: string }) {\r\n this.selectedPage = page;\r\n this.userPreferences.defaultLandingPageId = page.id; // Update default landing page\r\n this.togglePageModal(); // Close the page selection modal\r\n }\r\n\r\n // render() {\r\n // return (\r\n // <Host>\r\n // <div>\r\n // <i class=\"fas fa-cogs\" onClick={() => this.toggleModal()} style={{ cursor: 'pointer', fontSize: '24px' }}></i>\r\n\r\n // {/* Modal */}\r\n // {this.isModalOpen && (\r\n // <div class=\"modal\">\r\n // <div class=\"modal-content\">\r\n // <span class=\"close\" onClick={() => this.toggleModal()}>\r\n // &times;\r\n // </span>\r\n // <h2>User Preferences</h2>\r\n // <div>\r\n // <label>Date Format</label>\r\n // <select onInput={e => (this.userPreferences.dateFormate = (e.target as HTMLSelectElement).value)}>\r\n // {this.dateFormates.map(format => (\r\n // <option value={format} selected={this.userPreferences.dateFormate === format}>\r\n // {format}\r\n // </option>\r\n // ))}\r\n // </select>\r\n\r\n // <label>Time Format</label>\r\n // <select onInput={e => (this.userPreferences.timeFormate = (e.target as HTMLSelectElement).value)}>\r\n // {this.timeFormats.map(format => (\r\n // <option value={format} selected={this.userPreferences.timeFormate === format}>\r\n // {format}\r\n // </option>\r\n // ))}\r\n // </select>\r\n\r\n // <label>Font Size</label>\r\n // <select onInput={e => (this.userPreferences.fontSize = (e.target as HTMLSelectElement).value)}>\r\n // {this.fontSizes.map(size => (\r\n // <option value={size.value} selected={this.userPreferences.fontSize === size.value}>\r\n // {size.label}\r\n // </option>\r\n // ))}\r\n // </select>\r\n\r\n // <label>User Display Format</label>\r\n // <select onInput={e => (this.userPreferences.displayFormat = parseInt((e.target as HTMLSelectElement).value))}>\r\n // {this.displayFormats.map(format => (\r\n // <option value={format.value} selected={this.userPreferences.displayFormat === format.value}>\r\n // {format.label}\r\n // </option>\r\n // ))}\r\n // </select>\r\n\r\n // <label>Default Landing Page</label>\r\n // <select onInput={e => (this.userPreferences.defaultLandingPageId = (e.target as HTMLSelectElement).value)}>\r\n // {this.pages.map(page => (\r\n // <option value={page.id} selected={this.userPreferences.defaultLandingPageId === page.id}>\r\n // {page.name}\r\n // </option>\r\n // ))}\r\n // </select>\r\n\r\n // <button onClick={() => this.submitPreferences()}>Save</button>\r\n // <button onClick={() => this.resetPreferences()}>Reset</button>\r\n // </div>\r\n // </div>\r\n // </div>\r\n // )}\r\n // </div>\r\n // </Host>\r\n // );\r\n // }\r\n render() {\r\n return (\r\n <Host>\r\n <div>\r\n {/* User Preferences Modal Trigger */}\r\n <i class=\"fas fa-cogs\" onClick={() => this.toggleModal()} style={{ cursor: 'pointer', fontSize: '24px' }}></i>\r\n\r\n {/* Main Modal */}\r\n {this.isModalOpen && (\r\n <div class=\"kt-quick-panel kt-quick-panel--on\">\r\n <a onClick={() => this.toggleModal()} id=\"kt_quick_panel_close_btn\" class=\"kt-quick-panel__close\">\r\n <i class=\"fas fa-times\"></i>\r\n </a>\r\n <div class=\"kt-quick-panel__nav\">\r\n <ul role=\"tablist\" class=\"nav nav-tabs nav-tabs-line nav-tabs-bold nav-tabs-line-3x nav-tabs-line-brand kt-notification-item-padding-x\">\r\n <li class=\"nav-item active\">\r\n <a data-toggle=\"tab\" role=\"tab\" class=\"nav-link active\">\r\n User Preference\r\n </a>\r\n </li>\r\n </ul>\r\n </div>\r\n\r\n <div class=\"kt-quick-panel__content\">\r\n <div class=\"tab-content\">\r\n <div id=\"kt_quick_panel_tab_notifications\" role=\"tabpanel\" class=\"tab-pane fade show kt-scroll active ps ps--active-y\">\r\n <div class=\"kt-notification\">\r\n <div class=\"kt-portlet__body\">\r\n <div class=\"form-group\">\r\n <label>Date Format</label>\r\n <select onInput={e => (this.userPreferences.dateFormate = (e.target as HTMLSelectElement).value)}>\r\n {this.dateFormates.map(format => (\r\n <option value={format} selected={this.userPreferences.dateFormate === format}>\r\n {format}\r\n </option>\r\n ))}\r\n </select>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>Time Format</label>\r\n <select onInput={e => (this.userPreferences.timeFormate = (e.target as HTMLSelectElement).value)}>\r\n {this.timeFormats.map(format => (\r\n <option value={format} selected={this.userPreferences.timeFormate === format}>\r\n {format}\r\n </option>\r\n ))}\r\n </select>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>Font Size</label>\r\n <select onInput={e => (this.userPreferences.fontSize = (e.target as HTMLSelectElement).value)}>\r\n {this.fontSizes.map(size => (\r\n <option value={size.value} selected={this.userPreferences.fontSize === size.value}>\r\n {size.label}\r\n </option>\r\n ))}\r\n </select>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>User Display Format</label>\r\n <select onInput={e => (this.userPreferences.displayFormat = parseInt((e.target as HTMLSelectElement).value))}>\r\n {this.displayFormats.map(format => (\r\n <option value={format.value} selected={this.userPreferences.displayFormat === format.value}>\r\n {format.label}\r\n </option>\r\n ))}\r\n </select>\r\n </div>\r\n\r\n <div class=\"form-group\">\r\n <label>Default Landing Page</label>\r\n <div class=\"input-group\" onClick={() => this.togglePageModal()}>\r\n <div class=\"input-group-prepend\">\r\n <span class=\"input-group-text\">\r\n <i class=\"fas fa-link\"></i>\r\n </span>\r\n </div>\r\n <input type=\"text\" class=\"form-control\" readonly value={this.selectedPage.name || 'Select page'} placeholder=\"Select page\" />\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"kt-portlet__foot\">\r\n <div class=\"kt-form__actions\">\r\n <button class=\"btn btn-primary\" onClick={() => this.submitPreferences()}>\r\n Save\r\n </button>\r\n <button class=\"btn btn-secondary\" onClick={() => this.resetPreferences()}>\r\n Reset\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n )}\r\n\r\n {/* Page Selection Modal */}\r\n\r\n {this.isPageModalOpen && (\r\n <div class=\"modal-dialog modal-md landing-modal\">\r\n <div class=\"modal-content landing-page\">\r\n <div class=\"modal-header\">\r\n <h4 class=\"modal-title pull-left\"> Default Landing Page </h4>\r\n <button onClick={() => this.togglePageModal()} type=\"button\" aria-label=\"Close\" class=\"close pull-right\">\r\n <span>\r\n <i class=\"fas fa-times\"></i>\r\n </span>\r\n </button>\r\n </div>\r\n\r\n <div class=\"modal-body\">\r\n <div class=\"row\">\r\n <div class=\"col-12\">\r\n <div class=\"row\">\r\n <div class=\"form-group\">\r\n <label htmlFor=\"\"> Default Landing Page </label>\r\n <select onInput={e => this.changeApplication(e)}>\r\n {this.userApplications.map(application => (\r\n <option value={application.applicationId}>{application.applicationName}</option>\r\n ))}\r\n </select>\r\n </div>\r\n </div>\r\n\r\n <label>Select Page</label>\r\n <div style={{ maxHeight: '300px', overflowY: 'auto', overflowX: 'hidden' }}>\r\n {this.pages.map(page => (\r\n <div class=\"slug-item\" onClick={() => this.selectPage(page)}>\r\n <div class=\"row\">\r\n <span class=\"text-brand\" style={{ fontWeight: '600', lineHeight: '1' }}>\r\n {page.name}\r\n </span>\r\n <small\r\n class={{\r\n 'culture-unpublished': page.pageCultureStatus == 1,\r\n 'culture-published': page.pageCultureStatus == 2,\r\n }}\r\n >\r\n | {page.cultureCode}\r\n </small>\r\n </div>\r\n </div>\r\n ))}\r\n </div>\r\n <div class=\"d-flex justify-content-center mt-2 pagination-class\">\r\n {/* <pagination\r\n totalItems={this.totalPages}\r\n maxSize={10}\r\n itemsPerPage={this.pageParams.pageSize}\r\n boundaryLinks={true}\r\n onPageChanged={event => this.changePage(event)}\r\n /> */}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n )}\r\n </div>\r\n </Host>\r\n );\r\n }\r\n}\r\n"]}
@@ -0,0 +1,3 @@
1
+ :host {
2
+ display: block;
3
+ }