Socket
Socket
Sign inDemoInstall

@commercetools/checkout-browser-sdk

Package Overview
Dependencies
Maintainers
12
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commercetools/checkout-browser-sdk - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

2

browser/sdk.js

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

!function(){var n,o,e,t=["dev","stg","prod"],c={},i=function(){return o||!n||"prod"===n?o||"https://app.checkoutanywhere.io":"https://app.".concat(n,".checkoutanywhere.io")},r=function(){return c},a=function(n){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(c={}),c={accessToken:"accessToken"in n?n.accessToken:c.accessToken,applicationId:"applicationId"in n?n.applicationId:c.applicationId,callbackUrl:"callbackUrl"in n?n.callbackUrl:c.callbackUrl,cartId:"cartId"in n?n.cartId:c.cartId,locale:"locale"in n?n.locale:c.locale,sellerId:"sellerId"in n?n.sellerId:c.sellerId,storeKey:"storeKey"in n?n.storeKey:c.storeKey,skipShipping:"skipShipping"in n?n.skipShipping:c.skipShipping}},l="ctc-wrapper";(e||(e={})).InitCheckout="init_checkout";var d=function(n){var o=document.body.style.top;window.scrollTo({left:0,top:-1*parseInt(o||"0",10),behavior:"instant"}),document.body.style.overflow="visible";var e=document.getElementById(l);e&&e.remove(),window.removeEventListener("message",n)},s=function(){var n=document.createElement("iframe");return function(n){var o=function(t){var c=t.origin,a=t.data;if(c===i()){if("checkout_cancelled"===(null==a?void 0:a.code)&&d(o),"checkout_loaded"===(null==a?void 0:a.code)){document.body.style.overflow="hidden",document.body.style.top="-".concat(window.scrollY,"px");var l=Object.assign({},r());delete l.callbackUrl,n.contentWindow.postMessage({code:e.InitCheckout,payload:l},i())}if("checkout_completed"===(null==a?void 0:a.code)){var s;d(o);var u=((null==a||null===(s=a.payload)||void 0===s?void 0:s.order)||{}).id,p=r().callbackUrl;p&&(window.location.href="".concat(p,"?orderId=").concat(u))}}};window.addEventListener("message",o)}(n),n.src=i(),n.title="Checkout",n.setAttribute("id",l),n.setAttribute("style","display: none; top: 0; position: fixed; height: 100vh; width: 100vw; z-index: 100000;"),n.onload=function(){n.scrollIntoView({behavior:"smooth",block:"center"})},document.body.appendChild(n),n},u=function(n){return function(o){if(!n||!o)return!1;if("*"===n||o===n)return!0;var e=n.split(":"),t=o.split(":");return!(!t[0]||e[0]!==t[0])&&u(e.slice(1).join(":"))(t.slice(1).join(":"))}},p={},f=function(n,o){var e="".concat(n,"_").concat(Math.round(1e15*Math.random())),t=function(e){var t=e.origin,c=e.data;if(t===i()){var r=c||{};u(n)(r.type)&&o(r)}};return window.addEventListener("message",t),p[e]=t,e},w=function(n){return window.removeEventListener("message",p[n])},v={},y={checkout:function(n){a(n),(document.getElementById(l)||s()).style.display="block"},init:function(e){if("object"!=typeof e)throw new Error("Bad config, please review docs");var c,i;t.includes(e.env)&&(c=e.env,n=c),"string"==typeof e.appHost&&(i=e.appHost,o=i),"object"==typeof e.checkoutConfig&&a(e.checkoutConfig),function(n){[["info","onInfo"],["warn","onWarn"],["error","onError"]].forEach((function(o){var e=o[0],t=o[1];"function"==typeof n[t]&&(v[t]&&w(v[t]),v[t]=f("".concat(e,":*"),n[t]))}))}(e),function(n){[["info","logInfo"],["warn","logWarn"],["error","logError"]].forEach((function(o){var e=o[0],t=o[1];!0===n[t]&&(v[t]&&w(v[t]),v[t]=f("".concat(e,":*"),(function(n){console[e]("[ctc]",n.type,n.code,n.payload||{})})))}))}(e)},subscribe:f,unsubscribe:w};function h(n){return y[n]&&y[n].apply(null,Array.prototype.slice.call(arguments,1))}window.ctc&&Array.isArray(window.ctc.queue)&&window.ctc.queue.forEach((function(n){return h.apply(null,n)})),window.ctc&&Array.isArray(window.ctc.q)&&window.ctc.q.forEach((function(n){return h.apply(null,n)})),window.ctc=h}();
!function(){var o,e,n,t=["dev","stg","prod"],c={},i=function(){return e||!o||"prod"===o?e||"https://app.checkout.europe-west1.gcp.commercetools.com":"https://app.".concat(o,".checkout.europe-west1.gcp.commercetools.com")},r=function(){return c},a=function(o){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(c={}),c={accessToken:"accessToken"in o?o.accessToken:c.accessToken,applicationId:"applicationId"in o?o.applicationId:c.applicationId,callbackUrl:"callbackUrl"in o?o.callbackUrl:c.callbackUrl,cartId:"cartId"in o?o.cartId:c.cartId,locale:"locale"in o?o.locale:c.locale,sellerId:"sellerId"in o?o.sellerId:c.sellerId,storeKey:"storeKey"in o?o.storeKey:c.storeKey,skipShipping:"skipShipping"in o?o.skipShipping:c.skipShipping}},l="ctc-wrapper";(n||(n={})).InitCheckout="init_checkout";var d=function(o){var e=document.body.style.top;window.scrollTo({left:0,top:-1*parseInt(e||"0",10),behavior:"instant"}),document.body.style.overflow="visible";var n=document.getElementById(l);n&&n.remove(),window.removeEventListener("message",o)},s=function(){var o=document.createElement("iframe");return function(o){var e=function(t){var c=t.origin,a=t.data;if(c===i()){if("checkout_cancelled"===(null==a?void 0:a.code)&&d(e),"checkout_loaded"===(null==a?void 0:a.code)){document.body.style.overflow="hidden",document.body.style.top="-".concat(window.scrollY,"px");var l=Object.assign({},r());delete l.callbackUrl,o.contentWindow.postMessage({code:n.InitCheckout,payload:l},i())}if("checkout_completed"===(null==a?void 0:a.code)){var s;d(e);var u=((null==a||null===(s=a.payload)||void 0===s?void 0:s.order)||{}).id,p=r().callbackUrl;p&&(window.location.href="".concat(p,"?orderId=").concat(u))}}};window.addEventListener("message",e)}(o),o.src=i(),o.title="Checkout",o.setAttribute("id",l),o.setAttribute("style","display: none; top: 0; position: fixed; height: 100vh; width: 100vw; z-index: 100000;"),o.onload=function(){o.scrollIntoView({behavior:"smooth",block:"center"})},document.body.appendChild(o),o},u=function(o){return function(e){if(!o||!e)return!1;if("*"===o||e===o)return!0;var n=o.split(":"),t=e.split(":");return!(!t[0]||n[0]!==t[0])&&u(n.slice(1).join(":"))(t.slice(1).join(":"))}},p={},f=function(o,e){var n="".concat(o,"_").concat(Math.round(1e15*Math.random())),t=function(n){var t=n.origin,c=n.data;if(t===i()){var r=c||{};u(o)(r.type)&&e(r)}};return window.addEventListener("message",t),p[n]=t,n},w=function(o){return window.removeEventListener("message",p[o])},v={},y={checkout:function(o){a(o),(document.getElementById(l)||s()).style.display="block"},init:function(n){if("object"!=typeof n)throw new Error("Bad config, please review docs");var c,i;t.includes(n.env)&&(c=n.env,o=c),"string"==typeof n.appHost&&(i=n.appHost,e=i),"object"==typeof n.checkoutConfig&&a(n.checkoutConfig),function(o){[["info","onInfo"],["warn","onWarn"],["error","onError"]].forEach((function(e){var n=e[0],t=e[1];"function"==typeof o[t]&&(v[t]&&w(v[t]),v[t]=f("".concat(n,":*"),o[t]))}))}(n),function(o){[["info","logInfo"],["warn","logWarn"],["error","logError"]].forEach((function(e){var n=e[0],t=e[1];!0===o[t]&&(v[t]&&w(v[t]),v[t]=f("".concat(n,":*"),(function(o){console[n]("[ctc]",o.type,o.code,o.payload||{})})))}))}(n)},subscribe:f,unsubscribe:w};function h(o){return y[o]&&y[o].apply(null,Array.prototype.slice.call(arguments,1))}window.ctc&&Array.isArray(window.ctc.queue)&&window.ctc.queue.forEach((function(o){return h.apply(null,o)})),window.ctc&&Array.isArray(window.ctc.q)&&window.ctc.q.forEach((function(o){return h.apply(null,o)})),window.ctc=h}();

@@ -19,4 +19,4 @@ "use strict";

const getAppHost = () => appHost || !env || env === 'prod'
? appHost || 'https://app.checkoutanywhere.io'
: `https://app.${env}.checkoutanywhere.io`;
? appHost || 'https://app.checkout.europe-west1.gcp.commercetools.com'
: `https://app.${env}.checkout.europe-west1.gcp.commercetools.com`;
exports.getAppHost = getAppHost;

@@ -23,0 +23,0 @@ const getCheckoutConfig = () => checkoutConfig;

{
"private": false,
"name": "@commercetools/checkout-browser-sdk",
"version": "0.0.7",
"version": "0.0.8",
"main": "dist/index.js",

@@ -10,11 +10,5 @@ "types": "dist/index.d.ts",

},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"dependencies": {
"@swc/helpers": "^0.5.0"
"@swc/helpers": "0.5.0"
}
}

@@ -5,3 +5,3 @@ # Commercetools Checkout Typescript SDK

### Browser environment
### Browser environment

@@ -23,3 +23,3 @@ ```

js.async = true;
js.src = 'https://cdn.checkoutanywhere.io/sdk.js';
js.src = 'https://cdn.checkout.europe-west1.gcp.commercetools.com/sdk.js';
fjs.parentNode.insertBefore(js, fjs);

@@ -40,3 +40,2 @@ }(window, document, 'script'));

### Node environment

@@ -43,0 +42,0 @@

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