@braze/web-sdk 4.6.2 → 4.7.0
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 +13 -8
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +2 -2
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +18 -17
- package/shared-lib/indexed-db-adapter.js +2 -2
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +15 -15
- package/src/Core/handle-braze-action.js +40 -34
- package/src/Core/log-custom-event.js +2 -7
- package/src/Core/log-purchase.js +3 -3
- package/src/Core/wipe-data.js +2 -2
- package/src/FeatureFlags/feature-flag.js +33 -16
- package/src/FeatureFlags/feature-flags-provider.js +86 -75
- package/src/FeatureFlags/get-all-feature-flags.js +5 -5
- package/src/FeatureFlags/get-feature-flag.js +6 -6
- package/src/FeatureFlags/refresh-feature-flags.js +1 -1
- package/src/FeatureFlags/types.js +1 -0
- package/src/Feed/feed-provider.js +17 -17
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +135 -120
- package/src/InAppMessage/display/in-app-message-to-html.js +21 -21
- package/src/InAppMessage/display/modal-utils.js +6 -6
- package/src/InAppMessage/in-app-message-factory.js +3 -3
- package/src/InAppMessage/in-app-message-manager-factory.js +3 -3
- package/src/InAppMessage/in-app-message-manager.js +65 -65
- package/src/InAppMessage/log-in-app-message-button-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-html-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-impression.js +3 -3
- package/src/InAppMessage/models/full-screen-message.js +1 -1
- package/src/InAppMessage/models/html-message.js +1 -1
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +80 -80
- package/src/InAppMessage/models/modal-message.js +2 -2
- package/src/InAppMessage/models/slide-up-message.js +8 -8
- package/src/InAppMessage/models/templated-in-app-message.js +4 -4
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +20 -20
- package/src/Push/push-manager.js +216 -209
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +11 -8
- package/src/User/user.js +52 -41
- package/src/common/base-feed.js +1 -1
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +2 -0
- package/src/common/feed-display.js +6 -6
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/managers/auth-manager.js +24 -24
- package/src/managers/braze-instance.js +120 -120
- package/src/managers/device-manager.js +11 -11
- package/src/managers/network-manager.js +63 -54
- package/src/managers/server-config-manager.js +20 -20
- package/src/managers/session-manager.js +29 -29
- package/src/managers/storage-manager-factory.js +4 -4
- package/src/managers/storage-manager.js +104 -104
- package/src/managers/subscription-manager.js +6 -6
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +7 -7
- package/src/models/device.js +1 -1
- package/src/models/identifier.js +6 -6
- package/src/models/push-token.js +3 -3
- package/src/models/server-config.js +15 -15
- package/src/request-controller.js +92 -88
- package/src/triggers/models/custom-event-data.js +4 -4
- package/src/triggers/models/custom-event-property-data.js +9 -9
- package/src/triggers/models/filter-set.js +9 -9
- package/src/triggers/models/filter.js +63 -63
- package/src/triggers/models/in-app-message-click-data.js +5 -5
- package/src/triggers/models/purchase-data.js +3 -3
- package/src/triggers/models/purchase-property-data.js +9 -9
- package/src/triggers/models/push-click-data.js +5 -5
- package/src/triggers/models/trigger-condition.js +48 -48
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +29 -29
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +87 -89
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/feed-css.js +4 -4
- package/src/ui/js/iam-css.js +4 -4
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +2 -2
- package/src/util/braze-actions.js +8 -8
- package/src/util/browser-detector.js +8 -8
- package/src/util/client-hints-parser.js +3 -3
- package/src/util/code-utils.js +10 -3
- package/src/util/component-utils.js +1 -1
- package/src/util/date-utils.js +2 -2
- package/src/util/device-constants.js +1 -1
- package/src/util/dom-utils.js +9 -9
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +3 -3
- package/src/util/user-agent-parser.js +4 -4
- package/src/util/validation-utils.js +155 -74
- package/src/util/window-utils.js +1 -1
|
@@ -2,43 +2,43 @@ import qt from "../models/backend-errors.js";
|
|
|
2
2
|
import ue from "../models/braze-event.js";
|
|
3
3
|
import {
|
|
4
4
|
convertMsToSeconds as l,
|
|
5
|
-
convertSecondsToMs as
|
|
5
|
+
convertSecondsToMs as Xt
|
|
6
6
|
} from "../util/date-utils.js";
|
|
7
7
|
import s from "../common/event-logger.js";
|
|
8
8
|
import { isArray as p, isEqual as ii } from "../util/code-utils.js";
|
|
9
9
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
10
10
|
import { STORAGE_KEYS as o } from "./storage-manager.js";
|
|
11
|
-
export default class
|
|
11
|
+
export default class Pt {
|
|
12
12
|
constructor(t, e, s, i, r, o, n, a, u, h, c) {
|
|
13
13
|
(this.Ur = t),
|
|
14
14
|
(this.h = e),
|
|
15
|
-
(this.
|
|
15
|
+
(this.Vo = s),
|
|
16
16
|
(this.v = i),
|
|
17
17
|
(this.j = r),
|
|
18
18
|
(this.gt = o),
|
|
19
19
|
(this._r = n),
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
22
|
-
(this.
|
|
23
|
-
(this
|
|
24
|
-
(this.
|
|
20
|
+
(this.Uo = a),
|
|
21
|
+
(this.jo = u),
|
|
22
|
+
(this.Fo = h),
|
|
23
|
+
(this.$o = c),
|
|
24
|
+
(this.Zo = ["npm"]);
|
|
25
25
|
}
|
|
26
26
|
Ps(t, e) {
|
|
27
27
|
const s = this.Ur.te(),
|
|
28
|
-
i = s.
|
|
29
|
-
r = this.h.I(o.q.
|
|
28
|
+
i = s.Pi(),
|
|
29
|
+
r = this.h.I(o.q.Qo);
|
|
30
30
|
ii(r, i) || (t.device = i),
|
|
31
31
|
(t.api_key = this._r),
|
|
32
32
|
(t.time = l(new Date().valueOf(), !0));
|
|
33
|
-
const n = this.h.I(o.q.
|
|
34
|
-
a = this.h.I(o.q.
|
|
33
|
+
const n = this.h.I(o.q.sa) || [],
|
|
34
|
+
a = this.h.I(o.q.oa) || "";
|
|
35
35
|
if (
|
|
36
|
-
(this.
|
|
37
|
-
(!ii(n, this.
|
|
38
|
-
(t.sdk_metadata = this.
|
|
39
|
-
(t.sdk_version = this.
|
|
40
|
-
this.
|
|
41
|
-
(t.app_version = this
|
|
36
|
+
(this.Zo.length > 0 &&
|
|
37
|
+
(!ii(n, this.Zo) || a !== this.j.ua()) &&
|
|
38
|
+
(t.sdk_metadata = this.Zo),
|
|
39
|
+
(t.sdk_version = this.jo),
|
|
40
|
+
this.Fo && (t.sdk_flavor = this.Fo),
|
|
41
|
+
(t.app_version = this.$o),
|
|
42
42
|
(t.device_id = s.id),
|
|
43
43
|
e)
|
|
44
44
|
) {
|
|
@@ -53,7 +53,7 @@ export default class Ot {
|
|
|
53
53
|
if (!o && !n) return !0;
|
|
54
54
|
if (o) {
|
|
55
55
|
let e;
|
|
56
|
-
this.
|
|
56
|
+
this.Vo.Vn();
|
|
57
57
|
const s = { errorCode: o.error_code };
|
|
58
58
|
for (const t of i)
|
|
59
59
|
p(t) && "X-Braze-Auth-Signature" === t[0] && (s.signature = t[1]);
|
|
@@ -65,42 +65,51 @@ export default class Ot {
|
|
|
65
65
|
n
|
|
66
66
|
? ((s.reason = n), (e = `due to ${n}`))
|
|
67
67
|
: (e = `with error code ${o.error_code}.`),
|
|
68
|
-
this.
|
|
68
|
+
this.Vo.Jn() ||
|
|
69
69
|
(e +=
|
|
70
70
|
' Please use the "enableSdkAuthentication" initialization option to enable authentication.'),
|
|
71
71
|
r.D.error(`SDK Authentication failed ${e}`),
|
|
72
|
-
this.
|
|
73
|
-
this.
|
|
72
|
+
this.ha(t.events, t.attributes),
|
|
73
|
+
this.Vo.Qn(s),
|
|
74
74
|
!1
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
77
|
if (n) {
|
|
78
|
-
let i
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
78
|
+
let i,
|
|
79
|
+
o = n;
|
|
80
|
+
switch (o) {
|
|
81
|
+
case qt.ca:
|
|
82
|
+
return (
|
|
83
|
+
(i = "Received successful response with empty body."),
|
|
84
|
+
s.G(r.A.qs, { e: i }),
|
|
85
|
+
r.D.info(i),
|
|
86
|
+
!1
|
|
87
|
+
);
|
|
88
|
+
case qt.la:
|
|
89
|
+
return (
|
|
90
|
+
(i = "Received successful response with invalid JSON"),
|
|
91
|
+
s.G(r.A.qs, { e: i + ": " + e.response }),
|
|
92
|
+
r.D.info(i),
|
|
93
|
+
!1
|
|
94
|
+
);
|
|
95
|
+
case qt.fa:
|
|
96
|
+
o = `The API key "${t.api_key}" is invalid for the baseUrl ${this.Uo}`;
|
|
88
97
|
break;
|
|
89
|
-
case qt.
|
|
90
|
-
|
|
98
|
+
case qt.ma:
|
|
99
|
+
o =
|
|
91
100
|
"Sorry, we are not currently accepting your requests. If you think this is in error, please contact us.";
|
|
92
101
|
break;
|
|
93
|
-
case qt.
|
|
94
|
-
|
|
102
|
+
case qt.pa:
|
|
103
|
+
o = "No device identifier. Please contact support@braze.com";
|
|
95
104
|
}
|
|
96
|
-
r.D.error("Backend error: " +
|
|
105
|
+
r.D.error("Backend error: " + o);
|
|
97
106
|
}
|
|
98
107
|
return !1;
|
|
99
108
|
}
|
|
100
|
-
|
|
109
|
+
Ra(t, e, s, i) {
|
|
101
110
|
return !!((t && 0 !== t.length) || (e && 0 !== e.length) || s || i);
|
|
102
111
|
}
|
|
103
|
-
|
|
112
|
+
ba(t, e, s, i) {
|
|
104
113
|
const r = [],
|
|
105
114
|
o = t => t || "",
|
|
106
115
|
n = o(this.v.getUserId());
|
|
@@ -108,11 +117,11 @@ export default class Ot {
|
|
|
108
117
|
u,
|
|
109
118
|
h,
|
|
110
119
|
c,
|
|
111
|
-
l = this.
|
|
120
|
+
l = this.Oi(t, e);
|
|
112
121
|
if (s.length > 0) {
|
|
113
122
|
const t = [];
|
|
114
123
|
for (const e of s) {
|
|
115
|
-
if (((a = e.
|
|
124
|
+
if (((a = e.Pi()), this.Vo.Jn())) {
|
|
116
125
|
if (n && !a.user_id) {
|
|
117
126
|
c || ((c = {}), (c.events = [])), c.events.push(a);
|
|
118
127
|
continue;
|
|
@@ -129,39 +138,39 @@ export default class Ot {
|
|
|
129
138
|
if (i.length > 0) {
|
|
130
139
|
const t = [];
|
|
131
140
|
for (const e of i)
|
|
132
|
-
this.
|
|
141
|
+
this.Vo.Jn() && o(e.user_id) !== n
|
|
133
142
|
? (h || (h = []), h.push(e))
|
|
134
143
|
: t.push(e);
|
|
135
144
|
t.length > 0 && (l.attributes = t);
|
|
136
145
|
}
|
|
137
|
-
if ((this.
|
|
146
|
+
if ((this.ha(u, h), (l = this.Ps(l, !0)), c)) {
|
|
138
147
|
c = this.Ps(c, !1);
|
|
139
148
|
const t = { requestData: c, headers: this.Bs(c) };
|
|
140
149
|
r.push(t);
|
|
141
150
|
}
|
|
142
|
-
if (l && !this.
|
|
151
|
+
if (l && !this.Ra(l.events, l.attributes, t, e)) return c ? r : null;
|
|
143
152
|
const f = { requestData: l, headers: this.Bs(l) };
|
|
144
153
|
return r.push(f), r;
|
|
145
154
|
}
|
|
146
|
-
|
|
155
|
+
ha(t, e) {
|
|
147
156
|
if (t) {
|
|
148
157
|
const e = [];
|
|
149
158
|
for (const s of t) {
|
|
150
159
|
const t = ue.fromJson(s);
|
|
151
|
-
(t.time =
|
|
160
|
+
(t.time = Xt(t.time)), e.push(t);
|
|
152
161
|
}
|
|
153
162
|
this.h.bo(e);
|
|
154
163
|
}
|
|
155
|
-
if (e) for (const t of e) this.h.
|
|
164
|
+
if (e) for (const t of e) this.h.ga(t);
|
|
156
165
|
}
|
|
157
166
|
Vs(t, e) {
|
|
158
167
|
let s = "HTTP error ";
|
|
159
168
|
null != t && (s += t + " "), (s += e), r.D.error(s);
|
|
160
169
|
}
|
|
161
170
|
Fr(t) {
|
|
162
|
-
return s.G(r.A.
|
|
171
|
+
return s.G(r.A.qa, { n: t });
|
|
163
172
|
}
|
|
164
|
-
|
|
173
|
+
Oi(t, e, s) {
|
|
165
174
|
const i = {};
|
|
166
175
|
t && (i.feed = !0), e && (i.triggers = !0);
|
|
167
176
|
const r = null != s ? s : this.v.getUserId();
|
|
@@ -192,9 +201,9 @@ export default class Ot {
|
|
|
192
201
|
if (
|
|
193
202
|
(s && (r.push(["X-Braze-FeatureFlagsRequest", "true"]), (n = !0)),
|
|
194
203
|
n && r.push(["X-Braze-DataRequest", "true"]),
|
|
195
|
-
this.
|
|
204
|
+
this.Vo.Jn())
|
|
196
205
|
) {
|
|
197
|
-
const t = this.
|
|
206
|
+
const t = this.Vo.Kn();
|
|
198
207
|
null != t && r.push(["X-Braze-Auth-Signature", t]);
|
|
199
208
|
}
|
|
200
209
|
return r;
|
|
@@ -208,12 +217,12 @@ export default class Ot {
|
|
|
208
217
|
: e();
|
|
209
218
|
}
|
|
210
219
|
Qs() {
|
|
211
|
-
this.
|
|
220
|
+
this.Vo.Qs();
|
|
212
221
|
}
|
|
213
222
|
Ks() {
|
|
214
|
-
return this.
|
|
223
|
+
return this.Uo;
|
|
215
224
|
}
|
|
216
225
|
addSdkMetadata(t) {
|
|
217
|
-
for (const e of t) -1 === this.
|
|
226
|
+
for (const e of t) -1 === this.Zo.indexOf(e) && this.Zo.push(e);
|
|
218
227
|
}
|
|
219
228
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { STORAGE_KEYS as o } from "./storage-manager.js";
|
|
2
2
|
import u from "./subscription-manager.js";
|
|
3
|
-
import
|
|
3
|
+
import Kt from "../models/server-config.js";
|
|
4
4
|
import s from "../common/event-logger.js";
|
|
5
5
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
6
|
-
export default class
|
|
6
|
+
export default class Mt {
|
|
7
7
|
constructor(t) {
|
|
8
8
|
(this.h = t),
|
|
9
9
|
(this.tl = new u()),
|
|
@@ -14,7 +14,7 @@ export default class Pt {
|
|
|
14
14
|
rl() {
|
|
15
15
|
if (null == this.il) {
|
|
16
16
|
const t = this.h.I(o.q.hl);
|
|
17
|
-
this.il = null != t ?
|
|
17
|
+
this.il = null != t ? Kt.Pn(t) : new Kt();
|
|
18
18
|
}
|
|
19
19
|
return this.il;
|
|
20
20
|
}
|
|
@@ -25,7 +25,7 @@ export default class Pt {
|
|
|
25
25
|
if (null != t && null != t.config) {
|
|
26
26
|
const e = t.config;
|
|
27
27
|
if (e.time > this.rl().ol) {
|
|
28
|
-
const t = new
|
|
28
|
+
const t = new Kt(
|
|
29
29
|
e.time,
|
|
30
30
|
e.events_blacklist,
|
|
31
31
|
e.attributes_blacklist,
|
|
@@ -36,11 +36,11 @@ export default class Pt {
|
|
|
36
36
|
e.feature_flags
|
|
37
37
|
);
|
|
38
38
|
let s = !1;
|
|
39
|
-
null != t.gl && this.
|
|
39
|
+
null != t.gl && this.mn() !== t.gl && (s = !0);
|
|
40
40
|
let i = !1;
|
|
41
41
|
null != t.ml.enabled && this.Ys() !== t.ml.enabled && (i = !0);
|
|
42
42
|
let r = !1;
|
|
43
|
-
null != t.
|
|
43
|
+
null != t.hi.enabled && this.ci() !== t.hi.enabled && (r = !0),
|
|
44
44
|
(this.il = t),
|
|
45
45
|
this.h.B(o.q.hl, t.ss()),
|
|
46
46
|
s && this.tl.St(),
|
|
@@ -49,40 +49,40 @@ export default class Pt {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
gn(t) {
|
|
53
53
|
let e = this.tl.ut(t);
|
|
54
|
-
return this.
|
|
54
|
+
return this.cl && this.tl.removeSubscription(this.cl), (this.cl = e), e;
|
|
55
55
|
}
|
|
56
56
|
Ms(t) {
|
|
57
57
|
return this.el.ut(t);
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
Fi(t) {
|
|
60
60
|
return this.sl.ut(t);
|
|
61
61
|
}
|
|
62
62
|
ge(t) {
|
|
63
|
-
return -1 !== this.rl().
|
|
63
|
+
return -1 !== this.rl().fl.indexOf(t);
|
|
64
64
|
}
|
|
65
65
|
hu(t) {
|
|
66
|
-
return -1 !== this.rl().
|
|
66
|
+
return -1 !== this.rl().bl.indexOf(t);
|
|
67
67
|
}
|
|
68
68
|
Dr(t) {
|
|
69
|
-
return -1 !== this.rl().
|
|
69
|
+
return -1 !== this.rl().dl.indexOf(t);
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
return this.rl().
|
|
71
|
+
vl() {
|
|
72
|
+
return this.rl().wl;
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
mn() {
|
|
75
75
|
return this.rl().gl;
|
|
76
76
|
}
|
|
77
77
|
Ys() {
|
|
78
78
|
return this.rl().ml.enabled || !1;
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
return this.rl().
|
|
80
|
+
ci() {
|
|
81
|
+
return this.rl().hi.enabled && null == this.ji()
|
|
82
82
|
? (s.G(r.A.qs, { e: "Missing feature flag refresh_rate_limit." }), !1)
|
|
83
|
-
: this.rl().
|
|
83
|
+
: this.rl().hi.enabled || !1;
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
return this.rl().
|
|
85
|
+
ji() {
|
|
86
|
+
return this.rl().hi.refresh_rate_limit;
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -3,66 +3,66 @@ import ue from "../models/braze-event.js";
|
|
|
3
3
|
import _t from "../models/identifier.js";
|
|
4
4
|
import { convertMsToSeconds as l } from "../util/date-utils.js";
|
|
5
5
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
6
|
-
export default class
|
|
6
|
+
export default class jt {
|
|
7
7
|
constructor(s, t, e, i) {
|
|
8
8
|
(this.h = s),
|
|
9
9
|
(this.v = t),
|
|
10
10
|
(this.gt = e),
|
|
11
|
-
(this.
|
|
11
|
+
(this.fh = 1e3),
|
|
12
12
|
(i = parseFloat(i)),
|
|
13
13
|
isNaN(i) && (i = 1800),
|
|
14
|
-
i < this.
|
|
14
|
+
i < this.fh / 1e3 &&
|
|
15
15
|
(r.D.info(
|
|
16
16
|
"Specified session timeout of " +
|
|
17
17
|
i +
|
|
18
18
|
"s is too small, using the minimum session timeout of " +
|
|
19
|
-
this.
|
|
19
|
+
this.fh / 1e3 +
|
|
20
20
|
"s instead."
|
|
21
21
|
),
|
|
22
|
-
(i = this.
|
|
23
|
-
(this.
|
|
22
|
+
(i = this.fh / 1e3)),
|
|
23
|
+
(this.ph = i);
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
return new ue(this.v.getUserId(), r.A.
|
|
25
|
+
gh(s, t) {
|
|
26
|
+
return new ue(this.v.getUserId(), r.A.wh, s, t.iu, { d: l(s - t.jh) });
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
const s = this.h.tu(o.eu.
|
|
28
|
+
ua() {
|
|
29
|
+
const s = this.h.tu(o.eu.xh);
|
|
30
30
|
return null == s ? null : s.iu;
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
Ch() {
|
|
33
33
|
const s = new Date().valueOf(),
|
|
34
|
-
t = this.gt.
|
|
35
|
-
e = this.h.I(o.q.
|
|
34
|
+
t = this.gt.vl(),
|
|
35
|
+
e = this.h.I(o.q.Gh);
|
|
36
36
|
if (null != e && null == t) return !1;
|
|
37
37
|
const i = null == e || s - e > 1e3 * t;
|
|
38
|
-
return i && this.h.B(o.q.
|
|
38
|
+
return i && this.h.B(o.q.Gh, s), i;
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
return null == t || (!(s - t.
|
|
40
|
+
Fh(s, t) {
|
|
41
|
+
return null == t || (!(s - t.jh < this.fh) && t.Hh < s);
|
|
42
42
|
}
|
|
43
43
|
mo() {
|
|
44
44
|
const s = new Date().valueOf(),
|
|
45
|
-
t = s + 1e3 * this.
|
|
46
|
-
e = this.h.tu(o.eu.
|
|
47
|
-
if (this.
|
|
45
|
+
t = s + 1e3 * this.ph,
|
|
46
|
+
e = this.h.tu(o.eu.xh);
|
|
47
|
+
if (this.Fh(s, e)) {
|
|
48
48
|
let i = "Generating session start event with time " + s;
|
|
49
49
|
if (null != e) {
|
|
50
|
-
let s = e.
|
|
51
|
-
s - e.
|
|
52
|
-
this.h.
|
|
50
|
+
let s = e.Wh;
|
|
51
|
+
s - e.jh < this.fh && (s = e.jh + this.kh),
|
|
52
|
+
this.h.qh(this.gh(s, e)),
|
|
53
53
|
(i += " (old session ended " + s + ")");
|
|
54
54
|
}
|
|
55
55
|
(i += ". Will expire " + t.valueOf()), r.D.info(i);
|
|
56
56
|
const n = new _t(r.it.nt(), t);
|
|
57
|
-
this.h.
|
|
58
|
-
this.h.
|
|
59
|
-
return null == this.h.I(o.q.
|
|
57
|
+
this.h.qh(new ue(this.v.getUserId(), r.A.yh, s, n.iu)),
|
|
58
|
+
this.h.uu(o.eu.xh, n);
|
|
59
|
+
return null == this.h.I(o.q.Gh) && this.h.B(o.q.Gh, s), n.iu;
|
|
60
60
|
}
|
|
61
|
-
return (e.
|
|
61
|
+
return (e.Wh = s), (e.Hh = t), this.h.uu(o.eu.xh, e), e.iu;
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
const s = this.h.tu(o.eu.
|
|
63
|
+
Bh() {
|
|
64
|
+
const s = this.h.tu(o.eu.xh);
|
|
65
65
|
null != s &&
|
|
66
|
-
(this.h.
|
|
66
|
+
(this.h.Jh(o.eu.xh), this.h.qh(this.gh(new Date().valueOf(), s)));
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import G, { STORAGE_KEYS as o } from "./storage-manager.js";
|
|
2
2
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
3
|
-
const
|
|
4
|
-
|
|
3
|
+
const Dt = {
|
|
4
|
+
Bo: (e, t) => {
|
|
5
5
|
let a = !1;
|
|
6
6
|
try {
|
|
7
7
|
if (localStorage && localStorage.getItem)
|
|
@@ -21,7 +21,7 @@ const Mt = {
|
|
|
21
21
|
} catch (e) {
|
|
22
22
|
r.D.info("Local Storage not supported!");
|
|
23
23
|
}
|
|
24
|
-
const l =
|
|
24
|
+
const l = Dt.Ea(),
|
|
25
25
|
c = new G.wa(e, l && !t, a);
|
|
26
26
|
let n = null;
|
|
27
27
|
return (n = a ? new G._a(e) : new G.Oa()), new G(c, n);
|
|
@@ -32,4 +32,4 @@ const Mt = {
|
|
|
32
32
|
(document.cookie.length > 0 ||
|
|
33
33
|
(document.cookie = "test").indexOf.call(document.cookie, "test") > -1))
|
|
34
34
|
};
|
|
35
|
-
export default
|
|
35
|
+
export default Dt;
|