@ada-support/embed2 1.1.0 → 1.1.3

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.
@@ -4,6 +4,7 @@ import type { StoreProxy } from "client/lib/store-proxy";
4
4
  import type { Module } from "common/types/modules";
5
5
  interface OwnProps {
6
6
  name: Module;
7
+ roleDescription?: string;
7
8
  styles: string;
8
9
  store: StoreProxy;
9
10
  messageService: MessageService;
@@ -1,5 +1,6 @@
1
- import { ComponentType, h } from "preact";
2
- import { ActionCreators } from "common/constants/actions";
3
- import { Dispatch, MapDispatchToProps, MapStateToProps } from "common/types/store";
1
+ import type { ComponentType } from "preact";
2
+ import { h } from "preact";
3
+ import type { ActionCreators } from "common/constants/actions";
4
+ import type { Dispatch, MapDispatchToProps, MapStateToProps } from "common/types/store";
4
5
  export declare function connect<MSP extends MapStateToProps, MDP extends MapDispatchToProps>(mapStateToProps?: MSP, mapDispatchToProps?: MDP): <O>(WrappedComponent: ComponentType<O & ReturnType<MSP> & ReturnType<MDP>>) => (ownProps: O) => h.JSX.Element;
5
6
  export declare function bindActionCreators(action: Partial<ActionCreators>, dispatch: Dispatch): (payload?: object) => Promise<import("../../common/types/store-state").StoreState>;
@@ -1,8 +1,8 @@
1
- import { ActionCreators } from "common/constants/actions";
2
- import { MessagePayload } from "common/types/events";
3
- import { StoreAction } from "common/types/index";
4
- import { DirectDispatch } from "common/types/store";
5
- import { StoreState } from "common/types/store-state";
1
+ import type { ActionCreators } from "common/constants/actions";
2
+ import type { MessagePayload } from "common/types/events";
3
+ import type { StoreAction } from "common/types/index";
4
+ import type { DirectDispatch } from "common/types/store";
5
+ import type { StoreState } from "common/types/store-state";
6
6
  declare const actions: {
7
7
  [key in ActionCreators]: ({ currentState, payload, dispatch }: {
8
8
  payload?: MessagePayload;
@@ -1,2 +1,2 @@
1
- import { StartOptions } from "common/types/store-state";
1
+ import type { StartOptions } from "common/types/store-state";
2
2
  export declare function getAlignment(adaSettings: StartOptions): "right" | "left";
@@ -1,6 +1,7 @@
1
- import { Component, ComponentType, h } from "preact";
2
- import { MapDispatchToProps, MapStateToProps, StoreProxyInterface } from "common/types/store";
3
- import { StoreState } from "common/types/store-state";
1
+ import type { ComponentType } from "preact";
2
+ import { Component, h } from "preact";
3
+ import type { MapDispatchToProps, MapStateToProps, StoreProxyInterface } from "common/types/store";
4
+ import type { StoreState } from "common/types/store-state";
4
5
  declare type Props<O, MSP extends MapStateToProps, MDP extends MapDispatchToProps> = {
5
6
  store: StoreProxyInterface;
6
7
  WrappedComponent: ComponentType<O & ReturnType<MSP> & ReturnType<MDP>>;
@@ -1,4 +1,4 @@
1
- import { FetchEventStatusType } from "common/constants/events";
1
+ import type { FetchEventStatusType } from "common/constants/events";
2
2
  import type { EmbedEvent, EmbedRequestEvent, PayloadByEvent } from "common/lib/channel";
3
3
  export interface MessagePayload {
4
4
  [key: string]: any;
@@ -1,7 +1,7 @@
1
- import { EventSubscriptionCallback } from "client/helpers/event-subscriptions";
2
- import { ActionTypes } from "common/constants/actions";
3
- import { MetaFieldPayload } from "common/types/store";
4
- import { StartOptions, StoreState } from "./store-state";
1
+ import type { EventSubscriptionCallback } from "client/helpers/event-subscriptions";
2
+ import type { ActionTypes } from "common/constants/actions";
3
+ import type { MetaFieldPayload } from "common/types/store";
4
+ import type { StartOptions, StoreState } from "./store-state";
5
5
  export interface StoreAction {
6
6
  [key: string]: string | object | number;
7
7
  type: ActionTypes;
@@ -1,4 +1,4 @@
1
- import { StoreState } from "./store-state";
1
+ import type { StoreState } from "./store-state";
2
2
  export declare type Get = <K extends keyof StoreState>(key: K) => Promise<StoreState[K]>;
3
3
  export declare type GetState = () => Promise<StoreState>;
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { CHATTER_CREATED_STORAGE_KEY, CHATTER_TOKEN_STORAGE_KEY, IN_LIVE_CHAT_STORAGE_KEY, ZD_MESSAGING_CHATTER_CREATED_STORAGE_KEY, ZD_MESSAGING_EXTERNAL_USER_ID_STORAGE_KEY, ZD_PREVIOUS_TAGS_STORAGE_KEY, ZD_SESSION_STORAGE_KEY } from "common/constants/storage-keys";
1
+ import type { CHATTER_CREATED_STORAGE_KEY, CHATTER_TOKEN_STORAGE_KEY, IN_LIVE_CHAT_STORAGE_KEY, ZD_MESSAGING_CHATTER_CREATED_STORAGE_KEY, ZD_MESSAGING_EXTERNAL_USER_ID_STORAGE_KEY, ZD_PREVIOUS_TAGS_STORAGE_KEY, ZD_SESSION_STORAGE_KEY } from "common/constants/storage-keys";
2
2
  export declare enum StorageTypes {
3
3
  Local = "local",
4
4
  Session = "session"
@@ -8788,7 +8788,7 @@ var client = new error_tracker_BrowserClient({
8788
8788
  return event;
8789
8789
  },
8790
8790
  environment: "production",
8791
- release: "1.1.0-a8e7d44",
8791
+ release: "1.1.3-6707009",
8792
8792
  sampleRate: 0.25,
8793
8793
  autoSessionTracking: false,
8794
8794
  // Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
@@ -9490,7 +9490,7 @@ function getEmbedURL(_ref) {
9490
9490
  polyfillVersionString = "legacy";
9491
9491
  }
9492
9492
 
9493
- return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "a8e7d44", "/index.html");
9493
+ return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "6707009", "/index.html");
9494
9494
  }
9495
9495
  /**
9496
9496
  * Generate the Chat / API URL
@@ -9663,7 +9663,6 @@ var CHATTER_STORAGE_KEY = CHATTER_TOKEN_STORAGE_KEY;
9663
9663
 
9664
9664
 
9665
9665
 
9666
-
9667
9666
  var StorageTypes;
9668
9667
 
9669
9668
  (function (StorageTypes) {
@@ -11347,6 +11346,7 @@ var IFrame = /*#__PURE__*/function (_Component) {
11347
11346
  value: function render() {
11348
11347
  var _this$props4 = this.props,
11349
11348
  name = _this$props4.name,
11349
+ roleDescription = _this$props4.roleDescription,
11350
11350
  onTransitionEnd = _this$props4.onTransitionEnd,
11351
11351
  styles = _this$props4.styles,
11352
11352
  title = _this$props4.title;
@@ -11362,7 +11362,7 @@ var IFrame = /*#__PURE__*/function (_Component) {
11362
11362
  title: title || iFrameName,
11363
11363
  className: iFrameName,
11364
11364
  onTransitionEnd: onTransitionEnd,
11365
- "aria-roledescription": iFrameName,
11365
+ "aria-roledescription": roleDescription,
11366
11366
  role: "application"
11367
11367
  });
11368
11368
  }
@@ -11403,6 +11403,7 @@ function mapDispatchToProps(dispatch) {
11403
11403
 
11404
11404
 
11405
11405
 
11406
+
11406
11407
  function ButtonFrame_createSuper(Derived) { var hasNativeReflectConstruct = ButtonFrame_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0,getPrototypeOf/* default */.Z)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0,getPrototypeOf/* default */.Z)(this).constructor; result = construct_default()(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0,possibleConstructorReturn/* default */.Z)(this, result); }; }
11407
11408
 
11408
11409
  function ButtonFrame_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !(construct_default())) return false; if ((construct_default()).sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct_default()(Boolean, [], function () {})); return true; } catch (e) { return false; } }
@@ -11510,12 +11511,25 @@ var ButtonFrame = /*#__PURE__*/function (_Component) {
11510
11511
  value: function render() {
11511
11512
  var _this2 = this;
11512
11513
 
11514
+ var client = this.props.client;
11515
+
11516
+ var roleDescription = function roleDescription() {
11517
+ var _context11;
11518
+
11519
+ if (!(client !== null && client !== void 0 && client.handle)) {
11520
+ return "Chat Button";
11521
+ }
11522
+
11523
+ return "".concat(client.handle.charAt(0).toUpperCase() + slice_default()(_context11 = client.handle).call(_context11, 1), " Chat Button");
11524
+ };
11525
+
11513
11526
  return v(StoreContext.Consumer, null, function (store) {
11514
11527
  return v(MessageServiceContext.Consumer, null, function (messageService) {
11515
11528
  return v(components_IFrame, {
11516
11529
  title: "Chat with bot",
11517
11530
  styles: _this2.styles,
11518
11531
  name: BUTTON_IFRAME,
11532
+ roleDescription: roleDescription(),
11519
11533
  store: store,
11520
11534
  messageService: messageService,
11521
11535
  onTransitionEnd: _this2.handleOnTransitionEndBound
@@ -11559,6 +11573,7 @@ var isMobile = /(iPhone)|(iPod)|(android)|(webOS)/i.exec(navigator.userAgent) !=
11559
11573
 
11560
11574
 
11561
11575
 
11576
+
11562
11577
  function ChatFrame_createSuper(Derived) { var hasNativeReflectConstruct = ChatFrame_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0,getPrototypeOf/* default */.Z)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0,getPrototypeOf/* default */.Z)(this).constructor; result = construct_default()(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0,possibleConstructorReturn/* default */.Z)(this, result); }; }
11563
11578
 
11564
11579
  function ChatFrame_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !(construct_default())) return false; if ((construct_default()).sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct_default()(Boolean, [], function () {})); return true; } catch (e) { return false; } }
@@ -12299,7 +12314,8 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
12299
12314
 
12300
12315
  var _this$props11 = this.props,
12301
12316
  handle = _this$props11.handle,
12302
- adaSettings = _this$props11.adaSettings;
12317
+ adaSettings = _this$props11.adaSettings; // SUP-1141- TODO: Remove chatFrameTimeoutCallback
12318
+
12303
12319
  var chatFrameTimeoutCallback = adaSettings.chatFrameTimeoutCallback;
12304
12320
  this.chatRenderTimeout = window.setTimeout(function () {
12305
12321
  var _this6$channel;
@@ -12309,8 +12325,13 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
12309
12325
  embedSettings: adaSettings
12310
12326
  });
12311
12327
 
12312
- if (chatFrameTimeoutCallback && !((_this6$channel = _this6.channel) !== null && _this6$channel !== void 0 && _this6$channel.isConnected)) {
12313
- chatFrameTimeoutCallback();
12328
+ if (!((_this6$channel = _this6.channel) !== null && _this6$channel !== void 0 && _this6$channel.isConnected)) {
12329
+ // SUP-1141- TODO: Remove chatFrameTimeoutCallback
12330
+ if (chatFrameTimeoutCallback) {
12331
+ chatFrameTimeoutCallback();
12332
+ }
12333
+
12334
+ publishEvent("ada:chat_frame_timeout", {});
12314
12335
  }
12315
12336
  }, 5000);
12316
12337
  }
@@ -12319,8 +12340,20 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
12319
12340
  value: function render() {
12320
12341
  var _this$props12 = this.props,
12321
12342
  name = _this$props12.name,
12343
+ client = _this$props12.client,
12322
12344
  isDrawerOpen = _this$props12.isDrawerOpen;
12323
12345
  var iFrameName = "ada-".concat(name, "-frame");
12346
+
12347
+ var roleDescription = function roleDescription() {
12348
+ var _context23;
12349
+
12350
+ if (!(client !== null && client !== void 0 && client.handle)) {
12351
+ return "Chat Window";
12352
+ }
12353
+
12354
+ return "".concat(client.handle.charAt(0).toUpperCase() + slice_default()(_context23 = client.handle).call(_context23, 1), " Chat Window");
12355
+ };
12356
+
12324
12357
  return v("iframe", {
12325
12358
  src: this.url,
12326
12359
  scrolling: "no",
@@ -12332,6 +12365,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
12332
12365
  title: iFrameName,
12333
12366
  className: iFrameName,
12334
12367
  "aria-expanded": isDrawerOpen,
12368
+ "aria-roledescription": roleDescription(),
12335
12369
  allowTransparency: true,
12336
12370
  allowFullScreen: true,
12337
12371
  onLoad: this.frameLoaded.bind(this)
@@ -14374,7 +14408,7 @@ window.__AdaEmbedConstructor = Embed;
14374
14408
  /* harmony export */ });
14375
14409
  var isModern = new RegExp("((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(15|(1[6-9]|[2-9]\\d|\\d{3,}))[_.]\\d+(?:[_.]\\d+)?)|((Chromium|Chrome)\\/(99|([1-9]\\d\\d|\\d{4,}))\\.\\d+(?:\\.\\d+)?)|(Version\\/(15|(1[6-9]|[2-9]\\d|\\d{3,}))\\.\\d+(?:\\.\\d+)? Safari\\/)|(Firefox\\/(98|(99|\\d{3,}))\\.\\d+\\.\\d+)|(Firefox\\/(98|(99|\\d{3,}))\\.\\d+(pre|[ab]\\d+[a-z]*)?)").test(navigator.userAgent);
14376
14410
  var isProduction = "production" === "production";
14377
- var embed2Version = "a8e7d44";
14411
+ var embed2Version = "6707009";
14378
14412
 
14379
14413
  /***/ }),
14380
14414
 
@@ -14720,9 +14754,9 @@ function _log() {
14720
14754
  service: "embed",
14721
14755
  env: "production",
14722
14756
  embedVersion: 2,
14723
- version: "1.1.0",
14757
+ version: "1.1.3",
14724
14758
  isNpm: true,
14725
- commitHash: "a8e7d44"
14759
+ commitHash: "6707009"
14726
14760
  }))
14727
14761
  });
14728
14762
 
@@ -25663,7 +25697,7 @@ function _loadClientChunk() {
25663
25697
  polyfillVersionString = "legacy";
25664
25698
  }
25665
25699
 
25666
- clientScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "a8e7d44", "/index.js");
25700
+ clientScriptSource = concat_default()(_context17 = concat_default()(_context18 = "".concat(host, "/embed/")).call(_context18, polyfillVersionString, "/client/")).call(_context17, "6707009", "/index.js");
25667
25701
  } // `window.__AdaEmbedConstructor` gets created in the "client" bundle
25668
25702
 
25669
25703
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/embed2",
3
- "version": "1.1.0",
3
+ "version": "1.1.3",
4
4
  "description": "",
5
5
  "main": "dist/npm-entry",
6
6
  "typings": "dist/npm-entry/index.d.ts",