@boldvideo/bold-js 0.4.1 → 0.4.2

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
@@ -72,11 +72,9 @@ __export(src_exports, {
72
72
  module.exports = __toCommonJS(src_exports);
73
73
 
74
74
  // src/lib/client.ts
75
- var import_axios2 = __toESM(require("axios"), 1);
76
- var import_js_cookie = __toESM(require("js-cookie"), 1);
75
+ var import_axios = __toESM(require("axios"), 1);
77
76
 
78
77
  // src/lib/fetchers.ts
79
- var import_axios = __toESM(require("axios"), 1);
80
78
  function get(client, url) {
81
79
  return __async(this, null, function* () {
82
80
  try {
@@ -86,16 +84,7 @@ function get(client, url) {
86
84
  }
87
85
  return res.data;
88
86
  } catch (error) {
89
- if (import_axios.default.isAxiosError(error)) {
90
- console.error("fetching error details:", {
91
- message: error.message,
92
- code: error.code,
93
- config: error.config,
94
- response: error.response
95
- });
96
- } else {
97
- console.error(`Error fetching data from URL: ${url}`, error);
98
- }
87
+ console.error(`Error fetching data from URL: ${url}`, error);
99
88
  throw error;
100
89
  }
101
90
  });
@@ -269,39 +258,26 @@ function basicInfos() {
269
258
  }
270
259
 
271
260
  // src/lib/client.ts
272
- var generateUserId = () => {
273
- return [...Array(30)].map(() => Math.random().toString(36)[2]).join("");
274
- };
275
- var getUserId = () => {
276
- const localStorageKey = "boldvideo_user_id";
277
- let userId = import_js_cookie.default.get(localStorageKey);
278
- if (!userId) {
279
- userId = generateUserId();
280
- import_js_cookie.default.set(localStorageKey, userId, { expires: 365 });
281
- }
282
- return userId;
283
- };
284
261
  function createClient(apiKey, options = { debug: false }) {
285
262
  var _a;
286
263
  if (!apiKey || typeof apiKey !== "string") {
287
264
  throw new Error("API key is missing or invalid");
288
265
  }
289
- const userId = getUserId();
290
266
  const { debug } = options;
291
267
  const apiClientOptions = {
292
268
  baseURL: (_a = options.baseURL) != null ? _a : "https://app.boldvideo.io/api/v1/",
293
269
  headers: {
294
- Authorization: apiKey,
295
- "X-User-Id": userId
270
+ Authorization: apiKey
296
271
  }
297
272
  };
298
273
  let apiClient;
299
274
  try {
300
- apiClient = import_axios2.default.create(apiClientOptions);
275
+ apiClient = import_axios.default.create(apiClientOptions);
301
276
  } catch (error) {
302
277
  console.error("Error creating API client", error);
303
278
  throw error;
304
279
  }
280
+ const userId = [...Array(30)].map(() => Math.random().toString(36)[2]).join("");
305
281
  return {
306
282
  settings: fetchSettings(apiClient),
307
283
  videos: {
package/dist/index.d.ts CHANGED
@@ -34,6 +34,8 @@ type MenuItem = {
34
34
  type Settings = {
35
35
  featured_playlists: Playlist[];
36
36
  menu_items: MenuItem[];
37
+ ai_avatar: string;
38
+ ai_name: string;
37
39
  meta_data: {
38
40
  channel_name: string;
39
41
  description: string;
package/dist/index.js CHANGED
@@ -39,11 +39,9 @@ var __async = (__this, __arguments, generator) => {
39
39
  };
40
40
 
41
41
  // src/lib/client.ts
42
- import axios2 from "axios";
43
- import Cookies from "js-cookie";
42
+ import axios from "axios";
44
43
 
45
44
  // src/lib/fetchers.ts
46
- import axios from "axios";
47
45
  function get(client, url) {
48
46
  return __async(this, null, function* () {
49
47
  try {
@@ -53,16 +51,7 @@ function get(client, url) {
53
51
  }
54
52
  return res.data;
55
53
  } catch (error) {
56
- if (axios.isAxiosError(error)) {
57
- console.error("fetching error details:", {
58
- message: error.message,
59
- code: error.code,
60
- config: error.config,
61
- response: error.response
62
- });
63
- } else {
64
- console.error(`Error fetching data from URL: ${url}`, error);
65
- }
54
+ console.error(`Error fetching data from URL: ${url}`, error);
66
55
  throw error;
67
56
  }
68
57
  });
@@ -236,39 +225,26 @@ function basicInfos() {
236
225
  }
237
226
 
238
227
  // src/lib/client.ts
239
- var generateUserId = () => {
240
- return [...Array(30)].map(() => Math.random().toString(36)[2]).join("");
241
- };
242
- var getUserId = () => {
243
- const localStorageKey = "boldvideo_user_id";
244
- let userId = Cookies.get(localStorageKey);
245
- if (!userId) {
246
- userId = generateUserId();
247
- Cookies.set(localStorageKey, userId, { expires: 365 });
248
- }
249
- return userId;
250
- };
251
228
  function createClient(apiKey, options = { debug: false }) {
252
229
  var _a;
253
230
  if (!apiKey || typeof apiKey !== "string") {
254
231
  throw new Error("API key is missing or invalid");
255
232
  }
256
- const userId = getUserId();
257
233
  const { debug } = options;
258
234
  const apiClientOptions = {
259
235
  baseURL: (_a = options.baseURL) != null ? _a : "https://app.boldvideo.io/api/v1/",
260
236
  headers: {
261
- Authorization: apiKey,
262
- "X-User-Id": userId
237
+ Authorization: apiKey
263
238
  }
264
239
  };
265
240
  let apiClient;
266
241
  try {
267
- apiClient = axios2.create(apiClientOptions);
242
+ apiClient = axios.create(apiClientOptions);
268
243
  } catch (error) {
269
244
  console.error("Error creating API client", error);
270
245
  throw error;
271
246
  }
247
+ const userId = [...Array(30)].map(() => Math.random().toString(36)[2]).join("");
272
248
  return {
273
249
  settings: fetchSettings(apiClient),
274
250
  videos: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@boldvideo/bold-js",
3
3
  "license": "MIT",
4
- "version": "0.4.1",
4
+ "version": "0.4.2",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",