UI API
POS 플러그인에서 제공하는 UI 컴포넌트 API예요. 바코드 스캔 팝업을 제공해요.
import 방식
ui는 posPluginSdk의 프로퍼티가 아닌 독립 export예요.
ts
import { ui } from '@tossplace/pos-plugin-sdk';Methods
openBarcode
바코드 스캔 팝업을 표시해요.
ts
import { ui } from '@tossplace/pos-plugin-sdk';
const result = await ui.openBarcode({
productName: '토스 POS 플러그인', // 팝업 왼쪽 상단에 표시
});
if (result.result === 'SUCCESS') {
console.log('스캔된 바코드:', result.barcode);
} else {
console.log('사용자가 취소했어요');
}Parameters
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
productName | string | O | 팝업 왼쪽 상단에 표시할 이름 |
Response
ts
{
barcode: string; // 스캔된 바코드 값
result: 'SUCCESS';
} | {
result: 'CANCELLED'; // 사용자 취소
}| 필드 | 타입 | 설명 |
|---|---|---|
result | 'SUCCESS' | 'CANCELLED' | 스캔 결과. 사용자가 취소하면 'CANCELLED'예요 |
barcode | string | 스캔된 바코드 값. result가 'SUCCESS'일 때만 있어요 |