@braze/web-sdk 5.7.0 → 5.8.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 +4 -4
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +23 -23
- package/shared-lib/guid.js +1 -1
- package/shared-lib/indexed-db-adapter.js +21 -21
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +18 -18
- package/src/Banner/banner-provider.js +79 -79
- package/src/Banner/banner.js +9 -9
- package/src/Banner/display/banner-to-html.js +2 -2
- package/src/Banner/get-all-banners.js +3 -4
- package/src/Banner/get-banner.js +11 -11
- package/src/Banner/log-banner-click.js +2 -2
- package/src/Banner/log-banner-impressions.js +4 -4
- package/src/Banner/request-banners-refresh.js +21 -13
- package/src/Banner/subscribe-to-banners-updates.js +14 -13
- package/src/Banner/ui/insert-banner.js +11 -9
- package/src/Card/card-manager.js +35 -35
- package/src/Card/display/card-display.js +8 -8
- package/src/Card/log-card-click.js +1 -1
- package/src/Card/log-card-dismissal.js +1 -1
- package/src/Card/log-card-impressions.js +3 -3
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +92 -92
- 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 +19 -19
- package/src/Card/util/card-factory.js +39 -39
- package/src/ContentCards/content-cards-provider-factory.js +1 -1
- package/src/ContentCards/content-cards-provider.js +142 -142
- package/src/ContentCards/content-cards.js +3 -3
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +4 -4
- package/src/ContentCards/ui/show-content-cards.js +8 -8
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +3 -3
- package/src/Core/disable-sdk.js +7 -7
- package/src/Core/enable-sdk.js +5 -5
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +2 -2
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/is-initialized.js +1 -1
- package/src/Core/log-custom-event.js +5 -5
- package/src/Core/log-purchase.js +4 -4
- package/src/Core/open-session.js +7 -7
- package/src/Core/wipe-data.js +3 -3
- package/src/FeatureFlags/feature-flag-factory.js +10 -10
- package/src/FeatureFlags/feature-flag.js +19 -19
- package/src/FeatureFlags/feature-flags-provider.js +61 -61
- package/src/FeatureFlags/get-all-feature-flags.js +6 -7
- package/src/FeatureFlags/get-feature-flag.js +5 -6
- package/src/FeatureFlags/log-feature-flag-impression.js +4 -4
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/Feed/feed-provider.js +41 -41
- package/src/Feed/feed.js +2 -2
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/log-feed-displayed.js +1 -1
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/subscribe-to-feed-updates.js +1 -1
- package/src/Feed/ui/show-feed.js +5 -5
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +6 -6
- package/src/InAppMessage/display/in-app-message-to-html.js +20 -20
- package/src/InAppMessage/display/modal-utils.js +4 -4
- package/src/InAppMessage/in-app-message-factory.js +7 -7
- package/src/InAppMessage/in-app-message-manager-factory.js +1 -1
- package/src/InAppMessage/in-app-message-manager.js +89 -89
- package/src/InAppMessage/log-in-app-message-button-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-click.js +5 -5
- package/src/InAppMessage/log-in-app-message-html-click.js +7 -7
- package/src/InAppMessage/log-in-app-message-impression.js +2 -2
- package/src/InAppMessage/models/control-message.js +5 -5
- package/src/InAppMessage/models/full-screen-message.js +34 -34
- package/src/InAppMessage/models/html-message.js +20 -20
- package/src/InAppMessage/models/in-app-message-button.js +8 -8
- package/src/InAppMessage/models/in-app-message.js +83 -83
- package/src/InAppMessage/models/modal-message.js +33 -33
- package/src/InAppMessage/models/slide-up-message.js +30 -30
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- 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 +19 -19
- package/src/Push/push-manager-factory.js +8 -8
- package/src/Push/push-manager.js +96 -96
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +19 -19
- package/src/User/user.js +41 -41
- package/src/common/base-feed.js +3 -3
- package/src/common/base-provider.js +1 -1
- package/src/common/event-logger.js +6 -6
- package/src/common/feed-display.js +10 -10
- package/src/l10n/l10n-manager-factory.js +2 -2
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +31 -31
- package/src/managers/braze-instance.js +139 -139
- package/src/managers/device-manager.js +24 -24
- package/src/managers/network-manager.js +151 -151
- package/src/managers/server-config-manager.js +86 -86
- package/src/managers/session-manager.js +38 -38
- package/src/managers/storage-manager-factory.js +12 -12
- package/src/managers/storage-manager.js +96 -96
- package/src/managers/subscription-manager.js +10 -10
- package/src/managers/utils.js +4 -4
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +4 -4
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +12 -12
- package/src/models/push-token.js +8 -8
- package/src/models/request-result.js +3 -3
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +152 -152
- package/src/triggers/models/custom-event-data.js +1 -1
- package/src/triggers/models/custom-event-property-data.js +2 -2
- package/src/triggers/models/filter-set.js +6 -6
- package/src/triggers/models/filter.js +2 -2
- package/src/triggers/models/in-app-message-click-data.js +1 -1
- package/src/triggers/models/purchase-data.js +1 -1
- package/src/triggers/models/purchase-property-data.js +2 -2
- package/src/triggers/models/push-click-data.js +1 -1
- package/src/triggers/models/trigger-condition.js +33 -33
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +11 -11
- package/src/triggers/triggers-provider-factory.js +3 -3
- package/src/triggers/triggers-provider.js +74 -74
- package/src/ui/js/attach-css.js +3 -3
- package/src/ui/js/load-font-awesome.js +2 -2
- package/src/util/base-device-parser.js +3 -3
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +5 -5
- package/src/util/client-hints-parser.js +1 -1
- package/src/util/component-utils.js +1 -1
- package/src/util/dom-utils.js +7 -7
- package/src/util/html-display-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +6 -6
- package/src/util/request-header-utils.js +21 -21
- package/src/util/user-agent-parser.js +1 -1
- package/src/util/validation-utils.js +4 -4
- package/src/util/window-utils.js +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import l from "../util/net.js";
|
|
2
|
-
import
|
|
2
|
+
import t from "../common/base-provider.js";
|
|
3
3
|
import r from "../managers/braze-instance.js";
|
|
4
4
|
import ContentCards from "./content-cards.js";
|
|
5
5
|
import { dateFromUnixTimestamp as O } from "../util/date-utils.js";
|
|
@@ -8,72 +8,72 @@ import {
|
|
|
8
8
|
newCardFromContentCardsJson as Y,
|
|
9
9
|
newCardFromSerializedValue as Z,
|
|
10
10
|
} from "../Card/util/card-factory.js";
|
|
11
|
-
import { STORAGE_KEYS as
|
|
11
|
+
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
12
12
|
import u from "../managers/subscription-manager.js";
|
|
13
13
|
import h from "../util/request-header-utils.js";
|
|
14
14
|
import { randomInclusive as a } from "../util/math.js";
|
|
15
15
|
import { logger as N, IndexedDBAdapter as tt } from "../../shared-lib/index.js";
|
|
16
|
-
export default class Q extends
|
|
16
|
+
export default class Q extends t {
|
|
17
17
|
constructor(t, s, i, e, h) {
|
|
18
18
|
super(),
|
|
19
|
-
(this.
|
|
19
|
+
(this.Cs = t),
|
|
20
20
|
(this.C = s),
|
|
21
21
|
(this.B = i),
|
|
22
|
-
(this.
|
|
22
|
+
(this.Ss = e),
|
|
23
23
|
(this.S = h),
|
|
24
|
-
(this.
|
|
24
|
+
(this.Cs = t),
|
|
25
25
|
(this.C = s),
|
|
26
26
|
(this.B = i),
|
|
27
|
-
(this.
|
|
27
|
+
(this.Ss = e),
|
|
28
28
|
(this.S = h),
|
|
29
|
-
(this.
|
|
30
|
-
r.N(this.
|
|
31
|
-
(this.
|
|
32
|
-
(this
|
|
29
|
+
(this.Ts = new u()),
|
|
30
|
+
r.N(this.Ts),
|
|
31
|
+
(this.Rs = 0),
|
|
32
|
+
(this.Us = 0),
|
|
33
33
|
(this.cards = []),
|
|
34
|
-
this.
|
|
35
|
-
const n = tt.
|
|
36
|
-
new tt(n, N).
|
|
37
|
-
this
|
|
34
|
+
this.Ds();
|
|
35
|
+
const n = tt.Ls.Fs;
|
|
36
|
+
new tt(n, N).Ns(n.Ms.Js, (t) => {
|
|
37
|
+
this.$s(t);
|
|
38
38
|
}),
|
|
39
|
-
(this.
|
|
39
|
+
(this.Es = null),
|
|
40
40
|
(this.k = null),
|
|
41
|
-
(this.
|
|
42
|
-
(this.
|
|
43
|
-
(this.
|
|
41
|
+
(this.Ps = null),
|
|
42
|
+
(this.Xs = null),
|
|
43
|
+
(this._s = 10);
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
return this.
|
|
45
|
+
Gs() {
|
|
46
|
+
return this.Es;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
this.
|
|
48
|
+
Hs(t) {
|
|
49
|
+
this.Es = t;
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
Ct() {
|
|
52
52
|
return this.k;
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
Tt(t) {
|
|
55
55
|
this.k = t;
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
Ds() {
|
|
58
58
|
if (!this.C) return;
|
|
59
|
-
const
|
|
59
|
+
const t = this.C.ft(s.gt.Is) || [],
|
|
60
60
|
i = [];
|
|
61
|
-
for (let
|
|
62
|
-
const e = Z(s
|
|
61
|
+
for (let s = 0; s < t.length; s++) {
|
|
62
|
+
const e = Z(t[s]);
|
|
63
63
|
null != e && i.push(e);
|
|
64
64
|
}
|
|
65
|
-
(this.cards = this.
|
|
66
|
-
(this.
|
|
67
|
-
(this
|
|
65
|
+
(this.cards = this.Ks(this.Os(i, !1))),
|
|
66
|
+
(this.Rs = this.C.ft(s.gt.Qs) || this.Rs),
|
|
67
|
+
(this.Us = this.C.ft(s.gt.Vs) || this.Us);
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
Ws(t, i = !1, e = 0, h = 0) {
|
|
70
70
|
let r;
|
|
71
71
|
if (i) {
|
|
72
72
|
r = [];
|
|
73
73
|
for (const t of this.cards) t.test && r.push(t);
|
|
74
74
|
} else r = this.cards.slice();
|
|
75
|
-
for (let
|
|
76
|
-
const e = s
|
|
75
|
+
for (let s = 0; s < t.length; s++) {
|
|
76
|
+
const e = t[s];
|
|
77
77
|
let h = null;
|
|
78
78
|
for (let t = 0; t < this.cards.length; t++)
|
|
79
79
|
if (e.id === this.cards[t].id) {
|
|
@@ -87,7 +87,7 @@ export default class Q extends s {
|
|
|
87
87
|
const t = Y(e);
|
|
88
88
|
null != t && r.push(t);
|
|
89
89
|
} else {
|
|
90
|
-
if (!h.
|
|
90
|
+
if (!h.ri(e))
|
|
91
91
|
for (let t = 0; t < r.length; t++)
|
|
92
92
|
if (e.id === r[t].id) {
|
|
93
93
|
r.splice(t, 1);
|
|
@@ -95,31 +95,31 @@ export default class Q extends s {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
(this.cards = this.
|
|
99
|
-
this.
|
|
100
|
-
(this.
|
|
101
|
-
(this
|
|
102
|
-
this.C && (this.C.
|
|
98
|
+
(this.cards = this.Ks(this.Os(r, i))),
|
|
99
|
+
this.Ys(),
|
|
100
|
+
(this.Rs = e),
|
|
101
|
+
(this.Us = h),
|
|
102
|
+
this.C && (this.C.Bt(s.gt.Qs, this.Rs), this.C.Bt(s.gt.Vs, this.Us));
|
|
103
103
|
}
|
|
104
|
-
U(
|
|
105
|
-
if (this.
|
|
106
|
-
this.C && this.C.
|
|
107
|
-
const i =
|
|
108
|
-
i || this.
|
|
109
|
-
this.
|
|
110
|
-
this.
|
|
104
|
+
U(t) {
|
|
105
|
+
if (this.Zs() && null != t && t.cards) {
|
|
106
|
+
this.C && this.C.Bt(s.gt.fi, r.di());
|
|
107
|
+
const i = t.full_sync;
|
|
108
|
+
i || this.Ds(),
|
|
109
|
+
this.Ws(t.cards, i, t.last_full_sync_at, t.last_card_updated_at),
|
|
110
|
+
this.Ts.X(this.pi(!0));
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
|
|
114
|
-
this.
|
|
113
|
+
Ci(t) {
|
|
114
|
+
this.bi(), (this.Ps = t);
|
|
115
115
|
}
|
|
116
|
-
|
|
116
|
+
$s(t) {
|
|
117
117
|
var s;
|
|
118
|
-
if (!this.
|
|
119
|
-
this.
|
|
118
|
+
if (!this.Zs()) return;
|
|
119
|
+
this.Ds();
|
|
120
120
|
const i = this.cards.slice();
|
|
121
121
|
let e = null;
|
|
122
|
-
e = null === (s = this.
|
|
122
|
+
e = null === (s = this.Cs) || void 0 === s ? void 0 : s.getUserId();
|
|
123
123
|
for (let s = 0; s < t.length; s++)
|
|
124
124
|
if (e === t[s].userId || (null == e && null == t[s].userId)) {
|
|
125
125
|
const e = t[s].card;
|
|
@@ -133,7 +133,7 @@ export default class Q extends s {
|
|
|
133
133
|
const t = Y(e);
|
|
134
134
|
null != t && i.push(t);
|
|
135
135
|
} else {
|
|
136
|
-
if (!h.
|
|
136
|
+
if (!h.ri(e))
|
|
137
137
|
for (let t = 0; t < i.length; t++)
|
|
138
138
|
if (e.id === i[t].id) {
|
|
139
139
|
i.splice(t, 1);
|
|
@@ -141,135 +141,135 @@ export default class Q extends s {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
(this.cards = this.
|
|
144
|
+
(this.cards = this.Ks(this.Os(i, !1))), this.Ys(), this.Ts.X(this.pi(!0));
|
|
145
145
|
}
|
|
146
|
-
|
|
146
|
+
Os(t, i) {
|
|
147
147
|
let e = {},
|
|
148
148
|
h = {},
|
|
149
149
|
r = {};
|
|
150
150
|
this.C &&
|
|
151
|
-
((e = this.C.
|
|
152
|
-
(h = this.C.
|
|
153
|
-
(r = this.C.
|
|
151
|
+
((e = this.C.ft(s.gt.Kt) || {}),
|
|
152
|
+
(h = this.C.ft(s.gt.Yt) || {}),
|
|
153
|
+
(r = this.C.ft(s.gt.Vt) || {}));
|
|
154
154
|
const n = {},
|
|
155
155
|
o = {},
|
|
156
156
|
l = {};
|
|
157
|
-
for (let
|
|
158
|
-
const i = s
|
|
157
|
+
for (let s = 0; s < t.length; s++) {
|
|
158
|
+
const i = t[s].id;
|
|
159
159
|
i &&
|
|
160
|
-
(e[i] && ((s
|
|
161
|
-
h[i] && ((s
|
|
162
|
-
r[i] && ((s
|
|
160
|
+
(e[i] && ((t[s].clicked = !0), (n[i] = !0)),
|
|
161
|
+
h[i] && ((t[s].viewed = !0), (o[i] = !0)),
|
|
162
|
+
r[i] && ((t[s].dismissed = !0), (l[i] = !0)));
|
|
163
163
|
}
|
|
164
164
|
return (
|
|
165
165
|
i &&
|
|
166
166
|
this.C &&
|
|
167
|
-
(this.C.
|
|
168
|
-
|
|
167
|
+
(this.C.Bt(s.gt.Kt, n), this.C.Bt(s.gt.Yt, o), this.C.Bt(s.gt.Vt, l)),
|
|
168
|
+
t
|
|
169
169
|
);
|
|
170
170
|
}
|
|
171
|
-
|
|
171
|
+
Ks(t) {
|
|
172
172
|
const i = [],
|
|
173
173
|
e = new Date();
|
|
174
174
|
let h = {};
|
|
175
|
-
this.C && (h = this.C.
|
|
175
|
+
this.C && (h = this.C.ft(s.gt.Vt) || {});
|
|
176
176
|
let r = !1;
|
|
177
|
-
for (let
|
|
178
|
-
const n = s
|
|
179
|
-
if (!this.
|
|
177
|
+
for (let s = 0; s < t.length; s++) {
|
|
178
|
+
const n = t[s].url;
|
|
179
|
+
if (!this.Ss && n && X(n)) {
|
|
180
180
|
N.error(
|
|
181
181
|
`Card with url ${n} will not be displayed because Javascript URLs are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable this card.`,
|
|
182
182
|
);
|
|
183
183
|
continue;
|
|
184
184
|
}
|
|
185
|
-
const o = s
|
|
185
|
+
const o = t[s].expiresAt;
|
|
186
186
|
let l = !0;
|
|
187
|
-
if ((null != o && (l = o >= e), (l = l && !s
|
|
188
|
-
i.push(s
|
|
187
|
+
if ((null != o && (l = o >= e), (l = l && !t[s].dismissed), l))
|
|
188
|
+
i.push(t[s]);
|
|
189
189
|
else {
|
|
190
|
-
const i = s
|
|
190
|
+
const i = t[s].id;
|
|
191
191
|
i && (h[i] = !0), (r = !0);
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
return r && this.C && this.C.
|
|
194
|
+
return r && this.C && this.C.Bt(s.gt.Vt, h), i;
|
|
195
195
|
}
|
|
196
|
-
|
|
197
|
-
var
|
|
196
|
+
Ys() {
|
|
197
|
+
var t;
|
|
198
198
|
const i = [];
|
|
199
|
-
for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].
|
|
200
|
-
null === (
|
|
199
|
+
for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].bt());
|
|
200
|
+
null === (t = this.C) || void 0 === t || t.Bt(s.gt.Is, i);
|
|
201
201
|
}
|
|
202
|
-
|
|
203
|
-
this.
|
|
202
|
+
bi() {
|
|
203
|
+
this.Ps && (clearTimeout(this.Ps), (this.Ps = null));
|
|
204
204
|
}
|
|
205
|
-
|
|
205
|
+
vi(t, i, e = !1) {
|
|
206
206
|
var n;
|
|
207
207
|
const o = this.S,
|
|
208
208
|
u = this.C;
|
|
209
209
|
if (!o || !u) return void ("function" == typeof i && i());
|
|
210
|
-
if ((e && (h.
|
|
210
|
+
if ((e && (h.wi(u, h.O.gi), this.bi()), !this.Zs()))
|
|
211
211
|
return void (
|
|
212
212
|
null === (n = this.B) ||
|
|
213
213
|
void 0 === n ||
|
|
214
|
-
n.
|
|
215
|
-
this.
|
|
214
|
+
n.ji(() => {
|
|
215
|
+
this.vi(t, i, !0);
|
|
216
216
|
})
|
|
217
217
|
);
|
|
218
218
|
const c = o.H({}, !0);
|
|
219
|
-
u.
|
|
220
|
-
(c.last_full_sync_at = this.
|
|
221
|
-
(c.last_card_updated_at = this
|
|
222
|
-
const f = o.J(c, h.O.
|
|
219
|
+
u.ft(s.gt.fi) !== r.di() && this.yi(),
|
|
220
|
+
(c.last_full_sync_at = this.Rs),
|
|
221
|
+
(c.last_card_updated_at = this.Us);
|
|
222
|
+
const f = o.J(c, h.O.gi, e);
|
|
223
223
|
let d = !1;
|
|
224
224
|
o.V(
|
|
225
225
|
c,
|
|
226
|
-
(
|
|
226
|
+
(s = -1) => {
|
|
227
227
|
if (this.C) {
|
|
228
228
|
const t = new Date().valueOf();
|
|
229
|
-
h.W(this.C, h.O.
|
|
229
|
+
h.W(this.C, h.O.gi, t);
|
|
230
230
|
}
|
|
231
|
-
-1 !==
|
|
231
|
+
-1 !== s && f.push(["X-Braze-Req-Tokens-Remaining", s.toString()]),
|
|
232
232
|
l.Y({
|
|
233
233
|
url: `${o.Z()}/content_cards/sync`,
|
|
234
234
|
data: c,
|
|
235
235
|
headers: f,
|
|
236
|
-
|
|
237
|
-
if (!o.
|
|
236
|
+
tt: (s) => {
|
|
237
|
+
if (!o.st(c, s, f))
|
|
238
238
|
return (d = !0), void ("function" == typeof i && i());
|
|
239
|
-
o.
|
|
239
|
+
o.it(), this.U(s), (d = !1), "function" == typeof t && t();
|
|
240
240
|
},
|
|
241
241
|
error: (t) => {
|
|
242
|
-
o.
|
|
242
|
+
o.et(t, "retrieving content cards"),
|
|
243
243
|
(d = !0),
|
|
244
244
|
"function" == typeof i && i();
|
|
245
245
|
},
|
|
246
|
-
|
|
246
|
+
nt: (s, e) => {
|
|
247
247
|
let r;
|
|
248
248
|
if (d) {
|
|
249
|
-
let t = this.
|
|
250
|
-
(null == t || t < 1e3 * this.
|
|
251
|
-
(r = Math.min(3e5, a(1e3 * this.
|
|
249
|
+
let t = this.Xs;
|
|
250
|
+
(null == t || t < 1e3 * this._s) && (t = 1e3 * this._s),
|
|
251
|
+
(r = Math.min(3e5, a(1e3 * this._s, 3 * t)));
|
|
252
252
|
}
|
|
253
|
-
o.
|
|
253
|
+
o.rt(
|
|
254
254
|
e,
|
|
255
255
|
() => {
|
|
256
|
-
this.
|
|
256
|
+
this.vi(t, i, !1);
|
|
257
257
|
},
|
|
258
|
-
h.O.
|
|
259
|
-
(t) => this.
|
|
260
|
-
() => this.
|
|
258
|
+
h.O.gi,
|
|
259
|
+
(t) => this.Ci(t),
|
|
260
|
+
() => this.bi(),
|
|
261
261
|
r,
|
|
262
262
|
);
|
|
263
263
|
},
|
|
264
264
|
});
|
|
265
265
|
},
|
|
266
|
-
h.O.
|
|
266
|
+
h.O.gi,
|
|
267
267
|
i,
|
|
268
268
|
);
|
|
269
269
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
const i = this.
|
|
270
|
+
pi(t) {
|
|
271
|
+
t || this.Ds();
|
|
272
|
+
const i = this.Ks(this.cards);
|
|
273
273
|
i.sort((t, s) =>
|
|
274
274
|
t.pinned && !s.pinned
|
|
275
275
|
? -1
|
|
@@ -281,50 +281,50 @@ export default class Q extends s {
|
|
|
281
281
|
? 1
|
|
282
282
|
: 0,
|
|
283
283
|
);
|
|
284
|
-
let e = Math.max(this
|
|
284
|
+
let e = Math.max(this.Us || 0, this.Rs || 0);
|
|
285
285
|
return (
|
|
286
286
|
0 === e && (e = void 0),
|
|
287
|
-
this.C && this.C.
|
|
287
|
+
this.C && this.C.ft(s.gt.Vs) === this.Us && void 0 === e && (e = this.Us),
|
|
288
288
|
new ContentCards(i, O(e))
|
|
289
289
|
);
|
|
290
290
|
}
|
|
291
|
-
|
|
292
|
-
return this.
|
|
291
|
+
qt(t) {
|
|
292
|
+
return this.Ts.Ft(t);
|
|
293
293
|
}
|
|
294
|
-
|
|
295
|
-
(this.
|
|
296
|
-
(this
|
|
297
|
-
this.C && (this.C.
|
|
294
|
+
yi() {
|
|
295
|
+
(this.Rs = 0),
|
|
296
|
+
(this.Us = 0),
|
|
297
|
+
this.C && (this.C.Ut(s.gt.Qs), this.C.Ut(s.gt.Vs));
|
|
298
298
|
}
|
|
299
|
-
changeUser(
|
|
300
|
-
|
|
299
|
+
changeUser(t) {
|
|
300
|
+
t ||
|
|
301
301
|
((this.cards = []),
|
|
302
|
-
this.
|
|
302
|
+
this.Ts.X(new ContentCards(this.cards.slice(), null)),
|
|
303
303
|
this.C &&
|
|
304
|
-
(this.C.
|
|
305
|
-
this.C.
|
|
306
|
-
this.C.
|
|
307
|
-
this.C.
|
|
308
|
-
this.
|
|
304
|
+
(this.C.Ut(s.gt.Is),
|
|
305
|
+
this.C.Ut(s.gt.Kt),
|
|
306
|
+
this.C.Ut(s.gt.Yt),
|
|
307
|
+
this.C.Ut(s.gt.Vt))),
|
|
308
|
+
this.yi();
|
|
309
309
|
}
|
|
310
|
-
clearData(
|
|
311
|
-
(this.
|
|
312
|
-
(this
|
|
310
|
+
clearData(t) {
|
|
311
|
+
(this.Rs = 0),
|
|
312
|
+
(this.Us = 0),
|
|
313
313
|
(this.cards = []),
|
|
314
|
-
this.
|
|
315
|
-
|
|
314
|
+
this.Ts.X(new ContentCards(this.cards.slice(), null)),
|
|
315
|
+
t &&
|
|
316
316
|
this.C &&
|
|
317
|
-
(this.C.
|
|
318
|
-
this.C.
|
|
319
|
-
this.C.
|
|
320
|
-
this.C.
|
|
321
|
-
this.C.
|
|
322
|
-
this.C.
|
|
317
|
+
(this.C.Ut(s.gt.Is),
|
|
318
|
+
this.C.Ut(s.gt.Kt),
|
|
319
|
+
this.C.Ut(s.gt.Yt),
|
|
320
|
+
this.C.Ut(s.gt.Vt),
|
|
321
|
+
this.C.Ut(s.gt.Qs),
|
|
322
|
+
this.C.Ut(s.gt.Vs));
|
|
323
323
|
}
|
|
324
|
-
|
|
325
|
-
return !!this.B && (!!this.B.
|
|
324
|
+
Zs() {
|
|
325
|
+
return !!this.B && (!!this.B.Ri() || (0 !== this.B.Et() && this.Ui(), !1));
|
|
326
326
|
}
|
|
327
|
-
|
|
328
|
-
this.
|
|
327
|
+
Ui() {
|
|
328
|
+
this.Ts.X(new ContentCards([], new Date())), this.C && this.C.Ut(s.gt.Is);
|
|
329
329
|
}
|
|
330
330
|
}
|
|
@@ -14,11 +14,11 @@ export default class ContentCards extends rr {
|
|
|
14
14
|
logCardClick(r) {
|
|
15
15
|
return logCardClick(r, !0);
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
sr() {
|
|
18
18
|
requestContentCardsRefresh();
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
nr() {
|
|
21
21
|
return !0;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
ContentCards.
|
|
24
|
+
ContentCards.dr = 6e4;
|
|
@@ -3,14 +3,14 @@ import W from "./content-cards-provider-factory.js";
|
|
|
3
3
|
export function subscribeToContentCardsUpdates(o) {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
5
|
const t = W.m(),
|
|
6
|
-
n = t.
|
|
7
|
-
if (!t.
|
|
6
|
+
n = t.qt(o);
|
|
7
|
+
if (!t.Ct()) {
|
|
8
8
|
const o = r.nn();
|
|
9
9
|
if (o) {
|
|
10
10
|
const r = o.rn(() => {
|
|
11
|
-
t.
|
|
11
|
+
t.vi(void 0, void 0, !0);
|
|
12
12
|
});
|
|
13
|
-
r && t.
|
|
13
|
+
r && t.Tt(r);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
return n;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import r, { OPTIONS as
|
|
1
|
+
import r, { OPTIONS as w } from "../../managers/braze-instance.js";
|
|
2
2
|
import { ContentCards, subscribeToContentCardsUpdates } from "../index.js";
|
|
3
3
|
import W from "../content-cards-provider-factory.js";
|
|
4
4
|
import {
|
|
@@ -18,20 +18,20 @@ export function showContentCards(n, t) {
|
|
|
18
18
|
fn();
|
|
19
19
|
let e = !1;
|
|
20
20
|
null == n && ((n = document.body), (e = !0));
|
|
21
|
-
const o = r.
|
|
22
|
-
i = W.m().
|
|
21
|
+
const o = r.ee(w.tn) || r.ee(w.en) || !1,
|
|
22
|
+
i = W.m().pi(!1);
|
|
23
23
|
"function" == typeof t && an(i, t(i.cards.slice()), i.lastUpdated, null, o);
|
|
24
24
|
const a = tn(i, o, e),
|
|
25
25
|
s = W.m(),
|
|
26
|
-
f = s.
|
|
26
|
+
f = s.Gs();
|
|
27
27
|
(null == i.lastUpdated ||
|
|
28
|
-
new Date().valueOf() - i.lastUpdated.valueOf() > ContentCards.
|
|
29
|
-
(null == f || new Date().valueOf() - f > ContentCards.
|
|
28
|
+
new Date().valueOf() - i.lastUpdated.valueOf() > ContentCards.dr) &&
|
|
29
|
+
(null == f || new Date().valueOf() - f > ContentCards.dr) &&
|
|
30
30
|
(N.info(
|
|
31
|
-
`Cached content cards were older than max TTL of ${ContentCards.
|
|
31
|
+
`Cached content cards were older than max TTL of ${ContentCards.dr} ms, requesting an update from the server.`,
|
|
32
32
|
),
|
|
33
33
|
on(i, a),
|
|
34
|
-
s.
|
|
34
|
+
s.Hs(new Date().valueOf()));
|
|
35
35
|
const l = new Date().valueOf(),
|
|
36
36
|
c = subscribeToContentCardsUpdates(function (n) {
|
|
37
37
|
const e = a.querySelectorAll(".ab-refresh-button")[0];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import aa from "../managers/braze-instance.js";
|
|
2
2
|
import BrazeSdkMetadata from "./braze-sdk-metadata.js";
|
|
3
3
|
import {
|
|
4
|
-
isArray as
|
|
4
|
+
isArray as z,
|
|
5
5
|
validateValueIsFromEnum as ta,
|
|
6
6
|
} from "../util/code-utils.js";
|
|
7
7
|
import { logger as N } from "../../shared-lib/index.js";
|
|
@@ -9,7 +9,7 @@ export function addSdkMetadata(a) {
|
|
|
9
9
|
if (!aa.rr()) return;
|
|
10
10
|
const t = aa.g();
|
|
11
11
|
if (t) {
|
|
12
|
-
if (!
|
|
12
|
+
if (!z(a))
|
|
13
13
|
return (
|
|
14
14
|
N.error("Cannot set SDK metadata because metadata is not an array."), !1
|
|
15
15
|
);
|
package/src/Core/change-user.js
CHANGED
|
@@ -7,11 +7,11 @@ export function changeUser(e, i) {
|
|
|
7
7
|
if (!r.rr()) return;
|
|
8
8
|
if (null == e || 0 === e.length || e != e)
|
|
9
9
|
return void N.error("changeUser requires a non-empty userId.");
|
|
10
|
-
if (er(e) > User.
|
|
10
|
+
if (er(e) > User.ur)
|
|
11
11
|
return void N.error(
|
|
12
|
-
`Rejected user id "${e}" because it is longer than ${User.
|
|
12
|
+
`Rejected user id "${e}" because it is longer than ${User.ur} bytes.`,
|
|
13
13
|
);
|
|
14
14
|
if (null != i && !ir(i, "set signature for new user", "signature")) return;
|
|
15
15
|
const t = r.nn();
|
|
16
|
-
t && t.changeUser(e.toString(), r.
|
|
16
|
+
t && t.changeUser(e.toString(), r.ar(), i);
|
|
17
17
|
}
|
package/src/Core/disable-sdk.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
2
|
import { logger as N, IndexedDBAdapter as tt } from "../../shared-lib/index.js";
|
|
3
|
-
import ne, { STORAGE_KEYS as
|
|
3
|
+
import ne, { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
4
4
|
export function disableSDK() {
|
|
5
5
|
const e = r.nn();
|
|
6
6
|
e && e.requestImmediateDataFlush();
|
|
7
|
-
const n = new ne.
|
|
8
|
-
|
|
9
|
-
n.store(
|
|
10
|
-
const
|
|
11
|
-
new tt(
|
|
7
|
+
const n = new ne.se(null, !0),
|
|
8
|
+
a = "This-cookie-will-expire-in-" + n.le();
|
|
9
|
+
n.store(s.me, a);
|
|
10
|
+
const i = tt.Ls.Fs;
|
|
11
|
+
new tt(i, N).setItem(i.Ms.pe, i.be, !0),
|
|
12
12
|
N.info("disableSDK was called"),
|
|
13
13
|
r.destroy(!1),
|
|
14
|
-
r.
|
|
14
|
+
r.fe(!0);
|
|
15
15
|
}
|
package/src/Core/enable-sdk.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
2
|
import { logger as N, IndexedDBAdapter as tt } from "../../shared-lib/index.js";
|
|
3
|
-
import ne, { STORAGE_KEYS as
|
|
3
|
+
import ne, { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
4
4
|
export function enableSDK() {
|
|
5
|
-
new ne.
|
|
6
|
-
const e = tt.
|
|
7
|
-
new tt(e, N).
|
|
5
|
+
new ne.se(null, !0).remove(s.me);
|
|
6
|
+
const e = tt.Ls.Fs;
|
|
7
|
+
new tt(e, N).ge(e.Ms.pe, e.be),
|
|
8
8
|
N.info("enableSDK was called"),
|
|
9
9
|
r.destroy(!1),
|
|
10
|
-
r.
|
|
10
|
+
r.fe(!1);
|
|
11
11
|
}
|
|
@@ -2,9 +2,9 @@ import r from "../managers/braze-instance.js";
|
|
|
2
2
|
import { logger as N } from "../../shared-lib/index.js";
|
|
3
3
|
export function getDeviceId(e) {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
|
-
const t = r.
|
|
5
|
+
const t = r.ue();
|
|
6
6
|
if (!t) return;
|
|
7
|
-
const i = t.
|
|
7
|
+
const i = t.ve().id;
|
|
8
8
|
if ("function" != typeof e) return i;
|
|
9
9
|
N.warn(
|
|
10
10
|
"The callback for getDeviceId is deprecated. You can access its return value directly instead (e.g. `const id = braze.getDeviceId()`)",
|
package/src/Core/get-user.js
CHANGED
|
@@ -41,7 +41,7 @@ export function _handleBrazeAction(o, e, s) {
|
|
|
41
41
|
case oo.types.logCustomEvent:
|
|
42
42
|
import("./log-custom-event.js").then(
|
|
43
43
|
({ logCustomEvent: logCustomEvent }) => {
|
|
44
|
-
r.
|
|
44
|
+
r._t()
|
|
45
45
|
? ((t = Array.prototype.slice.call(e)),
|
|
46
46
|
logCustomEvent(...t))
|
|
47
47
|
: N.error(p);
|
|
@@ -51,7 +51,7 @@ export function _handleBrazeAction(o, e, s) {
|
|
|
51
51
|
case oo.types.requestPushPermission:
|
|
52
52
|
import("../Push/request-push-permission.js").then(
|
|
53
53
|
({ requestPushPermission: requestPushPermission }) => {
|
|
54
|
-
r.
|
|
54
|
+
r._t()
|
|
55
55
|
? "Safari" === ro.browser && ro.OS === so.ao
|
|
56
56
|
? window.navigator.standalone && requestPushPermission()
|
|
57
57
|
: requestPushPermission()
|