@apps-in-toss/native-modules 0.0.0-dev.1752049503789
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/README.md +3 -0
- package/dist/bridges-meta.json +110 -0
- package/dist/index.cjs +775 -0
- package/dist/index.d.cts +2352 -0
- package/dist/index.d.ts +2352 -0
- package/dist/index.js +712 -0
- package/package.json +58 -0
- package/src/async-bridges.ts +23 -0
- package/src/constant-bridges.ts +9 -0
- package/src/event-bridges.ts +2 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,775 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
Accuracy: () => Accuracy2,
|
|
24
|
+
AppsInTossModule: () => AppsInTossModule,
|
|
25
|
+
BedrockCoreModule: () => BedrockCoreModule,
|
|
26
|
+
BedrockModule: () => BedrockModule,
|
|
27
|
+
GoogleAdMob: () => GoogleAdMob,
|
|
28
|
+
INTERNAL__AppsInTossModule: () => AppsInTossModuleInstance,
|
|
29
|
+
INTERNAL__module: () => INTERNAL__module,
|
|
30
|
+
Storage: () => Storage,
|
|
31
|
+
TossPay: () => TossPay,
|
|
32
|
+
appLogin: () => appLogin,
|
|
33
|
+
appsInTossEvent: () => appsInTossEvent,
|
|
34
|
+
closeView: () => closeView,
|
|
35
|
+
eventLog: () => eventLog,
|
|
36
|
+
fetchAlbumPhotos: () => fetchAlbumPhotos,
|
|
37
|
+
fetchContacts: () => fetchContacts,
|
|
38
|
+
generateHapticFeedback: () => generateHapticFeedback,
|
|
39
|
+
getClipboardText: () => getClipboardText,
|
|
40
|
+
getCurrentLocation: () => getCurrentLocation,
|
|
41
|
+
getDeviceId: () => getDeviceId,
|
|
42
|
+
getLocale: () => getLocale,
|
|
43
|
+
getNetworkStatus: () => getNetworkStatus,
|
|
44
|
+
getOperationalEnvironment: () => getOperationalEnvironment,
|
|
45
|
+
getPlatformOS: () => getPlatformOS,
|
|
46
|
+
getSchemeUri: () => getSchemeUri,
|
|
47
|
+
getTossAppVersion: () => getTossAppVersion,
|
|
48
|
+
getTossShareLink: () => getTossShareLink,
|
|
49
|
+
isMinVersionSupported: () => isMinVersionSupported,
|
|
50
|
+
openCamera: () => openCamera,
|
|
51
|
+
openURL: () => openURL,
|
|
52
|
+
saveBase64Data: () => saveBase64Data,
|
|
53
|
+
setClipboardText: () => setClipboardText,
|
|
54
|
+
setDeviceOrientation: () => setDeviceOrientation,
|
|
55
|
+
setIosSwipeGestureEnabled: () => setIosSwipeGestureEnabled,
|
|
56
|
+
setScreenAwakeMode: () => setScreenAwakeMode,
|
|
57
|
+
setSecureScreen: () => setSecureScreen,
|
|
58
|
+
share: () => share,
|
|
59
|
+
startUpdateLocation: () => startUpdateLocation
|
|
60
|
+
});
|
|
61
|
+
module.exports = __toCommonJS(index_exports);
|
|
62
|
+
|
|
63
|
+
// src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
|
|
64
|
+
var import_react_native6 = require("@granite-js/react-native");
|
|
65
|
+
|
|
66
|
+
// src/AppsInTossModule/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts
|
|
67
|
+
var import_react_native = require("@granite-js/react-native");
|
|
68
|
+
var EntryMessageExitedEvent = class extends import_react_native.GraniteEventDefinition {
|
|
69
|
+
name = "entryMessageExited";
|
|
70
|
+
remove() {
|
|
71
|
+
}
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
73
|
+
listener(_) {
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
78
|
+
var import_react_native4 = require("@granite-js/react-native");
|
|
79
|
+
|
|
80
|
+
// src/AppsInTossModule/native-modules/AppsInTossModule.ts
|
|
81
|
+
var import_react_native2 = require("react-native");
|
|
82
|
+
var Module = import_react_native2.TurboModuleRegistry.getEnforcing("AppsInTossModule");
|
|
83
|
+
var AppsInTossModuleInstance = Module;
|
|
84
|
+
var AppsInTossModule = Module;
|
|
85
|
+
|
|
86
|
+
// src/AppsInTossModule/native-modules/getPermission.ts
|
|
87
|
+
function getPermission(permission) {
|
|
88
|
+
return AppsInTossModule.getPermission(permission);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// src/AppsInTossModule/native-modules/openPermissionDialog.ts
|
|
92
|
+
function openPermissionDialog(permission) {
|
|
93
|
+
return AppsInTossModule.openPermissionDialog(permission);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// src/AppsInTossModule/native-modules/requestPermission.ts
|
|
97
|
+
async function requestPermission(permission) {
|
|
98
|
+
const permissionStatus = await getPermission(permission);
|
|
99
|
+
switch (permissionStatus) {
|
|
100
|
+
case "allowed":
|
|
101
|
+
case "denied":
|
|
102
|
+
return permissionStatus;
|
|
103
|
+
default:
|
|
104
|
+
return openPermissionDialog(permission);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// src/AppsInTossModule/native-event-emitter/nativeEventEmitter.ts
|
|
109
|
+
var import_react_native3 = require("react-native");
|
|
110
|
+
var nativeEventEmitter = new import_react_native3.NativeEventEmitter(AppsInTossModuleInstance);
|
|
111
|
+
|
|
112
|
+
// src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
113
|
+
var UpdateLocationEvent = class extends import_react_native4.GraniteEventDefinition {
|
|
114
|
+
name = "updateLocationEvent";
|
|
115
|
+
subscriptionCount = 0;
|
|
116
|
+
ref = {
|
|
117
|
+
remove: () => {
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
remove() {
|
|
121
|
+
if (--this.subscriptionCount === 0) {
|
|
122
|
+
AppsInTossModuleInstance.stopUpdateLocation({});
|
|
123
|
+
}
|
|
124
|
+
this.ref.remove();
|
|
125
|
+
}
|
|
126
|
+
listener(options, onEvent, onError) {
|
|
127
|
+
requestPermission({ name: "geolocation", access: "access" }).then((permissionStatus) => {
|
|
128
|
+
if (permissionStatus === "denied") {
|
|
129
|
+
onError(new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."));
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
void AppsInTossModuleInstance.startUpdateLocation(options).catch(onError);
|
|
133
|
+
const subscription = nativeEventEmitter.addListener("updateLocation", onEvent);
|
|
134
|
+
this.ref = {
|
|
135
|
+
remove: () => subscription?.remove()
|
|
136
|
+
};
|
|
137
|
+
this.subscriptionCount++;
|
|
138
|
+
}).catch(onError);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
143
|
+
var import_react_native5 = require("@granite-js/react-native");
|
|
144
|
+
|
|
145
|
+
// src/utils/generateUUID.ts
|
|
146
|
+
function generateUUID(placeholder) {
|
|
147
|
+
return placeholder ? (placeholder ^ Math.random() * 16 >> placeholder / 4).toString(16) : (String(1e7) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, generateUUID);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// src/AppsInTossModule/native-event-emitter/internal/appBridge.ts
|
|
151
|
+
var INTERNAL__callbacks = /* @__PURE__ */ new Map();
|
|
152
|
+
function invokeAppBridgeCallback(id, ...args) {
|
|
153
|
+
const callback = INTERNAL__callbacks.get(id);
|
|
154
|
+
callback?.call(null, ...args);
|
|
155
|
+
return Boolean(callback);
|
|
156
|
+
}
|
|
157
|
+
function invokeAppBridgeMethod(methodName, params, callbacks) {
|
|
158
|
+
const { onSuccess, onError, ...appBridgeCallbacks } = callbacks;
|
|
159
|
+
const { callbackMap, unregisterAll } = registerCallbacks(appBridgeCallbacks);
|
|
160
|
+
const promise = AppsInTossModuleInstance[methodName]({
|
|
161
|
+
params,
|
|
162
|
+
callbacks: callbackMap
|
|
163
|
+
});
|
|
164
|
+
void promise.then(onSuccess).catch(onError);
|
|
165
|
+
return unregisterAll;
|
|
166
|
+
}
|
|
167
|
+
function registerCallbacks(callbacks) {
|
|
168
|
+
const callbackMap = {};
|
|
169
|
+
for (const [callbackName, callback] of Object.entries(callbacks)) {
|
|
170
|
+
const id = registerCallback(callback, callbackName);
|
|
171
|
+
callbackMap[callbackName] = id;
|
|
172
|
+
}
|
|
173
|
+
const unregisterAll = () => {
|
|
174
|
+
Object.values(callbackMap).forEach(unregisterCallback);
|
|
175
|
+
};
|
|
176
|
+
return { callbackMap, unregisterAll };
|
|
177
|
+
}
|
|
178
|
+
function registerCallback(callback, name = "unnamed") {
|
|
179
|
+
const uniqueId = generateUUID();
|
|
180
|
+
const callbackId = `${uniqueId}__${name}`;
|
|
181
|
+
INTERNAL__callbacks.set(callbackId, callback);
|
|
182
|
+
return callbackId;
|
|
183
|
+
}
|
|
184
|
+
function unregisterCallback(id) {
|
|
185
|
+
INTERNAL__callbacks.delete(id);
|
|
186
|
+
}
|
|
187
|
+
function getCallbackIds() {
|
|
188
|
+
return Array.from(INTERNAL__callbacks.keys());
|
|
189
|
+
}
|
|
190
|
+
var INTERNAL__appBridgeHandler = {
|
|
191
|
+
invokeAppBridgeCallback,
|
|
192
|
+
invokeAppBridgeMethod,
|
|
193
|
+
registerCallback,
|
|
194
|
+
unregisterCallback,
|
|
195
|
+
getCallbackIds
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
// src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
199
|
+
var UNSAFE__nativeEventEmitter = nativeEventEmitter;
|
|
200
|
+
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends import_react_native5.GraniteEventDefinition {
|
|
201
|
+
static INTERNAL__appBridgeSubscription;
|
|
202
|
+
name = "appBridgeCallbackEvent";
|
|
203
|
+
constructor() {
|
|
204
|
+
super();
|
|
205
|
+
this.registerAppBridgeCallbackEventListener();
|
|
206
|
+
}
|
|
207
|
+
remove() {
|
|
208
|
+
}
|
|
209
|
+
listener() {
|
|
210
|
+
}
|
|
211
|
+
registerAppBridgeCallbackEventListener() {
|
|
212
|
+
if (_AppBridgeCallbackEvent.INTERNAL__appBridgeSubscription != null) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
_AppBridgeCallbackEvent.INTERNAL__appBridgeSubscription = UNSAFE__nativeEventEmitter.addListener(
|
|
216
|
+
"appBridgeCallback",
|
|
217
|
+
this.ensureInvokeAppBridgeCallback
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
ensureInvokeAppBridgeCallback(result) {
|
|
221
|
+
if (typeof result === "object" && typeof result.name === "string") {
|
|
222
|
+
INTERNAL__appBridgeHandler.invokeAppBridgeCallback(result.name, result.params);
|
|
223
|
+
} else {
|
|
224
|
+
console.warn("Invalid app bridge callback result:", result);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
// src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
|
|
230
|
+
var appsInTossEvent = new import_react_native6.GraniteEvent([
|
|
231
|
+
new AppBridgeCallbackEvent(),
|
|
232
|
+
new UpdateLocationEvent(),
|
|
233
|
+
new EntryMessageExitedEvent()
|
|
234
|
+
]);
|
|
235
|
+
|
|
236
|
+
// src/AppsInTossModule/native-event-emitter/startUpdateLocation.ts
|
|
237
|
+
function startUpdateLocation(eventParams) {
|
|
238
|
+
return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// src/AppsInTossModule/native-modules/ads/googleAdMob.ts
|
|
242
|
+
var import_es_toolkit = require("es-toolkit");
|
|
243
|
+
|
|
244
|
+
// src/AppsInTossModule/native-modules/getOperationalEnvironment.ts
|
|
245
|
+
function getOperationalEnvironment() {
|
|
246
|
+
return AppsInTossModule.operationalEnvironment;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// src/AppsInTossModule/native-modules/isMinVersionSupported.ts
|
|
250
|
+
var import_react_native7 = require("react-native");
|
|
251
|
+
|
|
252
|
+
// src/utils/compareVersion.ts
|
|
253
|
+
var SEMVER_REGEX = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
|
|
254
|
+
var isWildcard = (val) => ["*", "x", "X"].includes(val);
|
|
255
|
+
var tryParse = (val) => {
|
|
256
|
+
const num = parseInt(val, 10);
|
|
257
|
+
return isNaN(num) ? val : num;
|
|
258
|
+
};
|
|
259
|
+
var coerceTypes = (a, b) => {
|
|
260
|
+
return typeof a === typeof b ? [a, b] : [String(a), String(b)];
|
|
261
|
+
};
|
|
262
|
+
var compareValues = (a, b) => {
|
|
263
|
+
if (isWildcard(a) || isWildcard(b)) {
|
|
264
|
+
return 0;
|
|
265
|
+
}
|
|
266
|
+
const [aVal, bVal] = coerceTypes(tryParse(a), tryParse(b));
|
|
267
|
+
if (aVal > bVal) {
|
|
268
|
+
return 1;
|
|
269
|
+
}
|
|
270
|
+
if (aVal < bVal) {
|
|
271
|
+
return -1;
|
|
272
|
+
}
|
|
273
|
+
return 0;
|
|
274
|
+
};
|
|
275
|
+
var parseVersion = (version) => {
|
|
276
|
+
if (typeof version !== "string") {
|
|
277
|
+
throw new TypeError("Invalid argument: expected a string");
|
|
278
|
+
}
|
|
279
|
+
const match = version.match(SEMVER_REGEX);
|
|
280
|
+
if (!match) {
|
|
281
|
+
throw new Error(`Invalid semver: '${version}'`);
|
|
282
|
+
}
|
|
283
|
+
const [, major, minor, patch, build, preRelease] = match;
|
|
284
|
+
return [major, minor, patch, build, preRelease];
|
|
285
|
+
};
|
|
286
|
+
var compareSegments = (a, b) => {
|
|
287
|
+
const maxLength = Math.max(a.length, b.length);
|
|
288
|
+
for (let i = 0; i < maxLength; i++) {
|
|
289
|
+
const segA = a[i] ?? "0";
|
|
290
|
+
const segB = b[i] ?? "0";
|
|
291
|
+
const result = compareValues(segA, segB);
|
|
292
|
+
if (result !== 0) {
|
|
293
|
+
return result;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return 0;
|
|
297
|
+
};
|
|
298
|
+
var compareVersions = (v1, v2) => {
|
|
299
|
+
const seg1 = parseVersion(v1);
|
|
300
|
+
const seg2 = parseVersion(v2);
|
|
301
|
+
const preRelease1 = seg1.pop();
|
|
302
|
+
const preRelease2 = seg2.pop();
|
|
303
|
+
const mainCompare = compareSegments(seg1, seg2);
|
|
304
|
+
if (mainCompare !== 0) {
|
|
305
|
+
return mainCompare;
|
|
306
|
+
}
|
|
307
|
+
if (preRelease1 && preRelease2) {
|
|
308
|
+
return compareSegments(preRelease1.split("."), preRelease2.split("."));
|
|
309
|
+
}
|
|
310
|
+
if (preRelease1) {
|
|
311
|
+
return -1;
|
|
312
|
+
}
|
|
313
|
+
if (preRelease2) {
|
|
314
|
+
return 1;
|
|
315
|
+
}
|
|
316
|
+
return 0;
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
// src/AppsInTossModule/native-modules/isMinVersionSupported.ts
|
|
320
|
+
function isMinVersionSupported(minVersions) {
|
|
321
|
+
const operationalEnvironment = AppsInTossModule.operationalEnvironment;
|
|
322
|
+
if (operationalEnvironment === "sandbox") {
|
|
323
|
+
return true;
|
|
324
|
+
}
|
|
325
|
+
const currentVersion = AppsInTossModule.tossAppVersion;
|
|
326
|
+
const isIOS = import_react_native7.Platform.OS === "ios";
|
|
327
|
+
const minVersion = isIOS ? minVersions.ios : minVersions.android;
|
|
328
|
+
if (minVersion === void 0) {
|
|
329
|
+
return false;
|
|
330
|
+
}
|
|
331
|
+
if (minVersion === "always") {
|
|
332
|
+
return true;
|
|
333
|
+
}
|
|
334
|
+
if (minVersion === "never") {
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
return compareVersions(currentVersion, minVersion) >= 0;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// src/AppsInTossModule/native-modules/ads/googleAdMob.ts
|
|
341
|
+
function loadAdMobInterstitialAd(params) {
|
|
342
|
+
if (!loadAdMobInterstitialAd.isSupported()) {
|
|
343
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
344
|
+
return import_es_toolkit.noop;
|
|
345
|
+
}
|
|
346
|
+
const { onEvent, onError, options } = params;
|
|
347
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobInterstitialAd", options, {
|
|
348
|
+
onAdClicked: () => {
|
|
349
|
+
onEvent({ type: "clicked" });
|
|
350
|
+
},
|
|
351
|
+
onAdDismissed: () => {
|
|
352
|
+
onEvent({ type: "dismissed" });
|
|
353
|
+
},
|
|
354
|
+
onAdFailedToShow: () => {
|
|
355
|
+
onEvent({ type: "failedToShow" });
|
|
356
|
+
},
|
|
357
|
+
onAdImpression: () => {
|
|
358
|
+
onEvent({ type: "impression" });
|
|
359
|
+
},
|
|
360
|
+
onAdShow: () => {
|
|
361
|
+
onEvent({ type: "show" });
|
|
362
|
+
},
|
|
363
|
+
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
364
|
+
onError
|
|
365
|
+
});
|
|
366
|
+
return unregisterCallbacks;
|
|
367
|
+
}
|
|
368
|
+
function showAdMobInterstitialAd(params) {
|
|
369
|
+
if (!showAdMobInterstitialAd.isSupported()) {
|
|
370
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
371
|
+
return import_es_toolkit.noop;
|
|
372
|
+
}
|
|
373
|
+
const { onEvent, onError, options } = params;
|
|
374
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobInterstitialAd", options, {
|
|
375
|
+
onSuccess: () => onEvent({ type: "requested" }),
|
|
376
|
+
onError
|
|
377
|
+
});
|
|
378
|
+
return unregisterCallbacks;
|
|
379
|
+
}
|
|
380
|
+
function loadAdMobRewardedAd(params) {
|
|
381
|
+
if (!loadAdMobRewardedAd.isSupported()) {
|
|
382
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
383
|
+
return import_es_toolkit.noop;
|
|
384
|
+
}
|
|
385
|
+
const { onEvent, onError, options } = params;
|
|
386
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobRewardedAd", options, {
|
|
387
|
+
onAdClicked: () => {
|
|
388
|
+
onEvent({ type: "clicked" });
|
|
389
|
+
},
|
|
390
|
+
onAdDismissed: () => {
|
|
391
|
+
onEvent({ type: "dismissed" });
|
|
392
|
+
},
|
|
393
|
+
onAdFailedToShow: () => {
|
|
394
|
+
onEvent({ type: "failedToShow" });
|
|
395
|
+
},
|
|
396
|
+
onAdImpression: () => {
|
|
397
|
+
onEvent({ type: "impression" });
|
|
398
|
+
},
|
|
399
|
+
onAdShow: () => {
|
|
400
|
+
onEvent({ type: "show" });
|
|
401
|
+
},
|
|
402
|
+
onUserEarnedReward: () => {
|
|
403
|
+
onEvent({ type: "userEarnedReward" });
|
|
404
|
+
},
|
|
405
|
+
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
406
|
+
onError
|
|
407
|
+
});
|
|
408
|
+
return unregisterCallbacks;
|
|
409
|
+
}
|
|
410
|
+
function showAdMobRewardedAd(params) {
|
|
411
|
+
if (!showAdMobRewardedAd.isSupported()) {
|
|
412
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
413
|
+
return import_es_toolkit.noop;
|
|
414
|
+
}
|
|
415
|
+
const { onEvent, onError, options } = params;
|
|
416
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobRewardedAd", options, {
|
|
417
|
+
onSuccess: () => onEvent({ type: "requested" }),
|
|
418
|
+
onError
|
|
419
|
+
});
|
|
420
|
+
return unregisterCallbacks;
|
|
421
|
+
}
|
|
422
|
+
var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
|
|
423
|
+
var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
|
|
424
|
+
var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
|
|
425
|
+
var ENVIRONMENT = getOperationalEnvironment();
|
|
426
|
+
function createIsSupported() {
|
|
427
|
+
return () => {
|
|
428
|
+
if (ENVIRONMENT !== "toss") {
|
|
429
|
+
return false;
|
|
430
|
+
}
|
|
431
|
+
return isMinVersionSupported({
|
|
432
|
+
android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION,
|
|
433
|
+
ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION
|
|
434
|
+
});
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
loadAdMobInterstitialAd.isSupported = createIsSupported();
|
|
438
|
+
loadAdMobRewardedAd.isSupported = createIsSupported();
|
|
439
|
+
showAdMobInterstitialAd.isSupported = createIsSupported();
|
|
440
|
+
showAdMobRewardedAd.isSupported = createIsSupported();
|
|
441
|
+
|
|
442
|
+
// src/AppsInTossModule/native-modules/checkoutPayment.ts
|
|
443
|
+
async function checkoutPayment(options) {
|
|
444
|
+
return AppsInTossModule.checkoutPayment({ params: options });
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// src/AppsInTossModule/native-modules/setClipboardText.ts
|
|
448
|
+
async function setClipboardText(text) {
|
|
449
|
+
const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
|
|
450
|
+
if (permissionStatus === "denied") {
|
|
451
|
+
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
452
|
+
}
|
|
453
|
+
return AppsInTossModule.setClipboardText({ text });
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// src/AppsInTossModule/native-modules/getClipboardText.ts
|
|
457
|
+
async function getClipboardText() {
|
|
458
|
+
const permissionStatus = await requestPermission({ name: "clipboard", access: "read" });
|
|
459
|
+
if (permissionStatus === "denied") {
|
|
460
|
+
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC77D\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
461
|
+
}
|
|
462
|
+
return AppsInTossModule.getClipboardText({});
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// src/AppsInTossModule/native-modules/fetchContacts.ts
|
|
466
|
+
async function fetchContacts(options) {
|
|
467
|
+
const permissionStatus = await requestPermission({ name: "contacts", access: "read" });
|
|
468
|
+
if (permissionStatus === "denied") {
|
|
469
|
+
throw new Error("\uC5F0\uB77D\uCC98 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
470
|
+
}
|
|
471
|
+
const contacts = await AppsInTossModule.fetchContacts(options);
|
|
472
|
+
return {
|
|
473
|
+
result: contacts.result,
|
|
474
|
+
nextOffset: contacts.nextOffset ?? null,
|
|
475
|
+
done: contacts.done
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// src/AppsInTossModule/native-modules/fetchAlbumPhotos.ts
|
|
480
|
+
var DEFAULT_MAX_COUNT = 10;
|
|
481
|
+
var DEFAULT_MAX_WIDTH = 1024;
|
|
482
|
+
async function fetchAlbumPhotos(options) {
|
|
483
|
+
const permissionStatus = await requestPermission({ name: "photos", access: "read" });
|
|
484
|
+
if (permissionStatus === "denied") {
|
|
485
|
+
throw new Error("\uC0AC\uC9C4\uCCA9 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
486
|
+
}
|
|
487
|
+
const albumPhotos = await AppsInTossModule.fetchAlbumPhotos({
|
|
488
|
+
...options,
|
|
489
|
+
maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
|
|
490
|
+
maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
|
|
491
|
+
});
|
|
492
|
+
return albumPhotos;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
// src/AppsInTossModule/native-modules/getCurrentLocation.ts
|
|
496
|
+
async function getCurrentLocation(options) {
|
|
497
|
+
const permissionStatus = await requestPermission({ name: "geolocation", access: "access" });
|
|
498
|
+
if (permissionStatus === "denied") {
|
|
499
|
+
throw new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
500
|
+
}
|
|
501
|
+
const position = await AppsInTossModule.getCurrentLocation(options);
|
|
502
|
+
return position;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
// src/AppsInTossModule/native-modules/openCamera.ts
|
|
506
|
+
async function openCamera(options) {
|
|
507
|
+
const permissionStatus = await requestPermission({ name: "camera", access: "access" });
|
|
508
|
+
if (permissionStatus === "denied") {
|
|
509
|
+
throw new Error("\uCE74\uBA54\uB77C \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
510
|
+
}
|
|
511
|
+
const photo = await AppsInTossModule.openCamera({ base64: false, maxWidth: 1024, ...options });
|
|
512
|
+
return photo;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// src/AppsInTossModule/native-modules/appLogin.ts
|
|
516
|
+
async function appLogin() {
|
|
517
|
+
return AppsInTossModule.appLogin({});
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
// src/AppsInTossModule/native-modules/getTossAppVersion.ts
|
|
521
|
+
function getTossAppVersion() {
|
|
522
|
+
return AppsInTossModule.tossAppVersion;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// src/AppsInTossModule/native-modules/getDeviceId.ts
|
|
526
|
+
function getDeviceId() {
|
|
527
|
+
return AppsInTossModule.deviceId;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
// src/AppsInTossModule/native-modules/storage.ts
|
|
531
|
+
function getItem(key) {
|
|
532
|
+
return AppsInTossModule.getStorageItem({ key });
|
|
533
|
+
}
|
|
534
|
+
function setItem(key, value) {
|
|
535
|
+
return AppsInTossModule.setStorageItem({
|
|
536
|
+
key,
|
|
537
|
+
value
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
function removeItem(key) {
|
|
541
|
+
return AppsInTossModule.removeStorageItem({ key });
|
|
542
|
+
}
|
|
543
|
+
function clearItems() {
|
|
544
|
+
return AppsInTossModule.clearStorage({});
|
|
545
|
+
}
|
|
546
|
+
var Storage = {
|
|
547
|
+
getItem,
|
|
548
|
+
setItem,
|
|
549
|
+
removeItem,
|
|
550
|
+
clearItems
|
|
551
|
+
};
|
|
552
|
+
|
|
553
|
+
// src/AppsInTossModule/native-modules/eventLog.ts
|
|
554
|
+
function normalizeParams(params) {
|
|
555
|
+
return Object.fromEntries(
|
|
556
|
+
Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
|
|
557
|
+
);
|
|
558
|
+
}
|
|
559
|
+
async function eventLog(params) {
|
|
560
|
+
if (AppsInTossModule.operationalEnvironment === "sandbox") {
|
|
561
|
+
console.log("[eventLogDebug]", {
|
|
562
|
+
log_name: params.log_name,
|
|
563
|
+
log_type: params.log_type,
|
|
564
|
+
params: normalizeParams(params.params)
|
|
565
|
+
});
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
const isSupported = isMinVersionSupported({
|
|
569
|
+
android: "5.208.0",
|
|
570
|
+
ios: "5.208.0"
|
|
571
|
+
});
|
|
572
|
+
if (!isSupported) {
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
return AppsInTossModule.eventLog({
|
|
576
|
+
log_name: params.log_name,
|
|
577
|
+
log_type: params.log_type,
|
|
578
|
+
params: normalizeParams(params.params)
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// src/AppsInTossModule/native-modules/getTossShareLink.ts
|
|
583
|
+
async function getTossShareLink(path) {
|
|
584
|
+
const { shareLink } = await AppsInTossModule.getTossShareLink({});
|
|
585
|
+
const shareUrl = new URL(shareLink);
|
|
586
|
+
shareUrl.searchParams.set("deep_link_value", path);
|
|
587
|
+
shareUrl.searchParams.set("af_dp", path);
|
|
588
|
+
return shareUrl.toString();
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
// src/AppsInTossModule/native-modules/setDeviceOrientation.ts
|
|
592
|
+
async function setDeviceOrientation(options) {
|
|
593
|
+
const isSupported = isMinVersionSupported({
|
|
594
|
+
android: "5.215.0",
|
|
595
|
+
ios: "5.215.0"
|
|
596
|
+
});
|
|
597
|
+
if (!isSupported) {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
return AppsInTossModule.setDeviceOrientation(options);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
// src/AppsInTossModule/native-modules/saveBase64Data.ts
|
|
604
|
+
async function saveBase64Data(params) {
|
|
605
|
+
const isSupported = isMinVersionSupported({
|
|
606
|
+
android: "5.218.0",
|
|
607
|
+
ios: "5.216.0"
|
|
608
|
+
});
|
|
609
|
+
if (!isSupported) {
|
|
610
|
+
console.warn("saveBase64Data is not supported in this app version");
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
await AppsInTossModule.saveBase64Data(params);
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
// src/AppsInTossModule/native-modules/index.ts
|
|
617
|
+
var TossPay = {
|
|
618
|
+
checkoutPayment
|
|
619
|
+
};
|
|
620
|
+
var GoogleAdMob = {
|
|
621
|
+
loadAdMobInterstitialAd,
|
|
622
|
+
showAdMobInterstitialAd,
|
|
623
|
+
loadAdMobRewardedAd,
|
|
624
|
+
showAdMobRewardedAd
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
// src/BedrockModule/native-modules/natives/BedrockModule.ts
|
|
628
|
+
var import_react_native8 = require("react-native");
|
|
629
|
+
var BedrockModule = import_react_native8.NativeModules.BedrockModule;
|
|
630
|
+
|
|
631
|
+
// src/BedrockModule/native-modules/natives/closeView.ts
|
|
632
|
+
async function closeView() {
|
|
633
|
+
return BedrockModule.closeView();
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
// src/BedrockModule/native-modules/natives/getLocale.ts
|
|
637
|
+
var import_react_native9 = require("react-native");
|
|
638
|
+
function getLocale() {
|
|
639
|
+
const locale = BedrockModule?.DeviceInfo?.locale ?? "ko-KR";
|
|
640
|
+
if (import_react_native9.Platform.OS === "android") {
|
|
641
|
+
return replaceUnderbarToHypen(locale);
|
|
642
|
+
}
|
|
643
|
+
return locale;
|
|
644
|
+
}
|
|
645
|
+
function replaceUnderbarToHypen(locale) {
|
|
646
|
+
return locale.replace(/_/g, "-");
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
// src/BedrockModule/native-modules/natives/getSchemeUri.ts
|
|
650
|
+
function getSchemeUri() {
|
|
651
|
+
return BedrockModule.schemeUri;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// src/BedrockModule/native-modules/natives/generateHapticFeedback/index.ts
|
|
655
|
+
function generateHapticFeedback(options) {
|
|
656
|
+
return BedrockModule.generateHapticFeedback(options);
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
// src/BedrockModule/native-modules/natives/share.ts
|
|
660
|
+
async function share(message) {
|
|
661
|
+
BedrockModule.share(message);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
// src/BedrockModule/native-modules/natives/setSecureScreen.ts
|
|
665
|
+
function setSecureScreen(options) {
|
|
666
|
+
return BedrockModule.setSecureScreen(options);
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
// src/BedrockModule/native-modules/natives/setScreenAwakeMode.ts
|
|
670
|
+
async function setScreenAwakeMode(options) {
|
|
671
|
+
return BedrockModule.setScreenAwakeMode(options);
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
// src/BedrockModule/native-modules/natives/getNetworkStatus/index.ts
|
|
675
|
+
function getNetworkStatus() {
|
|
676
|
+
return BedrockModule.getNetworkStatus();
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// src/BedrockModule/native-modules/natives/setIosSwipeGestureEnabled.ts
|
|
680
|
+
async function setIosSwipeGestureEnabled(options) {
|
|
681
|
+
if (BedrockModule.setIosSwipeGestureEnabled == null) {
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
return BedrockModule.setIosSwipeGestureEnabled(options);
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
// src/BedrockModule/native-modules/natives/openURL.ts
|
|
688
|
+
var import_react_native10 = require("react-native");
|
|
689
|
+
function openURL(url) {
|
|
690
|
+
return import_react_native10.Linking.openURL(url);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
// src/BedrockModule/native-modules/natives/getPlatformOS.ts
|
|
694
|
+
var import_react_native11 = require("react-native");
|
|
695
|
+
function getPlatformOS() {
|
|
696
|
+
return import_react_native11.Platform.OS;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// src/BedrockModule/native-modules/core/BedrockCoreModule.ts
|
|
700
|
+
var import_react_native12 = require("react-native");
|
|
701
|
+
var BedrockCoreModule = import_react_native12.NativeModules.BedrockCoreModule;
|
|
702
|
+
|
|
703
|
+
// src/types.ts
|
|
704
|
+
var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
705
|
+
Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
|
|
706
|
+
Accuracy3[Accuracy3["Low"] = 2] = "Low";
|
|
707
|
+
Accuracy3[Accuracy3["Balanced"] = 3] = "Balanced";
|
|
708
|
+
Accuracy3[Accuracy3["High"] = 4] = "High";
|
|
709
|
+
Accuracy3[Accuracy3["Highest"] = 5] = "Highest";
|
|
710
|
+
Accuracy3[Accuracy3["BestForNavigation"] = 6] = "BestForNavigation";
|
|
711
|
+
return Accuracy3;
|
|
712
|
+
})(Accuracy2 || {});
|
|
713
|
+
|
|
714
|
+
// src/AppsInTossModule/native-modules/tossCore.ts
|
|
715
|
+
var import_react_native13 = require("react-native");
|
|
716
|
+
var TossCoreModule = import_react_native13.NativeModules.TossCoreModule;
|
|
717
|
+
function tossCoreEventLog(params) {
|
|
718
|
+
const supported = isMinVersionSupported({ ios: "5.210.0", android: "5.210.0" });
|
|
719
|
+
const isSandbox = getOperationalEnvironment() === "sandbox";
|
|
720
|
+
if (!supported || isSandbox) {
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
TossCoreModule.eventLog({
|
|
724
|
+
params: {
|
|
725
|
+
log_name: params.log_name,
|
|
726
|
+
log_type: params.log_type,
|
|
727
|
+
params: params.params
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
// src/index.ts
|
|
733
|
+
var INTERNAL__module = {
|
|
734
|
+
tossCoreEventLog
|
|
735
|
+
};
|
|
736
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
737
|
+
0 && (module.exports = {
|
|
738
|
+
Accuracy,
|
|
739
|
+
AppsInTossModule,
|
|
740
|
+
BedrockCoreModule,
|
|
741
|
+
BedrockModule,
|
|
742
|
+
GoogleAdMob,
|
|
743
|
+
INTERNAL__AppsInTossModule,
|
|
744
|
+
INTERNAL__module,
|
|
745
|
+
Storage,
|
|
746
|
+
TossPay,
|
|
747
|
+
appLogin,
|
|
748
|
+
appsInTossEvent,
|
|
749
|
+
closeView,
|
|
750
|
+
eventLog,
|
|
751
|
+
fetchAlbumPhotos,
|
|
752
|
+
fetchContacts,
|
|
753
|
+
generateHapticFeedback,
|
|
754
|
+
getClipboardText,
|
|
755
|
+
getCurrentLocation,
|
|
756
|
+
getDeviceId,
|
|
757
|
+
getLocale,
|
|
758
|
+
getNetworkStatus,
|
|
759
|
+
getOperationalEnvironment,
|
|
760
|
+
getPlatformOS,
|
|
761
|
+
getSchemeUri,
|
|
762
|
+
getTossAppVersion,
|
|
763
|
+
getTossShareLink,
|
|
764
|
+
isMinVersionSupported,
|
|
765
|
+
openCamera,
|
|
766
|
+
openURL,
|
|
767
|
+
saveBase64Data,
|
|
768
|
+
setClipboardText,
|
|
769
|
+
setDeviceOrientation,
|
|
770
|
+
setIosSwipeGestureEnabled,
|
|
771
|
+
setScreenAwakeMode,
|
|
772
|
+
setSecureScreen,
|
|
773
|
+
share,
|
|
774
|
+
startUpdateLocation
|
|
775
|
+
});
|