@akinon/pz-masterpass-rest 1.111.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/CHANGELOG.md +8 -0
- package/README.md +96 -0
- package/package.json +36 -0
- package/src/assets/img/mp_amex.jpg +0 -0
- package/src/assets/img/mp_mastercard.png +0 -0
- package/src/assets/img/mp_masterpass-logo.png +0 -0
- package/src/assets/img/mp_other.png +0 -0
- package/src/assets/img/mp_troy.png +0 -0
- package/src/assets/img/mp_visa.png +0 -0
- package/src/assets/masterpass-javascript-sdk-web.min.js +1 -0
- package/src/components/card-list.tsx +192 -0
- package/src/components/confirmation-modal.tsx +65 -0
- package/src/components/credit-card-form.tsx +341 -0
- package/src/components/installment-list.tsx +177 -0
- package/src/components/link-modal.tsx +61 -0
- package/src/components/otp-modal.tsx +129 -0
- package/src/components/payment-method-selector.tsx +137 -0
- package/src/hooks/useMasterpassAccount.ts +393 -0
- package/src/hooks/useMasterpassPayment.ts +231 -0
- package/src/hooks/useMasterpassScript.ts +138 -0
- package/src/hooks/useMasterpassToken.ts +79 -0
- package/src/index.d.ts +84 -0
- package/src/index.ts +23 -0
- package/src/redux/api.ts +244 -0
- package/src/redux/reducer.ts +279 -0
- package/src/services/account.ts +109 -0
- package/src/services/payment.ts +131 -0
- package/src/services/verify.ts +39 -0
- package/src/types/account.types.ts +179 -0
- package/src/types/custom-render.types.ts +212 -0
- package/src/types/payment.types.ts +139 -0
- package/src/types/verify.types.ts +14 -0
- package/src/utils/card-utils.ts +121 -0
- package/src/utils/constants.ts +4 -0
- package/src/utils/masterpass-sdk.ts +31 -0
- package/src/utils/payment-constants.ts +31 -0
- package/src/utils/payment-utils.ts +100 -0
- package/src/utils/response-handler.ts +179 -0
- package/src/utils/validation-schemas.ts +93 -0
- package/src/views/masterpass-rest-option.tsx +756 -0
package/CHANGELOG.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Masterpass REST Plugin
|
|
2
|
+
|
|
3
|
+
A React component for integrating Masterpass REST payment functionality into your checkout flow.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Install the plugin using the Project Zero CLI:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx @akinon/projectzero@latest --plugins
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Basic Usage
|
|
14
|
+
|
|
15
|
+
Here's a simple example of how to use the Masterpass REST component:
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { useLocalization } from '@akinon/next/hooks';
|
|
19
|
+
import PluginModule, { Component } from '@akinon/next/components/plugin-module';
|
|
20
|
+
|
|
21
|
+
const MasterpassRest = () => {
|
|
22
|
+
const { locale, currency } = useLocalization();
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<PluginModule
|
|
26
|
+
component={Component.MasterpassRest}
|
|
27
|
+
props={{ locale, currency }}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default MasterpassRest;
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**File Path:** `src/views/checkout/steps/payment/options/masterpass-rest.tsx`
|
|
36
|
+
|
|
37
|
+
## Props Reference
|
|
38
|
+
|
|
39
|
+
| Prop | Type | Default | Description |
|
|
40
|
+
| --- | --- | --- | --- |
|
|
41
|
+
| `locale` | `string` | `'en'` | Language locale for the component (e.g., `'en'`, `'tr'`) |
|
|
42
|
+
| `currency` | `string` | `'usd'` | Currency code (e.g., `'usd'`, `'try'`) |
|
|
43
|
+
| `texts` | `MasterpassRestOptionTexts` | `defaultTexts` | Object containing all user-facing text for customization and localization |
|
|
44
|
+
| `customRender` | `MasterpassRestOptionCustomRender` | `undefined` | Object with custom render functions for advanced UI customization |
|
|
45
|
+
|
|
46
|
+
## Advanced Customization
|
|
47
|
+
|
|
48
|
+
### Text Customization
|
|
49
|
+
|
|
50
|
+
Override any user-facing text for localization or branding:
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import { useLocalization } from '@akinon/next/hooks';
|
|
54
|
+
import PluginModule, { Component } from '@akinon/next/components/plugin-module';
|
|
55
|
+
|
|
56
|
+
function PaymentPage() {
|
|
57
|
+
const { locale, currency } = useLocalization();
|
|
58
|
+
|
|
59
|
+
const customTexts = {
|
|
60
|
+
addCardButton: 'Kartı Kaydet',
|
|
61
|
+
paymentErrorTitle: 'Ödeme Hatası'
|
|
62
|
+
// ... other text overrides
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<PluginModule
|
|
67
|
+
component={Component.MasterpassRest}
|
|
68
|
+
props={{
|
|
69
|
+
locale,
|
|
70
|
+
currency,
|
|
71
|
+
texts: customTexts
|
|
72
|
+
}}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Custom Rendering
|
|
79
|
+
|
|
80
|
+
Override major UI sections using the `customRender` prop:
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
<PluginModule
|
|
84
|
+
component={Component.MasterpassRest}
|
|
85
|
+
props={{
|
|
86
|
+
locale,
|
|
87
|
+
currency,
|
|
88
|
+
customRender: {
|
|
89
|
+
paymentMethodSelector: (props) => <MyCustomSelector {...props} />
|
|
90
|
+
// ... other custom renderers
|
|
91
|
+
}
|
|
92
|
+
}}
|
|
93
|
+
/>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
For all available customization options, see the `MasterpassRestOptionTexts` and `MasterpassRestOptionCustomRender` types.
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@akinon/pz-masterpass-rest",
|
|
3
|
+
"version": "1.111.0",
|
|
4
|
+
"main": "src/index.ts",
|
|
5
|
+
"types": "src/index.d.ts",
|
|
6
|
+
"description": "Modern React-based Masterpass REST API integration package for ProjectZero e-commerce platform",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"masterpass",
|
|
9
|
+
"payment",
|
|
10
|
+
"react",
|
|
11
|
+
"typescript",
|
|
12
|
+
"redux",
|
|
13
|
+
"e-commerce",
|
|
14
|
+
"projectzero"
|
|
15
|
+
],
|
|
16
|
+
"author": "Akinon",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@hookform/resolvers": "2.9.0",
|
|
19
|
+
"@reduxjs/toolkit": "1.9.7",
|
|
20
|
+
"react": "18.2.0",
|
|
21
|
+
"react-hook-form": "7.31.3",
|
|
22
|
+
"react-redux": "8.1.3",
|
|
23
|
+
"yup": "0.32.11"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"react": "^18.2.0",
|
|
27
|
+
"react-dom": "^18.2.0",
|
|
28
|
+
"react-redux": "^8.1.3",
|
|
29
|
+
"@reduxjs/toolkit": "^1.9.7"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/react": "18.2.27",
|
|
33
|
+
"@types/react-dom": "18.2.12",
|
|
34
|
+
"typescript": "5.2.2"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function n(o,i,a){function s(e,t){if(!i[e]){if(!o[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(c)return c(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}r=i[e]={exports:{}},o[e][0].call(r.exports,function(t){return s(o[e][1][t]||t)},r,r.exports,n,o,i,a)}return i[e].exports}for(var c="function"==typeof require&&require,t=0;t<a.length;t++)s(a[t]);return s}({1:[function(t,e,r){"use strict";function o(t){return(o="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 i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function")}var e,r,n;return e=t,(r=[{key:"encrypt",value:function(t){return T.encrypt(t)}}])&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function m(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 g(){return new m(null)}r="Microsoft Internet Explorer"==navigator.appName?(m.prototype.am=function(t,e,r,n,o,i){for(var a=32767&e,s=e>>15;0<=--i;){var c=32767&this[t],u=this[t++]>>15,l=s*c+u*a;o=((c=a*c+((32767&l)<<15)+r[n]+(1073741823&o))>>>30)+(l>>>15)+s*u+(o>>>30),r[n++]=1073741823&c}return o},30):"Netscape"!=navigator.appName?(m.prototype.am=function(t,e,r,n,o,i){for(;0<=--i;){var a=e*this[t++]+r[n]+o;o=Math.floor(a/67108864),r[n++]=67108863&a}return o},26):(m.prototype.am=function(t,e,r,n,o,i){for(var a=16383&e,s=e>>14;0<=--i;){var c=16383&this[t],u=this[t++]>>14,l=s*c+u*a;o=((c=a*c+((16383&l)<<14)+r[n]+o)>>28)+(l>>14)+s*u,r[n++]=268435455&c}return o},28),m.prototype.DB=r,m.prototype.DM=(1<<r)-1,m.prototype.DV=1<<r;m.prototype.FV=Math.pow(2,52),m.prototype.F1=52-r,m.prototype.F2=2*r-52;for(var n="0123456789abcdefghijklmnopqrstuvwxyz",c=new Array,a="0".charCodeAt(0),s=0;s<=9;++s)c[a++]=s;for(a="a".charCodeAt(0),s=10;s<36;++s)c[a++]=s;for(a="A".charCodeAt(0),s=10;s<36;++s)c[a++]=s;function u(t){return n.charAt(t)}function l(t){var e=g();return e.fromInt(t),e}function b(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 h(t){this.m=t}function f(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 p(){this.i=0,this.j=0,this.S=new Array}h.prototype.convert=function(t){return t.s<0||0<=t.compareTo(this.m)?t.mod(this.m):t},h.prototype.revert=function(t){return t},h.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},h.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},h.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},f.prototype.convert=function(t){var e=g();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&0<e.compareTo(m.ZERO)&&this.m.subTo(e,e),e},f.prototype.revert=function(t){var e=g();return t.copyTo(e),this.reduce(e),e},f.prototype.reduce=function(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)},f.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},f.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},m.prototype.copyTo=function(t){for(var e=this.t-1;0<=e;--e)t[e]=this[e];t.t=this.t,t.s=this.s},m.prototype.fromInt=function(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},m.prototype.fromString=function(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,o=t.length,i=!1,a=0;0<=--o;){var s=8==r?255&t[o]:(s=o,null==(n=c[(n=t).charCodeAt(s)])?-1:n);s<0?"-"==t.charAt(o)&&(i=!0):(i=!1,0==a?this[this.t++]=s:a+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-a)-1)<<a,this[this.t++]=s>>this.DB-a):this[this.t-1]|=s<<a,(a+=r)>=this.DB&&(a-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,0<a)&&(this[this.t-1]|=(1<<this.DB-a)-1<<a),this.clamp(),i&&m.ZERO.subTo(this,this)},m.prototype.clamp=function(){for(var t=this.s&this.DM;0<this.t&&this[this.t-1]==t;)--this.t},m.prototype.dlShiftTo=function(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},m.prototype.drShiftTo=function(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},m.prototype.lShiftTo=function(t,e){for(var r=t%this.DB,n=this.DB-r,o=(1<<n)-1,i=Math.floor(t/this.DB),a=this.s<<r&this.DM,s=this.t-1;0<=s;--s)e[s+i+1]=this[s]>>n|a,a=(this[s]&o)<<r;for(s=i-1;0<=s;--s)e[s]=0;e[i]=a,e.t=this.t+i+1,e.s=this.s,e.clamp()},m.prototype.rShiftTo=function(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 a=r+1;a<this.t;++a)e[a-r-1]|=(this[a]&i)<<o,e[a-r]=this[a]>>n;0<n&&(e[this.t-r-1]|=(this.s&i)<<o),e.t=this.t-r,e.clamp()}},m.prototype.subTo=function(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()},m.prototype.multiplyTo=function(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&&m.ZERO.subTo(e,e)},m.prototype.squareTo=function(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()},m.prototype.divRemTo=function(t,e,r){var n=t.abs();if(!(n.t<=0)){var o=this.abs();if(o.t<n.t)null!=e&&e.fromInt(0),null!=r&&this.copyTo(r);else{null==r&&(r=g());var i=g(),a=this.s,t=t.s,s=this.DB-b(n[n.t-1]),c=(0<s?(n.lShiftTo(s,i),o.lShiftTo(s,r)):(n.copyTo(i),o.copyTo(r)),i.t),u=i[c-1];if(0!=u){var n=u*(1<<this.F1)+(1<c?i[c-2]>>this.F2:0),l=this.FV/n,h=(1<<this.F1)/n,f=1<<this.F2,p=r.t,d=p-c,v=null==e?g():e;for(i.dlShiftTo(d,v),0<=r.compareTo(v)&&(r[r.t++]=1,r.subTo(v,r)),m.ONE.dlShiftTo(c,v),v.subTo(i,i);i.t<c;)i[i.t++]=0;for(;0<=--d;){var y=r[--p]==u?this.DM:Math.floor(r[p]*l+(r[p-1]+f)*h);if((r[p]+=i.am(0,y,r,d,0,c))<y)for(i.dlShiftTo(d,v),r.subTo(v,r);r[p]<--y;)r.subTo(v,r)}null!=e&&(r.drShiftTo(c,e),a!=t)&&m.ZERO.subTo(e,e),r.t=c,r.clamp(),0<s&&r.rShiftTo(s,r),a<0&&m.ZERO.subTo(r,r)}}}},m.prototype.invDigit=function(){var t,e;return this.t<1||0==(1&(t=this[0]))?0:0<(e=(e=(e=(e=(e=3&t)*(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},m.prototype.isEven=function(){return 0==(0<this.t?1&this[0]:this.s)},m.prototype.exp=function(t,e){if(4294967295<t||t<1)return m.ONE;var r,n=g(),o=g(),i=e.convert(this),a=b(t)-1;for(i.copyTo(n);0<=--a;)e.sqrTo(n,o),0<(t&1<<a)?e.mulTo(o,i,n):(r=n,n=o,o=r);return e.revert(n)},m.prototype.toString=function(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="",a=this.t,s=this.DB-a*this.DB%e;if(0<a--)for(s<this.DB&&0<(r=this[a]>>s)&&(o=!0,i=u(r));0<=a;)s<e?(r=(this[a]&(1<<s)-1)<<e-s,r|=this[--a]>>(s+=this.DB-e)):(r=this[a]>>(s-=e)&n,s<=0&&(s+=this.DB,--a)),(o=0<r?!0:o)&&(i+=u(r));return o?i:"0"},m.prototype.negate=function(){var t=g();return m.ZERO.subTo(this,t),t},m.prototype.abs=function(){return this.s<0?this.negate():this},m.prototype.compareTo=function(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},m.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+b(this[this.t-1]^this.s&this.DM)},m.prototype.mod=function(t){var e=g();return this.abs().divRemTo(t,null,e),this.s<0&&0<e.compareTo(m.ZERO)&&t.subTo(e,e),e},m.prototype.modPowInt=function(t,e){return e=new(t<256||e.isEven()?h:f)(e),this.exp(t,e)},m.ZERO=l(0),m.ONE=l(1),p.prototype.init=function(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},p.prototype.next=function(){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]};var d,v=256;function y(){var t;t=(new Date).getTime(),w[D++]^=255&t,w[D++]^=t>>8&255,w[D++]^=t>>16&255,w[D++]^=t>>24&255,v<=D&&(D-=v)}if(null==w){var w=new Array,D=0;if(window.crypto&&window.crypto.getRandomValues){var S=new Uint8Array(32);for(window.crypto.getRandomValues(S),j=0;j<32;++j)w[D++]=S[j]}if("Netscape"==navigator.appName&&navigator.appVersion<"5"&&window.crypto)for(var E=window.crypto.random(32),j=0;j<E.length;++j)w[D++]=255&E.charCodeAt(j);for(;D<v;)j=Math.floor(65536*Math.random()),w[D++]=j>>>8,w[D++]=255&j;D=0,y()}function P(){if(null==d){for(y(),(d=new p).init(w),D=0;D<w.length;++D)w[D]=0;D=0}return d.next()}function x(){}function O(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}x.prototype.nextBytes=function(t){for(var e=0;e<t.length;++e)t[e]=P()},O.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},O.prototype.setPublic=function(t,e){null!=t&&null!=e&&0<t.length&&0<e.length?(this.n=new m(t,16),this.e=parseInt(e,16)):alert("Invalid RSA public key")},O.prototype.encrypt=function(t){return null==(t=function(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 x,a=new Array;2<e;){for(a[0]=0;0==a[0];)i.nextBytes(a);r[--e]=a[0]}return r[--e]=2,r[--e]=0,new m(r)}(t,this.n.bitLength()+7>>3))||null==(t=this.doPublic(t))?null:0==(1&(t=t.toString(16)).length)?t:"0"+t};var T=new O;T.setPublic("F619C53A37BAB059C583DA9AC4E2920FFC9D57E00885E82F7A0863DEAC43CE06374E45A1417DAC907C6CAC0AF1DDF1D7152192FED7A1D9255C97BC27E420E0742B95ED3C53C62995F42CB6EEDB7B1FBDD3E4F4A4AA935650DA81E763CA7074690032F6A6AF72802CC50394C2AFA5C9450A990E6F969A38571C8BC9E381125D2BEEC348AF919D7374FF10DC3E0B4367566CE929AD6EA323A475A677EB41C20B42D44E82E8A53DD52334D927394FCADF09","03")},{}],2:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Masterpass=void 0;var n=t("./utils/request.js"),o=t("./services/verifyService.js"),i=t("./services/accountService.js"),a=t("./services/paymentService.js"),t=t("./services/creditService.js");r.Masterpass=window.Masterpass={setEndpoint:n.Rest.setEndpoint,setToken:n.Rest.setToken,setApiVersion:n.Rest.setApiVersion,setLanguage:n.Rest.setLanguage,setMerchantId:n.Rest.setMerchantId,accountService:i.AccountService,verifyService:o.VerifyService,paymentService:a.PaymentService,creditService:t.CreditService}},{"./services/accountService.js":3,"./services/creditService.js":4,"./services/paymentService.js":5,"./services/verifyService.js":6,"./utils/request.js":7}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.AccountService=void 0;var n,o=t("../utils/request.js"),i=(n=t("../libs/rsa.js"))&&n.__esModule?n:{default:n},a=t("../utils/utils.js");var s={endpoint:"/account"},c="/api/Account",u="/api/Card",l="/api/RecurringOrder";r.AccountService={setEndpoint:function(t){s.endpoint=t},addUserId:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0;t=a.Utils.operationParameters(t,["accountKey","currentUserId","newUserId"]),o.Rest.post(s.endpoint+c+"/AddUserId",t,e)},forgotPassword:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0;t=a.Utils.operationParameters(t,["accountKey","lastSixDigitsOfCard","userId","authenticationMethod"]),o.Rest.post(s.endpoint+c+"/ForgotPassword",t,e)},linkToMerchant:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0;t=a.Utils.operationParameters(t,["accountKey","userId"]),o.Rest.put(s.endpoint+c+"/LinkToMerchant",t,e)},updateUserId:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0;t=a.Utils.operationParameters(t,["accountKey","currentUserId","newUserId"]),o.Rest.patch(s.endpoint+c+"/UserId",t,e)},updateUserMsisdn:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0;t=a.Utils.operationParameters(t,["accountKey","userId","newMsisdn"]),o.Rest.patch(s.endpoint+c+"/Msisdn",t,e)},accountAccess:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0;t=a.Utils.operationParameters(t,["accountKey","accountKeyType","userId"]),o.Rest.get(s.endpoint+u,t,e)},addCard:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0,r=t.cardNumber.replace(/\s/g,"");if(!a.Utils.validateCard(r))throw new Error("Kart numarası geçerli değil!");var n=new i.default;t.cardNumber=n.encrypt(r),t.cvv=n.encrypt(t.cvv.replace(/\s/g,"")),t.deviceFingerPrint="",t=a.Utils.operationParameters(t,["accountKey","accountKeyType","userId","requestReferenceNumber","cardNumber","expiryDate","accountAliasName","cardHolderName","cvv","deviceFingerPrint","additionalParams"]),o.Rest.post(s.endpoint+u,t,e)},removeCard:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0;t=a.Utils.operationParameters(t,["accountKey","cardAlias"]),o.Rest.del(s.endpoint+u,t,e)},completeRegistration:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0;(t=a.Utils.operationParameters(t,["accountKey","userId","accountAliasName","isMsisdnValidatedByMerchant"])).token=FlowDirectable.token,o.Rest.post(s.endpoint+"/api/PurchaseAndRegister",t,e)},recurringOrder:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0;t=a.Utils.operationParameters(t,["accountKey","authenticationMethod","amountLimit","requestReferenceNumber","cardAlias","productId","expiryDate"]),o.Rest.post(s.endpoint+l,t,e)},recurringOrderUpdate:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0;t=a.Utils.operationParameters(t,["accountKey","amountLimit","requestReferenceNumber","cardAlias","productId","expiryDate"]),o.Rest.put(s.endpoint+l,t,e)},recurringOrderDelete:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0;t=a.Utils.operationParameters(t,["accountKey","authenticationMethod","authenticationMethod","amountLimit","requestReferenceNumber","cardAlias","productId"]),o.Rest.del(s.endpoint+l,t,e)}}},{"../libs/rsa.js":1,"../utils/request.js":7,"../utils/utils.js":8}],4:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.CreditService=void 0;var n,o=t("../utils/request.js"),i=(n=t("../libs/rsa.js"))&&n.__esModule?n:{default:n},a=t("../utils/utils.js");var s={endpoint:"/credit-bff"};r.CreditService={setEndpoint:function(t){s.endpoint=t},loanGetUrl:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0,r=new i.default;t.cvc=r.encrypt(t.cvc.replace(/\s/g,"")),t.deviceFingerPrint="",t=a.Utils.operationParameters(t,["accountKey","userId","requestReferenceNo","amount","isMsisdnValidatedByMerchant","currencyCode","orderNo","terminalGroupId","cvc","acquirerIcaNumber","loanIssuerIcaNumber","accessToken","campaingCode","basket"]),o.Rest.post(s.endpoint+"/api/Loan/geturl",t,e)},overdraftQuery:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0,r=o.FlowDirectable.uri;o.Rest.get(s.endpoint+r,t,e)}}},{"../libs/rsa.js":1,"../utils/request.js":7,"../utils/utils.js":8}],5:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.PaymentService=void 0;var n,o=t("../utils/request.js"),i=(n=t("../libs/rsa.js"))&&n.__esModule?n:{default:n},a=t("../utils/utils.js");var s={endpoint:"/payment"};r.PaymentService={setEndpoint:function(t){s.endpoint=t},payment:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0;t=a.Utils.operationParameters(t,["accountKey","authenticationMethod","amount","requestReferenceNo","cardAlias","cvc","orderNo","installmentCount","acquirerIcaNumber","terminalGroupId","currencyCode","paymentType","secure3DModel","subMerchant","rewardList","orderDetails","orderProductsDetails","buyerDetails","billDetails","deliveryDetails","otherDetails","mokaSubDealerDetails","terminal","customParameters","additionalParams"]),o.Rest.post(s.endpoint+"/api/Payment/request",t,e)},directPayment:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0,r=t.cardNumber.replace(/\s/g,"");if(!a.Utils.validateCard(r))throw new Error("Kart numarası geçerli değil!");var n=new i.default;t.cardNumber=n.encrypt(r),t.cvc=n.encrypt(t.cvc.replace(/\s/g,"")),t.deviceFingerPrint="",t=a.Utils.operationParameters(t,["accountKey","authenticationMethod","requestReferenceNo","cardNumber","cardHolderName","expiryDate","cvc","cardAlias","amount","orderNo","terminalGroupId","currencyCode","paymentType","acquirerIcaNumber","installmentCount","subMerchant","rewardList","orderDetails","buyerDetails","otherDetails","secure3DModel","mokaSubDealerDetails","deviceFingerPrint","orderProductsDetails","billDetails","deliveryDetails","terminal","customParameters","additionalParams"]),o.Rest.post(s.endpoint+"/api/DirectPayment/request",t,e)},registerAndPurchase:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0,r=t.cardNumber.replace(/\s/g,"");if(!a.Utils.validateCard(r))throw new Error("Kart numarası geçerli değil!");var n=new i.default;t.cardNumber=n.encrypt(r),t.cvc=n.encrypt(t.cvc.replace(/\s/g,"")),t.deviceFingerPrint="",t=a.Utils.operationParameters(t,["accountKey","accountKeyType","merchantUserId","authenticationMethod","requestReferenceNo","orderNo","acquirerIcaNumber","installmentCount","cardAlias","cardNumber","expiryDate","cvc","cardHolderName","amount","deviceFingerPrint","terminalGroupId","currencyCode","paymentType","subMerchant","rewardList","orderDetails","orderProductsDetails","buyerDetails","billDetails","deliveryDetails","otherDetails","secure3DModel","terminal","isMsisdnValidatedByMerchant","mokaSubDealerDetails","customParameters","additionalParams"]),o.Rest.post(s.endpoint+"/api/RegisterAndPurchase",t,e)}}},{"../libs/rsa.js":1,"../utils/request.js":7,"../utils/utils.js":8}],6:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.VerifyService=void 0;var o=t("../utils/request.js");function T(t){return(T="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 A(){A=function(){return a};var c,a={},t=Object.prototype,u=t.hasOwnProperty,l=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(c){i=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o,i,a,s,e=e&&e.prototype instanceof m?e:m,e=Object.create(e.prototype),n=new x(n||[]);return l(e,"_invoke",{value:(o=t,i=r,a=n,s=f,function(t,e){if(s===d)throw new Error("Generator is already running");if(s===v){if("throw"===t)throw e;return{value:c,done:!0}}for(a.method=t,a.arg=e;;){var r=a.delegate;if(r){r=function t(e,r){var n=r.method,o=e.iterator[n];if(o===c)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=c,t(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;n=h(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,y;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=c),r.delegate=null,y):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}(r,a);if(r){if(r===y)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(s===f)throw s=v,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s=d;r=h(o,i,a);if("normal"===r.type){if(s=a.done?v:p,r.arg===y)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(s=v,a.method="throw",a.arg=r.arg)}})}),e}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var f="suspendedStart",p="suspendedYield",d="executing",v="completed",y={};function m(){}function g(){}function b(){}var e={},w=(i(e,n,function(){return this}),Object.getPrototypeOf),w=w&&w(w(O([]))),D=(w&&w!==t&&u.call(w,n)&&(e=w),b.prototype=m.prototype=Object.create(e));function S(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function E(a,s){var e;l(this,"_invoke",{value:function(r,n){function t(){return new s(function(t,e){!function e(t,r,n,o){var i,t=h(a[t],a,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==T(r)&&u.call(r,"__await")?s.resolve(r.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):s.resolve(r).then(function(t){i.value=t,n(i)},function(t){return e("throw",t,n,o)});o(t.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}})}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function O(e){if(e||""===e){var r,t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return r=-1,(t=function t(){for(;++r<e.length;)if(u.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=c,t.done=!0,t}).next=t}throw new TypeError(T(e)+" is not iterable")}return l(D,"constructor",{value:g.prototype=b,configurable:!0}),l(b,"constructor",{value:g,configurable:!0}),g.displayName=i(b,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,i(t,o,"GeneratorFunction")),t.prototype=Object.create(D),t},a.awrap=function(t){return{__await:t}},S(E.prototype),i(E.prototype,r,function(){return this}),a.AsyncIterator=E,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new E(s(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},S(D),i(D,o,"Generator"),i(D,n,function(){return this}),i(D,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,r=Object(t),n=[];for(e in r)n.push(e);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=O,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEach(P),!t)for(var e in this)"t"===e.charAt(0)&&u.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=c)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return i.type="throw",i.arg=r,n.next=t,e&&(n.method="next",n.arg=c),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=u.call(o,"catchLoc"),s=u.call(o,"finallyLoc");if(a&&s){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&u.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc?null:o)?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),P(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r,n,o=this.tryEntries[e];if(o.tryLoc===t)return"throw"===(r=o.completion).type&&(n=r.arg,P(o)),n}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=c),y}},a}function c(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}var i={endpoint:"/user-authorization"},a="/api/Otp";r.VerifyService={setEndpoint:function(t){i.endpoint=t},verifyOtp:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=1<arguments.length?arguments[1]:void 0,r=o.FlowDirectable.uri;t.token=o.FlowDirectable.token,o.Rest.post(r,t,e)},resendOtp:function(){return n.apply(this,arguments)}};function n(){var s;return s=A().mark(function t(){var e,r,n=arguments;return A().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e=0<n.length&&void 0!==n[0]?n[0]:{},r=1<n.length?n[1]:void 0,o.Rest.post(i.endpoint+a+"/resend",e,r);case 3:case"end":return t.stop()}},t)}),(n=function(){var t=this,a=arguments;return new Promise(function(e,r){var n=s.apply(t,a);function o(t){c(n,e,r,o,i,"next",t)}function i(t){c(n,e,r,o,i,"throw",t)}o(void 0)})}).apply(this,arguments)}},{"../utils/request.js":7}],7:[function(t,e,r){"use strict";function T(t){return(T="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 A(){A=function(){return a};var c,a={},t=Object.prototype,u=t.hasOwnProperty,l=Object.defineProperty||function(t,e,r){t[e]=r.value},e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",r=e.asyncIterator||"@@asyncIterator",o=e.toStringTag||"@@toStringTag";function i(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{i({},"")}catch(c){i=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o,i,a,s,e=e&&e.prototype instanceof m?e:m,e=Object.create(e.prototype),n=new x(n||[]);return l(e,"_invoke",{value:(o=t,i=r,a=n,s=f,function(t,e){if(s===d)throw new Error("Generator is already running");if(s===v){if("throw"===t)throw e;return{value:c,done:!0}}for(a.method=t,a.arg=e;;){var r=a.delegate;if(r){r=function t(e,r){var n=r.method,o=e.iterator[n];if(o===c)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=c,t(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;n=h(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,y;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=c),r.delegate=null,y):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}(r,a);if(r){if(r===y)continue;return r}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if(s===f)throw s=v,a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);s=d;r=h(o,i,a);if("normal"===r.type){if(s=a.done?v:p,r.arg===y)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(s=v,a.method="throw",a.arg=r.arg)}})}),e}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}a.wrap=s;var f="suspendedStart",p="suspendedYield",d="executing",v="completed",y={};function m(){}function g(){}function b(){}var e={},w=(i(e,n,function(){return this}),Object.getPrototypeOf),w=w&&w(w(O([]))),D=(w&&w!==t&&u.call(w,n)&&(e=w),b.prototype=m.prototype=Object.create(e));function S(t){["next","throw","return"].forEach(function(e){i(t,e,function(t){return this._invoke(e,t)})})}function E(a,s){var e;l(this,"_invoke",{value:function(r,n){function t(){return new s(function(t,e){!function e(t,r,n,o){var i,t=h(a[t],a,r);if("throw"!==t.type)return(r=(i=t.arg).value)&&"object"==T(r)&&u.call(r,"__await")?s.resolve(r.__await).then(function(t){e("next",t,n,o)},function(t){e("throw",t,n,o)}):s.resolve(r).then(function(t){i.value=t,n(i)},function(t){return e("throw",t,n,o)});o(t.arg)}(r,n,t,e)})}return e=e?e.then(t,t):t()}})}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function O(e){if(e||""===e){var r,t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return r=-1,(t=function t(){for(;++r<e.length;)if(u.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=c,t.done=!0,t}).next=t}throw new TypeError(T(e)+" is not iterable")}return l(D,"constructor",{value:g.prototype=b,configurable:!0}),l(b,"constructor",{value:g,configurable:!0}),g.displayName=i(b,o,"GeneratorFunction"),a.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},a.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,i(t,o,"GeneratorFunction")),t.prototype=Object.create(D),t},a.awrap=function(t){return{__await:t}},S(E.prototype),i(E.prototype,r,function(){return this}),a.AsyncIterator=E,a.async=function(t,e,r,n,o){void 0===o&&(o=Promise);var i=new E(s(t,e,r,n),o);return a.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},S(D),i(D,o,"Generator"),i(D,n,function(){return this}),i(D,"toString",function(){return"[object Generator]"}),a.keys=function(t){var e,r=Object(t),n=[];for(e in r)n.push(e);return n.reverse(),function t(){for(;n.length;){var e=n.pop();if(e in r)return t.value=e,t.done=!1,t}return t.done=!0,t}},a.values=O,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEach(P),!t)for(var e in this)"t"===e.charAt(0)&&u.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=c)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function t(t,e){return i.type="throw",i.arg=r,n.next=t,e&&(n.method="next",n.arg=c),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var o=this.tryEntries[e],i=o.completion;if("root"===o.tryLoc)return t("end");if(o.tryLoc<=this.prev){var a=u.call(o,"catchLoc"),s=u.call(o,"finallyLoc");if(a&&s){if(this.prev<o.catchLoc)return t(o.catchLoc,!0);if(this.prev<o.finallyLoc)return t(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return t(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return t(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&u.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}var i=(o=o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc?null:o)?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),P(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r,n,o=this.tryEntries[e];if(o.tryLoc===t)return"throw"===(r=o.completion).type&&(n=r.arg,P(o)),n}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=c),y}},a}function i(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)),n}function a(n){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?i(Object(o),!0).forEach(function(t){var e,r;e=n,r=o[t=t],(t=function(t){t=function(t,e){if("object"!==T(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==T(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===T(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):i(Object(o)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(o,t))})}return n}function c(t,e,r,n,o,i,a){try{var s=t[i](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,o)}function o(s){return function(){var t=this,a=arguments;return new Promise(function(e,r){var n=s.apply(t,a);function o(t){c(n,e,r,o,i,"next",t)}function i(t){c(n,e,r,o,i,"throw",t)}o(void 0)})}}Object.defineProperty(r,"__esModule",{value:!0}),r.Rest=r.FlowDirectable=void 0;var s={"Content-Type":"application/json","x-channel":"SYS","x-source-channel":"Web",Accept:"application/json"},u={endpoint:""},l={merchantId:"",sdkVersion:"1.0.4",sourceChannel:"Web"},h=r.FlowDirectable=window.FlowDirectable={uri:"",token:"",url3d:"",url3dSuccess:"",url3dFail:""};r.Rest={setToken:function(t){var e;t=null!=(e=null==(e=t.split(" "))?void 0:e[1])?e:t,s.Authorization="Bearer "+t},setEndpoint:function(t){u.endpoint=t},setApiVersion:function(t){s["x-api-version"]=null!=t?t:l.sdkVersion},setLanguage:function(t){s["x-language"]=null!=t?t:"en-US"},setMerchantId:function(t){l.merchantId=t},post:function(t,e,r){return n.apply(this,arguments)},put:function(t,e,r){return d.apply(this,arguments)},patch:function(t,e,r){return v.apply(this,arguments)},del:function(t,e,r){return p.apply(this,arguments)},get:function(t,e,r){return y.apply(this,arguments)}};function f(t,e){h.uri=t.get("content-location")||"",h.token=(null==e?void 0:e.token)||"",h.url3d=(null==e?void 0:e.url3d)||"",h.url3dSuccess=(null==e?void 0:e.url3dSuccess)||"",h.url3dFail=(null==e?void 0:e.url3dFail)||""}function n(){return(n=o(A().mark(function t(e,r,n){var o;return A().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o=a(a({},r),l),o={method:"POST",headers:s,body:JSON.stringify(o)},t.next=4,m(u.endpoint+e,o,n);case 4:case"end":return t.stop()}},t)}))).apply(this,arguments)}function p(){return(p=o(A().mark(function t(e,r,n){var o;return A().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o=a(a({},r),l),o={method:"DELETE",headers:s,body:JSON.stringify(o)},t.next=4,m(u.endpoint+e,o,n);case 4:case"end":return t.stop()}},t)}))).apply(this,arguments)}function d(){return(d=o(A().mark(function t(e,r,n){var o;return A().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o=a(a({},r),l),o={method:"PUT",headers:s,body:JSON.stringify(o)},t.next=4,m(u.endpoint+e,o,n);case 4:case"end":return t.stop()}},t)}))).apply(this,arguments)}function v(){return(v=o(A().mark(function t(e,r,n){var o;return A().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o=a(a({},r),l),o={method:"PATCH",headers:s,body:JSON.stringify(o)},t.next=4,m(u.endpoint+e,o,n);case 4:case"end":return t.stop()}},t)}))).apply(this,arguments)}function y(){return(y=o(A().mark(function t(e,r,n){var o,i;return A().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o=a(a({},r),l),i={method:"GET",headers:s},t.next=4,m(u.endpoint+e+"?"+new URLSearchParams(o),i,n);case 4:case"end":return t.stop()}},t)}))).apply(this,arguments)}function m(){return g.apply(this,arguments)}function g(){return(g=o(A().mark(function t(i,e,r){var a,n;return A().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=a="",t.next=4,fetch(i,e).then(function(){var e=o(A().mark(function t(e){var r,n,o;return A().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.json();case 2:return r=t.sent,a=r.statusCode,e.ok?(n=-1!==i.toLowerCase().indexOf("verify"),o=-1!==i.toLowerCase().indexOf("directpayment/request"),202==r.statusCode?(f(e.headers,r.result),r.token=h.token,r.url3d=h.url3d,r.responseCode=r.result.responseCode):200==r.statusCode&&(n||o)&&f(e.headers,r.result)):(console.error(r.exception),r.responseCode=null==(n=r.exception)?void 0:n.code,r.exception.validationErrors?(o=r.exception.validationErrors.map(function(t){return t.message}),r.description=o.join(", ")):r.description=r.exception.message),t.abrupt("return",r);case 6:case"end":return t.stop()}},t)}));return function(t){return e.apply(this,arguments)}}());case 4:n=t.sent,r&&r(a,n);case 6:case"end":return t.stop()}},t)}))).apply(this,arguments)}},{}],8:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Utils=void 0;r.Utils=window.Utils={formDataToClassObject:function(t,e){var r,n=Object.fromEntries(t.entries()),o=Object.getOwnPropertyNames(new e),i={};for(r in n)o.includes(r)&&(i[r]=n[r]);t=new e;return Object.assign(t,i),t},formDataToJson:function(t){t=new FormData(t);return Object.fromEntries(t.entries())},dataToClassObject:function(t,e){var r,n=Object.getOwnPropertyNames(new e),o={};for(r in t)n.includes(r)&&(o[r]=t[r]);e=new e;return Object.assign(e,o),e},decodeJwt:function(t){var e=(t="Bearer "+(t=null!=(e=null==(e=t.split(" "))?void 0:e[1])?e:t)).split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),t=decodeURIComponent(window.atob(e).split("").map(function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(t)},validateCard:function(t){for(var e=t.length,r=1,n=0,o=e-1;0<=o;o--){var i=parseInt(t.charAt(o),10);n+=(r^=1)?2*i%10+Math.floor(2*i/10):i}return n%10==0},operationParameters:function(t,e){for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];e.includes(o)||delete t[o]}return t}}},{}]},{},[2]);
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { CardModel } from '../types/account.types';
|
|
3
|
+
import { Input, Icon } from '@akinon/next/components';
|
|
4
|
+
import { detectCardType, getCardIcon, getCvcLength } from '../utils/card-utils';
|
|
5
|
+
import type { MasterpassRestOptionTexts } from '../types/custom-render.types';
|
|
6
|
+
|
|
7
|
+
interface CardListProps {
|
|
8
|
+
cards: CardModel[];
|
|
9
|
+
onCardSelect: (card: CardModel) => void;
|
|
10
|
+
selectedCard?: CardModel | null;
|
|
11
|
+
onRemove?: (card: CardModel) => void;
|
|
12
|
+
removingCardId?: string | null;
|
|
13
|
+
cvc?: string;
|
|
14
|
+
onCvcChange?: (cvc: string) => void;
|
|
15
|
+
texts: MasterpassRestOptionTexts;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const CardList: React.FC<CardListProps> = ({
|
|
19
|
+
cards,
|
|
20
|
+
onCardSelect,
|
|
21
|
+
selectedCard,
|
|
22
|
+
onRemove,
|
|
23
|
+
removingCardId,
|
|
24
|
+
cvc = '',
|
|
25
|
+
onCvcChange,
|
|
26
|
+
texts
|
|
27
|
+
}) => {
|
|
28
|
+
const [localCvc, setLocalCvc] = useState(cvc);
|
|
29
|
+
|
|
30
|
+
const handleCvcChange = (value: string) => {
|
|
31
|
+
const numericValue = value.replace(/\D/g, '').slice(0, 4);
|
|
32
|
+
setLocalCvc(numericValue);
|
|
33
|
+
onCvcChange?.(numericValue);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div className="flex flex-col gap-4">
|
|
38
|
+
{cards.map((card) => {
|
|
39
|
+
const isSelected =
|
|
40
|
+
selectedCard?.uniqueCardNumber === card.uniqueCardNumber;
|
|
41
|
+
const expectedCvcLength = getCvcLength(detectCardType(card.cardBin));
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div
|
|
45
|
+
key={card.uniqueCardNumber}
|
|
46
|
+
className={`border transition-all cursor-pointer ${
|
|
47
|
+
isSelected
|
|
48
|
+
? 'border-primary bg-primary/5'
|
|
49
|
+
: 'border-gray-200 hover:border-gray-300'
|
|
50
|
+
}`}
|
|
51
|
+
onClick={() => onCardSelect(card)}
|
|
52
|
+
>
|
|
53
|
+
<div className="flex items-center justify-between p-4">
|
|
54
|
+
{/* Selection Indicator - Moved to beginning */}
|
|
55
|
+
<div className="flex items-center space-x-4">
|
|
56
|
+
<div
|
|
57
|
+
className={`
|
|
58
|
+
w-4 h-4 border-2 rounded-full flex items-center justify-center
|
|
59
|
+
${
|
|
60
|
+
isSelected
|
|
61
|
+
? 'border-primary bg-primary'
|
|
62
|
+
: 'border-gray-300'
|
|
63
|
+
}
|
|
64
|
+
`}
|
|
65
|
+
>
|
|
66
|
+
{isSelected && (
|
|
67
|
+
<div className="w-2 h-2 bg-white rounded-full"></div>
|
|
68
|
+
)}
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<img
|
|
72
|
+
src={getCardIcon(card.cardBin).src}
|
|
73
|
+
alt={card.cardType}
|
|
74
|
+
className="w-8 h-6 object-contain"
|
|
75
|
+
/>
|
|
76
|
+
<div>
|
|
77
|
+
<div className="font-medium text-gray-900">
|
|
78
|
+
{card.maskedCardNumber}
|
|
79
|
+
</div>
|
|
80
|
+
<div className="text-sm text-gray-500">{card.cardAlias}</div>
|
|
81
|
+
<div className="flex items-center space-x-2 mt-1">
|
|
82
|
+
<span className="text-xs px-2 py-1 bg-gray-100">
|
|
83
|
+
{card.cardType}
|
|
84
|
+
</span>
|
|
85
|
+
{card.isDefaultCard && (
|
|
86
|
+
<span className="text-xs px-2 py-1 bg-primary/10 text-primary">
|
|
87
|
+
{texts.defaultCardText}
|
|
88
|
+
</span>
|
|
89
|
+
)}
|
|
90
|
+
{card.expireSoon && (
|
|
91
|
+
<span className="text-xs px-2 py-1 bg-warning/10 text-warning">
|
|
92
|
+
{texts.expiresSoonText}
|
|
93
|
+
</span>
|
|
94
|
+
)}
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
{/* Delete Icon */}
|
|
100
|
+
{onRemove && (
|
|
101
|
+
<button
|
|
102
|
+
className="p-2 text-gray-400 hover:text-red-500 transition-colors disabled:opacity-50 bg-gray-100 rounded-full"
|
|
103
|
+
disabled={removingCardId === card.uniqueCardNumber}
|
|
104
|
+
onClick={(e) => {
|
|
105
|
+
e.stopPropagation();
|
|
106
|
+
onRemove(card);
|
|
107
|
+
}}
|
|
108
|
+
title={texts.removeCardTitleText}
|
|
109
|
+
>
|
|
110
|
+
{removingCardId === card.uniqueCardNumber ? (
|
|
111
|
+
<div className="animate-spin h-5 w-5 border-b-2 border-red-500"></div>
|
|
112
|
+
) : (
|
|
113
|
+
<svg
|
|
114
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
115
|
+
width="20"
|
|
116
|
+
height="20"
|
|
117
|
+
viewBox="0 0 24 24"
|
|
118
|
+
fill="none"
|
|
119
|
+
stroke="currentColor"
|
|
120
|
+
strokeWidth="2"
|
|
121
|
+
strokeLinecap="round"
|
|
122
|
+
strokeLinejoin="round"
|
|
123
|
+
className="text-gray-600"
|
|
124
|
+
>
|
|
125
|
+
<path d="M3 6h18" />
|
|
126
|
+
<path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" />
|
|
127
|
+
<path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" />
|
|
128
|
+
</svg>
|
|
129
|
+
)}
|
|
130
|
+
</button>
|
|
131
|
+
)}
|
|
132
|
+
</div>
|
|
133
|
+
|
|
134
|
+
{isSelected && (
|
|
135
|
+
<div
|
|
136
|
+
className="border-t border-gray-200 p-4 bg-gray-50"
|
|
137
|
+
onClick={(e) => e.stopPropagation()}
|
|
138
|
+
>
|
|
139
|
+
<div className="flex items-center gap-4">
|
|
140
|
+
<div className="flex-1">
|
|
141
|
+
<label
|
|
142
|
+
htmlFor={`cvc-${card.uniqueCardNumber}`}
|
|
143
|
+
className="block text-sm font-medium text-gray-700 mb-2"
|
|
144
|
+
>
|
|
145
|
+
{texts.cvcCardLabel}{' '}
|
|
146
|
+
<span className="text-red-500">*</span>
|
|
147
|
+
</label>
|
|
148
|
+
<Input
|
|
149
|
+
id={`cvc-${card.uniqueCardNumber}`}
|
|
150
|
+
type="text"
|
|
151
|
+
placeholder={
|
|
152
|
+
expectedCvcLength === 4
|
|
153
|
+
? texts.cvcPlaceholder4
|
|
154
|
+
: texts.cvcPlaceholder3
|
|
155
|
+
}
|
|
156
|
+
value={localCvc}
|
|
157
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
|
158
|
+
handleCvcChange(e.target.value)
|
|
159
|
+
}
|
|
160
|
+
maxLength={expectedCvcLength}
|
|
161
|
+
className="w-32"
|
|
162
|
+
/>
|
|
163
|
+
<p className="text-xs text-gray-500 mt-1">
|
|
164
|
+
{texts.cvcCardHelpText
|
|
165
|
+
?.replace('{length}', expectedCvcLength.toString())
|
|
166
|
+
.replace(
|
|
167
|
+
'{side}',
|
|
168
|
+
expectedCvcLength === 4
|
|
169
|
+
? texts.cvcFrontText
|
|
170
|
+
: texts.cvcBackText
|
|
171
|
+
)}
|
|
172
|
+
</p>
|
|
173
|
+
</div>
|
|
174
|
+
<div className="flex items-center text-sm text-gray-600">
|
|
175
|
+
<Icon
|
|
176
|
+
name="shield-check"
|
|
177
|
+
size={16}
|
|
178
|
+
className="mr-1 text-green-600"
|
|
179
|
+
/>
|
|
180
|
+
<span>{texts.secureCardText}</span>
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
)}
|
|
185
|
+
</div>
|
|
186
|
+
);
|
|
187
|
+
})}
|
|
188
|
+
</div>
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export default CardList;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Modal, Button } from '@akinon/next/components';
|
|
3
|
+
import type { MasterpassRestOptionTexts } from '../types/custom-render.types';
|
|
4
|
+
|
|
5
|
+
interface ConfirmationModalProps {
|
|
6
|
+
open: boolean;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
onConfirm: () => void;
|
|
9
|
+
title: string;
|
|
10
|
+
message: string;
|
|
11
|
+
confirmText?: string;
|
|
12
|
+
cancelText?: string;
|
|
13
|
+
isLoading?: boolean;
|
|
14
|
+
loadingText?: string;
|
|
15
|
+
texts: MasterpassRestOptionTexts;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const ConfirmationModal: React.FC<ConfirmationModalProps> = ({
|
|
19
|
+
open,
|
|
20
|
+
onClose,
|
|
21
|
+
onConfirm,
|
|
22
|
+
title,
|
|
23
|
+
message,
|
|
24
|
+
confirmText,
|
|
25
|
+
cancelText,
|
|
26
|
+
isLoading = false,
|
|
27
|
+
loadingText,
|
|
28
|
+
texts
|
|
29
|
+
}) => {
|
|
30
|
+
return (
|
|
31
|
+
<Modal
|
|
32
|
+
portalId="confirmation-modal"
|
|
33
|
+
open={open}
|
|
34
|
+
setOpen={onClose}
|
|
35
|
+
title={title}
|
|
36
|
+
className="w-full sm:w-[28rem] max-h-[90vh] overflow-y-auto"
|
|
37
|
+
>
|
|
38
|
+
<div className="px-6 pb-6">
|
|
39
|
+
<p className="text-center mt-4 mb-6 text-lg">{message}</p>
|
|
40
|
+
<div className="flex gap-3 justify-center">
|
|
41
|
+
<Button
|
|
42
|
+
appearance="outlined"
|
|
43
|
+
className="px-6 py-3 h-auto hover:bg-gray-50 transition-colors"
|
|
44
|
+
onClick={onClose}
|
|
45
|
+
disabled={isLoading}
|
|
46
|
+
>
|
|
47
|
+
{cancelText || texts.cancelText}
|
|
48
|
+
</Button>
|
|
49
|
+
<Button
|
|
50
|
+
appearance="filled"
|
|
51
|
+
className="px-6 py-3 h-auto"
|
|
52
|
+
onClick={onConfirm}
|
|
53
|
+
disabled={isLoading}
|
|
54
|
+
>
|
|
55
|
+
{isLoading
|
|
56
|
+
? loadingText || texts.loadingText
|
|
57
|
+
: confirmText || texts.confirmText}
|
|
58
|
+
</Button>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</Modal>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default ConfirmationModal;
|