How to use the @shopgate/pwa-core/classes/DataRequest function in @shopgate/pwa-core

To help you get started, we’ve selected a few @shopgate/pwa-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shopgate / pwa / libraries / common / actions / app / handlePushNotification.js View on Github external
const { link = '', notificationId = null, nativeNotificationNotShown } = payload;

  /**
   * The following property is only available on iOS. A value of TRUE indicates that the push
   * message came in, while the app was open. Since the app would instantly open the link of the
   * message in those situations, the link handling is suppressed to not distract the user.
   */
  if (nativeNotificationNotShown === true) {
    return;
  }

  if (notificationId) {
    const id = notificationId.toString();

    // Send tracking event to the backend
    new DataRequest(PUSH_MESSAGE_OPENED)
      .setPayload({ notificationId: id })
      .dispatch();
  }

  handleLink({ link }, dispatch);

  dispatch(openPushNotification(notificationId, link));
};
github shopgate / pwa / components / Router / helpers / link-events / index.js View on Github external
const handleOpenPushNotification = (payload = {}) => {
  const { link = '' } = payload;
  let { notificationId } = payload;

  notificationId = notificationId ? notificationId.toString() : null;

  if (notificationId) {
    new DataRequest(PUSH_MESSAGE_OPENED)
      .setPayload({
        notificationId,
      })
      .dispatch()
        .then(result => logger.info(PUSH_MESSAGE_OPENED, result))
        .catch(err => err && logger.error(err));
  }

  if (link) {
    const parsedLink = new ParsedLink(link);
    parsedLink.open();
  }
};
github shopgate / pwa / libraries / tracking-core / helpers / helper.js View on Github external
export function sendDataRequest(url) {
  new DataRequest(url)
    .dispatch()
    .then(result => logger.info(url, result))
    .catch(err => err && logger.error(err));
}
github shopgate / pwa / components / ClientInformation / actions.js View on Github external
export const enableDebugLogging = () => () => {
  setDebugLoggingEnabled();
  (new DataRequest('ajax_started_live_logging')).dispatch();
};