@apps-in-toss/framework 0.0.40 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bridge-meta.d.ts +1 -0
- package/dist/bridge-meta.js +5 -0
- package/dist/index.cjs +254 -1015
- package/dist/index.d.cts +7 -2269
- package/dist/index.d.ts +7 -2269
- package/dist/index.js +162 -904
- package/dist/internal.cjs +24 -0
- package/dist/internal.d.cts +1 -0
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +2 -0
- 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 -26
- package/src/bridge-entry.ts +4 -0
- package/src/async-bridges.ts +0 -15
- package/src/constant-bridges.ts +0 -3
- package/src/event-bridges.ts +0 -2
package/dist/index.cjs
CHANGED
|
@@ -31,37 +31,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
// src/index.ts
|
|
32
32
|
var src_exports = {};
|
|
33
33
|
__export(src_exports, {
|
|
34
|
-
Accuracy: () => Accuracy2,
|
|
35
34
|
Analytics: () => Analytics2,
|
|
36
35
|
AppsInToss: () => AppsInToss,
|
|
37
|
-
GoogleAdMob: () => GoogleAdMob,
|
|
38
|
-
IAP: () => IAP,
|
|
39
36
|
INTERNAL__onVisibilityChangedByTransparentServiceWeb: () => INTERNAL__onVisibilityChangedByTransparentServiceWeb,
|
|
40
|
-
Storage: () => Storage,
|
|
41
|
-
TossPay: () => TossPay,
|
|
42
37
|
WebView: () => WebView,
|
|
43
|
-
appLogin: () => appLogin,
|
|
44
|
-
appsInTossEvent: () => appsInTossEvent,
|
|
45
|
-
contactsViral: () => contactsViral,
|
|
46
38
|
env: () => env,
|
|
47
|
-
eventLog: () => eventLog,
|
|
48
|
-
fetchAlbumPhotos: () => fetchAlbumPhotos,
|
|
49
|
-
fetchContacts: () => fetchContacts,
|
|
50
|
-
getClipboardText: () => getClipboardText,
|
|
51
|
-
getCurrentLocation: () => getCurrentLocation,
|
|
52
|
-
getDeviceId: () => getDeviceId,
|
|
53
|
-
getGameCenterGameProfile: () => getGameCenterGameProfile,
|
|
54
|
-
getOperationalEnvironment: () => getOperationalEnvironment,
|
|
55
|
-
getTossAppVersion: () => getTossAppVersion,
|
|
56
|
-
getTossShareLink: () => getTossShareLink,
|
|
57
|
-
isMinVersionSupported: () => isMinVersionSupported,
|
|
58
|
-
openCamera: () => openCamera,
|
|
59
|
-
openGameCenterLeaderboard: () => openGameCenterLeaderboard,
|
|
60
|
-
saveBase64Data: () => saveBase64Data,
|
|
61
|
-
setClipboardText: () => setClipboardText,
|
|
62
|
-
setDeviceOrientation: () => setDeviceOrientation,
|
|
63
|
-
startUpdateLocation: () => startUpdateLocation,
|
|
64
|
-
submitGameCenterLeaderBoardScore: () => submitGameCenterLeaderBoardScore,
|
|
65
39
|
useCreateUserAgent: () => useCreateUserAgent,
|
|
66
40
|
useGeolocation: () => useGeolocation
|
|
67
41
|
});
|
|
@@ -70,12 +44,14 @@ var import_analytics2 = require("@apps-in-toss/analytics");
|
|
|
70
44
|
|
|
71
45
|
// src/core/registerApp.tsx
|
|
72
46
|
var import_analytics = require("@apps-in-toss/analytics");
|
|
73
|
-
var
|
|
74
|
-
var
|
|
47
|
+
var import_native_modules4 = require("@apps-in-toss/native-modules");
|
|
48
|
+
var import_react_native7 = require("@granite-js/react-native");
|
|
49
|
+
var import_react_native8 = require("@toss-design-system/react-native");
|
|
75
50
|
|
|
76
51
|
// src/core/components/AppEvent.tsx
|
|
52
|
+
var import_native_modules2 = require("@apps-in-toss/native-modules");
|
|
53
|
+
var import_react_native4 = require("@granite-js/react-native");
|
|
77
54
|
var import_react3 = require("react");
|
|
78
|
-
var import_react_native_bedrock4 = require("react-native-bedrock");
|
|
79
55
|
|
|
80
56
|
// src/env.ts
|
|
81
57
|
var env = {
|
|
@@ -83,148 +59,28 @@ var env = {
|
|
|
83
59
|
};
|
|
84
60
|
|
|
85
61
|
// src/hooks/useCaptureExitLog.ts
|
|
62
|
+
var import_native_modules = require("@apps-in-toss/native-modules");
|
|
63
|
+
var import_react_native3 = require("@granite-js/react-native");
|
|
86
64
|
var import_react2 = require("react");
|
|
87
|
-
var import_react_native_bedrock3 = require("react-native-bedrock");
|
|
88
65
|
|
|
89
66
|
// src/core/hooks/useReferrer.ts
|
|
67
|
+
var import_react_native = require("@granite-js/react-native");
|
|
90
68
|
var import_react = require("react");
|
|
91
|
-
var import_react_native_bedrock = require("react-native-bedrock");
|
|
92
69
|
function useReferrer() {
|
|
93
70
|
return (0, import_react.useMemo)(() => {
|
|
94
71
|
try {
|
|
95
|
-
return new URL((0,
|
|
72
|
+
return new URL((0, import_react_native.getSchemeUri)()).searchParams.get("referrer");
|
|
96
73
|
} catch {
|
|
97
74
|
return null;
|
|
98
75
|
}
|
|
99
76
|
}, []);
|
|
100
77
|
}
|
|
101
78
|
|
|
102
|
-
// src/native-modules/tossCore.ts
|
|
103
|
-
var import_react_native3 = require("react-native");
|
|
104
|
-
|
|
105
|
-
// src/native-modules/AppsInTossModule.ts
|
|
106
|
-
var import_react_native = require("react-native");
|
|
107
|
-
var AppsInTossModuleInstance = import_react_native.NativeModules.AppsInTossModule;
|
|
108
|
-
var AppsInTossModule = AppsInTossModuleInstance;
|
|
109
|
-
|
|
110
|
-
// src/native-modules/getOperationalEnvironment.ts
|
|
111
|
-
function getOperationalEnvironment() {
|
|
112
|
-
return AppsInTossModule.operationalEnvironment;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// src/native-modules/isMinVersionSupported.ts
|
|
116
|
-
var import_react_native2 = require("react-native");
|
|
117
|
-
|
|
118
|
-
// src/utils/compareVersion.ts
|
|
119
|
-
var SEMVER_REGEX = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
|
|
120
|
-
var isWildcard = (val) => ["*", "x", "X"].includes(val);
|
|
121
|
-
var tryParse = (val) => {
|
|
122
|
-
const num = parseInt(val, 10);
|
|
123
|
-
return isNaN(num) ? val : num;
|
|
124
|
-
};
|
|
125
|
-
var coerceTypes = (a, b) => {
|
|
126
|
-
return typeof a === typeof b ? [a, b] : [String(a), String(b)];
|
|
127
|
-
};
|
|
128
|
-
var compareValues = (a, b) => {
|
|
129
|
-
if (isWildcard(a) || isWildcard(b)) {
|
|
130
|
-
return 0;
|
|
131
|
-
}
|
|
132
|
-
const [aVal, bVal] = coerceTypes(tryParse(a), tryParse(b));
|
|
133
|
-
if (aVal > bVal) {
|
|
134
|
-
return 1;
|
|
135
|
-
}
|
|
136
|
-
if (aVal < bVal) {
|
|
137
|
-
return -1;
|
|
138
|
-
}
|
|
139
|
-
return 0;
|
|
140
|
-
};
|
|
141
|
-
var parseVersion = (version) => {
|
|
142
|
-
if (typeof version !== "string") {
|
|
143
|
-
throw new TypeError("Invalid argument: expected a string");
|
|
144
|
-
}
|
|
145
|
-
const match = version.match(SEMVER_REGEX);
|
|
146
|
-
if (!match) {
|
|
147
|
-
throw new Error(`Invalid semver: '${version}'`);
|
|
148
|
-
}
|
|
149
|
-
const [, major, minor, patch, build, preRelease] = match;
|
|
150
|
-
return [major, minor, patch, build, preRelease];
|
|
151
|
-
};
|
|
152
|
-
var compareSegments = (a, b) => {
|
|
153
|
-
const maxLength = Math.max(a.length, b.length);
|
|
154
|
-
for (let i = 0; i < maxLength; i++) {
|
|
155
|
-
const segA = a[i] ?? "0";
|
|
156
|
-
const segB = b[i] ?? "0";
|
|
157
|
-
const result = compareValues(segA, segB);
|
|
158
|
-
if (result !== 0) {
|
|
159
|
-
return result;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return 0;
|
|
163
|
-
};
|
|
164
|
-
var compareVersions = (v1, v2) => {
|
|
165
|
-
const seg1 = parseVersion(v1);
|
|
166
|
-
const seg2 = parseVersion(v2);
|
|
167
|
-
const preRelease1 = seg1.pop();
|
|
168
|
-
const preRelease2 = seg2.pop();
|
|
169
|
-
const mainCompare = compareSegments(seg1, seg2);
|
|
170
|
-
if (mainCompare !== 0) {
|
|
171
|
-
return mainCompare;
|
|
172
|
-
}
|
|
173
|
-
if (preRelease1 && preRelease2) {
|
|
174
|
-
return compareSegments(preRelease1.split("."), preRelease2.split("."));
|
|
175
|
-
}
|
|
176
|
-
if (preRelease1) {
|
|
177
|
-
return -1;
|
|
178
|
-
}
|
|
179
|
-
if (preRelease2) {
|
|
180
|
-
return 1;
|
|
181
|
-
}
|
|
182
|
-
return 0;
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
// src/native-modules/isMinVersionSupported.ts
|
|
186
|
-
function isMinVersionSupported(minVersions) {
|
|
187
|
-
const operationalEnvironment2 = AppsInTossModule.operationalEnvironment;
|
|
188
|
-
if (operationalEnvironment2 === "sandbox") {
|
|
189
|
-
return true;
|
|
190
|
-
}
|
|
191
|
-
const currentVersion = AppsInTossModule.tossAppVersion;
|
|
192
|
-
const isIOS = import_react_native2.Platform.OS === "ios";
|
|
193
|
-
const minVersion = isIOS ? minVersions.ios : minVersions.android;
|
|
194
|
-
if (minVersion === void 0) {
|
|
195
|
-
return false;
|
|
196
|
-
}
|
|
197
|
-
if (minVersion === "always") {
|
|
198
|
-
return true;
|
|
199
|
-
}
|
|
200
|
-
if (minVersion === "never") {
|
|
201
|
-
return false;
|
|
202
|
-
}
|
|
203
|
-
return compareVersions(currentVersion, minVersion) >= 0;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
// src/native-modules/tossCore.ts
|
|
207
|
-
var TossCoreModule = import_react_native3.NativeModules.TossCoreModule;
|
|
208
|
-
function tossCoreEventLog(params) {
|
|
209
|
-
const supported = isMinVersionSupported({ ios: "5.210.0", android: "5.210.0" });
|
|
210
|
-
const isSandbox = getOperationalEnvironment() === "sandbox";
|
|
211
|
-
if (!supported || isSandbox) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
TossCoreModule.eventLog({
|
|
215
|
-
params: {
|
|
216
|
-
log_name: params.log_name,
|
|
217
|
-
log_type: params.log_type,
|
|
218
|
-
params: params.params
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
|
|
223
79
|
// src/utils/isPrivateScheme.ts
|
|
224
|
-
var
|
|
80
|
+
var import_react_native2 = require("@granite-js/react-native");
|
|
225
81
|
function isPrivateScheme() {
|
|
226
82
|
try {
|
|
227
|
-
return new URL((0,
|
|
83
|
+
return new URL((0, import_react_native2.getSchemeUri)()).protocol === "intoss-private:";
|
|
228
84
|
} catch {
|
|
229
85
|
return false;
|
|
230
86
|
}
|
|
@@ -235,7 +91,7 @@ var EXIT_IMPRESSION_LOG_NAME = "appsintoss_app_visit__common_module::impression_
|
|
|
235
91
|
var EXIT_IMPRESSION_SCHEMA_ID = 1631628;
|
|
236
92
|
function useCaptureExitLog() {
|
|
237
93
|
const referrer = useReferrer();
|
|
238
|
-
const visible = (0,
|
|
94
|
+
const visible = (0, import_react_native3.useVisibility)();
|
|
239
95
|
const enterTime = (0, import_react2.useRef)(void 0);
|
|
240
96
|
(0, import_react2.useEffect)(() => {
|
|
241
97
|
if (visible === true) {
|
|
@@ -248,7 +104,7 @@ function useCaptureExitLog() {
|
|
|
248
104
|
return;
|
|
249
105
|
}
|
|
250
106
|
const stayTime = Math.floor(exitTime - enterTime.current);
|
|
251
|
-
tossCoreEventLog({
|
|
107
|
+
import_native_modules.INTERNAL__module.tossCoreEventLog({
|
|
252
108
|
log_name: EXIT_IMPRESSION_LOG_NAME,
|
|
253
109
|
log_type: "event",
|
|
254
110
|
params: {
|
|
@@ -256,7 +112,7 @@ function useCaptureExitLog() {
|
|
|
256
112
|
event_type: "impression",
|
|
257
113
|
referrer,
|
|
258
114
|
deployment_id: env.getDeploymentId(),
|
|
259
|
-
app_name:
|
|
115
|
+
app_name: import_react_native3.Granite.appName,
|
|
260
116
|
is_private: isPrivateScheme(),
|
|
261
117
|
stay_time: stayTime.toString(),
|
|
262
118
|
exit_time: exitTime.toString()
|
|
@@ -274,7 +130,7 @@ var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
|
|
|
274
130
|
function EntryAppEvent() {
|
|
275
131
|
const referrer = useReferrer() ?? "";
|
|
276
132
|
(0, import_react3.useEffect)(() => {
|
|
277
|
-
tossCoreEventLog({
|
|
133
|
+
import_native_modules2.INTERNAL__module.tossCoreEventLog({
|
|
278
134
|
log_name: "appsintoss_app_visit::impression__enter_appsintoss",
|
|
279
135
|
log_type: "info",
|
|
280
136
|
params: {
|
|
@@ -282,7 +138,7 @@ function EntryAppEvent() {
|
|
|
282
138
|
schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
|
|
283
139
|
referrer,
|
|
284
140
|
deployment_id: env.getDeploymentId(),
|
|
285
|
-
app_name:
|
|
141
|
+
app_name: import_react_native4.Granite.appName,
|
|
286
142
|
is_private: isPrivateScheme()
|
|
287
143
|
}
|
|
288
144
|
});
|
|
@@ -291,14 +147,14 @@ function EntryAppEvent() {
|
|
|
291
147
|
}
|
|
292
148
|
function SystemAppEvent({ ...initialProps }) {
|
|
293
149
|
(0, import_react3.useEffect)(() => {
|
|
294
|
-
tossCoreEventLog({
|
|
150
|
+
import_native_modules2.INTERNAL__module.tossCoreEventLog({
|
|
295
151
|
log_name: "AppsInTossInitialProps",
|
|
296
152
|
log_type: "debug",
|
|
297
153
|
params: {
|
|
298
154
|
...initialProps,
|
|
299
|
-
schemeUri: (0,
|
|
155
|
+
schemeUri: (0, import_react_native4.getSchemeUri)(),
|
|
300
156
|
deployment_id: env.getDeploymentId(),
|
|
301
|
-
app_name:
|
|
157
|
+
app_name: import_react_native4.Granite.appName,
|
|
302
158
|
is_private: isPrivateScheme()
|
|
303
159
|
}
|
|
304
160
|
});
|
|
@@ -306,7 +162,7 @@ function SystemAppEvent({ ...initialProps }) {
|
|
|
306
162
|
return null;
|
|
307
163
|
}
|
|
308
164
|
function StayTimeAppEvent() {
|
|
309
|
-
const visible = (0,
|
|
165
|
+
const visible = (0, import_react_native4.useVisibility)();
|
|
310
166
|
const { captureExitLog } = useCaptureExitLog();
|
|
311
167
|
(0, import_react3.useEffect)(() => {
|
|
312
168
|
if (visible === false) {
|
|
@@ -321,204 +177,22 @@ var AppEvent = {
|
|
|
321
177
|
StayTime: StayTimeAppEvent
|
|
322
178
|
};
|
|
323
179
|
|
|
324
|
-
// src/core/
|
|
325
|
-
var import_react_native5 = require("@
|
|
180
|
+
// src/core/components/AppUpdate.tsx
|
|
181
|
+
var import_react_native5 = require("@granite-js/react-native");
|
|
326
182
|
var import_react4 = require("react");
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
name = "entryMessageExited";
|
|
335
|
-
remove() {
|
|
336
|
-
}
|
|
337
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
338
|
-
listener(_) {
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
// src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
343
|
-
var import_react_native_bedrock6 = require("react-native-bedrock");
|
|
344
|
-
|
|
345
|
-
// src/native-modules/getPermission.ts
|
|
346
|
-
function getPermission(permission) {
|
|
347
|
-
return AppsInTossModule.getPermission(permission);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
// src/native-modules/openPermissionDialog.ts
|
|
351
|
-
function openPermissionDialog(permission) {
|
|
352
|
-
return AppsInTossModule.openPermissionDialog(permission);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
// src/native-modules/requestPermission.ts
|
|
356
|
-
async function requestPermission(permission) {
|
|
357
|
-
const permissionStatus = await getPermission(permission);
|
|
358
|
-
switch (permissionStatus) {
|
|
359
|
-
case "allowed":
|
|
360
|
-
case "denied":
|
|
361
|
-
return permissionStatus;
|
|
362
|
-
default:
|
|
363
|
-
return openPermissionDialog(permission);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
// src/native-event-emitter/nativeEventEmitter.ts
|
|
368
|
-
var import_react_native4 = require("react-native");
|
|
369
|
-
var nativeEventEmitter = new import_react_native4.NativeEventEmitter(AppsInTossModuleInstance);
|
|
370
|
-
|
|
371
|
-
// src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
372
|
-
var UpdateLocationEvent = class extends import_react_native_bedrock6.BedrockEventDefinition {
|
|
373
|
-
name = "updateLocationEvent";
|
|
374
|
-
subscriptionCount = 0;
|
|
375
|
-
ref = {
|
|
376
|
-
remove: () => {
|
|
377
|
-
}
|
|
378
|
-
};
|
|
379
|
-
remove() {
|
|
380
|
-
if (--this.subscriptionCount === 0) {
|
|
381
|
-
AppsInTossModuleInstance.stopUpdateLocation({});
|
|
382
|
-
}
|
|
383
|
-
this.ref.remove();
|
|
384
|
-
}
|
|
385
|
-
listener(options, onEvent, onError) {
|
|
386
|
-
requestPermission({ name: "geolocation", access: "access" }).then((permissionStatus) => {
|
|
387
|
-
if (permissionStatus === "denied") {
|
|
388
|
-
onError(new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."));
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
void AppsInTossModuleInstance.startUpdateLocation(options).catch(onError);
|
|
392
|
-
const subscription = nativeEventEmitter.addListener("updateLocation", onEvent);
|
|
393
|
-
this.ref = {
|
|
394
|
-
remove: () => subscription?.remove()
|
|
395
|
-
};
|
|
396
|
-
this.subscriptionCount++;
|
|
397
|
-
}).catch(onError);
|
|
398
|
-
}
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
// src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
402
|
-
var import_react_native_bedrock7 = require("react-native-bedrock");
|
|
403
|
-
|
|
404
|
-
// src/utils/generateUUID.ts
|
|
405
|
-
function generateUUID(placeholder) {
|
|
406
|
-
return placeholder ? (placeholder ^ Math.random() * 16 >> placeholder / 4).toString(16) : (String(1e7) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, generateUUID);
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
// src/native-event-emitter/internal/appBridge.ts
|
|
410
|
-
var INTERNAL__callbacks = /* @__PURE__ */ new Map();
|
|
411
|
-
function invokeAppBridgeCallback(id, ...args) {
|
|
412
|
-
const callback = INTERNAL__callbacks.get(id);
|
|
413
|
-
callback?.call(null, ...args);
|
|
414
|
-
return Boolean(callback);
|
|
415
|
-
}
|
|
416
|
-
function invokeAppBridgeMethod(methodName, params, callbacks) {
|
|
417
|
-
const { onSuccess, onError, ...appBridgeCallbacks } = callbacks;
|
|
418
|
-
const { callbackMap, unregisterAll } = registerCallbacks(appBridgeCallbacks);
|
|
419
|
-
const promise = AppsInTossModuleInstance[methodName]({
|
|
420
|
-
params,
|
|
421
|
-
callbacks: callbackMap
|
|
422
|
-
});
|
|
423
|
-
void promise.then(onSuccess).catch(onError);
|
|
424
|
-
return unregisterAll;
|
|
425
|
-
}
|
|
426
|
-
function registerCallbacks(callbacks) {
|
|
427
|
-
const callbackMap = {};
|
|
428
|
-
for (const [callbackName, callback] of Object.entries(callbacks)) {
|
|
429
|
-
const id = registerCallback(callback, callbackName);
|
|
430
|
-
callbackMap[callbackName] = id;
|
|
431
|
-
}
|
|
432
|
-
const unregisterAll = () => {
|
|
433
|
-
Object.values(callbackMap).forEach(unregisterCallback);
|
|
434
|
-
};
|
|
435
|
-
return { callbackMap, unregisterAll };
|
|
436
|
-
}
|
|
437
|
-
function registerCallback(callback, name = "unnamed") {
|
|
438
|
-
const uniqueId = generateUUID();
|
|
439
|
-
const callbackId = `${uniqueId}__${name}`;
|
|
440
|
-
INTERNAL__callbacks.set(callbackId, callback);
|
|
441
|
-
return callbackId;
|
|
442
|
-
}
|
|
443
|
-
function unregisterCallback(id) {
|
|
444
|
-
INTERNAL__callbacks.delete(id);
|
|
445
|
-
}
|
|
446
|
-
function getCallbackIds() {
|
|
447
|
-
return Array.from(INTERNAL__callbacks.keys());
|
|
183
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
184
|
+
var UPDATE_SCHEME = "servicetoss://update/forced/j?updateType=required";
|
|
185
|
+
function AppUpdate() {
|
|
186
|
+
(0, import_react4.useEffect)(() => {
|
|
187
|
+
(0, import_react_native5.openURL)(`supertoss://closePage?url=${UPDATE_SCHEME}`);
|
|
188
|
+
}, []);
|
|
189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
448
190
|
}
|
|
449
|
-
var INTERNAL__appBridgeHandler = {
|
|
450
|
-
invokeAppBridgeCallback,
|
|
451
|
-
invokeAppBridgeMethod,
|
|
452
|
-
registerCallback,
|
|
453
|
-
unregisterCallback,
|
|
454
|
-
getCallbackIds
|
|
455
|
-
};
|
|
456
191
|
|
|
457
|
-
// src/
|
|
458
|
-
var
|
|
459
|
-
var
|
|
460
|
-
|
|
461
|
-
name = "appBridgeCallbackEvent";
|
|
462
|
-
constructor() {
|
|
463
|
-
super();
|
|
464
|
-
this.registerAppBridgeCallbackEventListener();
|
|
465
|
-
}
|
|
466
|
-
remove() {
|
|
467
|
-
}
|
|
468
|
-
listener() {
|
|
469
|
-
}
|
|
470
|
-
registerAppBridgeCallbackEventListener() {
|
|
471
|
-
if (_AppBridgeCallbackEvent.INTERNAL__appBridgeSubscription != null) {
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
_AppBridgeCallbackEvent.INTERNAL__appBridgeSubscription = UNSAFE__nativeEventEmitter.addListener(
|
|
475
|
-
"appBridgeCallback",
|
|
476
|
-
this.ensureInvokeAppBridgeCallback
|
|
477
|
-
);
|
|
478
|
-
}
|
|
479
|
-
ensureInvokeAppBridgeCallback(result) {
|
|
480
|
-
if (typeof result === "object" && typeof result.name === "string") {
|
|
481
|
-
INTERNAL__appBridgeHandler.invokeAppBridgeCallback(result.name, result.params);
|
|
482
|
-
} else {
|
|
483
|
-
console.warn("Invalid app bridge callback result:", result);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
};
|
|
487
|
-
|
|
488
|
-
// src/native-event-emitter/internal/VisibilityChangedByTransparentServiceWebEvent.ts
|
|
489
|
-
var import_react_native_bedrock8 = require("react-native-bedrock");
|
|
490
|
-
var VisibilityChangedByTransparentServiceWebEvent = class extends import_react_native_bedrock8.BedrockEventDefinition {
|
|
491
|
-
name = "onVisibilityChangedByTransparentServiceWeb";
|
|
492
|
-
subscription = null;
|
|
493
|
-
remove() {
|
|
494
|
-
this.subscription?.remove();
|
|
495
|
-
this.subscription = null;
|
|
496
|
-
}
|
|
497
|
-
listener(options, onEvent, onError) {
|
|
498
|
-
const subscription = nativeEventEmitter.addListener("visibilityChangedByTransparentServiceWeb", (params) => {
|
|
499
|
-
if (this.isVisibilityChangedByTransparentServiceWebResult(params)) {
|
|
500
|
-
if (params.callbackId === options.callbackId) {
|
|
501
|
-
onEvent(params.isVisible);
|
|
502
|
-
}
|
|
503
|
-
} else {
|
|
504
|
-
onError(new Error("Invalid visibility changed by transparent service web result"));
|
|
505
|
-
}
|
|
506
|
-
});
|
|
507
|
-
this.subscription = subscription;
|
|
508
|
-
}
|
|
509
|
-
isVisibilityChangedByTransparentServiceWebResult(params) {
|
|
510
|
-
return typeof params === "object" && typeof params.callbackId === "string" && typeof params.isVisible === "boolean";
|
|
511
|
-
}
|
|
512
|
-
};
|
|
513
|
-
|
|
514
|
-
// src/native-event-emitter/appsInTossEvent.ts
|
|
515
|
-
var appsInTossEvent = new import_react_native_bedrock9.BedrockEvent([
|
|
516
|
-
new UpdateLocationEvent(),
|
|
517
|
-
new EntryMessageExitedEvent(),
|
|
518
|
-
// Internal events
|
|
519
|
-
new AppBridgeCallbackEvent(),
|
|
520
|
-
new VisibilityChangedByTransparentServiceWebEvent()
|
|
521
|
-
]);
|
|
192
|
+
// src/core/hooks/useAppsInTossBridge.ts
|
|
193
|
+
var import_native_modules3 = require("@apps-in-toss/native-modules");
|
|
194
|
+
var import_react_native6 = require("@toss-design-system/react-native");
|
|
195
|
+
var import_react5 = require("react");
|
|
522
196
|
|
|
523
197
|
// src/core/utils/getAppsInTossGlobals.ts
|
|
524
198
|
function getAppsInTossGlobals() {
|
|
@@ -535,9 +209,9 @@ function toIcon(source) {
|
|
|
535
209
|
|
|
536
210
|
// src/core/hooks/useAppsInTossBridge.ts
|
|
537
211
|
function useAppsInTossBridge() {
|
|
538
|
-
const controller = (0,
|
|
212
|
+
const controller = (0, import_react_native6.useBridge)();
|
|
539
213
|
const appsInTossGlobals2 = getAppsInTossGlobals();
|
|
540
|
-
(0,
|
|
214
|
+
(0, import_react5.useEffect)(() => {
|
|
541
215
|
const commonProps = {
|
|
542
216
|
serviceName: appsInTossGlobals2.brandDisplayName,
|
|
543
217
|
icon: toIcon(appsInTossGlobals2.brandIcon),
|
|
@@ -547,240 +221,45 @@ function useAppsInTossBridge() {
|
|
|
547
221
|
controller.open({
|
|
548
222
|
...commonProps,
|
|
549
223
|
onExited: () => {
|
|
550
|
-
appsInTossEvent.emit("entryMessageExited", void 0);
|
|
224
|
+
import_native_modules3.appsInTossEvent.emit("entryMessageExited", void 0);
|
|
551
225
|
}
|
|
552
226
|
});
|
|
553
227
|
}, []);
|
|
554
228
|
}
|
|
555
229
|
|
|
556
|
-
// src/async-bridges.ts
|
|
557
|
-
var async_bridges_exports = {};
|
|
558
|
-
__export(async_bridges_exports, {
|
|
559
|
-
appLogin: () => appLogin,
|
|
560
|
-
checkoutPayment: () => checkoutPayment,
|
|
561
|
-
eventLog: () => eventLog,
|
|
562
|
-
fetchAlbumPhotos: () => fetchAlbumPhotos,
|
|
563
|
-
fetchContacts: () => fetchContacts,
|
|
564
|
-
getClipboardText: () => getClipboardText,
|
|
565
|
-
getCurrentLocation: () => getCurrentLocation,
|
|
566
|
-
getGameCenterGameProfile: () => getGameCenterGameProfile,
|
|
567
|
-
getTossShareLink: () => getTossShareLink,
|
|
568
|
-
openCamera: () => openCamera,
|
|
569
|
-
openGameCenterLeaderboard: () => openGameCenterLeaderboard,
|
|
570
|
-
saveBase64Data: () => saveBase64Data,
|
|
571
|
-
setClipboardText: () => setClipboardText,
|
|
572
|
-
setDeviceOrientation: () => setDeviceOrientation,
|
|
573
|
-
submitGameCenterLeaderBoardScore: () => submitGameCenterLeaderBoardScore
|
|
574
|
-
});
|
|
575
|
-
|
|
576
|
-
// src/native-modules/setClipboardText.ts
|
|
577
|
-
async function setClipboardText(text) {
|
|
578
|
-
const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
|
|
579
|
-
if (permissionStatus === "denied") {
|
|
580
|
-
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
581
|
-
}
|
|
582
|
-
return AppsInTossModule.setClipboardText({ text });
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
// src/native-modules/getClipboardText.ts
|
|
586
|
-
async function getClipboardText() {
|
|
587
|
-
const permissionStatus = await requestPermission({ name: "clipboard", access: "read" });
|
|
588
|
-
if (permissionStatus === "denied") {
|
|
589
|
-
throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC77D\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
590
|
-
}
|
|
591
|
-
return AppsInTossModule.getClipboardText({});
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
// src/native-modules/fetchContacts.ts
|
|
595
|
-
async function fetchContacts({
|
|
596
|
-
size,
|
|
597
|
-
offset,
|
|
598
|
-
query
|
|
599
|
-
}) {
|
|
600
|
-
const permissionStatus = await requestPermission({ name: "contacts", access: "read" });
|
|
601
|
-
if (permissionStatus === "denied") {
|
|
602
|
-
throw new Error("\uC5F0\uB77D\uCC98 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
603
|
-
}
|
|
604
|
-
const contacts = await AppsInTossModule.fetchContacts({
|
|
605
|
-
size,
|
|
606
|
-
offset,
|
|
607
|
-
query
|
|
608
|
-
});
|
|
609
|
-
return {
|
|
610
|
-
result: contacts.result,
|
|
611
|
-
nextOffset: contacts.nextOffset ?? null,
|
|
612
|
-
done: contacts.done
|
|
613
|
-
};
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
// src/native-modules/fetchAlbumPhotos.ts
|
|
617
|
-
var DEFAULT_MAX_COUNT = 10;
|
|
618
|
-
var DEFAULT_MAX_WIDTH = 1024;
|
|
619
|
-
async function fetchAlbumPhotos(options) {
|
|
620
|
-
const permissionStatus = await requestPermission({ name: "photos", access: "read" });
|
|
621
|
-
if (permissionStatus === "denied") {
|
|
622
|
-
throw new Error("\uC0AC\uC9C4\uCCA9 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
623
|
-
}
|
|
624
|
-
const albumPhotos = await AppsInTossModule.fetchAlbumPhotos({
|
|
625
|
-
...options,
|
|
626
|
-
maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
|
|
627
|
-
maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
|
|
628
|
-
});
|
|
629
|
-
return albumPhotos;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
// src/native-modules/getCurrentLocation.ts
|
|
633
|
-
async function getCurrentLocation(options) {
|
|
634
|
-
const permissionStatus = await requestPermission({ name: "geolocation", access: "access" });
|
|
635
|
-
if (permissionStatus === "denied") {
|
|
636
|
-
throw new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
637
|
-
}
|
|
638
|
-
const position = await AppsInTossModule.getCurrentLocation(options);
|
|
639
|
-
return position;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
// src/native-modules/openCamera.ts
|
|
643
|
-
async function openCamera(options) {
|
|
644
|
-
const permissionStatus = await requestPermission({ name: "camera", access: "access" });
|
|
645
|
-
if (permissionStatus === "denied") {
|
|
646
|
-
throw new Error("\uCE74\uBA54\uB77C \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
|
|
647
|
-
}
|
|
648
|
-
const photo = await AppsInTossModule.openCamera({ base64: false, maxWidth: 1024, ...options });
|
|
649
|
-
return photo;
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
// src/native-modules/appLogin.ts
|
|
653
|
-
async function appLogin() {
|
|
654
|
-
return AppsInTossModule.appLogin({});
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
// src/native-modules/checkoutPayment.ts
|
|
658
|
-
async function checkoutPayment(options) {
|
|
659
|
-
return AppsInTossModule.checkoutPayment({ params: options });
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
// src/native-modules/eventLog.ts
|
|
663
|
-
function normalizeParams(params) {
|
|
664
|
-
return Object.fromEntries(
|
|
665
|
-
Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
|
|
666
|
-
);
|
|
667
|
-
}
|
|
668
|
-
async function eventLog(params) {
|
|
669
|
-
if (AppsInTossModule.operationalEnvironment === "sandbox") {
|
|
670
|
-
console.log("[eventLogDebug]", {
|
|
671
|
-
log_name: params.log_name,
|
|
672
|
-
log_type: params.log_type,
|
|
673
|
-
params: normalizeParams(params.params)
|
|
674
|
-
});
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
const isSupported = isMinVersionSupported({
|
|
678
|
-
android: "5.208.0",
|
|
679
|
-
ios: "5.208.0"
|
|
680
|
-
});
|
|
681
|
-
if (!isSupported) {
|
|
682
|
-
return;
|
|
683
|
-
}
|
|
684
|
-
return AppsInTossModule.eventLog({
|
|
685
|
-
log_name: params.log_name,
|
|
686
|
-
log_type: params.log_type,
|
|
687
|
-
params: normalizeParams(params.params)
|
|
688
|
-
});
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
// src/native-modules/getTossShareLink.ts
|
|
692
|
-
async function getTossShareLink(path) {
|
|
693
|
-
const { shareLink } = await AppsInTossModule.getTossShareLink({});
|
|
694
|
-
const shareUrl = new URL(shareLink);
|
|
695
|
-
shareUrl.searchParams.set("deep_link_value", path);
|
|
696
|
-
shareUrl.searchParams.set("af_dp", path);
|
|
697
|
-
return shareUrl.toString();
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
// src/native-modules/setDeviceOrientation.ts
|
|
701
|
-
async function setDeviceOrientation(options) {
|
|
702
|
-
const isSupported = isMinVersionSupported({
|
|
703
|
-
android: "5.215.0",
|
|
704
|
-
ios: "5.215.0"
|
|
705
|
-
});
|
|
706
|
-
if (!isSupported) {
|
|
707
|
-
return;
|
|
708
|
-
}
|
|
709
|
-
return AppsInTossModule.setDeviceOrientation(options);
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
// src/native-modules/saveBase64Data.ts
|
|
713
|
-
async function saveBase64Data(params) {
|
|
714
|
-
const isSupported = isMinVersionSupported({
|
|
715
|
-
android: "5.218.0",
|
|
716
|
-
ios: "5.216.0"
|
|
717
|
-
});
|
|
718
|
-
if (!isSupported) {
|
|
719
|
-
console.warn("saveBase64Data is not supported in this app version");
|
|
720
|
-
return;
|
|
721
|
-
}
|
|
722
|
-
await AppsInTossModule.saveBase64Data(params);
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
// src/constant/game-center.ts
|
|
726
|
-
var GAME_PROFILE_WEBVIEW_URL = "https://service.toss.im/game-center/profile";
|
|
727
|
-
var GAME_CENTER_MIN_VERSION = {
|
|
728
|
-
android: "5.221.0",
|
|
729
|
-
ios: "5.221.0"
|
|
730
|
-
};
|
|
731
|
-
|
|
732
|
-
// src/native-modules/getGameCenterGameProfile.ts
|
|
733
|
-
async function getGameCenterGameProfile() {
|
|
734
|
-
const isSupported = isMinVersionSupported(GAME_CENTER_MIN_VERSION);
|
|
735
|
-
if (!isSupported) {
|
|
736
|
-
return;
|
|
737
|
-
}
|
|
738
|
-
return AppsInTossModule.getGameCenterGameProfile({});
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
// src/native-modules/openGameCenterLeaderboard.ts
|
|
742
|
-
var import_react_native_bedrock10 = require("react-native-bedrock");
|
|
743
|
-
async function openGameCenterLeaderboard() {
|
|
744
|
-
if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
|
|
745
|
-
return;
|
|
746
|
-
}
|
|
747
|
-
const url = new URL("servicetoss://game-center/leaderboard?_navbar=hide");
|
|
748
|
-
url.searchParams.set("appName", getAppName());
|
|
749
|
-
url.searchParams.set("referrer", `appsintoss.${getAppName()}`);
|
|
750
|
-
return (0, import_react_native_bedrock10.openURL)(url.toString());
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
// src/native-modules/submitGameCenterLeaderBoardScore.ts
|
|
754
|
-
async function submitGameCenterLeaderBoardScore(params) {
|
|
755
|
-
const isSupported = isMinVersionSupported(GAME_CENTER_MIN_VERSION);
|
|
756
|
-
if (!isSupported) {
|
|
757
|
-
return;
|
|
758
|
-
}
|
|
759
|
-
return AppsInTossModule.submitGameCenterLeaderBoardScore(params);
|
|
760
|
-
}
|
|
761
|
-
|
|
762
230
|
// src/core/registerApp.tsx
|
|
763
|
-
var
|
|
231
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
764
232
|
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
233
|
+
if (!(0, import_native_modules4.isMinVersionSupported)({
|
|
234
|
+
android: "5.220.0",
|
|
235
|
+
ios: "5.221.0"
|
|
236
|
+
})) {
|
|
237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
238
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AppEvent.Entry, {}),
|
|
239
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AppEvent.System, { ...initialProps }),
|
|
240
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AppUpdate, {})
|
|
241
|
+
] });
|
|
242
|
+
}
|
|
243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
244
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AppEvent.StayTime, {}),
|
|
245
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AppEvent.Entry, {}),
|
|
246
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AppEvent.System, { ...initialProps }),
|
|
247
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Container, { ...initialProps, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native8.TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TDSContainer, { ...initialProps, children }) }) })
|
|
770
248
|
] });
|
|
771
249
|
}
|
|
772
250
|
function TDSContainer({ children }) {
|
|
773
251
|
useAppsInTossBridge();
|
|
774
|
-
return /* @__PURE__ */ (0,
|
|
252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children });
|
|
775
253
|
}
|
|
776
254
|
function registerApp(container, { context, analytics }) {
|
|
777
255
|
import_analytics.Analytics.init({
|
|
778
|
-
logger: (params) => void eventLog(params),
|
|
256
|
+
logger: (params) => void (0, import_native_modules4.eventLog)(params),
|
|
779
257
|
debug: analytics?.debug ?? __DEV__
|
|
780
258
|
});
|
|
781
|
-
|
|
259
|
+
const App = import_react_native7.Granite.registerApp(AppsInTossContainer.bind(null, container), {
|
|
782
260
|
appName: getAppName(),
|
|
783
261
|
context,
|
|
262
|
+
setIosSwipeGestureEnabled: import_native_modules4.setIosSwipeGestureEnabled,
|
|
784
263
|
router: {
|
|
785
264
|
screenContainer: import_analytics.Analytics.Screen,
|
|
786
265
|
defaultScreenOption: {
|
|
@@ -788,10 +267,12 @@ function registerApp(container, { context, analytics }) {
|
|
|
788
267
|
}
|
|
789
268
|
}
|
|
790
269
|
});
|
|
270
|
+
global.Page = App;
|
|
271
|
+
return App;
|
|
791
272
|
}
|
|
792
273
|
function getAppName() {
|
|
793
274
|
try {
|
|
794
|
-
return global.
|
|
275
|
+
return global.__granite.app.name;
|
|
795
276
|
} catch (error) {
|
|
796
277
|
console.error("unexpected error occurred while getting app name");
|
|
797
278
|
throw error;
|
|
@@ -803,249 +284,59 @@ var AppsInToss = {
|
|
|
803
284
|
registerApp
|
|
804
285
|
};
|
|
805
286
|
|
|
806
|
-
// src/native-event-emitter/startUpdateLocation.ts
|
|
807
|
-
function startUpdateLocation(eventParams) {
|
|
808
|
-
return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
// ../../.yarn/cache/es-toolkit-npm-1.34.1-4cd6371dcb-aab6d07be3.zip/node_modules/es-toolkit/dist/function/noop.mjs
|
|
812
|
-
function noop() {
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
// src/native-modules/ads/googleAdMob.ts
|
|
816
|
-
function loadAdMobInterstitialAd(params) {
|
|
817
|
-
if (!loadAdMobInterstitialAd.isSupported()) {
|
|
818
|
-
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
819
|
-
return noop;
|
|
820
|
-
}
|
|
821
|
-
const { onEvent, onError, options } = params;
|
|
822
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobInterstitialAd", options, {
|
|
823
|
-
onAdClicked: () => {
|
|
824
|
-
onEvent({ type: "clicked" });
|
|
825
|
-
},
|
|
826
|
-
onAdDismissed: () => {
|
|
827
|
-
onEvent({ type: "dismissed" });
|
|
828
|
-
},
|
|
829
|
-
onAdFailedToShow: () => {
|
|
830
|
-
onEvent({ type: "failedToShow" });
|
|
831
|
-
},
|
|
832
|
-
onAdImpression: () => {
|
|
833
|
-
onEvent({ type: "impression" });
|
|
834
|
-
},
|
|
835
|
-
onAdShow: () => {
|
|
836
|
-
onEvent({ type: "show" });
|
|
837
|
-
},
|
|
838
|
-
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
839
|
-
onError
|
|
840
|
-
});
|
|
841
|
-
return unregisterCallbacks;
|
|
842
|
-
}
|
|
843
|
-
function showAdMobInterstitialAd(params) {
|
|
844
|
-
if (!showAdMobInterstitialAd.isSupported()) {
|
|
845
|
-
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
846
|
-
return noop;
|
|
847
|
-
}
|
|
848
|
-
const { onEvent, onError, options } = params;
|
|
849
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobInterstitialAd", options, {
|
|
850
|
-
onSuccess: () => onEvent({ type: "requested" }),
|
|
851
|
-
onError
|
|
852
|
-
});
|
|
853
|
-
return unregisterCallbacks;
|
|
854
|
-
}
|
|
855
|
-
function loadAdMobRewardedAd(params) {
|
|
856
|
-
if (!loadAdMobRewardedAd.isSupported()) {
|
|
857
|
-
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
858
|
-
return noop;
|
|
859
|
-
}
|
|
860
|
-
const { onEvent, onError, options } = params;
|
|
861
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobRewardedAd", options, {
|
|
862
|
-
onAdClicked: () => {
|
|
863
|
-
onEvent({ type: "clicked" });
|
|
864
|
-
},
|
|
865
|
-
onAdDismissed: () => {
|
|
866
|
-
onEvent({ type: "dismissed" });
|
|
867
|
-
},
|
|
868
|
-
onAdFailedToShow: () => {
|
|
869
|
-
onEvent({ type: "failedToShow" });
|
|
870
|
-
},
|
|
871
|
-
onAdImpression: () => {
|
|
872
|
-
onEvent({ type: "impression" });
|
|
873
|
-
},
|
|
874
|
-
onAdShow: () => {
|
|
875
|
-
onEvent({ type: "show" });
|
|
876
|
-
},
|
|
877
|
-
onUserEarnedReward: () => {
|
|
878
|
-
onEvent({ type: "userEarnedReward" });
|
|
879
|
-
},
|
|
880
|
-
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
881
|
-
onError
|
|
882
|
-
});
|
|
883
|
-
return unregisterCallbacks;
|
|
884
|
-
}
|
|
885
|
-
function showAdMobRewardedAd(params) {
|
|
886
|
-
if (!showAdMobRewardedAd.isSupported()) {
|
|
887
|
-
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
888
|
-
return noop;
|
|
889
|
-
}
|
|
890
|
-
const { onEvent, onError, options } = params;
|
|
891
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobRewardedAd", options, {
|
|
892
|
-
onSuccess: () => onEvent({ type: "requested" }),
|
|
893
|
-
onError
|
|
894
|
-
});
|
|
895
|
-
return unregisterCallbacks;
|
|
896
|
-
}
|
|
897
|
-
var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
|
|
898
|
-
var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
|
|
899
|
-
var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
|
|
900
|
-
var ENVIRONMENT = getOperationalEnvironment();
|
|
901
|
-
function createIsSupported() {
|
|
902
|
-
return () => {
|
|
903
|
-
if (ENVIRONMENT !== "toss") {
|
|
904
|
-
return false;
|
|
905
|
-
}
|
|
906
|
-
return isMinVersionSupported({
|
|
907
|
-
android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION,
|
|
908
|
-
ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION
|
|
909
|
-
});
|
|
910
|
-
};
|
|
911
|
-
}
|
|
912
|
-
loadAdMobInterstitialAd.isSupported = createIsSupported();
|
|
913
|
-
loadAdMobRewardedAd.isSupported = createIsSupported();
|
|
914
|
-
showAdMobInterstitialAd.isSupported = createIsSupported();
|
|
915
|
-
showAdMobRewardedAd.isSupported = createIsSupported();
|
|
916
|
-
|
|
917
|
-
// src/native-modules/getDeviceId.ts
|
|
918
|
-
function getDeviceId() {
|
|
919
|
-
return AppsInTossModule.deviceId;
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
// src/native-modules/getTossAppVersion.ts
|
|
923
|
-
function getTossAppVersion() {
|
|
924
|
-
return AppsInTossModule.tossAppVersion;
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
// src/native-modules/iap.ts
|
|
928
|
-
async function createOneTimePurchaseOrder(params) {
|
|
929
|
-
const isSupported = isMinVersionSupported({
|
|
930
|
-
android: "5.219.0",
|
|
931
|
-
ios: "5.219.0"
|
|
932
|
-
});
|
|
933
|
-
if (!isSupported) {
|
|
934
|
-
return;
|
|
935
|
-
}
|
|
936
|
-
return AppsInTossModule.iapCreateOneTimePurchaseOrder(params);
|
|
937
|
-
}
|
|
938
|
-
async function getProductItemList() {
|
|
939
|
-
const isSupported = isMinVersionSupported({
|
|
940
|
-
android: "5.219.0",
|
|
941
|
-
ios: "5.219.0"
|
|
942
|
-
});
|
|
943
|
-
if (!isSupported) {
|
|
944
|
-
return;
|
|
945
|
-
}
|
|
946
|
-
return AppsInTossModule.iapGetProductItemList({});
|
|
947
|
-
}
|
|
948
|
-
var IAP = {
|
|
949
|
-
createOneTimePurchaseOrder,
|
|
950
|
-
getProductItemList
|
|
951
|
-
};
|
|
952
|
-
|
|
953
|
-
// src/native-modules/storage.ts
|
|
954
|
-
function getItem(key) {
|
|
955
|
-
return AppsInTossModule.getStorageItem({ key });
|
|
956
|
-
}
|
|
957
|
-
function setItem(key, value) {
|
|
958
|
-
return AppsInTossModule.setStorageItem({
|
|
959
|
-
key,
|
|
960
|
-
value
|
|
961
|
-
});
|
|
962
|
-
}
|
|
963
|
-
function removeItem(key) {
|
|
964
|
-
return AppsInTossModule.removeStorageItem({ key });
|
|
965
|
-
}
|
|
966
|
-
function clearItems() {
|
|
967
|
-
return AppsInTossModule.clearStorage({});
|
|
968
|
-
}
|
|
969
|
-
var Storage = {
|
|
970
|
-
getItem,
|
|
971
|
-
setItem,
|
|
972
|
-
removeItem,
|
|
973
|
-
clearItems
|
|
974
|
-
};
|
|
975
|
-
|
|
976
|
-
// src/native-modules/contactsViral.ts
|
|
977
|
-
function contactsViral(params) {
|
|
978
|
-
const isSupported = isMinVersionSupported({
|
|
979
|
-
android: "5.223.0",
|
|
980
|
-
ios: "5.223.0"
|
|
981
|
-
});
|
|
982
|
-
if (!isSupported) {
|
|
983
|
-
return () => {
|
|
984
|
-
};
|
|
985
|
-
}
|
|
986
|
-
const { onEvent, onError, options } = params;
|
|
987
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("contactsViral", options, {
|
|
988
|
-
onRewardFromContactsViral: (result) => {
|
|
989
|
-
onEvent({ type: "sendViral", data: result });
|
|
990
|
-
},
|
|
991
|
-
onSuccess: (result) => {
|
|
992
|
-
onEvent({ type: "close", data: result });
|
|
993
|
-
},
|
|
994
|
-
onError
|
|
995
|
-
});
|
|
996
|
-
return unregisterCallbacks;
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
// src/native-modules/index.ts
|
|
1000
|
-
var TossPay = {
|
|
1001
|
-
checkoutPayment
|
|
1002
|
-
};
|
|
1003
|
-
var GoogleAdMob = {
|
|
1004
|
-
loadAdMobInterstitialAd,
|
|
1005
|
-
showAdMobInterstitialAd,
|
|
1006
|
-
loadAdMobRewardedAd,
|
|
1007
|
-
showAdMobRewardedAd
|
|
1008
|
-
};
|
|
1009
|
-
|
|
1010
287
|
// src/components/WebView.tsx
|
|
1011
|
-
var
|
|
288
|
+
var import_native_modules12 = require("@apps-in-toss/native-modules");
|
|
289
|
+
var appsInTossAsyncBridges = __toESM(require("@apps-in-toss/native-modules/async-bridges"), 1);
|
|
290
|
+
var appsInTossConstantBridges = __toESM(require("@apps-in-toss/native-modules/constant-bridges"), 1);
|
|
291
|
+
var appsInTossEventBridges = __toESM(require("@apps-in-toss/native-modules/event-bridges"), 1);
|
|
292
|
+
var import_react_native27 = require("@granite-js/react-native");
|
|
293
|
+
var graniteAsyncBridges = __toESM(require("@granite-js/react-native/async-bridges"), 1);
|
|
294
|
+
var graniteConstantBridges = __toESM(require("@granite-js/react-native/constant-bridges"), 1);
|
|
295
|
+
var import_react_native28 = require("@toss-design-system/react-native");
|
|
1012
296
|
var import_private3 = require("@toss-design-system/react-native/private");
|
|
1013
|
-
var
|
|
1014
|
-
var
|
|
1015
|
-
var import_react_native_bedrock18 = require("react-native-bedrock");
|
|
1016
|
-
var bedrockAsyncBridges = __toESM(require("react-native-bedrock/async-bridges"), 1);
|
|
1017
|
-
var bedrockConstantBridges = __toESM(require("react-native-bedrock/constant-bridges"), 1);
|
|
297
|
+
var import_react11 = require("react");
|
|
298
|
+
var import_react_native29 = require("react-native");
|
|
1018
299
|
|
|
1019
300
|
// src/components/GameWebView.tsx
|
|
1020
|
-
var
|
|
1021
|
-
var
|
|
301
|
+
var import_native_modules8 = require("@apps-in-toss/native-modules");
|
|
302
|
+
var import_react_native_webview = require("@granite-js/native/react-native-webview");
|
|
303
|
+
var import_react_native21 = require("@granite-js/react-native");
|
|
304
|
+
var import_react_native22 = require("@toss-design-system/react-native");
|
|
1022
305
|
var import_es_hangul2 = require("es-hangul");
|
|
1023
|
-
var
|
|
1024
|
-
var
|
|
1025
|
-
var import_react_native_bedrock14 = require("react-native-bedrock");
|
|
306
|
+
var import_react8 = require("react");
|
|
307
|
+
var import_react_native23 = require("react-native");
|
|
1026
308
|
|
|
1027
309
|
// src/components/GameProfile.tsx
|
|
1028
|
-
var
|
|
1029
|
-
var
|
|
1030
|
-
var
|
|
310
|
+
var import_native_modules7 = require("@apps-in-toss/native-modules");
|
|
311
|
+
var import_react_native14 = require("@toss-design-system/react-native");
|
|
312
|
+
var import_react7 = require("react");
|
|
313
|
+
var import_react_native15 = require("react-native");
|
|
314
|
+
|
|
315
|
+
// src/constant/game-center.ts
|
|
316
|
+
var GAME_PROFILE_WEBVIEW_URL = "https://service.toss.im/game-center/profile";
|
|
317
|
+
var GAME_CENTER_MIN_VERSION = {
|
|
318
|
+
android: "5.221.0",
|
|
319
|
+
ios: "5.221.0"
|
|
320
|
+
};
|
|
1031
321
|
|
|
1032
322
|
// src/hooks/useGameCenterProfile.ts
|
|
1033
|
-
var
|
|
323
|
+
var import_native_modules6 = require("@apps-in-toss/native-modules");
|
|
324
|
+
var import_react_native12 = require("@granite-js/react-native");
|
|
325
|
+
var import_react_native13 = require("@toss-design-system/react-native");
|
|
1034
326
|
var import_es_hangul = require("es-hangul");
|
|
1035
|
-
var
|
|
1036
|
-
var import_react_native_bedrock13 = require("react-native-bedrock");
|
|
327
|
+
var import_react6 = require("react");
|
|
1037
328
|
|
|
1038
329
|
// src/components/GameProfileToast.tsx
|
|
1039
|
-
var
|
|
330
|
+
var import_react_native9 = require("@toss-design-system/react-native");
|
|
1040
331
|
var import_private = require("@toss-design-system/react-native/private");
|
|
1041
|
-
var
|
|
332
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1042
333
|
var useGameProfileToast = () => {
|
|
1043
334
|
const overlay = (0, import_private.useOverlay)();
|
|
1044
335
|
const openGameProfileToast = (nickname, profileImageUri) => {
|
|
1045
336
|
return new Promise((resolve) => {
|
|
1046
337
|
overlay.open(({ isOpen, close, exit }) => {
|
|
1047
|
-
return /* @__PURE__ */ (0,
|
|
1048
|
-
|
|
338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_private.ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_private.AdaptiveColorProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
339
|
+
import_react_native9.Toast,
|
|
1049
340
|
{
|
|
1050
341
|
open: isOpen,
|
|
1051
342
|
onClose: () => {
|
|
@@ -1055,11 +346,11 @@ var useGameProfileToast = () => {
|
|
|
1055
346
|
onExited: exit,
|
|
1056
347
|
position: "top",
|
|
1057
348
|
text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
|
|
1058
|
-
icon: /* @__PURE__ */ (0,
|
|
1059
|
-
|
|
349
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
350
|
+
import_react_native9.Asset.Image,
|
|
1060
351
|
{
|
|
1061
352
|
style: { borderRadius: 64, overflow: "hidden" },
|
|
1062
|
-
frameShape:
|
|
353
|
+
frameShape: import_react_native9.Asset.frameShape.CleanW32,
|
|
1063
354
|
source: { uri: profileImageUri }
|
|
1064
355
|
}
|
|
1065
356
|
)
|
|
@@ -1078,23 +369,19 @@ var DEFAULT_ERROR = {
|
|
|
1078
369
|
};
|
|
1079
370
|
|
|
1080
371
|
// src/utils/market.ts
|
|
1081
|
-
var
|
|
372
|
+
var import_react_native10 = require("react-native");
|
|
1082
373
|
var PLAYSTORE_LINK = "https://play.google.com/store/apps/details?id=viva.republica.toss";
|
|
1083
374
|
var APPSTORE_LINK = "https://itunes.apple.com/app/id839333328";
|
|
1084
375
|
var getMarketLink = () => {
|
|
1085
|
-
return
|
|
376
|
+
return import_react_native10.Platform.OS === "android" ? PLAYSTORE_LINK : APPSTORE_LINK;
|
|
1086
377
|
};
|
|
1087
378
|
|
|
1088
379
|
// src/utils/openTransparentWebView.ts
|
|
1089
|
-
var
|
|
1090
|
-
|
|
1091
|
-
// src/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
|
|
1092
|
-
function onVisibilityChangedByTransparentServiceWeb(eventParams) {
|
|
1093
|
-
return appsInTossEvent.addEventListener("onVisibilityChangedByTransparentServiceWeb", eventParams);
|
|
1094
|
-
}
|
|
380
|
+
var import_react_native11 = require("@granite-js/react-native");
|
|
1095
381
|
|
|
1096
382
|
// src/private.ts
|
|
1097
|
-
var
|
|
383
|
+
var import_native_modules5 = require("@apps-in-toss/native-modules");
|
|
384
|
+
var INTERNAL__onVisibilityChangedByTransparentServiceWeb = import_native_modules5.onVisibilityChangedByTransparentServiceWeb;
|
|
1098
385
|
|
|
1099
386
|
// src/utils/openTransparentWebView.ts
|
|
1100
387
|
var openTransparentWebView = ({
|
|
@@ -1124,29 +411,29 @@ var openTransparentWebView = ({
|
|
|
1124
411
|
}
|
|
1125
412
|
}
|
|
1126
413
|
});
|
|
1127
|
-
(0,
|
|
414
|
+
(0, import_react_native11.openURL)(url.toString());
|
|
1128
415
|
};
|
|
1129
416
|
|
|
1130
417
|
// src/hooks/useGameCenterProfile.ts
|
|
1131
418
|
var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
1132
|
-
const [profileData, setProfileData] = (0,
|
|
1133
|
-
const [isProfileDataLoading, setIsProfileDataLoading] = (0,
|
|
1134
|
-
const [isProfileDataRefetching, setIsProfileDataRefetching] = (0,
|
|
419
|
+
const [profileData, setProfileData] = (0, import_react6.useState)(void 0);
|
|
420
|
+
const [isProfileDataLoading, setIsProfileDataLoading] = (0, import_react6.useState)(true);
|
|
421
|
+
const [isProfileDataRefetching, setIsProfileDataRefetching] = (0, import_react6.useState)(false);
|
|
1135
422
|
const shouldShowLoadingOverlay = isProfileDataLoading && isReadyForProfileUI;
|
|
1136
423
|
const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
|
|
1137
424
|
const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
|
|
1138
|
-
const [isWebviewLoading, setIsWebviewLoading] = (0,
|
|
1139
|
-
const isCompletedProfileFlow = (0,
|
|
1140
|
-
const { openAlert, openConfirm } = (0,
|
|
425
|
+
const [isWebviewLoading, setIsWebviewLoading] = (0, import_react6.useState)(false);
|
|
426
|
+
const isCompletedProfileFlow = (0, import_react6.useRef)(false);
|
|
427
|
+
const { openAlert, openConfirm } = (0, import_react_native13.useDialog)();
|
|
1141
428
|
const { openGameProfileToast } = useGameProfileToast();
|
|
1142
|
-
const openErrorAlert = (0,
|
|
429
|
+
const openErrorAlert = (0, import_react6.useCallback)(async () => {
|
|
1143
430
|
await openAlert({
|
|
1144
431
|
title: DEFAULT_ERROR.title,
|
|
1145
432
|
description: DEFAULT_ERROR.description
|
|
1146
433
|
});
|
|
1147
|
-
(0,
|
|
434
|
+
(0, import_react_native12.closeView)();
|
|
1148
435
|
}, [openAlert]);
|
|
1149
|
-
const openProfileWebview = (0,
|
|
436
|
+
const openProfileWebview = (0, import_react6.useCallback)(() => {
|
|
1150
437
|
if (isWebviewLoading) {
|
|
1151
438
|
return;
|
|
1152
439
|
}
|
|
@@ -1158,7 +445,7 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
1158
445
|
try {
|
|
1159
446
|
setIsWebviewLoading(false);
|
|
1160
447
|
setIsProfileDataRefetching(true);
|
|
1161
|
-
const data = await getGameCenterGameProfile();
|
|
448
|
+
const data = await (0, import_native_modules6.getGameCenterGameProfile)();
|
|
1162
449
|
setProfileData(data);
|
|
1163
450
|
setIsProfileDataRefetching(false);
|
|
1164
451
|
if (data?.statusCode === "SUCCESS") {
|
|
@@ -1175,7 +462,7 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
1175
462
|
}
|
|
1176
463
|
});
|
|
1177
464
|
}, [isWebviewLoading, openGameProfileToast, openErrorAlert]);
|
|
1178
|
-
const updateAppToSupportedMinVersion = (0,
|
|
465
|
+
const updateAppToSupportedMinVersion = (0, import_react6.useCallback)(async () => {
|
|
1179
466
|
const upddateConfirmDialogLabel = {
|
|
1180
467
|
title: `${(0, import_es_hangul.josa)(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
|
|
1181
468
|
\uC571\uC744 \uC5C5\uB370\uC774\uD2B8\uD574\uC8FC\uC138\uC694`,
|
|
@@ -1189,11 +476,11 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
1189
476
|
closeOnDimmerClick: true
|
|
1190
477
|
});
|
|
1191
478
|
if (!isConfirmed) {
|
|
1192
|
-
(0,
|
|
479
|
+
(0, import_react_native12.closeView)();
|
|
1193
480
|
return;
|
|
1194
481
|
}
|
|
1195
482
|
const STORE_SCHEME = getMarketLink();
|
|
1196
|
-
(0,
|
|
483
|
+
(0, import_react_native12.openURL)(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
|
|
1197
484
|
}, [openConfirm]);
|
|
1198
485
|
return {
|
|
1199
486
|
profileData,
|
|
@@ -1222,7 +509,7 @@ var Z_INDEX = {
|
|
|
1222
509
|
};
|
|
1223
510
|
|
|
1224
511
|
// src/components/GameProfile.tsx
|
|
1225
|
-
var
|
|
512
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1226
513
|
var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
1227
514
|
const {
|
|
1228
515
|
profileData,
|
|
@@ -1238,10 +525,10 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1238
525
|
openErrorAlert,
|
|
1239
526
|
openGameProfileToast
|
|
1240
527
|
} = useGameCenterProfile(isReadyForProfileUI);
|
|
1241
|
-
(0,
|
|
528
|
+
(0, import_react7.useEffect)(() => {
|
|
1242
529
|
try {
|
|
1243
530
|
const getProfileData = async () => {
|
|
1244
|
-
const data = await getGameCenterGameProfile();
|
|
531
|
+
const data = await (0, import_native_modules7.getGameCenterGameProfile)();
|
|
1245
532
|
setProfileData(data);
|
|
1246
533
|
setIsProfileDataLoading(false);
|
|
1247
534
|
};
|
|
@@ -1251,7 +538,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1251
538
|
setIsProfileDataLoading(false);
|
|
1252
539
|
}
|
|
1253
540
|
}, []);
|
|
1254
|
-
(0,
|
|
541
|
+
(0, import_react7.useEffect)(() => {
|
|
1255
542
|
const handleGameProfileFlow = async () => {
|
|
1256
543
|
if (!canShowBottomSheetOrToast) {
|
|
1257
544
|
return;
|
|
@@ -1260,7 +547,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1260
547
|
return;
|
|
1261
548
|
}
|
|
1262
549
|
isCompletedProfileFlow.current = true;
|
|
1263
|
-
if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
|
|
550
|
+
if (!(0, import_native_modules7.isMinVersionSupported)(GAME_CENTER_MIN_VERSION)) {
|
|
1264
551
|
updateAppToSupportedMinVersion();
|
|
1265
552
|
return;
|
|
1266
553
|
}
|
|
@@ -1281,11 +568,11 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1281
568
|
profileData,
|
|
1282
569
|
updateAppToSupportedMinVersion
|
|
1283
570
|
]);
|
|
1284
|
-
if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
|
|
1285
|
-
return /* @__PURE__ */ (0,
|
|
1286
|
-
/* @__PURE__ */ (0,
|
|
1287
|
-
/* @__PURE__ */ (0,
|
|
1288
|
-
|
|
571
|
+
if (!(0, import_native_modules7.isMinVersionSupported)(GAME_CENTER_MIN_VERSION)) {
|
|
572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
573
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native15.View, { style: { flex: 1, position: "relative" }, children }),
|
|
574
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
575
|
+
import_react_native15.Pressable,
|
|
1289
576
|
{
|
|
1290
577
|
style: {
|
|
1291
578
|
...overlayStyle
|
|
@@ -1298,10 +585,10 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1298
585
|
] });
|
|
1299
586
|
}
|
|
1300
587
|
if (shouldShowLoadingOverlay || isProfileDataRefetching) {
|
|
1301
|
-
return /* @__PURE__ */ (0,
|
|
1302
|
-
/* @__PURE__ */ (0,
|
|
1303
|
-
/* @__PURE__ */ (0,
|
|
1304
|
-
|
|
588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
589
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native15.View, { style: { flex: 1, position: "relative" }, children }),
|
|
590
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
591
|
+
import_react_native15.View,
|
|
1305
592
|
{
|
|
1306
593
|
style: {
|
|
1307
594
|
...overlayStyle,
|
|
@@ -1309,16 +596,16 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1309
596
|
alignItems: "center",
|
|
1310
597
|
backgroundColor: "rgba(0, 0, 0, 0.2)"
|
|
1311
598
|
},
|
|
1312
|
-
children: /* @__PURE__ */ (0,
|
|
599
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native14.Loader, { size: "large", type: "light" })
|
|
1313
600
|
}
|
|
1314
601
|
)
|
|
1315
602
|
] });
|
|
1316
603
|
}
|
|
1317
604
|
if (shouldShowProfileNotFoundOverlay) {
|
|
1318
|
-
return /* @__PURE__ */ (0,
|
|
1319
|
-
/* @__PURE__ */ (0,
|
|
1320
|
-
shouldShowProfileNotFoundOverlay && /* @__PURE__ */ (0,
|
|
1321
|
-
|
|
605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
606
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native15.View, { style: { flex: 1, position: "relative" }, children }),
|
|
607
|
+
shouldShowProfileNotFoundOverlay && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
608
|
+
import_react_native15.Pressable,
|
|
1322
609
|
{
|
|
1323
610
|
style: {
|
|
1324
611
|
...overlayStyle
|
|
@@ -1330,7 +617,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1330
617
|
)
|
|
1331
618
|
] });
|
|
1332
619
|
}
|
|
1333
|
-
return /* @__PURE__ */ (0,
|
|
620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native15.View, { style: { flex: 1, position: "relative" }, children }) });
|
|
1334
621
|
};
|
|
1335
622
|
var overlayStyle = {
|
|
1336
623
|
position: "absolute",
|
|
@@ -1342,19 +629,19 @@ var overlayStyle = {
|
|
|
1342
629
|
};
|
|
1343
630
|
|
|
1344
631
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
1345
|
-
var import_react_native_svg = require("@
|
|
1346
|
-
var
|
|
1347
|
-
var
|
|
632
|
+
var import_react_native_svg = require("@granite-js/native/react-native-svg");
|
|
633
|
+
var import_react_native19 = require("@toss-design-system/react-native");
|
|
634
|
+
var import_react_native20 = require("react-native");
|
|
1348
635
|
|
|
1349
636
|
// src/components/GameWebViewNavigationBar/HeaderRight.tsx
|
|
1350
|
-
var
|
|
637
|
+
var import_react_native17 = require("react-native");
|
|
1351
638
|
|
|
1352
639
|
// src/components/GameWebViewNavigationBar/byPlatform.ts
|
|
1353
|
-
var
|
|
640
|
+
var import_react_native16 = require("react-native");
|
|
1354
641
|
function byPlatform({
|
|
1355
642
|
...props
|
|
1356
643
|
}) {
|
|
1357
|
-
return (props[
|
|
644
|
+
return (props[import_react_native16.Platform.OS] ?? props.fallback)();
|
|
1358
645
|
}
|
|
1359
646
|
|
|
1360
647
|
// src/components/GameWebViewNavigationBar/constants.ts
|
|
@@ -1362,21 +649,21 @@ var RIGHT_MARGIN = 24;
|
|
|
1362
649
|
var IOS_DEFAULT_MARGIN = 20;
|
|
1363
650
|
|
|
1364
651
|
// src/components/GameWebViewNavigationBar/HeaderRight.tsx
|
|
1365
|
-
var
|
|
652
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1366
653
|
function IOSHeaderRight(props) {
|
|
1367
|
-
return /* @__PURE__ */ (0,
|
|
654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native17.View, { style: styles.ios, ...props });
|
|
1368
655
|
}
|
|
1369
656
|
function AndroidHeaderRight(props) {
|
|
1370
|
-
return /* @__PURE__ */ (0,
|
|
657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native17.View, { style: styles.android, ...props });
|
|
1371
658
|
}
|
|
1372
659
|
function HeaderRight(props) {
|
|
1373
660
|
return byPlatform({
|
|
1374
|
-
ios: () => /* @__PURE__ */ (0,
|
|
1375
|
-
android: () => /* @__PURE__ */ (0,
|
|
1376
|
-
fallback: () => /* @__PURE__ */ (0,
|
|
661
|
+
ios: () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IOSHeaderRight, { ...props }),
|
|
662
|
+
android: () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AndroidHeaderRight, { ...props }),
|
|
663
|
+
fallback: () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IOSHeaderRight, { ...props })
|
|
1377
664
|
});
|
|
1378
665
|
}
|
|
1379
|
-
var styles =
|
|
666
|
+
var styles = import_react_native17.StyleSheet.create({
|
|
1380
667
|
ios: {
|
|
1381
668
|
marginRight: -IOS_DEFAULT_MARGIN + RIGHT_MARGIN,
|
|
1382
669
|
flexDirection: "row"
|
|
@@ -1387,49 +674,49 @@ var styles = import_react_native13.StyleSheet.create({
|
|
|
1387
674
|
});
|
|
1388
675
|
|
|
1389
676
|
// src/components/GameWebViewNavigationBar/useSafeAreaTop.ts
|
|
1390
|
-
var import_react_native_safe_area_context = require("@
|
|
1391
|
-
var
|
|
677
|
+
var import_react_native_safe_area_context = require("@granite-js/native/react-native-safe-area-context");
|
|
678
|
+
var import_react_native18 = require("react-native");
|
|
1392
679
|
function useSafeAreaTop() {
|
|
1393
680
|
const safeAreaInsets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
1394
|
-
const hasDynamicIsland =
|
|
681
|
+
const hasDynamicIsland = import_react_native18.Platform.OS === "ios" && safeAreaInsets.top > 50;
|
|
1395
682
|
const safeAreaTop = hasDynamicIsland ? safeAreaInsets.top - 5 : safeAreaInsets.top;
|
|
1396
683
|
return safeAreaTop;
|
|
1397
684
|
}
|
|
1398
685
|
|
|
1399
686
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
1400
|
-
var
|
|
687
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1401
688
|
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>';
|
|
1402
689
|
function GameNavigationBar({ onClose }) {
|
|
1403
690
|
const safeAreaTop = useSafeAreaTop();
|
|
1404
|
-
return /* @__PURE__ */ (0,
|
|
1405
|
-
/* @__PURE__ */ (0,
|
|
1406
|
-
/* @__PURE__ */ (0,
|
|
1407
|
-
|
|
691
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
692
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native19.PageNavbar, { preference: { type: "none" } }),
|
|
693
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
694
|
+
import_react_native20.View,
|
|
1408
695
|
{
|
|
1409
696
|
style: {
|
|
1410
697
|
width: "100%",
|
|
1411
|
-
height:
|
|
698
|
+
height: import_react_native20.Platform.OS === "ios" ? 44 : 54,
|
|
1412
699
|
flexDirection: "row",
|
|
1413
700
|
alignItems: "center",
|
|
1414
701
|
justifyContent: "flex-end",
|
|
1415
702
|
position: "absolute",
|
|
1416
703
|
zIndex: Z_INDEX.CLOSE_BUTTON,
|
|
1417
704
|
marginTop: safeAreaTop,
|
|
1418
|
-
paddingRight:
|
|
705
|
+
paddingRight: import_react_native20.Platform.OS === "ios" ? 10 : 8
|
|
1419
706
|
},
|
|
1420
707
|
pointerEvents: "box-none",
|
|
1421
|
-
children: /* @__PURE__ */ (0,
|
|
1422
|
-
|
|
708
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HeaderRight, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
709
|
+
import_react_native20.TouchableOpacity,
|
|
1423
710
|
{
|
|
1424
711
|
hitSlop: { left: 8, right: 8 },
|
|
1425
712
|
accessibilityRole: "button",
|
|
1426
713
|
accessible: true,
|
|
1427
714
|
accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
|
|
1428
715
|
style: {
|
|
1429
|
-
padding:
|
|
716
|
+
padding: import_react_native20.Platform.OS === "ios" ? 7 : 9
|
|
1430
717
|
},
|
|
1431
718
|
onPress: onClose,
|
|
1432
|
-
children: /* @__PURE__ */ (0,
|
|
719
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native_svg.SvgXml, { xml: originXML, width: 30, height: 30 })
|
|
1433
720
|
}
|
|
1434
721
|
) })
|
|
1435
722
|
}
|
|
@@ -1438,13 +725,13 @@ function GameNavigationBar({ onClose }) {
|
|
|
1438
725
|
}
|
|
1439
726
|
|
|
1440
727
|
// src/components/GameWebView.tsx
|
|
1441
|
-
var
|
|
1442
|
-
var GameWebView = (0,
|
|
1443
|
-
const { openConfirm } = (0,
|
|
728
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
729
|
+
var GameWebView = (0, import_react8.forwardRef)(function GameWebView2(props, ref) {
|
|
730
|
+
const { openConfirm } = (0, import_react_native22.useDialog)();
|
|
1444
731
|
const { brandDisplayName } = getAppsInTossGlobals();
|
|
1445
732
|
const { captureExitLog } = useCaptureExitLog();
|
|
1446
|
-
const [isEntryMessageExited, setIsEntryMessageExited] = (0,
|
|
1447
|
-
const handleClose = (0,
|
|
733
|
+
const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react8.useState)(false);
|
|
734
|
+
const handleClose = (0, import_react8.useCallback)(async () => {
|
|
1448
735
|
const isConfirmed = await openConfirm({
|
|
1449
736
|
title: `${(0, import_es_hangul2.josa)(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
1450
737
|
leftButton: "\uCDE8\uC18C",
|
|
@@ -1453,43 +740,43 @@ var GameWebView = (0, import_react7.forwardRef)(function GameWebView2(props, ref
|
|
|
1453
740
|
});
|
|
1454
741
|
if (isConfirmed) {
|
|
1455
742
|
captureExitLog(Date.now());
|
|
1456
|
-
(0,
|
|
743
|
+
(0, import_react_native21.closeView)();
|
|
1457
744
|
}
|
|
1458
745
|
}, [brandDisplayName, captureExitLog, openConfirm]);
|
|
1459
|
-
(0,
|
|
1460
|
-
if (
|
|
1461
|
-
(0,
|
|
746
|
+
(0, import_react8.useEffect)(() => {
|
|
747
|
+
if (import_react_native23.Platform.OS === "ios") {
|
|
748
|
+
(0, import_native_modules8.setIosSwipeGestureEnabled)({ isEnabled: false });
|
|
1462
749
|
return () => {
|
|
1463
|
-
(0,
|
|
750
|
+
(0, import_native_modules8.setIosSwipeGestureEnabled)({ isEnabled: true });
|
|
1464
751
|
};
|
|
1465
752
|
}
|
|
1466
753
|
return;
|
|
1467
754
|
}, []);
|
|
1468
|
-
(0,
|
|
755
|
+
(0, import_react8.useEffect)(() => {
|
|
1469
756
|
const backHandler = () => {
|
|
1470
757
|
handleClose();
|
|
1471
758
|
return true;
|
|
1472
759
|
};
|
|
1473
|
-
|
|
760
|
+
import_react_native23.BackHandler.addEventListener("hardwareBackPress", backHandler);
|
|
1474
761
|
return () => {
|
|
1475
|
-
|
|
762
|
+
import_react_native23.BackHandler.removeEventListener("hardwareBackPress", backHandler);
|
|
1476
763
|
};
|
|
1477
764
|
}, [handleClose]);
|
|
1478
|
-
(0,
|
|
1479
|
-
appsInTossEvent.addEventListener("entryMessageExited", {
|
|
765
|
+
(0, import_react8.useEffect)(() => {
|
|
766
|
+
import_native_modules8.appsInTossEvent.addEventListener("entryMessageExited", {
|
|
1480
767
|
onEvent: () => {
|
|
1481
768
|
setIsEntryMessageExited(true);
|
|
1482
769
|
}
|
|
1483
770
|
});
|
|
1484
771
|
}, []);
|
|
1485
|
-
return /* @__PURE__ */ (0,
|
|
1486
|
-
/* @__PURE__ */ (0,
|
|
1487
|
-
getOperationalEnvironment() === "toss" ? /* @__PURE__ */ (0,
|
|
772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
773
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(GameNavigationBar, { onClose: handleClose }),
|
|
774
|
+
(0, import_native_modules8.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native_webview.WebView, { ref, ...props }) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native_webview.WebView, { ref, ...props })
|
|
1488
775
|
] });
|
|
1489
776
|
});
|
|
1490
777
|
|
|
1491
778
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1492
|
-
var
|
|
779
|
+
var import_react9 = require("react");
|
|
1493
780
|
function serializeError(error) {
|
|
1494
781
|
return JSON.stringify(error, (_, value) => {
|
|
1495
782
|
if (value instanceof Error) {
|
|
@@ -1521,12 +808,12 @@ function methodHandler({
|
|
|
1521
808
|
};
|
|
1522
809
|
wrappedFunc(...args).then((result) => {
|
|
1523
810
|
injectJavaScript?.(`
|
|
1524
|
-
window.
|
|
811
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/resolve/${eventId}', ${JSON.stringify(result, null, 0)});
|
|
1525
812
|
`);
|
|
1526
813
|
}).catch((error) => {
|
|
1527
814
|
const serializedError = serializeError(error);
|
|
1528
815
|
injectJavaScript?.(`
|
|
1529
|
-
window.
|
|
816
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/reject/${eventId}', ${serializedError});
|
|
1530
817
|
`);
|
|
1531
818
|
});
|
|
1532
819
|
}
|
|
@@ -1538,8 +825,8 @@ function useBridgeHandler({
|
|
|
1538
825
|
eventListenerMap,
|
|
1539
826
|
injectedJavaScript: originalInjectedJavaScript
|
|
1540
827
|
}) {
|
|
1541
|
-
const ref = (0,
|
|
1542
|
-
const injectedJavaScript = (0,
|
|
828
|
+
const ref = (0, import_react9.useRef)(null);
|
|
829
|
+
const injectedJavaScript = (0, import_react9.useMemo)(
|
|
1543
830
|
() => [
|
|
1544
831
|
`window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
1545
832
|
Object.entries(constantHandlerMap).reduce(
|
|
@@ -1557,15 +844,15 @@ function useBridgeHandler({
|
|
|
1557
844
|
);
|
|
1558
845
|
const createHandleOnEvent = (functionName, eventId) => (response) => {
|
|
1559
846
|
ref.current?.injectJavaScript(`
|
|
1560
|
-
window.
|
|
847
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onEvent/${eventId}', ${JSON.stringify(response, null, 0)});
|
|
1561
848
|
`);
|
|
1562
849
|
};
|
|
1563
850
|
const createHandleOnError = (functionName, eventId) => (error) => {
|
|
1564
851
|
ref.current?.injectJavaScript(`
|
|
1565
|
-
window.
|
|
852
|
+
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
|
|
1566
853
|
`);
|
|
1567
854
|
};
|
|
1568
|
-
const $onMessage = (0,
|
|
855
|
+
const $onMessage = (0, import_react9.useCallback)(
|
|
1569
856
|
async (e) => {
|
|
1570
857
|
onMessage?.(e);
|
|
1571
858
|
const data = JSON.parse(e.nativeEvent.data);
|
|
@@ -1615,24 +902,9 @@ function useBridgeHandler({
|
|
|
1615
902
|
};
|
|
1616
903
|
}
|
|
1617
904
|
|
|
1618
|
-
// src/constant-bridges.ts
|
|
1619
|
-
var constant_bridges_exports = {};
|
|
1620
|
-
__export(constant_bridges_exports, {
|
|
1621
|
-
getDeviceId: () => getDeviceId,
|
|
1622
|
-
getOperationalEnvironment: () => getOperationalEnvironment,
|
|
1623
|
-
getTossAppVersion: () => getTossAppVersion
|
|
1624
|
-
});
|
|
1625
|
-
|
|
1626
|
-
// src/event-bridges.ts
|
|
1627
|
-
var event_bridges_exports = {};
|
|
1628
|
-
__export(event_bridges_exports, {
|
|
1629
|
-
contactsViral: () => contactsViral,
|
|
1630
|
-
startUpdateLocation: () => startUpdateLocation
|
|
1631
|
-
});
|
|
1632
|
-
|
|
1633
905
|
// src/hooks/useCreateUserAgent.ts
|
|
1634
|
-
var
|
|
1635
|
-
var
|
|
906
|
+
var import_native_modules9 = require("@apps-in-toss/native-modules");
|
|
907
|
+
var import_react_native24 = require("react-native");
|
|
1636
908
|
var FontA11yCategory = {
|
|
1637
909
|
Large: "Large",
|
|
1638
910
|
xLarge: "xLarge",
|
|
@@ -1765,9 +1037,9 @@ function useCreateUserAgent({
|
|
|
1765
1037
|
safeArea,
|
|
1766
1038
|
safeAreaBottomTransparency
|
|
1767
1039
|
}) {
|
|
1768
|
-
const platform = (0,
|
|
1769
|
-
const appVersion = getTossAppVersion();
|
|
1770
|
-
const { fontScale } = (0,
|
|
1040
|
+
const platform = (0, import_native_modules9.getPlatformOS)();
|
|
1041
|
+
const appVersion = (0, import_native_modules9.getTossAppVersion)();
|
|
1042
|
+
const { fontScale } = (0, import_react_native24.useWindowDimensions)();
|
|
1771
1043
|
const platformString = platform === "ios" ? "iPhone" : "Android";
|
|
1772
1044
|
const fontA11y = mapFontScaleToCategory(fontScale, platform);
|
|
1773
1045
|
const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
|
|
@@ -1787,16 +1059,17 @@ function useCreateUserAgent({
|
|
|
1787
1059
|
}
|
|
1788
1060
|
|
|
1789
1061
|
// src/hooks/useGeolocation.ts
|
|
1790
|
-
var
|
|
1791
|
-
var
|
|
1062
|
+
var import_native_modules10 = require("@apps-in-toss/native-modules");
|
|
1063
|
+
var import_react_native25 = require("@granite-js/react-native");
|
|
1064
|
+
var import_react10 = require("react");
|
|
1792
1065
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1793
|
-
const isVisible = (0,
|
|
1794
|
-
const [location, setLocation] = (0,
|
|
1795
|
-
(0,
|
|
1066
|
+
const isVisible = (0, import_react_native25.useVisibility)();
|
|
1067
|
+
const [location, setLocation] = (0, import_react10.useState)(null);
|
|
1068
|
+
(0, import_react10.useEffect)(() => {
|
|
1796
1069
|
if (!isVisible) {
|
|
1797
1070
|
return;
|
|
1798
1071
|
}
|
|
1799
|
-
return startUpdateLocation({
|
|
1072
|
+
return (0, import_native_modules10.startUpdateLocation)({
|
|
1800
1073
|
options: {
|
|
1801
1074
|
accuracy,
|
|
1802
1075
|
distanceInterval,
|
|
@@ -1810,7 +1083,8 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
1810
1083
|
}
|
|
1811
1084
|
|
|
1812
1085
|
// src/utils/log.ts
|
|
1813
|
-
var
|
|
1086
|
+
var import_native_modules11 = require("@apps-in-toss/native-modules");
|
|
1087
|
+
var import_react_native26 = require("@granite-js/react-native");
|
|
1814
1088
|
|
|
1815
1089
|
// src/utils/extractDateFromUUIDv7.ts
|
|
1816
1090
|
var extractDateFromUUIDv7 = (uuid) => {
|
|
@@ -1836,7 +1110,7 @@ var getGroupId = (url) => {
|
|
|
1836
1110
|
};
|
|
1837
1111
|
var getReferrer = () => {
|
|
1838
1112
|
try {
|
|
1839
|
-
const referrer = new URL((0,
|
|
1113
|
+
const referrer = new URL((0, import_react_native26.getSchemeUri)());
|
|
1840
1114
|
return referrer.searchParams.get("referrer");
|
|
1841
1115
|
} catch {
|
|
1842
1116
|
return "";
|
|
@@ -1854,22 +1128,22 @@ var trackScreen = (url) => {
|
|
|
1854
1128
|
deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
|
|
1855
1129
|
}
|
|
1856
1130
|
};
|
|
1857
|
-
return eventLog(log);
|
|
1131
|
+
return (0, import_native_modules11.eventLog)(log);
|
|
1858
1132
|
};
|
|
1859
1133
|
|
|
1860
1134
|
// src/components/WebView.tsx
|
|
1861
|
-
var
|
|
1135
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1862
1136
|
var appsInTossGlobals = getAppsInTossGlobals();
|
|
1863
|
-
var operationalEnvironment = getOperationalEnvironment();
|
|
1137
|
+
var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
|
|
1864
1138
|
var TYPES = ["partner", "external", "game"];
|
|
1865
1139
|
var WEBVIEW_TYPES = {
|
|
1866
|
-
partner:
|
|
1867
|
-
external:
|
|
1140
|
+
partner: import_react_native28.PartnerWebViewScreen,
|
|
1141
|
+
external: import_react_native28.ExternalWebViewScreen,
|
|
1868
1142
|
game: GameWebView
|
|
1869
1143
|
};
|
|
1870
1144
|
function mergeSchemeQueryParamsInto(url) {
|
|
1871
1145
|
const baseUrl = new URL(url);
|
|
1872
|
-
const schemeUrl = new URL((0,
|
|
1146
|
+
const schemeUrl = new URL((0, import_react_native27.getSchemeUri)());
|
|
1873
1147
|
baseUrl.pathname = schemeUrl.pathname;
|
|
1874
1148
|
for (const [key, value] of schemeUrl.searchParams.entries()) {
|
|
1875
1149
|
baseUrl.searchParams.set(key, value);
|
|
@@ -1881,7 +1155,7 @@ function getWebViewUri(local) {
|
|
|
1881
1155
|
const devUrl = `http://${local.host}:${local.port}`;
|
|
1882
1156
|
return mergeSchemeQueryParamsInto(devUrl).toString();
|
|
1883
1157
|
}
|
|
1884
|
-
const { url: rawUrl } = AppsInTossModule.getWebBundleURL({});
|
|
1158
|
+
const { url: rawUrl } = import_native_modules12.AppsInTossModule.getWebBundleURL({});
|
|
1885
1159
|
const url = mergeSchemeQueryParamsInto(rawUrl);
|
|
1886
1160
|
const deploymentId = env.getDeploymentId();
|
|
1887
1161
|
if (deploymentId) {
|
|
@@ -1893,12 +1167,12 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1893
1167
|
if (!TYPES.includes(type)) {
|
|
1894
1168
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
1895
1169
|
}
|
|
1896
|
-
const
|
|
1897
|
-
const uri = (0,
|
|
1170
|
+
const graniteEvent = (0, import_react_native27.useGraniteEvent)();
|
|
1171
|
+
const uri = (0, import_react11.useMemo)(() => getWebViewUri(local), [local]);
|
|
1898
1172
|
const top = (0, import_private3.useSafeAreaTop)();
|
|
1899
1173
|
const bottom = (0, import_private3.useSafeAreaBottom)();
|
|
1900
1174
|
const global2 = getAppsInTossGlobals();
|
|
1901
|
-
const partner = (0,
|
|
1175
|
+
const partner = (0, import_react_native28.usePartnerNavigation)();
|
|
1902
1176
|
const disableTextSelectionCSS = `
|
|
1903
1177
|
(function() {
|
|
1904
1178
|
const style = document.createElement('style');
|
|
@@ -1906,7 +1180,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1906
1180
|
document.head.appendChild(style);
|
|
1907
1181
|
})();
|
|
1908
1182
|
`;
|
|
1909
|
-
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0,
|
|
1183
|
+
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0, import_react11.useState)(
|
|
1910
1184
|
props.allowsBackForwardNavigationGestures
|
|
1911
1185
|
);
|
|
1912
1186
|
const handler = useBridgeHandler({
|
|
@@ -1914,58 +1188,58 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1914
1188
|
injectedJavaScript: [disableTextSelectionCSS].join("\n"),
|
|
1915
1189
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1916
1190
|
eventListenerMap: {
|
|
1917
|
-
...
|
|
1918
|
-
navigationAccessoryEvent: ({ onEvent, onError }) =>
|
|
1191
|
+
...appsInTossEventBridges,
|
|
1192
|
+
navigationAccessoryEvent: ({ onEvent, onError }) => import_react_native28.tdsEvent.addEventListener("navigationAccessoryEvent", {
|
|
1919
1193
|
onEvent,
|
|
1920
1194
|
onError
|
|
1921
1195
|
}),
|
|
1922
|
-
backEvent: ({ onEvent, onError, options }) =>
|
|
1923
|
-
entryMessageExited: ({ onEvent, onError }) => appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
1924
|
-
updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
1196
|
+
backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
|
|
1197
|
+
entryMessageExited: ({ onEvent, onError }) => import_native_modules12.appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
1198
|
+
updateLocationEvent: ({ onEvent, onError, options }) => import_native_modules12.appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
1925
1199
|
/** @internal */
|
|
1926
|
-
appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
|
|
1200
|
+
appBridgeCallbackEvent: ({ onEvent, onError, options }) => import_native_modules12.appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
|
|
1927
1201
|
/** AdMob */
|
|
1928
|
-
loadAdMobInterstitialAd: GoogleAdMob.loadAdMobInterstitialAd,
|
|
1929
|
-
showAdMobInterstitialAd: GoogleAdMob.showAdMobInterstitialAd,
|
|
1930
|
-
loadAdMobRewardedAd: GoogleAdMob.loadAdMobRewardedAd,
|
|
1931
|
-
showAdMobRewardedAd: GoogleAdMob.showAdMobRewardedAd
|
|
1202
|
+
loadAdMobInterstitialAd: import_native_modules12.GoogleAdMob.loadAdMobInterstitialAd,
|
|
1203
|
+
showAdMobInterstitialAd: import_native_modules12.GoogleAdMob.showAdMobInterstitialAd,
|
|
1204
|
+
loadAdMobRewardedAd: import_native_modules12.GoogleAdMob.loadAdMobRewardedAd,
|
|
1205
|
+
showAdMobRewardedAd: import_native_modules12.GoogleAdMob.showAdMobRewardedAd
|
|
1932
1206
|
},
|
|
1933
1207
|
constantHandlerMap: {
|
|
1934
|
-
...
|
|
1935
|
-
...
|
|
1208
|
+
...graniteConstantBridges,
|
|
1209
|
+
...appsInTossConstantBridges,
|
|
1936
1210
|
getSafeAreaTop: () => top,
|
|
1937
1211
|
getSafeAreaBottom: () => bottom,
|
|
1938
1212
|
...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
|
|
1939
1213
|
/** AdMob */
|
|
1940
|
-
loadAdMobInterstitialAd_isSupported: GoogleAdMob.loadAdMobInterstitialAd.isSupported,
|
|
1941
|
-
showAdMobInterstitialAd_isSupported: GoogleAdMob.showAdMobInterstitialAd.isSupported,
|
|
1942
|
-
loadAdMobRewardedAd_isSupported: GoogleAdMob.loadAdMobRewardedAd.isSupported,
|
|
1943
|
-
showAdMobRewardedAd_isSupported: GoogleAdMob.showAdMobRewardedAd.isSupported,
|
|
1214
|
+
loadAdMobInterstitialAd_isSupported: import_native_modules12.GoogleAdMob.loadAdMobInterstitialAd.isSupported,
|
|
1215
|
+
showAdMobInterstitialAd_isSupported: import_native_modules12.GoogleAdMob.showAdMobInterstitialAd.isSupported,
|
|
1216
|
+
loadAdMobRewardedAd_isSupported: import_native_modules12.GoogleAdMob.loadAdMobRewardedAd.isSupported,
|
|
1217
|
+
showAdMobRewardedAd_isSupported: import_native_modules12.GoogleAdMob.showAdMobRewardedAd.isSupported,
|
|
1944
1218
|
/** env */
|
|
1945
1219
|
getDeploymentId: env.getDeploymentId
|
|
1946
1220
|
},
|
|
1947
1221
|
asyncHandlerMap: {
|
|
1948
|
-
...
|
|
1949
|
-
...
|
|
1222
|
+
...graniteAsyncBridges,
|
|
1223
|
+
...appsInTossAsyncBridges,
|
|
1950
1224
|
setIosSwipeGestureEnabled: (options) => {
|
|
1951
1225
|
setAllowsBackForwardNavigationGestures(options.isEnabled);
|
|
1952
|
-
return
|
|
1226
|
+
return appsInTossAsyncBridges.setIosSwipeGestureEnabled(options);
|
|
1953
1227
|
},
|
|
1954
1228
|
addAccessoryButton: async (params) => partner.addAccessoryButton(params),
|
|
1955
1229
|
removeAccessoryButton: async () => partner.removeAccessoryButton(),
|
|
1956
1230
|
/** internal */
|
|
1957
|
-
openPermissionDialog: AppsInTossModule.openPermissionDialog,
|
|
1231
|
+
openPermissionDialog: import_native_modules12.AppsInTossModule.openPermissionDialog,
|
|
1958
1232
|
/** Storage */
|
|
1959
|
-
getStorageItem: Storage.getItem,
|
|
1960
|
-
setStorageItem: Storage.setItem,
|
|
1961
|
-
removeStorageItem: Storage.removeItem,
|
|
1962
|
-
clearItems: Storage.clearItems,
|
|
1233
|
+
getStorageItem: import_native_modules12.Storage.getItem,
|
|
1234
|
+
setStorageItem: import_native_modules12.Storage.setItem,
|
|
1235
|
+
removeStorageItem: import_native_modules12.Storage.removeItem,
|
|
1236
|
+
clearItems: import_native_modules12.Storage.clearItems,
|
|
1963
1237
|
/** IAP */
|
|
1964
|
-
iapCreateOneTimePurchaseOrder: IAP.createOneTimePurchaseOrder,
|
|
1965
|
-
iapGetProductItemList: IAP.getProductItemList
|
|
1238
|
+
iapCreateOneTimePurchaseOrder: import_native_modules12.IAP.createOneTimePurchaseOrder,
|
|
1239
|
+
iapGetProductItemList: import_native_modules12.IAP.getProductItemList
|
|
1966
1240
|
}
|
|
1967
1241
|
});
|
|
1968
|
-
const baseProps = (0,
|
|
1242
|
+
const baseProps = (0, import_react11.useMemo)(() => {
|
|
1969
1243
|
switch (type) {
|
|
1970
1244
|
case "partner": {
|
|
1971
1245
|
const headerOnlyProp = {
|
|
@@ -1994,8 +1268,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1994
1268
|
}, [type, props]);
|
|
1995
1269
|
const BaseWebView = WEBVIEW_TYPES[type];
|
|
1996
1270
|
const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
|
|
1997
|
-
const [canHistoryGoBack, setCanHistoryGoBack] = (0,
|
|
1998
|
-
const handleNavigationStateChange = (0,
|
|
1271
|
+
const [canHistoryGoBack, setCanHistoryGoBack] = (0, import_react11.useState)(false);
|
|
1272
|
+
const handleNavigationStateChange = (0, import_react11.useCallback)(
|
|
1999
1273
|
(event) => {
|
|
2000
1274
|
if (event.url) {
|
|
2001
1275
|
trackScreen(event.url);
|
|
@@ -2007,7 +1281,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2007
1281
|
const userAgent = useCreateUserAgent({
|
|
2008
1282
|
colorPreference: "light"
|
|
2009
1283
|
});
|
|
2010
|
-
const handleBackEvent = (0,
|
|
1284
|
+
const handleBackEvent = (0, import_react11.useCallback)(() => {
|
|
2011
1285
|
if (canHistoryGoBack) {
|
|
2012
1286
|
handler.ref.current?.goBack();
|
|
2013
1287
|
return true;
|
|
@@ -2015,11 +1289,11 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2015
1289
|
return false;
|
|
2016
1290
|
}
|
|
2017
1291
|
}, [canHistoryGoBack, handler]);
|
|
2018
|
-
(0,
|
|
2019
|
-
|
|
2020
|
-
return () =>
|
|
1292
|
+
(0, import_react11.useEffect)(() => {
|
|
1293
|
+
import_react_native29.BackHandler.addEventListener("hardwareBackPress", handleBackEvent);
|
|
1294
|
+
return () => import_react_native29.BackHandler.removeEventListener("hardwareBackPress", handleBackEvent);
|
|
2021
1295
|
}, [handleBackEvent]);
|
|
2022
|
-
return /* @__PURE__ */ (0,
|
|
1296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2023
1297
|
BaseWebView,
|
|
2024
1298
|
{
|
|
2025
1299
|
ref: handler.ref,
|
|
@@ -2032,7 +1306,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2032
1306
|
"User-Agent": userAgent
|
|
2033
1307
|
}
|
|
2034
1308
|
},
|
|
2035
|
-
userAgent:
|
|
1309
|
+
userAgent: import_react_native29.Platform.OS === "ios" ? userAgent : void 0,
|
|
2036
1310
|
sharedCookiesEnabled: true,
|
|
2037
1311
|
webviewDebuggingEnabled: webViewDebuggingEnabled,
|
|
2038
1312
|
thirdPartyCookiesEnabled: true,
|
|
@@ -2040,7 +1314,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2040
1314
|
onNavigationStateChange: handleNavigationStateChange,
|
|
2041
1315
|
injectedJavaScript: handler.injectedJavaScript,
|
|
2042
1316
|
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
|
|
2043
|
-
decelerationRate:
|
|
1317
|
+
decelerationRate: import_react_native29.Platform.OS === "ios" ? 1 : void 0,
|
|
2044
1318
|
allowsBackForwardNavigationGestures
|
|
2045
1319
|
}
|
|
2046
1320
|
);
|
|
@@ -2052,19 +1326,9 @@ function ensureValue(value, name) {
|
|
|
2052
1326
|
return value;
|
|
2053
1327
|
}
|
|
2054
1328
|
|
|
2055
|
-
// src/types.ts
|
|
2056
|
-
var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
2057
|
-
Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
|
|
2058
|
-
Accuracy3[Accuracy3["Low"] = 2] = "Low";
|
|
2059
|
-
Accuracy3[Accuracy3["Balanced"] = 3] = "Balanced";
|
|
2060
|
-
Accuracy3[Accuracy3["High"] = 4] = "High";
|
|
2061
|
-
Accuracy3[Accuracy3["Highest"] = 5] = "Highest";
|
|
2062
|
-
Accuracy3[Accuracy3["BestForNavigation"] = 6] = "BestForNavigation";
|
|
2063
|
-
return Accuracy3;
|
|
2064
|
-
})(Accuracy2 || {});
|
|
2065
|
-
|
|
2066
1329
|
// src/index.ts
|
|
2067
1330
|
__reExport(src_exports, require("@apps-in-toss/analytics"), module.exports);
|
|
1331
|
+
__reExport(src_exports, require("@apps-in-toss/native-modules"), module.exports);
|
|
2068
1332
|
var Analytics2 = {
|
|
2069
1333
|
init: import_analytics2.Analytics.init,
|
|
2070
1334
|
Impression: import_analytics2.Analytics.Impression,
|
|
@@ -2073,38 +1337,13 @@ var Analytics2 = {
|
|
|
2073
1337
|
};
|
|
2074
1338
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2075
1339
|
0 && (module.exports = {
|
|
2076
|
-
Accuracy,
|
|
2077
1340
|
Analytics,
|
|
2078
1341
|
AppsInToss,
|
|
2079
|
-
GoogleAdMob,
|
|
2080
|
-
IAP,
|
|
2081
1342
|
INTERNAL__onVisibilityChangedByTransparentServiceWeb,
|
|
2082
|
-
Storage,
|
|
2083
|
-
TossPay,
|
|
2084
1343
|
WebView,
|
|
2085
|
-
appLogin,
|
|
2086
|
-
appsInTossEvent,
|
|
2087
|
-
contactsViral,
|
|
2088
1344
|
env,
|
|
2089
|
-
eventLog,
|
|
2090
|
-
fetchAlbumPhotos,
|
|
2091
|
-
fetchContacts,
|
|
2092
|
-
getClipboardText,
|
|
2093
|
-
getCurrentLocation,
|
|
2094
|
-
getDeviceId,
|
|
2095
|
-
getGameCenterGameProfile,
|
|
2096
|
-
getOperationalEnvironment,
|
|
2097
|
-
getTossAppVersion,
|
|
2098
|
-
getTossShareLink,
|
|
2099
|
-
isMinVersionSupported,
|
|
2100
|
-
openCamera,
|
|
2101
|
-
openGameCenterLeaderboard,
|
|
2102
|
-
saveBase64Data,
|
|
2103
|
-
setClipboardText,
|
|
2104
|
-
setDeviceOrientation,
|
|
2105
|
-
startUpdateLocation,
|
|
2106
|
-
submitGameCenterLeaderBoardScore,
|
|
2107
1345
|
useCreateUserAgent,
|
|
2108
1346
|
useGeolocation,
|
|
2109
|
-
...require("@apps-in-toss/analytics")
|
|
1347
|
+
...require("@apps-in-toss/analytics"),
|
|
1348
|
+
...require("@apps-in-toss/native-modules")
|
|
2110
1349
|
});
|