@braze/web-sdk
Version:
Braze SDK for web sites and other JS platforms.
48 lines (47 loc) • 1.23 kB
JavaScript
import f from "../../managers/subscription-manager.js";
import { IamColors as ss, IamClickAction as $e } from "../constants.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 || ss._E),
(this.textColor = i || ss.AE),
(this.borderColor = r || this.backgroundColor),
(this.clickAction = h || $e.NONE),
(this.uri = e),
null == n && (n = InAppMessageButton.Kn),
(this.id = n),
(this.rd = !1),
(this.ti = new f());
}
subscribeToClickedEvent(s) {
return this.ti.Kt(s);
}
removeSubscription(s) {
this.ti.removeSubscription(s);
}
removeAllSubscriptions() {
this.ti.removeAllSubscriptions();
}
ss() {
return !this.rd && ((this.rd = !0), this.ti.A(), !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.Kn = -1;