@braze/web-sdk 4.8.3 → 4.9.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 +121 -6
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +7 -7
- package/shared-lib/encoding-utils.js +4 -4
- package/shared-lib/event-types.js +22 -21
- package/shared-lib/guid.js +7 -7
- package/shared-lib/indexed-db-adapter.js +172 -135
- package/shared-lib/logger.js +26 -26
- package/shared-lib/supported-options.js +15 -15
- package/shared-lib/types.js +1 -0
- package/src/Card/card-manager-factory.js +1 -1
- package/src/Card/card-manager.js +2 -2
- package/src/Card/display/card-display.js +5 -4
- package/src/Card/models/banner.js +10 -10
- package/src/Card/models/captioned-image.js +7 -7
- package/src/Card/models/card.js +37 -36
- package/src/Card/models/classic-card.js +7 -7
- package/src/Card/models/control-card.js +3 -3
- package/src/Card/models/image-only.js +32 -0
- package/src/Card/models/index.js +1 -0
- package/src/Card/util/card-factory.js +16 -16
- package/src/ContentCards/content-cards-provider-factory.js +1 -1
- package/src/ContentCards/content-cards-provider.js +102 -102
- 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 +15 -12
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/braze-sdk-metadata.js +1 -1
- package/src/Core/change-user.js +1 -1
- package/src/Core/device-properties.js +1 -1
- package/src/Core/disable-sdk.js +10 -7
- package/src/Core/enable-sdk.js +5 -2
- package/src/Core/get-device-id.js +3 -3
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +14 -14
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +4 -4
- package/src/Core/log-purchase.js +9 -9
- package/src/Core/open-session.js +10 -10
- package/src/FeatureFlags/feature-flag-factory.js +5 -3
- package/src/FeatureFlags/feature-flag.js +17 -14
- package/src/FeatureFlags/feature-flags-provider-factory.js +1 -1
- package/src/FeatureFlags/feature-flags-provider.js +56 -43
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/index.js +1 -0
- package/src/FeatureFlags/log-feature-flag-impression.js +23 -0
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
- package/src/Feed/feed-provider-factory.js +1 -1
- package/src/Feed/feed-provider.js +20 -20
- 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 +13 -10
- package/src/InAppMessage/defer-in-app-message.js +13 -0
- package/src/InAppMessage/display/get-animation-effect.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +47 -47
- package/src/InAppMessage/display/in-app-message-to-html.js +92 -91
- package/src/InAppMessage/display/modal-utils.js +16 -16
- package/src/InAppMessage/get-deferred-in-app-message.js +5 -0
- package/src/InAppMessage/in-app-message-factory.js +77 -57
- package/src/InAppMessage/in-app-message-manager-factory.js +6 -6
- package/src/InAppMessage/in-app-message-manager.js +121 -82
- package/src/InAppMessage/index.js +2 -0
- package/src/InAppMessage/log-in-app-message-button-click.js +17 -9
- package/src/InAppMessage/log-in-app-message-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-html-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-impression.js +3 -3
- package/src/InAppMessage/models/full-screen-message.js +65 -29
- package/src/InAppMessage/models/html-message.js +32 -13
- package/src/InAppMessage/models/in-app-message-button.js +7 -7
- package/src/InAppMessage/models/in-app-message.js +203 -134
- package/src/InAppMessage/models/modal-message.js +64 -29
- package/src/InAppMessage/models/slide-up-message.js +52 -24
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +6 -6
- package/src/InAppMessage/ui/show-in-app-message.js +49 -47
- package/src/InAppMessage/utils/in-app-message-utils.js +1 -1
- 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 +19 -19
- package/src/Push/push-manager.js +131 -131
- package/src/Push/request-push-permission.js +2 -2
- package/src/Push/unregister-push.js +2 -2
- package/src/Push/utils/push-utils.js +12 -10
- package/src/User/user-manager.js +4 -4
- package/src/User/user.js +57 -57
- package/src/common/base-feed.js +1 -1
- package/src/common/constants.js +1 -0
- package/src/common/event-logger.js +6 -6
- package/src/common/feed-display.js +34 -34
- package/src/common/translations.js +33 -33
- package/src/l10n/l10n-manager-factory.js +8 -8
- package/src/l10n/l10n-manager.js +6 -2
- package/src/l10n/types.js +1 -0
- package/src/managers/auth-manager.js +29 -29
- package/src/managers/braze-instance.js +125 -125
- package/src/managers/device-manager.js +20 -20
- package/src/managers/network-manager.js +100 -98
- package/src/managers/server-config-manager.js +23 -23
- package/src/managers/session-manager.js +5 -5
- package/src/managers/storage-manager-factory.js +9 -9
- package/src/managers/storage-manager.js +132 -129
- package/src/managers/subscription-manager.js +8 -8
- package/src/models/backend-errors.js +6 -6
- package/src/models/braze-event.js +11 -11
- package/src/models/braze-sdk-metadata.js +1 -1
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +1 -1
- package/src/models/push-token.js +5 -5
- package/src/models/server-config.js +7 -7
- package/src/request-controller.js +191 -178
- package/src/triggers/models/custom-event-data.js +4 -4
- package/src/triggers/models/custom-event-property-data.js +7 -7
- package/src/triggers/models/filter-set.js +5 -5
- package/src/triggers/models/filter.js +64 -60
- package/src/triggers/models/in-app-message-click-data.js +9 -9
- package/src/triggers/models/purchase-data.js +4 -4
- package/src/triggers/models/purchase-property-data.js +6 -6
- package/src/triggers/models/push-click-data.js +6 -6
- package/src/triggers/models/trigger-condition.js +55 -59
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +47 -35
- package/src/triggers/triggers-provider-factory.js +10 -6
- package/src/triggers/triggers-provider.js +203 -185
- package/src/triggers/types.js +1 -0
- package/src/ui/js/attach-css.js +5 -4
- package/src/ui/js/feed-css.js +5 -5
- package/src/ui/js/iam-css.js +5 -5
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +1 -1
- package/src/util/braze-actions.js +35 -30
- package/src/util/browser-detector.js +30 -31
- package/src/util/client-hints-parser.js +30 -24
- package/src/util/code-utils.js +22 -21
- package/src/util/color-utils.js +19 -13
- package/src/util/component-utils.js +4 -4
- package/src/util/date-utils.js +4 -3
- package/src/util/device-constants.js +10 -10
- package/src/util/dom-utils.js +32 -28
- package/src/util/error-utils.js +1 -1
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +53 -57
- package/src/util/request-header-utils.js +34 -11
- package/src/util/string-utils.js +14 -14
- package/src/util/types.js +1 -0
- package/src/util/url-utils.js +1 -4
- package/src/util/user-agent-parser.js +39 -39
- package/src/util/validation-utils.js +32 -32
- package/src/util/window-utils.js +11 -12
|
@@ -1,27 +1,35 @@
|
|
|
1
|
-
export default class
|
|
1
|
+
export default class Oe {
|
|
2
2
|
constructor(t, e) {
|
|
3
|
-
(this.
|
|
4
|
-
(this.
|
|
5
|
-
(this.
|
|
3
|
+
(this.database = t),
|
|
4
|
+
(this.j = e),
|
|
5
|
+
(this.parent = "undefined" == typeof window ? self : window),
|
|
6
|
+
(this.database = t),
|
|
7
|
+
(this.j = e);
|
|
6
8
|
}
|
|
7
|
-
|
|
8
|
-
if ("indexedDB" in this.
|
|
9
|
+
td() {
|
|
10
|
+
if ("indexedDB" in this.parent) return this.parent.indexedDB;
|
|
9
11
|
}
|
|
10
|
-
|
|
12
|
+
isSupported() {
|
|
13
|
+
var t;
|
|
11
14
|
try {
|
|
12
|
-
if (null == this.
|
|
15
|
+
if (null == this.td()) return !1;
|
|
13
16
|
{
|
|
14
|
-
const
|
|
17
|
+
const e =
|
|
18
|
+
null === (t = this.td()) || void 0 === t
|
|
19
|
+
? void 0
|
|
20
|
+
: t.open("Braze IndexedDB Support Test");
|
|
15
21
|
if (
|
|
16
|
-
(
|
|
17
|
-
|
|
22
|
+
(e &&
|
|
23
|
+
((e.onupgradeneeded = () => e.result.close()),
|
|
24
|
+
(e.onsuccess = () => e.result.close())),
|
|
18
25
|
"undefined" != typeof window)
|
|
19
26
|
) {
|
|
20
|
-
const t = window
|
|
21
|
-
|
|
27
|
+
const t = window,
|
|
28
|
+
e = t.chrome || t.browser || t.ed;
|
|
29
|
+
if (e && e.runtime && e.runtime.id)
|
|
22
30
|
return (
|
|
23
|
-
this.
|
|
24
|
-
"Not using IndexedDB for storage because we are running inside an extension"
|
|
31
|
+
this.j.info(
|
|
32
|
+
"Not using IndexedDB for storage because we are running inside an extension",
|
|
25
33
|
),
|
|
26
34
|
!1
|
|
27
35
|
);
|
|
@@ -30,85 +38,101 @@ export default class Ae {
|
|
|
30
38
|
}
|
|
31
39
|
} catch (t) {
|
|
32
40
|
return (
|
|
33
|
-
this.
|
|
34
|
-
"Not using IndexedDB for storage due to following error: " + t
|
|
41
|
+
this.j.info(
|
|
42
|
+
"Not using IndexedDB for storage due to following error: " + t,
|
|
35
43
|
),
|
|
36
44
|
!1
|
|
37
45
|
);
|
|
38
46
|
}
|
|
39
47
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
nd(t, e) {
|
|
49
|
+
var n;
|
|
50
|
+
const o =
|
|
51
|
+
null === (n = this.td()) || void 0 === n
|
|
52
|
+
? void 0
|
|
53
|
+
: n.open(this.database.od, this.database.VERSION);
|
|
54
|
+
if (null == o) return "function" == typeof e && e(), !1;
|
|
55
|
+
const i = this;
|
|
44
56
|
return (
|
|
45
|
-
(
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
(o.onupgradeneeded = (t) => {
|
|
58
|
+
var e;
|
|
59
|
+
i.j.info(
|
|
60
|
+
"Upgrading indexedDB " +
|
|
61
|
+
i.database.od +
|
|
62
|
+
" to v" +
|
|
63
|
+
i.database.VERSION +
|
|
64
|
+
"...",
|
|
48
65
|
);
|
|
49
|
-
const e = t.target.result;
|
|
50
|
-
for (const t in
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
66
|
+
const n = null === (e = t.target) || void 0 === e ? void 0 : e.result;
|
|
67
|
+
for (const t in i.database.Jt) {
|
|
68
|
+
const e = t;
|
|
69
|
+
i.database.Jt.hasOwnProperty(t) &&
|
|
70
|
+
!n.objectStoreNames.contains(i.database.Jt[e]) &&
|
|
71
|
+
n.createObjectStore(i.database.Jt[e]);
|
|
72
|
+
}
|
|
54
73
|
}),
|
|
55
|
-
(
|
|
56
|
-
|
|
57
|
-
(
|
|
58
|
-
|
|
74
|
+
(o.onsuccess = (n) => {
|
|
75
|
+
var o;
|
|
76
|
+
const r = null === (o = n.target) || void 0 === o ? void 0 : o.result;
|
|
77
|
+
(r.onversionchange = () => {
|
|
78
|
+
r.close(),
|
|
59
79
|
"function" == typeof e && e(),
|
|
60
|
-
|
|
61
|
-
"Needed to close the database unexpectedly because of an upgrade in another tab"
|
|
80
|
+
i.j.error(
|
|
81
|
+
"Needed to close the database unexpectedly because of an upgrade in another tab",
|
|
62
82
|
);
|
|
63
83
|
}),
|
|
64
|
-
t(
|
|
84
|
+
t(r);
|
|
85
|
+
}),
|
|
86
|
+
(o.onerror = (t) => {
|
|
87
|
+
var n;
|
|
88
|
+
const o = t;
|
|
89
|
+
return (
|
|
90
|
+
i.j.info(
|
|
91
|
+
"Could not open indexedDB " +
|
|
92
|
+
i.database.od +
|
|
93
|
+
" v" +
|
|
94
|
+
i.database.VERSION +
|
|
95
|
+
": " +
|
|
96
|
+
(null === (n = o.target) || void 0 === n ? void 0 : n.errorCode),
|
|
97
|
+
),
|
|
98
|
+
"function" == typeof e && e(),
|
|
99
|
+
!0
|
|
100
|
+
);
|
|
65
101
|
}),
|
|
66
|
-
(n.onerror = t => (
|
|
67
|
-
o.sd.info(
|
|
68
|
-
"Could not open indexedDB " +
|
|
69
|
-
o.od.ad +
|
|
70
|
-
" v" +
|
|
71
|
-
o.od.VERSION +
|
|
72
|
-
": " +
|
|
73
|
-
t.target.errorCode
|
|
74
|
-
),
|
|
75
|
-
"function" == typeof e && e(),
|
|
76
|
-
!0
|
|
77
|
-
)),
|
|
78
102
|
!0
|
|
79
103
|
);
|
|
80
104
|
}
|
|
81
105
|
setItem(t, e, n, o, i) {
|
|
82
|
-
if (!this.
|
|
106
|
+
if (!this.isSupported()) return "function" == typeof i && i(), !1;
|
|
83
107
|
const r = this;
|
|
84
|
-
return this.
|
|
85
|
-
if (!
|
|
108
|
+
return this.nd((d) => {
|
|
109
|
+
if (!d.objectStoreNames.contains(t))
|
|
86
110
|
return (
|
|
87
|
-
r.
|
|
111
|
+
r.j.error(
|
|
88
112
|
"Could not store object " +
|
|
89
113
|
e +
|
|
90
114
|
" in " +
|
|
91
115
|
t +
|
|
92
116
|
" on indexedDB " +
|
|
93
|
-
r.od
|
|
117
|
+
r.database.od +
|
|
94
118
|
" - " +
|
|
95
119
|
t +
|
|
96
|
-
" is not a valid objectStore"
|
|
120
|
+
" is not a valid objectStore",
|
|
97
121
|
),
|
|
98
122
|
"function" == typeof i && i(),
|
|
99
|
-
void
|
|
123
|
+
void d.close()
|
|
100
124
|
);
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
const u =
|
|
125
|
+
const s = d.transaction([t], "readwrite");
|
|
126
|
+
s.oncomplete = () => d.close();
|
|
127
|
+
const u = s.objectStore(t).put(n, e);
|
|
104
128
|
(u.onerror = () => {
|
|
105
|
-
r.
|
|
129
|
+
r.j.error(
|
|
106
130
|
"Could not store object " +
|
|
107
131
|
e +
|
|
108
132
|
" in " +
|
|
109
133
|
t +
|
|
110
134
|
" on indexedDB " +
|
|
111
|
-
r.od
|
|
135
|
+
r.database.od,
|
|
112
136
|
),
|
|
113
137
|
"function" == typeof i && i();
|
|
114
138
|
}),
|
|
@@ -118,198 +142,211 @@ export default class Ae {
|
|
|
118
142
|
}, i);
|
|
119
143
|
}
|
|
120
144
|
getItem(t, e, n) {
|
|
121
|
-
if (!this.
|
|
145
|
+
if (!this.isSupported()) return !1;
|
|
122
146
|
const o = this;
|
|
123
|
-
return this.
|
|
147
|
+
return this.nd((i) => {
|
|
124
148
|
if (!i.objectStoreNames.contains(t))
|
|
125
149
|
return (
|
|
126
|
-
o.
|
|
150
|
+
o.j.error(
|
|
127
151
|
"Could not retrieve object " +
|
|
128
152
|
e +
|
|
129
153
|
" in " +
|
|
130
154
|
t +
|
|
131
155
|
" on indexedDB " +
|
|
132
|
-
o.od
|
|
156
|
+
o.database.od +
|
|
133
157
|
" - " +
|
|
134
158
|
t +
|
|
135
|
-
" is not a valid objectStore"
|
|
159
|
+
" is not a valid objectStore",
|
|
136
160
|
),
|
|
137
161
|
void i.close()
|
|
138
162
|
);
|
|
139
163
|
const r = i.transaction([t], "readonly");
|
|
140
164
|
r.oncomplete = () => i.close();
|
|
141
|
-
const
|
|
142
|
-
(
|
|
143
|
-
o.
|
|
165
|
+
const d = r.objectStore(t).get(e);
|
|
166
|
+
(d.onerror = () => {
|
|
167
|
+
o.j.error(
|
|
144
168
|
"Could not retrieve object " +
|
|
145
169
|
e +
|
|
146
170
|
" in " +
|
|
147
171
|
t +
|
|
148
172
|
" on indexedDB " +
|
|
149
|
-
o.od
|
|
173
|
+
o.database.od,
|
|
150
174
|
);
|
|
151
175
|
}),
|
|
152
|
-
(
|
|
153
|
-
|
|
154
|
-
null
|
|
176
|
+
(d.onsuccess = (t) => {
|
|
177
|
+
var e;
|
|
178
|
+
const o = null === (e = t.target) || void 0 === e ? void 0 : e.result;
|
|
179
|
+
null != o && n(o);
|
|
155
180
|
});
|
|
156
181
|
});
|
|
157
182
|
}
|
|
158
183
|
hr(t, e, n) {
|
|
159
|
-
if (!this.
|
|
184
|
+
if (!this.isSupported()) return "function" == typeof n && n(), !1;
|
|
160
185
|
const o = this;
|
|
161
|
-
return this.
|
|
186
|
+
return this.nd((i) => {
|
|
162
187
|
if (!i.objectStoreNames.contains(t))
|
|
163
188
|
return (
|
|
164
|
-
o.
|
|
189
|
+
o.j.error(
|
|
165
190
|
"Could not retrieve last record from " +
|
|
166
191
|
t +
|
|
167
192
|
" on indexedDB " +
|
|
168
|
-
o.od
|
|
193
|
+
o.database.od +
|
|
169
194
|
" - " +
|
|
170
195
|
t +
|
|
171
|
-
" is not a valid objectStore"
|
|
196
|
+
" is not a valid objectStore",
|
|
172
197
|
),
|
|
173
198
|
"function" == typeof n && n(),
|
|
174
199
|
void i.close()
|
|
175
200
|
);
|
|
176
201
|
const r = i.transaction([t], "readonly");
|
|
177
202
|
r.oncomplete = () => i.close();
|
|
178
|
-
const
|
|
179
|
-
(
|
|
180
|
-
o.
|
|
181
|
-
"Could not open cursor for " + t + " on indexedDB " + o.od
|
|
203
|
+
const d = r.objectStore(t).openCursor(null, "prev");
|
|
204
|
+
(d.onerror = () => {
|
|
205
|
+
o.j.error(
|
|
206
|
+
"Could not open cursor for " + t + " on indexedDB " + o.database.od,
|
|
182
207
|
),
|
|
183
208
|
"function" == typeof n && n();
|
|
184
209
|
}),
|
|
185
|
-
(
|
|
186
|
-
|
|
187
|
-
null
|
|
188
|
-
|
|
210
|
+
(d.onsuccess = (t) => {
|
|
211
|
+
var o;
|
|
212
|
+
const i = null === (o = t.target) || void 0 === o ? void 0 : o.result;
|
|
213
|
+
null != i && null != i.value && null != i.key
|
|
214
|
+
? e(i.key, i.value)
|
|
189
215
|
: "function" == typeof n && n();
|
|
190
216
|
});
|
|
191
217
|
}, n);
|
|
192
218
|
}
|
|
193
|
-
|
|
194
|
-
if (!this.
|
|
219
|
+
oe(t, e) {
|
|
220
|
+
if (!this.isSupported()) return !1;
|
|
195
221
|
const n = this;
|
|
196
|
-
return this.
|
|
222
|
+
return this.nd((o) => {
|
|
197
223
|
if (!o.objectStoreNames.contains(t))
|
|
198
224
|
return (
|
|
199
|
-
n.
|
|
225
|
+
n.j.error(
|
|
200
226
|
"Could not delete record " +
|
|
201
227
|
e +
|
|
202
228
|
" from " +
|
|
203
229
|
t +
|
|
204
230
|
" on indexedDB " +
|
|
205
|
-
n.od
|
|
231
|
+
n.database.od +
|
|
206
232
|
" - " +
|
|
207
233
|
t +
|
|
208
|
-
" is not a valid objectStore"
|
|
234
|
+
" is not a valid objectStore",
|
|
209
235
|
),
|
|
210
236
|
void o.close()
|
|
211
237
|
);
|
|
212
238
|
const i = o.transaction([t], "readwrite");
|
|
213
239
|
i.oncomplete = () => o.close();
|
|
214
240
|
i.objectStore(t).delete(e).onerror = () => {
|
|
215
|
-
n.
|
|
241
|
+
n.j.error(
|
|
216
242
|
"Could not delete record " +
|
|
217
243
|
e +
|
|
218
244
|
" from " +
|
|
219
245
|
t +
|
|
220
246
|
" on indexedDB " +
|
|
221
|
-
n.od
|
|
247
|
+
n.database.od,
|
|
222
248
|
);
|
|
223
249
|
};
|
|
224
250
|
});
|
|
225
251
|
}
|
|
226
252
|
Mt(t, e) {
|
|
227
|
-
if (!this.
|
|
253
|
+
if (!this.isSupported()) return !1;
|
|
228
254
|
const n = this;
|
|
229
|
-
return this.
|
|
255
|
+
return this.nd((o) => {
|
|
230
256
|
if (!o.objectStoreNames.contains(t))
|
|
231
257
|
return (
|
|
232
|
-
n.
|
|
258
|
+
n.j.error(
|
|
233
259
|
"Could not retrieve objects from " +
|
|
234
260
|
t +
|
|
235
261
|
" on indexedDB " +
|
|
236
|
-
n.od
|
|
262
|
+
n.database.od +
|
|
237
263
|
" - " +
|
|
238
264
|
t +
|
|
239
|
-
" is not a valid objectStore"
|
|
265
|
+
" is not a valid objectStore",
|
|
240
266
|
),
|
|
241
267
|
void o.close()
|
|
242
268
|
);
|
|
243
269
|
const i = o.transaction([t], "readwrite");
|
|
244
270
|
i.oncomplete = () => o.close();
|
|
245
271
|
const r = i.objectStore(t),
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
(
|
|
249
|
-
|
|
250
|
-
? (n.
|
|
272
|
+
d = r.openCursor(),
|
|
273
|
+
s = [];
|
|
274
|
+
(d.onerror = () => {
|
|
275
|
+
s.length > 0
|
|
276
|
+
? (n.j.info(
|
|
251
277
|
"Cursor closed midway through for " +
|
|
252
278
|
t +
|
|
253
279
|
" on indexedDB " +
|
|
254
|
-
n.od
|
|
280
|
+
n.database.od,
|
|
255
281
|
),
|
|
256
|
-
e(
|
|
257
|
-
: n.
|
|
258
|
-
"Could not open cursor for " +
|
|
282
|
+
e(s))
|
|
283
|
+
: n.j.error(
|
|
284
|
+
"Could not open cursor for " +
|
|
285
|
+
t +
|
|
286
|
+
" on indexedDB " +
|
|
287
|
+
n.database.od,
|
|
259
288
|
);
|
|
260
289
|
}),
|
|
261
|
-
(
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
290
|
+
(d.onsuccess = (t) => {
|
|
291
|
+
var n;
|
|
292
|
+
const o = null === (n = t.target) || void 0 === n ? void 0 : n.result;
|
|
293
|
+
if (null != o) {
|
|
294
|
+
if (null != o.value && null != o.key) {
|
|
295
|
+
r.delete(o.key).onsuccess = () => {
|
|
296
|
+
s.push(o.value);
|
|
267
297
|
};
|
|
268
298
|
}
|
|
269
|
-
|
|
270
|
-
} else
|
|
299
|
+
"function" == typeof o.continue && o.continue();
|
|
300
|
+
} else s.length > 0 && e(s);
|
|
271
301
|
});
|
|
272
302
|
});
|
|
273
303
|
}
|
|
274
304
|
clearData() {
|
|
275
|
-
if (!this.
|
|
305
|
+
if (!this.isSupported()) return !1;
|
|
276
306
|
const t = [];
|
|
277
|
-
for (const e in this.
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
307
|
+
for (const e in this.database.Jt) {
|
|
308
|
+
const n = e;
|
|
309
|
+
this.database.Jt.hasOwnProperty(e) &&
|
|
310
|
+
this.database.Jt[n] !== this.database.Jt.se &&
|
|
311
|
+
t.push(this.database.Jt[n]);
|
|
312
|
+
}
|
|
281
313
|
const e = this;
|
|
282
|
-
return this.
|
|
314
|
+
return this.nd(function (n) {
|
|
283
315
|
const o = n.transaction(t, "readwrite");
|
|
284
316
|
o.oncomplete = () => n.close();
|
|
285
317
|
for (let n = 0; n < t.length; n++) {
|
|
286
318
|
const i = t[n];
|
|
287
|
-
o.objectStore(i).clear().onerror = function() {
|
|
288
|
-
e.
|
|
289
|
-
"Could not clear " +
|
|
319
|
+
o.objectStore(i).clear().onerror = function () {
|
|
320
|
+
e.j.error(
|
|
321
|
+
"Could not clear " +
|
|
322
|
+
this.source.name +
|
|
323
|
+
" on indexedDB " +
|
|
324
|
+
e.database.od,
|
|
290
325
|
);
|
|
291
326
|
};
|
|
292
327
|
}
|
|
293
|
-
o.onerror = function() {
|
|
294
|
-
e.
|
|
328
|
+
o.onerror = function () {
|
|
329
|
+
e.j.error(
|
|
330
|
+
"Could not clear object stores on indexedDB " + e.database.od,
|
|
331
|
+
);
|
|
295
332
|
};
|
|
296
333
|
});
|
|
297
334
|
}
|
|
298
335
|
}
|
|
299
|
-
|
|
336
|
+
Oe.ep = {
|
|
300
337
|
Ft: {
|
|
301
|
-
|
|
338
|
+
od: "AppboyServiceWorkerAsyncStorage",
|
|
302
339
|
VERSION: 6,
|
|
303
340
|
Jt: {
|
|
304
|
-
|
|
341
|
+
Ja: "data",
|
|
305
342
|
kr: "pushClicks",
|
|
306
343
|
cu: "pushSubscribed",
|
|
307
|
-
|
|
344
|
+
dd: "fallbackDevice",
|
|
308
345
|
qt: "cardUpdates",
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
346
|
+
se: "optOut",
|
|
347
|
+
wr: "pendingData",
|
|
348
|
+
qh: "sdkAuthenticationSignature",
|
|
312
349
|
},
|
|
313
|
-
|
|
314
|
-
}
|
|
350
|
+
ie: 1,
|
|
351
|
+
},
|
|
315
352
|
};
|
package/shared-lib/logger.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
const
|
|
2
|
-
init: function(n) {
|
|
3
|
-
(void 0 === n && void 0 !==
|
|
1
|
+
const Ue = {
|
|
2
|
+
init: function (n) {
|
|
3
|
+
(void 0 === n && void 0 !== Ue.zg) || (Ue.zg = !!n), Ue.t || (Ue.t = !0);
|
|
4
4
|
},
|
|
5
|
-
destroy: function() {
|
|
6
|
-
(
|
|
5
|
+
destroy: function () {
|
|
6
|
+
(Ue.t = !1), (Ue.zg = void 0), (Ue.j = void 0);
|
|
7
7
|
},
|
|
8
|
-
setLogger: function(n) {
|
|
8
|
+
setLogger: function (n) {
|
|
9
9
|
"function" == typeof n
|
|
10
|
-
? (
|
|
11
|
-
:
|
|
10
|
+
? (Ue.init(), (Ue.j = n))
|
|
11
|
+
: Ue.info("Ignoring setLogger call since logger is not a function");
|
|
12
12
|
},
|
|
13
|
-
toggleLogging: function() {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
? (console.log("Disabling Braze logging"), (
|
|
17
|
-
: (console.log("Enabled Braze logging"), (
|
|
13
|
+
toggleLogging: function () {
|
|
14
|
+
Ue.init(),
|
|
15
|
+
Ue.zg
|
|
16
|
+
? (console.log("Disabling Braze logging"), (Ue.zg = !1))
|
|
17
|
+
: (console.log("Enabled Braze logging"), (Ue.zg = !0));
|
|
18
18
|
},
|
|
19
|
-
info: function(n) {
|
|
20
|
-
if (
|
|
19
|
+
info: function (n) {
|
|
20
|
+
if (Ue.zg) {
|
|
21
21
|
const o = "Braze: " + n;
|
|
22
|
-
null !=
|
|
22
|
+
null != Ue.j ? Ue.j(o) : console.log(o);
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
-
warn: function(n) {
|
|
26
|
-
if (
|
|
27
|
-
const o = "Braze SDK Warning: " + n + " (v4.
|
|
28
|
-
null !=
|
|
25
|
+
warn: function (n) {
|
|
26
|
+
if (Ue.zg) {
|
|
27
|
+
const o = "Braze SDK Warning: " + n + " (v4.9.0)";
|
|
28
|
+
null != Ue.j ? Ue.j(o) : console.warn(o);
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
|
-
error: function(n) {
|
|
32
|
-
if (
|
|
33
|
-
const o = "Braze SDK Error: " + n + " (v4.
|
|
34
|
-
null !=
|
|
31
|
+
error: function (n) {
|
|
32
|
+
if (Ue.zg) {
|
|
33
|
+
const o = "Braze SDK Error: " + n + " (v4.9.0)";
|
|
34
|
+
null != Ue.j ? Ue.j(o) : console.error(o);
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
},
|
|
37
37
|
};
|
|
38
|
-
export default
|
|
38
|
+
export default Ue;
|
|
@@ -3,24 +3,24 @@ export default {
|
|
|
3
3
|
Eo: "baseUrl",
|
|
4
4
|
_o: "noCookies",
|
|
5
5
|
Io: "devicePropertyAllowlist",
|
|
6
|
-
|
|
6
|
+
Aa: "disablePushTokenMaintenance",
|
|
7
7
|
Ao: "enableLogging",
|
|
8
8
|
So: "enableSdkAuthentication",
|
|
9
|
-
|
|
9
|
+
qa: "manageServiceWorkerExternally",
|
|
10
10
|
No: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
11
11
|
wo: "sessionTimeoutInSeconds",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
Oo: "appVersion",
|
|
13
|
+
_a: "serviceWorkerLocation",
|
|
14
|
+
ka: "safariWebsitePushId",
|
|
15
|
+
Ba: "localization",
|
|
16
|
+
po: "contentSecurityNonce",
|
|
17
|
+
Co: "enableHtmlInAppMessages",
|
|
18
|
+
Lo: "allowUserSuppliedJavascript",
|
|
19
|
+
lo: "inAppMessageZIndex",
|
|
20
|
+
fo: "openInAppMessagesInNewTab",
|
|
21
21
|
en: "openNewsFeedCardsInNewTab",
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
tn: "openCardsInNewTab"
|
|
22
|
+
mh: "requireExplicitInAppMessageDismissal",
|
|
23
|
+
Po: "doNotLoadFontAwesome",
|
|
24
|
+
Ro: "sdkFlavor",
|
|
25
|
+
tn: "openCardsInNewTab",
|
|
26
26
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/src/Card/card-manager.js
CHANGED
|
@@ -12,7 +12,7 @@ export default class a {
|
|
|
12
12
|
if ((n.p(), null == n.url || "" === n.url))
|
|
13
13
|
return (
|
|
14
14
|
r.j.info(
|
|
15
|
-
`Card ${n.id} has no url. Not logging click to Braze servers
|
|
15
|
+
`Card ${n.id} has no url. Not logging click to Braze servers.`,
|
|
16
16
|
),
|
|
17
17
|
e
|
|
18
18
|
);
|
|
@@ -30,7 +30,7 @@ export default class a {
|
|
|
30
30
|
if (!n.F())
|
|
31
31
|
return (
|
|
32
32
|
r.j.info(
|
|
33
|
-
`Card ${n.id} refused this dismissal. Ignoring analytics event
|
|
33
|
+
`Card ${n.id} refused this dismissal. Ignoring analytics event.`,
|
|
34
34
|
),
|
|
35
35
|
o
|
|
36
36
|
);
|
|
@@ -44,13 +44,14 @@ export function setCardHeight(t, o) {
|
|
|
44
44
|
export function cardToHtml(t, logCardClick, e) {
|
|
45
45
|
const a = document.createElement("div");
|
|
46
46
|
(a.className = "ab-card ab-effect-card " + t.U),
|
|
47
|
-
t.id &&
|
|
47
|
+
t.id &&
|
|
48
|
+
(a.setAttribute("data-ab-card-id", t.id), a.setAttribute("id", t.id)),
|
|
48
49
|
a.setAttribute("role", "article"),
|
|
49
50
|
a.setAttribute("tabindex", "0");
|
|
50
51
|
let n = "",
|
|
51
52
|
i = !1;
|
|
52
53
|
t.url && "" !== t.url && ((n = t.url), (i = !0));
|
|
53
|
-
const s = o => (markCardAsRead(a), i && (logCardClick(t), m(n, e, o)), !1);
|
|
54
|
+
const s = (o) => (markCardAsRead(a), i && (logCardClick(t), m(n, e, o)), !1);
|
|
54
55
|
if (t.pinned) {
|
|
55
56
|
const t = document.createElement("div");
|
|
56
57
|
t.className = "ab-pinned-indicator";
|
|
@@ -83,10 +84,10 @@ export function cardToHtml(t, logCardClick, e) {
|
|
|
83
84
|
t.logCardDismissal = () => logCardDismissal(t);
|
|
84
85
|
const e = o("Dismiss Card", void 0, t.dismissCard.bind(t));
|
|
85
86
|
a.appendChild(e),
|
|
86
|
-
d(u, c.W, t => {
|
|
87
|
+
d(u, c.W, (t) => {
|
|
87
88
|
(a.className += " ab-swiped-left"), e.onclick(t);
|
|
88
89
|
}),
|
|
89
|
-
d(u, c.X, t => {
|
|
90
|
+
d(u, c.X, (t) => {
|
|
90
91
|
(a.className += " ab-swiped-right"), e.onclick(t);
|
|
91
92
|
});
|
|
92
93
|
}
|