@braze/web-sdk 6.6.0 → 6.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 +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
|
@@ -2,76 +2,76 @@ import l from "../util/net.js";
|
|
|
2
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
|
-
import { dateFromUnixTimestamp as
|
|
5
|
+
import { dateFromUnixTimestamp as Y } from "../util/date-utils.js";
|
|
6
6
|
import { isURIJavascriptOrData as tt } from "../util/url-utils.js";
|
|
7
7
|
import {
|
|
8
8
|
newCardFromContentCardsJson as st,
|
|
9
9
|
newCardFromSerializedValue as it,
|
|
10
10
|
} from "../Card/util/card-factory.js";
|
|
11
11
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
12
|
-
import
|
|
12
|
+
import f 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 {
|
|
16
|
-
REQUEST_BACKOFF_MAX_SLEEP_MS_DEFAULT as
|
|
17
|
-
REQUEST_BACKOFF_MIN_SLEEP_MS_DEFAULT as
|
|
18
|
-
REQUEST_BACKOFF_SCALE_FACTOR_DEFAULT as
|
|
16
|
+
REQUEST_BACKOFF_MAX_SLEEP_MS_DEFAULT as c,
|
|
17
|
+
REQUEST_BACKOFF_MIN_SLEEP_MS_DEFAULT as d,
|
|
18
|
+
REQUEST_BACKOFF_SCALE_FACTOR_DEFAULT as m,
|
|
19
19
|
} from "../common/constants.js";
|
|
20
20
|
import { logger as E, IndexedDBAdapter as et } from "../../shared-lib/index.js";
|
|
21
|
-
export default class
|
|
21
|
+
export default class rr extends t {
|
|
22
22
|
constructor(t, s, i, e, h) {
|
|
23
23
|
super(),
|
|
24
|
-
(this.
|
|
25
|
-
(this.
|
|
24
|
+
(this.Ss = t),
|
|
25
|
+
(this.C = s),
|
|
26
26
|
(this.h = i),
|
|
27
|
-
(this.
|
|
28
|
-
(this.
|
|
29
|
-
(this.
|
|
30
|
-
(this.
|
|
27
|
+
(this.Ts = e),
|
|
28
|
+
(this.B = h),
|
|
29
|
+
(this.Ss = t),
|
|
30
|
+
(this.C = s),
|
|
31
31
|
(this.h = i),
|
|
32
|
-
(this.
|
|
33
|
-
(this.
|
|
34
|
-
(this.
|
|
35
|
-
r.
|
|
36
|
-
(this.
|
|
37
|
-
(this.
|
|
32
|
+
(this.Ts = e),
|
|
33
|
+
(this.B = h),
|
|
34
|
+
(this.Rs = new f()),
|
|
35
|
+
r.S(this.Rs),
|
|
36
|
+
(this.Us = 0),
|
|
37
|
+
(this.Ns = 0),
|
|
38
38
|
(this.cards = []),
|
|
39
|
-
this.
|
|
40
|
-
const n = et.
|
|
41
|
-
new et(n, E).
|
|
42
|
-
this.
|
|
39
|
+
this.Ms();
|
|
40
|
+
const n = et.Ps.$s;
|
|
41
|
+
new et(n, E).Xs(n.Os._s, (t) => {
|
|
42
|
+
this.Qs(t);
|
|
43
43
|
}),
|
|
44
|
-
(this.
|
|
45
|
-
(this.
|
|
46
|
-
(this.
|
|
47
|
-
(this.
|
|
48
|
-
(this
|
|
44
|
+
(this.Vs = null),
|
|
45
|
+
(this.T = null),
|
|
46
|
+
(this.Ws = null),
|
|
47
|
+
(this.Ys = null),
|
|
48
|
+
(this.Zs = 10);
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
return this.
|
|
50
|
+
fi() {
|
|
51
|
+
return this.Vs;
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
this.
|
|
53
|
+
vi(t) {
|
|
54
|
+
this.Vs = t;
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
return this.
|
|
56
|
+
Lt() {
|
|
57
|
+
return this.T;
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
this.
|
|
59
|
+
$t(t) {
|
|
60
|
+
this.T = t;
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
if (!this.
|
|
64
|
-
const t = this.
|
|
62
|
+
Ms() {
|
|
63
|
+
if (!this.C) return;
|
|
64
|
+
const t = this.C.Rt(s.Tt.Ci) || [],
|
|
65
65
|
i = [];
|
|
66
66
|
for (let s = 0; s < t.length; s++) {
|
|
67
67
|
const e = it(t[s]);
|
|
68
68
|
null != e && i.push(e);
|
|
69
69
|
}
|
|
70
|
-
(this.cards = this.
|
|
71
|
-
(this.
|
|
72
|
-
(this.
|
|
70
|
+
(this.cards = this.bi(this.wi(i, !1))),
|
|
71
|
+
(this.Us = this.C.Rt(s.Tt.gi) || this.Us),
|
|
72
|
+
(this.Ns = this.C.Rt(s.Tt.ji) || this.Ns);
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
yi(t, i = !1, e = 0, h = 0) {
|
|
75
75
|
let r;
|
|
76
76
|
if (i) {
|
|
77
77
|
r = [];
|
|
@@ -100,31 +100,31 @@ export default class Z extends t {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
(this.cards = this.
|
|
104
|
-
this.
|
|
105
|
-
(this.
|
|
106
|
-
(this.
|
|
107
|
-
this.
|
|
103
|
+
(this.cards = this.bi(this.wi(r, i))),
|
|
104
|
+
this.Ri(),
|
|
105
|
+
(this.Us = e),
|
|
106
|
+
(this.Ns = h),
|
|
107
|
+
this.C && (this.C.It(s.Tt.gi, this.Us), this.C.It(s.Tt.ji, this.Ns));
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
if (this.
|
|
111
|
-
this.
|
|
109
|
+
I(t) {
|
|
110
|
+
if (this.Ui() && null != t && t.cards) {
|
|
111
|
+
this.C && this.C.It(s.Tt.ki, r.zi());
|
|
112
112
|
const i = t.full_sync;
|
|
113
|
-
i || this.
|
|
114
|
-
this.
|
|
115
|
-
this.
|
|
113
|
+
i || this.Ms(),
|
|
114
|
+
this.yi(t.cards, i, t.last_full_sync_at, t.last_card_updated_at),
|
|
115
|
+
this.Rs.A(this.qi(!0));
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
|
|
119
|
-
this.
|
|
118
|
+
xi(t) {
|
|
119
|
+
this.Fi(), (this.Ws = t);
|
|
120
120
|
}
|
|
121
|
-
|
|
121
|
+
Qs(t) {
|
|
122
122
|
var s;
|
|
123
|
-
if (!this.
|
|
124
|
-
this.
|
|
123
|
+
if (!this.Ui()) return;
|
|
124
|
+
this.Ms();
|
|
125
125
|
const i = this.cards.slice();
|
|
126
126
|
let e = null;
|
|
127
|
-
e = null === (s = this.
|
|
127
|
+
e = null === (s = this.Ss) || void 0 === s ? void 0 : s.getUserId();
|
|
128
128
|
for (let s = 0; s < t.length; s++)
|
|
129
129
|
if (e === t[s].userId || (null == e && null == t[s].userId)) {
|
|
130
130
|
const e = t[s].card;
|
|
@@ -146,16 +146,16 @@ export default class Z extends t {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
(this.cards = this.
|
|
149
|
+
(this.cards = this.bi(this.wi(i, !1))), this.Ri(), this.Rs.A(this.qi(!0));
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
wi(t, i) {
|
|
152
152
|
let e = {},
|
|
153
153
|
h = {},
|
|
154
154
|
r = {};
|
|
155
|
-
this.
|
|
156
|
-
((e = this.
|
|
157
|
-
(h = this.
|
|
158
|
-
(r = this.
|
|
155
|
+
this.C &&
|
|
156
|
+
((e = this.C.Rt(s.Tt.ns) || {}),
|
|
157
|
+
(h = this.C.Rt(s.Tt.hs) || {}),
|
|
158
|
+
(r = this.C.Rt(s.Tt.us) || {}));
|
|
159
159
|
const n = {},
|
|
160
160
|
o = {},
|
|
161
161
|
l = {};
|
|
@@ -168,20 +168,20 @@ export default class Z extends t {
|
|
|
168
168
|
}
|
|
169
169
|
return (
|
|
170
170
|
i &&
|
|
171
|
-
this.
|
|
172
|
-
(this.
|
|
171
|
+
this.C &&
|
|
172
|
+
(this.C.It(s.Tt.ns, n), this.C.It(s.Tt.hs, o), this.C.It(s.Tt.us, l)),
|
|
173
173
|
t
|
|
174
174
|
);
|
|
175
175
|
}
|
|
176
|
-
|
|
176
|
+
bi(t) {
|
|
177
177
|
const i = [],
|
|
178
178
|
e = new Date();
|
|
179
179
|
let h = {};
|
|
180
|
-
this.
|
|
180
|
+
this.C && (h = this.C.Rt(s.Tt.us) || {});
|
|
181
181
|
let r = !1;
|
|
182
182
|
for (let s = 0; s < t.length; s++) {
|
|
183
183
|
const n = t[s].url;
|
|
184
|
-
if (!this.
|
|
184
|
+
if (!this.Ts && n && tt(n)) {
|
|
185
185
|
E.error(
|
|
186
186
|
`Card with url ${n} will not be displayed because Javascript URLs are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable this card.`,
|
|
187
187
|
);
|
|
@@ -196,94 +196,94 @@ export default class Z extends t {
|
|
|
196
196
|
i && (h[i] = !0), (r = !0);
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
return r && this.
|
|
199
|
+
return r && this.C && this.C.It(s.Tt.us, h), i;
|
|
200
200
|
}
|
|
201
|
-
|
|
201
|
+
Ri() {
|
|
202
202
|
var t;
|
|
203
203
|
const i = [];
|
|
204
|
-
for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].
|
|
205
|
-
null === (t = this.
|
|
204
|
+
for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].qt());
|
|
205
|
+
null === (t = this.C) || void 0 === t || t.It(s.Tt.Ci, i);
|
|
206
206
|
}
|
|
207
|
-
|
|
208
|
-
this.
|
|
207
|
+
Fi() {
|
|
208
|
+
this.Ws && (clearTimeout(this.Ws), (this.Ws = null));
|
|
209
209
|
}
|
|
210
|
-
|
|
210
|
+
lr(t, i, e = !1) {
|
|
211
211
|
var n;
|
|
212
|
-
const o = this.
|
|
213
|
-
|
|
214
|
-
if (!o || !
|
|
215
|
-
if ((e && (h.
|
|
212
|
+
const o = this.B,
|
|
213
|
+
u = this.C;
|
|
214
|
+
if (!o || !u) return void ("function" == typeof i && i());
|
|
215
|
+
if ((e && (h.Li(u, h.it.Ji), this.Fi()), !this.Ui()))
|
|
216
216
|
return void (
|
|
217
217
|
null === (n = this.h) ||
|
|
218
218
|
void 0 === n ||
|
|
219
|
-
n.
|
|
220
|
-
this.
|
|
219
|
+
n.Mi(() => {
|
|
220
|
+
this.lr(t, i, !0);
|
|
221
221
|
})
|
|
222
222
|
);
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
(
|
|
226
|
-
(
|
|
227
|
-
const p = o.
|
|
223
|
+
const f = o.Z({}, !0);
|
|
224
|
+
u.Rt(s.Tt.ki) !== r.zi() && this.$i(),
|
|
225
|
+
(f.last_full_sync_at = this.Us),
|
|
226
|
+
(f.last_card_updated_at = this.Ns);
|
|
227
|
+
const p = o.tt(f, h.it.Ji, e);
|
|
228
228
|
let v = !1;
|
|
229
|
-
o.
|
|
230
|
-
|
|
229
|
+
o.et(
|
|
230
|
+
f,
|
|
231
231
|
(s = -1) => {
|
|
232
|
-
if (this.
|
|
232
|
+
if (this.C) {
|
|
233
233
|
const t = new Date().valueOf();
|
|
234
|
-
h.
|
|
234
|
+
h.nt(this.C, h.it.Ji, t);
|
|
235
235
|
}
|
|
236
236
|
-1 !== s && p.push(["X-Braze-Req-Tokens-Remaining", s.toString()]),
|
|
237
|
-
l.
|
|
238
|
-
url: `${o.
|
|
239
|
-
data:
|
|
237
|
+
l.ot({
|
|
238
|
+
url: `${o.ht()}/content_cards/sync`,
|
|
239
|
+
data: f,
|
|
240
240
|
headers: p,
|
|
241
|
-
|
|
242
|
-
if (!o.
|
|
241
|
+
lt: (s) => {
|
|
242
|
+
if (!o.ut(f, s, p))
|
|
243
243
|
return (v = !0), void ("function" == typeof i && i());
|
|
244
|
-
o.
|
|
244
|
+
o.ct(), this.I(s), (v = !1), "function" == typeof t && t();
|
|
245
245
|
},
|
|
246
246
|
error: (t) => {
|
|
247
|
-
o.
|
|
247
|
+
o.dt(t, "retrieving content cards"),
|
|
248
248
|
(v = !0),
|
|
249
249
|
"function" == typeof i && i();
|
|
250
250
|
},
|
|
251
|
-
|
|
251
|
+
ft: (s, e) => {
|
|
252
252
|
var r, n, l;
|
|
253
|
-
let
|
|
253
|
+
let u;
|
|
254
254
|
if (v) {
|
|
255
255
|
const t =
|
|
256
|
-
(null === (r = this.h) || void 0 === r ? void 0 : r.
|
|
257
|
-
c,
|
|
258
|
-
s =
|
|
259
|
-
(null === (n = this.h) || void 0 === n ? void 0 : n.it()) ||
|
|
256
|
+
(null === (r = this.h) || void 0 === r ? void 0 : r.vt()) ||
|
|
260
257
|
d,
|
|
258
|
+
s =
|
|
259
|
+
(null === (n = this.h) || void 0 === n ? void 0 : n.gt()) ||
|
|
260
|
+
m,
|
|
261
261
|
i =
|
|
262
|
-
(null === (l = this.h) || void 0 === l ? void 0 : l.
|
|
263
|
-
|
|
264
|
-
let e = this.
|
|
265
|
-
(null == e || e < t) && (e = t), (
|
|
262
|
+
(null === (l = this.h) || void 0 === l ? void 0 : l.bt()) ||
|
|
263
|
+
c;
|
|
264
|
+
let e = this.Ys;
|
|
265
|
+
(null == e || e < t) && (e = t), (u = Math.min(i, a(t, e * s)));
|
|
266
266
|
}
|
|
267
|
-
o.
|
|
267
|
+
o.yt(
|
|
268
268
|
e,
|
|
269
269
|
() => {
|
|
270
|
-
this.
|
|
270
|
+
this.lr(t, i, !1);
|
|
271
271
|
},
|
|
272
|
-
h.
|
|
273
|
-
(t) => this.
|
|
274
|
-
() => this.
|
|
275
|
-
|
|
272
|
+
h.it.Ji,
|
|
273
|
+
(t) => this.xi(t),
|
|
274
|
+
() => this.Fi(),
|
|
275
|
+
u,
|
|
276
276
|
);
|
|
277
277
|
},
|
|
278
278
|
});
|
|
279
279
|
},
|
|
280
|
-
h.
|
|
280
|
+
h.it.Ji,
|
|
281
281
|
i,
|
|
282
282
|
);
|
|
283
283
|
}
|
|
284
|
-
|
|
285
|
-
t || this.
|
|
286
|
-
const i = this.
|
|
284
|
+
qi(t) {
|
|
285
|
+
t || this.Ms();
|
|
286
|
+
const i = this.bi(this.cards);
|
|
287
287
|
i.sort((t, s) =>
|
|
288
288
|
t.pinned && !s.pinned
|
|
289
289
|
? -1
|
|
@@ -295,52 +295,52 @@ export default class Z extends t {
|
|
|
295
295
|
? 1
|
|
296
296
|
: 0,
|
|
297
297
|
);
|
|
298
|
-
let e = Math.max(this.
|
|
298
|
+
let e = Math.max(this.Ns || 0, this.Us || 0);
|
|
299
299
|
return (
|
|
300
300
|
0 === e && (e = void 0),
|
|
301
|
-
this.
|
|
302
|
-
new ContentCards(i,
|
|
301
|
+
this.C && this.C.Rt(s.Tt.ji) === this.Ns && void 0 === e && (e = this.Ns),
|
|
302
|
+
new ContentCards(i, Y(e))
|
|
303
303
|
);
|
|
304
304
|
}
|
|
305
|
-
|
|
306
|
-
return this.
|
|
305
|
+
zt(t) {
|
|
306
|
+
return this.Rs.Kt(t);
|
|
307
307
|
}
|
|
308
|
-
|
|
309
|
-
(this.
|
|
310
|
-
(this.
|
|
311
|
-
this.
|
|
308
|
+
$i() {
|
|
309
|
+
(this.Us = 0),
|
|
310
|
+
(this.Ns = 0),
|
|
311
|
+
this.C && (this.C.Qt(s.Tt.gi), this.C.Qt(s.Tt.ji));
|
|
312
312
|
}
|
|
313
313
|
changeUser(t) {
|
|
314
314
|
t ||
|
|
315
315
|
((this.cards = []),
|
|
316
|
-
this.
|
|
317
|
-
this.
|
|
318
|
-
(this.
|
|
319
|
-
this.
|
|
320
|
-
this.
|
|
321
|
-
this.
|
|
322
|
-
this.
|
|
323
|
-
this
|
|
316
|
+
this.Rs.A(new ContentCards(this.cards.slice(), null)),
|
|
317
|
+
this.C &&
|
|
318
|
+
(this.C.Qt(s.Tt.Ci),
|
|
319
|
+
this.C.Qt(s.Tt.ns),
|
|
320
|
+
this.C.Qt(s.Tt.hs),
|
|
321
|
+
this.C.Qt(s.Tt.us))),
|
|
322
|
+
this.Fi(),
|
|
323
|
+
this.$i();
|
|
324
324
|
}
|
|
325
325
|
clearData(t) {
|
|
326
|
-
(this.
|
|
327
|
-
(this.
|
|
326
|
+
(this.Us = 0),
|
|
327
|
+
(this.Ns = 0),
|
|
328
328
|
(this.cards = []),
|
|
329
|
-
this.
|
|
329
|
+
this.Rs.A(new ContentCards(this.cards.slice(), null)),
|
|
330
330
|
t &&
|
|
331
|
-
this.
|
|
332
|
-
(this.
|
|
333
|
-
this.
|
|
334
|
-
this.
|
|
335
|
-
this.
|
|
336
|
-
this.
|
|
337
|
-
this.
|
|
338
|
-
this.
|
|
331
|
+
this.C &&
|
|
332
|
+
(this.C.Qt(s.Tt.Ci),
|
|
333
|
+
this.C.Qt(s.Tt.ns),
|
|
334
|
+
this.C.Qt(s.Tt.hs),
|
|
335
|
+
this.C.Qt(s.Tt.us),
|
|
336
|
+
this.C.Qt(s.Tt.gi),
|
|
337
|
+
this.C.Qt(s.Tt.ji)),
|
|
338
|
+
this.Fi();
|
|
339
339
|
}
|
|
340
|
-
|
|
341
|
-
return !!this.h && (!!this.h.
|
|
340
|
+
Ui() {
|
|
341
|
+
return !!this.h && (!!this.h.Bi() || (0 !== this.h.Ot() && this.Pi(), !1));
|
|
342
342
|
}
|
|
343
|
-
|
|
344
|
-
this.
|
|
343
|
+
Pi() {
|
|
344
|
+
this.Rs.A(new ContentCards([], new Date())), this.C && this.C.Qt(s.Tt.Ci);
|
|
345
345
|
}
|
|
346
346
|
}
|
|
@@ -16,17 +16,17 @@ export default class ContentCards {
|
|
|
16
16
|
for (const t of this.cards) t.viewed || t instanceof ControlCard || r++;
|
|
17
17
|
return r;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
ur(r) {
|
|
20
20
|
logContentCardImpressions(r);
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
cr(r) {
|
|
23
23
|
return logContentCardClick(r);
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
Cr() {
|
|
26
26
|
requestContentCardsRefresh();
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
hr() {
|
|
29
29
|
return !0;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
(ContentCards.
|
|
32
|
+
(ContentCards.mr = 6e4), (ContentCards.gr = 500), (ContentCards.jr = 1e4);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import er from "./content-cards-provider-factory.js";
|
|
2
2
|
import r from "../managers/braze-instance.js";
|
|
3
3
|
export function getCachedContentCards() {
|
|
4
|
-
if (r.rr()) return
|
|
4
|
+
if (r.rr()) return er.o().qi(!1);
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import er from "./content-cards-provider-factory.js";
|
|
3
3
|
export function requestContentCardsRefresh(e, t) {
|
|
4
|
-
if (r.rr()) return
|
|
4
|
+
if (r.rr()) return er.o().lr(e, t, !0);
|
|
5
5
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import er from "./content-cards-provider-factory.js";
|
|
3
3
|
export function subscribeToContentCardsUpdates(o) {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
|
-
const t =
|
|
6
|
-
n = t.
|
|
7
|
-
if (!t.
|
|
5
|
+
const t = er.o(),
|
|
6
|
+
n = t.zt(o);
|
|
7
|
+
if (!t.Lt()) {
|
|
8
8
|
const o = r.nn();
|
|
9
9
|
if (o) {
|
|
10
10
|
const r = o.rn(() => {
|
|
11
|
-
t.
|
|
11
|
+
t.lr(void 0, void 0, !0);
|
|
12
12
|
});
|
|
13
|
-
r && t
|
|
13
|
+
r && t.$t(r);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
return n;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import r, { OPTIONS as
|
|
1
|
+
import r, { OPTIONS as U } from "../../managers/braze-instance.js";
|
|
2
2
|
import { ContentCards, subscribeToContentCardsUpdates } from "../index.js";
|
|
3
|
-
import
|
|
3
|
+
import er from "../content-cards-provider-factory.js";
|
|
4
4
|
import { setCardHeight as tn } from "../../Card/display/card-display.js";
|
|
5
5
|
import { logger as E } from "../../../shared-lib/index.js";
|
|
6
6
|
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
|
-
s =
|
|
21
|
+
const o = r.er(U.tn) || !1,
|
|
22
|
+
s = er.o().qi(!1);
|
|
23
23
|
"function" == typeof t && cn(s, t(s.cards.slice()), s.lastUpdated, null, o);
|
|
24
24
|
const a = on(s, o, e),
|
|
25
|
-
i =
|
|
26
|
-
c = i.
|
|
25
|
+
i = er.o(),
|
|
26
|
+
c = i.fi();
|
|
27
27
|
(null == s.lastUpdated ||
|
|
28
|
-
new Date().valueOf() - s.lastUpdated.valueOf() > ContentCards.
|
|
29
|
-
(null == c || new Date().valueOf() - c > ContentCards.
|
|
28
|
+
new Date().valueOf() - s.lastUpdated.valueOf() > ContentCards.mr) &&
|
|
29
|
+
(null == c || new Date().valueOf() - c > ContentCards.mr) &&
|
|
30
30
|
(E.info(
|
|
31
|
-
`Cached content cards were older than max TTL of ${ContentCards.
|
|
31
|
+
`Cached content cards were older than max TTL of ${ContentCards.mr} ms, requesting an update from the server.`,
|
|
32
32
|
),
|
|
33
33
|
sn(s, a),
|
|
34
|
-
i.
|
|
34
|
+
i.vi(new Date().valueOf()));
|
|
35
35
|
const f = new Date().valueOf(),
|
|
36
36
|
l = 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 g,
|
|
5
5
|
validateValueIsFromEnum as ta,
|
|
6
6
|
} from "../util/code-utils.js";
|
|
7
7
|
import { logger as E } from "../../shared-lib/index.js";
|
|
@@ -9,7 +9,7 @@ export function addSdkMetadata(a) {
|
|
|
9
9
|
if (!aa.rr()) return;
|
|
10
10
|
const t = aa.m();
|
|
11
11
|
if (t) {
|
|
12
|
-
if (!
|
|
12
|
+
if (!g(a))
|
|
13
13
|
return (
|
|
14
14
|
E.error("Cannot set SDK metadata because metadata is not an array."), !1
|
|
15
15
|
);
|
package/src/Core/change-user.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { getByteLength as
|
|
2
|
+
import { getByteLength as ir } from "../util/string-utils.js";
|
|
3
3
|
import { logger as E } from "../../shared-lib/index.js";
|
|
4
4
|
import { User } from "../User/index.js";
|
|
5
|
-
import { validateStandardString as
|
|
5
|
+
import { validateStandardString as tr } from "../util/validation-utils.js";
|
|
6
6
|
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 E.error("changeUser requires a non-empty userId.");
|
|
10
|
-
if (
|
|
10
|
+
if (ir(e) > User.br)
|
|
11
11
|
return void E.error(
|
|
12
|
-
`Rejected user id "${e}" because it is longer than ${User.
|
|
12
|
+
`Rejected user id "${e}" because it is longer than ${User.br} bytes.`,
|
|
13
13
|
);
|
|
14
|
-
if (null != i && !
|
|
14
|
+
if (null != i && !tr(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.vr(), i);
|
|
17
17
|
}
|
package/src/Core/disable-sdk.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import r, { OPTIONS as
|
|
1
|
+
import r, { OPTIONS as U } from "../managers/braze-instance.js";
|
|
2
2
|
import { logger as E, IndexedDBAdapter as et } from "../../shared-lib/index.js";
|
|
3
|
-
import
|
|
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 = r.
|
|
8
|
-
a = new
|
|
9
|
-
i = "This-cookie-will-expire-in-" + a.
|
|
10
|
-
a.store(s.
|
|
11
|
-
const o = et.
|
|
12
|
-
new et(o, E).setItem(o.
|
|
7
|
+
const n = r.er(U.se),
|
|
8
|
+
a = new ne.le(null, !0, n),
|
|
9
|
+
i = "This-cookie-will-expire-in-" + a.me();
|
|
10
|
+
a.store(s.ce, i);
|
|
11
|
+
const o = et.Ps.$s;
|
|
12
|
+
new et(o, E).setItem(o.Os.pe, o.be, !0),
|
|
13
13
|
E.info("disableSDK was called"),
|
|
14
14
|
r.destroy(!1),
|
|
15
|
-
r.
|
|
15
|
+
r.fe(!0);
|
|
16
16
|
}
|
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 E, IndexedDBAdapter as et } from "../../shared-lib/index.js";
|
|
3
|
-
import
|
|
3
|
+
import ne, { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
4
4
|
export function enableSDK() {
|
|
5
|
-
new
|
|
6
|
-
const e = et.
|
|
7
|
-
new et(e, E).
|
|
5
|
+
new ne.le(null, !0).remove(s.ce);
|
|
6
|
+
const e = et.Ps.$s;
|
|
7
|
+
new et(e, E).ge(e.Os.pe, e.be),
|
|
8
8
|
E.info("enableSDK was called"),
|
|
9
9
|
r.destroy(!1),
|
|
10
|
-
r.
|
|
10
|
+
r.fe(!1);
|
|
11
11
|
}
|
package/src/Core/get-user.js
CHANGED