@apps-in-toss/framework 0.0.36 → 0.0.38

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
@@ -1549,7 +1549,7 @@ function useBridgeHandler({
1549
1549
  },
1550
1550
  {}
1551
1551
  )
1552
- )}`,
1552
+ )};`,
1553
1553
  originalInjectedJavaScript,
1554
1554
  "true"
1555
1555
  ].join("\n"),
@@ -1899,8 +1899,16 @@ function WebView({ type, local, onMessage, ...props }) {
1899
1899
  const bottom = (0, import_private3.useSafeAreaBottom)();
1900
1900
  const global2 = getAppsInTossGlobals();
1901
1901
  const partner = (0, import_react_native20.usePartnerNavigation)();
1902
+ const disableTextSelectionCSS = `
1903
+ (function() {
1904
+ const style = document.createElement('style');
1905
+ style.textContent = '*:not(input):not(textarea) { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-touch-callout: none; }';
1906
+ document.head.appendChild(style);
1907
+ })();
1908
+ `;
1902
1909
  const handler = useBridgeHandler({
1903
1910
  onMessage,
1911
+ injectedJavaScript: [disableTextSelectionCSS].join("\n"),
1904
1912
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1905
1913
  eventListenerMap: {
1906
1914
  ...event_bridges_exports,
@@ -1979,14 +1987,31 @@ function WebView({ type, local, onMessage, ...props }) {
1979
1987
  }, [type, props]);
1980
1988
  const BaseWebView = WEBVIEW_TYPES[type];
1981
1989
  const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
1982
- const handleNavigationStateChange = (0, import_react10.useCallback)((event) => {
1983
- if (event.url) {
1984
- trackScreen(event.url);
1985
- }
1986
- }, []);
1990
+ const [canHistoryGoBack, setCanHistoryGoBack] = (0, import_react10.useState)(false);
1991
+ const handleNavigationStateChange = (0, import_react10.useCallback)(
1992
+ (event) => {
1993
+ if (event.url) {
1994
+ trackScreen(event.url);
1995
+ }
1996
+ setCanHistoryGoBack(event.canGoBack);
1997
+ },
1998
+ [setCanHistoryGoBack]
1999
+ );
1987
2000
  const userAgent = useCreateUserAgent({
1988
2001
  colorPreference: "light"
1989
2002
  });
2003
+ const backEvent = (0, import_react_native_bedrock18.useBackEvent)();
2004
+ const handleBackEvent = (0, import_react10.useCallback)(() => {
2005
+ if (canHistoryGoBack) {
2006
+ handler.ref.current?.goBack();
2007
+ } else {
2008
+ (0, import_react_native_bedrock18.closeView)();
2009
+ }
2010
+ }, [canHistoryGoBack, handler]);
2011
+ (0, import_react10.useEffect)(() => {
2012
+ backEvent.addEventListener(handleBackEvent);
2013
+ return () => backEvent.removeEventListener(handleBackEvent);
2014
+ }, [backEvent, handleBackEvent]);
1990
2015
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1991
2016
  BaseWebView,
1992
2017
  {
package/dist/index.d.cts CHANGED
@@ -1441,20 +1441,22 @@ interface IapCreateOneTimePurchaseOrderOptions {
1441
1441
  * @category 인앱결제
1442
1442
  * @name IapCreateOneTimePurchaseOrderResult
1443
1443
  * @description 인앱결제 1건이 완료되면 결제 세부 정보와 상품 정보를 담아 반환해요. 반환된 정보로 결제한 상품의 정보를 화면에 표시할 수 있어요.
1444
- * @property {string | null} miniAppIconUrl - 미니앱 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요. 콘솔에서 아이콘을 등록하지 않았다면 `null`로 반환돼요.
1444
+ * @property {string} orderId - 결제 주문 ID이에요. 결제 완료 [결제 상태를 조회](https://developers-apps-in-toss.toss.im/api/getIapOrderStatus.html)할 사용해요.
1445
1445
  * @property {string} displayName - 화면에 표시할 상품 이름이에요.
1446
1446
  * @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요.
1447
1447
  * @property {number} amount - 상품 가격 숫자 값이에요. 화폐 단위와 쉼표를 제외한 순수 숫자예요. 예를 들어 `1000`으로 표시돼요.
1448
1448
  * @property {string} currency - [ISO 4217 표준](https://ko.wikipedia.org/wiki/ISO_4217)에 따른 상품 가격 통화 단위예요. 예를 들어 원화는 `KRW`, 달러는 `USD`로 표시돼요.
1449
1449
  * @property {number} fraction - 가격을 표시할 때 소수점 아래 몇 자리까지 보여줄지 정하는 값이에요. 예를 들어 달러는 소수점 둘째 자리까지 보여줘서 `2`, 원화는 소수점이 필요 없어서 `0`이에요
1450
+ * @property {string | null} miniAppIconUrl - 미니앱 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요. 콘솔에서 아이콘을 등록하지 않았다면 `null`로 반환돼요.
1450
1451
  */
1451
1452
  interface IapCreateOneTimePurchaseOrderResult {
1452
- miniAppIconUrl: string | null;
1453
+ orderId: string;
1453
1454
  displayName: string;
1454
1455
  displayAmount: string;
1455
1456
  amount: number;
1456
1457
  currency: string;
1457
1458
  fraction: number;
1459
+ miniAppIconUrl: string | null;
1458
1460
  }
1459
1461
  /**
1460
1462
  * @public
@@ -1481,25 +1483,26 @@ interface IapCreateOneTimePurchaseOrderResult {
1481
1483
  * ### 특정 인앱결제 주문서 페이지로 이동하기
1482
1484
  *
1483
1485
  * ```tsx
1484
- * import { Button } from 'react-native';
1485
- * import { IAP } from '@apps-in-toss/framework';
1486
+ * import { IAP } from "@apps-in-toss/web-framework";
1487
+ * import { Button } from "@toss-design-system/react-native";
1486
1488
  *
1487
1489
  * interface Props {
1488
1490
  * productId: string;
1489
1491
  * }
1490
1492
  *
1491
1493
  * function IapCreateOneTimePurchaseOrderButton({ productId }: Props) {
1492
- * const handleClick = async () => {
1494
+ * async function handleClick() {
1493
1495
  * try {
1494
1496
  * await IAP.createOneTimePurchaseOrder({
1495
1497
  * productId,
1496
1498
  * });
1499
+ * console.error("인앱결제에 성공했어요");
1497
1500
  * } catch (error) {
1498
1501
  * console.error('인앱결제에 실패했어요:', error);
1499
1502
  * }
1500
- * };
1503
+ * }
1501
1504
  *
1502
- * return <Button title="구매하기" onPress={handleClick} />;
1505
+ * return <Button onClick={handleClick}>구매하기</Button>;
1503
1506
  * }
1504
1507
  * ```
1505
1508
  */
@@ -1509,7 +1512,7 @@ declare function createOneTimePurchaseOrder(params: IapCreateOneTimePurchaseOrde
1509
1512
  * @category 인앱결제
1510
1513
  * @name IapProductListItem
1511
1514
  * @description 인앱결제로 구매할 수 있는 상품 하나의 정보를 담은 객체예요. 상품 목록을 화면에 표시할 때 사용해요.
1512
- * @property {string} sku - 상품의 고유 ID예요. [인앱결제 주문서 페이지로 이동할때](/bedrock/reference/framework/인앱결제/createOneTimePurchaseOrder.html) 사용하는 `productId`와 동일한 값이에요.
1515
+ * @property {string} sku - 상품의 고유 ID예요. [IAP.createOneTimePurchaseOrder](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/createOneTimePurchaseOrder.html) 호출할때 사용하는 `productId`와 동일한 값이에요.
1513
1516
  * @property {string} displayName - 화면에 표시할 상품 이름이에요. 상품 이름은 앱인토스 콘솔에서 설정한 값이에요.
1514
1517
  * @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요.
1515
1518
  * @property {string} iconUrl - 상품 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요.
@@ -1533,20 +1536,32 @@ interface IapProductListItem {
1533
1536
  * ### 구매 가능한 인앱결제 상품목록 가져오기
1534
1537
  *
1535
1538
  * ```tsx
1536
- * import { useEffect, useState } from 'react';
1537
- * import { List, ListRow, Txt } from '@toss-design-system/react-native';
1538
- * import { IAP } from '@apps-in-toss/framework';
1539
+ * import { IAP, IapProductListItem } from "@apps-in-toss/framework";
1540
+ * import { Button, List, ListRow } from "@toss-design-system/react-native";
1541
+ * import { useEffect, useState } from "react";
1539
1542
  *
1540
- * function IapGetProductItemList() {
1543
+ * function IapProductList() {
1541
1544
  * const [products, setProducts] = useState<IapProductListItem[]>([]);
1542
1545
  *
1546
+ * async function buyIapProduct(productId: string) {
1547
+ * try {
1548
+ * await IAP.createOneTimePurchaseOrder({
1549
+ * productId,
1550
+ * });
1551
+ *
1552
+ * console.error("인앱결제에 성공했어요");
1553
+ * } catch (error) {
1554
+ * console.error("인앱결제에 실패했어요:", error);
1555
+ * }
1556
+ * }
1557
+ *
1543
1558
  * useEffect(() => {
1544
1559
  * async function fetchProducts() {
1545
1560
  * try {
1546
1561
  * const response = await IAP.getProductItemList();
1547
1562
  * setProducts(response?.products ?? []);
1548
1563
  * } catch (error) {
1549
- * console.error('상품 목록을 가져오는 데 실패했어요:', error);
1564
+ * console.error("상품 목록을 가져오는 데 실패했어요:", error);
1550
1565
  * }
1551
1566
  * }
1552
1567
  *
@@ -1558,7 +1573,22 @@ interface IapProductListItem {
1558
1573
  * {products.map((product) => (
1559
1574
  * <ListRow
1560
1575
  * key={product.sku}
1561
- * contents={<Txt>{product.displayName}</Txt>}
1576
+ * left={
1577
+ * <ListRow.Image type="square" source={{ uri: product.iconUrl }} />
1578
+ * }
1579
+ * right={
1580
+ * <Button size="medium" onPress={() => buyIapProduct(product.sku)}>
1581
+ * 구매하기
1582
+ * </Button>
1583
+ * }
1584
+ * contents={
1585
+ * <ListRow.Texts
1586
+ * type="3RowTypeA"
1587
+ * top={product.displayName}
1588
+ * middle={product.description}
1589
+ * bottom={product.displayAmount}
1590
+ * />
1591
+ * }
1562
1592
  * />
1563
1593
  * ))}
1564
1594
  * </List>
@@ -1574,8 +1604,8 @@ declare function getProductItemList(): Promise<{
1574
1604
  * @category 인앱결제
1575
1605
  * @name IAP
1576
1606
  * @description 인앱결제 관련 기능을 모은 객체예요. 단건 인앱결제 주문서 이동과 상품 목록 조회 기능을 제공해요.
1577
- * @property {typeof createOneTimePurchaseOrder} [createOneTimePurchaseOrder] 특정 인앱결제 주문서 페이지로 이동해요. 자세한 내용은 [createOneTimePurchaseOrder](/bedrock/reference/framework/인앱결제/createOneTimePurchaseOrder.html) 문서를 참고하세요.
1578
- * @property {typeof getProductItemList} [getProductItemList] 인앱결제로 구매할 수 있는 상품 목록을 가져와요. 자세한 내용은 [getProductItemList](/bedrock/reference/framework/인앱결제/getProductItemList.html) 문서를 참고하세요.
1607
+ * @property {typeof createOneTimePurchaseOrder} [createOneTimePurchaseOrder] 특정 인앱결제 주문서 페이지로 이동해요. 자세한 내용은 [createOneTimePurchaseOrder](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/getProductItemList.html) 문서를 참고하세요.
1608
+ * @property {typeof getProductItemList} [getProductItemList] 인앱결제로 구매할 수 있는 상품 목록을 가져와요. 자세한 내용은 [getProductItemList](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/createOneTimePurchaseOrder.html) 문서를 참고하세요.
1579
1609
  */
1580
1610
  declare const IAP: {
1581
1611
  createOneTimePurchaseOrder: typeof createOneTimePurchaseOrder;
package/dist/index.d.ts CHANGED
@@ -1441,20 +1441,22 @@ interface IapCreateOneTimePurchaseOrderOptions {
1441
1441
  * @category 인앱결제
1442
1442
  * @name IapCreateOneTimePurchaseOrderResult
1443
1443
  * @description 인앱결제 1건이 완료되면 결제 세부 정보와 상품 정보를 담아 반환해요. 반환된 정보로 결제한 상품의 정보를 화면에 표시할 수 있어요.
1444
- * @property {string | null} miniAppIconUrl - 미니앱 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요. 콘솔에서 아이콘을 등록하지 않았다면 `null`로 반환돼요.
1444
+ * @property {string} orderId - 결제 주문 ID이에요. 결제 완료 [결제 상태를 조회](https://developers-apps-in-toss.toss.im/api/getIapOrderStatus.html)할 사용해요.
1445
1445
  * @property {string} displayName - 화면에 표시할 상품 이름이에요.
1446
1446
  * @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요.
1447
1447
  * @property {number} amount - 상품 가격 숫자 값이에요. 화폐 단위와 쉼표를 제외한 순수 숫자예요. 예를 들어 `1000`으로 표시돼요.
1448
1448
  * @property {string} currency - [ISO 4217 표준](https://ko.wikipedia.org/wiki/ISO_4217)에 따른 상품 가격 통화 단위예요. 예를 들어 원화는 `KRW`, 달러는 `USD`로 표시돼요.
1449
1449
  * @property {number} fraction - 가격을 표시할 때 소수점 아래 몇 자리까지 보여줄지 정하는 값이에요. 예를 들어 달러는 소수점 둘째 자리까지 보여줘서 `2`, 원화는 소수점이 필요 없어서 `0`이에요
1450
+ * @property {string | null} miniAppIconUrl - 미니앱 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요. 콘솔에서 아이콘을 등록하지 않았다면 `null`로 반환돼요.
1450
1451
  */
1451
1452
  interface IapCreateOneTimePurchaseOrderResult {
1452
- miniAppIconUrl: string | null;
1453
+ orderId: string;
1453
1454
  displayName: string;
1454
1455
  displayAmount: string;
1455
1456
  amount: number;
1456
1457
  currency: string;
1457
1458
  fraction: number;
1459
+ miniAppIconUrl: string | null;
1458
1460
  }
1459
1461
  /**
1460
1462
  * @public
@@ -1481,25 +1483,26 @@ interface IapCreateOneTimePurchaseOrderResult {
1481
1483
  * ### 특정 인앱결제 주문서 페이지로 이동하기
1482
1484
  *
1483
1485
  * ```tsx
1484
- * import { Button } from 'react-native';
1485
- * import { IAP } from '@apps-in-toss/framework';
1486
+ * import { IAP } from "@apps-in-toss/web-framework";
1487
+ * import { Button } from "@toss-design-system/react-native";
1486
1488
  *
1487
1489
  * interface Props {
1488
1490
  * productId: string;
1489
1491
  * }
1490
1492
  *
1491
1493
  * function IapCreateOneTimePurchaseOrderButton({ productId }: Props) {
1492
- * const handleClick = async () => {
1494
+ * async function handleClick() {
1493
1495
  * try {
1494
1496
  * await IAP.createOneTimePurchaseOrder({
1495
1497
  * productId,
1496
1498
  * });
1499
+ * console.error("인앱결제에 성공했어요");
1497
1500
  * } catch (error) {
1498
1501
  * console.error('인앱결제에 실패했어요:', error);
1499
1502
  * }
1500
- * };
1503
+ * }
1501
1504
  *
1502
- * return <Button title="구매하기" onPress={handleClick} />;
1505
+ * return <Button onClick={handleClick}>구매하기</Button>;
1503
1506
  * }
1504
1507
  * ```
1505
1508
  */
@@ -1509,7 +1512,7 @@ declare function createOneTimePurchaseOrder(params: IapCreateOneTimePurchaseOrde
1509
1512
  * @category 인앱결제
1510
1513
  * @name IapProductListItem
1511
1514
  * @description 인앱결제로 구매할 수 있는 상품 하나의 정보를 담은 객체예요. 상품 목록을 화면에 표시할 때 사용해요.
1512
- * @property {string} sku - 상품의 고유 ID예요. [인앱결제 주문서 페이지로 이동할때](/bedrock/reference/framework/인앱결제/createOneTimePurchaseOrder.html) 사용하는 `productId`와 동일한 값이에요.
1515
+ * @property {string} sku - 상품의 고유 ID예요. [IAP.createOneTimePurchaseOrder](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/createOneTimePurchaseOrder.html) 호출할때 사용하는 `productId`와 동일한 값이에요.
1513
1516
  * @property {string} displayName - 화면에 표시할 상품 이름이에요. 상품 이름은 앱인토스 콘솔에서 설정한 값이에요.
1514
1517
  * @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요.
1515
1518
  * @property {string} iconUrl - 상품 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요.
@@ -1533,20 +1536,32 @@ interface IapProductListItem {
1533
1536
  * ### 구매 가능한 인앱결제 상품목록 가져오기
1534
1537
  *
1535
1538
  * ```tsx
1536
- * import { useEffect, useState } from 'react';
1537
- * import { List, ListRow, Txt } from '@toss-design-system/react-native';
1538
- * import { IAP } from '@apps-in-toss/framework';
1539
+ * import { IAP, IapProductListItem } from "@apps-in-toss/framework";
1540
+ * import { Button, List, ListRow } from "@toss-design-system/react-native";
1541
+ * import { useEffect, useState } from "react";
1539
1542
  *
1540
- * function IapGetProductItemList() {
1543
+ * function IapProductList() {
1541
1544
  * const [products, setProducts] = useState<IapProductListItem[]>([]);
1542
1545
  *
1546
+ * async function buyIapProduct(productId: string) {
1547
+ * try {
1548
+ * await IAP.createOneTimePurchaseOrder({
1549
+ * productId,
1550
+ * });
1551
+ *
1552
+ * console.error("인앱결제에 성공했어요");
1553
+ * } catch (error) {
1554
+ * console.error("인앱결제에 실패했어요:", error);
1555
+ * }
1556
+ * }
1557
+ *
1543
1558
  * useEffect(() => {
1544
1559
  * async function fetchProducts() {
1545
1560
  * try {
1546
1561
  * const response = await IAP.getProductItemList();
1547
1562
  * setProducts(response?.products ?? []);
1548
1563
  * } catch (error) {
1549
- * console.error('상품 목록을 가져오는 데 실패했어요:', error);
1564
+ * console.error("상품 목록을 가져오는 데 실패했어요:", error);
1550
1565
  * }
1551
1566
  * }
1552
1567
  *
@@ -1558,7 +1573,22 @@ interface IapProductListItem {
1558
1573
  * {products.map((product) => (
1559
1574
  * <ListRow
1560
1575
  * key={product.sku}
1561
- * contents={<Txt>{product.displayName}</Txt>}
1576
+ * left={
1577
+ * <ListRow.Image type="square" source={{ uri: product.iconUrl }} />
1578
+ * }
1579
+ * right={
1580
+ * <Button size="medium" onPress={() => buyIapProduct(product.sku)}>
1581
+ * 구매하기
1582
+ * </Button>
1583
+ * }
1584
+ * contents={
1585
+ * <ListRow.Texts
1586
+ * type="3RowTypeA"
1587
+ * top={product.displayName}
1588
+ * middle={product.description}
1589
+ * bottom={product.displayAmount}
1590
+ * />
1591
+ * }
1562
1592
  * />
1563
1593
  * ))}
1564
1594
  * </List>
@@ -1574,8 +1604,8 @@ declare function getProductItemList(): Promise<{
1574
1604
  * @category 인앱결제
1575
1605
  * @name IAP
1576
1606
  * @description 인앱결제 관련 기능을 모은 객체예요. 단건 인앱결제 주문서 이동과 상품 목록 조회 기능을 제공해요.
1577
- * @property {typeof createOneTimePurchaseOrder} [createOneTimePurchaseOrder] 특정 인앱결제 주문서 페이지로 이동해요. 자세한 내용은 [createOneTimePurchaseOrder](/bedrock/reference/framework/인앱결제/createOneTimePurchaseOrder.html) 문서를 참고하세요.
1578
- * @property {typeof getProductItemList} [getProductItemList] 인앱결제로 구매할 수 있는 상품 목록을 가져와요. 자세한 내용은 [getProductItemList](/bedrock/reference/framework/인앱결제/getProductItemList.html) 문서를 참고하세요.
1607
+ * @property {typeof createOneTimePurchaseOrder} [createOneTimePurchaseOrder] 특정 인앱결제 주문서 페이지로 이동해요. 자세한 내용은 [createOneTimePurchaseOrder](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/getProductItemList.html) 문서를 참고하세요.
1608
+ * @property {typeof getProductItemList} [getProductItemList] 인앱결제로 구매할 수 있는 상품 목록을 가져와요. 자세한 내용은 [getProductItemList](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/createOneTimePurchaseOrder.html) 문서를 참고하세요.
1579
1609
  */
1580
1610
  declare const IAP: {
1581
1611
  createOneTimePurchaseOrder: typeof createOneTimePurchaseOrder;
package/dist/index.js CHANGED
@@ -954,9 +954,9 @@ import {
954
954
  usePartnerNavigation
955
955
  } from "@toss-design-system/react-native";
956
956
  import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2 } from "@toss-design-system/react-native/private";
957
- import { useCallback as useCallback5, useMemo as useMemo3 } from "react";
957
+ import { useCallback as useCallback5, useEffect as useEffect7, useMemo as useMemo3, useState as useState4 } from "react";
958
958
  import { Platform as Platform7 } from "react-native";
959
- import { getSchemeUri as getSchemeUri5, useBedrockEvent } from "react-native-bedrock";
959
+ import { getSchemeUri as getSchemeUri5, useBackEvent, useBedrockEvent, closeView as closeView3 } from "react-native-bedrock";
960
960
  import * as bedrockAsyncBridges from "react-native-bedrock/async-bridges";
961
961
  import * as bedrockConstantBridges from "react-native-bedrock/constant-bridges";
962
962
 
@@ -1495,7 +1495,7 @@ function useBridgeHandler({
1495
1495
  },
1496
1496
  {}
1497
1497
  )
1498
- )}`,
1498
+ )};`,
1499
1499
  originalInjectedJavaScript,
1500
1500
  "true"
1501
1501
  ].join("\n"),
@@ -1845,8 +1845,16 @@ function WebView({ type, local, onMessage, ...props }) {
1845
1845
  const bottom = useSafeAreaBottom();
1846
1846
  const global2 = getAppsInTossGlobals();
1847
1847
  const partner = usePartnerNavigation();
1848
+ const disableTextSelectionCSS = `
1849
+ (function() {
1850
+ const style = document.createElement('style');
1851
+ style.textContent = '*:not(input):not(textarea) { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-touch-callout: none; }';
1852
+ document.head.appendChild(style);
1853
+ })();
1854
+ `;
1848
1855
  const handler = useBridgeHandler({
1849
1856
  onMessage,
1857
+ injectedJavaScript: [disableTextSelectionCSS].join("\n"),
1850
1858
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1851
1859
  eventListenerMap: {
1852
1860
  ...event_bridges_exports,
@@ -1925,14 +1933,31 @@ function WebView({ type, local, onMessage, ...props }) {
1925
1933
  }, [type, props]);
1926
1934
  const BaseWebView = WEBVIEW_TYPES[type];
1927
1935
  const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
1928
- const handleNavigationStateChange = useCallback5((event) => {
1929
- if (event.url) {
1930
- trackScreen(event.url);
1931
- }
1932
- }, []);
1936
+ const [canHistoryGoBack, setCanHistoryGoBack] = useState4(false);
1937
+ const handleNavigationStateChange = useCallback5(
1938
+ (event) => {
1939
+ if (event.url) {
1940
+ trackScreen(event.url);
1941
+ }
1942
+ setCanHistoryGoBack(event.canGoBack);
1943
+ },
1944
+ [setCanHistoryGoBack]
1945
+ );
1933
1946
  const userAgent = useCreateUserAgent({
1934
1947
  colorPreference: "light"
1935
1948
  });
1949
+ const backEvent = useBackEvent();
1950
+ const handleBackEvent = useCallback5(() => {
1951
+ if (canHistoryGoBack) {
1952
+ handler.ref.current?.goBack();
1953
+ } else {
1954
+ closeView3();
1955
+ }
1956
+ }, [canHistoryGoBack, handler]);
1957
+ useEffect7(() => {
1958
+ backEvent.addEventListener(handleBackEvent);
1959
+ return () => backEvent.removeEventListener(handleBackEvent);
1960
+ }, [backEvent, handleBackEvent]);
1936
1961
  return /* @__PURE__ */ jsx7(
1937
1962
  BaseWebView,
1938
1963
  {
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.36",
4
+ "version": "0.0.38",
5
5
  "description": "The framework for Apps In Toss",
6
6
  "scripts": {
7
7
  "prepack": "yarn build",
@@ -57,9 +57,9 @@
57
57
  "ait": "./bin/ait.js"
58
58
  },
59
59
  "dependencies": {
60
- "@apps-in-toss/analytics": "0.0.36",
61
- "@apps-in-toss/cli": "0.0.36",
62
- "@apps-in-toss/plugins": "0.0.36",
60
+ "@apps-in-toss/analytics": "0.0.38",
61
+ "@apps-in-toss/cli": "0.0.38",
62
+ "@apps-in-toss/plugins": "0.0.38",
63
63
  "es-hangul": "^2.3.2"
64
64
  },
65
65
  "devDependencies": {
@@ -94,5 +94,5 @@
94
94
  "publishConfig": {
95
95
  "access": "public"
96
96
  },
97
- "gitHead": "b3b65b35bf9532480fcbd14f7d22b796644e2f2f"
97
+ "gitHead": "ce9e4e922e27220978e7975e350539e863088b38"
98
98
  }