@apps-in-toss/framework 0.0.0-dev.1752115036458 → 0.0.0-dev.1754906858438
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/index.cjs +1269 -1086
- package/dist/index.d.cts +2251 -7
- package/dist/index.d.ts +2251 -7
- package/dist/index.js +1265 -1071
- 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 +27 -21
- package/src/async-bridges.ts +15 -0
- package/src/constant-bridges.ts +3 -0
- package/src/event-bridges.ts +2 -0
- package/dist/bridge-meta.d.ts +0 -1
- package/dist/bridge-meta.js +0 -158
- package/src/bridge-entry.ts +0 -4
package/dist/index.js
CHANGED
|
@@ -9,30 +9,267 @@ 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";
|
|
13
12
|
import { TDSProvider } from "@toss-design-system/react-native";
|
|
13
|
+
import { Bedrock as Bedrock3 } from "react-native-bedrock";
|
|
14
14
|
|
|
15
|
-
//
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
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";
|
|
15
|
+
// src/core/components/AppEvent.tsx
|
|
16
|
+
import { useEffect as useEffect2 } from "react";
|
|
17
|
+
import { Bedrock as Bedrock2, getSchemeUri as getSchemeUri3, useVisibility as useVisibility2 } from "react-native-bedrock";
|
|
22
18
|
|
|
23
|
-
//
|
|
24
|
-
|
|
19
|
+
// src/env.ts
|
|
20
|
+
var env = {
|
|
21
|
+
getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// src/hooks/useCaptureExitLog.ts
|
|
25
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
26
|
+
import { Bedrock, useVisibility } from "react-native-bedrock";
|
|
27
|
+
|
|
28
|
+
// src/core/hooks/useReferrer.ts
|
|
29
|
+
import { useMemo } from "react";
|
|
30
|
+
import { getSchemeUri } from "react-native-bedrock";
|
|
31
|
+
function useReferrer() {
|
|
32
|
+
return useMemo(() => {
|
|
33
|
+
try {
|
|
34
|
+
return new URL(getSchemeUri()).searchParams.get("referrer");
|
|
35
|
+
} catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}, []);
|
|
25
39
|
}
|
|
26
40
|
|
|
27
|
-
//
|
|
28
|
-
import { Platform } from "react-native";
|
|
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";
|
|
41
|
+
// src/native-modules/tossCore.ts
|
|
33
42
|
import { NativeModules as NativeModules2 } from "react-native";
|
|
34
|
-
|
|
35
|
-
|
|
43
|
+
|
|
44
|
+
// src/native-modules/AppsInTossModule.ts
|
|
45
|
+
import { NativeModules } from "react-native";
|
|
46
|
+
var AppsInTossModuleInstance = NativeModules.AppsInTossModule;
|
|
47
|
+
var AppsInTossModule = AppsInTossModuleInstance;
|
|
48
|
+
|
|
49
|
+
// src/native-modules/getOperationalEnvironment.ts
|
|
50
|
+
function getOperationalEnvironment() {
|
|
51
|
+
return AppsInTossModule.operationalEnvironment;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/native-modules/isMinVersionSupported.ts
|
|
55
|
+
import { Platform } from "react-native";
|
|
56
|
+
|
|
57
|
+
// src/utils/compareVersion.ts
|
|
58
|
+
var SEMVER_REGEX = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
|
|
59
|
+
var isWildcard = (val) => ["*", "x", "X"].includes(val);
|
|
60
|
+
var tryParse = (val) => {
|
|
61
|
+
const num = parseInt(val, 10);
|
|
62
|
+
return isNaN(num) ? val : num;
|
|
63
|
+
};
|
|
64
|
+
var coerceTypes = (a, b) => {
|
|
65
|
+
return typeof a === typeof b ? [a, b] : [String(a), String(b)];
|
|
66
|
+
};
|
|
67
|
+
var compareValues = (a, b) => {
|
|
68
|
+
if (isWildcard(a) || isWildcard(b)) {
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
const [aVal, bVal] = coerceTypes(tryParse(a), tryParse(b));
|
|
72
|
+
if (aVal > bVal) {
|
|
73
|
+
return 1;
|
|
74
|
+
}
|
|
75
|
+
if (aVal < bVal) {
|
|
76
|
+
return -1;
|
|
77
|
+
}
|
|
78
|
+
return 0;
|
|
79
|
+
};
|
|
80
|
+
var parseVersion = (version) => {
|
|
81
|
+
if (typeof version !== "string") {
|
|
82
|
+
throw new TypeError("Invalid argument: expected a string");
|
|
83
|
+
}
|
|
84
|
+
const match = version.match(SEMVER_REGEX);
|
|
85
|
+
if (!match) {
|
|
86
|
+
throw new Error(`Invalid semver: '${version}'`);
|
|
87
|
+
}
|
|
88
|
+
const [, major, minor, patch, build, preRelease] = match;
|
|
89
|
+
return [major, minor, patch, build, preRelease];
|
|
90
|
+
};
|
|
91
|
+
var compareSegments = (a, b) => {
|
|
92
|
+
const maxLength = Math.max(a.length, b.length);
|
|
93
|
+
for (let i = 0; i < maxLength; i++) {
|
|
94
|
+
const segA = a[i] ?? "0";
|
|
95
|
+
const segB = b[i] ?? "0";
|
|
96
|
+
const result = compareValues(segA, segB);
|
|
97
|
+
if (result !== 0) {
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return 0;
|
|
102
|
+
};
|
|
103
|
+
var compareVersions = (v1, v2) => {
|
|
104
|
+
const seg1 = parseVersion(v1);
|
|
105
|
+
const seg2 = parseVersion(v2);
|
|
106
|
+
const preRelease1 = seg1.pop();
|
|
107
|
+
const preRelease2 = seg2.pop();
|
|
108
|
+
const mainCompare = compareSegments(seg1, seg2);
|
|
109
|
+
if (mainCompare !== 0) {
|
|
110
|
+
return mainCompare;
|
|
111
|
+
}
|
|
112
|
+
if (preRelease1 && preRelease2) {
|
|
113
|
+
return compareSegments(preRelease1.split("."), preRelease2.split("."));
|
|
114
|
+
}
|
|
115
|
+
if (preRelease1) {
|
|
116
|
+
return -1;
|
|
117
|
+
}
|
|
118
|
+
if (preRelease2) {
|
|
119
|
+
return 1;
|
|
120
|
+
}
|
|
121
|
+
return 0;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// src/native-modules/isMinVersionSupported.ts
|
|
125
|
+
function isMinVersionSupported(minVersions) {
|
|
126
|
+
const operationalEnvironment2 = AppsInTossModule.operationalEnvironment;
|
|
127
|
+
if (operationalEnvironment2 === "sandbox") {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
const currentVersion = AppsInTossModule.tossAppVersion;
|
|
131
|
+
const isIOS = Platform.OS === "ios";
|
|
132
|
+
const minVersion = isIOS ? minVersions.ios : minVersions.android;
|
|
133
|
+
if (minVersion === void 0) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
if (minVersion === "always") {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
if (minVersion === "never") {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
return compareVersions(currentVersion, minVersion) >= 0;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// src/native-modules/tossCore.ts
|
|
146
|
+
var TossCoreModule = NativeModules2.TossCoreModule;
|
|
147
|
+
function tossCoreEventLog(params) {
|
|
148
|
+
const supported = isMinVersionSupported({ ios: "5.210.0", android: "5.210.0" });
|
|
149
|
+
const isSandbox = getOperationalEnvironment() === "sandbox";
|
|
150
|
+
if (!supported || isSandbox) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
TossCoreModule.eventLog({
|
|
154
|
+
params: {
|
|
155
|
+
log_name: params.log_name,
|
|
156
|
+
log_type: params.log_type,
|
|
157
|
+
params: params.params
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// src/utils/isPrivateScheme.ts
|
|
163
|
+
import { getSchemeUri as getSchemeUri2 } from "react-native-bedrock";
|
|
164
|
+
function isPrivateScheme() {
|
|
165
|
+
try {
|
|
166
|
+
return new URL(getSchemeUri2()).protocol === "intoss-private:";
|
|
167
|
+
} catch {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// src/hooks/useCaptureExitLog.ts
|
|
173
|
+
var EXIT_IMPRESSION_LOG_NAME = "appsintoss_app_visit__common_module::impression__stay_time";
|
|
174
|
+
var EXIT_IMPRESSION_SCHEMA_ID = 1631628;
|
|
175
|
+
function useCaptureExitLog() {
|
|
176
|
+
const referrer = useReferrer();
|
|
177
|
+
const visible = useVisibility();
|
|
178
|
+
const enterTime = useRef(void 0);
|
|
179
|
+
useEffect(() => {
|
|
180
|
+
if (visible === true) {
|
|
181
|
+
enterTime.current = Date.now();
|
|
182
|
+
}
|
|
183
|
+
}, [visible]);
|
|
184
|
+
const captureExitLog = useCallback(
|
|
185
|
+
(exitTime) => {
|
|
186
|
+
if (enterTime.current == null) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const stayTime = Math.floor(exitTime - enterTime.current);
|
|
190
|
+
tossCoreEventLog({
|
|
191
|
+
log_name: EXIT_IMPRESSION_LOG_NAME,
|
|
192
|
+
log_type: "event",
|
|
193
|
+
params: {
|
|
194
|
+
schema_id: EXIT_IMPRESSION_SCHEMA_ID,
|
|
195
|
+
event_type: "impression",
|
|
196
|
+
referrer,
|
|
197
|
+
deployment_id: env.getDeploymentId(),
|
|
198
|
+
app_name: Bedrock.appName,
|
|
199
|
+
is_private: isPrivateScheme(),
|
|
200
|
+
stay_time: stayTime.toString(),
|
|
201
|
+
exit_time: exitTime.toString()
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
enterTime.current = void 0;
|
|
205
|
+
},
|
|
206
|
+
[referrer]
|
|
207
|
+
);
|
|
208
|
+
return { captureExitLog };
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// src/core/components/AppEvent.tsx
|
|
212
|
+
var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
|
|
213
|
+
function EntryAppEvent() {
|
|
214
|
+
const referrer = useReferrer() ?? "";
|
|
215
|
+
useEffect2(() => {
|
|
216
|
+
tossCoreEventLog({
|
|
217
|
+
log_name: "appsintoss_app_visit::impression__enter_appsintoss",
|
|
218
|
+
log_type: "info",
|
|
219
|
+
params: {
|
|
220
|
+
is_transform: true,
|
|
221
|
+
schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
|
|
222
|
+
referrer,
|
|
223
|
+
deployment_id: env.getDeploymentId(),
|
|
224
|
+
app_name: Bedrock2.appName,
|
|
225
|
+
is_private: isPrivateScheme()
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}, [referrer]);
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
function SystemAppEvent({ ...initialProps }) {
|
|
232
|
+
useEffect2(() => {
|
|
233
|
+
tossCoreEventLog({
|
|
234
|
+
log_name: "AppsInTossInitialProps",
|
|
235
|
+
log_type: "debug",
|
|
236
|
+
params: {
|
|
237
|
+
...initialProps,
|
|
238
|
+
schemeUri: getSchemeUri3(),
|
|
239
|
+
deployment_id: env.getDeploymentId(),
|
|
240
|
+
app_name: Bedrock2.appName,
|
|
241
|
+
is_private: isPrivateScheme()
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
}, [initialProps]);
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
function StayTimeAppEvent() {
|
|
248
|
+
const visible = useVisibility2();
|
|
249
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
250
|
+
useEffect2(() => {
|
|
251
|
+
if (visible === false) {
|
|
252
|
+
captureExitLog(Date.now());
|
|
253
|
+
}
|
|
254
|
+
}, [visible, captureExitLog]);
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
var AppEvent = {
|
|
258
|
+
Entry: EntryAppEvent,
|
|
259
|
+
System: SystemAppEvent,
|
|
260
|
+
StayTime: StayTimeAppEvent
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
// src/core/hooks/useAppsInTossBridge.ts
|
|
264
|
+
import { useBridge } from "@toss-design-system/react-native";
|
|
265
|
+
import { useEffect as useEffect3 } from "react";
|
|
266
|
+
|
|
267
|
+
// src/native-event-emitter/appsInTossEvent.ts
|
|
268
|
+
import { BedrockEvent } from "react-native-bedrock";
|
|
269
|
+
|
|
270
|
+
// src/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts
|
|
271
|
+
import { BedrockEventDefinition } from "react-native-bedrock";
|
|
272
|
+
var EntryMessageExitedEvent = class extends BedrockEventDefinition {
|
|
36
273
|
name = "entryMessageExited";
|
|
37
274
|
remove() {
|
|
38
275
|
}
|
|
@@ -40,15 +277,21 @@ var EntryMessageExitedEvent = class extends GraniteEventDefinition {
|
|
|
40
277
|
listener(_) {
|
|
41
278
|
}
|
|
42
279
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
280
|
+
|
|
281
|
+
// src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
282
|
+
import { BedrockEventDefinition as BedrockEventDefinition2 } from "react-native-bedrock";
|
|
283
|
+
|
|
284
|
+
// src/native-modules/getPermission.ts
|
|
46
285
|
function getPermission(permission) {
|
|
47
286
|
return AppsInTossModule.getPermission(permission);
|
|
48
287
|
}
|
|
288
|
+
|
|
289
|
+
// src/native-modules/openPermissionDialog.ts
|
|
49
290
|
function openPermissionDialog(permission) {
|
|
50
291
|
return AppsInTossModule.openPermissionDialog(permission);
|
|
51
292
|
}
|
|
293
|
+
|
|
294
|
+
// src/native-modules/requestPermission.ts
|
|
52
295
|
async function requestPermission(permission) {
|
|
53
296
|
const permissionStatus = await getPermission(permission);
|
|
54
297
|
switch (permissionStatus) {
|
|
@@ -59,8 +302,13 @@ async function requestPermission(permission) {
|
|
|
59
302
|
return openPermissionDialog(permission);
|
|
60
303
|
}
|
|
61
304
|
}
|
|
305
|
+
|
|
306
|
+
// src/native-event-emitter/nativeEventEmitter.ts
|
|
307
|
+
import { NativeEventEmitter } from "react-native";
|
|
62
308
|
var nativeEventEmitter = new NativeEventEmitter(AppsInTossModuleInstance);
|
|
63
|
-
|
|
309
|
+
|
|
310
|
+
// src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
311
|
+
var UpdateLocationEvent = class extends BedrockEventDefinition2 {
|
|
64
312
|
name = "updateLocationEvent";
|
|
65
313
|
subscriptionCount = 0;
|
|
66
314
|
ref = {
|
|
@@ -88,9 +336,16 @@ var UpdateLocationEvent = class extends GraniteEventDefinition2 {
|
|
|
88
336
|
}).catch(onError);
|
|
89
337
|
}
|
|
90
338
|
};
|
|
339
|
+
|
|
340
|
+
// src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
341
|
+
import { BedrockEventDefinition as BedrockEventDefinition3 } from "react-native-bedrock";
|
|
342
|
+
|
|
343
|
+
// src/utils/generateUUID.ts
|
|
91
344
|
function generateUUID(placeholder) {
|
|
92
345
|
return placeholder ? (placeholder ^ Math.random() * 16 >> placeholder / 4).toString(16) : (String(1e7) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, generateUUID);
|
|
93
346
|
}
|
|
347
|
+
|
|
348
|
+
// src/native-event-emitter/internal/appBridge.ts
|
|
94
349
|
var INTERNAL__callbacks = /* @__PURE__ */ new Map();
|
|
95
350
|
function invokeAppBridgeCallback(id, ...args) {
|
|
96
351
|
const callback = INTERNAL__callbacks.get(id);
|
|
@@ -137,8 +392,10 @@ var INTERNAL__appBridgeHandler = {
|
|
|
137
392
|
unregisterCallback,
|
|
138
393
|
getCallbackIds
|
|
139
394
|
};
|
|
395
|
+
|
|
396
|
+
// src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
140
397
|
var UNSAFE__nativeEventEmitter = nativeEventEmitter;
|
|
141
|
-
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends
|
|
398
|
+
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends BedrockEventDefinition3 {
|
|
142
399
|
static INTERNAL__appBridgeSubscription;
|
|
143
400
|
name = "appBridgeCallbackEvent";
|
|
144
401
|
constructor() {
|
|
@@ -166,204 +423,96 @@ var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends GraniteEventD
|
|
|
166
423
|
}
|
|
167
424
|
}
|
|
168
425
|
};
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
return AppsInTossModule.operationalEnvironment;
|
|
179
|
-
}
|
|
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;
|
|
426
|
+
|
|
427
|
+
// src/native-event-emitter/internal/VisibilityChangedByTransparentServiceWebEvent.ts
|
|
428
|
+
import { BedrockEventDefinition as BedrockEventDefinition4 } from "react-native-bedrock";
|
|
429
|
+
var VisibilityChangedByTransparentServiceWebEvent = class extends BedrockEventDefinition4 {
|
|
430
|
+
name = "onVisibilityChangedByTransparentServiceWeb";
|
|
431
|
+
subscription = null;
|
|
432
|
+
remove() {
|
|
433
|
+
this.subscription?.remove();
|
|
434
|
+
this.subscription = null;
|
|
192
435
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
436
|
+
listener(options, onEvent, onError) {
|
|
437
|
+
const subscription = nativeEventEmitter.addListener("visibilityChangedByTransparentServiceWeb", (params) => {
|
|
438
|
+
if (this.isVisibilityChangedByTransparentServiceWebResult(params)) {
|
|
439
|
+
if (params.callbackId === options.callbackId) {
|
|
440
|
+
onEvent(params.isVisible);
|
|
441
|
+
}
|
|
442
|
+
} else {
|
|
443
|
+
onError(new Error("Invalid visibility changed by transparent service web result"));
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
this.subscription = subscription;
|
|
196
447
|
}
|
|
197
|
-
|
|
198
|
-
return
|
|
448
|
+
isVisibilityChangedByTransparentServiceWebResult(params) {
|
|
449
|
+
return typeof params === "object" && typeof params.callbackId === "string" && typeof params.isVisible === "boolean";
|
|
199
450
|
}
|
|
200
|
-
return 0;
|
|
201
451
|
};
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
452
|
+
|
|
453
|
+
// src/native-event-emitter/appsInTossEvent.ts
|
|
454
|
+
var appsInTossEvent = new BedrockEvent([
|
|
455
|
+
new UpdateLocationEvent(),
|
|
456
|
+
new EntryMessageExitedEvent(),
|
|
457
|
+
// Internal events
|
|
458
|
+
new AppBridgeCallbackEvent(),
|
|
459
|
+
new VisibilityChangedByTransparentServiceWebEvent()
|
|
460
|
+
]);
|
|
461
|
+
|
|
462
|
+
// src/core/utils/getAppsInTossGlobals.ts
|
|
463
|
+
function getAppsInTossGlobals() {
|
|
464
|
+
if (global.__appsInToss == null) {
|
|
465
|
+
throw new Error("invalid apps-in-toss globals");
|
|
209
466
|
}
|
|
210
|
-
|
|
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;
|
|
263
|
-
}
|
|
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;
|
|
467
|
+
return global.__appsInToss;
|
|
332
468
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
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;
|
|
469
|
+
|
|
470
|
+
// src/core/utils/toIcon.ts
|
|
471
|
+
function toIcon(source) {
|
|
472
|
+
return source.startsWith("http") ? { source: { uri: source } } : { name: source };
|
|
344
473
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
474
|
+
|
|
475
|
+
// src/core/hooks/useAppsInTossBridge.ts
|
|
476
|
+
function useAppsInTossBridge() {
|
|
477
|
+
const controller = useBridge();
|
|
478
|
+
const appsInTossGlobals2 = getAppsInTossGlobals();
|
|
479
|
+
useEffect3(() => {
|
|
480
|
+
const commonProps = {
|
|
481
|
+
serviceName: appsInTossGlobals2.brandDisplayName,
|
|
482
|
+
icon: toIcon(appsInTossGlobals2.brandIcon),
|
|
483
|
+
color: appsInTossGlobals2.brandPrimaryColor,
|
|
484
|
+
colorMode: appsInTossGlobals2.brandBridgeColorMode
|
|
485
|
+
};
|
|
486
|
+
controller.open({
|
|
487
|
+
...commonProps,
|
|
488
|
+
onExited: () => {
|
|
489
|
+
appsInTossEvent.emit("entryMessageExited", void 0);
|
|
490
|
+
}
|
|
357
491
|
});
|
|
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 });
|
|
492
|
+
}, []);
|
|
366
493
|
}
|
|
494
|
+
|
|
495
|
+
// src/async-bridges.ts
|
|
496
|
+
var async_bridges_exports = {};
|
|
497
|
+
__export(async_bridges_exports, {
|
|
498
|
+
appLogin: () => appLogin,
|
|
499
|
+
checkoutPayment: () => checkoutPayment,
|
|
500
|
+
eventLog: () => eventLog,
|
|
501
|
+
fetchAlbumPhotos: () => fetchAlbumPhotos,
|
|
502
|
+
fetchContacts: () => fetchContacts,
|
|
503
|
+
getClipboardText: () => getClipboardText,
|
|
504
|
+
getCurrentLocation: () => getCurrentLocation,
|
|
505
|
+
getGameCenterGameProfile: () => getGameCenterGameProfile,
|
|
506
|
+
getTossShareLink: () => getTossShareLink,
|
|
507
|
+
openCamera: () => openCamera,
|
|
508
|
+
openGameCenterLeaderboard: () => openGameCenterLeaderboard,
|
|
509
|
+
saveBase64Data: () => saveBase64Data,
|
|
510
|
+
setClipboardText: () => setClipboardText,
|
|
511
|
+
setDeviceOrientation: () => setDeviceOrientation,
|
|
512
|
+
submitGameCenterLeaderBoardScore: () => submitGameCenterLeaderBoardScore
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
// src/native-modules/setClipboardText.ts
|
|
367
516
|
async function setClipboardText(text) {
|
|
368
517
|
const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
|
|
369
518
|
if (permissionStatus === "denied") {
|
|
@@ -371,6 +520,8 @@ async function setClipboardText(text) {
|
|
|
371
520
|
}
|
|
372
521
|
return AppsInTossModule.setClipboardText({ text });
|
|
373
522
|
}
|
|
523
|
+
|
|
524
|
+
// src/native-modules/getClipboardText.ts
|
|
374
525
|
async function getClipboardText() {
|
|
375
526
|
const permissionStatus = await requestPermission({ name: "clipboard", access: "read" });
|
|
376
527
|
if (permissionStatus === "denied") {
|
|
@@ -378,18 +529,30 @@ async function getClipboardText() {
|
|
|
378
529
|
}
|
|
379
530
|
return AppsInTossModule.getClipboardText({});
|
|
380
531
|
}
|
|
381
|
-
|
|
532
|
+
|
|
533
|
+
// src/native-modules/fetchContacts.ts
|
|
534
|
+
async function fetchContacts({
|
|
535
|
+
size,
|
|
536
|
+
offset,
|
|
537
|
+
query
|
|
538
|
+
}) {
|
|
382
539
|
const permissionStatus = await requestPermission({ name: "contacts", access: "read" });
|
|
383
540
|
if (permissionStatus === "denied") {
|
|
384
541
|
throw new Error("\uC5F0\uB77D\uCC98 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
385
542
|
}
|
|
386
|
-
const contacts = await AppsInTossModule.fetchContacts(
|
|
543
|
+
const contacts = await AppsInTossModule.fetchContacts({
|
|
544
|
+
size,
|
|
545
|
+
offset,
|
|
546
|
+
query
|
|
547
|
+
});
|
|
387
548
|
return {
|
|
388
549
|
result: contacts.result,
|
|
389
550
|
nextOffset: contacts.nextOffset ?? null,
|
|
390
551
|
done: contacts.done
|
|
391
552
|
};
|
|
392
553
|
}
|
|
554
|
+
|
|
555
|
+
// src/native-modules/fetchAlbumPhotos.ts
|
|
393
556
|
var DEFAULT_MAX_COUNT = 10;
|
|
394
557
|
var DEFAULT_MAX_WIDTH = 1024;
|
|
395
558
|
async function fetchAlbumPhotos(options) {
|
|
@@ -404,6 +567,8 @@ async function fetchAlbumPhotos(options) {
|
|
|
404
567
|
});
|
|
405
568
|
return albumPhotos;
|
|
406
569
|
}
|
|
570
|
+
|
|
571
|
+
// src/native-modules/getCurrentLocation.ts
|
|
407
572
|
async function getCurrentLocation(options) {
|
|
408
573
|
const permissionStatus = await requestPermission({ name: "geolocation", access: "access" });
|
|
409
574
|
if (permissionStatus === "denied") {
|
|
@@ -412,6 +577,8 @@ async function getCurrentLocation(options) {
|
|
|
412
577
|
const position = await AppsInTossModule.getCurrentLocation(options);
|
|
413
578
|
return position;
|
|
414
579
|
}
|
|
580
|
+
|
|
581
|
+
// src/native-modules/openCamera.ts
|
|
415
582
|
async function openCamera(options) {
|
|
416
583
|
const permissionStatus = await requestPermission({ name: "camera", access: "access" });
|
|
417
584
|
if (permissionStatus === "denied") {
|
|
@@ -420,36 +587,18 @@ async function openCamera(options) {
|
|
|
420
587
|
const photo = await AppsInTossModule.openCamera({ base64: false, maxWidth: 1024, ...options });
|
|
421
588
|
return photo;
|
|
422
589
|
}
|
|
590
|
+
|
|
591
|
+
// src/native-modules/appLogin.ts
|
|
423
592
|
async function appLogin() {
|
|
424
593
|
return AppsInTossModule.appLogin({});
|
|
425
594
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
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({});
|
|
595
|
+
|
|
596
|
+
// src/native-modules/checkoutPayment.ts
|
|
597
|
+
async function checkoutPayment(options) {
|
|
598
|
+
return AppsInTossModule.checkoutPayment({ params: options });
|
|
446
599
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
setItem,
|
|
450
|
-
removeItem,
|
|
451
|
-
clearItems
|
|
452
|
-
};
|
|
600
|
+
|
|
601
|
+
// src/native-modules/eventLog.ts
|
|
453
602
|
function normalizeParams(params) {
|
|
454
603
|
return Object.fromEntries(
|
|
455
604
|
Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
|
|
@@ -477,6 +626,8 @@ async function eventLog(params) {
|
|
|
477
626
|
params: normalizeParams(params.params)
|
|
478
627
|
});
|
|
479
628
|
}
|
|
629
|
+
|
|
630
|
+
// src/native-modules/getTossShareLink.ts
|
|
480
631
|
async function getTossShareLink(path) {
|
|
481
632
|
const { shareLink } = await AppsInTossModule.getTossShareLink({});
|
|
482
633
|
const shareUrl = new URL(shareLink);
|
|
@@ -484,6 +635,8 @@ async function getTossShareLink(path) {
|
|
|
484
635
|
shareUrl.searchParams.set("af_dp", path);
|
|
485
636
|
return shareUrl.toString();
|
|
486
637
|
}
|
|
638
|
+
|
|
639
|
+
// src/native-modules/setDeviceOrientation.ts
|
|
487
640
|
async function setDeviceOrientation(options) {
|
|
488
641
|
const isSupported = isMinVersionSupported({
|
|
489
642
|
android: "5.215.0",
|
|
@@ -494,6 +647,8 @@ async function setDeviceOrientation(options) {
|
|
|
494
647
|
}
|
|
495
648
|
return AppsInTossModule.setDeviceOrientation(options);
|
|
496
649
|
}
|
|
650
|
+
|
|
651
|
+
// src/native-modules/saveBase64Data.ts
|
|
497
652
|
async function saveBase64Data(params) {
|
|
498
653
|
const isSupported = isMinVersionSupported({
|
|
499
654
|
android: "5.218.0",
|
|
@@ -505,812 +660,647 @@ async function saveBase64Data(params) {
|
|
|
505
660
|
}
|
|
506
661
|
await AppsInTossModule.saveBase64Data(params);
|
|
507
662
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
var
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
loadAdMobRewardedAd,
|
|
515
|
-
showAdMobRewardedAd
|
|
663
|
+
|
|
664
|
+
// src/constant/game-center.ts
|
|
665
|
+
var GAME_PROFILE_WEBVIEW_URL = "https://service.toss.im/game-center/profile";
|
|
666
|
+
var GAME_CENTER_MIN_VERSION = {
|
|
667
|
+
android: "5.221.0",
|
|
668
|
+
ios: "5.221.0"
|
|
516
669
|
};
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
if (Platform2.OS === "android") {
|
|
524
|
-
return replaceUnderbarToHypen(locale);
|
|
670
|
+
|
|
671
|
+
// src/native-modules/getGameCenterGameProfile.ts
|
|
672
|
+
async function getGameCenterGameProfile() {
|
|
673
|
+
const isSupported = isMinVersionSupported(GAME_CENTER_MIN_VERSION);
|
|
674
|
+
if (!isSupported) {
|
|
675
|
+
return;
|
|
525
676
|
}
|
|
526
|
-
return
|
|
677
|
+
return AppsInTossModule.getGameCenterGameProfile({});
|
|
527
678
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
}
|
|
531
|
-
function
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
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();
|
|
679
|
+
|
|
680
|
+
// src/native-modules/openGameCenterLeaderboard.ts
|
|
681
|
+
import { openURL } from "react-native-bedrock";
|
|
682
|
+
async function openGameCenterLeaderboard() {
|
|
683
|
+
if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
const url = new URL("servicetoss://game-center/leaderboard?_navbar=hide");
|
|
687
|
+
url.searchParams.set("appName", getAppName());
|
|
688
|
+
url.searchParams.set("referrer", `appsintoss.${getAppName()}`);
|
|
689
|
+
return openURL(url.toString());
|
|
548
690
|
}
|
|
549
|
-
|
|
550
|
-
|
|
691
|
+
|
|
692
|
+
// src/native-modules/submitGameCenterLeaderBoardScore.ts
|
|
693
|
+
async function submitGameCenterLeaderBoardScore(params) {
|
|
694
|
+
const isSupported = isMinVersionSupported(GAME_CENTER_MIN_VERSION);
|
|
695
|
+
if (!isSupported) {
|
|
551
696
|
return;
|
|
552
697
|
}
|
|
553
|
-
return
|
|
698
|
+
return AppsInTossModule.submitGameCenterLeaderBoardScore(params);
|
|
554
699
|
}
|
|
555
|
-
|
|
556
|
-
|
|
700
|
+
|
|
701
|
+
// src/core/registerApp.tsx
|
|
702
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
703
|
+
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
704
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
705
|
+
/* @__PURE__ */ jsx(AppEvent.StayTime, {}),
|
|
706
|
+
/* @__PURE__ */ jsx(AppEvent.Entry, {}),
|
|
707
|
+
/* @__PURE__ */ jsx(AppEvent.System, { ...initialProps }),
|
|
708
|
+
/* @__PURE__ */ jsx(Container, { ...initialProps, children: /* @__PURE__ */ jsx(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ jsx(TDSContainer, { ...initialProps, children }) }) })
|
|
709
|
+
] });
|
|
557
710
|
}
|
|
558
|
-
function
|
|
559
|
-
|
|
711
|
+
function TDSContainer({ children }) {
|
|
712
|
+
useAppsInTossBridge();
|
|
713
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
560
714
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
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
|
-
}
|
|
715
|
+
function registerApp(container, { context, analytics }) {
|
|
716
|
+
Analytics.init({
|
|
717
|
+
logger: (params) => void eventLog(params),
|
|
718
|
+
debug: analytics?.debug ?? __DEV__
|
|
584
719
|
});
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
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;
|
|
720
|
+
return Bedrock3.registerApp(AppsInTossContainer.bind(null, container), {
|
|
721
|
+
appName: getAppName(),
|
|
722
|
+
context,
|
|
723
|
+
router: {
|
|
724
|
+
screenContainer: Analytics.Screen,
|
|
725
|
+
defaultScreenOption: {
|
|
726
|
+
statusBarStyle: "dark"
|
|
727
|
+
}
|
|
608
728
|
}
|
|
609
|
-
}
|
|
729
|
+
});
|
|
610
730
|
}
|
|
611
|
-
|
|
612
|
-
// src/core/components/AppEvent.tsx
|
|
613
|
-
var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
|
|
614
|
-
function isPrivateScheme() {
|
|
731
|
+
function getAppName() {
|
|
615
732
|
try {
|
|
616
|
-
return
|
|
617
|
-
} catch {
|
|
618
|
-
|
|
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);
|
|
733
|
+
return global.__bedrock.app.name;
|
|
734
|
+
} catch (error) {
|
|
735
|
+
console.error("unexpected error occurred while getting app name");
|
|
736
|
+
throw error;
|
|
795
737
|
}
|
|
796
738
|
}
|
|
797
739
|
|
|
798
|
-
//
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
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
|
-
}
|
|
740
|
+
// src/core/index.ts
|
|
741
|
+
var AppsInToss = {
|
|
742
|
+
registerApp
|
|
743
|
+
};
|
|
806
744
|
|
|
807
|
-
//
|
|
808
|
-
|
|
809
|
-
|
|
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({});
|
|
745
|
+
// src/native-event-emitter/startUpdateLocation.ts
|
|
746
|
+
function startUpdateLocation(eventParams) {
|
|
747
|
+
return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
|
|
814
748
|
}
|
|
815
749
|
|
|
816
|
-
// ../../.yarn/
|
|
817
|
-
|
|
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
|
-
};
|
|
750
|
+
// ../../.yarn/cache/es-toolkit-npm-1.34.1-4cd6371dcb-aab6d07be3.zip/node_modules/es-toolkit/dist/function/noop.mjs
|
|
751
|
+
function noop() {
|
|
828
752
|
}
|
|
829
753
|
|
|
830
|
-
//
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
if (permissionStatus === "denied") {
|
|
836
|
-
throw new Error("\uC0AC\uC9C4\uCCA9 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
754
|
+
// src/native-modules/ads/googleAdMob.ts
|
|
755
|
+
function loadAdMobInterstitialAd(params) {
|
|
756
|
+
if (!loadAdMobInterstitialAd.isSupported()) {
|
|
757
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
758
|
+
return noop;
|
|
837
759
|
}
|
|
838
|
-
const
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
760
|
+
const { onEvent, onError, options } = params;
|
|
761
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobInterstitialAd", options, {
|
|
762
|
+
onAdClicked: () => {
|
|
763
|
+
onEvent({ type: "clicked" });
|
|
764
|
+
},
|
|
765
|
+
onAdDismissed: () => {
|
|
766
|
+
onEvent({ type: "dismissed" });
|
|
767
|
+
},
|
|
768
|
+
onAdFailedToShow: () => {
|
|
769
|
+
onEvent({ type: "failedToShow" });
|
|
770
|
+
},
|
|
771
|
+
onAdImpression: () => {
|
|
772
|
+
onEvent({ type: "impression" });
|
|
773
|
+
},
|
|
774
|
+
onAdShow: () => {
|
|
775
|
+
onEvent({ type: "show" });
|
|
776
|
+
},
|
|
777
|
+
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
778
|
+
onError
|
|
842
779
|
});
|
|
843
|
-
return
|
|
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
|
-
);
|
|
780
|
+
return unregisterCallbacks;
|
|
967
781
|
}
|
|
968
|
-
|
|
969
|
-
if (
|
|
970
|
-
|
|
971
|
-
|
|
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;
|
|
782
|
+
function showAdMobInterstitialAd(params) {
|
|
783
|
+
if (!showAdMobInterstitialAd.isSupported()) {
|
|
784
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
785
|
+
return noop;
|
|
983
786
|
}
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
787
|
+
const { onEvent, onError, options } = params;
|
|
788
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobInterstitialAd", options, {
|
|
789
|
+
onSuccess: () => onEvent({ type: "requested" }),
|
|
790
|
+
onError
|
|
988
791
|
});
|
|
792
|
+
return unregisterCallbacks;
|
|
989
793
|
}
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
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;
|
|
794
|
+
function loadAdMobRewardedAd(params) {
|
|
795
|
+
if (!loadAdMobRewardedAd.isSupported()) {
|
|
796
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
797
|
+
return noop;
|
|
1008
798
|
}
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
799
|
+
const { onEvent, onError, options } = params;
|
|
800
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobRewardedAd", options, {
|
|
801
|
+
onAdClicked: () => {
|
|
802
|
+
onEvent({ type: "clicked" });
|
|
803
|
+
},
|
|
804
|
+
onAdDismissed: () => {
|
|
805
|
+
onEvent({ type: "dismissed" });
|
|
806
|
+
},
|
|
807
|
+
onAdFailedToShow: () => {
|
|
808
|
+
onEvent({ type: "failedToShow" });
|
|
809
|
+
},
|
|
810
|
+
onAdImpression: () => {
|
|
811
|
+
onEvent({ type: "impression" });
|
|
812
|
+
},
|
|
813
|
+
onAdShow: () => {
|
|
814
|
+
onEvent({ type: "show" });
|
|
815
|
+
},
|
|
816
|
+
onUserEarnedReward: () => {
|
|
817
|
+
onEvent({ type: "userEarnedReward" });
|
|
818
|
+
},
|
|
819
|
+
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
820
|
+
onError
|
|
1022
821
|
});
|
|
1023
|
-
|
|
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;
|
|
822
|
+
return unregisterCallbacks;
|
|
1078
823
|
}
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
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);
|
|
824
|
+
function showAdMobRewardedAd(params) {
|
|
825
|
+
if (!showAdMobRewardedAd.isSupported()) {
|
|
826
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
827
|
+
return noop;
|
|
1134
828
|
}
|
|
1135
|
-
};
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
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
|
|
829
|
+
const { onEvent, onError, options } = params;
|
|
830
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobRewardedAd", options, {
|
|
831
|
+
onSuccess: () => onEvent({ type: "requested" }),
|
|
832
|
+
onError
|
|
1158
833
|
});
|
|
1159
|
-
|
|
1160
|
-
return unregisterAll;
|
|
834
|
+
return unregisterCallbacks;
|
|
1161
835
|
}
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
836
|
+
var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
|
|
837
|
+
var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
|
|
838
|
+
var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
|
|
839
|
+
var ENVIRONMENT = getOperationalEnvironment();
|
|
840
|
+
function createIsSupported() {
|
|
841
|
+
return () => {
|
|
842
|
+
if (ENVIRONMENT !== "toss") {
|
|
843
|
+
return false;
|
|
844
|
+
}
|
|
845
|
+
return isMinVersionSupported({
|
|
846
|
+
android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION,
|
|
847
|
+
ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION
|
|
848
|
+
});
|
|
1170
849
|
};
|
|
1171
|
-
return { callbackMap, unregisterAll };
|
|
1172
|
-
}
|
|
1173
|
-
function registerCallback2(callback, name = "unnamed") {
|
|
1174
|
-
const uniqueId = generateUUID2();
|
|
1175
|
-
const callbackId = `${uniqueId}__${name}`;
|
|
1176
|
-
INTERNAL__callbacks2.set(callbackId, callback);
|
|
1177
|
-
return callbackId;
|
|
1178
|
-
}
|
|
1179
|
-
function unregisterCallback2(id) {
|
|
1180
|
-
INTERNAL__callbacks2.delete(id);
|
|
1181
|
-
}
|
|
1182
|
-
function getCallbackIds2() {
|
|
1183
|
-
return Array.from(INTERNAL__callbacks2.keys());
|
|
1184
850
|
}
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
unregisterCallback: unregisterCallback2,
|
|
1190
|
-
getCallbackIds: getCallbackIds2
|
|
1191
|
-
};
|
|
1192
|
-
|
|
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();
|
|
1201
|
-
}
|
|
1202
|
-
remove() {
|
|
1203
|
-
}
|
|
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
|
-
};
|
|
1223
|
-
|
|
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
|
-
]);
|
|
851
|
+
loadAdMobInterstitialAd.isSupported = createIsSupported();
|
|
852
|
+
loadAdMobRewardedAd.isSupported = createIsSupported();
|
|
853
|
+
showAdMobInterstitialAd.isSupported = createIsSupported();
|
|
854
|
+
showAdMobRewardedAd.isSupported = createIsSupported();
|
|
1230
855
|
|
|
1231
|
-
//
|
|
1232
|
-
function
|
|
1233
|
-
return
|
|
856
|
+
// src/native-modules/getDeviceId.ts
|
|
857
|
+
function getDeviceId() {
|
|
858
|
+
return AppsInTossModule.deviceId;
|
|
1234
859
|
}
|
|
1235
860
|
|
|
1236
|
-
// src/
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1240
|
-
/* @__PURE__ */ jsx(AppEvent.Entry, {}),
|
|
1241
|
-
/* @__PURE__ */ jsx(AppEvent.System, { ...initialProps }),
|
|
1242
|
-
/* @__PURE__ */ jsx(Container, { ...initialProps, children: /* @__PURE__ */ jsx(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ jsx(TDSContainer, { ...initialProps, children }) }) })
|
|
1243
|
-
] });
|
|
861
|
+
// src/native-modules/getTossAppVersion.ts
|
|
862
|
+
function getTossAppVersion() {
|
|
863
|
+
return AppsInTossModule.tossAppVersion;
|
|
1244
864
|
}
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
865
|
+
|
|
866
|
+
// src/native-modules/iap.ts
|
|
867
|
+
async function createOneTimePurchaseOrder(params) {
|
|
868
|
+
const isSupported = isMinVersionSupported({
|
|
869
|
+
android: "5.219.0",
|
|
870
|
+
ios: "5.219.0"
|
|
871
|
+
});
|
|
872
|
+
if (!isSupported) {
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
return AppsInTossModule.iapCreateOneTimePurchaseOrder(params);
|
|
1248
876
|
}
|
|
1249
|
-
function
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
877
|
+
async function getProductItemList() {
|
|
878
|
+
const isSupported = isMinVersionSupported({
|
|
879
|
+
android: "5.219.0",
|
|
880
|
+
ios: "5.219.0"
|
|
1253
881
|
});
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
882
|
+
if (!isSupported) {
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
return AppsInTossModule.iapGetProductItemList({});
|
|
886
|
+
}
|
|
887
|
+
var IAP = {
|
|
888
|
+
createOneTimePurchaseOrder,
|
|
889
|
+
getProductItemList
|
|
890
|
+
};
|
|
891
|
+
|
|
892
|
+
// src/native-modules/storage.ts
|
|
893
|
+
function getItem(key) {
|
|
894
|
+
return AppsInTossModule.getStorageItem({ key });
|
|
895
|
+
}
|
|
896
|
+
function setItem(key, value) {
|
|
897
|
+
return AppsInTossModule.setStorageItem({
|
|
898
|
+
key,
|
|
899
|
+
value
|
|
1263
900
|
});
|
|
1264
901
|
}
|
|
1265
|
-
function
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
902
|
+
function removeItem(key) {
|
|
903
|
+
return AppsInTossModule.removeStorageItem({ key });
|
|
904
|
+
}
|
|
905
|
+
function clearItems() {
|
|
906
|
+
return AppsInTossModule.clearStorage({});
|
|
907
|
+
}
|
|
908
|
+
var Storage = {
|
|
909
|
+
getItem,
|
|
910
|
+
setItem,
|
|
911
|
+
removeItem,
|
|
912
|
+
clearItems
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
// src/native-modules/contactsViral.ts
|
|
916
|
+
function contactsViral(params) {
|
|
917
|
+
const isSupported = isMinVersionSupported({
|
|
918
|
+
android: "5.223.0",
|
|
919
|
+
ios: "5.223.0"
|
|
920
|
+
});
|
|
921
|
+
if (!isSupported) {
|
|
922
|
+
return () => {
|
|
923
|
+
};
|
|
1271
924
|
}
|
|
925
|
+
const { onEvent, onError, options } = params;
|
|
926
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("contactsViral", options, {
|
|
927
|
+
onRewardFromContactsViral: (result) => {
|
|
928
|
+
onEvent({ type: "sendViral", data: result });
|
|
929
|
+
},
|
|
930
|
+
onSuccess: (result) => {
|
|
931
|
+
onEvent({ type: "close", data: result });
|
|
932
|
+
},
|
|
933
|
+
onError
|
|
934
|
+
});
|
|
935
|
+
return unregisterCallbacks;
|
|
1272
936
|
}
|
|
1273
937
|
|
|
1274
|
-
// src/
|
|
1275
|
-
var
|
|
1276
|
-
|
|
938
|
+
// src/native-modules/index.ts
|
|
939
|
+
var TossPay = {
|
|
940
|
+
checkoutPayment
|
|
941
|
+
};
|
|
942
|
+
var GoogleAdMob = {
|
|
943
|
+
loadAdMobInterstitialAd,
|
|
944
|
+
showAdMobInterstitialAd,
|
|
945
|
+
loadAdMobRewardedAd,
|
|
946
|
+
showAdMobRewardedAd
|
|
1277
947
|
};
|
|
1278
948
|
|
|
1279
949
|
// 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";
|
|
1283
950
|
import {
|
|
951
|
+
ExternalWebViewScreen,
|
|
1284
952
|
PartnerWebViewScreen,
|
|
1285
|
-
|
|
953
|
+
tdsEvent,
|
|
954
|
+
usePartnerNavigation
|
|
1286
955
|
} from "@toss-design-system/react-native";
|
|
1287
956
|
import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2 } from "@toss-design-system/react-native/private";
|
|
1288
|
-
import { useCallback as
|
|
957
|
+
import { useCallback as useCallback5, useMemo as useMemo3 } from "react";
|
|
958
|
+
import { Platform as Platform7 } from "react-native";
|
|
959
|
+
import { getSchemeUri as getSchemeUri5, useBedrockEvent } from "react-native-bedrock";
|
|
960
|
+
import * as bedrockAsyncBridges from "react-native-bedrock/async-bridges";
|
|
961
|
+
import * as bedrockConstantBridges from "react-native-bedrock/constant-bridges";
|
|
1289
962
|
|
|
1290
963
|
// src/components/GameWebView.tsx
|
|
1291
964
|
import {
|
|
1292
965
|
WebView as PlainWebView
|
|
1293
|
-
} from "@
|
|
1294
|
-
import {
|
|
966
|
+
} from "@react-native-bedrock/native/react-native-webview";
|
|
967
|
+
import { useDialog as useDialog2 } from "@toss-design-system/react-native";
|
|
968
|
+
import { josa as josa2 } from "es-hangul";
|
|
969
|
+
import { forwardRef, useCallback as useCallback3, useEffect as useEffect5, useState as useState2 } from "react";
|
|
970
|
+
import { BackHandler, Platform as Platform6 } from "react-native";
|
|
971
|
+
import { closeView as closeView2, setIosSwipeGestureEnabled } from "react-native-bedrock";
|
|
972
|
+
|
|
973
|
+
// src/components/GameProfile.tsx
|
|
974
|
+
import { Loader } from "@toss-design-system/react-native";
|
|
975
|
+
import { useEffect as useEffect4 } from "react";
|
|
976
|
+
import { Pressable, View } from "react-native";
|
|
977
|
+
|
|
978
|
+
// src/hooks/useGameCenterProfile.ts
|
|
1295
979
|
import { useDialog } from "@toss-design-system/react-native";
|
|
1296
980
|
import { josa } from "es-hangul";
|
|
1297
|
-
import {
|
|
1298
|
-
import {
|
|
981
|
+
import { useCallback as useCallback2, useRef as useRef2, useState } from "react";
|
|
982
|
+
import { closeView, openURL as openURL3 } from "react-native-bedrock";
|
|
983
|
+
|
|
984
|
+
// src/components/GameProfileToast.tsx
|
|
985
|
+
import { Asset, Toast } from "@toss-design-system/react-native";
|
|
986
|
+
import { AdaptiveColorProvider, ColorPreferenceProvider, useOverlay } from "@toss-design-system/react-native/private";
|
|
987
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
988
|
+
var useGameProfileToast = () => {
|
|
989
|
+
const overlay = useOverlay();
|
|
990
|
+
const openGameProfileToast = (nickname, profileImageUri) => {
|
|
991
|
+
return new Promise((resolve) => {
|
|
992
|
+
overlay.open(({ isOpen, close, exit }) => {
|
|
993
|
+
return /* @__PURE__ */ jsx2(ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ jsx2(AdaptiveColorProvider, { children: /* @__PURE__ */ jsx2(
|
|
994
|
+
Toast,
|
|
995
|
+
{
|
|
996
|
+
open: isOpen,
|
|
997
|
+
onClose: () => {
|
|
998
|
+
resolve();
|
|
999
|
+
close();
|
|
1000
|
+
},
|
|
1001
|
+
onExited: exit,
|
|
1002
|
+
position: "top",
|
|
1003
|
+
text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
|
|
1004
|
+
icon: /* @__PURE__ */ jsx2(
|
|
1005
|
+
Asset.Image,
|
|
1006
|
+
{
|
|
1007
|
+
style: { borderRadius: 64, overflow: "hidden" },
|
|
1008
|
+
frameShape: Asset.frameShape.CleanW32,
|
|
1009
|
+
source: { uri: profileImageUri }
|
|
1010
|
+
}
|
|
1011
|
+
)
|
|
1012
|
+
}
|
|
1013
|
+
) }) });
|
|
1014
|
+
});
|
|
1015
|
+
});
|
|
1016
|
+
};
|
|
1017
|
+
return { openGameProfileToast };
|
|
1018
|
+
};
|
|
1019
|
+
|
|
1020
|
+
// src/utils/error.ts
|
|
1021
|
+
var DEFAULT_ERROR = {
|
|
1022
|
+
title: "\uC7A0\uC2DC \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD574\uC8FC\uC138\uC694",
|
|
1023
|
+
description: "\uBB38\uC81C\uAC00 \uACC4\uC18D\uB418\uBA74 \uD1A0\uC2A4 \uACE0\uAC1D\uC13C\uD130(1599-4905)\uB85C \uBB38\uC758\uD574\uC8FC\uC138\uC694."
|
|
1024
|
+
};
|
|
1025
|
+
|
|
1026
|
+
// src/utils/market.ts
|
|
1027
|
+
import { Platform as Platform2 } from "react-native";
|
|
1028
|
+
var PLAYSTORE_LINK = "https://play.google.com/store/apps/details?id=viva.republica.toss";
|
|
1029
|
+
var APPSTORE_LINK = "https://itunes.apple.com/app/id839333328";
|
|
1030
|
+
var getMarketLink = () => {
|
|
1031
|
+
return Platform2.OS === "android" ? PLAYSTORE_LINK : APPSTORE_LINK;
|
|
1032
|
+
};
|
|
1033
|
+
|
|
1034
|
+
// src/utils/openTransparentWebView.ts
|
|
1035
|
+
import { openURL as openURL2 } from "react-native-bedrock";
|
|
1036
|
+
|
|
1037
|
+
// src/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
|
|
1038
|
+
function onVisibilityChangedByTransparentServiceWeb(eventParams) {
|
|
1039
|
+
return appsInTossEvent.addEventListener("onVisibilityChangedByTransparentServiceWeb", eventParams);
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
// src/private.ts
|
|
1043
|
+
var INTERNAL__onVisibilityChangedByTransparentServiceWeb = onVisibilityChangedByTransparentServiceWeb;
|
|
1044
|
+
|
|
1045
|
+
// src/utils/openTransparentWebView.ts
|
|
1046
|
+
var openTransparentWebView = ({
|
|
1047
|
+
webUrl,
|
|
1048
|
+
cleanupWhenDismissed = true,
|
|
1049
|
+
onEvent,
|
|
1050
|
+
onError,
|
|
1051
|
+
callbackId = "fn",
|
|
1052
|
+
params
|
|
1053
|
+
}) => {
|
|
1054
|
+
const url = new URL("supertoss://transparent-service-web");
|
|
1055
|
+
url.searchParams.set("url", webUrl);
|
|
1056
|
+
url.searchParams.set("onVisibilityChangeCallback", callbackId);
|
|
1057
|
+
Object.entries(params ?? {}).forEach(([key, value]) => {
|
|
1058
|
+
url.searchParams.set(key, value);
|
|
1059
|
+
});
|
|
1060
|
+
const cleanup = INTERNAL__onVisibilityChangedByTransparentServiceWeb({
|
|
1061
|
+
options: { callbackId },
|
|
1062
|
+
onError: (error) => {
|
|
1063
|
+
onError(error);
|
|
1064
|
+
cleanup();
|
|
1065
|
+
},
|
|
1066
|
+
onEvent: (value) => {
|
|
1067
|
+
onEvent(value);
|
|
1068
|
+
if (cleanupWhenDismissed && value === true) {
|
|
1069
|
+
cleanup();
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
openURL2(url.toString());
|
|
1074
|
+
};
|
|
1075
|
+
|
|
1076
|
+
// src/hooks/useGameCenterProfile.ts
|
|
1077
|
+
var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
1078
|
+
const [profileData, setProfileData] = useState(void 0);
|
|
1079
|
+
const [isProfileDataLoading, setIsProfileDataLoading] = useState(true);
|
|
1080
|
+
const [isProfileDataRefetching, setIsProfileDataRefetching] = useState(false);
|
|
1081
|
+
const shouldShowLoadingOverlay = isProfileDataLoading && isReadyForProfileUI;
|
|
1082
|
+
const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
|
|
1083
|
+
const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
|
|
1084
|
+
const [isWebviewLoading, setIsWebviewLoading] = useState(false);
|
|
1085
|
+
const isCompletedProfileFlow = useRef2(false);
|
|
1086
|
+
const { openAlert, openConfirm } = useDialog();
|
|
1087
|
+
const { openGameProfileToast } = useGameProfileToast();
|
|
1088
|
+
const openErrorAlert = useCallback2(async () => {
|
|
1089
|
+
await openAlert({
|
|
1090
|
+
title: DEFAULT_ERROR.title,
|
|
1091
|
+
description: DEFAULT_ERROR.description
|
|
1092
|
+
});
|
|
1093
|
+
closeView();
|
|
1094
|
+
}, [openAlert]);
|
|
1095
|
+
const openProfileWebview = useCallback2(() => {
|
|
1096
|
+
if (isWebviewLoading) {
|
|
1097
|
+
return;
|
|
1098
|
+
}
|
|
1099
|
+
setIsWebviewLoading(true);
|
|
1100
|
+
openTransparentWebView({
|
|
1101
|
+
webUrl: `${GAME_PROFILE_WEBVIEW_URL}?appName=${getAppName()}&referrer=appsintoss.${getAppName()}`,
|
|
1102
|
+
onEvent: async (isClosedTransparentWebView) => {
|
|
1103
|
+
if (isClosedTransparentWebView) {
|
|
1104
|
+
try {
|
|
1105
|
+
setIsWebviewLoading(false);
|
|
1106
|
+
setIsProfileDataRefetching(true);
|
|
1107
|
+
const data = await getGameCenterGameProfile();
|
|
1108
|
+
setProfileData(data);
|
|
1109
|
+
setIsProfileDataRefetching(false);
|
|
1110
|
+
if (data?.statusCode === "SUCCESS") {
|
|
1111
|
+
openGameProfileToast(data.nickname, data.profileImageUri);
|
|
1112
|
+
}
|
|
1113
|
+
} catch (_) {
|
|
1114
|
+
setIsProfileDataRefetching(false);
|
|
1115
|
+
openErrorAlert();
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
},
|
|
1119
|
+
onError: () => {
|
|
1120
|
+
openErrorAlert();
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
}, [isWebviewLoading, openGameProfileToast, openErrorAlert]);
|
|
1124
|
+
const updateAppToSupportedMinVersion = useCallback2(async () => {
|
|
1125
|
+
const upddateConfirmDialogLabel = {
|
|
1126
|
+
title: `${josa(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
|
|
1127
|
+
\uC571\uC744 \uC5C5\uB370\uC774\uD2B8\uD574\uC8FC\uC138\uC694`,
|
|
1128
|
+
leftButton: "\uB2EB\uAE30",
|
|
1129
|
+
rightButton: "\uC5C5\uB370\uC774\uD2B8\uD558\uAE30"
|
|
1130
|
+
};
|
|
1131
|
+
const isConfirmed = await openConfirm({
|
|
1132
|
+
title: upddateConfirmDialogLabel.title,
|
|
1133
|
+
leftButton: upddateConfirmDialogLabel.leftButton,
|
|
1134
|
+
rightButton: upddateConfirmDialogLabel.rightButton,
|
|
1135
|
+
closeOnDimmerClick: true
|
|
1136
|
+
});
|
|
1137
|
+
if (!isConfirmed) {
|
|
1138
|
+
closeView();
|
|
1139
|
+
return;
|
|
1140
|
+
}
|
|
1141
|
+
const STORE_SCHEME = getMarketLink();
|
|
1142
|
+
openURL3(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
|
|
1143
|
+
}, [openConfirm]);
|
|
1144
|
+
return {
|
|
1145
|
+
profileData,
|
|
1146
|
+
isProfileDataLoading,
|
|
1147
|
+
isProfileDataRefetching,
|
|
1148
|
+
shouldShowLoadingOverlay,
|
|
1149
|
+
shouldShowProfileNotFoundOverlay,
|
|
1150
|
+
canShowBottomSheetOrToast,
|
|
1151
|
+
isCompletedProfileFlow,
|
|
1152
|
+
updateAppToSupportedMinVersion,
|
|
1153
|
+
setIsProfileDataLoading,
|
|
1154
|
+
openProfileWebview,
|
|
1155
|
+
setProfileData,
|
|
1156
|
+
openErrorAlert,
|
|
1157
|
+
openGameProfileToast
|
|
1158
|
+
};
|
|
1159
|
+
};
|
|
1160
|
+
|
|
1161
|
+
// src/utils/zIndex.ts
|
|
1162
|
+
var Z_INDEX = {
|
|
1163
|
+
/* 게임 프로필을 위한 overlay
|
|
1164
|
+
*/
|
|
1165
|
+
PROFILE_OVERLAY: 9998,
|
|
1166
|
+
// 게임을 종료할 수 있는 X 버튼
|
|
1167
|
+
CLOSE_BUTTON: 9999
|
|
1168
|
+
};
|
|
1169
|
+
|
|
1170
|
+
// src/components/GameProfile.tsx
|
|
1171
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1172
|
+
var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
1173
|
+
const {
|
|
1174
|
+
profileData,
|
|
1175
|
+
isProfileDataRefetching,
|
|
1176
|
+
shouldShowLoadingOverlay,
|
|
1177
|
+
shouldShowProfileNotFoundOverlay,
|
|
1178
|
+
canShowBottomSheetOrToast,
|
|
1179
|
+
isCompletedProfileFlow,
|
|
1180
|
+
openProfileWebview,
|
|
1181
|
+
updateAppToSupportedMinVersion,
|
|
1182
|
+
setIsProfileDataLoading,
|
|
1183
|
+
setProfileData,
|
|
1184
|
+
openErrorAlert,
|
|
1185
|
+
openGameProfileToast
|
|
1186
|
+
} = useGameCenterProfile(isReadyForProfileUI);
|
|
1187
|
+
useEffect4(() => {
|
|
1188
|
+
try {
|
|
1189
|
+
const getProfileData = async () => {
|
|
1190
|
+
const data = await getGameCenterGameProfile();
|
|
1191
|
+
setProfileData(data);
|
|
1192
|
+
setIsProfileDataLoading(false);
|
|
1193
|
+
};
|
|
1194
|
+
getProfileData();
|
|
1195
|
+
} catch (_) {
|
|
1196
|
+
openErrorAlert();
|
|
1197
|
+
setIsProfileDataLoading(false);
|
|
1198
|
+
}
|
|
1199
|
+
}, []);
|
|
1200
|
+
useEffect4(() => {
|
|
1201
|
+
const handleGameProfileFlow = async () => {
|
|
1202
|
+
if (!canShowBottomSheetOrToast) {
|
|
1203
|
+
return;
|
|
1204
|
+
}
|
|
1205
|
+
if (isCompletedProfileFlow.current) {
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
isCompletedProfileFlow.current = true;
|
|
1209
|
+
if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
|
|
1210
|
+
updateAppToSupportedMinVersion();
|
|
1211
|
+
return;
|
|
1212
|
+
}
|
|
1213
|
+
if (profileData?.statusCode === "SUCCESS") {
|
|
1214
|
+
openGameProfileToast(profileData.nickname, profileData.profileImageUri);
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
if (profileData?.statusCode === "PROFILE_NOT_FOUND") {
|
|
1218
|
+
openProfileWebview();
|
|
1219
|
+
}
|
|
1220
|
+
};
|
|
1221
|
+
handleGameProfileFlow();
|
|
1222
|
+
}, [
|
|
1223
|
+
canShowBottomSheetOrToast,
|
|
1224
|
+
isCompletedProfileFlow,
|
|
1225
|
+
openGameProfileToast,
|
|
1226
|
+
openProfileWebview,
|
|
1227
|
+
profileData,
|
|
1228
|
+
updateAppToSupportedMinVersion
|
|
1229
|
+
]);
|
|
1230
|
+
if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
|
|
1231
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
1232
|
+
/* @__PURE__ */ jsx3(View, { style: { flex: 1, position: "relative" }, children }),
|
|
1233
|
+
/* @__PURE__ */ jsx3(
|
|
1234
|
+
Pressable,
|
|
1235
|
+
{
|
|
1236
|
+
style: {
|
|
1237
|
+
...overlayStyle
|
|
1238
|
+
},
|
|
1239
|
+
onPress: () => {
|
|
1240
|
+
updateAppToSupportedMinVersion();
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
)
|
|
1244
|
+
] });
|
|
1245
|
+
}
|
|
1246
|
+
if (shouldShowLoadingOverlay || isProfileDataRefetching) {
|
|
1247
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
1248
|
+
/* @__PURE__ */ jsx3(View, { style: { flex: 1, position: "relative" }, children }),
|
|
1249
|
+
/* @__PURE__ */ jsx3(
|
|
1250
|
+
View,
|
|
1251
|
+
{
|
|
1252
|
+
style: {
|
|
1253
|
+
...overlayStyle,
|
|
1254
|
+
justifyContent: "center",
|
|
1255
|
+
alignItems: "center",
|
|
1256
|
+
backgroundColor: "rgba(0, 0, 0, 0.2)"
|
|
1257
|
+
},
|
|
1258
|
+
children: /* @__PURE__ */ jsx3(Loader, { size: "large", type: "light" })
|
|
1259
|
+
}
|
|
1260
|
+
)
|
|
1261
|
+
] });
|
|
1262
|
+
}
|
|
1263
|
+
if (shouldShowProfileNotFoundOverlay) {
|
|
1264
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
1265
|
+
/* @__PURE__ */ jsx3(View, { style: { flex: 1, position: "relative" }, children }),
|
|
1266
|
+
shouldShowProfileNotFoundOverlay && /* @__PURE__ */ jsx3(
|
|
1267
|
+
Pressable,
|
|
1268
|
+
{
|
|
1269
|
+
style: {
|
|
1270
|
+
...overlayStyle
|
|
1271
|
+
},
|
|
1272
|
+
onPress: () => {
|
|
1273
|
+
openProfileWebview();
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
)
|
|
1277
|
+
] });
|
|
1278
|
+
}
|
|
1279
|
+
return /* @__PURE__ */ jsx3(Fragment2, { children: /* @__PURE__ */ jsx3(View, { style: { flex: 1, position: "relative" }, children }) });
|
|
1280
|
+
};
|
|
1281
|
+
var overlayStyle = {
|
|
1282
|
+
position: "absolute",
|
|
1283
|
+
top: 0,
|
|
1284
|
+
left: 0,
|
|
1285
|
+
right: 0,
|
|
1286
|
+
bottom: 0,
|
|
1287
|
+
zIndex: Z_INDEX.PROFILE_OVERLAY
|
|
1288
|
+
};
|
|
1299
1289
|
|
|
1300
1290
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
1301
|
-
import { SvgXml } from "@
|
|
1291
|
+
import { SvgXml } from "@react-native-bedrock/native/react-native-svg";
|
|
1302
1292
|
import { PageNavbar } from "@toss-design-system/react-native";
|
|
1303
|
-
import { Platform as
|
|
1293
|
+
import { Platform as Platform5, TouchableOpacity, View as View3 } from "react-native";
|
|
1304
1294
|
|
|
1305
1295
|
// src/components/GameWebViewNavigationBar/HeaderRight.tsx
|
|
1306
|
-
import { StyleSheet, View } from "react-native";
|
|
1296
|
+
import { StyleSheet, View as View2 } from "react-native";
|
|
1307
1297
|
|
|
1308
1298
|
// src/components/GameWebViewNavigationBar/byPlatform.ts
|
|
1309
|
-
import { Platform as
|
|
1299
|
+
import { Platform as Platform3 } from "react-native";
|
|
1310
1300
|
function byPlatform({
|
|
1311
1301
|
...props
|
|
1312
1302
|
}) {
|
|
1313
|
-
return (props[
|
|
1303
|
+
return (props[Platform3.OS] ?? props.fallback)();
|
|
1314
1304
|
}
|
|
1315
1305
|
|
|
1316
1306
|
// src/components/GameWebViewNavigationBar/constants.ts
|
|
@@ -1318,18 +1308,18 @@ var RIGHT_MARGIN = 24;
|
|
|
1318
1308
|
var IOS_DEFAULT_MARGIN = 20;
|
|
1319
1309
|
|
|
1320
1310
|
// src/components/GameWebViewNavigationBar/HeaderRight.tsx
|
|
1321
|
-
import { jsx as
|
|
1311
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
1322
1312
|
function IOSHeaderRight(props) {
|
|
1323
|
-
return /* @__PURE__ */
|
|
1313
|
+
return /* @__PURE__ */ jsx4(View2, { style: styles.ios, ...props });
|
|
1324
1314
|
}
|
|
1325
1315
|
function AndroidHeaderRight(props) {
|
|
1326
|
-
return /* @__PURE__ */
|
|
1316
|
+
return /* @__PURE__ */ jsx4(View2, { style: styles.android, ...props });
|
|
1327
1317
|
}
|
|
1328
1318
|
function HeaderRight(props) {
|
|
1329
1319
|
return byPlatform({
|
|
1330
|
-
ios: () => /* @__PURE__ */
|
|
1331
|
-
android: () => /* @__PURE__ */
|
|
1332
|
-
fallback: () => /* @__PURE__ */
|
|
1320
|
+
ios: () => /* @__PURE__ */ jsx4(IOSHeaderRight, { ...props }),
|
|
1321
|
+
android: () => /* @__PURE__ */ jsx4(AndroidHeaderRight, { ...props }),
|
|
1322
|
+
fallback: () => /* @__PURE__ */ jsx4(IOSHeaderRight, { ...props })
|
|
1333
1323
|
});
|
|
1334
1324
|
}
|
|
1335
1325
|
var styles = StyleSheet.create({
|
|
@@ -1343,38 +1333,38 @@ var styles = StyleSheet.create({
|
|
|
1343
1333
|
});
|
|
1344
1334
|
|
|
1345
1335
|
// src/components/GameWebViewNavigationBar/useSafeAreaTop.ts
|
|
1346
|
-
import { useSafeAreaInsets } from "@
|
|
1347
|
-
import { Platform as
|
|
1336
|
+
import { useSafeAreaInsets } from "@react-native-bedrock/native/react-native-safe-area-context";
|
|
1337
|
+
import { Platform as Platform4 } from "react-native";
|
|
1348
1338
|
function useSafeAreaTop() {
|
|
1349
1339
|
const safeAreaInsets = useSafeAreaInsets();
|
|
1350
|
-
const hasDynamicIsland =
|
|
1340
|
+
const hasDynamicIsland = Platform4.OS === "ios" && safeAreaInsets.top > 50;
|
|
1351
1341
|
const safeAreaTop = hasDynamicIsland ? safeAreaInsets.top - 5 : safeAreaInsets.top;
|
|
1352
1342
|
return safeAreaTop;
|
|
1353
1343
|
}
|
|
1354
1344
|
|
|
1355
1345
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
1356
|
-
import { Fragment as
|
|
1346
|
+
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1357
1347
|
var originXML = '<svg fill="none" height="30" viewBox="0 0 30 30" width="30" xmlns="https://www.w3.org/2000/svg"><rect fill="#031832" fill-opacity=".46" height="30" rx="15" width="30"/><rect height="29.5" rx="14.75" stroke="#d9d9ff" stroke-opacity=".11" stroke-width=".5" width="29.5" x=".25" y=".25"/><path clip-rule="evenodd" d="m16.5119 15.0014 4.7092-4.7092c.0929-.0928.1666-.2031.2169-.32441.0503-.12134.0762-.25141.0762-.38276.0001-.13136-.0258-.26144-.076-.38281s-.1239-.23166-.2167-.32457c-.0929-.09291-.2031-.16662-.3245-.21692-.1213-.05031-.2514-.07622-.3827-.07626-.1314-.00004-.2615.0258-.3828.07603-.1214.05023-.2317.12388-.3246.21673l-4.7092 4.70997-4.71-4.70997c-.1897-.17718-.4408-.27373-.70034-.26927s-.5072.10959-.69069.2932c-.1835.1836-.28848.43132-.29279.69087-.00432.25954.09238.51057.26968.70017l4.71004 4.7092-4.71004 4.7092c-.1392.1401-.23385.3183-.27204.5121-.0382.1939-.01823.3946.05739.5771s.20351.3386.36759.4486.35702.169.55456.1697c.25583 0 .51164-.0975.70664-.2925l4.71-4.71 4.7092 4.71c.0927.093.2029.1668.3243.2172.1213.0504.2514.0763.3828.0763s.2614-.0259.3828-.0763c.1213-.0504.2315-.1242.3243-.2172.0929-.0929.1667-.2032.217-.3246s.0762-.2515.0762-.3829-.0259-.2616-.0762-.383-.1241-.2317-.217-.3245z" fill="#fdfdfe" fill-opacity=".89" fill-rule="evenodd"/></svg>';
|
|
1358
1348
|
function GameNavigationBar({ onClose }) {
|
|
1359
1349
|
const safeAreaTop = useSafeAreaTop();
|
|
1360
|
-
return /* @__PURE__ */
|
|
1361
|
-
/* @__PURE__ */
|
|
1362
|
-
/* @__PURE__ */
|
|
1363
|
-
|
|
1350
|
+
return /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
1351
|
+
/* @__PURE__ */ jsx5(PageNavbar, { preference: { type: "none" } }),
|
|
1352
|
+
/* @__PURE__ */ jsx5(
|
|
1353
|
+
View3,
|
|
1364
1354
|
{
|
|
1365
1355
|
style: {
|
|
1366
1356
|
width: "100%",
|
|
1367
|
-
height:
|
|
1357
|
+
height: Platform5.OS === "ios" ? 44 : 54,
|
|
1368
1358
|
flexDirection: "row",
|
|
1369
1359
|
alignItems: "center",
|
|
1370
1360
|
justifyContent: "flex-end",
|
|
1371
1361
|
position: "absolute",
|
|
1372
|
-
zIndex:
|
|
1362
|
+
zIndex: Z_INDEX.CLOSE_BUTTON,
|
|
1373
1363
|
marginTop: safeAreaTop,
|
|
1374
|
-
paddingRight:
|
|
1364
|
+
paddingRight: Platform5.OS === "ios" ? 10 : 8
|
|
1375
1365
|
},
|
|
1376
1366
|
pointerEvents: "box-none",
|
|
1377
|
-
children: /* @__PURE__ */
|
|
1367
|
+
children: /* @__PURE__ */ jsx5(HeaderRight, { children: /* @__PURE__ */ jsx5(
|
|
1378
1368
|
TouchableOpacity,
|
|
1379
1369
|
{
|
|
1380
1370
|
hitSlop: { left: 8, right: 8 },
|
|
@@ -1382,10 +1372,10 @@ function GameNavigationBar({ onClose }) {
|
|
|
1382
1372
|
accessible: true,
|
|
1383
1373
|
accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
|
|
1384
1374
|
style: {
|
|
1385
|
-
padding:
|
|
1375
|
+
padding: Platform5.OS === "ios" ? 7 : 9
|
|
1386
1376
|
},
|
|
1387
1377
|
onPress: onClose,
|
|
1388
|
-
children: /* @__PURE__ */
|
|
1378
|
+
children: /* @__PURE__ */ jsx5(SvgXml, { xml: originXML, width: 30, height: 30 })
|
|
1389
1379
|
}
|
|
1390
1380
|
) })
|
|
1391
1381
|
}
|
|
@@ -1394,23 +1384,26 @@ function GameNavigationBar({ onClose }) {
|
|
|
1394
1384
|
}
|
|
1395
1385
|
|
|
1396
1386
|
// src/components/GameWebView.tsx
|
|
1397
|
-
import { Fragment as
|
|
1387
|
+
import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1398
1388
|
var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
1399
|
-
const { openConfirm } =
|
|
1389
|
+
const { openConfirm } = useDialog2();
|
|
1400
1390
|
const { brandDisplayName } = getAppsInTossGlobals();
|
|
1401
|
-
const
|
|
1391
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
1392
|
+
const [isEntryMessageExited, setIsEntryMessageExited] = useState2(false);
|
|
1393
|
+
const handleClose = useCallback3(async () => {
|
|
1402
1394
|
const isConfirmed = await openConfirm({
|
|
1403
|
-
title: `${
|
|
1395
|
+
title: `${josa2(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
1404
1396
|
leftButton: "\uCDE8\uC18C",
|
|
1405
1397
|
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
1406
1398
|
closeOnDimmerClick: true
|
|
1407
1399
|
});
|
|
1408
1400
|
if (isConfirmed) {
|
|
1409
|
-
|
|
1401
|
+
captureExitLog(Date.now());
|
|
1402
|
+
closeView2();
|
|
1410
1403
|
}
|
|
1411
|
-
}, [brandDisplayName, openConfirm]);
|
|
1412
|
-
|
|
1413
|
-
if (
|
|
1404
|
+
}, [brandDisplayName, captureExitLog, openConfirm]);
|
|
1405
|
+
useEffect5(() => {
|
|
1406
|
+
if (Platform6.OS === "ios") {
|
|
1414
1407
|
setIosSwipeGestureEnabled({ isEnabled: false });
|
|
1415
1408
|
return () => {
|
|
1416
1409
|
setIosSwipeGestureEnabled({ isEnabled: true });
|
|
@@ -1418,7 +1411,7 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1418
1411
|
}
|
|
1419
1412
|
return;
|
|
1420
1413
|
}, []);
|
|
1421
|
-
|
|
1414
|
+
useEffect5(() => {
|
|
1422
1415
|
const backHandler = () => {
|
|
1423
1416
|
handleClose();
|
|
1424
1417
|
return true;
|
|
@@ -1428,14 +1421,21 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1428
1421
|
BackHandler.removeEventListener("hardwareBackPress", backHandler);
|
|
1429
1422
|
};
|
|
1430
1423
|
}, [handleClose]);
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1424
|
+
useEffect5(() => {
|
|
1425
|
+
appsInTossEvent.addEventListener("entryMessageExited", {
|
|
1426
|
+
onEvent: () => {
|
|
1427
|
+
setIsEntryMessageExited(true);
|
|
1428
|
+
}
|
|
1429
|
+
});
|
|
1430
|
+
}, []);
|
|
1431
|
+
return /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
1432
|
+
/* @__PURE__ */ jsx6(GameNavigationBar, { onClose: handleClose }),
|
|
1433
|
+
getOperationalEnvironment() === "toss" ? /* @__PURE__ */ jsx6(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ jsx6(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx6(PlainWebView, { ref, ...props })
|
|
1434
1434
|
] });
|
|
1435
1435
|
});
|
|
1436
1436
|
|
|
1437
1437
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1438
|
-
import { useCallback as
|
|
1438
|
+
import { useCallback as useCallback4, useMemo as useMemo2, useRef as useRef3 } from "react";
|
|
1439
1439
|
function serializeError(error) {
|
|
1440
1440
|
return JSON.stringify(error, (_, value) => {
|
|
1441
1441
|
if (value instanceof Error) {
|
|
@@ -1467,12 +1467,12 @@ function methodHandler({
|
|
|
1467
1467
|
};
|
|
1468
1468
|
wrappedFunc(...args).then((result) => {
|
|
1469
1469
|
injectJavaScript?.(`
|
|
1470
|
-
window.
|
|
1470
|
+
window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/resolve/${eventId}', ${JSON.stringify(result, null, 0)});
|
|
1471
1471
|
`);
|
|
1472
1472
|
}).catch((error) => {
|
|
1473
1473
|
const serializedError = serializeError(error);
|
|
1474
1474
|
injectJavaScript?.(`
|
|
1475
|
-
window.
|
|
1475
|
+
window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/reject/${eventId}', ${serializedError});
|
|
1476
1476
|
`);
|
|
1477
1477
|
});
|
|
1478
1478
|
}
|
|
@@ -1484,7 +1484,7 @@ function useBridgeHandler({
|
|
|
1484
1484
|
eventListenerMap,
|
|
1485
1485
|
injectedJavaScript: originalInjectedJavaScript
|
|
1486
1486
|
}) {
|
|
1487
|
-
const ref =
|
|
1487
|
+
const ref = useRef3(null);
|
|
1488
1488
|
const injectedJavaScript = useMemo2(
|
|
1489
1489
|
() => [
|
|
1490
1490
|
`window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
@@ -1503,15 +1503,15 @@ function useBridgeHandler({
|
|
|
1503
1503
|
);
|
|
1504
1504
|
const createHandleOnEvent = (functionName, eventId) => (response) => {
|
|
1505
1505
|
ref.current?.injectJavaScript(`
|
|
1506
|
-
window.
|
|
1506
|
+
window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onEvent/${eventId}', ${JSON.stringify(response, null, 0)});
|
|
1507
1507
|
`);
|
|
1508
1508
|
};
|
|
1509
1509
|
const createHandleOnError = (functionName, eventId) => (error) => {
|
|
1510
1510
|
ref.current?.injectJavaScript(`
|
|
1511
|
-
window.
|
|
1511
|
+
window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
|
|
1512
1512
|
`);
|
|
1513
1513
|
};
|
|
1514
|
-
const $onMessage =
|
|
1514
|
+
const $onMessage = useCallback4(
|
|
1515
1515
|
async (e) => {
|
|
1516
1516
|
onMessage?.(e);
|
|
1517
1517
|
const data = JSON.parse(e.nativeEvent.data);
|
|
@@ -1561,8 +1561,202 @@ function useBridgeHandler({
|
|
|
1561
1561
|
};
|
|
1562
1562
|
}
|
|
1563
1563
|
|
|
1564
|
+
// src/constant-bridges.ts
|
|
1565
|
+
var constant_bridges_exports = {};
|
|
1566
|
+
__export(constant_bridges_exports, {
|
|
1567
|
+
getDeviceId: () => getDeviceId,
|
|
1568
|
+
getOperationalEnvironment: () => getOperationalEnvironment,
|
|
1569
|
+
getTossAppVersion: () => getTossAppVersion
|
|
1570
|
+
});
|
|
1571
|
+
|
|
1572
|
+
// src/event-bridges.ts
|
|
1573
|
+
var event_bridges_exports = {};
|
|
1574
|
+
__export(event_bridges_exports, {
|
|
1575
|
+
contactsViral: () => contactsViral,
|
|
1576
|
+
startUpdateLocation: () => startUpdateLocation
|
|
1577
|
+
});
|
|
1578
|
+
|
|
1579
|
+
// src/hooks/useCreateUserAgent.ts
|
|
1580
|
+
import { useWindowDimensions } from "react-native";
|
|
1581
|
+
import { getPlatformOS } from "react-native-bedrock";
|
|
1582
|
+
var FontA11yCategory = {
|
|
1583
|
+
Large: "Large",
|
|
1584
|
+
xLarge: "xLarge",
|
|
1585
|
+
xxLarge: "xxLarge",
|
|
1586
|
+
xxxLarge: "xxxLarge",
|
|
1587
|
+
A11y_Medium: "A11y_Medium",
|
|
1588
|
+
A11y_Large: "A11y_Large",
|
|
1589
|
+
A11y_xLarge: "A11y_xLarge",
|
|
1590
|
+
A11y_xxLarge: "A11y_xxLarge",
|
|
1591
|
+
A11y_xxxLarge: "A11y_xxxLarge"
|
|
1592
|
+
};
|
|
1593
|
+
var androidFontScaleMap = {
|
|
1594
|
+
100: FontA11yCategory.Large,
|
|
1595
|
+
110: FontA11yCategory.xLarge,
|
|
1596
|
+
120: FontA11yCategory.xxLarge,
|
|
1597
|
+
135: FontA11yCategory.xxxLarge,
|
|
1598
|
+
160: FontA11yCategory.A11y_Medium,
|
|
1599
|
+
190: FontA11yCategory.A11y_Large,
|
|
1600
|
+
235: FontA11yCategory.A11y_xLarge,
|
|
1601
|
+
275: FontA11yCategory.A11y_xxLarge,
|
|
1602
|
+
310: FontA11yCategory.A11y_xxxLarge
|
|
1603
|
+
};
|
|
1604
|
+
var iosScaleToAndroidScale = {
|
|
1605
|
+
0.823: 100,
|
|
1606
|
+
0.882: 100,
|
|
1607
|
+
0.941: 100,
|
|
1608
|
+
1: 100,
|
|
1609
|
+
1.118: 110,
|
|
1610
|
+
1.235: 120,
|
|
1611
|
+
1.353: 135,
|
|
1612
|
+
1.786: 160,
|
|
1613
|
+
2.143: 190,
|
|
1614
|
+
2.643: 235,
|
|
1615
|
+
3.143: 275,
|
|
1616
|
+
3.571: 310
|
|
1617
|
+
};
|
|
1618
|
+
function convertToAndroidStyleScale(fontScale, platform) {
|
|
1619
|
+
if (platform === "android") {
|
|
1620
|
+
if (fontScale <= 1) {
|
|
1621
|
+
return 100;
|
|
1622
|
+
}
|
|
1623
|
+
const scaledValue = Math.round(fontScale * 100);
|
|
1624
|
+
const keys = Object.keys(androidFontScaleMap).map(Number).sort((a, b) => a - b);
|
|
1625
|
+
let closestKey = keys[0];
|
|
1626
|
+
let minDiff = Math.abs(scaledValue - closestKey);
|
|
1627
|
+
for (const key of keys) {
|
|
1628
|
+
const diff = Math.abs(scaledValue - key);
|
|
1629
|
+
if (diff < minDiff) {
|
|
1630
|
+
minDiff = diff;
|
|
1631
|
+
closestKey = key;
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
return closestKey;
|
|
1635
|
+
} else {
|
|
1636
|
+
const iosScales = Object.keys(iosScaleToAndroidScale).map(Number);
|
|
1637
|
+
let closestScale = iosScales[0];
|
|
1638
|
+
let minDiff = Math.abs(fontScale - closestScale);
|
|
1639
|
+
for (const scale of iosScales) {
|
|
1640
|
+
const diff = Math.abs(fontScale - scale);
|
|
1641
|
+
if (diff < minDiff) {
|
|
1642
|
+
minDiff = diff;
|
|
1643
|
+
closestScale = scale;
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
return iosScaleToAndroidScale[closestScale];
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
function mapIOSFontScaleToCategory(fontScale) {
|
|
1650
|
+
if (fontScale < 1) {
|
|
1651
|
+
return FontA11yCategory.Large;
|
|
1652
|
+
}
|
|
1653
|
+
if (Math.abs(fontScale - 1) < 0.05) {
|
|
1654
|
+
return FontA11yCategory.Large;
|
|
1655
|
+
}
|
|
1656
|
+
if (Math.abs(fontScale - 1.118) < 0.05) {
|
|
1657
|
+
return FontA11yCategory.xLarge;
|
|
1658
|
+
}
|
|
1659
|
+
if (Math.abs(fontScale - 1.235) < 0.05) {
|
|
1660
|
+
return FontA11yCategory.xxLarge;
|
|
1661
|
+
}
|
|
1662
|
+
if (Math.abs(fontScale - 1.353) < 0.05) {
|
|
1663
|
+
return FontA11yCategory.xxxLarge;
|
|
1664
|
+
}
|
|
1665
|
+
if (Math.abs(fontScale - 1.786) < 0.05) {
|
|
1666
|
+
return FontA11yCategory.A11y_Medium;
|
|
1667
|
+
}
|
|
1668
|
+
if (Math.abs(fontScale - 2.143) < 0.05) {
|
|
1669
|
+
return FontA11yCategory.A11y_Large;
|
|
1670
|
+
}
|
|
1671
|
+
if (Math.abs(fontScale - 2.643) < 0.05) {
|
|
1672
|
+
return FontA11yCategory.A11y_xLarge;
|
|
1673
|
+
}
|
|
1674
|
+
if (Math.abs(fontScale - 3.143) < 0.05) {
|
|
1675
|
+
return FontA11yCategory.A11y_xxLarge;
|
|
1676
|
+
}
|
|
1677
|
+
if (Math.abs(fontScale - 3.571) < 0.05) {
|
|
1678
|
+
return FontA11yCategory.A11y_xxxLarge;
|
|
1679
|
+
}
|
|
1680
|
+
return FontA11yCategory.Large;
|
|
1681
|
+
}
|
|
1682
|
+
function mapAndroidFontScaleToCategory(fontScale) {
|
|
1683
|
+
if (fontScale <= 1) {
|
|
1684
|
+
return androidFontScaleMap[100];
|
|
1685
|
+
}
|
|
1686
|
+
const scaledValue = Math.round(fontScale * 100);
|
|
1687
|
+
const keys = Object.keys(androidFontScaleMap).map(Number).sort((a, b) => a - b);
|
|
1688
|
+
if (keys.length === 0) {
|
|
1689
|
+
return androidFontScaleMap[100];
|
|
1690
|
+
}
|
|
1691
|
+
let closestKey = keys[0];
|
|
1692
|
+
let minDiff = Math.abs(scaledValue - closestKey);
|
|
1693
|
+
for (const key of keys) {
|
|
1694
|
+
const diff = Math.abs(scaledValue - key);
|
|
1695
|
+
if (diff < minDiff) {
|
|
1696
|
+
minDiff = diff;
|
|
1697
|
+
closestKey = key;
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
return androidFontScaleMap[closestKey];
|
|
1701
|
+
}
|
|
1702
|
+
function mapFontScaleToCategory(fontScale, platform) {
|
|
1703
|
+
return platform === "ios" ? mapIOSFontScaleToCategory(fontScale) : mapAndroidFontScaleToCategory(fontScale);
|
|
1704
|
+
}
|
|
1705
|
+
function useCreateUserAgent({
|
|
1706
|
+
batteryModePreference,
|
|
1707
|
+
colorPreference,
|
|
1708
|
+
locale,
|
|
1709
|
+
navbarPreference,
|
|
1710
|
+
pureSafeArea,
|
|
1711
|
+
safeArea,
|
|
1712
|
+
safeAreaBottomTransparency
|
|
1713
|
+
}) {
|
|
1714
|
+
const platform = getPlatformOS();
|
|
1715
|
+
const appVersion = getTossAppVersion();
|
|
1716
|
+
const { fontScale } = useWindowDimensions();
|
|
1717
|
+
const platformString = platform === "ios" ? "iPhone" : "Android";
|
|
1718
|
+
const fontA11y = mapFontScaleToCategory(fontScale, platform);
|
|
1719
|
+
const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
|
|
1720
|
+
return [
|
|
1721
|
+
`TossApp/${appVersion}`,
|
|
1722
|
+
batteryModePreference && `TossBatteryModePreference/${batteryModePreference}`,
|
|
1723
|
+
colorPreference && `TossColorPreference/${colorPreference}`,
|
|
1724
|
+
`TossFontAccessibility/${fontA11y}`,
|
|
1725
|
+
`TossFontScale/${normalizedFontScale}`,
|
|
1726
|
+
locale && `TossLocale/${locale}`,
|
|
1727
|
+
navbarPreference && `TossNavbarPreference/${navbarPreference}`,
|
|
1728
|
+
pureSafeArea && `TossPureSafeArea/${pureSafeArea}`,
|
|
1729
|
+
safeArea && `TossSafeArea/${safeArea}`,
|
|
1730
|
+
safeAreaBottomTransparency && `TossSafeAreaBottomTransparency/${safeAreaBottomTransparency}`,
|
|
1731
|
+
platformString
|
|
1732
|
+
].filter(Boolean).join(" ");
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
// src/hooks/useGeolocation.ts
|
|
1736
|
+
import { useState as useState3, useEffect as useEffect6 } from "react";
|
|
1737
|
+
import { useVisibility as useVisibility3 } from "react-native-bedrock";
|
|
1738
|
+
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1739
|
+
const isVisible = useVisibility3();
|
|
1740
|
+
const [location, setLocation] = useState3(null);
|
|
1741
|
+
useEffect6(() => {
|
|
1742
|
+
if (!isVisible) {
|
|
1743
|
+
return;
|
|
1744
|
+
}
|
|
1745
|
+
return startUpdateLocation({
|
|
1746
|
+
options: {
|
|
1747
|
+
accuracy,
|
|
1748
|
+
distanceInterval,
|
|
1749
|
+
timeInterval
|
|
1750
|
+
},
|
|
1751
|
+
onEvent: setLocation,
|
|
1752
|
+
onError: console.error
|
|
1753
|
+
});
|
|
1754
|
+
}, [accuracy, distanceInterval, timeInterval, isVisible]);
|
|
1755
|
+
return location;
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1564
1758
|
// src/utils/log.ts
|
|
1565
|
-
import { getSchemeUri as
|
|
1759
|
+
import { getSchemeUri as getSchemeUri4 } from "react-native-bedrock";
|
|
1566
1760
|
|
|
1567
1761
|
// src/utils/extractDateFromUUIDv7.ts
|
|
1568
1762
|
var extractDateFromUUIDv7 = (uuid) => {
|
|
@@ -1588,7 +1782,7 @@ var getGroupId = (url) => {
|
|
|
1588
1782
|
};
|
|
1589
1783
|
var getReferrer = () => {
|
|
1590
1784
|
try {
|
|
1591
|
-
const referrer = new URL(
|
|
1785
|
+
const referrer = new URL(getSchemeUri4());
|
|
1592
1786
|
return referrer.searchParams.get("referrer");
|
|
1593
1787
|
} catch {
|
|
1594
1788
|
return "";
|
|
@@ -1610,9 +1804,9 @@ var trackScreen = (url) => {
|
|
|
1610
1804
|
};
|
|
1611
1805
|
|
|
1612
1806
|
// src/components/WebView.tsx
|
|
1613
|
-
import { jsx as
|
|
1807
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1614
1808
|
var appsInTossGlobals = getAppsInTossGlobals();
|
|
1615
|
-
var operationalEnvironment =
|
|
1809
|
+
var operationalEnvironment = getOperationalEnvironment();
|
|
1616
1810
|
var TYPES = ["partner", "external", "game"];
|
|
1617
1811
|
var WEBVIEW_TYPES = {
|
|
1618
1812
|
partner: PartnerWebViewScreen,
|
|
@@ -1621,7 +1815,7 @@ var WEBVIEW_TYPES = {
|
|
|
1621
1815
|
};
|
|
1622
1816
|
function mergeSchemeQueryParamsInto(url) {
|
|
1623
1817
|
const baseUrl = new URL(url);
|
|
1624
|
-
const schemeUrl = new URL(
|
|
1818
|
+
const schemeUrl = new URL(getSchemeUri5());
|
|
1625
1819
|
baseUrl.pathname = schemeUrl.pathname;
|
|
1626
1820
|
for (const [key, value] of schemeUrl.searchParams.entries()) {
|
|
1627
1821
|
baseUrl.searchParams.set(key, value);
|
|
@@ -1645,16 +1839,22 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1645
1839
|
if (!TYPES.includes(type)) {
|
|
1646
1840
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
1647
1841
|
}
|
|
1648
|
-
const
|
|
1842
|
+
const bedrockEvent = useBedrockEvent();
|
|
1649
1843
|
const uri = useMemo3(() => getWebViewUri(local), [local]);
|
|
1650
1844
|
const top = useSafeAreaTop2();
|
|
1651
1845
|
const bottom = useSafeAreaBottom();
|
|
1846
|
+
const global2 = getAppsInTossGlobals();
|
|
1847
|
+
const partner = usePartnerNavigation();
|
|
1652
1848
|
const handler = useBridgeHandler({
|
|
1653
1849
|
onMessage,
|
|
1654
1850
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1655
1851
|
eventListenerMap: {
|
|
1656
1852
|
...event_bridges_exports,
|
|
1657
|
-
|
|
1853
|
+
navigationAccessoryEvent: ({ onEvent, onError }) => tdsEvent.addEventListener("navigationAccessoryEvent", {
|
|
1854
|
+
onEvent,
|
|
1855
|
+
onError
|
|
1856
|
+
}),
|
|
1857
|
+
backEvent: ({ onEvent, onError, options }) => bedrockEvent.addEventListener("backEvent", { onEvent, onError, options }),
|
|
1658
1858
|
entryMessageExited: ({ onEvent, onError }) => appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
1659
1859
|
updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
1660
1860
|
/** @internal */
|
|
@@ -1666,10 +1866,11 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1666
1866
|
showAdMobRewardedAd: GoogleAdMob.showAdMobRewardedAd
|
|
1667
1867
|
},
|
|
1668
1868
|
constantHandlerMap: {
|
|
1669
|
-
...
|
|
1869
|
+
...bedrockConstantBridges,
|
|
1670
1870
|
...constant_bridges_exports,
|
|
1671
1871
|
getSafeAreaTop: () => top,
|
|
1672
1872
|
getSafeAreaBottom: () => bottom,
|
|
1873
|
+
...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
|
|
1673
1874
|
/** AdMob */
|
|
1674
1875
|
loadAdMobInterstitialAd_isSupported: GoogleAdMob.loadAdMobInterstitialAd.isSupported,
|
|
1675
1876
|
showAdMobInterstitialAd_isSupported: GoogleAdMob.showAdMobInterstitialAd.isSupported,
|
|
@@ -1679,15 +1880,20 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1679
1880
|
getDeploymentId: env.getDeploymentId
|
|
1680
1881
|
},
|
|
1681
1882
|
asyncHandlerMap: {
|
|
1682
|
-
...
|
|
1883
|
+
...bedrockAsyncBridges,
|
|
1683
1884
|
...async_bridges_exports,
|
|
1885
|
+
addAccessoryButton: async (params) => partner.addAccessoryButton(params),
|
|
1886
|
+
removeAccessoryButton: async () => partner.removeAccessoryButton(),
|
|
1684
1887
|
/** internal */
|
|
1685
1888
|
openPermissionDialog: AppsInTossModule.openPermissionDialog,
|
|
1686
1889
|
/** Storage */
|
|
1687
1890
|
getStorageItem: Storage.getItem,
|
|
1688
1891
|
setStorageItem: Storage.setItem,
|
|
1689
1892
|
removeStorageItem: Storage.removeItem,
|
|
1690
|
-
clearItems: Storage.clearItems
|
|
1893
|
+
clearItems: Storage.clearItems,
|
|
1894
|
+
/** IAP */
|
|
1895
|
+
iapCreateOneTimePurchaseOrder: IAP.createOneTimePurchaseOrder,
|
|
1896
|
+
iapGetProductItemList: IAP.getProductItemList
|
|
1691
1897
|
}
|
|
1692
1898
|
});
|
|
1693
1899
|
const baseProps = useMemo3(() => {
|
|
@@ -1697,9 +1903,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1697
1903
|
header: {
|
|
1698
1904
|
..."header" in props ? props.header : {},
|
|
1699
1905
|
icon: toIcon(ensureValue(appsInTossGlobals.brandIcon, "icon")),
|
|
1700
|
-
title: ensureValue(appsInTossGlobals.brandDisplayName, "displayName")
|
|
1701
|
-
rightButtons: void 0
|
|
1702
|
-
// TODO: onClick 이벤트를 받아야 하기에 런타임에서 설정 받아야 함
|
|
1906
|
+
title: ensureValue(appsInTossGlobals.brandDisplayName, "displayName")
|
|
1703
1907
|
}
|
|
1704
1908
|
};
|
|
1705
1909
|
return headerOnlyProp;
|
|
@@ -1721,25 +1925,36 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1721
1925
|
}, [type, props]);
|
|
1722
1926
|
const BaseWebView = WEBVIEW_TYPES[type];
|
|
1723
1927
|
const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
|
|
1724
|
-
const handleNavigationStateChange =
|
|
1928
|
+
const handleNavigationStateChange = useCallback5((event) => {
|
|
1725
1929
|
if (event.url) {
|
|
1726
1930
|
trackScreen(event.url);
|
|
1727
1931
|
}
|
|
1728
1932
|
}, []);
|
|
1729
|
-
|
|
1933
|
+
const userAgent = useCreateUserAgent({
|
|
1934
|
+
colorPreference: "light"
|
|
1935
|
+
});
|
|
1936
|
+
return /* @__PURE__ */ jsx7(
|
|
1730
1937
|
BaseWebView,
|
|
1731
1938
|
{
|
|
1732
1939
|
ref: handler.ref,
|
|
1733
1940
|
...props,
|
|
1734
1941
|
...baseProps,
|
|
1735
|
-
source: {
|
|
1942
|
+
source: {
|
|
1943
|
+
uri,
|
|
1944
|
+
// NOTE: https://github.com/react-native-webview/react-native-webview/pull/3133
|
|
1945
|
+
headers: {
|
|
1946
|
+
"User-Agent": userAgent
|
|
1947
|
+
}
|
|
1948
|
+
},
|
|
1949
|
+
userAgent: Platform7.OS === "ios" ? userAgent : void 0,
|
|
1736
1950
|
sharedCookiesEnabled: true,
|
|
1737
1951
|
webviewDebuggingEnabled: webViewDebuggingEnabled,
|
|
1738
1952
|
thirdPartyCookiesEnabled: true,
|
|
1739
1953
|
onMessage: handler.onMessage,
|
|
1740
1954
|
onNavigationStateChange: handleNavigationStateChange,
|
|
1741
1955
|
injectedJavaScript: handler.injectedJavaScript,
|
|
1742
|
-
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
|
|
1956
|
+
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
|
|
1957
|
+
decelerationRate: Platform7.OS === "ios" ? 1 : void 0
|
|
1743
1958
|
}
|
|
1744
1959
|
);
|
|
1745
1960
|
}
|
|
@@ -1750,28 +1965,16 @@ function ensureValue(value, name) {
|
|
|
1750
1965
|
return value;
|
|
1751
1966
|
}
|
|
1752
1967
|
|
|
1753
|
-
// src/
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
return startUpdateLocation({
|
|
1764
|
-
options: {
|
|
1765
|
-
accuracy,
|
|
1766
|
-
distanceInterval,
|
|
1767
|
-
timeInterval
|
|
1768
|
-
},
|
|
1769
|
-
onEvent: setLocation,
|
|
1770
|
-
onError: console.error
|
|
1771
|
-
});
|
|
1772
|
-
}, [accuracy, distanceInterval, timeInterval, isVisible]);
|
|
1773
|
-
return location;
|
|
1774
|
-
}
|
|
1968
|
+
// src/types.ts
|
|
1969
|
+
var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
1970
|
+
Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
|
|
1971
|
+
Accuracy3[Accuracy3["Low"] = 2] = "Low";
|
|
1972
|
+
Accuracy3[Accuracy3["Balanced"] = 3] = "Balanced";
|
|
1973
|
+
Accuracy3[Accuracy3["High"] = 4] = "High";
|
|
1974
|
+
Accuracy3[Accuracy3["Highest"] = 5] = "Highest";
|
|
1975
|
+
Accuracy3[Accuracy3["BestForNavigation"] = 6] = "BestForNavigation";
|
|
1976
|
+
return Accuracy3;
|
|
1977
|
+
})(Accuracy2 || {});
|
|
1775
1978
|
|
|
1776
1979
|
// src/index.ts
|
|
1777
1980
|
export * from "@apps-in-toss/analytics";
|
|
@@ -1785,43 +1988,34 @@ export {
|
|
|
1785
1988
|
Accuracy2 as Accuracy,
|
|
1786
1989
|
Analytics2 as Analytics,
|
|
1787
1990
|
AppsInToss,
|
|
1788
|
-
AppsInTossModule,
|
|
1789
|
-
BedrockCoreModule,
|
|
1790
|
-
BedrockModule,
|
|
1791
1991
|
GoogleAdMob,
|
|
1792
|
-
|
|
1793
|
-
|
|
1992
|
+
IAP,
|
|
1993
|
+
INTERNAL__onVisibilityChangedByTransparentServiceWeb,
|
|
1794
1994
|
Storage,
|
|
1795
1995
|
TossPay,
|
|
1796
1996
|
WebView,
|
|
1797
1997
|
appLogin,
|
|
1798
1998
|
appsInTossEvent,
|
|
1799
|
-
|
|
1999
|
+
contactsViral,
|
|
1800
2000
|
env,
|
|
1801
2001
|
eventLog,
|
|
1802
2002
|
fetchAlbumPhotos,
|
|
1803
2003
|
fetchContacts,
|
|
1804
|
-
generateHapticFeedback,
|
|
1805
2004
|
getClipboardText,
|
|
1806
2005
|
getCurrentLocation,
|
|
1807
2006
|
getDeviceId,
|
|
1808
|
-
|
|
1809
|
-
getNetworkStatus,
|
|
2007
|
+
getGameCenterGameProfile,
|
|
1810
2008
|
getOperationalEnvironment,
|
|
1811
|
-
getPlatformOS,
|
|
1812
|
-
getSchemeUri,
|
|
1813
2009
|
getTossAppVersion,
|
|
1814
2010
|
getTossShareLink,
|
|
1815
2011
|
isMinVersionSupported,
|
|
1816
2012
|
openCamera,
|
|
1817
|
-
|
|
2013
|
+
openGameCenterLeaderboard,
|
|
1818
2014
|
saveBase64Data,
|
|
1819
2015
|
setClipboardText,
|
|
1820
2016
|
setDeviceOrientation,
|
|
1821
|
-
setIosSwipeGestureEnabled,
|
|
1822
|
-
setScreenAwakeMode,
|
|
1823
|
-
setSecureScreen,
|
|
1824
|
-
share,
|
|
1825
2017
|
startUpdateLocation,
|
|
2018
|
+
submitGameCenterLeaderBoardScore,
|
|
2019
|
+
useCreateUserAgent,
|
|
1826
2020
|
useGeolocation
|
|
1827
2021
|
};
|