Socket
Socket
Sign inDemoInstall

airwallex-payment-elements

Package Overview
Dependencies
Maintainers
1
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

airwallex-payment-elements - npm Package Compare versions

Comparing version 0.0.77 to 0.0.79

4

lib/bin/airwallex.cjs.js

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

/* Airwallex Checkout Component Version [0.0.77] */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=`https://checkout.airwallex.com/assets/bundle.${[0,0,77].join(".")}.min.js`,r=Promise.resolve().then(()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const r=document.querySelector(`script[src="${e}"], script[src="${e}/"]`)||(()=>{const r=document.createElement("script");r.src=e;const o=document.head||document.body;if(!o)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return o.appendChild(r),r})();return new Promise((e,o)=>{r.addEventListener("load",()=>{window.Airwallex?e():o(new Error("Failed to load Airwallex on load event"))}),r.addEventListener("error",()=>{o(new Error("Failed to load Airwallex scripts"))})})});exports.confirmPaymentIntent=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},exports.createElement=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),exports.createPaymentMethod=async(e,r)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,r);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},exports.destroyElement=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),exports.getElement=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),exports.getPaymentIntent=async(e,r)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,r);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},exports.init=(e,r)=>{window.Airwallex?window.Airwallex.init(e,r):console.error("Please loadAirwallex() before init();")},exports.loadAirwallex=()=>r,exports.redirectToCheckout=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")};
/* Airwallex Checkout Component Version [0.0.79] */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",qa:"checkoutui.qa.awx.im",preview:"checkoutui.preview.awx.im",dev:"localhost:3000"},r=r=>"https://"+(e[r]||"checkout.airwallex.com"),o=`/assets/bundle.${[0,0,79].join(".")}.min.js`;exports.confirmPaymentIntent=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},exports.createElement=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),exports.createPaymentMethod=async(e,r)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,r);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},exports.destroyElement=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),exports.getElement=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),exports.getGatewayUrl=r,exports.getPaymentIntent=async(e,r)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,r);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},exports.init=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},exports.loadAirwallex=e=>Promise.resolve().then(()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const l=document.querySelector(`script[src="${o}"], script[src="${o}/"]`)||(e=>{const r=document.createElement("script");r.src=`${e}${o}`;const l=document.head||document.body;if(!l)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return l.appendChild(r),r})(r((null==e?void 0:e.env)||"prod"));return new Promise((r,o)=>{l.addEventListener("load",()=>{window.Airwallex?(window.Airwallex.init(e),r(window.Airwallex)):o(new Error("Failed to load Airwallex on load event"))}),l.addEventListener("error",()=>{o(new Error("Failed to load Airwallex scripts"))})})}),exports.redirectToCheckout=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")};
/* Airwallex @Charlie.Lang */
//# sourceMappingURL=airwallex.cjs.js.map

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

/* Airwallex Checkout Component Version [0.0.77] */
const e=`https://checkout.airwallex.com/assets/bundle.${[0,0,77].join(".")}.min.js`,r=Promise.resolve().then(()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const r=document.querySelector(`script[src="${e}"], script[src="${e}/"]`)||(()=>{const r=document.createElement("script");r.src=e;const o=document.head||document.body;if(!o)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return o.appendChild(r),r})();return new Promise((e,o)=>{r.addEventListener("load",()=>{window.Airwallex?e():o(new Error("Failed to load Airwallex on load event"))}),r.addEventListener("error",()=>{o(new Error("Failed to load Airwallex scripts"))})})}),o=()=>r,l=(e,r)=>{window.Airwallex?window.Airwallex.init(e,r):console.error("Please loadAirwallex() before init();")},n=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")},t=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),i=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),w=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),a=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},d=async(e,r)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,r);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},s=async(e,r)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,r);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}};export{a as confirmPaymentIntent,t as createElement,d as createPaymentMethod,i as destroyElement,w as getElement,s as getPaymentIntent,l as init,o as loadAirwallex,n as redirectToCheckout};
/* Airwallex Checkout Component Version [0.0.79] */
const e={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",qa:"checkoutui.qa.awx.im",preview:"checkoutui.preview.awx.im",dev:"localhost:3000"},r=r=>"https://"+(e[r]||"checkout.airwallex.com"),o=`/assets/bundle.${[0,0,79].join(".")}.min.js`,l=e=>Promise.resolve().then(()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const l=document.querySelector(`script[src="${o}"], script[src="${o}/"]`)||(e=>{const r=document.createElement("script");r.src=`${e}${o}`;const l=document.head||document.body;if(!l)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return l.appendChild(r),r})(r((null==e?void 0:e.env)||"prod"));return new Promise((r,o)=>{l.addEventListener("load",()=>{window.Airwallex?(window.Airwallex.init(e),r(window.Airwallex)):o(new Error("Failed to load Airwallex on load event"))}),l.addEventListener("error",()=>{o(new Error("Failed to load Airwallex scripts"))})})}),n=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},i=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")},t=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),w=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),a=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),d=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},c=async(e,r)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,r);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},s=async(e,r)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,r);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}};export{d as confirmPaymentIntent,t as createElement,c as createPaymentMethod,w as destroyElement,a as getElement,r as getGatewayUrl,s as getPaymentIntent,n as init,l as loadAirwallex,i as redirectToCheckout};
/* Airwallex @Charlie.Lang */
//# sourceMappingURL=airwallex.es.js.map

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

/* Airwallex Checkout Component Version [0.0.77] */
var Airwallex=function(e){"use strict";const r=`https://checkout.airwallex.com/assets/bundle.${[0,0,77].join(".")}.min.js`,l=Promise.resolve().then(()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const e=document.querySelector(`script[src="${r}"], script[src="${r}/"]`)||(()=>{const e=document.createElement("script");e.src=r;const l=document.head||document.body;if(!l)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return l.appendChild(e),e})();return new Promise((r,l)=>{e.addEventListener("load",()=>{window.Airwallex?r():l(new Error("Failed to load Airwallex on load event"))}),e.addEventListener("error",()=>{l(new Error("Failed to load Airwallex scripts"))})})});return e.confirmPaymentIntent=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},e.createElement=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),e.createPaymentMethod=async(e,r)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,r);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},e.destroyElement=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),e.getElement=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),e.getPaymentIntent=async(e,r)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,r);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},e.init=(e,r)=>{window.Airwallex?window.Airwallex.init(e,r):console.error("Please loadAirwallex() before init();")},e.loadAirwallex=()=>l,e.redirectToCheckout=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")},e}({});
/* Airwallex Checkout Component Version [0.0.79] */
var Airwallex=function(e){"use strict";const r={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",qa:"checkoutui.qa.awx.im",preview:"checkoutui.preview.awx.im",dev:"localhost:3000"},o=e=>"https://"+(r[e]||"checkout.airwallex.com"),l=`/assets/bundle.${[0,0,79].join(".")}.min.js`;return e.confirmPaymentIntent=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},e.createElement=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),e.createPaymentMethod=async(e,r)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,r);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},e.destroyElement=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),e.getElement=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),e.getGatewayUrl=o,e.getPaymentIntent=async(e,r)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,r);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},e.init=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},e.loadAirwallex=e=>Promise.resolve().then(()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const r=document.querySelector(`script[src="${l}"], script[src="${l}/"]`)||(e=>{const r=document.createElement("script");r.src=`${e}${l}`;const o=document.head||document.body;if(!o)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return o.appendChild(r),r})(o((null==e?void 0:e.env)||"prod"));return new Promise((o,l)=>{r.addEventListener("load",()=>{window.Airwallex?(window.Airwallex.init(e),o(window.Airwallex)):l(new Error("Failed to load Airwallex on load event"))}),r.addEventListener("error",()=>{l(new Error("Failed to load Airwallex scripts"))})})}),e.redirectToCheckout=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")},e}({});
/* Airwallex @Charlie.Lang */
//# sourceMappingURL=airwallex.iife.js.map
{
"name": "airwallex-payment-elements",
"version": "0.0.77",
"version": "0.0.79",
"module": "lib/bin/airwallex.es.js",
"main": "lib/bin/airwallex.es.js",
"bin": "lib/bin/airwallex.es.js",
"types": "types/index.d.ts",
"directories": {
"lib": "lib"
"lib": "lib/bin/airwallex.es.js",
"bin": "lib/bin/airwallex.es.js"
},

@@ -9,0 +12,0 @@ "license": "MIT",

@@ -19,2 +19,3 @@ # airwallex-payment-elements

Option #1
```js

@@ -24,3 +25,3 @@ yarn add airwallex-payment-elements

OR with NPM:
Option #2: OR with NPM:

@@ -31,6 +32,6 @@ ```js

Or using UMD build from your client HTML:
Option #3: OR using UMD build from your client HTML:
```html
<script src="https://checkout.airwallex.com/assets/bundle.min.js"></script>
<script src="https://checkout.airwallex.com/assets/bundle.0.0.79.min.js"></script>
```

@@ -42,16 +43,22 @@

Option #1:
```ts
Airwallex.init(client_secret: string, gateway_url: string, options?: InitOptions);
import { loadAirwallex } from 'airwallex-payment-elements';
await loadAirwallex(options?: InitOptions);
```
```client_secret``` - [REQUIRED], can find it from response when create [PaymentIntent](https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/_api_v1_pa_payment_intents_create/post)
Option #2: Or using UMD js global (optional on NPM package integration):
```gateway_url``` - [REQUIRED], is the domain url to loading airwallex checkout assets (html, javascript, css, fonts), it's also the server url for user interaction like submit checkout form.
```js
Production: https://checkout.airwallex.com
Demo: https://checkout-demo.airwallex.com
Staging: https://checkout-staging.airwallex.com
Airwallex.init(options?: InitOptions);
```
Option #3: (optional on NPM package integration):
```ts
import { init } from 'airwallex-payment-elements';
init(options?: InitOptions);
```
```options``` is useful to customize looks and feel of the checkout form when you are adopt Drop-in / Elements integration

@@ -66,2 +73,3 @@

export interface InitOptions {
env?: string; // staging | demo | prod
locale?: string;

@@ -80,3 +88,3 @@ font?: FontOptions;

export interface HostPaymentPage {
host: string; // checkout-{env}.airwallex.com | checkout.airwallex.com
env?: string; // staging | demo | prod
client_secret: string;

@@ -95,5 +103,6 @@ theme?: Style;

Option #1: using UMD js global
```js
airwallex.redirectToCheckout({
host: 'checkout.airwallex.com',
client_secret: 'client_secret',

@@ -103,2 +112,11 @@ }

Option #2:
```ts
import { redirectToCheckout } from 'airwallex-payment-elements';
redirectToCheckout({
client_secret: 'client_secret',
}
```
### Drop-in / Elements integration

@@ -138,41 +156,12 @@

#### Create element interface
#### Create element interface [Detail interface](./types/airwallex.d.ts)
```ts
export declare const createElement: (type: 'cardNumber' | 'expiry' | 'cvc' | 'paymentRequestButton' | 'card' | 'wechat' | 'dropIn', options?: ElementOptions | undefined) => ElementBase | null;
export interface Intent {
id: string;
latest_payment_attempt: {
id: string;
};
}
export interface Style {
variant: 'outlined' | 'filled' | 'standard' | 'bootstrap';
hidden?: boolean;
backgroundColor?: string;
color?: string;
fontSize?: string;
fontSmoothing?: string;
fontStyle?: string;
fontVariant?: string;
fontWeight?: string;
lineHeight?: string;
letterSpacing?: string;
textAlign?: string;
padding?: number;
textDecoration?: string;
textShadow?: string;
textTransform?: string;
}
export interface ElementOptions {
style?: Style;
placeholder?: string;
cvcLength?: number;
origin?: string;
intent?: Intent;
}
```
#### Browser javascript
#### Browser javascript or import NPM package
Option #1: using UMD js global
```js

@@ -182,2 +171,9 @@ Airwallex.createElement(type, options);

Option #2:
```ts
import { createElement } from 'airwallex-payment-elements';
createElement(type, options);
```
### Mount element

@@ -191,4 +187,13 @@

Option #1: using UMD js global
```js
const cardElement = Airwallex.createElement('card');
Airwallex.cardElement.mount('card');
```
Option #2:
```ts
import { createElement } from 'airwallex-payment-elements';
const cardElement = createElement('card');
cardElement.mount('card');

@@ -201,11 +206,8 @@ ```

i.e Confirm using card element (for UMD global can use `Airwallex.confirmPaymentIntent` to replace the imported method)
```ts
export declare const confirmPaymentIntent: (data: PaymentMethod) => Promise<boolean | Intent>;
```
i.e Confirm using card element
```js
import { confirmPaymentIntent } from 'airwallex-payment-elements';
const payload = {
element: Airwallex.getElement('card'),
element: getElement('card'),
intent,

@@ -217,3 +219,3 @@ payment_method: {

try {
const res = await Airwallex.confirmPaymentIntent(payload);
const res = await confirmPaymentIntent(payload);
const { confirmResult } = res || {};

@@ -220,0 +222,0 @@ const { id, status } = confirmResult || {};

@@ -27,2 +27,7 @@ import { Element, ElementType } from './element';

/**
* Indicate which airwallex integration env your merchant site would like to connect with
*/
export type AirwallexEnv = 'dev' | 'preview' | 'qa' | 'staging' | 'demo' | 'prod';
/**
* Global init option config for Airwallex javascript SDK

@@ -32,2 +37,7 @@ */

/**
* Indicate which airwallex integration env your merchant site would like to connect with
* If not provide default will be prod which point to: 'https://checkout.airwallex.com'
*/
env?: AirwallexEnv;
/**
* i18n localization config

@@ -118,5 +128,6 @@ */

/**
* Airwallex payment checkout host, i.e 'https://checkout-demo.airwallex.com' or 'https://checkout.airwallex.com'
* Indicate which airwallex integration env your merchant site would like to connect with
* If not provide default will be prod which point to: 'https://checkout.airwallex.com'
*/
gatewayUrl: string;
env?: AirwallexEnv;
/**

@@ -212,3 +223,3 @@ * The intent id you shopper want to checkout

* Due to PCI CSS https://www.pcisecuritystandards.org/ Airwallex js SDK will load Airwallex javascript to handle all sensitive information
* The PCI Security Standards Council (SSC) defines ‘cardholder data’ which must also be protected:
* The PCI Security Standards Council (SSC) defines `cardholder data` which must also be protected:
* Primary Account Number (PAN) or the full PAN along with any of the following elements:

@@ -300,6 +311,7 @@ * Cardholder name

* Element integration `step #1`
* Optional if you already call `loadAirwallex: (options?: InitOptions | undefined)`
* The first method call to init element integration after loadAirwallex successfully return
* Exceptional: not needed for HPP integration, means you can call redirectToCheckout right after loadAirwallex succeeded
*/
export declare const init: (gatewayUrl: string, options?: InitOptions | undefined) => void;
export declare const init: (options?: InitOptions | undefined) => void;

@@ -306,0 +318,0 @@ /**

@@ -6,2 +6,3 @@ export * from './cardNumber';

init,
AirwallexEnv,
redirectToCheckout,

@@ -22,2 +23,3 @@ createElement,

init,
AirwallexEnv,
redirectToCheckout,

@@ -39,3 +41,3 @@ createElement,

*/
export declare const loadAirwallex: () => Promise<Airwallex | null>;
export declare const loadAirwallex: (options?: InitOptions | undefined) => Promise<Airwallex | null>;

@@ -42,0 +44,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