360dialog-connect-button
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -82,3 +82,3 @@ 'use strict'; | ||
var baseUrl = env === 'local' && 'http://0.0.0.0:8082/' || env === 'staging' && 'https://staging-admin.360dialog.io/' || env === 'rc' && 'https://rc-admin.360dialog.io/' || 'https://hub.360dialog.com/'; | ||
var baseUrl = env === 'local' && 'http://0.0.0.0:8082' || env === 'staging' && 'https://staging-admin.360dialog.io' || env === 'rc' && 'https://rc-admin.360dialog.io' || 'https://hub.360dialog.com'; | ||
var permissionUrl = requestedNumber ? baseUrl + "/dashboard/app/" + partnerId + "/permissions?number=" + requestedNumber : baseUrl + "/dashboard/app/" + partnerId + "/permissions"; | ||
@@ -104,4 +104,3 @@ | ||
}); // remove search parameters from URL after fetching them | ||
window.history.replaceState(null, "", window.location.pathname); | ||
// window.history.replaceState(null, "", window.location.pathname); | ||
} // send to parent (opener) window and close small window | ||
@@ -108,0 +107,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n=require("react"),o=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,t=null,a=null,i=function(e,n){e.origin==n&&(window.location.search=""+e.data)},r=["className","partnerId","callback","requestedNumber","label","env"];exports.ConnectButton=function(e){var l=e.className,c=e.partnerId,s=e.callback,d=e.requestedNumber,u=e.label,p=void 0===u?"Connect 360dialog":u,w=e.env,g=void 0===w?"prod":w,f=function(e,n){if(null==e)return{};var o,t,a={},i=Object.keys(e);for(t=0;t<i.length;t++)n.indexOf(o=i[t])>=0||(a[o]=e[o]);return a}(e,r),b=("local"===g?"http://0.0.0.0:8082/":"staging"===g&&"https://staging-admin.360dialog.io/")||"rc"===g&&"https://rc-admin.360dialog.io/"||"https://hub.360dialog.com/",h=d?b+"/dashboard/app/"+c+"/permissions?number="+d:b+"/dashboard/app/"+c+"/permissions",m=function(e,n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var o=new RegExp("[\\?&]"+n+"=([^&#]*)").exec(e);return null===o?"":decodeURIComponent(o[1].replace(/\+/g," "))};return n.useEffect((function(){var e=window.location.search,n=m(e,"client"),o=m(e,"channels");if(n&&o){var t=o.substring(1,o.length-1).split(",");s({client:n,channels:t}),window.history.replaceState(null,"",window.location.pathname)}window.opener&&(window.opener.postMessage(e),window.close())}),[]),o.createElement("button",Object.assign({className:l||"360dialog-connect-button",onClick:function(){return function(e,n,o){window.removeEventListener("message",i);var r="toolbar=no, menubar=no, width=600, height=900, top=100, left=100";null===t||t.closed?t=window.open(e,n,r):a!==e?(t=window.open(e,n,r)).focus():t.focus(),window.addEventListener("message",(function(e){return i(e,o)}),!1),a=e}(h,"connect-360dialog",window.location.origin)}},f),p)}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n=require("react"),o=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,t=null,a=null,i=function(e,n){e.origin==n&&(window.location.search=""+e.data)},r=["className","partnerId","callback","requestedNumber","label","env"];exports.ConnectButton=function(e){var c=e.className,l=e.partnerId,s=e.callback,d=e.requestedNumber,u=e.label,p=void 0===u?"Connect 360dialog":u,g=e.env,w=void 0===g?"prod":g,f=function(e,n){if(null==e)return{};var o,t,a={},i=Object.keys(e);for(t=0;t<i.length;t++)n.indexOf(o=i[t])>=0||(a[o]=e[o]);return a}(e,r),b=("local"===w?"http://0.0.0.0:8082":"staging"===w&&"https://staging-admin.360dialog.io")||"rc"===w&&"https://rc-admin.360dialog.io"||"https://hub.360dialog.com",m=d?b+"/dashboard/app/"+l+"/permissions?number="+d:b+"/dashboard/app/"+l+"/permissions",h=function(e,n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var o=new RegExp("[\\?&]"+n+"=([^&#]*)").exec(e);return null===o?"":decodeURIComponent(o[1].replace(/\+/g," "))};return n.useEffect((function(){var e=window.location.search,n=h(e,"client"),o=h(e,"channels");if(n&&o){var t=o.substring(1,o.length-1).split(",");s({client:n,channels:t})}window.opener&&(window.opener.postMessage(e),window.close())}),[]),o.createElement("button",Object.assign({className:c||"360dialog-connect-button",onClick:function(){return function(e,n,o){window.removeEventListener("message",i);var r="toolbar=no, menubar=no, width=600, height=900, top=100, left=100";null===t||t.closed?t=window.open(e,n,r):a!==e?(t=window.open(e,n,r)).focus():t.focus(),window.addEventListener("message",(function(e){return i(e,o)}),!1),a=e}(m,"connect-360dialog",window.location.origin)}},f),p)}; | ||
//# sourceMappingURL=dialog-connect-button.cjs.production.min.js.map |
@@ -75,3 +75,3 @@ import React, { useEffect } from 'react'; | ||
var baseUrl = env === 'local' && 'http://0.0.0.0:8082/' || env === 'staging' && 'https://staging-admin.360dialog.io/' || env === 'rc' && 'https://rc-admin.360dialog.io/' || 'https://hub.360dialog.com/'; | ||
var baseUrl = env === 'local' && 'http://0.0.0.0:8082' || env === 'staging' && 'https://staging-admin.360dialog.io' || env === 'rc' && 'https://rc-admin.360dialog.io' || 'https://hub.360dialog.com'; | ||
var permissionUrl = requestedNumber ? baseUrl + "/dashboard/app/" + partnerId + "/permissions?number=" + requestedNumber : baseUrl + "/dashboard/app/" + partnerId + "/permissions"; | ||
@@ -97,4 +97,3 @@ | ||
}); // remove search parameters from URL after fetching them | ||
window.history.replaceState(null, "", window.location.pathname); | ||
// window.history.replaceState(null, "", window.location.pathname); | ||
} // send to parent (opener) window and close small window | ||
@@ -101,0 +100,0 @@ |
{ | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"license": "MIT", | ||
@@ -4,0 +4,0 @@ "main": "dist/index.js", |
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
Sorry, the diff of this file is not supported yet
43128