@apps-in-toss/framework 0.0.17 → 0.0.19

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 CHANGED
@@ -32,6 +32,7 @@ var src_exports = {};
32
32
  __export(src_exports, {
33
33
  Accuracy: () => Accuracy2,
34
34
  AppsInToss: () => AppsInToss,
35
+ Storage: () => Storage,
35
36
  TossPay: () => TossPay,
36
37
  WebView: () => WebView,
37
38
  appLogin: () => appLogin,
@@ -41,6 +42,7 @@ __export(src_exports, {
41
42
  getClipboardText: () => getClipboardText,
42
43
  getCurrentLocation: () => getCurrentLocation,
43
44
  getOperationalEnvironment: () => getOperationalEnvironment,
45
+ getTossAppVersion: () => getTossAppVersion,
44
46
  openCamera: () => openCamera,
45
47
  setClipboardText: () => setClipboardText,
46
48
  startUpdateLocation: () => startUpdateLocation,
@@ -282,6 +284,34 @@ function getOperationalEnvironment() {
282
284
  return AppsInTossModule.operationalEnvironment;
283
285
  }
284
286
 
287
+ // src/native-modules/getTossAppVersion.ts
288
+ function getTossAppVersion() {
289
+ return AppsInTossModule.tossAppVersion;
290
+ }
291
+
292
+ // src/native-modules/storage.ts
293
+ function getItem(key) {
294
+ return AppsInTossModule.getStorageItem({ key });
295
+ }
296
+ function setItem(key, value) {
297
+ return AppsInTossModule.setStorageItem({
298
+ key,
299
+ value
300
+ });
301
+ }
302
+ function removeItem(key) {
303
+ return AppsInTossModule.removeStorageItem({ key });
304
+ }
305
+ function clearItems() {
306
+ return AppsInTossModule.clearStorage({});
307
+ }
308
+ var Storage = {
309
+ getItem,
310
+ setItem,
311
+ removeItem,
312
+ clearItems
313
+ };
314
+
285
315
  // src/native-modules/index.ts
286
316
  var TossPay = {
287
317
  checkoutPayment,
@@ -289,7 +319,8 @@ var TossPay = {
289
319
  };
290
320
 
291
321
  // src/components/WebView.tsx
292
- var import_react_native11 = require("@toss-design-system/react-native");
322
+ var import_react_native12 = require("@toss-design-system/react-native");
323
+ var import_private = require("@toss-design-system/react-native/private");
293
324
  var import_react3 = require("react");
294
325
  var import_react_native_bedrock5 = require("react-native-bedrock");
295
326
  var bedrockAsyncBridges = __toESM(require("react-native-bedrock/async-bridges"), 1);
@@ -297,8 +328,9 @@ var bedrockConstantBridges = __toESM(require("react-native-bedrock/constant-brid
297
328
 
298
329
  // src/components/GameWebView.tsx
299
330
  var import_react_native_webview = require("@react-native-bedrock/native/react-native-webview");
331
+ var import_react_native10 = require("@toss-design-system/react-native");
300
332
  var import_react2 = require("react");
301
- var import_react_native10 = require("react-native");
333
+ var import_react_native11 = require("react-native");
302
334
  var import_react_native_bedrock4 = require("react-native-bedrock");
303
335
 
304
336
  // src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
@@ -382,6 +414,9 @@ function GameNavigationBar({ onClose }) {
382
414
  import_react_native9.TouchableOpacity,
383
415
  {
384
416
  hitSlop: { left: 8, right: 8 },
417
+ accessibilityRole: "button",
418
+ accessible: true,
419
+ accessibilityLabel: "\uB2EB\uAE30",
385
420
  style: {
386
421
  padding: import_react_native9.Platform.OS === "ios" ? 7 : 9
387
422
  },
@@ -397,16 +432,35 @@ function GameNavigationBar({ onClose }) {
397
432
  // src/components/GameWebView.tsx
398
433
  var import_jsx_runtime4 = require("react/jsx-runtime");
399
434
  var GameWebView = (0, import_react2.forwardRef)(function GameWebView2(props, ref) {
435
+ const { openConfirm } = (0, import_react_native10.useDialog)();
436
+ const { brandDisplayName } = getAppsInTossGlobals();
437
+ (0, import_react2.useEffect)(() => {
438
+ if (import_react_native11.Platform.OS === "ios") {
439
+ (0, import_react_native_bedrock4.setIosSwipeGestureEnabled)({ isEnabled: false });
440
+ return () => {
441
+ (0, import_react_native_bedrock4.setIosSwipeGestureEnabled)({ isEnabled: true });
442
+ };
443
+ }
444
+ return;
445
+ }, []);
400
446
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
401
447
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
402
448
  GameNavigationBar,
403
449
  {
404
- onClose: () => {
405
- (0, import_react_native_bedrock4.closeView)();
450
+ onClose: async () => {
451
+ const isConfirmed = await openConfirm({
452
+ title: `${brandDisplayName}\uC744 \uC885\uB8CC\uD560\uAE4C\uC694?`,
453
+ leftButton: "\uCDE8\uC18C",
454
+ rightButton: "\uC885\uB8CC\uD558\uAE30",
455
+ closeOnDimmerClick: true
456
+ });
457
+ if (isConfirmed) {
458
+ (0, import_react_native_bedrock4.closeView)();
459
+ }
406
460
  }
407
461
  }
408
462
  ),
409
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native10.View, { style: { flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_webview.WebView, { ref, ...props }) })
463
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native11.View, { style: { flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_webview.WebView, { ref, ...props }) })
410
464
  ] });
411
465
  });
412
466
 
@@ -427,7 +481,8 @@ __export(async_bridges_exports, {
427
481
  // src/constant-bridges.ts
428
482
  var constant_bridges_exports = {};
429
483
  __export(constant_bridges_exports, {
430
- getOperationalEnvironment: () => getOperationalEnvironment
484
+ getOperationalEnvironment: () => getOperationalEnvironment,
485
+ getTossAppVersion: () => getTossAppVersion
431
486
  });
432
487
 
433
488
  // src/env.ts
@@ -446,8 +501,8 @@ var import_jsx_runtime5 = require("react/jsx-runtime");
446
501
  var appsInTossGlobals = getAppsInTossGlobals();
447
502
  var TYPES = ["partner", "external", "game"];
448
503
  var WEBVIEW_TYPES = {
449
- partner: import_react_native11.PartnerWebViewScreen,
450
- external: import_react_native11.ExternalWebViewScreen,
504
+ partner: import_react_native12.PartnerWebViewScreen,
505
+ external: import_react_native12.ExternalWebViewScreen,
451
506
  game: GameWebView
452
507
  };
453
508
  function mergeSchemeQueryParamsInto(url) {
@@ -477,6 +532,8 @@ function WebView({ type, local, onMessage, ...props }) {
477
532
  throw new Error(`Invalid WebView type: '${type}'`);
478
533
  }
479
534
  const uri = (0, import_react3.useMemo)(() => getWebViewUri(local), [local]);
535
+ const top = (0, import_private.useSafeAreaTop)();
536
+ const bottom = (0, import_private.useSafeAreaBottom)();
480
537
  const handler = (0, import_react_native_bedrock5.useBridgeHandler)({
481
538
  onMessage,
482
539
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -485,13 +542,22 @@ function WebView({ type, local, onMessage, ...props }) {
485
542
  // @ts-expect-error
486
543
  constantHandlerMap: {
487
544
  ...bedrockConstantBridges,
488
- ...constant_bridges_exports
545
+ ...constant_bridges_exports,
546
+ getSafeAreaTop: () => top,
547
+ getSafeAreaBottom: () => bottom
489
548
  },
490
549
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
491
550
  // @ts-expect-error
492
551
  asyncHandlerMap: {
493
552
  ...bedrockAsyncBridges,
494
- ...async_bridges_exports
553
+ ...async_bridges_exports,
554
+ // internal
555
+ openPermissionDialog: AppsInTossModule.openPermissionDialog,
556
+ /** Storage */
557
+ getStorageItem: Storage.getItem,
558
+ setStorageItem: Storage.setItem,
559
+ removeStorageItem: Storage.removeItem,
560
+ clearItems: Storage.clearItems
495
561
  }
496
562
  });
497
563
  const baseProps = (0, import_react3.useMemo)(() => {
@@ -524,6 +590,10 @@ function WebView({ type, local, onMessage, ...props }) {
524
590
  }
525
591
  }, [type, props]);
526
592
  const BaseWebView = WEBVIEW_TYPES[type];
593
+ const webviewDebuggingEnabled = (0, import_react3.useMemo)(
594
+ () => getOperationalEnvironment() === "sandbox",
595
+ []
596
+ );
527
597
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
528
598
  BaseWebView,
529
599
  {
@@ -532,9 +602,8 @@ function WebView({ type, local, onMessage, ...props }) {
532
602
  ...baseProps,
533
603
  source: { uri },
534
604
  sharedCookiesEnabled: true,
605
+ webviewDebuggingEnabled,
535
606
  thirdPartyCookiesEnabled: true,
536
- cacheEnabled: false,
537
- cacheMode: "LOAD_NO_CACHE",
538
607
  onMessage: handler.onMessage,
539
608
  injectedJavaScript: handler.injectedJavaScript,
540
609
  injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
@@ -585,6 +654,7 @@ var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
585
654
  0 && (module.exports = {
586
655
  Accuracy,
587
656
  AppsInToss,
657
+ Storage,
588
658
  TossPay,
589
659
  WebView,
590
660
  appLogin,
@@ -594,6 +664,7 @@ var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
594
664
  getClipboardText,
595
665
  getCurrentLocation,
596
666
  getOperationalEnvironment,
667
+ getTossAppVersion,
597
668
  openCamera,
598
669
  setClipboardText,
599
670
  startUpdateLocation,
package/dist/index.d.cts CHANGED
@@ -569,7 +569,7 @@ interface TossMoneyExecutePaymentResult {
569
569
  * @param {ExecutePaymentOptions} options 결제를 실행할 때 필요한 옵션이에요.
570
570
  * @param {string} options.orderNo 결제를 생성할 때 사용한 주문번호예요.
571
571
  * @param {string} options.payToken 결제 인증 과정에서 전달받은 결제 토큰이에요. 결제를 실행할 때 사용해요.
572
- * @returns {Promise<CardExecutePaymentResult | TossMoneyExecutePaymentResult>} 결제 결과 객체를 반환해요. 자세한 내용은 [카드 결제 결과](reference/framework/토스페이/CardExecutePaymentResult.html) 또는 [토스머니 결제 결과](reference/framework/토스페이/TossMoneyExecutePaymentResult.html)를 참고하세요.
572
+ * @returns {Promise<CardExecutePaymentResult | TossMoneyExecutePaymentResult>} 결제 결과 객체를 반환해요. 자세한 내용은 [카드 결제 결과](/react-native/reference/framework/토스페이/CardExecutePaymentResult.html) 또는 [토스머니 결제 결과](/react-native/reference/framework/토스페이/TossMoneyExecutePaymentResult.html)를 참고하세요.
573
573
  *
574
574
  * @example
575
575
  *
@@ -1027,13 +1027,127 @@ declare function appLogin(): Promise<{
1027
1027
  */
1028
1028
  declare function getOperationalEnvironment(): 'toss' | 'sandbox';
1029
1029
 
1030
+ /**
1031
+ * @public
1032
+ * @category 환경 확인
1033
+ * @name getTossAppVersion
1034
+ * @description 토스 앱 버전을 가져옵니다. 예를 들어, `5.206.0`과 같은 형태로 반환돼요. 토스 앱 버전을 로그로 남기거나, 특정 기능이 특정 버전 이상에서만 실행될 때 사용돼요.
1035
+ * @signature
1036
+ * ```typescript
1037
+ * function getTossAppVersion(): string
1038
+ * ```
1039
+ *
1040
+ * @returns {string} 토스 앱 버전
1041
+ *
1042
+ * @example
1043
+ *
1044
+ *
1045
+ * ### 토스 앱 버전 확인하기
1046
+ *
1047
+ * ```tsx
1048
+ * import { getTossAppVersion } from '@apps-in-toss/framework';
1049
+ * import { Text } from 'react-native';
1050
+ *
1051
+ * export function TossAppVersionPage() {
1052
+ * return (
1053
+ * <Text>{getTossAppVersion()}</Text>
1054
+ * )
1055
+ * }
1056
+ * ```
1057
+ */
1058
+ declare function getTossAppVersion(): string;
1059
+
1060
+ /**
1061
+ * @public
1062
+ * @category 저장소
1063
+ * @name getItem
1064
+ * @description 모바일 앱의 로컬 저장소에서 문자열 데이터를 가져와요. 주로 앱이 종료되었다가 다시 시작해도 데이터가 유지되어야 하는 경우에 사용해요.
1065
+ * @param {string} key - 가져올 아이템의 키를 입력해요.
1066
+ * @returns {Promise<string | null>} 지정한 키에 저장된 문자열 값을 반환해요. 값이 없으면 `null`을 반환해요.
1067
+ * @example
1068
+ *
1069
+ * ### `my-key`에 저장된 아이템 가져오기
1070
+ * ```ts
1071
+ * const value = await Storage.getItem('my-key');
1072
+ * console.log(value); // 'value'
1073
+ * ```
1074
+ */
1075
+ declare function getItem(key: string): Promise<string | null>;
1076
+ /**
1077
+ * @public
1078
+ * @category 저장소
1079
+ * @name setItem
1080
+ * @description 모바일 앱의 로컬 저장소에 문자열 데이터를 저장해요. 주로 앱이 종료되었다가 다시 시작해도 데이터가 유지되어야 하는 경우에 사용해요.
1081
+ * @param {string} key - 저장할 아이템의 키를 입력해요.
1082
+ * @param {string} value - 저장할 아이템의 값을 입력해요.
1083
+ * @returns {Promise<void>} 아이템을 성공적으로 저장하면 아무 값도 반환하지 않아요.
1084
+ * @example
1085
+ *
1086
+ * ### `my-key`에 아이템 저장하기
1087
+ * ```ts
1088
+ * import { Storage } from '@apps-in-toss/framework';
1089
+ *
1090
+ * await Storage.setItem('my-key', 'value');
1091
+ * ```
1092
+ */
1093
+ declare function setItem(key: string, value: string): Promise<void>;
1094
+ /**
1095
+ * @public
1096
+ * @category 저장소
1097
+ * @name removeItem
1098
+ * @description 모바일 앱의 로컬 저장소에서 특정 키에 해당하는 아이템을 삭제해요.
1099
+ * @param {string} key - 삭제할 아이템의 키를 입력해요.
1100
+ * @returns {Promise<void>} 아이템을 삭제하면 아무 값도 반환하지 않아요.
1101
+ * @example
1102
+ *
1103
+ * ### `my-key`에 저장된 아이템 삭제하기
1104
+ * ```ts
1105
+ * import { Storage } from '@apps-in-toss/framework';
1106
+ *
1107
+ * await Storage.removeItem('my-key');
1108
+ * ```
1109
+ */
1110
+ declare function removeItem(key: string): Promise<void>;
1111
+ /**
1112
+ * @public
1113
+ * @category 저장소
1114
+ * @name clearItems
1115
+ * @description 모바일 앱의 로컬 저장소의 모든 아이템을 삭제해요.
1116
+ * @returns {Promise<void>} 아이템을 삭제하면 아무 값도 반환하지 않고 저장소가 초기화돼요.
1117
+ * @example
1118
+ *
1119
+ * ### 저장소 초기화하기
1120
+ * ```ts
1121
+ * import { Storage } from '@apps-in-toss/framework';
1122
+ *
1123
+ * await Storage.clearItems();
1124
+ * ```
1125
+ */
1126
+ declare function clearItems(): Promise<void>;
1127
+ /**
1128
+ * @public
1129
+ * @category 저장소
1130
+ * @name Storage
1131
+ * @description 네이티브의 저장소를 사용해요.
1132
+ * @property {typeof getItem} [getItem] 모바일 앱의 로컬 저장소에서 아이템을 가져오는 함수예요. 자세한 내용은 [getItem](/react-native/reference/framework/저장소/getItem)을 참고하세요.
1133
+ * @property {typeof setItem} [setItem] 모바일 앱의 로컬 저장소에 아이템을 저장하는 함수예요. 자세한 내용은 [setItem](/react-native/reference/framework/저장소/setItem)을 참고하세요.
1134
+ * @property {typeof removeItem} [removeItem] 모바일 앱의 로컬 저장소에서 아이템을 삭제하는 함수예요. 자세한 내용은 [removeItem](/react-native/reference/framework/저장소/removeItem)을 참고하세요.
1135
+ * @property {typeof clearItems} [clearItems] 모바일 앱의 로컬 저장소를 초기화하는 함수예요. 자세한 내용은 [clearItems](/react-native/reference/framework/저장소/clearItems)을 참고하세요.
1136
+ */
1137
+ declare const Storage: {
1138
+ getItem: typeof getItem;
1139
+ setItem: typeof setItem;
1140
+ removeItem: typeof removeItem;
1141
+ clearItems: typeof clearItems;
1142
+ };
1143
+
1030
1144
  /**
1031
1145
  * @public
1032
1146
  * @category 토스페이
1033
1147
  * @name TossPay
1034
1148
  * @description 토스페이 결제 관련 함수를 모아둔 객체예요.
1035
- * @property {typeof checkoutPayment} [checkoutPayment] 토스페이 결제를 생성하는 함수예요. 자세한 내용은 [checkoutPayment](reference/framework/토스페이/checkoutPayment)를 참고하세요.
1036
- * @property {typeof executePayment} [executePayment] 토스페이 결제를 실행하는 함수예요. 자세한 내용은 [executePayment](reference/framework/토스페이/executePayment)를 참고하세요.
1149
+ * @property {typeof checkoutPayment} [checkoutPayment] 토스페이 결제를 생성하는 함수예요. 자세한 내용은 [checkoutPayment](/react-native/reference/framework/토스페이/checkoutPayment)를 참고하세요.
1150
+ * @property {typeof executePayment} [executePayment] 토스페이 결제를 실행하는 함수예요. 자세한 내용은 [executePayment](/react-native/reference/framework/토스페이/executePayment)를 참고하세요.
1037
1151
  */
1038
1152
  declare const TossPay: {
1039
1153
  checkoutPayment: typeof checkoutPayment;
@@ -1112,4 +1226,4 @@ declare const env: {
1112
1226
  getDeploymentId: () => string | undefined;
1113
1227
  };
1114
1228
 
1115
- export { Accuracy, AppsInToss, type ContactEntity, type ExternalWebViewProps, type FetchAlbumPhotosOptions, type GameWebViewProps, type GetCurrentLocationOptions, type ImageResponse, type Location, type LocationCoords, type OpenCameraOptions, type PartnerWebViewProps, type StartUpdateLocationOptions, type StartUpdateLocationSubscription, TossPay, type UpdateLocationEventEmitter, type UseGeolocationOptions, WebView, type WebViewProps, appLogin, env, fetchAlbumPhotos, fetchContacts, getClipboardText, getCurrentLocation, getOperationalEnvironment, openCamera, setClipboardText, startUpdateLocation, useGeolocation };
1229
+ export { Accuracy, AppsInToss, type ContactEntity, type ExternalWebViewProps, type FetchAlbumPhotosOptions, type GameWebViewProps, type GetCurrentLocationOptions, type ImageResponse, type Location, type LocationCoords, type OpenCameraOptions, type PartnerWebViewProps, type StartUpdateLocationOptions, type StartUpdateLocationSubscription, Storage, TossPay, type UpdateLocationEventEmitter, type UseGeolocationOptions, WebView, type WebViewProps, appLogin, env, fetchAlbumPhotos, fetchContacts, getClipboardText, getCurrentLocation, getOperationalEnvironment, getTossAppVersion, openCamera, setClipboardText, startUpdateLocation, useGeolocation };
package/dist/index.d.ts CHANGED
@@ -569,7 +569,7 @@ interface TossMoneyExecutePaymentResult {
569
569
  * @param {ExecutePaymentOptions} options 결제를 실행할 때 필요한 옵션이에요.
570
570
  * @param {string} options.orderNo 결제를 생성할 때 사용한 주문번호예요.
571
571
  * @param {string} options.payToken 결제 인증 과정에서 전달받은 결제 토큰이에요. 결제를 실행할 때 사용해요.
572
- * @returns {Promise<CardExecutePaymentResult | TossMoneyExecutePaymentResult>} 결제 결과 객체를 반환해요. 자세한 내용은 [카드 결제 결과](reference/framework/토스페이/CardExecutePaymentResult.html) 또는 [토스머니 결제 결과](reference/framework/토스페이/TossMoneyExecutePaymentResult.html)를 참고하세요.
572
+ * @returns {Promise<CardExecutePaymentResult | TossMoneyExecutePaymentResult>} 결제 결과 객체를 반환해요. 자세한 내용은 [카드 결제 결과](/react-native/reference/framework/토스페이/CardExecutePaymentResult.html) 또는 [토스머니 결제 결과](/react-native/reference/framework/토스페이/TossMoneyExecutePaymentResult.html)를 참고하세요.
573
573
  *
574
574
  * @example
575
575
  *
@@ -1027,13 +1027,127 @@ declare function appLogin(): Promise<{
1027
1027
  */
1028
1028
  declare function getOperationalEnvironment(): 'toss' | 'sandbox';
1029
1029
 
1030
+ /**
1031
+ * @public
1032
+ * @category 환경 확인
1033
+ * @name getTossAppVersion
1034
+ * @description 토스 앱 버전을 가져옵니다. 예를 들어, `5.206.0`과 같은 형태로 반환돼요. 토스 앱 버전을 로그로 남기거나, 특정 기능이 특정 버전 이상에서만 실행될 때 사용돼요.
1035
+ * @signature
1036
+ * ```typescript
1037
+ * function getTossAppVersion(): string
1038
+ * ```
1039
+ *
1040
+ * @returns {string} 토스 앱 버전
1041
+ *
1042
+ * @example
1043
+ *
1044
+ *
1045
+ * ### 토스 앱 버전 확인하기
1046
+ *
1047
+ * ```tsx
1048
+ * import { getTossAppVersion } from '@apps-in-toss/framework';
1049
+ * import { Text } from 'react-native';
1050
+ *
1051
+ * export function TossAppVersionPage() {
1052
+ * return (
1053
+ * <Text>{getTossAppVersion()}</Text>
1054
+ * )
1055
+ * }
1056
+ * ```
1057
+ */
1058
+ declare function getTossAppVersion(): string;
1059
+
1060
+ /**
1061
+ * @public
1062
+ * @category 저장소
1063
+ * @name getItem
1064
+ * @description 모바일 앱의 로컬 저장소에서 문자열 데이터를 가져와요. 주로 앱이 종료되었다가 다시 시작해도 데이터가 유지되어야 하는 경우에 사용해요.
1065
+ * @param {string} key - 가져올 아이템의 키를 입력해요.
1066
+ * @returns {Promise<string | null>} 지정한 키에 저장된 문자열 값을 반환해요. 값이 없으면 `null`을 반환해요.
1067
+ * @example
1068
+ *
1069
+ * ### `my-key`에 저장된 아이템 가져오기
1070
+ * ```ts
1071
+ * const value = await Storage.getItem('my-key');
1072
+ * console.log(value); // 'value'
1073
+ * ```
1074
+ */
1075
+ declare function getItem(key: string): Promise<string | null>;
1076
+ /**
1077
+ * @public
1078
+ * @category 저장소
1079
+ * @name setItem
1080
+ * @description 모바일 앱의 로컬 저장소에 문자열 데이터를 저장해요. 주로 앱이 종료되었다가 다시 시작해도 데이터가 유지되어야 하는 경우에 사용해요.
1081
+ * @param {string} key - 저장할 아이템의 키를 입력해요.
1082
+ * @param {string} value - 저장할 아이템의 값을 입력해요.
1083
+ * @returns {Promise<void>} 아이템을 성공적으로 저장하면 아무 값도 반환하지 않아요.
1084
+ * @example
1085
+ *
1086
+ * ### `my-key`에 아이템 저장하기
1087
+ * ```ts
1088
+ * import { Storage } from '@apps-in-toss/framework';
1089
+ *
1090
+ * await Storage.setItem('my-key', 'value');
1091
+ * ```
1092
+ */
1093
+ declare function setItem(key: string, value: string): Promise<void>;
1094
+ /**
1095
+ * @public
1096
+ * @category 저장소
1097
+ * @name removeItem
1098
+ * @description 모바일 앱의 로컬 저장소에서 특정 키에 해당하는 아이템을 삭제해요.
1099
+ * @param {string} key - 삭제할 아이템의 키를 입력해요.
1100
+ * @returns {Promise<void>} 아이템을 삭제하면 아무 값도 반환하지 않아요.
1101
+ * @example
1102
+ *
1103
+ * ### `my-key`에 저장된 아이템 삭제하기
1104
+ * ```ts
1105
+ * import { Storage } from '@apps-in-toss/framework';
1106
+ *
1107
+ * await Storage.removeItem('my-key');
1108
+ * ```
1109
+ */
1110
+ declare function removeItem(key: string): Promise<void>;
1111
+ /**
1112
+ * @public
1113
+ * @category 저장소
1114
+ * @name clearItems
1115
+ * @description 모바일 앱의 로컬 저장소의 모든 아이템을 삭제해요.
1116
+ * @returns {Promise<void>} 아이템을 삭제하면 아무 값도 반환하지 않고 저장소가 초기화돼요.
1117
+ * @example
1118
+ *
1119
+ * ### 저장소 초기화하기
1120
+ * ```ts
1121
+ * import { Storage } from '@apps-in-toss/framework';
1122
+ *
1123
+ * await Storage.clearItems();
1124
+ * ```
1125
+ */
1126
+ declare function clearItems(): Promise<void>;
1127
+ /**
1128
+ * @public
1129
+ * @category 저장소
1130
+ * @name Storage
1131
+ * @description 네이티브의 저장소를 사용해요.
1132
+ * @property {typeof getItem} [getItem] 모바일 앱의 로컬 저장소에서 아이템을 가져오는 함수예요. 자세한 내용은 [getItem](/react-native/reference/framework/저장소/getItem)을 참고하세요.
1133
+ * @property {typeof setItem} [setItem] 모바일 앱의 로컬 저장소에 아이템을 저장하는 함수예요. 자세한 내용은 [setItem](/react-native/reference/framework/저장소/setItem)을 참고하세요.
1134
+ * @property {typeof removeItem} [removeItem] 모바일 앱의 로컬 저장소에서 아이템을 삭제하는 함수예요. 자세한 내용은 [removeItem](/react-native/reference/framework/저장소/removeItem)을 참고하세요.
1135
+ * @property {typeof clearItems} [clearItems] 모바일 앱의 로컬 저장소를 초기화하는 함수예요. 자세한 내용은 [clearItems](/react-native/reference/framework/저장소/clearItems)을 참고하세요.
1136
+ */
1137
+ declare const Storage: {
1138
+ getItem: typeof getItem;
1139
+ setItem: typeof setItem;
1140
+ removeItem: typeof removeItem;
1141
+ clearItems: typeof clearItems;
1142
+ };
1143
+
1030
1144
  /**
1031
1145
  * @public
1032
1146
  * @category 토스페이
1033
1147
  * @name TossPay
1034
1148
  * @description 토스페이 결제 관련 함수를 모아둔 객체예요.
1035
- * @property {typeof checkoutPayment} [checkoutPayment] 토스페이 결제를 생성하는 함수예요. 자세한 내용은 [checkoutPayment](reference/framework/토스페이/checkoutPayment)를 참고하세요.
1036
- * @property {typeof executePayment} [executePayment] 토스페이 결제를 실행하는 함수예요. 자세한 내용은 [executePayment](reference/framework/토스페이/executePayment)를 참고하세요.
1149
+ * @property {typeof checkoutPayment} [checkoutPayment] 토스페이 결제를 생성하는 함수예요. 자세한 내용은 [checkoutPayment](/react-native/reference/framework/토스페이/checkoutPayment)를 참고하세요.
1150
+ * @property {typeof executePayment} [executePayment] 토스페이 결제를 실행하는 함수예요. 자세한 내용은 [executePayment](/react-native/reference/framework/토스페이/executePayment)를 참고하세요.
1037
1151
  */
1038
1152
  declare const TossPay: {
1039
1153
  checkoutPayment: typeof checkoutPayment;
@@ -1112,4 +1226,4 @@ declare const env: {
1112
1226
  getDeploymentId: () => string | undefined;
1113
1227
  };
1114
1228
 
1115
- export { Accuracy, AppsInToss, type ContactEntity, type ExternalWebViewProps, type FetchAlbumPhotosOptions, type GameWebViewProps, type GetCurrentLocationOptions, type ImageResponse, type Location, type LocationCoords, type OpenCameraOptions, type PartnerWebViewProps, type StartUpdateLocationOptions, type StartUpdateLocationSubscription, TossPay, type UpdateLocationEventEmitter, type UseGeolocationOptions, WebView, type WebViewProps, appLogin, env, fetchAlbumPhotos, fetchContacts, getClipboardText, getCurrentLocation, getOperationalEnvironment, openCamera, setClipboardText, startUpdateLocation, useGeolocation };
1229
+ export { Accuracy, AppsInToss, type ContactEntity, type ExternalWebViewProps, type FetchAlbumPhotosOptions, type GameWebViewProps, type GetCurrentLocationOptions, type ImageResponse, type Location, type LocationCoords, type OpenCameraOptions, type PartnerWebViewProps, type StartUpdateLocationOptions, type StartUpdateLocationSubscription, Storage, TossPay, type UpdateLocationEventEmitter, type UseGeolocationOptions, WebView, type WebViewProps, appLogin, env, fetchAlbumPhotos, fetchContacts, getClipboardText, getCurrentLocation, getOperationalEnvironment, getTossAppVersion, openCamera, setClipboardText, startUpdateLocation, useGeolocation };
package/dist/index.js CHANGED
@@ -238,6 +238,34 @@ function getOperationalEnvironment() {
238
238
  return AppsInTossModule.operationalEnvironment;
239
239
  }
240
240
 
241
+ // src/native-modules/getTossAppVersion.ts
242
+ function getTossAppVersion() {
243
+ return AppsInTossModule.tossAppVersion;
244
+ }
245
+
246
+ // src/native-modules/storage.ts
247
+ function getItem(key) {
248
+ return AppsInTossModule.getStorageItem({ key });
249
+ }
250
+ function setItem(key, value) {
251
+ return AppsInTossModule.setStorageItem({
252
+ key,
253
+ value
254
+ });
255
+ }
256
+ function removeItem(key) {
257
+ return AppsInTossModule.removeStorageItem({ key });
258
+ }
259
+ function clearItems() {
260
+ return AppsInTossModule.clearStorage({});
261
+ }
262
+ var Storage = {
263
+ getItem,
264
+ setItem,
265
+ removeItem,
266
+ clearItems
267
+ };
268
+
241
269
  // src/native-modules/index.ts
242
270
  var TossPay = {
243
271
  checkoutPayment,
@@ -249,6 +277,7 @@ import {
249
277
  PartnerWebViewScreen,
250
278
  ExternalWebViewScreen
251
279
  } from "@toss-design-system/react-native";
280
+ import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2 } from "@toss-design-system/react-native/private";
252
281
  import { useMemo } from "react";
253
282
  import { getSchemeUri, useBridgeHandler } from "react-native-bedrock";
254
283
  import * as bedrockAsyncBridges from "react-native-bedrock/async-bridges";
@@ -258,9 +287,10 @@ import * as bedrockConstantBridges from "react-native-bedrock/constant-bridges";
258
287
  import {
259
288
  WebView as PlainWebView
260
289
  } from "@react-native-bedrock/native/react-native-webview";
261
- import { forwardRef } from "react";
262
- import { View as View3 } from "react-native";
263
- import { closeView } from "react-native-bedrock";
290
+ import { useDialog } from "@toss-design-system/react-native";
291
+ import { forwardRef, useEffect as useEffect2 } from "react";
292
+ import { Platform as Platform4, View as View3 } from "react-native";
293
+ import { closeView, setIosSwipeGestureEnabled } from "react-native-bedrock";
264
294
 
265
295
  // src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
266
296
  import { SvgXml } from "@react-native-bedrock/native/react-native-svg";
@@ -343,6 +373,9 @@ function GameNavigationBar({ onClose }) {
343
373
  TouchableOpacity,
344
374
  {
345
375
  hitSlop: { left: 8, right: 8 },
376
+ accessibilityRole: "button",
377
+ accessible: true,
378
+ accessibilityLabel: "\uB2EB\uAE30",
346
379
  style: {
347
380
  padding: Platform3.OS === "ios" ? 7 : 9
348
381
  },
@@ -358,12 +391,31 @@ function GameNavigationBar({ onClose }) {
358
391
  // src/components/GameWebView.tsx
359
392
  import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
360
393
  var GameWebView = forwardRef(function GameWebView2(props, ref) {
394
+ const { openConfirm } = useDialog();
395
+ const { brandDisplayName } = getAppsInTossGlobals();
396
+ useEffect2(() => {
397
+ if (Platform4.OS === "ios") {
398
+ setIosSwipeGestureEnabled({ isEnabled: false });
399
+ return () => {
400
+ setIosSwipeGestureEnabled({ isEnabled: true });
401
+ };
402
+ }
403
+ return;
404
+ }, []);
361
405
  return /* @__PURE__ */ jsxs2(Fragment3, { children: [
362
406
  /* @__PURE__ */ jsx4(
363
407
  GameNavigationBar,
364
408
  {
365
- onClose: () => {
366
- closeView();
409
+ onClose: async () => {
410
+ const isConfirmed = await openConfirm({
411
+ title: `${brandDisplayName}\uC744 \uC885\uB8CC\uD560\uAE4C\uC694?`,
412
+ leftButton: "\uCDE8\uC18C",
413
+ rightButton: "\uC885\uB8CC\uD558\uAE30",
414
+ closeOnDimmerClick: true
415
+ });
416
+ if (isConfirmed) {
417
+ closeView();
418
+ }
367
419
  }
368
420
  }
369
421
  ),
@@ -388,7 +440,8 @@ __export(async_bridges_exports, {
388
440
  // src/constant-bridges.ts
389
441
  var constant_bridges_exports = {};
390
442
  __export(constant_bridges_exports, {
391
- getOperationalEnvironment: () => getOperationalEnvironment
443
+ getOperationalEnvironment: () => getOperationalEnvironment,
444
+ getTossAppVersion: () => getTossAppVersion
392
445
  });
393
446
 
394
447
  // src/env.ts
@@ -438,6 +491,8 @@ function WebView({ type, local, onMessage, ...props }) {
438
491
  throw new Error(`Invalid WebView type: '${type}'`);
439
492
  }
440
493
  const uri = useMemo(() => getWebViewUri(local), [local]);
494
+ const top = useSafeAreaTop2();
495
+ const bottom = useSafeAreaBottom();
441
496
  const handler = useBridgeHandler({
442
497
  onMessage,
443
498
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -446,13 +501,22 @@ function WebView({ type, local, onMessage, ...props }) {
446
501
  // @ts-expect-error
447
502
  constantHandlerMap: {
448
503
  ...bedrockConstantBridges,
449
- ...constant_bridges_exports
504
+ ...constant_bridges_exports,
505
+ getSafeAreaTop: () => top,
506
+ getSafeAreaBottom: () => bottom
450
507
  },
451
508
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
452
509
  // @ts-expect-error
453
510
  asyncHandlerMap: {
454
511
  ...bedrockAsyncBridges,
455
- ...async_bridges_exports
512
+ ...async_bridges_exports,
513
+ // internal
514
+ openPermissionDialog: AppsInTossModule.openPermissionDialog,
515
+ /** Storage */
516
+ getStorageItem: Storage.getItem,
517
+ setStorageItem: Storage.setItem,
518
+ removeStorageItem: Storage.removeItem,
519
+ clearItems: Storage.clearItems
456
520
  }
457
521
  });
458
522
  const baseProps = useMemo(() => {
@@ -485,6 +549,10 @@ function WebView({ type, local, onMessage, ...props }) {
485
549
  }
486
550
  }, [type, props]);
487
551
  const BaseWebView = WEBVIEW_TYPES[type];
552
+ const webviewDebuggingEnabled = useMemo(
553
+ () => getOperationalEnvironment() === "sandbox",
554
+ []
555
+ );
488
556
  return /* @__PURE__ */ jsx5(
489
557
  BaseWebView,
490
558
  {
@@ -493,9 +561,8 @@ function WebView({ type, local, onMessage, ...props }) {
493
561
  ...baseProps,
494
562
  source: { uri },
495
563
  sharedCookiesEnabled: true,
564
+ webviewDebuggingEnabled,
496
565
  thirdPartyCookiesEnabled: true,
497
- cacheEnabled: false,
498
- cacheMode: "LOAD_NO_CACHE",
499
566
  onMessage: handler.onMessage,
500
567
  injectedJavaScript: handler.injectedJavaScript,
501
568
  injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
@@ -510,12 +577,12 @@ function ensureValue(value, name) {
510
577
  }
511
578
 
512
579
  // src/hooks/useGeolocation.ts
513
- import { useState, useEffect as useEffect2 } from "react";
580
+ import { useState, useEffect as useEffect3 } from "react";
514
581
  import { useVisibility } from "react-native-bedrock";
515
582
  function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
516
583
  const isVisible = useVisibility();
517
584
  const [location, setLocation] = useState(null);
518
- useEffect2(() => {
585
+ useEffect3(() => {
519
586
  if (!isVisible) {
520
587
  return;
521
588
  }
@@ -545,6 +612,7 @@ var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
545
612
  export {
546
613
  Accuracy2 as Accuracy,
547
614
  AppsInToss,
615
+ Storage,
548
616
  TossPay,
549
617
  WebView,
550
618
  appLogin,
@@ -554,6 +622,7 @@ export {
554
622
  getClipboardText,
555
623
  getCurrentLocation,
556
624
  getOperationalEnvironment,
625
+ getTossAppVersion,
557
626
  openCamera,
558
627
  setClipboardText,
559
628
  startUpdateLocation,
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@apps-in-toss/framework",
3
3
  "type": "module",
4
- "version": "0.0.17",
4
+ "version": "0.0.19",
5
5
  "description": "The framework for Apps In Toss",
6
6
  "scripts": {
7
7
  "prepack": "yarn build",
8
8
  "typecheck": "tsc --noEmit",
9
+ "test:no-parallel": "vitest --no-watch",
9
10
  "lint": "eslint .",
10
11
  "build": "tsup"
11
12
  },
@@ -55,21 +56,28 @@
55
56
  "ait": "./bin/ait.js"
56
57
  },
57
58
  "dependencies": {
58
- "@apps-in-toss/cli": "0.0.17",
59
- "@apps-in-toss/plugins": "0.0.17"
59
+ "@apps-in-toss/cli": "0.0.19",
60
+ "@apps-in-toss/plugins": "0.0.19"
60
61
  },
61
62
  "devDependencies": {
62
- "@react-native-bedrock/mpack-next": "0.0.15",
63
- "@react-native-bedrock/native": "0.0.15",
63
+ "@react-native-bedrock/mpack-next": "0.0.17",
64
+ "@react-native-bedrock/native": "0.0.17",
64
65
  "@toss-design-system/react-native": "^0.4.1",
66
+ "@types/kill-port": "^2.0.1",
65
67
  "@types/react": "18.3.3",
68
+ "@types/yauzl": "^2.10.3",
69
+ "es-toolkit": "^1.34.1",
66
70
  "eslint": "^9.7.0",
71
+ "execa": "^9.5.2",
72
+ "kill-port": "^2.0.1",
67
73
  "react": "18.2.0",
68
74
  "react-native": "0.72.6",
69
- "react-native-bedrock": "0.0.15",
75
+ "react-native-bedrock": "0.0.17",
70
76
  "tsup": "^8.3.5",
71
77
  "typescript": "4.9.5",
72
- "vitest": "^3.0.3"
78
+ "vitest": "^3.0.3",
79
+ "workspace-tools": "^0.38.2",
80
+ "yauzl": "^3.2.0"
73
81
  },
74
82
  "peerDependencies": {
75
83
  "@react-native-bedrock/native": "*",
@@ -82,5 +90,5 @@
82
90
  "publishConfig": {
83
91
  "access": "public"
84
92
  },
85
- "gitHead": "8c405027275bd4ef6a16037e32b4786ea9f0277a"
93
+ "gitHead": "205a7b9571d501f2b64c9b6ad80cae377baec49d"
86
94
  }
@@ -1 +1,2 @@
1
1
  export * from './native-modules/getOperationalEnvironment.js';
2
+ export * from './native-modules/getTossAppVersion.js';