@tap-payments/os-micro-frontend-shared 0.1.299-test.10 → 0.1.299-test.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,32 @@
1
+ import { TextAndLang } from '../types/index.js';
2
+ interface Source {
3
+ code: string;
4
+ name: TextAndLang[];
5
+ }
6
+ interface PaymentMethod extends Source {
7
+ payment_methods: Source[];
8
+ }
9
+ export declare function transformPaymentMethodsData(data?: PaymentMethod[]): never[] | {
10
+ name: string;
11
+ type: string;
12
+ options: ({
13
+ name: string;
14
+ type: string;
15
+ icon: string;
16
+ options: {
17
+ name: string | undefined;
18
+ type: string;
19
+ icon: string;
20
+ }[];
21
+ } | null)[];
22
+ };
23
+ export declare function transformPaymentSchemesData(data?: Source[]): never[] | {
24
+ name: string;
25
+ type: string;
26
+ options: {
27
+ name: string | undefined;
28
+ type: string;
29
+ icon: string;
30
+ }[];
31
+ };
32
+ export {};
@@ -0,0 +1,80 @@
1
+ import { lightUrl } from '../constants/index.js';
2
+ import { getNameText } from './language';
3
+ const PAYMENT_TYPES = {
4
+ DEVICE: {
5
+ name: 'Device',
6
+ type: 'device',
7
+ icon: `${lightUrl}/device.svg`,
8
+ },
9
+ CARD: {
10
+ name: 'Cards',
11
+ type: 'cards',
12
+ icon: `${lightUrl}/payment-method/card.svg`,
13
+ },
14
+ PASS_THRU_WALLET: {
15
+ name: 'Pass-Thru Wallet',
16
+ type: 'pass_thru_wallet',
17
+ icon: `${lightUrl}/passThruWallet.svg`,
18
+ },
19
+ EXPRESS_CHECKOUT: {
20
+ name: 'Express Checkout',
21
+ type: 'express_checkout',
22
+ icon: `${lightUrl}/express_checkout.svg`,
23
+ },
24
+ STORED_VALUE_WALLET: {
25
+ name: 'Stored Value Wallet',
26
+ type: 'stored_value_wallet',
27
+ icon: `${lightUrl}/storedValueWallet.svg`,
28
+ },
29
+ CASH_WALLET: {
30
+ name: 'Cash Wallet',
31
+ type: 'cash_wallet',
32
+ icon: `${lightUrl}/cash.svg`,
33
+ },
34
+ BUY_NOW_PAY_LATER: {
35
+ name: 'Buy Now Pay Later',
36
+ type: 'buy_now_pay_later',
37
+ icon: `${lightUrl}/buyNowPayLater.svg`,
38
+ },
39
+ };
40
+ export function transformPaymentMethodsData(data) {
41
+ if (!data)
42
+ return [];
43
+ return {
44
+ name: 'Payment Methods',
45
+ type: 'payment_methods',
46
+ options: data === null || data === void 0 ? void 0 : data.map((category) => {
47
+ var _a, _b;
48
+ const paymentType = (_a = PAYMENT_TYPES[category.code]) !== null && _a !== void 0 ? _a : {};
49
+ if (!paymentType)
50
+ return null;
51
+ return {
52
+ name: paymentType === null || paymentType === void 0 ? void 0 : paymentType.name,
53
+ type: paymentType === null || paymentType === void 0 ? void 0 : paymentType.type,
54
+ icon: paymentType === null || paymentType === void 0 ? void 0 : paymentType.icon,
55
+ options: (_b = category.payment_methods) === null || _b === void 0 ? void 0 : _b.map((method) => ({
56
+ name: getNameText(method.name),
57
+ type: method.code,
58
+ icon: `${lightUrl}/payment-method/${method.code}.svg`,
59
+ })),
60
+ };
61
+ }),
62
+ };
63
+ }
64
+ export function transformPaymentSchemesData(data) {
65
+ if (!data)
66
+ return [];
67
+ return {
68
+ name: 'Payment Schemes',
69
+ type: 'payment_scheme',
70
+ options: data
71
+ .filter((scheme) => scheme.code)
72
+ .map((scheme) => {
73
+ return {
74
+ name: getNameText(scheme === null || scheme === void 0 ? void 0 : scheme.name),
75
+ type: scheme === null || scheme === void 0 ? void 0 : scheme.code,
76
+ icon: `${lightUrl}/payment-method/${scheme.code}.svg`,
77
+ };
78
+ }),
79
+ };
80
+ }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@tap-payments/os-micro-frontend-shared",
3
3
  "description": "Shared components and utilities for Tap Payments micro frontends",
4
- "version": "0.1.299-test.10",
5
- "testVersion": 10,
4
+ "version": "0.1.299-test.11",
5
+ "testVersion": 11,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",