react-native-bootpay-api 4.2.6 → 4.3.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Bootpay.d.ts","sourceRoot":"","sources":["../src/Bootpay.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIzC,OAAO,OAAO,EAAE,EAAC,mBAAmB,EAAC,MAAO,8BAA8B,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAQ/E,qBAAa,OAAQ,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAGrD,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBAEtB,KAAK,EAAE,iBAAiB;IAMpC,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB,KAAK;;;;;;MAMJ;IAED,QAAQ,SAAU;IAClB,MAAM,UAAS;IAGf,OAAO,aAMN;IAGD,eAAe,WAAY,OAAO,UAQjC;IAGD,YAAY,aAGX;IAGD,SAAS,gDAoGR;IAED,4BAA4B,MAAQ,MAAM,aAEzC;IAED,aAAa,eAUZ;IAED,kBAAkB,0DAMjB;IAED,kBAAkB,2EAQjB;IAWD,kBAAkB,aAajB;IAED,mBAAmB,aAKlB;IAED,cAAc,WAAY,MAAM,UAM/B;IAED,gBAAgB,wBASf;IAED,OAAO,eAEN;IAED,IAAI,eAEH;IAED,MAAM,eAEL;IAED,KAAK,eAEJ;IAED,MAAM,eAEL;IAED,KAAK,eAEJ;IAIK,oBAAoB;IAY1B,iBAAiB;IAIjB,MAAM;IA+DN,cAAc,YAAmB,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,IAAI,SAAS,KAAK,mBAGhF;IAED,mBAAmB,YAAmB,OAAO,SAAS,CAAC,IAAI,CAAC,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;IAY1B,iBAAiB;IAIjB,MAAM;IA+DN,cAAc,YAAmB,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,IAAI,SAAS,KAAK,mBAGhF;IAED,mBAAmB,YAAmB,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,IAAI,SAAS,KAAK,mBAErF;IAED,qBAAqB,YAAmB,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,IAAI,SAAS,KAAK,mBAEvF;IAED,cAAc,YAAmB,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,IAAI,SAAS,KAAK,iBAAiB,MAAM,mBA4BvG;IAGD,kBAAkB,wBAQjB;IAGD,cAAc,YAAY,OAAO,iBAAiB,MAAM,YAavD;CAEJ"}
package/lib/Bootpay.js CHANGED
@@ -72,7 +72,7 @@ var Bootpay = /** @class */ (function (_super) {
72
72
  isShowProgress: false
73
73
  };
74
74
  // _payload = {}
75
- _this._VERSION = "4.1.5";
75
+ _this._VERSION = "4.3.1";
76
76
  _this._DEBUG = false;
77
77
  _this.dismiss = function () {
78
78
  _this.setState({
@@ -85,7 +85,8 @@ var Bootpay = /** @class */ (function (_super) {
85
85
  });
86
86
  };
87
87
  _this.closeDismiss = function () {
88
- // if(this.props.onClose != undefined) this.props.onClose();
88
+ if (_this.props.onClose != undefined)
89
+ _this.props.onClose();
89
90
  _this.dismiss();
90
91
  };
91
92
  _this.onMessage = function (event) { return __awaiter(_this, void 0, void 0, function () {
@@ -414,7 +415,7 @@ var Bootpay = /** @class */ (function (_super) {
414
415
 
415
416
 
416
417
  <WebView ref={this.webView} originWhitelist={['*']} source={{
417
- uri: 'https://webview.bootpay.co.kr/4.2.6'
418
+ uri: 'https://webview.bootpay.co.kr/4.2.7'
418
419
  }} injectedJavaScript={this.state.script} javaScriptEnabled={true} javaScriptCanOpenWindowsAutomatically={true}
419
420
  // scalesPageToFit={true}
420
421
  onMessage={this.onMessage}/>
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAG3D,OAAO,EAAG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAK3D,OAAO,EAAG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC"}
package/lib/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Bootpay } from './Bootpay';
2
2
  import { Payload, Extra, Item, User } from './BootpayTypes';
3
3
  // import { userTrace, pageTrace } from './BootpayAnalytics'
4
+ // import { WebView } from 'react-native-bootpay-api';
4
5
  export { Bootpay, Payload, Extra, Item, User };
5
6
  // export { BootpayModal, userTrace, pageTrace };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-bootpay-api",
3
- "version": "4.2.6",
3
+ "version": "4.3.1",
4
4
  "description": "React Native를 위한 bootpay 라이브러리 입니다.",
5
5
  "main": "index.js",
6
6
  "main-internal": "src/index.ts",
@@ -31,7 +31,8 @@
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": "*",
34
- "react-native": "*"
34
+ "react-native": "*",
35
+ "react-native-webview-bootpay": "11.x"
35
36
  },
36
37
  "dependencies": {
37
38
  "escape-string-regexp": "2.0.0",
@@ -61,7 +62,7 @@
61
62
  "metro-react-native-babel-preset": "^0.67.0",
62
63
  "react": "17.0.2",
63
64
  "react-dom": "17.0.2",
64
- "react-native": "0.68.2",
65
+ "react-native": "0.68.5",
65
66
  "react-native-macos": "0.66.57",
66
67
  "react-native-test-app": "1.3.8",
67
68
  "react-native-windows": "0.68.4",
@@ -70,7 +71,7 @@
70
71
  "semantic-release": "15.13.24",
71
72
  "typescript": "^4.0.0",
72
73
  "winappdriver": "^0.0.7",
73
- "react-native-webview-bootpay": "^11.22.85",
74
+ "react-native-webview-bootpay": "11.26.18",
74
75
  "react-native-device-info": "^8.7.0",
75
76
  "react-native-sensitive-info": "^5.5.8",
76
77
  "react-native-base64": "^0.2.1",
@@ -1,72 +0,0 @@
1
- import React, { Component } from 'react';
2
- import WebView, { WebViewMessageEvent } from 'react-native-webview-bootpay';
3
- import { BootpayTypesProps, Payload, Extra, Item, User } from './BootpayTypes';
4
- export declare class BootpayTemp extends Component<BootpayTypesProps> {
5
- _VERSION: string;
6
- _DEBUG: boolean;
7
- webView: React.RefObject<WebView>;
8
- state: {
9
- visibility: boolean;
10
- script: string;
11
- firstLoad: boolean;
12
- showCloseButton: boolean;
13
- };
14
- constructor(props: BootpayTypesProps);
15
- dismiss: () => void;
16
- closeDismiss: () => void;
17
- onMessage: (event: WebViewMessageEvent) => void;
18
- onShouldStartLoadWithRequest: (_: string) => boolean;
19
- getSDKVersion: () => string;
20
- getEnvironmentMode: () => "" | "Bootpay.setEnvironmentMode('development');";
21
- getBootpayPlatform: () => "" | "Bootpay.setDevice('IOS');" | "Bootpay.setDevice('ANDROID');";
22
- removePaymentWindow: () => void;
23
- getAnalyticsData: () => Promise<string>;
24
- confirm: () => string;
25
- done: () => string;
26
- issued: () => string;
27
- error: () => string;
28
- cancel: () => string;
29
- close: () => string;
30
- componentWillUnmount(): Promise<void>;
31
- componentDidMount(): void;
32
- render(): JSX.Element;
33
- }
34
- export declare class BootpayModal extends Component<BootpayTypesProps> {
35
- webView: React.RefObject<WebView>;
36
- constructor(props: BootpayTypesProps);
37
- state: {
38
- visibility: boolean;
39
- script: string;
40
- firstLoad: boolean;
41
- showCloseButton: boolean;
42
- };
43
- _VERSION: string;
44
- _DEBUG: boolean;
45
- dismiss: () => void;
46
- closeDismiss: () => void;
47
- onMessage: (event: WebViewMessageEvent) => void;
48
- onShouldStartLoadWithRequest: (_: string) => boolean;
49
- getSDKVersion: () => string;
50
- getEnvironmentMode: () => "" | "Bootpay.setEnvironmentMode('development');";
51
- getBootpayPlatform: () => "" | "Bootpay.setDevice('IOS');" | "Bootpay.setDevice('ANDROID');";
52
- transactionConfirm: () => void;
53
- removePaymentWindow: () => void;
54
- callJavaScript: (script: string) => void;
55
- getAnalyticsData: () => Promise<string>;
56
- confirm: () => string;
57
- done: () => string;
58
- issued: () => string;
59
- error: () => string;
60
- cancel: () => string;
61
- close: () => string;
62
- componentWillUnmount(): Promise<void>;
63
- componentDidMount(): void;
64
- render(): JSX.Element;
65
- requestPayment: (payload: Payload, items: [Item], user: User, extra: Extra) => Promise<void>;
66
- requestSubscription: (payload: Payload, items: [Item], user: User, extra: Extra) => Promise<void>;
67
- requestAuthentication: (payload: Payload, items: [Item], user: User, extra: Extra) => Promise<void>;
68
- bootpayRequest: (payload: Payload, items: [Item], user: User, extra: Extra, requestMethod: string) => Promise<void>;
69
- getMountJavascript: () => Promise<string>;
70
- generateScript: (payload: Payload, requestMethod: string) => string;
71
- }
72
- //# sourceMappingURL=BootpayModal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BootpayModal.d.ts","sourceRoot":"","sources":["../src/BootpayModal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIzC,OAAO,OAAO,EAAE,EAAC,mBAAmB,EAAC,MAAO,8BAA8B,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAI/E,qBAAa,WAAY,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAIzD,QAAQ,SAAU;IAClB,MAAM,U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qBAAqB,YAAmB,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,IAAI,SAAS,KAAK,mBAEvF;IAED,cAAc,YAAmB,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,IAAI,SAAS,KAAK,iBAAiB,MAAM,mBAyBvG;IAGD,kBAAkB,wBAQjB;IAGD,cAAc,YAAY,OAAO,iBAAiB,MAAM,YAavD;CAEJ"}
@@ -1,710 +0,0 @@
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 { debounce } from 'lodash';
58
- import UserInfo from './UserInfo';
59
- var BootpayTemp = /** @class */ (function (_super) {
60
- __extends(BootpayTemp, _super);
61
- function BootpayTemp(props) {
62
- var _this = _super.call(this, props) || this;
63
- // webView = useRef();
64
- // webView = useRef<WebView>(null);
65
- _this._VERSION = "4.1.3";
66
- _this._DEBUG = false;
67
- _this.state = {
68
- visibility: false,
69
- script: '',
70
- firstLoad: false,
71
- showCloseButton: false
72
- };
73
- // constructor(props) {
74
- // }
75
- // webView2 = useRef(null);
76
- // ref = {
77
- // webview2: WebView(null)
78
- // }
79
- // state = {
80
- // visibility: false,
81
- // script: '',
82
- // firstLoad: false,
83
- // showCloseButton: false
84
- // }
85
- // // _payload = {}
86
- // _VERSION = "4.1.3"
87
- // _DEBUG = false;
88
- _this.dismiss = function () {
89
- // let extra = new Extra()
90
- _this.setState({
91
- visibility: false
92
- });
93
- // this.removePaymentWindow();
94
- };
95
- _this.closeDismiss = function () {
96
- if (_this.props.onClose != undefined)
97
- _this.props.onClose();
98
- _this.dismiss();
99
- };
100
- _this.onMessage = function (event) {
101
- var _a, _b;
102
- console.log("onMessage: ".concat(event, ", ").concat(JSON.stringify(event)));
103
- if (event == undefined)
104
- return;
105
- var res = JSON.parse(JSON.stringify(event));
106
- if (res.data == 'close') {
107
- _this.closeDismiss();
108
- // if(this.props.onClose == undefined) return;
109
- // var json = {
110
- // action: 'BootpayClose',
111
- // message: '결제창이 닫혔습니다'
112
- // }
113
- // this.props.onClose();
114
- // this.dismiss();
115
- return;
116
- }
117
- var data = JSON.parse(res.data);
118
- // console.log(`redirect: ${JSON.stringify(data)}`);
119
- var redirect = false;
120
- var show_success = false;
121
- var show_error = false;
122
- if (((_a = _this.props.payload) === null || _a === void 0 ? void 0 : _a.extra) != undefined) {
123
- if (((_b = _this.props.payload.extra) === null || _b === void 0 ? void 0 : _b.open_type) == 'redirect') {
124
- redirect = true;
125
- }
126
- if (_this.props.payload.extra.display_error_result == true) {
127
- show_error = true;
128
- }
129
- if (_this.props.payload.extra.display_success_result == true) {
130
- show_success = true;
131
- }
132
- }
133
- if (redirect === true) {
134
- switch (data.event) {
135
- case 'cancel':
136
- if (_this.props.onCancel != undefined)
137
- _this.props.onCancel(data);
138
- _this.closeDismiss();
139
- break;
140
- case 'error':
141
- if (_this.props.onError != undefined)
142
- _this.props.onError(data);
143
- if (show_error == false) {
144
- _this.closeDismiss();
145
- }
146
- break;
147
- case 'issued':
148
- if (_this.props.onIssued != undefined)
149
- _this.props.onIssued(data);
150
- if (show_success == false) {
151
- _this.closeDismiss();
152
- }
153
- break;
154
- case 'confirm':
155
- if (_this.props.onConfirm != undefined)
156
- _this.props.onConfirm(data);
157
- break;
158
- case 'done':
159
- if (_this.props.onDone != undefined)
160
- _this.props.onDone(data);
161
- if (show_success == false) {
162
- _this.closeDismiss();
163
- }
164
- break;
165
- case 'close':
166
- _this.closeDismiss();
167
- break;
168
- }
169
- }
170
- else {
171
- switch (data.event) {
172
- case 'cancel':
173
- if (_this.props.onCancel != undefined)
174
- _this.props.onCancel(data);
175
- break;
176
- case 'error':
177
- if (_this.props.onError != undefined)
178
- _this.props.onError(data);
179
- break;
180
- case 'issued':
181
- if (_this.props.onIssued != undefined)
182
- _this.props.onIssued(data);
183
- break;
184
- case 'confirm':
185
- if (_this.props.onConfirm != undefined)
186
- _this.props.onConfirm(data);
187
- break;
188
- case 'done':
189
- if (_this.props.onDone != undefined)
190
- _this.props.onDone(data);
191
- break;
192
- case 'close':
193
- _this.closeDismiss();
194
- break;
195
- }
196
- }
197
- };
198
- _this.onShouldStartLoadWithRequest = function (_) {
199
- return true;
200
- };
201
- _this.getSDKVersion = function () {
202
- if (Platform.OS == 'ios') {
203
- return "Bootpay.setVersion('" + _this._VERSION + "', 'ios_react_native')";
204
- // return "Bootpay.setDevice('IOS');";
205
- }
206
- else if (Platform.OS == 'android') {
207
- return "Bootpay.setVersion('" + _this._VERSION + "', 'android_react_native')";
208
- // return "Bootpay.setDevice('ANDROID');";
209
- }
210
- else {
211
- return "";
212
- }
213
- };
214
- _this.getEnvironmentMode = function () {
215
- if (_this._DEBUG) {
216
- return "Bootpay.setEnvironmentMode('development');";
217
- }
218
- return "";
219
- };
220
- _this.getBootpayPlatform = function () {
221
- if (Platform.OS == 'ios') {
222
- return "Bootpay.setDevice('IOS');";
223
- }
224
- else if (Platform.OS == 'android') {
225
- return "Bootpay.setDevice('ANDROID');";
226
- }
227
- else {
228
- return "";
229
- }
230
- };
231
- // setPayScript = () => {
232
- // const fullScript = this.generateScript(this.state.script);
233
- // this.injectJavaScript(fullScript);
234
- // if(this.state.showCloseButton == true) {
235
- // if(this.webView == null || this.webView == undefined) return;
236
- // this.webView.showCloseButton();
237
- // }
238
- // }
239
- // transactionConfirm = () => {
240
- // const script = "Bootpay.confirm()"
241
- // +
242
- // ".then( function (res) {" +
243
- // this.confirm() +
244
- // this.issued() +
245
- // this.done() +
246
- // "}, function (res) {" +
247
- // this.error() +
248
- // this.cancel() +
249
- // "})";
250
- // this.callJavaScript(script);
251
- // }
252
- _this.removePaymentWindow = function () {
253
- _this.dismiss();
254
- // this.callJavaScript(`
255
- // Bootpay.removePaymentWindow();
256
- // `);
257
- };
258
- // callJavaScript = (script: string) => {
259
- // if(this.webView == null || this.webView == undefined) return
260
- // this.webView.current?.injectJavaScript(`
261
- // setTimeout(function() { ${script} }, 30);
262
- // `)
263
- // }
264
- _this.getAnalyticsData = function () { return __awaiter(_this, void 0, void 0, function () {
265
- var uuid, bootLastTime, elaspedTime;
266
- return __generator(this, function (_a) {
267
- switch (_a.label) {
268
- case 0: return [4 /*yield*/, UserInfo.getBootpayUUID()];
269
- case 1:
270
- uuid = _a.sent();
271
- return [4 /*yield*/, UserInfo.getBootpayLastTime()];
272
- case 2:
273
- bootLastTime = _a.sent();
274
- elaspedTime = Date.now() - bootLastTime;
275
- return [2 /*return*/, "window.Bootpay.$analytics.setAnalyticsData({uuid:'".concat(uuid, "', time:").concat(elaspedTime, "});")];
276
- }
277
- });
278
- }); };
279
- _this.confirm = function () {
280
- return "if (res.event === 'confirm') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
281
- };
282
- _this.done = function () {
283
- return "else if (res.event === 'done') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
284
- };
285
- _this.issued = function () {
286
- return "else if (res.event === 'issued') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
287
- };
288
- _this.error = function () {
289
- return "if (res.event === 'error') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
290
- };
291
- _this.cancel = function () {
292
- return "else if (res.event === 'cancel') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
293
- };
294
- _this.close = function () {
295
- return "document.addEventListener('bootpayclose', function (e) { window.BootpayRNWebView.postMessage('close'); });";
296
- };
297
- _this.webView = React.createRef();
298
- return _this;
299
- }
300
- BootpayTemp.prototype.componentWillUnmount = function () {
301
- return __awaiter(this, void 0, void 0, function () {
302
- return __generator(this, function (_a) {
303
- this.setState({
304
- visibility: false,
305
- firstLoad: false,
306
- showCloseButton: false
307
- });
308
- UserInfo.setBootpayLastTime(Date.now());
309
- return [2 /*return*/];
310
- });
311
- });
312
- };
313
- BootpayTemp.prototype.componentDidMount = function () {
314
- this.closeDismiss = debounce(this.closeDismiss, 30);
315
- };
316
- BootpayTemp.prototype.render = function () {
317
- return (<WebView ref={this.webView} originWhitelist={['*']} source={{
318
- uri: 'https://www.naver.com/'
319
- }} javaScriptEnabled={true} javaScriptCanOpenWindowsAutomatically={true}/>);
320
- };
321
- return BootpayTemp;
322
- }(Component));
323
- export { BootpayTemp };
324
- var BootpayModal = /** @class */ (function (_super) {
325
- __extends(BootpayModal, _super);
326
- function BootpayModal(props) {
327
- var _this = _super.call(this, props) || this;
328
- _this.state = {
329
- visibility: false,
330
- script: '',
331
- firstLoad: false,
332
- showCloseButton: false
333
- };
334
- // _payload = {}
335
- _this._VERSION = "4.1.3";
336
- _this._DEBUG = false;
337
- _this.dismiss = function () {
338
- // let extra = new Extra()
339
- _this.setState({
340
- visibility: false
341
- });
342
- // this.removePaymentWindow();
343
- };
344
- _this.closeDismiss = function () {
345
- if (_this.props.onClose != undefined)
346
- _this.props.onClose();
347
- _this.dismiss();
348
- };
349
- _this.onMessage = function (event) {
350
- var _a, _b;
351
- console.log("onMessage: ".concat(event, ", ").concat(JSON.stringify(event)));
352
- if (event == undefined)
353
- return;
354
- var res = JSON.parse(JSON.stringify(event));
355
- if (res.data == 'close') {
356
- _this.closeDismiss();
357
- // if(this.props.onClose == undefined) return;
358
- // var json = {
359
- // action: 'BootpayClose',
360
- // message: '결제창이 닫혔습니다'
361
- // }
362
- // this.props.onClose();
363
- // this.dismiss();
364
- return;
365
- }
366
- var data = JSON.parse(res.data);
367
- // console.log(`redirect: ${JSON.stringify(data)}`);
368
- var redirect = false;
369
- var show_success = false;
370
- var show_error = false;
371
- if (((_a = _this.props.payload) === null || _a === void 0 ? void 0 : _a.extra) != undefined) {
372
- if (((_b = _this.props.payload.extra) === null || _b === void 0 ? void 0 : _b.open_type) == 'redirect') {
373
- redirect = true;
374
- }
375
- if (_this.props.payload.extra.display_error_result == true) {
376
- show_error = true;
377
- }
378
- if (_this.props.payload.extra.display_success_result == true) {
379
- show_success = true;
380
- }
381
- }
382
- if (redirect === true) {
383
- switch (data.event) {
384
- case 'cancel':
385
- if (_this.props.onCancel != undefined)
386
- _this.props.onCancel(data);
387
- _this.closeDismiss();
388
- break;
389
- case 'error':
390
- if (_this.props.onError != undefined)
391
- _this.props.onError(data);
392
- if (show_error == false) {
393
- _this.closeDismiss();
394
- }
395
- break;
396
- case 'issued':
397
- if (_this.props.onIssued != undefined)
398
- _this.props.onIssued(data);
399
- if (show_success == false) {
400
- _this.closeDismiss();
401
- }
402
- break;
403
- case 'confirm':
404
- if (_this.props.onConfirm != undefined)
405
- _this.props.onConfirm(data);
406
- break;
407
- case 'done':
408
- if (_this.props.onDone != undefined)
409
- _this.props.onDone(data);
410
- if (show_success == false) {
411
- _this.closeDismiss();
412
- }
413
- break;
414
- case 'close':
415
- _this.closeDismiss();
416
- break;
417
- }
418
- }
419
- else {
420
- switch (data.event) {
421
- case 'cancel':
422
- if (_this.props.onCancel != undefined)
423
- _this.props.onCancel(data);
424
- break;
425
- case 'error':
426
- if (_this.props.onError != undefined)
427
- _this.props.onError(data);
428
- break;
429
- case 'issued':
430
- if (_this.props.onIssued != undefined)
431
- _this.props.onIssued(data);
432
- break;
433
- case 'confirm':
434
- if (_this.props.onConfirm != undefined)
435
- _this.props.onConfirm(data);
436
- break;
437
- case 'done':
438
- if (_this.props.onDone != undefined)
439
- _this.props.onDone(data);
440
- break;
441
- case 'close':
442
- _this.closeDismiss();
443
- break;
444
- }
445
- }
446
- };
447
- _this.onShouldStartLoadWithRequest = function (_) {
448
- return true;
449
- };
450
- _this.getSDKVersion = function () {
451
- if (Platform.OS == 'ios') {
452
- return "Bootpay.setVersion('" + _this._VERSION + "', 'ios_react_native')";
453
- // return "Bootpay.setDevice('IOS');";
454
- }
455
- else if (Platform.OS == 'android') {
456
- return "Bootpay.setVersion('" + _this._VERSION + "', 'android_react_native')";
457
- // return "Bootpay.setDevice('ANDROID');";
458
- }
459
- else {
460
- return "";
461
- }
462
- };
463
- _this.getEnvironmentMode = function () {
464
- if (_this._DEBUG) {
465
- return "Bootpay.setEnvironmentMode('development');";
466
- }
467
- return "";
468
- };
469
- _this.getBootpayPlatform = function () {
470
- if (Platform.OS == 'ios') {
471
- return "Bootpay.setDevice('IOS');";
472
- }
473
- else if (Platform.OS == 'android') {
474
- return "Bootpay.setDevice('ANDROID');";
475
- }
476
- else {
477
- return "";
478
- }
479
- };
480
- // setPayScript = () => {
481
- // const fullScript = this.generateScript(this.state.script);
482
- // this.injectJavaScript(fullScript);
483
- // if(this.state.showCloseButton == true) {
484
- // if(this.webView == null || this.webView == undefined) return;
485
- // this.webView.showCloseButton();
486
- // }
487
- // }
488
- _this.transactionConfirm = function () {
489
- var script = "Bootpay.confirm()"
490
- +
491
- ".then( function (res) {" +
492
- _this.confirm() +
493
- _this.issued() +
494
- _this.done() +
495
- "}, function (res) {" +
496
- _this.error() +
497
- _this.cancel() +
498
- "})";
499
- _this.callJavaScript(script);
500
- };
501
- _this.removePaymentWindow = function () {
502
- _this.dismiss();
503
- // this.callJavaScript(`
504
- // Bootpay.removePaymentWindow();
505
- // `);
506
- };
507
- _this.callJavaScript = function (script) {
508
- var _a;
509
- if (_this.webView == null || _this.webView == undefined)
510
- return;
511
- (_a = _this.webView.current) === null || _a === void 0 ? void 0 : _a.injectJavaScript("\n setTimeout(function() { ".concat(script, " }, 30);\n "));
512
- };
513
- _this.getAnalyticsData = function () { return __awaiter(_this, void 0, void 0, function () {
514
- var uuid, bootLastTime, elaspedTime;
515
- return __generator(this, function (_a) {
516
- switch (_a.label) {
517
- case 0: return [4 /*yield*/, UserInfo.getBootpayUUID()];
518
- case 1:
519
- uuid = _a.sent();
520
- return [4 /*yield*/, UserInfo.getBootpayLastTime()];
521
- case 2:
522
- bootLastTime = _a.sent();
523
- elaspedTime = Date.now() - bootLastTime;
524
- return [2 /*return*/, "window.Bootpay.$analytics.setAnalyticsData({uuid:'".concat(uuid, "', time:").concat(elaspedTime, "});")];
525
- }
526
- });
527
- }); };
528
- _this.confirm = function () {
529
- return "if (res.event === 'confirm') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
530
- };
531
- _this.done = function () {
532
- return "else if (res.event === 'done') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
533
- };
534
- _this.issued = function () {
535
- return "else if (res.event === 'issued') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
536
- };
537
- _this.error = function () {
538
- return "if (res.event === 'error') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
539
- };
540
- _this.cancel = function () {
541
- return "else if (res.event === 'cancel') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
542
- };
543
- _this.close = function () {
544
- return "document.addEventListener('bootpayclose', function (e) { window.BootpayRNWebView.postMessage('close'); });";
545
- };
546
- _this.requestPayment = function (payload, items, user, extra) { return __awaiter(_this, void 0, void 0, function () {
547
- return __generator(this, function (_a) {
548
- this.bootpayRequest(payload, items, user, extra, "requestPayment");
549
- return [2 /*return*/];
550
- });
551
- }); };
552
- _this.requestSubscription = function (payload, items, user, extra) { return __awaiter(_this, void 0, void 0, function () {
553
- return __generator(this, function (_a) {
554
- this.bootpayRequest(payload, items, user, extra, "requestSubscription");
555
- return [2 /*return*/];
556
- });
557
- }); };
558
- _this.requestAuthentication = function (payload, items, user, extra) { return __awaiter(_this, void 0, void 0, function () {
559
- return __generator(this, function (_a) {
560
- this.bootpayRequest(payload, items, user, extra, "requestAuthentication");
561
- return [2 /*return*/];
562
- });
563
- }); };
564
- _this.bootpayRequest = function (payload, items, user, extra, requestMethod) { return __awaiter(_this, void 0, void 0, function () {
565
- var _a, _b;
566
- var _c;
567
- return __generator(this, function (_d) {
568
- switch (_d.label) {
569
- case 0:
570
- payload.application_id = Platform.OS == 'ios' ? this.props.ios_application_id : this.props.android_application_id;
571
- payload.items = items;
572
- payload.user = user;
573
- payload.extra = extra;
574
- // this._payload = payload;
575
- // //visibility가 true가 되면 webview onLoaded가 실행됨
576
- _a = this.setState;
577
- _c = {
578
- visibility: true
579
- };
580
- _b = "\n ".concat;
581
- return [4 /*yield*/, this.getMountJavascript()];
582
- case 1:
583
- // this._payload = payload;
584
- // //visibility가 true가 되면 webview onLoaded가 실행됨
585
- _a.apply(this, [(_c.script = _b.apply("\n ", [_d.sent(), " \n "]).concat(this.generateScript(payload, requestMethod), "\n "),
586
- _c.firstLoad = false,
587
- _c.showCloseButton = extra.show_close_button || false,
588
- _c)]);
589
- UserInfo.updateInfo();
590
- return [2 /*return*/];
591
- }
592
- });
593
- }); };
594
- _this.getMountJavascript = function () { return __awaiter(_this, void 0, void 0, function () {
595
- var _a, _b;
596
- return __generator(this, function (_c) {
597
- switch (_c.label) {
598
- case 0:
599
- _b = (_a = "\n ".concat(this.getSDKVersion(), "\n ").concat(this.getEnvironmentMode(), "\n ").concat(this.getBootpayPlatform(), "\n ").concat(this.close(), "\n ")).concat;
600
- return [4 /*yield*/, this.getAnalyticsData()];
601
- case 1: return [2 /*return*/, _b.apply(_a, [_c.sent(), "\n "])];
602
- }
603
- });
604
- }); };
605
- _this.generateScript = function (payload, requestMethod) {
606
- var script = "Bootpay." + requestMethod +
607
- "(".concat(JSON.stringify(payload), ")") +
608
- ".then( function (res) {" +
609
- _this.confirm() +
610
- _this.issued() +
611
- _this.done() +
612
- "}, function (res) {" +
613
- _this.error() +
614
- _this.cancel() +
615
- "}); void(0);";
616
- return script;
617
- };
618
- _this.webView = React.createRef();
619
- return _this;
620
- }
621
- BootpayModal.prototype.componentWillUnmount = function () {
622
- return __awaiter(this, void 0, void 0, function () {
623
- return __generator(this, function (_a) {
624
- this.setState({
625
- visibility: false,
626
- firstLoad: false,
627
- showCloseButton: false
628
- });
629
- UserInfo.setBootpayLastTime(Date.now());
630
- return [2 /*return*/];
631
- });
632
- });
633
- };
634
- BootpayModal.prototype.componentDidMount = function () {
635
- this.closeDismiss = debounce(this.closeDismiss, 30);
636
- };
637
- BootpayModal.prototype.render = function () {
638
- var _this = this;
639
- return (<Modal animationType={'slide'} transparent={false} onRequestClose={function () {
640
- _this.closeDismiss();
641
- // console.log(1234);
642
- // this.dismiss();
643
- }} visible={this.state.visibility}>
644
- <SafeAreaView style={{ flex: 1 }}>
645
- {this.state.showCloseButton &&
646
- <TouchableOpacity onPress={function () {
647
- var cancelData = {
648
- action: 'BootpayCancel',
649
- message: '사용자에 의해 취소되었습니다'
650
- };
651
- if (_this.props.onCancel != undefined)
652
- _this.props.onCancel(cancelData);
653
- if (_this.props.onClose != undefined)
654
- _this.props.onClose();
655
- _this.setState({ visibility: false });
656
- }}>
657
- <Image style={[styles.overlay]} source={require('../images/close.png')}/>
658
- </TouchableOpacity>}
659
- <WebView ref={this.webView} originWhitelist={['*']} source={{
660
- uri: 'https://webview.bootpay.co.kr/4.1.5'
661
- }} injectedJavaScript={this.state.script} javaScriptEnabled={true} javaScriptCanOpenWindowsAutomatically={true}
662
- // scalesPageToFit={true}
663
- onMessage={this.onMessage}/>
664
- </SafeAreaView>
665
-
666
- </Modal>);
667
- };
668
- return BootpayModal;
669
- }(Component));
670
- export { BootpayModal };
671
- var styles = StyleSheet.create({
672
- container: {
673
- flex: 1,
674
- justifyContent: 'center',
675
- alignItems: 'center',
676
- backgroundColor: '#F5FCFF'
677
- },
678
- welcome: {
679
- fontSize: 20,
680
- textAlign: 'center',
681
- margin: 10
682
- },
683
- // Flex to fill, position absolute,
684
- // Fixed left/top, and the width set to the window width
685
- overlay: {
686
- width: 25,
687
- height: 25,
688
- right: 5,
689
- alignSelf: 'flex-end'
690
- }
691
- });
692
- // const deviceHeight = Dimensions.get('window').height;
693
- // const deviceWidth = Dimensions.get('window').width;
694
- // const styles = StyleSheet.create({
695
- // container: {
696
- // flex: 1,
697
- // alignItems: 'center',
698
- // justifyContent: 'center',
699
- // },
700
- // webview: {
701
- // width: deviceWidth,
702
- // height: deviceHeight
703
- // },
704
- // button: {
705
- // alignItems: "center",
706
- // backgroundColor: "#DDDDDD",
707
- // padding: 10,
708
- // margin: 10,
709
- // },
710
- // });
@@ -1 +0,0 @@
1
- //# sourceMappingURL=BootpayShared.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BootpayShared.d.ts","sourceRoot":"","sources":["../src/BootpayShared.tsx"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- "use strict";