Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tef-novum/webview-bridge

Package Overview
Dependencies
Maintainers
7
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tef-novum/webview-bridge - npm Package Compare versions

Comparing version 3.16.0 to 3.17.0

4

dist/index.d.ts

@@ -13,3 +13,3 @@ export { isWebViewBridgeAvailable, onNativeEvent, NativeEventHandler, setLogger, } from './src/post-message';

export { showAppRating } from './src/app-rating';
export { bottomSheet, bottomSheetSingleSelector } from './src/bottom-sheet';
export type { SheetListItem } from './src/bottom-sheet';
export { bottomSheet, bottomSheetSingleSelector, bottomSheetActionSelector, bottomSheetInfo, } from './src/bottom-sheet';
export type { SheetRowItem, SheetActionItem, SheetInfoItem, } from './src/bottom-sheet';
import { type SheetResponse } from './post-message';
declare type SheetListType = 'SINGLE_SELECTION';
export declare type SheetListItem = Readonly<{
declare type SheetIcon = Readonly<{
url: string;
urlDark?: string;
type?: 'regular' | 'small';
}>;
declare type InfoIcon = Readonly<{
url: string;
urlDark?: string;
type: 'regular' | 'small';
}> | Readonly<{
type: 'bullet';
}>;
export declare type SheetRowItem = Readonly<{
id: string;
title?: string;
description?: string;
icon?: Readonly<{
url: string;
urlDark?: string;
}>;
icon?: SheetIcon;
}>;
export declare type SheetActionItem = Readonly<{
id: string;
title: string;
style?: 'normal' | 'destructive';
icon?: SheetIcon;
}>;
export declare type SheetInfoItem = Readonly<{
id: string;
title: string;
description?: string;
icon: InfoIcon;
}>;
declare type SheetUIElement = Readonly<{
id: string;
type: 'LIST';
listType: SheetListType;
listType: 'SINGLE_SELECTION';
autoSubmit?: boolean;
selectedIds: Array<string>;
items: Array<SheetListItem>;
items: Array<SheetRowItem>;
}> | Readonly<{
id: string;
type: 'LIST';
listType: 'ACTIONS';
autoSubmit?: boolean;
selectedIds: Array<string>;
items: Array<SheetActionItem>;
}> | Readonly<{
id: string;
type: 'LIST';
listType: 'INFORMATIVE';
autoSubmit?: boolean;
selectedIds: Array<string>;
items: Array<SheetInfoItem>;
}>;

@@ -32,3 +66,3 @@ declare type SheetUI = Readonly<{

selectedId?: string | undefined;
items: Array<SheetListItem>;
items: Array<SheetRowItem>;
}) => Promise<{

@@ -41,2 +75,20 @@ action: 'SUBMIT';

}>;
export declare const bottomSheetActionSelector: ({ title, subtitle, description, items, }: {
title?: string | undefined;
subtitle?: string | undefined;
description?: string | undefined;
items: Array<SheetActionItem>;
}) => Promise<{
action: 'SUBMIT';
selectedId: string;
} | {
action: 'DISMISS';
selectedId: null;
}>;
export declare const bottomSheetInfo: ({ title, subtitle, description, items, }: {
title?: string | undefined;
subtitle?: string | undefined;
description?: string | undefined;
items: Array<SheetInfoItem>;
}) => Promise<void>;
export {};

@@ -963,2 +963,61 @@ define(['exports'], (function (exports) { 'use strict';

};
var bottomSheetActionSelector = function (_a) {
var title = _a.title, subtitle = _a.subtitle, description = _a.description, items = _a.items;
return bottomSheet({
title: title,
subtitle: subtitle,
description: description,
content: [
{
type: 'LIST',
id: 'list-0',
listType: 'ACTIONS',
autoSubmit: true,
selectedIds: [],
items: items,
},
],
}).then(function (_a) {
var action = _a.action, result = _a.result;
if (action === 'SUBMIT') {
return {
action: action,
selectedId: result[0].selectedIds[0],
};
}
else {
return {
action: action,
selectedId: null,
};
}
});
};
var bottomSheetInfo = function (_a) {
var title = _a.title, subtitle = _a.subtitle, description = _a.description, items = _a.items;
return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, bottomSheet({
title: title,
subtitle: subtitle,
description: description,
content: [
{
type: 'LIST',
id: 'list-0',
listType: 'INFORMATIVE',
autoSubmit: false,
selectedIds: [],
items: items,
},
],
})];
case 1:
_b.sent();
return [2 /*return*/];
}
});
});
};

@@ -970,2 +1029,4 @@ exports.CD_EVENT_VALUE = CD_EVENT_VALUE;

exports.bottomSheet = bottomSheet;
exports.bottomSheetActionSelector = bottomSheetActionSelector;
exports.bottomSheetInfo = bottomSheetInfo;
exports.bottomSheetSingleSelector = bottomSheetSingleSelector;

@@ -972,0 +1033,0 @@ exports.checkPermissionStatus = checkPermissionStatus;

@@ -965,2 +965,61 @@ 'use strict';

};
var bottomSheetActionSelector = function (_a) {
var title = _a.title, subtitle = _a.subtitle, description = _a.description, items = _a.items;
return bottomSheet({
title: title,
subtitle: subtitle,
description: description,
content: [
{
type: 'LIST',
id: 'list-0',
listType: 'ACTIONS',
autoSubmit: true,
selectedIds: [],
items: items,
},
],
}).then(function (_a) {
var action = _a.action, result = _a.result;
if (action === 'SUBMIT') {
return {
action: action,
selectedId: result[0].selectedIds[0],
};
}
else {
return {
action: action,
selectedId: null,
};
}
});
};
var bottomSheetInfo = function (_a) {
var title = _a.title, subtitle = _a.subtitle, description = _a.description, items = _a.items;
return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, bottomSheet({
title: title,
subtitle: subtitle,
description: description,
content: [
{
type: 'LIST',
id: 'list-0',
listType: 'INFORMATIVE',
autoSubmit: false,
selectedIds: [],
items: items,
},
],
})];
case 1:
_b.sent();
return [2 /*return*/];
}
});
});
};

@@ -972,2 +1031,4 @@ exports.CD_EVENT_VALUE = CD_EVENT_VALUE;

exports.bottomSheet = bottomSheet;
exports.bottomSheetActionSelector = bottomSheetActionSelector;
exports.bottomSheetInfo = bottomSheetInfo;
exports.bottomSheetSingleSelector = bottomSheetSingleSelector;

@@ -974,0 +1035,0 @@ exports.checkPermissionStatus = checkPermissionStatus;

@@ -964,2 +964,61 @@ var webviewBridge = (function (exports) {

};
var bottomSheetActionSelector = function (_a) {
var title = _a.title, subtitle = _a.subtitle, description = _a.description, items = _a.items;
return bottomSheet({
title: title,
subtitle: subtitle,
description: description,
content: [
{
type: 'LIST',
id: 'list-0',
listType: 'ACTIONS',
autoSubmit: true,
selectedIds: [],
items: items,
},
],
}).then(function (_a) {
var action = _a.action, result = _a.result;
if (action === 'SUBMIT') {
return {
action: action,
selectedId: result[0].selectedIds[0],
};
}
else {
return {
action: action,
selectedId: null,
};
}
});
};
var bottomSheetInfo = function (_a) {
var title = _a.title, subtitle = _a.subtitle, description = _a.description, items = _a.items;
return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, bottomSheet({
title: title,
subtitle: subtitle,
description: description,
content: [
{
type: 'LIST',
id: 'list-0',
listType: 'INFORMATIVE',
autoSubmit: false,
selectedIds: [],
items: items,
},
],
})];
case 1:
_b.sent();
return [2 /*return*/];
}
});
});
};

@@ -971,2 +1030,4 @@ exports.CD_EVENT_VALUE = CD_EVENT_VALUE;

exports.bottomSheet = bottomSheet;
exports.bottomSheetActionSelector = bottomSheetActionSelector;
exports.bottomSheetInfo = bottomSheetInfo;
exports.bottomSheetSingleSelector = bottomSheetSingleSelector;

@@ -973,0 +1034,0 @@ exports.checkPermissionStatus = checkPermissionStatus;

@@ -1,1 +0,1 @@

var webviewBridge=function(e){"use strict";var t=1,n="".concat(Date.now(),"-").concat(String(Math.random()).slice(-8)),o="__tuenti_webview_bridge",r=function(){return!("undefined"==typeof window||!window.tuentiWebView||!window.tuentiWebView.postMessage)},i=function(){return!!("undefined"!=typeof window&&window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.tuentiWebView&&window.webkit.messageHandlers.tuentiWebView.postMessage)},a=function(){return"undefined"==typeof window?null:r()?function(e){window.tuentiWebView.postMessage(e)}:i()?function(e){window.webkit.messageHandlers.tuentiWebView.postMessage(e)}:null},u=[],s=function(e){u.push(e)},c=function(e){u=u.filter(function(t){return t!==e})},l=function(){var e;return"undefined"!=typeof window&&(!!function(){try{return window.self!==window.top}catch(e){return!0}}()&&!(null===(e=null===window||void 0===window?void 0:window.frameElement)||void 0===e?void 0:e.hasAttribute("data-enable-webview-bridge")))},f=void 0,d=function(){return!l()&&(r()||i())},p=function(e,o){var r=e.type,i=e.id,u=void 0===i?"web-".concat(t++,"-").concat(n):i,l=e.payload,d=a(),p=JSON.stringify({type:r,id:u,payload:l});return null===f||void 0===f||f("[WebView Bridge] SEND:",p),d?(setTimeout(function(){d(p)}),new Promise(function(e,t){var n=!1,i=function(o){o.id!==u||n||(o.type===r?e(o.payload):"ERROR"===o.type?t(o.payload):t({code:500,reason:"bad type: ".concat(o.type,". Expecting ").concat(r)}),c(i))};s(i),o&&setTimeout(function(){n=!0,c(i),t({code:408,reason:"request timeout"})},o)})):Promise.reject({code:500,reason:"WebView postMessage not available"})};"undefined"!=typeof window&&(window[o]=window[o]||{postMessage:function(e){var t;null===f||void 0===f||f("[WebView Bridge] RCVD:",e);try{t=JSON.parse(e)}catch(t){throw Error("Problem parsing webview message: ".concat(e))}u.forEach(function(e){return e(t)})}});var y=function(e,t){var n=function(n){n.type===e&&Promise.resolve(t(n.payload)).then(function(e){var t=a();t&&t(JSON.stringify({type:n.type,id:n.id,payload:e}))})};return s(n),function(){c(n)}},m=function(e){var t=e.title,n=e.expandedTitle,o=e.showBackButton,r=e.showReloadButton,i=e.showProfileButton,a=e.backgroundColor;return d()?p({type:"NAVIGATION_BAR",payload:{title:t,expandedTitle:n,showBackButton:o,showReloadButton:r,showProfileButton:i,backgroundColor:a}}):(void 0!==t&&"undefined"!=typeof document&&(document.title=t),Promise.resolve())},v=null,w=function(e){return"true"===v.result[e]},g=function(e){return Math.floor(e/1e3)},b=function(){return(b=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function h(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function T(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{s(o.next(e))}catch(e){i(e)}}function u(e){try{s(o.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,u)}s((o=o.apply(e,t||[])).next())})}function E(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var S=0,P=function(e){var t=setTimeout(function(){e(),S++},500);return function(){clearTimeout(t),S=0,e()}},A=function(e){var t=e.onAndroid,n=e.onIos,o=e.onWeb;return"undefined"==typeof window?Promise.resolve():window.AnalyticsWebInterface?t(window.AnalyticsWebInterface):window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.firebase?n(window.webkit.messageHandlers.firebase):window.gtag&&S<3?o(window.gtag):Promise.resolve()},_=function(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")},N=function(e){return _(e).toLocaleLowerCase().replace(/[^a-z0-9\s\-\_\/\|\:]/g,"").replace(/\s+/g," ").trim().replace(/\s/g,"_").slice(0,100)},I=function(e){var t={};return Object.entries(e).forEach(function(e){var n=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}(e,2),o=n[0],r=n[1],i=r,a=o.slice(0,40);"string"==typeof r&&(i=N(r)),t[a]=i}),t},O={sanitize:!0},C="",M=!1,R=function(e){return T(void 0,void 0,void 0,function(){var t,n,o;return E(this,function(r){switch(r.label){case 0:if(M)throw{code:423,reason:"BottomSheet is locked. You can only have one bottom sheet in the screen"};M=!0,t=setTimeout(function(){M=!1},1e3),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,p({type:"SHEET",payload:e})];case 2:return n=r.sent(),M=!1,clearTimeout(t),[2,n];case 3:throw o=r.sent(),M=!1,clearTimeout(t),o;case 4:return[2]}})})};return e.CD_EVENT_VALUE=8,e.CD_NOVUM_UID=7,e.CD_WEBAPP_INSTALLED=4,e.attachToEmail=function(e){var t=e.url,n=e.subject,o=e.fileName,r=e.recipient,i=e.body;return p({type:"ATTACH_TO_EMAIL",payload:{url:t,subject:n,fileName:o,recipient:r,body:i}})},e.bottomSheet=R,e.bottomSheetSingleSelector=function(e){var t=e.title,n=e.subtitle,o=e.description,r=e.selectedId,i=e.items;return R({title:t,subtitle:n,description:o,content:[{type:"LIST",id:"list-0",listType:"SINGLE_SELECTION",autoSubmit:!0,selectedIds:"string"==typeof r?[r]:[],items:i}]}).then(function(e){var t=e.action,n=e.result;return"SUBMIT"===t?{action:t,selectedId:n[0].selectedIds[0]}:{action:t,selectedId:null}})},e.checkPermissionStatus=function(e,t){return p({type:"OS_PERMISSION_STATUS",payload:{feature:e,params:t}}).then(function(e){return e.granted})},e.createCalendarEvent=function(e){var t=e.beginTime,n=e.endTime,o=e.title;return p({type:"CREATE_CALENDAR_EVENT",payload:{beginTime:g(t),endTime:g(n),title:o}})},e.dismiss=function(e){return p({type:"DISMISS",payload:{onCompletionUrl:e}})},e.fetch=function(e){var t=e.url,n=e.method,o=e.headers,r=e.body;return d()?p({type:"FETCH",payload:{url:t,method:n,headers:o,body:r}}).catch(function(){return{status:500,headers:{},body:"Bridge call failed"}}):Promise.resolve({status:500,headers:{},body:"Bridge not available"})},e.fetchContactsByPhone=function(e){return p({type:"FETCH_CONTACTS_DATA",payload:{phoneNumbers:e}})},e.getAppMetadata=function(e){return p({type:"GET_APP_METADATA",payload:{appToken:e}})},e.getCustomerHash=function(){return p({type:"GET_CUSTOMER_HASH"})},e.getDiskSpaceInfo=function(){return p({type:"GET_DISK_SPACE_INFO"})},e.getEsimInfo=function(){return p({type:"GET_ESIM_INFO"}).catch(function(){return{supportsEsim:!1}})},e.getTopazToken=function(e){return void 0===e&&(e={}),p({type:"GET_TOPAZ_TOKEN",payload:{}},e.timeout)},e.highlightNavigationTab=function(e){var t=e.tab,n=e.highlight,o=e.count;return p({type:"HIGHLIGHT_TAB",payload:{tab:t,highlight:n,count:o}})},e.internalNavigation=function(e){return p({type:"INTERNAL_NAVIGATION",payload:{feature:e}})},e.isABTestingAvailable=function(e){if(v)return Promise.resolve(w(e));var t=new Promise(function(e){setTimeout(function(){e(!1)},500)}),n=p({type:"GET_REMOTE_CONFIG"}).then(function(t){return v=t,w(e)});return Promise.race([t,n])},e.isWebViewBridgeAvailable=d,e.logEcommerceEvent=function(e,t){return t=b(b({},t),{screenName:t.screenName||C}),A({onAndroid:function(n){return n.logEvent&&n.logEvent(e,JSON.stringify(t)),Promise.resolve()},onIos:function(n){return n.postMessage({command:"logEvent",name:e,parameters:t}),Promise.resolve()},onWeb:function(){return Promise.resolve()}})},e.logEvent=function(e,t){var n,o,r,i,a,u,s=b(b({},O),t).sanitize,c=e.name,l=h(e,["name"]);if(c)Object.keys(l).length>25&&console.warn("Trying to log FirebaseEvent with name ".concat(c," exceeding the limit of ").concat(25," params")),s&&(l=I(l),c=N(c));else{if(!e.category||!e.action)return console.warn('LegacyAnalyticsEvent should have "category" and "action"',{category:e.category,action:e.action}),Promise.resolve();o=(n=e).category,r=n.action,i=n.label,a=n.value,u=h(n,["category","action","label","value"]),i||(i="null_label"),a||(a=0),l=b({eventCategory:o,eventAction:r,eventLabel:_(i),eventValue:a},u),c=e.category}return l=b(b({},l),{screenName:l.screenName||C}),A({onAndroid:function(e){return e.logEvent&&e.logEvent(c,JSON.stringify(l)),Promise.resolve()},onIos:function(e){return e.postMessage({command:"logEvent",name:c,parameters:l}),Promise.resolve()},onWeb:function(e){return new Promise(function(t){e("event",c,b(b({},l),{event_callback:P(t)}))})}})},e.logTiming=function(e){var t=e.category,n=void 0===t?"performance_timer":t,o=e.variable,r=e.value,i=e.label;if(!n||!o||!r)return console.warn('Analytics timing should have "category", "variable" and "value"',{category:n,variable:o,value:r}),Promise.resolve();var a={timingCategory:n,timingVar:o,timingValue:r=Math.round(r),timingLabel:i},u=n;return A({onAndroid:function(e){return e.logEvent&&e.logEvent(u,JSON.stringify(a)),Promise.resolve()},onIos:function(e){return e.postMessage({command:"logEvent",name:u,parameters:a}),Promise.resolve()},onWeb:function(){return new Promise(function(e){gtag("event",u,b(b({},a),{event_callback:P(e)}))})}})},e.logout=function(){return p({type:"LOG_OUT"})},e.nativeAlert=function(e){var t=e.message,n=e.title,o=e.buttonText;return d()?p({type:"ALERT",payload:{title:n,message:t,buttonText:o}}):("undefined"!=typeof window&&window.alert(t),Promise.resolve())},e.nativeConfirm=function(e){var t=e.message,n=e.title,o=e.acceptText,r=e.cancelText;return d()?p({type:"CONFIRM",payload:{message:t,title:n,acceptText:o,cancelText:r}}).then(function(e){return e.result}):Promise.resolve("undefined"!=typeof window&&window.confirm(t))},e.nativeMessage=function(e){var t=e.message,n=e.duration,o=e.buttonText,r=e.type;return d()?p({type:"MESSAGE",payload:{message:t,duration:n,buttonText:o,type:r}}):("undefined"!=typeof window&&window.alert(t),Promise.resolve())},e.notifyBridgeReady=function(){return p({type:"BRIDGE_READY"})},e.notifyPageLoaded=function(){return p({type:"PAGE_LOADED"})},e.onNativeEvent=function(e){return y("NATIVE_EVENT",function(t){return{action:e({event:t.event}).action||"default"}})},e.onSessionRenewed=function(e){return y("SESSION_RENEWED",function(t){var n=t.accessToken;return e(n)})},e.renewSession=function(e,t){return void 0===t&&(t={}),p({type:"RENEW_SESSION",payload:{accessToken:e||null}},t.timeout).then(function(e){return e.accessToken})},e.reportStatus=function(e){var t=e.feature,n=e.status,o=e.reason;return p({type:"STATUS_REPORT",payload:{feature:t,status:n,reason:o}})},e.requestContact=function(e){var t=(void 0===e?{}:e).filter;return p({type:"GET_CONTACT_DATA",payload:{filter:void 0===t?"phone":t}})},e.requestDeviceImei=function(){return p({type:"IMEI"},200).then(function(e){return e.imei}).catch(function(){return null})},e.requestSimIcc=function(){return p({type:"SIM_ICC"},200).then(function(e){return e.icc}).catch(function(){return null})},e.requestSimImsi=function(){return p({type:"IMSI"},200).then(function(e){return e.imsi}).catch(function(){return null})},e.requestVibration=function(e){return p({type:"VIBRATION",payload:{type:e}})},e.sanitizeAnalyticsParam=N,e.sanitizeAnalyticsParams=I,e.setActionBehavior=function(e){return p({type:"SET_ACTION_BEHAVIOR",payload:{actions:e}}).catch(function(){})},e.setCustomerHash=function(e){return p({type:"SET_CUSTOMER_HASH",payload:{hash:e}})},e.setLogger=function(e){f=e},e.setScreenName=function(e,t){if(!e)return console.warn("Missing analytics screenName"),Promise.resolve();var n=C;return C=e,A({onAndroid:function(n){return n.setScreenNameWithParams?n.setScreenNameWithParams(e,JSON.stringify(t)):n.setScreenName&&n.setScreenName(e),Promise.resolve()},onIos:function(n){return n.postMessage({command:"setScreenName",name:e,parameters:t}),Promise.resolve()},onWeb:function(o){return new Promise(function(r){o("event","page_view",b(b({screenName:e,page_title:e,previousScreenName:n},I(null!==t&&void 0!==t?t:{})),{event_callback:P(r)}))})}})},e.setTrackingProperty=function(e,t,n){return p({type:"SET_TRACKING_PROPERTY",payload:{system:e,name:t,value:n}}).catch(function(){})},e.setUserProperty=function(e,t){return e&&t?(t=String(t),A({onAndroid:function(n){return n.setUserProperty&&n.setUserProperty(e,t),Promise.resolve()},onIos:function(n){return n.postMessage({command:"setUserProperty",name:e,value:t}),Promise.resolve()},onWeb:function(n){var o;return n("set","user_properties",((o={})[e]=N(t),o)),Promise.resolve()}})):(console.warn("Trying to set analytics user property without name or value",e,t),Promise.resolve())},e.setWebViewTitle=function(e){return d()?m({title:e}):("undefined"!=typeof document&&(document.title=e),Promise.resolve())},e.share=function(e){return p({type:"SHARE",payload:e})},e.showAppRating=function(){return p({type:"SHOW_APP_RATING"})},e.updateNavigationBar=m,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
var webviewBridge=function(e){"use strict";var t=1,n="".concat(Date.now(),"-").concat(String(Math.random()).slice(-8)),o="__tuenti_webview_bridge",r=function(){return!("undefined"==typeof window||!window.tuentiWebView||!window.tuentiWebView.postMessage)},i=function(){return!!("undefined"!=typeof window&&window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.tuentiWebView&&window.webkit.messageHandlers.tuentiWebView.postMessage)},a=function(){return"undefined"==typeof window?null:r()?function(e){window.tuentiWebView.postMessage(e)}:i()?function(e){window.webkit.messageHandlers.tuentiWebView.postMessage(e)}:null},u=[],s=function(e){u.push(e)},c=function(e){u=u.filter(function(t){return t!==e})},l=function(){var e;return"undefined"!=typeof window&&(!!function(){try{return window.self!==window.top}catch(e){return!0}}()&&!(null===(e=null===window||void 0===window?void 0:window.frameElement)||void 0===e?void 0:e.hasAttribute("data-enable-webview-bridge")))},d=void 0,f=function(){return!l()&&(r()||i())},p=function(e,o){var r=e.type,i=e.id,u=void 0===i?"web-".concat(t++,"-").concat(n):i,l=e.payload,f=a(),p=JSON.stringify({type:r,id:u,payload:l});return null===d||void 0===d||d("[WebView Bridge] SEND:",p),f?(setTimeout(function(){f(p)}),new Promise(function(e,t){var n=!1,i=function(o){o.id!==u||n||(o.type===r?e(o.payload):"ERROR"===o.type?t(o.payload):t({code:500,reason:"bad type: ".concat(o.type,". Expecting ").concat(r)}),c(i))};s(i),o&&setTimeout(function(){n=!0,c(i),t({code:408,reason:"request timeout"})},o)})):Promise.reject({code:500,reason:"WebView postMessage not available"})};"undefined"!=typeof window&&(window[o]=window[o]||{postMessage:function(e){var t;null===d||void 0===d||d("[WebView Bridge] RCVD:",e);try{t=JSON.parse(e)}catch(t){throw Error("Problem parsing webview message: ".concat(e))}u.forEach(function(e){return e(t)})}});var y=function(e,t){var n=function(n){n.type===e&&Promise.resolve(t(n.payload)).then(function(e){var t=a();t&&t(JSON.stringify({type:n.type,id:n.id,payload:e}))})};return s(n),function(){c(n)}},m=function(e){var t=e.title,n=e.expandedTitle,o=e.showBackButton,r=e.showReloadButton,i=e.showProfileButton,a=e.backgroundColor;return f()?p({type:"NAVIGATION_BAR",payload:{title:t,expandedTitle:n,showBackButton:o,showReloadButton:r,showProfileButton:i,backgroundColor:a}}):(void 0!==t&&"undefined"!=typeof document&&(document.title=t),Promise.resolve())},v=null,w=function(e){return"true"===v.result[e]},g=function(e){return Math.floor(e/1e3)},b=function(){return(b=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function h(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function T(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{s(o.next(e))}catch(e){i(e)}}function u(e){try{s(o.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,u)}s((o=o.apply(e,t||[])).next())})}function E(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var S=0,I=function(e){var t=setTimeout(function(){e(),S++},500);return function(){clearTimeout(t),S=0,e()}},A=function(e){var t=e.onAndroid,n=e.onIos,o=e.onWeb;return"undefined"==typeof window?Promise.resolve():window.AnalyticsWebInterface?t(window.AnalyticsWebInterface):window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.firebase?n(window.webkit.messageHandlers.firebase):window.gtag&&S<3?o(window.gtag):Promise.resolve()},P=function(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")},_=function(e){return P(e).toLocaleLowerCase().replace(/[^a-z0-9\s\-\_\/\|\:]/g,"").replace(/\s+/g," ").trim().replace(/\s/g,"_").slice(0,100)},N=function(e){var t={};return Object.entries(e).forEach(function(e){var n=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}(e,2),o=n[0],r=n[1],i=r,a=o.slice(0,40);"string"==typeof r&&(i=_(r)),t[a]=i}),t},O={sanitize:!0},C="",M=!1,R=function(e){return T(void 0,void 0,void 0,function(){var t,n,o;return E(this,function(r){switch(r.label){case 0:if(M)throw{code:423,reason:"BottomSheet is locked. You can only have one bottom sheet in the screen"};M=!0,t=setTimeout(function(){M=!1},1e3),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,p({type:"SHEET",payload:e})];case 2:return n=r.sent(),M=!1,clearTimeout(t),[2,n];case 3:throw o=r.sent(),M=!1,clearTimeout(t),o;case 4:return[2]}})})};return e.CD_EVENT_VALUE=8,e.CD_NOVUM_UID=7,e.CD_WEBAPP_INSTALLED=4,e.attachToEmail=function(e){var t=e.url,n=e.subject,o=e.fileName,r=e.recipient,i=e.body;return p({type:"ATTACH_TO_EMAIL",payload:{url:t,subject:n,fileName:o,recipient:r,body:i}})},e.bottomSheet=R,e.bottomSheetActionSelector=function(e){var t=e.title,n=e.subtitle,o=e.description,r=e.items;return R({title:t,subtitle:n,description:o,content:[{type:"LIST",id:"list-0",listType:"ACTIONS",autoSubmit:!0,selectedIds:[],items:r}]}).then(function(e){var t=e.action,n=e.result;return"SUBMIT"===t?{action:t,selectedId:n[0].selectedIds[0]}:{action:t,selectedId:null}})},e.bottomSheetInfo=function(e){var t=e.title,n=e.subtitle,o=e.description,r=e.items;return T(void 0,void 0,void 0,function(){return E(this,function(e){switch(e.label){case 0:return[4,R({title:t,subtitle:n,description:o,content:[{type:"LIST",id:"list-0",listType:"INFORMATIVE",autoSubmit:!1,selectedIds:[],items:r}]})];case 1:return e.sent(),[2]}})})},e.bottomSheetSingleSelector=function(e){var t=e.title,n=e.subtitle,o=e.description,r=e.selectedId,i=e.items;return R({title:t,subtitle:n,description:o,content:[{type:"LIST",id:"list-0",listType:"SINGLE_SELECTION",autoSubmit:!0,selectedIds:"string"==typeof r?[r]:[],items:i}]}).then(function(e){var t=e.action,n=e.result;return"SUBMIT"===t?{action:t,selectedId:n[0].selectedIds[0]}:{action:t,selectedId:null}})},e.checkPermissionStatus=function(e,t){return p({type:"OS_PERMISSION_STATUS",payload:{feature:e,params:t}}).then(function(e){return e.granted})},e.createCalendarEvent=function(e){var t=e.beginTime,n=e.endTime,o=e.title;return p({type:"CREATE_CALENDAR_EVENT",payload:{beginTime:g(t),endTime:g(n),title:o}})},e.dismiss=function(e){return p({type:"DISMISS",payload:{onCompletionUrl:e}})},e.fetch=function(e){var t=e.url,n=e.method,o=e.headers,r=e.body;return f()?p({type:"FETCH",payload:{url:t,method:n,headers:o,body:r}}).catch(function(){return{status:500,headers:{},body:"Bridge call failed"}}):Promise.resolve({status:500,headers:{},body:"Bridge not available"})},e.fetchContactsByPhone=function(e){return p({type:"FETCH_CONTACTS_DATA",payload:{phoneNumbers:e}})},e.getAppMetadata=function(e){return p({type:"GET_APP_METADATA",payload:{appToken:e}})},e.getCustomerHash=function(){return p({type:"GET_CUSTOMER_HASH"})},e.getDiskSpaceInfo=function(){return p({type:"GET_DISK_SPACE_INFO"})},e.getEsimInfo=function(){return p({type:"GET_ESIM_INFO"}).catch(function(){return{supportsEsim:!1}})},e.getTopazToken=function(e){return void 0===e&&(e={}),p({type:"GET_TOPAZ_TOKEN",payload:{}},e.timeout)},e.highlightNavigationTab=function(e){var t=e.tab,n=e.highlight,o=e.count;return p({type:"HIGHLIGHT_TAB",payload:{tab:t,highlight:n,count:o}})},e.internalNavigation=function(e){return p({type:"INTERNAL_NAVIGATION",payload:{feature:e}})},e.isABTestingAvailable=function(e){if(v)return Promise.resolve(w(e));var t=new Promise(function(e){setTimeout(function(){e(!1)},500)}),n=p({type:"GET_REMOTE_CONFIG"}).then(function(t){return v=t,w(e)});return Promise.race([t,n])},e.isWebViewBridgeAvailable=f,e.logEcommerceEvent=function(e,t){return t=b(b({},t),{screenName:t.screenName||C}),A({onAndroid:function(n){return n.logEvent&&n.logEvent(e,JSON.stringify(t)),Promise.resolve()},onIos:function(n){return n.postMessage({command:"logEvent",name:e,parameters:t}),Promise.resolve()},onWeb:function(){return Promise.resolve()}})},e.logEvent=function(e,t){var n,o,r,i,a,u,s=b(b({},O),t).sanitize,c=e.name,l=h(e,["name"]);if(c)Object.keys(l).length>25&&console.warn("Trying to log FirebaseEvent with name ".concat(c," exceeding the limit of ").concat(25," params")),s&&(l=N(l),c=_(c));else{if(!e.category||!e.action)return console.warn('LegacyAnalyticsEvent should have "category" and "action"',{category:e.category,action:e.action}),Promise.resolve();o=(n=e).category,r=n.action,i=n.label,a=n.value,u=h(n,["category","action","label","value"]),i||(i="null_label"),a||(a=0),l=b({eventCategory:o,eventAction:r,eventLabel:P(i),eventValue:a},u),c=e.category}return l=b(b({},l),{screenName:l.screenName||C}),A({onAndroid:function(e){return e.logEvent&&e.logEvent(c,JSON.stringify(l)),Promise.resolve()},onIos:function(e){return e.postMessage({command:"logEvent",name:c,parameters:l}),Promise.resolve()},onWeb:function(e){return new Promise(function(t){e("event",c,b(b({},l),{event_callback:I(t)}))})}})},e.logTiming=function(e){var t=e.category,n=void 0===t?"performance_timer":t,o=e.variable,r=e.value,i=e.label;if(!n||!o||!r)return console.warn('Analytics timing should have "category", "variable" and "value"',{category:n,variable:o,value:r}),Promise.resolve();var a={timingCategory:n,timingVar:o,timingValue:r=Math.round(r),timingLabel:i},u=n;return A({onAndroid:function(e){return e.logEvent&&e.logEvent(u,JSON.stringify(a)),Promise.resolve()},onIos:function(e){return e.postMessage({command:"logEvent",name:u,parameters:a}),Promise.resolve()},onWeb:function(){return new Promise(function(e){gtag("event",u,b(b({},a),{event_callback:I(e)}))})}})},e.logout=function(){return p({type:"LOG_OUT"})},e.nativeAlert=function(e){var t=e.message,n=e.title,o=e.buttonText;return f()?p({type:"ALERT",payload:{title:n,message:t,buttonText:o}}):("undefined"!=typeof window&&window.alert(t),Promise.resolve())},e.nativeConfirm=function(e){var t=e.message,n=e.title,o=e.acceptText,r=e.cancelText;return f()?p({type:"CONFIRM",payload:{message:t,title:n,acceptText:o,cancelText:r}}).then(function(e){return e.result}):Promise.resolve("undefined"!=typeof window&&window.confirm(t))},e.nativeMessage=function(e){var t=e.message,n=e.duration,o=e.buttonText,r=e.type;return f()?p({type:"MESSAGE",payload:{message:t,duration:n,buttonText:o,type:r}}):("undefined"!=typeof window&&window.alert(t),Promise.resolve())},e.notifyBridgeReady=function(){return p({type:"BRIDGE_READY"})},e.notifyPageLoaded=function(){return p({type:"PAGE_LOADED"})},e.onNativeEvent=function(e){return y("NATIVE_EVENT",function(t){return{action:e({event:t.event}).action||"default"}})},e.onSessionRenewed=function(e){return y("SESSION_RENEWED",function(t){var n=t.accessToken;return e(n)})},e.renewSession=function(e,t){return void 0===t&&(t={}),p({type:"RENEW_SESSION",payload:{accessToken:e||null}},t.timeout).then(function(e){return e.accessToken})},e.reportStatus=function(e){var t=e.feature,n=e.status,o=e.reason;return p({type:"STATUS_REPORT",payload:{feature:t,status:n,reason:o}})},e.requestContact=function(e){var t=(void 0===e?{}:e).filter;return p({type:"GET_CONTACT_DATA",payload:{filter:void 0===t?"phone":t}})},e.requestDeviceImei=function(){return p({type:"IMEI"},200).then(function(e){return e.imei}).catch(function(){return null})},e.requestSimIcc=function(){return p({type:"SIM_ICC"},200).then(function(e){return e.icc}).catch(function(){return null})},e.requestSimImsi=function(){return p({type:"IMSI"},200).then(function(e){return e.imsi}).catch(function(){return null})},e.requestVibration=function(e){return p({type:"VIBRATION",payload:{type:e}})},e.sanitizeAnalyticsParam=_,e.sanitizeAnalyticsParams=N,e.setActionBehavior=function(e){return p({type:"SET_ACTION_BEHAVIOR",payload:{actions:e}}).catch(function(){})},e.setCustomerHash=function(e){return p({type:"SET_CUSTOMER_HASH",payload:{hash:e}})},e.setLogger=function(e){d=e},e.setScreenName=function(e,t){if(!e)return console.warn("Missing analytics screenName"),Promise.resolve();var n=C;return C=e,A({onAndroid:function(n){return n.setScreenNameWithParams?n.setScreenNameWithParams(e,JSON.stringify(t)):n.setScreenName&&n.setScreenName(e),Promise.resolve()},onIos:function(n){return n.postMessage({command:"setScreenName",name:e,parameters:t}),Promise.resolve()},onWeb:function(o){return new Promise(function(r){o("event","page_view",b(b({screenName:e,page_title:e,previousScreenName:n},N(null!==t&&void 0!==t?t:{})),{event_callback:I(r)}))})}})},e.setTrackingProperty=function(e,t,n){return p({type:"SET_TRACKING_PROPERTY",payload:{system:e,name:t,value:n}}).catch(function(){})},e.setUserProperty=function(e,t){return e&&t?(t=String(t),A({onAndroid:function(n){return n.setUserProperty&&n.setUserProperty(e,t),Promise.resolve()},onIos:function(n){return n.postMessage({command:"setUserProperty",name:e,value:t}),Promise.resolve()},onWeb:function(n){var o;return n("set","user_properties",((o={})[e]=_(t),o)),Promise.resolve()}})):(console.warn("Trying to set analytics user property without name or value",e,t),Promise.resolve())},e.setWebViewTitle=function(e){return f()?m({title:e}):("undefined"!=typeof document&&(document.title=e),Promise.resolve())},e.share=function(e){return p({type:"SHARE",payload:e})},e.showAppRating=function(){return p({type:"SHOW_APP_RATING"})},e.updateNavigationBar=m,Object.defineProperty(e,"__esModule",{value:!0}),e}({});

@@ -967,2 +967,61 @@ (function (global, factory) {

};
var bottomSheetActionSelector = function (_a) {
var title = _a.title, subtitle = _a.subtitle, description = _a.description, items = _a.items;
return bottomSheet({
title: title,
subtitle: subtitle,
description: description,
content: [
{
type: 'LIST',
id: 'list-0',
listType: 'ACTIONS',
autoSubmit: true,
selectedIds: [],
items: items,
},
],
}).then(function (_a) {
var action = _a.action, result = _a.result;
if (action === 'SUBMIT') {
return {
action: action,
selectedId: result[0].selectedIds[0],
};
}
else {
return {
action: action,
selectedId: null,
};
}
});
};
var bottomSheetInfo = function (_a) {
var title = _a.title, subtitle = _a.subtitle, description = _a.description, items = _a.items;
return __awaiter(void 0, void 0, void 0, function () {
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, bottomSheet({
title: title,
subtitle: subtitle,
description: description,
content: [
{
type: 'LIST',
id: 'list-0',
listType: 'INFORMATIVE',
autoSubmit: false,
selectedIds: [],
items: items,
},
],
})];
case 1:
_b.sent();
return [2 /*return*/];
}
});
});
};

@@ -974,2 +1033,4 @@ exports.CD_EVENT_VALUE = CD_EVENT_VALUE;

exports.bottomSheet = bottomSheet;
exports.bottomSheetActionSelector = bottomSheetActionSelector;
exports.bottomSheetInfo = bottomSheetInfo;
exports.bottomSheetSingleSelector = bottomSheetSingleSelector;

@@ -976,0 +1037,0 @@ exports.checkPermissionStatus = checkPermissionStatus;

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).webviewBridge={})}(this,function(e){"use strict";var t=1,n="".concat(Date.now(),"-").concat(String(Math.random()).slice(-8)),o="__tuenti_webview_bridge",r=function(){return!("undefined"==typeof window||!window.tuentiWebView||!window.tuentiWebView.postMessage)},i=function(){return!!("undefined"!=typeof window&&window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.tuentiWebView&&window.webkit.messageHandlers.tuentiWebView.postMessage)},a=function(){return"undefined"==typeof window?null:r()?function(e){window.tuentiWebView.postMessage(e)}:i()?function(e){window.webkit.messageHandlers.tuentiWebView.postMessage(e)}:null},u=[],s=function(e){u.push(e)},c=function(e){u=u.filter(function(t){return t!==e})},l=function(){var e;return"undefined"!=typeof window&&(!!function(){try{return window.self!==window.top}catch(e){return!0}}()&&!(null===(e=null===window||void 0===window?void 0:window.frameElement)||void 0===e?void 0:e.hasAttribute("data-enable-webview-bridge")))},f=void 0,d=function(){return!l()&&(r()||i())},p=function(e,o){var r=e.type,i=e.id,u=void 0===i?"web-".concat(t++,"-").concat(n):i,l=e.payload,d=a(),p=JSON.stringify({type:r,id:u,payload:l});return null===f||void 0===f||f("[WebView Bridge] SEND:",p),d?(setTimeout(function(){d(p)}),new Promise(function(e,t){var n=!1,i=function(o){o.id!==u||n||(o.type===r?e(o.payload):"ERROR"===o.type?t(o.payload):t({code:500,reason:"bad type: ".concat(o.type,". Expecting ").concat(r)}),c(i))};s(i),o&&setTimeout(function(){n=!0,c(i),t({code:408,reason:"request timeout"})},o)})):Promise.reject({code:500,reason:"WebView postMessage not available"})};"undefined"!=typeof window&&(window[o]=window[o]||{postMessage:function(e){var t;null===f||void 0===f||f("[WebView Bridge] RCVD:",e);try{t=JSON.parse(e)}catch(t){throw Error("Problem parsing webview message: ".concat(e))}u.forEach(function(e){return e(t)})}});var y=function(e,t){var n=function(n){n.type===e&&Promise.resolve(t(n.payload)).then(function(e){var t=a();t&&t(JSON.stringify({type:n.type,id:n.id,payload:e}))})};return s(n),function(){c(n)}},m=function(e){var t=e.title,n=e.expandedTitle,o=e.showBackButton,r=e.showReloadButton,i=e.showProfileButton,a=e.backgroundColor;return d()?p({type:"NAVIGATION_BAR",payload:{title:t,expandedTitle:n,showBackButton:o,showReloadButton:r,showProfileButton:i,backgroundColor:a}}):(void 0!==t&&"undefined"!=typeof document&&(document.title=t),Promise.resolve())},v=null,w=function(e){return"true"===v.result[e]},g=function(e){return Math.floor(e/1e3)},b=function(){return(b=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function h(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function T(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{s(o.next(e))}catch(e){i(e)}}function u(e){try{s(o.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,u)}s((o=o.apply(e,t||[])).next())})}function E(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var S=0,P=function(e){var t=setTimeout(function(){e(),S++},500);return function(){clearTimeout(t),S=0,e()}},A=function(e){var t=e.onAndroid,n=e.onIos,o=e.onWeb;return"undefined"==typeof window?Promise.resolve():window.AnalyticsWebInterface?t(window.AnalyticsWebInterface):window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.firebase?n(window.webkit.messageHandlers.firebase):window.gtag&&S<3?o(window.gtag):Promise.resolve()},_=function(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")},N=function(e){return _(e).toLocaleLowerCase().replace(/[^a-z0-9\s\-\_\/\|\:]/g,"").replace(/\s+/g," ").trim().replace(/\s/g,"_").slice(0,100)},I=function(e){var t={};return Object.entries(e).forEach(function(e){var n=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}(e,2),o=n[0],r=n[1],i=r,a=o.slice(0,40);"string"==typeof r&&(i=N(r)),t[a]=i}),t},O={sanitize:!0},C="",M=!1,R=function(e){return T(void 0,void 0,void 0,function(){var t,n,o;return E(this,function(r){switch(r.label){case 0:if(M)throw{code:423,reason:"BottomSheet is locked. You can only have one bottom sheet in the screen"};M=!0,t=setTimeout(function(){M=!1},1e3),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,p({type:"SHEET",payload:e})];case 2:return n=r.sent(),M=!1,clearTimeout(t),[2,n];case 3:throw o=r.sent(),M=!1,clearTimeout(t),o;case 4:return[2]}})})};e.CD_EVENT_VALUE=8,e.CD_NOVUM_UID=7,e.CD_WEBAPP_INSTALLED=4,e.attachToEmail=function(e){var t=e.url,n=e.subject,o=e.fileName,r=e.recipient,i=e.body;return p({type:"ATTACH_TO_EMAIL",payload:{url:t,subject:n,fileName:o,recipient:r,body:i}})},e.bottomSheet=R,e.bottomSheetSingleSelector=function(e){var t=e.title,n=e.subtitle,o=e.description,r=e.selectedId,i=e.items;return R({title:t,subtitle:n,description:o,content:[{type:"LIST",id:"list-0",listType:"SINGLE_SELECTION",autoSubmit:!0,selectedIds:"string"==typeof r?[r]:[],items:i}]}).then(function(e){var t=e.action,n=e.result;return"SUBMIT"===t?{action:t,selectedId:n[0].selectedIds[0]}:{action:t,selectedId:null}})},e.checkPermissionStatus=function(e,t){return p({type:"OS_PERMISSION_STATUS",payload:{feature:e,params:t}}).then(function(e){return e.granted})},e.createCalendarEvent=function(e){var t=e.beginTime,n=e.endTime,o=e.title;return p({type:"CREATE_CALENDAR_EVENT",payload:{beginTime:g(t),endTime:g(n),title:o}})},e.dismiss=function(e){return p({type:"DISMISS",payload:{onCompletionUrl:e}})},e.fetch=function(e){var t=e.url,n=e.method,o=e.headers,r=e.body;return d()?p({type:"FETCH",payload:{url:t,method:n,headers:o,body:r}}).catch(function(){return{status:500,headers:{},body:"Bridge call failed"}}):Promise.resolve({status:500,headers:{},body:"Bridge not available"})},e.fetchContactsByPhone=function(e){return p({type:"FETCH_CONTACTS_DATA",payload:{phoneNumbers:e}})},e.getAppMetadata=function(e){return p({type:"GET_APP_METADATA",payload:{appToken:e}})},e.getCustomerHash=function(){return p({type:"GET_CUSTOMER_HASH"})},e.getDiskSpaceInfo=function(){return p({type:"GET_DISK_SPACE_INFO"})},e.getEsimInfo=function(){return p({type:"GET_ESIM_INFO"}).catch(function(){return{supportsEsim:!1}})},e.getTopazToken=function(e){return void 0===e&&(e={}),p({type:"GET_TOPAZ_TOKEN",payload:{}},e.timeout)},e.highlightNavigationTab=function(e){var t=e.tab,n=e.highlight,o=e.count;return p({type:"HIGHLIGHT_TAB",payload:{tab:t,highlight:n,count:o}})},e.internalNavigation=function(e){return p({type:"INTERNAL_NAVIGATION",payload:{feature:e}})},e.isABTestingAvailable=function(e){if(v)return Promise.resolve(w(e));var t=new Promise(function(e){setTimeout(function(){e(!1)},500)}),n=p({type:"GET_REMOTE_CONFIG"}).then(function(t){return v=t,w(e)});return Promise.race([t,n])},e.isWebViewBridgeAvailable=d,e.logEcommerceEvent=function(e,t){return t=b(b({},t),{screenName:t.screenName||C}),A({onAndroid:function(n){return n.logEvent&&n.logEvent(e,JSON.stringify(t)),Promise.resolve()},onIos:function(n){return n.postMessage({command:"logEvent",name:e,parameters:t}),Promise.resolve()},onWeb:function(){return Promise.resolve()}})},e.logEvent=function(e,t){var n,o,r,i,a,u,s=b(b({},O),t).sanitize,c=e.name,l=h(e,["name"]);if(c)Object.keys(l).length>25&&console.warn("Trying to log FirebaseEvent with name ".concat(c," exceeding the limit of ").concat(25," params")),s&&(l=I(l),c=N(c));else{if(!e.category||!e.action)return console.warn('LegacyAnalyticsEvent should have "category" and "action"',{category:e.category,action:e.action}),Promise.resolve();o=(n=e).category,r=n.action,i=n.label,a=n.value,u=h(n,["category","action","label","value"]),i||(i="null_label"),a||(a=0),l=b({eventCategory:o,eventAction:r,eventLabel:_(i),eventValue:a},u),c=e.category}return l=b(b({},l),{screenName:l.screenName||C}),A({onAndroid:function(e){return e.logEvent&&e.logEvent(c,JSON.stringify(l)),Promise.resolve()},onIos:function(e){return e.postMessage({command:"logEvent",name:c,parameters:l}),Promise.resolve()},onWeb:function(e){return new Promise(function(t){e("event",c,b(b({},l),{event_callback:P(t)}))})}})},e.logTiming=function(e){var t=e.category,n=void 0===t?"performance_timer":t,o=e.variable,r=e.value,i=e.label;if(!n||!o||!r)return console.warn('Analytics timing should have "category", "variable" and "value"',{category:n,variable:o,value:r}),Promise.resolve();var a={timingCategory:n,timingVar:o,timingValue:r=Math.round(r),timingLabel:i},u=n;return A({onAndroid:function(e){return e.logEvent&&e.logEvent(u,JSON.stringify(a)),Promise.resolve()},onIos:function(e){return e.postMessage({command:"logEvent",name:u,parameters:a}),Promise.resolve()},onWeb:function(){return new Promise(function(e){gtag("event",u,b(b({},a),{event_callback:P(e)}))})}})},e.logout=function(){return p({type:"LOG_OUT"})},e.nativeAlert=function(e){var t=e.message,n=e.title,o=e.buttonText;return d()?p({type:"ALERT",payload:{title:n,message:t,buttonText:o}}):("undefined"!=typeof window&&window.alert(t),Promise.resolve())},e.nativeConfirm=function(e){var t=e.message,n=e.title,o=e.acceptText,r=e.cancelText;return d()?p({type:"CONFIRM",payload:{message:t,title:n,acceptText:o,cancelText:r}}).then(function(e){return e.result}):Promise.resolve("undefined"!=typeof window&&window.confirm(t))},e.nativeMessage=function(e){var t=e.message,n=e.duration,o=e.buttonText,r=e.type;return d()?p({type:"MESSAGE",payload:{message:t,duration:n,buttonText:o,type:r}}):("undefined"!=typeof window&&window.alert(t),Promise.resolve())},e.notifyBridgeReady=function(){return p({type:"BRIDGE_READY"})},e.notifyPageLoaded=function(){return p({type:"PAGE_LOADED"})},e.onNativeEvent=function(e){return y("NATIVE_EVENT",function(t){return{action:e({event:t.event}).action||"default"}})},e.onSessionRenewed=function(e){return y("SESSION_RENEWED",function(t){var n=t.accessToken;return e(n)})},e.renewSession=function(e,t){return void 0===t&&(t={}),p({type:"RENEW_SESSION",payload:{accessToken:e||null}},t.timeout).then(function(e){return e.accessToken})},e.reportStatus=function(e){var t=e.feature,n=e.status,o=e.reason;return p({type:"STATUS_REPORT",payload:{feature:t,status:n,reason:o}})},e.requestContact=function(e){var t=(void 0===e?{}:e).filter;return p({type:"GET_CONTACT_DATA",payload:{filter:void 0===t?"phone":t}})},e.requestDeviceImei=function(){return p({type:"IMEI"},200).then(function(e){return e.imei}).catch(function(){return null})},e.requestSimIcc=function(){return p({type:"SIM_ICC"},200).then(function(e){return e.icc}).catch(function(){return null})},e.requestSimImsi=function(){return p({type:"IMSI"},200).then(function(e){return e.imsi}).catch(function(){return null})},e.requestVibration=function(e){return p({type:"VIBRATION",payload:{type:e}})},e.sanitizeAnalyticsParam=N,e.sanitizeAnalyticsParams=I,e.setActionBehavior=function(e){return p({type:"SET_ACTION_BEHAVIOR",payload:{actions:e}}).catch(function(){})},e.setCustomerHash=function(e){return p({type:"SET_CUSTOMER_HASH",payload:{hash:e}})},e.setLogger=function(e){f=e},e.setScreenName=function(e,t){if(!e)return console.warn("Missing analytics screenName"),Promise.resolve();var n=C;return C=e,A({onAndroid:function(n){return n.setScreenNameWithParams?n.setScreenNameWithParams(e,JSON.stringify(t)):n.setScreenName&&n.setScreenName(e),Promise.resolve()},onIos:function(n){return n.postMessage({command:"setScreenName",name:e,parameters:t}),Promise.resolve()},onWeb:function(o){return new Promise(function(r){o("event","page_view",b(b({screenName:e,page_title:e,previousScreenName:n},I(null!==t&&void 0!==t?t:{})),{event_callback:P(r)}))})}})},e.setTrackingProperty=function(e,t,n){return p({type:"SET_TRACKING_PROPERTY",payload:{system:e,name:t,value:n}}).catch(function(){})},e.setUserProperty=function(e,t){return e&&t?(t=String(t),A({onAndroid:function(n){return n.setUserProperty&&n.setUserProperty(e,t),Promise.resolve()},onIos:function(n){return n.postMessage({command:"setUserProperty",name:e,value:t}),Promise.resolve()},onWeb:function(n){var o;return n("set","user_properties",((o={})[e]=N(t),o)),Promise.resolve()}})):(console.warn("Trying to set analytics user property without name or value",e,t),Promise.resolve())},e.setWebViewTitle=function(e){return d()?m({title:e}):("undefined"!=typeof document&&(document.title=e),Promise.resolve())},e.share=function(e){return p({type:"SHARE",payload:e})},e.showAppRating=function(){return p({type:"SHOW_APP_RATING"})},e.updateNavigationBar=m,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).webviewBridge={})}(this,function(e){"use strict";var t=1,n="".concat(Date.now(),"-").concat(String(Math.random()).slice(-8)),o="__tuenti_webview_bridge",r=function(){return!("undefined"==typeof window||!window.tuentiWebView||!window.tuentiWebView.postMessage)},i=function(){return!!("undefined"!=typeof window&&window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.tuentiWebView&&window.webkit.messageHandlers.tuentiWebView.postMessage)},a=function(){return"undefined"==typeof window?null:r()?function(e){window.tuentiWebView.postMessage(e)}:i()?function(e){window.webkit.messageHandlers.tuentiWebView.postMessage(e)}:null},u=[],s=function(e){u.push(e)},c=function(e){u=u.filter(function(t){return t!==e})},l=function(){var e;return"undefined"!=typeof window&&(!!function(){try{return window.self!==window.top}catch(e){return!0}}()&&!(null===(e=null===window||void 0===window?void 0:window.frameElement)||void 0===e?void 0:e.hasAttribute("data-enable-webview-bridge")))},f=void 0,d=function(){return!l()&&(r()||i())},p=function(e,o){var r=e.type,i=e.id,u=void 0===i?"web-".concat(t++,"-").concat(n):i,l=e.payload,d=a(),p=JSON.stringify({type:r,id:u,payload:l});return null===f||void 0===f||f("[WebView Bridge] SEND:",p),d?(setTimeout(function(){d(p)}),new Promise(function(e,t){var n=!1,i=function(o){o.id!==u||n||(o.type===r?e(o.payload):"ERROR"===o.type?t(o.payload):t({code:500,reason:"bad type: ".concat(o.type,". Expecting ").concat(r)}),c(i))};s(i),o&&setTimeout(function(){n=!0,c(i),t({code:408,reason:"request timeout"})},o)})):Promise.reject({code:500,reason:"WebView postMessage not available"})};"undefined"!=typeof window&&(window[o]=window[o]||{postMessage:function(e){var t;null===f||void 0===f||f("[WebView Bridge] RCVD:",e);try{t=JSON.parse(e)}catch(t){throw Error("Problem parsing webview message: ".concat(e))}u.forEach(function(e){return e(t)})}});var y=function(e,t){var n=function(n){n.type===e&&Promise.resolve(t(n.payload)).then(function(e){var t=a();t&&t(JSON.stringify({type:n.type,id:n.id,payload:e}))})};return s(n),function(){c(n)}},m=function(e){var t=e.title,n=e.expandedTitle,o=e.showBackButton,r=e.showReloadButton,i=e.showProfileButton,a=e.backgroundColor;return d()?p({type:"NAVIGATION_BAR",payload:{title:t,expandedTitle:n,showBackButton:o,showReloadButton:r,showProfileButton:i,backgroundColor:a}}):(void 0!==t&&"undefined"!=typeof document&&(document.title=t),Promise.resolve())},v=null,w=function(e){return"true"===v.result[e]},g=function(e){return Math.floor(e/1e3)},b=function(){return(b=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function h(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function T(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{s(o.next(e))}catch(e){i(e)}}function u(e){try{s(o.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,u)}s((o=o.apply(e,t||[])).next())})}function E(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}var S=0,I=function(e){var t=setTimeout(function(){e(),S++},500);return function(){clearTimeout(t),S=0,e()}},A=function(e){var t=e.onAndroid,n=e.onIos,o=e.onWeb;return"undefined"==typeof window?Promise.resolve():window.AnalyticsWebInterface?t(window.AnalyticsWebInterface):window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.firebase?n(window.webkit.messageHandlers.firebase):window.gtag&&S<3?o(window.gtag):Promise.resolve()},P=function(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")},_=function(e){return P(e).toLocaleLowerCase().replace(/[^a-z0-9\s\-\_\/\|\:]/g,"").replace(/\s+/g," ").trim().replace(/\s/g,"_").slice(0,100)},N=function(e){var t={};return Object.entries(e).forEach(function(e){var n=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}(e,2),o=n[0],r=n[1],i=r,a=o.slice(0,40);"string"==typeof r&&(i=_(r)),t[a]=i}),t},O={sanitize:!0},C="",M=!1,R=function(e){return T(void 0,void 0,void 0,function(){var t,n,o;return E(this,function(r){switch(r.label){case 0:if(M)throw{code:423,reason:"BottomSheet is locked. You can only have one bottom sheet in the screen"};M=!0,t=setTimeout(function(){M=!1},1e3),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,p({type:"SHEET",payload:e})];case 2:return n=r.sent(),M=!1,clearTimeout(t),[2,n];case 3:throw o=r.sent(),M=!1,clearTimeout(t),o;case 4:return[2]}})})};e.CD_EVENT_VALUE=8,e.CD_NOVUM_UID=7,e.CD_WEBAPP_INSTALLED=4,e.attachToEmail=function(e){var t=e.url,n=e.subject,o=e.fileName,r=e.recipient,i=e.body;return p({type:"ATTACH_TO_EMAIL",payload:{url:t,subject:n,fileName:o,recipient:r,body:i}})},e.bottomSheet=R,e.bottomSheetActionSelector=function(e){var t=e.title,n=e.subtitle,o=e.description,r=e.items;return R({title:t,subtitle:n,description:o,content:[{type:"LIST",id:"list-0",listType:"ACTIONS",autoSubmit:!0,selectedIds:[],items:r}]}).then(function(e){var t=e.action,n=e.result;return"SUBMIT"===t?{action:t,selectedId:n[0].selectedIds[0]}:{action:t,selectedId:null}})},e.bottomSheetInfo=function(e){var t=e.title,n=e.subtitle,o=e.description,r=e.items;return T(void 0,void 0,void 0,function(){return E(this,function(e){switch(e.label){case 0:return[4,R({title:t,subtitle:n,description:o,content:[{type:"LIST",id:"list-0",listType:"INFORMATIVE",autoSubmit:!1,selectedIds:[],items:r}]})];case 1:return e.sent(),[2]}})})},e.bottomSheetSingleSelector=function(e){var t=e.title,n=e.subtitle,o=e.description,r=e.selectedId,i=e.items;return R({title:t,subtitle:n,description:o,content:[{type:"LIST",id:"list-0",listType:"SINGLE_SELECTION",autoSubmit:!0,selectedIds:"string"==typeof r?[r]:[],items:i}]}).then(function(e){var t=e.action,n=e.result;return"SUBMIT"===t?{action:t,selectedId:n[0].selectedIds[0]}:{action:t,selectedId:null}})},e.checkPermissionStatus=function(e,t){return p({type:"OS_PERMISSION_STATUS",payload:{feature:e,params:t}}).then(function(e){return e.granted})},e.createCalendarEvent=function(e){var t=e.beginTime,n=e.endTime,o=e.title;return p({type:"CREATE_CALENDAR_EVENT",payload:{beginTime:g(t),endTime:g(n),title:o}})},e.dismiss=function(e){return p({type:"DISMISS",payload:{onCompletionUrl:e}})},e.fetch=function(e){var t=e.url,n=e.method,o=e.headers,r=e.body;return d()?p({type:"FETCH",payload:{url:t,method:n,headers:o,body:r}}).catch(function(){return{status:500,headers:{},body:"Bridge call failed"}}):Promise.resolve({status:500,headers:{},body:"Bridge not available"})},e.fetchContactsByPhone=function(e){return p({type:"FETCH_CONTACTS_DATA",payload:{phoneNumbers:e}})},e.getAppMetadata=function(e){return p({type:"GET_APP_METADATA",payload:{appToken:e}})},e.getCustomerHash=function(){return p({type:"GET_CUSTOMER_HASH"})},e.getDiskSpaceInfo=function(){return p({type:"GET_DISK_SPACE_INFO"})},e.getEsimInfo=function(){return p({type:"GET_ESIM_INFO"}).catch(function(){return{supportsEsim:!1}})},e.getTopazToken=function(e){return void 0===e&&(e={}),p({type:"GET_TOPAZ_TOKEN",payload:{}},e.timeout)},e.highlightNavigationTab=function(e){var t=e.tab,n=e.highlight,o=e.count;return p({type:"HIGHLIGHT_TAB",payload:{tab:t,highlight:n,count:o}})},e.internalNavigation=function(e){return p({type:"INTERNAL_NAVIGATION",payload:{feature:e}})},e.isABTestingAvailable=function(e){if(v)return Promise.resolve(w(e));var t=new Promise(function(e){setTimeout(function(){e(!1)},500)}),n=p({type:"GET_REMOTE_CONFIG"}).then(function(t){return v=t,w(e)});return Promise.race([t,n])},e.isWebViewBridgeAvailable=d,e.logEcommerceEvent=function(e,t){return t=b(b({},t),{screenName:t.screenName||C}),A({onAndroid:function(n){return n.logEvent&&n.logEvent(e,JSON.stringify(t)),Promise.resolve()},onIos:function(n){return n.postMessage({command:"logEvent",name:e,parameters:t}),Promise.resolve()},onWeb:function(){return Promise.resolve()}})},e.logEvent=function(e,t){var n,o,r,i,a,u,s=b(b({},O),t).sanitize,c=e.name,l=h(e,["name"]);if(c)Object.keys(l).length>25&&console.warn("Trying to log FirebaseEvent with name ".concat(c," exceeding the limit of ").concat(25," params")),s&&(l=N(l),c=_(c));else{if(!e.category||!e.action)return console.warn('LegacyAnalyticsEvent should have "category" and "action"',{category:e.category,action:e.action}),Promise.resolve();o=(n=e).category,r=n.action,i=n.label,a=n.value,u=h(n,["category","action","label","value"]),i||(i="null_label"),a||(a=0),l=b({eventCategory:o,eventAction:r,eventLabel:P(i),eventValue:a},u),c=e.category}return l=b(b({},l),{screenName:l.screenName||C}),A({onAndroid:function(e){return e.logEvent&&e.logEvent(c,JSON.stringify(l)),Promise.resolve()},onIos:function(e){return e.postMessage({command:"logEvent",name:c,parameters:l}),Promise.resolve()},onWeb:function(e){return new Promise(function(t){e("event",c,b(b({},l),{event_callback:I(t)}))})}})},e.logTiming=function(e){var t=e.category,n=void 0===t?"performance_timer":t,o=e.variable,r=e.value,i=e.label;if(!n||!o||!r)return console.warn('Analytics timing should have "category", "variable" and "value"',{category:n,variable:o,value:r}),Promise.resolve();var a={timingCategory:n,timingVar:o,timingValue:r=Math.round(r),timingLabel:i},u=n;return A({onAndroid:function(e){return e.logEvent&&e.logEvent(u,JSON.stringify(a)),Promise.resolve()},onIos:function(e){return e.postMessage({command:"logEvent",name:u,parameters:a}),Promise.resolve()},onWeb:function(){return new Promise(function(e){gtag("event",u,b(b({},a),{event_callback:I(e)}))})}})},e.logout=function(){return p({type:"LOG_OUT"})},e.nativeAlert=function(e){var t=e.message,n=e.title,o=e.buttonText;return d()?p({type:"ALERT",payload:{title:n,message:t,buttonText:o}}):("undefined"!=typeof window&&window.alert(t),Promise.resolve())},e.nativeConfirm=function(e){var t=e.message,n=e.title,o=e.acceptText,r=e.cancelText;return d()?p({type:"CONFIRM",payload:{message:t,title:n,acceptText:o,cancelText:r}}).then(function(e){return e.result}):Promise.resolve("undefined"!=typeof window&&window.confirm(t))},e.nativeMessage=function(e){var t=e.message,n=e.duration,o=e.buttonText,r=e.type;return d()?p({type:"MESSAGE",payload:{message:t,duration:n,buttonText:o,type:r}}):("undefined"!=typeof window&&window.alert(t),Promise.resolve())},e.notifyBridgeReady=function(){return p({type:"BRIDGE_READY"})},e.notifyPageLoaded=function(){return p({type:"PAGE_LOADED"})},e.onNativeEvent=function(e){return y("NATIVE_EVENT",function(t){return{action:e({event:t.event}).action||"default"}})},e.onSessionRenewed=function(e){return y("SESSION_RENEWED",function(t){var n=t.accessToken;return e(n)})},e.renewSession=function(e,t){return void 0===t&&(t={}),p({type:"RENEW_SESSION",payload:{accessToken:e||null}},t.timeout).then(function(e){return e.accessToken})},e.reportStatus=function(e){var t=e.feature,n=e.status,o=e.reason;return p({type:"STATUS_REPORT",payload:{feature:t,status:n,reason:o}})},e.requestContact=function(e){var t=(void 0===e?{}:e).filter;return p({type:"GET_CONTACT_DATA",payload:{filter:void 0===t?"phone":t}})},e.requestDeviceImei=function(){return p({type:"IMEI"},200).then(function(e){return e.imei}).catch(function(){return null})},e.requestSimIcc=function(){return p({type:"SIM_ICC"},200).then(function(e){return e.icc}).catch(function(){return null})},e.requestSimImsi=function(){return p({type:"IMSI"},200).then(function(e){return e.imsi}).catch(function(){return null})},e.requestVibration=function(e){return p({type:"VIBRATION",payload:{type:e}})},e.sanitizeAnalyticsParam=_,e.sanitizeAnalyticsParams=N,e.setActionBehavior=function(e){return p({type:"SET_ACTION_BEHAVIOR",payload:{actions:e}}).catch(function(){})},e.setCustomerHash=function(e){return p({type:"SET_CUSTOMER_HASH",payload:{hash:e}})},e.setLogger=function(e){f=e},e.setScreenName=function(e,t){if(!e)return console.warn("Missing analytics screenName"),Promise.resolve();var n=C;return C=e,A({onAndroid:function(n){return n.setScreenNameWithParams?n.setScreenNameWithParams(e,JSON.stringify(t)):n.setScreenName&&n.setScreenName(e),Promise.resolve()},onIos:function(n){return n.postMessage({command:"setScreenName",name:e,parameters:t}),Promise.resolve()},onWeb:function(o){return new Promise(function(r){o("event","page_view",b(b({screenName:e,page_title:e,previousScreenName:n},N(null!==t&&void 0!==t?t:{})),{event_callback:I(r)}))})}})},e.setTrackingProperty=function(e,t,n){return p({type:"SET_TRACKING_PROPERTY",payload:{system:e,name:t,value:n}}).catch(function(){})},e.setUserProperty=function(e,t){return e&&t?(t=String(t),A({onAndroid:function(n){return n.setUserProperty&&n.setUserProperty(e,t),Promise.resolve()},onIos:function(n){return n.postMessage({command:"setUserProperty",name:e,value:t}),Promise.resolve()},onWeb:function(n){var o;return n("set","user_properties",((o={})[e]=_(t),o)),Promise.resolve()}})):(console.warn("Trying to set analytics user property without name or value",e,t),Promise.resolve())},e.setWebViewTitle=function(e){return d()?m({title:e}):("undefined"!=typeof document&&(document.title=e),Promise.resolve())},e.share=function(e){return p({type:"SHARE",payload:e})},e.showAppRating=function(){return p({type:"SHOW_APP_RATING"})},e.updateNavigationBar=m,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "@tef-novum/webview-bridge",
"version": "3.16.0",
"version": "3.17.0",
"description": "JavaScript library to access to native functionality. Requires a webview with a postMessage bridge.",

@@ -5,0 +5,0 @@ "main": "./dist/webview-bridge-cjs.js",

@@ -883,5 +883,11 @@ <p align="center">

For the specific case of single selection, you can use the
`bottomSheetSingleSelector` method:
:warning: If you try to call this method repeatedly while a sheet is already
being opened (for example, user accidental double tap), it will throw an Error
with code `423` (Locked)
There are some specific cases of bottom sheet, and we have some utility methods
to make them simpler to use:
For single selection use `bottomSheetSingleSelector`:
```ts

@@ -893,10 +899,28 @@ bottomSheetSingleSelector = ({

selectedId?: string;
items: Array<SheetListItem>;
}) => Promise<{action: 'SUBMIT' | 'DISMISS'; selected: string}>
items: Array<SheetRowItem>;
}) => Promise<{action: 'SUBMIT' | 'DISMISS'; selectedId: string}>
```
:warning: If you try to call this method repeatedly while a sheet is already
being opened (for example, user accidental double tap), it will throw an Error
with code `423` (Locked)
For a bottom sheet with a list of actions use `bottomSheetActionSelector`:
```ts
bottomSheetActionSelector = ({
title?: string;
subtitle?: string;
description?: string;
items: Array<SheetActionItem>;
}) => Promise<{action: 'SUBMIT' | 'DISMISS'; selectedId: string}>
```
For an informative bottom sheet use `bottomSheetInfo`:
```ts
bottomSheetInfo = ({
title?: string;
subtitle?: string;
description?: string;
items: Array<SheetInfoItem>;
}) => Promise<void>
```
#### Example:

@@ -903,0 +927,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc