@adyen/adyen-platform-experience-web 1.0.2 → 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 (54) hide show
  1. package/dist/cjs/index.js +2 -2
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/es/components/internal/Calendar/calendar/facade/Calendar.js +221 -211
  4. package/dist/es/components/internal/Calendar/calendar/timeframe/frames/MonthFrame.js +103 -94
  5. package/dist/es/components/internal/Calendar/calendar/timeframe/frames/TimeFrame.js +201 -200
  6. package/dist/es/components/internal/Calendar/calendar/timerange/presets/lastNDays.js +19 -18
  7. package/dist/es/components/internal/Calendar/calendar/timerange/presets/shared/offsetMonth.js +18 -17
  8. package/dist/es/components/internal/Calendar/calendar/timerange/presets/shared/offsetWeek.js +17 -20
  9. package/dist/es/components/internal/Calendar/calendar/timerange/presets/yearToDate.js +9 -12
  10. package/dist/es/components/internal/Calendar/calendar/timerange/utils.js +39 -43
  11. package/dist/es/components/internal/Calendar/calendar/timeslice/TimeSlice.js +10 -10
  12. package/dist/es/components/internal/Calendar/calendar/timeslice/index.js +25 -26
  13. package/dist/es/components/internal/Calendar/calendar/utils.js +64 -16
  14. package/dist/es/components/internal/Calendar/hooks/useCalendar.js +40 -38
  15. package/dist/es/components/internal/Calendar/hooks/useTimezone.js +2 -2
  16. package/dist/es/components/internal/DatePicker/DatePicker.js +17 -16
  17. package/dist/es/components/internal/FilterBar/filters/AmountFilter/AmountFilter.js +14 -14
  18. package/dist/es/components/internal/FilterBar/filters/AmountFilter/RangeSelection.js +19 -17
  19. package/dist/es/components/internal/FilterBar/filters/DateFilter/DateFilterCore.js +81 -76
  20. package/dist/es/core/Http/utils.js +1 -1
  21. package/dist/es/core/Localization/datetime/restamper/utils.js +26 -26
  22. package/dist/es/core/core.js +1 -1
  23. package/dist/es/primitives/time/today/main.js +38 -43
  24. package/dist/style.css +1 -1
  25. package/dist/types/components/internal/Calendar/calendar/facade/Calendar.d.ts.map +1 -1
  26. package/dist/types/components/internal/Calendar/calendar/timeframe/frames/MonthFrame.d.ts +1 -1
  27. package/dist/types/components/internal/Calendar/calendar/timeframe/frames/MonthFrame.d.ts.map +1 -1
  28. package/dist/types/components/internal/Calendar/calendar/timeframe/frames/TimeFrame.d.ts +3 -3
  29. package/dist/types/components/internal/Calendar/calendar/timeframe/frames/TimeFrame.d.ts.map +1 -1
  30. package/dist/types/components/internal/Calendar/calendar/timeframe/frames/YearFrame.d.ts +1 -1
  31. package/dist/types/components/internal/Calendar/calendar/timeframe/frames/YearFrame.d.ts.map +1 -1
  32. package/dist/types/components/internal/Calendar/calendar/timerange/presets/lastNDays.d.ts.map +1 -1
  33. package/dist/types/components/internal/Calendar/calendar/timerange/presets/shared/offsetMonth.d.ts.map +1 -1
  34. package/dist/types/components/internal/Calendar/calendar/timerange/presets/shared/offsetWeek.d.ts.map +1 -1
  35. package/dist/types/components/internal/Calendar/calendar/timerange/presets/yearToDate.d.ts.map +1 -1
  36. package/dist/types/components/internal/Calendar/calendar/timerange/utils.d.ts +0 -5
  37. package/dist/types/components/internal/Calendar/calendar/timerange/utils.d.ts.map +1 -1
  38. package/dist/types/components/internal/Calendar/calendar/timeslice/TimeSlice.d.ts +2 -2
  39. package/dist/types/components/internal/Calendar/calendar/timeslice/TimeSlice.d.ts.map +1 -1
  40. package/dist/types/components/internal/Calendar/calendar/timeslice/index.d.ts.map +1 -1
  41. package/dist/types/components/internal/Calendar/calendar/types.d.ts +6 -1
  42. package/dist/types/components/internal/Calendar/calendar/types.d.ts.map +1 -1
  43. package/dist/types/components/internal/Calendar/calendar/utils.d.ts +13 -4
  44. package/dist/types/components/internal/Calendar/calendar/utils.d.ts.map +1 -1
  45. package/dist/types/components/internal/Calendar/hooks/useCalendar.d.ts +1 -1
  46. package/dist/types/components/internal/Calendar/hooks/useCalendar.d.ts.map +1 -1
  47. package/dist/types/components/internal/Calendar/types.d.ts +1 -0
  48. package/dist/types/components/internal/Calendar/types.d.ts.map +1 -1
  49. package/dist/types/components/internal/DatePicker/DatePicker.d.ts.map +1 -1
  50. package/dist/types/components/internal/FilterBar/filters/AmountFilter/RangeSelection.d.ts.map +1 -1
  51. package/dist/types/components/internal/FilterBar/filters/DateFilter/DateFilterCore.d.ts.map +1 -1
  52. package/dist/types/core/Localization/datetime/restamper/utils.d.ts.map +1 -1
  53. package/dist/types/primitives/time/today/main.d.ts.map +1 -1
  54. package/package.json +2 -1
@@ -1,59 +1,60 @@
1
- var Z = Object.defineProperty;
2
- var $ = (r, s, t) => s in r ? Z(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
3
- var P = (r, s, t) => ($(r, typeof s != "symbol" ? s + "" : s, t), t), U = (r, s, t) => {
1
+ var rt = Object.defineProperty;
2
+ var ot = (r, s, t) => s in r ? rt(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
3
+ var Z = (r, s, t) => (ot(r, typeof s != "symbol" ? s + "" : s, t), t), $ = (r, s, t) => {
4
4
  if (!s.has(r))
5
5
  throw TypeError("Cannot " + t);
6
6
  };
7
- var i = (r, s, t) => (U(r, s, "read from private field"), t ? t.call(r) : s.get(r)), n = (r, s, t) => {
7
+ var i = (r, s, t) => ($(r, s, "read from private field"), t ? t.call(r) : s.get(r)), n = (r, s, t) => {
8
8
  if (s.has(r))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
10
  s instanceof WeakSet ? s.add(r) : s.set(r, t);
11
- }, m = (r, s, t, e) => (U(r, s, "write to private field"), e ? e.call(r, t) : s.set(r, t), t);
12
- var h = (r, s, t) => (U(r, s, "access private method"), t);
13
- import tt from "./TimeFrame.js";
14
- import { getWeekendDays as z } from "../common/utils.js";
15
- import { getEdgesDistance as X, computeTimestampOffset as et, getMonthDays as j } from "../../utils.js";
16
- import { DAY_OF_WEEK_FORMATS as it, MAXIMUM_MONTH_UNITS as q, DAY_MS as st } from "../../constants.js";
17
- import rt from "../common/flags.js";
18
- import { TimeFlag as o } from "../../types.js";
19
- import { isUndefined as nt, isString as ot } from "../../../../../../utils/value/is.js";
20
- import { isInfinity as at, isBitSafeInteger as mt } from "../../../../../../utils/value/number.js";
21
- import { enumerable as b } from "../../../../../../utils/struct/property.js";
22
- import { struct as F, withFreezeProxyHandlers as ht, structFrom as ft } from "../../../../../../utils/struct/main.js";
23
- var u, T, d, N, y, I, B, A, W, _, k, S, E, M, K, l, D, O, C;
24
- class St extends tt {
11
+ }, u = (r, s, t, e) => ($(r, s, "write to private field"), e ? e.call(r, t) : s.set(r, t), t);
12
+ var c = (r, s, t) => ($(r, s, "access private method"), t);
13
+ import nt from "./TimeFrame.js";
14
+ import { getWeekendDays as X } from "../common/utils.js";
15
+ import { getEdgesDistance as j, withTimezone as q, getTimezoneDateParts as k, computeTimestampOffset as mt, getMonthDays as b, startOfMonth as at, startOfWeek as ht } from "../../utils.js";
16
+ import { DAY_OF_WEEK_FORMATS as ft, MAXIMUM_MONTH_UNITS as J, DAY_MS as Q } from "../../constants.js";
17
+ import ct from "../common/flags.js";
18
+ import { TimeFlag as m } from "../../types.js";
19
+ import { timezoneToSystem as V, systemToTimezone as tt } from "../../../../../../core/Localization/datetime/restamper/utils.js";
20
+ import { isUndefined as lt, isString as gt } from "../../../../../../utils/value/is.js";
21
+ import { isInfinity as ut, isBitSafeInteger as pt } from "../../../../../../utils/value/number.js";
22
+ import { enumerable as K } from "../../../../../../utils/struct/property.js";
23
+ import { struct as _, withFreezeProxyHandlers as Tt, structFrom as dt } from "../../../../../../utils/struct/main.js";
24
+ var y, D, S, M, E, O, R, F, H, N, B, W, L, Y, w, P, T, I, z, v;
25
+ class At extends nt {
25
26
  constructor() {
26
27
  super();
27
- n(this, M);
28
- n(this, l);
29
- n(this, O);
30
- n(this, u, 7);
31
- n(this, T, []);
32
- n(this, d, z(this.firstWeekDay));
28
+ n(this, L);
29
+ n(this, w);
30
+ n(this, T);
31
+ n(this, z);
32
+ n(this, y, 7);
33
+ n(this, D, []);
34
+ n(this, S, X(this.firstWeekDay));
35
+ n(this, M, void 0);
36
+ n(this, E, -1 / 0);
37
+ n(this, O, 1 / 0);
38
+ n(this, R, 1 / 0);
39
+ n(this, F, void 0);
40
+ n(this, H, void 0);
33
41
  n(this, N, void 0);
34
- n(this, y, -1 / 0);
35
- n(this, I, 1 / 0);
36
- n(this, B, 1 / 0);
37
- n(this, A, void 0);
42
+ n(this, B, void 0);
38
43
  n(this, W, void 0);
39
- n(this, _, void 0);
40
- n(this, k, void 0);
41
- n(this, S, void 0);
42
- n(this, E, void 0);
43
- P(this, "daysInWeek", i(this, u));
44
+ Z(this, "daysInWeek", i(this, y));
44
45
  this.initialize();
45
46
  }
46
47
  get fromTimestamp() {
47
- return i(this, y);
48
+ return i(this, E);
48
49
  }
49
50
  get toTimestamp() {
50
- return i(this, I);
51
+ return i(this, O);
51
52
  }
52
53
  get numberOfBlocks() {
53
- return i(this, B);
54
+ return i(this, R);
54
55
  }
55
56
  get currentDayTimestamp() {
56
- return i(this, N);
57
+ return i(this, M);
57
58
  }
58
59
  get dynamicBlockHeight() {
59
60
  return super.dynamicBlockHeight;
@@ -63,71 +64,73 @@ class St extends tt {
63
64
  super.dynamicBlockHeight = t, this.dynamicBlockHeight !== e && this.refreshFrame(!0);
64
65
  }
65
66
  get rowspan() {
66
- return i(this, u);
67
+ return i(this, y);
67
68
  }
68
69
  get firstWeekDay() {
69
70
  return super.firstWeekDay;
70
71
  }
71
72
  set firstWeekDay(t) {
72
73
  const e = this.firstWeekDay;
73
- super.firstWeekDay = t, this.firstWeekDay !== e && (i(this, T).length = 0, m(this, d, z(this.firstWeekDay)), this.reoriginate(), this.refreshFrame());
74
+ super.firstWeekDay = t, this.firstWeekDay !== e && (i(this, D).length = 0, u(this, S, X(this.firstWeekDay)), this.reoriginate(), this.refreshFrame());
74
75
  }
75
76
  getCursorBlockOriginTimestampOffset(t) {
76
- return new Date(t).getDate() - 1;
77
+ return k(t, this.timezone)[2] - 1;
77
78
  }
78
79
  getDayOfWeekAtIndex(t) {
79
- if (!i(this, T)[t]) {
80
+ if (!i(this, D)[t]) {
80
81
  const e = new Date(this.getTimestampAtIndex(t));
81
- let p = 0;
82
- i(this, d).includes(t) && (p |= o.WEEKEND), t === 0 ? p |= o.LINE_START : t === 6 && (p |= o.LINE_END);
83
- const R = {};
84
- for (const c of it)
85
- R[c] = b(e.toLocaleDateString(this.locale, {
86
- weekday: c
82
+ let o = 0;
83
+ i(this, S).includes(t) && (o |= m.WEEKEND), t === 0 ? o |= m.LINE_START : t === 6 && (o |= m.LINE_END);
84
+ const l = {};
85
+ for (const f of ft)
86
+ l[f] = K(e.toLocaleDateString(this.locale, {
87
+ weekday: f,
88
+ timeZone: this.timezone
87
89
  }));
88
- i(this, T)[t] = F({
89
- flags: b(rt(p)),
90
- labels: b(F(R))
90
+ i(this, D)[t] = _({
91
+ flags: K(ct(o)),
92
+ labels: K(_(l))
91
93
  });
92
94
  }
93
- return i(this, T)[t];
95
+ return i(this, D)[t];
94
96
  }
95
97
  getEdgeBlockOffsetsFromOrigin() {
96
- return [h(this, M, K).call(this, i(this, y)), h(this, M, K).call(this, i(this, I))];
98
+ return [c(this, L, Y).call(this, i(this, E)), c(this, L, Y).call(this, i(this, O))];
97
99
  }
98
100
  getFormattedDataForBlockCell(t) {
99
- const e = new Date(t).toISOString();
100
- return [Number(e.slice(8, 10)).toLocaleString(this.locale), e.slice(0, 10)];
101
+ const [e, o, l] = k(t, this.timezone);
102
+ return [Number(l).toLocaleString(this.locale), `${e}-${`${o + 1}`.padStart(2, "0")}-${`${l}`.padStart(2, "0")}`];
101
103
  }
102
104
  getFormattedDataForFrameBlock(t) {
103
- const e = new Date(t);
104
- return [e.toLocaleDateString(this.locale, {
105
+ const [e, o] = k(t, this.timezone);
106
+ return [new Date(t).toLocaleDateString(this.locale, {
105
107
  month: "long",
106
- year: "numeric"
107
- }), e.toISOString().slice(0, 7)];
108
+ year: "numeric",
109
+ timeZone: this.timezone
110
+ }), `${e}-${`${o + 1}`.padStart(2, "0")}`];
108
111
  }
109
112
  getFrameBlockAtIndex(t) {
110
- const [e, p, R] = j(this.origin, i(this, k), t), c = t > 0 ? this.getFrameBlockAtIndex(t - 1).inner.to + 1 : i(this, W), w = c + e - 1, H = Math.floor(c / 7) * 7, Y = this.dynamicBlockHeight ? Math.ceil((w + 1) / 7) * 7 : H + q, G = this.dynamicBlockHeight ? Y - H : q, J = new Proxy(F(), ht({
111
- get: (Q, v, V) => {
112
- if (ot(v)) {
113
- const L = +v;
114
- if (mt(L) && L >= 0 && L < G) {
115
- const g = H + L, f = this.getTimestampAtIndex(g), x = g % i(this, u);
116
- let a = f === this.currentDayTimestamp ? o.CURRENT : 0;
117
- return g === this.cursor && (a |= o.CURSOR), i(this, d).includes(x) && (a |= o.WEEKEND), x === 0 ? a |= o.LINE_START : x === i(this, u) - 1 && (a |= o.LINE_END), g >= c && g <= w && (g === c ? a |= o.BLOCK_START : g === w && (a |= o.BLOCK_END), a |= o.WITHIN_BLOCK), f >= this.fromTimestamp && f <= this.toTimestamp && (f === this.fromTimestamp && (a |= o.RANGE_START), f === this.toTimestamp && (a |= o.RANGE_END), a |= o.WITHIN_RANGE), f >= i(this, S) && f <= i(this, E) && (f === i(this, S) && (a |= o.SELECTION_START), f === i(this, E) && (a |= o.SELECTION_END), a |= o.WITHIN_SELECTION), [f, a];
113
+ const [e, o, l] = b(this.origin, i(this, N), t), f = t > 0 ? this.getFrameBlockAtIndex(t - 1).inner.to + 1 : i(this, F), a = f + e - 1, g = Math.floor(f / 7) * 7, A = this.dynamicBlockHeight ? Math.ceil((a + 1) / 7) * 7 : g + J, G = this.dynamicBlockHeight ? A - g : J, et = new Proxy(_(), Tt({
114
+ get: (it, x, st) => {
115
+ if (gt(x)) {
116
+ const C = +x;
117
+ if (pt(C) && C >= 0 && C < G) {
118
+ const d = g + C, p = this.getTimestampAtIndex(d), U = d % i(this, y);
119
+ let h = p === this.currentDayTimestamp ? m.CURRENT : 0;
120
+ return d === this.cursor && (h |= m.CURSOR), i(this, S).includes(U) && (h |= m.WEEKEND), U === 0 ? h |= m.LINE_START : U === i(this, y) - 1 && (h |= m.LINE_END), d >= f && d <= a && (d === f ? h |= m.BLOCK_START : d === a && (h |= m.BLOCK_END), h |= m.WITHIN_BLOCK), p >= this.fromTimestamp && p <= this.toTimestamp && (p === this.fromTimestamp && (h |= m.RANGE_START), p === this.toTimestamp && (h |= m.RANGE_END), h |= m.WITHIN_RANGE), p >= i(this, B) && p <= i(this, W) && (p === i(this, B) && (h |= m.SELECTION_START), p === i(this, W) && (h |= m.SELECTION_END), h |= m.WITHIN_SELECTION), [p, h];
118
121
  }
119
122
  }
120
- return Reflect.get(Q, v, V);
123
+ return Reflect.get(it, x, st);
121
124
  }
122
125
  }));
123
- return ft(J, {
126
+ return dt(et, {
124
127
  inner: {
125
- value: F({
128
+ value: _({
126
129
  from: {
127
- value: c
130
+ value: f
128
131
  },
129
132
  to: {
130
- value: w
133
+ value: a
131
134
  },
132
135
  units: {
133
136
  value: e
@@ -135,15 +138,15 @@ class St extends tt {
135
138
  })
136
139
  },
137
140
  month: {
138
- value: p
141
+ value: o
139
142
  },
140
143
  outer: {
141
- value: F({
144
+ value: _({
142
145
  from: {
143
- value: H
146
+ value: g
144
147
  },
145
148
  to: {
146
- value: Y - 1
149
+ value: A - 1
147
150
  },
148
151
  units: {
149
152
  value: G
@@ -151,47 +154,53 @@ class St extends tt {
151
154
  })
152
155
  },
153
156
  year: {
154
- value: R
157
+ value: l
155
158
  }
156
159
  });
157
160
  }
158
161
  getUnitsForFrameBlockAtIndex(t) {
159
- return j(this.origin, i(this, k), t)[0];
162
+ return b(this.origin, i(this, N), t)[0];
160
163
  }
161
164
  getUnitsOffsetForTimestamp(t, e) {
162
- return Math.round((e - t) / st);
165
+ return Math.round((e - t) / Q);
163
166
  }
164
167
  reoriginate() {
165
- const t = new Date(this.originTimestamp), e = (8 - (t.getDate() - t.getDay() + this.firstWeekDay) % 7) % 7;
166
- this.origin = t.getMonth(), m(this, k, t.getFullYear()), this.originTimestamp = t.setDate(1), m(this, W, e), m(this, _, t.setDate(1 - e)), m(this, A, t.getDate());
168
+ this.originTimestamp = at(this.originTimestamp, this.timezone);
169
+ const [t, e] = k(this.originTimestamp, this.timezone), o = ht(this.originTimestamp, this.timezone, this.firstWeekDay);
170
+ this.origin = e, u(this, N, t), u(this, F, this.getUnitsOffsetForTimestamp(o, this.originTimestamp)), u(this, H, c(this, w, P).call(this, this.originTimestamp, -i(this, F)));
167
171
  }
168
172
  reslice() {
169
- h(this, O, C).call(this), m(this, y, h(this, l, D).call(this, super.fromTimestamp)), m(this, I, h(this, l, D).call(this, super.toTimestamp)), m(this, B, X(super.fromTimestamp, super.toTimestamp) + 1);
173
+ c(this, z, v).call(this), u(this, E, c(this, T, I).call(this, super.fromTimestamp)), u(this, O, c(this, T, I).call(this, super.toTimestamp)), u(this, R, j(super.fromTimestamp, super.toTimestamp, this.timezone) + 1);
170
174
  }
171
175
  shiftOrigin(t) {
172
- this.originTimestamp = new Date(this.originTimestamp).setMonth(this.origin + t), this.reoriginate();
176
+ const [e, o] = k(this.originTimestamp, this.timezone), [, l, f] = b(o, e, t), a = q(this.timezone), g = new Date(V(a, this.originTimestamp)).setFullYear(f, l);
177
+ this.originTimestamp = tt(a, g), this.reoriginate();
173
178
  }
174
179
  clearSelection() {
175
- super.clearSelection(), h(this, O, C).call(this), this.refreshFrame(!0);
180
+ super.clearSelection(), c(this, z, v).call(this), this.refreshFrame(!0);
176
181
  }
177
182
  getTimestampAtIndex(t) {
178
- return new Date(i(this, _)).setDate(i(this, A) + t);
183
+ return c(this, w, P).call(this, i(this, H), t);
179
184
  }
180
185
  updateSelection(t, e) {
181
- super.updateSelection(t, e), h(this, O, C).call(this), this.refreshFrame(!0);
186
+ super.updateSelection(t, e), c(this, z, v).call(this), this.refreshFrame(!0);
182
187
  }
183
- withCurrentDayTimestamp(t) {
184
- m(this, N, h(this, l, D).call(this, t));
188
+ withCurrentDayTimestamp() {
189
+ u(this, M, c(this, T, I).call(this, Date.now()));
185
190
  }
186
191
  }
187
- u = new WeakMap(), T = new WeakMap(), d = new WeakMap(), N = new WeakMap(), y = new WeakMap(), I = new WeakMap(), B = new WeakMap(), A = new WeakMap(), W = new WeakMap(), _ = new WeakMap(), k = new WeakMap(), S = new WeakMap(), E = new WeakMap(), M = new WeakSet(), K = function(t) {
188
- const e = X(t, this.originTimestamp);
192
+ y = new WeakMap(), D = new WeakMap(), S = new WeakMap(), M = new WeakMap(), E = new WeakMap(), O = new WeakMap(), R = new WeakMap(), F = new WeakMap(), H = new WeakMap(), N = new WeakMap(), B = new WeakMap(), W = new WeakMap(), L = new WeakSet(), Y = function(t) {
193
+ const e = j(t, this.originTimestamp, this.timezone);
189
194
  return t < this.originTimestamp ? 0 - e : e;
190
- }, l = new WeakSet(), D = function(t) {
191
- return nt(t) || at(t) ? t : t - et(t);
192
- }, O = new WeakSet(), C = function() {
193
- m(this, S, h(this, l, D).call(this, this.selectionStart)), m(this, E, h(this, l, D).call(this, this.selectionEnd));
195
+ }, w = new WeakSet(), P = function(t, e = 0) {
196
+ const o = q(this.timezone), l = V(o, t), f = tt(o, l + e * Q);
197
+ let [, , , a, g] = k(f, this.timezone), A = 0;
198
+ return (a > 0 || g > 0) && (a = (a > 12 ? 24 : 0) - a, g = (a > 1 ? 1 : -1) * g, A = a * 36e5 + g * 6e4), f + A;
199
+ }, T = new WeakSet(), I = function(t) {
200
+ return lt(t) || ut(t) ? t : t - mt(t, this.timezone);
201
+ }, z = new WeakSet(), v = function() {
202
+ u(this, B, c(this, T, I).call(this, this.selectionStart)), u(this, W, c(this, T, I).call(this, this.selectionEnd));
194
203
  };
195
204
  export {
196
- St as default
205
+ At as default
197
206
  };