@braze/web-sdk
Version:
Braze SDK for web sites and other JS platforms.
48 lines (47 loc) • 1.25 kB
JavaScript
import InAppMessage from "./in-app-message.js";
import u from "../../managers/subscription-manager.js";
export default class InAppMessageButton {
constructor(s, t, i, r, h, e, n) {
(this.text = s),
(this.backgroundColor = t),
(this.textColor = i),
(this.borderColor = r),
(this.clickAction = h),
(this.uri = e),
(this.id = n),
(this.text = s || ""),
(this.backgroundColor = t || InAppMessage.th.sh),
(this.textColor = i || InAppMessage.th.ih),
(this.borderColor = r || this.backgroundColor),
(this.clickAction = h || InAppMessage.ClickAction.NONE),
(this.uri = e),
null == n && (n = InAppMessageButton.Hi),
(this.id = n),
(this.Co = !1),
(this.ti = new u());
}
subscribeToClickedEvent(s) {
return this.ti.wt(s);
}
removeSubscription(s) {
this.ti.removeSubscription(s);
}
removeAllSubscriptions() {
this.ti.removeAllSubscriptions();
}
$t() {
return !this.Co && ((this.Co = !0), this.ti.L(), !0);
}
static fromJson(s) {
return new InAppMessageButton(
s.text,
s.bg_color,
s.text_color,
s.border_color,
s.click_action,
s.uri,
s.id,
);
}
}
InAppMessageButton.Hi = -1;