fedapay-reactjs 1.1.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/cjs/checkout-options.d.ts +32 -0
- package/lib/cjs/checkout-options.js +3 -0
- package/lib/cjs/checkout-options.js.map +1 -0
- package/lib/cjs/index.d.ts +31 -0
- package/lib/cjs/index.js +96 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/esm/checkout-options.d.ts +32 -0
- package/lib/esm/checkout-options.js +2 -0
- package/lib/esm/checkout-options.js.map +1 -0
- package/lib/esm/index.d.ts +31 -0
- package/lib/esm/index.js +93 -0
- package/lib/esm/index.js.map +1 -0
- package/package.json +2 -2
@@ -0,0 +1,32 @@
|
|
1
|
+
export default interface CheckoutOptions {
|
2
|
+
environment?: 'live' | 'production' | 'test' | 'sandbox' | 'dev' | 'local';
|
3
|
+
url?: string;
|
4
|
+
public_key?: string;
|
5
|
+
container?: string | HTMLElement | null;
|
6
|
+
trigger?: string;
|
7
|
+
locale?: 'en' | 'fr';
|
8
|
+
transaction: {
|
9
|
+
id?: number;
|
10
|
+
amount: number;
|
11
|
+
description: string;
|
12
|
+
custom_metadata?: any;
|
13
|
+
};
|
14
|
+
currency: {
|
15
|
+
iso: string;
|
16
|
+
code?: number;
|
17
|
+
};
|
18
|
+
customer?: {
|
19
|
+
firstname: string;
|
20
|
+
lastname: string;
|
21
|
+
email: string;
|
22
|
+
phone_number?: {
|
23
|
+
number: string;
|
24
|
+
country: string;
|
25
|
+
};
|
26
|
+
};
|
27
|
+
button?: {
|
28
|
+
text?: string;
|
29
|
+
class?: string;
|
30
|
+
};
|
31
|
+
onComplete?: any;
|
32
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"checkout-options.js","sourceRoot":"","sources":["../../src/checkout-options.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import CheckoutOptions from './checkout-options';
|
3
|
+
export interface Props {
|
4
|
+
options: CheckoutOptions;
|
5
|
+
}
|
6
|
+
/**
|
7
|
+
* @class BaseComponent
|
8
|
+
*/
|
9
|
+
export declare class BaseComponent extends React.Component<Props> {
|
10
|
+
componentDidMount(): void;
|
11
|
+
}
|
12
|
+
/**
|
13
|
+
* @class FedaCheckoutButton
|
14
|
+
*/
|
15
|
+
export declare class FedaCheckoutButton extends BaseComponent {
|
16
|
+
buttonRef: any;
|
17
|
+
constructor(props: Props);
|
18
|
+
componentDidMount(): void;
|
19
|
+
initFedaPay(): void;
|
20
|
+
render(): React.JSX.Element;
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* @class FedaCheckoutContainer
|
24
|
+
*/
|
25
|
+
export declare class FedaCheckoutContainer extends BaseComponent {
|
26
|
+
containerRef: any;
|
27
|
+
constructor(props: Props);
|
28
|
+
componentDidMount(): void;
|
29
|
+
initFedaPay(): void;
|
30
|
+
render(): React.JSX.Element;
|
31
|
+
}
|
package/lib/cjs/index.js
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
3
|
+
var extendStatics = function (d, b) {
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
+
return extendStatics(d, b);
|
8
|
+
};
|
9
|
+
return function (d, b) {
|
10
|
+
if (typeof b !== "function" && b !== null)
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
+
extendStatics(d, b);
|
13
|
+
function __() { this.constructor = d; }
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
+
};
|
16
|
+
})();
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
18
|
+
__assign = Object.assign || function(t) {
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
20
|
+
s = arguments[i];
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
22
|
+
t[p] = s[p];
|
23
|
+
}
|
24
|
+
return t;
|
25
|
+
};
|
26
|
+
return __assign.apply(this, arguments);
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.FedaCheckoutContainer = exports.FedaCheckoutButton = exports.BaseComponent = void 0;
|
30
|
+
var React = require("react");
|
31
|
+
/**
|
32
|
+
* @class BaseComponent
|
33
|
+
*/
|
34
|
+
var BaseComponent = /** @class */ (function (_super) {
|
35
|
+
__extends(BaseComponent, _super);
|
36
|
+
function BaseComponent() {
|
37
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
38
|
+
}
|
39
|
+
BaseComponent.prototype.componentDidMount = function () {
|
40
|
+
if (typeof FedaPay === 'undefined') {
|
41
|
+
throw new Error('checkout.js script need to be included!');
|
42
|
+
}
|
43
|
+
};
|
44
|
+
return BaseComponent;
|
45
|
+
}(React.Component));
|
46
|
+
exports.BaseComponent = BaseComponent;
|
47
|
+
/**
|
48
|
+
* @class FedaCheckoutButton
|
49
|
+
*/
|
50
|
+
var FedaCheckoutButton = /** @class */ (function (_super) {
|
51
|
+
__extends(FedaCheckoutButton, _super);
|
52
|
+
function FedaCheckoutButton(props) {
|
53
|
+
var _this = _super.call(this, props) || this;
|
54
|
+
_this.buttonRef = React.createRef();
|
55
|
+
return _this;
|
56
|
+
}
|
57
|
+
FedaCheckoutButton.prototype.componentDidMount = function () {
|
58
|
+
_super.prototype.componentDidMount.call(this);
|
59
|
+
this.initFedaPay();
|
60
|
+
};
|
61
|
+
FedaCheckoutButton.prototype.initFedaPay = function () {
|
62
|
+
FedaPay.init(this.buttonRef, this.props.options);
|
63
|
+
};
|
64
|
+
FedaCheckoutButton.prototype.render = function () {
|
65
|
+
var _this = this;
|
66
|
+
return (React.createElement("button", __assign({ ref: function (el) { return _this.buttonRef = el; } }, this.props), "Click to Pay"));
|
67
|
+
};
|
68
|
+
return FedaCheckoutButton;
|
69
|
+
}(BaseComponent));
|
70
|
+
exports.FedaCheckoutButton = FedaCheckoutButton;
|
71
|
+
/**
|
72
|
+
* @class FedaCheckoutContainer
|
73
|
+
*/
|
74
|
+
var FedaCheckoutContainer = /** @class */ (function (_super) {
|
75
|
+
__extends(FedaCheckoutContainer, _super);
|
76
|
+
function FedaCheckoutContainer(props) {
|
77
|
+
var _this = _super.call(this, props) || this;
|
78
|
+
_this.containerRef = React.createRef();
|
79
|
+
return _this;
|
80
|
+
}
|
81
|
+
FedaCheckoutContainer.prototype.componentDidMount = function () {
|
82
|
+
_super.prototype.componentDidMount.call(this);
|
83
|
+
this.initFedaPay();
|
84
|
+
};
|
85
|
+
FedaCheckoutContainer.prototype.initFedaPay = function () {
|
86
|
+
this.props.options.container = this.containerRef;
|
87
|
+
FedaPay.init(this.props.options);
|
88
|
+
};
|
89
|
+
FedaCheckoutContainer.prototype.render = function () {
|
90
|
+
var _this = this;
|
91
|
+
return (React.createElement("div", __assign({ ref: function (el) { return _this.containerRef = el; } }, this.props)));
|
92
|
+
};
|
93
|
+
return FedaCheckoutContainer;
|
94
|
+
}(BaseComponent));
|
95
|
+
exports.FedaCheckoutContainer = FedaCheckoutContainer;
|
96
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA+B;AAO/B;;GAEG;AACH;IAAmC,iCAAsB;IAAzD;;IAMA,CAAC;IALC,yCAAiB,GAAjB;QACE,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;YAClC,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;SAC5D;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AAND,CAAmC,KAAK,CAAC,SAAS,GAMjD;AANY,sCAAa;AAQ1B;;GAEG;AACH;IAAwC,sCAAa;IAGnD,4B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;IACH,CAAC;IACH,4BAAC;AAAD,CAAC,AAvBD,CAA2C,aAAa,GAuBvD;AAvBY,sDAAqB"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
export default interface CheckoutOptions {
|
2
|
+
environment?: 'live' | 'production' | 'test' | 'sandbox' | 'dev' | 'local';
|
3
|
+
url?: string;
|
4
|
+
public_key?: string;
|
5
|
+
container?: string | HTMLElement | null;
|
6
|
+
trigger?: string;
|
7
|
+
locale?: 'en' | 'fr';
|
8
|
+
transaction: {
|
9
|
+
id?: number;
|
10
|
+
amount: number;
|
11
|
+
description: string;
|
12
|
+
custom_metadata?: any;
|
13
|
+
};
|
14
|
+
currency: {
|
15
|
+
iso: string;
|
16
|
+
code?: number;
|
17
|
+
};
|
18
|
+
customer?: {
|
19
|
+
firstname: string;
|
20
|
+
lastname: string;
|
21
|
+
email: string;
|
22
|
+
phone_number?: {
|
23
|
+
number: string;
|
24
|
+
country: string;
|
25
|
+
};
|
26
|
+
};
|
27
|
+
button?: {
|
28
|
+
text?: string;
|
29
|
+
class?: string;
|
30
|
+
};
|
31
|
+
onComplete?: any;
|
32
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"checkout-options.js","sourceRoot":"","sources":["../../src/checkout-options.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import CheckoutOptions from './checkout-options';
|
3
|
+
export interface Props {
|
4
|
+
options: CheckoutOptions;
|
5
|
+
}
|
6
|
+
/**
|
7
|
+
* @class BaseComponent
|
8
|
+
*/
|
9
|
+
export declare class BaseComponent extends React.Component<Props> {
|
10
|
+
componentDidMount(): void;
|
11
|
+
}
|
12
|
+
/**
|
13
|
+
* @class FedaCheckoutButton
|
14
|
+
*/
|
15
|
+
export declare class FedaCheckoutButton extends BaseComponent {
|
16
|
+
buttonRef: any;
|
17
|
+
constructor(props: Props);
|
18
|
+
componentDidMount(): void;
|
19
|
+
initFedaPay(): void;
|
20
|
+
render(): React.JSX.Element;
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* @class FedaCheckoutContainer
|
24
|
+
*/
|
25
|
+
export declare class FedaCheckoutContainer extends BaseComponent {
|
26
|
+
containerRef: any;
|
27
|
+
constructor(props: Props);
|
28
|
+
componentDidMount(): void;
|
29
|
+
initFedaPay(): void;
|
30
|
+
render(): React.JSX.Element;
|
31
|
+
}
|
package/lib/esm/index.js
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
2
|
+
var extendStatics = function (d, b) {
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
6
|
+
return extendStatics(d, b);
|
7
|
+
};
|
8
|
+
return function (d, b) {
|
9
|
+
if (typeof b !== "function" && b !== null)
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
11
|
+
extendStatics(d, b);
|
12
|
+
function __() { this.constructor = d; }
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14
|
+
};
|
15
|
+
})();
|
16
|
+
var __assign = (this && this.__assign) || function () {
|
17
|
+
__assign = Object.assign || function(t) {
|
18
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
19
|
+
s = arguments[i];
|
20
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
21
|
+
t[p] = s[p];
|
22
|
+
}
|
23
|
+
return t;
|
24
|
+
};
|
25
|
+
return __assign.apply(this, arguments);
|
26
|
+
};
|
27
|
+
import * as React from 'react';
|
28
|
+
/**
|
29
|
+
* @class BaseComponent
|
30
|
+
*/
|
31
|
+
var BaseComponent = /** @class */ (function (_super) {
|
32
|
+
__extends(BaseComponent, _super);
|
33
|
+
function BaseComponent() {
|
34
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
35
|
+
}
|
36
|
+
BaseComponent.prototype.componentDidMount = function () {
|
37
|
+
if (typeof FedaPay === 'undefined') {
|
38
|
+
throw new Error('checkout.js script need to be included!');
|
39
|
+
}
|
40
|
+
};
|
41
|
+
return BaseComponent;
|
42
|
+
}(React.Component));
|
43
|
+
export { BaseComponent };
|
44
|
+
/**
|
45
|
+
* @class FedaCheckoutButton
|
46
|
+
*/
|
47
|
+
var FedaCheckoutButton = /** @class */ (function (_super) {
|
48
|
+
__extends(FedaCheckoutButton, _super);
|
49
|
+
function FedaCheckoutButton(props) {
|
50
|
+
var _this = _super.call(this, props) || this;
|
51
|
+
_this.buttonRef = React.createRef();
|
52
|
+
return _this;
|
53
|
+
}
|
54
|
+
FedaCheckoutButton.prototype.componentDidMount = function () {
|
55
|
+
_super.prototype.componentDidMount.call(this);
|
56
|
+
this.initFedaPay();
|
57
|
+
};
|
58
|
+
FedaCheckoutButton.prototype.initFedaPay = function () {
|
59
|
+
FedaPay.init(this.buttonRef, this.props.options);
|
60
|
+
};
|
61
|
+
FedaCheckoutButton.prototype.render = function () {
|
62
|
+
var _this = this;
|
63
|
+
return (React.createElement("button", __assign({ ref: function (el) { return _this.buttonRef = el; } }, this.props), "Click to Pay"));
|
64
|
+
};
|
65
|
+
return FedaCheckoutButton;
|
66
|
+
}(BaseComponent));
|
67
|
+
export { FedaCheckoutButton };
|
68
|
+
/**
|
69
|
+
* @class FedaCheckoutContainer
|
70
|
+
*/
|
71
|
+
var FedaCheckoutContainer = /** @class */ (function (_super) {
|
72
|
+
__extends(FedaCheckoutContainer, _super);
|
73
|
+
function FedaCheckoutContainer(props) {
|
74
|
+
var _this = _super.call(this, props) || this;
|
75
|
+
_this.containerRef = React.createRef();
|
76
|
+
return _this;
|
77
|
+
}
|
78
|
+
FedaCheckoutContainer.prototype.componentDidMount = function () {
|
79
|
+
_super.prototype.componentDidMount.call(this);
|
80
|
+
this.initFedaPay();
|
81
|
+
};
|
82
|
+
FedaCheckoutContainer.prototype.initFedaPay = function () {
|
83
|
+
this.props.options.container = this.containerRef;
|
84
|
+
FedaPay.init(this.props.options);
|
85
|
+
};
|
86
|
+
FedaCheckoutContainer.prototype.render = function () {
|
87
|
+
var _this = this;
|
88
|
+
return (React.createElement("div", __assign({ ref: function (el) { return _this.containerRef = el; } }, this.props)));
|
89
|
+
};
|
90
|
+
return FedaCheckoutContainer;
|
91
|
+
}(BaseComponent));
|
92
|
+
export { FedaCheckoutContainer };
|
93
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B;;GAEG;AACH;IAAmC,iCAAsB;IAAzD;;IAMA,CAAC;IALC,yCAAiB,GAAjB;QACE,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;YAClC,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;SAC5D;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AAND,CAAmC,KAAK,CAAC,SAAS,GAMjD;;AAED;;GAEG;AACH;IAAwC,sCAAa;IAGnD,4BAAY,KAAY;QAAxB,YACE,kBAAM,KAAK,CAAC,SAEb;QADC,KAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;;IACrC,CAAC;IAED,8CAAiB,GAAjB;QACE,iBAAM,iBAAiB,WAAE,CAAC;QAC1B,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAED,wCAAW,GAAX;QACE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnD,CAAC;IAED,mCAAM,GAAN;QAAA,iBAMC;QALC,OAAO,CACL,yCAAQ,GAAG,EAAE,UAAA,EAAE,IAAI,OAAA,KAAI,CAAC,SAAS,GAAG,EAAE,EAAnB,CAAmB,IAAM,IAAI,CAAC,KAAK,kBAE7C,CACV,CAAA;IACH,CAAC;IACH,yBAAC;AAAD,CAAC,AAxBD,CAAwC,aAAa,GAwBpD;;AAED;;GAEG;AACH;IAA2C,yCAAa;IAGtD,+BAAY,KAAY;QAAxB,YACE,kBAAM,KAAK,CAAC,SAEb;QADC,KAAI,CAAC,YAAY,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;;IACxC,CAAC;IAED,iDAAiB,GAAjB;QACE,iBAAM,iBAAiB,WAAE,CAAC;QAC1B,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAED,2CAAW,GAAX;QACE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC;QACjD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,sCAAM,GAAN;QAAA,iBAIC;QAHC,OAAO,CACL,sCAAK,GAAG,EAAE,UAAA,EAAE,IAAI,OAAA,KAAI,CAAC,YAAY,GAAG,EAAE,EAAtB,CAAsB,IAAM,IAAI,CAAC,KAAK,EAAQ,CAC/D,CAAA;IACH,CAAC;IACH,4BAAC;AAAD,CAAC,AAvBD,CAA2C,aAAa,GAuBvD"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "fedapay-reactjs",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.2",
|
4
4
|
"description": "FedaPay integration for ReactJs applications",
|
5
5
|
"author": "FedaPay",
|
6
6
|
"license": "MIT",
|
@@ -30,6 +30,6 @@
|
|
30
30
|
"typescript": "^4.9.5"
|
31
31
|
},
|
32
32
|
"files": [
|
33
|
-
"
|
33
|
+
"lib"
|
34
34
|
]
|
35
35
|
}
|