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