@braze/web-sdk 6.6.0 → 6.7.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/index.d.ts +253 -5
- package/package.json +1 -1
- package/shared-lib/event-types.js +21 -20
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +70 -70
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +26 -26
- package/src/Banner/banner-factory.js +11 -1
- package/src/Banner/banner-provider.js +244 -120
- package/src/Banner/banner.js +14 -12
- package/src/Banner/display/banner-to-html.js +23 -16
- package/src/Banner/display/detect-banner-impressions.js +13 -13
- package/src/Banner/get-all-banners.js +5 -5
- package/src/Banner/get-banner.js +4 -4
- package/src/Banner/log-banner-click.js +4 -4
- package/src/Banner/log-banner-dismissal.js +23 -0
- package/src/Banner/log-banner-impressions.js +7 -7
- package/src/Banner/request-banners-refresh.js +12 -16
- package/src/Banner/subscribe-to-banners-updates.js +6 -6
- package/src/Banner/ui/insert-banner.js +12 -12
- package/src/Card/card-manager-factory.js +5 -5
- package/src/Card/card-manager.js +33 -33
- package/src/Card/constants.js +1 -1
- package/src/Card/display/card-display.js +11 -11
- package/src/Card/log-card-dismissal.js +3 -3
- package/src/Card/log-content-card-click.js +3 -3
- package/src/Card/log-content-card-impressions.js +6 -6
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +73 -73
- package/src/Card/models/classic-card.js +21 -21
- package/src/Card/models/control-card.js +11 -11
- package/src/Card/models/image-only.js +18 -18
- package/src/Card/util/card-factory.js +41 -41
- package/src/ContentCards/content-cards-provider-factory.js +12 -12
- package/src/ContentCards/content-cards-provider.js +151 -151
- package/src/ContentCards/content-cards.js +5 -5
- package/src/ContentCards/get-cached-content-cards.js +2 -2
- package/src/ContentCards/request-content-cards-refresh.js +2 -2
- package/src/ContentCards/subscribe-to-content-cards-updates.js +6 -6
- package/src/ContentCards/ui/show-content-cards.js +10 -10
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +6 -6
- package/src/Core/disable-sdk.js +9 -9
- package/src/Core/enable-sdk.js +5 -5
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +3 -3
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/log-custom-event.js +8 -8
- package/src/Core/log-purchase.js +5 -5
- package/src/Core/open-session.js +7 -7
- package/src/Core/set-sdk-authentication-signature.js +3 -3
- package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -1
- package/src/Core/wipe-data.js +6 -6
- package/src/DUST/dust-provider-factory.js +11 -11
- package/src/DUST/dust-provider.js +255 -255
- package/src/DUST/dust-shared-worker-impl.js +100 -100
- package/src/DUST/dust-worker-bridge.js +27 -27
- package/src/DUST/subscribe-to-dust.js +9 -9
- package/src/FeatureFlags/feature-flag-factory.js +8 -8
- package/src/FeatureFlags/feature-flag.js +9 -9
- package/src/FeatureFlags/feature-flags-provider.js +86 -86
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/log-feature-flag-impression.js +5 -5
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/InAppMessage/constants.js +83 -2
- package/src/InAppMessage/display/html-message-display-utils.js +15 -15
- package/src/InAppMessage/display/html-message-to-html.js +36 -37
- package/src/InAppMessage/display/in-app-message-to-html.js +44 -44
- package/src/InAppMessage/display/modal-utils.js +10 -14
- package/src/InAppMessage/in-app-message-factory.js +16 -20
- package/src/InAppMessage/in-app-message-manager.js +115 -116
- package/src/InAppMessage/log-in-app-message-button-click.js +8 -8
- package/src/InAppMessage/log-in-app-message-click.js +7 -7
- package/src/InAppMessage/log-in-app-message-html-click.js +8 -8
- package/src/InAppMessage/log-in-app-message-impression.js +5 -5
- package/src/InAppMessage/models/control-message.js +4 -4
- package/src/InAppMessage/models/full-screen-message.js +56 -49
- package/src/InAppMessage/models/html-message.js +31 -27
- package/src/InAppMessage/models/in-app-message-button.js +12 -12
- package/src/InAppMessage/models/in-app-message.js +202 -256
- package/src/InAppMessage/models/modal-message.js +55 -49
- package/src/InAppMessage/models/slide-up-message.js +57 -51
- package/src/InAppMessage/models/templated-in-app-message.js +10 -10
- package/src/InAppMessage/shared-types.js +1 -0
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +5 -5
- package/src/InAppMessage/ui/remove-all-visible-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +43 -41
- package/src/Push/is-push-blocked.js +2 -2
- package/src/Push/is-push-permission-granted.js +2 -2
- package/src/Push/is-push-supported.js +2 -2
- package/src/Push/push-manager-factory.js +9 -9
- package/src/Push/push-manager.js +15 -15
- package/src/Push/utils/push-utils.js +15 -15
- package/src/User/user-manager.js +14 -14
- package/src/User/user.js +60 -59
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +2 -1
- package/src/common/content-cards-display.js +38 -38
- package/src/common/event-logger.js +8 -8
- package/src/l10n/l10n-manager-factory.js +9 -9
- package/src/l10n/l10n-manager.js +2 -2
- package/src/managers/auth-manager.js +31 -31
- package/src/managers/braze-instance.js +197 -186
- package/src/managers/constants.js +1 -0
- package/src/managers/device-manager.js +25 -25
- package/src/managers/network-manager.js +155 -155
- package/src/managers/server-config-manager.js +106 -93
- package/src/managers/session-manager.js +37 -33
- package/src/managers/storage-manager-factory.js +33 -28
- package/src/managers/storage-manager.js +192 -170
- package/src/managers/subscription-manager.js +13 -13
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +13 -13
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +12 -12
- package/src/models/push-token.js +9 -9
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +29 -38
- package/src/request-controller.js +160 -164
- package/src/triggers/models/custom-event-data.js +7 -7
- package/src/triggers/models/custom-event-property-data.js +10 -10
- package/src/triggers/models/filter-set.js +12 -12
- package/src/triggers/models/filter.js +66 -66
- package/src/triggers/models/in-app-message-click-data.js +13 -13
- package/src/triggers/models/purchase-data.js +4 -4
- package/src/triggers/models/purchase-property-data.js +10 -10
- package/src/triggers/models/push-click-data.js +8 -8
- package/src/triggers/models/trigger-condition.js +58 -58
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +44 -44
- package/src/triggers/triggers-provider-factory.js +5 -5
- package/src/triggers/triggers-provider.js +70 -70
- package/src/ui/js/attach-css.js +3 -3
- package/src/ui/js/feed-css.js +2 -2
- package/src/ui/js/iam-css.js +2 -2
- package/src/ui/js/load-font-awesome.js +2 -2
- package/src/util/base-device-parser.js +9 -9
- package/src/util/braze-actions.js +3 -3
- package/src/util/browser-detector.js +37 -37
- package/src/util/client-hints-parser.js +9 -9
- package/src/util/component-utils.js +3 -3
- package/src/util/dom-utils.js +2 -2
- package/src/util/html-display-utils.js +11 -11
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +8 -8
- package/src/util/request-header-utils.js +25 -25
- package/src/util/user-agent-parser.js +20 -20
- package/src/util/validation-utils.js +21 -21
- package/src/util/window-utils.js +3 -3
|
@@ -1,42 +1,43 @@
|
|
|
1
1
|
import { STORAGE_KEYS as s } from "./storage-manager.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import f from "./subscription-manager.js";
|
|
3
|
+
import ci from "../models/server-config.js";
|
|
4
4
|
import v from "../common/event-logger.js";
|
|
5
|
-
import { EventTypes as
|
|
5
|
+
import { EventTypes as p } from "../../shared-lib/index.js";
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
DISMISSALS_CACHE_SIZE_DEFAULT as u,
|
|
8
|
+
REQUEST_BACKOFF_MAX_SLEEP_MS_DEFAULT as c,
|
|
9
|
+
REQUEST_BACKOFF_MIN_SLEEP_MS_DEFAULT as d,
|
|
10
|
+
REQUEST_BACKOFF_SCALE_FACTOR_DEFAULT as m,
|
|
10
11
|
} from "../common/constants.js";
|
|
11
|
-
export default class
|
|
12
|
+
export default class Yt {
|
|
12
13
|
constructor(t) {
|
|
13
|
-
(this.
|
|
14
|
-
(this.
|
|
15
|
-
(this.
|
|
16
|
-
(this.
|
|
17
|
-
(this.
|
|
18
|
-
(this.
|
|
19
|
-
(this.
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (null == this.
|
|
25
|
-
const t = this.
|
|
26
|
-
this.
|
|
14
|
+
(this.C = t),
|
|
15
|
+
(this.C = t),
|
|
16
|
+
(this.Gl = new f()),
|
|
17
|
+
(this._l = new f()),
|
|
18
|
+
(this.Vl = new f()),
|
|
19
|
+
(this.Jl = new f()),
|
|
20
|
+
(this.Ql = new f()),
|
|
21
|
+
(this.Wl = null),
|
|
22
|
+
(this.Yl = null);
|
|
23
|
+
}
|
|
24
|
+
Zl() {
|
|
25
|
+
if (null == this.Yl) {
|
|
26
|
+
const t = this.C.Rt(s.Tt.tc);
|
|
27
|
+
this.Yl = null != t ? ci._u(t) : new ci();
|
|
27
28
|
}
|
|
28
|
-
return this.
|
|
29
|
+
return this.Yl;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
return this.
|
|
31
|
+
Ot() {
|
|
32
|
+
return this.Zl().ec;
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
+
sc(t) {
|
|
34
35
|
var i, e, n, r;
|
|
35
36
|
if (null != t && null != t.config) {
|
|
36
37
|
const l = t.config;
|
|
37
|
-
if (l.time > this.
|
|
38
|
-
const t = (t) => (null == t ? this.
|
|
39
|
-
u = new
|
|
38
|
+
if (l.time > this.Zl().ec) {
|
|
39
|
+
const t = (t) => (null == t ? this.Zl().nc : t),
|
|
40
|
+
u = new ci(
|
|
40
41
|
l.time,
|
|
41
42
|
l.events_blacklist,
|
|
42
43
|
l.attributes_blacklist,
|
|
@@ -49,145 +50,157 @@ export default class Bt {
|
|
|
49
50
|
l.banners,
|
|
50
51
|
l.dust,
|
|
51
52
|
l.request_backoff,
|
|
53
|
+
l.minimum_session_timeout,
|
|
52
54
|
);
|
|
53
55
|
let o = !1;
|
|
54
|
-
null != u.
|
|
56
|
+
null != u.rc && this.ju() !== u.rc && (o = !0);
|
|
55
57
|
let a = !1;
|
|
56
|
-
null != u.
|
|
58
|
+
null != u.lc.enabled && this.Bi() !== u.lc.enabled && (a = !0);
|
|
57
59
|
let h = !1;
|
|
58
|
-
null != u.Xr.enabled && this.
|
|
60
|
+
null != u.Xr.enabled && this.lo() !== u.Xr.enabled && (h = !0);
|
|
59
61
|
let c = !1;
|
|
60
62
|
null !=
|
|
61
63
|
(null === (i = u.banners) || void 0 === i ? void 0 : i.enabled) &&
|
|
62
|
-
this.
|
|
64
|
+
this.Jt() !==
|
|
63
65
|
(null === (e = u.banners) || void 0 === e ? void 0 : e.enabled) &&
|
|
64
66
|
(c = !0);
|
|
65
67
|
let d = !1;
|
|
66
68
|
null != (null === (n = u.dust) || void 0 === n ? void 0 : n.enabled) &&
|
|
67
|
-
this.
|
|
69
|
+
this.fn() !==
|
|
68
70
|
(null === (r = u.dust) || void 0 === r ? void 0 : r.enabled) &&
|
|
69
71
|
(d = !0),
|
|
70
|
-
(this.
|
|
71
|
-
this.
|
|
72
|
-
o && this.
|
|
73
|
-
a && this.
|
|
74
|
-
h && this.
|
|
75
|
-
c && this.
|
|
76
|
-
d && this.
|
|
72
|
+
(this.Yl = u),
|
|
73
|
+
this.C.It(s.Tt.tc, u.qt()),
|
|
74
|
+
o && this.Gl.A(),
|
|
75
|
+
a && this._l.A(),
|
|
76
|
+
h && this.Vl.A(),
|
|
77
|
+
c && this.Jl.A(),
|
|
78
|
+
d && this.Ql.A();
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
xu(t) {
|
|
81
|
-
const i = this.
|
|
82
|
-
return this.
|
|
83
|
+
const i = this.Gl.Kt(t);
|
|
84
|
+
return this.Wl && this.Gl.removeSubscription(this.Wl), (this.Wl = i), i;
|
|
83
85
|
}
|
|
84
|
-
|
|
85
|
-
return this.
|
|
86
|
+
Mi(t) {
|
|
87
|
+
return this._l.Kt(t);
|
|
86
88
|
}
|
|
87
|
-
|
|
88
|
-
return this.
|
|
89
|
+
bo(t) {
|
|
90
|
+
return this.Vl.Kt(t);
|
|
89
91
|
}
|
|
90
|
-
|
|
91
|
-
return this.
|
|
92
|
+
V(t) {
|
|
93
|
+
return this.Jl.Kt(t);
|
|
92
94
|
}
|
|
93
95
|
Tr(t) {
|
|
94
|
-
return this.
|
|
96
|
+
return this.Ql.Kt(t);
|
|
95
97
|
}
|
|
96
|
-
|
|
97
|
-
return -1 !== this.
|
|
98
|
+
$e(t) {
|
|
99
|
+
return -1 !== this.Zl().uc.indexOf(t);
|
|
98
100
|
}
|
|
99
101
|
qu(t) {
|
|
100
|
-
return -1 !== this.
|
|
102
|
+
return -1 !== this.Zl().oc.indexOf(t);
|
|
101
103
|
}
|
|
102
104
|
Dr(t) {
|
|
103
|
-
return -1 !== this.
|
|
105
|
+
return -1 !== this.Zl().ac.indexOf(t);
|
|
104
106
|
}
|
|
105
|
-
|
|
106
|
-
return this.
|
|
107
|
+
hc() {
|
|
108
|
+
return this.Zl().cc;
|
|
107
109
|
}
|
|
108
110
|
ju() {
|
|
109
|
-
return this.
|
|
111
|
+
return this.Zl().rc;
|
|
110
112
|
}
|
|
111
|
-
|
|
112
|
-
return this.
|
|
113
|
+
Bi() {
|
|
114
|
+
return this.Zl().lc.enabled || !1;
|
|
113
115
|
}
|
|
114
|
-
|
|
115
|
-
const t = this.
|
|
116
|
+
dc() {
|
|
117
|
+
const t = this.Zl().nc;
|
|
116
118
|
return !(!t || null == t.enabled) && t.enabled;
|
|
117
119
|
}
|
|
118
|
-
|
|
119
|
-
if (!this.
|
|
120
|
-
const t = this.
|
|
120
|
+
Ul() {
|
|
121
|
+
if (!this.dc()) return -1;
|
|
122
|
+
const t = this.Zl().nc;
|
|
121
123
|
return null == t.capacity || t.capacity < 10 ? -1 : t.capacity;
|
|
122
124
|
}
|
|
123
|
-
|
|
124
|
-
if (!this.
|
|
125
|
-
const t = this.
|
|
125
|
+
xl() {
|
|
126
|
+
if (!this.dc()) return -1;
|
|
127
|
+
const t = this.Zl().nc;
|
|
126
128
|
return null == t.refill_rate || t.refill_rate <= 0 ? -1 : t.refill_rate;
|
|
127
129
|
}
|
|
128
|
-
|
|
129
|
-
const i = this.
|
|
130
|
+
mc(t) {
|
|
131
|
+
const i = this.Zl().nc.endpoint_overrides;
|
|
130
132
|
return null == i ? null : i[t];
|
|
131
133
|
}
|
|
132
|
-
|
|
133
|
-
const i = this.
|
|
134
|
+
Hl(t) {
|
|
135
|
+
const i = this.mc(t);
|
|
134
136
|
return null == i || isNaN(i.capacity) || i.capacity <= 0 ? -1 : i.capacity;
|
|
135
137
|
}
|
|
136
|
-
|
|
137
|
-
const i = this.
|
|
138
|
+
Ol(t) {
|
|
139
|
+
const i = this.mc(t);
|
|
138
140
|
return null == i || isNaN(i.refill_rate) || i.refill_rate <= 0
|
|
139
141
|
? -1
|
|
140
142
|
: i.refill_rate;
|
|
141
143
|
}
|
|
142
|
-
|
|
143
|
-
return this.
|
|
144
|
-
? (v.
|
|
145
|
-
: this.
|
|
144
|
+
lo() {
|
|
145
|
+
return this.Zl().Xr.enabled && null == this.Ro()
|
|
146
|
+
? (v.wt(p.Ya, { e: "Missing feature flag refresh_rate_limit." }), !1)
|
|
147
|
+
: this.Zl().Xr.enabled || !1;
|
|
146
148
|
}
|
|
147
|
-
|
|
148
|
-
return this.
|
|
149
|
+
Ro() {
|
|
150
|
+
return this.Zl().Xr.refresh_rate_limit;
|
|
149
151
|
}
|
|
150
|
-
|
|
152
|
+
Jt() {
|
|
151
153
|
var t;
|
|
152
154
|
return (
|
|
153
|
-
(null === (t = this.
|
|
155
|
+
(null === (t = this.Zl().banners) || void 0 === t ? void 0 : t.enabled) ||
|
|
154
156
|
null
|
|
155
157
|
);
|
|
156
158
|
}
|
|
157
|
-
|
|
159
|
+
re() {
|
|
158
160
|
var t;
|
|
159
161
|
return (
|
|
160
|
-
(null === (t = this.
|
|
162
|
+
(null === (t = this.Zl().banners) || void 0 === t
|
|
161
163
|
? void 0
|
|
162
164
|
: t.max_placements) || 0
|
|
163
165
|
);
|
|
164
166
|
}
|
|
165
|
-
|
|
167
|
+
Xt() {
|
|
168
|
+
var t;
|
|
169
|
+
const i =
|
|
170
|
+
null === (t = this.Zl().banners) || void 0 === t
|
|
171
|
+
? void 0
|
|
172
|
+
: t.dismissals_cache_size;
|
|
173
|
+
return null != i && "number" == typeof i && i > 0 ? i : u;
|
|
174
|
+
}
|
|
175
|
+
fn() {
|
|
166
176
|
var t;
|
|
167
177
|
return (
|
|
168
|
-
(null === (t = this.
|
|
178
|
+
(null === (t = this.Zl().dust) || void 0 === t ? void 0 : t.enabled) || !1
|
|
169
179
|
);
|
|
170
180
|
}
|
|
171
|
-
|
|
181
|
+
vt() {
|
|
172
182
|
var t;
|
|
173
183
|
const i =
|
|
174
|
-
null === (t = this.
|
|
184
|
+
null === (t = this.Zl().vc) || void 0 === t
|
|
175
185
|
? void 0
|
|
176
186
|
: t.min_sleep_duration_ms;
|
|
177
|
-
return null != i ? i :
|
|
187
|
+
return null != i ? i : d;
|
|
178
188
|
}
|
|
179
|
-
|
|
189
|
+
gt() {
|
|
180
190
|
var t;
|
|
181
191
|
const i =
|
|
182
|
-
null === (t = this.
|
|
183
|
-
return null != i ? i :
|
|
192
|
+
null === (t = this.Zl().vc) || void 0 === t ? void 0 : t.scale_factor;
|
|
193
|
+
return null != i ? i : m;
|
|
184
194
|
}
|
|
185
|
-
|
|
195
|
+
bt() {
|
|
186
196
|
var t;
|
|
187
197
|
const i =
|
|
188
|
-
null === (t = this.
|
|
198
|
+
null === (t = this.Zl().vc) || void 0 === t
|
|
189
199
|
? void 0
|
|
190
200
|
: t.max_sleep_duration_ms;
|
|
191
|
-
return null != i ? i :
|
|
201
|
+
return null != i ? i : c;
|
|
202
|
+
}
|
|
203
|
+
gc() {
|
|
204
|
+
return this.Zl().fc;
|
|
192
205
|
}
|
|
193
206
|
}
|
|
@@ -1,75 +1,79 @@
|
|
|
1
1
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
2
|
-
import
|
|
2
|
+
import Ie from "../models/braze-event.js";
|
|
3
3
|
import _t from "../models/identifier.js";
|
|
4
4
|
import { convertMsToSeconds as X } from "../util/date-utils.js";
|
|
5
5
|
import {
|
|
6
6
|
logger as E,
|
|
7
|
-
Guid as
|
|
8
|
-
EventTypes as
|
|
7
|
+
Guid as V,
|
|
8
|
+
EventTypes as p,
|
|
9
9
|
} from "../../shared-lib/index.js";
|
|
10
|
-
|
|
10
|
+
import { DEFAULT_MINIMUM_SESSION_TIMEOUT_IN_MS as ts } from "./constants.js";
|
|
11
|
+
export default class Xt {
|
|
11
12
|
constructor(s, t, i, e) {
|
|
12
|
-
(this.
|
|
13
|
-
(this.
|
|
13
|
+
(this.C = s),
|
|
14
|
+
(this.Ss = t),
|
|
14
15
|
(this.h = i),
|
|
15
16
|
(this.tm = e),
|
|
16
|
-
(this.
|
|
17
|
-
(this.
|
|
18
|
-
(this.h = i)
|
|
19
|
-
|
|
17
|
+
(this.C = s),
|
|
18
|
+
(this.Ss = t),
|
|
19
|
+
(this.h = i);
|
|
20
|
+
const n = this.h.gc();
|
|
21
|
+
(this.im = n ? 1e3 * n : ts),
|
|
20
22
|
(null == e || isNaN(e)) && (e = 1800),
|
|
21
23
|
e < this.im / 1e3 &&
|
|
22
|
-
|
|
24
|
+
E.info(
|
|
23
25
|
"Specified session timeout of " +
|
|
24
26
|
e +
|
|
25
27
|
"s is too small, using the minimum session timeout of " +
|
|
26
28
|
this.im / 1e3 +
|
|
27
29
|
"s instead.",
|
|
28
30
|
),
|
|
29
|
-
|
|
30
|
-
(this.tm = e);
|
|
31
|
+
(this.tm = Math.max(e, this.im / 1e3));
|
|
31
32
|
}
|
|
32
33
|
nm(s, t) {
|
|
33
|
-
return new
|
|
34
|
+
return new Ie(this.Ss.getUserId(), p.hm, s, t.Tu, { d: X(s - t.lm) });
|
|
35
|
+
}
|
|
36
|
+
al() {
|
|
37
|
+
return this.C.$u(s.Ou.um);
|
|
34
38
|
}
|
|
35
|
-
|
|
36
|
-
const t = this.
|
|
39
|
+
kt() {
|
|
40
|
+
const t = this.C.$u(s.Ou.um);
|
|
37
41
|
return null == t ? null : t.Tu;
|
|
38
42
|
}
|
|
39
43
|
am() {
|
|
40
44
|
const t = new Date().valueOf(),
|
|
41
|
-
i = this.h.
|
|
45
|
+
i = this.h.hc();
|
|
42
46
|
if (null == i) return !1;
|
|
43
|
-
const e = this.
|
|
47
|
+
const e = this.C.Rt(s.Tt.dm),
|
|
44
48
|
n = null == e || t - e > 1e3 * i;
|
|
45
|
-
return n && this.
|
|
49
|
+
return n && this.C.It(s.Tt.dm, t), n;
|
|
46
50
|
}
|
|
47
|
-
|
|
48
|
-
return null == t || null == t.
|
|
51
|
+
ul(s, t) {
|
|
52
|
+
return null == t || null == t.fm || (!(s - t.lm < this.im) && t.fm < s);
|
|
49
53
|
}
|
|
50
54
|
el() {
|
|
51
55
|
const t = new Date().valueOf(),
|
|
52
56
|
i = t + 1e3 * this.tm,
|
|
53
|
-
e = this.
|
|
54
|
-
if (this.
|
|
57
|
+
e = this.C.$u(s.Ou.um);
|
|
58
|
+
if (this.ul(t, e)) {
|
|
55
59
|
let n = "Generating session start event with time " + t;
|
|
56
60
|
if (null != e) {
|
|
57
|
-
let s = e.
|
|
61
|
+
let s = e.pm;
|
|
58
62
|
s - e.lm < this.im && (s = e.lm + this.im),
|
|
59
|
-
this.
|
|
63
|
+
this.C.gm(this.nm(s, e)),
|
|
60
64
|
(n += " (old session ended " + s + ")");
|
|
61
65
|
}
|
|
62
66
|
(n += ". Will expire " + i.valueOf()), E.info(n);
|
|
63
|
-
const
|
|
64
|
-
this.
|
|
65
|
-
this.
|
|
66
|
-
return null == this.
|
|
67
|
+
const r = new _t(V.de(), i);
|
|
68
|
+
this.C.gm(new Ie(this.Ss.getUserId(), p.wm, t, r.Tu)),
|
|
69
|
+
this.C.Iu(s.Ou.um, r);
|
|
70
|
+
return null == this.C.Rt(s.Tt.dm) && this.C.It(s.Tt.dm, t), r.Tu;
|
|
67
71
|
}
|
|
68
|
-
if (null != e) return (e.
|
|
72
|
+
if (null != e) return (e.pm = t), (e.fm = i), this.C.Iu(s.Ou.um, e), e.Tu;
|
|
69
73
|
}
|
|
70
|
-
|
|
71
|
-
const t = this.
|
|
74
|
+
Sm() {
|
|
75
|
+
const t = this.C.$u(s.Ou.um);
|
|
72
76
|
null != t &&
|
|
73
|
-
(this.
|
|
77
|
+
(this.C.jm(s.Ou.um), this.C.gm(this.nm(new Date().valueOf(), t)));
|
|
74
78
|
}
|
|
75
79
|
}
|
|
@@ -1,42 +1,47 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ne, { STORAGE_KEYS as s } from "./storage-manager.js";
|
|
2
2
|
import { logger as E } from "../../shared-lib/index.js";
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const Zt = {
|
|
4
|
+
rl: function (o, t = !1, e) {
|
|
5
|
+
const r = Zt.Sc(),
|
|
6
|
+
a = Zt.sl(),
|
|
7
|
+
n = new ne.Ec(o, r && !t, a, e);
|
|
8
|
+
let c;
|
|
9
|
+
return (c = a ? new ne.wc(o) : new ne.Rc()), new ne(n, c);
|
|
10
|
+
},
|
|
11
|
+
Sc: function () {
|
|
12
|
+
return (
|
|
13
|
+
navigator.cookieEnabled ||
|
|
14
|
+
("cookie" in document &&
|
|
15
|
+
(document.cookie.length > 0 ||
|
|
16
|
+
(document.cookie = "test").indexOf.call(document.cookie, "test") >
|
|
17
|
+
-1))
|
|
18
|
+
);
|
|
19
|
+
},
|
|
20
|
+
sl: function () {
|
|
21
|
+
let o = !1;
|
|
6
22
|
try {
|
|
7
23
|
if (localStorage && localStorage.getItem)
|
|
8
24
|
try {
|
|
9
|
-
localStorage.setItem(s.
|
|
10
|
-
localStorage.getItem(s.
|
|
11
|
-
(localStorage.removeItem(s.
|
|
12
|
-
|
|
25
|
+
localStorage.setItem(s.Tt._c, "true"),
|
|
26
|
+
localStorage.getItem(s.Tt._c)
|
|
27
|
+
? (localStorage.removeItem(s.Tt._c), (o = !0))
|
|
28
|
+
: (o = !1);
|
|
29
|
+
} catch (t) {
|
|
13
30
|
if (
|
|
14
31
|
!(
|
|
15
|
-
|
|
16
|
-
("QuotaExceededError" ===
|
|
17
|
-
"NS_ERROR_DOM_QUOTA_REACHED" ===
|
|
32
|
+
t instanceof Error &&
|
|
33
|
+
("QuotaExceededError" === t.name ||
|
|
34
|
+
"NS_ERROR_DOM_QUOTA_REACHED" === t.name) &&
|
|
18
35
|
localStorage.length > 0
|
|
19
36
|
)
|
|
20
37
|
)
|
|
21
|
-
throw
|
|
22
|
-
|
|
38
|
+
throw t;
|
|
39
|
+
o = !0;
|
|
23
40
|
}
|
|
24
|
-
} catch (
|
|
41
|
+
} catch (o) {
|
|
25
42
|
E.info("Local Storage not supported!");
|
|
26
43
|
}
|
|
27
|
-
|
|
28
|
-
n = new ee.Wc(e, a && !o, r, t);
|
|
29
|
-
let c;
|
|
30
|
-
return (c = r ? new ee.Xc(e) : new ee.Yc()), new ee(n, c);
|
|
31
|
-
},
|
|
32
|
-
Uc: function () {
|
|
33
|
-
return (
|
|
34
|
-
navigator.cookieEnabled ||
|
|
35
|
-
("cookie" in document &&
|
|
36
|
-
(document.cookie.length > 0 ||
|
|
37
|
-
(document.cookie = "test").indexOf.call(document.cookie, "test") >
|
|
38
|
-
-1))
|
|
39
|
-
);
|
|
44
|
+
return o;
|
|
40
45
|
},
|
|
41
46
|
};
|
|
42
|
-
export default
|
|
47
|
+
export default Zt;
|