hanbiro-react16-sdk 1.0.31 → 1.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/README.md CHANGED
@@ -40,28 +40,34 @@ import "hanbiro-react16-sdk/style.css";
40
40
 
41
41
  ## Exported Utils
42
42
 
43
- | Function | Description | Import path |
44
- | --------------------- | ------------------------------------------- | --------------------------- |
45
- | `initHanbiroReactSDK` | Initialize SDK (baseUrl, signer) | `hanbiro-react16-sdk/utils` |
46
- | `setLibLang` | Set the active language for SDK components | `hanbiro-react16-sdk/utils` |
47
- | `getBaseUrl` | Get the configured base URL | `hanbiro-react16-sdk/utils` |
48
- | `getGroupwareUrl` | Get the groupware URL | `hanbiro-react16-sdk/utils` |
43
+ | Function | Description | Import path |
44
+ | ----------------- | ---------------------------------------------------- | --------------------------- |
45
+ | `setLibLang` | Set the active language for SDK components | `hanbiro-react16-sdk/utils` |
46
+ | `getBaseUrl` | Get the base URL (derived from the current location) | `hanbiro-react16-sdk/utils` |
47
+ | `getGroupwareUrl` | Get the groupware URL | `hanbiro-react16-sdk/utils` |
48
+ | `getAppVersion` | Get the detected app version (`"v2"` \| `"v3"`) | `hanbiro-react16-sdk/utils` |
49
49
 
50
50
  ---
51
51
 
52
- ## Initialization (Required)
52
+ ## Versioned Theming (Automatic)
53
53
 
54
- Call `initHanbiroReactSDK` at the entry point of your project before rendering any components.
54
+ The SDK serves both the v3 app (URL contains `/v3`) and the v2 app (URL contains `/ngw/app`).
55
+ On import, the SDK detects the current version from the URL and sets a
56
+ `data-hanbiro-sdk-version` attribute (`"v2"` | `"v3"`) on the `<html>` element:
55
57
 
56
- ```ts
57
- import { initHanbiroReactSDK } from "hanbiro-react16-sdk/utils";
58
-
59
- initHanbiroReactSDK({
60
- baseUrl: "https://vndev.hanbiro.com",
61
- signer: null, // Pass your signer instance here if available
62
- });
58
+ ```html
59
+ <html data-hanbiro-sdk-version="v2">
60
+ ...
61
+ </html>
63
62
  ```
64
63
 
64
+ The stylesheet then overrides the primary color palette for v2 via the
65
+ `:root[data-hanbiro-sdk-version="v2"]` selector. **No initialization call is required** —
66
+ just import the SDK and its stylesheet.
67
+
68
+ > The base URL is derived automatically from the current location (`getBaseUrl`),
69
+ > so there is no manual setup step.
70
+
65
71
  ---
66
72
 
67
73
  ## Language Configuration (`setLibLang`)
@@ -75,13 +81,9 @@ Use `setLibLang` to configure the active language imperatively.
75
81
  ### ES Module (npm)
76
82
 
77
83
  ```ts
78
- import { initHanbiroReactSDK, setLibLang } from "hanbiro-react16-sdk/utils";
84
+ import { setLibLang } from "hanbiro-react16-sdk/utils";
79
85
 
80
86
  // Call ONCE at app startup, before rendering any SDK component
81
- initHanbiroReactSDK({
82
- baseUrl: "https://vndev.hanbiro.com",
83
- signer: null,
84
- });
85
87
  setLibLang("ko");
86
88
  ```
87
89
 
@@ -107,10 +109,6 @@ function App() {
107
109
  ### UMD (script tag)
108
110
 
109
111
  ```js
110
- HanbiroReact16SDK.initHanbiroReactSDK({
111
- baseUrl: "https://vndev.hanbiro.com",
112
- signer: null,
113
- });
114
112
  HanbiroReact16SDK.setLibLang("ko");
115
113
  ```
116
114
 
@@ -158,12 +156,6 @@ Load the SDK via `<script>` and `<link>` tags directly in your HTML. React and R
158
156
  The SDK is exposed as a global variable `HanbiroReact16SDK`.
159
157
 
160
158
  ```js
161
- // Initialize
162
- HanbiroReact16SDK.initHanbiroReactSDK({
163
- baseUrl: "https://vndev.hanbiro.com",
164
- signer: null,
165
- });
166
-
167
159
  // Mount a component into a DOM element
168
160
  ReactDOM.render(
169
161
  React.createElement(HanbiroReact16SDK.ChatAIDraft, {
@@ -185,11 +177,6 @@ angular.module("myApp").directive("chatAiDraft", function () {
185
177
  link: function (scope, element) {
186
178
  var container = element[0];
187
179
 
188
- HanbiroReact16SDK.initHanbiroReactSDK({
189
- baseUrl: "https://vndev.hanbiro.com",
190
- signer: null,
191
- });
192
-
193
180
  ReactDOM.render(
194
181
  React.createElement(HanbiroReact16SDK.ChatAIDraft, {
195
182
  baseUrl: HanbiroReact16SDK.getBaseUrl(),
@@ -45,7 +45,7 @@ import ChatInput from "../ChatInput.js";
45
45
  import EmptyState from "./EmptyState.js";
46
46
  import { getLengthOptions, getToneOptions } from "../constants.js";
47
47
  import { AI_LANG_FLAGS } from "../../../constants/index.js";
48
- import { SDKConfig } from "../../../utils/url.js";
48
+ import { CURRENT_LANG } from "../../../utils/lang.js";
49
49
  import v4 from "../../../node_modules/uuid/dist/esm-browser/v4.js";
50
50
  class CreatePanel extends React.Component {
51
51
  constructor(props) {
@@ -109,7 +109,7 @@ class CreatePanel extends React.Component {
109
109
  __publicField(this, "setTone", (tone) => this.setState({ tone }));
110
110
  __publicField(this, "setLength", (length) => this.setState({ length }));
111
111
  this.rootRef = React.createRef();
112
- const lang = ((_a = AI_LANG_FLAGS) == null ? void 0 : _a.find((_item) => (_item == null ? void 0 : _item.value) === SDKConfig.lang)) || AI_LANG_FLAGS[0];
112
+ const lang = ((_a = AI_LANG_FLAGS) == null ? void 0 : _a.find((_item) => (_item == null ? void 0 : _item.value) === CURRENT_LANG)) || AI_LANG_FLAGS[0];
113
113
  this.state = {
114
114
  message: "",
115
115
  messages: [],
@@ -49,8 +49,8 @@ import ContextPreviewModal from "./ContextPreviewModal.js";
49
49
  import { fetchMailView, fetchMailAiContext } from "./helper.js";
50
50
  import { getLengthOptions, getToneOptions } from "../constants.js";
51
51
  import { AI_LANG_FLAGS } from "../../../constants/index.js";
52
- import { SDKConfig } from "../../../utils/url.js";
53
52
  import { t } from "../../../lang/index.js";
53
+ import { CURRENT_LANG } from "../../../utils/lang.js";
54
54
  import v4 from "../../../node_modules/uuid/dist/esm-browser/v4.js";
55
55
  import { LangKey } from "../../../lang/keyLang.js";
56
56
  class ReplyPanel extends React.Component {
@@ -181,7 +181,7 @@ class ReplyPanel extends React.Component {
181
181
  __publicField(this, "setTone", (tone) => this.setState({ tone }));
182
182
  __publicField(this, "setLength", (length) => this.setState({ length }));
183
183
  this.rootRef = React.createRef();
184
- const lang = ((_a = AI_LANG_FLAGS) == null ? void 0 : _a.find((_item) => (_item == null ? void 0 : _item.value) === SDKConfig.lang)) || AI_LANG_FLAGS[0];
184
+ const lang = ((_a = AI_LANG_FLAGS) == null ? void 0 : _a.find((_item) => (_item == null ? void 0 : _item.value) === CURRENT_LANG)) || AI_LANG_FLAGS[0];
185
185
  this.state = {
186
186
  view: "empty",
187
187
  sourceMail: null,
@@ -34,7 +34,8 @@ var __async = (__this, __arguments, generator) => {
34
34
  step((generator = generator.apply(__this, __arguments)).next());
35
35
  });
36
36
  };
37
- import { getBaseUrl, SDKConfig } from "../../utils/url.js";
37
+ import { getSigner } from "../../utils/api.js";
38
+ import { getBaseUrl } from "../../utils/url.js";
38
39
  function callAI(_0, _1) {
39
40
  return __async(this, arguments, function* (params, { setContent, setIsLoading, setConversationId }) {
40
41
  var _a;
@@ -42,17 +43,13 @@ function callAI(_0, _1) {
42
43
  const baseUrl = getBaseUrl();
43
44
  try {
44
45
  setIsLoading(true);
45
- const config = {
46
+ const sigConfig = {
46
47
  method: "POST",
47
- baseURL: baseUrl,
48
+ baseURL: getBaseUrl(),
48
49
  url: "/nmail/chatdraft",
49
50
  params
50
51
  };
51
- let sigHeaders = {};
52
- const signer = (_a = SDKConfig) == null ? void 0 : _a.signer;
53
- if (signer && typeof signer.generateHeaders === "function") {
54
- sigHeaders = yield signer.generateHeaders(config);
55
- }
52
+ const sigHeaders = yield (_a = getSigner()) == null ? void 0 : _a.generateHeaders(sigConfig);
56
53
  const response = yield fetch(`${baseUrl}/nmail/chatdraft`, {
57
54
  method: "POST",
58
55
  body: JSON.stringify(params),
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import * as React from "react";
5
- import { SDKConfig, getBaseUrl } from "../../utils/url.js";
5
+ import { getBaseUrl } from "../../utils/url.js";
6
6
  import { t } from "../../lang/index.js";
7
7
  import LoadingContainer from "../LoadingContainer/index.js";
8
8
  import TargetInfoBar from "./TargetInfoBar.js";
@@ -11,6 +11,7 @@ import SummaryItem from "./SummaryItem.js";
11
11
  import Pagination from "../Pagination/index.js";
12
12
  import LanguagePopover from "./LanguagePopover.js";
13
13
  import { PAGE_SIZE, parseDataLine, findLangLabel } from "./utils.js";
14
+ import { CURRENT_LANG } from "../../utils/lang.js";
14
15
  import { LangKey } from "../../lang/keyLang.js";
15
16
  const INITIAL_META = {
16
17
  total: 0,
@@ -95,7 +96,7 @@ class SummaryAIEmails extends React.Component {
95
96
  this.setState({ langAnchor: null });
96
97
  });
97
98
  this.state = {
98
- lang: SDKConfig.lang || "ko",
99
+ lang: CURRENT_LANG || "ko",
99
100
  mailtype: "all",
100
101
  page: 1,
101
102
  items: [],
@@ -1,4 +1,5 @@
1
1
  import { LangKey } from "../../lang/keyLang.js";
2
+ import "../../utils/lang.js";
2
3
  const PAGE_SIZE = 5;
3
4
  const FILTERS = [
4
5
  { value: "all", label: LangKey.ALL },
@@ -1,5 +1,3 @@
1
1
  export { default as ChatAIDraft } from './ChatAIDraft';
2
- export { default as LoadingCircular } from './LoadingCircular';
3
2
  export { default as LoadingContainer } from './LoadingContainer';
4
- export { default as Pagination } from './Pagination';
5
3
  export { default as SummaryAIEmails } from './SummaryAIEmails';
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * hanbiro-react16-sdk v1.0.31
3
- * Build Date: 2026-05-27
2
+ * hanbiro-react16-sdk v1.0.33
3
+ * Build Date: 2026-06-23
4
4
  */
5
5
  @charset "UTF-8";
6
6
  button.icon-button {