@everymatrix/cashier-session-expiration-modal 1.43.0 → 1.43.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/cashier-session-expiration-modal",
3
- "version": "1.43.0",
3
+ "version": "1.43.1",
4
4
  "main": "index.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "2b46cd3311230285da87ca4b133f9dd5735a0db7"
38
+ "gitHead": "e0be02e594f762ecb10851537d8690d5e66f4e5d"
39
39
  }
@@ -7,6 +7,9 @@
7
7
  import { onMount, onDestroy } from 'svelte';
8
8
  import DOMPurify from 'dompurify';
9
9
  import sessionImage from './assets/set-timeout-icon.png';
10
+ import dayjs from 'dayjs';
11
+ import utc from 'dayjs/plugin/utc';
12
+ dayjs.extend(utc);
10
13
 
11
14
  export let clientstyling: string = '';
12
15
  export let clientstylingurl: string = '';
@@ -37,7 +40,7 @@
37
40
  startCountdown();
38
41
  }
39
42
  }
40
-
43
+
41
44
  const parseJwt = (token: string) => {
42
45
  try {
43
46
  return JSON.parse(atob(token.split('.')[1]));
@@ -49,17 +52,17 @@
49
52
  const startCountdown = () => {
50
53
  show = false;
51
54
  const tokenPayload = parseJwt(xPaymentSessionToken);
52
- if (!tokenPayload) return;
55
+ if (!tokenPayload) return;
53
56
  sessionEndTime = tokenPayload?.exp;
54
57
  timeLeft = sessionEndTime;
55
-
58
+
56
59
  if (interval) clearInterval(interval);
57
60
  interval = setInterval(() => {
58
61
  const currentTime = Math.floor(new Date().getTime() / 1000);
59
62
  timeLeft = sessionEndTime - currentTime;
60
63
  if (timeLeft <= lastNinetySeconds) {
61
64
  show = true;
62
- }
65
+ }
63
66
  if (currentTime >= sessionEndTime) {
64
67
  timeLeft = 0;
65
68
  show = false;
@@ -74,6 +77,7 @@
74
77
  const headers = new Headers();
75
78
  headers.append("accept", "application/json");
76
79
  headers.append("Content-Type", "application/json");
80
+ headers.append("X-Client-Request-Timestamp", dayjs.utc().format("YYYY-MM-DD HH:mm:ss.SSS"));
77
81
  const requestParams:RequestInit = {
78
82
  method: "POST",
79
83
  mode: "cors",
@@ -96,7 +100,7 @@
96
100
  renewSession();
97
101
  }
98
102
  }
99
-
103
+
100
104
  const setTranslationUrl = ():void => {
101
105
  let url:string = translationurl;
102
106
 
@@ -145,7 +149,7 @@
145
149
  onDestroy(() => {
146
150
  clearInterval(interval);
147
151
  });
148
-
152
+
149
153
  $: lang && setActiveLanguage();
150
154
  $: clientstyling && customStylingContainer && setClientStyling();
151
155
  $: clientstylingurl && customStylingContainer && setClientStylingURL();
@@ -159,7 +163,7 @@
159
163
  class="CashierSessionExpirationModalWindow"
160
164
  part="CashierSessionExpirationModalWindow"
161
165
  id="CashierSessionExpirationModal"
162
- transition:fade="{{duration }}"
166
+ transition:fade="{{duration }}"
163
167
  on:click={outOfModalClick}
164
168
  bind:clientWidth={width}
165
169
  bind:clientHeight={height}>
@@ -187,7 +191,7 @@
187
191
  <span>{$_('sessionExpirationGeneralButton')}</span>
188
192
  </slot>
189
193
  </div>
190
- </div>
194
+ </div>
191
195
  </div>
192
196
  </div>
193
197
  </div>
@@ -205,7 +209,7 @@
205
209
 
206
210
  .CashierSessionExpirationModalWindow {
207
211
  display: flex;
208
- position: fixed;
212
+ position: absolute;
209
213
  align-items: center;
210
214
  justify-content: center;
211
215
  width: 100%;
@@ -243,7 +247,7 @@
243
247
  overflow: hidden;
244
248
  text-overflow: ellipsis;
245
249
  line-height: calc(var(--emw--font-size-small, 14px) + 2px);
246
- }
250
+ }
247
251
  .CashierSessionExpirationModalContainer {
248
252
  padding: var(--emw--spacing-large, 20px);
249
253
  }