@apps-in-toss/framework 0.0.0-dev.1747216176095 → 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/dist/bridge-meta.d.ts +1 -0
- package/dist/bridge-meta.js +158 -0
- package/dist/index.cjs +1120 -578
- package/dist/index.d.cts +7 -1708
- package/dist/index.d.ts +7 -1708
- package/dist/index.js +1100 -576
- package/dist/jest/index.cjs +2 -2
- package/dist/jest/index.d.cts +1 -1
- package/dist/jest/index.d.ts +1 -1
- package/dist/jest/index.js +1 -1
- package/package.json +21 -26
- package/src/bridge-entry.ts +4 -0
- package/src/async-bridges.ts +0 -10
- package/src/constant-bridges.ts +0 -3
- package/src/event-bridges.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -9,210 +9,30 @@ import { Analytics as InternalAnalytics } from "@apps-in-toss/analytics";
|
|
|
9
9
|
|
|
10
10
|
// src/core/registerApp.tsx
|
|
11
11
|
import { Analytics } from "@apps-in-toss/analytics";
|
|
12
|
+
import { Granite as Granite2 } from "@granite-js/react-native";
|
|
12
13
|
import { TDSProvider } from "@toss-design-system/react-native";
|
|
13
|
-
import { Bedrock as Bedrock2 } from "react-native-bedrock";
|
|
14
14
|
|
|
15
|
-
//
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
// src/native-modules/tossCore.ts
|
|
25
|
-
import { NativeModules as NativeModules2 } from "react-native";
|
|
26
|
-
|
|
27
|
-
// src/native-modules/AppsInTossModule.ts
|
|
28
|
-
import { NativeModules } from "react-native";
|
|
29
|
-
var AppsInTossModuleInstance = NativeModules.AppsInTossModule;
|
|
30
|
-
var AppsInTossModule = AppsInTossModuleInstance;
|
|
15
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/dist/index.js
|
|
16
|
+
import { GraniteEvent } from "@granite-js/react-native";
|
|
17
|
+
import { GraniteEventDefinition } from "@granite-js/react-native";
|
|
18
|
+
import { GraniteEventDefinition as GraniteEventDefinition2 } from "@granite-js/react-native";
|
|
19
|
+
import { TurboModuleRegistry } from "react-native";
|
|
20
|
+
import { NativeEventEmitter } from "react-native";
|
|
21
|
+
import { GraniteEventDefinition as GraniteEventDefinition3 } from "@granite-js/react-native";
|
|
31
22
|
|
|
32
|
-
//
|
|
33
|
-
function
|
|
34
|
-
return AppsInTossModule.operationalEnvironment;
|
|
23
|
+
// ../../.yarn/cache/es-toolkit-npm-1.39.3-b94f623c91-1c85e518b1.zip/node_modules/es-toolkit/dist/function/noop.mjs
|
|
24
|
+
function noop() {
|
|
35
25
|
}
|
|
36
26
|
|
|
37
|
-
//
|
|
27
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/dist/index.js
|
|
38
28
|
import { Platform } from "react-native";
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
47
|
-
var coerceTypes = (a, b) => {
|
|
48
|
-
return typeof a === typeof b ? [a, b] : [String(a), String(b)];
|
|
49
|
-
};
|
|
50
|
-
var compareValues = (a, b) => {
|
|
51
|
-
if (isWildcard(a) || isWildcard(b)) {
|
|
52
|
-
return 0;
|
|
53
|
-
}
|
|
54
|
-
const [aVal, bVal] = coerceTypes(tryParse(a), tryParse(b));
|
|
55
|
-
if (aVal > bVal) {
|
|
56
|
-
return 1;
|
|
57
|
-
}
|
|
58
|
-
if (aVal < bVal) {
|
|
59
|
-
return -1;
|
|
60
|
-
}
|
|
61
|
-
return 0;
|
|
62
|
-
};
|
|
63
|
-
var parseVersion = (version) => {
|
|
64
|
-
if (typeof version !== "string") {
|
|
65
|
-
throw new TypeError("Invalid argument: expected a string");
|
|
66
|
-
}
|
|
67
|
-
const match = version.match(SEMVER_REGEX);
|
|
68
|
-
if (!match) {
|
|
69
|
-
throw new Error(`Invalid semver: '${version}'`);
|
|
70
|
-
}
|
|
71
|
-
const [, major, minor, patch, build, preRelease] = match;
|
|
72
|
-
return [major, minor, patch, build, preRelease];
|
|
73
|
-
};
|
|
74
|
-
var compareSegments = (a, b) => {
|
|
75
|
-
const maxLength = Math.max(a.length, b.length);
|
|
76
|
-
for (let i = 0; i < maxLength; i++) {
|
|
77
|
-
const segA = a[i] ?? "0";
|
|
78
|
-
const segB = b[i] ?? "0";
|
|
79
|
-
const result = compareValues(segA, segB);
|
|
80
|
-
if (result !== 0) {
|
|
81
|
-
return result;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return 0;
|
|
85
|
-
};
|
|
86
|
-
var compareVersions = (v1, v2) => {
|
|
87
|
-
const seg1 = parseVersion(v1);
|
|
88
|
-
const seg2 = parseVersion(v2);
|
|
89
|
-
const preRelease1 = seg1.pop();
|
|
90
|
-
const preRelease2 = seg2.pop();
|
|
91
|
-
const mainCompare = compareSegments(seg1, seg2);
|
|
92
|
-
if (mainCompare !== 0) {
|
|
93
|
-
return mainCompare;
|
|
94
|
-
}
|
|
95
|
-
if (preRelease1 && preRelease2) {
|
|
96
|
-
return compareSegments(preRelease1.split("."), preRelease2.split("."));
|
|
97
|
-
}
|
|
98
|
-
if (preRelease1) {
|
|
99
|
-
return -1;
|
|
100
|
-
}
|
|
101
|
-
if (preRelease2) {
|
|
102
|
-
return 1;
|
|
103
|
-
}
|
|
104
|
-
return 0;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
// src/native-modules/isMinVersionSupported.ts
|
|
108
|
-
function isMinVersionSupported(minVersions) {
|
|
109
|
-
const operationalEnvironment2 = AppsInTossModule.operationalEnvironment;
|
|
110
|
-
if (operationalEnvironment2 === "sandbox") {
|
|
111
|
-
return true;
|
|
112
|
-
}
|
|
113
|
-
const currentVersion = AppsInTossModule.tossAppVersion;
|
|
114
|
-
const isIOS = Platform.OS === "ios";
|
|
115
|
-
const minVersion = isIOS ? minVersions.ios : minVersions.android;
|
|
116
|
-
if (minVersion === void 0) {
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
if (minVersion === "always") {
|
|
120
|
-
return true;
|
|
121
|
-
}
|
|
122
|
-
if (minVersion === "never") {
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
return compareVersions(currentVersion, minVersion) >= 0;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// src/native-modules/tossCore.ts
|
|
129
|
-
var TossCoreModule = NativeModules2.TossCoreModule;
|
|
130
|
-
function tossCoreEventLog(params) {
|
|
131
|
-
const supported = isMinVersionSupported({ ios: "5.210.0", android: "5.210.0" });
|
|
132
|
-
const isSandbox = getOperationalEnvironment() === "sandbox";
|
|
133
|
-
if (!supported || isSandbox) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
TossCoreModule.eventLog({
|
|
137
|
-
params: {
|
|
138
|
-
log_name: params.log_name,
|
|
139
|
-
log_type: params.log_type,
|
|
140
|
-
params: params.params
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// src/core/hooks/useReferrer.ts
|
|
146
|
-
import { useMemo } from "react";
|
|
147
|
-
import { getSchemeUri } from "react-native-bedrock";
|
|
148
|
-
function useReferrer() {
|
|
149
|
-
return useMemo(() => {
|
|
150
|
-
try {
|
|
151
|
-
return new URL(getSchemeUri()).searchParams.get("referrer");
|
|
152
|
-
} catch {
|
|
153
|
-
return null;
|
|
154
|
-
}
|
|
155
|
-
}, []);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// src/core/components/AppEvent.tsx
|
|
159
|
-
var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
|
|
160
|
-
function isPrivateScheme() {
|
|
161
|
-
try {
|
|
162
|
-
return new URL(getSchemeUri2()).protocol === "intoss-private:";
|
|
163
|
-
} catch {
|
|
164
|
-
return false;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
function EntryAppEvent() {
|
|
168
|
-
const referrer = useReferrer() ?? "";
|
|
169
|
-
useEffect(() => {
|
|
170
|
-
tossCoreEventLog({
|
|
171
|
-
log_name: "appsintoss_app_visit::impression__enter_appsintoss",
|
|
172
|
-
log_type: "info",
|
|
173
|
-
params: {
|
|
174
|
-
is_transform: true,
|
|
175
|
-
schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
|
|
176
|
-
referrer,
|
|
177
|
-
deployment_id: env.getDeploymentId(),
|
|
178
|
-
app_name: Bedrock.appName,
|
|
179
|
-
is_private: isPrivateScheme()
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
}, [referrer]);
|
|
183
|
-
return null;
|
|
184
|
-
}
|
|
185
|
-
function SystemAppEvent({ ...initialProps }) {
|
|
186
|
-
useEffect(() => {
|
|
187
|
-
tossCoreEventLog({
|
|
188
|
-
log_name: "AppsInTossInitialProps",
|
|
189
|
-
log_type: "debug",
|
|
190
|
-
params: {
|
|
191
|
-
...initialProps,
|
|
192
|
-
schemeUri: getSchemeUri2(),
|
|
193
|
-
deployment_id: env.getDeploymentId(),
|
|
194
|
-
app_name: Bedrock.appName,
|
|
195
|
-
is_private: isPrivateScheme()
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
}, [initialProps]);
|
|
199
|
-
return null;
|
|
200
|
-
}
|
|
201
|
-
var AppEvent = {
|
|
202
|
-
Entry: EntryAppEvent,
|
|
203
|
-
System: SystemAppEvent
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
// src/core/hooks/useAppsInTossBridge.ts
|
|
207
|
-
import { useBridge } from "@toss-design-system/react-native";
|
|
208
|
-
import { useEffect as useEffect2 } from "react";
|
|
209
|
-
|
|
210
|
-
// src/native-event-emitter/appsInTossEvent.ts
|
|
211
|
-
import { BedrockEvent } from "react-native-bedrock";
|
|
212
|
-
|
|
213
|
-
// src/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts
|
|
214
|
-
import { BedrockEventDefinition } from "react-native-bedrock";
|
|
215
|
-
var EntryMessageExitedEvent = class extends BedrockEventDefinition {
|
|
29
|
+
import { NativeModules } from "react-native";
|
|
30
|
+
import { Platform as Platform2 } from "react-native";
|
|
31
|
+
import { Linking } from "react-native";
|
|
32
|
+
import { Platform as Platform3 } from "react-native";
|
|
33
|
+
import { NativeModules as NativeModules2 } from "react-native";
|
|
34
|
+
import { NativeModules as NativeModules3 } from "react-native";
|
|
35
|
+
var EntryMessageExitedEvent = class extends GraniteEventDefinition {
|
|
216
36
|
name = "entryMessageExited";
|
|
217
37
|
remove() {
|
|
218
38
|
}
|
|
@@ -220,21 +40,15 @@ var EntryMessageExitedEvent = class extends BedrockEventDefinition {
|
|
|
220
40
|
listener(_) {
|
|
221
41
|
}
|
|
222
42
|
};
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
// src/native-modules/getPermission.ts
|
|
43
|
+
var Module = TurboModuleRegistry.getEnforcing("AppsInTossModule");
|
|
44
|
+
var AppsInTossModuleInstance = Module;
|
|
45
|
+
var AppsInTossModule = Module;
|
|
228
46
|
function getPermission(permission) {
|
|
229
47
|
return AppsInTossModule.getPermission(permission);
|
|
230
48
|
}
|
|
231
|
-
|
|
232
|
-
// src/native-modules/openPermissionDialog.ts
|
|
233
49
|
function openPermissionDialog(permission) {
|
|
234
50
|
return AppsInTossModule.openPermissionDialog(permission);
|
|
235
51
|
}
|
|
236
|
-
|
|
237
|
-
// src/native-modules/requestPermission.ts
|
|
238
52
|
async function requestPermission(permission) {
|
|
239
53
|
const permissionStatus = await getPermission(permission);
|
|
240
54
|
switch (permissionStatus) {
|
|
@@ -245,13 +59,8 @@ async function requestPermission(permission) {
|
|
|
245
59
|
return openPermissionDialog(permission);
|
|
246
60
|
}
|
|
247
61
|
}
|
|
248
|
-
|
|
249
|
-
// src/native-event-emitter/nativeEventEmitter.ts
|
|
250
|
-
import { NativeEventEmitter } from "react-native";
|
|
251
62
|
var nativeEventEmitter = new NativeEventEmitter(AppsInTossModuleInstance);
|
|
252
|
-
|
|
253
|
-
// src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
254
|
-
var UpdateLocationEvent = class extends BedrockEventDefinition2 {
|
|
63
|
+
var UpdateLocationEvent = class extends GraniteEventDefinition2 {
|
|
255
64
|
name = "updateLocationEvent";
|
|
256
65
|
subscriptionCount = 0;
|
|
257
66
|
ref = {
|
|
@@ -279,16 +88,9 @@ var UpdateLocationEvent = class extends BedrockEventDefinition2 {
|
|
|
279
88
|
}).catch(onError);
|
|
280
89
|
}
|
|
281
90
|
};
|
|
282
|
-
|
|
283
|
-
// src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
284
|
-
import { BedrockEventDefinition as BedrockEventDefinition3 } from "react-native-bedrock";
|
|
285
|
-
|
|
286
|
-
// src/utils/generateUUID.ts
|
|
287
91
|
function generateUUID(placeholder) {
|
|
288
92
|
return placeholder ? (placeholder ^ Math.random() * 16 >> placeholder / 4).toString(16) : (String(1e7) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, generateUUID);
|
|
289
93
|
}
|
|
290
|
-
|
|
291
|
-
// src/native-event-emitter/internal/appBridge.ts
|
|
292
94
|
var INTERNAL__callbacks = /* @__PURE__ */ new Map();
|
|
293
95
|
function invokeAppBridgeCallback(id, ...args) {
|
|
294
96
|
const callback = INTERNAL__callbacks.get(id);
|
|
@@ -335,10 +137,8 @@ var INTERNAL__appBridgeHandler = {
|
|
|
335
137
|
unregisterCallback,
|
|
336
138
|
getCallbackIds
|
|
337
139
|
};
|
|
338
|
-
|
|
339
|
-
// src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
340
140
|
var UNSAFE__nativeEventEmitter = nativeEventEmitter;
|
|
341
|
-
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends
|
|
141
|
+
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends GraniteEventDefinition3 {
|
|
342
142
|
static INTERNAL__appBridgeSubscription;
|
|
343
143
|
name = "appBridgeCallbackEvent";
|
|
344
144
|
constructor() {
|
|
@@ -366,103 +166,230 @@ var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends BedrockEventD
|
|
|
366
166
|
}
|
|
367
167
|
}
|
|
368
168
|
};
|
|
369
|
-
|
|
370
|
-
// src/native-event-emitter/appsInTossEvent.ts
|
|
371
|
-
var appsInTossEvent = new BedrockEvent([
|
|
169
|
+
var appsInTossEvent = new GraniteEvent([
|
|
372
170
|
new AppBridgeCallbackEvent(),
|
|
373
171
|
new UpdateLocationEvent(),
|
|
374
172
|
new EntryMessageExitedEvent()
|
|
375
173
|
]);
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
function getAppsInTossGlobals() {
|
|
379
|
-
if (global.__appsInToss == null) {
|
|
380
|
-
throw new Error("invalid apps-in-toss globals");
|
|
381
|
-
}
|
|
382
|
-
return global.__appsInToss;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
// src/core/utils/toIcon.ts
|
|
386
|
-
function toIcon(source) {
|
|
387
|
-
return source.startsWith("http") ? { source: { uri: source } } : { name: source };
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
// src/core/hooks/useAppsInTossBridge.ts
|
|
391
|
-
function useAppsInTossBridge() {
|
|
392
|
-
const controller = useBridge();
|
|
393
|
-
const appsInTossGlobals2 = getAppsInTossGlobals();
|
|
394
|
-
useEffect2(() => {
|
|
395
|
-
const commonProps = {
|
|
396
|
-
serviceName: appsInTossGlobals2.brandDisplayName,
|
|
397
|
-
icon: toIcon(appsInTossGlobals2.brandIcon),
|
|
398
|
-
color: appsInTossGlobals2.brandPrimaryColor,
|
|
399
|
-
colorMode: appsInTossGlobals2.brandBridgeColorMode
|
|
400
|
-
};
|
|
401
|
-
controller.open({
|
|
402
|
-
...commonProps,
|
|
403
|
-
onExited: () => {
|
|
404
|
-
appsInTossEvent.emit("entryMessageExited", void 0);
|
|
405
|
-
}
|
|
406
|
-
});
|
|
407
|
-
}, []);
|
|
174
|
+
function startUpdateLocation(eventParams) {
|
|
175
|
+
return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
|
|
408
176
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
var async_bridges_exports = {};
|
|
412
|
-
__export(async_bridges_exports, {
|
|
413
|
-
appLogin: () => appLogin,
|
|
414
|
-
checkoutPayment: () => checkoutPayment,
|
|
415
|
-
eventLog: () => eventLog,
|
|
416
|
-
fetchAlbumPhotos: () => fetchAlbumPhotos,
|
|
417
|
-
fetchContacts: () => fetchContacts,
|
|
418
|
-
getClipboardText: () => getClipboardText,
|
|
419
|
-
getCurrentLocation: () => getCurrentLocation,
|
|
420
|
-
getTossShareLink: () => getTossShareLink,
|
|
421
|
-
openCamera: () => openCamera,
|
|
422
|
-
setClipboardText: () => setClipboardText
|
|
423
|
-
});
|
|
424
|
-
|
|
425
|
-
// src/native-modules/setClipboardText.ts
|
|
426
|
-
async function setClipboardText(text) {
|
|
427
|
-
const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
|
|
428
|
-
if (permissionStatus === "denied") {
|
|
429
|
-
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
430
|
-
}
|
|
431
|
-
return AppsInTossModule.setClipboardText({ text });
|
|
177
|
+
function getOperationalEnvironment() {
|
|
178
|
+
return AppsInTossModule.operationalEnvironment;
|
|
432
179
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
const
|
|
437
|
-
|
|
438
|
-
|
|
180
|
+
var SEMVER_REGEX = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
|
|
181
|
+
var isWildcard = (val) => ["*", "x", "X"].includes(val);
|
|
182
|
+
var tryParse = (val) => {
|
|
183
|
+
const num = parseInt(val, 10);
|
|
184
|
+
return isNaN(num) ? val : num;
|
|
185
|
+
};
|
|
186
|
+
var coerceTypes = (a, b) => {
|
|
187
|
+
return typeof a === typeof b ? [a, b] : [String(a), String(b)];
|
|
188
|
+
};
|
|
189
|
+
var compareValues = (a, b) => {
|
|
190
|
+
if (isWildcard(a) || isWildcard(b)) {
|
|
191
|
+
return 0;
|
|
439
192
|
}
|
|
440
|
-
|
|
193
|
+
const [aVal, bVal] = coerceTypes(tryParse(a), tryParse(b));
|
|
194
|
+
if (aVal > bVal) {
|
|
195
|
+
return 1;
|
|
196
|
+
}
|
|
197
|
+
if (aVal < bVal) {
|
|
198
|
+
return -1;
|
|
199
|
+
}
|
|
200
|
+
return 0;
|
|
201
|
+
};
|
|
202
|
+
var parseVersion = (version) => {
|
|
203
|
+
if (typeof version !== "string") {
|
|
204
|
+
throw new TypeError("Invalid argument: expected a string");
|
|
205
|
+
}
|
|
206
|
+
const match = version.match(SEMVER_REGEX);
|
|
207
|
+
if (!match) {
|
|
208
|
+
throw new Error(`Invalid semver: '${version}'`);
|
|
209
|
+
}
|
|
210
|
+
const [, major, minor, patch, build, preRelease] = match;
|
|
211
|
+
return [major, minor, patch, build, preRelease];
|
|
212
|
+
};
|
|
213
|
+
var compareSegments = (a, b) => {
|
|
214
|
+
const maxLength = Math.max(a.length, b.length);
|
|
215
|
+
for (let i = 0; i < maxLength; i++) {
|
|
216
|
+
const segA = a[i] ?? "0";
|
|
217
|
+
const segB = b[i] ?? "0";
|
|
218
|
+
const result = compareValues(segA, segB);
|
|
219
|
+
if (result !== 0) {
|
|
220
|
+
return result;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return 0;
|
|
224
|
+
};
|
|
225
|
+
var compareVersions = (v1, v2) => {
|
|
226
|
+
const seg1 = parseVersion(v1);
|
|
227
|
+
const seg2 = parseVersion(v2);
|
|
228
|
+
const preRelease1 = seg1.pop();
|
|
229
|
+
const preRelease2 = seg2.pop();
|
|
230
|
+
const mainCompare = compareSegments(seg1, seg2);
|
|
231
|
+
if (mainCompare !== 0) {
|
|
232
|
+
return mainCompare;
|
|
233
|
+
}
|
|
234
|
+
if (preRelease1 && preRelease2) {
|
|
235
|
+
return compareSegments(preRelease1.split("."), preRelease2.split("."));
|
|
236
|
+
}
|
|
237
|
+
if (preRelease1) {
|
|
238
|
+
return -1;
|
|
239
|
+
}
|
|
240
|
+
if (preRelease2) {
|
|
241
|
+
return 1;
|
|
242
|
+
}
|
|
243
|
+
return 0;
|
|
244
|
+
};
|
|
245
|
+
function isMinVersionSupported(minVersions) {
|
|
246
|
+
const operationalEnvironment2 = AppsInTossModule.operationalEnvironment;
|
|
247
|
+
if (operationalEnvironment2 === "sandbox") {
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
250
|
+
const currentVersion = AppsInTossModule.tossAppVersion;
|
|
251
|
+
const isIOS = Platform.OS === "ios";
|
|
252
|
+
const minVersion = isIOS ? minVersions.ios : minVersions.android;
|
|
253
|
+
if (minVersion === void 0) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
if (minVersion === "always") {
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
259
|
+
if (minVersion === "never") {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
return compareVersions(currentVersion, minVersion) >= 0;
|
|
441
263
|
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
264
|
+
function loadAdMobInterstitialAd(params) {
|
|
265
|
+
if (!loadAdMobInterstitialAd.isSupported()) {
|
|
266
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
267
|
+
return noop;
|
|
268
|
+
}
|
|
269
|
+
const { onEvent, onError, options } = params;
|
|
270
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobInterstitialAd", options, {
|
|
271
|
+
onAdClicked: () => {
|
|
272
|
+
onEvent({ type: "clicked" });
|
|
273
|
+
},
|
|
274
|
+
onAdDismissed: () => {
|
|
275
|
+
onEvent({ type: "dismissed" });
|
|
276
|
+
},
|
|
277
|
+
onAdFailedToShow: () => {
|
|
278
|
+
onEvent({ type: "failedToShow" });
|
|
279
|
+
},
|
|
280
|
+
onAdImpression: () => {
|
|
281
|
+
onEvent({ type: "impression" });
|
|
282
|
+
},
|
|
283
|
+
onAdShow: () => {
|
|
284
|
+
onEvent({ type: "show" });
|
|
285
|
+
},
|
|
286
|
+
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
287
|
+
onError
|
|
288
|
+
});
|
|
289
|
+
return unregisterCallbacks;
|
|
290
|
+
}
|
|
291
|
+
function showAdMobInterstitialAd(params) {
|
|
292
|
+
if (!showAdMobInterstitialAd.isSupported()) {
|
|
293
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
294
|
+
return noop;
|
|
295
|
+
}
|
|
296
|
+
const { onEvent, onError, options } = params;
|
|
297
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobInterstitialAd", options, {
|
|
298
|
+
onSuccess: () => onEvent({ type: "requested" }),
|
|
299
|
+
onError
|
|
300
|
+
});
|
|
301
|
+
return unregisterCallbacks;
|
|
302
|
+
}
|
|
303
|
+
function loadAdMobRewardedAd(params) {
|
|
304
|
+
if (!loadAdMobRewardedAd.isSupported()) {
|
|
305
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
306
|
+
return noop;
|
|
307
|
+
}
|
|
308
|
+
const { onEvent, onError, options } = params;
|
|
309
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobRewardedAd", options, {
|
|
310
|
+
onAdClicked: () => {
|
|
311
|
+
onEvent({ type: "clicked" });
|
|
312
|
+
},
|
|
313
|
+
onAdDismissed: () => {
|
|
314
|
+
onEvent({ type: "dismissed" });
|
|
315
|
+
},
|
|
316
|
+
onAdFailedToShow: () => {
|
|
317
|
+
onEvent({ type: "failedToShow" });
|
|
318
|
+
},
|
|
319
|
+
onAdImpression: () => {
|
|
320
|
+
onEvent({ type: "impression" });
|
|
321
|
+
},
|
|
322
|
+
onAdShow: () => {
|
|
323
|
+
onEvent({ type: "show" });
|
|
324
|
+
},
|
|
325
|
+
onUserEarnedReward: () => {
|
|
326
|
+
onEvent({ type: "userEarnedReward" });
|
|
327
|
+
},
|
|
328
|
+
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
329
|
+
onError
|
|
330
|
+
});
|
|
331
|
+
return unregisterCallbacks;
|
|
332
|
+
}
|
|
333
|
+
function showAdMobRewardedAd(params) {
|
|
334
|
+
if (!showAdMobRewardedAd.isSupported()) {
|
|
335
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
336
|
+
return noop;
|
|
337
|
+
}
|
|
338
|
+
const { onEvent, onError, options } = params;
|
|
339
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobRewardedAd", options, {
|
|
340
|
+
onSuccess: () => onEvent({ type: "requested" }),
|
|
341
|
+
onError
|
|
342
|
+
});
|
|
343
|
+
return unregisterCallbacks;
|
|
344
|
+
}
|
|
345
|
+
var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
|
|
346
|
+
var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
|
|
347
|
+
var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
|
|
348
|
+
var ENVIRONMENT = getOperationalEnvironment();
|
|
349
|
+
function createIsSupported() {
|
|
350
|
+
return () => {
|
|
351
|
+
if (ENVIRONMENT !== "toss") {
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
return isMinVersionSupported({
|
|
355
|
+
android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION,
|
|
356
|
+
ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION
|
|
357
|
+
});
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
loadAdMobInterstitialAd.isSupported = createIsSupported();
|
|
361
|
+
loadAdMobRewardedAd.isSupported = createIsSupported();
|
|
362
|
+
showAdMobInterstitialAd.isSupported = createIsSupported();
|
|
363
|
+
showAdMobRewardedAd.isSupported = createIsSupported();
|
|
364
|
+
async function checkoutPayment(options) {
|
|
365
|
+
return AppsInTossModule.checkoutPayment({ params: options });
|
|
366
|
+
}
|
|
367
|
+
async function setClipboardText(text) {
|
|
368
|
+
const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
|
|
369
|
+
if (permissionStatus === "denied") {
|
|
370
|
+
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
371
|
+
}
|
|
372
|
+
return AppsInTossModule.setClipboardText({ text });
|
|
373
|
+
}
|
|
374
|
+
async function getClipboardText() {
|
|
375
|
+
const permissionStatus = await requestPermission({ name: "clipboard", access: "read" });
|
|
376
|
+
if (permissionStatus === "denied") {
|
|
377
|
+
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC77D\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
378
|
+
}
|
|
379
|
+
return AppsInTossModule.getClipboardText({});
|
|
380
|
+
}
|
|
381
|
+
async function fetchContacts(options) {
|
|
449
382
|
const permissionStatus = await requestPermission({ name: "contacts", access: "read" });
|
|
450
383
|
if (permissionStatus === "denied") {
|
|
451
384
|
throw new Error("\uC5F0\uB77D\uCC98 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
452
385
|
}
|
|
453
|
-
const contacts = await AppsInTossModule.fetchContacts(
|
|
454
|
-
size,
|
|
455
|
-
offset,
|
|
456
|
-
query
|
|
457
|
-
});
|
|
386
|
+
const contacts = await AppsInTossModule.fetchContacts(options);
|
|
458
387
|
return {
|
|
459
388
|
result: contacts.result,
|
|
460
389
|
nextOffset: contacts.nextOffset ?? null,
|
|
461
390
|
done: contacts.done
|
|
462
391
|
};
|
|
463
392
|
}
|
|
464
|
-
|
|
465
|
-
// src/native-modules/fetchAlbumPhotos.ts
|
|
466
393
|
var DEFAULT_MAX_COUNT = 10;
|
|
467
394
|
var DEFAULT_MAX_WIDTH = 1024;
|
|
468
395
|
async function fetchAlbumPhotos(options) {
|
|
@@ -475,75 +402,835 @@ async function fetchAlbumPhotos(options) {
|
|
|
475
402
|
maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
|
|
476
403
|
maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
|
|
477
404
|
});
|
|
478
|
-
return albumPhotos;
|
|
405
|
+
return albumPhotos;
|
|
406
|
+
}
|
|
407
|
+
async function getCurrentLocation(options) {
|
|
408
|
+
const permissionStatus = await requestPermission({ name: "geolocation", access: "access" });
|
|
409
|
+
if (permissionStatus === "denied") {
|
|
410
|
+
throw new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
411
|
+
}
|
|
412
|
+
const position = await AppsInTossModule.getCurrentLocation(options);
|
|
413
|
+
return position;
|
|
414
|
+
}
|
|
415
|
+
async function openCamera(options) {
|
|
416
|
+
const permissionStatus = await requestPermission({ name: "camera", access: "access" });
|
|
417
|
+
if (permissionStatus === "denied") {
|
|
418
|
+
throw new Error("\uCE74\uBA54\uB77C \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
419
|
+
}
|
|
420
|
+
const photo = await AppsInTossModule.openCamera({ base64: false, maxWidth: 1024, ...options });
|
|
421
|
+
return photo;
|
|
422
|
+
}
|
|
423
|
+
async function appLogin() {
|
|
424
|
+
return AppsInTossModule.appLogin({});
|
|
425
|
+
}
|
|
426
|
+
function getTossAppVersion() {
|
|
427
|
+
return AppsInTossModule.tossAppVersion;
|
|
428
|
+
}
|
|
429
|
+
function getDeviceId() {
|
|
430
|
+
return AppsInTossModule.deviceId;
|
|
431
|
+
}
|
|
432
|
+
function getItem(key) {
|
|
433
|
+
return AppsInTossModule.getStorageItem({ key });
|
|
434
|
+
}
|
|
435
|
+
function setItem(key, value) {
|
|
436
|
+
return AppsInTossModule.setStorageItem({
|
|
437
|
+
key,
|
|
438
|
+
value
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
function removeItem(key) {
|
|
442
|
+
return AppsInTossModule.removeStorageItem({ key });
|
|
443
|
+
}
|
|
444
|
+
function clearItems() {
|
|
445
|
+
return AppsInTossModule.clearStorage({});
|
|
446
|
+
}
|
|
447
|
+
var Storage = {
|
|
448
|
+
getItem,
|
|
449
|
+
setItem,
|
|
450
|
+
removeItem,
|
|
451
|
+
clearItems
|
|
452
|
+
};
|
|
453
|
+
function normalizeParams(params) {
|
|
454
|
+
return Object.fromEntries(
|
|
455
|
+
Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
async function eventLog(params) {
|
|
459
|
+
if (AppsInTossModule.operationalEnvironment === "sandbox") {
|
|
460
|
+
console.log("[eventLogDebug]", {
|
|
461
|
+
log_name: params.log_name,
|
|
462
|
+
log_type: params.log_type,
|
|
463
|
+
params: normalizeParams(params.params)
|
|
464
|
+
});
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
const isSupported = isMinVersionSupported({
|
|
468
|
+
android: "5.208.0",
|
|
469
|
+
ios: "5.208.0"
|
|
470
|
+
});
|
|
471
|
+
if (!isSupported) {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
return AppsInTossModule.eventLog({
|
|
475
|
+
log_name: params.log_name,
|
|
476
|
+
log_type: params.log_type,
|
|
477
|
+
params: normalizeParams(params.params)
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
async function getTossShareLink(path) {
|
|
481
|
+
const { shareLink } = await AppsInTossModule.getTossShareLink({});
|
|
482
|
+
const shareUrl = new URL(shareLink);
|
|
483
|
+
shareUrl.searchParams.set("deep_link_value", path);
|
|
484
|
+
shareUrl.searchParams.set("af_dp", path);
|
|
485
|
+
return shareUrl.toString();
|
|
486
|
+
}
|
|
487
|
+
async function setDeviceOrientation(options) {
|
|
488
|
+
const isSupported = isMinVersionSupported({
|
|
489
|
+
android: "5.215.0",
|
|
490
|
+
ios: "5.215.0"
|
|
491
|
+
});
|
|
492
|
+
if (!isSupported) {
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
return AppsInTossModule.setDeviceOrientation(options);
|
|
496
|
+
}
|
|
497
|
+
async function saveBase64Data(params) {
|
|
498
|
+
const isSupported = isMinVersionSupported({
|
|
499
|
+
android: "5.218.0",
|
|
500
|
+
ios: "5.216.0"
|
|
501
|
+
});
|
|
502
|
+
if (!isSupported) {
|
|
503
|
+
console.warn("saveBase64Data is not supported in this app version");
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
await AppsInTossModule.saveBase64Data(params);
|
|
507
|
+
}
|
|
508
|
+
var TossPay = {
|
|
509
|
+
checkoutPayment
|
|
510
|
+
};
|
|
511
|
+
var GoogleAdMob = {
|
|
512
|
+
loadAdMobInterstitialAd,
|
|
513
|
+
showAdMobInterstitialAd,
|
|
514
|
+
loadAdMobRewardedAd,
|
|
515
|
+
showAdMobRewardedAd
|
|
516
|
+
};
|
|
517
|
+
var BedrockModule = NativeModules.BedrockModule;
|
|
518
|
+
async function closeView() {
|
|
519
|
+
return BedrockModule.closeView();
|
|
520
|
+
}
|
|
521
|
+
function getLocale() {
|
|
522
|
+
const locale = BedrockModule?.DeviceInfo?.locale ?? "ko-KR";
|
|
523
|
+
if (Platform2.OS === "android") {
|
|
524
|
+
return replaceUnderbarToHypen(locale);
|
|
525
|
+
}
|
|
526
|
+
return locale;
|
|
527
|
+
}
|
|
528
|
+
function replaceUnderbarToHypen(locale) {
|
|
529
|
+
return locale.replace(/_/g, "-");
|
|
530
|
+
}
|
|
531
|
+
function getSchemeUri() {
|
|
532
|
+
return BedrockModule.schemeUri;
|
|
533
|
+
}
|
|
534
|
+
function generateHapticFeedback(options) {
|
|
535
|
+
return BedrockModule.generateHapticFeedback(options);
|
|
536
|
+
}
|
|
537
|
+
async function share(message) {
|
|
538
|
+
BedrockModule.share(message);
|
|
539
|
+
}
|
|
540
|
+
function setSecureScreen(options) {
|
|
541
|
+
return BedrockModule.setSecureScreen(options);
|
|
542
|
+
}
|
|
543
|
+
async function setScreenAwakeMode(options) {
|
|
544
|
+
return BedrockModule.setScreenAwakeMode(options);
|
|
545
|
+
}
|
|
546
|
+
function getNetworkStatus() {
|
|
547
|
+
return BedrockModule.getNetworkStatus();
|
|
548
|
+
}
|
|
549
|
+
async function setIosSwipeGestureEnabled(options) {
|
|
550
|
+
if (BedrockModule.setIosSwipeGestureEnabled == null) {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
return BedrockModule.setIosSwipeGestureEnabled(options);
|
|
554
|
+
}
|
|
555
|
+
function openURL(url) {
|
|
556
|
+
return Linking.openURL(url);
|
|
557
|
+
}
|
|
558
|
+
function getPlatformOS() {
|
|
559
|
+
return Platform3.OS;
|
|
560
|
+
}
|
|
561
|
+
var BedrockCoreModule = NativeModules2.BedrockCoreModule;
|
|
562
|
+
var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
563
|
+
Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
|
|
564
|
+
Accuracy3[Accuracy3["Low"] = 2] = "Low";
|
|
565
|
+
Accuracy3[Accuracy3["Balanced"] = 3] = "Balanced";
|
|
566
|
+
Accuracy3[Accuracy3["High"] = 4] = "High";
|
|
567
|
+
Accuracy3[Accuracy3["Highest"] = 5] = "Highest";
|
|
568
|
+
Accuracy3[Accuracy3["BestForNavigation"] = 6] = "BestForNavigation";
|
|
569
|
+
return Accuracy3;
|
|
570
|
+
})(Accuracy2 || {});
|
|
571
|
+
var TossCoreModule = NativeModules3.TossCoreModule;
|
|
572
|
+
function tossCoreEventLog(params) {
|
|
573
|
+
const supported = isMinVersionSupported({ ios: "5.210.0", android: "5.210.0" });
|
|
574
|
+
const isSandbox = getOperationalEnvironment() === "sandbox";
|
|
575
|
+
if (!supported || isSandbox) {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
TossCoreModule.eventLog({
|
|
579
|
+
params: {
|
|
580
|
+
log_name: params.log_name,
|
|
581
|
+
log_type: params.log_type,
|
|
582
|
+
params: params.params
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
var INTERNAL__module = {
|
|
587
|
+
tossCoreEventLog
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
// src/core/components/AppEvent.tsx
|
|
591
|
+
import { Granite, getSchemeUri as getSchemeUri3 } from "@granite-js/react-native";
|
|
592
|
+
import { useEffect } from "react";
|
|
593
|
+
|
|
594
|
+
// src/env.ts
|
|
595
|
+
var env = {
|
|
596
|
+
getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
|
|
597
|
+
};
|
|
598
|
+
|
|
599
|
+
// src/core/hooks/useReferrer.ts
|
|
600
|
+
import { getSchemeUri as getSchemeUri2 } from "@granite-js/react-native";
|
|
601
|
+
import { useMemo } from "react";
|
|
602
|
+
function useReferrer() {
|
|
603
|
+
return useMemo(() => {
|
|
604
|
+
try {
|
|
605
|
+
return new URL(getSchemeUri2()).searchParams.get("referrer");
|
|
606
|
+
} catch {
|
|
607
|
+
return null;
|
|
608
|
+
}
|
|
609
|
+
}, []);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
// src/core/components/AppEvent.tsx
|
|
613
|
+
var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
|
|
614
|
+
function isPrivateScheme() {
|
|
615
|
+
try {
|
|
616
|
+
return new URL(getSchemeUri3()).protocol === "intoss-private:";
|
|
617
|
+
} catch {
|
|
618
|
+
return false;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
function EntryAppEvent() {
|
|
622
|
+
const referrer = useReferrer() ?? "";
|
|
623
|
+
useEffect(() => {
|
|
624
|
+
INTERNAL__module.tossCoreEventLog({
|
|
625
|
+
log_name: "appsintoss_app_visit::impression__enter_appsintoss",
|
|
626
|
+
log_type: "info",
|
|
627
|
+
params: {
|
|
628
|
+
is_transform: true,
|
|
629
|
+
schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
|
|
630
|
+
referrer,
|
|
631
|
+
deployment_id: env.getDeploymentId(),
|
|
632
|
+
app_name: Granite.appName,
|
|
633
|
+
is_private: isPrivateScheme()
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
}, [referrer]);
|
|
637
|
+
return null;
|
|
638
|
+
}
|
|
639
|
+
function SystemAppEvent({ ...initialProps }) {
|
|
640
|
+
useEffect(() => {
|
|
641
|
+
INTERNAL__module.tossCoreEventLog({
|
|
642
|
+
log_name: "AppsInTossInitialProps",
|
|
643
|
+
log_type: "debug",
|
|
644
|
+
params: {
|
|
645
|
+
...initialProps,
|
|
646
|
+
schemeUri: getSchemeUri3(),
|
|
647
|
+
deployment_id: env.getDeploymentId(),
|
|
648
|
+
app_name: Granite.appName,
|
|
649
|
+
is_private: isPrivateScheme()
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
}, [initialProps]);
|
|
653
|
+
return null;
|
|
654
|
+
}
|
|
655
|
+
var AppEvent = {
|
|
656
|
+
Entry: EntryAppEvent,
|
|
657
|
+
System: SystemAppEvent
|
|
658
|
+
};
|
|
659
|
+
|
|
660
|
+
// src/core/hooks/useAppsInTossBridge.ts
|
|
661
|
+
import { useBridge } from "@toss-design-system/react-native";
|
|
662
|
+
import { useEffect as useEffect2 } from "react";
|
|
663
|
+
|
|
664
|
+
// src/core/utils/getAppsInTossGlobals.ts
|
|
665
|
+
function getAppsInTossGlobals() {
|
|
666
|
+
if (global.__appsInToss == null) {
|
|
667
|
+
throw new Error("invalid apps-in-toss globals");
|
|
668
|
+
}
|
|
669
|
+
return global.__appsInToss;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// src/core/utils/toIcon.ts
|
|
673
|
+
function toIcon(source) {
|
|
674
|
+
return source.startsWith("http") ? { source: { uri: source } } : { name: source };
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// src/core/hooks/useAppsInTossBridge.ts
|
|
678
|
+
function useAppsInTossBridge() {
|
|
679
|
+
const controller = useBridge();
|
|
680
|
+
const appsInTossGlobals2 = getAppsInTossGlobals();
|
|
681
|
+
useEffect2(() => {
|
|
682
|
+
const commonProps = {
|
|
683
|
+
serviceName: appsInTossGlobals2.brandDisplayName,
|
|
684
|
+
icon: toIcon(appsInTossGlobals2.brandIcon),
|
|
685
|
+
color: appsInTossGlobals2.brandPrimaryColor,
|
|
686
|
+
colorMode: appsInTossGlobals2.brandBridgeColorMode
|
|
687
|
+
};
|
|
688
|
+
controller.open({
|
|
689
|
+
...commonProps,
|
|
690
|
+
onExited: () => {
|
|
691
|
+
appsInTossEvent.emit("entryMessageExited", void 0);
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
}, []);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/async-bridges.ts
|
|
698
|
+
var async_bridges_exports = {};
|
|
699
|
+
__export(async_bridges_exports, {
|
|
700
|
+
appLogin: () => appLogin2,
|
|
701
|
+
checkoutPayment: () => checkoutPayment2,
|
|
702
|
+
closeView: () => closeView2,
|
|
703
|
+
eventLog: () => eventLog2,
|
|
704
|
+
fetchAlbumPhotos: () => fetchAlbumPhotos2,
|
|
705
|
+
fetchContacts: () => fetchContacts2,
|
|
706
|
+
generateHapticFeedback: () => generateHapticFeedback2,
|
|
707
|
+
getClipboardText: () => getClipboardText2,
|
|
708
|
+
getCurrentLocation: () => getCurrentLocation2,
|
|
709
|
+
getNetworkStatus: () => getNetworkStatus2,
|
|
710
|
+
getTossShareLink: () => getTossShareLink2,
|
|
711
|
+
openCamera: () => openCamera2,
|
|
712
|
+
openURL: () => openURL2,
|
|
713
|
+
saveBase64Data: () => saveBase64Data2,
|
|
714
|
+
setClipboardText: () => setClipboardText2,
|
|
715
|
+
setDeviceOrientation: () => setDeviceOrientation2,
|
|
716
|
+
setIosSwipeGestureEnabled: () => setIosSwipeGestureEnabled2,
|
|
717
|
+
setScreenAwakeMode: () => setScreenAwakeMode2,
|
|
718
|
+
setSecureScreen: () => setSecureScreen2,
|
|
719
|
+
share: () => share2
|
|
720
|
+
});
|
|
721
|
+
|
|
722
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/BedrockModule.ts
|
|
723
|
+
import { NativeModules as NativeModules4 } from "react-native";
|
|
724
|
+
var BedrockModule2 = NativeModules4.BedrockModule;
|
|
725
|
+
|
|
726
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/closeView.ts
|
|
727
|
+
async function closeView2() {
|
|
728
|
+
return BedrockModule2.closeView();
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/generateHapticFeedback/index.ts
|
|
732
|
+
function generateHapticFeedback2(options) {
|
|
733
|
+
return BedrockModule2.generateHapticFeedback(options);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/share.ts
|
|
737
|
+
async function share2(message) {
|
|
738
|
+
BedrockModule2.share(message);
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/setSecureScreen.ts
|
|
742
|
+
function setSecureScreen2(options) {
|
|
743
|
+
return BedrockModule2.setSecureScreen(options);
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/setScreenAwakeMode.ts
|
|
747
|
+
async function setScreenAwakeMode2(options) {
|
|
748
|
+
return BedrockModule2.setScreenAwakeMode(options);
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/getNetworkStatus/index.ts
|
|
752
|
+
function getNetworkStatus2() {
|
|
753
|
+
return BedrockModule2.getNetworkStatus();
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/setIosSwipeGestureEnabled.ts
|
|
757
|
+
async function setIosSwipeGestureEnabled2(options) {
|
|
758
|
+
if (BedrockModule2.setIosSwipeGestureEnabled == null) {
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
return BedrockModule2.setIosSwipeGestureEnabled(options);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/openURL.ts
|
|
765
|
+
import { Linking as Linking2 } from "react-native";
|
|
766
|
+
function openURL2(url) {
|
|
767
|
+
return Linking2.openURL(url);
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/AppsInTossModule.ts
|
|
771
|
+
import { TurboModuleRegistry as TurboModuleRegistry2 } from "react-native";
|
|
772
|
+
var Module2 = TurboModuleRegistry2.getEnforcing("AppsInTossModule");
|
|
773
|
+
var AppsInTossModuleInstance2 = Module2;
|
|
774
|
+
var AppsInTossModule2 = Module2;
|
|
775
|
+
|
|
776
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getPermission.ts
|
|
777
|
+
function getPermission2(permission) {
|
|
778
|
+
return AppsInTossModule2.getPermission(permission);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/openPermissionDialog.ts
|
|
782
|
+
function openPermissionDialog2(permission) {
|
|
783
|
+
return AppsInTossModule2.openPermissionDialog(permission);
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/requestPermission.ts
|
|
787
|
+
async function requestPermission2(permission) {
|
|
788
|
+
const permissionStatus = await getPermission2(permission);
|
|
789
|
+
switch (permissionStatus) {
|
|
790
|
+
case "allowed":
|
|
791
|
+
case "denied":
|
|
792
|
+
return permissionStatus;
|
|
793
|
+
default:
|
|
794
|
+
return openPermissionDialog2(permission);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/setClipboardText.ts
|
|
799
|
+
async function setClipboardText2(text) {
|
|
800
|
+
const permissionStatus = await requestPermission2({ name: "clipboard", access: "write" });
|
|
801
|
+
if (permissionStatus === "denied") {
|
|
802
|
+
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
803
|
+
}
|
|
804
|
+
return AppsInTossModule2.setClipboardText({ text });
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getClipboardText.ts
|
|
808
|
+
async function getClipboardText2() {
|
|
809
|
+
const permissionStatus = await requestPermission2({ name: "clipboard", access: "read" });
|
|
810
|
+
if (permissionStatus === "denied") {
|
|
811
|
+
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC77D\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
812
|
+
}
|
|
813
|
+
return AppsInTossModule2.getClipboardText({});
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/fetchContacts.ts
|
|
817
|
+
async function fetchContacts2(options) {
|
|
818
|
+
const permissionStatus = await requestPermission2({ name: "contacts", access: "read" });
|
|
819
|
+
if (permissionStatus === "denied") {
|
|
820
|
+
throw new Error("\uC5F0\uB77D\uCC98 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
821
|
+
}
|
|
822
|
+
const contacts = await AppsInTossModule2.fetchContacts(options);
|
|
823
|
+
return {
|
|
824
|
+
result: contacts.result,
|
|
825
|
+
nextOffset: contacts.nextOffset ?? null,
|
|
826
|
+
done: contacts.done
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/fetchAlbumPhotos.ts
|
|
831
|
+
var DEFAULT_MAX_COUNT2 = 10;
|
|
832
|
+
var DEFAULT_MAX_WIDTH2 = 1024;
|
|
833
|
+
async function fetchAlbumPhotos2(options) {
|
|
834
|
+
const permissionStatus = await requestPermission2({ name: "photos", access: "read" });
|
|
835
|
+
if (permissionStatus === "denied") {
|
|
836
|
+
throw new Error("\uC0AC\uC9C4\uCCA9 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
837
|
+
}
|
|
838
|
+
const albumPhotos = await AppsInTossModule2.fetchAlbumPhotos({
|
|
839
|
+
...options,
|
|
840
|
+
maxCount: options.maxCount ?? DEFAULT_MAX_COUNT2,
|
|
841
|
+
maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH2
|
|
842
|
+
});
|
|
843
|
+
return albumPhotos;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getCurrentLocation.ts
|
|
847
|
+
async function getCurrentLocation2(options) {
|
|
848
|
+
const permissionStatus = await requestPermission2({ name: "geolocation", access: "access" });
|
|
849
|
+
if (permissionStatus === "denied") {
|
|
850
|
+
throw new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
851
|
+
}
|
|
852
|
+
const position = await AppsInTossModule2.getCurrentLocation(options);
|
|
853
|
+
return position;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/openCamera.ts
|
|
857
|
+
async function openCamera2(options) {
|
|
858
|
+
const permissionStatus = await requestPermission2({ name: "camera", access: "access" });
|
|
859
|
+
if (permissionStatus === "denied") {
|
|
860
|
+
throw new Error("\uCE74\uBA54\uB77C \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
861
|
+
}
|
|
862
|
+
const photo = await AppsInTossModule2.openCamera({ base64: false, maxWidth: 1024, ...options });
|
|
863
|
+
return photo;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/appLogin.ts
|
|
867
|
+
async function appLogin2() {
|
|
868
|
+
return AppsInTossModule2.appLogin({});
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/isMinVersionSupported.ts
|
|
872
|
+
import { Platform as Platform4 } from "react-native";
|
|
873
|
+
|
|
874
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/utils/compareVersion.ts
|
|
875
|
+
var SEMVER_REGEX2 = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
|
|
876
|
+
var isWildcard2 = (val) => ["*", "x", "X"].includes(val);
|
|
877
|
+
var tryParse2 = (val) => {
|
|
878
|
+
const num = parseInt(val, 10);
|
|
879
|
+
return isNaN(num) ? val : num;
|
|
880
|
+
};
|
|
881
|
+
var coerceTypes2 = (a, b) => {
|
|
882
|
+
return typeof a === typeof b ? [a, b] : [String(a), String(b)];
|
|
883
|
+
};
|
|
884
|
+
var compareValues2 = (a, b) => {
|
|
885
|
+
if (isWildcard2(a) || isWildcard2(b)) {
|
|
886
|
+
return 0;
|
|
887
|
+
}
|
|
888
|
+
const [aVal, bVal] = coerceTypes2(tryParse2(a), tryParse2(b));
|
|
889
|
+
if (aVal > bVal) {
|
|
890
|
+
return 1;
|
|
891
|
+
}
|
|
892
|
+
if (aVal < bVal) {
|
|
893
|
+
return -1;
|
|
894
|
+
}
|
|
895
|
+
return 0;
|
|
896
|
+
};
|
|
897
|
+
var parseVersion2 = (version) => {
|
|
898
|
+
if (typeof version !== "string") {
|
|
899
|
+
throw new TypeError("Invalid argument: expected a string");
|
|
900
|
+
}
|
|
901
|
+
const match = version.match(SEMVER_REGEX2);
|
|
902
|
+
if (!match) {
|
|
903
|
+
throw new Error(`Invalid semver: '${version}'`);
|
|
904
|
+
}
|
|
905
|
+
const [, major, minor, patch, build, preRelease] = match;
|
|
906
|
+
return [major, minor, patch, build, preRelease];
|
|
907
|
+
};
|
|
908
|
+
var compareSegments2 = (a, b) => {
|
|
909
|
+
const maxLength = Math.max(a.length, b.length);
|
|
910
|
+
for (let i = 0; i < maxLength; i++) {
|
|
911
|
+
const segA = a[i] ?? "0";
|
|
912
|
+
const segB = b[i] ?? "0";
|
|
913
|
+
const result = compareValues2(segA, segB);
|
|
914
|
+
if (result !== 0) {
|
|
915
|
+
return result;
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
return 0;
|
|
919
|
+
};
|
|
920
|
+
var compareVersions2 = (v1, v2) => {
|
|
921
|
+
const seg1 = parseVersion2(v1);
|
|
922
|
+
const seg2 = parseVersion2(v2);
|
|
923
|
+
const preRelease1 = seg1.pop();
|
|
924
|
+
const preRelease2 = seg2.pop();
|
|
925
|
+
const mainCompare = compareSegments2(seg1, seg2);
|
|
926
|
+
if (mainCompare !== 0) {
|
|
927
|
+
return mainCompare;
|
|
928
|
+
}
|
|
929
|
+
if (preRelease1 && preRelease2) {
|
|
930
|
+
return compareSegments2(preRelease1.split("."), preRelease2.split("."));
|
|
931
|
+
}
|
|
932
|
+
if (preRelease1) {
|
|
933
|
+
return -1;
|
|
934
|
+
}
|
|
935
|
+
if (preRelease2) {
|
|
936
|
+
return 1;
|
|
937
|
+
}
|
|
938
|
+
return 0;
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/isMinVersionSupported.ts
|
|
942
|
+
function isMinVersionSupported2(minVersions) {
|
|
943
|
+
const operationalEnvironment2 = AppsInTossModule2.operationalEnvironment;
|
|
944
|
+
if (operationalEnvironment2 === "sandbox") {
|
|
945
|
+
return true;
|
|
946
|
+
}
|
|
947
|
+
const currentVersion = AppsInTossModule2.tossAppVersion;
|
|
948
|
+
const isIOS = Platform4.OS === "ios";
|
|
949
|
+
const minVersion = isIOS ? minVersions.ios : minVersions.android;
|
|
950
|
+
if (minVersion === void 0) {
|
|
951
|
+
return false;
|
|
952
|
+
}
|
|
953
|
+
if (minVersion === "always") {
|
|
954
|
+
return true;
|
|
955
|
+
}
|
|
956
|
+
if (minVersion === "never") {
|
|
957
|
+
return false;
|
|
958
|
+
}
|
|
959
|
+
return compareVersions2(currentVersion, minVersion) >= 0;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/eventLog.ts
|
|
963
|
+
function normalizeParams2(params) {
|
|
964
|
+
return Object.fromEntries(
|
|
965
|
+
Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
|
|
966
|
+
);
|
|
967
|
+
}
|
|
968
|
+
async function eventLog2(params) {
|
|
969
|
+
if (AppsInTossModule2.operationalEnvironment === "sandbox") {
|
|
970
|
+
console.log("[eventLogDebug]", {
|
|
971
|
+
log_name: params.log_name,
|
|
972
|
+
log_type: params.log_type,
|
|
973
|
+
params: normalizeParams2(params.params)
|
|
974
|
+
});
|
|
975
|
+
return;
|
|
976
|
+
}
|
|
977
|
+
const isSupported = isMinVersionSupported2({
|
|
978
|
+
android: "5.208.0",
|
|
979
|
+
ios: "5.208.0"
|
|
980
|
+
});
|
|
981
|
+
if (!isSupported) {
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
return AppsInTossModule2.eventLog({
|
|
985
|
+
log_name: params.log_name,
|
|
986
|
+
log_type: params.log_type,
|
|
987
|
+
params: normalizeParams2(params.params)
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getTossShareLink.ts
|
|
992
|
+
async function getTossShareLink2(path) {
|
|
993
|
+
const { shareLink } = await AppsInTossModule2.getTossShareLink({});
|
|
994
|
+
const shareUrl = new URL(shareLink);
|
|
995
|
+
shareUrl.searchParams.set("deep_link_value", path);
|
|
996
|
+
shareUrl.searchParams.set("af_dp", path);
|
|
997
|
+
return shareUrl.toString();
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/setDeviceOrientation.ts
|
|
1001
|
+
async function setDeviceOrientation2(options) {
|
|
1002
|
+
const isSupported = isMinVersionSupported2({
|
|
1003
|
+
android: "5.215.0",
|
|
1004
|
+
ios: "5.215.0"
|
|
1005
|
+
});
|
|
1006
|
+
if (!isSupported) {
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
return AppsInTossModule2.setDeviceOrientation(options);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/checkoutPayment.ts
|
|
1013
|
+
async function checkoutPayment2(options) {
|
|
1014
|
+
return AppsInTossModule2.checkoutPayment({ params: options });
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/saveBase64Data.ts
|
|
1018
|
+
async function saveBase64Data2(params) {
|
|
1019
|
+
const isSupported = isMinVersionSupported2({
|
|
1020
|
+
android: "5.218.0",
|
|
1021
|
+
ios: "5.216.0"
|
|
1022
|
+
});
|
|
1023
|
+
if (!isSupported) {
|
|
1024
|
+
console.warn("saveBase64Data is not supported in this app version");
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
await AppsInTossModule2.saveBase64Data(params);
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/constant-bridges.ts
|
|
1031
|
+
var constant_bridges_exports = {};
|
|
1032
|
+
__export(constant_bridges_exports, {
|
|
1033
|
+
getDeviceId: () => getDeviceId2,
|
|
1034
|
+
getLocale: () => getLocale2,
|
|
1035
|
+
getOperationalEnvironment: () => getOperationalEnvironment2,
|
|
1036
|
+
getPlatformOS: () => getPlatformOS2,
|
|
1037
|
+
getSchemeUri: () => getSchemeUri4,
|
|
1038
|
+
getTossAppVersion: () => getTossAppVersion2
|
|
1039
|
+
});
|
|
1040
|
+
|
|
1041
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/getLocale.ts
|
|
1042
|
+
import { Platform as Platform5 } from "react-native";
|
|
1043
|
+
function getLocale2() {
|
|
1044
|
+
const locale = BedrockModule2?.DeviceInfo?.locale ?? "ko-KR";
|
|
1045
|
+
if (Platform5.OS === "android") {
|
|
1046
|
+
return replaceUnderbarToHypen2(locale);
|
|
1047
|
+
}
|
|
1048
|
+
return locale;
|
|
1049
|
+
}
|
|
1050
|
+
function replaceUnderbarToHypen2(locale) {
|
|
1051
|
+
return locale.replace(/_/g, "-");
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/getSchemeUri.ts
|
|
1055
|
+
function getSchemeUri4() {
|
|
1056
|
+
return BedrockModule2.schemeUri;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/getPlatformOS.ts
|
|
1060
|
+
import { Platform as Platform6 } from "react-native";
|
|
1061
|
+
function getPlatformOS2() {
|
|
1062
|
+
return Platform6.OS;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getOperationalEnvironment.ts
|
|
1066
|
+
function getOperationalEnvironment2() {
|
|
1067
|
+
return AppsInTossModule2.operationalEnvironment;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getTossAppVersion.ts
|
|
1071
|
+
function getTossAppVersion2() {
|
|
1072
|
+
return AppsInTossModule2.tossAppVersion;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getDeviceId.ts
|
|
1076
|
+
function getDeviceId2() {
|
|
1077
|
+
return AppsInTossModule2.deviceId;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/event-bridges.ts
|
|
1081
|
+
var event_bridges_exports = {};
|
|
1082
|
+
__export(event_bridges_exports, {
|
|
1083
|
+
startUpdateLocation: () => startUpdateLocation2
|
|
1084
|
+
});
|
|
1085
|
+
|
|
1086
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
|
|
1087
|
+
import { GraniteEvent as GraniteEvent2 } from "@granite-js/react-native";
|
|
1088
|
+
|
|
1089
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts
|
|
1090
|
+
import { GraniteEventDefinition as GraniteEventDefinition4 } from "@granite-js/react-native";
|
|
1091
|
+
var EntryMessageExitedEvent2 = class extends GraniteEventDefinition4 {
|
|
1092
|
+
name = "entryMessageExited";
|
|
1093
|
+
remove() {
|
|
1094
|
+
}
|
|
1095
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1096
|
+
listener(_) {
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
|
|
1100
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
1101
|
+
import { GraniteEventDefinition as GraniteEventDefinition5 } from "@granite-js/react-native";
|
|
1102
|
+
|
|
1103
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/nativeEventEmitter.ts
|
|
1104
|
+
import { NativeEventEmitter as NativeEventEmitter2 } from "react-native";
|
|
1105
|
+
var nativeEventEmitter2 = new NativeEventEmitter2(AppsInTossModuleInstance2);
|
|
1106
|
+
|
|
1107
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
1108
|
+
var UpdateLocationEvent2 = class extends GraniteEventDefinition5 {
|
|
1109
|
+
name = "updateLocationEvent";
|
|
1110
|
+
subscriptionCount = 0;
|
|
1111
|
+
ref = {
|
|
1112
|
+
remove: () => {
|
|
1113
|
+
}
|
|
1114
|
+
};
|
|
1115
|
+
remove() {
|
|
1116
|
+
if (--this.subscriptionCount === 0) {
|
|
1117
|
+
AppsInTossModuleInstance2.stopUpdateLocation({});
|
|
1118
|
+
}
|
|
1119
|
+
this.ref.remove();
|
|
1120
|
+
}
|
|
1121
|
+
listener(options, onEvent, onError) {
|
|
1122
|
+
requestPermission2({ name: "geolocation", access: "access" }).then((permissionStatus) => {
|
|
1123
|
+
if (permissionStatus === "denied") {
|
|
1124
|
+
onError(new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."));
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
void AppsInTossModuleInstance2.startUpdateLocation(options).catch(onError);
|
|
1128
|
+
const subscription = nativeEventEmitter2.addListener("updateLocation", onEvent);
|
|
1129
|
+
this.ref = {
|
|
1130
|
+
remove: () => subscription?.remove()
|
|
1131
|
+
};
|
|
1132
|
+
this.subscriptionCount++;
|
|
1133
|
+
}).catch(onError);
|
|
1134
|
+
}
|
|
1135
|
+
};
|
|
1136
|
+
|
|
1137
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
1138
|
+
import { GraniteEventDefinition as GraniteEventDefinition6 } from "@granite-js/react-native";
|
|
1139
|
+
|
|
1140
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/utils/generateUUID.ts
|
|
1141
|
+
function generateUUID2(placeholder) {
|
|
1142
|
+
return placeholder ? (placeholder ^ Math.random() * 16 >> placeholder / 4).toString(16) : (String(1e7) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, generateUUID2);
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/internal/appBridge.ts
|
|
1146
|
+
var INTERNAL__callbacks2 = /* @__PURE__ */ new Map();
|
|
1147
|
+
function invokeAppBridgeCallback2(id, ...args) {
|
|
1148
|
+
const callback = INTERNAL__callbacks2.get(id);
|
|
1149
|
+
callback?.call(null, ...args);
|
|
1150
|
+
return Boolean(callback);
|
|
1151
|
+
}
|
|
1152
|
+
function invokeAppBridgeMethod2(methodName, params, callbacks) {
|
|
1153
|
+
const { onSuccess, onError, ...appBridgeCallbacks } = callbacks;
|
|
1154
|
+
const { callbackMap, unregisterAll } = registerCallbacks2(appBridgeCallbacks);
|
|
1155
|
+
const promise = AppsInTossModuleInstance2[methodName]({
|
|
1156
|
+
params,
|
|
1157
|
+
callbacks: callbackMap
|
|
1158
|
+
});
|
|
1159
|
+
void promise.then(onSuccess).catch(onError);
|
|
1160
|
+
return unregisterAll;
|
|
479
1161
|
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
throw new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
1162
|
+
function registerCallbacks2(callbacks) {
|
|
1163
|
+
const callbackMap = {};
|
|
1164
|
+
for (const [callbackName, callback] of Object.entries(callbacks)) {
|
|
1165
|
+
const id = registerCallback2(callback, callbackName);
|
|
1166
|
+
callbackMap[callbackName] = id;
|
|
486
1167
|
}
|
|
487
|
-
const
|
|
488
|
-
|
|
1168
|
+
const unregisterAll = () => {
|
|
1169
|
+
Object.values(callbackMap).forEach(unregisterCallback2);
|
|
1170
|
+
};
|
|
1171
|
+
return { callbackMap, unregisterAll };
|
|
489
1172
|
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
throw new Error("\uCE74\uBA54\uB77C \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
496
|
-
}
|
|
497
|
-
const photo = await AppsInTossModule.openCamera({ base64: false, maxWidth: 1024, ...options });
|
|
498
|
-
return photo;
|
|
1173
|
+
function registerCallback2(callback, name = "unnamed") {
|
|
1174
|
+
const uniqueId = generateUUID2();
|
|
1175
|
+
const callbackId = `${uniqueId}__${name}`;
|
|
1176
|
+
INTERNAL__callbacks2.set(callbackId, callback);
|
|
1177
|
+
return callbackId;
|
|
499
1178
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
async function appLogin() {
|
|
503
|
-
return AppsInTossModule.appLogin({});
|
|
1179
|
+
function unregisterCallback2(id) {
|
|
1180
|
+
INTERNAL__callbacks2.delete(id);
|
|
504
1181
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
async function checkoutPayment(options) {
|
|
508
|
-
return AppsInTossModule.checkoutPayment({ params: options });
|
|
1182
|
+
function getCallbackIds2() {
|
|
1183
|
+
return Array.from(INTERNAL__callbacks2.keys());
|
|
509
1184
|
}
|
|
1185
|
+
var INTERNAL__appBridgeHandler2 = {
|
|
1186
|
+
invokeAppBridgeCallback: invokeAppBridgeCallback2,
|
|
1187
|
+
invokeAppBridgeMethod: invokeAppBridgeMethod2,
|
|
1188
|
+
registerCallback: registerCallback2,
|
|
1189
|
+
unregisterCallback: unregisterCallback2,
|
|
1190
|
+
getCallbackIds: getCallbackIds2
|
|
1191
|
+
};
|
|
510
1192
|
|
|
511
|
-
//
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
console.log("[eventLogDebug]", {
|
|
520
|
-
log_name: params.log_name,
|
|
521
|
-
log_type: params.log_type,
|
|
522
|
-
params: normalizeParams(params.params)
|
|
523
|
-
});
|
|
524
|
-
return;
|
|
1193
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
1194
|
+
var UNSAFE__nativeEventEmitter2 = nativeEventEmitter2;
|
|
1195
|
+
var AppBridgeCallbackEvent2 = class _AppBridgeCallbackEvent2 extends GraniteEventDefinition6 {
|
|
1196
|
+
static INTERNAL__appBridgeSubscription;
|
|
1197
|
+
name = "appBridgeCallbackEvent";
|
|
1198
|
+
constructor() {
|
|
1199
|
+
super();
|
|
1200
|
+
this.registerAppBridgeCallbackEventListener();
|
|
525
1201
|
}
|
|
526
|
-
|
|
527
|
-
android: "5.208.0",
|
|
528
|
-
ios: "5.208.0"
|
|
529
|
-
});
|
|
530
|
-
if (!isSupported) {
|
|
531
|
-
return;
|
|
1202
|
+
remove() {
|
|
532
1203
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
}
|
|
1204
|
+
listener() {
|
|
1205
|
+
}
|
|
1206
|
+
registerAppBridgeCallbackEventListener() {
|
|
1207
|
+
if (_AppBridgeCallbackEvent2.INTERNAL__appBridgeSubscription != null) {
|
|
1208
|
+
return;
|
|
1209
|
+
}
|
|
1210
|
+
_AppBridgeCallbackEvent2.INTERNAL__appBridgeSubscription = UNSAFE__nativeEventEmitter2.addListener(
|
|
1211
|
+
"appBridgeCallback",
|
|
1212
|
+
this.ensureInvokeAppBridgeCallback
|
|
1213
|
+
);
|
|
1214
|
+
}
|
|
1215
|
+
ensureInvokeAppBridgeCallback(result) {
|
|
1216
|
+
if (typeof result === "object" && typeof result.name === "string") {
|
|
1217
|
+
INTERNAL__appBridgeHandler2.invokeAppBridgeCallback(result.name, result.params);
|
|
1218
|
+
} else {
|
|
1219
|
+
console.warn("Invalid app bridge callback result:", result);
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
};
|
|
539
1223
|
|
|
540
|
-
//
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
1224
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
|
|
1225
|
+
var appsInTossEvent2 = new GraniteEvent2([
|
|
1226
|
+
new AppBridgeCallbackEvent2(),
|
|
1227
|
+
new UpdateLocationEvent2(),
|
|
1228
|
+
new EntryMessageExitedEvent2()
|
|
1229
|
+
]);
|
|
1230
|
+
|
|
1231
|
+
// ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/startUpdateLocation.ts
|
|
1232
|
+
function startUpdateLocation2(eventParams) {
|
|
1233
|
+
return appsInTossEvent2.addEventListener("updateLocationEvent", eventParams);
|
|
547
1234
|
}
|
|
548
1235
|
|
|
549
1236
|
// src/core/registerApp.tsx
|
|
@@ -561,10 +1248,10 @@ function TDSContainer({ children }) {
|
|
|
561
1248
|
}
|
|
562
1249
|
function registerApp(container, { context, analytics }) {
|
|
563
1250
|
Analytics.init({
|
|
564
|
-
logger: (params) => void
|
|
1251
|
+
logger: (params) => void eventLog2(params),
|
|
565
1252
|
debug: analytics?.debug ?? __DEV__
|
|
566
1253
|
});
|
|
567
|
-
return
|
|
1254
|
+
return Granite2.registerApp(AppsInTossContainer.bind(null, container), {
|
|
568
1255
|
appName: getAppName(),
|
|
569
1256
|
context,
|
|
570
1257
|
router: {
|
|
@@ -577,7 +1264,7 @@ function registerApp(container, { context, analytics }) {
|
|
|
577
1264
|
}
|
|
578
1265
|
function getAppName() {
|
|
579
1266
|
try {
|
|
580
|
-
return global.
|
|
1267
|
+
return global.__granite.app.name;
|
|
581
1268
|
} catch (error) {
|
|
582
1269
|
console.error("unexpected error occurred while getting app name");
|
|
583
1270
|
throw error;
|
|
@@ -589,197 +1276,41 @@ var AppsInToss = {
|
|
|
589
1276
|
registerApp
|
|
590
1277
|
};
|
|
591
1278
|
|
|
592
|
-
// src/native-event-emitter/startUpdateLocation.ts
|
|
593
|
-
function startUpdateLocation(eventParams) {
|
|
594
|
-
return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
// ../../.yarn/cache/es-toolkit-npm-1.34.1-4cd6371dcb-aab6d07be3.zip/node_modules/es-toolkit/dist/function/noop.mjs
|
|
598
|
-
function noop() {
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
// src/native-modules/ads/googleAdMob.ts
|
|
602
|
-
function loadAdMobInterstitialAd(params) {
|
|
603
|
-
if (!loadAdMobInterstitialAd.isSupported()) {
|
|
604
|
-
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
605
|
-
return noop;
|
|
606
|
-
}
|
|
607
|
-
const { onEvent, onError, options } = params;
|
|
608
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobInterstitialAd", options, {
|
|
609
|
-
onAdClicked: () => {
|
|
610
|
-
onEvent({ type: "clicked" });
|
|
611
|
-
},
|
|
612
|
-
onAdDismissed: () => {
|
|
613
|
-
onEvent({ type: "dismissed" });
|
|
614
|
-
},
|
|
615
|
-
onAdFailedToShow: () => {
|
|
616
|
-
onEvent({ type: "failedToShow" });
|
|
617
|
-
},
|
|
618
|
-
onAdImpression: () => {
|
|
619
|
-
onEvent({ type: "impression" });
|
|
620
|
-
},
|
|
621
|
-
onAdShow: () => {
|
|
622
|
-
onEvent({ type: "show" });
|
|
623
|
-
},
|
|
624
|
-
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
625
|
-
onError
|
|
626
|
-
});
|
|
627
|
-
return unregisterCallbacks;
|
|
628
|
-
}
|
|
629
|
-
function showAdMobInterstitialAd(params) {
|
|
630
|
-
if (!showAdMobInterstitialAd.isSupported()) {
|
|
631
|
-
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
632
|
-
return noop;
|
|
633
|
-
}
|
|
634
|
-
const { onEvent, onError, options } = params;
|
|
635
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobInterstitialAd", options, {
|
|
636
|
-
onSuccess: () => onEvent({ type: "requested" }),
|
|
637
|
-
onError
|
|
638
|
-
});
|
|
639
|
-
return unregisterCallbacks;
|
|
640
|
-
}
|
|
641
|
-
function loadAdMobRewardedAd(params) {
|
|
642
|
-
if (!loadAdMobRewardedAd.isSupported()) {
|
|
643
|
-
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
644
|
-
return noop;
|
|
645
|
-
}
|
|
646
|
-
const { onEvent, onError, options } = params;
|
|
647
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobRewardedAd", options, {
|
|
648
|
-
onAdClicked: () => {
|
|
649
|
-
onEvent({ type: "clicked" });
|
|
650
|
-
},
|
|
651
|
-
onAdDismissed: () => {
|
|
652
|
-
onEvent({ type: "dismissed" });
|
|
653
|
-
},
|
|
654
|
-
onAdFailedToShow: () => {
|
|
655
|
-
onEvent({ type: "failedToShow" });
|
|
656
|
-
},
|
|
657
|
-
onAdImpression: () => {
|
|
658
|
-
onEvent({ type: "impression" });
|
|
659
|
-
},
|
|
660
|
-
onAdShow: () => {
|
|
661
|
-
onEvent({ type: "show" });
|
|
662
|
-
},
|
|
663
|
-
onUserEarnedReward: () => {
|
|
664
|
-
onEvent({ type: "userEarnedReward" });
|
|
665
|
-
},
|
|
666
|
-
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
667
|
-
onError
|
|
668
|
-
});
|
|
669
|
-
return unregisterCallbacks;
|
|
670
|
-
}
|
|
671
|
-
function showAdMobRewardedAd(params) {
|
|
672
|
-
if (!showAdMobRewardedAd.isSupported()) {
|
|
673
|
-
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
674
|
-
return noop;
|
|
675
|
-
}
|
|
676
|
-
const { onEvent, onError, options } = params;
|
|
677
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobRewardedAd", options, {
|
|
678
|
-
onSuccess: () => onEvent({ type: "requested" }),
|
|
679
|
-
onError
|
|
680
|
-
});
|
|
681
|
-
return unregisterCallbacks;
|
|
682
|
-
}
|
|
683
|
-
var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
|
|
684
|
-
var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
|
|
685
|
-
var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
|
|
686
|
-
var ENVIRONMENT = getOperationalEnvironment();
|
|
687
|
-
function createIsSupported() {
|
|
688
|
-
return () => {
|
|
689
|
-
if (ENVIRONMENT !== "toss") {
|
|
690
|
-
console.warn("Google AdMob is not supported in the current environment");
|
|
691
|
-
return false;
|
|
692
|
-
}
|
|
693
|
-
return isMinVersionSupported({
|
|
694
|
-
android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION,
|
|
695
|
-
ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION
|
|
696
|
-
});
|
|
697
|
-
};
|
|
698
|
-
}
|
|
699
|
-
loadAdMobInterstitialAd.isSupported = createIsSupported();
|
|
700
|
-
loadAdMobRewardedAd.isSupported = createIsSupported();
|
|
701
|
-
showAdMobInterstitialAd.isSupported = createIsSupported();
|
|
702
|
-
showAdMobRewardedAd.isSupported = createIsSupported();
|
|
703
|
-
|
|
704
|
-
// src/native-modules/getTossAppVersion.ts
|
|
705
|
-
function getTossAppVersion() {
|
|
706
|
-
return AppsInTossModule.tossAppVersion;
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
// src/native-modules/getDeviceId.ts
|
|
710
|
-
function getDeviceId() {
|
|
711
|
-
return AppsInTossModule.deviceId;
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
// src/native-modules/storage.ts
|
|
715
|
-
function getItem(key) {
|
|
716
|
-
return AppsInTossModule.getStorageItem({ key });
|
|
717
|
-
}
|
|
718
|
-
function setItem(key, value) {
|
|
719
|
-
return AppsInTossModule.setStorageItem({
|
|
720
|
-
key,
|
|
721
|
-
value
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
|
-
function removeItem(key) {
|
|
725
|
-
return AppsInTossModule.removeStorageItem({ key });
|
|
726
|
-
}
|
|
727
|
-
function clearItems() {
|
|
728
|
-
return AppsInTossModule.clearStorage({});
|
|
729
|
-
}
|
|
730
|
-
var Storage = {
|
|
731
|
-
getItem,
|
|
732
|
-
setItem,
|
|
733
|
-
removeItem,
|
|
734
|
-
clearItems
|
|
735
|
-
};
|
|
736
|
-
|
|
737
|
-
// src/native-modules/index.ts
|
|
738
|
-
var TossPay = {
|
|
739
|
-
checkoutPayment
|
|
740
|
-
};
|
|
741
|
-
var GoogleAdMob = {
|
|
742
|
-
loadAdMobInterstitialAd,
|
|
743
|
-
showAdMobInterstitialAd,
|
|
744
|
-
loadAdMobRewardedAd,
|
|
745
|
-
showAdMobRewardedAd
|
|
746
|
-
};
|
|
747
|
-
|
|
748
1279
|
// src/components/WebView.tsx
|
|
1280
|
+
import { getSchemeUri as getSchemeUri6, useGraniteEvent } from "@granite-js/react-native";
|
|
1281
|
+
import * as graniteAsyncBridges from "@granite-js/react-native/async-bridges";
|
|
1282
|
+
import * as graniteConstantBridges from "@granite-js/react-native/constant-bridges";
|
|
749
1283
|
import {
|
|
750
1284
|
PartnerWebViewScreen,
|
|
751
1285
|
ExternalWebViewScreen
|
|
752
1286
|
} from "@toss-design-system/react-native";
|
|
753
1287
|
import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2 } from "@toss-design-system/react-native/private";
|
|
754
1288
|
import { useCallback as useCallback3, useMemo as useMemo3 } from "react";
|
|
755
|
-
import { getSchemeUri as getSchemeUri4, useBedrockEvent } from "react-native-bedrock";
|
|
756
|
-
import * as bedrockAsyncBridges from "react-native-bedrock/async-bridges";
|
|
757
|
-
import * as bedrockConstantBridges from "react-native-bedrock/constant-bridges";
|
|
758
1289
|
|
|
759
1290
|
// src/components/GameWebView.tsx
|
|
760
1291
|
import {
|
|
761
1292
|
WebView as PlainWebView
|
|
762
|
-
} from "@
|
|
1293
|
+
} from "@granite-js/native/react-native-webview";
|
|
1294
|
+
import { closeView as closeView3 } from "@granite-js/react-native";
|
|
763
1295
|
import { useDialog } from "@toss-design-system/react-native";
|
|
764
1296
|
import { josa } from "es-hangul";
|
|
765
1297
|
import { forwardRef, useCallback, useEffect as useEffect3 } from "react";
|
|
766
|
-
import { BackHandler, Platform as
|
|
767
|
-
import { closeView, setIosSwipeGestureEnabled } from "react-native-bedrock";
|
|
1298
|
+
import { BackHandler, Platform as Platform10, View as View3 } from "react-native";
|
|
768
1299
|
|
|
769
1300
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
770
|
-
import { SvgXml } from "@
|
|
1301
|
+
import { SvgXml } from "@granite-js/native/react-native-svg";
|
|
771
1302
|
import { PageNavbar } from "@toss-design-system/react-native";
|
|
772
|
-
import { Platform as
|
|
1303
|
+
import { Platform as Platform9, TouchableOpacity, View as View2 } from "react-native";
|
|
773
1304
|
|
|
774
1305
|
// src/components/GameWebViewNavigationBar/HeaderRight.tsx
|
|
775
1306
|
import { StyleSheet, View } from "react-native";
|
|
776
1307
|
|
|
777
1308
|
// src/components/GameWebViewNavigationBar/byPlatform.ts
|
|
778
|
-
import { Platform as
|
|
1309
|
+
import { Platform as Platform7 } from "react-native";
|
|
779
1310
|
function byPlatform({
|
|
780
1311
|
...props
|
|
781
1312
|
}) {
|
|
782
|
-
return (props[
|
|
1313
|
+
return (props[Platform7.OS] ?? props.fallback)();
|
|
783
1314
|
}
|
|
784
1315
|
|
|
785
1316
|
// src/components/GameWebViewNavigationBar/constants.ts
|
|
@@ -812,11 +1343,11 @@ var styles = StyleSheet.create({
|
|
|
812
1343
|
});
|
|
813
1344
|
|
|
814
1345
|
// src/components/GameWebViewNavigationBar/useSafeAreaTop.ts
|
|
815
|
-
import { useSafeAreaInsets } from "@
|
|
816
|
-
import { Platform as
|
|
1346
|
+
import { useSafeAreaInsets } from "@granite-js/native/react-native-safe-area-context";
|
|
1347
|
+
import { Platform as Platform8 } from "react-native";
|
|
817
1348
|
function useSafeAreaTop() {
|
|
818
1349
|
const safeAreaInsets = useSafeAreaInsets();
|
|
819
|
-
const hasDynamicIsland =
|
|
1350
|
+
const hasDynamicIsland = Platform8.OS === "ios" && safeAreaInsets.top > 50;
|
|
820
1351
|
const safeAreaTop = hasDynamicIsland ? safeAreaInsets.top - 5 : safeAreaInsets.top;
|
|
821
1352
|
return safeAreaTop;
|
|
822
1353
|
}
|
|
@@ -833,14 +1364,14 @@ function GameNavigationBar({ onClose }) {
|
|
|
833
1364
|
{
|
|
834
1365
|
style: {
|
|
835
1366
|
width: "100%",
|
|
836
|
-
height:
|
|
1367
|
+
height: Platform9.OS === "ios" ? 44 : 54,
|
|
837
1368
|
flexDirection: "row",
|
|
838
1369
|
alignItems: "center",
|
|
839
1370
|
justifyContent: "flex-end",
|
|
840
1371
|
position: "absolute",
|
|
841
1372
|
zIndex: 9999,
|
|
842
1373
|
marginTop: safeAreaTop,
|
|
843
|
-
paddingRight:
|
|
1374
|
+
paddingRight: Platform9.OS === "ios" ? 10 : 8
|
|
844
1375
|
},
|
|
845
1376
|
pointerEvents: "box-none",
|
|
846
1377
|
children: /* @__PURE__ */ jsx3(HeaderRight, { children: /* @__PURE__ */ jsx3(
|
|
@@ -851,7 +1382,7 @@ function GameNavigationBar({ onClose }) {
|
|
|
851
1382
|
accessible: true,
|
|
852
1383
|
accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
|
|
853
1384
|
style: {
|
|
854
|
-
padding:
|
|
1385
|
+
padding: Platform9.OS === "ios" ? 7 : 9
|
|
855
1386
|
},
|
|
856
1387
|
onPress: onClose,
|
|
857
1388
|
children: /* @__PURE__ */ jsx3(SvgXml, { xml: originXML, width: 30, height: 30 })
|
|
@@ -875,11 +1406,11 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
875
1406
|
closeOnDimmerClick: true
|
|
876
1407
|
});
|
|
877
1408
|
if (isConfirmed) {
|
|
878
|
-
|
|
1409
|
+
closeView3();
|
|
879
1410
|
}
|
|
880
1411
|
}, [brandDisplayName, openConfirm]);
|
|
881
1412
|
useEffect3(() => {
|
|
882
|
-
if (
|
|
1413
|
+
if (Platform10.OS === "ios") {
|
|
883
1414
|
setIosSwipeGestureEnabled({ isEnabled: false });
|
|
884
1415
|
return () => {
|
|
885
1416
|
setIosSwipeGestureEnabled({ isEnabled: true });
|
|
@@ -936,12 +1467,12 @@ function methodHandler({
|
|
|
936
1467
|
};
|
|
937
1468
|
wrappedFunc(...args).then((result) => {
|
|
938
1469
|
injectJavaScript?.(`
|
|
939
|
-
window.
|
|
1470
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/resolve/${eventId}', ${JSON.stringify(result, null, 0)});
|
|
940
1471
|
`);
|
|
941
1472
|
}).catch((error) => {
|
|
942
1473
|
const serializedError = serializeError(error);
|
|
943
1474
|
injectJavaScript?.(`
|
|
944
|
-
window.
|
|
1475
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/reject/${eventId}', ${serializedError});
|
|
945
1476
|
`);
|
|
946
1477
|
});
|
|
947
1478
|
}
|
|
@@ -972,12 +1503,12 @@ function useBridgeHandler({
|
|
|
972
1503
|
);
|
|
973
1504
|
const createHandleOnEvent = (functionName, eventId) => (response) => {
|
|
974
1505
|
ref.current?.injectJavaScript(`
|
|
975
|
-
window.
|
|
1506
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onEvent/${eventId}', ${JSON.stringify(response, null, 0)});
|
|
976
1507
|
`);
|
|
977
1508
|
};
|
|
978
1509
|
const createHandleOnError = (functionName, eventId) => (error) => {
|
|
979
1510
|
ref.current?.injectJavaScript(`
|
|
980
|
-
window.
|
|
1511
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
|
|
981
1512
|
`);
|
|
982
1513
|
};
|
|
983
1514
|
const $onMessage = useCallback2(
|
|
@@ -1030,22 +1561,8 @@ function useBridgeHandler({
|
|
|
1030
1561
|
};
|
|
1031
1562
|
}
|
|
1032
1563
|
|
|
1033
|
-
// src/constant-bridges.ts
|
|
1034
|
-
var constant_bridges_exports = {};
|
|
1035
|
-
__export(constant_bridges_exports, {
|
|
1036
|
-
getDeviceId: () => getDeviceId,
|
|
1037
|
-
getOperationalEnvironment: () => getOperationalEnvironment,
|
|
1038
|
-
getTossAppVersion: () => getTossAppVersion
|
|
1039
|
-
});
|
|
1040
|
-
|
|
1041
|
-
// src/event-bridges.ts
|
|
1042
|
-
var event_bridges_exports = {};
|
|
1043
|
-
__export(event_bridges_exports, {
|
|
1044
|
-
startUpdateLocation: () => startUpdateLocation
|
|
1045
|
-
});
|
|
1046
|
-
|
|
1047
1564
|
// src/utils/log.ts
|
|
1048
|
-
import { getSchemeUri as
|
|
1565
|
+
import { getSchemeUri as getSchemeUri5 } from "@granite-js/react-native";
|
|
1049
1566
|
|
|
1050
1567
|
// src/utils/extractDateFromUUIDv7.ts
|
|
1051
1568
|
var extractDateFromUUIDv7 = (uuid) => {
|
|
@@ -1071,7 +1588,7 @@ var getGroupId = (url) => {
|
|
|
1071
1588
|
};
|
|
1072
1589
|
var getReferrer = () => {
|
|
1073
1590
|
try {
|
|
1074
|
-
const referrer = new URL(
|
|
1591
|
+
const referrer = new URL(getSchemeUri5());
|
|
1075
1592
|
return referrer.searchParams.get("referrer");
|
|
1076
1593
|
} catch {
|
|
1077
1594
|
return "";
|
|
@@ -1095,7 +1612,7 @@ var trackScreen = (url) => {
|
|
|
1095
1612
|
// src/components/WebView.tsx
|
|
1096
1613
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1097
1614
|
var appsInTossGlobals = getAppsInTossGlobals();
|
|
1098
|
-
var operationalEnvironment =
|
|
1615
|
+
var operationalEnvironment = getOperationalEnvironment2();
|
|
1099
1616
|
var TYPES = ["partner", "external", "game"];
|
|
1100
1617
|
var WEBVIEW_TYPES = {
|
|
1101
1618
|
partner: PartnerWebViewScreen,
|
|
@@ -1104,7 +1621,7 @@ var WEBVIEW_TYPES = {
|
|
|
1104
1621
|
};
|
|
1105
1622
|
function mergeSchemeQueryParamsInto(url) {
|
|
1106
1623
|
const baseUrl = new URL(url);
|
|
1107
|
-
const schemeUrl = new URL(
|
|
1624
|
+
const schemeUrl = new URL(getSchemeUri6());
|
|
1108
1625
|
baseUrl.pathname = schemeUrl.pathname;
|
|
1109
1626
|
for (const [key, value] of schemeUrl.searchParams.entries()) {
|
|
1110
1627
|
baseUrl.searchParams.set(key, value);
|
|
@@ -1128,7 +1645,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1128
1645
|
if (!TYPES.includes(type)) {
|
|
1129
1646
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
1130
1647
|
}
|
|
1131
|
-
const
|
|
1648
|
+
const graniteEvent = useGraniteEvent();
|
|
1132
1649
|
const uri = useMemo3(() => getWebViewUri(local), [local]);
|
|
1133
1650
|
const top = useSafeAreaTop2();
|
|
1134
1651
|
const bottom = useSafeAreaBottom();
|
|
@@ -1137,7 +1654,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1137
1654
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1138
1655
|
eventListenerMap: {
|
|
1139
1656
|
...event_bridges_exports,
|
|
1140
|
-
backEvent: ({ onEvent, onError, options }) =>
|
|
1657
|
+
backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
|
|
1141
1658
|
entryMessageExited: ({ onEvent, onError }) => appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
1142
1659
|
updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
1143
1660
|
/** @internal */
|
|
@@ -1149,7 +1666,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1149
1666
|
showAdMobRewardedAd: GoogleAdMob.showAdMobRewardedAd
|
|
1150
1667
|
},
|
|
1151
1668
|
constantHandlerMap: {
|
|
1152
|
-
...
|
|
1669
|
+
...graniteConstantBridges,
|
|
1153
1670
|
...constant_bridges_exports,
|
|
1154
1671
|
getSafeAreaTop: () => top,
|
|
1155
1672
|
getSafeAreaBottom: () => bottom,
|
|
@@ -1162,7 +1679,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1162
1679
|
getDeploymentId: env.getDeploymentId
|
|
1163
1680
|
},
|
|
1164
1681
|
asyncHandlerMap: {
|
|
1165
|
-
...
|
|
1682
|
+
...graniteAsyncBridges,
|
|
1166
1683
|
...async_bridges_exports,
|
|
1167
1684
|
/** internal */
|
|
1168
1685
|
openPermissionDialog: AppsInTossModule.openPermissionDialog,
|
|
@@ -1234,8 +1751,8 @@ function ensureValue(value, name) {
|
|
|
1234
1751
|
}
|
|
1235
1752
|
|
|
1236
1753
|
// src/hooks/useGeolocation.ts
|
|
1754
|
+
import { useVisibility } from "@granite-js/react-native";
|
|
1237
1755
|
import { useState, useEffect as useEffect4 } from "react";
|
|
1238
|
-
import { useVisibility } from "react-native-bedrock";
|
|
1239
1756
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1240
1757
|
const isVisible = useVisibility();
|
|
1241
1758
|
const [location, setLocation] = useState(null);
|
|
@@ -1256,17 +1773,6 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
1256
1773
|
return location;
|
|
1257
1774
|
}
|
|
1258
1775
|
|
|
1259
|
-
// src/types.ts
|
|
1260
|
-
var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
1261
|
-
Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
|
|
1262
|
-
Accuracy3[Accuracy3["Low"] = 2] = "Low";
|
|
1263
|
-
Accuracy3[Accuracy3["Balanced"] = 3] = "Balanced";
|
|
1264
|
-
Accuracy3[Accuracy3["High"] = 4] = "High";
|
|
1265
|
-
Accuracy3[Accuracy3["Highest"] = 5] = "Highest";
|
|
1266
|
-
Accuracy3[Accuracy3["BestForNavigation"] = 6] = "BestForNavigation";
|
|
1267
|
-
return Accuracy3;
|
|
1268
|
-
})(Accuracy2 || {});
|
|
1269
|
-
|
|
1270
1776
|
// src/index.ts
|
|
1271
1777
|
export * from "@apps-in-toss/analytics";
|
|
1272
1778
|
var Analytics2 = {
|
|
@@ -1279,25 +1785,43 @@ export {
|
|
|
1279
1785
|
Accuracy2 as Accuracy,
|
|
1280
1786
|
Analytics2 as Analytics,
|
|
1281
1787
|
AppsInToss,
|
|
1788
|
+
AppsInTossModule,
|
|
1789
|
+
BedrockCoreModule,
|
|
1790
|
+
BedrockModule,
|
|
1282
1791
|
GoogleAdMob,
|
|
1792
|
+
AppsInTossModuleInstance as INTERNAL__AppsInTossModule,
|
|
1793
|
+
INTERNAL__module,
|
|
1283
1794
|
Storage,
|
|
1284
1795
|
TossPay,
|
|
1285
1796
|
WebView,
|
|
1286
1797
|
appLogin,
|
|
1287
1798
|
appsInTossEvent,
|
|
1799
|
+
closeView,
|
|
1288
1800
|
env,
|
|
1289
1801
|
eventLog,
|
|
1290
1802
|
fetchAlbumPhotos,
|
|
1291
1803
|
fetchContacts,
|
|
1804
|
+
generateHapticFeedback,
|
|
1292
1805
|
getClipboardText,
|
|
1293
1806
|
getCurrentLocation,
|
|
1294
1807
|
getDeviceId,
|
|
1808
|
+
getLocale,
|
|
1809
|
+
getNetworkStatus,
|
|
1295
1810
|
getOperationalEnvironment,
|
|
1811
|
+
getPlatformOS,
|
|
1812
|
+
getSchemeUri,
|
|
1296
1813
|
getTossAppVersion,
|
|
1297
1814
|
getTossShareLink,
|
|
1298
1815
|
isMinVersionSupported,
|
|
1299
1816
|
openCamera,
|
|
1817
|
+
openURL,
|
|
1818
|
+
saveBase64Data,
|
|
1300
1819
|
setClipboardText,
|
|
1820
|
+
setDeviceOrientation,
|
|
1821
|
+
setIosSwipeGestureEnabled,
|
|
1822
|
+
setScreenAwakeMode,
|
|
1823
|
+
setSecureScreen,
|
|
1824
|
+
share,
|
|
1301
1825
|
startUpdateLocation,
|
|
1302
1826
|
useGeolocation
|
|
1303
1827
|
};
|