@microsoft/omnichannel-amsclient
Advanced tools
Comparing version 0.1.0-main.ece533e to 0.1.0-main.ef0152f
@@ -1,1 +0,1 @@ | ||
exports.baseUrl = 'https://comms-test.omnichannelengagementhub.com/ams'; exports.sdkVersion = '0.1.0-main.ece533e'; | ||
exports.baseUrl = 'https://comms.omnichannelengagementhub.com/ams'; exports.sdkVersion = '0.1.0-main.ef0152f'; |
@@ -29,4 +29,4 @@ import AMSFileInfo from "./AMSFileInfo"; | ||
handleEvent(event: MessageEvent<any>): Promise<void>; | ||
private createIframe; | ||
private loadIframe; | ||
} | ||
export default FramedClient; |
@@ -81,3 +81,3 @@ "use strict"; | ||
} | ||
return [4 /*yield*/, this.createIframe()]; | ||
return [4 /*yield*/, this.loadIframe()]; | ||
case 1: | ||
@@ -103,10 +103,16 @@ _a.sent(); | ||
return __generator(this, function (_a) { | ||
/* istanbul ignore next */ | ||
this.debug && console.log("[FramedClient][skypeAuth]"); | ||
data = { | ||
chatToken: chatToken || this.chatToken | ||
}; | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
_this.postMessage(PostMessageEventType_1.default.Request, PostMessageEventName_1.default.SkypeTokenAuth, data, resolve, reject); | ||
})]; | ||
switch (_a.label) { | ||
case 0: | ||
/* istanbul ignore next */ | ||
this.debug && console.log("[FramedClient][skypeAuth]"); | ||
data = { | ||
chatToken: chatToken || this.chatToken | ||
}; | ||
return [4 /*yield*/, this.loadIframe()]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
_this.postMessage(PostMessageEventType_1.default.Request, PostMessageEventName_1.default.SkypeTokenAuth, data, resolve, reject); | ||
})]; | ||
} | ||
}); | ||
@@ -121,12 +127,18 @@ }); | ||
return __generator(this, function (_a) { | ||
/* istanbul ignore next */ | ||
this.debug && console.log("[FramedClient][createObject]"); | ||
data = { | ||
id: id, | ||
file: file, | ||
chatToken: chatToken || this.chatToken | ||
}; | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
_this.postMessage(PostMessageEventType_1.default.Request, PostMessageEventName_1.default.CreateObject, data, resolve, reject); | ||
})]; | ||
switch (_a.label) { | ||
case 0: | ||
/* istanbul ignore next */ | ||
this.debug && console.log("[FramedClient][createObject]"); | ||
data = { | ||
id: id, | ||
file: file, | ||
chatToken: chatToken || this.chatToken | ||
}; | ||
return [4 /*yield*/, this.loadIframe()]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
_this.postMessage(PostMessageEventType_1.default.Request, PostMessageEventName_1.default.CreateObject, data, resolve, reject); | ||
})]; | ||
} | ||
}); | ||
@@ -141,12 +153,18 @@ }); | ||
return __generator(this, function (_a) { | ||
/* istanbul ignore next */ | ||
this.debug && console.log("[FramedClient][uploadDocument]"); | ||
data = { | ||
documentId: documentId, | ||
file: file, | ||
chatToken: chatToken || this.chatToken | ||
}; | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
_this.postMessage(PostMessageEventType_1.default.Request, PostMessageEventName_1.default.UploadDocument, data, resolve, reject); | ||
})]; | ||
switch (_a.label) { | ||
case 0: | ||
/* istanbul ignore next */ | ||
this.debug && console.log("[FramedClient][uploadDocument]"); | ||
data = { | ||
documentId: documentId, | ||
file: file, | ||
chatToken: chatToken || this.chatToken | ||
}; | ||
return [4 /*yield*/, this.loadIframe()]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
_this.postMessage(PostMessageEventType_1.default.Request, PostMessageEventName_1.default.UploadDocument, data, resolve, reject); | ||
})]; | ||
} | ||
}); | ||
@@ -161,9 +179,15 @@ }); | ||
return __generator(this, function (_a) { | ||
data = { | ||
fileMetadata: fileMetadata, | ||
chatToken: chatToken || this.chatToken | ||
}; | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
_this.postMessage(PostMessageEventType_1.default.Request, PostMessageEventName_1.default.GetViewStatus, data, resolve, reject); | ||
})]; | ||
switch (_a.label) { | ||
case 0: | ||
data = { | ||
fileMetadata: fileMetadata, | ||
chatToken: chatToken || this.chatToken | ||
}; | ||
return [4 /*yield*/, this.loadIframe()]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
_this.postMessage(PostMessageEventType_1.default.Request, PostMessageEventName_1.default.GetViewStatus, data, resolve, reject); | ||
})]; | ||
} | ||
}); | ||
@@ -178,10 +202,16 @@ }); | ||
return __generator(this, function (_a) { | ||
data = { | ||
fileMetadata: fileMetadata, | ||
viewLocation: viewLocation, | ||
chatToken: chatToken || this.chatToken | ||
}; | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
_this.postMessage(PostMessageEventType_1.default.Request, PostMessageEventName_1.default.GetView, data, resolve, reject); | ||
})]; | ||
switch (_a.label) { | ||
case 0: | ||
data = { | ||
fileMetadata: fileMetadata, | ||
viewLocation: viewLocation, | ||
chatToken: chatToken || this.chatToken | ||
}; | ||
return [4 /*yield*/, this.loadIframe()]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
_this.postMessage(PostMessageEventType_1.default.Request, PostMessageEventName_1.default.GetView, data, resolve, reject); | ||
})]; | ||
} | ||
}); | ||
@@ -225,2 +255,6 @@ }); | ||
}; | ||
if (!this.targetWindow) { | ||
console.error('Target window not found!'); | ||
return; | ||
} | ||
this.targetWindow.postMessage(__assign({ requestId: requestId, | ||
@@ -240,3 +274,6 @@ eventType: eventType, | ||
this.debug && console.log(event); | ||
this.targetWindow = event.source; // Finds target window to post message back | ||
// Finds target window to post message back | ||
if (event.source) { | ||
this.targetWindow = event.source; | ||
} | ||
if (event.data.eventType === PostMessageEventType_1.default.Response) { | ||
@@ -274,3 +311,3 @@ /* istanbul ignore next */ | ||
}; | ||
FramedClient.prototype.createIframe = function () { | ||
FramedClient.prototype.loadIframe = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -284,2 +321,3 @@ var iframeId; | ||
var foundIframeElement = iframeElements.filter(function (iframeElement) { return iframeElement.id == iframeId; }); | ||
// Avoid duplicate load | ||
if (foundIframeElement.length) { | ||
@@ -286,0 +324,0 @@ return resolve(); |
{ | ||
"name": "@microsoft/omnichannel-amsclient", | ||
"version": "0.1.0-main.ece533e", | ||
"version": "0.1.0-main.ef0152f", | ||
"description": "Microsoft Omnichannel AMSClient", | ||
@@ -5,0 +5,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
207368
1609