MCPcopy Create free account
hub / github.com/ampproject/amphtml / sendEvent

Method sendEvent

third_party/subscriptions-project/swg.js:18661–18692  ·  view source on GitHub ↗

@override

(userEvent)

Source from the content-addressed store, hash-verified

18659
18660 /** @override */
18661 sendEvent(userEvent) {
18662 const analyticsEvent = publisherEventToAnalyticsEvent(userEvent.name);
18663 let data = null;
18664 if (!isEnumValue(Event, userEvent.name) || !analyticsEvent) {
18665 throw new Error('Invalid user event provided(' + userEvent.name + ')');
18666 }
18667
18668 if (userEvent.data) {
18669 if (!isObject(userEvent.data)) {
18670 throw new Error('Event data must be an Object(' + userEvent.data + ')');
18671 } else {
18672 data = {};
18673 Object.assign(data, userEvent.data);
18674 }
18675 }
18676
18677 if (isBoolean(userEvent.active)) {
18678 if (!data) {
18679 data = {};
18680 }
18681 Object.assign(data, {'is_active': userEvent.active});
18682 } else if (userEvent.active != null) {
18683 throw new Error('Event active must be a boolean');
18684 }
18685
18686 this.eventManager_.logEvent({
18687 eventType: analyticsEvent,
18688 eventOriginator: EventOriginator.PROPENSITY_CLIENT,
18689 isFromUserAction: userEvent.active,
18690 additionalParameters: data,
18691 });
18692 }
18693}
18694
18695const CSS = ".swg-dialog,.swg-toast{background-color:#fff!important;box-sizing:border-box}.swg-toast{border:none!important;bottom:0!important;max-height:46px!important;position:fixed!important;z-index:2147483647!important}@media (min-width:871px) and (min-height:641px){.swg-dialog.swg-wide-dialog{left:-435px!important;width:870px!important}}@media (max-height:640px),(max-width:640px){.swg-dialog,.swg-toast{border-top-left-radius:8px!important;border-top-right-radius:8px!important;box-shadow:0 1px 1px rgba(60,64,67,.3),0 1px 4px 1px rgba(60,64,67,.15)!important;left:-240px!important;margin-left:50vw!important;width:480px!important}}@media (min-width:641px) and (min-height:641px){.swg-dialog{background-color:transparent!important;border:none!important;left:-315px!important;margin-left:50vw!important;width:630px!important}.swg-toast{border-radius:4px!important;bottom:8px!important;box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12)!important;left:8px!important}}@media (max-width:480px){.swg-dialog,.swg-toast{left:0!important;margin-left:0!important;right:0!important;width:100%!important}}html>body.swg-disable-scroll{height:100vh!important;overflow:hidden!important}html>body.swg-disable-scroll *{overflow:hidden!important}\n/*# sourceURL=/./src/components/dialog.css*/\n";

Callers

nothing calls this directly

Calls 6

assignMethod · 0.80
isEnumValueFunction · 0.70
isObjectFunction · 0.70
isBooleanFunction · 0.70
logEventMethod · 0.45

Tested by

no test coverage detected