@apps-in-toss/framework 0.0.25 → 0.0.27

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
@@ -53,6 +53,7 @@ __export(src_exports, {
53
53
  isMinVersionSupported: () => isMinVersionSupported,
54
54
  openCamera: () => openCamera,
55
55
  setClipboardText: () => setClipboardText,
56
+ setDeviceOrientation: () => setDeviceOrientation,
56
57
  startUpdateLocation: () => startUpdateLocation,
57
58
  useGeolocation: () => useGeolocation
58
59
  });
@@ -311,7 +312,9 @@ var UpdateLocationEvent = class extends import_react_native_bedrock4.BedrockEven
311
312
  }
312
313
  };
313
314
  remove() {
314
- --this.subscriptionCount === 0 && AppsInTossModuleInstance.stopUpdateLocation({});
315
+ if (--this.subscriptionCount === 0) {
316
+ AppsInTossModuleInstance.stopUpdateLocation({});
317
+ }
315
318
  this.ref.remove();
316
319
  }
317
320
  listener(options, onEvent, onError) {
@@ -469,7 +472,8 @@ __export(async_bridges_exports, {
469
472
  getCurrentLocation: () => getCurrentLocation,
470
473
  getTossShareLink: () => getTossShareLink,
471
474
  openCamera: () => openCamera,
472
- setClipboardText: () => setClipboardText
475
+ setClipboardText: () => setClipboardText,
476
+ setDeviceOrientation: () => setDeviceOrientation
473
477
  });
474
478
 
475
479
  // src/native-modules/setClipboardText.ts
@@ -596,6 +600,18 @@ async function getTossShareLink(path) {
596
600
  return shareUrl.toString();
597
601
  }
598
602
 
603
+ // src/native-modules/setDeviceOrientation.ts
604
+ async function setDeviceOrientation(options) {
605
+ const isSupported = isMinVersionSupported({
606
+ android: "5.215.0",
607
+ ios: "5.215.0"
608
+ });
609
+ if (!isSupported) {
610
+ return;
611
+ }
612
+ return AppsInTossModule.setDeviceOrientation(options);
613
+ }
614
+
599
615
  // src/core/registerApp.tsx
600
616
  var import_jsx_runtime = require("react/jsx-runtime");
601
617
  function AppsInTossContainer(Container, { children, ...initialProps }) {
@@ -1193,8 +1209,6 @@ function WebView({ type, local, onMessage, ...props }) {
1193
1209
  loadAdMobRewardedAd: GoogleAdMob.loadAdMobRewardedAd,
1194
1210
  showAdMobRewardedAd: GoogleAdMob.showAdMobRewardedAd
1195
1211
  },
1196
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1197
- // @ts-expect-error
1198
1212
  constantHandlerMap: {
1199
1213
  ...bedrockConstantBridges,
1200
1214
  ...constant_bridges_exports,
@@ -1208,8 +1222,6 @@ function WebView({ type, local, onMessage, ...props }) {
1208
1222
  /** env */
1209
1223
  getDeploymentId: env.getDeploymentId
1210
1224
  },
1211
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1212
- // @ts-expect-error
1213
1225
  asyncHandlerMap: {
1214
1226
  ...bedrockAsyncBridges,
1215
1227
  ...async_bridges_exports,
@@ -1348,6 +1360,7 @@ var Analytics2 = {
1348
1360
  isMinVersionSupported,
1349
1361
  openCamera,
1350
1362
  setClipboardText,
1363
+ setDeviceOrientation,
1351
1364
  startUpdateLocation,
1352
1365
  useGeolocation,
1353
1366
  ...require("@apps-in-toss/analytics")
package/dist/index.d.cts CHANGED
@@ -149,10 +149,8 @@ interface StartUpdateLocationSubscription extends EmitterSubscription {
149
149
  * @kind typedef
150
150
  * @description
151
151
  * 디바이스의 위치 정보 변경을 감지해요
152
- * @extends {EventEmitterSchema<'updateLocation', [Location]>}
153
152
  */
154
- interface UpdateLocationEventEmitter extends EventEmitterSchema<'updateLocation', [Location]> {
155
- }
153
+ type UpdateLocationEventEmitter = EventEmitterSchema<'updateLocation', [Location]>;
156
154
  /**
157
155
  * @public
158
156
  * @category 위치 정보
@@ -365,20 +363,25 @@ type LoadAdMobInterstitialAdParams = AdMobHandlerParams<LoadAdMobInterstitialAdO
365
363
  * @property {() => boolean} [isSupported] 현재 실행 중인 앱(예: 토스 앱, 개발용 샌드박스 앱 등)에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요. 기능을 사용하기 전에 지원 여부를 확인해야 해요.
366
364
  *
367
365
  * @example
368
- * ### 진입 전면광고 불러오기
366
+ * ### 버튼 눌러 불러온 전면 광고 보여주기
369
367
  * ```tsx
370
368
  * import { GoogleAdMob } from '@apps-in-toss/framework';
371
- * import { useEffect } from 'react';
372
- * import { View, Text } from 'react-native';
369
+ * import { useFocusEffect } from '@react-native-bedrock/native/@react-navigation/native';
370
+ * import { useCallback, useState } from 'react';
371
+ * import { Button, Text, View } from 'react-native';
372
+ * import { useNavigation } from 'react-native-bedrock';
373
373
  *
374
- * const AD_UNIT_ID = '<YOUR_AD_UNIT_ID>';
374
+ * const AD_UNIT_ID = '<AD_UNIT_ID>';
375
375
  *
376
- * function Page() {
377
- * useEffect(() => {
376
+ * export function GoogleAdmobInterstitialAdExample() {
377
+ * const [adLoadStatus, setAdLoadStatus] = useState<'not_loaded' | 'loaded' | 'failed'>('not_loaded');
378
+ * const navigation = useNavigation();
379
+ *
380
+ * const loadAd = useCallback(() => {
378
381
  * if (GoogleAdMob.loadAdMobInterstitialAd.isSupported() !== true) {
379
382
  * return;
380
383
  * }
381
- *
384
+
382
385
  * const cleanup = GoogleAdMob.loadAdMobInterstitialAd({
383
386
  * options: {
384
387
  * adUnitId: AD_UNIT_ID,
@@ -387,6 +390,7 @@ type LoadAdMobInterstitialAdParams = AdMobHandlerParams<LoadAdMobInterstitialAdO
387
390
  * switch (event.type) {
388
391
  * case 'loaded':
389
392
  * console.log('광고 로드 성공', event.data);
393
+ * setAdLoadStatus('loaded');
390
394
  * break;
391
395
  *
392
396
  * case 'clicked':
@@ -395,6 +399,7 @@ type LoadAdMobInterstitialAdParams = AdMobHandlerParams<LoadAdMobInterstitialAdO
395
399
  *
396
400
  * case 'dismissed':
397
401
  * console.log('광고 닫힘');
402
+ * navigation.navigate('/examples/google-admob-interstitial-ad-landing');
398
403
  * break;
399
404
  *
400
405
  * case 'failedToShow':
@@ -416,11 +421,41 @@ type LoadAdMobInterstitialAdParams = AdMobHandlerParams<LoadAdMobInterstitialAdO
416
421
  * });
417
422
  *
418
423
  * return cleanup;
424
+ * }, [navigation]);
425
+ *
426
+ * const showAd = useCallback(() => {
427
+ * if (GoogleAdMob.showAdMobInterstitialAd.isSupported() !== true) {
428
+ * return;
429
+ * }
430
+ *
431
+ * GoogleAdMob.showAdMobInterstitialAd({
432
+ * options: {
433
+ * adUnitId: AD_UNIT_ID,
434
+ * },
435
+ * onEvent: (event) => {
436
+ * switch (event.type) {
437
+ * case 'requested':
438
+ * console.log('광고 보여주기 요청 완료');
439
+ * break;
440
+ * }
441
+ * },
442
+ * onError: (error) => {
443
+ * console.error('광고 보여주기 실패', error);
444
+ * },
445
+ * });
419
446
  * }, []);
420
447
  *
448
+ * useFocusEffect(loadAd);
449
+ *
421
450
  * return (
422
451
  * <View>
423
- * <Text>Page</Text>
452
+ * <Text>
453
+ * {adLoadStatus === 'not_loaded' && '광고 로드 하지 않음 '}
454
+ * {adLoadStatus === 'loaded' && '광고 로드 완료'}
455
+ * {adLoadStatus === 'failed' && '광고 로드 실패'}
456
+ * </Text>
457
+ *
458
+ * <Button title="Show Ad" onPress={showAd} disabled={adLoadStatus !== 'loaded'} />
424
459
  * </View>
425
460
  * );
426
461
  * }
@@ -468,12 +503,64 @@ type ShowAdMobInterstitialAdParams = AdMobHandlerParams<ShowAdMobInterstitialAdO
468
503
  * ### 버튼 눌러 불러온 전면 광고 보여주기
469
504
  * ```tsx
470
505
  * import { GoogleAdMob } from '@apps-in-toss/framework';
471
- * import { View, Button } from 'react-native';
506
+ * import { useFocusEffect } from '@react-native-bedrock/native/@react-navigation/native';
507
+ * import { useCallback, useState } from 'react';
508
+ * import { Button, Text, View } from 'react-native';
509
+ * import { useNavigation } from 'react-native-bedrock';
472
510
  *
473
- * const AD_UNIT_ID = '<YOUR_AD_UNIT_ID>';
511
+ * const AD_UNIT_ID = '<AD_UNIT_ID>';
474
512
  *
475
- * function Page() {
476
- * const handlePress = () => {
513
+ * export function GoogleAdmobInterstitialAdExample() {
514
+ * const [adLoadStatus, setAdLoadStatus] = useState<'not_loaded' | 'loaded' | 'failed'>('not_loaded');
515
+ * const navigation = useNavigation();
516
+ *
517
+ * const loadAd = useCallback(() => {
518
+ * if (GoogleAdMob.loadAdMobInterstitialAd.isSupported() !== true) {
519
+ * return;
520
+ * }
521
+
522
+ * const cleanup = GoogleAdMob.loadAdMobInterstitialAd({
523
+ * options: {
524
+ * adUnitId: AD_UNIT_ID,
525
+ * },
526
+ * onEvent: (event) => {
527
+ * switch (event.type) {
528
+ * case 'loaded':
529
+ * console.log('광고 로드 성공', event.data);
530
+ * setAdLoadStatus('loaded');
531
+ * break;
532
+ *
533
+ * case 'clicked':
534
+ * console.log('광고 클릭');
535
+ * break;
536
+ *
537
+ * case 'dismissed':
538
+ * console.log('광고 닫힘');
539
+ * navigation.navigate('/examples/google-admob-interstitial-ad-landing');
540
+ * break;
541
+ *
542
+ * case 'failedToShow':
543
+ * console.log('광고 보여주기 실패');
544
+ * break;
545
+ *
546
+ * case 'impression':
547
+ * console.log('광고 노출');
548
+ * break;
549
+ *
550
+ * case 'show':
551
+ * console.log('광고 컨텐츠 보여졌음');
552
+ * break;
553
+ * }
554
+ * },
555
+ * onError: (error) => {
556
+ * console.error('광고 불러오기 실패', error);
557
+ * },
558
+ * });
559
+ *
560
+ * return cleanup;
561
+ * }, [navigation]);
562
+ *
563
+ * const showAd = useCallback(() => {
477
564
  * if (GoogleAdMob.showAdMobInterstitialAd.isSupported() !== true) {
478
565
  * return;
479
566
  * }
@@ -493,10 +580,20 @@ type ShowAdMobInterstitialAdParams = AdMobHandlerParams<ShowAdMobInterstitialAdO
493
580
  * console.error('광고 보여주기 실패', error);
494
581
  * },
495
582
  * });
496
- * }
583
+ * }, []);
584
+ *
585
+ * useFocusEffect(loadAd);
497
586
  *
498
587
  * return (
499
- * <Button onPress={handlePress} title="광고 보기" />
588
+ * <View>
589
+ * <Text>
590
+ * {adLoadStatus === 'not_loaded' && '광고 로드 하지 않음 '}
591
+ * {adLoadStatus === 'loaded' && '광고 로드 완료'}
592
+ * {adLoadStatus === 'failed' && '광고 로드 실패'}
593
+ * </Text>
594
+ *
595
+ * <Button title="Show Ad" onPress={showAd} disabled={adLoadStatus !== 'loaded'} />
596
+ * </View>
500
597
  * );
501
598
  * }
502
599
  * ```
@@ -543,16 +640,20 @@ type LoadAdMobRewardedAdParams = AdMobHandlerParams<LoadAdMobRewardedAdOptions,
543
640
  * @property {() => boolean} [isSupported] 현재 실행 중인 앱(예: 토스 앱, 개발용 샌드박스 앱 등)에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요. 기능을 사용하기 전에 지원 여부를 확인해야 해요.
544
641
  *
545
642
  * @example
546
- * ### 뷰 진입 시 보상형 광고 불러오기
643
+ *
644
+ * ### 버튼 눌러 불러온 보상형 광고 보여주기
645
+ *
547
646
  * ```tsx
548
647
  * import { GoogleAdMob } from '@apps-in-toss/framework';
549
- * import { useEffect } from 'react';
550
- * import { View, Text } from 'react-native';
648
+ * import { useCallback, useState } from 'react';
649
+ * import { Button, Text, View } from 'react-native';
551
650
  *
552
- * const AD_UNIT_ID = '<YOUR_AD_UNIT_ID>';
651
+ * const AD_UNIT_ID = '<AD_UNIT_ID>';
553
652
  *
554
- * function Page() {
555
- * useEffect(() => {
653
+ * export function GoogleAdmobRewardedAdExample() {
654
+ * const [adLoadStatus, setAdLoadStatus] = useState<'not_loaded' | 'loaded' | 'failed'>('not_loaded');
655
+ *
656
+ * const loadAd = useCallback(() => {
556
657
  * if (GoogleAdMob.loadAdMobRewardedAd.isSupported() !== true) {
557
658
  * return;
558
659
  * }
@@ -562,9 +663,11 @@ type LoadAdMobRewardedAdParams = AdMobHandlerParams<LoadAdMobRewardedAdOptions,
562
663
  * adUnitId: AD_UNIT_ID,
563
664
  * },
564
665
  * onEvent: (event) => {
666
+ * console.log(event.type);
565
667
  * switch (event.type) {
566
668
  * case 'loaded':
567
669
  * console.log('광고 로드 성공', event.data);
670
+ * setAdLoadStatus('loaded');
568
671
  * break;
569
672
  *
570
673
  * case 'clicked':
@@ -600,9 +703,39 @@ type LoadAdMobRewardedAdParams = AdMobHandlerParams<LoadAdMobRewardedAdOptions,
600
703
  * return cleanup;
601
704
  * }, []);
602
705
  *
706
+ * const showAd = useCallback(() => {
707
+ * if (GoogleAdMob.showAdMobRewardedAd.isSupported() !== true) {
708
+ * return;
709
+ * }
710
+ *
711
+ * GoogleAdMob.showAdMobRewardedAd({
712
+ * options: {
713
+ * adUnitId: AD_UNIT_ID,
714
+ * },
715
+ * onEvent: (event) => {
716
+ * switch (event.type) {
717
+ * case 'requested':
718
+ * console.log('광고 보여주기 요청 완료');
719
+ * setAdLoadStatus('not_loaded');
720
+ * break;
721
+ * }
722
+ * },
723
+ * onError: (error) => {
724
+ * console.error('광고 보여주기 실패', error);
725
+ * },
726
+ * });
727
+ * }, []);
728
+ *
603
729
  * return (
604
730
  * <View>
605
- * <Text>Page</Text>
731
+ * <Text>
732
+ * {adLoadStatus === 'not_loaded' && '광고 로드 하지 않음 '}
733
+ * {adLoadStatus === 'loaded' && '광고 로드 완료'}
734
+ * {adLoadStatus === 'failed' && '광고 로드 실패'}
735
+ * </Text>
736
+ *
737
+ * <Button title="Load Ad" onPress={loadAd} />
738
+ * <Button title="Show Ad" onPress={showAd} disabled={adLoadStatus !== 'loaded'} />
606
739
  * </View>
607
740
  * );
608
741
  * }
@@ -648,14 +781,68 @@ type ShowAdMobRewardedAdParams = AdMobHandlerParams<ShowAdMobRewardedAdOptions,
648
781
  *
649
782
  * @example
650
783
  * ### 버튼 눌러 불러온 보상형 광고 보여주기
784
+ *
651
785
  * ```tsx
652
786
  * import { GoogleAdMob } from '@apps-in-toss/framework';
653
- * import { View, Text, Button } from 'react-native';
787
+ * import { useCallback, useState } from 'react';
788
+ * import { Button, Text, View } from 'react-native';
654
789
  *
655
- * const AD_UNIT_ID = '<YOUR_AD_UNIT_ID>';
790
+ * const AD_UNIT_ID = '<AD_UNIT_ID>';
656
791
  *
657
- * function Page() {
658
- * const handlePress = () => {
792
+ * export function GoogleAdmobRewardedAdExample() {
793
+ * const [adLoadStatus, setAdLoadStatus] = useState<'not_loaded' | 'loaded' | 'failed'>('not_loaded');
794
+ *
795
+ * const loadAd = useCallback(() => {
796
+ * if (GoogleAdMob.loadAdMobRewardedAd.isSupported() !== true) {
797
+ * return;
798
+ * }
799
+ *
800
+ * const cleanup = GoogleAdMob.loadAdMobRewardedAd({
801
+ * options: {
802
+ * adUnitId: AD_UNIT_ID,
803
+ * },
804
+ * onEvent: (event) => {
805
+ * console.log(event.type);
806
+ * switch (event.type) {
807
+ * case 'loaded':
808
+ * console.log('광고 로드 성공', event.data);
809
+ * setAdLoadStatus('loaded');
810
+ * break;
811
+ *
812
+ * case 'clicked':
813
+ * console.log('광고 클릭');
814
+ * break;
815
+ *
816
+ * case 'dismissed':
817
+ * console.log('광고 닫힘');
818
+ * break;
819
+ *
820
+ * case 'failedToShow':
821
+ * console.log('광고 보여주기 실패');
822
+ * break;
823
+ *
824
+ * case 'impression':
825
+ * console.log('광고 노출');
826
+ * break;
827
+ *
828
+ * case 'show':
829
+ * console.log('광고 컨텐츠 보여졌음');
830
+ * break;
831
+ *
832
+ * case 'userEarnedReward':
833
+ * console.log('사용자가 광고 시청을 완료했음');
834
+ * break;
835
+ * }
836
+ * },
837
+ * onError: (error) => {
838
+ * console.error('광고 불러오기 실패', error);
839
+ * },
840
+ * });
841
+ *
842
+ * return cleanup;
843
+ * }, []);
844
+ *
845
+ * const showAd = useCallback(() => {
659
846
  * if (GoogleAdMob.showAdMobRewardedAd.isSupported() !== true) {
660
847
  * return;
661
848
  * }
@@ -668,6 +855,7 @@ type ShowAdMobRewardedAdParams = AdMobHandlerParams<ShowAdMobRewardedAdOptions,
668
855
  * switch (event.type) {
669
856
  * case 'requested':
670
857
  * console.log('광고 보여주기 요청 완료');
858
+ * setAdLoadStatus('not_loaded');
671
859
  * break;
672
860
  * }
673
861
  * },
@@ -675,10 +863,19 @@ type ShowAdMobRewardedAdParams = AdMobHandlerParams<ShowAdMobRewardedAdOptions,
675
863
  * console.error('광고 보여주기 실패', error);
676
864
  * },
677
865
  * });
678
- * }
866
+ * }, []);
679
867
  *
680
868
  * return (
681
- * <Button onPress={handlePress} title="광고 보기" />
869
+ * <View>
870
+ * <Text>
871
+ * {adLoadStatus === 'not_loaded' && '광고 로드 하지 않음 '}
872
+ * {adLoadStatus === 'loaded' && '광고 로드 완료'}
873
+ * {adLoadStatus === 'failed' && '광고 로드 실패'}
874
+ * </Text>
875
+ *
876
+ * <Button title="Load Ad" onPress={loadAd} />
877
+ * <Button title="Show Ad" onPress={showAd} disabled={adLoadStatus !== 'loaded'} />
878
+ * </View>
682
879
  * );
683
880
  * }
684
881
  * ```
@@ -1455,6 +1652,70 @@ declare function eventLog(params: EventLogParams): Promise<void>;
1455
1652
  */
1456
1653
  declare function getTossShareLink(path: string): Promise<string>;
1457
1654
 
1655
+ /**
1656
+ * @public
1657
+ * @category 화면 제어
1658
+ * @kind function
1659
+ * @name setDeviceOrientation
1660
+ * @description
1661
+ * `setDeviceOrientation` 함수는 기기의 화면 방향을 설정하는 기능을 제공해요.
1662
+ * 이 기능은 특정 화면에서 가로 모드나 세로 모드를 강제로 지정해야 할 때 유용해요.
1663
+ *
1664
+ * `type` 옵션을 통해 원하는 화면 방향을 지정할 수 있어요. 특히, 이 함수는 앱 전체에 영향을 미치므로
1665
+ * 특정 화면에서만 사용하려면 화면을 벗어날 때 이전 상태로 복구하는 추가 작업이 필요해요.
1666
+ *
1667
+ * 예를 들어, 동영상 감상 화면에서는 가로 모드를 강제하고, 화면을 떠날 때 설정을 복구해서
1668
+ * 다른 화면들의 방향 설정에 영향을 주지 않도록 할 수 있어요.
1669
+ *
1670
+ * @param {object} options 화면 방향 설정 값이에요.
1671
+ * @param {string} options.type 화면 방향을 지정하는 옵션이에요.
1672
+ * 'portrait' | 'landscape' 중 하나를 선택할 수 있어요.
1673
+ *
1674
+ * @returns {Promise<void>} 화면 방향 설정이 완료되면 해결되는 Promise를 반환해요.
1675
+ *
1676
+ * @example
1677
+ * ### 화면 방향 설정하기
1678
+ *
1679
+ * ```tsx
1680
+ * import { Button } from 'react-native';
1681
+ * import { setDeviceOrientation } from '@apps-in-toss/framework';
1682
+ *
1683
+ * function SetDeviceOrientation() {
1684
+ * return (
1685
+ * <Button
1686
+ * title="가로 모드로 변경"
1687
+ * onPress={() => {
1688
+ * setDeviceOrientation({ type: 'landscape' });
1689
+ * }}
1690
+ * />
1691
+ * );
1692
+ * }
1693
+ * ```
1694
+ *
1695
+ * ### 화면 방향 복구하기
1696
+ * 특정 화면을 벗어날 때 이전 상태로 복구하려면 다음과 같이 `useEffect`를 사용하세요.
1697
+ *
1698
+ * ```tsx
1699
+ * import { useEffect } from 'react';
1700
+ * import { setDeviceOrientation } from '@apps-in-toss/framework';
1701
+ *
1702
+ * function VideoScreen() {
1703
+ * useEffect(() => {
1704
+ * setDeviceOrientation({ type: 'landscape' });
1705
+ *
1706
+ * return () => {
1707
+ * setDeviceOrientation({ type: 'portrait' }); // 설정을 이전 상태로 복구해요.
1708
+ * };
1709
+ * }, []);
1710
+ *
1711
+ * return <Text>동영상을 감상하는 화면</Text>;
1712
+ * }
1713
+ * ```
1714
+ */
1715
+ declare function setDeviceOrientation(options: {
1716
+ type: 'portrait' | 'landscape';
1717
+ }): Promise<void>;
1718
+
1458
1719
  /**
1459
1720
  * @public
1460
1721
  * @category 토스페이
@@ -1607,4 +1868,4 @@ declare const Analytics: {
1607
1868
  Area: ({ children, params: _params, ...props }: _apps_in_toss_analytics.LoggingAreaProps) => react_jsx_runtime.JSX.Element;
1608
1869
  };
1609
1870
 
1610
- export { Accuracy, Analytics, AppsInToss, type ContactEntity, type EventLogParams, type ExternalWebViewProps, type FetchAlbumPhotosOptions, type GameWebViewProps, type GetCurrentLocationOptions, GoogleAdMob, type ImageResponse, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type Location, type LocationCoords, type OpenCameraOptions, type PartnerWebViewProps, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, type StartUpdateLocationOptions$1 as StartUpdateLocationOptions, type StartUpdateLocationSubscription, Storage, TossPay, type UpdateLocationEventEmitter, type UseGeolocationOptions, WebView, type WebViewProps, appLogin, appsInTossEvent, env, eventLog, fetchAlbumPhotos, fetchContacts, getClipboardText, getCurrentLocation, getDeviceId, getOperationalEnvironment, getTossAppVersion, getTossShareLink, isMinVersionSupported, openCamera, setClipboardText, startUpdateLocation, useGeolocation };
1871
+ export { Accuracy, Analytics, AppsInToss, type ContactEntity, type EventLogParams, type ExternalWebViewProps, type FetchAlbumPhotosOptions, type GameWebViewProps, type GetCurrentLocationOptions, GoogleAdMob, type ImageResponse, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type Location, type LocationCoords, type OpenCameraOptions, type PartnerWebViewProps, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, type StartUpdateLocationOptions$1 as StartUpdateLocationOptions, type StartUpdateLocationSubscription, Storage, TossPay, type UpdateLocationEventEmitter, type UseGeolocationOptions, WebView, type WebViewProps, appLogin, appsInTossEvent, env, eventLog, fetchAlbumPhotos, fetchContacts, getClipboardText, getCurrentLocation, getDeviceId, getOperationalEnvironment, getTossAppVersion, getTossShareLink, isMinVersionSupported, openCamera, setClipboardText, setDeviceOrientation, startUpdateLocation, useGeolocation };
package/dist/index.d.ts CHANGED
@@ -149,10 +149,8 @@ interface StartUpdateLocationSubscription extends EmitterSubscription {
149
149
  * @kind typedef
150
150
  * @description
151
151
  * 디바이스의 위치 정보 변경을 감지해요
152
- * @extends {EventEmitterSchema<'updateLocation', [Location]>}
153
152
  */
154
- interface UpdateLocationEventEmitter extends EventEmitterSchema<'updateLocation', [Location]> {
155
- }
153
+ type UpdateLocationEventEmitter = EventEmitterSchema<'updateLocation', [Location]>;
156
154
  /**
157
155
  * @public
158
156
  * @category 위치 정보
@@ -365,20 +363,25 @@ type LoadAdMobInterstitialAdParams = AdMobHandlerParams<LoadAdMobInterstitialAdO
365
363
  * @property {() => boolean} [isSupported] 현재 실행 중인 앱(예: 토스 앱, 개발용 샌드박스 앱 등)에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요. 기능을 사용하기 전에 지원 여부를 확인해야 해요.
366
364
  *
367
365
  * @example
368
- * ### 진입 전면광고 불러오기
366
+ * ### 버튼 눌러 불러온 전면 광고 보여주기
369
367
  * ```tsx
370
368
  * import { GoogleAdMob } from '@apps-in-toss/framework';
371
- * import { useEffect } from 'react';
372
- * import { View, Text } from 'react-native';
369
+ * import { useFocusEffect } from '@react-native-bedrock/native/@react-navigation/native';
370
+ * import { useCallback, useState } from 'react';
371
+ * import { Button, Text, View } from 'react-native';
372
+ * import { useNavigation } from 'react-native-bedrock';
373
373
  *
374
- * const AD_UNIT_ID = '<YOUR_AD_UNIT_ID>';
374
+ * const AD_UNIT_ID = '<AD_UNIT_ID>';
375
375
  *
376
- * function Page() {
377
- * useEffect(() => {
376
+ * export function GoogleAdmobInterstitialAdExample() {
377
+ * const [adLoadStatus, setAdLoadStatus] = useState<'not_loaded' | 'loaded' | 'failed'>('not_loaded');
378
+ * const navigation = useNavigation();
379
+ *
380
+ * const loadAd = useCallback(() => {
378
381
  * if (GoogleAdMob.loadAdMobInterstitialAd.isSupported() !== true) {
379
382
  * return;
380
383
  * }
381
- *
384
+
382
385
  * const cleanup = GoogleAdMob.loadAdMobInterstitialAd({
383
386
  * options: {
384
387
  * adUnitId: AD_UNIT_ID,
@@ -387,6 +390,7 @@ type LoadAdMobInterstitialAdParams = AdMobHandlerParams<LoadAdMobInterstitialAdO
387
390
  * switch (event.type) {
388
391
  * case 'loaded':
389
392
  * console.log('광고 로드 성공', event.data);
393
+ * setAdLoadStatus('loaded');
390
394
  * break;
391
395
  *
392
396
  * case 'clicked':
@@ -395,6 +399,7 @@ type LoadAdMobInterstitialAdParams = AdMobHandlerParams<LoadAdMobInterstitialAdO
395
399
  *
396
400
  * case 'dismissed':
397
401
  * console.log('광고 닫힘');
402
+ * navigation.navigate('/examples/google-admob-interstitial-ad-landing');
398
403
  * break;
399
404
  *
400
405
  * case 'failedToShow':
@@ -416,11 +421,41 @@ type LoadAdMobInterstitialAdParams = AdMobHandlerParams<LoadAdMobInterstitialAdO
416
421
  * });
417
422
  *
418
423
  * return cleanup;
424
+ * }, [navigation]);
425
+ *
426
+ * const showAd = useCallback(() => {
427
+ * if (GoogleAdMob.showAdMobInterstitialAd.isSupported() !== true) {
428
+ * return;
429
+ * }
430
+ *
431
+ * GoogleAdMob.showAdMobInterstitialAd({
432
+ * options: {
433
+ * adUnitId: AD_UNIT_ID,
434
+ * },
435
+ * onEvent: (event) => {
436
+ * switch (event.type) {
437
+ * case 'requested':
438
+ * console.log('광고 보여주기 요청 완료');
439
+ * break;
440
+ * }
441
+ * },
442
+ * onError: (error) => {
443
+ * console.error('광고 보여주기 실패', error);
444
+ * },
445
+ * });
419
446
  * }, []);
420
447
  *
448
+ * useFocusEffect(loadAd);
449
+ *
421
450
  * return (
422
451
  * <View>
423
- * <Text>Page</Text>
452
+ * <Text>
453
+ * {adLoadStatus === 'not_loaded' && '광고 로드 하지 않음 '}
454
+ * {adLoadStatus === 'loaded' && '광고 로드 완료'}
455
+ * {adLoadStatus === 'failed' && '광고 로드 실패'}
456
+ * </Text>
457
+ *
458
+ * <Button title="Show Ad" onPress={showAd} disabled={adLoadStatus !== 'loaded'} />
424
459
  * </View>
425
460
  * );
426
461
  * }
@@ -468,12 +503,64 @@ type ShowAdMobInterstitialAdParams = AdMobHandlerParams<ShowAdMobInterstitialAdO
468
503
  * ### 버튼 눌러 불러온 전면 광고 보여주기
469
504
  * ```tsx
470
505
  * import { GoogleAdMob } from '@apps-in-toss/framework';
471
- * import { View, Button } from 'react-native';
506
+ * import { useFocusEffect } from '@react-native-bedrock/native/@react-navigation/native';
507
+ * import { useCallback, useState } from 'react';
508
+ * import { Button, Text, View } from 'react-native';
509
+ * import { useNavigation } from 'react-native-bedrock';
472
510
  *
473
- * const AD_UNIT_ID = '<YOUR_AD_UNIT_ID>';
511
+ * const AD_UNIT_ID = '<AD_UNIT_ID>';
474
512
  *
475
- * function Page() {
476
- * const handlePress = () => {
513
+ * export function GoogleAdmobInterstitialAdExample() {
514
+ * const [adLoadStatus, setAdLoadStatus] = useState<'not_loaded' | 'loaded' | 'failed'>('not_loaded');
515
+ * const navigation = useNavigation();
516
+ *
517
+ * const loadAd = useCallback(() => {
518
+ * if (GoogleAdMob.loadAdMobInterstitialAd.isSupported() !== true) {
519
+ * return;
520
+ * }
521
+
522
+ * const cleanup = GoogleAdMob.loadAdMobInterstitialAd({
523
+ * options: {
524
+ * adUnitId: AD_UNIT_ID,
525
+ * },
526
+ * onEvent: (event) => {
527
+ * switch (event.type) {
528
+ * case 'loaded':
529
+ * console.log('광고 로드 성공', event.data);
530
+ * setAdLoadStatus('loaded');
531
+ * break;
532
+ *
533
+ * case 'clicked':
534
+ * console.log('광고 클릭');
535
+ * break;
536
+ *
537
+ * case 'dismissed':
538
+ * console.log('광고 닫힘');
539
+ * navigation.navigate('/examples/google-admob-interstitial-ad-landing');
540
+ * break;
541
+ *
542
+ * case 'failedToShow':
543
+ * console.log('광고 보여주기 실패');
544
+ * break;
545
+ *
546
+ * case 'impression':
547
+ * console.log('광고 노출');
548
+ * break;
549
+ *
550
+ * case 'show':
551
+ * console.log('광고 컨텐츠 보여졌음');
552
+ * break;
553
+ * }
554
+ * },
555
+ * onError: (error) => {
556
+ * console.error('광고 불러오기 실패', error);
557
+ * },
558
+ * });
559
+ *
560
+ * return cleanup;
561
+ * }, [navigation]);
562
+ *
563
+ * const showAd = useCallback(() => {
477
564
  * if (GoogleAdMob.showAdMobInterstitialAd.isSupported() !== true) {
478
565
  * return;
479
566
  * }
@@ -493,10 +580,20 @@ type ShowAdMobInterstitialAdParams = AdMobHandlerParams<ShowAdMobInterstitialAdO
493
580
  * console.error('광고 보여주기 실패', error);
494
581
  * },
495
582
  * });
496
- * }
583
+ * }, []);
584
+ *
585
+ * useFocusEffect(loadAd);
497
586
  *
498
587
  * return (
499
- * <Button onPress={handlePress} title="광고 보기" />
588
+ * <View>
589
+ * <Text>
590
+ * {adLoadStatus === 'not_loaded' && '광고 로드 하지 않음 '}
591
+ * {adLoadStatus === 'loaded' && '광고 로드 완료'}
592
+ * {adLoadStatus === 'failed' && '광고 로드 실패'}
593
+ * </Text>
594
+ *
595
+ * <Button title="Show Ad" onPress={showAd} disabled={adLoadStatus !== 'loaded'} />
596
+ * </View>
500
597
  * );
501
598
  * }
502
599
  * ```
@@ -543,16 +640,20 @@ type LoadAdMobRewardedAdParams = AdMobHandlerParams<LoadAdMobRewardedAdOptions,
543
640
  * @property {() => boolean} [isSupported] 현재 실행 중인 앱(예: 토스 앱, 개발용 샌드박스 앱 등)에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요. 기능을 사용하기 전에 지원 여부를 확인해야 해요.
544
641
  *
545
642
  * @example
546
- * ### 뷰 진입 시 보상형 광고 불러오기
643
+ *
644
+ * ### 버튼 눌러 불러온 보상형 광고 보여주기
645
+ *
547
646
  * ```tsx
548
647
  * import { GoogleAdMob } from '@apps-in-toss/framework';
549
- * import { useEffect } from 'react';
550
- * import { View, Text } from 'react-native';
648
+ * import { useCallback, useState } from 'react';
649
+ * import { Button, Text, View } from 'react-native';
551
650
  *
552
- * const AD_UNIT_ID = '<YOUR_AD_UNIT_ID>';
651
+ * const AD_UNIT_ID = '<AD_UNIT_ID>';
553
652
  *
554
- * function Page() {
555
- * useEffect(() => {
653
+ * export function GoogleAdmobRewardedAdExample() {
654
+ * const [adLoadStatus, setAdLoadStatus] = useState<'not_loaded' | 'loaded' | 'failed'>('not_loaded');
655
+ *
656
+ * const loadAd = useCallback(() => {
556
657
  * if (GoogleAdMob.loadAdMobRewardedAd.isSupported() !== true) {
557
658
  * return;
558
659
  * }
@@ -562,9 +663,11 @@ type LoadAdMobRewardedAdParams = AdMobHandlerParams<LoadAdMobRewardedAdOptions,
562
663
  * adUnitId: AD_UNIT_ID,
563
664
  * },
564
665
  * onEvent: (event) => {
666
+ * console.log(event.type);
565
667
  * switch (event.type) {
566
668
  * case 'loaded':
567
669
  * console.log('광고 로드 성공', event.data);
670
+ * setAdLoadStatus('loaded');
568
671
  * break;
569
672
  *
570
673
  * case 'clicked':
@@ -600,9 +703,39 @@ type LoadAdMobRewardedAdParams = AdMobHandlerParams<LoadAdMobRewardedAdOptions,
600
703
  * return cleanup;
601
704
  * }, []);
602
705
  *
706
+ * const showAd = useCallback(() => {
707
+ * if (GoogleAdMob.showAdMobRewardedAd.isSupported() !== true) {
708
+ * return;
709
+ * }
710
+ *
711
+ * GoogleAdMob.showAdMobRewardedAd({
712
+ * options: {
713
+ * adUnitId: AD_UNIT_ID,
714
+ * },
715
+ * onEvent: (event) => {
716
+ * switch (event.type) {
717
+ * case 'requested':
718
+ * console.log('광고 보여주기 요청 완료');
719
+ * setAdLoadStatus('not_loaded');
720
+ * break;
721
+ * }
722
+ * },
723
+ * onError: (error) => {
724
+ * console.error('광고 보여주기 실패', error);
725
+ * },
726
+ * });
727
+ * }, []);
728
+ *
603
729
  * return (
604
730
  * <View>
605
- * <Text>Page</Text>
731
+ * <Text>
732
+ * {adLoadStatus === 'not_loaded' && '광고 로드 하지 않음 '}
733
+ * {adLoadStatus === 'loaded' && '광고 로드 완료'}
734
+ * {adLoadStatus === 'failed' && '광고 로드 실패'}
735
+ * </Text>
736
+ *
737
+ * <Button title="Load Ad" onPress={loadAd} />
738
+ * <Button title="Show Ad" onPress={showAd} disabled={adLoadStatus !== 'loaded'} />
606
739
  * </View>
607
740
  * );
608
741
  * }
@@ -648,14 +781,68 @@ type ShowAdMobRewardedAdParams = AdMobHandlerParams<ShowAdMobRewardedAdOptions,
648
781
  *
649
782
  * @example
650
783
  * ### 버튼 눌러 불러온 보상형 광고 보여주기
784
+ *
651
785
  * ```tsx
652
786
  * import { GoogleAdMob } from '@apps-in-toss/framework';
653
- * import { View, Text, Button } from 'react-native';
787
+ * import { useCallback, useState } from 'react';
788
+ * import { Button, Text, View } from 'react-native';
654
789
  *
655
- * const AD_UNIT_ID = '<YOUR_AD_UNIT_ID>';
790
+ * const AD_UNIT_ID = '<AD_UNIT_ID>';
656
791
  *
657
- * function Page() {
658
- * const handlePress = () => {
792
+ * export function GoogleAdmobRewardedAdExample() {
793
+ * const [adLoadStatus, setAdLoadStatus] = useState<'not_loaded' | 'loaded' | 'failed'>('not_loaded');
794
+ *
795
+ * const loadAd = useCallback(() => {
796
+ * if (GoogleAdMob.loadAdMobRewardedAd.isSupported() !== true) {
797
+ * return;
798
+ * }
799
+ *
800
+ * const cleanup = GoogleAdMob.loadAdMobRewardedAd({
801
+ * options: {
802
+ * adUnitId: AD_UNIT_ID,
803
+ * },
804
+ * onEvent: (event) => {
805
+ * console.log(event.type);
806
+ * switch (event.type) {
807
+ * case 'loaded':
808
+ * console.log('광고 로드 성공', event.data);
809
+ * setAdLoadStatus('loaded');
810
+ * break;
811
+ *
812
+ * case 'clicked':
813
+ * console.log('광고 클릭');
814
+ * break;
815
+ *
816
+ * case 'dismissed':
817
+ * console.log('광고 닫힘');
818
+ * break;
819
+ *
820
+ * case 'failedToShow':
821
+ * console.log('광고 보여주기 실패');
822
+ * break;
823
+ *
824
+ * case 'impression':
825
+ * console.log('광고 노출');
826
+ * break;
827
+ *
828
+ * case 'show':
829
+ * console.log('광고 컨텐츠 보여졌음');
830
+ * break;
831
+ *
832
+ * case 'userEarnedReward':
833
+ * console.log('사용자가 광고 시청을 완료했음');
834
+ * break;
835
+ * }
836
+ * },
837
+ * onError: (error) => {
838
+ * console.error('광고 불러오기 실패', error);
839
+ * },
840
+ * });
841
+ *
842
+ * return cleanup;
843
+ * }, []);
844
+ *
845
+ * const showAd = useCallback(() => {
659
846
  * if (GoogleAdMob.showAdMobRewardedAd.isSupported() !== true) {
660
847
  * return;
661
848
  * }
@@ -668,6 +855,7 @@ type ShowAdMobRewardedAdParams = AdMobHandlerParams<ShowAdMobRewardedAdOptions,
668
855
  * switch (event.type) {
669
856
  * case 'requested':
670
857
  * console.log('광고 보여주기 요청 완료');
858
+ * setAdLoadStatus('not_loaded');
671
859
  * break;
672
860
  * }
673
861
  * },
@@ -675,10 +863,19 @@ type ShowAdMobRewardedAdParams = AdMobHandlerParams<ShowAdMobRewardedAdOptions,
675
863
  * console.error('광고 보여주기 실패', error);
676
864
  * },
677
865
  * });
678
- * }
866
+ * }, []);
679
867
  *
680
868
  * return (
681
- * <Button onPress={handlePress} title="광고 보기" />
869
+ * <View>
870
+ * <Text>
871
+ * {adLoadStatus === 'not_loaded' && '광고 로드 하지 않음 '}
872
+ * {adLoadStatus === 'loaded' && '광고 로드 완료'}
873
+ * {adLoadStatus === 'failed' && '광고 로드 실패'}
874
+ * </Text>
875
+ *
876
+ * <Button title="Load Ad" onPress={loadAd} />
877
+ * <Button title="Show Ad" onPress={showAd} disabled={adLoadStatus !== 'loaded'} />
878
+ * </View>
682
879
  * );
683
880
  * }
684
881
  * ```
@@ -1455,6 +1652,70 @@ declare function eventLog(params: EventLogParams): Promise<void>;
1455
1652
  */
1456
1653
  declare function getTossShareLink(path: string): Promise<string>;
1457
1654
 
1655
+ /**
1656
+ * @public
1657
+ * @category 화면 제어
1658
+ * @kind function
1659
+ * @name setDeviceOrientation
1660
+ * @description
1661
+ * `setDeviceOrientation` 함수는 기기의 화면 방향을 설정하는 기능을 제공해요.
1662
+ * 이 기능은 특정 화면에서 가로 모드나 세로 모드를 강제로 지정해야 할 때 유용해요.
1663
+ *
1664
+ * `type` 옵션을 통해 원하는 화면 방향을 지정할 수 있어요. 특히, 이 함수는 앱 전체에 영향을 미치므로
1665
+ * 특정 화면에서만 사용하려면 화면을 벗어날 때 이전 상태로 복구하는 추가 작업이 필요해요.
1666
+ *
1667
+ * 예를 들어, 동영상 감상 화면에서는 가로 모드를 강제하고, 화면을 떠날 때 설정을 복구해서
1668
+ * 다른 화면들의 방향 설정에 영향을 주지 않도록 할 수 있어요.
1669
+ *
1670
+ * @param {object} options 화면 방향 설정 값이에요.
1671
+ * @param {string} options.type 화면 방향을 지정하는 옵션이에요.
1672
+ * 'portrait' | 'landscape' 중 하나를 선택할 수 있어요.
1673
+ *
1674
+ * @returns {Promise<void>} 화면 방향 설정이 완료되면 해결되는 Promise를 반환해요.
1675
+ *
1676
+ * @example
1677
+ * ### 화면 방향 설정하기
1678
+ *
1679
+ * ```tsx
1680
+ * import { Button } from 'react-native';
1681
+ * import { setDeviceOrientation } from '@apps-in-toss/framework';
1682
+ *
1683
+ * function SetDeviceOrientation() {
1684
+ * return (
1685
+ * <Button
1686
+ * title="가로 모드로 변경"
1687
+ * onPress={() => {
1688
+ * setDeviceOrientation({ type: 'landscape' });
1689
+ * }}
1690
+ * />
1691
+ * );
1692
+ * }
1693
+ * ```
1694
+ *
1695
+ * ### 화면 방향 복구하기
1696
+ * 특정 화면을 벗어날 때 이전 상태로 복구하려면 다음과 같이 `useEffect`를 사용하세요.
1697
+ *
1698
+ * ```tsx
1699
+ * import { useEffect } from 'react';
1700
+ * import { setDeviceOrientation } from '@apps-in-toss/framework';
1701
+ *
1702
+ * function VideoScreen() {
1703
+ * useEffect(() => {
1704
+ * setDeviceOrientation({ type: 'landscape' });
1705
+ *
1706
+ * return () => {
1707
+ * setDeviceOrientation({ type: 'portrait' }); // 설정을 이전 상태로 복구해요.
1708
+ * };
1709
+ * }, []);
1710
+ *
1711
+ * return <Text>동영상을 감상하는 화면</Text>;
1712
+ * }
1713
+ * ```
1714
+ */
1715
+ declare function setDeviceOrientation(options: {
1716
+ type: 'portrait' | 'landscape';
1717
+ }): Promise<void>;
1718
+
1458
1719
  /**
1459
1720
  * @public
1460
1721
  * @category 토스페이
@@ -1607,4 +1868,4 @@ declare const Analytics: {
1607
1868
  Area: ({ children, params: _params, ...props }: _apps_in_toss_analytics.LoggingAreaProps) => react_jsx_runtime.JSX.Element;
1608
1869
  };
1609
1870
 
1610
- export { Accuracy, Analytics, AppsInToss, type ContactEntity, type EventLogParams, type ExternalWebViewProps, type FetchAlbumPhotosOptions, type GameWebViewProps, type GetCurrentLocationOptions, GoogleAdMob, type ImageResponse, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type Location, type LocationCoords, type OpenCameraOptions, type PartnerWebViewProps, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, type StartUpdateLocationOptions$1 as StartUpdateLocationOptions, type StartUpdateLocationSubscription, Storage, TossPay, type UpdateLocationEventEmitter, type UseGeolocationOptions, WebView, type WebViewProps, appLogin, appsInTossEvent, env, eventLog, fetchAlbumPhotos, fetchContacts, getClipboardText, getCurrentLocation, getDeviceId, getOperationalEnvironment, getTossAppVersion, getTossShareLink, isMinVersionSupported, openCamera, setClipboardText, startUpdateLocation, useGeolocation };
1871
+ export { Accuracy, Analytics, AppsInToss, type ContactEntity, type EventLogParams, type ExternalWebViewProps, type FetchAlbumPhotosOptions, type GameWebViewProps, type GetCurrentLocationOptions, GoogleAdMob, type ImageResponse, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type Location, type LocationCoords, type OpenCameraOptions, type PartnerWebViewProps, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, type StartUpdateLocationOptions$1 as StartUpdateLocationOptions, type StartUpdateLocationSubscription, Storage, TossPay, type UpdateLocationEventEmitter, type UseGeolocationOptions, WebView, type WebViewProps, appLogin, appsInTossEvent, env, eventLog, fetchAlbumPhotos, fetchContacts, getClipboardText, getCurrentLocation, getDeviceId, getOperationalEnvironment, getTossAppVersion, getTossShareLink, isMinVersionSupported, openCamera, setClipboardText, setDeviceOrientation, startUpdateLocation, useGeolocation };
package/dist/index.js CHANGED
@@ -259,7 +259,9 @@ var UpdateLocationEvent = class extends BedrockEventDefinition2 {
259
259
  }
260
260
  };
261
261
  remove() {
262
- --this.subscriptionCount === 0 && AppsInTossModuleInstance.stopUpdateLocation({});
262
+ if (--this.subscriptionCount === 0) {
263
+ AppsInTossModuleInstance.stopUpdateLocation({});
264
+ }
263
265
  this.ref.remove();
264
266
  }
265
267
  listener(options, onEvent, onError) {
@@ -417,7 +419,8 @@ __export(async_bridges_exports, {
417
419
  getCurrentLocation: () => getCurrentLocation,
418
420
  getTossShareLink: () => getTossShareLink,
419
421
  openCamera: () => openCamera,
420
- setClipboardText: () => setClipboardText
422
+ setClipboardText: () => setClipboardText,
423
+ setDeviceOrientation: () => setDeviceOrientation
421
424
  });
422
425
 
423
426
  // src/native-modules/setClipboardText.ts
@@ -544,6 +547,18 @@ async function getTossShareLink(path) {
544
547
  return shareUrl.toString();
545
548
  }
546
549
 
550
+ // src/native-modules/setDeviceOrientation.ts
551
+ async function setDeviceOrientation(options) {
552
+ const isSupported = isMinVersionSupported({
553
+ android: "5.215.0",
554
+ ios: "5.215.0"
555
+ });
556
+ if (!isSupported) {
557
+ return;
558
+ }
559
+ return AppsInTossModule.setDeviceOrientation(options);
560
+ }
561
+
547
562
  // src/core/registerApp.tsx
548
563
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
549
564
  function AppsInTossContainer(Container, { children, ...initialProps }) {
@@ -1146,8 +1161,6 @@ function WebView({ type, local, onMessage, ...props }) {
1146
1161
  loadAdMobRewardedAd: GoogleAdMob.loadAdMobRewardedAd,
1147
1162
  showAdMobRewardedAd: GoogleAdMob.showAdMobRewardedAd
1148
1163
  },
1149
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1150
- // @ts-expect-error
1151
1164
  constantHandlerMap: {
1152
1165
  ...bedrockConstantBridges,
1153
1166
  ...constant_bridges_exports,
@@ -1161,8 +1174,6 @@ function WebView({ type, local, onMessage, ...props }) {
1161
1174
  /** env */
1162
1175
  getDeploymentId: env.getDeploymentId
1163
1176
  },
1164
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1165
- // @ts-expect-error
1166
1177
  asyncHandlerMap: {
1167
1178
  ...bedrockAsyncBridges,
1168
1179
  ...async_bridges_exports,
@@ -1300,6 +1311,7 @@ export {
1300
1311
  isMinVersionSupported,
1301
1312
  openCamera,
1302
1313
  setClipboardText,
1314
+ setDeviceOrientation,
1303
1315
  startUpdateLocation,
1304
1316
  useGeolocation
1305
1317
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apps-in-toss/framework",
3
3
  "type": "module",
4
- "version": "0.0.25",
4
+ "version": "0.0.27",
5
5
  "description": "The framework for Apps In Toss",
6
6
  "scripts": {
7
7
  "prepack": "yarn build",
@@ -57,30 +57,30 @@
57
57
  "ait": "./bin/ait.js"
58
58
  },
59
59
  "dependencies": {
60
- "@apps-in-toss/analytics": "0.0.25",
61
- "@apps-in-toss/cli": "0.0.25",
62
- "@apps-in-toss/plugins": "0.0.25",
60
+ "@apps-in-toss/analytics": "0.0.27",
61
+ "@apps-in-toss/cli": "0.0.27",
62
+ "@apps-in-toss/plugins": "0.0.27",
63
63
  "es-hangul": "^2.3.2"
64
64
  },
65
65
  "devDependencies": {
66
- "@react-native-bedrock/mpack-next": "0.0.23",
67
- "@react-native-bedrock/native": "0.0.23",
66
+ "@react-native-bedrock/mpack-next": "0.0.27",
67
+ "@react-native-bedrock/native": "workspace:*",
68
+ "@react-native-bedrock/plugin-core": "0.0.27",
69
+ "@react-native-bedrock/utils": "0.0.27",
68
70
  "@toss-design-system/react-native": "^0.5.0",
69
71
  "@types/kill-port": "^2.0.1",
70
72
  "@types/react": "18.3.3",
71
- "@types/yauzl": "^2.10.3",
72
73
  "es-toolkit": "^1.34.1",
73
74
  "eslint": "^9.7.0",
74
75
  "execa": "^9.5.2",
75
76
  "kill-port": "^2.0.1",
76
77
  "react": "18.2.0",
77
78
  "react-native": "0.72.6",
78
- "react-native-bedrock": "0.0.23",
79
+ "react-native-bedrock": "0.0.27",
79
80
  "tsup": "^8.3.5",
80
- "typescript": "4.9.5",
81
+ "typescript": "5.8.3",
81
82
  "vitest": "^3.0.3",
82
- "workspace-tools": "^0.38.2",
83
- "yauzl": "^3.2.0"
83
+ "workspace-tools": "^0.38.2"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "@react-native-bedrock/native": ">= 0.0.18",
@@ -93,5 +93,5 @@
93
93
  "publishConfig": {
94
94
  "access": "public"
95
95
  },
96
- "gitHead": "b2fea7f0eabf9afa89bd018d76cc7e4907790fcf"
96
+ "gitHead": "a6434fe8de65a2b20fb395b7e1b2b700edc112d3"
97
97
  }
@@ -1,10 +1,11 @@
1
- export * from './native-modules/setClipboardText.js';
2
- export * from './native-modules/getClipboardText.js';
3
- export * from './native-modules/fetchContacts.js';
4
- export * from './native-modules/fetchAlbumPhotos.js';
5
- export * from './native-modules/getCurrentLocation.js';
6
- export * from './native-modules/openCamera.js';
7
- export * from './native-modules/appLogin.js';
8
- export * from './native-modules/checkoutPayment.js';
9
- export * from './native-modules/eventLog.js';
10
- export * from './native-modules/getTossShareLink.js';
1
+ export * from './native-modules/setClipboardText';
2
+ export * from './native-modules/getClipboardText';
3
+ export * from './native-modules/fetchContacts';
4
+ export * from './native-modules/fetchAlbumPhotos';
5
+ export * from './native-modules/getCurrentLocation';
6
+ export * from './native-modules/openCamera';
7
+ export * from './native-modules/appLogin';
8
+ export * from './native-modules/checkoutPayment';
9
+ export * from './native-modules/eventLog';
10
+ export * from './native-modules/getTossShareLink';
11
+ export * from './native-modules/setDeviceOrientation';
@@ -1,3 +1,3 @@
1
- export * from './native-modules/getOperationalEnvironment.js';
2
- export * from './native-modules/getTossAppVersion.js';
3
- export * from './native-modules/getDeviceId.js';
1
+ export * from './native-modules/getOperationalEnvironment';
2
+ export * from './native-modules/getTossAppVersion';
3
+ export * from './native-modules/getDeviceId';
@@ -1 +1 @@
1
- export * from './native-event-emitter/startUpdateLocation.js';
1
+ export * from './native-event-emitter/startUpdateLocation';