airwallex-payment-elements 0.2.83 → 0.2.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+
2
+ * @CharlieLangCL @chao-ding-awx @carl-jin-awx @airwallex/awx-pa-qa @olivia-wei-awx @shirly-chen-awx @yifan-leng-awx @awx-luke-lu
@@ -0,0 +1,25 @@
1
+ # 📒 Overview
2
+
3
+ Add a description for other reviewers to read
4
+
5
+ ## 🎯 Release Target
6
+
7
+ Release version (TBD)
8
+
9
+ ## 🎫 Tickets in this pull request
10
+
11
+ - [JIRA Ticket Link](https://airwallex.atlassian.net/browse/APAF-271)
12
+
13
+ ## ✅ Task Checklist
14
+
15
+ - [ ] Is break changes and MAJOR version bump up
16
+ - [ ] Add functionality in a backwards compatible manner and bump up MINOR
17
+ - [ ] Only bump up PATCH version when you make backwards compatible bug fixes
18
+ - [ ] Added unit tests
19
+ - [ ] UAT passed
20
+ - [ ] Planed for all repository and doc update of the new version: checkout ui / checkout demo / airwallex payment demo / pa airboard shopping cart demo
21
+ ### List of updated PR on those repository:
22
+ - checkout ui: TBD
23
+ - pa airboard: TBD
24
+ - checkout demo: TBD
25
+ - airwallex payment demo: TBD
package/.gitlab-ci.yml CHANGED
@@ -1,5 +1,7 @@
1
1
  variables:
2
2
  SONAR_LOGIN: $SONAR_TOKEN
3
+ PUSH_REPO: "https://gitlab.awx.im/acquiring/airwallex-payment-elements.git"
4
+ GITLAB_ONLY_REPO: "true"
3
5
  cache:
4
6
  key:
5
7
  files:
@@ -1,3 +1,3 @@
1
- /* Airwallex Checkout Component Version [0.2.83] */
1
+ /* Airwallex Checkout Component Version [0.2.92] */
2
2
  "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]||e.prod}`,o="/assets/elements.bundle.min.js",t=e=>{const r=document.createElement("script");r.src=`${e}${o}`;const t=document.head||document.body;if(!t)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return t.appendChild(r),r};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.confirmPaymentIntentWithSavedCard=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntentWithSavedCard(e);{const e="Please loadAirwallex() before confirmPaymentIntentWithSavedCard();";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.createPaymentConsent=async e=>{if(window.Airwallex)return window.Airwallex.createPaymentConsent(e);{const e="Please loadAirwallex() before createPaymentConsent();";throw console.error(e),new Error(e)}},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.get3dsReturnUrl=e=>window.Airwallex.get3dsReturnUrl(e),exports.getBrowserInfo=e=>window.Airwallex.getBrowserInfo(e),exports.getDeviceFingerprint=e=>window.Airwallex.getDeviceFingerprint(e),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.handle3ds=e=>window.Airwallex.handle3ds(e),exports.init=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},exports.loadAirwallex=async e=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;let n=0;const l=async()=>{const n=document.querySelector(`script[src="${o}"], script[src="${o}/"]`)||t(r((null==e?void 0:e.env)||"prod"));return new Promise(((r,o)=>{n.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),r(window.Airwallex)):o(new Error("Failed to load Airwallex on load event"))})),n.addEventListener("error",(()=>{o(new Error("Failed to load Airwallex scripts")),n.remove&&n.remove()}))}))};for(;n<3;)try{return await l()}catch(e){n++,await new Promise((e=>window.setTimeout(e,500)))}return null},exports.loadAirwallexJs=t,exports.redirectToCheckout=e=>{if(window.Airwallex)return window.Airwallex.redirectToCheckout(e);console.error("Please loadAirwallex() before redirectToCheckout();")};
3
3
  //# sourceMappingURL=airwallex.cjs.js.map
@@ -1,3 +1,3 @@
1
- /* Airwallex Checkout Component Version [0.2.83] */
1
+ /* Airwallex Checkout Component Version [0.2.92] */
2
2
  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]||e.prod}`,o="/assets/elements.bundle.min.js",l=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},n=async e=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;let n=0;const i=async()=>{const n=document.querySelector(`script[src="${o}"], script[src="${o}/"]`)||l(r((null==e?void 0:e.env)||"prod"));return new Promise(((r,o)=>{n.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),r(window.Airwallex)):o(new Error("Failed to load Airwallex on load event"))})),n.addEventListener("error",(()=>{o(new Error("Failed to load Airwallex scripts")),n.remove&&n.remove()}))}))};for(;n<3;)try{return await i()}catch(e){n++,await new Promise((e=>window.setTimeout(e,500)))}return null},i=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},t=e=>{if(window.Airwallex)return window.Airwallex.redirectToCheckout(e);console.error("Please loadAirwallex() before redirectToCheckout();")},w=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),a=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),d=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),c=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},s=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntentWithSavedCard(e);{const e="Please loadAirwallex() before confirmPaymentIntentWithSavedCard();";throw console.error(e),new Error(e)}},x=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)}},m=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)}},A=async e=>{if(window.Airwallex)return window.Airwallex.createPaymentConsent(e);{const e="Please loadAirwallex() before createPaymentConsent();";throw console.error(e),new Error(e)}},u=e=>window.Airwallex.getBrowserInfo(e),f=e=>window.Airwallex.getDeviceFingerprint(e),h=e=>window.Airwallex.get3dsReturnUrl(e),y=e=>window.Airwallex.handle3ds(e);export{c as confirmPaymentIntent,s as confirmPaymentIntentWithSavedCard,w as createElement,A as createPaymentConsent,x as createPaymentMethod,a as destroyElement,h as get3dsReturnUrl,u as getBrowserInfo,f as getDeviceFingerprint,d as getElement,r as getGatewayUrl,m as getPaymentIntent,y as handle3ds,i as init,n as loadAirwallex,l as loadAirwallexJs,t as redirectToCheckout};
3
3
  //# sourceMappingURL=airwallex.es.js.map
@@ -1,3 +1,3 @@
1
- /* Airwallex Checkout Component Version [0.2.83] */
1
+ /* Airwallex Checkout Component Version [0.2.92] */
2
2
  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"},n=e=>`https://${r[e]||r.prod}`,o="/assets/elements.bundle.min.js",l=e=>{const r=document.createElement("script");r.src=`${e}${o}`;const n=document.head||document.body;if(!n)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return n.appendChild(r),r};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.confirmPaymentIntentWithSavedCard=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntentWithSavedCard(e);{const e="Please loadAirwallex() before confirmPaymentIntentWithSavedCard();";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.createPaymentConsent=async e=>{if(window.Airwallex)return window.Airwallex.createPaymentConsent(e);{const e="Please loadAirwallex() before createPaymentConsent();";throw console.error(e),new Error(e)}},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.get3dsReturnUrl=e=>window.Airwallex.get3dsReturnUrl(e),e.getBrowserInfo=e=>window.Airwallex.getBrowserInfo(e),e.getDeviceFingerprint=e=>window.Airwallex.getDeviceFingerprint(e),e.getElement=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),e.getGatewayUrl=n,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.handle3ds=e=>window.Airwallex.handle3ds(e),e.init=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},e.loadAirwallex=async e=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;let r=0;const t=async()=>{const r=document.querySelector(`script[src="${o}"], script[src="${o}/"]`)||l(n((null==e?void 0:e.env)||"prod"));return new Promise(((n,o)=>{r.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),n(window.Airwallex)):o(new Error("Failed to load Airwallex on load event"))})),r.addEventListener("error",(()=>{o(new Error("Failed to load Airwallex scripts")),r.remove&&r.remove()}))}))};for(;r<3;)try{return await t()}catch(e){r++,await new Promise((e=>window.setTimeout(e,500)))}return null},e.loadAirwallexJs=l,e.redirectToCheckout=e=>{if(window.Airwallex)return window.Airwallex.redirectToCheckout(e);console.error("Please loadAirwallex() before redirectToCheckout();")},Object.defineProperty(e,"__esModule",{value:!0}),e}({});
3
3
  //# sourceMappingURL=airwallex.iife.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "airwallex-payment-elements",
3
- "version": "0.2.83",
3
+ "version": "0.2.92",
4
4
  "module": "lib/bin/airwallex.es.js",
5
5
  "main": "lib/bin/airwallex.cjs.js",
6
6
  "bin": "lib/bin/airwallex.cjs.js",
@@ -62,7 +62,7 @@ export interface InitOptions {
62
62
  /**
63
63
  * i18n localization config
64
64
  */
65
- locale?: 'en' | 'zh' | 'ja' | 'ko' | 'ar' | 'fr';
65
+ locale?: 'en' | 'zh' | 'ja' | 'ko' | 'ar' | 'fr' | 'es' | 'nl' | 'de' | 'it' | 'zh-HK' | 'pl' | 'fi' | 'ru';
66
66
  /**
67
67
  * Global font options
68
68
  */
@@ -85,10 +85,6 @@ export interface RecurringOptions extends HppRecurringOptions {
85
85
  * The reason why merchant trigger transaction. Only applicable when next_triggered_by is `merchant`
86
86
  */
87
87
  merchant_trigger_reason?: 'scheduled' | 'unscheduled';
88
- /**
89
- * Only applicable when next_triggered_by is customer and method is card. If true, the customer must provide cvc for the subsequent payment with this PaymentConsent
90
- */
91
- requires_cvc?: boolean;
92
88
  /**
93
89
  * Currency of the initial PaymentIntent to verify the PaymentConsent. Three-letter ISO currency code. Only applicable for card method
94
90
  */
@@ -118,10 +114,6 @@ export interface HppRecurringOptions {
118
114
  * The reason why merchant trigger transaction. Only applicable when next_triggered_by is `merchant`
119
115
  */
120
116
  merchant_trigger_reason?: 'scheduled' | 'unscheduled';
121
- /**
122
- * Only applicable when next_triggered_by is customer. If true, the customer must provide cvc for the subsequent payment with this PaymentConsent
123
- */
124
- requires_cvc?: boolean;
125
117
  /**
126
118
  * Currency of the initial PaymentIntent to verify the PaymentConsent. Three-letter ISO currency code
127
119
  */
@@ -190,7 +182,7 @@ export interface HostPaymentPage {
190
182
  /**
191
183
  * i18n localization config
192
184
  */
193
- locale?: 'en' | 'zh' | 'ja' | 'ko' | 'ar' | 'fr';
185
+ locale?: 'en' | 'zh' | 'ja' | 'ko' | 'ar' | 'fr' | 'es' | 'nl' | 'de' | 'it' | 'zh-HK' | 'pl' | 'fi' | 'ru';
194
186
  /**
195
187
  * Apply only for card, to improve 3DS experience, indicate if the payment form will collect billing info from shopper
196
188
  */
@@ -498,10 +490,6 @@ export interface Consent {
498
490
  * The update time of the consent.
499
491
  */
500
492
  updated_at: string;
501
- /**
502
- * Whether the consent is required cvc.
503
- */
504
- requires_cvc: boolean;
505
493
  /**
506
494
  * It determines who will be the next one to trigger this consent.
507
495
  */
@@ -615,10 +603,6 @@ export interface PaymentConsentRequest {
615
603
  * The reason why merchant trigger transaction. Only applicable when next_triggered_by is `merchant`
616
604
  */
617
605
  merchant_trigger_reason?: 'scheduled' | 'unscheduled';
618
- /**
619
- * `requires_cvc` used for decide whether cvc is required for subsequent transactions. Only applicable when next_triggered_by is `customer`
620
- */
621
- requires_cvc?: boolean;
622
606
  /**
623
607
  * The billing info for the payment consent
624
608
  */
@@ -627,6 +611,10 @@ export interface PaymentConsentRequest {
627
611
  * It is to be used by the platform to indicate the connected entity in the transaction where platform is the owner of transaction.
628
612
  */
629
613
  connected_account_id?: string;
614
+ /**
615
+ * A set of key-value pairs that can be attached to this PaymentConsent
616
+ */
617
+ metadata?: Record<string, unknown>;
630
618
  }
631
619
 
632
620
  /**
@@ -30,7 +30,6 @@ export interface Intent {
30
30
  customer_payment_consents?: {
31
31
  id: string;
32
32
  next_triggered_by: 'merchant' | 'customer';
33
- requires_cvc: boolean;
34
33
  status: 'PENDING_VERIFICATION' | 'VERIFIED' | 'DISABLED';
35
34
  payment_method: {
36
35
  id?: string;
@@ -47,6 +46,13 @@ export interface Intent {
47
46
  owner_name: string;
48
47
  owner_email: string;
49
48
  };
49
+ card?: {
50
+ brand: string;
51
+ bin: string;
52
+ last4: string;
53
+ network_token: boolean;
54
+ fingerprint: string;
55
+ };
50
56
  };
51
57
  }[];
52
58
  customer_payment_methods?: {
@@ -55,6 +61,8 @@ export interface Intent {
55
61
  brand: string;
56
62
  bin: string;
57
63
  last4: string;
64
+ network_token: boolean;
65
+ fingerprint: string;
58
66
  };
59
67
  }[];
60
68
  }
@@ -88,7 +88,13 @@ export type PaymentMethodWithRedirect =
88
88
  | 'ovo'
89
89
  | 'bitpay'
90
90
  | 'truemoney'
91
- | 'atome';
91
+ | 'atome'
92
+ | 'duit_now'
93
+ | 'pay_now'
94
+ | 'prompt_pay'
95
+ | 'go_pay'
96
+ | 'linkaja'
97
+ | 'jenius_pay';
92
98
 
93
99
  export type DirectDebitPaymentMethod =
94
100
  | 'ach_direct_debit'
@@ -162,6 +168,8 @@ export type ERROR_CODE =
162
168
  * `onDynamicCurrencyConversion`: The events fire when merchant enable Dynamic Currency Conversion (DCC) feature and shopper is confirm payment with an intent which match DCC scenario
163
169
  *
164
170
  * `onPendingVerifyAccount`: The events fire when shoppers checkout with direct debit methods and the bank account need to be verified
171
+ *
172
+ * `onSwitchMethod`: The event fires when shoppers switch payment method in hpp or dropIn element
165
173
  */
166
174
  export type EventCode =
167
175
  | 'onReady'
@@ -175,7 +183,8 @@ export type EventCode =
175
183
  | 'onChange'
176
184
  | 'onClick'
177
185
  | 'onPendingVerifyAccount'
178
- | 'onPressArrowKey';
186
+ | 'onPressArrowKey'
187
+ | 'onSwitchMethod';
179
188
 
180
189
  /**
181
190
  * Return error when failed to validate user input or failed to request