@apps-in-toss/web-bridge 0.0.32 → 0.0.33

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/build/index.d.ts CHANGED
@@ -154,7 +154,7 @@ declare const IAP: {
154
154
  */
155
155
  createOneTimePurchaseOrder: (args_0: {
156
156
  productId: string;
157
- }, args_1: IapCreateOneTimePurchaseOrderResult) => Promise<any>;
157
+ }) => Promise<IapCreateOneTimePurchaseOrderResult>;
158
158
  /**
159
159
  * @public
160
160
  * @category 인앱결제
@@ -539,4 +539,119 @@ interface AppsInTossGlobals {
539
539
  }
540
540
  declare const getAppsInTossGlobals: () => AppsInTossGlobals;
541
541
 
542
- export { type AppsInTossEvent, type AppsInTossGlobals, type BedrockEvent, GoogleAdMob, IAP, type IapCreateOneTimePurchaseOrderResult, type IapProductListItem, Storage, appsInTossEvent, bedrockEvent, env, getAppsInTossGlobals, getSafeAreaInsets, isMinVersionSupported };
542
+ type TdsEvent = {
543
+ navigationAccessoryEvent: {
544
+ onEvent: (data: {
545
+ id: string;
546
+ }) => void;
547
+ onError?: (error: Error) => void;
548
+ options: undefined;
549
+ };
550
+ };
551
+ /**
552
+ * @public
553
+ * @category TDS
554
+ * @name tdsEvent
555
+ * @description 토스 이벤트를 사용해요.
556
+ * @property {typeof addEventListener} [addEventListener] 이벤트를 추가해요.
557
+ */
558
+ declare const tdsEvent: {
559
+ /**
560
+ * @public
561
+ * @category TDS
562
+ * @name addEventListener
563
+ * @description 이벤트를 추가해요.
564
+ * @param {string} event 이벤트 이름예요.
565
+ * @param {TdsEvent[K]['onEvent']} onEvent 이벤트 핸들러예요.
566
+ * @param {TdsEvent[K]['onError']} onError 이벤트 에러 핸들러예요.
567
+ * @param {TdsEvent[K]['options']} options 이벤트 옵션예요.
568
+ * @returns {void} 이벤트를 추가했을 때 아무 값도 반환하지 않아요.
569
+ * @example
570
+ * ### 네비게이션 악세서리 이벤트 추가하기
571
+ * ```tsx
572
+ * import { tdsEvent } from '@apps-in-toss/framework';
573
+ *
574
+ * tdsEvent.addEventListener('navigationAccessoryEvent', {
575
+ * onEvent: ({ id }) => {
576
+ * if(id === 'heart') {
577
+ * router.push('/heart');
578
+ * }
579
+ * },
580
+ * });
581
+ * ```
582
+ */
583
+ addEventListener: <K extends keyof TdsEvent>(event: K, { onEvent, onError, options, }: {
584
+ onEvent: TdsEvent[K]["onEvent"];
585
+ onError?: TdsEvent[K]["onError"];
586
+ options?: TdsEvent[K]["options"];
587
+ }) => () => void;
588
+ };
589
+
590
+ type AddAccessoryButtonOptions = {
591
+ id: string;
592
+ type: 'icon';
593
+ name: string;
594
+ alt: string;
595
+ } | {
596
+ type: 'icon-double';
597
+ color?: string;
598
+ leftIconName: string;
599
+ leftIconAlt: string;
600
+ rightIconName: string;
601
+ rightIconAlt: string;
602
+ id: [string, string];
603
+ };
604
+ /**
605
+ * @public
606
+ * @category 파트너
607
+ * @name partner
608
+ * @description 파트너 기능을 사용해요.
609
+ * @property {typeof addAccessoryButton} [addAccessoryButton] 상단 네비게이션의 악세서리 버튼을 추가해요.
610
+ */
611
+ declare const partner: {
612
+ /**
613
+ * @public
614
+ * @category 파트너
615
+ * @name addAccessoryButton
616
+ * @description 상단 네비게이션의 악세서리 버튼을 추가해요. callback에 대한 정의는 `tdsEvent.addEventListener("navigationAccessoryEvent", callback)`를 참고해주세요.
617
+ * @param {AddAccessoryButtonOptions} options - 악세서리 버튼의 고유 ID예요.
618
+ * @returns {void} 악세서리 버튼을 추가했을 때 아무 값도 반환하지 않아요.
619
+ * @example
620
+ * ```tsx
621
+ * import { partner } from '@apps-in-toss/framework';
622
+ *
623
+ * partner.addAccessoryButton({
624
+ * id: 'heart',
625
+ * type: 'icon',
626
+ * name: 'icon-heart-mono',
627
+ * alt: '하트',
628
+ * });
629
+ *
630
+ * partner.addAccessoryButton({
631
+ * id: ['heart', 'heart2'],
632
+ * type: 'icon-double',
633
+ * leftIconName: 'icon-heart-mono',
634
+ * leftIconAlt: '하트',
635
+ * rightIconName: 'icon-heart-mono',
636
+ * rightIconAlt: '하트',
637
+ * });
638
+ * ```
639
+ */
640
+ addAccessoryButton: (args_0: AddAccessoryButtonOptions) => Promise<void>;
641
+ /**
642
+ * @public
643
+ * @category 파트너
644
+ * @name removeAccessoryButton
645
+ * @description 상단 네비게이션의 악세서리 버튼을 제거해요.
646
+ * @returns {void} 악세서리 버튼을 제거했을 때 아무 값도 반환하지 않아요.
647
+ * @example
648
+ * ```tsx
649
+ * import { partner } from '@apps-in-toss/framework';
650
+ *
651
+ * partner.removeAccessoryButton();
652
+ * ```
653
+ */
654
+ removeAccessoryButton: () => Promise<void>;
655
+ };
656
+
657
+ export { type AddAccessoryButtonOptions, type AppsInTossEvent, type AppsInTossGlobals, type BedrockEvent, GoogleAdMob, IAP, type IapCreateOneTimePurchaseOrderResult, type IapProductListItem, Storage, type TdsEvent, appsInTossEvent, bedrockEvent, env, getAppsInTossGlobals, getSafeAreaInsets, isMinVersionSupported, partner, tdsEvent };
package/build/index.js CHANGED
@@ -121,7 +121,7 @@ function getSafeAreaInsets() {
121
121
  }
122
122
 
123
123
  // src/googleAdMob.ts
124
- import { createEventBridge, createConstantBridge as createConstantBridge2 } from "@apps-in-toss/bridge-core";
124
+ import { createConstantBridge as createConstantBridge2, createEventBridge } from "@apps-in-toss/bridge-core";
125
125
  var GoogleAdMob = {
126
126
  /**
127
127
  * @public
@@ -542,6 +542,93 @@ var getAppsInTossGlobals = () => {
542
542
  brandBridgeColorMode: brandBridgeColorMode()
543
543
  };
544
544
  };
545
+
546
+ // src/tdsEvent.ts
547
+ import { createEventBridge as createEventBridge4 } from "@apps-in-toss/bridge-core";
548
+ var tdsEvent = {
549
+ /**
550
+ * @public
551
+ * @category TDS
552
+ * @name addEventListener
553
+ * @description 이벤트를 추가해요.
554
+ * @param {string} event 이벤트 이름예요.
555
+ * @param {TdsEvent[K]['onEvent']} onEvent 이벤트 핸들러예요.
556
+ * @param {TdsEvent[K]['onError']} onError 이벤트 에러 핸들러예요.
557
+ * @param {TdsEvent[K]['options']} options 이벤트 옵션예요.
558
+ * @returns {void} 이벤트를 추가했을 때 아무 값도 반환하지 않아요.
559
+ * @example
560
+ * ### 네비게이션 악세서리 이벤트 추가하기
561
+ * ```tsx
562
+ * import { tdsEvent } from '@apps-in-toss/framework';
563
+ *
564
+ * tdsEvent.addEventListener('navigationAccessoryEvent', {
565
+ * onEvent: ({ id }) => {
566
+ * if(id === 'heart') {
567
+ * router.push('/heart');
568
+ * }
569
+ * },
570
+ * });
571
+ * ```
572
+ */
573
+ addEventListener: (event, {
574
+ onEvent,
575
+ onError,
576
+ options
577
+ }) => createEventBridge4(event)({
578
+ onEvent,
579
+ onError: onError ?? (() => {
580
+ }),
581
+ options
582
+ })
583
+ };
584
+
585
+ // src/partner.ts
586
+ import { createAsyncBridge as createAsyncBridge3 } from "@apps-in-toss/bridge-core";
587
+ var partner = {
588
+ /**
589
+ * @public
590
+ * @category 파트너
591
+ * @name addAccessoryButton
592
+ * @description 상단 네비게이션의 악세서리 버튼을 추가해요. callback에 대한 정의는 `tdsEvent.addEventListener("navigationAccessoryEvent", callback)`를 참고해주세요.
593
+ * @param {AddAccessoryButtonOptions} options - 악세서리 버튼의 고유 ID예요.
594
+ * @returns {void} 악세서리 버튼을 추가했을 때 아무 값도 반환하지 않아요.
595
+ * @example
596
+ * ```tsx
597
+ * import { partner } from '@apps-in-toss/framework';
598
+ *
599
+ * partner.addAccessoryButton({
600
+ * id: 'heart',
601
+ * type: 'icon',
602
+ * name: 'icon-heart-mono',
603
+ * alt: '하트',
604
+ * });
605
+ *
606
+ * partner.addAccessoryButton({
607
+ * id: ['heart', 'heart2'],
608
+ * type: 'icon-double',
609
+ * leftIconName: 'icon-heart-mono',
610
+ * leftIconAlt: '하트',
611
+ * rightIconName: 'icon-heart-mono',
612
+ * rightIconAlt: '하트',
613
+ * });
614
+ * ```
615
+ */
616
+ addAccessoryButton: createAsyncBridge3("addAccessoryButton"),
617
+ /**
618
+ * @public
619
+ * @category 파트너
620
+ * @name removeAccessoryButton
621
+ * @description 상단 네비게이션의 악세서리 버튼을 제거해요.
622
+ * @returns {void} 악세서리 버튼을 제거했을 때 아무 값도 반환하지 않아요.
623
+ * @example
624
+ * ```tsx
625
+ * import { partner } from '@apps-in-toss/framework';
626
+ *
627
+ * partner.removeAccessoryButton();
628
+ * ```
629
+ */
630
+ removeAccessoryButton: createAsyncBridge3("removeAccessoryButton")
631
+ };
545
632
  export {
546
633
  GoogleAdMob,
547
634
  IAP,
@@ -551,5 +638,7 @@ export {
551
638
  env,
552
639
  getAppsInTossGlobals,
553
640
  getSafeAreaInsets,
554
- isMinVersionSupported
641
+ isMinVersionSupported,
642
+ partner,
643
+ tdsEvent
555
644
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apps-in-toss/web-bridge",
3
3
  "type": "module",
4
- "version": "0.0.32",
4
+ "version": "0.0.33",
5
5
  "description": "Web Bridge for Apps In Toss",
6
6
  "scripts": {
7
7
  "prepack": "yarn build",
@@ -23,9 +23,9 @@
23
23
  "build"
24
24
  ],
25
25
  "devDependencies": {
26
- "@apps-in-toss-internal/bridgepack": "0.0.32",
27
- "@apps-in-toss/bridge-core": "0.0.32",
28
- "@apps-in-toss/framework": "0.0.32",
26
+ "@apps-in-toss-internal/bridgepack": "0.0.33",
27
+ "@apps-in-toss/bridge-core": "0.0.33",
28
+ "@apps-in-toss/framework": "0.0.33",
29
29
  "react-native-bedrock": "0.0.25",
30
30
  "tsup": "^8.3.5",
31
31
  "typescript": "4.9.5",
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "ad308fcf0d83cb5ffcde365282d18a5b814f0b29"
40
+ "gitHead": "6b7e58eea07536c97dee1de3ae03e565c726f619"
41
41
  }