@atls/tinkoff-payment-widget 0.0.5 → 0.1.2
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/dist/data/fields.data.d.ts +2 -2
- package/dist/data/fields.data.js +6 -9
- package/dist/data/index.d.ts +1 -1
- package/dist/data/index.js +1 -17
- package/dist/enums/button.enum.js +2 -5
- package/dist/enums/fields.enum.js +4 -7
- package/dist/enums/index.d.ts +8 -8
- package/dist/enums/index.js +8 -24
- package/dist/enums/language.enum.js +2 -5
- package/dist/enums/payment-method.enum.js +2 -5
- package/dist/enums/payment-object.enum.js +2 -5
- package/dist/enums/tax.enum.js +2 -5
- package/dist/enums/taxation.enum.js +2 -5
- package/dist/enums/wrapper.enum.js +2 -5
- package/dist/hooks/index.d.ts +6 -6
- package/dist/hooks/index.js +6 -28
- package/dist/hooks/use-custom-button.hook.js +3 -7
- package/dist/hooks/use-custom-fields.hook.d.ts +2 -2
- package/dist/hooks/use-custom-fields.hook.js +13 -17
- package/dist/hooks/use-fields-render.hook.d.ts +6 -6
- package/dist/hooks/use-fields-render.hook.js +16 -23
- package/dist/hooks/use-fields-state.hook.d.ts +3 -3
- package/dist/hooks/use-fields-state.hook.js +6 -10
- package/dist/hooks/use-init.hook.js +5 -9
- package/dist/hooks/use-validate.hook.d.ts +2 -2
- package/dist/hooks/use-validate.hook.js +13 -17
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -22
- package/dist/interfaces/custom-fields.iterfaces.d.ts +1 -1
- package/dist/interfaces/custom-fields.iterfaces.js +1 -2
- package/dist/interfaces/fields.interfaces.d.ts +3 -3
- package/dist/interfaces/fields.interfaces.js +1 -2
- package/dist/interfaces/form.interfaces.d.ts +5 -5
- package/dist/interfaces/form.interfaces.js +1 -2
- package/dist/interfaces/index.d.ts +9 -9
- package/dist/interfaces/index.js +9 -25
- package/dist/interfaces/receipt.interfaces.d.ts +4 -4
- package/dist/interfaces/receipt.interfaces.js +1 -2
- package/dist/interfaces/settings.interfaces.d.ts +1 -1
- package/dist/interfaces/settings.interfaces.js +1 -2
- package/dist/interfaces/styles.interfaces.js +2 -5
- package/dist/interfaces/theme.interfaces.js +1 -2
- package/dist/interfaces/widget.interfaces.d.ts +4 -4
- package/dist/interfaces/widget.interfaces.js +1 -2
- package/dist/interfaces/wrappers.interfaces.d.ts +5 -5
- package/dist/interfaces/wrappers.interfaces.js +1 -2
- package/dist/locales/en.locale.d.ts +2 -0
- package/dist/locales/en.locale.js +9 -0
- package/dist/locales/index.d.ts +2 -0
- package/dist/locales/index.js +2 -0
- package/dist/locales/locale.interaces.d.ts +9 -0
- package/dist/locales/locale.interaces.js +1 -0
- package/dist/locales/ru.locale.d.ts +2 -0
- package/dist/locales/ru.locale.js +9 -0
- package/dist/ui/button/button.component.js +11 -18
- package/dist/ui/button/button.styles.js +24 -30
- package/dist/ui/fields.component.d.ts +1 -1
- package/dist/ui/fields.component.js +21 -28
- package/dist/ui/form/form.component.d.ts +1 -2
- package/dist/ui/form/form.component.js +17 -24
- package/dist/ui/form/form.context.d.ts +1 -2
- package/dist/ui/form/form.context.js +3 -6
- package/dist/ui/form/form.provider.d.ts +1 -1
- package/dist/ui/form/form.provider.js +17 -24
- package/dist/ui/form/index.d.ts +3 -2
- package/dist/ui/form/index.js +3 -18
- package/dist/ui/form/use-form.hook.d.ts +1 -1
- package/dist/ui/form/use-form.hook.js +4 -8
- package/dist/ui/index.d.ts +4 -4
- package/dist/ui/index.js +4 -23
- package/dist/ui/input/input.component.d.ts +2 -1
- package/dist/ui/input/input.component.js +32 -39
- package/dist/ui/input/input.styles.js +11 -15
- package/dist/ui/settings.component.d.ts +1 -1
- package/dist/ui/settings.component.js +11 -17
- package/dist/ui/theme/src/index.d.ts +2 -2
- package/dist/ui/theme/src/index.js +3 -32
- package/dist/ui/theme/src/theme/colors.js +1 -4
- package/dist/ui/theme/src/theme/index.d.ts +1 -1
- package/dist/ui/theme/src/theme/index.js +1 -17
- package/dist/ui/theme/src/theme.provider.d.ts +1 -1
- package/dist/ui/theme/src/theme.provider.js +4 -34
- package/dist/ui/widget.component.d.ts +1 -1
- package/dist/ui/widget.component.js +24 -54
- package/dist/ui/wrapper/button-wrapper.component.d.ts +1 -1
- package/dist/ui/wrapper/button-wrapper.component.js +10 -16
- package/dist/ui/wrapper/index.d.ts +2 -2
- package/dist/ui/wrapper/index.js +2 -18
- package/dist/ui/wrapper/input-wrapper.component.d.ts +1 -1
- package/dist/ui/wrapper/input-wrapper.component.js +12 -18
- package/dist/utils/add-receipt-fields.util.d.ts +1 -1
- package/dist/utils/add-receipt-fields.util.js +5 -9
- package/dist/utils/convert-to-penny.util.d.ts +1 -1
- package/dist/utils/convert-to-penny.util.js +1 -5
- package/dist/utils/get-name-fields.util.d.ts +1 -1
- package/dist/utils/get-name-fields.util.js +3 -7
- package/dist/utils/index.d.ts +5 -5
- package/dist/utils/index.js +5 -21
- package/dist/utils/is-custom-element.util.d.ts +1 -1
- package/dist/utils/is-custom-element.util.js +2 -6
- package/dist/utils/pay.util.d.ts +1 -1
- package/dist/utils/pay.util.js +4 -9
- package/dist/utils/translate.util.js +1 -5
- package/package.json +22 -2
- package/dist/locales/en.json +0 -9
- package/dist/locales/ru.json +0 -9
package/dist/utils/index.js
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./pay.util"), exports);
|
|
18
|
-
__exportStar(require("./add-receipt-fields.util"), exports);
|
|
19
|
-
__exportStar(require("./convert-to-penny.util"), exports);
|
|
20
|
-
__exportStar(require("./is-custom-element.util"), exports);
|
|
21
|
-
__exportStar(require("./get-name-fields.util"), exports);
|
|
1
|
+
export * from "./pay.util.js";
|
|
2
|
+
export * from "./add-receipt-fields.util.js";
|
|
3
|
+
export * from "./convert-to-penny.util.js";
|
|
4
|
+
export * from "./is-custom-element.util.js";
|
|
5
|
+
export * from "./get-name-fields.util.js";
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.isCustomElement = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const isCustomElement = (nameNode, node) => (0, react_1.isValidElement)(node) && typeof node.type === 'function'
|
|
1
|
+
import { isValidElement } from 'react';
|
|
2
|
+
export const isCustomElement = (nameNode, node) => isValidElement(node) && typeof node.type === 'function'
|
|
6
3
|
? node.type.displayName === nameNode &&
|
|
7
4
|
typeof node.props.children === 'function'
|
|
8
5
|
: false;
|
|
9
|
-
exports.isCustomElement = isCustomElement;
|
package/dist/utils/pay.util.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FormEventHandler } from 'react';
|
|
2
2
|
import type { FormEvent } from 'react';
|
|
3
|
-
import type { ReceiptSettings } from '../interfaces';
|
|
3
|
+
import type { ReceiptSettings } from '../interfaces/index.js';
|
|
4
4
|
export declare const makePayment: FormEventHandler<HTMLFormElement>;
|
|
5
5
|
export declare const makePaymentWithCheck: (event: FormEvent<HTMLFormElement>, receiptSettings: ReceiptSettings) => void;
|
package/dist/utils/pay.util.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.makePaymentWithCheck = exports.makePayment = void 0;
|
|
4
|
-
const convert_to_penny_util_1 = require("./convert-to-penny.util");
|
|
5
|
-
const makePayment = (event) => {
|
|
1
|
+
import { convertToPenny } from './convert-to-penny.util.js';
|
|
2
|
+
export const makePayment = (event) => {
|
|
6
3
|
const { pay } = window;
|
|
7
4
|
pay(event.target);
|
|
8
5
|
};
|
|
9
|
-
|
|
10
|
-
const makePaymentWithCheck = (event, receiptSettings) => {
|
|
6
|
+
export const makePaymentWithCheck = (event, receiptSettings) => {
|
|
11
7
|
const form = event.target;
|
|
12
8
|
const receiptElement = form.elements.namedItem('receipt');
|
|
13
9
|
const email = form.elements.namedItem('email');
|
|
@@ -15,7 +11,7 @@ const makePaymentWithCheck = (event, receiptSettings) => {
|
|
|
15
11
|
const receipt = {
|
|
16
12
|
Taxation: receiptSettings.Taxation,
|
|
17
13
|
EmailCompany: receiptSettings.EmailCompany,
|
|
18
|
-
Items:
|
|
14
|
+
Items: convertToPenny(receiptSettings.Items),
|
|
19
15
|
};
|
|
20
16
|
if (email?.value) {
|
|
21
17
|
receipt.Email = email.value;
|
|
@@ -27,4 +23,3 @@ const makePaymentWithCheck = (event, receiptSettings) => {
|
|
|
27
23
|
const { pay } = window;
|
|
28
24
|
pay(form);
|
|
29
25
|
};
|
|
30
|
-
exports.makePaymentWithCheck = makePaymentWithCheck;
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.translate = void 0;
|
|
4
|
-
const translate = (intl, messageId, defaultMessage) => intl.messages[messageId] ? intl.formatMessage({ id: messageId }) : defaultMessage;
|
|
5
|
-
exports.translate = translate;
|
|
1
|
+
export const translate = (intl, messageId, defaultMessage) => intl.messages[messageId] ? intl.formatMessage({ id: messageId }) : defaultMessage;
|
package/package.json
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atls/tinkoff-payment-widget",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
"./package.json": "./package.json",
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
5
14
|
"main": "dist/index.js",
|
|
6
15
|
"files": [
|
|
7
16
|
"dist"
|
|
@@ -26,11 +35,14 @@
|
|
|
26
35
|
"@emotion/jest": "11.9.4",
|
|
27
36
|
"@emotion/react": "11.9.3",
|
|
28
37
|
"@emotion/styled": "11.9.3",
|
|
29
|
-
"@testing-library/react": "
|
|
38
|
+
"@testing-library/react": "16.1.0",
|
|
39
|
+
"@types/node": "22.10.1",
|
|
30
40
|
"@types/react": "18.3.6",
|
|
31
41
|
"@types/react-dom": "18",
|
|
32
42
|
"@types/styled-system": "5.1.16",
|
|
33
43
|
"csstype": "3.1.2",
|
|
44
|
+
"global-jsdom": "25.0.0",
|
|
45
|
+
"jsdom": "25.0.1",
|
|
34
46
|
"react": "18.2.0",
|
|
35
47
|
"react-dom": "18.2.0",
|
|
36
48
|
"styled-system": "5.1.5"
|
|
@@ -42,6 +54,14 @@
|
|
|
42
54
|
},
|
|
43
55
|
"publishConfig": {
|
|
44
56
|
"access": "public",
|
|
57
|
+
"exports": {
|
|
58
|
+
"./package.json": "./package.json",
|
|
59
|
+
".": {
|
|
60
|
+
"import": "./dist/index.js",
|
|
61
|
+
"types": "./dist/index.d.ts",
|
|
62
|
+
"default": "./dist/index.js"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
45
65
|
"main": "dist/index.js",
|
|
46
66
|
"typings": "dist/index.d.ts"
|
|
47
67
|
},
|
package/dist/locales/en.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"payment_widget.pay": "Pay",
|
|
3
|
-
"payment_widget.order_price": "Order amount",
|
|
4
|
-
"payment_widget.email": "E-mail",
|
|
5
|
-
"payment_widget.error_required": "Required field",
|
|
6
|
-
"payment_widget.error_amount": "The amount must be greater than zero",
|
|
7
|
-
"payment_widget.error_email": "Incorrect e-mail",
|
|
8
|
-
"payment_widget.error_phone": "Incorrect phone"
|
|
9
|
-
}
|
package/dist/locales/ru.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"payment_widget.pay": "Оплатить",
|
|
3
|
-
"payment_widget.order_price": "Сумма заказа",
|
|
4
|
-
"payment_widget.email": "E-mail",
|
|
5
|
-
"payment_widget.error_required": "Обязательное поле",
|
|
6
|
-
"payment_widget.error_amount": "Сумма должна быть больше нуля",
|
|
7
|
-
"payment_widget.error_email": "Некорректный e-mail",
|
|
8
|
-
"payment_widget.error_phone": "Некорректный номер"
|
|
9
|
-
}
|