@apps-in-toss/framework 0.0.0-dev.1744801739343 → 0.0.0-dev.1747216176095
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 +695 -160
- package/dist/index.d.cts +891 -343
- package/dist/index.d.ts +891 -343
- package/dist/index.js +661 -132
- package/package.json +16 -14
- package/src/async-bridges.ts +10 -9
- package/src/constant-bridges.ts +3 -3
- package/src/event-bridges.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
21
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
22
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
23
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -31,12 +32,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
32
|
var src_exports = {};
|
|
32
33
|
__export(src_exports, {
|
|
33
34
|
Accuracy: () => Accuracy2,
|
|
35
|
+
Analytics: () => Analytics2,
|
|
34
36
|
AppsInToss: () => AppsInToss,
|
|
37
|
+
GoogleAdMob: () => GoogleAdMob,
|
|
35
38
|
Storage: () => Storage,
|
|
36
39
|
TossPay: () => TossPay,
|
|
37
40
|
WebView: () => WebView,
|
|
38
41
|
appLogin: () => appLogin,
|
|
42
|
+
appsInTossEvent: () => appsInTossEvent,
|
|
39
43
|
env: () => env,
|
|
44
|
+
eventLog: () => eventLog,
|
|
40
45
|
fetchAlbumPhotos: () => fetchAlbumPhotos,
|
|
41
46
|
fetchContacts: () => fetchContacts,
|
|
42
47
|
getClipboardText: () => getClipboardText,
|
|
@@ -44,88 +49,232 @@ __export(src_exports, {
|
|
|
44
49
|
getDeviceId: () => getDeviceId,
|
|
45
50
|
getOperationalEnvironment: () => getOperationalEnvironment,
|
|
46
51
|
getTossAppVersion: () => getTossAppVersion,
|
|
52
|
+
getTossShareLink: () => getTossShareLink,
|
|
53
|
+
isMinVersionSupported: () => isMinVersionSupported,
|
|
47
54
|
openCamera: () => openCamera,
|
|
48
55
|
setClipboardText: () => setClipboardText,
|
|
49
56
|
startUpdateLocation: () => startUpdateLocation,
|
|
50
57
|
useGeolocation: () => useGeolocation
|
|
51
58
|
});
|
|
52
59
|
module.exports = __toCommonJS(src_exports);
|
|
60
|
+
var import_analytics2 = require("@apps-in-toss/analytics");
|
|
53
61
|
|
|
54
62
|
// src/core/registerApp.tsx
|
|
55
|
-
var
|
|
56
|
-
var
|
|
63
|
+
var import_analytics = require("@apps-in-toss/analytics");
|
|
64
|
+
var import_react_native6 = require("@toss-design-system/react-native");
|
|
65
|
+
var import_react_native_bedrock7 = require("react-native-bedrock");
|
|
57
66
|
|
|
58
|
-
// src/core/
|
|
59
|
-
var
|
|
60
|
-
var
|
|
67
|
+
// src/core/components/AppEvent.tsx
|
|
68
|
+
var import_react2 = require("react");
|
|
69
|
+
var import_react_native_bedrock2 = require("react-native-bedrock");
|
|
61
70
|
|
|
62
|
-
// src/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
71
|
+
// src/env.ts
|
|
72
|
+
var env = {
|
|
73
|
+
getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// src/native-modules/tossCore.ts
|
|
77
|
+
var import_react_native3 = require("react-native");
|
|
78
|
+
|
|
79
|
+
// src/native-modules/AppsInTossModule.ts
|
|
80
|
+
var import_react_native = require("react-native");
|
|
81
|
+
var AppsInTossModuleInstance = import_react_native.NativeModules.AppsInTossModule;
|
|
82
|
+
var AppsInTossModule = AppsInTossModuleInstance;
|
|
83
|
+
|
|
84
|
+
// src/native-modules/getOperationalEnvironment.ts
|
|
85
|
+
function getOperationalEnvironment() {
|
|
86
|
+
return AppsInTossModule.operationalEnvironment;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// src/native-modules/isMinVersionSupported.ts
|
|
90
|
+
var import_react_native2 = require("react-native");
|
|
91
|
+
|
|
92
|
+
// src/utils/compareVersion.ts
|
|
93
|
+
var SEMVER_REGEX = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
|
|
94
|
+
var isWildcard = (val) => ["*", "x", "X"].includes(val);
|
|
95
|
+
var tryParse = (val) => {
|
|
96
|
+
const num = parseInt(val, 10);
|
|
97
|
+
return isNaN(num) ? val : num;
|
|
98
|
+
};
|
|
99
|
+
var coerceTypes = (a, b) => {
|
|
100
|
+
return typeof a === typeof b ? [a, b] : [String(a), String(b)];
|
|
101
|
+
};
|
|
102
|
+
var compareValues = (a, b) => {
|
|
103
|
+
if (isWildcard(a) || isWildcard(b)) {
|
|
104
|
+
return 0;
|
|
66
105
|
}
|
|
67
|
-
|
|
106
|
+
const [aVal, bVal] = coerceTypes(tryParse(a), tryParse(b));
|
|
107
|
+
if (aVal > bVal) {
|
|
108
|
+
return 1;
|
|
109
|
+
}
|
|
110
|
+
if (aVal < bVal) {
|
|
111
|
+
return -1;
|
|
112
|
+
}
|
|
113
|
+
return 0;
|
|
114
|
+
};
|
|
115
|
+
var parseVersion = (version) => {
|
|
116
|
+
if (typeof version !== "string") {
|
|
117
|
+
throw new TypeError("Invalid argument: expected a string");
|
|
118
|
+
}
|
|
119
|
+
const match = version.match(SEMVER_REGEX);
|
|
120
|
+
if (!match) {
|
|
121
|
+
throw new Error(`Invalid semver: '${version}'`);
|
|
122
|
+
}
|
|
123
|
+
const [, major, minor, patch, build, preRelease] = match;
|
|
124
|
+
return [major, minor, patch, build, preRelease];
|
|
125
|
+
};
|
|
126
|
+
var compareSegments = (a, b) => {
|
|
127
|
+
const maxLength = Math.max(a.length, b.length);
|
|
128
|
+
for (let i = 0; i < maxLength; i++) {
|
|
129
|
+
const segA = a[i] ?? "0";
|
|
130
|
+
const segB = b[i] ?? "0";
|
|
131
|
+
const result = compareValues(segA, segB);
|
|
132
|
+
if (result !== 0) {
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return 0;
|
|
137
|
+
};
|
|
138
|
+
var compareVersions = (v1, v2) => {
|
|
139
|
+
const seg1 = parseVersion(v1);
|
|
140
|
+
const seg2 = parseVersion(v2);
|
|
141
|
+
const preRelease1 = seg1.pop();
|
|
142
|
+
const preRelease2 = seg2.pop();
|
|
143
|
+
const mainCompare = compareSegments(seg1, seg2);
|
|
144
|
+
if (mainCompare !== 0) {
|
|
145
|
+
return mainCompare;
|
|
146
|
+
}
|
|
147
|
+
if (preRelease1 && preRelease2) {
|
|
148
|
+
return compareSegments(preRelease1.split("."), preRelease2.split("."));
|
|
149
|
+
}
|
|
150
|
+
if (preRelease1) {
|
|
151
|
+
return -1;
|
|
152
|
+
}
|
|
153
|
+
if (preRelease2) {
|
|
154
|
+
return 1;
|
|
155
|
+
}
|
|
156
|
+
return 0;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// src/native-modules/isMinVersionSupported.ts
|
|
160
|
+
function isMinVersionSupported(minVersions) {
|
|
161
|
+
const operationalEnvironment2 = AppsInTossModule.operationalEnvironment;
|
|
162
|
+
if (operationalEnvironment2 === "sandbox") {
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
const currentVersion = AppsInTossModule.tossAppVersion;
|
|
166
|
+
const isIOS = import_react_native2.Platform.OS === "ios";
|
|
167
|
+
const minVersion = isIOS ? minVersions.ios : minVersions.android;
|
|
168
|
+
if (minVersion === void 0) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
if (minVersion === "always") {
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
if (minVersion === "never") {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
return compareVersions(currentVersion, minVersion) >= 0;
|
|
68
178
|
}
|
|
69
179
|
|
|
70
|
-
// src/
|
|
71
|
-
|
|
72
|
-
|
|
180
|
+
// src/native-modules/tossCore.ts
|
|
181
|
+
var TossCoreModule = import_react_native3.NativeModules.TossCoreModule;
|
|
182
|
+
function tossCoreEventLog(params) {
|
|
183
|
+
const supported = isMinVersionSupported({ ios: "5.210.0", android: "5.210.0" });
|
|
184
|
+
const isSandbox = getOperationalEnvironment() === "sandbox";
|
|
185
|
+
if (!supported || isSandbox) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
TossCoreModule.eventLog({
|
|
189
|
+
params: {
|
|
190
|
+
log_name: params.log_name,
|
|
191
|
+
log_type: params.log_type,
|
|
192
|
+
params: params.params
|
|
193
|
+
}
|
|
194
|
+
});
|
|
73
195
|
}
|
|
74
196
|
|
|
75
|
-
// src/core/hooks/
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
(0, import_react.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
};
|
|
86
|
-
controller.open({ ...commonProps });
|
|
197
|
+
// src/core/hooks/useReferrer.ts
|
|
198
|
+
var import_react = require("react");
|
|
199
|
+
var import_react_native_bedrock = require("react-native-bedrock");
|
|
200
|
+
function useReferrer() {
|
|
201
|
+
return (0, import_react.useMemo)(() => {
|
|
202
|
+
try {
|
|
203
|
+
return new URL((0, import_react_native_bedrock.getSchemeUri)()).searchParams.get("referrer");
|
|
204
|
+
} catch {
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
87
207
|
}, []);
|
|
88
208
|
}
|
|
89
209
|
|
|
90
|
-
// src/core/
|
|
91
|
-
var
|
|
92
|
-
function
|
|
93
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Container, { ...initialProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TDSContainer, { ...initialProps, children }) }) });
|
|
94
|
-
}
|
|
95
|
-
function TDSContainer({ children }) {
|
|
96
|
-
useAppsInTossBridge();
|
|
97
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
98
|
-
}
|
|
99
|
-
function registerApp(container, { context }) {
|
|
100
|
-
return import_react_native_bedrock.Bedrock.registerApp(AppsInTossContainer.bind(null, container), {
|
|
101
|
-
appName: getAppName(),
|
|
102
|
-
context
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
function getAppName() {
|
|
210
|
+
// src/core/components/AppEvent.tsx
|
|
211
|
+
var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
|
|
212
|
+
function isPrivateScheme() {
|
|
106
213
|
try {
|
|
107
|
-
return
|
|
108
|
-
} catch
|
|
109
|
-
|
|
110
|
-
throw error;
|
|
214
|
+
return new URL((0, import_react_native_bedrock2.getSchemeUri)()).protocol === "intoss-private:";
|
|
215
|
+
} catch {
|
|
216
|
+
return false;
|
|
111
217
|
}
|
|
112
218
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
219
|
+
function EntryAppEvent() {
|
|
220
|
+
const referrer = useReferrer() ?? "";
|
|
221
|
+
(0, import_react2.useEffect)(() => {
|
|
222
|
+
tossCoreEventLog({
|
|
223
|
+
log_name: "appsintoss_app_visit::impression__enter_appsintoss",
|
|
224
|
+
log_type: "info",
|
|
225
|
+
params: {
|
|
226
|
+
is_transform: true,
|
|
227
|
+
schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
|
|
228
|
+
referrer,
|
|
229
|
+
deployment_id: env.getDeploymentId(),
|
|
230
|
+
app_name: import_react_native_bedrock2.Bedrock.appName,
|
|
231
|
+
is_private: isPrivateScheme()
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
}, [referrer]);
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
function SystemAppEvent({ ...initialProps }) {
|
|
238
|
+
(0, import_react2.useEffect)(() => {
|
|
239
|
+
tossCoreEventLog({
|
|
240
|
+
log_name: "AppsInTossInitialProps",
|
|
241
|
+
log_type: "debug",
|
|
242
|
+
params: {
|
|
243
|
+
...initialProps,
|
|
244
|
+
schemeUri: (0, import_react_native_bedrock2.getSchemeUri)(),
|
|
245
|
+
deployment_id: env.getDeploymentId(),
|
|
246
|
+
app_name: import_react_native_bedrock2.Bedrock.appName,
|
|
247
|
+
is_private: isPrivateScheme()
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}, [initialProps]);
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
var AppEvent = {
|
|
254
|
+
Entry: EntryAppEvent,
|
|
255
|
+
System: SystemAppEvent
|
|
117
256
|
};
|
|
118
257
|
|
|
119
|
-
// src/
|
|
258
|
+
// src/core/hooks/useAppsInTossBridge.ts
|
|
259
|
+
var import_react_native5 = require("@toss-design-system/react-native");
|
|
260
|
+
var import_react3 = require("react");
|
|
261
|
+
|
|
262
|
+
// src/native-event-emitter/appsInTossEvent.ts
|
|
263
|
+
var import_react_native_bedrock6 = require("react-native-bedrock");
|
|
264
|
+
|
|
265
|
+
// src/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts
|
|
120
266
|
var import_react_native_bedrock3 = require("react-native-bedrock");
|
|
267
|
+
var EntryMessageExitedEvent = class extends import_react_native_bedrock3.BedrockEventDefinition {
|
|
268
|
+
name = "entryMessageExited";
|
|
269
|
+
remove() {
|
|
270
|
+
}
|
|
271
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
272
|
+
listener(_) {
|
|
273
|
+
}
|
|
274
|
+
};
|
|
121
275
|
|
|
122
276
|
// src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
123
|
-
var
|
|
124
|
-
|
|
125
|
-
// src/native-modules/AppsInTossModule.ts
|
|
126
|
-
var import_react_native3 = require("react-native");
|
|
127
|
-
var AppsInTossModuleInstance = import_react_native3.NativeModules.AppsInTossModule;
|
|
128
|
-
var AppsInTossModule = AppsInTossModuleInstance;
|
|
277
|
+
var import_react_native_bedrock4 = require("react-native-bedrock");
|
|
129
278
|
|
|
130
279
|
// src/native-modules/getPermission.ts
|
|
131
280
|
function getPermission(permission) {
|
|
@@ -154,7 +303,7 @@ var import_react_native4 = require("react-native");
|
|
|
154
303
|
var nativeEventEmitter = new import_react_native4.NativeEventEmitter(AppsInTossModuleInstance);
|
|
155
304
|
|
|
156
305
|
// src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
157
|
-
var UpdateLocationEvent = class extends
|
|
306
|
+
var UpdateLocationEvent = class extends import_react_native_bedrock4.BedrockEventDefinition {
|
|
158
307
|
name = "updateLocationEvent";
|
|
159
308
|
subscriptionCount = 0;
|
|
160
309
|
ref = {
|
|
@@ -162,7 +311,9 @@ var UpdateLocationEvent = class extends import_react_native_bedrock2.BedrockEven
|
|
|
162
311
|
}
|
|
163
312
|
};
|
|
164
313
|
remove() {
|
|
165
|
-
--this.subscriptionCount === 0
|
|
314
|
+
if (--this.subscriptionCount === 0) {
|
|
315
|
+
AppsInTossModuleInstance.stopUpdateLocation({});
|
|
316
|
+
}
|
|
166
317
|
this.ref.remove();
|
|
167
318
|
}
|
|
168
319
|
listener(options, onEvent, onError) {
|
|
@@ -181,24 +332,148 @@ var UpdateLocationEvent = class extends import_react_native_bedrock2.BedrockEven
|
|
|
181
332
|
}
|
|
182
333
|
};
|
|
183
334
|
|
|
184
|
-
// src/native-event-emitter/
|
|
185
|
-
var
|
|
335
|
+
// src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
336
|
+
var import_react_native_bedrock5 = require("react-native-bedrock");
|
|
186
337
|
|
|
187
|
-
// src/
|
|
188
|
-
function
|
|
189
|
-
return
|
|
338
|
+
// src/utils/generateUUID.ts
|
|
339
|
+
function generateUUID(placeholder) {
|
|
340
|
+
return placeholder ? (placeholder ^ Math.random() * 16 >> placeholder / 4).toString(16) : (String(1e7) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, generateUUID);
|
|
190
341
|
}
|
|
191
342
|
|
|
192
|
-
// src/native-
|
|
193
|
-
|
|
194
|
-
|
|
343
|
+
// src/native-event-emitter/internal/appBridge.ts
|
|
344
|
+
var INTERNAL__callbacks = /* @__PURE__ */ new Map();
|
|
345
|
+
function invokeAppBridgeCallback(id, ...args) {
|
|
346
|
+
const callback = INTERNAL__callbacks.get(id);
|
|
347
|
+
callback?.call(null, ...args);
|
|
348
|
+
return Boolean(callback);
|
|
349
|
+
}
|
|
350
|
+
function invokeAppBridgeMethod(methodName, params, callbacks) {
|
|
351
|
+
const { onSuccess, onError, ...appBridgeCallbacks } = callbacks;
|
|
352
|
+
const { callbackMap, unregisterAll } = registerCallbacks(appBridgeCallbacks);
|
|
353
|
+
const promise = AppsInTossModuleInstance[methodName]({
|
|
354
|
+
params,
|
|
355
|
+
callbacks: callbackMap
|
|
356
|
+
});
|
|
357
|
+
void promise.then(onSuccess).catch(onError);
|
|
358
|
+
return unregisterAll;
|
|
359
|
+
}
|
|
360
|
+
function registerCallbacks(callbacks) {
|
|
361
|
+
const callbackMap = {};
|
|
362
|
+
for (const [callbackName, callback] of Object.entries(callbacks)) {
|
|
363
|
+
const id = registerCallback(callback, callbackName);
|
|
364
|
+
callbackMap[callbackName] = id;
|
|
365
|
+
}
|
|
366
|
+
const unregisterAll = () => {
|
|
367
|
+
Object.values(callbackMap).forEach(unregisterCallback);
|
|
368
|
+
};
|
|
369
|
+
return { callbackMap, unregisterAll };
|
|
370
|
+
}
|
|
371
|
+
function registerCallback(callback, name = "unnamed") {
|
|
372
|
+
const uniqueId = generateUUID();
|
|
373
|
+
const callbackId = `${uniqueId}__${name}`;
|
|
374
|
+
INTERNAL__callbacks.set(callbackId, callback);
|
|
375
|
+
return callbackId;
|
|
376
|
+
}
|
|
377
|
+
function unregisterCallback(id) {
|
|
378
|
+
INTERNAL__callbacks.delete(id);
|
|
379
|
+
}
|
|
380
|
+
function getCallbackIds() {
|
|
381
|
+
return Array.from(INTERNAL__callbacks.keys());
|
|
382
|
+
}
|
|
383
|
+
var INTERNAL__appBridgeHandler = {
|
|
384
|
+
invokeAppBridgeCallback,
|
|
385
|
+
invokeAppBridgeMethod,
|
|
386
|
+
registerCallback,
|
|
387
|
+
unregisterCallback,
|
|
388
|
+
getCallbackIds
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
// src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
392
|
+
var UNSAFE__nativeEventEmitter = nativeEventEmitter;
|
|
393
|
+
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends import_react_native_bedrock5.BedrockEventDefinition {
|
|
394
|
+
static INTERNAL__appBridgeSubscription;
|
|
395
|
+
name = "appBridgeCallbackEvent";
|
|
396
|
+
constructor() {
|
|
397
|
+
super();
|
|
398
|
+
this.registerAppBridgeCallbackEventListener();
|
|
399
|
+
}
|
|
400
|
+
remove() {
|
|
401
|
+
}
|
|
402
|
+
listener() {
|
|
403
|
+
}
|
|
404
|
+
registerAppBridgeCallbackEventListener() {
|
|
405
|
+
if (_AppBridgeCallbackEvent.INTERNAL__appBridgeSubscription != null) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
_AppBridgeCallbackEvent.INTERNAL__appBridgeSubscription = UNSAFE__nativeEventEmitter.addListener(
|
|
409
|
+
"appBridgeCallback",
|
|
410
|
+
this.ensureInvokeAppBridgeCallback
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
ensureInvokeAppBridgeCallback(result) {
|
|
414
|
+
if (typeof result === "object" && typeof result.name === "string") {
|
|
415
|
+
INTERNAL__appBridgeHandler.invokeAppBridgeCallback(result.name, result.params);
|
|
416
|
+
} else {
|
|
417
|
+
console.warn("Invalid app bridge callback result:", result);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
// src/native-event-emitter/appsInTossEvent.ts
|
|
423
|
+
var appsInTossEvent = new import_react_native_bedrock6.BedrockEvent([
|
|
424
|
+
new AppBridgeCallbackEvent(),
|
|
425
|
+
new UpdateLocationEvent(),
|
|
426
|
+
new EntryMessageExitedEvent()
|
|
427
|
+
]);
|
|
428
|
+
|
|
429
|
+
// src/core/utils/getAppsInTossGlobals.ts
|
|
430
|
+
function getAppsInTossGlobals() {
|
|
431
|
+
if (global.__appsInToss == null) {
|
|
432
|
+
throw new Error("invalid apps-in-toss globals");
|
|
433
|
+
}
|
|
434
|
+
return global.__appsInToss;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// src/core/utils/toIcon.ts
|
|
438
|
+
function toIcon(source) {
|
|
439
|
+
return source.startsWith("http") ? { source: { uri: source } } : { name: source };
|
|
195
440
|
}
|
|
196
441
|
|
|
197
|
-
// src/
|
|
198
|
-
|
|
199
|
-
|
|
442
|
+
// src/core/hooks/useAppsInTossBridge.ts
|
|
443
|
+
function useAppsInTossBridge() {
|
|
444
|
+
const controller = (0, import_react_native5.useBridge)();
|
|
445
|
+
const appsInTossGlobals2 = getAppsInTossGlobals();
|
|
446
|
+
(0, import_react3.useEffect)(() => {
|
|
447
|
+
const commonProps = {
|
|
448
|
+
serviceName: appsInTossGlobals2.brandDisplayName,
|
|
449
|
+
icon: toIcon(appsInTossGlobals2.brandIcon),
|
|
450
|
+
color: appsInTossGlobals2.brandPrimaryColor,
|
|
451
|
+
colorMode: appsInTossGlobals2.brandBridgeColorMode
|
|
452
|
+
};
|
|
453
|
+
controller.open({
|
|
454
|
+
...commonProps,
|
|
455
|
+
onExited: () => {
|
|
456
|
+
appsInTossEvent.emit("entryMessageExited", void 0);
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
}, []);
|
|
200
460
|
}
|
|
201
461
|
|
|
462
|
+
// src/async-bridges.ts
|
|
463
|
+
var async_bridges_exports = {};
|
|
464
|
+
__export(async_bridges_exports, {
|
|
465
|
+
appLogin: () => appLogin,
|
|
466
|
+
checkoutPayment: () => checkoutPayment,
|
|
467
|
+
eventLog: () => eventLog,
|
|
468
|
+
fetchAlbumPhotos: () => fetchAlbumPhotos,
|
|
469
|
+
fetchContacts: () => fetchContacts,
|
|
470
|
+
getClipboardText: () => getClipboardText,
|
|
471
|
+
getCurrentLocation: () => getCurrentLocation,
|
|
472
|
+
getTossShareLink: () => getTossShareLink,
|
|
473
|
+
openCamera: () => openCamera,
|
|
474
|
+
setClipboardText: () => setClipboardText
|
|
475
|
+
});
|
|
476
|
+
|
|
202
477
|
// src/native-modules/setClipboardText.ts
|
|
203
478
|
async function setClipboardText(text) {
|
|
204
479
|
const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
|
|
@@ -280,10 +555,203 @@ async function appLogin() {
|
|
|
280
555
|
return AppsInTossModule.appLogin({});
|
|
281
556
|
}
|
|
282
557
|
|
|
283
|
-
// src/native-modules/
|
|
284
|
-
function
|
|
285
|
-
return AppsInTossModule.
|
|
558
|
+
// src/native-modules/checkoutPayment.ts
|
|
559
|
+
async function checkoutPayment(options) {
|
|
560
|
+
return AppsInTossModule.checkoutPayment({ params: options });
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
// src/native-modules/eventLog.ts
|
|
564
|
+
function normalizeParams(params) {
|
|
565
|
+
return Object.fromEntries(
|
|
566
|
+
Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
async function eventLog(params) {
|
|
570
|
+
if (AppsInTossModule.operationalEnvironment === "sandbox") {
|
|
571
|
+
console.log("[eventLogDebug]", {
|
|
572
|
+
log_name: params.log_name,
|
|
573
|
+
log_type: params.log_type,
|
|
574
|
+
params: normalizeParams(params.params)
|
|
575
|
+
});
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
const isSupported = isMinVersionSupported({
|
|
579
|
+
android: "5.208.0",
|
|
580
|
+
ios: "5.208.0"
|
|
581
|
+
});
|
|
582
|
+
if (!isSupported) {
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
return AppsInTossModule.eventLog({
|
|
586
|
+
log_name: params.log_name,
|
|
587
|
+
log_type: params.log_type,
|
|
588
|
+
params: normalizeParams(params.params)
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
// src/native-modules/getTossShareLink.ts
|
|
593
|
+
async function getTossShareLink(path) {
|
|
594
|
+
const { shareLink } = await AppsInTossModule.getTossShareLink({});
|
|
595
|
+
const shareUrl = new URL(shareLink);
|
|
596
|
+
shareUrl.searchParams.set("deep_link_value", path);
|
|
597
|
+
shareUrl.searchParams.set("af_dp", path);
|
|
598
|
+
return shareUrl.toString();
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
// src/core/registerApp.tsx
|
|
602
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
603
|
+
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
605
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppEvent.Entry, {}),
|
|
606
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppEvent.System, { ...initialProps }),
|
|
607
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Container, { ...initialProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native6.TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TDSContainer, { ...initialProps, children }) }) })
|
|
608
|
+
] });
|
|
609
|
+
}
|
|
610
|
+
function TDSContainer({ children }) {
|
|
611
|
+
useAppsInTossBridge();
|
|
612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
613
|
+
}
|
|
614
|
+
function registerApp(container, { context, analytics }) {
|
|
615
|
+
import_analytics.Analytics.init({
|
|
616
|
+
logger: (params) => void eventLog(params),
|
|
617
|
+
debug: analytics?.debug ?? __DEV__
|
|
618
|
+
});
|
|
619
|
+
return import_react_native_bedrock7.Bedrock.registerApp(AppsInTossContainer.bind(null, container), {
|
|
620
|
+
appName: getAppName(),
|
|
621
|
+
context,
|
|
622
|
+
router: {
|
|
623
|
+
screenContainer: import_analytics.Analytics.Screen,
|
|
624
|
+
defaultScreenOption: {
|
|
625
|
+
statusBarStyle: "dark"
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
function getAppName() {
|
|
631
|
+
try {
|
|
632
|
+
return global.__bedrock.app.name;
|
|
633
|
+
} catch (error) {
|
|
634
|
+
console.error("unexpected error occurred while getting app name");
|
|
635
|
+
throw error;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
// src/core/index.ts
|
|
640
|
+
var AppsInToss = {
|
|
641
|
+
registerApp
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
// src/native-event-emitter/startUpdateLocation.ts
|
|
645
|
+
function startUpdateLocation(eventParams) {
|
|
646
|
+
return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
// ../../.yarn/cache/es-toolkit-npm-1.34.1-4cd6371dcb-aab6d07be3.zip/node_modules/es-toolkit/dist/function/noop.mjs
|
|
650
|
+
function noop() {
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
// src/native-modules/ads/googleAdMob.ts
|
|
654
|
+
function loadAdMobInterstitialAd(params) {
|
|
655
|
+
if (!loadAdMobInterstitialAd.isSupported()) {
|
|
656
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
657
|
+
return noop;
|
|
658
|
+
}
|
|
659
|
+
const { onEvent, onError, options } = params;
|
|
660
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobInterstitialAd", options, {
|
|
661
|
+
onAdClicked: () => {
|
|
662
|
+
onEvent({ type: "clicked" });
|
|
663
|
+
},
|
|
664
|
+
onAdDismissed: () => {
|
|
665
|
+
onEvent({ type: "dismissed" });
|
|
666
|
+
},
|
|
667
|
+
onAdFailedToShow: () => {
|
|
668
|
+
onEvent({ type: "failedToShow" });
|
|
669
|
+
},
|
|
670
|
+
onAdImpression: () => {
|
|
671
|
+
onEvent({ type: "impression" });
|
|
672
|
+
},
|
|
673
|
+
onAdShow: () => {
|
|
674
|
+
onEvent({ type: "show" });
|
|
675
|
+
},
|
|
676
|
+
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
677
|
+
onError
|
|
678
|
+
});
|
|
679
|
+
return unregisterCallbacks;
|
|
680
|
+
}
|
|
681
|
+
function showAdMobInterstitialAd(params) {
|
|
682
|
+
if (!showAdMobInterstitialAd.isSupported()) {
|
|
683
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
684
|
+
return noop;
|
|
685
|
+
}
|
|
686
|
+
const { onEvent, onError, options } = params;
|
|
687
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobInterstitialAd", options, {
|
|
688
|
+
onSuccess: () => onEvent({ type: "requested" }),
|
|
689
|
+
onError
|
|
690
|
+
});
|
|
691
|
+
return unregisterCallbacks;
|
|
692
|
+
}
|
|
693
|
+
function loadAdMobRewardedAd(params) {
|
|
694
|
+
if (!loadAdMobRewardedAd.isSupported()) {
|
|
695
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
696
|
+
return noop;
|
|
697
|
+
}
|
|
698
|
+
const { onEvent, onError, options } = params;
|
|
699
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobRewardedAd", options, {
|
|
700
|
+
onAdClicked: () => {
|
|
701
|
+
onEvent({ type: "clicked" });
|
|
702
|
+
},
|
|
703
|
+
onAdDismissed: () => {
|
|
704
|
+
onEvent({ type: "dismissed" });
|
|
705
|
+
},
|
|
706
|
+
onAdFailedToShow: () => {
|
|
707
|
+
onEvent({ type: "failedToShow" });
|
|
708
|
+
},
|
|
709
|
+
onAdImpression: () => {
|
|
710
|
+
onEvent({ type: "impression" });
|
|
711
|
+
},
|
|
712
|
+
onAdShow: () => {
|
|
713
|
+
onEvent({ type: "show" });
|
|
714
|
+
},
|
|
715
|
+
onUserEarnedReward: () => {
|
|
716
|
+
onEvent({ type: "userEarnedReward" });
|
|
717
|
+
},
|
|
718
|
+
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
719
|
+
onError
|
|
720
|
+
});
|
|
721
|
+
return unregisterCallbacks;
|
|
286
722
|
}
|
|
723
|
+
function showAdMobRewardedAd(params) {
|
|
724
|
+
if (!showAdMobRewardedAd.isSupported()) {
|
|
725
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
726
|
+
return noop;
|
|
727
|
+
}
|
|
728
|
+
const { onEvent, onError, options } = params;
|
|
729
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobRewardedAd", options, {
|
|
730
|
+
onSuccess: () => onEvent({ type: "requested" }),
|
|
731
|
+
onError
|
|
732
|
+
});
|
|
733
|
+
return unregisterCallbacks;
|
|
734
|
+
}
|
|
735
|
+
var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
|
|
736
|
+
var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
|
|
737
|
+
var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
|
|
738
|
+
var ENVIRONMENT = getOperationalEnvironment();
|
|
739
|
+
function createIsSupported() {
|
|
740
|
+
return () => {
|
|
741
|
+
if (ENVIRONMENT !== "toss") {
|
|
742
|
+
console.warn("Google AdMob is not supported in the current environment");
|
|
743
|
+
return false;
|
|
744
|
+
}
|
|
745
|
+
return isMinVersionSupported({
|
|
746
|
+
android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION,
|
|
747
|
+
ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION
|
|
748
|
+
});
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
loadAdMobInterstitialAd.isSupported = createIsSupported();
|
|
752
|
+
loadAdMobRewardedAd.isSupported = createIsSupported();
|
|
753
|
+
showAdMobInterstitialAd.isSupported = createIsSupported();
|
|
754
|
+
showAdMobRewardedAd.isSupported = createIsSupported();
|
|
287
755
|
|
|
288
756
|
// src/native-modules/getTossAppVersion.ts
|
|
289
757
|
function getTossAppVersion() {
|
|
@@ -320,40 +788,45 @@ var Storage = {
|
|
|
320
788
|
|
|
321
789
|
// src/native-modules/index.ts
|
|
322
790
|
var TossPay = {
|
|
323
|
-
checkoutPayment
|
|
324
|
-
|
|
791
|
+
checkoutPayment
|
|
792
|
+
};
|
|
793
|
+
var GoogleAdMob = {
|
|
794
|
+
loadAdMobInterstitialAd,
|
|
795
|
+
showAdMobInterstitialAd,
|
|
796
|
+
loadAdMobRewardedAd,
|
|
797
|
+
showAdMobRewardedAd
|
|
325
798
|
};
|
|
326
799
|
|
|
327
800
|
// src/components/WebView.tsx
|
|
328
|
-
var
|
|
801
|
+
var import_react_native14 = require("@toss-design-system/react-native");
|
|
329
802
|
var import_private = require("@toss-design-system/react-native/private");
|
|
330
|
-
var
|
|
331
|
-
var
|
|
803
|
+
var import_react6 = require("react");
|
|
804
|
+
var import_react_native_bedrock10 = require("react-native-bedrock");
|
|
332
805
|
var bedrockAsyncBridges = __toESM(require("react-native-bedrock/async-bridges"), 1);
|
|
333
806
|
var bedrockConstantBridges = __toESM(require("react-native-bedrock/constant-bridges"), 1);
|
|
334
807
|
|
|
335
808
|
// src/components/GameWebView.tsx
|
|
336
809
|
var import_react_native_webview = require("@react-native-bedrock/native/react-native-webview");
|
|
337
|
-
var
|
|
810
|
+
var import_react_native12 = require("@toss-design-system/react-native");
|
|
338
811
|
var import_es_hangul = require("es-hangul");
|
|
339
|
-
var
|
|
340
|
-
var
|
|
341
|
-
var
|
|
812
|
+
var import_react4 = require("react");
|
|
813
|
+
var import_react_native13 = require("react-native");
|
|
814
|
+
var import_react_native_bedrock8 = require("react-native-bedrock");
|
|
342
815
|
|
|
343
816
|
// src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
|
|
344
817
|
var import_react_native_svg = require("@react-native-bedrock/native/react-native-svg");
|
|
345
|
-
var
|
|
346
|
-
var
|
|
818
|
+
var import_react_native10 = require("@toss-design-system/react-native");
|
|
819
|
+
var import_react_native11 = require("react-native");
|
|
347
820
|
|
|
348
821
|
// src/components/GameWebViewNavigationBar/HeaderRight.tsx
|
|
349
|
-
var
|
|
822
|
+
var import_react_native8 = require("react-native");
|
|
350
823
|
|
|
351
824
|
// src/components/GameWebViewNavigationBar/byPlatform.ts
|
|
352
|
-
var
|
|
825
|
+
var import_react_native7 = require("react-native");
|
|
353
826
|
function byPlatform({
|
|
354
827
|
...props
|
|
355
828
|
}) {
|
|
356
|
-
return (props[
|
|
829
|
+
return (props[import_react_native7.Platform.OS] ?? props.fallback)();
|
|
357
830
|
}
|
|
358
831
|
|
|
359
832
|
// src/components/GameWebViewNavigationBar/constants.ts
|
|
@@ -363,10 +836,10 @@ var IOS_DEFAULT_MARGIN = 20;
|
|
|
363
836
|
// src/components/GameWebViewNavigationBar/HeaderRight.tsx
|
|
364
837
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
365
838
|
function IOSHeaderRight(props) {
|
|
366
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native8.View, { style: styles.ios, ...props });
|
|
367
840
|
}
|
|
368
841
|
function AndroidHeaderRight(props) {
|
|
369
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native8.View, { style: styles.android, ...props });
|
|
370
843
|
}
|
|
371
844
|
function HeaderRight(props) {
|
|
372
845
|
return byPlatform({
|
|
@@ -375,7 +848,7 @@ function HeaderRight(props) {
|
|
|
375
848
|
fallback: () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IOSHeaderRight, { ...props })
|
|
376
849
|
});
|
|
377
850
|
}
|
|
378
|
-
var styles =
|
|
851
|
+
var styles = import_react_native8.StyleSheet.create({
|
|
379
852
|
ios: {
|
|
380
853
|
marginRight: -IOS_DEFAULT_MARGIN + RIGHT_MARGIN,
|
|
381
854
|
flexDirection: "row"
|
|
@@ -387,10 +860,10 @@ var styles = import_react_native6.StyleSheet.create({
|
|
|
387
860
|
|
|
388
861
|
// src/components/GameWebViewNavigationBar/useSafeAreaTop.ts
|
|
389
862
|
var import_react_native_safe_area_context = require("@react-native-bedrock/native/react-native-safe-area-context");
|
|
390
|
-
var
|
|
863
|
+
var import_react_native9 = require("react-native");
|
|
391
864
|
function useSafeAreaTop() {
|
|
392
865
|
const safeAreaInsets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
393
|
-
const hasDynamicIsland =
|
|
866
|
+
const hasDynamicIsland = import_react_native9.Platform.OS === "ios" && safeAreaInsets.top > 50;
|
|
394
867
|
const safeAreaTop = hasDynamicIsland ? safeAreaInsets.top - 5 : safeAreaInsets.top;
|
|
395
868
|
return safeAreaTop;
|
|
396
869
|
}
|
|
@@ -401,31 +874,31 @@ var originXML = '<svg fill="none" height="30" viewBox="0 0 30 30" width="30" xml
|
|
|
401
874
|
function GameNavigationBar({ onClose }) {
|
|
402
875
|
const safeAreaTop = useSafeAreaTop();
|
|
403
876
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
404
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
877
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native10.PageNavbar, { preference: { type: "none" } }),
|
|
405
878
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
406
|
-
|
|
879
|
+
import_react_native11.View,
|
|
407
880
|
{
|
|
408
881
|
style: {
|
|
409
882
|
width: "100%",
|
|
410
|
-
height:
|
|
883
|
+
height: import_react_native11.Platform.OS === "ios" ? 44 : 54,
|
|
411
884
|
flexDirection: "row",
|
|
412
885
|
alignItems: "center",
|
|
413
886
|
justifyContent: "flex-end",
|
|
414
887
|
position: "absolute",
|
|
415
888
|
zIndex: 9999,
|
|
416
889
|
marginTop: safeAreaTop,
|
|
417
|
-
paddingRight:
|
|
890
|
+
paddingRight: import_react_native11.Platform.OS === "ios" ? 10 : 8
|
|
418
891
|
},
|
|
419
892
|
pointerEvents: "box-none",
|
|
420
893
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(HeaderRight, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
421
|
-
|
|
894
|
+
import_react_native11.TouchableOpacity,
|
|
422
895
|
{
|
|
423
896
|
hitSlop: { left: 8, right: 8 },
|
|
424
897
|
accessibilityRole: "button",
|
|
425
898
|
accessible: true,
|
|
426
899
|
accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
|
|
427
900
|
style: {
|
|
428
|
-
padding:
|
|
901
|
+
padding: import_react_native11.Platform.OS === "ios" ? 7 : 9
|
|
429
902
|
},
|
|
430
903
|
onPress: onClose,
|
|
431
904
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native_svg.SvgXml, { xml: originXML, width: 30, height: 30 })
|
|
@@ -438,10 +911,10 @@ function GameNavigationBar({ onClose }) {
|
|
|
438
911
|
|
|
439
912
|
// src/components/GameWebView.tsx
|
|
440
913
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
441
|
-
var GameWebView = (0,
|
|
442
|
-
const { openConfirm } = (0,
|
|
914
|
+
var GameWebView = (0, import_react4.forwardRef)(function GameWebView2(props, ref) {
|
|
915
|
+
const { openConfirm } = (0, import_react_native12.useDialog)();
|
|
443
916
|
const { brandDisplayName } = getAppsInTossGlobals();
|
|
444
|
-
const handleClose = (0,
|
|
917
|
+
const handleClose = (0, import_react4.useCallback)(async () => {
|
|
445
918
|
const isConfirmed = await openConfirm({
|
|
446
919
|
title: `${(0, import_es_hangul.josa)(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
447
920
|
leftButton: "\uCDE8\uC18C",
|
|
@@ -449,50 +922,36 @@ var GameWebView = (0, import_react2.forwardRef)(function GameWebView2(props, ref
|
|
|
449
922
|
closeOnDimmerClick: true
|
|
450
923
|
});
|
|
451
924
|
if (isConfirmed) {
|
|
452
|
-
(0,
|
|
925
|
+
(0, import_react_native_bedrock8.closeView)();
|
|
453
926
|
}
|
|
454
927
|
}, [brandDisplayName, openConfirm]);
|
|
455
|
-
(0,
|
|
456
|
-
if (
|
|
457
|
-
(0,
|
|
928
|
+
(0, import_react4.useEffect)(() => {
|
|
929
|
+
if (import_react_native13.Platform.OS === "ios") {
|
|
930
|
+
(0, import_react_native_bedrock8.setIosSwipeGestureEnabled)({ isEnabled: false });
|
|
458
931
|
return () => {
|
|
459
|
-
(0,
|
|
932
|
+
(0, import_react_native_bedrock8.setIosSwipeGestureEnabled)({ isEnabled: true });
|
|
460
933
|
};
|
|
461
934
|
}
|
|
462
935
|
return;
|
|
463
936
|
}, []);
|
|
464
|
-
(0,
|
|
937
|
+
(0, import_react4.useEffect)(() => {
|
|
465
938
|
const backHandler = () => {
|
|
466
939
|
handleClose();
|
|
467
940
|
return true;
|
|
468
941
|
};
|
|
469
|
-
|
|
942
|
+
import_react_native13.BackHandler.addEventListener("hardwareBackPress", backHandler);
|
|
470
943
|
return () => {
|
|
471
|
-
|
|
944
|
+
import_react_native13.BackHandler.removeEventListener("hardwareBackPress", backHandler);
|
|
472
945
|
};
|
|
473
946
|
}, [handleClose]);
|
|
474
947
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
475
948
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GameNavigationBar, { onClose: handleClose }),
|
|
476
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
949
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native13.View, { style: { flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_webview.WebView, { ref, ...props }) })
|
|
477
950
|
] });
|
|
478
951
|
});
|
|
479
952
|
|
|
480
|
-
// src/async-bridges.ts
|
|
481
|
-
var async_bridges_exports = {};
|
|
482
|
-
__export(async_bridges_exports, {
|
|
483
|
-
appLogin: () => appLogin,
|
|
484
|
-
checkoutPayment: () => checkoutPayment,
|
|
485
|
-
executePayment: () => executePayment,
|
|
486
|
-
fetchAlbumPhotos: () => fetchAlbumPhotos,
|
|
487
|
-
fetchContacts: () => fetchContacts,
|
|
488
|
-
getClipboardText: () => getClipboardText,
|
|
489
|
-
getCurrentLocation: () => getCurrentLocation,
|
|
490
|
-
openCamera: () => openCamera,
|
|
491
|
-
setClipboardText: () => setClipboardText
|
|
492
|
-
});
|
|
493
|
-
|
|
494
953
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
495
|
-
var
|
|
954
|
+
var import_react5 = require("react");
|
|
496
955
|
function serializeError(error) {
|
|
497
956
|
return JSON.stringify(error, (_, value) => {
|
|
498
957
|
if (value instanceof Error) {
|
|
@@ -513,15 +972,16 @@ function methodHandler({
|
|
|
513
972
|
handlerMap,
|
|
514
973
|
injectJavaScript
|
|
515
974
|
}) {
|
|
516
|
-
const func =
|
|
517
|
-
const result = await handlerMap[functionName](...args2);
|
|
518
|
-
return result;
|
|
519
|
-
};
|
|
975
|
+
const func = handlerMap[functionName];
|
|
520
976
|
if (!func) {
|
|
521
977
|
console.error(`${functionName} is not a function`);
|
|
522
978
|
return;
|
|
523
979
|
}
|
|
524
|
-
|
|
980
|
+
const wrappedFunc = async (...args2) => {
|
|
981
|
+
const result = await func(...args2);
|
|
982
|
+
return result;
|
|
983
|
+
};
|
|
984
|
+
wrappedFunc(...args).then((result) => {
|
|
525
985
|
injectJavaScript?.(`
|
|
526
986
|
window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/resolve/${eventId}', ${JSON.stringify(result, null, 0)});
|
|
527
987
|
`);
|
|
@@ -540,8 +1000,8 @@ function useBridgeHandler({
|
|
|
540
1000
|
eventListenerMap,
|
|
541
1001
|
injectedJavaScript: originalInjectedJavaScript
|
|
542
1002
|
}) {
|
|
543
|
-
const ref = (0,
|
|
544
|
-
const injectedJavaScript = (0,
|
|
1003
|
+
const ref = (0, import_react5.useRef)(null);
|
|
1004
|
+
const injectedJavaScript = (0, import_react5.useMemo)(
|
|
545
1005
|
() => [
|
|
546
1006
|
`window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
547
1007
|
Object.entries(constantHandlerMap).reduce(
|
|
@@ -567,7 +1027,7 @@ function useBridgeHandler({
|
|
|
567
1027
|
window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
|
|
568
1028
|
`);
|
|
569
1029
|
};
|
|
570
|
-
const $onMessage = (0,
|
|
1030
|
+
const $onMessage = (0, import_react5.useCallback)(
|
|
571
1031
|
async (e) => {
|
|
572
1032
|
onMessage?.(e);
|
|
573
1033
|
const data = JSON.parse(e.nativeEvent.data);
|
|
@@ -625,29 +1085,73 @@ __export(constant_bridges_exports, {
|
|
|
625
1085
|
getTossAppVersion: () => getTossAppVersion
|
|
626
1086
|
});
|
|
627
1087
|
|
|
628
|
-
// src/env.ts
|
|
629
|
-
var env = {
|
|
630
|
-
getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
|
|
631
|
-
};
|
|
632
|
-
|
|
633
1088
|
// src/event-bridges.ts
|
|
634
1089
|
var event_bridges_exports = {};
|
|
635
1090
|
__export(event_bridges_exports, {
|
|
636
1091
|
startUpdateLocation: () => startUpdateLocation
|
|
637
1092
|
});
|
|
638
1093
|
|
|
1094
|
+
// src/utils/log.ts
|
|
1095
|
+
var import_react_native_bedrock9 = require("react-native-bedrock");
|
|
1096
|
+
|
|
1097
|
+
// src/utils/extractDateFromUUIDv7.ts
|
|
1098
|
+
var extractDateFromUUIDv7 = (uuid) => {
|
|
1099
|
+
const timestampHex = uuid.split("-").join("").slice(0, 12);
|
|
1100
|
+
const timestamp = Number.parseInt(timestampHex, 16);
|
|
1101
|
+
return new Date(timestamp);
|
|
1102
|
+
};
|
|
1103
|
+
|
|
1104
|
+
// src/utils/log.ts
|
|
1105
|
+
var getGroupId = (url) => {
|
|
1106
|
+
try {
|
|
1107
|
+
const urlObject = new URL(url);
|
|
1108
|
+
return {
|
|
1109
|
+
groupId: urlObject.pathname,
|
|
1110
|
+
search: urlObject.search.startsWith("?") ? urlObject.search.substring(1) : urlObject.search
|
|
1111
|
+
};
|
|
1112
|
+
} catch {
|
|
1113
|
+
return {
|
|
1114
|
+
groupId: "unknown",
|
|
1115
|
+
search: "unknown"
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
var getReferrer = () => {
|
|
1120
|
+
try {
|
|
1121
|
+
const referrer = new URL((0, import_react_native_bedrock9.getSchemeUri)());
|
|
1122
|
+
return referrer.searchParams.get("referrer");
|
|
1123
|
+
} catch {
|
|
1124
|
+
return "";
|
|
1125
|
+
}
|
|
1126
|
+
};
|
|
1127
|
+
var trackScreen = (url) => {
|
|
1128
|
+
const { groupId, search } = getGroupId(url);
|
|
1129
|
+
const log = {
|
|
1130
|
+
log_type: "screen",
|
|
1131
|
+
log_name: `${groupId}::screen`,
|
|
1132
|
+
params: {
|
|
1133
|
+
search,
|
|
1134
|
+
referrer: getReferrer(),
|
|
1135
|
+
deployment_id: env.getDeploymentId(),
|
|
1136
|
+
deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
|
|
1137
|
+
}
|
|
1138
|
+
};
|
|
1139
|
+
return eventLog(log);
|
|
1140
|
+
};
|
|
1141
|
+
|
|
639
1142
|
// src/components/WebView.tsx
|
|
640
1143
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
641
1144
|
var appsInTossGlobals = getAppsInTossGlobals();
|
|
1145
|
+
var operationalEnvironment = getOperationalEnvironment();
|
|
642
1146
|
var TYPES = ["partner", "external", "game"];
|
|
643
1147
|
var WEBVIEW_TYPES = {
|
|
644
|
-
partner:
|
|
645
|
-
external:
|
|
1148
|
+
partner: import_react_native14.PartnerWebViewScreen,
|
|
1149
|
+
external: import_react_native14.ExternalWebViewScreen,
|
|
646
1150
|
game: GameWebView
|
|
647
1151
|
};
|
|
648
1152
|
function mergeSchemeQueryParamsInto(url) {
|
|
649
1153
|
const baseUrl = new URL(url);
|
|
650
|
-
const schemeUrl = new URL((0,
|
|
1154
|
+
const schemeUrl = new URL((0, import_react_native_bedrock10.getSchemeUri)());
|
|
651
1155
|
baseUrl.pathname = schemeUrl.pathname;
|
|
652
1156
|
for (const [key, value] of schemeUrl.searchParams.entries()) {
|
|
653
1157
|
baseUrl.searchParams.set(key, value);
|
|
@@ -671,8 +1175,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
671
1175
|
if (!TYPES.includes(type)) {
|
|
672
1176
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
673
1177
|
}
|
|
674
|
-
const bedrockEvent = (0,
|
|
675
|
-
const uri = (0,
|
|
1178
|
+
const bedrockEvent = (0, import_react_native_bedrock10.useBedrockEvent)();
|
|
1179
|
+
const uri = (0, import_react6.useMemo)(() => getWebViewUri(local), [local]);
|
|
676
1180
|
const top = (0, import_private.useSafeAreaTop)();
|
|
677
1181
|
const bottom = (0, import_private.useSafeAreaBottom)();
|
|
678
1182
|
const handler = useBridgeHandler({
|
|
@@ -680,18 +1184,30 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
680
1184
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
681
1185
|
eventListenerMap: {
|
|
682
1186
|
...event_bridges_exports,
|
|
683
|
-
backEvent: ({ onEvent, onError, options }) => bedrockEvent.addEventListener("backEvent", { onEvent, onError, options })
|
|
1187
|
+
backEvent: ({ onEvent, onError, options }) => bedrockEvent.addEventListener("backEvent", { onEvent, onError, options }),
|
|
1188
|
+
entryMessageExited: ({ onEvent, onError }) => appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
1189
|
+
updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
1190
|
+
/** @internal */
|
|
1191
|
+
appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
|
|
1192
|
+
/** AdMob */
|
|
1193
|
+
loadAdMobInterstitialAd: GoogleAdMob.loadAdMobInterstitialAd,
|
|
1194
|
+
showAdMobInterstitialAd: GoogleAdMob.showAdMobInterstitialAd,
|
|
1195
|
+
loadAdMobRewardedAd: GoogleAdMob.loadAdMobRewardedAd,
|
|
1196
|
+
showAdMobRewardedAd: GoogleAdMob.showAdMobRewardedAd
|
|
684
1197
|
},
|
|
685
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
686
|
-
// @ts-expect-error
|
|
687
1198
|
constantHandlerMap: {
|
|
688
1199
|
...bedrockConstantBridges,
|
|
689
1200
|
...constant_bridges_exports,
|
|
690
1201
|
getSafeAreaTop: () => top,
|
|
691
|
-
getSafeAreaBottom: () => bottom
|
|
1202
|
+
getSafeAreaBottom: () => bottom,
|
|
1203
|
+
/** AdMob */
|
|
1204
|
+
loadAdMobInterstitialAd_isSupported: GoogleAdMob.loadAdMobInterstitialAd.isSupported,
|
|
1205
|
+
showAdMobInterstitialAd_isSupported: GoogleAdMob.showAdMobInterstitialAd.isSupported,
|
|
1206
|
+
loadAdMobRewardedAd_isSupported: GoogleAdMob.loadAdMobRewardedAd.isSupported,
|
|
1207
|
+
showAdMobRewardedAd_isSupported: GoogleAdMob.showAdMobRewardedAd.isSupported,
|
|
1208
|
+
/** env */
|
|
1209
|
+
getDeploymentId: env.getDeploymentId
|
|
692
1210
|
},
|
|
693
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
694
|
-
// @ts-expect-error
|
|
695
1211
|
asyncHandlerMap: {
|
|
696
1212
|
...bedrockAsyncBridges,
|
|
697
1213
|
...async_bridges_exports,
|
|
@@ -704,7 +1220,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
704
1220
|
clearItems: Storage.clearItems
|
|
705
1221
|
}
|
|
706
1222
|
});
|
|
707
|
-
const baseProps = (0,
|
|
1223
|
+
const baseProps = (0, import_react6.useMemo)(() => {
|
|
708
1224
|
switch (type) {
|
|
709
1225
|
case "partner": {
|
|
710
1226
|
const headerOnlyProp = {
|
|
@@ -734,10 +1250,12 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
734
1250
|
}
|
|
735
1251
|
}, [type, props]);
|
|
736
1252
|
const BaseWebView = WEBVIEW_TYPES[type];
|
|
737
|
-
const
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
1253
|
+
const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
|
|
1254
|
+
const handleNavigationStateChange = (0, import_react6.useCallback)((event) => {
|
|
1255
|
+
if (event.url) {
|
|
1256
|
+
trackScreen(event.url);
|
|
1257
|
+
}
|
|
1258
|
+
}, []);
|
|
741
1259
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
742
1260
|
BaseWebView,
|
|
743
1261
|
{
|
|
@@ -746,9 +1264,10 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
746
1264
|
...baseProps,
|
|
747
1265
|
source: { uri },
|
|
748
1266
|
sharedCookiesEnabled: true,
|
|
749
|
-
webviewDebuggingEnabled,
|
|
1267
|
+
webviewDebuggingEnabled: webViewDebuggingEnabled,
|
|
750
1268
|
thirdPartyCookiesEnabled: true,
|
|
751
1269
|
onMessage: handler.onMessage,
|
|
1270
|
+
onNavigationStateChange: handleNavigationStateChange,
|
|
752
1271
|
injectedJavaScript: handler.injectedJavaScript,
|
|
753
1272
|
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
|
|
754
1273
|
}
|
|
@@ -762,12 +1281,12 @@ function ensureValue(value, name) {
|
|
|
762
1281
|
}
|
|
763
1282
|
|
|
764
1283
|
// src/hooks/useGeolocation.ts
|
|
765
|
-
var
|
|
766
|
-
var
|
|
1284
|
+
var import_react7 = require("react");
|
|
1285
|
+
var import_react_native_bedrock11 = require("react-native-bedrock");
|
|
767
1286
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
768
|
-
const isVisible = (0,
|
|
769
|
-
const [location, setLocation] = (0,
|
|
770
|
-
(0,
|
|
1287
|
+
const isVisible = (0, import_react_native_bedrock11.useVisibility)();
|
|
1288
|
+
const [location, setLocation] = (0, import_react7.useState)(null);
|
|
1289
|
+
(0, import_react7.useEffect)(() => {
|
|
771
1290
|
if (!isVisible) {
|
|
772
1291
|
return;
|
|
773
1292
|
}
|
|
@@ -794,15 +1313,28 @@ var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
|
794
1313
|
Accuracy3[Accuracy3["BestForNavigation"] = 6] = "BestForNavigation";
|
|
795
1314
|
return Accuracy3;
|
|
796
1315
|
})(Accuracy2 || {});
|
|
1316
|
+
|
|
1317
|
+
// src/index.ts
|
|
1318
|
+
__reExport(src_exports, require("@apps-in-toss/analytics"), module.exports);
|
|
1319
|
+
var Analytics2 = {
|
|
1320
|
+
init: import_analytics2.Analytics.init,
|
|
1321
|
+
Impression: import_analytics2.Analytics.Impression,
|
|
1322
|
+
Press: import_analytics2.Analytics.Press,
|
|
1323
|
+
Area: import_analytics2.Analytics.Area
|
|
1324
|
+
};
|
|
797
1325
|
// Annotate the CommonJS export names for ESM import in node:
|
|
798
1326
|
0 && (module.exports = {
|
|
799
1327
|
Accuracy,
|
|
1328
|
+
Analytics,
|
|
800
1329
|
AppsInToss,
|
|
1330
|
+
GoogleAdMob,
|
|
801
1331
|
Storage,
|
|
802
1332
|
TossPay,
|
|
803
1333
|
WebView,
|
|
804
1334
|
appLogin,
|
|
1335
|
+
appsInTossEvent,
|
|
805
1336
|
env,
|
|
1337
|
+
eventLog,
|
|
806
1338
|
fetchAlbumPhotos,
|
|
807
1339
|
fetchContacts,
|
|
808
1340
|
getClipboardText,
|
|
@@ -810,8 +1342,11 @@ var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
|
|
|
810
1342
|
getDeviceId,
|
|
811
1343
|
getOperationalEnvironment,
|
|
812
1344
|
getTossAppVersion,
|
|
1345
|
+
getTossShareLink,
|
|
1346
|
+
isMinVersionSupported,
|
|
813
1347
|
openCamera,
|
|
814
1348
|
setClipboardText,
|
|
815
1349
|
startUpdateLocation,
|
|
816
|
-
useGeolocation
|
|
1350
|
+
useGeolocation,
|
|
1351
|
+
...require("@apps-in-toss/analytics")
|
|
817
1352
|
});
|