@flagship.io/js-sdk
Version:
142 lines (126 loc) • 5.9 kB
JavaScript
;
(self["webpackChunk_flagship_io_js_sdk"] = self["webpackChunk_flagship_io_js_sdk"] || []).push([[777],{
/***/ 429:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ INTERNAL_EVENTS: () => (/* binding */ INTERNAL_EVENTS),
/* harmony export */ MSG_NAME_FROM_IFRAME: () => (/* binding */ MSG_NAME_FROM_IFRAME),
/* harmony export */ MSG_NAME_TO_IFRAME: () => (/* binding */ MSG_NAME_TO_IFRAME),
/* harmony export */ VisitorVariationUpdateParam: () => (/* binding */ VisitorVariationUpdateParam)
/* harmony export */ });
/**
* All events posted from iframe
*/
var MSG_NAME_FROM_IFRAME;
(function (MSG_NAME_FROM_IFRAME) {
MSG_NAME_FROM_IFRAME["QaAssistantClose"] = "ABTASTY_QA_ASSISTANT_CLOSE";
MSG_NAME_FROM_IFRAME["FsApplyForcedVariations"] = "FS_APPLY_FORCED_VARIATIONS";
MSG_NAME_FROM_IFRAME["FsResetForcedVariations"] = "FS_RESET_FORCED_VARIATIONS";
MSG_NAME_FROM_IFRAME["FsRemoveForcedVariation"] = "FS_REMOVE_FORCED_VARIATION";
MSG_NAME_FROM_IFRAME["FsQaAssistantReady"] = "FS_QA_ASSISTANT_READY";
MSG_NAME_FROM_IFRAME["MinimizeQaAssistantClose"] = "ABTASTY_QA_MINIMIZE_QA_ASSISTANT_CLOSE";
MSG_NAME_FROM_IFRAME["FsTriggerRender"] = "FS_TRIGGER_RENDER";
MSG_NAME_FROM_IFRAME["QaAssistantPlatformChoiceLoaded"] = "ABTASTY_QA_ASSISTANT_PLATFORM_CHOICE_LOADED";
MSG_NAME_FROM_IFRAME["FsVariationsForcedAllocation"] = "FS_VARIATIONS_FORCED_ALLOCATION";
MSG_NAME_FROM_IFRAME["FsVariationsForcedUnallocation"] = "FS_VARIATIONS_FORCED_UNALLOCATION";
})(MSG_NAME_FROM_IFRAME || (MSG_NAME_FROM_IFRAME = {}));
/**
* All events posted to iframe
*/
var MSG_NAME_TO_IFRAME;
(function (MSG_NAME_TO_IFRAME) {
MSG_NAME_TO_IFRAME["FsUpdateVisitorAllocatedVariation"] = "FS_UPDATE_VISITOR_ALLOCATED_VARIATION";
MSG_NAME_TO_IFRAME["FsVisitorExposedVariation"] = "FS_VISITOR_EXPOSED_VARIATION";
MSG_NAME_TO_IFRAME["FsHIT"] = "FS_HIT";
})(MSG_NAME_TO_IFRAME || (MSG_NAME_TO_IFRAME = {}));
var VisitorVariationUpdateParam;
(function (VisitorVariationUpdateParam) {
VisitorVariationUpdateParam["NewNavigation"] = "newNavigation";
})(VisitorVariationUpdateParam || (VisitorVariationUpdateParam = {}));
var INTERNAL_EVENTS;
(function (INTERNAL_EVENTS) {
INTERNAL_EVENTS["FsTriggerRendering"] = "FS_TRIGGER_RENDERING";
})(INTERNAL_EVENTS || (INTERNAL_EVENTS = {}));
/***/ }),
/***/ 586:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ sendFsHitToQA: () => (/* binding */ sendFsHitToQA),
/* harmony export */ sendVisitorAllocatedVariations: () => (/* binding */ sendVisitorAllocatedVariations),
/* harmony export */ sendVisitorExposedVariations: () => (/* binding */ sendVisitorExposedVariations)
/* harmony export */ });
/* unused harmony export sendMessageToIframe */
/* harmony import */ var _type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(429);
function sendMessageToIframe(data) {
if (!window?.frames?.ABTastyQaAssistant) {
return;
}
window.frames.ABTastyQaAssistant.postMessage(data, '*');
}
function sendVisitorAllocatedVariations(visitorVariationState) {
if (!visitorVariationState?.visitorVariations) {
return;
}
sendMessageToIframe({
name: _type__WEBPACK_IMPORTED_MODULE_0__.MSG_NAME_TO_IFRAME.FsUpdateVisitorAllocatedVariation,
value: visitorVariationState.visitorVariations,
visitorData: visitorVariationState.visitorData,
sdkInfo: visitorVariationState.sdkInfo
});
}
function sendVisitorExposedVariations(visitorVariationState) {
if (!visitorVariationState?.exposedVariations) {
return;
}
const navigationDetected = visitorVariationState.navigationDetected;
if (visitorVariationState.navigationDetected) {
visitorVariationState.navigationDetected = false;
}
sendMessageToIframe({
name: _type__WEBPACK_IMPORTED_MODULE_0__.MSG_NAME_TO_IFRAME.FsVisitorExposedVariation,
value: visitorVariationState.exposedVariations,
param: navigationDetected ? _type__WEBPACK_IMPORTED_MODULE_0__.VisitorVariationUpdateParam.NewNavigation : undefined
});
}
function sendFsHitToQA(hit) {
sendMessageToIframe({
name: _type__WEBPACK_IMPORTED_MODULE_0__.MSG_NAME_TO_IFRAME.FsHIT,
value: hit.map(item => {
return {
...item,
timestamp: Date.now() - item.qt
};
})
});
}
/***/ }),
/***/ 777:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ sendFsHitToQA: () => (/* binding */ sendFsHitToQA),
/* harmony export */ sendVisitorAllocatedVariations: () => (/* binding */ sendVisitorAllocatedVariations),
/* harmony export */ sendVisitorExposedVariations: () => (/* binding */ sendVisitorExposedVariations)
/* harmony export */ });
/* harmony import */ var _web_messages_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(586);
function sendVisitorAllocatedVariations(visitorVariationState) {
if (true) {
(0,_web_messages_index__WEBPACK_IMPORTED_MODULE_0__.sendVisitorAllocatedVariations)(visitorVariationState);
}
if (false) {}
}
function sendVisitorExposedVariations(visitorVariationState) {
if (true) {
(0,_web_messages_index__WEBPACK_IMPORTED_MODULE_0__.sendVisitorExposedVariations)(visitorVariationState);
}
if (false) {}
}
function sendFsHitToQA(hit) {
if (true) {
(0,_web_messages_index__WEBPACK_IMPORTED_MODULE_0__.sendFsHitToQA)(hit);
}
if (false) {}
}
/***/ })
}]);
//# sourceMappingURL=777.79f16a66f9550b76b0bd.js.map