react-native-bootpay-api 13.6.13 → 13.8.4

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/lib/Bootpay.d.ts CHANGED
@@ -34,7 +34,7 @@ export declare class Bootpay extends Component<BootpayTypesProps> {
34
34
  close: () => string;
35
35
  componentWillUnmount(): Promise<void>;
36
36
  componentDidMount(): void;
37
- render(): JSX.Element;
37
+ render(): React.JSX.Element;
38
38
  requestPayment: (payload: Payload, items: [Item], user: User, extra: Extra) => Promise<void>;
39
39
  requestSubscription: (payload: Payload, items: [Item], user: User, extra: Extra) => Promise<void>;
40
40
  requestAuthentication: (payload: Payload, items: [Item], user: User, extra: Extra) => Promise<void>;
package/lib/Bootpay.js CHANGED
@@ -1,451 +1,12 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
- return new (P || (P = Promise))(function (resolve, reject) {
19
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
- step((generator = generator.apply(thisArg, _arguments || [])).next());
23
- });
24
- };
25
- var __generator = (this && this.__generator) || function (thisArg, body) {
26
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
27
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
28
- function verb(n) { return function (v) { return step([n, v]); }; }
29
- function step(op) {
30
- if (f) throw new TypeError("Generator is already executing.");
31
- while (_) try {
32
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
- if (y = 0, t) op = [op[0] & 2, t.value];
34
- switch (op[0]) {
35
- case 0: case 1: t = op; break;
36
- case 4: _.label++; return { value: op[1], done: false };
37
- case 5: _.label++; y = op[1]; op = [0]; continue;
38
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
39
- default:
40
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
41
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
42
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
43
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
44
- if (t[2]) _.ops.pop();
45
- _.trys.pop(); continue;
46
- }
47
- op = body.call(thisArg, _);
48
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
49
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
- }
51
- };
52
- import React, { Component } from 'react';
53
- import { SafeAreaView, Modal, TouchableOpacity, Image, StyleSheet, Platform } from 'react-native';
54
- // import { StyleSheet, Platform } from 'react-native';
55
- // import { Platform, StyleSheet, Dimensions } from 'react-native';
56
- import WebView from 'react-native-webview-bootpay';
57
- import { Extra, User } from './BootpayTypes';
58
- import { debounce } from 'lodash';
59
- import UserInfo from './UserInfo';
60
- // import Loader from './Loader'
61
- // import ClipLoader from "react-spinners/ClipLoader";
62
- // import Spinner from 'react-native-loading-spinner-overlay';
63
- var Bootpay = /** @class */ (function (_super) {
64
- __extends(Bootpay, _super);
65
- function Bootpay(props) {
66
- var _this = _super.call(this, props) || this;
67
- _this.state = {
68
- visibility: false,
69
- script: '',
70
- firstLoad: false,
71
- showCloseButton: false,
72
- isShowProgress: false
73
- };
74
- // _payload = {}
75
- _this._VERSION = "4.3.1";
76
- _this._DEBUG = false;
77
- _this.dismiss = function () {
78
- _this.setState({
79
- visibility: false
80
- });
81
- };
82
- _this.showProgressBar = function (isShow) {
83
- _this.setState({
84
- isShowProgress: isShow
85
- });
86
- };
87
- _this.closeDismiss = function () {
88
- if (_this.props.onClose != undefined)
89
- _this.props.onClose();
90
- _this.dismiss();
91
- };
92
- _this.onMessage = function (event) { return __awaiter(_this, void 0, void 0, function () {
93
- var res, data, redirect, show_success, show_error;
94
- var _a, _b, _c, _d;
95
- return __generator(this, function (_e) {
96
- if (event == undefined)
97
- return [2 /*return*/];
98
- res = JSON.parse(JSON.stringify(event.nativeEvent.data));
99
- if (res == 'close') {
100
- this.showProgressBar(false);
101
- this.closeDismiss();
102
- return [2 /*return*/];
103
- }
104
- data = JSON.parse(res);
105
- redirect = false;
106
- show_success = false;
107
- show_error = false;
108
- if (((_a = this.payload) === null || _a === void 0 ? void 0 : _a.extra) != undefined) {
109
- if (((_b = this.payload.extra) === null || _b === void 0 ? void 0 : _b.open_type) == 'redirect') {
110
- redirect = true;
111
- }
112
- if (((_c = this.payload.extra) === null || _c === void 0 ? void 0 : _c.display_error_result) == true) {
113
- show_error = true;
114
- }
115
- if (((_d = this.payload.extra) === null || _d === void 0 ? void 0 : _d.display_success_result) == true) {
116
- show_success = true;
117
- }
118
- }
119
- if (redirect === true) {
120
- switch (data.event) {
121
- case 'cancel':
122
- this.showProgressBar(false);
123
- if (this.props.onCancel != undefined)
124
- this.props.onCancel(data);
125
- this.closeDismiss();
126
- break;
127
- case 'error':
128
- this.showProgressBar(false);
129
- if (this.props.onError != undefined)
130
- this.props.onError(data);
131
- if (show_error == false) {
132
- this.closeDismiss();
133
- }
134
- break;
135
- case 'issued':
136
- this.showProgressBar(false);
137
- if (this.props.onIssued != undefined)
138
- this.props.onIssued(data);
139
- if (show_success == false) {
140
- this.closeDismiss();
141
- }
142
- break;
143
- case 'confirm':
144
- this.showProgressBar(true);
145
- // if(this.props.onConfirm != undefined) this.props.onConfirm(data);
146
- if (this.props.onConfirm != undefined) {
147
- if (this.props.onConfirm(data)) {
148
- this.transactionConfirm();
149
- }
150
- }
151
- break;
152
- case 'done':
153
- this.showProgressBar(false);
154
- if (this.props.onDone != undefined)
155
- this.props.onDone(data);
156
- if (show_success == false) {
157
- this.closeDismiss();
158
- }
159
- break;
160
- case 'close':
161
- this.showProgressBar(false);
162
- this.closeDismiss();
163
- break;
164
- }
165
- }
166
- else {
167
- switch (data.event) {
168
- case 'cancel':
169
- this.showProgressBar(false);
170
- if (this.props.onCancel != undefined)
171
- this.props.onCancel(data);
172
- break;
173
- case 'error':
174
- this.showProgressBar(false);
175
- if (this.props.onError != undefined)
176
- this.props.onError(data);
177
- break;
178
- case 'issued':
179
- this.showProgressBar(false);
180
- if (this.props.onIssued != undefined)
181
- this.props.onIssued(data);
182
- break;
183
- case 'confirm':
184
- this.showProgressBar(true);
185
- if (this.props.onConfirm != undefined) {
186
- if (this.props.onConfirm(data)) {
187
- this.transactionConfirm();
188
- }
189
- }
190
- break;
191
- case 'done':
192
- this.showProgressBar(false);
193
- if (this.props.onDone != undefined)
194
- this.props.onDone(data);
195
- break;
196
- case 'close':
197
- this.showProgressBar(false);
198
- this.closeDismiss();
199
- break;
200
- }
201
- }
202
- return [2 /*return*/];
203
- });
204
- }); };
205
- _this.onShouldStartLoadWithRequest = function (_) {
206
- return true;
207
- };
208
- _this.getSDKVersion = function () {
209
- if (Platform.OS == 'ios') {
210
- return "Bootpay.setVersion('" + _this._VERSION + "', 'ios_react_native')";
211
- // return "Bootpay.setDevice('IOS');";
212
- }
213
- else if (Platform.OS == 'android') {
214
- return "Bootpay.setVersion('" + _this._VERSION + "', 'android_react_native')";
215
- // return "Bootpay.setDevice('ANDROID');";
216
- }
217
- else {
218
- return "";
219
- }
220
- };
221
- _this.getEnvironmentMode = function () {
222
- if (_this._DEBUG) {
223
- return "Bootpay.setEnvironmentMode('development');";
224
- }
225
- return "";
226
- };
227
- _this.getBootpayPlatform = function () {
228
- if (Platform.OS == 'ios') {
229
- return "Bootpay.setDevice('IOS');";
230
- }
231
- else if (Platform.OS == 'android') {
232
- return "Bootpay.setDevice('ANDROID');";
233
- }
234
- else {
235
- return "";
236
- }
237
- };
238
- // setPayScript = () => {
239
- // const fullScript = this.generateScript(this.state.script);
240
- // this.injectJavaScript(fullScript);
241
- // if(this.state.showCloseButton == true) {
242
- // if(this.webView == null || this.webView == undefined) return;
243
- // this.webView.showCloseButton( );
244
- // }
245
- // }
246
- _this.transactionConfirm = function () {
247
- var script = "Bootpay.confirm()"
248
- +
249
- ".then( function (res) {" +
250
- _this.confirm() +
251
- _this.issued() +
252
- _this.done() +
253
- "}, function (res) {" +
254
- _this.error() +
255
- _this.cancel() +
256
- "})";
257
- _this.callJavaScript(script);
258
- };
259
- _this.removePaymentWindow = function () {
260
- _this.dismiss();
261
- // this.callJavaScript(`
262
- // Bootpay.removePaymentWindow();
263
- // `);
264
- };
265
- _this.callJavaScript = function (script) {
266
- var _a;
267
- if (_this.webView == null || _this.webView == undefined)
268
- return;
269
- (_a = _this.webView.current) === null || _a === void 0 ? void 0 : _a.injectJavaScript("\n setTimeout(function() { ".concat(script, " }, 30);\n "));
270
- };
271
- _this.getAnalyticsData = function () { return __awaiter(_this, void 0, void 0, function () {
272
- var uuid, bootLastTime, elaspedTime;
273
- return __generator(this, function (_a) {
274
- switch (_a.label) {
275
- case 0: return [4 /*yield*/, UserInfo.getBootpayUUID()];
276
- case 1:
277
- uuid = _a.sent();
278
- return [4 /*yield*/, UserInfo.getBootpayLastTime()];
279
- case 2:
280
- bootLastTime = _a.sent();
281
- elaspedTime = Date.now() - bootLastTime;
282
- return [2 /*return*/, "window.Bootpay.$analytics.setAnalyticsData({uuid:'".concat(uuid, "', time:").concat(elaspedTime, "});")];
283
- }
284
- });
285
- }); };
286
- _this.confirm = function () {
287
- return "if (res.event === 'confirm') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
288
- };
289
- _this.done = function () {
290
- return "else if (res.event === 'done') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
291
- };
292
- _this.issued = function () {
293
- return "else if (res.event === 'issued') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
294
- };
295
- _this.error = function () {
296
- return "if (res.event === 'error') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
297
- };
298
- _this.cancel = function () {
299
- return "else if (res.event === 'cancel') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
300
- };
301
- _this.close = function () {
302
- return "document.addEventListener('bootpayclose', function (e) { window.BootpayRNWebView.postMessage('close'); });";
303
- };
304
- _this.requestPayment = function (payload, items, user, extra) { return __awaiter(_this, void 0, void 0, function () {
305
- return __generator(this, function (_a) {
306
- this.bootpayRequest(payload, items, user, extra, "requestPayment");
307
- return [2 /*return*/];
308
- });
309
- }); };
310
- _this.requestSubscription = function (payload, items, user, extra) { return __awaiter(_this, void 0, void 0, function () {
311
- return __generator(this, function (_a) {
312
- this.bootpayRequest(payload, items, user, extra, "requestSubscription");
313
- return [2 /*return*/];
314
- });
315
- }); };
316
- _this.requestAuthentication = function (payload, items, user, extra) { return __awaiter(_this, void 0, void 0, function () {
317
- return __generator(this, function (_a) {
318
- this.bootpayRequest(payload, items, user, extra, "requestAuthentication");
319
- return [2 /*return*/];
320
- });
321
- }); };
322
- _this.bootpayRequest = function (payload, items, user, extra, requestMethod) { return __awaiter(_this, void 0, void 0, function () {
323
- var _a, _b;
324
- var _c;
325
- return __generator(this, function (_d) {
326
- switch (_d.label) {
327
- case 0:
328
- payload.application_id = Platform.OS == 'ios' ? this.props.ios_application_id : this.props.android_application_id;
329
- payload.items = items;
330
- payload.user = user;
331
- payload.user = Object.assign(new User(), user); //set default value from class optional parameter value
332
- payload.extra = Object.assign(new Extra(), extra); //set default value from class optional parameter value
333
- this.payload = payload;
334
- _a = this.setState;
335
- _c = {
336
- visibility: true
337
- };
338
- _b = "\n ".concat;
339
- return [4 /*yield*/, this.getMountJavascript()];
340
- case 1:
341
- _a.apply(this, [(_c.script = _b.apply("\n ", [_d.sent(), " \n "]).concat(this.generateScript(payload, requestMethod), "\n "),
342
- _c.firstLoad = false,
343
- _c.showCloseButton = extra.show_close_button || false,
344
- _c.spinner = false,
345
- _c)]);
346
- UserInfo.updateInfo();
347
- return [2 /*return*/];
348
- }
349
- });
350
- }); };
351
- _this.getMountJavascript = function () { return __awaiter(_this, void 0, void 0, function () {
352
- var _a, _b;
353
- return __generator(this, function (_c) {
354
- switch (_c.label) {
355
- case 0:
356
- _b = (_a = "\n ".concat(this.getSDKVersion(), "\n ").concat(this.getEnvironmentMode(), "\n ").concat(this.getBootpayPlatform(), "\n ").concat(this.close(), "\n ")).concat;
357
- return [4 /*yield*/, this.getAnalyticsData()];
358
- case 1: return [2 /*return*/, _b.apply(_a, [_c.sent(), "\n "])];
359
- }
360
- });
361
- }); };
362
- _this.generateScript = function (payload, requestMethod) {
363
- var script = "Bootpay." + requestMethod +
364
- "(".concat(JSON.stringify(payload), ")") +
365
- ".then( function (res) {" +
366
- _this.confirm() +
367
- _this.issued() +
368
- _this.done() +
369
- "}, function (res) {" +
370
- _this.error() +
371
- _this.cancel() +
372
- "}); void(0);";
373
- return script;
374
- };
375
- _this.webView = React.createRef();
376
- return _this;
377
- }
378
- Bootpay.prototype.componentWillUnmount = function () {
379
- return __awaiter(this, void 0, void 0, function () {
380
- return __generator(this, function (_a) {
381
- this.setState({
382
- visibility: false,
383
- firstLoad: false,
384
- showCloseButton: false
385
- });
386
- UserInfo.setBootpayLastTime(Date.now());
387
- return [2 /*return*/];
388
- });
389
- });
390
- };
391
- Bootpay.prototype.componentDidMount = function () {
392
- this.closeDismiss = debounce(this.closeDismiss, 30);
393
- };
394
- Bootpay.prototype.render = function () {
395
- var _this = this;
396
- return (<Modal animationType={'slide'} transparent={false} onRequestClose={function () {
397
- _this.closeDismiss();
398
- // console.log(1234);
399
- // this.dismiss();
400
- }} visible={this.state.visibility}>
401
- <SafeAreaView style={{ flex: 1 }}>
402
- {this.state.showCloseButton &&
403
- <TouchableOpacity onPress={function () {
404
- var cancelData = {
405
- action: 'BootpayCancel',
406
- message: '사용자에 의해 취소되었습니다'
407
- };
408
- if (_this.props.onCancel != undefined)
409
- _this.props.onCancel(cancelData);
410
- if (_this.props.onClose != undefined)
411
- _this.props.onClose();
412
- _this.setState({ visibility: false });
413
- // this.showProgressBar(true);
414
- }}>
415
- <Image style={[styles.overlay]} source={require('../images/close.png')}/>
416
- </TouchableOpacity>}
417
-
418
- <WebView ref={this.webView} originWhitelist={['*']} source={{
419
- uri: 'https://webview.bootpay.co.kr/4.3.3'
420
- }} injectedJavaScript={this.state.script} javaScriptEnabled={true} javaScriptCanOpenWindowsAutomatically={true}
421
- // scalesPageToFit={true}
422
- onMessage={this.onMessage}/>
423
- </SafeAreaView>
424
-
425
-
426
- </Modal>);
427
- };
428
- return Bootpay;
429
- }(Component));
430
- export { Bootpay };
431
- var styles = StyleSheet.create({
432
- container: {
433
- flex: 1,
434
- justifyContent: 'center',
435
- alignItems: 'center',
436
- backgroundColor: '#F5FCFF'
437
- },
438
- welcome: {
439
- fontSize: 20,
440
- textAlign: 'center',
441
- margin: 10
442
- },
443
- // Flex to fill, position absolute,
444
- // Fixed left/top, and the width set to the window width
445
- overlay: {
446
- width: 25,
447
- height: 25,
448
- right: 5,
449
- alignSelf: 'flex-end'
450
- }
451
- });
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.Bootpay=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _reactNativeWebviewBootpay=_interopRequireDefault(require("react-native-webview-bootpay"));var _BootpayTypes=require("./BootpayTypes");var _lodash=require("lodash");var _UserInfo=_interopRequireDefault(require("./UserInfo"));var _jsxRuntime=require("react/jsx-runtime");var _jsxFileName="/Users/taesupyoon/bootpay/client/react-native/react-native-bootpay-api/src/Bootpay.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&{}.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}function _callSuper(t,o,e){return o=(0,_getPrototypeOf2.default)(o),(0,_possibleConstructorReturn2.default)(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],(0,_getPrototypeOf2.default)(t).constructor):o.apply(t,e));}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}var Bootpay=exports.Bootpay=function(_Component){function Bootpay(props){var _this;(0,_classCallCheck2.default)(this,Bootpay);_this=_callSuper(this,Bootpay,[props]);_this.state={visibility:false,script:'',firstLoad:false,showCloseButton:false,isShowProgress:false};_this._VERSION="13.8.2";_this._DEBUG=false;_this.dismiss=function(){_this.setState({visibility:false});};_this.showProgressBar=function(isShow){_this.setState({isShowProgress:isShow});};_this.closeDismiss=function(){if(_this.props.onClose!=undefined)_this.props.onClose();_this.dismiss();};_this.onMessage=function(){var _ref=(0,_asyncToGenerator2.default)(function*(event){var _this$payload;if(event==undefined)return;console.log(event.nativeEvent.data);var res=JSON.parse(JSON.stringify(event.nativeEvent.data));console.log(res);if(res=='close'){_this.showProgressBar(false);_this.closeDismiss();return;}var data=JSON.parse(res);var redirect=false;var show_success=false;var show_error=false;if(((_this$payload=_this.payload)==null?void 0:_this$payload.extra)!=undefined){var _this$payload$extra,_this$payload$extra2,_this$payload$extra3;if(((_this$payload$extra=_this.payload.extra)==null?void 0:_this$payload$extra.open_type)=='redirect'){redirect=true;}if(((_this$payload$extra2=_this.payload.extra)==null?void 0:_this$payload$extra2.display_error_result)==true){show_error=true;}if(((_this$payload$extra3=_this.payload.extra)==null?void 0:_this$payload$extra3.display_success_result)==true){show_success=true;}}if(redirect===true){switch(data.event){case'cancel':_this.showProgressBar(false);if(_this.props.onCancel!=undefined)_this.props.onCancel(data);_this.closeDismiss();break;case'error':_this.showProgressBar(false);if(_this.props.onError!=undefined)_this.props.onError(data);if(show_error==false){_this.closeDismiss();}break;case'issued':_this.showProgressBar(false);if(_this.props.onIssued!=undefined)_this.props.onIssued(data);if(show_success==false){_this.closeDismiss();}break;case'confirm':_this.showProgressBar(true);if(_this.props.onConfirm!=undefined){if(_this.props.onConfirm(data)){_this.transactionConfirm();}}break;case'done':_this.showProgressBar(false);if(_this.props.onDone!=undefined)_this.props.onDone(data);if(show_success==false){_this.closeDismiss();}break;case'close':_this.showProgressBar(false);_this.closeDismiss();break;}}else{switch(data.event){case'cancel':_this.showProgressBar(false);if(_this.props.onCancel!=undefined)_this.props.onCancel(data);break;case'error':_this.showProgressBar(false);if(_this.props.onError!=undefined)_this.props.onError(data);break;case'issued':_this.showProgressBar(false);if(_this.props.onIssued!=undefined)_this.props.onIssued(data);break;case'confirm':_this.showProgressBar(true);if(_this.props.onConfirm!=undefined){if(_this.props.onConfirm(data)){_this.transactionConfirm();}}break;case'done':_this.showProgressBar(false);if(_this.props.onDone!=undefined)_this.props.onDone(data);break;case'close':_this.showProgressBar(false);_this.closeDismiss();break;}}});return function(_x){return _ref.apply(this,arguments);};}();_this.onShouldStartLoadWithRequest=function(_){return true;};_this.getSDKVersion=function(){if(_reactNative.Platform.OS=='ios'){return"Bootpay.setVersion('"+_this._VERSION+"', 'ios_react_native')";}else if(_reactNative.Platform.OS=='android'){return"Bootpay.setVersion('"+_this._VERSION+"', 'android_react_native')";}else{return"";}};_this.getEnvironmentMode=function(){if(_this._DEBUG){return"Bootpay.setEnvironmentMode('development');";}return"";};_this.getBootpayPlatform=function(){if(_reactNative.Platform.OS=='ios'){return"Bootpay.setDevice('IOS');";}else if(_reactNative.Platform.OS=='android'){return"Bootpay.setDevice('ANDROID');";}else{return"";}};_this.transactionConfirm=function(){var script="Bootpay.confirm()"+".then( function (res) {"+_this.confirm()+_this.issued()+_this.done()+"}, function (res) {"+_this.error()+_this.cancel()+"})";_this.callJavaScript(script);};_this.removePaymentWindow=function(){_this.dismiss();};_this.callJavaScript=function(script){var _this$webView$current;if(_this.webView==null||_this.webView==undefined)return;(_this$webView$current=_this.webView.current)==null?void 0:_this$webView$current.injectJavaScript(`
2
+ setTimeout(function() { ${script} }, 30);
3
+ `);};_this.getAnalyticsData=(0,_asyncToGenerator2.default)(function*(){var uuid=yield _UserInfo.default.getBootpayUUID();var bootLastTime=yield _UserInfo.default.getBootpayLastTime();var elaspedTime=Date.now()-bootLastTime;return`window.Bootpay.$analytics.setAnalyticsData({uuid:'${uuid}', time:${elaspedTime}});`;});_this.confirm=function(){return"if (res.event === 'confirm') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";};_this.done=function(){return"else if (res.event === 'done') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";};_this.issued=function(){return"else if (res.event === 'issued') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";};_this.error=function(){return"if (res.event === 'error') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";};_this.cancel=function(){return"else if (res.event === 'cancel') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";};_this.close=function(){return"document.addEventListener('bootpayclose', function (e) { window.BootpayRNWebView.postMessage('close'); });";};_this.requestPayment=function(){var _ref3=(0,_asyncToGenerator2.default)(function*(payload,items,user,extra){_this.bootpayRequest(payload,items,user,extra,"requestPayment");});return function(_x2,_x3,_x4,_x5){return _ref3.apply(this,arguments);};}();_this.requestSubscription=function(){var _ref4=(0,_asyncToGenerator2.default)(function*(payload,items,user,extra){_this.bootpayRequest(payload,items,user,extra,"requestSubscription");});return function(_x6,_x7,_x8,_x9){return _ref4.apply(this,arguments);};}();_this.requestAuthentication=function(){var _ref5=(0,_asyncToGenerator2.default)(function*(payload,items,user,extra){_this.bootpayRequest(payload,items,user,extra,"requestAuthentication");});return function(_x10,_x11,_x12,_x13){return _ref5.apply(this,arguments);};}();_this.bootpayRequest=function(){var _ref6=(0,_asyncToGenerator2.default)(function*(payload,items,user,extra,requestMethod){payload.application_id=_reactNative.Platform.OS=='ios'?_this.props.ios_application_id:_this.props.android_application_id;payload.items=items;payload.user=user;payload.user=Object.assign(new _BootpayTypes.User(),user);payload.extra=Object.assign(new _BootpayTypes.Extra(),extra);_this.payload=payload;_this.setState({visibility:true,script:`
4
+ ${yield _this.getMountJavascript()}
5
+ ${_this.generateScript(payload,requestMethod)}
6
+ `,firstLoad:false,showCloseButton:extra.show_close_button||false,spinner:false});_UserInfo.default.updateInfo();});return function(_x14,_x15,_x16,_x17,_x18){return _ref6.apply(this,arguments);};}();_this.getMountJavascript=(0,_asyncToGenerator2.default)(function*(){return`
7
+ ${_this.getSDKVersion()}
8
+ ${_this.getEnvironmentMode()}
9
+ ${_this.getBootpayPlatform()}
10
+ ${_this.close()}
11
+ ${yield _this.getAnalyticsData()}
12
+ `;});_this.generateScript=function(payload,requestMethod){var script="Bootpay."+requestMethod+`(${JSON.stringify(payload)})`+".then( function (res) {"+_this.confirm()+_this.issued()+_this.done()+"}, function (res) {"+_this.error()+_this.cancel()+"}); void(0);";return script;};_this.webView=_react.default.createRef();return _this;}(0,_inherits2.default)(Bootpay,_Component);return(0,_createClass2.default)(Bootpay,[{key:"componentWillUnmount",value:function(){var _componentWillUnmount=(0,_asyncToGenerator2.default)(function*(){this.setState({visibility:false,firstLoad:false,showCloseButton:false});_UserInfo.default.setBootpayLastTime(Date.now());});function componentWillUnmount(){return _componentWillUnmount.apply(this,arguments);}return componentWillUnmount;}()},{key:"componentDidMount",value:function componentDidMount(){this.closeDismiss=(0,_lodash.debounce)(this.closeDismiss,30);}},{key:"render",value:function render(){var _this2=this;return(0,_jsxRuntime.jsx)(_reactNative.Modal,{animationType:'slide',transparent:false,onRequestClose:function onRequestClose(){_this2.closeDismiss();},visible:this.state.visibility,children:(0,_jsxRuntime.jsxs)(_reactNative.SafeAreaView,{style:{flex:1},children:[this.state.showCloseButton&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:function onPress(){var cancelData={action:'BootpayCancel',message:'사용자에 의해 취소되었습니다'};if(_this2.props.onCancel!=undefined)_this2.props.onCancel(cancelData);if(_this2.props.onClose!=undefined)_this2.props.onClose();_this2.setState({visibility:false});},children:(0,_jsxRuntime.jsx)(_reactNative.Image,{style:[styles.overlay],source:require('../images/close.png')})}),(0,_jsxRuntime.jsx)(_reactNativeWebviewBootpay.default,{ref:this.webView,originWhitelist:['*'],source:{uri:'https://webview.bootpay.co.kr/5.0.0-beta.25'},injectedJavaScript:this.state.script,javaScriptEnabled:true,javaScriptCanOpenWindowsAutomatically:true,onMessage:this.onMessage,onError:function onError(syntheticEvent){var nativeEvent=syntheticEvent.nativeEvent;if(nativeEvent.code==3){_this2.showProgressBar(false);if(_this2.props.onError!=undefined)_this2.props.onError({code:nativeEvent.code,message:nativeEvent.description});_this2.closeDismiss();}}})]})});}}]);}(_react.Component);var styles=_reactNative.StyleSheet.create({container:{flex:1,justifyContent:'center',alignItems:'center',backgroundColor:'#F5FCFF'},welcome:{fontSize:20,textAlign:'center',margin:10},overlay:{width:25,height:25,right:5,alignSelf:'flex-end'}});
@@ -1,69 +1 @@
1
- var User = /** @class */ (function () {
2
- function User() {
3
- }
4
- return User;
5
- }());
6
- export { User };
7
- var Item = /** @class */ (function () {
8
- function Item() {
9
- }
10
- return Item;
11
- }());
12
- export { Item };
13
- var StatItem = /** @class */ (function () {
14
- function StatItem() {
15
- }
16
- return StatItem;
17
- }());
18
- export { StatItem };
19
- var Onestore = /** @class */ (function () {
20
- function Onestore() {
21
- this.ad_id = "UNKNOWN_ADID";
22
- this.sim_operator = "UNKNOWN_SIM_OPERATOR";
23
- this.installer_package_name = "UNKNOWN_INSTALLER";
24
- }
25
- return Onestore;
26
- }());
27
- export { Onestore };
28
- // export interface Extra {
29
- // card_quota?: string;
30
- // seller_name?: string;
31
- // delivery_day?: number;
32
- // }
33
- var Extra = /** @class */ (function () {
34
- function Extra() {
35
- this.delivery_day = 1; // 배송일자
36
- this.locale = 'ko'; //결제창 언어지원
37
- this.display_cash_receipt = true; // 현금영수증 보일지 말지.. 가상계좌 KCP 옵션
38
- this.use_card_point = true; //카드 포인트 사용 여부 (토스만 가능)
39
- this.use_order_id = false; //가맹점 order_id로 PG로 전송
40
- this.international_card_only = false; // 해외 결제카드 선택 여부 (토스만 가능)
41
- this.phone_carrier = ""; //본인인증 시 고정할 통신사명, SKT,KT,LGT 중 1개만 가능
42
- this.direct_app_card = false; // 카드사앱으로 direct 호출
43
- this.direct_samsungpay = false; // 삼성페이 바로 띄우기
44
- this.test_deposit = false; // 가상계좌 모의 입금
45
- this.enable_error_webhook = false; //결제 오류시 Feedback URL로 webhook
46
- this.separately_confirmed = true; // confirm 이벤트를 호출할지 말지, false일 경우 자동승인
47
- this.confirmOnlyRestApi = false; // REST API로만 승인 처리
48
- this.open_type = 'redirect'; // 페이지 오픈 type, [iframe, popup, redirect] 중 택 1
49
- this.use_bootpay_inapp_sdk = true; // native app에서는 redirect를 완성도있게 지원하기 위한 옵션
50
- this.redirect_url = 'https://api.bootpay.co.kr/v2'; //open_type이 redirect일 경우 페이지 이동할 URL ( 오류 및 결제 완료 모두 수신 가능 )
51
- this.display_success_result = false; // 결제 완료되면 부트페이가 제공하는 완료창으로 보여주기 ( open_type이 iframe, popup 일때만 가능 )
52
- this.display_error_result = true; // 결제 실패되면 부트페이가 제공하는 실패창으로 보여주기 ( open_type이 iframe, popup 일때만 가능 )
53
- this.disposable_cup_deposit = 0; // 배달대행 플랫폼을 위한 컵 보증급 가격
54
- // ExtraCardEasyOption cardEasyOption = ExtraCardEasyOption();
55
- // List<BrowserOpenType>? browserOpenType = [];
56
- this.use_welcomepayment = 0; //웰컴 재판모듈 진행시 1
57
- this.first_subscription_comment = ''; // 자동결제 price > 0 조건일 때 첫 결제 관련 메세지
58
- this.confirm_grace_seconds = 0; // 결제승인 유예시간 ( 승인 요청을 여러번하더라도 승인 이후 특정 시간동안 계속해서 결제 response_data 를 리턴한다 )
59
- this.show_close_button = false; // x 닫기 버튼을 보여줄지 말지
60
- }
61
- return Extra;
62
- }());
63
- export { Extra };
64
- var Payload = /** @class */ (function () {
65
- function Payload() {
66
- }
67
- return Payload;
68
- }());
69
- export { Payload };
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.User=exports.StatItem=exports.Payload=exports.Onestore=exports.Item=exports.Extra=void 0;var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var User=exports.User=(0,_createClass2.default)(function User(){(0,_classCallCheck2.default)(this,User);});var Item=exports.Item=(0,_createClass2.default)(function Item(){(0,_classCallCheck2.default)(this,Item);});var StatItem=exports.StatItem=(0,_createClass2.default)(function StatItem(){(0,_classCallCheck2.default)(this,StatItem);});var Onestore=exports.Onestore=(0,_createClass2.default)(function Onestore(){(0,_classCallCheck2.default)(this,Onestore);this.ad_id="UNKNOWN_ADID";this.sim_operator="UNKNOWN_SIM_OPERATOR";this.installer_package_name="UNKNOWN_INSTALLER";});var Extra=exports.Extra=(0,_createClass2.default)(function Extra(){(0,_classCallCheck2.default)(this,Extra);this.delivery_day=1;this.locale='ko';this.display_cash_receipt=true;this.use_card_point=true;this.use_order_id=false;this.international_card_only=false;this.phone_carrier="";this.direct_app_card=false;this.direct_samsungpay=false;this.test_deposit=false;this.enable_error_webhook=false;this.separately_confirmed=true;this.confirmOnlyRestApi=false;this.open_type='redirect';this.use_bootpay_inapp_sdk=true;this.redirect_url='https://api.bootpay.co.kr/v2';this.display_success_result=false;this.display_error_result=true;this.disposable_cup_deposit=0;this.use_welcomepayment=0;this.first_subscription_comment='';this.confirm_grace_seconds=0;this.show_close_button=false;});var Payload=exports.Payload=(0,_createClass2.default)(function Payload(){(0,_classCallCheck2.default)(this,Payload);});
package/lib/Loader.js CHANGED
@@ -1,34 +0,0 @@
1
- "use strict";
2
- // import React from 'react'
3
- // import ClipLoader from "react-spinners/ClipLoader";
4
- // import { LoadingTypesProps } from './BootpayTypes';
5
- // const override: React.CSSProperties = {
6
- // display: "block",
7
- // margin: "0 auto",
8
- // borderColor: "red",
9
- // };
10
- // class Loader extends React.Component<LoadingTypesProps> {
11
- // constructor(props: LoadingTypesProps) {
12
- // super(props);
13
- // }
14
- // state = {
15
- // loading: true,
16
- // }
17
- // render() {
18
- // return (
19
- // <div className="sweet-loading">
20
- // <ClipLoader
21
- // cssOverride={override}
22
- // size={150}
23
- // color={"#123abc"}
24
- // loading={this.state.loading}
25
- // speedMultiplier={1.5}
26
- // />
27
- // <span>
28
- // ddd
29
- // </span>
30
- // </div>
31
- // );
32
- // }
33
- // }
34
- // export default Loader;
package/lib/UserInfo.js CHANGED
@@ -1,136 +1 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (_) try {
17
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- // import { Component } from 'react';
38
- import DeviceInfo from 'react-native-device-info';
39
- import SInfo from 'react-native-sensitive-info';
40
- // export default class UserInfo extends Component {
41
- var UserInfo = /** @class */ (function () {
42
- function UserInfo() {
43
- }
44
- UserInfo.setBootpayLastTime = function (val) {
45
- return UserInfo.setBootpayInfo('bootpay_last_time', val);
46
- };
47
- UserInfo.getBootpayUserId = function () {
48
- return UserInfo.getBootpayInfo('bootpay_user_id', '');
49
- };
50
- var _a;
51
- _a = UserInfo;
52
- UserInfo.getBootpayInfo = function (key, defaultVal) {
53
- return new Promise(function (resolve, reject) {
54
- SInfo.getItem(key, {
55
- sharedPreferencesName: 'bootpaySharedPrefs',
56
- keychainService: 'bootpayKeychain'
57
- }).then(function (res) {
58
- res == undefined ? resolve(defaultVal) : resolve(res);
59
- resolve(res);
60
- })["catch"](function (error) {
61
- reject(error);
62
- });
63
- });
64
- };
65
- UserInfo.setBootpayInfo = function (key, val) {
66
- return new Promise(function (resolve, reject) {
67
- SInfo.setItem(String(key), String(val), {
68
- sharedPreferencesName: 'bootpaySharedPrefs',
69
- keychainService: 'bootpayKeychain'
70
- }).then(function (res) {
71
- resolve(res);
72
- })["catch"](function (error) {
73
- reject(error);
74
- });
75
- });
76
- };
77
- UserInfo.getBootpayUUID = function () {
78
- var uuid = DeviceInfo.getUniqueId();
79
- return UserInfo.setBootpayInfo('uuid', uuid);
80
- };
81
- UserInfo.getBootpaySK = function () {
82
- return UserInfo.getBootpayInfo('bootpay_sk', '');
83
- };
84
- UserInfo.setBootpaySK = function (val) {
85
- return UserInfo.setBootpayInfo('bootpay_sk', val);
86
- };
87
- UserInfo.newBootpaySK = function (uuid, time) {
88
- return UserInfo.setBootpaySK("".concat(uuid, "_").concat(time));
89
- };
90
- UserInfo.getBootpayLastTime = function () { return __awaiter(void 0, void 0, void 0, function () {
91
- return __generator(_a, function (_b) {
92
- switch (_b.label) {
93
- case 0: return [4 /*yield*/, UserInfo.getBootpayInfo('bootpay_last_time', 0)];
94
- case 1: return [2 /*return*/, _b.sent()];
95
- }
96
- });
97
- }); };
98
- UserInfo.setBootpayUserId = function (val) {
99
- return UserInfo.setBootpayInfo('bootpay_user_id', val);
100
- };
101
- UserInfo.updateInfo = function () { return __awaiter(void 0, void 0, void 0, function () {
102
- var uuid, bootpaySK, lastTime, current, isExpired;
103
- return __generator(_a, function (_b) {
104
- switch (_b.label) {
105
- case 0: return [4 /*yield*/, UserInfo.getBootpayUUID()];
106
- case 1:
107
- uuid = _b.sent();
108
- return [4 /*yield*/, UserInfo.getBootpaySK()];
109
- case 2:
110
- bootpaySK = _b.sent();
111
- return [4 /*yield*/, UserInfo.getBootpayLastTime()];
112
- case 3:
113
- lastTime = _b.sent();
114
- current = Date.now();
115
- if (!(bootpaySK == '')) return [3 /*break*/, 5];
116
- return [4 /*yield*/, UserInfo.newBootpaySK(uuid, current)];
117
- case 4:
118
- _b.sent();
119
- _b.label = 5;
120
- case 5:
121
- isExpired = current - lastTime > 30 * 60 * 1000;
122
- if (!isExpired) return [3 /*break*/, 7];
123
- return [4 /*yield*/, UserInfo.newBootpaySK(uuid, current)];
124
- case 6:
125
- _b.sent();
126
- _b.label = 7;
127
- case 7: return [4 /*yield*/, UserInfo.setBootpayLastTime(current)];
128
- case 8:
129
- _b.sent();
130
- return [2 /*return*/];
131
- }
132
- });
133
- }); };
134
- return UserInfo;
135
- }());
136
- export default UserInfo;
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _reactNativeDeviceInfo=_interopRequireDefault(require("react-native-device-info"));var _reactNativeSensitiveInfo=_interopRequireDefault(require("react-native-sensitive-info"));var _UserInfo;var UserInfo=exports.default=function(){function UserInfo(){(0,_classCallCheck2.default)(this,UserInfo);}return(0,_createClass2.default)(UserInfo,null,[{key:"setBootpayLastTime",value:function setBootpayLastTime(val){return UserInfo.setBootpayInfo('bootpay_last_time',val);}},{key:"getBootpayUserId",value:function getBootpayUserId(){return UserInfo.getBootpayInfo('bootpay_user_id','');}}]);}();_UserInfo=UserInfo;UserInfo.getBootpayInfo=function(key,defaultVal){return new Promise(function(resolve,reject){_reactNativeSensitiveInfo.default.getItem(key,{sharedPreferencesName:'bootpaySharedPrefs',keychainService:'bootpayKeychain'}).then(function(res){res==undefined?resolve(defaultVal):resolve(res);resolve(res);}).catch(function(error){reject(error);});});};UserInfo.setBootpayInfo=function(key,val){return new Promise(function(resolve,reject){_reactNativeSensitiveInfo.default.setItem(String(key),String(val),{sharedPreferencesName:'bootpaySharedPrefs',keychainService:'bootpayKeychain'}).then(function(res){resolve(res);}).catch(function(error){reject(error);});});};UserInfo.getBootpayUUID=function(){var uuid=_reactNativeDeviceInfo.default.getUniqueId();return _UserInfo.setBootpayInfo('uuid',uuid);};UserInfo.getBootpaySK=function(){return _UserInfo.getBootpayInfo('bootpay_sk','');};UserInfo.setBootpaySK=function(val){return _UserInfo.setBootpayInfo('bootpay_sk',val);};UserInfo.newBootpaySK=function(uuid,time){return _UserInfo.setBootpaySK(`${uuid}_${time}`);};UserInfo.getBootpayLastTime=(0,_asyncToGenerator2.default)(function*(){return yield _UserInfo.getBootpayInfo('bootpay_last_time',0);});UserInfo.setBootpayUserId=function(val){return _UserInfo.setBootpayInfo('bootpay_user_id',val);};UserInfo.updateInfo=(0,_asyncToGenerator2.default)(function*(){var uuid=yield _UserInfo.getBootpayUUID();var bootpaySK=yield _UserInfo.getBootpaySK();var lastTime=yield _UserInfo.getBootpayLastTime();var current=Date.now();if(bootpaySK=='')yield _UserInfo.newBootpaySK(uuid,current);var isExpired=current-lastTime>30*60*1000;if(isExpired)yield _UserInfo.newBootpaySK(uuid,current);yield _UserInfo.setBootpayLastTime(current);});
File without changes
@@ -0,0 +1 @@
1
+ it.todo('write a test');
@@ -1,195 +1 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (_) try {
17
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- import base64 from 'react-native-base64';
38
- import DeviceInfo from 'react-native-device-info';
39
- import { NativeModules } from 'react-native';
40
- // getRandomKey 함수의 반환 타입을 명시
41
- var getRandomKey = function (length) {
42
- var text = '';
43
- var keys = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ';
44
- for (var i = 0; i < length; i++)
45
- text += keys.charAt(Math.floor(Math.random() * keys.length));
46
- return text;
47
- };
48
- // getSessionKey 함수의 반환 타입을 명시
49
- var getSessionKey = function (key, iv) { return __awaiter(void 0, void 0, void 0, function () {
50
- var keyValue, ivValue;
51
- return __generator(this, function (_a) {
52
- keyValue = base64.encode(key);
53
- ivValue = base64.encode(iv);
54
- return [2 /*return*/, "".concat(keyValue, "##").concat(ivValue)];
55
- });
56
- }); };
57
- // stringToHex 함수의 반환 타입을 명시
58
- var stringToHex = function (str) {
59
- var hex = '';
60
- for (var i = 0, l = str.length; i < l; i++) {
61
- hex += str.charCodeAt(i).toString(16);
62
- }
63
- return hex;
64
- };
65
- // userTrace 함수의 반환 타입을 명시
66
- var userTrace = function (applicationId, userId, phone, email, gender, birth, area) { return __awaiter(void 0, void 0, void 0, function () {
67
- var payload, key, iv, data, response, _a, _b, _c, _d, json, e_1, error_1;
68
- var _e, _f;
69
- return __generator(this, function (_g) {
70
- switch (_g.label) {
71
- case 0:
72
- _g.trys.push([0, 8, , 9]);
73
- payload = {
74
- "id": userId,
75
- "ver": DeviceInfo.getVersion(),
76
- "application_id": applicationId,
77
- "phone": phone,
78
- "email": email,
79
- "gender": gender,
80
- "birth": birth,
81
- "area": area
82
- };
83
- key = getRandomKey(32);
84
- iv = getRandomKey(16);
85
- _g.label = 1;
86
- case 1:
87
- _g.trys.push([1, 6, , 7]);
88
- return [4 /*yield*/, NativeModules.Aes.encrypt(JSON.stringify(payload), stringToHex(key), stringToHex(iv))];
89
- case 2:
90
- data = _g.sent();
91
- _a = fetch;
92
- _b = ['https://analytics.bootpay.co.kr/login'];
93
- _e = {
94
- method: 'POST',
95
- headers: {
96
- Accept: 'application/json',
97
- 'Content-Type': 'application/json'
98
- }
99
- };
100
- _d = (_c = JSON).stringify;
101
- _f = {
102
- data: data
103
- };
104
- return [4 /*yield*/, getSessionKey(key, iv)];
105
- case 3: return [4 /*yield*/, _a.apply(void 0, _b.concat([(_e.body = _d.apply(_c, [(_f.session_key = _g.sent(),
106
- _f)]),
107
- _e)]))];
108
- case 4:
109
- response = _g.sent();
110
- return [4 /*yield*/, response.json()];
111
- case 5:
112
- json = _g.sent();
113
- return [2 /*return*/, json];
114
- case 6:
115
- e_1 = _g.sent();
116
- console.log(e_1);
117
- return [3 /*break*/, 7];
118
- case 7: return [3 /*break*/, 9];
119
- case 8:
120
- error_1 = _g.sent();
121
- console.error(error_1);
122
- return [3 /*break*/, 9];
123
- case 9: return [2 /*return*/];
124
- }
125
- });
126
- }); };
127
- // pageTrace 함수의 반환 타입을 명시
128
- var pageTrace = function (applicationId, url, pageType, items) { return __awaiter(void 0, void 0, void 0, function () {
129
- var payload, key, iv, data, response, _a, _b, _c, _d, json, e_2, error_2;
130
- var _e, _f;
131
- return __generator(this, function (_g) {
132
- switch (_g.label) {
133
- case 0:
134
- _g.trys.push([0, 8, , 9]);
135
- payload = {
136
- "application_id": applicationId,
137
- "url": url,
138
- "page_type": pageType,
139
- "items": items,
140
- "referer": ''
141
- };
142
- key = getRandomKey(32);
143
- iv = getRandomKey(16);
144
- _g.label = 1;
145
- case 1:
146
- _g.trys.push([1, 6, , 7]);
147
- return [4 /*yield*/, NativeModules.Aes.encrypt(JSON.stringify(payload), stringToHex(key), stringToHex(iv))];
148
- case 2:
149
- data = _g.sent();
150
- _a = fetch;
151
- _b = ['https://analytics.bootpay.co.kr/call'];
152
- _e = {
153
- method: 'POST',
154
- headers: {
155
- Accept: 'application/json',
156
- 'Content-Type': 'application/json'
157
- }
158
- };
159
- _d = (_c = JSON).stringify;
160
- _f = {
161
- data: data
162
- };
163
- return [4 /*yield*/, getSessionKey(key, iv)];
164
- case 3: return [4 /*yield*/, _a.apply(void 0, _b.concat([(_e.body = _d.apply(_c, [(_f.session_key = _g.sent(),
165
- _f)]),
166
- _e)]))];
167
- case 4:
168
- response = _g.sent();
169
- return [4 /*yield*/, response.json()];
170
- case 5:
171
- json = _g.sent();
172
- return [2 /*return*/, json];
173
- case 6:
174
- e_2 = _g.sent();
175
- console.log(e_2);
176
- return [3 /*break*/, 7];
177
- case 7: return [3 /*break*/, 9];
178
- case 8:
179
- error_2 = _g.sent();
180
- console.error(error_2);
181
- return [3 /*break*/, 9];
182
- case 9: return [2 /*return*/];
183
- }
184
- });
185
- }); };
186
- // strEncode 함수의 반환 타입을 명시
187
- // const strEncode = async (str: string, key: string, iv: string): Promise<string> => {
188
- // return await NativeModules.Aes.encrypt(str, key, iv).then(cipher => {
189
- // return NativeModules.Aes.hmac256(cipher, key).then(hash => {
190
- // console.log('HMAC', hash);
191
- // return hash;
192
- // });
193
- // });
194
- // };
195
- export { userTrace, pageTrace };
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.userTrace=exports.pageTrace=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _reactNativeBase=_interopRequireDefault(require("react-native-base64"));var _reactNativeDeviceInfo=_interopRequireDefault(require("react-native-device-info"));var _reactNative=require("react-native");var getRandomKey=function getRandomKey(length){var text='';var keys='abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ';for(var i=0;i<length;i++)text+=keys.charAt(Math.floor(Math.random()*keys.length));return text;};var getSessionKey=function(){var _ref=(0,_asyncToGenerator2.default)(function*(key,iv){var keyValue=_reactNativeBase.default.encode(key);var ivValue=_reactNativeBase.default.encode(iv);return`${keyValue}##${ivValue}`;});return function getSessionKey(_x,_x2){return _ref.apply(this,arguments);};}();var stringToHex=function stringToHex(str){var hex='';for(var i=0,l=str.length;i<l;i++){hex+=str.charCodeAt(i).toString(16);}return hex;};var userTrace=exports.userTrace=function(){var _ref2=(0,_asyncToGenerator2.default)(function*(applicationId,userId,phone,email,gender,birth,area){try{var payload={"id":userId,"ver":_reactNativeDeviceInfo.default.getVersion(),"application_id":applicationId,"phone":phone,"email":email,"gender":gender,"birth":birth,"area":area};var key=getRandomKey(32);var iv=getRandomKey(16);try{var _data=yield _reactNative.NativeModules.Aes.encrypt(JSON.stringify(payload),stringToHex(key),stringToHex(iv));var response=yield fetch('https://analytics.bootpay.co.kr/login',{method:'POST',headers:{Accept:'application/json','Content-Type':'application/json'},body:JSON.stringify({data:_data,session_key:yield getSessionKey(key,iv)})});var json=yield response.json();return json;}catch(e){console.log(e);}}catch(error){console.error(error);}});return function userTrace(_x3,_x4,_x5,_x6,_x7,_x8,_x9){return _ref2.apply(this,arguments);};}();var pageTrace=exports.pageTrace=function(){var _ref3=(0,_asyncToGenerator2.default)(function*(applicationId,url,pageType,items){try{var payload={"application_id":applicationId,"url":url,"page_type":pageType,"items":items,"referer":''};var key=getRandomKey(32);var iv=getRandomKey(16);try{var _data2=yield _reactNative.NativeModules.Aes.encrypt(JSON.stringify(payload),stringToHex(key),stringToHex(iv));var response=yield fetch('https://analytics.bootpay.co.kr/call',{method:'POST',headers:{Accept:'application/json','Content-Type':'application/json'},body:JSON.stringify({data:_data2,session_key:yield getSessionKey(key,iv)})});var json=yield response.json();return json;}catch(e){console.log(e);}}catch(error){console.error(error);}});return function pageTrace(_x10,_x11,_x12,_x13){return _ref3.apply(this,arguments);};}();
package/lib/index.js CHANGED
@@ -1,6 +1 @@
1
- import { Bootpay } from './Bootpay';
2
- import { Payload, Extra, Item, User } from './BootpayTypes';
3
- // import { userTrace, pageTrace } from './BootpayAnalytics'
4
- // import { WebView } from 'react-native-bootpay-api';
5
- export { Bootpay, Payload, Extra, Item, User };
6
- // export { BootpayModal, userTrace, pageTrace };
1
+ Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Bootpay",{enumerable:true,get:function get(){return _Bootpay.Bootpay;}});Object.defineProperty(exports,"Extra",{enumerable:true,get:function get(){return _BootpayTypes.Extra;}});Object.defineProperty(exports,"Item",{enumerable:true,get:function get(){return _BootpayTypes.Item;}});Object.defineProperty(exports,"Payload",{enumerable:true,get:function get(){return _BootpayTypes.Payload;}});Object.defineProperty(exports,"User",{enumerable:true,get:function get(){return _BootpayTypes.User;}});var _Bootpay=require("./Bootpay");var _BootpayTypes=require("./BootpayTypes");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-bootpay-api",
3
- "version": "13.6.13",
3
+ "version": "13.8.4",
4
4
  "description": "React Native를 위한 bootpay 라이브러리 입니다.",
5
5
  "main": "index.tsx",
6
6
  "author": "bootpay <bootpay.co.kr@gmail.com>",
@@ -12,19 +12,17 @@
12
12
  "scripts": {
13
13
  "android": "react-native run-android",
14
14
  "ios": "react-native run-ios",
15
- "build:ios": "react-native bundle --entry-file='./index.js' --bundle-output='./example/ios/main.jsbundle' --dev=false --platform='ios'",
16
-
17
15
  "macos": "react-native run-macos --scheme WebviewExample --project-path example/macos",
18
16
  "start": "cd example && react-native start",
19
17
  "windows": "install-windows-test-app --project-directory example/windows && react-native run-windows --root example --arch x64",
20
18
  "ci": "CI=true && yarn lint",
21
19
  "ci:publish": "yarn semantic-release",
22
- "lint": "yarn tsc --noEmit && yarn eslint ./src --ext .ts,.tsx",
23
- "build": "yarn tsc",
20
+ "lint": "yarn tsc --noEmit && yarn eslint ./src --ext .ts,.tsx,.js,.jsx",
21
+ "build": "babel --extensions \".ts,.tsx\" --out-dir lib src",
24
22
  "prepare": "yarn build",
25
23
  "appium": "appium",
26
24
  "test:windows": "yarn jest --setupFiles=./jest-setups/jest.setup.js",
27
- "add:macos": "yarn add react-native-macos@0.71.33"
25
+ "add:macos": "yarn add react-native-macos@0.73.17"
28
26
  },
29
27
  "rn-docs": {
30
28
  "title": "bootpay",
@@ -35,52 +33,44 @@
35
33
  "react-native": "*"
36
34
  },
37
35
  "dependencies": {
38
- "escape-string-regexp": "2.0.0",
39
- "invariant": "2.2.4"
36
+ "escape-string-regexp": "5.0.0",
37
+ "invariant": "2.2.4",
38
+ "react-native-device-info": "^10.13.1",
39
+ "react-native-sensitive-info": "^5.5.8",
40
+ "@types/react-native-base64": "^0.2.2",
41
+ "react-native-aes-crypto": "^3.0.1",
42
+ "react-native-webview-bootpay": "^13.8.4"
40
43
  },
41
44
  "devDependencies": {
42
- "@babel/core": "^7.0.0",
43
- "@babel/runtime": "^7.0.0",
45
+ "@babel/cli": "^7.20.0",
46
+ "@babel/core": "^7.20.0",
47
+ "@babel/runtime": "^7.20.0",
48
+ "@react-native/babel-preset": "0.73.21",
49
+ "@react-native/eslint-config": "0.73.2",
50
+ "@react-native/metro-config": "0.73.5",
51
+ "@react-native/typescript-config": "0.73.1",
52
+ "@rnx-kit/metro-config": "1.3.14",
44
53
  "@semantic-release/git": "7.0.16",
45
54
  "@types/invariant": "^2.2.30",
46
- "@types/jest": "^29.4.0",
47
- "@types/react": "18.0.27",
55
+ "@types/jest": "^29.5.12",
56
+ "@types/react": "18.2.61",
48
57
  "@types/selenium-webdriver": "4.0.9",
49
- "@typescript-eslint/eslint-plugin": "2.1.0",
50
- "@typescript-eslint/parser": "2.1.0",
51
58
  "appium": "1.17.0",
52
- "eslint": "6.3.0",
53
- "react-native-webview-bootpay": "13.6.13",
54
- "eslint-config-airbnb": "18.0.1",
55
- "eslint-config-prettier": "6.2.0",
56
- "eslint-plugin-import": "2.18.2",
57
- "eslint-plugin-jsx-a11y": "6.2.3",
58
- "eslint-plugin-react": "7.14.3",
59
- "eslint-plugin-react-hooks": "^4.5.0",
60
- "eslint-plugin-react-native": "3.7.0",
61
- "jest": "^29.4.1",
62
- "metro-react-native-babel-preset": "0.73.7",
59
+ "eslint": "8.57.0",
60
+ "jest": "^29.6.3",
61
+ "prettier": "2.8.8",
63
62
  "react": "18.2.0",
64
- "react-native": "0.71.12",
65
- "react-native-macos": "0.71.33",
66
- "react-native-test-app": "2.5.15",
67
- "react-native-windows": "0.71.30",
63
+ "react-native": "0.73.5",
64
+ "react-native-macos": "0.73.17",
65
+ "react-native-test-app": "3.2.16",
66
+ "react-native-windows": "0.73.8",
68
67
  "selenium-appium": "1.0.2",
69
68
  "selenium-webdriver": "4.0.0-alpha.7",
70
69
  "semantic-release": "15.13.24",
71
- "typescript": "^4.0.0",
72
- "winappdriver": "^0.0.7",
73
- "react-native-device-info": "^8.7.0",
74
- "react-native-sensitive-info": "^5.5.8",
75
- "@types/react-native-base64": "^0.2.2",
76
- "react-native-aes-crypto": "^2.1.0",
77
- "@types/lodash": "^4.14.182"
78
- },
79
- "resolutions": {
80
- "@react-native-community/cli": "10.2.4",
81
- "@react-native-community/cli-platform-android": "10.2.0",
82
- "@react-native-community/cli-platform-ios": "10.2.4"
83
- },
70
+ "typescript": "5.1.3",
71
+ "winappdriver": "^0.0.7",
72
+ "@types/lodash": "^4.17.0"
73
+ },
84
74
  "repository": {
85
75
  "type": "git",
86
76
  "url": "https://github.com/bootpay/react-native-bootpay-api.git"
@@ -98,6 +88,12 @@
98
88
  "index.d.ts",
99
89
  "react-native-bootpay-api.podspec",
100
90
  "react-native.config.js"
101
- ]
91
+ ],
92
+ "resolutions": {
93
+ "@react-native-community/cli": "10.2.4",
94
+ "@react-native-community/cli-platform-android": "10.2.0",
95
+ "@react-native-community/cli-platform-ios": "10.2.4"
96
+ },
97
+ "packageManager": "yarn@1.22.19"
102
98
  }
103
99
 
@@ -2,26 +2,24 @@ const project = (() => {
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
4
  try {
5
- const {
6
- androidManifestPath,
7
- // iosProjectPath,
8
- windowsProjectPath,
9
- } = require('react-native-test-app');
10
- return {
5
+ const { configureProjects } = require('react-native-test-app');
6
+
7
+ return configureProjects({
11
8
  android: {
12
9
  sourceDir: path.join('example', 'android'),
13
- manifestPath: androidManifestPath(
14
- path.join(__dirname, 'example', 'android'),
15
- ),
10
+ manifestPath: path.join(__dirname, 'example', 'android'),
16
11
  },
17
12
  ios: {
18
13
  sourceDir: 'example/ios',
19
14
  },
20
- // ios: {
21
- // project: iosProjectPath('example/ios'),
22
- // },
23
- };
24
- } catch (_) {
15
+ windows: fs.existsSync('example/windows/WebviewExample.sln') && {
16
+ sourceDir: path.join('example', 'windows'),
17
+ solutionFile: path.join('example', 'windows', 'WebviewExample.sln'),
18
+ project: path.join(__dirname, 'example', 'windows'),
19
+ },
20
+ });
21
+ } catch (e) {
22
+ console.log('Hello?', e);
25
23
  return undefined;
26
24
  }
27
25
  })();
@@ -32,6 +30,45 @@ module.exports = {
32
30
  'react-native-bootpay-api': {
33
31
  root: __dirname,
34
32
  },
35
- },
33
+ },
36
34
  ...(project ? { project } : undefined),
37
35
  };
36
+
37
+
38
+ // const project = (() => {
39
+ // const fs = require('fs');
40
+ // const path = require('path');
41
+ // try {
42
+ // const {
43
+ // androidManifestPath,
44
+ // // iosProjectPath,
45
+ // windowsProjectPath,
46
+ // } = require('react-native-test-app');
47
+ // return {
48
+ // android: {
49
+ // sourceDir: path.join('example', 'android'),
50
+ // manifestPath: androidManifestPath(
51
+ // path.join(__dirname, 'example', 'android'),
52
+ // ),
53
+ // },
54
+ // ios: {
55
+ // sourceDir: 'example/ios',
56
+ // },
57
+ // // ios: {
58
+ // // project: iosProjectPath('example/ios'),
59
+ // // },
60
+ // };
61
+ // } catch (_) {
62
+ // return undefined;
63
+ // }
64
+ // })();
65
+
66
+ // module.exports = {
67
+ // dependencies: {
68
+ // // Help rn-cli find and autolink this library
69
+ // 'react-native-bootpay-api': {
70
+ // root: __dirname,
71
+ // },
72
+ // },
73
+ // ...(project ? { project } : undefined),
74
+ // };
package/src/Bootpay.tsx CHANGED
@@ -8,6 +8,7 @@ import WebView, {WebViewMessageEvent} from 'react-native-webview-bootpay';
8
8
  import { BootpayTypesProps, Payload, Extra, Item, User } from './BootpayTypes';
9
9
  import {debounce} from 'lodash';
10
10
  import UserInfo from './UserInfo'
11
+ import { WebViewErrorEvent } from 'react-native-webview-bootpay/lib/BPCWebViewNativeComponent';
11
12
  // import Loader from './Loader'
12
13
  // import ClipLoader from "react-spinners/ClipLoader";
13
14
  // import Spinner from 'react-native-loading-spinner-overlay';
@@ -34,7 +35,7 @@ export class Bootpay extends Component<BootpayTypesProps> {
34
35
  isShowProgress: false
35
36
  }
36
37
  // _payload = {}
37
- _VERSION = "4.3.1"
38
+ _VERSION = "13.8.2"
38
39
  _DEBUG = false;
39
40
 
40
41
 
@@ -60,13 +61,17 @@ export class Bootpay extends Component<BootpayTypesProps> {
60
61
  if(this.props.onClose != undefined) this.props.onClose();
61
62
  this.dismiss();
62
63
  }
64
+
63
65
 
64
66
 
65
67
  onMessage = async (event: WebViewMessageEvent) => {
66
68
 
67
69
  if (event == undefined) return;
70
+ console.log(event.nativeEvent.data);
68
71
 
69
72
  const res = JSON.parse(JSON.stringify(event.nativeEvent.data));
73
+
74
+ console.log(res);
70
75
 
71
76
 
72
77
  if(res == 'close') {
@@ -299,7 +304,7 @@ export class Bootpay extends Component<BootpayTypesProps> {
299
304
  this.closeDismiss = debounce(this.closeDismiss, 30);
300
305
  }
301
306
 
302
- render() {
307
+ render() {
303
308
  return (
304
309
  <Modal
305
310
  animationType={'slide'}
@@ -339,13 +344,34 @@ export class Bootpay extends Component<BootpayTypesProps> {
339
344
  ref={this.webView}
340
345
  originWhitelist={['*']}
341
346
  source={{
342
- uri: 'https://webview.bootpay.co.kr/4.3.3'
347
+ uri: 'https://webview.bootpay.co.kr/5.0.0-beta.25'
343
348
  }}
344
349
  injectedJavaScript={this.state.script}
345
350
  javaScriptEnabled={true}
346
351
  javaScriptCanOpenWindowsAutomatically={true}
347
352
  // scalesPageToFit={true}
348
- onMessage={this.onMessage}
353
+ onMessage={this.onMessage}
354
+ onError={(syntheticEvent) => {
355
+ const { nativeEvent } = syntheticEvent;
356
+ if(nativeEvent.code == 3) {
357
+ this.showProgressBar(false);
358
+ if(this.props.onError != undefined) this.props.onError({
359
+ code: nativeEvent.code,
360
+ message: nativeEvent.description
361
+ });
362
+ this.closeDismiss();
363
+ }
364
+ }}
365
+ // onError={ error => {
366
+ // if(error.code == 3) {
367
+ // console.log()
368
+ // }
369
+ // }}
370
+ // onError={syntheticEvent => {
371
+ // const { nativeEvent } = syntheticEvent;
372
+ // console.warn('WebView error: ', nativeEvent);
373
+ // }}
374
+ // onError={}
349
375
  />
350
376
  </SafeAreaView>
351
377
 
@@ -354,6 +380,9 @@ export class Bootpay extends Component<BootpayTypesProps> {
354
380
  )
355
381
  }
356
382
 
383
+ // onMessage = async (event: WebViewMessageEvent) => {
384
+
385
+
357
386
 
358
387
 
359
388
  requestPayment = async (payload: Payload, items: [Item], user: User, extra: Extra) => {