@akinon/pz-masterpass 1.19.0
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.
- package/.prettierrc +13 -0
- package/CHANGELOG.md +7 -0
- package/README.md +122 -0
- package/assets/img/mp_amex.jpg +0 -0
- package/assets/img/mp_mastercard.png +0 -0
- package/assets/img/mp_masterpass-logo.png +0 -0
- package/assets/img/mp_other.png +0 -0
- package/assets/img/mp_troy.png +0 -0
- package/assets/img/mp_visa.png +0 -0
- package/assets/mfs-client.min.js +3 -0
- package/assets/zepto.min.js +2 -0
- package/package.json +18 -0
- package/src/hooks/use-cards.ts +51 -0
- package/src/hooks/use-countdown.ts +28 -0
- package/src/hooks/use-delete-card.tsx +88 -0
- package/src/index.d.ts +3 -0
- package/src/index.ts +17 -0
- package/src/masterpass-provider.tsx +141 -0
- package/src/redux/reducer.ts +126 -0
- package/src/types/index.ts +111 -0
- package/src/utils/check-masterpass.ts +66 -0
- package/src/utils/get-masterpass-cards.ts +32 -0
- package/src/utils/index.ts +177 -0
- package/src/utils/init.ts +17 -0
- package/src/views/card-list/index.tsx +166 -0
- package/src/views/card-registration/index.tsx +250 -0
- package/src/views/countdown-timer/countdown-timer.tsx +43 -0
- package/src/views/delete-confirmation-modal/index.tsx +64 -0
- package/src/views/info-modal/index.tsx +102 -0
- package/src/views/link-modal/index.tsx +135 -0
- package/src/views/otp-modal/index.tsx +148 -0
- package/src/views/otp-modal/otp-form.tsx +86 -0
package/.prettierrc
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bracketSameLine": false,
|
|
3
|
+
"tabWidth": 2,
|
|
4
|
+
"singleQuote": true,
|
|
5
|
+
"jsxSingleQuote": false,
|
|
6
|
+
"bracketSpacing": true,
|
|
7
|
+
"semi": true,
|
|
8
|
+
"useTabs": false,
|
|
9
|
+
"arrowParens": "always",
|
|
10
|
+
"endOfLine": "lf",
|
|
11
|
+
"proseWrap": "never",
|
|
12
|
+
"trailingComma": "none"
|
|
13
|
+
}
|
package/CHANGELOG.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# pz-masterpass
|
|
2
|
+
|
|
3
|
+
### Install the npm package
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# For latest version
|
|
7
|
+
yarn add git+ssh://git@bitbucket.org:akinonteam/pz-masterpass.git
|
|
8
|
+
|
|
9
|
+
# For specific version
|
|
10
|
+
yarn add git+ssh://git@bitbucket.org:akinonteam/pz-masterpass.git#COMMIT_HASH
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Next Config Configuration
|
|
14
|
+
|
|
15
|
+
##### next.config.js**
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
transpilePackages: ['pz-masterpass'],
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
##### Middleware Config
|
|
22
|
+
Add to matcher array
|
|
23
|
+
```javascript
|
|
24
|
+
|mfs-client.min.js|zepto.min.js
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Translation
|
|
28
|
+
##### File Path: public/locales/en/checkout.json
|
|
29
|
+
##### File Path: public/locales/tr/checkout.json
|
|
30
|
+
|
|
31
|
+
**NOTE:** Add to payment object
|
|
32
|
+
*en*
|
|
33
|
+
```json
|
|
34
|
+
"masterpass": {
|
|
35
|
+
"title": "Your Masterpass Registered Cards",
|
|
36
|
+
"modal": {
|
|
37
|
+
"use_masterpass_cards": "Would you like to use your cards registered to Masterpass?",
|
|
38
|
+
"use": "Use",
|
|
39
|
+
"remove_title": "Are you sure you want to delete the card?",
|
|
40
|
+
"remove_button": "YES, DELETE",
|
|
41
|
+
"cancel_button": "CANCEL"
|
|
42
|
+
},
|
|
43
|
+
"add": {
|
|
44
|
+
"sms_code": "Sms Code",
|
|
45
|
+
"send_sms_again": "Send Sms Again",
|
|
46
|
+
"enter_code": "Enter the verification code.",
|
|
47
|
+
"invalid_ex_date": "Invalid expiration date",
|
|
48
|
+
"invalid_card_number": "Invalid card number",
|
|
49
|
+
"enter_one_time_pass": "Enter Your One-Time Password",
|
|
50
|
+
"enter_bank_pass": "Enter Your Bank Verification Password",
|
|
51
|
+
"enter_the_verification_code": "Enter the verification code.",
|
|
52
|
+
"enter_card_name": "Please enter card name.",
|
|
53
|
+
"mastercard_info": "I want to store my card information in the Mastercard infrastructure and use it again in my next purchase.",
|
|
54
|
+
"masterpass_term": "Masterpass Terms of Use",
|
|
55
|
+
"continue": "CONTINUE",
|
|
56
|
+
"verify": "VERIFY"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
*tr*
|
|
62
|
+
```json
|
|
63
|
+
"masterpass": {
|
|
64
|
+
"title": "Masterpass Kayıtlı Kartlarınız",
|
|
65
|
+
"modal": {
|
|
66
|
+
"use_masterpass_cards": "Masterpass'e kayıtlı kartlarınızı kullanmak ister misiniz?",
|
|
67
|
+
"use": "Kullan",
|
|
68
|
+
"remove_title": "Karti silmek istediğinize emin misiniz?",
|
|
69
|
+
"remove_button": "EVET, SİL",
|
|
70
|
+
"cancel_button": "VAZGEÇ"
|
|
71
|
+
},
|
|
72
|
+
"add": {
|
|
73
|
+
"sms_code": "Sms Kodu",
|
|
74
|
+
"send_sms_again": "Tekrar Sms Gönder",
|
|
75
|
+
"enter_code": "Doğrulama kodunu giriniz",
|
|
76
|
+
"invalid_ex_date": "Geçersiz son kullanma tarihi",
|
|
77
|
+
"invalid_card_number": "Geçersiz kart numarası",
|
|
78
|
+
"enter_one_time_pass": "Tek Seferlik Şifrenizi Giriniz",
|
|
79
|
+
"enter_bank_pass": "Banka Doğrulama Şifrenizi Giriniz",
|
|
80
|
+
"enter_the_verification_code": "Doğrulama kodunu giriniz.",
|
|
81
|
+
"enter_card_name": "Kartınıza bir isim verin",
|
|
82
|
+
"mastercard_info": "Kart bilgilerimi Mastercard altyapısında saklamak ve bir sonraki alışverişimde tekrar kullanmak istiyorum.",
|
|
83
|
+
"masterpass_term": "Masterpass Kullanım Koşulları",
|
|
84
|
+
"continue": "DEVAM ET",
|
|
85
|
+
"verify": "DOĞRULA"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Example Usage
|
|
91
|
+
Wrap the component with the provider
|
|
92
|
+
|
|
93
|
+
##### File Path: src/app/[commerce]/[locale]/orders/checkout/page.tsx
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
return (
|
|
97
|
+
<MasterpassProvider>
|
|
98
|
+
...
|
|
99
|
+
</MasterpassProvider>
|
|
100
|
+
);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Add PaymentOptions
|
|
104
|
+
##### File Path: src/views/checkout/steps/payment/index.tsx
|
|
105
|
+
|
|
106
|
+
```javascript
|
|
107
|
+
{
|
|
108
|
+
pk: 000, // Related payment option pk
|
|
109
|
+
view: CheckoutCreditCard
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
##### File Path: src/views/checkout/steps/payment/options/credit-card/index.tsx
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
import { MasterpassCardList, MasterpassCheckForm } from 'pz-masterpass';
|
|
117
|
+
|
|
118
|
+
<MasterpassCardList />
|
|
119
|
+
|
|
120
|
+
<MasterpassCheckForm getValues={getValues} />
|
|
121
|
+
|
|
122
|
+
```
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! mfs-client 21-12-2021 */
|
|
2
|
+
|
|
3
|
+
var dbits,superagentLegacyIESupportPlugin=function(t){function i(t){if(t!==Object(t))return t;var e,r=[];for(e in t)null!=t[e]&&r.push(encodeURIComponent(e)+"="+encodeURIComponent(t[e]));return r.join("&")}var e,r;(e=t.url,(r=document.createElement("a")).href=e,{hostname:r.hostname,protocol:r.protocol,pathname:r.pathname,queryString:r.search}).hostname!=window.location.hostname&&"undefined"!=typeof XDomainRequest&&(t.end=function(t){var e=this,r=this.xhr=new XDomainRequest;r.getAllResponseHeaders=function(){return""},r.getResponseHeader=function(t){if("content-type"==t)return"application/json"};var n=this._query.join("&"),o=this._formData||this._data;if(this._callback=t||noop,r.onload=function(){r.status=200,e.emit("end")},r.onerror=function(){return r.status=400,e.aborted?e.timeoutError():e.crossDomainError()},r.onprogress=function(){e.emit("progress",50)},r.ontimeout=function(){return r.status=408,e.timeoutError()},n&&(n=i(n),this.url+=~this.url.indexOf("?")?"&"+n:"?"+n),"GET"!=this.method&&"POST"!=this.method)throw"Only Get and Post methods are supported by XDomainRequest object.";return r.open(this.method,this.url,!0),"POST"==this.method&&"string"!=typeof o&&(o=i(o)),this.emit("request",this),r.send(o),this})},canary=0xdeadbeefcafe,j_lm=15715070==(16777215&canary);function BigInteger(t,e,r){null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function nbi(){return new BigInteger(null)}function am1(t,e,r,n,o,i){for(;0<=--i;){var s=e*this[t++]+r[n]+o;o=Math.floor(s/67108864),r[n++]=67108863&s}return o}function am2(t,e,r,n,o,i){for(var s=32767&e,a=e>>15;0<=--i;){var u=32767&this[t],c=this[t++]>>15,l=a*u+c*s;o=((u=s*u+((32767&l)<<15)+r[n]+(1073741823&o))>>>30)+(l>>>15)+a*c+(o>>>30),r[n++]=1073741823&u}return o}function am3(t,e,r,n,o,i){for(var s=16383&e,a=e>>14;0<=--i;){var u=16383&this[t],c=this[t++]>>14,l=a*u+c*s;o=((u=s*u+((16383&l)<<14)+r[n]+o)>>28)+(l>>14)+a*c,r[n++]=268435455&u}return o}dbits=j_lm&&"Microsoft Internet Explorer"==navigator.appName?(BigInteger.prototype.am=am2,30):j_lm&&"Netscape"!=navigator.appName?(BigInteger.prototype.am=am1,26):(BigInteger.prototype.am=am3,28),BigInteger.prototype.DB=dbits,BigInteger.prototype.DM=(1<<dbits)-1,BigInteger.prototype.DV=1<<dbits;var BI_FP=52;BigInteger.prototype.FV=Math.pow(2,BI_FP),BigInteger.prototype.F1=BI_FP-dbits,BigInteger.prototype.F2=2*dbits-BI_FP;for(var BI_RM="0123456789abcdefghijklmnopqrstuvwxyz",BI_RC=new Array,rr="0".charCodeAt(0),vv=0;vv<=9;++vv)BI_RC[rr++]=vv;for(rr="a".charCodeAt(0),vv=10;vv<36;++vv)BI_RC[rr++]=vv;for(rr="A".charCodeAt(0),vv=10;vv<36;++vv)BI_RC[rr++]=vv;function int2char(t){return BI_RM.charAt(t)}function intAt(t,e){e=BI_RC[t.charCodeAt(e)];return null==e?-1:e}function bnpCopyTo(t){for(var e=this.t-1;0<=e;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function bnpFromInt(t){this.t=1,this.s=t<0?-1:0,0<t?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0}function nbv(t){var e=nbi();return e.fromInt(t),e}function bnpFromString(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var n=t.length,o=!1,i=0;0<=--n;){var s=8==r?255&t[n]:intAt(t,n);s<0?"-"==t.charAt(n)&&(o=!0):(o=!1,0==i?this[this.t++]=s:i+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-i)-1)<<i,this[this.t++]=s>>this.DB-i):this[this.t-1]|=s<<i,(i+=r)>=this.DB&&(i-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,0<i&&(this[this.t-1]|=(1<<this.DB-i)-1<<i)),this.clamp(),o&&BigInteger.ZERO.subTo(this,this)}function bnpClamp(){for(var t=this.s&this.DM;0<this.t&&this[this.t-1]==t;)--this.t}function bnToString(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,n=(1<<e)-1,o=!1,i="",s=this.t,a=this.DB-s*this.DB%e;if(0<s--)for(a<this.DB&&0<(r=this[s]>>a)&&(o=!0,i=int2char(r));0<=s;)a<e?(r=(this[s]&(1<<a)-1)<<e-a,r|=this[--s]>>(a+=this.DB-e)):(r=this[s]>>(a-=e)&n,a<=0&&(a+=this.DB,--s)),(o=0<r?!0:o)&&(i+=int2char(r));return o?i:"0"}function bnNegate(){var t=nbi();return BigInteger.ZERO.subTo(this,t),t}function bnAbs(){return this.s<0?this.negate():this}function bnCompareTo(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;0<=--r;)if(0!=(e=this[r]-t[r]))return e;return 0}function nbits(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function bnBitLength(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(t,e){for(var r=this.t-1;0<=r;--r)e[r+t]=this[r];for(r=t-1;0<=r;--r)e[r]=0;e.t=this.t+t,e.s=this.s}function bnpDRShiftTo(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s}function bnpLShiftTo(t,e){for(var r=t%this.DB,n=this.DB-r,o=(1<<n)-1,i=Math.floor(t/this.DB),s=this.s<<r&this.DM,a=this.t-1;0<=a;--a)e[a+i+1]=this[a]>>n|s,s=(this[a]&o)<<r;for(a=i-1;0<=a;--a)e[a]=0;e[i]=s,e.t=this.t+i+1,e.s=this.s,e.clamp()}function bnpRShiftTo(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var n=t%this.DB,o=this.DB-n,i=(1<<n)-1;e[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)e[s-r-1]|=(this[s]&i)<<o,e[s-r]=this[s]>>n;0<n&&(e[this.t-r-1]|=(this.s&i)<<o),e.t=this.t-r,e.clamp()}}function bnpSubTo(t,e){for(var r=0,n=0,o=Math.min(t.t,this.t);r<o;)n+=this[r]-t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n-=t[r],e[r++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=this.DV+n:0<n&&(e[r++]=n),e.t=r,e.clamp()}function bnpMultiplyTo(t,e){var r=this.abs(),n=t.abs(),o=r.t;for(e.t=o+n.t;0<=--o;)e[o]=0;for(o=0;o<n.t;++o)e[o+r.t]=r.am(0,n[o],e,o,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&BigInteger.ZERO.subTo(e,e)}function bnpSquareTo(t){for(var e=this.abs(),r=t.t=2*e.t;0<=--r;)t[r]=0;for(r=0;r<e.t-1;++r){var n=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,n,e.t-r-1))>=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}0<t.t&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()}function bnpDivRemTo(t,e,r){var n=t.abs();if(!(n.t<=0)){var o=this.abs();if(o.t<n.t)return null!=e&&e.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=nbi());var i=nbi(),s=this.s,a=t.s,t=this.DB-nbits(n[n.t-1]);0<t?(n.lShiftTo(t,i),o.lShiftTo(t,r)):(n.copyTo(i),o.copyTo(r));var u=i.t,c=i[u-1];if(0!=c){var o=c*(1<<this.F1)+(1<u?i[u-2]>>this.F2:0),l=this.FV/o,p=(1<<this.F1)/o,f=1<<this.F2,h=r.t,d=h-u,y=null==e?nbi():e;for(i.dlShiftTo(d,y),0<=r.compareTo(y)&&(r[r.t++]=1,r.subTo(y,r)),BigInteger.ONE.dlShiftTo(u,y),y.subTo(i,i);i.t<u;)i[i.t++]=0;for(;0<=--d;){var m=r[--h]==c?this.DM:Math.floor(r[h]*l+(r[h-1]+f)*p);if((r[h]+=i.am(0,m,r,d,0,u))<m)for(i.dlShiftTo(d,y),r.subTo(y,r);r[h]<--m;)r.subTo(y,r)}null!=e&&(r.drShiftTo(u,e),s!=a&&BigInteger.ZERO.subTo(e,e)),r.t=u,r.clamp(),0<t&&r.rShiftTo(t,r),s<0&&BigInteger.ZERO.subTo(r,r)}}}function bnMod(t){var e=nbi();return this.abs().divRemTo(t,null,e),this.s<0&&0<e.compareTo(BigInteger.ZERO)&&t.subTo(e,e),e}function Classic(t){this.m=t}function cConvert(t){return t.s<0||0<=t.compareTo(this.m)?t.mod(this.m):t}function cRevert(t){return t}function cReduce(t){t.divRemTo(this.m,null,t)}function cMulTo(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function cSqrTo(t,e){t.squareTo(e),this.reduce(e)}function bnpInvDigit(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return 0<(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)?this.DV-e:-e}function Montgomery(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function montConvert(t){var e=nbi();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&0<e.compareTo(BigInteger.ZERO)&&this.m.subTo(e,e),e}function montRevert(t){var e=nbi();return t.copyTo(e),this.reduce(e),e}function montReduce(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=32767&t[e],n=r*this.mpl+((r*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),0<=t.compareTo(this.m)&&t.subTo(this.m,t)}function montSqrTo(t,e){t.squareTo(e),this.reduce(e)}function montMulTo(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function bnpIsEven(){return 0==(0<this.t?1&this[0]:this.s)}function bnpExp(t,e){if(4294967295<t||t<1)return BigInteger.ONE;var r,n=nbi(),o=nbi(),i=e.convert(this),s=nbits(t)-1;for(i.copyTo(n);0<=--s;)e.sqrTo(n,o),0<(t&1<<s)?e.mulTo(o,i,n):(r=n,n=o,o=r);return e.revert(n)}function bnModPowInt(t,e){e=new(t<256||e.isEven()?Classic:Montgomery)(e);return this.exp(t,e)}function Arcfour(){this.i=0,this.j=0,this.S=new Array}function ARC4init(t){for(var e,r,n=0;n<256;++n)this.S[n]=n;for(n=e=0;n<256;++n)e=e+this.S[n]+t[n%t.length]&255,r=this.S[n],this.S[n]=this.S[e],this.S[e]=r;this.i=0,this.j=0}function ARC4next(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]}function prng_newstate(){return new Arcfour}Classic.prototype.convert=cConvert,Classic.prototype.revert=cRevert,Classic.prototype.reduce=cReduce,Classic.prototype.mulTo=cMulTo,Classic.prototype.sqrTo=cSqrTo,Montgomery.prototype.convert=montConvert,Montgomery.prototype.revert=montRevert,Montgomery.prototype.reduce=montReduce,Montgomery.prototype.mulTo=montMulTo,Montgomery.prototype.sqrTo=montSqrTo,BigInteger.prototype.copyTo=bnpCopyTo,BigInteger.prototype.fromInt=bnpFromInt,BigInteger.prototype.fromString=bnpFromString,BigInteger.prototype.clamp=bnpClamp,BigInteger.prototype.dlShiftTo=bnpDLShiftTo,BigInteger.prototype.drShiftTo=bnpDRShiftTo,BigInteger.prototype.lShiftTo=bnpLShiftTo,BigInteger.prototype.rShiftTo=bnpRShiftTo,BigInteger.prototype.subTo=bnpSubTo,BigInteger.prototype.multiplyTo=bnpMultiplyTo,BigInteger.prototype.squareTo=bnpSquareTo,BigInteger.prototype.divRemTo=bnpDivRemTo,BigInteger.prototype.invDigit=bnpInvDigit,BigInteger.prototype.isEven=bnpIsEven,BigInteger.prototype.exp=bnpExp,BigInteger.prototype.toString=bnToString,BigInteger.prototype.negate=bnNegate,BigInteger.prototype.abs=bnAbs,BigInteger.prototype.compareTo=bnCompareTo,BigInteger.prototype.bitLength=bnBitLength,BigInteger.prototype.mod=bnMod,BigInteger.prototype.modPowInt=bnModPowInt,BigInteger.ZERO=nbv(0),BigInteger.ONE=nbv(1),Arcfour.prototype.init=ARC4init,Arcfour.prototype.next=ARC4next;var rng_state,rng_psize=256;function rng_seed_int(t){rng_pool[rng_pptr++]^=255&t,rng_pool[rng_pptr++]^=t>>8&255,rng_pool[rng_pptr++]^=t>>16&255,rng_pool[rng_pptr++]^=t>>24&255,rng_psize<=rng_pptr&&(rng_pptr-=rng_psize)}function rng_seed_time(){rng_seed_int((new Date).getTime())}if(null==rng_pool){var rng_pool=new Array,rng_pptr=0;if(window.crypto&&window.crypto.getRandomValues){var ua=new Uint8Array(32);for(window.crypto.getRandomValues(ua),t=0;t<32;++t)rng_pool[rng_pptr++]=ua[t]}if("Netscape"==navigator.appName&&navigator.appVersion<"5"&&window.crypto)for(var z=window.crypto.random(32),t=0;t<z.length;++t)rng_pool[rng_pptr++]=255&z.charCodeAt(t);for(;rng_pptr<rng_psize;)t=Math.floor(65536*Math.random()),rng_pool[rng_pptr++]=t>>>8,rng_pool[rng_pptr++]=255&t;rng_pptr=0,rng_seed_time()}function rng_get_byte(){if(null==rng_state){for(rng_seed_time(),(rng_state=prng_newstate()).init(rng_pool),rng_pptr=0;rng_pptr<rng_pool.length;++rng_pptr)rng_pool[rng_pptr]=0;rng_pptr=0}return rng_state.next()}function rng_get_bytes(t){for(var e=0;e<t.length;++e)t[e]=rng_get_byte()}function SecureRandom(){}function parseBigInt(t,e){return new BigInteger(t,e)}function linebrk(t,e){for(var r="",n=0;n+e<t.length;)r+=t.substring(n,n+e)+"\n",n+=e;return r+t.substring(n,t.length)}function byte2Hex(t){return t<16?"0"+t.toString(16):t.toString(16)}function pkcs1pad2(t,e){if(e<t.length+11)return alert("Message too long for RSA"),null;for(var r=new Array,n=t.length-1;0<=n&&0<e;){var o=t.charCodeAt(n--);o<128?r[--e]=o:127<o&&o<2048?(r[--e]=63&o|128,r[--e]=o>>6|192):(r[--e]=63&o|128,r[--e]=o>>6&63|128,r[--e]=o>>12|224)}r[--e]=0;for(var i=new SecureRandom,s=new Array;2<e;){for(s[0]=0;0==s[0];)i.nextBytes(s);r[--e]=s[0]}return r[--e]=2,r[--e]=0,new BigInteger(r)}function RSAKey(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function RSASetPublic(t,e){null!=t&&null!=e&&0<t.length&&0<e.length?(this.n=parseBigInt(t,16),this.e=parseInt(e,16)):alert("Invalid RSA public key")}function RSADoPublic(t){return t.modPowInt(this.e,this.n)}function RSAEncrypt(t){t=pkcs1pad2(t,this.n.bitLength()+7>>3);if(null==t)return null;t=this.doPublic(t);if(null==t)return null;t=t.toString(16);return 0==(1&t.length)?t:"0"+t}SecureRandom.prototype.nextBytes=rng_get_bytes,RSAKey.prototype.doPublic=RSADoPublic,RSAKey.prototype.setPublic=RSASetPublic,RSAKey.prototype.encrypt=RSAEncrypt;var b64map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b64padchar="=";function hex2b64(t){for(var e,r="",n=0;n+3<=t.length;n+=3)e=parseInt(t.substring(n,n+3),16),r+=b64map.charAt(e>>6)+b64map.charAt(63&e);for(n+1==t.length?(e=parseInt(t.substring(n,n+1),16),r+=b64map.charAt(e<<2)):n+2==t.length&&(e=parseInt(t.substring(n,n+2),16),r+=b64map.charAt(e>>2)+b64map.charAt((3&e)<<4));0<(3&r.length);)r+=b64padchar;return r}function b64tohex(t){for(var e,r="",n=0,o=0;o<t.length&&t.charAt(o)!=b64padchar;++o)v=b64map.indexOf(t.charAt(o)),v<0||(n=0==n?(r+=int2char(v>>2),e=3&v,1):1==n?(r+=int2char(e<<2|v>>4),e=15&v,2):2==n?(r+=int2char(e),r+=int2char(v>>2),e=3&v,3):(r+=int2char(e<<2|v>>4),r+=int2char(15&v),0));return 1==n&&(r+=int2char(e<<2)),r}function b64toBA(t){for(var e=b64tohex(t),r=new Array,n=0;2*n<e.length;++n)r[n]=parseInt(e.substring(2*n,2*n+2),16);return r}!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).superagent=t()}(function(){return function n(o,i,s){function a(e,t){if(!i[e]){if(!o[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(u)return u(e,!0);throw(r=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",r}r=i[e]={exports:{}},o[e][0].call(r.exports,function(t){return a(o[e][1][t]||t)},r,r.exports,n,o,i,s)}return i[e].exports}for(var u="function"==typeof require&&require,t=0;t<s.length;t++)a(s[t]);return a}({1:[function(t,e,r){"use strict";function n(t){if(t)return function(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}(t)}void 0!==e&&(e.exports=n),n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},n.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<n.length;o++)if((r=n[o])===e||r.fn===e){n.splice(o,1);break}return 0===n.length&&delete this._callbacks["$"+t],this},n.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(r)for(var n=0,o=(r=r.slice(0)).length;n<o;++n)r[n].apply(this,e);return this},n.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},n.prototype.hasListeners=function(t){return!!this.listeners(t).length}},{}],2:[function(t,e,r){"use strict";function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}((e.exports=n).default=n).stable=o,n.stableStringify=o;var p=[],f=[];function n(t,e,r){for(!function t(e,r,n,o){var i;if("object"===l(e)&&null!==e){for(i=0;i<n.length;i++)if(n[i]===e){var s=Object.getOwnPropertyDescriptor(o,r);return void(void 0!==s.get?s.configurable?(Object.defineProperty(o,r,{value:"[Circular]"}),p.push([o,r,e,s])):f.push([e,r]):(o[r]="[Circular]",p.push([o,r,e])))}if(n.push(e),Array.isArray(e))for(i=0;i<e.length;i++)t(e[i],i,n,e);else{var a=Object.keys(e);for(i=0;i<a.length;i++){var u=a[i];t(e[u],u,n,e)}}n.pop()}}(t,"",[],void 0),r=0===f.length?JSON.stringify(t,e,r):JSON.stringify(t,i(e),r);0!==p.length;){var n=p.pop();4===n.length?Object.defineProperty(n[0],n[1],n[3]):n[0][n[1]]=n[2]}return r}function h(t,e){return t<e?-1:e<t?1:0}function o(t,e,r){for(t=function t(e,r,n,o){var i;if("object"===l(e)&&null!==e){for(i=0;i<n.length;i++)if(n[i]===e){var s=Object.getOwnPropertyDescriptor(o,r);return void(void 0!==s.get?s.configurable?(Object.defineProperty(o,r,{value:"[Circular]"}),p.push([o,r,e,s])):f.push([e,r]):(o[r]="[Circular]",p.push([o,r,e])))}if("function"!=typeof e.toJSON){if(n.push(e),Array.isArray(e))for(i=0;i<e.length;i++)t(e[i],i,n,e);else{var a={},u=Object.keys(e).sort(h);for(i=0;i<u.length;i++){var c=u[i];t(e[c],c,n,e),a[c]=e[c]}if(void 0===o)return a;p.push([o,r,e]),o[r]=a}n.pop()}}}(t,"",[],void 0)||t,r=0===f.length?JSON.stringify(t,e,r):JSON.stringify(t,i(e),r);0!==p.length;){var n=p.pop();4===n.length?Object.defineProperty(n[0],n[1],n[3]):n[0][n[1]]=n[2]}return r}function i(o){return o=void 0!==o?o:function(t,e){return e},function(t,e){if(0<f.length)for(var r=0;r<f.length;r++){var n=f[r];if(n[1]===t&&n[0]===e){e="[Circular]",f.splice(r,1);break}}return o.call(this,t,e)}}},{}],3:[function(t,e,r){"use strict";var n=String.prototype.replace,o=/%20/g,i=t("./utils"),t={RFC1738:"RFC1738",RFC3986:"RFC3986"};e.exports=i.assign({default:t.RFC3986,formatters:{RFC1738:function(t){return n.call(t,o,"+")},RFC3986:function(t){return String(t)}}},t)},{"./utils":7}],4:[function(t,e,r){"use strict";var n=t("./stringify"),o=t("./parse"),t=t("./formats");e.exports={formats:t,parse:o,stringify:n}},{"./formats":3,"./parse":5,"./stringify":6}],5:[function(t,e,r){"use strict";function u(t,e){var r,n,o,i,s={},a=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,t=e.parameterLimit===1/0?void 0:e.parameterLimit,u=a.split(e.delimiter,t),c=-1,l=e.charset;if(e.charsetSentinel)for(r=0;r<u.length;++r)0===u[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===u[r]?l="utf-8":"utf8=%26%2310003%3B"===u[r]&&(l="iso-8859-1"),c=r,r=u.length);for(r=0;r<u.length;++r)r!==c&&((i=-1===(i=-1===(i=(n=u[r]).indexOf("]="))?n.indexOf("="):i+1)?(o=e.decoder(n,d.decoder,l,"key"),e.strictNullHandling?null:""):(o=e.decoder(n.slice(0,i),d.decoder,l,"key"),p.maybeMap(y(n.slice(i+1),e),function(t){return e.decoder(t,d.decoder,l,"value")})))&&e.interpretNumericEntities&&"iso-8859-1"===l&&(i=i.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})),-1<n.indexOf("[]=")&&(i=h(i)?[i]:i),f.call(s,o)?s[o]=p.combine(s[o],i):s[o]=i);return s}function c(t,e,r,n){if(t){var o=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/g,s=0<r.depth&&/(\[[^[\]]*])/.exec(o),t=s?o.slice(0,s.index):o,a=[];if(t){if(!r.plainObjects&&f.call(Object.prototype,t)&&!r.allowPrototypes)return;a.push(t)}for(var u=0;0<r.depth&&null!==(s=i.exec(o))&&u<r.depth;){if(u+=1,!r.plainObjects&&f.call(Object.prototype,s[1].slice(1,-1))&&!r.allowPrototypes)return;a.push(s[1])}return s&&a.push("["+o.slice(s.index)+"]"),function(t,e,r,n){for(var o=n?e:y(e,r),i=t.length-1;0<=i;--i){var s,a,u,c=t[i];"[]"===c&&r.parseArrays?s=[].concat(o):(s=r.plainObjects?Object.create(null):{},a="["===c.charAt(0)&&"]"===c.charAt(c.length-1)?c.slice(1,-1):c,u=parseInt(a,10),r.parseArrays||""!==a?!isNaN(u)&&c!==a&&String(u)===a&&0<=u&&r.parseArrays&&u<=r.arrayLimit?(s=[])[u]=o:s[a]=o:s={0:o}),o=s}return o}(a,e,r,n)}}var p=t("./utils"),f=Object.prototype.hasOwnProperty,h=Array.isArray,d={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:p.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},y=function(t,e){return t&&"string"==typeof t&&e.comma&&-1<t.indexOf(",")?t.split(","):t};e.exports=function(t,e){var r=function(t){if(!t)return d;if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=(void 0===t.charset?d:t).charset;return{allowDots:void 0===t.allowDots?d.allowDots:!!t.allowDots,allowPrototypes:("boolean"==typeof t.allowPrototypes?t:d).allowPrototypes,arrayLimit:("number"==typeof t.arrayLimit?t:d).arrayLimit,charset:e,charsetSentinel:("boolean"==typeof t.charsetSentinel?t:d).charsetSentinel,comma:("boolean"==typeof t.comma?t:d).comma,decoder:("function"==typeof t.decoder?t:d).decoder,delimiter:("string"==typeof t.delimiter||p.isRegExp(t.delimiter)?t:d).delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:d.depth,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:("boolean"==typeof t.interpretNumericEntities?t:d).interpretNumericEntities,parameterLimit:("number"==typeof t.parameterLimit?t:d).parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:("boolean"==typeof t.plainObjects?t:d).plainObjects,strictNullHandling:("boolean"==typeof t.strictNullHandling?t:d).strictNullHandling}}(e);if(""===t||null==t)return r.plainObjects?Object.create(null):{};for(var n="string"==typeof t?u(t,r):t,o=r.plainObjects?Object.create(null):{},i=Object.keys(n),s=0;s<i.length;++s)var a=i[s],a=c(a,n[a],r,"string"==typeof t),o=p.merge(o,a,r);return p.compact(o)}},{"./utils":7}],6:[function(t,e,r){"use strict";function v(t){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function T(t,e){n.apply(t,w(e)?e:[e])}function _(t,e,r,n,o,i,s,a,u,c,l,p,f){var h=t;if("function"==typeof s?h=s(e,h):h instanceof Date?h=c(h):"comma"===r&&w(h)&&(h=S.maybeMap(h,function(t){return t instanceof Date?c(t):t}).join(",")),null===h){if(n)return i&&!p?i(e,D.encoder,f,"key"):e;h=""}if("string"==typeof(t=h)||"number"==typeof t||"boolean"==typeof t||"symbol"===v(t)||"bigint"==typeof t||S.isBuffer(h))return i?[l(p?e:i(e,D.encoder,f,"key"))+"="+l(i(h,D.encoder,f,"value"))]:[l(e)+"="+l(String(h))];var d,y=[];if(void 0===h)return y;d=w(s)?s:(t=Object.keys(h),a?t.sort(a):t);for(var m=0;m<d.length;++m){var g=d[m],b=h[g];o&&null===b||(g=w(h)?"function"==typeof r?r(e,g):e:e+(u?"."+g:"["+g+"]"),T(y,_(b,g,r,n,o,i,s,a,u,c,l,p,f)))}return y}var S=t("./utils"),c=t("./formats"),l=Object.prototype.hasOwnProperty,p={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},w=Array.isArray,n=Array.prototype.push,o=Date.prototype.toISOString,t=c.default,D={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:S.encode,encodeValuesOnly:!1,format:t,formatter:c.formatters[t],indices:!1,serializeDate:function(t){return o.call(t)},skipNulls:!1,strictNullHandling:!1};e.exports=function(t,e){var r=t,n=function(t){if(!t)return D;if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||D.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=c.default;if(void 0!==t.format){if(!l.call(c.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var n=c.formatters[r],r=D.filter;return"function"!=typeof t.filter&&!w(t.filter)||(r=t.filter),{addQueryPrefix:("boolean"==typeof t.addQueryPrefix?t:D).addQueryPrefix,allowDots:void 0===t.allowDots?D.allowDots:!!t.allowDots,charset:e,charsetSentinel:("boolean"==typeof t.charsetSentinel?t:D).charsetSentinel,delimiter:(void 0===t.delimiter?D:t).delimiter,encode:("boolean"==typeof t.encode?t:D).encode,encoder:("function"==typeof t.encoder?t:D).encoder,encodeValuesOnly:("boolean"==typeof t.encodeValuesOnly?t:D).encodeValuesOnly,filter:r,formatter:n,serializeDate:("function"==typeof t.serializeDate?t:D).serializeDate,skipNulls:("boolean"==typeof t.skipNulls?t:D).skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:("boolean"==typeof t.strictNullHandling?t:D).strictNullHandling}}(e);"function"==typeof n.filter?r=(0,n.filter)("",r):w(n.filter)&&(s=n.filter);var o=[];if("object"!==v(r)||null===r)return"";var t=e&&e.arrayFormat in p?e.arrayFormat:!(e&&"indices"in e)||e.indices?"indices":"repeat",i=p[t],s=s||Object.keys(r);n.sort&&s.sort(n.sort);for(var a=0;a<s.length;++a){var u=s[a];n.skipNulls&&null===r[u]||T(o,_(r[u],u,i,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.formatter,n.encodeValuesOnly,n.charset))}e=o.join(n.delimiter),t=!0===n.addQueryPrefix?"?":"";return n.charsetSentinel&&("iso-8859-1"===n.charset?t+="utf8=%26%2310003%3B&":t+="utf8=%E2%9C%93&"),0<e.length?t+e:""}},{"./formats":3,"./utils":7}],7:[function(t,e,r){"use strict";function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},n=0;n<t.length;++n)void 0!==t[n]&&(r[n]=t[n]);return r}function a(n,o,i){if(!o)return n;if("object"!==l(o)){if(p(n))n.push(o);else{if(!n||"object"!==l(n))return[n,o];(i&&(i.plainObjects||i.allowPrototypes)||!u.call(Object.prototype,o))&&(n[o]=!0)}return n}if(!n||"object"!==l(n))return[n].concat(o);var t=n;return p(n)&&!p(o)&&(t=s(n,i)),p(n)&&p(o)?(o.forEach(function(t,e){var r;u.call(n,e)?(r=n[e])&&"object"===l(r)&&t&&"object"===l(t)?n[e]=a(r,t,i):n.push(t):n[e]=t}),n):Object.keys(o).reduce(function(t,e){var r=o[e];return u.call(t,e)?t[e]=a(t[e],r,i):t[e]=r,t},t)}var u=Object.prototype.hasOwnProperty,p=Array.isArray,c=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}();e.exports={arrayToObject:s,assign:function(t,r){return Object.keys(r).reduce(function(t,e){return t[e]=r[e],t},t)},combine:function(t,e){return[].concat(t,e)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],n=0;n<e.length;++n)for(var o=e[n],i=o.obj[o.prop],s=Object.keys(i),a=0;a<s.length;++a){var u=s[a],c=i[u];"object"===l(c)&&null!==c&&-1===r.indexOf(c)&&(e.push({obj:i,prop:u}),r.push(c))}return function(t){for(;1<t.length;){var e=t.pop(),r=e.obj[e.prop];if(p(r)){for(var n=[],o=0;o<r.length;++o)void 0!==r[o]&&n.push(r[o]);e.obj[e.prop]=n}}}(e),t},decode:function(e,t,r){e=e.replace(/\+/g," ");if("iso-8859-1"===r)return e.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(e)}catch(t){return e}},encode:function(t,e,r){if(0===t.length)return t;var n=t;if("symbol"===l(t)?n=Symbol.prototype.toString.call(t):"string"!=typeof t&&(n=String(t)),"iso-8859-1"===r)return escape(n).replace(/%u[0-9a-f]{4}/gi,function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"});for(var o="",i=0;i<n.length;++i){var s=n.charCodeAt(i);45===s||46===s||95===s||126===s||48<=s&&s<=57||65<=s&&s<=90||97<=s&&s<=122?o+=n.charAt(i):s<128?o+=c[s]:s<2048?o+=c[192|s>>6]+c[128|63&s]:s<55296||57344<=s?o+=c[224|s>>12]+c[128|s>>6&63]+c[128|63&s]:(i+=1,s=65536+((1023&s)<<10|1023&n.charCodeAt(i)),o+=c[240|s>>18]+c[128|s>>12&63]+c[128|s>>6&63]+c[128|63&s])}return o},isBuffer:function(t){return!(!t||"object"!==l(t))&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(p(t)){for(var r=[],n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)},merge:a}},{}],8:[function(t,e,r){"use strict";function n(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(r="Object"===r&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(){this._defaults=[]}["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"].forEach(function(n){i.prototype[n]=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return this._defaults.push({fn:n,args:e}),this}}),i.prototype._setDefaults=function(e){this._defaults.forEach(function(t){e[t.fn].apply(e,n(t.args))})},e.exports=i},{}],9:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}e.exports=function(t){return null!==t&&"object"===n(t)}},{}],10:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o="undefined"!=typeof window?window:"undefined"==typeof self?void console.warn("Using browser-only version of superagent in non-browser environment"):self,i=t("component-emitter"),s=t("fast-safe-stringify"),a=t("qs"),u=t("./request-base"),c=t("./is-object"),l=t("./response-base"),p=t("./agent-base");function f(){}e.exports=function(t,e){return"function"==typeof e?new r.Request("GET",t).end(e):1===arguments.length?new r.Request("GET",t):new r.Request(t,e)};var h=r=e.exports;r.Request=v,h.getXHR=function(){if(o.XMLHttpRequest&&(!o.location||"file:"!==o.location.protocol||!o.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw new Error("Browser-only version of superagent could not find XHR")};var d="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};function y(t){if(!c(t))return t;var e,r=[];for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&!function e(r,n,t){if(void 0===t)return;if(null===t)return void r.push(encodeURI(n));if(Array.isArray(t))t.forEach(function(t){e(r,n,t)});else if(c(t))for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e(r,"".concat(n,"[").concat(o,"]"),t[o]);else r.push(encodeURI(n)+"="+encodeURIComponent(t))}(r,e,t[e]);return r.join("&")}function m(t){for(var e,r,n={},o=t.split("&"),i=0,s=o.length;i<s;++i)-1===(r=(e=o[i]).indexOf("="))?n[decodeURIComponent(e)]="":n[decodeURIComponent(e.slice(0,r))]=decodeURIComponent(e.slice(r+1));return n}function g(t){return/[/+]json($|[^-\w])/i.test(t)}function b(t){this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!==this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var e=this.xhr.status;this._setStatusProperties(e=1223===e?204:e),this.headers=function(t){for(var e,r,n,o=t.split(/\r?\n/),i={},s=0,a=o.length;s<a;++s)-1!==(n=(e=o[s]).indexOf(":"))&&(r=e.slice(0,n).toLowerCase(),n=d(e.slice(n+1)),i[r]=n);return i}(this.xhr.getAllResponseHeaders()),this.header=this.headers,this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&t._responseType?this.body=this.xhr.response:this.body="HEAD"===this.req.method?null:this._parseBody(this.text||this.xhr.response)}function v(t,e){var n=this;this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var e,r=null,t=null;try{t=new b(n)}catch(t){return(r=new Error("Parser is unable to parse the response")).parse=!0,r.original=t,n.xhr?(r.rawResponse=void 0===n.xhr.responseType?n.xhr.responseText:n.xhr.response,r.status=n.xhr.status||null,r.statusCode=r.status):(r.rawResponse=null,r.status=null),n.callback(r)}n.emit("response",t);try{n._isResponseOK(t)||(e=new Error(t.statusText||t.text||"Unsuccessful HTTP response"))}catch(t){e=t}e?(e.original=r,e.response=t,e.status=t.status,n.callback(e,t)):n.callback(null,t)})}function T(t,e,r){t=h("DELETE",t);return"function"==typeof e&&(r=e,e=null),e&&t.send(e),r&&t.end(r),t}h.serializeObject=y,h.parseString=m,h.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},h.serialize={"application/x-www-form-urlencoded":a.stringify,"application/json":s},h.parse={"application/x-www-form-urlencoded":m,"application/json":JSON.parse},l(b.prototype),b.prototype._parseBody=function(t){var e=h.parse[this.type];return this.req._parser?this.req._parser(this,t):(e=!e&&g(this.type)?h.parse["application/json"]:e)&&t&&(0<t.length||t instanceof Object)?e(t):null},b.prototype.toError=function(){var t=this.req,e=t.method,r=t.url,t="cannot ".concat(e," ").concat(r," (").concat(this.status,")"),t=new Error(t);return t.status=this.status,t.method=e,t.url=r,t},h.Response=b,i(v.prototype),u(v.prototype),v.prototype.type=function(t){return this.set("Content-Type",h.types[t]||t),this},v.prototype.accept=function(t){return this.set("Accept",h.types[t]||t),this},v.prototype.auth=function(t,e,r){"object"===n(e=1===arguments.length?"":e)&&null!==e&&(r=e,e=""),r=r||{type:"function"==typeof btoa?"basic":"auto"};return this._auth(t,e,r,function(t){if("function"==typeof btoa)return btoa(t);throw new Error("Cannot use basic auth, btoa is not a function")})},v.prototype.query=function(t){return(t="string"!=typeof t?y(t):t)&&this._query.push(t),this},v.prototype.attach=function(t,e,r){if(e){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(t,e,r||e.name)}return this},v.prototype._getFormData=function(){return this._formData||(this._formData=new o.FormData),this._formData},v.prototype.callback=function(t,e){if(this._shouldRetry(t,e))return this._retry();var r=this._callback;this.clearTimeout(),t&&(this._maxRetries&&(t.retries=this._retries-1),this.emit("error",t)),r(t,e)},v.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},v.prototype.buffer=v.prototype.ca=v.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},v.prototype.pipe=v.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},v.prototype._isHost=function(t){return t&&"object"===n(t)&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},v.prototype.end=function(t){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=t||f,this._finalizeQueryString(),this._end()},v.prototype._setUploadTimeout=function(){var t=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout(function(){t._timeoutError("Upload timeout of ",t._uploadTimeout,"ETIMEDOUT")},this._uploadTimeout))},v.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));var r=this;this.xhr=h.getXHR();var n=this.xhr,t=this._formData||this._data;this._setTimeouts(),n.onreadystatechange=function(){var e,t=n.readyState;if(2<=t&&r._responseTimeoutTimer&&clearTimeout(r._responseTimeoutTimer),4===t){try{e=n.status}catch(t){e=0}if(!e)return r.timedout||r._aborted?void 0:r.crossDomainError();r.emit("end")}};var e,o,i=function(t,e){0<e.total&&(e.percent=e.loaded/e.total*100,100===e.percent&&clearTimeout(r._uploadTimeoutTimer)),e.direction=t,r.emit("progress",e)};if(this.hasListeners("progress"))try{n.addEventListener("progress",i.bind(null,"download")),n.upload&&n.upload.addEventListener("progress",i.bind(null,"upload"))}catch(t){}n.upload&&this._setUploadTimeout();try{this.username&&this.password?n.open(this.method,this.url,!0,this.username,this.password):n.open(this.method,this.url,!0)}catch(t){return this.callback(t)}for(o in this._withCredentials&&(n.withCredentials=!0),this._formData||"GET"===this.method||"HEAD"===this.method||"string"==typeof t||this._isHost(t)||(e=this._header["content-type"],(i=!(i=this._serializer||h.serialize[e?e.split(";")[0]:""])&&g(e)?h.serialize["application/json"]:i)&&(t=i(t))),this.header)null!==this.header[o]&&Object.prototype.hasOwnProperty.call(this.header,o)&&n.setRequestHeader(o,this.header[o]);this._responseType&&(n.responseType=this._responseType),this.emit("request",this),n.send(void 0===t?null:t)},h.agent=function(){return new p},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach(function(r){p.prototype[r.toLowerCase()]=function(t,e){t=new h.Request(r,t);return this._setDefaults(t),e&&t.end(e),t}}),p.prototype.del=p.prototype.delete,h.get=function(t,e,r){t=h("GET",t);return"function"==typeof e&&(r=e,e=null),e&&t.query(e),r&&t.end(r),t},h.head=function(t,e,r){t=h("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&t.query(e),r&&t.end(r),t},h.options=function(t,e,r){t=h("OPTIONS",t);return"function"==typeof e&&(r=e,e=null),e&&t.send(e),r&&t.end(r),t},h.del=T,h.delete=T,h.patch=function(t,e,r){t=h("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&t.send(e),r&&t.end(r),t},h.post=function(t,e,r){t=h("POST",t);return"function"==typeof e&&(r=e,e=null),e&&t.send(e),r&&t.end(r),t},h.put=function(t,e,r){t=h("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&t.send(e),r&&t.end(r),t}},{"./agent-base":8,"./is-object":9,"./request-base":11,"./response-base":12,"component-emitter":1,"fast-safe-stringify":2,qs:4}],11:[function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=t("./is-object");function i(t){if(t)return function(t){for(var e in i.prototype)Object.prototype.hasOwnProperty.call(i.prototype,e)&&(t[e]=i.prototype[e]);return t}(t)}(e.exports=i).prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},i.prototype.parse=function(t){return this._parser=t,this},i.prototype.responseType=function(t){return this._responseType=t,this},i.prototype.serialize=function(t){return this._serializer=t,this},i.prototype.timeout=function(t){if(!t||"object"!==n(t))return this._timeout=t,this._responseTimeout=0,this._uploadTimeout=0,this;for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))switch(e){case"deadline":this._timeout=t.deadline;break;case"response":this._responseTimeout=t.response;break;case"upload":this._uploadTimeout=t.upload;break;default:console.warn("Unknown timeout option",e)}return this},i.prototype.retry=function(t,e){return this._maxRetries=t=(t=0===arguments.length||!0===t?1:t)<=0?0:t,this._retries=0,this._retryCallback=e,this};var s=new Set(["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"]),a=new Set([408,413,429,500,502,503,504,521,522,524]);i.prototype._shouldRetry=function(t,e){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{var r=this._retryCallback(t,e);if(!0===r)return!0;if(!1===r)return!1}catch(t){console.error(t)}if(e&&e.status&&a.has(e.status))return!0;if(t){if(t.code&&s.has(t.code))return!0;if(t.timeout&&"ECONNABORTED"===t.code)return!0;if(t.crossDomain)return!0}return!1},i.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},i.prototype.then=function(t,e){var o,i=this;return this._fullfilledPromise||((o=this)._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(r,n){o.on("abort",function(){var t;i._maxRetries&&i._maxRetries>i._retries||(i.timedout&&i.timedoutError?n(i.timedoutError):((t=new Error("Aborted")).code="ABORTED",t.status=i.status,t.method=i.method,t.url=i.url,n(t)))}),o.end(function(t,e){t?n(t):r(e)})})),this._fullfilledPromise.then(t,e)},i.prototype.catch=function(t){return this.then(void 0,t)},i.prototype.use=function(t){return t(this),this},i.prototype.ok=function(t){if("function"!=typeof t)throw new Error("Callback required");return this._okCallback=t,this},i.prototype._isResponseOK=function(t){return!!t&&(this._okCallback?this._okCallback(t):200<=t.status&&t.status<300)},i.prototype.getHeader=i.prototype.get=function(t){return this._header[t.toLowerCase()]},i.prototype.set=function(t,e){if(o(t)){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.set(r,t[r]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},i.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},i.prototype.field=function(t,e){if(null==t)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(o(t)){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.field(r,t[r]);return this}if(Array.isArray(e)){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&this.field(t,e[n]);return this}if(null==e)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof e&&(e=String(e)),this._getFormData().append(t,e),this},i.prototype.abort=function(){return this._aborted||(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort")),this},i.prototype._auth=function(t,e,r,n){switch(r.type){case"basic":this.set("Authorization","Basic ".concat(n("".concat(t,":").concat(e))));break;case"auto":this.username=t,this.password=e;break;case"bearer":this.set("Authorization","Bearer ".concat(t))}return this},i.prototype.withCredentials=function(t){return this._withCredentials=t=void 0===t?!0:t,this},i.prototype.redirects=function(t){return this._maxRedirects=t,this},i.prototype.maxResponseSize=function(t){if("number"!=typeof t)throw new TypeError("Invalid argument");return this._maxResponseSize=t,this},i.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},i.prototype.send=function(t){var e=o(t),r=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(e&&o(this._data))for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(this._data[n]=t[n]);else"string"==typeof t?(r||this.type("form"),r=(r=this._header["content-type"])&&r.toLowerCase().trim(),this._data="application/x-www-form-urlencoded"===r?this._data?"".concat(this._data,"&").concat(t):t:(this._data||"")+t):this._data=t;return!e||this._isHost(t)||r||this.type("json"),this},i.prototype.sortQuery=function(t){return this._sort=void 0===t||t,this},i.prototype._finalizeQueryString=function(){var t,e=this._query.join("&");e&&(this.url+=(this.url.includes("?")?"&":"?")+e),this._query.length=0,!this._sort||0<=(t=this.url.indexOf("?"))&&(e=this.url.slice(t+1).split("&"),"function"==typeof this._sort?e.sort(this._sort):e.sort(),this.url=this.url.slice(0,t)+"?"+e.join("&"))},i.prototype._appendQueryString=function(){console.warn("Unsupported")},i.prototype._timeoutError=function(t,e,r){this._aborted||((t=new Error("".concat(t+e,"ms exceeded"))).timeout=e,t.code="ECONNABORTED",t.errno=r,this.timedout=!0,this.timedoutError=t,this.abort(),this.callback(t))},i.prototype._setTimeouts=function(){var t=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){t._timeoutError("Timeout of ",t._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){t._timeoutError("Response timeout of ",t._responseTimeout,"ETIMEDOUT")},this._responseTimeout))}},{"./is-object":9}],12:[function(t,e,r){"use strict";var o=t("./utils");function n(t){if(t)return function(t){for(var e in n.prototype)Object.prototype.hasOwnProperty.call(n.prototype,e)&&(t[e]=n.prototype[e]);return t}(t)}(e.exports=n).prototype.get=function(t){return this.header[t.toLowerCase()]},n.prototype._setHeaderProperties=function(t){var e=t["content-type"]||"";this.type=o.type(e);var r,n=o.params(e);for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(this[r]=n[r]);this.links={};try{t.link&&(this.links=o.parseLinks(t.link))}catch(t){}},n.prototype._setStatusProperties=function(t){var e=t/100|0;this.statusCode=t,this.status=this.statusCode,this.statusType=e,this.info=1==e,this.ok=2==e,this.redirect=3==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.created=201===t,this.accepted=202===t,this.noContent=204===t,this.badRequest=400===t,this.unauthorized=401===t,this.notAcceptable=406===t,this.forbidden=403===t,this.notFound=404===t,this.unprocessableEntity=422===t}},{"./utils":13}],13:[function(t,e,r){"use strict";function a(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return u(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(r="Object"===r&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,e=function(){};return{s:e,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return i=t.done,t},e:function(t){s=!0,o=t},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}r.type=function(t){return t.split(/ *; */).shift()},r.params=function(t){var e,r={},n=a(t.split(/ *; */));try{for(n.s();!(e=n.n()).done;){var o=e.value.split(/ *= */),i=o.shift(),s=o.shift();i&&s&&(r[i]=s)}}catch(t){n.e(t)}finally{n.f()}return r},r.parseLinks=function(t){var e,r={},n=a(t.split(/ *, */));try{for(n.s();!(e=n.n()).done;){var o=e.value.split(/ *; */),i=o[0].slice(1,-1);r[o[1].split(/ *= */)[1].slice(1,-1)]=i}}catch(t){n.e(t)}finally{n.f()}return r},r.cleanHeader=function(t,e){return delete t["content-type"],delete t["content-length"],delete t["transfer-encoding"],delete t.host,e&&(delete t.authorization,delete t.cookie),t}},{}]},{},[10])(10)}),function(){var j=superagent,L=superagentLegacyIESupportPlugin,F="36.4",M="1",q="https://test.masterpassturkiye.com/MasterpassJsonServerHandler/v2",U="",H=new RSAKey;H.setPublic("F619C53A37BAB059C583DA9AC4E2920FFC9D57E00885E82F7A0863DEAC43CE06374E45A1417DAC907C6CAC0AF1DDF1D7152192FED7A1D9255C97BC27E420E0742B95ED3C53C62995F42CB6EEDB7B1FBDD3E4F4A4AA935650DA81E763CA7074690032F6A6AF72802CC50394C2AFA5C9450A990E6F969A38571C8BC9E381125D2BEEC348AF919D7374FF10DC3E0B4367566CE929AD6EA323A475A677EB41C20B42D44E82E8A53DD52334D927394FCADF09","03"),this.MFS=function(){function o(t,e,r){for(var n=r.length-1;0<=n;n--){var o=r[n];e[o]=k(t,o)}e.fp=U,e.additionalParams=u}function i(t,e,n){t.clientId=s;var r=(r=(new Date).toJSON()).replace(/"/g,"");t.dateTime=r,t.version=F,t.clientType=M,j.post(q+e).use(L).send(JSON.stringify(t)).end(function(t,e){var r=null;try{r=x(e)}catch(t){}n(e.status,r)})}var s,a,u,c,n=["actionType","clientIp","delinkReason","eActionType","cardTypeFlag","cpinFlag","defaultAccount","mmrpConfig","identityVerificationFlag","mobileAccountConfig","msisdn","referenceNo","sendSms","sendSmsLanguage","timeZone","uiChannelType","rtaPan","expiryDate","accountAliasName","cvc","homeAddress","homeCity","homeState","homeCountryCode","homePostalCode","firstName","lastName","email","cardHolderName","token"],l=["msisdn","referenceNo","sendSms","sendSmsLanguage","accountAliasName","token"],p=["validationCode","sendSms","sendSmsLanguage","referenceNo","token"],f=["aav","amount","clientIp","encCPin","encPassword","listAccountName","msisdn","password","referenceNo","sendSms","sendSmsLanguage","sendSmsMerchant","userId","token","rewardName","rewardValue","moneyCardInvoiceAmount","moneyCardMigrosDiscountAmount","moneyCardPaymentAmount","moneyCardExtraDiscountAmount","moneyCardProductBasedDiscountAmount","installmentCount","cvc","macroMerchantId","orderNo","paymentType"],h=["msisdn","encPan","token","referenceNo","sendSms","sendSmsLanguage","cvv"],d=["userId","token","referenceNo","sendSms","sendSmsLanguage"],y=["msisdn","cardAliasName","token","referenceNo","sendSms","sendSmsLanguage"],m=["msisdn","cardAliasName","token","referenceNo","sendSms","sendSmsLanguage"],g=["token","msisdn","sendSmsLanguage","fP","amount","expiryDate","rtaPan","cardHolderName","cvc","macroMerchantId","orderNo","paymentType","installmentCount","rewardName","rewardValue"],b=["sendSmsLanguage","msisdn","token","cardAliasName","fP","referenceNo","sendSms"],v=["token","msisdn","oldValue","theNewValue","valueType","sendSmsLanguage","fP","referenceNo","sendSms"],T=["token","msisdn","sendSmsLanguage","fP","referenceNo","sendSms"],_=["msisdn","accountAliasName","token","referenceNo","sendSms","sendSmsLanguage","fP","amount","actionType","firstName","lastName","gender","expiryDate","rtaPan","cardHolderName","orderNo","merchantId","rewardName","rewardValue","moneyCardInvoiceAmount","moneyCardMigrosDiscountAmount","moneyCardPaymentAmount","moneyCardExtraDiscountAmount","moneyCardProductBasedDiscountAmount","installmentCount","cvc","macroMerchantId","orderNo","paymentType"],S=["msisdn","token","referenceNo","sendSms","sendSmsLanguage"],w=["msisdn","token","listAccountName","amount","endDate","actionType","referenceNo","sendSms","sendSmsLanguage","productId"],D=["aav","amount","clientIp","encCPin","encPassword","moneySendType","senderAliasName","recipientAliasName","msisdn","password","referenceNo","sendSms","sendSmsLanguage","sendSmsMerchant","userId","token","rewardName","rewardValue","moneyCardInvoiceAmount","installmentCount","cvc","macroMerchantId","orderNo","paymentType"],A=["language","referenceNo","cvc","pan","client_token","action_type","token"],C=["msisdn","token","language","referenceNo","orderIds"],R=["referenceNo","language","msisdn","amount","client_token","fP","macroMerchantId","orderNo","basketInfo","campaignCode","loanBankIca","bankIca"],B=["referenceNo","language","token","fP","identityNumber","transactionType"],E=["referenceNo","language","token","fP","installmentId","installmentCount","loanType"],O=["referenceNo","language","token","fP","loanType","loanRrn"],I=!1,N=!1,P=(c=[0,2,4,6,8,1,3,5,7,9],function(t){for(var e,r=t.length,n=1,o=0;r;)e=parseInt(t.charAt(--r),10),o+=(n^=1)?c[e]:e;return o&&o%10==0}),k=function(t,e){for(var r=t.find("input"),n=r.length-1;0<=n;n--){var o=r[n].getAttribute("type");if(r[n].getAttribute("name")==e){if("cardAliasName"==e||"accountAliasName"==e||"cardHolderName"==e||"listAccountName"==e||"productId"==e||"senderAliasName"==e||"recipientAliasName"==e)return encodeURIComponent(r[n].value);if("validationCode"==e){if(I)return H.encrypt(r[n].value);if(N){var i=r[n].value.replace(".","").replace(",","");return 3==i.length?i:i.concat("0")}}if("rtaPan"==e||"pan"==e)return P(r[n].value)?H.encrypt(r[n].value):"";if("cvv"==e||"cvc"==e)return 3!=r[n].value.length&&4!=r[n].value.length?"":H.encrypt(r[n].value);if("installmentCount"==e&&""!==r[n].value&&!isNaN(r[n].value))return parseFloat(r[n].value);if("checkbox"==o||"radio"==o)if(!r[n].checked)continue;return r[n].value}}return null},x=function(t){var e=JSON.parse(t.text||{}),r={};if(e.hasOwnProperty("Data")){r.referenceNo=e.Data.Body.Fault.Detail.ServiceFaultDetail.RefNo,r.responseCode=e.Data.Body.Fault.Detail.ServiceFaultDetail.ResponseCode,r.responseDescription=e.Data.Body.Fault.Detail.ServiceFaultDetail.ResponseDesc,r.url3D=e.Data.Body.Fault.Detail.ServiceFaultDetail.Url3D,r.url3DSuccess=e.Data.Body.Fault.Detail.ServiceFaultDetail.Url3DSuccess,r.url3DError=e.Data.Body.Fault.Detail.ServiceFaultDetail.Url3DError,r.urlLoan=e.Data.Body.Fault.Detail.ServiceFaultDetail.UrlLoan,r.urlLoanSuccess=e.Data.Body.Fault.Detail.ServiceFaultDetail.UrlLoanSuccess,r.urlLoanError=e.Data.Body.Fault.Detail.ServiceFaultDetail.UrlLoanError,r.newMsisdn=e.Data.Body.Fault.Detail.ServiceFaultDetail.NewMsisdn,r.internalResponseCode=e.Data.Body.Fault.Detail.ServiceFaultDetail.InternalResponseCode,r.internalResponseDescription=e.Data.Body.Fault.Detail.ServiceFaultDetail.InternalResponseMessage;var n=e.Data.Body.Fault.Detail.ServiceFaultDetail.Token,o="";if(e.Data.Body.hasOwnProperty("Response")){o=e.Data.Body.Response.Result.TransactionBody.Token,r.token=o;t="";e.Data.Body.Response.Result.TransactionBody.hasOwnProperty("RefNo")&&""!==e.Data.Body.Response.Result.TransactionBody.RefNo&&(t=e.Data.Body.Response.Result.TransactionBody.RefNo),e.Data.Body.Fault.Detail.ServiceFaultDetail.hasOwnProperty("RefNo")&&""!==e.Data.Body.Fault.Detail.ServiceFaultDetail.RefNo&&(t=e.Data.Body.Fault.Detail.ServiceFaultDetail.RefNo),r.transactionId=t;t="";e.Data.Body.Response.Result.TransactionBody.hasOwnProperty("CardUniqueId")&&""!==e.Data.Body.Response.Result.TransactionBody.CardUniqueId&&(t=e.Data.Body.Response.Result.TransactionBody.CardUniqueId),r.cardUniqueId=t,e.Data.Body.Response.Result.TransactionBody.hasOwnProperty("AccountList")&&""!==e.Data.Body.Response.Result.TransactionBody.AccountList&&(r.AccountList=e.Data.Body.Response.Result.TransactionBody.AccountList);t=e.Data.Body.Response.Result.TransactionBody.ListItems;try{t&&0!==t.ListItem&&(r.cards=t.ListItem)}catch(t){}try{t&&0!==t.BankList&&(r.banks=t.BankList)}catch(t){}r.accountStatus=e.Data.Body.Response.Result.TransactionBody.AccountStatus,r.amount=e.Data.Body.Response.Result.TransactionBody.Amount,r.orderNo=e.Data.Body.Response.Result.TransactionBody.OrderNo,r.installmentCount=e.Data.Body.Response.Result.TransactionBody.InstallmentCount}n&&0!==n.length?a=n:r.token=o}return r};return{setClientId:function(t){s=t},listCards:function(t,e,r){var n={};n.msisdn=t,n.token=e,n.referenceNo="00000000",n.listType="ACCOUNT",n.sendSms="Y",n.clientIp="",n.sendSmsLanguage="eng",i(n,"/listManagement",r)},register:function(t,e){var r={};o(t,r,n),i(r,"/register",e)},purchase:function(t,e){var r={};o(t,r,f),i(r,"/remotePurchaseOther",e)},commit:function(t){var e={referenceNo:"00000000",sendSms:"N",sendSmsLanguage:"eng"};e.token=t,i(e,"/commitTransaction",function(){})},deleteCard:function(t,e){var r={};o(t,r,l),i(r,"/deleteCard",e)},validateTransaction:function(t,e){var r=t.find("input[name^='pinType']")[0];I="mpin"==r.value||"cvv"==r.value,"rta"==r.value&&(N=!0);r={};r.validationRefNo=a,o(t,r,p),i(r,"/validateTransaction",e)},forgotPassword:function(t,e){var r={};o(t,r,h),i(r,"/forgotPassword",e)},setAddress:function(t){q=t},checkMasterPass:function(t,e){var r={};o(t,r,d),i(r,"/checkMasterPassEndUser",e)},linkCardToClient:function(t,e){var r={};o(t,r,m),i(r,"/linkCardToClient",e)},addCardToMasterPass:function(t,e){var r={};o(t,r,y),i(r,"/addCardToMasterPass",e)},purchaseAndRegister:function(t,e){var r={};r.validationRefNo=a,o(t,r,_),i(r,"/purchaseAndRegister",e)},directPurchase:function(t,e){var r={};o(t,r,g),i(r,"/directPurchase",e)},resendOtp:function(t,e,r){var n={};n.validationRefNo=t,n.referenceNo="00000000",n.sendSms="N",n.sendSmsLanguage=e,i(n,"/resendOtp",r)},completeRegistration:function(t,e,r){var n={};n.token2=e,o(t,n,b),i(n,"/completeRegistration",r)},setFingerprint:function(t){U=t},setToken:function(t){a=t},getLastToken:function(){return a},updateUser:function(t,e){var r={};o(t,r,v),i(r,"/updateUser",e)},verifyPin:function(t,e){var r={};o(t,r,T),i(r,"/verifyPin",e)},parseQrCode:function(t,e){var r={};o(t,r,S),i(r,"/QrPaymentVerify",e)},initiateRecurringPayment:function(t,e){var r={};o(t,r,w),i(r,"/initiateManageRecurringPayment",e)},setAdditionalParameters:function(t){u=t},moneySend:function(t,e){var r={};o(t,r,D),i(r,"/initiateMoneySend",e)},getCardUniqueId:function(t,e,r){var n={};P(t)?n.rtaPan=H.encrypt(t):n.rtaPan="",n.token=e,n.referenceNo="00000000",n.sendSms="N",n.clientIp="",n.sendSmsLanguage="eng",i(n,"/getCardUniqueId",r)},listCardAccounts:function(t,e){var r={};o(t,r,A),i(r,"/ListAccountByCardOwner ",e)},deleteCardAccount:function(t,e){var r={};o(t,r,C),i(r,"/deletecardbycardowner",e)},getDigitalLoanUrl:function(t,e){var r={};o(t,r,R),i(r,"/digitalLoanUrl",e)},initiateTcknValidation:function(t,e){var r={};o(t,r,B),i(r,"/initiateTcknValidation",e)},completeLoan:function(t,e){var r={};o(t,r,E),i(r,"/completeLoan",e)},initiateLoanPayment:function(t,e){var r={};o(t,r,O),i(r,"/initiateLoanPayment",e)}}}()}.call(this);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* Zepto v1.2.0 - zepto event ajax form ie - zeptojs.com/license */
|
|
2
|
+
!function(t,e){"function"==typeof define&&define.amd?define(function(){return e(t)}):e(t)}(this,function(t){var e=function(){function $(t){return null==t?String(t):S[C.call(t)]||"object"}function F(t){return"function"==$(t)}function k(t){return null!=t&&t==t.window}function M(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function R(t){return"object"==$(t)}function Z(t){return R(t)&&!k(t)&&Object.getPrototypeOf(t)==Object.prototype}function z(t){var e=!!t&&"length"in t&&t.length,n=r.type(t);return"function"!=n&&!k(t)&&("array"==n||0===e||"number"==typeof e&&e>0&&e-1 in t)}function q(t){return a.call(t,function(t){return null!=t})}function H(t){return t.length>0?r.fn.concat.apply([],t):t}function I(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function V(t){return t in l?l[t]:l[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function _(t,e){return"number"!=typeof e||h[I(t)]?e:e+"px"}function B(t){var e,n;return c[t]||(e=f.createElement(t),f.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),c[t]=n),c[t]}function U(t){return"children"in t?u.call(t.children):r.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function X(t,e){var n,r=t?t.length:0;for(n=0;r>n;n++)this[n]=t[n];this.length=r,this.selector=e||""}function J(t,r,i){for(n in r)i&&(Z(r[n])||L(r[n]))?(Z(r[n])&&!Z(t[n])&&(t[n]={}),L(r[n])&&!L(t[n])&&(t[n]=[]),J(t[n],r[n],i)):r[n]!==e&&(t[n]=r[n])}function W(t,e){return null==e?r(t):r(t).filter(e)}function Y(t,e,n,r){return F(e)?e.call(t,n,r):e}function G(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function K(t,n){var r=t.className||"",i=r&&r.baseVal!==e;return n===e?i?r.baseVal:r:void(i?r.baseVal=n:t.className=n)}function Q(t){try{return t?"true"==t||("false"==t?!1:"null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?r.parseJSON(t):t):t}catch(e){return t}}function tt(t,e){e(t);for(var n=0,r=t.childNodes.length;r>n;n++)tt(t.childNodes[n],e)}var e,n,r,i,O,P,o=[],s=o.concat,a=o.filter,u=o.slice,f=t.document,c={},l={},h={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},p=/^\s*<(\w+|!)[^>]*>/,d=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,m=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,g=/^(?:body|html)$/i,v=/([A-Z])/g,y=["val","css","html","text","data","width","height","offset"],x=["after","prepend","before","append"],b=f.createElement("table"),E=f.createElement("tr"),j={tr:f.createElement("tbody"),tbody:b,thead:b,tfoot:b,td:E,th:E,"*":f.createElement("div")},w=/complete|loaded|interactive/,T=/^[\w-]*$/,S={},C=S.toString,N={},A=f.createElement("div"),D={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},L=Array.isArray||function(t){return t instanceof Array};return N.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var r,i=t.parentNode,o=!i;return o&&(i=A).appendChild(t),r=~N.qsa(i,e).indexOf(t),o&&A.removeChild(t),r},O=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},P=function(t){return a.call(t,function(e,n){return t.indexOf(e)==n})},N.fragment=function(t,n,i){var o,s,a;return d.test(t)&&(o=r(f.createElement(RegExp.$1))),o||(t.replace&&(t=t.replace(m,"<$1></$2>")),n===e&&(n=p.test(t)&&RegExp.$1),n in j||(n="*"),a=j[n],a.innerHTML=""+t,o=r.each(u.call(a.childNodes),function(){a.removeChild(this)})),Z(i)&&(s=r(o),r.each(i,function(t,e){y.indexOf(t)>-1?s[t](e):s.attr(t,e)})),o},N.Z=function(t,e){return new X(t,e)},N.isZ=function(t){return t instanceof N.Z},N.init=function(t,n){var i;if(!t)return N.Z();if("string"==typeof t)if(t=t.trim(),"<"==t[0]&&p.test(t))i=N.fragment(t,RegExp.$1,n),t=null;else{if(n!==e)return r(n).find(t);i=N.qsa(f,t)}else{if(F(t))return r(f).ready(t);if(N.isZ(t))return t;if(L(t))i=q(t);else if(R(t))i=[t],t=null;else if(p.test(t))i=N.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==e)return r(n).find(t);i=N.qsa(f,t)}}return N.Z(i,t)},r=function(t,e){return N.init(t,e)},r.extend=function(t){var e,n=u.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){J(t,n,e)}),t},N.qsa=function(t,e){var n,r="#"==e[0],i=!r&&"."==e[0],o=r||i?e.slice(1):e,s=T.test(o);return t.getElementById&&s&&r?(n=t.getElementById(o))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:u.call(s&&!r&&t.getElementsByClassName?i?t.getElementsByClassName(o):t.getElementsByTagName(e):t.querySelectorAll(e))},r.contains=f.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},r.type=$,r.isFunction=F,r.isWindow=k,r.isArray=L,r.isPlainObject=Z,r.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},r.isNumeric=function(t){var e=Number(t),n=typeof t;return null!=t&&"boolean"!=n&&("string"!=n||t.length)&&!isNaN(e)&&isFinite(e)||!1},r.inArray=function(t,e,n){return o.indexOf.call(e,t,n)},r.camelCase=O,r.trim=function(t){return null==t?"":String.prototype.trim.call(t)},r.uuid=0,r.support={},r.expr={},r.noop=function(){},r.map=function(t,e){var n,i,o,r=[];if(z(t))for(i=0;i<t.length;i++)n=e(t[i],i),null!=n&&r.push(n);else for(o in t)n=e(t[o],o),null!=n&&r.push(n);return H(r)},r.each=function(t,e){var n,r;if(z(t)){for(n=0;n<t.length;n++)if(e.call(t[n],n,t[n])===!1)return t}else for(r in t)if(e.call(t[r],r,t[r])===!1)return t;return t},r.grep=function(t,e){return a.call(t,e)},t.JSON&&(r.parseJSON=JSON.parse),r.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(t,e){S["[object "+e+"]"]=e.toLowerCase()}),r.fn={constructor:N.Z,length:0,forEach:o.forEach,reduce:o.reduce,push:o.push,sort:o.sort,splice:o.splice,indexOf:o.indexOf,concat:function(){var t,e,n=[];for(t=0;t<arguments.length;t++)e=arguments[t],n[t]=N.isZ(e)?e.toArray():e;return s.apply(N.isZ(this)?this.toArray():this,n)},map:function(t){return r(r.map(this,function(e,n){return t.call(e,n,e)}))},slice:function(){return r(u.apply(this,arguments))},ready:function(t){return w.test(f.readyState)&&f.body?t(r):f.addEventListener("DOMContentLoaded",function(){t(r)},!1),this},get:function(t){return t===e?u.call(this):this[t>=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return o.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return F(t)?this.not(this.not(t)):r(a.call(this,function(e){return N.matches(e,t)}))},add:function(t,e){return r(P(this.concat(r(t,e))))},is:function(t){return this.length>0&&N.matches(this[0],t)},not:function(t){var n=[];if(F(t)&&t.call!==e)this.each(function(e){t.call(this,e)||n.push(this)});else{var i="string"==typeof t?this.filter(t):z(t)&&F(t.item)?u.call(t):r(t);this.forEach(function(t){i.indexOf(t)<0&&n.push(t)})}return r(n)},has:function(t){return this.filter(function(){return R(t)?r.contains(this,t):r(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!R(t)?t:r(t)},last:function(){var t=this[this.length-1];return t&&!R(t)?t:r(t)},find:function(t){var e,n=this;return e=t?"object"==typeof t?r(t).filter(function(){var t=this;return o.some.call(n,function(e){return r.contains(e,t)})}):1==this.length?r(N.qsa(this[0],t)):this.map(function(){return N.qsa(this,t)}):r()},closest:function(t,e){var n=[],i="object"==typeof t&&r(t);return this.each(function(r,o){for(;o&&!(i?i.indexOf(o)>=0:N.matches(o,t));)o=o!==e&&!M(o)&&o.parentNode;o&&n.indexOf(o)<0&&n.push(o)}),r(n)},parents:function(t){for(var e=[],n=this;n.length>0;)n=r.map(n,function(t){return(t=t.parentNode)&&!M(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return W(e,t)},parent:function(t){return W(P(this.pluck("parentNode")),t)},children:function(t){return W(this.map(function(){return U(this)}),t)},contents:function(){return this.map(function(){return this.contentDocument||u.call(this.childNodes)})},siblings:function(t){return W(this.map(function(t,e){return a.call(U(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return r.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=B(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=F(t);if(this[0]&&!e)var n=r(t).get(0),i=n.parentNode||this.length>1;return this.each(function(o){r(this).wrapAll(e?t.call(this,o):i?n.cloneNode(!0):n)})},wrapAll:function(t){if(this[0]){r(this[0]).before(t=r(t));for(var e;(e=t.children()).length;)t=e.first();r(t).append(this)}return this},wrapInner:function(t){var e=F(t);return this.each(function(n){var i=r(this),o=i.contents(),s=e?t.call(this,n):t;o.length?o.wrapAll(s):i.append(s)})},unwrap:function(){return this.parent().each(function(){r(this).replaceWith(r(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var n=r(this);(t===e?"none"==n.css("display"):t)?n.show():n.hide()})},prev:function(t){return r(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return r(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var n=this.innerHTML;r(this).empty().append(Y(this,t,e,n))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=Y(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this.pluck("textContent").join(""):null},attr:function(t,r){var i;return"string"!=typeof t||1 in arguments?this.each(function(e){if(1===this.nodeType)if(R(t))for(n in t)G(this,n,t[n]);else G(this,t,Y(this,r,e,this.getAttribute(t)))}):0 in this&&1==this[0].nodeType&&null!=(i=this[0].getAttribute(t))?i:e},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){G(this,t)},this)})},prop:function(t,e){return t=D[t]||t,1 in arguments?this.each(function(n){this[t]=Y(this,e,n,this[t])}):this[0]&&this[0][t]},removeProp:function(t){return t=D[t]||t,this.each(function(){delete this[t]})},data:function(t,n){var r="data-"+t.replace(v,"-$1").toLowerCase(),i=1 in arguments?this.attr(r,n):this.attr(r);return null!==i?Q(i):e},val:function(t){return 0 in arguments?(null==t&&(t=""),this.each(function(e){this.value=Y(this,t,e,this.value)})):this[0]&&(this[0].multiple?r(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(e){if(e)return this.each(function(t){var n=r(this),i=Y(this,e,t,n.offset()),o=n.offsetParent().offset(),s={top:i.top-o.top,left:i.left-o.left};"static"==n.css("position")&&(s.position="relative"),n.css(s)});if(!this.length)return null;if(f.documentElement!==this[0]&&!r.contains(f.documentElement,this[0]))return{top:0,left:0};var n=this[0].getBoundingClientRect();return{left:n.left+t.pageXOffset,top:n.top+t.pageYOffset,width:Math.round(n.width),height:Math.round(n.height)}},css:function(t,e){if(arguments.length<2){var i=this[0];if("string"==typeof t){if(!i)return;return i.style[O(t)]||getComputedStyle(i,"").getPropertyValue(t)}if(L(t)){if(!i)return;var o={},s=getComputedStyle(i,"");return r.each(t,function(t,e){o[e]=i.style[O(e)]||s.getPropertyValue(e)}),o}}var a="";if("string"==$(t))e||0===e?a=I(t)+":"+_(t,e):this.each(function(){this.style.removeProperty(I(t))});else for(n in t)t[n]||0===t[n]?a+=I(n)+":"+_(n,t[n])+";":this.each(function(){this.style.removeProperty(I(n))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(r(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?o.some.call(this,function(t){return this.test(K(t))},V(t)):!1},addClass:function(t){return t?this.each(function(e){if("className"in this){i=[];var n=K(this),o=Y(this,t,e,n);o.split(/\s+/g).forEach(function(t){r(this).hasClass(t)||i.push(t)},this),i.length&&K(this,n+(n?" ":"")+i.join(" "))}}):this},removeClass:function(t){return this.each(function(n){if("className"in this){if(t===e)return K(this,"");i=K(this),Y(this,t,n,i).split(/\s+/g).forEach(function(t){i=i.replace(V(t)," ")}),K(this,i.trim())}})},toggleClass:function(t,n){return t?this.each(function(i){var o=r(this),s=Y(this,t,i,K(this));s.split(/\s+/g).forEach(function(t){(n===e?!o.hasClass(t):n)?o.addClass(t):o.removeClass(t)})}):this},scrollTop:function(t){if(this.length){var n="scrollTop"in this[0];return t===e?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var n="scrollLeft"in this[0];return t===e?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),i=g.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(r(t).css("margin-top"))||0,n.left-=parseFloat(r(t).css("margin-left"))||0,i.top+=parseFloat(r(e[0]).css("border-top-width"))||0,i.left+=parseFloat(r(e[0]).css("border-left-width"))||0,{top:n.top-i.top,left:n.left-i.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||f.body;t&&!g.test(t.nodeName)&&"static"==r(t).css("position");)t=t.offsetParent;return t})}},r.fn.detach=r.fn.remove,["width","height"].forEach(function(t){var n=t.replace(/./,function(t){return t[0].toUpperCase()});r.fn[t]=function(i){var o,s=this[0];return i===e?k(s)?s["inner"+n]:M(s)?s.documentElement["scroll"+n]:(o=this.offset())&&o[t]:this.each(function(e){s=r(this),s.css(t,Y(this,i,e,s[t]()))})}}),x.forEach(function(n,i){var o=i%2;r.fn[n]=function(){var n,a,s=r.map(arguments,function(t){var i=[];return n=$(t),"array"==n?(t.forEach(function(t){return t.nodeType!==e?i.push(t):r.zepto.isZ(t)?i=i.concat(t.get()):void(i=i.concat(N.fragment(t)))}),i):"object"==n||null==t?t:N.fragment(t)}),u=this.length>1;return s.length<1?this:this.each(function(e,n){a=o?n:n.parentNode,n=0==i?n.nextSibling:1==i?n.firstChild:2==i?n:null;var c=r.contains(f.documentElement,a);s.forEach(function(e){if(u)e=e.cloneNode(!0);else if(!a)return r(e).remove();a.insertBefore(e,n),c&&tt(e,function(e){if(!(null==e.nodeName||"SCRIPT"!==e.nodeName.toUpperCase()||e.type&&"text/javascript"!==e.type||e.src)){var n=e.ownerDocument?e.ownerDocument.defaultView:t;n.eval.call(n,e.innerHTML)}})})})},r.fn[o?n+"To":"insert"+(i?"Before":"After")]=function(t){return r(t)[n](this),this}}),N.Z.prototype=X.prototype=r.fn,N.uniq=P,N.deserializeValue=Q,r.zepto=N,r}();return t.Zepto=e,void 0===t.$&&(t.$=e),function(e){function h(t){return t._zid||(t._zid=n++)}function p(t,e,n,r){if(e=d(e),e.ns)var i=m(e.ns);return(a[h(t)]||[]).filter(function(t){return t&&(!e.e||t.e==e.e)&&(!e.ns||i.test(t.ns))&&(!n||h(t.fn)===h(n))&&(!r||t.sel==r)})}function d(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function m(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function g(t,e){return t.del&&!f&&t.e in c||!!e}function v(t){return l[t]||f&&c[t]||t}function y(t,n,i,o,s,u,f){var c=h(t),p=a[c]||(a[c]=[]);n.split(/\s/).forEach(function(n){if("ready"==n)return e(document).ready(i);var a=d(n);a.fn=i,a.sel=s,a.e in l&&(i=function(t){var n=t.relatedTarget;return!n||n!==this&&!e.contains(this,n)?a.fn.apply(this,arguments):void 0}),a.del=u;var c=u||i;a.proxy=function(e){if(e=T(e),!e.isImmediatePropagationStopped()){e.data=o;var n=c.apply(t,e._args==r?[e]:[e].concat(e._args));return n===!1&&(e.preventDefault(),e.stopPropagation()),n}},a.i=p.length,p.push(a),"addEventListener"in t&&t.addEventListener(v(a.e),a.proxy,g(a,f))})}function x(t,e,n,r,i){var o=h(t);(e||"").split(/\s/).forEach(function(e){p(t,e,n,r).forEach(function(e){delete a[o][e.i],"removeEventListener"in t&&t.removeEventListener(v(e.e),e.proxy,g(e,i))})})}function T(t,n){return(n||!t.isDefaultPrevented)&&(n||(n=t),e.each(w,function(e,r){var i=n[e];t[e]=function(){return this[r]=b,i&&i.apply(n,arguments)},t[r]=E}),t.timeStamp||(t.timeStamp=Date.now()),(n.defaultPrevented!==r?n.defaultPrevented:"returnValue"in n?n.returnValue===!1:n.getPreventDefault&&n.getPreventDefault())&&(t.isDefaultPrevented=b)),t}function S(t){var e,n={originalEvent:t};for(e in t)j.test(e)||t[e]===r||(n[e]=t[e]);return T(n,t)}var r,n=1,i=Array.prototype.slice,o=e.isFunction,s=function(t){return"string"==typeof t},a={},u={},f="onfocusin"in t,c={focus:"focusin",blur:"focusout"},l={mouseenter:"mouseover",mouseleave:"mouseout"};u.click=u.mousedown=u.mouseup=u.mousemove="MouseEvents",e.event={add:y,remove:x},e.proxy=function(t,n){var r=2 in arguments&&i.call(arguments,2);if(o(t)){var a=function(){return t.apply(n,r?r.concat(i.call(arguments)):arguments)};return a._zid=h(t),a}if(s(n))return r?(r.unshift(t[n],t),e.proxy.apply(null,r)):e.proxy(t[n],t);throw new TypeError("expected function")},e.fn.bind=function(t,e,n){return this.on(t,e,n)},e.fn.unbind=function(t,e){return this.off(t,e)},e.fn.one=function(t,e,n,r){return this.on(t,e,n,r,1)};var b=function(){return!0},E=function(){return!1},j=/^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/,w={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};e.fn.delegate=function(t,e,n){return this.on(e,t,n)},e.fn.undelegate=function(t,e,n){return this.off(e,t,n)},e.fn.live=function(t,n){return e(document.body).delegate(this.selector,t,n),this},e.fn.die=function(t,n){return e(document.body).undelegate(this.selector,t,n),this},e.fn.on=function(t,n,a,u,f){var c,l,h=this;return t&&!s(t)?(e.each(t,function(t,e){h.on(t,n,a,e,f)}),h):(s(n)||o(u)||u===!1||(u=a,a=n,n=r),(u===r||a===!1)&&(u=a,a=r),u===!1&&(u=E),h.each(function(r,o){f&&(c=function(t){return x(o,t.type,u),u.apply(this,arguments)}),n&&(l=function(t){var r,s=e(t.target).closest(n,o).get(0);return s&&s!==o?(r=e.extend(S(t),{currentTarget:s,liveFired:o}),(c||u).apply(s,[r].concat(i.call(arguments,1)))):void 0}),y(o,t,u,a,n,l||c)}))},e.fn.off=function(t,n,i){var a=this;return t&&!s(t)?(e.each(t,function(t,e){a.off(t,n,e)}),a):(s(n)||o(i)||i===!1||(i=n,n=r),i===!1&&(i=E),a.each(function(){x(this,t,i,n)}))},e.fn.trigger=function(t,n){return t=s(t)||e.isPlainObject(t)?e.Event(t):T(t),t._args=n,this.each(function(){t.type in c&&"function"==typeof this[t.type]?this[t.type]():"dispatchEvent"in this?this.dispatchEvent(t):e(this).triggerHandler(t,n)})},e.fn.triggerHandler=function(t,n){var r,i;return this.each(function(o,a){r=S(s(t)?e.Event(t):t),r._args=n,r.target=a,e.each(p(a,t.type||t),function(t,e){return i=e.proxy(r),r.isImmediatePropagationStopped()?!1:void 0})}),i},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(t){e.fn[t]=function(e){return 0 in arguments?this.bind(t,e):this.trigger(t)}}),e.Event=function(t,e){s(t)||(e=t,t=e.type);var n=document.createEvent(u[t]||"Events"),r=!0;if(e)for(var i in e)"bubbles"==i?r=!!e[i]:n[i]=e[i];return n.initEvent(t,r,!0),T(n)}}(e),function(e){function p(t,n,r){var i=e.Event(n);return e(t).trigger(i,r),!i.isDefaultPrevented()}function d(t,e,n,i){return t.global?p(e||r,n,i):void 0}function m(t){t.global&&0===e.active++&&d(t,null,"ajaxStart")}function g(t){t.global&&!--e.active&&d(t,null,"ajaxStop")}function v(t,e){var n=e.context;return e.beforeSend.call(n,t,e)===!1||d(e,n,"ajaxBeforeSend",[t,e])===!1?!1:void d(e,n,"ajaxSend",[t,e])}function y(t,e,n,r){var i=n.context,o="success";n.success.call(i,t,o,e),r&&r.resolveWith(i,[t,o,e]),d(n,i,"ajaxSuccess",[e,n,t]),b(o,e,n)}function x(t,e,n,r,i){var o=r.context;r.error.call(o,n,e,t),i&&i.rejectWith(o,[n,e,t]),d(r,o,"ajaxError",[n,r,t||e]),b(e,n,r)}function b(t,e,n){var r=n.context;n.complete.call(r,e,t),d(n,r,"ajaxComplete",[e,n]),g(n)}function E(t,e,n){if(n.dataFilter==j)return t;var r=n.context;return n.dataFilter.call(r,t,e)}function j(){}function w(t){return t&&(t=t.split(";",2)[0]),t&&(t==c?"html":t==f?"json":a.test(t)?"script":u.test(t)&&"xml")||"text"}function T(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function S(t){t.processData&&t.data&&"string"!=e.type(t.data)&&(t.data=e.param(t.data,t.traditional)),!t.data||t.type&&"GET"!=t.type.toUpperCase()&&"jsonp"!=t.dataType||(t.url=T(t.url,t.data),t.data=void 0)}function C(t,n,r,i){return e.isFunction(n)&&(i=r,r=n,n=void 0),e.isFunction(r)||(i=r,r=void 0),{url:t,data:n,success:r,dataType:i}}function O(t,n,r,i){var o,s=e.isArray(n),a=e.isPlainObject(n);e.each(n,function(n,u){o=e.type(u),i&&(n=r?i:i+"["+(a||"object"==o||"array"==o?n:"")+"]"),!i&&s?t.add(u.name,u.value):"array"==o||!r&&"object"==o?O(t,u,r,n):t.add(n,u)})}var i,o,n=+new Date,r=t.document,s=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,a=/^(?:text|application)\/javascript/i,u=/^(?:text|application)\/xml/i,f="application/json",c="text/html",l=/^\s*$/,h=r.createElement("a");h.href=t.location.href,e.active=0,e.ajaxJSONP=function(i,o){if(!("type"in i))return e.ajax(i);var c,p,s=i.jsonpCallback,a=(e.isFunction(s)?s():s)||"Zepto"+n++,u=r.createElement("script"),f=t[a],l=function(t){e(u).triggerHandler("error",t||"abort")},h={abort:l};return o&&o.promise(h),e(u).on("load error",function(n,r){clearTimeout(p),e(u).off().remove(),"error"!=n.type&&c?y(c[0],h,i,o):x(null,r||"error",h,i,o),t[a]=f,c&&e.isFunction(f)&&f(c[0]),f=c=void 0}),v(h,i)===!1?(l("abort"),h):(t[a]=function(){c=arguments},u.src=i.url.replace(/\?(.+)=\?/,"?$1="+a),r.head.appendChild(u),i.timeout>0&&(p=setTimeout(function(){l("timeout")},i.timeout)),h)},e.ajaxSettings={type:"GET",beforeSend:j,success:j,error:j,complete:j,context:null,global:!0,xhr:function(){return new t.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:f,xml:"application/xml, text/xml",html:c,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0,dataFilter:j},e.ajax=function(n){var u,f,s=e.extend({},n||{}),a=e.Deferred&&e.Deferred();for(i in e.ajaxSettings)void 0===s[i]&&(s[i]=e.ajaxSettings[i]);m(s),s.crossDomain||(u=r.createElement("a"),u.href=s.url,u.href=u.href,s.crossDomain=h.protocol+"//"+h.host!=u.protocol+"//"+u.host),s.url||(s.url=t.location.toString()),(f=s.url.indexOf("#"))>-1&&(s.url=s.url.slice(0,f)),S(s);var c=s.dataType,p=/\?.+=\?/.test(s.url);if(p&&(c="jsonp"),s.cache!==!1&&(n&&n.cache===!0||"script"!=c&&"jsonp"!=c)||(s.url=T(s.url,"_="+Date.now())),"jsonp"==c)return p||(s.url=T(s.url,s.jsonp?s.jsonp+"=?":s.jsonp===!1?"":"callback=?")),e.ajaxJSONP(s,a);var P,d=s.accepts[c],g={},b=function(t,e){g[t.toLowerCase()]=[t,e]},C=/^([\w-]+:)\/\//.test(s.url)?RegExp.$1:t.location.protocol,N=s.xhr(),O=N.setRequestHeader;if(a&&a.promise(N),s.crossDomain||b("X-Requested-With","XMLHttpRequest"),b("Accept",d||"*/*"),(d=s.mimeType||d)&&(d.indexOf(",")>-1&&(d=d.split(",",2)[0]),N.overrideMimeType&&N.overrideMimeType(d)),(s.contentType||s.contentType!==!1&&s.data&&"GET"!=s.type.toUpperCase())&&b("Content-Type",s.contentType||"application/x-www-form-urlencoded"),s.headers)for(o in s.headers)b(o,s.headers[o]);if(N.setRequestHeader=b,N.onreadystatechange=function(){if(4==N.readyState){N.onreadystatechange=j,clearTimeout(P);var t,n=!1;if(N.status>=200&&N.status<300||304==N.status||0==N.status&&"file:"==C){if(c=c||w(s.mimeType||N.getResponseHeader("content-type")),"arraybuffer"==N.responseType||"blob"==N.responseType)t=N.response;else{t=N.responseText;try{t=E(t,c,s),"script"==c?(1,eval)(t):"xml"==c?t=N.responseXML:"json"==c&&(t=l.test(t)?null:e.parseJSON(t))}catch(r){n=r}if(n)return x(n,"parsererror",N,s,a)}y(t,N,s,a)}else x(N.statusText||null,N.status?"error":"abort",N,s,a)}},v(N,s)===!1)return N.abort(),x(null,"abort",N,s,a),N;var A="async"in s?s.async:!0;if(N.open(s.type,s.url,A,s.username,s.password),s.xhrFields)for(o in s.xhrFields)N[o]=s.xhrFields[o];for(o in g)O.apply(N,g[o]);return s.timeout>0&&(P=setTimeout(function(){N.onreadystatechange=j,N.abort(),x(null,"timeout",N,s,a)},s.timeout)),N.send(s.data?s.data:null),N},e.get=function(){return e.ajax(C.apply(null,arguments))},e.post=function(){var t=C.apply(null,arguments);return t.type="POST",e.ajax(t)},e.getJSON=function(){var t=C.apply(null,arguments);return t.dataType="json",e.ajax(t)},e.fn.load=function(t,n,r){if(!this.length)return this;var a,i=this,o=t.split(/\s/),u=C(t,n,r),f=u.success;return o.length>1&&(u.url=o[0],a=o[1]),u.success=function(t){i.html(a?e("<div>").html(t.replace(s,"")).find(a):t),f&&f.apply(i,arguments)},e.ajax(u),this};var N=encodeURIComponent;e.param=function(t,n){var r=[];return r.add=function(t,n){e.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(N(t)+"="+N(n))},O(r,t,n),r.join("&").replace(/%20/g,"+")}}(e),function(t){t.fn.serializeArray=function(){var e,n,r=[],i=function(t){return t.forEach?t.forEach(i):void r.push({name:e,value:t})};return this[0]&&t.each(this[0].elements,function(r,o){n=o.type,e=o.name,e&&"fieldset"!=o.nodeName.toLowerCase()&&!o.disabled&&"submit"!=n&&"reset"!=n&&"button"!=n&&"file"!=n&&("radio"!=n&&"checkbox"!=n||o.checked)&&i(t(o).val())}),r},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(0 in arguments)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(e),function(){try{getComputedStyle(void 0)}catch(e){var n=getComputedStyle;t.getComputedStyle=function(t,e){try{return n(t,e)}catch(r){return null}}}}(),e});
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@akinon/pz-masterpass",
|
|
3
|
+
"version": "1.19.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"main": "src/index.ts",
|
|
6
|
+
"types": "src/index.d.ts",
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"react": "^18.0.0",
|
|
9
|
+
"react-dom": "^18.0.0"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@types/node": "^18.7.8",
|
|
13
|
+
"@types/react": "^18.0.17",
|
|
14
|
+
"@types/react-dom": "^18.0.6",
|
|
15
|
+
"@types/jquery": "^3.5.16",
|
|
16
|
+
"typescript": "^4.7.4"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useAppDispatch, useAppSelector } from '@akinon/next/redux/hooks';
|
|
4
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
5
|
+
import { setCards, setIsDirectPurchase } from '../redux/reducer';
|
|
6
|
+
import { MasterpassStatus } from '../types';
|
|
7
|
+
import { getMasterpassCards } from '../utils/get-masterpass-cards';
|
|
8
|
+
|
|
9
|
+
interface UseCardsProps {
|
|
10
|
+
skipData?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const useCards = ({ skipData }: UseCardsProps = { skipData: true }) => {
|
|
14
|
+
const { msisdn, token, accountStatus, cards } = useAppSelector(
|
|
15
|
+
(state: any) => state.masterpass
|
|
16
|
+
);
|
|
17
|
+
const [loading, setLoading] = useState(false);
|
|
18
|
+
const [error, setError] = useState<string | null>(null);
|
|
19
|
+
const dispatch = useAppDispatch();
|
|
20
|
+
|
|
21
|
+
const fetchCards = useCallback(async () => {
|
|
22
|
+
setError(null);
|
|
23
|
+
|
|
24
|
+
if (!msisdn || !token) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
setLoading(true);
|
|
29
|
+
|
|
30
|
+
const { cards, description } = await getMasterpassCards({
|
|
31
|
+
msisdn: msisdn,
|
|
32
|
+
token: token
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (description) {
|
|
36
|
+
setError(description);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
setLoading(false);
|
|
40
|
+
dispatch(setCards(cards));
|
|
41
|
+
dispatch(setIsDirectPurchase(cards?.length === 0));
|
|
42
|
+
}, [msisdn, token]);
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (!skipData && accountStatus === MasterpassStatus.ListCards) {
|
|
46
|
+
fetchCards();
|
|
47
|
+
}
|
|
48
|
+
}, [accountStatus, skipData]);
|
|
49
|
+
|
|
50
|
+
return { cards, loading, refreshCards: fetchCards, error };
|
|
51
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
const useCountdown = (targetDate: Date) => {
|
|
4
|
+
const countDownDate = new Date(targetDate).getTime();
|
|
5
|
+
|
|
6
|
+
const [countDown, setCountDown] = useState(
|
|
7
|
+
countDownDate - new Date().getTime()
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const interval = setInterval(() => {
|
|
12
|
+
setCountDown(countDownDate - new Date().getTime());
|
|
13
|
+
}, 1000);
|
|
14
|
+
|
|
15
|
+
return () => clearInterval(interval);
|
|
16
|
+
}, [countDownDate]);
|
|
17
|
+
|
|
18
|
+
return getReturnValues(countDown);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const getReturnValues = (countDown: number) => {
|
|
22
|
+
const minutes = Math.floor((countDown % (1000 * 60 * 60)) / (1000 * 60));
|
|
23
|
+
const seconds = Math.floor((countDown % (1000 * 60)) / 1000);
|
|
24
|
+
|
|
25
|
+
return [minutes, seconds];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { useCountdown };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useAppDispatch, useAppSelector } from '@akinon/next/redux/hooks';
|
|
4
|
+
import { Icon } from 'components';
|
|
5
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
|
+
import {
|
|
7
|
+
setDeletionCardAliasName,
|
|
8
|
+
setDeletionModalVisible
|
|
9
|
+
} from '../redux/reducer';
|
|
10
|
+
import { CheckMasterpassResponse } from '../types';
|
|
11
|
+
import { formCreator } from '../utils';
|
|
12
|
+
import { useCards } from './use-cards';
|
|
13
|
+
|
|
14
|
+
export const useDeleteCard = () => {
|
|
15
|
+
const { msisdn, token, language, deletion } = useAppSelector(
|
|
16
|
+
(state: any) => state.masterpass
|
|
17
|
+
);
|
|
18
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
19
|
+
const [error, setError] = useState<string | null>(null);
|
|
20
|
+
const { refreshCards } = useCards();
|
|
21
|
+
const dispatch = useAppDispatch();
|
|
22
|
+
|
|
23
|
+
const deleteCard = useCallback(() => {
|
|
24
|
+
if (!msisdn || !token || !deletion.cardAliasName) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const fields = [
|
|
29
|
+
{
|
|
30
|
+
name: 'token',
|
|
31
|
+
value: token
|
|
32
|
+
},
|
|
33
|
+
{ name: 'userId', value: msisdn },
|
|
34
|
+
{ name: 'sendSmsLanguage', value: language },
|
|
35
|
+
{ name: 'sendSms', value: 'N' },
|
|
36
|
+
{ name: 'accountAliasName', value: deletion.cardAliasName },
|
|
37
|
+
{ name: 'msisdn', value: msisdn }
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
const form = formCreator({
|
|
41
|
+
id: 'remove-card-masterpass-form',
|
|
42
|
+
fields
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
setError(null);
|
|
46
|
+
setIsLoading(true);
|
|
47
|
+
|
|
48
|
+
window.MFS?.deleteCard($(form), (statusCode, response) => {
|
|
49
|
+
setIsLoading(false);
|
|
50
|
+
|
|
51
|
+
if (response.responseCode == '0000' || response.responseCode == '') {
|
|
52
|
+
dispatch(setDeletionModalVisible(false));
|
|
53
|
+
refreshCards();
|
|
54
|
+
} else {
|
|
55
|
+
setError(response.responseDescription);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}, [msisdn, token, deletion.cardAliasName]);
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (!deletion.isModalVisible) {
|
|
62
|
+
dispatch(setDeletionCardAliasName(undefined));
|
|
63
|
+
setError(null);
|
|
64
|
+
setIsLoading(false);
|
|
65
|
+
}
|
|
66
|
+
}, [deletion.isModalVisible]);
|
|
67
|
+
|
|
68
|
+
const DeleteButton = useMemo(
|
|
69
|
+
() =>
|
|
70
|
+
({ cardAliasName }: { cardAliasName: string }) => {
|
|
71
|
+
return (
|
|
72
|
+
<span
|
|
73
|
+
className="cursor-pointer p-1"
|
|
74
|
+
onClick={(event: React.MouseEvent<HTMLElement>) => {
|
|
75
|
+
event.stopPropagation();
|
|
76
|
+
dispatch(setDeletionModalVisible(true));
|
|
77
|
+
dispatch(setDeletionCardAliasName(cardAliasName));
|
|
78
|
+
}}
|
|
79
|
+
>
|
|
80
|
+
<Icon name="close" size={12} />
|
|
81
|
+
</span>
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
[]
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
return { DeleteButton, deleteCard, isLoading, error };
|
|
88
|
+
};
|
package/src/index.d.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MasterpassCardList } from './views/card-list';
|
|
2
|
+
import { MasterpassCardRegistration } from './views/card-registration';
|
|
3
|
+
import { MasterpassDeleteConfirmationModal } from './views/delete-confirmation-modal';
|
|
4
|
+
import { MasterpassOtpModal } from './views/otp-modal';
|
|
5
|
+
import { MasterpassLinkModal } from './views/link-modal';
|
|
6
|
+
import masterpassReducer from './redux/reducer';
|
|
7
|
+
|
|
8
|
+
export * from './masterpass-provider';
|
|
9
|
+
export * from './types';
|
|
10
|
+
export {
|
|
11
|
+
MasterpassCardList,
|
|
12
|
+
MasterpassCardRegistration,
|
|
13
|
+
MasterpassDeleteConfirmationModal,
|
|
14
|
+
MasterpassOtpModal,
|
|
15
|
+
MasterpassLinkModal,
|
|
16
|
+
masterpassReducer
|
|
17
|
+
};
|