@braze/web-sdk 4.9.0 → 4.10.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 +2296 -2235
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +1 -8
- package/shared-lib/encoding-utils.js +1 -12
- package/shared-lib/event-types.js +1 -34
- package/shared-lib/guid.js +1 -10
- package/shared-lib/indexed-db-adapter.js +1 -352
- package/shared-lib/logger.js +1 -38
- package/shared-lib/supported-options.js +1 -26
- package/shared-lib/types.js +1 -1
- package/src/Card/card-manager-factory.js +1 -14
- package/src/Card/card-manager.js +1 -78
- package/src/Card/display/card-display.js +1 -138
- package/src/Card/index.js +1 -6
- package/src/Card/log-card-click.js +1 -11
- package/src/Card/log-card-dismissal.js +1 -11
- package/src/Card/log-card-impressions.js +1 -13
- package/src/Card/log-content-card-click.js +1 -4
- package/src/Card/log-content-card-impressions.js +1 -4
- package/src/Card/models/banner.js +1 -31
- package/src/Card/models/captioned-image.js +1 -33
- package/src/Card/models/card.js +1 -196
- package/src/Card/models/classic-card.js +1 -32
- package/src/Card/models/control-card.js +1 -23
- package/src/Card/models/image-only.js +1 -32
- package/src/Card/models/index.js +1 -6
- package/src/Card/types.js +1 -1
- package/src/Card/util/card-factory.js +1 -104
- package/src/ContentCards/content-cards-provider-factory.js +1 -20
- package/src/ContentCards/content-cards-provider.js +1 -391
- package/src/ContentCards/content-cards.js +1 -24
- package/src/ContentCards/get-cached-content-cards.js +1 -5
- package/src/ContentCards/index.js +1 -8
- package/src/ContentCards/log-content-cards-displayed.js +1 -5
- package/src/ContentCards/request-content-cards-refresh.js +1 -5
- package/src/ContentCards/subscribe-to-content-cards-updates.js +1 -17
- package/src/ContentCards/types.js +1 -1
- package/src/ContentCards/ui/hide-content-cards.js +1 -8
- package/src/ContentCards/ui/show-content-cards.js +1 -77
- package/src/ContentCards/ui/toggle-content-cards.js +1 -8
- package/src/Core/add-sdk-metadata.js +1 -26
- package/src/Core/braze-sdk-metadata.js +1 -10
- package/src/Core/change-user.js +1 -17
- package/src/Core/destroy.js +1 -5
- package/src/Core/device-properties.js +1 -9
- package/src/Core/disable-sdk.js +1 -15
- package/src/Core/enable-sdk.js +1 -11
- package/src/Core/get-device-id.js +1 -11
- package/src/Core/get-user.js +1 -4
- package/src/Core/handle-braze-action.js +1 -87
- package/src/Core/index.js +1 -23
- package/src/Core/initialize.js +1 -4
- package/src/Core/is-disabled.js +1 -4
- package/src/Core/log-custom-event.js +1 -38
- package/src/Core/log-purchase.js +1 -245
- package/src/Core/open-session.js +1 -25
- package/src/Core/remove-all-subscriptions.js +1 -4
- package/src/Core/remove-subscription.js +1 -4
- package/src/Core/request-immediate-data-flush.js +1 -6
- package/src/Core/set-logger.js +1 -4
- package/src/Core/set-sdk-authentication-signature.js +1 -8
- package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -6
- package/src/Core/toggle-logging.js +1 -4
- package/src/Core/types.js +1 -1
- package/src/Core/wipe-data.js +1 -16
- package/src/FeatureFlags/feature-flag-factory.js +1 -24
- package/src/FeatureFlags/feature-flag.js +1 -64
- package/src/FeatureFlags/feature-flags-provider-factory.js +1 -19
- package/src/FeatureFlags/feature-flags-provider.js +1 -145
- package/src/FeatureFlags/get-all-feature-flags.js +1 -12
- package/src/FeatureFlags/get-feature-flag.js +1 -12
- package/src/FeatureFlags/index.js +1 -6
- package/src/FeatureFlags/log-feature-flag-impression.js +1 -23
- package/src/FeatureFlags/refresh-feature-flags.js +1 -9
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -9
- package/src/FeatureFlags/types.js +1 -1
- package/src/Feed/feed-provider-factory.js +1 -18
- package/src/Feed/feed-provider.js +1 -90
- package/src/Feed/feed.js +1 -20
- package/src/Feed/get-cached-feed.js +1 -5
- package/src/Feed/index.js +1 -8
- package/src/Feed/log-feed-displayed.js +1 -7
- package/src/Feed/request-feed-refresh.js +1 -5
- package/src/Feed/subscribe-to-feed-updates.js +1 -5
- package/src/Feed/types.js +1 -1
- package/src/Feed/ui/hide-feed.js +1 -7
- package/src/Feed/ui/show-feed.js +1 -96
- package/src/Feed/ui/toggle-feed.js +1 -8
- package/src/InAppMessage/defer-in-app-message.js +1 -13
- package/src/InAppMessage/display/get-animation-effect.js +1 -19
- package/src/InAppMessage/display/html-message-to-html.js +1 -244
- package/src/InAppMessage/display/in-app-message-to-html.js +1 -188
- package/src/InAppMessage/display/modal-utils.js +1 -73
- package/src/InAppMessage/get-deferred-in-app-message.js +1 -5
- package/src/InAppMessage/in-app-message-factory.js +1 -166
- package/src/InAppMessage/in-app-message-manager-factory.js +1 -16
- package/src/InAppMessage/in-app-message-manager.js +1 -248
- package/src/InAppMessage/index.js +1 -16
- package/src/InAppMessage/log-in-app-message-button-click.js +1 -27
- package/src/InAppMessage/log-in-app-message-click.js +1 -19
- package/src/InAppMessage/log-in-app-message-html-click.js +1 -23
- package/src/InAppMessage/log-in-app-message-impression.js +1 -13
- package/src/InAppMessage/models/control-message.js +1 -11
- package/src/InAppMessage/models/full-screen-message.js +1 -105
- package/src/InAppMessage/models/html-message.js +1 -68
- package/src/InAppMessage/models/in-app-message-button.js +1 -47
- package/src/InAppMessage/models/in-app-message.js +1 -382
- package/src/InAppMessage/models/modal-message.js +1 -101
- package/src/InAppMessage/models/slide-up-message.js +1 -84
- package/src/InAppMessage/models/templated-in-app-message.js +1 -19
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -10
- package/src/InAppMessage/types.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +1 -15
- package/src/InAppMessage/ui/show-in-app-message.js +1 -181
- package/src/InAppMessage/utils/in-app-message-utils.js +1 -1
- package/src/Push/index.js +1 -5
- package/src/Push/is-push-blocked.js +1 -5
- package/src/Push/is-push-permission-granted.js +1 -5
- package/src/Push/is-push-supported.js +1 -5
- package/src/Push/push-manager-factory.js +1 -30
- package/src/Push/push-manager.js +1 -387
- package/src/Push/request-push-permission.js +1 -9
- package/src/Push/types.js +1 -1
- package/src/Push/unregister-push.js +1 -5
- package/src/Push/utils/push-utils.js +1 -36
- package/src/User/index.js +1 -1
- package/src/User/types.js +1 -1
- package/src/User/user-manager.js +1 -73
- package/src/User/user.js +1 -301
- package/src/common/base-feed.js +1 -28
- package/src/common/base-provider.js +1 -6
- package/src/common/constants.js +1 -14
- package/src/common/event-logger.js +1 -31
- package/src/common/feed-display.js +1 -210
- package/src/common/translations.js +1 -148
- package/src/common/types.js +1 -1
- package/src/index.js +1 -9
- package/src/l10n/l10n-manager-factory.js +1 -22
- package/src/l10n/l10n-manager.js +1 -25
- package/src/l10n/types.js +1 -1
- package/src/managers/auth-manager.js +1 -51
- package/src/managers/braze-instance.js +1 -329
- package/src/managers/device-manager.js +1 -85
- package/src/managers/network-manager.js +1 -253
- package/src/managers/server-config-manager.js +1 -108
- package/src/managers/session-manager.js +1 -75
- package/src/managers/storage-manager-factory.js +1 -42
- package/src/managers/storage-manager.js +1 -419
- package/src/managers/subscription-manager.js +1 -28
- package/src/managers/types.js +1 -1
- package/src/models/backend-errors.js +1 -8
- package/src/models/braze-event.js +1 -47
- package/src/models/braze-sdk-metadata.js +1 -10
- package/src/models/device.js +1 -18
- package/src/models/identifier.js +1 -19
- package/src/models/push-token.js +1 -27
- package/src/models/request-result.js +1 -8
- package/src/models/server-config.js +1 -48
- package/src/models/types.js +1 -1
- package/src/request-controller.js +1 -307
- package/src/triggers/models/custom-event-data.js +1 -14
- package/src/triggers/models/custom-event-property-data.js +1 -21
- package/src/triggers/models/filter-set.js +1 -55
- package/src/triggers/models/filter.js +1 -102
- package/src/triggers/models/in-app-message-click-data.js +1 -25
- package/src/triggers/models/purchase-data.js +1 -14
- package/src/triggers/models/purchase-property-data.js +1 -21
- package/src/triggers/models/push-click-data.js +1 -15
- package/src/triggers/models/trigger-condition.js +1 -105
- package/src/triggers/models/trigger-events.js +1 -8
- package/src/triggers/models/trigger.js +1 -122
- package/src/triggers/triggers-provider-factory.js +1 -34
- package/src/triggers/triggers-provider.js +1 -326
- package/src/triggers/types.js +1 -1
- package/src/types.js +1 -1
- package/src/ui/js/attach-css.js +1 -13
- package/src/ui/js/feed-css.js +1 -12
- package/src/ui/js/iam-css.js +1 -12
- package/src/ui/js/index.js +1 -3
- package/src/ui/js/load-font-awesome.js +1 -13
- package/src/util/base-device-parser.js +1 -14
- package/src/util/braze-actions.js +1 -84
- package/src/util/browser-detector.js +1 -84
- package/src/util/client-hints-parser.js +1 -66
- package/src/util/code-utils.js +1 -100
- package/src/util/color-utils.js +1 -29
- package/src/util/component-utils.js +1 -26
- package/src/util/date-utils.js +1 -28
- package/src/util/deprecation-utils.js +1 -5
- package/src/util/device-constants.js +1 -14
- package/src/util/dom-utils.js +1 -91
- package/src/util/error-utils.js +1 -2
- package/src/util/key-codes.js +1 -1
- package/src/util/math.js +1 -5
- package/src/util/net.js +1 -71
- package/src/util/request-header-utils.js +1 -46
- package/src/util/string-utils.js +1 -22
- package/src/util/types.js +1 -1
- package/src/util/url-utils.js +1 -20
- package/src/util/user-agent-parser.js +1 -85
- package/src/util/validation-utils.js +1 -217
- package/src/util/window-utils.js +1 -34
package/package.json
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
import ve from
|
|
2
|
-
import { EventTypes as De, InternalEventTypes as Be } from "./event-types.js";
|
|
3
|
-
import Ge from "./guid.js";
|
|
4
|
-
import Oe from "./indexed-db-adapter.js";
|
|
5
|
-
import Ue from "./logger.js";
|
|
6
|
-
import ke from "./supported-options.js";
|
|
7
|
-
const r = { On: ve, q: De, Cr: Be, Z: Ge, xt: Oe, zt: Oe.ep, j: Ue, Jo: ke };
|
|
8
|
-
export default r;
|
|
1
|
+
import ve from"./encoding-utils.js";import{EventTypes as De,InternalEventTypes as Be}from"./event-types.js";import Ge from"./guid.js";import Oe from"./indexed-db-adapter.js";import Ue from"./logger.js";import ke from"./supported-options.js";const r={On:ve,q:De,Cr:Be,Z:Ge,xt:Oe,zt:Oe.ep,j:Ue,Yo:ke};export default r;
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
const ve =
|
|
2
|
-
Fn: function (t) {
|
|
3
|
-
const r = (t + "=".repeat((4 - (t.length % 4)) % 4))
|
|
4
|
-
.replace(/\-/g, "+")
|
|
5
|
-
.replace(/_/g, "/"),
|
|
6
|
-
n = atob(r),
|
|
7
|
-
o = new Uint8Array(n.length);
|
|
8
|
-
for (let t = 0; t < n.length; ++t) o[t] = n.charCodeAt(t);
|
|
9
|
-
return o;
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
export default ve;
|
|
1
|
+
const ve={Fn:function(t){const r=(t+"=".repeat((4-t.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(r),o=new Uint8Array(n.length);for(let t=0;t<n.length;++t)o[t]=n.charCodeAt(t);return o}};export default ve;
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
const De
|
|
2
|
-
CustomEvent: "ce",
|
|
3
|
-
Pr: "p",
|
|
4
|
-
$u: "pc",
|
|
5
|
-
dc: "ca",
|
|
6
|
-
Va: "i",
|
|
7
|
-
qs: "ie",
|
|
8
|
-
P: "cci",
|
|
9
|
-
T: "ccic",
|
|
10
|
-
$: "ccc",
|
|
11
|
-
H: "ccd",
|
|
12
|
-
Wl: "ss",
|
|
13
|
-
xl: "se",
|
|
14
|
-
Vi: "si",
|
|
15
|
-
Li: "sc",
|
|
16
|
-
Qi: "sbc",
|
|
17
|
-
Ki: "sfe",
|
|
18
|
-
eo: "iec",
|
|
19
|
-
Su: "lr",
|
|
20
|
-
ju: "uae",
|
|
21
|
-
R: "ci",
|
|
22
|
-
B: "cc",
|
|
23
|
-
Au: "lcaa",
|
|
24
|
-
qu: "lcar",
|
|
25
|
-
Xn: "inc",
|
|
26
|
-
Jn: "add",
|
|
27
|
-
Qn: "rem",
|
|
28
|
-
Hn: "set",
|
|
29
|
-
Kn: "ncam",
|
|
30
|
-
Cu: "sgu",
|
|
31
|
-
Fr: "ffi",
|
|
32
|
-
},
|
|
33
|
-
Be = { Br: "feed_displayed", vc: "content_cards_displayed" };
|
|
34
|
-
export { De as EventTypes, Be as InternalEventTypes };
|
|
1
|
+
const De={CustomEvent:"ce",Pr:"p",Mu:"pc",cc:"ca",Ka:"i",qs:"ie",P:"cci",T:"ccic",$:"ccc",H:"ccd",Wl:"ss",xl:"se",Vi:"si",Li:"sc",Qi:"sbc",Ki:"sfe",eo:"iec",Lu:"lr",Tu:"uae",R:"ci",B:"cc",Ru:"lcaa",Pu:"lcar",Xn:"inc",Jn:"add",Qn:"rem",Hn:"set",Kn:"ncam",Nu:"sgu",Fr:"ffi"},Be={Br:"feed_displayed",dc:"content_cards_displayed"};export{De as EventTypes,Be as InternalEventTypes};
|
package/shared-lib/guid.js
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
const Ge =
|
|
2
|
-
Y: function () {
|
|
3
|
-
const t = (t = !1) => {
|
|
4
|
-
const n = (Math.random().toString(16) + "000000000").substr(2, 8);
|
|
5
|
-
return t ? "-" + n.substr(0, 4) + "-" + n.substr(4, 4) : n;
|
|
6
|
-
};
|
|
7
|
-
return t() + t(!0) + t(!0) + t();
|
|
8
|
-
},
|
|
9
|
-
};
|
|
10
|
-
export default Ge;
|
|
1
|
+
const Ge={Y:function(){const t=(t=!1)=>{const n=(Math.random().toString(16)+"000000000").substr(2,8);return t?"-"+n.substr(0,4)+"-"+n.substr(4,4):n};return t()+t(!0)+t(!0)+t()}};export default Ge;
|
|
@@ -1,352 +1 @@
|
|
|
1
|
-
export default class Oe {
|
|
2
|
-
constructor(t, e) {
|
|
3
|
-
(this.database = t),
|
|
4
|
-
(this.j = e),
|
|
5
|
-
(this.parent = "undefined" == typeof window ? self : window),
|
|
6
|
-
(this.database = t),
|
|
7
|
-
(this.j = e);
|
|
8
|
-
}
|
|
9
|
-
td() {
|
|
10
|
-
if ("indexedDB" in this.parent) return this.parent.indexedDB;
|
|
11
|
-
}
|
|
12
|
-
isSupported() {
|
|
13
|
-
var t;
|
|
14
|
-
try {
|
|
15
|
-
if (null == this.td()) return !1;
|
|
16
|
-
{
|
|
17
|
-
const e =
|
|
18
|
-
null === (t = this.td()) || void 0 === t
|
|
19
|
-
? void 0
|
|
20
|
-
: t.open("Braze IndexedDB Support Test");
|
|
21
|
-
if (
|
|
22
|
-
(e &&
|
|
23
|
-
((e.onupgradeneeded = () => e.result.close()),
|
|
24
|
-
(e.onsuccess = () => e.result.close())),
|
|
25
|
-
"undefined" != typeof window)
|
|
26
|
-
) {
|
|
27
|
-
const t = window,
|
|
28
|
-
e = t.chrome || t.browser || t.ed;
|
|
29
|
-
if (e && e.runtime && e.runtime.id)
|
|
30
|
-
return (
|
|
31
|
-
this.j.info(
|
|
32
|
-
"Not using IndexedDB for storage because we are running inside an extension",
|
|
33
|
-
),
|
|
34
|
-
!1
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
return !0;
|
|
38
|
-
}
|
|
39
|
-
} catch (t) {
|
|
40
|
-
return (
|
|
41
|
-
this.j.info(
|
|
42
|
-
"Not using IndexedDB for storage due to following error: " + t,
|
|
43
|
-
),
|
|
44
|
-
!1
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
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;
|
|
56
|
-
return (
|
|
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
|
-
"...",
|
|
65
|
-
);
|
|
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
|
-
}
|
|
73
|
-
}),
|
|
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(),
|
|
79
|
-
"function" == typeof e && e(),
|
|
80
|
-
i.j.error(
|
|
81
|
-
"Needed to close the database unexpectedly because of an upgrade in another tab",
|
|
82
|
-
);
|
|
83
|
-
}),
|
|
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
|
-
);
|
|
101
|
-
}),
|
|
102
|
-
!0
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
setItem(t, e, n, o, i) {
|
|
106
|
-
if (!this.isSupported()) return "function" == typeof i && i(), !1;
|
|
107
|
-
const r = this;
|
|
108
|
-
return this.nd((d) => {
|
|
109
|
-
if (!d.objectStoreNames.contains(t))
|
|
110
|
-
return (
|
|
111
|
-
r.j.error(
|
|
112
|
-
"Could not store object " +
|
|
113
|
-
e +
|
|
114
|
-
" in " +
|
|
115
|
-
t +
|
|
116
|
-
" on indexedDB " +
|
|
117
|
-
r.database.od +
|
|
118
|
-
" - " +
|
|
119
|
-
t +
|
|
120
|
-
" is not a valid objectStore",
|
|
121
|
-
),
|
|
122
|
-
"function" == typeof i && i(),
|
|
123
|
-
void d.close()
|
|
124
|
-
);
|
|
125
|
-
const s = d.transaction([t], "readwrite");
|
|
126
|
-
s.oncomplete = () => d.close();
|
|
127
|
-
const u = s.objectStore(t).put(n, e);
|
|
128
|
-
(u.onerror = () => {
|
|
129
|
-
r.j.error(
|
|
130
|
-
"Could not store object " +
|
|
131
|
-
e +
|
|
132
|
-
" in " +
|
|
133
|
-
t +
|
|
134
|
-
" on indexedDB " +
|
|
135
|
-
r.database.od,
|
|
136
|
-
),
|
|
137
|
-
"function" == typeof i && i();
|
|
138
|
-
}),
|
|
139
|
-
(u.onsuccess = () => {
|
|
140
|
-
"function" == typeof o && o();
|
|
141
|
-
});
|
|
142
|
-
}, i);
|
|
143
|
-
}
|
|
144
|
-
getItem(t, e, n) {
|
|
145
|
-
if (!this.isSupported()) return !1;
|
|
146
|
-
const o = this;
|
|
147
|
-
return this.nd((i) => {
|
|
148
|
-
if (!i.objectStoreNames.contains(t))
|
|
149
|
-
return (
|
|
150
|
-
o.j.error(
|
|
151
|
-
"Could not retrieve object " +
|
|
152
|
-
e +
|
|
153
|
-
" in " +
|
|
154
|
-
t +
|
|
155
|
-
" on indexedDB " +
|
|
156
|
-
o.database.od +
|
|
157
|
-
" - " +
|
|
158
|
-
t +
|
|
159
|
-
" is not a valid objectStore",
|
|
160
|
-
),
|
|
161
|
-
void i.close()
|
|
162
|
-
);
|
|
163
|
-
const r = i.transaction([t], "readonly");
|
|
164
|
-
r.oncomplete = () => i.close();
|
|
165
|
-
const d = r.objectStore(t).get(e);
|
|
166
|
-
(d.onerror = () => {
|
|
167
|
-
o.j.error(
|
|
168
|
-
"Could not retrieve object " +
|
|
169
|
-
e +
|
|
170
|
-
" in " +
|
|
171
|
-
t +
|
|
172
|
-
" on indexedDB " +
|
|
173
|
-
o.database.od,
|
|
174
|
-
);
|
|
175
|
-
}),
|
|
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);
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
hr(t, e, n) {
|
|
184
|
-
if (!this.isSupported()) return "function" == typeof n && n(), !1;
|
|
185
|
-
const o = this;
|
|
186
|
-
return this.nd((i) => {
|
|
187
|
-
if (!i.objectStoreNames.contains(t))
|
|
188
|
-
return (
|
|
189
|
-
o.j.error(
|
|
190
|
-
"Could not retrieve last record from " +
|
|
191
|
-
t +
|
|
192
|
-
" on indexedDB " +
|
|
193
|
-
o.database.od +
|
|
194
|
-
" - " +
|
|
195
|
-
t +
|
|
196
|
-
" is not a valid objectStore",
|
|
197
|
-
),
|
|
198
|
-
"function" == typeof n && n(),
|
|
199
|
-
void i.close()
|
|
200
|
-
);
|
|
201
|
-
const r = i.transaction([t], "readonly");
|
|
202
|
-
r.oncomplete = () => i.close();
|
|
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,
|
|
207
|
-
),
|
|
208
|
-
"function" == typeof n && n();
|
|
209
|
-
}),
|
|
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)
|
|
215
|
-
: "function" == typeof n && n();
|
|
216
|
-
});
|
|
217
|
-
}, n);
|
|
218
|
-
}
|
|
219
|
-
oe(t, e) {
|
|
220
|
-
if (!this.isSupported()) return !1;
|
|
221
|
-
const n = this;
|
|
222
|
-
return this.nd((o) => {
|
|
223
|
-
if (!o.objectStoreNames.contains(t))
|
|
224
|
-
return (
|
|
225
|
-
n.j.error(
|
|
226
|
-
"Could not delete record " +
|
|
227
|
-
e +
|
|
228
|
-
" from " +
|
|
229
|
-
t +
|
|
230
|
-
" on indexedDB " +
|
|
231
|
-
n.database.od +
|
|
232
|
-
" - " +
|
|
233
|
-
t +
|
|
234
|
-
" is not a valid objectStore",
|
|
235
|
-
),
|
|
236
|
-
void o.close()
|
|
237
|
-
);
|
|
238
|
-
const i = o.transaction([t], "readwrite");
|
|
239
|
-
i.oncomplete = () => o.close();
|
|
240
|
-
i.objectStore(t).delete(e).onerror = () => {
|
|
241
|
-
n.j.error(
|
|
242
|
-
"Could not delete record " +
|
|
243
|
-
e +
|
|
244
|
-
" from " +
|
|
245
|
-
t +
|
|
246
|
-
" on indexedDB " +
|
|
247
|
-
n.database.od,
|
|
248
|
-
);
|
|
249
|
-
};
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
Mt(t, e) {
|
|
253
|
-
if (!this.isSupported()) return !1;
|
|
254
|
-
const n = this;
|
|
255
|
-
return this.nd((o) => {
|
|
256
|
-
if (!o.objectStoreNames.contains(t))
|
|
257
|
-
return (
|
|
258
|
-
n.j.error(
|
|
259
|
-
"Could not retrieve objects from " +
|
|
260
|
-
t +
|
|
261
|
-
" on indexedDB " +
|
|
262
|
-
n.database.od +
|
|
263
|
-
" - " +
|
|
264
|
-
t +
|
|
265
|
-
" is not a valid objectStore",
|
|
266
|
-
),
|
|
267
|
-
void o.close()
|
|
268
|
-
);
|
|
269
|
-
const i = o.transaction([t], "readwrite");
|
|
270
|
-
i.oncomplete = () => o.close();
|
|
271
|
-
const r = i.objectStore(t),
|
|
272
|
-
d = r.openCursor(),
|
|
273
|
-
s = [];
|
|
274
|
-
(d.onerror = () => {
|
|
275
|
-
s.length > 0
|
|
276
|
-
? (n.j.info(
|
|
277
|
-
"Cursor closed midway through for " +
|
|
278
|
-
t +
|
|
279
|
-
" on indexedDB " +
|
|
280
|
-
n.database.od,
|
|
281
|
-
),
|
|
282
|
-
e(s))
|
|
283
|
-
: n.j.error(
|
|
284
|
-
"Could not open cursor for " +
|
|
285
|
-
t +
|
|
286
|
-
" on indexedDB " +
|
|
287
|
-
n.database.od,
|
|
288
|
-
);
|
|
289
|
-
}),
|
|
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);
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
"function" == typeof o.continue && o.continue();
|
|
300
|
-
} else s.length > 0 && e(s);
|
|
301
|
-
});
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
clearData() {
|
|
305
|
-
if (!this.isSupported()) return !1;
|
|
306
|
-
const t = [];
|
|
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
|
-
}
|
|
313
|
-
const e = this;
|
|
314
|
-
return this.nd(function (n) {
|
|
315
|
-
const o = n.transaction(t, "readwrite");
|
|
316
|
-
o.oncomplete = () => n.close();
|
|
317
|
-
for (let n = 0; n < t.length; n++) {
|
|
318
|
-
const i = t[n];
|
|
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,
|
|
325
|
-
);
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
o.onerror = function () {
|
|
329
|
-
e.j.error(
|
|
330
|
-
"Could not clear object stores on indexedDB " + e.database.od,
|
|
331
|
-
);
|
|
332
|
-
};
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
Oe.ep = {
|
|
337
|
-
Ft: {
|
|
338
|
-
od: "AppboyServiceWorkerAsyncStorage",
|
|
339
|
-
VERSION: 6,
|
|
340
|
-
Jt: {
|
|
341
|
-
Ja: "data",
|
|
342
|
-
kr: "pushClicks",
|
|
343
|
-
cu: "pushSubscribed",
|
|
344
|
-
dd: "fallbackDevice",
|
|
345
|
-
qt: "cardUpdates",
|
|
346
|
-
se: "optOut",
|
|
347
|
-
wr: "pendingData",
|
|
348
|
-
qh: "sdkAuthenticationSignature",
|
|
349
|
-
},
|
|
350
|
-
ie: 1,
|
|
351
|
-
},
|
|
352
|
-
};
|
|
1
|
+
export default class Oe{constructor(t,e){this.database=t,this.j=e,this.parent="undefined"==typeof window?self:window,this.database=t,this.j=e}td(){if("indexedDB"in this.parent)return this.parent.indexedDB}isSupported(){var t;try{if(null==this.td())return!1;{const e=null===(t=this.td())||void 0===t?void 0:t.open("Braze IndexedDB Support Test");if(e&&(e.onupgradeneeded=()=>e.result.close(),e.onsuccess=()=>e.result.close()),"undefined"!=typeof window){const t=window,e=t.chrome||t.browser||t.ed;if(e&&e.runtime&&e.runtime.id)return this.j.info("Not using IndexedDB for storage because we are running inside an extension"),!1}return!0}}catch(t){return this.j.info("Not using IndexedDB for storage due to following error: "+t),!1}}nd(t,e){var n;const o=null===(n=this.td())||void 0===n?void 0:n.open(this.database.od,this.database.VERSION);if(null==o)return"function"==typeof e&&e(),!1;const i=this;return o.onupgradeneeded=t=>{var e;i.j.info("Upgrading indexedDB "+i.database.od+" to v"+i.database.VERSION+"...");const n=null===(e=t.target)||void 0===e?void 0:e.result;for(const t in i.database.Jt){const e=t;i.database.Jt.hasOwnProperty(t)&&!n.objectStoreNames.contains(i.database.Jt[e])&&n.createObjectStore(i.database.Jt[e])}},o.onsuccess=n=>{var o;const r=null===(o=n.target)||void 0===o?void 0:o.result;r.onversionchange=()=>{r.close(),"function"==typeof e&&e(),i.j.error("Needed to close the database unexpectedly because of an upgrade in another tab")},t(r)},o.onerror=t=>{var n;const o=t;return i.j.info("Could not open indexedDB "+i.database.od+" v"+i.database.VERSION+": "+(null===(n=o.target)||void 0===n?void 0:n.errorCode)),"function"==typeof e&&e(),!0},!0}setItem(t,e,n,o,i){if(!this.isSupported())return"function"==typeof i&&i(),!1;const r=this;return this.nd((d=>{if(!d.objectStoreNames.contains(t))return r.j.error("Could not store object "+e+" in "+t+" on indexedDB "+r.database.od+" - "+t+" is not a valid objectStore"),"function"==typeof i&&i(),void d.close();const s=d.transaction([t],"readwrite");s.oncomplete=()=>d.close();const u=s.objectStore(t).put(n,e);u.onerror=()=>{r.j.error("Could not store object "+e+" in "+t+" on indexedDB "+r.database.od),"function"==typeof i&&i()},u.onsuccess=()=>{"function"==typeof o&&o()}}),i)}getItem(t,e,n){if(!this.isSupported())return!1;const o=this;return this.nd((i=>{if(!i.objectStoreNames.contains(t))return o.j.error("Could not retrieve object "+e+" in "+t+" on indexedDB "+o.database.od+" - "+t+" is not a valid objectStore"),void i.close();const r=i.transaction([t],"readonly");r.oncomplete=()=>i.close();const d=r.objectStore(t).get(e);d.onerror=()=>{o.j.error("Could not retrieve object "+e+" in "+t+" on indexedDB "+o.database.od)},d.onsuccess=t=>{var e;const o=null===(e=t.target)||void 0===e?void 0:e.result;null!=o&&n(o)}}))}hr(t,e,n){if(!this.isSupported())return"function"==typeof n&&n(),!1;const o=this;return this.nd((i=>{if(!i.objectStoreNames.contains(t))return o.j.error("Could not retrieve last record from "+t+" on indexedDB "+o.database.od+" - "+t+" is not a valid objectStore"),"function"==typeof n&&n(),void i.close();const r=i.transaction([t],"readonly");r.oncomplete=()=>i.close();const d=r.objectStore(t).openCursor(null,"prev");d.onerror=()=>{o.j.error("Could not open cursor for "+t+" on indexedDB "+o.database.od),"function"==typeof n&&n()},d.onsuccess=t=>{var o;const i=null===(o=t.target)||void 0===o?void 0:o.result;null!=i&&null!=i.value&&null!=i.key?e(i.key,i.value):"function"==typeof n&&n()}}),n)}oe(t,e){if(!this.isSupported())return!1;const n=this;return this.nd((o=>{if(!o.objectStoreNames.contains(t))return n.j.error("Could not delete record "+e+" from "+t+" on indexedDB "+n.database.od+" - "+t+" is not a valid objectStore"),void o.close();const i=o.transaction([t],"readwrite");i.oncomplete=()=>o.close();i.objectStore(t).delete(e).onerror=()=>{n.j.error("Could not delete record "+e+" from "+t+" on indexedDB "+n.database.od)}}))}Mt(t,e){if(!this.isSupported())return!1;const n=this;return this.nd((o=>{if(!o.objectStoreNames.contains(t))return n.j.error("Could not retrieve objects from "+t+" on indexedDB "+n.database.od+" - "+t+" is not a valid objectStore"),void o.close();const i=o.transaction([t],"readwrite");i.oncomplete=()=>o.close();const r=i.objectStore(t),d=r.openCursor(),s=[];d.onerror=()=>{s.length>0?(n.j.info("Cursor closed midway through for "+t+" on indexedDB "+n.database.od),e(s)):n.j.error("Could not open cursor for "+t+" on indexedDB "+n.database.od)},d.onsuccess=t=>{var n;const o=null===(n=t.target)||void 0===n?void 0:n.result;if(null!=o){if(null!=o.value&&null!=o.key){r.delete(o.key).onsuccess=()=>{s.push(o.value)}}"function"==typeof o.continue&&o.continue()}else s.length>0&&e(s)}}))}clearData(){if(!this.isSupported())return!1;const t=[];for(const e in this.database.Jt){const n=e;this.database.Jt.hasOwnProperty(e)&&this.database.Jt[n]!==this.database.Jt.se&&t.push(this.database.Jt[n])}const e=this;return this.nd((function(n){const o=n.transaction(t,"readwrite");o.oncomplete=()=>n.close();for(let n=0;n<t.length;n++){const i=t[n];o.objectStore(i).clear().onerror=function(){e.j.error("Could not clear "+this.source.name+" on indexedDB "+e.database.od)}}o.onerror=function(){e.j.error("Could not clear object stores on indexedDB "+e.database.od)}}))}}Oe.ep={Ft:{od:"AppboyServiceWorkerAsyncStorage",VERSION:6,Jt:{Na:"data",kr:"pushClicks",cu:"pushSubscribed",dd:"fallbackDevice",qt:"cardUpdates",se:"optOut",wr:"pendingData",qh:"sdkAuthenticationSignature"},ie:1}};
|
package/shared-lib/logger.js
CHANGED
|
@@ -1,38 +1 @@
|
|
|
1
|
-
const Ue = {
|
|
2
|
-
init: function (n) {
|
|
3
|
-
(void 0 === n && void 0 !== Ue.zg) || (Ue.zg = !!n), Ue.t || (Ue.t = !0);
|
|
4
|
-
},
|
|
5
|
-
destroy: function () {
|
|
6
|
-
(Ue.t = !1), (Ue.zg = void 0), (Ue.j = void 0);
|
|
7
|
-
},
|
|
8
|
-
setLogger: function (n) {
|
|
9
|
-
"function" == typeof n
|
|
10
|
-
? (Ue.init(), (Ue.j = n))
|
|
11
|
-
: Ue.info("Ignoring setLogger call since logger is not a function");
|
|
12
|
-
},
|
|
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
|
-
},
|
|
19
|
-
info: function (n) {
|
|
20
|
-
if (Ue.zg) {
|
|
21
|
-
const o = "Braze: " + n;
|
|
22
|
-
null != Ue.j ? Ue.j(o) : console.log(o);
|
|
23
|
-
}
|
|
24
|
-
},
|
|
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
|
-
}
|
|
30
|
-
},
|
|
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
|
-
}
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
export default Ue;
|
|
1
|
+
const Ue={init:function(n){void 0===n&&void 0!==Ue.zg||(Ue.zg=!!n),Ue.t||(Ue.t=!0)},destroy:function(){Ue.t=!1,Ue.zg=void 0,Ue.j=void 0},setLogger:function(n){"function"==typeof n?(Ue.init(),Ue.j=n):Ue.info("Ignoring setLogger call since logger is not a function")},toggleLogging:function(){Ue.init(),Ue.zg?(console.log("Disabling Braze logging"),Ue.zg=!1):(console.log("Enabled Braze logging"),Ue.zg=!0)},info:function(n){if(Ue.zg){const o="Braze: "+n;null!=Ue.j?Ue.j(o):console.log(o)}},warn:function(n){if(Ue.zg){const o="Braze SDK Warning: "+n+" (v4.10.1)";null!=Ue.j?Ue.j(o):console.warn(o)}},error:function(n){if(Ue.zg){const o="Braze SDK Error: "+n+" (v4.10.1)";null!=Ue.j?Ue.j(o):console.error(o)}}};export default Ue;
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
export default
|
|
2
|
-
ho: "allowCrawlerActivity",
|
|
3
|
-
Eo: "baseUrl",
|
|
4
|
-
_o: "noCookies",
|
|
5
|
-
Io: "devicePropertyAllowlist",
|
|
6
|
-
Aa: "disablePushTokenMaintenance",
|
|
7
|
-
Ao: "enableLogging",
|
|
8
|
-
So: "enableSdkAuthentication",
|
|
9
|
-
qa: "manageServiceWorkerExternally",
|
|
10
|
-
No: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
11
|
-
wo: "sessionTimeoutInSeconds",
|
|
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
|
-
en: "openNewsFeedCardsInNewTab",
|
|
22
|
-
mh: "requireExplicitInAppMessageDismissal",
|
|
23
|
-
Po: "doNotLoadFontAwesome",
|
|
24
|
-
Ro: "sdkFlavor",
|
|
25
|
-
tn: "openCardsInNewTab",
|
|
26
|
-
};
|
|
1
|
+
export default{ho:"allowCrawlerActivity",Eo:"baseUrl",_o:"noCookies",Io:"devicePropertyAllowlist",Aa:"disablePushTokenMaintenance",Ao:"enableLogging",So:"enableSdkAuthentication",qa:"manageServiceWorkerExternally",No:"minimumIntervalBetweenTriggerActionsInSeconds",wo:"sessionTimeoutInSeconds",Oo:"appVersion",Po:"appVersionNumber",_a:"serviceWorkerLocation",ka:"safariWebsitePushId",Ba:"localization",po:"contentSecurityNonce",Ro:"enableHtmlInAppMessages",Co:"allowUserSuppliedJavascript",lo:"inAppMessageZIndex",fo:"openInAppMessagesInNewTab",en:"openNewsFeedCardsInNewTab",mh:"requireExplicitInAppMessageDismissal",Lo:"doNotLoadFontAwesome",Mo:"sdkFlavor",tn:"openCardsInNewTab"};
|
package/shared-lib/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export{};
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
import a from
|
|
2
|
-
import e from "../managers/braze-instance.js";
|
|
3
|
-
const n = {
|
|
4
|
-
t: !1,
|
|
5
|
-
i: null,
|
|
6
|
-
m: () => (n.o(), n.i || (n.i = new a(e.l())), n.i),
|
|
7
|
-
o: () => {
|
|
8
|
-
n.t || (e.g(n), (n.t = !0));
|
|
9
|
-
},
|
|
10
|
-
destroy: () => {
|
|
11
|
-
(n.i = null), (n.t = !1);
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
export default n;
|
|
1
|
+
import a from"./card-manager.js";import e from"../managers/braze-instance.js";const n={t:!1,i:null,m:()=>(n.o(),n.i||(n.i=new a(e.l())),n.i),o:()=>{n.t||(e.g(n),n.t=!0)},destroy:()=>{n.i=null,n.t=!1}};export default n;
|
package/src/Card/card-manager.js
CHANGED
|
@@ -1,78 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import s from "../common/event-logger.js";
|
|
3
|
-
import t from "../models/request-result.js";
|
|
4
|
-
import r from "../../shared-lib/braze-shared-lib.js";
|
|
5
|
-
import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
|
|
6
|
-
export default class a {
|
|
7
|
-
constructor(s) {
|
|
8
|
-
(this.u = s), (this.u = s);
|
|
9
|
-
}
|
|
10
|
-
h(n, o) {
|
|
11
|
-
const e = new t();
|
|
12
|
-
if ((n.p(), null == n.url || "" === n.url))
|
|
13
|
-
return (
|
|
14
|
-
r.j.info(
|
|
15
|
-
`Card ${n.id} has no url. Not logging click to Braze servers.`,
|
|
16
|
-
),
|
|
17
|
-
e
|
|
18
|
-
);
|
|
19
|
-
if (o && n.id && this.u) {
|
|
20
|
-
const s = this.u.v(i.k.C) || {};
|
|
21
|
-
(s[n.id] = !0), this.u.D(i.k.C, s);
|
|
22
|
-
}
|
|
23
|
-
const l = this.I([n]);
|
|
24
|
-
if (null == l) return e;
|
|
25
|
-
const u = o ? r.q.$ : r.q.B;
|
|
26
|
-
return s.N(u, l);
|
|
27
|
-
}
|
|
28
|
-
A(n) {
|
|
29
|
-
const o = new t();
|
|
30
|
-
if (!n.F())
|
|
31
|
-
return (
|
|
32
|
-
r.j.info(
|
|
33
|
-
`Card ${n.id} refused this dismissal. Ignoring analytics event.`,
|
|
34
|
-
),
|
|
35
|
-
o
|
|
36
|
-
);
|
|
37
|
-
if (n.id && this.u) {
|
|
38
|
-
const s = this.u.v(i.k.G) || {};
|
|
39
|
-
(s[n.id] = !0), this.u.D(i.k.G, s);
|
|
40
|
-
}
|
|
41
|
-
const e = this.I([n]);
|
|
42
|
-
return null == e ? o : s.N(r.q.H, e);
|
|
43
|
-
}
|
|
44
|
-
J(n, o) {
|
|
45
|
-
const e = new t(!0),
|
|
46
|
-
l = [],
|
|
47
|
-
u = [];
|
|
48
|
-
let a = {};
|
|
49
|
-
this.u && (a = o ? this.u.v(i.k.K) || {} : this.u.v(i.k.L) || {});
|
|
50
|
-
for (const s of n)
|
|
51
|
-
s.M(),
|
|
52
|
-
s instanceof ControlCard ? u.push(s) : l.push(s),
|
|
53
|
-
s.id && (a[s.id] = !0);
|
|
54
|
-
const h = this.I(l),
|
|
55
|
-
c = this.I(u);
|
|
56
|
-
if (null == h && null == c) return (e.O = !1), e;
|
|
57
|
-
if ((this.u && (o ? this.u.D(i.k.K, a) : this.u.D(i.k.L, a)), null != h)) {
|
|
58
|
-
const t = o ? r.q.P : r.q.R,
|
|
59
|
-
n = s.N(t, h);
|
|
60
|
-
e.S(n);
|
|
61
|
-
}
|
|
62
|
-
if (null != c && o) {
|
|
63
|
-
const t = s.N(r.q.T, c);
|
|
64
|
-
e.S(t);
|
|
65
|
-
}
|
|
66
|
-
return e;
|
|
67
|
-
}
|
|
68
|
-
I(s) {
|
|
69
|
-
let t,
|
|
70
|
-
r = null;
|
|
71
|
-
for (let n = 0; n < s.length; n++)
|
|
72
|
-
(t = s[n].id),
|
|
73
|
-
null != t &&
|
|
74
|
-
"" !== t &&
|
|
75
|
-
((r = r || {}), (r.ids = r.ids || []), r.ids.push(t));
|
|
76
|
-
return r;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
1
|
+
import{ControlCard}from"./models/index.js";import s from"../common/event-logger.js";import t from"../models/request-result.js";import r from"../../shared-lib/braze-shared-lib.js";import{STORAGE_KEYS as i}from"../managers/storage-manager.js";export default class a{constructor(s){this.u=s,this.u=s}h(n,o){const e=new t;if(n.p(),null==n.url||""===n.url)return r.j.info(`Card ${n.id} has no url. Not logging click to Braze servers.`),e;if(o&&n.id&&this.u){const s=this.u.v(i.k.C)||{};s[n.id]=!0,this.u.D(i.k.C,s)}const l=this.I([n]);if(null==l)return e;const u=o?r.q.$:r.q.B;return s.N(u,l)}A(n){const o=new t;if(!n.F())return r.j.info(`Card ${n.id} refused this dismissal. Ignoring analytics event.`),o;if(n.id&&this.u){const s=this.u.v(i.k.G)||{};s[n.id]=!0,this.u.D(i.k.G,s)}const e=this.I([n]);return null==e?o:s.N(r.q.H,e)}J(n,o){const e=new t(!0),l=[],u=[];let a={};this.u&&(a=o?this.u.v(i.k.K)||{}:this.u.v(i.k.L)||{});for(const s of n)s.M(),s instanceof ControlCard?u.push(s):l.push(s),s.id&&(a[s.id]=!0);const h=this.I(l),c=this.I(u);if(null==h&&null==c)return e.O=!1,e;if(this.u&&(o?this.u.D(i.k.K,a):this.u.D(i.k.L,a)),null!=h){const t=o?r.q.P:r.q.R,n=s.N(t,h);e.S(n)}if(null!=c&&o){const t=s.N(r.q.T,c);e.S(t)}return e}I(s){let t,r=null;for(let n=0;n<s.length;n++)t=s[n].id,null!=t&&""!==t&&(r=r||{},r.ids=r.ids||[],r.ids.push(t));return r}}
|