@playmoweb/vue-payline-wrapper
Advanced tools
Comparing version 1.1.1 to 1.1.2
/*! | ||
* @playmoweb/vue-payline-wrapper v1.1.1 | ||
* @playmoweb/vue-payline-wrapper v1.1.2 | ||
* (c) Playmoweb SAS | ||
* Released under the MIT License. | ||
*/ | ||
function _empty() {} | ||
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.mjs'; | ||
import __vue_create_injector__ from 'vue-runtime-helpers/dist/inject-style/browser.mjs'; | ||
function _awaitIgnored(value, direct) { | ||
if (!direct) { | ||
return value && value.then ? value.then(_empty) : Promise.resolve(); | ||
} | ||
} | ||
function _await(value, then, direct) { | ||
if (direct) { | ||
return then ? then(value) : value; | ||
} | ||
if (!value || !value.then) { | ||
value = Promise.resolve(value); | ||
} | ||
return then ? value.then(then) : value; | ||
} | ||
function _invokeIgnored(body) { | ||
var result = body(); | ||
if (result && result.then) { | ||
return result.then(_empty); | ||
} | ||
} | ||
function _async(f) { | ||
return function () { | ||
for (var args = [], i = 0; i < arguments.length; i++) { | ||
args[i] = arguments[i]; | ||
} | ||
try { | ||
return Promise.resolve(f.apply(this, args)); | ||
} catch (e) { | ||
return Promise.reject(e); | ||
} | ||
}; | ||
} | ||
function loadScript(url) { | ||
@@ -72,17 +33,12 @@ return new Promise(function (resolve, reject) { | ||
var loadPayline = _async(function () { | ||
var loadPayline = function loadPayline() { | ||
var isHomologation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; | ||
return _invokeIgnored(function () { | ||
if (isHomologation) { | ||
return _await(loadScript("https://homologation-payment.cdn.payline.com/scripts/widget-min.js"), function () { | ||
return _awaitIgnored(loadStyle("https://homologation-payment.cdn.payline.com/styles/widget-min.css")); | ||
}); | ||
} else { | ||
return _await(loadScript("https://payment.payline.com/scripts/widget-min.js"), function () { | ||
return _awaitIgnored(loadStyle("https://payment.payline.com/styles/widget-min.css")); | ||
}); | ||
} | ||
}); | ||
}); | ||
if (isHomologation) { | ||
return Promise.all([loadScript("https://homologation-payment.cdn.payline.com/scripts/widget-min.js"), loadStyle("https://homologation-payment.cdn.payline.com/styles/widget-min.css")]); | ||
} else { | ||
return Promise.all([loadScript("https://payment.payline.com/scripts/widget-min.js"), loadStyle("https://payment.payline.com/styles/widget-min.css")]); | ||
} | ||
}; | ||
// | ||
@@ -130,2 +86,7 @@ /** | ||
}, | ||
data: function data() { | ||
return { | ||
payline: window.Payline | ||
}; | ||
}, | ||
watch: { | ||
@@ -142,5 +103,2 @@ token: { | ||
computed: { | ||
payline: function payline() { | ||
return window.Payline; | ||
}, | ||
isLightbox: function isLightbox() { | ||
@@ -151,4 +109,8 @@ return this.widgetType === "lightbox"; | ||
beforeMount: function beforeMount() { | ||
var _this = this; | ||
if (!this.payline) { | ||
loadPayline(this.isHomologation); | ||
loadPayline(this.isHomologation).then(function () { | ||
_this.payline = window.Payline; | ||
}); | ||
} | ||
@@ -236,3 +198,3 @@ }, | ||
handleFinalStateReached: function handleFinalStateReached(param) { | ||
var _this = this; | ||
var _this2 = this; | ||
@@ -243,3 +205,3 @@ this.$emit("handleFinalStateReached", param); | ||
this.$nextTick().then(function () { | ||
_this.payline.Api.hide(); | ||
_this2.payline.Api.hide(); | ||
}); | ||
@@ -263,130 +225,2 @@ } | ||
function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) { | ||
if (typeof shadowMode !== 'boolean') { | ||
createInjectorSSR = createInjector; | ||
createInjector = shadowMode; | ||
shadowMode = false; | ||
} | ||
// Vue.extend constructor export interop. | ||
const options = typeof script === 'function' ? script.options : script; | ||
// render functions | ||
if (template && template.render) { | ||
options.render = template.render; | ||
options.staticRenderFns = template.staticRenderFns; | ||
options._compiled = true; | ||
// functional template | ||
if (isFunctionalTemplate) { | ||
options.functional = true; | ||
} | ||
} | ||
// scopedId | ||
if (scopeId) { | ||
options._scopeId = scopeId; | ||
} | ||
let hook; | ||
if (moduleIdentifier) { | ||
// server build | ||
hook = function (context) { | ||
// 2.3 injection | ||
context = | ||
context || // cached call | ||
(this.$vnode && this.$vnode.ssrContext) || // stateful | ||
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional | ||
// 2.2 with runInNewContext: true | ||
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { | ||
context = __VUE_SSR_CONTEXT__; | ||
} | ||
// inject component styles | ||
if (style) { | ||
style.call(this, createInjectorSSR(context)); | ||
} | ||
// register component module identifier for async chunk inference | ||
if (context && context._registeredComponents) { | ||
context._registeredComponents.add(moduleIdentifier); | ||
} | ||
}; | ||
// used by ssr in case component is cached and beforeCreate | ||
// never gets called | ||
options._ssrRegister = hook; | ||
} | ||
else if (style) { | ||
hook = shadowMode | ||
? function (context) { | ||
style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot)); | ||
} | ||
: function (context) { | ||
style.call(this, createInjector(context)); | ||
}; | ||
} | ||
if (hook) { | ||
if (options.functional) { | ||
// register for functional component in vue file | ||
const originalRender = options.render; | ||
options.render = function renderWithStyleInjection(h, context) { | ||
hook.call(context); | ||
return originalRender(h, context); | ||
}; | ||
} | ||
else { | ||
// inject component registration as beforeCreate hook | ||
const existing = options.beforeCreate; | ||
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]; | ||
} | ||
} | ||
return script; | ||
} | ||
const isOldIE = typeof navigator !== 'undefined' && | ||
/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase()); | ||
function createInjector(context) { | ||
return (id, style) => addStyle(id, style); | ||
} | ||
let HEAD; | ||
const styles = {}; | ||
function addStyle(id, css) { | ||
const group = isOldIE ? css.media || 'default' : id; | ||
const style = styles[group] || (styles[group] = { ids: new Set(), styles: [] }); | ||
if (!style.ids.has(id)) { | ||
style.ids.add(id); | ||
let code = css.source; | ||
if (css.map) { | ||
// https://developer.chrome.com/devtools/docs/javascript-debugging | ||
// this makes source maps inside style tags work properly in Chrome | ||
code += '\n/*# sourceURL=' + css.map.sources[0] + ' */'; | ||
// http://stackoverflow.com/a/26603875 | ||
code += | ||
'\n/*# sourceMappingURL=data:application/json;base64,' + | ||
btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) + | ||
' */'; | ||
} | ||
if (!style.element) { | ||
style.element = document.createElement('style'); | ||
style.element.type = 'text/css'; | ||
if (css.media) | ||
style.element.setAttribute('media', css.media); | ||
if (HEAD === undefined) { | ||
HEAD = document.head || document.getElementsByTagName('head')[0]; | ||
} | ||
HEAD.appendChild(style.element); | ||
} | ||
if ('styleSheet' in style.element) { | ||
style.styles.push(code); | ||
style.element.styleSheet.cssText = style.styles | ||
.filter(Boolean) | ||
.join('\n'); | ||
} | ||
else { | ||
const index = style.ids.size - 1; | ||
const textNode = document.createTextNode(code); | ||
const nodes = style.element.childNodes; | ||
if (nodes[index]) | ||
style.element.removeChild(nodes[index]); | ||
if (nodes.length) | ||
style.element.insertBefore(textNode, nodes[index]); | ||
else | ||
style.element.appendChild(textNode); | ||
} | ||
} | ||
} | ||
/* script */ | ||
@@ -421,3 +255,3 @@ var __vue_script__ = script; | ||
if (!inject) return; | ||
inject("data-v-0235b24f_0", { | ||
inject("data-v-9258e3d2_0", { | ||
source: ".noClose /deep/ #pl-container-lightbox-header-bar{display:none!important}", | ||
@@ -442,6 +276,6 @@ map: undefined, | ||
var __vue_component__ = normalizeComponent({ | ||
var __vue_component__ = /*#__PURE__*/__vue_normalize__({ | ||
render: __vue_render__, | ||
staticRenderFns: __vue_staticRenderFns__ | ||
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, createInjector, undefined, undefined); | ||
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, __vue_create_injector__, undefined, undefined); | ||
@@ -448,0 +282,0 @@ var index = { |
/*! | ||
* @playmoweb/vue-payline-wrapper v1.1.1 | ||
* @playmoweb/vue-payline-wrapper v1.1.2 | ||
* (c) Playmoweb SAS | ||
@@ -8,44 +8,7 @@ * Released under the MIT License. | ||
function _empty() {} | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
function _awaitIgnored(value, direct) { | ||
if (!direct) { | ||
return value && value.then ? value.then(_empty) : Promise.resolve(); | ||
} | ||
} | ||
var __vue_normalize__ = _interopDefault(require('vue-runtime-helpers/dist/normalize-component.mjs')); | ||
var __vue_create_injector__ = _interopDefault(require('vue-runtime-helpers/dist/inject-style/browser.mjs')); | ||
function _await(value, then, direct) { | ||
if (direct) { | ||
return then ? then(value) : value; | ||
} | ||
if (!value || !value.then) { | ||
value = Promise.resolve(value); | ||
} | ||
return then ? value.then(then) : value; | ||
} | ||
function _invokeIgnored(body) { | ||
var result = body(); | ||
if (result && result.then) { | ||
return result.then(_empty); | ||
} | ||
} | ||
function _async(f) { | ||
return function () { | ||
for (var args = [], i = 0; i < arguments.length; i++) { | ||
args[i] = arguments[i]; | ||
} | ||
try { | ||
return Promise.resolve(f.apply(this, args)); | ||
} catch (e) { | ||
return Promise.reject(e); | ||
} | ||
}; | ||
} | ||
function loadScript(url) { | ||
@@ -75,17 +38,12 @@ return new Promise(function (resolve, reject) { | ||
var loadPayline = _async(function () { | ||
var loadPayline = function loadPayline() { | ||
var isHomologation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; | ||
return _invokeIgnored(function () { | ||
if (isHomologation) { | ||
return _await(loadScript("https://homologation-payment.cdn.payline.com/scripts/widget-min.js"), function () { | ||
return _awaitIgnored(loadStyle("https://homologation-payment.cdn.payline.com/styles/widget-min.css")); | ||
}); | ||
} else { | ||
return _await(loadScript("https://payment.payline.com/scripts/widget-min.js"), function () { | ||
return _awaitIgnored(loadStyle("https://payment.payline.com/styles/widget-min.css")); | ||
}); | ||
} | ||
}); | ||
}); | ||
if (isHomologation) { | ||
return Promise.all([loadScript("https://homologation-payment.cdn.payline.com/scripts/widget-min.js"), loadStyle("https://homologation-payment.cdn.payline.com/styles/widget-min.css")]); | ||
} else { | ||
return Promise.all([loadScript("https://payment.payline.com/scripts/widget-min.js"), loadStyle("https://payment.payline.com/styles/widget-min.css")]); | ||
} | ||
}; | ||
// | ||
@@ -133,2 +91,7 @@ /** | ||
}, | ||
data: function data() { | ||
return { | ||
payline: window.Payline | ||
}; | ||
}, | ||
watch: { | ||
@@ -145,5 +108,2 @@ token: { | ||
computed: { | ||
payline: function payline() { | ||
return window.Payline; | ||
}, | ||
isLightbox: function isLightbox() { | ||
@@ -154,4 +114,8 @@ return this.widgetType === "lightbox"; | ||
beforeMount: function beforeMount() { | ||
var _this = this; | ||
if (!this.payline) { | ||
loadPayline(this.isHomologation); | ||
loadPayline(this.isHomologation).then(function () { | ||
_this.payline = window.Payline; | ||
}); | ||
} | ||
@@ -239,3 +203,3 @@ }, | ||
handleFinalStateReached: function handleFinalStateReached(param) { | ||
var _this = this; | ||
var _this2 = this; | ||
@@ -246,3 +210,3 @@ this.$emit("handleFinalStateReached", param); | ||
this.$nextTick().then(function () { | ||
_this.payline.Api.hide(); | ||
_this2.payline.Api.hide(); | ||
}); | ||
@@ -266,130 +230,2 @@ } | ||
function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) { | ||
if (typeof shadowMode !== 'boolean') { | ||
createInjectorSSR = createInjector; | ||
createInjector = shadowMode; | ||
shadowMode = false; | ||
} | ||
// Vue.extend constructor export interop. | ||
const options = typeof script === 'function' ? script.options : script; | ||
// render functions | ||
if (template && template.render) { | ||
options.render = template.render; | ||
options.staticRenderFns = template.staticRenderFns; | ||
options._compiled = true; | ||
// functional template | ||
if (isFunctionalTemplate) { | ||
options.functional = true; | ||
} | ||
} | ||
// scopedId | ||
if (scopeId) { | ||
options._scopeId = scopeId; | ||
} | ||
let hook; | ||
if (moduleIdentifier) { | ||
// server build | ||
hook = function (context) { | ||
// 2.3 injection | ||
context = | ||
context || // cached call | ||
(this.$vnode && this.$vnode.ssrContext) || // stateful | ||
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional | ||
// 2.2 with runInNewContext: true | ||
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { | ||
context = __VUE_SSR_CONTEXT__; | ||
} | ||
// inject component styles | ||
if (style) { | ||
style.call(this, createInjectorSSR(context)); | ||
} | ||
// register component module identifier for async chunk inference | ||
if (context && context._registeredComponents) { | ||
context._registeredComponents.add(moduleIdentifier); | ||
} | ||
}; | ||
// used by ssr in case component is cached and beforeCreate | ||
// never gets called | ||
options._ssrRegister = hook; | ||
} | ||
else if (style) { | ||
hook = shadowMode | ||
? function (context) { | ||
style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot)); | ||
} | ||
: function (context) { | ||
style.call(this, createInjector(context)); | ||
}; | ||
} | ||
if (hook) { | ||
if (options.functional) { | ||
// register for functional component in vue file | ||
const originalRender = options.render; | ||
options.render = function renderWithStyleInjection(h, context) { | ||
hook.call(context); | ||
return originalRender(h, context); | ||
}; | ||
} | ||
else { | ||
// inject component registration as beforeCreate hook | ||
const existing = options.beforeCreate; | ||
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]; | ||
} | ||
} | ||
return script; | ||
} | ||
const isOldIE = typeof navigator !== 'undefined' && | ||
/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase()); | ||
function createInjector(context) { | ||
return (id, style) => addStyle(id, style); | ||
} | ||
let HEAD; | ||
const styles = {}; | ||
function addStyle(id, css) { | ||
const group = isOldIE ? css.media || 'default' : id; | ||
const style = styles[group] || (styles[group] = { ids: new Set(), styles: [] }); | ||
if (!style.ids.has(id)) { | ||
style.ids.add(id); | ||
let code = css.source; | ||
if (css.map) { | ||
// https://developer.chrome.com/devtools/docs/javascript-debugging | ||
// this makes source maps inside style tags work properly in Chrome | ||
code += '\n/*# sourceURL=' + css.map.sources[0] + ' */'; | ||
// http://stackoverflow.com/a/26603875 | ||
code += | ||
'\n/*# sourceMappingURL=data:application/json;base64,' + | ||
btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) + | ||
' */'; | ||
} | ||
if (!style.element) { | ||
style.element = document.createElement('style'); | ||
style.element.type = 'text/css'; | ||
if (css.media) | ||
style.element.setAttribute('media', css.media); | ||
if (HEAD === undefined) { | ||
HEAD = document.head || document.getElementsByTagName('head')[0]; | ||
} | ||
HEAD.appendChild(style.element); | ||
} | ||
if ('styleSheet' in style.element) { | ||
style.styles.push(code); | ||
style.element.styleSheet.cssText = style.styles | ||
.filter(Boolean) | ||
.join('\n'); | ||
} | ||
else { | ||
const index = style.ids.size - 1; | ||
const textNode = document.createTextNode(code); | ||
const nodes = style.element.childNodes; | ||
if (nodes[index]) | ||
style.element.removeChild(nodes[index]); | ||
if (nodes.length) | ||
style.element.insertBefore(textNode, nodes[index]); | ||
else | ||
style.element.appendChild(textNode); | ||
} | ||
} | ||
} | ||
/* script */ | ||
@@ -424,3 +260,3 @@ var __vue_script__ = script; | ||
if (!inject) return; | ||
inject("data-v-0235b24f_0", { | ||
inject("data-v-9258e3d2_0", { | ||
source: ".noClose /deep/ #pl-container-lightbox-header-bar{display:none!important}", | ||
@@ -445,6 +281,6 @@ map: undefined, | ||
var __vue_component__ = normalizeComponent({ | ||
var __vue_component__ = /*#__PURE__*/__vue_normalize__({ | ||
render: __vue_render__, | ||
staticRenderFns: __vue_staticRenderFns__ | ||
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, createInjector, undefined, undefined); | ||
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, __vue_create_injector__, undefined, undefined); | ||
@@ -451,0 +287,0 @@ var index = { |
{ | ||
"name": "@playmoweb/vue-payline-wrapper", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "VueJS Payline Widget Wrapper.", | ||
"main": "dist/index.js", | ||
"module": "dist/index.esm.js", | ||
"files": ["dist"], | ||
"files": [ | ||
"dist" | ||
], | ||
"devDependencies": { | ||
@@ -9,0 +11,0 @@ "bili": "^4.8.1", |
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
18909
486