@braze/web-sdk 6.12.1 → 6.13.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 +240 -3
- package/package.json +1 -1
- package/shared-lib/event-types.js +18 -18
- package/shared-lib/indexed-db-adapter.js +58 -58
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +25 -24
- package/src/ConversationalChat/automatically-manage-chat.js +5 -0
- package/src/ConversationalChat/chat-message-factory.js +25 -0
- package/src/ConversationalChat/chat-message.js +33 -0
- package/src/ConversationalChat/constants.js +1 -0
- package/src/ConversationalChat/conversational-chat-provider-factory.js +26 -0
- package/src/ConversationalChat/conversational-chat-provider.js +372 -0
- package/src/ConversationalChat/display/chat-widget-manager.js +113 -0
- package/src/ConversationalChat/display/chat-widget-to-html.js +58 -0
- package/src/ConversationalChat/get-chat-messages.js +7 -0
- package/src/ConversationalChat/index.js +12 -0
- package/src/ConversationalChat/is-chat-conversation-ended.js +7 -0
- package/src/ConversationalChat/is-chat-turn-errored.js +7 -0
- package/src/ConversationalChat/is-chat-turn-in-progress.js +7 -0
- package/src/ConversationalChat/register-chat-action-handler.js +10 -0
- package/src/ConversationalChat/reset-chat-conversation.js +5 -0
- package/src/ConversationalChat/retrieve-chat-config.js +7 -0
- package/src/ConversationalChat/send-chat-message.js +17 -0
- package/src/ConversationalChat/subscribe-to-chat-action.js +5 -0
- package/src/ConversationalChat/subscribe-to-chat-conversation-updated.js +5 -0
- package/src/ConversationalChat/subscribe-to-chat-message-received.js +5 -0
- package/src/ConversationalChat/trigger-chat-action.js +11 -0
- package/src/ConversationalChat/types.js +1 -0
- package/src/Core/add-sdk-metadata.js +5 -5
- package/src/Core/change-user.js +6 -6
- package/src/Core/disable-sdk.js +6 -6
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/handle-braze-action.js +20 -13
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/is-initialized.js +1 -1
- package/src/Core/log-custom-event.js +9 -9
- package/src/Core/log-ecommerce-event.js +4 -4
- package/src/Core/log-purchase.js +14 -14
- package/src/Core/open-session.js +8 -8
- 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 +1 -1
- package/src/DUST/dust-config-store.js +35 -35
- package/src/DUST/dust-message-dedup.js +3 -3
- package/src/DUST/dust-provider-factory.js +10 -10
- package/src/DUST/dust-provider.js +234 -234
- package/src/DUST/subscribe-to-dust.js +7 -7
- package/src/FeatureFlags/feature-flag-factory.js +2 -2
- package/src/FeatureFlags/feature-flag.js +4 -4
- package/src/FeatureFlags/feature-flags-provider-factory.js +11 -11
- package/src/FeatureFlags/feature-flags-provider.js +38 -38
- package/src/FeatureFlags/get-all-feature-flags.js +3 -3
- package/src/FeatureFlags/get-feature-flag.js +3 -3
- package/src/FeatureFlags/log-feature-flag-impression.js +4 -4
- package/src/FeatureFlags/refresh-feature-flags.js +5 -5
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +3 -3
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-display-utils.js +4 -4
- package/src/InAppMessage/display/html-message-to-html.js +13 -13
- package/src/InAppMessage/display/in-app-message-to-html.js +20 -20
- package/src/InAppMessage/display/modal-utils.js +7 -7
- package/src/InAppMessage/in-app-message-factory.js +6 -6
- package/src/InAppMessage/in-app-message-manager.js +92 -92
- package/src/InAppMessage/log-in-app-message-button-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-click.js +7 -7
- 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 +39 -39
- package/src/InAppMessage/models/html-message.js +20 -20
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +102 -102
- package/src/InAppMessage/models/modal-message.js +38 -38
- package/src/InAppMessage/models/slide-up-message.js +34 -34
- 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/remove-all-visible-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +23 -23
- 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 +15 -15
- package/src/Push/push-manager.js +13 -13
- package/src/Push/register-push.js +2 -2
- package/src/Push/request-push-permission.js +2 -2
- package/src/Push/unregister-push-token-on-server.js +3 -3
- package/src/Push/unregister-push.js +3 -3
- package/src/Push/utils/push-utils.js +15 -15
- package/src/User/user-manager.js +9 -9
- package/src/User/user.js +50 -50
- package/src/common/constants.js +1 -1
- package/src/common/content-cards-display.js +22 -22
- package/src/common/event-logger.js +3 -3
- package/src/index.js +2 -9
- package/src/l10n/l10n-manager-factory.js +4 -4
- package/src/l10n/l10n-manager.js +6 -6
- package/src/managers/auth-manager.js +28 -28
- package/src/managers/braze-action-manager.js +14 -0
- package/src/managers/braze-instance.js +159 -151
- package/src/managers/device-manager.js +26 -26
- package/src/managers/network-manager.js +120 -120
- package/src/managers/server-config-manager.js +95 -86
- package/src/managers/session-manager.js +25 -25
- package/src/managers/storage-manager-factory.js +12 -12
- package/src/managers/storage-manager.js +129 -124
- package/src/managers/subscription-manager.js +8 -8
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +5 -5
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +8 -8
- package/src/models/push-token.js +6 -6
- package/src/models/request-result.js +2 -2
- package/src/models/server-config.js +27 -27
- package/src/request-controller.js +117 -117
- package/src/standard-index.js +9 -0
- package/src/triggers/models/custom-event-data.js +4 -4
- package/src/triggers/models/custom-event-property-data.js +5 -5
- package/src/triggers/models/filter-set.js +5 -5
- package/src/triggers/models/filter.js +31 -31
- package/src/triggers/models/in-app-message-click-data.js +9 -9
- package/src/triggers/models/purchase-data.js +1 -1
- package/src/triggers/models/purchase-property-data.js +5 -5
- package/src/triggers/models/push-click-data.js +4 -4
- package/src/triggers/models/trigger-condition.js +35 -35
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +36 -36
- package/src/triggers/triggers-provider-factory.js +5 -5
- package/src/triggers/triggers-provider.js +128 -128
- package/src/types.js +2 -2
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/chat-widget-css.js +11 -0
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +7 -7
- package/src/util/braze-actions.js +5 -5
- package/src/util/browser-detector.js +41 -41
- package/src/util/client-hints-parser.js +10 -10
- package/src/util/component-utils.js +1 -1
- package/src/util/date-utils.js +2 -2
- package/src/util/device-constants.js +5 -5
- package/src/util/dom-utils.js +8 -8
- package/src/util/ecommerce-event-validation.js +13 -13
- package/src/util/html-display-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +82 -44
- package/src/util/request-header-utils.js +26 -24
- package/src/util/user-agent-parser.js +21 -21
- package/src/util/validation-utils.js +29 -21
- package/src/util/window-utils.js +3 -3
|
@@ -1,63 +1,63 @@
|
|
|
1
1
|
import t from "../common/base-provider.js";
|
|
2
|
-
import { newInAppMessageFromJson as
|
|
2
|
+
import { newInAppMessageFromJson as It } from "../InAppMessage/in-app-message-factory.js";
|
|
3
3
|
import ve from "../models/braze-event.js";
|
|
4
4
|
import {
|
|
5
5
|
isArray as g,
|
|
6
6
|
isEqual as hi,
|
|
7
|
-
validateValueIsFromEnum as
|
|
7
|
+
validateValueIsFromEnum as ra,
|
|
8
8
|
} from "../util/code-utils.js";
|
|
9
9
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
10
10
|
import Jt from "../InAppMessage/models/templated-in-app-message.js";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
11
|
+
import Tt from "./models/trigger.js";
|
|
12
|
+
import gt from "./models/trigger-events.js";
|
|
13
13
|
import { logger as b } from "../../shared-lib/index.js";
|
|
14
14
|
export default class vr extends t {
|
|
15
15
|
constructor(t, i, s, e, r) {
|
|
16
16
|
super(),
|
|
17
|
-
(this.
|
|
17
|
+
(this.sg = t),
|
|
18
18
|
(this.Rs = i),
|
|
19
19
|
(this.j = s),
|
|
20
20
|
(this.Ru = e),
|
|
21
|
-
(this.
|
|
22
|
-
(this.
|
|
21
|
+
(this.hg = r),
|
|
22
|
+
(this.sg = t),
|
|
23
23
|
(this.Rs = i),
|
|
24
24
|
(this.j = s),
|
|
25
25
|
(this.Ru = e),
|
|
26
|
-
(this.
|
|
27
|
-
(this.
|
|
28
|
-
(this.
|
|
29
|
-
(this.
|
|
30
|
-
(this.
|
|
31
|
-
(this.
|
|
26
|
+
(this.hg = r),
|
|
27
|
+
(this.ng = []),
|
|
28
|
+
(this.lg = []),
|
|
29
|
+
(this.gg = null),
|
|
30
|
+
(this.fg = {}),
|
|
31
|
+
(this.cg = {}),
|
|
32
32
|
(this.triggers = []),
|
|
33
|
-
(this.
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
33
|
+
(this.ug = 0),
|
|
34
|
+
this.dg(),
|
|
35
|
+
this.pg();
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
mg() {
|
|
38
38
|
if (this.j) {
|
|
39
|
-
(this.
|
|
40
|
-
(this.
|
|
41
|
-
(this.
|
|
39
|
+
(this.gg = this.j.St(s.It.iS) || this.gg),
|
|
40
|
+
(this.fg = this.j.St(s.It.SS) || this.fg),
|
|
41
|
+
(this.cg = this.j.St(s.It.nS) || this.cg);
|
|
42
42
|
for (let t = 0; t < this.triggers.length; t++) {
|
|
43
43
|
const i = this.triggers[t];
|
|
44
|
-
i.id && null != this.
|
|
44
|
+
i.id && null != this.cg[i.id] && i.Hm(this.cg[i.id]);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
dg() {
|
|
49
49
|
if (!this.j) return;
|
|
50
|
-
this.
|
|
50
|
+
this.ug = this.j.St(s.It.aS) || 0;
|
|
51
51
|
const t = this.j.St(s.It.oS) || [],
|
|
52
52
|
i = [];
|
|
53
|
-
for (let s = 0; s < t.length; s++) i.push(
|
|
54
|
-
(this.triggers = i), this.
|
|
53
|
+
for (let s = 0; s < t.length; s++) i.push(Tt._u(t[s]));
|
|
54
|
+
(this.triggers = i), this.mg();
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
pg() {
|
|
57
57
|
const t = this,
|
|
58
58
|
i = function (i, s, e, r, h) {
|
|
59
59
|
return function () {
|
|
60
|
-
t.
|
|
60
|
+
t.bg(i, s, e, r, h);
|
|
61
61
|
};
|
|
62
62
|
},
|
|
63
63
|
e = {};
|
|
@@ -65,182 +65,182 @@ export default class vr extends t {
|
|
|
65
65
|
let r = !1;
|
|
66
66
|
for (let t = 0; t < this.triggers.length; t++) {
|
|
67
67
|
const s = this.triggers[t];
|
|
68
|
-
if (s.id && null != this.
|
|
69
|
-
const t = this.
|
|
68
|
+
if (s.id && null != this.fg[s.id]) {
|
|
69
|
+
const t = this.fg[s.id],
|
|
70
70
|
h = [];
|
|
71
71
|
for (let r = 0; r < t.length; r++) {
|
|
72
72
|
const n = t[r],
|
|
73
|
-
o = s.
|
|
73
|
+
o = s.Jm(n._a || 0);
|
|
74
74
|
if (o > 0) {
|
|
75
75
|
let t, r;
|
|
76
76
|
h.push(n),
|
|
77
|
-
null != n.
|
|
78
|
-
null != n.
|
|
77
|
+
null != n.wg && (t = n.wg),
|
|
78
|
+
null != n.yg && ve.gS(n.yg) && (r = ve._u(n.yg));
|
|
79
79
|
const l = [];
|
|
80
|
-
if (n.
|
|
81
|
-
for (let t = 0; t < n.
|
|
82
|
-
const i = e[n.
|
|
80
|
+
if (n.Tg && g(n.Tg))
|
|
81
|
+
for (let t = 0; t < n.Tg.length; t++) {
|
|
82
|
+
const i = e[n.Tg[t]];
|
|
83
83
|
null != i && l.push(i);
|
|
84
84
|
}
|
|
85
|
-
this.
|
|
85
|
+
this.lg.push(window.setTimeout(i(s, n._a || 0, t, r, l), o));
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
this.
|
|
89
|
-
((this.
|
|
88
|
+
this.fg[s.id].length > h.length &&
|
|
89
|
+
((this.fg[s.id] = h),
|
|
90
90
|
(r = !0),
|
|
91
|
-
0 === this.
|
|
91
|
+
0 === this.fg[s.id].length && delete this.fg[s.id]);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
r && this.j && this.j.Pt(s.It.SS, this.
|
|
94
|
+
r && this.j && this.j.Pt(s.It.SS, this.fg);
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
$g() {
|
|
97
97
|
if (!this.j) return;
|
|
98
98
|
const t = [];
|
|
99
99
|
for (let i = 0; i < this.triggers.length; i++)
|
|
100
100
|
t.push(this.triggers[i].qt());
|
|
101
|
-
(this.
|
|
101
|
+
(this.ug = new Date().valueOf()),
|
|
102
102
|
this.j.Pt(s.It.oS, t),
|
|
103
|
-
this.j.Pt(s.It.
|
|
103
|
+
this.j.Pt(s.It.aS, this.ug);
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
vg() {
|
|
106
106
|
if (!this.j) return;
|
|
107
|
-
(this.j.St(s.It.
|
|
107
|
+
(this.j.St(s.It.aS) || 0) > this.ug ? this.dg() : this.mg();
|
|
108
108
|
}
|
|
109
109
|
q(t) {
|
|
110
110
|
let i = !1;
|
|
111
111
|
if (null != t && t.triggers) {
|
|
112
|
-
this.
|
|
112
|
+
this.hg.Ga(), this.mg();
|
|
113
113
|
const e = {},
|
|
114
114
|
r = {};
|
|
115
115
|
this.triggers = [];
|
|
116
116
|
for (let s = 0; s < t.triggers.length; s++) {
|
|
117
|
-
const h =
|
|
117
|
+
const h = Tt.fromJson(t.triggers[s]);
|
|
118
118
|
if (h) {
|
|
119
119
|
h.id &&
|
|
120
|
-
null != this.
|
|
121
|
-
(h.
|
|
122
|
-
h.id && null != this.
|
|
123
|
-
for (let t = 0; t < h.
|
|
124
|
-
if (h.
|
|
120
|
+
null != this.cg[h.id] &&
|
|
121
|
+
(h.Hm(this.cg[h.id]), (e[h.id] = this.cg[h.id])),
|
|
122
|
+
h.id && null != this.fg[h.id] && (r[h.id] = this.fg[h.id]);
|
|
123
|
+
for (let t = 0; t < h.Nm.length; t++)
|
|
124
|
+
if (h.Nm[t]._m(gt.Os, null)) {
|
|
125
125
|
i = !0;
|
|
126
126
|
break;
|
|
127
127
|
}
|
|
128
128
|
this.triggers.push(h);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
hi(this.
|
|
132
|
-
hi(this.
|
|
133
|
-
((this.
|
|
134
|
-
this
|
|
131
|
+
hi(this.cg, e) || ((this.cg = e), this.j && this.j.Pt(s.It.nS, this.cg)),
|
|
132
|
+
hi(this.fg, r) ||
|
|
133
|
+
((this.fg = r), this.j && this.j.Pt(s.It.SS, this.fg)),
|
|
134
|
+
this.$g(),
|
|
135
135
|
i &&
|
|
136
136
|
(b.info("Trigger with test condition found, firing test."),
|
|
137
|
-
this.
|
|
138
|
-
this.
|
|
139
|
-
const h = this.
|
|
137
|
+
this.Pe(gt.Os)),
|
|
138
|
+
this.Pe(gt.OPEN);
|
|
139
|
+
const h = this.ng;
|
|
140
140
|
let n;
|
|
141
|
-
this.
|
|
141
|
+
this.ng = [];
|
|
142
142
|
for (let t = 0; t < h.length; t++)
|
|
143
|
-
(n = Array.prototype.slice.call(h[t])), this.
|
|
143
|
+
(n = Array.prototype.slice.call(h[t])), this.Pe(...n);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
|
|
146
|
+
bg(t, i, s, e, r) {
|
|
147
147
|
const h = (e) => {
|
|
148
|
-
this.
|
|
148
|
+
this.mg();
|
|
149
149
|
const r = new Date().valueOf();
|
|
150
|
-
t
|
|
151
|
-
(!1 === navigator.onLine && t.type ===
|
|
150
|
+
t.Lm(i) ||
|
|
151
|
+
(!1 === navigator.onLine && t.type === Tt.Ba.za && e.imageUrl
|
|
152
152
|
? b.info(
|
|
153
153
|
`Not showing ${t.type} trigger action ${t.id} due to offline state.`,
|
|
154
154
|
)
|
|
155
|
-
: t.
|
|
156
|
-
? 0 === this.Rs
|
|
155
|
+
: t.Fm(r) && this.kg(t, r, s)
|
|
156
|
+
? 0 === this.Rs.$h()
|
|
157
157
|
? b.info(
|
|
158
158
|
`Not displaying trigger ${t.id} because neither automaticallyShowInAppMessages() nor subscribeToInAppMessage() were called.`,
|
|
159
159
|
)
|
|
160
|
-
: (this.Rs.A([e]), this.
|
|
160
|
+
: (this.Rs.A([e]), this.jg(t, r))
|
|
161
161
|
: b.info(
|
|
162
162
|
`Not displaying trigger ${t.id} because display time fell outside of the acceptable time window.`,
|
|
163
163
|
));
|
|
164
164
|
},
|
|
165
165
|
n = () => {
|
|
166
|
-
this.
|
|
166
|
+
this.mg();
|
|
167
167
|
const h = r.pop();
|
|
168
168
|
if (null != h)
|
|
169
|
-
if ((this.
|
|
169
|
+
if ((this.Dg(h, i, s, e, r), h.Lm(i))) {
|
|
170
170
|
let t = `Server aborted in-app message display, but the timeout on fallback trigger ${h.id} has already elapsed.`;
|
|
171
171
|
r.length > 0 && (t += " Continuing to fall back."), b.info(t), n();
|
|
172
172
|
} else {
|
|
173
173
|
b.info(
|
|
174
174
|
`Server aborted in-app message display. Falling back to lower priority ${h.type} trigger action ${t.id}.`,
|
|
175
175
|
);
|
|
176
|
-
const n = 1e3 * h.
|
|
176
|
+
const n = 1e3 * h.Im - (new Date().valueOf() - i);
|
|
177
177
|
n > 0
|
|
178
|
-
? this.
|
|
178
|
+
? this.lg.push(
|
|
179
179
|
window.setTimeout(() => {
|
|
180
|
-
this.
|
|
180
|
+
this.bg(h, i, s, e, r);
|
|
181
181
|
}, n),
|
|
182
182
|
)
|
|
183
|
-
: this.
|
|
183
|
+
: this.bg(h, i, s, e, r);
|
|
184
184
|
}
|
|
185
185
|
};
|
|
186
186
|
let o, l, a;
|
|
187
187
|
switch (t.type) {
|
|
188
|
-
case
|
|
189
|
-
if (((o =
|
|
188
|
+
case Tt.Ba.za:
|
|
189
|
+
if (((o = It(t.data)), null == o)) {
|
|
190
190
|
b.error(
|
|
191
191
|
`Could not parse trigger data for trigger ${t.id}, ignoring.`,
|
|
192
192
|
);
|
|
193
193
|
break;
|
|
194
194
|
}
|
|
195
|
-
if (((l = this.
|
|
195
|
+
if (((l = this.hg.ja(o)), l)) {
|
|
196
196
|
b.error(l), n();
|
|
197
197
|
break;
|
|
198
198
|
}
|
|
199
199
|
h(o);
|
|
200
200
|
break;
|
|
201
|
-
case
|
|
202
|
-
if (((a = Jt.fromJson(t.data, h, n, i, t.
|
|
201
|
+
case Tt.Ba.Rm:
|
|
202
|
+
if (((a = Jt.fromJson(t.data, h, n, i, t.qa || 0)), null == a)) {
|
|
203
203
|
b.error(
|
|
204
204
|
`Could not parse trigger data for trigger ${t.id}, ignoring.`,
|
|
205
205
|
);
|
|
206
206
|
break;
|
|
207
207
|
}
|
|
208
|
-
this.
|
|
208
|
+
this.hg.Ta(a, s, e);
|
|
209
209
|
break;
|
|
210
210
|
default:
|
|
211
211
|
b.error(`Trigger ${t.id} was of unexpected type ${t.type}, ignoring.`);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
|
|
215
|
-
if (!
|
|
216
|
-
if (this.Ru && this.Ru.
|
|
214
|
+
Pe(t, i = null, s) {
|
|
215
|
+
if (!ra(gt, t, "Cannot fire trigger action.", "TriggerEvents")) return;
|
|
216
|
+
if (this.Ru && this.Ru.Vd())
|
|
217
217
|
return (
|
|
218
218
|
b.info(
|
|
219
219
|
"Trigger sync is currently in progress, awaiting sync completion before firing trigger event.",
|
|
220
220
|
),
|
|
221
|
-
void this.
|
|
221
|
+
void this.ng.push(arguments)
|
|
222
222
|
);
|
|
223
|
-
this.
|
|
223
|
+
this.vg();
|
|
224
224
|
const e = new Date().valueOf(),
|
|
225
|
-
r = e - (this.
|
|
225
|
+
r = e - (this.gg || 0);
|
|
226
226
|
let h = !0,
|
|
227
227
|
n = !0;
|
|
228
228
|
const o = [];
|
|
229
229
|
for (let s = 0; s < this.triggers.length; s++) {
|
|
230
230
|
const r = this.triggers[s],
|
|
231
|
-
l = e + 1e3 * r.
|
|
231
|
+
l = e + 1e3 * r.Im;
|
|
232
232
|
if (
|
|
233
|
-
r.
|
|
233
|
+
r.Fm(l) &&
|
|
234
234
|
(null == r.startTime || r.startTime.valueOf() <= e) &&
|
|
235
235
|
(null == r.endTime || r.endTime.valueOf() >= e)
|
|
236
236
|
) {
|
|
237
237
|
let s = !1;
|
|
238
|
-
for (let e = 0; e < r.
|
|
239
|
-
if (r.
|
|
238
|
+
for (let e = 0; e < r.Nm.length; e++)
|
|
239
|
+
if (r.Nm[e]._m(t, i)) {
|
|
240
240
|
s = !0;
|
|
241
241
|
break;
|
|
242
242
|
}
|
|
243
|
-
s && ((h = !1), this.
|
|
243
|
+
s && ((h = !1), this.kg(r, l, t) && ((n = !1), o.push(r)));
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
if (h)
|
|
@@ -259,64 +259,64 @@ export default class vr extends t {
|
|
|
259
259
|
(b.info(
|
|
260
260
|
`Firing ${l.type} trigger action ${l.id} from trigger event ${t}.`,
|
|
261
261
|
),
|
|
262
|
-
this.
|
|
263
|
-
0 === l.
|
|
264
|
-
? this.
|
|
265
|
-
: this.
|
|
262
|
+
this.Dg(l, e, t, s, o),
|
|
263
|
+
0 === l.Im
|
|
264
|
+
? this.bg(l, e, t, s, o)
|
|
265
|
+
: this.lg.push(
|
|
266
266
|
window.setTimeout(() => {
|
|
267
|
-
this.
|
|
268
|
-
}, 1e3 * l.
|
|
267
|
+
this.bg(l, e, t, s, o);
|
|
268
|
+
}, 1e3 * l.Im),
|
|
269
269
|
));
|
|
270
270
|
}
|
|
271
271
|
changeUser(t = !1) {
|
|
272
272
|
if (((this.triggers = []), this.j && this.j.Vt(s.It.oS), !t)) {
|
|
273
|
-
(this.
|
|
274
|
-
(this.
|
|
275
|
-
(this.
|
|
276
|
-
(this.
|
|
277
|
-
this.
|
|
278
|
-
for (let t = 0; t < this.
|
|
279
|
-
(this.
|
|
280
|
-
this.j && (this.j.Vt(s.It.iS), this.j.Vt(s.It.
|
|
273
|
+
(this.ng = []),
|
|
274
|
+
(this.gg = null),
|
|
275
|
+
(this.cg = {}),
|
|
276
|
+
(this.fg = {}),
|
|
277
|
+
this.hg && this.hg.xa();
|
|
278
|
+
for (let t = 0; t < this.lg.length; t++) clearTimeout(this.lg[t]);
|
|
279
|
+
(this.lg = []),
|
|
280
|
+
this.j && (this.j.Vt(s.It.iS), this.j.Vt(s.It.nS), this.j.Vt(s.It.SS));
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
clearData() {
|
|
284
284
|
(this.triggers = []),
|
|
285
|
-
(this.
|
|
286
|
-
(this.
|
|
287
|
-
(this.
|
|
288
|
-
this.
|
|
289
|
-
for (let t = 0; t < this.
|
|
290
|
-
this.
|
|
285
|
+
(this.gg = null),
|
|
286
|
+
(this.cg = {}),
|
|
287
|
+
(this.fg = {}),
|
|
288
|
+
this.hg && this.hg.xa();
|
|
289
|
+
for (let t = 0; t < this.lg.length; t++) clearTimeout(this.lg[t]);
|
|
290
|
+
this.lg = [];
|
|
291
291
|
}
|
|
292
|
-
|
|
293
|
-
if (null == this.
|
|
294
|
-
if (s ===
|
|
292
|
+
kg(t, i, s) {
|
|
293
|
+
if (null == this.gg) return !0;
|
|
294
|
+
if (s === gt.Os)
|
|
295
295
|
return (
|
|
296
296
|
b.info(
|
|
297
297
|
"Ignoring minimum interval between trigger because it is a test type.",
|
|
298
298
|
),
|
|
299
299
|
!0
|
|
300
300
|
);
|
|
301
|
-
let e = t.
|
|
302
|
-
return null == e && (e = this.
|
|
301
|
+
let e = t.Mm;
|
|
302
|
+
return null == e && (e = this.sg), i - this.gg >= 1e3 * e;
|
|
303
303
|
}
|
|
304
|
-
|
|
305
|
-
this.
|
|
304
|
+
Dg(t, i, e, r, h) {
|
|
305
|
+
this.mg(), t.id && (this.fg[t.id] = this.fg[t.id] || []);
|
|
306
306
|
const n = {};
|
|
307
307
|
let o;
|
|
308
|
-
(n.
|
|
308
|
+
(n._a = i), (n.wg = e), null != r && (o = r.qt()), (n.yg = o);
|
|
309
309
|
const l = [];
|
|
310
310
|
for (const t of h) t.id && l.push(t.id);
|
|
311
|
-
(n.
|
|
312
|
-
t.id && this.
|
|
313
|
-
this.j && this.j.Pt(s.It.SS, this.
|
|
311
|
+
(n.Tg = l),
|
|
312
|
+
t.id && this.fg[t.id].push(n),
|
|
313
|
+
this.j && this.j.Pt(s.It.SS, this.fg);
|
|
314
314
|
}
|
|
315
|
-
|
|
316
|
-
this.
|
|
317
|
-
t.
|
|
318
|
-
(this.
|
|
319
|
-
t.id && (this.
|
|
320
|
-
this.j && (this.j.Pt(s.It.iS, i), this.j.Pt(s.It.
|
|
315
|
+
jg(t, i) {
|
|
316
|
+
this.mg(),
|
|
317
|
+
t.Hm(i),
|
|
318
|
+
(this.gg = i),
|
|
319
|
+
t.id && (this.cg[t.id] = i),
|
|
320
|
+
this.j && (this.j.Pt(s.It.iS, i), this.j.Pt(s.It.nS, this.cg));
|
|
321
321
|
}
|
|
322
322
|
}
|
package/src/types.js
CHANGED
package/src/ui/js/attach-css.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import r, { OPTIONS as U } from "../../managers/braze-instance.js";
|
|
2
2
|
export function attachCSS(n, t, o) {
|
|
3
3
|
const c = n || document.querySelector("head"),
|
|
4
|
-
e = `ab-${t}-css-definitions-${"6.
|
|
4
|
+
e = `ab-${t}-css-definitions-${"6.13.0".replace(/\./g, "-")}`;
|
|
5
5
|
if (!c) return;
|
|
6
6
|
const s = c.ownerDocument || document;
|
|
7
7
|
if (null == s.getElementById(e)) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { attachCSS as Sn } from "./attach-css.js";
|
|
2
|
+
export function attachChatWidgetCSS(t) {
|
|
3
|
+
Sn(
|
|
4
|
+
t,
|
|
5
|
+
"chat-widget",
|
|
6
|
+
".ab-chat-widget{position:fixed;right:0;bottom:0;width:0;height:0;border:none;background:0 0;z-index:9000}",
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
export function setupChatWidgetUI() {
|
|
10
|
+
attachChatWidgetCSS();
|
|
11
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import r, { OPTIONS as U } from "../../managers/braze-instance.js";
|
|
2
2
|
export function loadFontAwesome() {
|
|
3
|
-
if (r.er(U.
|
|
3
|
+
if (r.er(U.vl)) return;
|
|
4
4
|
const e = "https://use.fontawesome.com/7f85a56ba4.css";
|
|
5
5
|
if (
|
|
6
6
|
!(null !== document.querySelector('link[rel=stylesheet][href="' + e + '"]'))
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { isArray as g } from "./code-utils.js";
|
|
2
2
|
export default class Oe {
|
|
3
3
|
constructor() {}
|
|
4
|
-
ef() {}
|
|
5
4
|
ff() {}
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
cf() {}
|
|
6
|
+
jc(t) {}
|
|
7
|
+
static lf(t, e) {
|
|
8
8
|
if (t && e)
|
|
9
|
-
if (((t = t.toLowerCase()), g(e.
|
|
10
|
-
for (let r = 0; r < e.
|
|
11
|
-
if (-1 !== t.indexOf(e.
|
|
12
|
-
} else if (-1 !== t.indexOf(e.
|
|
9
|
+
if (((t = t.toLowerCase()), g(e.uf))) {
|
|
10
|
+
for (let r = 0; r < e.uf.length; r++)
|
|
11
|
+
if (-1 !== t.indexOf(e.uf[r].toLowerCase())) return e.identity;
|
|
12
|
+
} else if (-1 !== t.indexOf(e.uf.toLowerCase())) return e.identity;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -19,17 +19,17 @@ export const BRAZE_ACTIONS = {
|
|
|
19
19
|
removeFromSubscriptionGroup: "removeFromSubscriptionGroup",
|
|
20
20
|
addToCustomAttributeArray: "addToCustomAttributeArray",
|
|
21
21
|
removeFromCustomAttributeArray: "removeFromCustomAttributeArray",
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
co: "openLink",
|
|
23
|
+
mo: "openLinkInWebView",
|
|
24
24
|
},
|
|
25
25
|
properties: { type: "type", eo: "steps", so: "args" },
|
|
26
26
|
};
|
|
27
27
|
export const INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES = {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
ya: "unknownBrazeAction",
|
|
29
|
+
cp: "noPushPrompt",
|
|
30
30
|
};
|
|
31
31
|
export const ineligibleBrazeActionURLErrorMessage = (t, o) =>
|
|
32
|
-
t === INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.
|
|
32
|
+
t === INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.ya
|
|
33
33
|
? `${o} contains an unknown braze action type and will not be displayed.`
|
|
34
34
|
: "";
|
|
35
35
|
export function getDecodedBrazeAction(t) {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { Browsers as
|
|
4
|
-
class
|
|
1
|
+
import yi from "./client-hints-parser.js";
|
|
2
|
+
import xi from "./user-agent-parser.js";
|
|
3
|
+
import { Browsers as Bi, OperatingSystems as so } from "./device-constants.js";
|
|
4
|
+
class Oi {
|
|
5
5
|
constructor() {
|
|
6
6
|
let t;
|
|
7
7
|
(t =
|
|
8
|
-
navigator.userAgent.toLowerCase().includes(
|
|
8
|
+
navigator.userAgent.toLowerCase().includes(Bi.Sg.toLowerCase()) ||
|
|
9
9
|
!navigator.userAgentData
|
|
10
|
-
?
|
|
11
|
-
:
|
|
12
|
-
(this.
|
|
10
|
+
? xi
|
|
11
|
+
: yi),
|
|
12
|
+
(this.xg = new t()),
|
|
13
13
|
(this.userAgent = navigator.userAgent),
|
|
14
|
-
(this.browser = this.
|
|
15
|
-
(this.version = this.
|
|
14
|
+
(this.browser = this.xg.ff()),
|
|
15
|
+
(this.version = this.xg.cf()),
|
|
16
16
|
(this.OS = null),
|
|
17
|
-
this.
|
|
17
|
+
this.jc().then((t) => (this.OS = t));
|
|
18
18
|
const i = navigator;
|
|
19
19
|
(this.language = (
|
|
20
20
|
i.userLanguage ||
|
|
@@ -23,20 +23,20 @@ class Bi {
|
|
|
23
23
|
i.systemLanguage ||
|
|
24
24
|
""
|
|
25
25
|
).toLowerCase()),
|
|
26
|
-
(this.
|
|
26
|
+
(this.kl = Oi.Bg(this.userAgent));
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
return this.browser ===
|
|
28
|
+
NS() {
|
|
29
|
+
return this.browser === Bi.Og;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
Ic() {
|
|
32
32
|
return this.OS || null;
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
jc() {
|
|
35
35
|
return this.OS
|
|
36
36
|
? Promise.resolve(this.OS)
|
|
37
|
-
: this.
|
|
37
|
+
: this.xg.jc(Oi.Pg).then((t) => ((this.OS = t), t));
|
|
38
38
|
}
|
|
39
|
-
static
|
|
39
|
+
static Bg(t) {
|
|
40
40
|
t = t.toLowerCase();
|
|
41
41
|
const i = [
|
|
42
42
|
"bot",
|
|
@@ -63,33 +63,33 @@ class Bi {
|
|
|
63
63
|
return !1;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
{ string: navigator.platform,
|
|
68
|
-
{ string: navigator.platform,
|
|
69
|
-
{ string: navigator.platform,
|
|
70
|
-
{ string: navigator.platform,
|
|
71
|
-
{ string: navigator.platform,
|
|
72
|
-
{ string: navigator.platform,
|
|
73
|
-
{ string: navigator.platform,
|
|
74
|
-
{ string: navigator.platform,
|
|
75
|
-
{ string: navigator.platform,
|
|
66
|
+
Oi.Pg = [
|
|
67
|
+
{ string: navigator.platform, uf: "Win", identity: so.Wg },
|
|
68
|
+
{ string: navigator.platform, uf: "Mac", identity: so.Cg },
|
|
69
|
+
{ string: navigator.platform, uf: "BlackBerry", identity: "BlackBerry" },
|
|
70
|
+
{ string: navigator.platform, uf: "FreeBSD", identity: "FreeBSD" },
|
|
71
|
+
{ string: navigator.platform, uf: "OpenBSD", identity: "OpenBSD" },
|
|
72
|
+
{ string: navigator.platform, uf: "Nintendo", identity: "Nintendo" },
|
|
73
|
+
{ string: navigator.platform, uf: "SunOS", identity: "SunOS" },
|
|
74
|
+
{ string: navigator.platform, uf: "PlayStation", identity: "PlayStation" },
|
|
75
|
+
{ string: navigator.platform, uf: "X11", identity: "X11" },
|
|
76
76
|
{
|
|
77
77
|
string: navigator.userAgent,
|
|
78
|
-
|
|
79
|
-
identity: so.
|
|
78
|
+
uf: ["iPhone", "iPad", "iPod"],
|
|
79
|
+
identity: so.ao,
|
|
80
80
|
},
|
|
81
|
-
{ string: navigator.platform,
|
|
82
|
-
{ string: navigator.userAgent,
|
|
83
|
-
{ string: navigator.userAgent,
|
|
84
|
-
{ string: navigator.userAgent,
|
|
85
|
-
{ string: navigator.userAgent,
|
|
81
|
+
{ string: navigator.platform, uf: "Pike v", identity: so.ao },
|
|
82
|
+
{ string: navigator.userAgent, uf: ["Web0S"], identity: "WebOS" },
|
|
83
|
+
{ string: navigator.userAgent, uf: "Tizen", identity: "Tizen" },
|
|
84
|
+
{ string: navigator.userAgent, uf: "Coolita", identity: "Other Smart TV" },
|
|
85
|
+
{ string: navigator.userAgent, uf: "WhaleTV", identity: "Other Smart TV" },
|
|
86
86
|
{
|
|
87
87
|
string: navigator.platform,
|
|
88
|
-
|
|
89
|
-
identity: so.
|
|
88
|
+
uf: ["Linux armv7l", "Android"],
|
|
89
|
+
identity: so.Fg,
|
|
90
90
|
},
|
|
91
|
-
{ string: navigator.userAgent,
|
|
92
|
-
{ string: navigator.platform,
|
|
91
|
+
{ string: navigator.userAgent, uf: ["Android"], identity: so.Fg },
|
|
92
|
+
{ string: navigator.platform, uf: "Linux", identity: "Linux" },
|
|
93
93
|
];
|
|
94
|
-
const
|
|
95
|
-
export {
|
|
94
|
+
const eo = new Oi();
|
|
95
|
+
export { eo as default, Oi as BrowserDetector };
|