@apps-in-toss/native-modules 1.1.0 → 1.1.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/index.cjs +45 -32
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +23 -10
- package/package.json +5 -5
- package/src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts +5 -0
- package/src/AppsInTossModule/native-event-emitter/event-plugins/BackButtonClickHandleEvent.ts +10 -0
- package/dist/VisibilityChangedByTransparentServiceWebEvent-D6XJvPVh.d.cts +0 -20
- package/dist/VisibilityChangedByTransparentServiceWebEvent-D6XJvPVh.d.ts +0 -20
- package/dist/chunk-YS54L7RG.js +0 -209
- package/dist/private.cjs +0 -236
- package/dist/private.d.cts +0 -17
- package/dist/private.d.ts +0 -17
- package/dist/private.js +0 -11
package/dist/index.cjs
CHANGED
|
@@ -68,11 +68,22 @@ __export(index_exports, {
|
|
|
68
68
|
module.exports = __toCommonJS(index_exports);
|
|
69
69
|
|
|
70
70
|
// src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
|
|
71
|
-
var
|
|
71
|
+
var import_react_native9 = require("@granite-js/react-native");
|
|
72
72
|
|
|
73
|
-
// src/AppsInTossModule/native-event-emitter/event-plugins/
|
|
73
|
+
// src/AppsInTossModule/native-event-emitter/event-plugins/BackButtonClickHandleEvent.ts
|
|
74
74
|
var import_react_native = require("@granite-js/react-native");
|
|
75
|
-
var
|
|
75
|
+
var BackButtonClickHandleEvent = class extends import_react_native.GraniteEventDefinition {
|
|
76
|
+
name = "backButtonClickEvent";
|
|
77
|
+
remove() {
|
|
78
|
+
}
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
80
|
+
listener(_) {
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// src/AppsInTossModule/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts
|
|
85
|
+
var import_react_native2 = require("@granite-js/react-native");
|
|
86
|
+
var EntryMessageExitedEvent = class extends import_react_native2.GraniteEventDefinition {
|
|
76
87
|
name = "entryMessageExited";
|
|
77
88
|
remove() {
|
|
78
89
|
}
|
|
@@ -82,8 +93,8 @@ var EntryMessageExitedEvent = class extends import_react_native.GraniteEventDefi
|
|
|
82
93
|
};
|
|
83
94
|
|
|
84
95
|
// src/AppsInTossModule/native-event-emitter/event-plugins/HomeIconButtonClickHandleEvent.ts
|
|
85
|
-
var
|
|
86
|
-
var HomeIconButtonClickHandleEvent = class extends
|
|
96
|
+
var import_react_native3 = require("@granite-js/react-native");
|
|
97
|
+
var HomeIconButtonClickHandleEvent = class extends import_react_native3.GraniteEventDefinition {
|
|
87
98
|
name = "homeIconButtonClickEvent";
|
|
88
99
|
remove() {
|
|
89
100
|
}
|
|
@@ -94,11 +105,11 @@ var HomeIconButtonClickHandleEvent = class extends import_react_native2.GraniteE
|
|
|
94
105
|
|
|
95
106
|
// src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
96
107
|
var import_types = require("@apps-in-toss/types");
|
|
97
|
-
var
|
|
108
|
+
var import_react_native6 = require("@granite-js/react-native");
|
|
98
109
|
|
|
99
110
|
// src/AppsInTossModule/native-modules/AppsInTossModule.ts
|
|
100
|
-
var
|
|
101
|
-
var Module =
|
|
111
|
+
var import_react_native4 = require("react-native");
|
|
112
|
+
var Module = import_react_native4.TurboModuleRegistry.getEnforcing("AppsInTossModule");
|
|
102
113
|
var AppsInTossModuleInstance = Module;
|
|
103
114
|
var AppsInTossModule = Module;
|
|
104
115
|
|
|
@@ -125,11 +136,11 @@ async function requestPermission(permission) {
|
|
|
125
136
|
}
|
|
126
137
|
|
|
127
138
|
// src/AppsInTossModule/native-event-emitter/nativeEventEmitter.ts
|
|
128
|
-
var
|
|
129
|
-
var nativeEventEmitter = new
|
|
139
|
+
var import_react_native5 = require("react-native");
|
|
140
|
+
var nativeEventEmitter = new import_react_native5.NativeEventEmitter(AppsInTossModuleInstance);
|
|
130
141
|
|
|
131
142
|
// src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
132
|
-
var UpdateLocationEvent = class extends
|
|
143
|
+
var UpdateLocationEvent = class extends import_react_native6.GraniteEventDefinition {
|
|
133
144
|
name = "updateLocationEvent";
|
|
134
145
|
subscriptionCount = 0;
|
|
135
146
|
ref = {
|
|
@@ -159,7 +170,7 @@ var UpdateLocationEvent = class extends import_react_native5.GraniteEventDefinit
|
|
|
159
170
|
};
|
|
160
171
|
|
|
161
172
|
// src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
162
|
-
var
|
|
173
|
+
var import_react_native7 = require("@granite-js/react-native");
|
|
163
174
|
|
|
164
175
|
// src/utils/generateUUID.ts
|
|
165
176
|
function generateUUID(placeholder) {
|
|
@@ -221,7 +232,7 @@ var INTERNAL__appBridgeHandler = {
|
|
|
221
232
|
|
|
222
233
|
// src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
223
234
|
var UNSAFE__nativeEventEmitter = nativeEventEmitter;
|
|
224
|
-
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends
|
|
235
|
+
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends import_react_native7.GraniteEventDefinition {
|
|
225
236
|
static INTERNAL__appBridgeSubscription;
|
|
226
237
|
name = "appBridgeCallbackEvent";
|
|
227
238
|
constructor() {
|
|
@@ -251,8 +262,8 @@ var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends import_react_
|
|
|
251
262
|
};
|
|
252
263
|
|
|
253
264
|
// src/AppsInTossModule/native-event-emitter/internal/VisibilityChangedByTransparentServiceWebEvent.ts
|
|
254
|
-
var
|
|
255
|
-
var VisibilityChangedByTransparentServiceWebEvent = class extends
|
|
265
|
+
var import_react_native8 = require("@granite-js/react-native");
|
|
266
|
+
var VisibilityChangedByTransparentServiceWebEvent = class extends import_react_native8.GraniteEventDefinition {
|
|
256
267
|
name = "onVisibilityChangedByTransparentServiceWeb";
|
|
257
268
|
subscription = null;
|
|
258
269
|
remove() {
|
|
@@ -277,10 +288,12 @@ var VisibilityChangedByTransparentServiceWebEvent = class extends import_react_n
|
|
|
277
288
|
};
|
|
278
289
|
|
|
279
290
|
// src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
|
|
280
|
-
var appsInTossEvent = new
|
|
291
|
+
var appsInTossEvent = new import_react_native9.GraniteEvent([
|
|
281
292
|
new UpdateLocationEvent(),
|
|
282
293
|
new EntryMessageExitedEvent(),
|
|
294
|
+
// Navigation Bar events
|
|
283
295
|
new HomeIconButtonClickHandleEvent(),
|
|
296
|
+
new BackButtonClickHandleEvent(),
|
|
284
297
|
// Internal events
|
|
285
298
|
new AppBridgeCallbackEvent(),
|
|
286
299
|
new VisibilityChangedByTransparentServiceWebEvent()
|
|
@@ -295,7 +308,7 @@ function getOperationalEnvironment() {
|
|
|
295
308
|
}
|
|
296
309
|
|
|
297
310
|
// src/AppsInTossModule/native-modules/isMinVersionSupported.ts
|
|
298
|
-
var
|
|
311
|
+
var import_react_native10 = require("react-native");
|
|
299
312
|
|
|
300
313
|
// src/utils/compareVersion.ts
|
|
301
314
|
var SEMVER_REGEX = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
|
|
@@ -371,7 +384,7 @@ function isMinVersionSupported(minVersions) {
|
|
|
371
384
|
return true;
|
|
372
385
|
}
|
|
373
386
|
const currentVersion = AppsInTossModule.tossAppVersion;
|
|
374
|
-
const isIOS =
|
|
387
|
+
const isIOS = import_react_native10.Platform.OS === "ios";
|
|
375
388
|
const minVersion = isIOS ? minVersions.ios : minVersions.android;
|
|
376
389
|
if (minVersion === void 0) {
|
|
377
390
|
return false;
|
|
@@ -795,7 +808,7 @@ var Storage = {
|
|
|
795
808
|
};
|
|
796
809
|
|
|
797
810
|
// src/AppsInTossModule/native-modules/openGameCenterLeaderboard.ts
|
|
798
|
-
var
|
|
811
|
+
var import_react_native11 = require("@granite-js/react-native");
|
|
799
812
|
|
|
800
813
|
// src/AppsInTossModule/constants.ts
|
|
801
814
|
var GAME_CENTER_MIN_VERSION = {
|
|
@@ -815,7 +828,7 @@ async function openGameCenterLeaderboard() {
|
|
|
815
828
|
const url = new URL("servicetoss://game-center/leaderboard?_navbar=hide");
|
|
816
829
|
url.searchParams.set("appName", appName);
|
|
817
830
|
url.searchParams.set("referrer", `appsintoss.${appName}`);
|
|
818
|
-
return (0,
|
|
831
|
+
return (0, import_react_native11.openURL)(url.toString());
|
|
819
832
|
}
|
|
820
833
|
|
|
821
834
|
// src/AppsInTossModule/native-modules/getGameCenterGameProfile.ts
|
|
@@ -888,8 +901,8 @@ function onVisibilityChangedByTransparentServiceWeb(eventParams) {
|
|
|
888
901
|
}
|
|
889
902
|
|
|
890
903
|
// src/BedrockModule/native-modules/natives/BedrockModule.ts
|
|
891
|
-
var
|
|
892
|
-
var BedrockModule =
|
|
904
|
+
var import_react_native12 = require("react-native");
|
|
905
|
+
var BedrockModule = import_react_native12.NativeModules.BedrockModule;
|
|
893
906
|
|
|
894
907
|
// src/BedrockModule/native-modules/natives/closeView.ts
|
|
895
908
|
async function closeView() {
|
|
@@ -897,10 +910,10 @@ async function closeView() {
|
|
|
897
910
|
}
|
|
898
911
|
|
|
899
912
|
// src/BedrockModule/native-modules/natives/getLocale.ts
|
|
900
|
-
var
|
|
913
|
+
var import_react_native13 = require("react-native");
|
|
901
914
|
function getLocale() {
|
|
902
915
|
const locale = BedrockModule?.DeviceInfo?.locale ?? "ko-KR";
|
|
903
|
-
if (
|
|
916
|
+
if (import_react_native13.Platform.OS === "android") {
|
|
904
917
|
return replaceUnderbarToHypen(locale);
|
|
905
918
|
}
|
|
906
919
|
return locale;
|
|
@@ -948,24 +961,24 @@ async function setIosSwipeGestureEnabled(options) {
|
|
|
948
961
|
}
|
|
949
962
|
|
|
950
963
|
// src/BedrockModule/native-modules/natives/openURL.ts
|
|
951
|
-
var
|
|
964
|
+
var import_react_native14 = require("react-native");
|
|
952
965
|
function openURL2(url) {
|
|
953
|
-
return
|
|
966
|
+
return import_react_native14.Linking.openURL(url);
|
|
954
967
|
}
|
|
955
968
|
|
|
956
969
|
// src/BedrockModule/native-modules/natives/getPlatformOS.ts
|
|
957
|
-
var
|
|
970
|
+
var import_react_native15 = require("react-native");
|
|
958
971
|
function getPlatformOS() {
|
|
959
|
-
return
|
|
972
|
+
return import_react_native15.Platform.OS;
|
|
960
973
|
}
|
|
961
974
|
|
|
962
975
|
// src/BedrockModule/native-modules/core/BedrockCoreModule.ts
|
|
963
|
-
var
|
|
964
|
-
var BedrockCoreModule =
|
|
976
|
+
var import_react_native16 = require("react-native");
|
|
977
|
+
var BedrockCoreModule = import_react_native16.NativeModules.BedrockCoreModule;
|
|
965
978
|
|
|
966
979
|
// src/AppsInTossModule/native-modules/tossCore.ts
|
|
967
|
-
var
|
|
968
|
-
var TossCoreModule =
|
|
980
|
+
var import_react_native17 = require("react-native");
|
|
981
|
+
var TossCoreModule = import_react_native17.NativeModules.TossCoreModule;
|
|
969
982
|
function tossCoreEventLog(params) {
|
|
970
983
|
const supported = isMinVersionSupported({ ios: "5.210.0", android: "5.210.0" });
|
|
971
984
|
const isSandbox = getOperationalEnvironment() === "sandbox";
|
package/dist/index.d.cts
CHANGED
|
@@ -231,6 +231,12 @@ interface ContactsViralParams {
|
|
|
231
231
|
*/
|
|
232
232
|
declare function contactsViral(params: ContactsViralParams): () => void;
|
|
233
233
|
|
|
234
|
+
declare class BackButtonClickHandleEvent extends GraniteEventDefinition<undefined, undefined> {
|
|
235
|
+
name: "backButtonClickEvent";
|
|
236
|
+
remove(): void;
|
|
237
|
+
listener(_: undefined): void;
|
|
238
|
+
}
|
|
239
|
+
|
|
234
240
|
declare class EntryMessageExitedEvent extends GraniteEventDefinition<undefined, undefined> {
|
|
235
241
|
name: "entryMessageExited";
|
|
236
242
|
remove(): void;
|
|
@@ -292,7 +298,7 @@ declare class VisibilityChangedByTransparentServiceWebEvent extends GraniteEvent
|
|
|
292
298
|
private isVisibilityChangedByTransparentServiceWebResult;
|
|
293
299
|
}
|
|
294
300
|
|
|
295
|
-
declare const appsInTossEvent: GraniteEvent<EntryMessageExitedEvent | HomeIconButtonClickHandleEvent | UpdateLocationEvent | AppBridgeCallbackEvent | VisibilityChangedByTransparentServiceWebEvent>;
|
|
301
|
+
declare const appsInTossEvent: GraniteEvent<BackButtonClickHandleEvent | EntryMessageExitedEvent | HomeIconButtonClickHandleEvent | UpdateLocationEvent | AppBridgeCallbackEvent | VisibilityChangedByTransparentServiceWebEvent>;
|
|
296
302
|
|
|
297
303
|
declare function onVisibilityChangedByTransparentServiceWeb(eventParams: {
|
|
298
304
|
options: {
|
package/dist/index.d.ts
CHANGED
|
@@ -231,6 +231,12 @@ interface ContactsViralParams {
|
|
|
231
231
|
*/
|
|
232
232
|
declare function contactsViral(params: ContactsViralParams): () => void;
|
|
233
233
|
|
|
234
|
+
declare class BackButtonClickHandleEvent extends GraniteEventDefinition<undefined, undefined> {
|
|
235
|
+
name: "backButtonClickEvent";
|
|
236
|
+
remove(): void;
|
|
237
|
+
listener(_: undefined): void;
|
|
238
|
+
}
|
|
239
|
+
|
|
234
240
|
declare class EntryMessageExitedEvent extends GraniteEventDefinition<undefined, undefined> {
|
|
235
241
|
name: "entryMessageExited";
|
|
236
242
|
remove(): void;
|
|
@@ -292,7 +298,7 @@ declare class VisibilityChangedByTransparentServiceWebEvent extends GraniteEvent
|
|
|
292
298
|
private isVisibilityChangedByTransparentServiceWebResult;
|
|
293
299
|
}
|
|
294
300
|
|
|
295
|
-
declare const appsInTossEvent: GraniteEvent<EntryMessageExitedEvent | HomeIconButtonClickHandleEvent | UpdateLocationEvent | AppBridgeCallbackEvent | VisibilityChangedByTransparentServiceWebEvent>;
|
|
301
|
+
declare const appsInTossEvent: GraniteEvent<BackButtonClickHandleEvent | EntryMessageExitedEvent | HomeIconButtonClickHandleEvent | UpdateLocationEvent | AppBridgeCallbackEvent | VisibilityChangedByTransparentServiceWebEvent>;
|
|
296
302
|
|
|
297
303
|
declare function onVisibilityChangedByTransparentServiceWeb(eventParams: {
|
|
298
304
|
options: {
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
// src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
|
|
2
2
|
import { GraniteEvent } from "@granite-js/react-native";
|
|
3
3
|
|
|
4
|
-
// src/AppsInTossModule/native-event-emitter/event-plugins/
|
|
4
|
+
// src/AppsInTossModule/native-event-emitter/event-plugins/BackButtonClickHandleEvent.ts
|
|
5
5
|
import { GraniteEventDefinition } from "@granite-js/react-native";
|
|
6
|
-
var
|
|
6
|
+
var BackButtonClickHandleEvent = class extends GraniteEventDefinition {
|
|
7
|
+
name = "backButtonClickEvent";
|
|
8
|
+
remove() {
|
|
9
|
+
}
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
|
+
listener(_) {
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// src/AppsInTossModule/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts
|
|
16
|
+
import { GraniteEventDefinition as GraniteEventDefinition2 } from "@granite-js/react-native";
|
|
17
|
+
var EntryMessageExitedEvent = class extends GraniteEventDefinition2 {
|
|
7
18
|
name = "entryMessageExited";
|
|
8
19
|
remove() {
|
|
9
20
|
}
|
|
@@ -13,8 +24,8 @@ var EntryMessageExitedEvent = class extends GraniteEventDefinition {
|
|
|
13
24
|
};
|
|
14
25
|
|
|
15
26
|
// src/AppsInTossModule/native-event-emitter/event-plugins/HomeIconButtonClickHandleEvent.ts
|
|
16
|
-
import { GraniteEventDefinition as
|
|
17
|
-
var HomeIconButtonClickHandleEvent = class extends
|
|
27
|
+
import { GraniteEventDefinition as GraniteEventDefinition3 } from "@granite-js/react-native";
|
|
28
|
+
var HomeIconButtonClickHandleEvent = class extends GraniteEventDefinition3 {
|
|
18
29
|
name = "homeIconButtonClickEvent";
|
|
19
30
|
remove() {
|
|
20
31
|
}
|
|
@@ -25,7 +36,7 @@ var HomeIconButtonClickHandleEvent = class extends GraniteEventDefinition2 {
|
|
|
25
36
|
|
|
26
37
|
// src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
27
38
|
import { GetCurrentLocationPermissionError } from "@apps-in-toss/types";
|
|
28
|
-
import { GraniteEventDefinition as
|
|
39
|
+
import { GraniteEventDefinition as GraniteEventDefinition4 } from "@granite-js/react-native";
|
|
29
40
|
|
|
30
41
|
// src/AppsInTossModule/native-modules/AppsInTossModule.ts
|
|
31
42
|
import { TurboModuleRegistry } from "react-native";
|
|
@@ -60,7 +71,7 @@ import { NativeEventEmitter } from "react-native";
|
|
|
60
71
|
var nativeEventEmitter = new NativeEventEmitter(AppsInTossModuleInstance);
|
|
61
72
|
|
|
62
73
|
// src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
63
|
-
var UpdateLocationEvent = class extends
|
|
74
|
+
var UpdateLocationEvent = class extends GraniteEventDefinition4 {
|
|
64
75
|
name = "updateLocationEvent";
|
|
65
76
|
subscriptionCount = 0;
|
|
66
77
|
ref = {
|
|
@@ -90,7 +101,7 @@ var UpdateLocationEvent = class extends GraniteEventDefinition3 {
|
|
|
90
101
|
};
|
|
91
102
|
|
|
92
103
|
// src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
93
|
-
import { GraniteEventDefinition as
|
|
104
|
+
import { GraniteEventDefinition as GraniteEventDefinition5 } from "@granite-js/react-native";
|
|
94
105
|
|
|
95
106
|
// src/utils/generateUUID.ts
|
|
96
107
|
function generateUUID(placeholder) {
|
|
@@ -152,7 +163,7 @@ var INTERNAL__appBridgeHandler = {
|
|
|
152
163
|
|
|
153
164
|
// src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
154
165
|
var UNSAFE__nativeEventEmitter = nativeEventEmitter;
|
|
155
|
-
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends
|
|
166
|
+
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends GraniteEventDefinition5 {
|
|
156
167
|
static INTERNAL__appBridgeSubscription;
|
|
157
168
|
name = "appBridgeCallbackEvent";
|
|
158
169
|
constructor() {
|
|
@@ -182,8 +193,8 @@ var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends GraniteEventD
|
|
|
182
193
|
};
|
|
183
194
|
|
|
184
195
|
// src/AppsInTossModule/native-event-emitter/internal/VisibilityChangedByTransparentServiceWebEvent.ts
|
|
185
|
-
import { GraniteEventDefinition as
|
|
186
|
-
var VisibilityChangedByTransparentServiceWebEvent = class extends
|
|
196
|
+
import { GraniteEventDefinition as GraniteEventDefinition6 } from "@granite-js/react-native";
|
|
197
|
+
var VisibilityChangedByTransparentServiceWebEvent = class extends GraniteEventDefinition6 {
|
|
187
198
|
name = "onVisibilityChangedByTransparentServiceWeb";
|
|
188
199
|
subscription = null;
|
|
189
200
|
remove() {
|
|
@@ -211,7 +222,9 @@ var VisibilityChangedByTransparentServiceWebEvent = class extends GraniteEventDe
|
|
|
211
222
|
var appsInTossEvent = new GraniteEvent([
|
|
212
223
|
new UpdateLocationEvent(),
|
|
213
224
|
new EntryMessageExitedEvent(),
|
|
225
|
+
// Navigation Bar events
|
|
214
226
|
new HomeIconButtonClickHandleEvent(),
|
|
227
|
+
new BackButtonClickHandleEvent(),
|
|
215
228
|
// Internal events
|
|
216
229
|
new AppBridgeCallbackEvent(),
|
|
217
230
|
new VisibilityChangedByTransparentServiceWebEvent()
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apps-in-toss/native-modules",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"description": "Native Modules for Apps In Toss",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepack": "yarn build",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
],
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/runtime": "^7",
|
|
33
|
-
"@granite-js/native": "0.1.
|
|
34
|
-
"@granite-js/react-native": "0.1.
|
|
33
|
+
"@granite-js/native": "0.1.22",
|
|
34
|
+
"@granite-js/react-native": "0.1.22",
|
|
35
35
|
"@types/react": "18.3.3",
|
|
36
36
|
"dts-bundle-generator": "^9.5.1",
|
|
37
37
|
"esbuild": "0.25.5",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"vitest": "^3.2.4"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@apps-in-toss/types": "^1.1.
|
|
46
|
+
"@apps-in-toss/types": "^1.1.1",
|
|
47
47
|
"es-toolkit": "^1.39.3"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "0e0af7d44ed8ad2615a237650b9682c68ab5861e"
|
|
58
58
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GraniteEvent } from '@granite-js/react-native';
|
|
2
|
+
import { BackButtonClickHandleEvent } from './event-plugins/BackButtonClickHandleEvent';
|
|
2
3
|
import { EntryMessageExitedEvent } from './event-plugins/EntryMessageExitedEvent';
|
|
3
4
|
import { HomeIconButtonClickHandleEvent } from './event-plugins/HomeIconButtonClickHandleEvent';
|
|
4
5
|
import { UpdateLocationEvent } from './event-plugins/UpdateLocationEvent';
|
|
@@ -8,7 +9,11 @@ import { VisibilityChangedByTransparentServiceWebEvent } from './internal/Visibi
|
|
|
8
9
|
export const appsInTossEvent = new GraniteEvent([
|
|
9
10
|
new UpdateLocationEvent(),
|
|
10
11
|
new EntryMessageExitedEvent(),
|
|
12
|
+
|
|
13
|
+
// Navigation Bar events
|
|
11
14
|
new HomeIconButtonClickHandleEvent(),
|
|
15
|
+
new BackButtonClickHandleEvent(),
|
|
16
|
+
|
|
12
17
|
// Internal events
|
|
13
18
|
new AppBridgeCallbackEvent(),
|
|
14
19
|
new VisibilityChangedByTransparentServiceWebEvent(),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GraniteEventDefinition } from '@granite-js/react-native';
|
|
2
|
+
|
|
3
|
+
export class BackButtonClickHandleEvent extends GraniteEventDefinition<undefined, undefined> {
|
|
4
|
+
name = 'backButtonClickEvent' as const;
|
|
5
|
+
|
|
6
|
+
remove() {}
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9
|
+
listener(_: undefined) {}
|
|
10
|
+
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { GraniteEventDefinition } from '@granite-js/react-native';
|
|
2
|
-
import { EmitterSubscription } from 'react-native';
|
|
3
|
-
|
|
4
|
-
interface EventEmitterSchema<K extends string, P extends unknown[]> {
|
|
5
|
-
name: K;
|
|
6
|
-
params: P;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface VisibilityChangedByTransparentServiceWebOptions {
|
|
10
|
-
callbackId: string;
|
|
11
|
-
}
|
|
12
|
-
declare class VisibilityChangedByTransparentServiceWebEvent extends GraniteEventDefinition<VisibilityChangedByTransparentServiceWebOptions, boolean> {
|
|
13
|
-
name: "onVisibilityChangedByTransparentServiceWeb";
|
|
14
|
-
subscription: EmitterSubscription | null;
|
|
15
|
-
remove(): void;
|
|
16
|
-
listener(options: VisibilityChangedByTransparentServiceWebOptions, onEvent: (isVisible: boolean) => void, onError: (error: unknown) => void): void;
|
|
17
|
-
private isVisibilityChangedByTransparentServiceWebResult;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { type EventEmitterSchema as E, VisibilityChangedByTransparentServiceWebEvent as V, type VisibilityChangedByTransparentServiceWebOptions as a };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { GraniteEventDefinition } from '@granite-js/react-native';
|
|
2
|
-
import { EmitterSubscription } from 'react-native';
|
|
3
|
-
|
|
4
|
-
interface EventEmitterSchema<K extends string, P extends unknown[]> {
|
|
5
|
-
name: K;
|
|
6
|
-
params: P;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface VisibilityChangedByTransparentServiceWebOptions {
|
|
10
|
-
callbackId: string;
|
|
11
|
-
}
|
|
12
|
-
declare class VisibilityChangedByTransparentServiceWebEvent extends GraniteEventDefinition<VisibilityChangedByTransparentServiceWebOptions, boolean> {
|
|
13
|
-
name: "onVisibilityChangedByTransparentServiceWeb";
|
|
14
|
-
subscription: EmitterSubscription | null;
|
|
15
|
-
remove(): void;
|
|
16
|
-
listener(options: VisibilityChangedByTransparentServiceWebOptions, onEvent: (isVisible: boolean) => void, onError: (error: unknown) => void): void;
|
|
17
|
-
private isVisibilityChangedByTransparentServiceWebResult;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { type EventEmitterSchema as E, VisibilityChangedByTransparentServiceWebEvent as V, type VisibilityChangedByTransparentServiceWebOptions as a };
|
package/dist/chunk-YS54L7RG.js
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
// src/AppsInTossModule/native-modules/AppsInTossModule.ts
|
|
2
|
-
import { TurboModuleRegistry } from "react-native";
|
|
3
|
-
var Module = TurboModuleRegistry.getEnforcing("AppsInTossModule");
|
|
4
|
-
var AppsInTossModuleInstance = Module;
|
|
5
|
-
var AppsInTossModule = Module;
|
|
6
|
-
|
|
7
|
-
// src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
|
|
8
|
-
import { GraniteEvent } from "@granite-js/react-native";
|
|
9
|
-
|
|
10
|
-
// src/AppsInTossModule/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts
|
|
11
|
-
import { GraniteEventDefinition } from "@granite-js/react-native";
|
|
12
|
-
var EntryMessageExitedEvent = class extends GraniteEventDefinition {
|
|
13
|
-
name = "entryMessageExited";
|
|
14
|
-
remove() {
|
|
15
|
-
}
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17
|
-
listener(_) {
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
22
|
-
import { GraniteEventDefinition as GraniteEventDefinition2 } from "@granite-js/react-native";
|
|
23
|
-
|
|
24
|
-
// src/AppsInTossModule/native-modules/getPermission.ts
|
|
25
|
-
function getPermission(permission) {
|
|
26
|
-
return AppsInTossModule.getPermission(permission);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// src/AppsInTossModule/native-modules/openPermissionDialog.ts
|
|
30
|
-
function openPermissionDialog(permission) {
|
|
31
|
-
return AppsInTossModule.openPermissionDialog(permission);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// src/AppsInTossModule/native-modules/requestPermission.ts
|
|
35
|
-
async function requestPermission(permission) {
|
|
36
|
-
const permissionStatus = await getPermission(permission);
|
|
37
|
-
switch (permissionStatus) {
|
|
38
|
-
case "allowed":
|
|
39
|
-
case "denied":
|
|
40
|
-
return permissionStatus;
|
|
41
|
-
default:
|
|
42
|
-
return openPermissionDialog(permission);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// src/AppsInTossModule/native-event-emitter/nativeEventEmitter.ts
|
|
47
|
-
import { NativeEventEmitter } from "react-native";
|
|
48
|
-
var nativeEventEmitter = new NativeEventEmitter(AppsInTossModuleInstance);
|
|
49
|
-
|
|
50
|
-
// src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
51
|
-
var UpdateLocationEvent = class extends GraniteEventDefinition2 {
|
|
52
|
-
name = "updateLocationEvent";
|
|
53
|
-
subscriptionCount = 0;
|
|
54
|
-
ref = {
|
|
55
|
-
remove: () => {
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
remove() {
|
|
59
|
-
if (--this.subscriptionCount === 0) {
|
|
60
|
-
AppsInTossModuleInstance.stopUpdateLocation({});
|
|
61
|
-
}
|
|
62
|
-
this.ref.remove();
|
|
63
|
-
}
|
|
64
|
-
listener(options, onEvent, onError) {
|
|
65
|
-
requestPermission({ name: "geolocation", access: "access" }).then((permissionStatus) => {
|
|
66
|
-
if (permissionStatus === "denied") {
|
|
67
|
-
onError(new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."));
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
void AppsInTossModuleInstance.startUpdateLocation(options).catch(onError);
|
|
71
|
-
const subscription = nativeEventEmitter.addListener("updateLocation", onEvent);
|
|
72
|
-
this.ref = {
|
|
73
|
-
remove: () => subscription?.remove()
|
|
74
|
-
};
|
|
75
|
-
this.subscriptionCount++;
|
|
76
|
-
}).catch(onError);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
// src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
81
|
-
import { GraniteEventDefinition as GraniteEventDefinition3 } from "@granite-js/react-native";
|
|
82
|
-
|
|
83
|
-
// src/utils/generateUUID.ts
|
|
84
|
-
function generateUUID(placeholder) {
|
|
85
|
-
return placeholder ? (placeholder ^ Math.random() * 16 >> placeholder / 4).toString(16) : (String(1e7) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, generateUUID);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// src/AppsInTossModule/native-event-emitter/internal/appBridge.ts
|
|
89
|
-
var INTERNAL__callbacks = /* @__PURE__ */ new Map();
|
|
90
|
-
function invokeAppBridgeCallback(id, ...args) {
|
|
91
|
-
const callback = INTERNAL__callbacks.get(id);
|
|
92
|
-
callback?.call(null, ...args);
|
|
93
|
-
return Boolean(callback);
|
|
94
|
-
}
|
|
95
|
-
function invokeAppBridgeMethod(methodName, params, callbacks) {
|
|
96
|
-
const { onSuccess, onError, ...appBridgeCallbacks } = callbacks;
|
|
97
|
-
const { callbackMap, unregisterAll } = registerCallbacks(appBridgeCallbacks);
|
|
98
|
-
const promise = AppsInTossModuleInstance[methodName]({
|
|
99
|
-
params,
|
|
100
|
-
callbacks: callbackMap
|
|
101
|
-
});
|
|
102
|
-
void promise.then(onSuccess).catch(onError);
|
|
103
|
-
return unregisterAll;
|
|
104
|
-
}
|
|
105
|
-
function registerCallbacks(callbacks) {
|
|
106
|
-
const callbackMap = {};
|
|
107
|
-
for (const [callbackName, callback] of Object.entries(callbacks)) {
|
|
108
|
-
const id = registerCallback(callback, callbackName);
|
|
109
|
-
callbackMap[callbackName] = id;
|
|
110
|
-
}
|
|
111
|
-
const unregisterAll = () => {
|
|
112
|
-
Object.values(callbackMap).forEach(unregisterCallback);
|
|
113
|
-
};
|
|
114
|
-
return { callbackMap, unregisterAll };
|
|
115
|
-
}
|
|
116
|
-
function registerCallback(callback, name = "unnamed") {
|
|
117
|
-
const uniqueId = generateUUID();
|
|
118
|
-
const callbackId = `${uniqueId}__${name}`;
|
|
119
|
-
INTERNAL__callbacks.set(callbackId, callback);
|
|
120
|
-
return callbackId;
|
|
121
|
-
}
|
|
122
|
-
function unregisterCallback(id) {
|
|
123
|
-
INTERNAL__callbacks.delete(id);
|
|
124
|
-
}
|
|
125
|
-
function getCallbackIds() {
|
|
126
|
-
return Array.from(INTERNAL__callbacks.keys());
|
|
127
|
-
}
|
|
128
|
-
var INTERNAL__appBridgeHandler = {
|
|
129
|
-
invokeAppBridgeCallback,
|
|
130
|
-
invokeAppBridgeMethod,
|
|
131
|
-
registerCallback,
|
|
132
|
-
unregisterCallback,
|
|
133
|
-
getCallbackIds
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
// src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
137
|
-
var UNSAFE__nativeEventEmitter = nativeEventEmitter;
|
|
138
|
-
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends GraniteEventDefinition3 {
|
|
139
|
-
static INTERNAL__appBridgeSubscription;
|
|
140
|
-
name = "appBridgeCallbackEvent";
|
|
141
|
-
constructor() {
|
|
142
|
-
super();
|
|
143
|
-
this.registerAppBridgeCallbackEventListener();
|
|
144
|
-
}
|
|
145
|
-
remove() {
|
|
146
|
-
}
|
|
147
|
-
listener() {
|
|
148
|
-
}
|
|
149
|
-
registerAppBridgeCallbackEventListener() {
|
|
150
|
-
if (_AppBridgeCallbackEvent.INTERNAL__appBridgeSubscription != null) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
_AppBridgeCallbackEvent.INTERNAL__appBridgeSubscription = UNSAFE__nativeEventEmitter.addListener(
|
|
154
|
-
"appBridgeCallback",
|
|
155
|
-
this.ensureInvokeAppBridgeCallback
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
ensureInvokeAppBridgeCallback(result) {
|
|
159
|
-
if (typeof result === "object" && typeof result.name === "string") {
|
|
160
|
-
INTERNAL__appBridgeHandler.invokeAppBridgeCallback(result.name, result.params);
|
|
161
|
-
} else {
|
|
162
|
-
console.warn("Invalid app bridge callback result:", result);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
// src/AppsInTossModule/native-event-emitter/internal/VisibilityChangedByTransparentServiceWebEvent.ts
|
|
168
|
-
import { GraniteEventDefinition as GraniteEventDefinition4 } from "@granite-js/react-native";
|
|
169
|
-
var VisibilityChangedByTransparentServiceWebEvent = class extends GraniteEventDefinition4 {
|
|
170
|
-
name = "onVisibilityChangedByTransparentServiceWeb";
|
|
171
|
-
subscription = null;
|
|
172
|
-
remove() {
|
|
173
|
-
this.subscription?.remove();
|
|
174
|
-
this.subscription = null;
|
|
175
|
-
}
|
|
176
|
-
listener(options, onEvent, onError) {
|
|
177
|
-
const subscription = nativeEventEmitter.addListener("visibilityChangedByTransparentServiceWeb", (params) => {
|
|
178
|
-
if (this.isVisibilityChangedByTransparentServiceWebResult(params)) {
|
|
179
|
-
if (params.callbackId === options.callbackId) {
|
|
180
|
-
onEvent(params.isVisible);
|
|
181
|
-
}
|
|
182
|
-
} else {
|
|
183
|
-
onError(new Error("Invalid visibility changed by transparent service web result"));
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
this.subscription = subscription;
|
|
187
|
-
}
|
|
188
|
-
isVisibilityChangedByTransparentServiceWebResult(params) {
|
|
189
|
-
return typeof params === "object" && typeof params.callbackId === "string" && typeof params.isVisible === "boolean";
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
// src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
|
|
194
|
-
var appsInTossEvent = new GraniteEvent([
|
|
195
|
-
new AppBridgeCallbackEvent(),
|
|
196
|
-
new UpdateLocationEvent(),
|
|
197
|
-
new EntryMessageExitedEvent(),
|
|
198
|
-
// Internal events
|
|
199
|
-
new AppBridgeCallbackEvent(),
|
|
200
|
-
new VisibilityChangedByTransparentServiceWebEvent()
|
|
201
|
-
]);
|
|
202
|
-
|
|
203
|
-
export {
|
|
204
|
-
AppsInTossModuleInstance,
|
|
205
|
-
AppsInTossModule,
|
|
206
|
-
requestPermission,
|
|
207
|
-
INTERNAL__appBridgeHandler,
|
|
208
|
-
appsInTossEvent
|
|
209
|
-
};
|
package/dist/private.cjs
DELETED
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/private.ts
|
|
21
|
-
var private_exports = {};
|
|
22
|
-
__export(private_exports, {
|
|
23
|
-
onVisibilityChangedByTransparentServiceWeb: () => onVisibilityChangedByTransparentServiceWeb
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(private_exports);
|
|
26
|
-
|
|
27
|
-
// src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
|
|
28
|
-
var import_react_native7 = require("@granite-js/react-native");
|
|
29
|
-
|
|
30
|
-
// src/AppsInTossModule/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts
|
|
31
|
-
var import_react_native = require("@granite-js/react-native");
|
|
32
|
-
var EntryMessageExitedEvent = class extends import_react_native.GraniteEventDefinition {
|
|
33
|
-
name = "entryMessageExited";
|
|
34
|
-
remove() {
|
|
35
|
-
}
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
37
|
-
listener(_) {
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
// src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
42
|
-
var import_react_native4 = require("@granite-js/react-native");
|
|
43
|
-
|
|
44
|
-
// src/AppsInTossModule/native-modules/AppsInTossModule.ts
|
|
45
|
-
var import_react_native2 = require("react-native");
|
|
46
|
-
var Module = import_react_native2.TurboModuleRegistry.getEnforcing("AppsInTossModule");
|
|
47
|
-
var AppsInTossModuleInstance = Module;
|
|
48
|
-
var AppsInTossModule = Module;
|
|
49
|
-
|
|
50
|
-
// src/AppsInTossModule/native-modules/getPermission.ts
|
|
51
|
-
function getPermission(permission) {
|
|
52
|
-
return AppsInTossModule.getPermission(permission);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// src/AppsInTossModule/native-modules/openPermissionDialog.ts
|
|
56
|
-
function openPermissionDialog(permission) {
|
|
57
|
-
return AppsInTossModule.openPermissionDialog(permission);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// src/AppsInTossModule/native-modules/requestPermission.ts
|
|
61
|
-
async function requestPermission(permission) {
|
|
62
|
-
const permissionStatus = await getPermission(permission);
|
|
63
|
-
switch (permissionStatus) {
|
|
64
|
-
case "allowed":
|
|
65
|
-
case "denied":
|
|
66
|
-
return permissionStatus;
|
|
67
|
-
default:
|
|
68
|
-
return openPermissionDialog(permission);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// src/AppsInTossModule/native-event-emitter/nativeEventEmitter.ts
|
|
73
|
-
var import_react_native3 = require("react-native");
|
|
74
|
-
var nativeEventEmitter = new import_react_native3.NativeEventEmitter(AppsInTossModuleInstance);
|
|
75
|
-
|
|
76
|
-
// src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
77
|
-
var UpdateLocationEvent = class extends import_react_native4.GraniteEventDefinition {
|
|
78
|
-
name = "updateLocationEvent";
|
|
79
|
-
subscriptionCount = 0;
|
|
80
|
-
ref = {
|
|
81
|
-
remove: () => {
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
remove() {
|
|
85
|
-
if (--this.subscriptionCount === 0) {
|
|
86
|
-
AppsInTossModuleInstance.stopUpdateLocation({});
|
|
87
|
-
}
|
|
88
|
-
this.ref.remove();
|
|
89
|
-
}
|
|
90
|
-
listener(options, onEvent, onError) {
|
|
91
|
-
requestPermission({ name: "geolocation", access: "access" }).then((permissionStatus) => {
|
|
92
|
-
if (permissionStatus === "denied") {
|
|
93
|
-
onError(new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."));
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
void AppsInTossModuleInstance.startUpdateLocation(options).catch(onError);
|
|
97
|
-
const subscription = nativeEventEmitter.addListener("updateLocation", onEvent);
|
|
98
|
-
this.ref = {
|
|
99
|
-
remove: () => subscription?.remove()
|
|
100
|
-
};
|
|
101
|
-
this.subscriptionCount++;
|
|
102
|
-
}).catch(onError);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
// src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
107
|
-
var import_react_native5 = require("@granite-js/react-native");
|
|
108
|
-
|
|
109
|
-
// src/utils/generateUUID.ts
|
|
110
|
-
function generateUUID(placeholder) {
|
|
111
|
-
return placeholder ? (placeholder ^ Math.random() * 16 >> placeholder / 4).toString(16) : (String(1e7) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, generateUUID);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// src/AppsInTossModule/native-event-emitter/internal/appBridge.ts
|
|
115
|
-
var INTERNAL__callbacks = /* @__PURE__ */ new Map();
|
|
116
|
-
function invokeAppBridgeCallback(id, ...args) {
|
|
117
|
-
const callback = INTERNAL__callbacks.get(id);
|
|
118
|
-
callback?.call(null, ...args);
|
|
119
|
-
return Boolean(callback);
|
|
120
|
-
}
|
|
121
|
-
function invokeAppBridgeMethod(methodName, params, callbacks) {
|
|
122
|
-
const { onSuccess, onError, ...appBridgeCallbacks } = callbacks;
|
|
123
|
-
const { callbackMap, unregisterAll } = registerCallbacks(appBridgeCallbacks);
|
|
124
|
-
const promise = AppsInTossModuleInstance[methodName]({
|
|
125
|
-
params,
|
|
126
|
-
callbacks: callbackMap
|
|
127
|
-
});
|
|
128
|
-
void promise.then(onSuccess).catch(onError);
|
|
129
|
-
return unregisterAll;
|
|
130
|
-
}
|
|
131
|
-
function registerCallbacks(callbacks) {
|
|
132
|
-
const callbackMap = {};
|
|
133
|
-
for (const [callbackName, callback] of Object.entries(callbacks)) {
|
|
134
|
-
const id = registerCallback(callback, callbackName);
|
|
135
|
-
callbackMap[callbackName] = id;
|
|
136
|
-
}
|
|
137
|
-
const unregisterAll = () => {
|
|
138
|
-
Object.values(callbackMap).forEach(unregisterCallback);
|
|
139
|
-
};
|
|
140
|
-
return { callbackMap, unregisterAll };
|
|
141
|
-
}
|
|
142
|
-
function registerCallback(callback, name = "unnamed") {
|
|
143
|
-
const uniqueId = generateUUID();
|
|
144
|
-
const callbackId = `${uniqueId}__${name}`;
|
|
145
|
-
INTERNAL__callbacks.set(callbackId, callback);
|
|
146
|
-
return callbackId;
|
|
147
|
-
}
|
|
148
|
-
function unregisterCallback(id) {
|
|
149
|
-
INTERNAL__callbacks.delete(id);
|
|
150
|
-
}
|
|
151
|
-
function getCallbackIds() {
|
|
152
|
-
return Array.from(INTERNAL__callbacks.keys());
|
|
153
|
-
}
|
|
154
|
-
var INTERNAL__appBridgeHandler = {
|
|
155
|
-
invokeAppBridgeCallback,
|
|
156
|
-
invokeAppBridgeMethod,
|
|
157
|
-
registerCallback,
|
|
158
|
-
unregisterCallback,
|
|
159
|
-
getCallbackIds
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
// src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
163
|
-
var UNSAFE__nativeEventEmitter = nativeEventEmitter;
|
|
164
|
-
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends import_react_native5.GraniteEventDefinition {
|
|
165
|
-
static INTERNAL__appBridgeSubscription;
|
|
166
|
-
name = "appBridgeCallbackEvent";
|
|
167
|
-
constructor() {
|
|
168
|
-
super();
|
|
169
|
-
this.registerAppBridgeCallbackEventListener();
|
|
170
|
-
}
|
|
171
|
-
remove() {
|
|
172
|
-
}
|
|
173
|
-
listener() {
|
|
174
|
-
}
|
|
175
|
-
registerAppBridgeCallbackEventListener() {
|
|
176
|
-
if (_AppBridgeCallbackEvent.INTERNAL__appBridgeSubscription != null) {
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
_AppBridgeCallbackEvent.INTERNAL__appBridgeSubscription = UNSAFE__nativeEventEmitter.addListener(
|
|
180
|
-
"appBridgeCallback",
|
|
181
|
-
this.ensureInvokeAppBridgeCallback
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
ensureInvokeAppBridgeCallback(result) {
|
|
185
|
-
if (typeof result === "object" && typeof result.name === "string") {
|
|
186
|
-
INTERNAL__appBridgeHandler.invokeAppBridgeCallback(result.name, result.params);
|
|
187
|
-
} else {
|
|
188
|
-
console.warn("Invalid app bridge callback result:", result);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
// src/AppsInTossModule/native-event-emitter/internal/VisibilityChangedByTransparentServiceWebEvent.ts
|
|
194
|
-
var import_react_native6 = require("@granite-js/react-native");
|
|
195
|
-
var VisibilityChangedByTransparentServiceWebEvent = class extends import_react_native6.GraniteEventDefinition {
|
|
196
|
-
name = "onVisibilityChangedByTransparentServiceWeb";
|
|
197
|
-
subscription = null;
|
|
198
|
-
remove() {
|
|
199
|
-
this.subscription?.remove();
|
|
200
|
-
this.subscription = null;
|
|
201
|
-
}
|
|
202
|
-
listener(options, onEvent, onError) {
|
|
203
|
-
const subscription = nativeEventEmitter.addListener("visibilityChangedByTransparentServiceWeb", (params) => {
|
|
204
|
-
if (this.isVisibilityChangedByTransparentServiceWebResult(params)) {
|
|
205
|
-
if (params.callbackId === options.callbackId) {
|
|
206
|
-
onEvent(params.isVisible);
|
|
207
|
-
}
|
|
208
|
-
} else {
|
|
209
|
-
onError(new Error("Invalid visibility changed by transparent service web result"));
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
this.subscription = subscription;
|
|
213
|
-
}
|
|
214
|
-
isVisibilityChangedByTransparentServiceWebResult(params) {
|
|
215
|
-
return typeof params === "object" && typeof params.callbackId === "string" && typeof params.isVisible === "boolean";
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
// src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
|
|
220
|
-
var appsInTossEvent = new import_react_native7.GraniteEvent([
|
|
221
|
-
new AppBridgeCallbackEvent(),
|
|
222
|
-
new UpdateLocationEvent(),
|
|
223
|
-
new EntryMessageExitedEvent(),
|
|
224
|
-
// Internal events
|
|
225
|
-
new AppBridgeCallbackEvent(),
|
|
226
|
-
new VisibilityChangedByTransparentServiceWebEvent()
|
|
227
|
-
]);
|
|
228
|
-
|
|
229
|
-
// src/AppsInTossModule/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
|
|
230
|
-
function onVisibilityChangedByTransparentServiceWeb(eventParams) {
|
|
231
|
-
return appsInTossEvent.addEventListener("onVisibilityChangedByTransparentServiceWeb", eventParams);
|
|
232
|
-
}
|
|
233
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
234
|
-
0 && (module.exports = {
|
|
235
|
-
onVisibilityChangedByTransparentServiceWeb
|
|
236
|
-
});
|
package/dist/private.d.cts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { EmitterSubscription } from 'react-native';
|
|
2
|
-
import { E as EventEmitterSchema, a as VisibilityChangedByTransparentServiceWebOptions } from './VisibilityChangedByTransparentServiceWebEvent-D6XJvPVh.cjs';
|
|
3
|
-
import '@granite-js/react-native';
|
|
4
|
-
|
|
5
|
-
interface OnVisibilityChangedByTransparentServiceWebSubscription extends EmitterSubscription {
|
|
6
|
-
remove: () => void;
|
|
7
|
-
}
|
|
8
|
-
type OnVisibilityChangedByTransparentServiceWebEventEmitter = EventEmitterSchema<'visibilityChangedByTransparentServiceWeb', [
|
|
9
|
-
boolean
|
|
10
|
-
]>;
|
|
11
|
-
declare function onVisibilityChangedByTransparentServiceWeb(eventParams: {
|
|
12
|
-
options: VisibilityChangedByTransparentServiceWebOptions;
|
|
13
|
-
onEvent: (isVisible: boolean) => void;
|
|
14
|
-
onError: (error: unknown) => void;
|
|
15
|
-
}): () => void;
|
|
16
|
-
|
|
17
|
-
export { type OnVisibilityChangedByTransparentServiceWebEventEmitter, type OnVisibilityChangedByTransparentServiceWebSubscription, onVisibilityChangedByTransparentServiceWeb };
|
package/dist/private.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { EmitterSubscription } from 'react-native';
|
|
2
|
-
import { E as EventEmitterSchema, a as VisibilityChangedByTransparentServiceWebOptions } from './VisibilityChangedByTransparentServiceWebEvent-D6XJvPVh.js';
|
|
3
|
-
import '@granite-js/react-native';
|
|
4
|
-
|
|
5
|
-
interface OnVisibilityChangedByTransparentServiceWebSubscription extends EmitterSubscription {
|
|
6
|
-
remove: () => void;
|
|
7
|
-
}
|
|
8
|
-
type OnVisibilityChangedByTransparentServiceWebEventEmitter = EventEmitterSchema<'visibilityChangedByTransparentServiceWeb', [
|
|
9
|
-
boolean
|
|
10
|
-
]>;
|
|
11
|
-
declare function onVisibilityChangedByTransparentServiceWeb(eventParams: {
|
|
12
|
-
options: VisibilityChangedByTransparentServiceWebOptions;
|
|
13
|
-
onEvent: (isVisible: boolean) => void;
|
|
14
|
-
onError: (error: unknown) => void;
|
|
15
|
-
}): () => void;
|
|
16
|
-
|
|
17
|
-
export { type OnVisibilityChangedByTransparentServiceWebEventEmitter, type OnVisibilityChangedByTransparentServiceWebSubscription, onVisibilityChangedByTransparentServiceWeb };
|
package/dist/private.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
appsInTossEvent
|
|
3
|
-
} from "./chunk-YS54L7RG.js";
|
|
4
|
-
|
|
5
|
-
// src/AppsInTossModule/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
|
|
6
|
-
function onVisibilityChangedByTransparentServiceWeb(eventParams) {
|
|
7
|
-
return appsInTossEvent.addEventListener("onVisibilityChangedByTransparentServiceWeb", eventParams);
|
|
8
|
-
}
|
|
9
|
-
export {
|
|
10
|
-
onVisibilityChangedByTransparentServiceWeb
|
|
11
|
-
};
|