plutosdk 1.0.2-beta.1 → 1.0.2-beta.3
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/pluto-sdk.js +217 -217
- package/lib/components/CheckIn/index.js +3 -3
- package/lib/components/PayButton/index.d.ts +4 -2
- package/lib/components/PayButton/index.js +7 -2
- package/lib/components/Purchase/index.js +3 -3
- package/lib/components/StrokeText/index.d.ts +1 -0
- package/lib/components/StrokeText/index.js +4 -1
- package/lib/interface.d.ts +19 -4
- package/lib/main.js +4 -0
- package/lib/sdk.d.ts +2 -2
- package/lib/sdk.js +1 -1
- package/lib/utils/Platform.d.ts +3 -3
- package/lib/utils/Platform.js +25 -6
- package/lib/utils/constant.d.ts +13 -1
- package/lib/utils/constant.js +13 -1
- package/package.json +1 -1
|
@@ -13,8 +13,8 @@ import walletManager from '../../utils/WalletManager';
|
|
|
13
13
|
import ContentBg from '../ContentBg';
|
|
14
14
|
import BlurMask from '../BlurMask';
|
|
15
15
|
import ContentTitle from '../ContentTitle';
|
|
16
|
-
import
|
|
17
|
-
import
|
|
16
|
+
import CheckInInfo from '../CheckInInfo';
|
|
17
|
+
import CheckInButton from '../CheckInButton';
|
|
18
18
|
import Toast from '../Toast';
|
|
19
19
|
import Loading from '../Loading';
|
|
20
20
|
/**
|
|
@@ -80,7 +80,7 @@ export default class CheckIn extends PureComponent {
|
|
|
80
80
|
*/
|
|
81
81
|
render() {
|
|
82
82
|
const { showSlide } = this.state;
|
|
83
|
-
return (_jsxs(Box, Object.assign({ sx: { width: 1, height: 1, position: 'relative' } }, { children: [_jsx(BlurMask, {}), _jsxs(Box, Object.assign({ sx: { width: 1, height: 1, position: 'relative' } }, { children: [_jsx(Box, { sx: { width: 1, height: 1, position: 'fixed' }, onClick: this.onClickClose }), _jsx(Box, Object.assign({ sx: { width: 1, position: 'absolute', bottom: 40, pointerEvents: 'none' } }, { children: _jsx(Slide, Object.assign({ direction: 'up', in: showSlide, mountOnEnter: true, unmountOnExit: true, timeout: { enter: 600, exit: 600 }, onEntered: this.onEntered, onExited: this.onExited }, { children: _jsxs(Box, Object.assign({ sx: { width: '96%', maxWidth: 430, m: '0 auto', position: 'relative', pointerEvents: 'auto' } }, { children: [_jsx(ContentBg, {}), _jsx(ContentTitle, { title: 'Claim' }), _jsx(
|
|
83
|
+
return (_jsxs(Box, Object.assign({ sx: { width: 1, height: 1, position: 'relative' } }, { children: [_jsx(BlurMask, {}), _jsxs(Box, Object.assign({ sx: { width: 1, height: 1, position: 'relative' } }, { children: [_jsx(Box, { sx: { width: 1, height: 1, position: 'fixed' }, onClick: this.onClickClose }), _jsx(Box, Object.assign({ sx: { width: 1, position: 'absolute', bottom: 40, pointerEvents: 'none' } }, { children: _jsx(Slide, Object.assign({ direction: 'up', in: showSlide, mountOnEnter: true, unmountOnExit: true, timeout: { enter: 600, exit: 600 }, onEntered: this.onEntered, onExited: this.onExited }, { children: _jsxs(Box, Object.assign({ sx: { width: '96%', maxWidth: 430, m: '0 auto', position: 'relative', pointerEvents: 'auto' } }, { children: [_jsx(ContentBg, {}), _jsx(ContentTitle, { title: 'Claim' }), _jsx(CheckInInfo, {}), _jsx(Stack, Object.assign({ spacing: 2, sx: { mx: 5, pb: 4 } }, { children: _jsx(CheckInButton, { onClickSignIn: this.onClickSignIn }) }))] })) })) }))] }))] })));
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
86
|
*
|
|
@@ -3,6 +3,7 @@ import { PureComponent } from 'react';
|
|
|
3
3
|
import Box from '@mui/material/Box';
|
|
4
4
|
import Button from '@mui/material/Button';
|
|
5
5
|
import { getRes } from '../../utils/Utils';
|
|
6
|
+
import { CURRENCY, CURRENCY_ICON, CURRENCY_NAME } from '../../utils/constant';
|
|
6
7
|
import StrokeText from '../StrokeText';
|
|
7
8
|
/**
|
|
8
9
|
*
|
|
@@ -12,7 +13,11 @@ export default class PayButton extends PureComponent {
|
|
|
12
13
|
*
|
|
13
14
|
*/
|
|
14
15
|
render() {
|
|
15
|
-
const {
|
|
16
|
-
|
|
16
|
+
const { currency, price, oldPrice, discount, onClickPay } = this.props;
|
|
17
|
+
const icon = getRes(CURRENCY_ICON[currency]);
|
|
18
|
+
const name = CURRENCY_NAME[currency];
|
|
19
|
+
const priceStr = `${currency == CURRENCY.star ? price : price.toFixed(2)} ${name}`;
|
|
20
|
+
const oldPriceStr = `\xa0${currency == CURRENCY.star ? oldPrice : oldPrice.toFixed(2)} ${name}\xa0`;
|
|
21
|
+
return (_jsxs(Box, Object.assign({ sx: { height: 50, position: 'relative' } }, { children: [_jsxs(Button, Object.assign({ sx: { width: 1, height: 1, borderRadius: 3 }, variant: 'contained', onClick: onClickPay }, { children: [_jsx(Box, { sx: { width: 1, height: 1, position: 'absolute', top: 0, borderImage: `url(${getRes('button_2.png')})`, borderWidth: 20, borderStyle: 'solid', borderImageRepeat: 'repeat', borderImageSlice: '20 fill' } }), _jsx(Box, { component: 'img', src: icon, sx: { width: 30, height: 30, mr: 1, position: 'relative' } }), _jsx(StrokeText, { content: priceStr, fontSize: 22, color: '#fff', strokeColor: '#4a7408', strokeWidth: 3 }), _jsx(Box, { sx: { width: '10px' } }), discount > 0 ? (_jsx(StrokeText, { content: oldPriceStr, fontSize: 14, color: '#fff', strokeColor: '#4a7408', strokeWidth: 2, decorationLine: true })) : null] })), discount > 0 ? (_jsx(Box, Object.assign({ sx: { top: -12, right: -20, bottom: 0, left: -20, position: 'absolute', pointerEvents: 'none' } }, { children: _jsxs(Box, Object.assign({ sx: { width: 62, height: 50, rotate: '-20deg', position: 'relative', float: 'right', display: 'inline-block' } }, { children: [_jsx(Box, { component: 'img', src: getRes('sale_off.png'), sx: { width: 62, height: 50, position: 'absolute', display: 'block' } }), _jsx(Box, Object.assign({ sx: { top: 6, width: 62, height: 25, textAlign: 'center', color: '#fff', fontSize: 16, fontWeight: 'bold', position: 'absolute' } }, { children: `${discount * 100}%` })), _jsx(Box, Object.assign({ sx: { bottom: 6, width: 62, height: 25, textAlign: 'center', color: '#fff', fontSize: 16, fontWeight: 'bold', position: 'absolute' } }, { children: "OFF" }))] })) }))) : null] })));
|
|
17
22
|
}
|
|
18
23
|
}
|
|
@@ -6,7 +6,7 @@ import Stack from '@mui/material/Stack';
|
|
|
6
6
|
import PubSub from 'pubsub-js';
|
|
7
7
|
import { CHAIN } from '@tonconnect/ui';
|
|
8
8
|
import { CODE, CURRENCY, PS_PURCHASE_COMPLETED, PS_SWITCH_PAGE, PAGE_ID, PAY_TYPE, TOKEN_NAME } from '../../utils/constant';
|
|
9
|
-
import {
|
|
9
|
+
import { isAppleClient, onMobile } from '../../utils/Utils';
|
|
10
10
|
import Config from '../../utils/Config';
|
|
11
11
|
import user from '../../utils/User';
|
|
12
12
|
import platform from '../../utils/Platform';
|
|
@@ -145,9 +145,9 @@ export default class Purchase extends PureComponent {
|
|
|
145
145
|
*
|
|
146
146
|
*/
|
|
147
147
|
render() {
|
|
148
|
-
const { ton, usdt, cati, star } = user.purchaseData;
|
|
148
|
+
const { ton, tonOld, tonDiscount, usdt, usdtOld, usdtDiscount, cati, catiOld, catiDiscount, star, starOld, starDiscount } = user.purchaseData;
|
|
149
149
|
const { showSlide } = this.state;
|
|
150
|
-
return (_jsxs(Box, Object.assign({ sx: { width: 1, height: 1, position: 'relative' } }, { children: [_jsx(BlurMask, {}), _jsxs(Box, Object.assign({ sx: { width: 1, height: 1, position: 'relative', overflowY: 'auto', '::-webkit-scrollbar': { display: 'none' } } }, { children: [_jsx(Box, { sx: { width: 1, height: 1, position: 'fixed' }, onClick: this.onClickClose }), _jsx(Box, Object.assign({ sx: { width: '100%', position: 'absolute', pointerEvents: 'none', '@media (orientation: portrait)': { bottom: 20 }, '@media (orientation: landscape)': { top: 10 } } }, { children: _jsx(Slide, Object.assign({ direction: 'up', in: showSlide, mountOnEnter: true, unmountOnExit: true, timeout: { enter: 600, exit: 600 }, onExited: this.onExited }, { children: _jsxs(Box, Object.assign({ sx: { width: 1, maxWidth: 430, m: '0 auto', position: 'relative', pointerEvents: 'auto' } }, { children: [_jsx(ContentBg, {}), _jsx(ContentTitle, { title: 'Purchase' }), _jsx(PurchaseInfo, {}), _jsxs(Stack, Object.assign({ spacing: 2, sx: { mx: 5, pb: 4 } }, { children: [Config.TEST_MODE || (!onMobile() && !isAppleClient()) ? (_jsxs(_Fragment, { children: [_jsx(PayButton, {
|
|
150
|
+
return (_jsxs(Box, Object.assign({ sx: { width: 1, height: 1, position: 'relative' } }, { children: [_jsx(BlurMask, {}), _jsxs(Box, Object.assign({ sx: { width: 1, height: 1, position: 'relative', overflowY: 'auto', '::-webkit-scrollbar': { display: 'none' } } }, { children: [_jsx(Box, { sx: { width: 1, height: 1, position: 'fixed' }, onClick: this.onClickClose }), _jsx(Box, Object.assign({ sx: { width: '100%', position: 'absolute', pointerEvents: 'none', '@media (orientation: portrait)': { bottom: 20 }, '@media (orientation: landscape)': { top: 10 } } }, { children: _jsx(Slide, Object.assign({ direction: 'up', in: showSlide, mountOnEnter: true, unmountOnExit: true, timeout: { enter: 600, exit: 600 }, onExited: this.onExited }, { children: _jsxs(Box, Object.assign({ sx: { width: 1, maxWidth: 430, m: '0 auto', position: 'relative', pointerEvents: 'auto' } }, { children: [_jsx(ContentBg, {}), _jsx(ContentTitle, { title: 'Purchase' }), _jsx(PurchaseInfo, {}), _jsxs(Stack, Object.assign({ spacing: 2, sx: { mx: 5, pb: 4 } }, { children: [Config.TEST_MODE || (!onMobile() && !isAppleClient()) ? (_jsxs(_Fragment, { children: [_jsx(PayButton, { currency: CURRENCY.cati, price: cati, oldPrice: catiOld, discount: catiDiscount, onClickPay: this.onClickCati }), _jsx(PayButton, { currency: CURRENCY.ton, price: ton, oldPrice: tonOld, discount: tonDiscount, onClickPay: this.onClickTon }), _jsx(PayButton, { currency: CURRENCY.usdt, price: usdt, oldPrice: usdtOld, discount: usdtDiscount, onClickPay: this.onClickUsdt })] })) : null, _jsx(PayButton, { currency: CURRENCY.star, price: star, oldPrice: starOld, discount: starDiscount, onClickPay: this.onClickStar })] }))] })) })) }))] }))] })));
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
153
153
|
*
|
|
@@ -9,7 +9,7 @@ export default class StrokeText extends PureComponent {
|
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
11
|
render() {
|
|
12
|
-
const { content, fontSize, color, strokeColor, strokeWidth } = this.props;
|
|
12
|
+
const { content, fontSize, color, strokeColor, strokeWidth, decorationLine } = this.props;
|
|
13
13
|
const sx = {
|
|
14
14
|
color: color,
|
|
15
15
|
fontSize: fontSize,
|
|
@@ -17,6 +17,9 @@ export default class StrokeText extends PureComponent {
|
|
|
17
17
|
position: 'relative',
|
|
18
18
|
zIndex: 0,
|
|
19
19
|
textTransform: 'none',
|
|
20
|
+
textDecorationLine: decorationLine ? 'line-through' : 'none',
|
|
21
|
+
textDecorationColor: '#f30808',
|
|
22
|
+
textDecorationThickness: '0.1em',
|
|
20
23
|
'&:after': {
|
|
21
24
|
content: 'attr(content)',
|
|
22
25
|
WebkitTextStrokeColor: strokeColor,
|
package/lib/interface.d.ts
CHANGED
|
@@ -20,20 +20,35 @@ export interface IPurchase {
|
|
|
20
20
|
name?: string;
|
|
21
21
|
productId?: string;
|
|
22
22
|
orderId?: string;
|
|
23
|
-
|
|
23
|
+
customData?: string;
|
|
24
|
+
orderNo?: string;
|
|
24
25
|
usdt?: number;
|
|
26
|
+
usdtOld?: number;
|
|
27
|
+
usdtDiscount?: number;
|
|
28
|
+
ton?: number;
|
|
29
|
+
tonOld?: number;
|
|
30
|
+
tonDiscount?: number;
|
|
25
31
|
cati?: number;
|
|
32
|
+
catiOld?: number;
|
|
33
|
+
catiDiscount?: number;
|
|
26
34
|
star?: number;
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
starOld?: number;
|
|
36
|
+
starDiscount?: number;
|
|
29
37
|
}
|
|
30
|
-
export interface
|
|
38
|
+
export interface IPayOrder {
|
|
31
39
|
amount: string;
|
|
32
40
|
orderNo: string;
|
|
33
41
|
payload: string;
|
|
34
42
|
payLink: string;
|
|
35
43
|
address: string;
|
|
36
44
|
}
|
|
45
|
+
export interface IQueryOrder {
|
|
46
|
+
name: string;
|
|
47
|
+
productId: string;
|
|
48
|
+
orderId: string;
|
|
49
|
+
orderNo: string;
|
|
50
|
+
customData: string;
|
|
51
|
+
}
|
|
37
52
|
export interface ICheckIn {
|
|
38
53
|
name?: string;
|
|
39
54
|
orderId?: string;
|
package/lib/main.js
CHANGED
package/lib/sdk.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILogin,
|
|
1
|
+
import { ILogin, IQueryOrder } from './interface';
|
|
2
2
|
/**
|
|
3
3
|
*
|
|
4
4
|
*/
|
|
@@ -59,7 +59,7 @@ export declare const consumePurchase: (orderNo: string) => Promise<void>;
|
|
|
59
59
|
/**
|
|
60
60
|
*
|
|
61
61
|
*/
|
|
62
|
-
export declare const queryPurchses: () => Promise<
|
|
62
|
+
export declare const queryPurchses: () => Promise<IQueryOrder[]>;
|
|
63
63
|
/**
|
|
64
64
|
*
|
|
65
65
|
* @param type
|
package/lib/sdk.js
CHANGED
package/lib/utils/Platform.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IGame, ILogin,
|
|
1
|
+
import { IGame, ILogin, IPayOrder, IQueryOrder } from "../interface";
|
|
2
2
|
import { CURRENCY, PAY_TYPE } from './constant';
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
@@ -29,7 +29,7 @@ declare class Platform {
|
|
|
29
29
|
* @param payType
|
|
30
30
|
* @param currency
|
|
31
31
|
*/
|
|
32
|
-
reqOrder(payType: PAY_TYPE, currency: CURRENCY): Promise<
|
|
32
|
+
reqOrder(payType: PAY_TYPE, currency: CURRENCY): Promise<IPayOrder>;
|
|
33
33
|
/**
|
|
34
34
|
*
|
|
35
35
|
* @param orderNo
|
|
@@ -38,7 +38,7 @@ declare class Platform {
|
|
|
38
38
|
/**
|
|
39
39
|
*
|
|
40
40
|
*/
|
|
41
|
-
reqUnfinishRecord(): Promise<
|
|
41
|
+
reqUnfinishRecord(): Promise<IQueryOrder[]>;
|
|
42
42
|
/**
|
|
43
43
|
*
|
|
44
44
|
* @param name
|
package/lib/utils/Platform.js
CHANGED
|
@@ -81,15 +81,35 @@ class Platform {
|
|
|
81
81
|
*/
|
|
82
82
|
reqPurchase(productId, name, orderId, amount, customData) {
|
|
83
83
|
return Api.priceExchange(amount).then(data => {
|
|
84
|
+
const usdt = parseFloat(data['usdt']) || 0;
|
|
85
|
+
const ton = parseFloat(data['ton']) || 0;
|
|
86
|
+
const cati = parseFloat(data['cati']) || 0;
|
|
87
|
+
const star = parseInt(data['star']) || 0;
|
|
88
|
+
const usdtOff = parseFloat(data['usdtoff']) || 0;
|
|
89
|
+
const tonOff = parseFloat(data['tonoff']) || 0;
|
|
90
|
+
const catiOff = parseFloat(data['catioff']) || 0;
|
|
91
|
+
const starOff = parseFloat(data['staroff']) || 0;
|
|
92
|
+
const usdtDiscount = parseFloat(data['usdtdiscount']) || 0;
|
|
93
|
+
const tonDiscount = parseFloat(data['tondiscount']) || 0;
|
|
94
|
+
const catiDiscount = parseFloat(data['catidiscount']) || 0;
|
|
95
|
+
const starDiscount = parseFloat(data['stardiscount']) || 0;
|
|
84
96
|
user.purchaseData = {
|
|
85
97
|
name: name,
|
|
86
98
|
productId: productId,
|
|
87
99
|
orderId: orderId,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
100
|
+
customData: customData,
|
|
101
|
+
usdt: usdtDiscount ? usdtOff : usdt,
|
|
102
|
+
usdtOld: usdt,
|
|
103
|
+
usdtDiscount: usdtDiscount,
|
|
104
|
+
ton: tonDiscount ? tonOff : ton,
|
|
105
|
+
tonOld: ton,
|
|
106
|
+
tonDiscount: tonDiscount,
|
|
107
|
+
cati: catiDiscount ? catiOff : cati,
|
|
108
|
+
catiOld: cati,
|
|
109
|
+
catiDiscount: catiDiscount,
|
|
110
|
+
star: starDiscount ? starOff : star,
|
|
111
|
+
starOld: star,
|
|
112
|
+
starDiscount: starDiscount
|
|
93
113
|
};
|
|
94
114
|
});
|
|
95
115
|
}
|
|
@@ -102,7 +122,6 @@ class Platform {
|
|
|
102
122
|
const { productId, name, orderId, usdt, customData } = user.purchaseData;
|
|
103
123
|
return Api.order(productId, name, orderId, usdt, payType, currency, customData).then(data => {
|
|
104
124
|
user.purchaseData.orderNo = data['orderNo'];
|
|
105
|
-
//
|
|
106
125
|
return {
|
|
107
126
|
amount: data['amount'],
|
|
108
127
|
orderNo: data['orderNo'],
|
package/lib/utils/constant.d.ts
CHANGED
|
@@ -63,8 +63,8 @@ export declare enum PAY_TYPE {
|
|
|
63
63
|
tonConnect = 2
|
|
64
64
|
}
|
|
65
65
|
export declare enum CURRENCY {
|
|
66
|
-
ton = "TON",
|
|
67
66
|
usdt = "USDT",
|
|
67
|
+
ton = "TON",
|
|
68
68
|
cati = "CATI",
|
|
69
69
|
star = "STAR"
|
|
70
70
|
}
|
|
@@ -76,3 +76,15 @@ export declare enum ORIENTATION_TYPE {
|
|
|
76
76
|
portrait = 1,
|
|
77
77
|
landscape = 2
|
|
78
78
|
}
|
|
79
|
+
export declare const CURRENCY_NAME: {
|
|
80
|
+
USDT: string;
|
|
81
|
+
TON: string;
|
|
82
|
+
CATI: string;
|
|
83
|
+
STAR: string;
|
|
84
|
+
};
|
|
85
|
+
export declare const CURRENCY_ICON: {
|
|
86
|
+
USDT: string;
|
|
87
|
+
TON: string;
|
|
88
|
+
CATI: string;
|
|
89
|
+
STAR: string;
|
|
90
|
+
};
|
package/lib/utils/constant.js
CHANGED
|
@@ -67,8 +67,8 @@ export var PAY_TYPE;
|
|
|
67
67
|
})(PAY_TYPE || (PAY_TYPE = {}));
|
|
68
68
|
export var CURRENCY;
|
|
69
69
|
(function (CURRENCY) {
|
|
70
|
-
CURRENCY["ton"] = "TON";
|
|
71
70
|
CURRENCY["usdt"] = "USDT";
|
|
71
|
+
CURRENCY["ton"] = "TON";
|
|
72
72
|
CURRENCY["cati"] = "CATI";
|
|
73
73
|
CURRENCY["star"] = "STAR";
|
|
74
74
|
})(CURRENCY || (CURRENCY = {}));
|
|
@@ -82,3 +82,15 @@ export var ORIENTATION_TYPE;
|
|
|
82
82
|
ORIENTATION_TYPE[ORIENTATION_TYPE["portrait"] = 1] = "portrait";
|
|
83
83
|
ORIENTATION_TYPE[ORIENTATION_TYPE["landscape"] = 2] = "landscape";
|
|
84
84
|
})(ORIENTATION_TYPE || (ORIENTATION_TYPE = {}));
|
|
85
|
+
export const CURRENCY_NAME = {
|
|
86
|
+
[CURRENCY.usdt]: 'USDT',
|
|
87
|
+
[CURRENCY.ton]: 'TON',
|
|
88
|
+
[CURRENCY.cati]: 'CATI',
|
|
89
|
+
[CURRENCY.star]: 'Star'
|
|
90
|
+
};
|
|
91
|
+
export const CURRENCY_ICON = {
|
|
92
|
+
[CURRENCY.usdt]: 'coin_usdt.png',
|
|
93
|
+
[CURRENCY.ton]: 'coin_ton.png',
|
|
94
|
+
[CURRENCY.cati]: 'coin_cati.png',
|
|
95
|
+
[CURRENCY.star]: 'coin_star.png'
|
|
96
|
+
};
|