@ada-support/embed2 1.0.41 → 1.0.46
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.
- package/dist/npm-entry/campaigns/campaign.d.ts +4 -4
- package/dist/npm-entry/client/components/ButtonFrame/index.d.ts +1 -1
- package/dist/npm-entry/client/components/ChatFrame/index.d.ts +3 -3
- package/dist/npm-entry/client/components/Container/index.d.ts +2 -2
- package/dist/npm-entry/client/components/IFrame/index.d.ts +2 -2
- package/dist/npm-entry/client/index.d.ts +8 -8
- package/dist/npm-entry/client/lib/ce.d.ts +5 -4
- package/dist/npm-entry/client/lib/message-service.d.ts +8 -8
- package/dist/npm-entry/client/lib/store-proxy.d.ts +6 -6
- package/dist/npm-entry/client/store/index.d.ts +3 -3
- package/dist/npm-entry/client/store/state.d.ts +1 -1
- package/dist/npm-entry/common/helpers/startup.d.ts +1 -1
- package/dist/npm-entry/common/lib/channel.d.ts +5 -5
- package/dist/npm-entry/common/lib/fc/index.d.ts +5 -4
- package/dist/npm-entry/common/types/channels.d.ts +6 -6
- package/dist/npm-entry/common/types/helpers.d.ts +0 -1
- package/dist/npm-entry/common/types/store-state.d.ts +8 -10
- package/dist/npm-entry/index.js +57 -52
- package/package.json +5 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import MessageService from "client/lib/message-service";
|
|
2
|
-
import { EvaluateCampaignParams } from "common/types";
|
|
3
|
-
import { StartOptions } from "common/types/store-state";
|
|
4
|
-
import { MarketingCampaign } from "./types";
|
|
1
|
+
import type { MessageService } from "client/lib/message-service";
|
|
2
|
+
import type { EvaluateCampaignParams } from "common/types";
|
|
3
|
+
import type { StartOptions } from "common/types/store-state";
|
|
4
|
+
import type { MarketingCampaign } from "./types";
|
|
5
5
|
interface TriggerCampaignImplParams {
|
|
6
6
|
adaSettings: StartOptions;
|
|
7
7
|
chatterToken: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { h } from "preact";
|
|
2
|
-
import MessageService from "client/lib/message-service";
|
|
2
|
+
import type { MessageService } from "client/lib/message-service";
|
|
3
3
|
import type { StoreProxy } from "client/lib/store-proxy";
|
|
4
|
-
import { Module } from "common/types/modules";
|
|
5
|
-
import { StartOptions } from "common/types/store-state";
|
|
4
|
+
import type { Module } from "common/types/modules";
|
|
5
|
+
import type { StartOptions } from "common/types/store-state";
|
|
6
6
|
interface OwnProps {
|
|
7
7
|
name: Module;
|
|
8
8
|
adaSettings: StartOptions;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h } from "preact";
|
|
2
|
-
import MessageService from "client/lib/message-service";
|
|
2
|
+
import type { MessageService } from "client/lib/message-service";
|
|
3
3
|
import type { StoreProxy } from "client/lib/store-proxy";
|
|
4
|
-
import { StartOptions } from "common/types/store-state";
|
|
4
|
+
import type { StartOptions } from "common/types/store-state";
|
|
5
5
|
interface OwnProps {
|
|
6
6
|
store: StoreProxy;
|
|
7
7
|
messageService: MessageService;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h } from "preact";
|
|
2
|
-
import MessageService from "client/lib/message-service";
|
|
2
|
+
import type { MessageService } from "client/lib/message-service";
|
|
3
3
|
import type { StoreProxy } from "client/lib/store-proxy";
|
|
4
|
-
import { Module } from "common/types/modules";
|
|
4
|
+
import type { Module } from "common/types/modules";
|
|
5
5
|
interface OwnProps {
|
|
6
6
|
name: Module;
|
|
7
7
|
styles: string;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { EventSubscriptionCallback } from "client/helpers/event-subscriptions";
|
|
2
|
-
import MessageService from "client/lib/message-service";
|
|
1
|
+
import type { EventSubscriptionCallback } from "client/helpers/event-subscriptions";
|
|
2
|
+
import { MessageService } from "client/lib/message-service";
|
|
3
3
|
import { StoreProxy } from "client/lib/store-proxy";
|
|
4
4
|
import "client/lib/error-tracker";
|
|
5
|
-
import Client from "common/models/client";
|
|
6
|
-
import { EvaluateCampaignParams, ResetParams, WindowInfo } from "common/types";
|
|
7
|
-
import { MetaFieldPayload } from "common/types/store";
|
|
8
|
-
import { StartOptions } from "common/types/store-state";
|
|
9
|
-
import {
|
|
5
|
+
import type Client from "common/models/client";
|
|
6
|
+
import type { EvaluateCampaignParams, ResetParams, WindowInfo } from "common/types";
|
|
7
|
+
import type { MetaFieldPayload } from "common/types/store";
|
|
8
|
+
import type { StartOptions } from "common/types/store-state";
|
|
9
|
+
import type { CustomEventChannel } from "./lib/ce";
|
|
10
10
|
export declare class Embed {
|
|
11
11
|
client: Client;
|
|
12
12
|
storage: Storage;
|
|
13
|
-
localChannel:
|
|
13
|
+
localChannel: CustomEventChannel;
|
|
14
14
|
store: StoreProxy;
|
|
15
15
|
messageService: MessageService;
|
|
16
16
|
buttonWasMoved: boolean;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { FetchEventStatusType } from "common/constants/events";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { FetchEventStatusType } from "common/constants/events";
|
|
2
|
+
import type { EmbedEvent, PayloadByEvent } from "common/lib/channel";
|
|
3
|
+
import { Channel } from "common/lib/channel";
|
|
4
|
+
import type { AdaCustomEvent, Refhandler } from "common/types/events";
|
|
4
5
|
/**
|
|
5
6
|
* Custom Event Channel
|
|
6
7
|
*/
|
|
7
|
-
export declare class
|
|
8
|
+
export declare class CustomEventChannel extends Channel {
|
|
8
9
|
protected trackedListeners: Set<Refhandler>;
|
|
9
10
|
protected trackedTimeouts: Set<number>;
|
|
10
11
|
protected eventType: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Channels } from "common/types/channels";
|
|
3
|
-
import { Module } from "common/types/modules";
|
|
4
|
-
import {
|
|
5
|
-
export
|
|
1
|
+
import { FrameChannel } from "common/lib/fc";
|
|
2
|
+
import type { Channels } from "common/types/channels";
|
|
3
|
+
import type { Module } from "common/types/modules";
|
|
4
|
+
import { CustomEventChannel } from "./ce";
|
|
5
|
+
export declare class MessageService {
|
|
6
6
|
channels: Channels;
|
|
7
|
-
registerFrameChannel(name: Module, targetWindow: Window, targetOrigin?: string):
|
|
7
|
+
registerFrameChannel(name: Module, targetWindow: Window, targetOrigin?: string): FrameChannel;
|
|
8
8
|
unregisterChannel(name: keyof Channels): void;
|
|
9
|
-
getChannel(name: keyof Channels):
|
|
10
|
-
getAllChannels(): (
|
|
9
|
+
getChannel(name: keyof Channels): FrameChannel | CustomEventChannel | null;
|
|
10
|
+
getAllChannels(): (FrameChannel | CustomEventChannel)[];
|
|
11
11
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import MessageService from "client/lib/message-service";
|
|
1
|
+
import type { MessageService } from "client/lib/message-service";
|
|
2
2
|
import { Store } from "client/store";
|
|
3
|
-
import { Channels } from "common/types/channels";
|
|
4
|
-
import { StoreProxyInterface } from "common/types/store";
|
|
5
|
-
import { StoreState } from "common/types/store-state";
|
|
6
|
-
import {
|
|
3
|
+
import type { Channels } from "common/types/channels";
|
|
4
|
+
import type { StoreProxyInterface } from "common/types/store";
|
|
5
|
+
import type { StoreState } from "common/types/store-state";
|
|
6
|
+
import type { CustomEventChannel } from "./ce";
|
|
7
7
|
export declare class StoreProxy implements StoreProxyInterface {
|
|
8
|
-
localChannel:
|
|
8
|
+
localChannel: CustomEventChannel;
|
|
9
9
|
store: Store;
|
|
10
10
|
registeredCallbacks: ((payload: StoreState) => void)[];
|
|
11
11
|
constructor(messageService: MessageService);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import MessageService from "client/lib/message-service";
|
|
2
|
-
import { Channels } from "common/types/channels";
|
|
3
|
-
import { StoreState } from "common/types/store-state";
|
|
1
|
+
import type { MessageService } from "client/lib/message-service";
|
|
2
|
+
import type { Channels } from "common/types/channels";
|
|
3
|
+
import type { StoreState } from "common/types/store-state";
|
|
4
4
|
export declare class Store {
|
|
5
5
|
state: StoreState;
|
|
6
6
|
defaultState: StoreState;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FetchEventStatusType } from "common/constants/events";
|
|
2
|
-
import { AdaCustomEvent, Refhandler } from "common/types/events";
|
|
3
|
-
import { EvaluateCampaignParams, ResetParams, SendGreetingParams, StoreDispatchPayload, StoreGetPayload, TrackEventParams } from "common/types/index";
|
|
4
|
-
import { MetaFieldPayload } from "common/types/store";
|
|
5
|
-
import { StoreState } from "common/types/store-state";
|
|
1
|
+
import type { FetchEventStatusType } from "common/constants/events";
|
|
2
|
+
import type { AdaCustomEvent, Refhandler } from "common/types/events";
|
|
3
|
+
import type { EvaluateCampaignParams, ResetParams, SendGreetingParams, StoreDispatchPayload, StoreGetPayload, TrackEventParams } from "common/types/index";
|
|
4
|
+
import type { MetaFieldPayload } from "common/types/store";
|
|
5
|
+
import type { StoreState } from "common/types/store-state";
|
|
6
6
|
export interface EmbedRequestPayloadByEvent {
|
|
7
7
|
CREATE_PROACTIVE: {
|
|
8
8
|
body: string;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { FetchEventStatusType } from "common/constants/events";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { FetchEventStatusType } from "common/constants/events";
|
|
2
|
+
import type { EmbedEvent, PayloadByEvent } from "common/lib/channel";
|
|
3
|
+
import { Channel } from "common/lib/channel";
|
|
4
|
+
import type { Refhandler } from "common/types/events";
|
|
4
5
|
/**
|
|
5
6
|
* Frame Channel: Used for postMessage communication between iFrames.
|
|
6
7
|
* NOTE: iFrames must have the same domain - when postMessages are sent between
|
|
7
8
|
* iframes they use the eventListener below to check if the target domain matches
|
|
8
9
|
* the domain from where the postMessage originated from.
|
|
9
10
|
*/
|
|
10
|
-
export
|
|
11
|
+
export declare class FrameChannel extends Channel {
|
|
11
12
|
protected trackedListeners: Set<Refhandler>;
|
|
12
13
|
protected trackedTimeouts: Set<number>;
|
|
13
14
|
protected eventType: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { PartialRecord } from "common/types/helpers";
|
|
4
|
-
import { Module } from "common/types/modules";
|
|
5
|
-
declare type FrameChannels = PartialRecord<Module,
|
|
1
|
+
import type { CustomEventChannel } from "client/lib/ce";
|
|
2
|
+
import type { FrameChannel } from "common/lib/fc";
|
|
3
|
+
import type { PartialRecord } from "common/types/helpers";
|
|
4
|
+
import type { Module } from "common/types/modules";
|
|
5
|
+
declare type FrameChannels = PartialRecord<Module, FrameChannel>;
|
|
6
6
|
interface LocalChannel {
|
|
7
|
-
local:
|
|
7
|
+
local: CustomEventChannel;
|
|
8
8
|
}
|
|
9
9
|
export declare type Channels = FrameChannels & LocalChannel;
|
|
10
10
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ConnectionState } from "common/constants/events";
|
|
2
|
-
import Client from "common/models/client";
|
|
3
|
-
import { ChatterEventPayload } from "common/types/events";
|
|
4
|
-
import { ValueOf } from "common/types/helpers";
|
|
1
|
+
import type { ConnectionState } from "common/constants/events";
|
|
2
|
+
import type Client from "common/models/client";
|
|
3
|
+
import type { ChatterEventPayload } from "common/types/events";
|
|
5
4
|
export interface StartOptions {
|
|
6
5
|
handle?: string;
|
|
7
6
|
lazy?: boolean;
|
|
@@ -41,7 +40,7 @@ export interface StartOptions {
|
|
|
41
40
|
export interface StoreState extends StartOptionsNoFunction {
|
|
42
41
|
chatterCreated?: string | null;
|
|
43
42
|
chatterToken?: string | null;
|
|
44
|
-
client
|
|
43
|
+
client?: Client;
|
|
45
44
|
isDrawerOpen: boolean;
|
|
46
45
|
zdSessionId?: string | null;
|
|
47
46
|
zdPreviousTags?: string | null;
|
|
@@ -52,7 +51,7 @@ export interface StoreState extends StartOptionsNoFunction {
|
|
|
52
51
|
height?: number;
|
|
53
52
|
width?: number;
|
|
54
53
|
};
|
|
55
|
-
initialURL
|
|
54
|
+
initialURL?: string;
|
|
56
55
|
wasIntroShown: boolean;
|
|
57
56
|
unreadMessageCount: number;
|
|
58
57
|
embedStyles?: string;
|
|
@@ -60,14 +59,14 @@ export interface StoreState extends StartOptionsNoFunction {
|
|
|
60
59
|
[key: string]: ConnectionState;
|
|
61
60
|
};
|
|
62
61
|
appConnectionState: ConnectionState;
|
|
63
|
-
notificationsPermission
|
|
62
|
+
notificationsPermission?: NotificationPermission;
|
|
64
63
|
browserHasNotificationSupport: boolean;
|
|
65
|
-
chatDimensions
|
|
64
|
+
chatDimensions?: {
|
|
66
65
|
height?: number;
|
|
67
66
|
width?: number;
|
|
68
67
|
};
|
|
69
68
|
isChatWebsocketConnected: boolean;
|
|
70
|
-
latestCampaignKey
|
|
69
|
+
latestCampaignKey?: string;
|
|
71
70
|
hasChatOpenedAfterProactiveMessagesShown: boolean;
|
|
72
71
|
chatterInLiveChat: boolean;
|
|
73
72
|
language?: string;
|
|
@@ -96,4 +95,3 @@ export interface StartOptionsNoFunction {
|
|
|
96
95
|
};
|
|
97
96
|
preload?: boolean;
|
|
98
97
|
}
|
|
99
|
-
export declare type ResponsePayload = Promise<StoreState | ValueOf<StoreState>>;
|
package/dist/npm-entry/index.js
CHANGED
|
@@ -8500,7 +8500,7 @@ var client = new error_tracker_BrowserClient({
|
|
|
8500
8500
|
return event;
|
|
8501
8501
|
},
|
|
8502
8502
|
environment: "production",
|
|
8503
|
-
release: "
|
|
8503
|
+
release: "1.0.46-1f14246",
|
|
8504
8504
|
sampleRate: 0.25,
|
|
8505
8505
|
autoSessionTracking: false,
|
|
8506
8506
|
// Integrations don't seem to work with Sentry: https://github.com/getsentry/sentry-javascript/issues/2541
|
|
@@ -8728,7 +8728,12 @@ var Channel = /*#__PURE__*/function () {
|
|
|
8728
8728
|
|
|
8729
8729
|
_this.postMessage(requestEvent, payload, id);
|
|
8730
8730
|
}).catch(function (e) {
|
|
8731
|
-
//
|
|
8731
|
+
// We should NOT silently catch errors for "GET_STATE" request event - it is critical for application to work.
|
|
8732
|
+
if (requestEvent === "GET_STATE") {
|
|
8733
|
+
throw new errors/* AdaEmbedError */.S("Failed to respond to \"GET_STATE\" request. Reason: ".concat(e.message, "."));
|
|
8734
|
+
} // handling promise
|
|
8735
|
+
|
|
8736
|
+
|
|
8732
8737
|
if (e.message !== "Could not connect frame channel.") {
|
|
8733
8738
|
error_tracker.trackException(e);
|
|
8734
8739
|
}
|
|
@@ -8796,15 +8801,15 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !(c
|
|
|
8796
8801
|
* iframes they use the eventListener below to check if the target domain matches
|
|
8797
8802
|
* the domain from where the postMessage originated from.
|
|
8798
8803
|
*/
|
|
8799
|
-
var
|
|
8800
|
-
(0,inherits/* default */.Z)(
|
|
8804
|
+
var FrameChannel = /*#__PURE__*/function (_Channel) {
|
|
8805
|
+
(0,inherits/* default */.Z)(FrameChannel, _Channel);
|
|
8801
8806
|
|
|
8802
|
-
var _super = _createSuper(
|
|
8807
|
+
var _super = _createSuper(FrameChannel);
|
|
8803
8808
|
|
|
8804
|
-
function
|
|
8809
|
+
function FrameChannel(name, targetWindow, targetOrigin) {
|
|
8805
8810
|
var _this;
|
|
8806
8811
|
|
|
8807
|
-
(0,classCallCheck/* default */.Z)(this,
|
|
8812
|
+
(0,classCallCheck/* default */.Z)(this, FrameChannel);
|
|
8808
8813
|
|
|
8809
8814
|
_this = _super.call(this);
|
|
8810
8815
|
|
|
@@ -8830,7 +8835,7 @@ var FC = /*#__PURE__*/function (_Channel) {
|
|
|
8830
8835
|
return _this;
|
|
8831
8836
|
}
|
|
8832
8837
|
|
|
8833
|
-
_createClass(
|
|
8838
|
+
_createClass(FrameChannel, [{
|
|
8834
8839
|
key: "postMessage",
|
|
8835
8840
|
value: function postMessage(eventName, data, id, status) {
|
|
8836
8841
|
this.targetWindow.postMessage(this.constructObjectToSend(eventName, data, id, status), this.targetOrigin);
|
|
@@ -8850,7 +8855,7 @@ var FC = /*#__PURE__*/function (_Channel) {
|
|
|
8850
8855
|
}
|
|
8851
8856
|
|
|
8852
8857
|
try {
|
|
8853
|
-
if (
|
|
8858
|
+
if (FrameChannel.isMessageEvent(event)) {
|
|
8854
8859
|
parsedData = JSON.parse(event.data);
|
|
8855
8860
|
}
|
|
8856
8861
|
} catch (_unused) {
|
|
@@ -8893,11 +8898,20 @@ var FC = /*#__PURE__*/function (_Channel) {
|
|
|
8893
8898
|
status: status
|
|
8894
8899
|
});
|
|
8895
8900
|
} catch (e) {
|
|
8896
|
-
var
|
|
8901
|
+
var _context3, _context4;
|
|
8897
8902
|
|
|
8898
8903
|
var reason = e instanceof Error ? e.message : "unknown";
|
|
8899
8904
|
var payloadRootKeys = payload && (0,esm_typeof/* default */.Z)(payload) === "object" ? keys_default()(payload) : [];
|
|
8900
|
-
|
|
8905
|
+
|
|
8906
|
+
if (eventName === "DISPATCH" && payload && (0,esm_typeof/* default */.Z)(payload) === "object") {
|
|
8907
|
+
var _context2;
|
|
8908
|
+
|
|
8909
|
+
var p = payload;
|
|
8910
|
+
var dispatchPayloadKeys = p.payload && (0,esm_typeof/* default */.Z)(p.payload) === "object" ? keys_default()(p.payload) : [];
|
|
8911
|
+
throw new errors/* AdaEmbedError */.S(concat_default()(_context2 = "Failed to stringify payload for \"DISPATCH\" event. Reason: \"".concat(reason, "\". Payload keys: ")).call(_context2, dispatchPayloadKeys.join(", "), "."));
|
|
8912
|
+
}
|
|
8913
|
+
|
|
8914
|
+
throw new errors/* AdaEmbedError */.S(concat_default()(_context3 = concat_default()(_context4 = "Failed to stringify object. Reason: \"".concat(reason, "\". Event: \"")).call(_context4, eventName, "\". Payload keys: ")).call(_context3, payloadRootKeys.join(", "), "."));
|
|
8901
8915
|
}
|
|
8902
8916
|
}
|
|
8903
8917
|
}], [{
|
|
@@ -8907,10 +8921,8 @@ var FC = /*#__PURE__*/function (_Channel) {
|
|
|
8907
8921
|
}
|
|
8908
8922
|
}]);
|
|
8909
8923
|
|
|
8910
|
-
return
|
|
8924
|
+
return FrameChannel;
|
|
8911
8925
|
}(Channel);
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
8926
|
;// CONCATENATED MODULE: ./src/client/helpers/events/index.ts
|
|
8915
8927
|
/**
|
|
8916
8928
|
* Older browsers like IE11 cannot use Event and CustomEvent constructors. These
|
|
@@ -8976,17 +8988,17 @@ var ADA_CUSTOM_EVENT = "ada-custom-message";
|
|
|
8976
8988
|
* Custom Event Channel
|
|
8977
8989
|
*/
|
|
8978
8990
|
|
|
8979
|
-
var
|
|
8980
|
-
(0,inherits/* default */.Z)(
|
|
8991
|
+
var CustomEventChannel = /*#__PURE__*/function (_Channel) {
|
|
8992
|
+
(0,inherits/* default */.Z)(CustomEventChannel, _Channel);
|
|
8981
8993
|
|
|
8982
|
-
var _super = ce_createSuper(
|
|
8994
|
+
var _super = ce_createSuper(CustomEventChannel);
|
|
8983
8995
|
|
|
8984
|
-
function
|
|
8996
|
+
function CustomEventChannel() {
|
|
8985
8997
|
var _context;
|
|
8986
8998
|
|
|
8987
8999
|
var _this;
|
|
8988
9000
|
|
|
8989
|
-
(0,classCallCheck/* default */.Z)(this,
|
|
9001
|
+
(0,classCallCheck/* default */.Z)(this, CustomEventChannel);
|
|
8990
9002
|
|
|
8991
9003
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8992
9004
|
args[_key] = arguments[_key];
|
|
@@ -9005,9 +9017,9 @@ var CE = /*#__PURE__*/function (_Channel) {
|
|
|
9005
9017
|
return _this;
|
|
9006
9018
|
}
|
|
9007
9019
|
|
|
9008
|
-
_createClass(
|
|
9020
|
+
_createClass(CustomEventChannel, [{
|
|
9009
9021
|
key: "postMessage",
|
|
9010
|
-
value: // We want
|
|
9022
|
+
value: // We want CustomEventChannel to have the same interface as FrameChannel
|
|
9011
9023
|
function postMessage(eventName, data, id, status) {
|
|
9012
9024
|
var customEvent = createNewCustomEvent(this.eventType, this.constructObjectToSend(eventName, data, id, status));
|
|
9013
9025
|
window.dispatchEvent(customEvent);
|
|
@@ -9044,7 +9056,7 @@ var CE = /*#__PURE__*/function (_Channel) {
|
|
|
9044
9056
|
}
|
|
9045
9057
|
}]);
|
|
9046
9058
|
|
|
9047
|
-
return
|
|
9059
|
+
return CustomEventChannel;
|
|
9048
9060
|
}(Channel);
|
|
9049
9061
|
;// CONCATENATED MODULE: ./src/client/lib/message-service.ts
|
|
9050
9062
|
|
|
@@ -9054,20 +9066,19 @@ var CE = /*#__PURE__*/function (_Channel) {
|
|
|
9054
9066
|
|
|
9055
9067
|
|
|
9056
9068
|
|
|
9057
|
-
|
|
9058
9069
|
var MessageService = /*#__PURE__*/function () {
|
|
9059
9070
|
function MessageService() {
|
|
9060
9071
|
(0,classCallCheck/* default */.Z)(this, MessageService);
|
|
9061
9072
|
|
|
9062
9073
|
(0,defineProperty/* default */.Z)(this, "channels", {
|
|
9063
|
-
local: new
|
|
9074
|
+
local: new CustomEventChannel()
|
|
9064
9075
|
});
|
|
9065
9076
|
}
|
|
9066
9077
|
|
|
9067
9078
|
_createClass(MessageService, [{
|
|
9068
9079
|
key: "registerFrameChannel",
|
|
9069
9080
|
value: function registerFrameChannel(name, targetWindow, targetOrigin) {
|
|
9070
|
-
var frameChannel = new
|
|
9081
|
+
var frameChannel = new FrameChannel(name, targetWindow, targetOrigin);
|
|
9071
9082
|
this.channels[name] = frameChannel;
|
|
9072
9083
|
return frameChannel;
|
|
9073
9084
|
}
|
|
@@ -9104,8 +9115,6 @@ var MessageService = /*#__PURE__*/function () {
|
|
|
9104
9115
|
|
|
9105
9116
|
return MessageService;
|
|
9106
9117
|
}();
|
|
9107
|
-
|
|
9108
|
-
|
|
9109
9118
|
// EXTERNAL MODULE: ./node_modules/json-stable-stringify/index.js
|
|
9110
9119
|
var json_stable_stringify = __webpack_require__(7266);
|
|
9111
9120
|
var json_stable_stringify_default = /*#__PURE__*/__webpack_require__.n(json_stable_stringify);
|
|
@@ -9192,7 +9201,7 @@ function getEmbedURL(_ref) {
|
|
|
9192
9201
|
polyfillVersionString = "legacy";
|
|
9193
9202
|
}
|
|
9194
9203
|
|
|
9195
|
-
return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "
|
|
9204
|
+
return concat_default()(_context5 = concat_default()(_context6 = concat_default()(_context7 = "".concat(host, "/embed/")).call(_context7, polyfillVersionString, "/")).call(_context6, frameName, "/")).call(_context5, "1f14246", "/index.html");
|
|
9196
9205
|
}
|
|
9197
9206
|
/**
|
|
9198
9207
|
* Generate the Chat / API URL
|
|
@@ -11460,7 +11469,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11460
11469
|
closeTransitionTime = _this$state.closeTransitionTime;
|
|
11461
11470
|
var isShown = isDrawerOpen && isMounted;
|
|
11462
11471
|
var backgroundColor = this.darkMode ? "#121212" : "#fff";
|
|
11463
|
-
var borderRadius = (
|
|
11472
|
+
var borderRadius = ((_client$ui_settings2 = client.ui_settings) === null || _client$ui_settings2 === void 0 ? void 0 : _client$ui_settings2.chat.style) === "rectangular" ? "8px" : "16px";
|
|
11464
11473
|
var WINDOW_HEIGHT = 725;
|
|
11465
11474
|
var TEST_BOT_NAV_HEIGHT = 48;
|
|
11466
11475
|
var isTestBot = client.features.embed_test_bot && testMode;
|
|
@@ -11484,7 +11493,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11484
11493
|
}, {
|
|
11485
11494
|
key: "visibleProactiveStyles",
|
|
11486
11495
|
get: function get() {
|
|
11487
|
-
var _client$ui_settings3, _client$ui_settings3$,
|
|
11496
|
+
var _client$ui_settings3, _client$ui_settings3$, _context15, _context16, _context17;
|
|
11488
11497
|
|
|
11489
11498
|
var _this$props5 = this.props,
|
|
11490
11499
|
chatDimensions = _this$props5.chatDimensions,
|
|
@@ -11494,7 +11503,7 @@ var ChatFrame = /*#__PURE__*/function (_Component) {
|
|
|
11494
11503
|
|
|
11495
11504
|
var delta = 3;
|
|
11496
11505
|
var TEXT_BUTTON_HEIGHT = 44;
|
|
11497
|
-
var bottomOffset = (client === null || client === void 0 ? void 0 : (_client$ui_settings3 = client.ui_settings) === null || _client$ui_settings3 === void 0 ? void 0 : (_client$ui_settings3$ = _client$ui_settings3.embed) === null || _client$ui_settings3$ === void 0 ? void 0 : _client$ui_settings3$.style) === "text" ? TEXT_BUTTON_HEIGHT - delta : (client === null || client === void 0 ? void 0 :
|
|
11506
|
+
var bottomOffset = (client === null || client === void 0 ? void 0 : (_client$ui_settings3 = client.ui_settings) === null || _client$ui_settings3 === void 0 ? void 0 : (_client$ui_settings3$ = _client$ui_settings3.embed) === null || _client$ui_settings3$ === void 0 ? void 0 : _client$ui_settings3$.style) === "text" ? TEXT_BUTTON_HEIGHT - delta : (client === null || client === void 0 ? void 0 : client.chat_button.size) - delta;
|
|
11498
11507
|
return concat_default()(_context15 = concat_default()(_context16 = concat_default()(_context17 = "\n box-shadow: none;\n background: none;\n height: ".concat(chatDimensions === null || chatDimensions === void 0 ? void 0 : chatDimensions.height, "px !important;\n width: ")).call(_context17, chatDimensions === null || chatDimensions === void 0 ? void 0 : chatDimensions.width, "px !important;\n ")).call(_context16, getAlignment(adaSettings), ": 0;\n bottom: ")).call(_context15, bottomOffset, "px;\n z-index: 9999;\n ");
|
|
11499
11508
|
}
|
|
11500
11509
|
}, {
|
|
@@ -12007,7 +12016,7 @@ var IntroFrame = /*#__PURE__*/function (_Component) {
|
|
|
12007
12016
|
var introPositionRight = INTRO_BUTTON_PADDING + buttonSize;
|
|
12008
12017
|
var stylesForHiding = "\n visibility: \"hidden\";\n top: -9999px !important;\n left: -9999px !important;\n ";
|
|
12009
12018
|
|
|
12010
|
-
var styles = concat_default()(_context = concat_default()(_context2 = concat_default()(_context3 = concat_default()(_context4 = concat_default()(_context5 = "\n position: fixed;\n ".concat(getAlignment(adaSettings), ": ")).call(_context5, introPositionRight, "px;\n bottom: 8px;\n z-index: 10000;\n max-height: 300px;\n max-width: 250px;\n opacity: ")).call(_context4, this.isShown ? "1" : "0", ";\n height: ")).call(_context3, introDimensions
|
|
12019
|
+
var styles = concat_default()(_context = concat_default()(_context2 = concat_default()(_context3 = concat_default()(_context4 = concat_default()(_context5 = "\n position: fixed;\n ".concat(getAlignment(adaSettings), ": ")).call(_context5, introPositionRight, "px;\n bottom: 8px;\n z-index: 10000;\n max-height: 300px;\n max-width: 250px;\n opacity: ")).call(_context4, this.isShown ? "1" : "0", ";\n height: ")).call(_context3, introDimensions.height, "px;\n width: ")).call(_context2, introDimensions.width, "px;\n\n ")).call(_context, Boolean(client === null || client === void 0 ? void 0 : client.features.chat_ui_v2) && concat_default()(_context6 = "\n max-height: auto;\n max-width: 350px;\n z-index: 9999;\n ".concat(getAlignment(adaSettings), ": 0;\n bottom: ")).call(_context6, buttonSize - 20, "px;\n "), "\n ");
|
|
12011
12020
|
|
|
12012
12021
|
if (!this.isShown) {
|
|
12013
12022
|
return styles + stylesForHiding;
|
|
@@ -12452,7 +12461,7 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12452
12461
|
*/
|
|
12453
12462
|
|
|
12454
12463
|
|
|
12455
|
-
if (chatterToken && prevProps.chatterToken !== chatterToken && client !== null && client !== void 0 && client.business_events && client
|
|
12464
|
+
if (chatterToken && prevProps.chatterToken !== chatterToken && client !== null && client !== void 0 && client.business_events && client.features.afm_business_events) {
|
|
12456
12465
|
this.evaluateBusinessEventConditions();
|
|
12457
12466
|
}
|
|
12458
12467
|
}
|
|
@@ -12994,9 +13003,6 @@ var Container = /*#__PURE__*/function (_Component) {
|
|
|
12994
13003
|
if (!newClient.features.chat_ui_v2) {
|
|
12995
13004
|
(0,services_logger/* log */.c)("Clients on old UI", {
|
|
12996
13005
|
clientHandle: newClient.handle
|
|
12997
|
-
}, {
|
|
12998
|
-
sampleRate: 0.01 // log 1 out of every 100
|
|
12999
|
-
|
|
13000
13006
|
});
|
|
13001
13007
|
}
|
|
13002
13008
|
|
|
@@ -13892,7 +13898,7 @@ window.__AdaEmbedConstructor = Embed;
|
|
|
13892
13898
|
/* harmony export */ });
|
|
13893
13899
|
var isModern = new RegExp("((CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(14|(1[5-9]|[2-9]\\d|\\d{3,}))[_.]\\d+(?:[_.]\\d+)?)|((Chromium|Chrome)\\/(92|(9[3-9]|\\d{3,}))\\.\\d+(?:\\.\\d+)?)|(Version\\/(14|(1[5-9]|[2-9]\\d|\\d{3,}))\\.\\d+(?:\\.\\d+)? Safari\\/)|(Firefox\\/(91|(9[2-9]|\\d{3,}))\\.\\d+\\.\\d+)|(Firefox\\/(91|(9[2-9]|\\d{3,}))\\.\\d+(pre|[ab]\\d+[a-z]*)?)").test(navigator.userAgent);
|
|
13894
13900
|
var isProduction = "production" === "production";
|
|
13895
|
-
var embed2Version = "
|
|
13901
|
+
var embed2Version = "1f14246";
|
|
13896
13902
|
|
|
13897
13903
|
/***/ }),
|
|
13898
13904
|
|
|
@@ -14180,12 +14186,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
14180
14186
|
|
|
14181
14187
|
|
|
14182
14188
|
|
|
14183
|
-
var DEFAULT_LOG_SAMPLE_RATE = 0.1
|
|
14189
|
+
var DEFAULT_LOG_SAMPLE_RATE = 0.01; // 1% of logs will go through
|
|
14190
|
+
|
|
14184
14191
|
var DD_BASE_URL = "https://browser-http-intake.logs.datadoghq.com/v1/input/";
|
|
14185
14192
|
var DD_TOKEN = "pubfe23baedd2ea322bebb5ed2020fa2fa1";
|
|
14186
14193
|
|
|
14187
14194
|
var shouldLog = function shouldLog(sampleRate) {
|
|
14188
|
-
if (!DD_TOKEN || sampleRate
|
|
14195
|
+
if (!DD_TOKEN || sampleRate !== undefined && sampleRate <= 0) {
|
|
14189
14196
|
return false;
|
|
14190
14197
|
}
|
|
14191
14198
|
|
|
@@ -14221,7 +14228,12 @@ function _log() {
|
|
|
14221
14228
|
body: _babel_runtime_corejs3_core_js_stable_json_stringify__WEBPACK_IMPORTED_MODULE_8___default()(_objectSpread(_objectSpread({
|
|
14222
14229
|
message: message
|
|
14223
14230
|
}, extra), {}, {
|
|
14224
|
-
|
|
14231
|
+
service: "embed",
|
|
14232
|
+
env: "production",
|
|
14233
|
+
embedVersion: 2,
|
|
14234
|
+
version: "1.0.46",
|
|
14235
|
+
isNpm: true,
|
|
14236
|
+
commitHash: "1f14246"
|
|
14225
14237
|
}))
|
|
14226
14238
|
});
|
|
14227
14239
|
|
|
@@ -23665,8 +23677,8 @@ function _loadEmbed() {
|
|
|
23665
23677
|
while (1) {
|
|
23666
23678
|
switch (_context18.prev = _context18.next) {
|
|
23667
23679
|
case 0:
|
|
23668
|
-
if (adaSettings
|
|
23669
|
-
embedScriptSource = config_info/* isModern */.pX ? adaSettings
|
|
23680
|
+
if (adaSettings.customDomains) {
|
|
23681
|
+
embedScriptSource = config_info/* isModern */.pX ? adaSettings.customDomains.embedModern : adaSettings.customDomains.embedLegacy;
|
|
23670
23682
|
} else {
|
|
23671
23683
|
if (config_info/* isProduction */.yv) {
|
|
23672
23684
|
host = "https://static.ada.support";
|
|
@@ -23676,7 +23688,7 @@ function _loadEmbed() {
|
|
|
23676
23688
|
polyfillVersionString = "legacy";
|
|
23677
23689
|
}
|
|
23678
23690
|
|
|
23679
|
-
embedScriptSource = concat_default()(_context16 = concat_default()(_context17 = "".concat(host, "/embed/")).call(_context17, polyfillVersionString, "/client/")).call(_context16, "
|
|
23691
|
+
embedScriptSource = concat_default()(_context16 = concat_default()(_context17 = "".concat(host, "/embed/")).call(_context17, polyfillVersionString, "/client/")).call(_context16, "1f14246", "/index.js");
|
|
23680
23692
|
}
|
|
23681
23693
|
|
|
23682
23694
|
clientScriptExists = Boolean( true || // The client script is bundled with npm module
|
|
@@ -23781,7 +23793,7 @@ function createEmbedObject() {
|
|
|
23781
23793
|
return loadEmbed(adaSettings);
|
|
23782
23794
|
|
|
23783
23795
|
case 5:
|
|
23784
|
-
if (!(adaSettings
|
|
23796
|
+
if (!(adaSettings.customDomains && window.__AdaEmbedConstructor && window.__AdaEmbedConstructor.embed2Version !== config_info/* embed2Version */.Mk)) {
|
|
23785
23797
|
_context2.next = 7;
|
|
23786
23798
|
break;
|
|
23787
23799
|
}
|
|
@@ -23801,15 +23813,8 @@ function createEmbedObject() {
|
|
|
23801
23813
|
startEmbedResolve();
|
|
23802
23814
|
(0,logger/* log */.c)("Embed start", {
|
|
23803
23815
|
handle: adaSettings.handle,
|
|
23804
|
-
embedVersion: 2,
|
|
23805
23816
|
embedSettings: adaSettings,
|
|
23806
|
-
|
|
23807
|
-
isNpm: true,
|
|
23808
|
-
hostPage: window.location.href,
|
|
23809
|
-
commitHash: "70f4c51"
|
|
23810
|
-
}, {
|
|
23811
|
-
sampleRate: 0.01 // 1% of logs will go through
|
|
23812
|
-
|
|
23817
|
+
hostPage: window.location.href
|
|
23813
23818
|
});
|
|
23814
23819
|
return _context2.abrupt("return", embed.initialized);
|
|
23815
23820
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ada-support/embed2",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.46",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/npm-entry",
|
|
6
6
|
"typings": "dist/npm-entry/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"build:modern": "NODE_ENV=production BROWSERSLIST_ENV=modern npx webpack --config webpack.prod.ts",
|
|
11
11
|
"build:npm-types": "tsc --project tsconfig.npm.json --declaration --outDir dist/npm-entry --emitDeclarationOnly --allowJs false --checkJs false",
|
|
12
12
|
"build:npm": "./npm-build.sh",
|
|
13
|
-
"lint": "tsc --noEmit --strict false && ./node_modules/.bin/eslint --report-unused-disable-directives --ext .js,.jsx,.ts,.tsx . --max-warnings
|
|
13
|
+
"lint": "tsc --noEmit --strict false && ./node_modules/.bin/eslint --report-unused-disable-directives --ext .js,.jsx,.ts,.tsx . --max-warnings 109",
|
|
14
14
|
"lint:fix": "yarn lint --fix",
|
|
15
15
|
"deploy-legacy": "TS_NODE_PROJECT=wp.tsconfig.json NODE_ENV=production BROWSERSLIST_ENV=legacy npx webpack --config webpack.prod.ts",
|
|
16
16
|
"deploy-modern": "TS_NODE_PROJECT=wp.tsconfig.json NODE_ENV=production BROWSERSLIST_ENV=modern npx webpack --config webpack.prod.ts",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"author": "",
|
|
54
54
|
"license": "ISC",
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@ada-support/eslint-config-ada": "^1.1.
|
|
56
|
+
"@ada-support/eslint-config-ada": "^1.1.5",
|
|
57
57
|
"@babel/core": "^7.14.8",
|
|
58
58
|
"@babel/plugin-proposal-class-properties": "^7.14.5",
|
|
59
59
|
"@babel/plugin-proposal-numeric-separator": "^7.14.5",
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"cypress": "^9.1.0",
|
|
77
77
|
"enzyme": "^3.11.0",
|
|
78
78
|
"enzyme-adapter-preact-pure": "^2.2.0",
|
|
79
|
+
"eslint": "^8.6.0",
|
|
79
80
|
"eslint-plugin-chai-friendly": "^0.7.2",
|
|
80
81
|
"eslint-plugin-compat": "^3.13.0",
|
|
81
82
|
"eslint-plugin-cypress": "^2.11.3",
|
|
@@ -119,6 +120,7 @@
|
|
|
119
120
|
"webpack-s3-plugin": "^1.2.0-rc.0"
|
|
120
121
|
},
|
|
121
122
|
"resolutions": {
|
|
123
|
+
"follow-redirects": ">=1.14.7",
|
|
122
124
|
"json-schema": ">=0.4.0",
|
|
123
125
|
"minimist": ">=0.2.1",
|
|
124
126
|
"node-forge": ">=1.0.0",
|