> For the complete documentation index, see [llms.txt](https://docs.wepin.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wepin.io/widget-integration/web-javascript-sdk/widget/init.md).

# 초기화하기

Wepin Widget Javascript SDK를 초기화하는 방법입니다.&#x20;

## init

WepinSDK 를 초기화 합니다. 초기화시에  필요한 위젯의 속성들을 정의합니다.

```javascript
await wepinSdk.init(attributes?)
```

### **Parameters**

* `attributes` \<object> **optional** &#x20;
* `type` \<string>\
  처음 로딩 시 앱 위젯 윈도우를 어떻게 보여줄 지를 결정 합니다. 기본 값은 `hide` 입니다. 현재는\
  `hide` 만 지원합니다 \
  `hide` 는 처음 로딩시 위젯 윈도우를 보여주지 않고 숨깁니다. 이후 `openWindow()`을 통해서 위젯 윈도우을 띄워 보여 줍니다.
* `defaultLanguage`: \<string>\
  위젯 기본 언어 설정, 기본 값은 `ko`입니다. 현재 지원하는 언어는 `en`, `ko`, `ja` 3가지 입니다.
* `defaultCurrency`**:** \<string>\
  위젯 기본 통화 설정, 기본 값은 `KRW`입니다. 현재 지원하는 통화는 `USD`, `KRW`, `JPY` 3가지 입니다.
* `loginProviders`: \<string\[]> **optional**

  로그인 프로바이더 리스트 입니다.   현재 지원하는 프로바이더는 `google`, `apple` , `naver`, `discord`, `line`, `facebook` 이렇게 6가지 입니다.  필요한 로그인 프로바이더만 정의해서 사용하세요. &#x20;

  * 이 값을 지정하지 않으면  제공하는 모든 프로바이더를 이용할 수 있습니다.
  * 빈 배열이 제공된 경우, 이메일 로그인 기능만 사용 가능합니다. (v0.0.3 버전 이상부터  지원)

### **Return value**

* `Promise`\<void>

### Example

<pre class="language-javascript"><code class="lang-javascript">await wepinSdk.init({
    type: 'hide',
    defaultLanguage: 'ko',
    defaultCurrency: 'KRW',
})

// google, apple login
<strong>await wepinSdk.init({
</strong>    type: 'hide',
    defaultLanguage: 'ko',
    defaultCurrency: 'KRW',
    loginProviders: ['google', 'apple']
})

// only email login
await wepinSdk.init({
    type: 'hide',
    defaultLanguage: 'ko',
    defaultCurrency: 'KRW',
    loginProviders: []
})
</code></pre>

## isInitialized

WepinSDK 가 정상적으로 초기화 되었는지 확인할 수 있습니다.&#x20;

```javascript
wepinSdk.isInitialized()
```

### **Parameters**

* \<void>

### **Return Value**

* `<boolean>`\
  초기화가 정상적으로 잘 된 경우 true , 실패한 경우 false 를 반환합니다.

### **Example**

```javascript
await wepinSdk.init({
    type: 'hide',
    defaultLanguage: 'ko',
    defaultCurrency: 'KRW',
})

if(wepinSdk.isInitialized()) {
  console.log('wepinSDK is initialized!')
}
```

## changeLanguage

위젯의 언어와 통화를 변경할 수 있습니다.

```javascript
wepinSdk.changeLanguage({language, currency})
```

### **Parameters**

* `language` \<string>\
  위젯에 표시될 언어를   지정합니다. 현재 지원하는 언어는 `en`, `ko`, `ja` 3가지 입니다.
* `currency` \<string>\
  위젯에 표시될 통화를  지정합니다. 현재 지원하는 통화는 `USD`, `KRW`, `JPY` 3가지 입니다.

### Example

```javascript
wepinSdk.changeLanguage({
   currency: 'KRW',
   language: 'ko'
})
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wepin.io/widget-integration/web-javascript-sdk/widget/init.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
