@quantabit/recommend-sdk 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 QuantaBit Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # @quantabit/recommend-sdk
2
+
3
+ > QuantaBit Recommendation SDK - Personalized content/product recommendations and cold-start strategies
4
+
5
+ ## ๐Ÿ“ฆ Installation
6
+
7
+ ```bash
8
+ npm install @quantabit/recommend-sdk
9
+ # or
10
+ yarn add @quantabit/recommend-sdk
11
+ ```
12
+
13
+ ## ๐Ÿš€ Quick Start
14
+
15
+ ### Using Components
16
+
17
+ ```jsx
18
+ import { RecommendCard, RecommendSection, GuessYouLike, SimilarItems } from '@quantabit/recommend-sdk';
19
+
20
+ <RecommendCard />
21
+ <RecommendSection />
22
+ <GuessYouLike />
23
+ ```
24
+
25
+ ### Using Hooks
26
+
27
+ ```jsx
28
+ import { useRecommendations, useSimilar, useHomeFeed, useColdStart, useRecommend } from '@quantabit/recommend-sdk';
29
+
30
+ function MyComponent() {
31
+ const result = useRecommendations();
32
+ const result = useSimilar();
33
+ const result = useHomeFeed();
34
+ return <div>...</div>;
35
+ }
36
+ ```
37
+
38
+ ### API Client
39
+
40
+ ```javascript
41
+ import { recommendApi } from '@quantabit/recommend-sdk';
42
+
43
+ // Use recommendApi for direct API calls
44
+ const data = await recommendApi.list();
45
+ ```
46
+
47
+ ## ๐Ÿ“š Components
48
+
49
+ | Component | Description |
50
+ | --------- | ----------- |
51
+ | `RecommendCard` | Recommend Card component |
52
+ | `RecommendSection` | Recommend Section component |
53
+ | `GuessYouLike` | Guess You Like component |
54
+ | `SimilarItems` | Similar Items component |
55
+
56
+ ## ๐Ÿช Hooks
57
+
58
+ | Hook | Description |
59
+ | ---- | ----------- |
60
+ | `useRecommendations` | Recommendations management |
61
+ | `useSimilar` | Similar management |
62
+ | `useHomeFeed` | Home Feed management |
63
+ | `useColdStart` | Cold Start management |
64
+ | `useRecommend` | Recommend management |
65
+
66
+ ## ๐Ÿ“– Type Definitions
67
+
68
+ ```javascript
69
+ import { RecommendType, RecommendAlgorithm, RecommendScene, FeedbackType } from '@quantabit/recommend-sdk';
70
+ ```
71
+
72
+ ## ๐Ÿ“„ License
73
+
74
+ MIT License
75
+
76
+
77
+
78
+ ---
79
+
80
+ ## ๐ŸŒ Brand & Links
81
+ - Official Mainnet: [QuantaBit Chain](https://qbitchain.io/)
82
+ - Developer Platform: [Developer Platform](https://developer.quantabit.io/)
83
+ - Open Platform: [Open Platform](https://open.quantabit.io/)
84
+ - Payment Platform: [Pay Platform](https://pay.qbitwallet.io/)
85
+ - Feedback: [Feedback](https://xwin.live/qbit)
package/dist/index.cjs ADDED
@@ -0,0 +1,616 @@
1
+ 'use strict';
2
+
3
+ var sdkConfig = require('@quantabit/sdk-config');
4
+ var react = require('react');
5
+
6
+ /**
7
+ * Recommend SDK - API ๅฎขๆˆท็ซฏ
8
+ * ๆŽจ่็ณป็ปŸๅŽ็ซฏๆŽฅๅฃๅฐ่ฃ…
9
+ *
10
+ * ไฝฟ็”จ BaseApiClient ๅŸบ็ฑป็ฎ€ๅŒ–ไปฃ็ 
11
+ */
12
+
13
+
14
+ /**
15
+ * ๆŽจ่ API ๅฎขๆˆท็ซฏ
16
+ */
17
+ class RecommendApiClient extends sdkConfig.BaseApiClient {
18
+ constructor(config = {}) {
19
+ super('/recommend', config);
20
+ }
21
+
22
+ // ============ ไธชๆ€งๅŒ–ๆŽจ่ ============
23
+
24
+ /**
25
+ * ่Žทๅ–้ฆ–้กตๆŽจ่
26
+ * @param {Object} params - ๆŽจ่ๅ‚ๆ•ฐ
27
+ */
28
+ async getHomeRecommendations(params = {}) {
29
+ return this.get('/home', params);
30
+ }
31
+ async getHomeFeed(params = {}) {
32
+ return this.getHomeRecommendations(params);
33
+ }
34
+ async getRecommendations(type = 'home', params = {}) {
35
+ return this.get(`/${type}`, params);
36
+ }
37
+
38
+ /**
39
+ * ่Žทๅ–ๅ†…ๅฎนๆŽจ่
40
+ * @param {Object} params - ๆŽจ่ๅ‚ๆ•ฐ
41
+ */
42
+ async getContentRecommendations(params = {}) {
43
+ return this.get('/content', params);
44
+ }
45
+
46
+ /**
47
+ * ่Žทๅ–ๅ•†ๅ“ๆŽจ่
48
+ * @param {Object} params - ๆŽจ่ๅ‚ๆ•ฐ
49
+ */
50
+ async getProductRecommendations(params = {}) {
51
+ return this.get('/products', params);
52
+ }
53
+
54
+ /**
55
+ * ่Žทๅ–็”จๆˆทๆŽจ่๏ผˆๅฏ่ƒฝ่ฎค่ฏ†็š„ไบบ๏ผ‰
56
+ * @param {Object} params - ๆŽจ่ๅ‚ๆ•ฐ
57
+ */
58
+ async getUserRecommendations(params = {}) {
59
+ return this.get('/users', params);
60
+ }
61
+
62
+ // ============ ็›ธๅ…ณๆŽจ่ ============
63
+
64
+ /**
65
+ * ่Žทๅ–็›ธๅ…ณๅ†…ๅฎน
66
+ * @param {string} contentId - ๅ†…ๅฎน ID
67
+ * @param {Object} params - ๆŽจ่ๅ‚ๆ•ฐ
68
+ */
69
+ async getRelatedContent(contentId, params = {}) {
70
+ return this.get(`/related/content/${contentId}`, params);
71
+ }
72
+ async getSimilar(itemType, itemId, limit = 10) {
73
+ return this.get(`/related/${itemType}/${itemId}`, {
74
+ limit
75
+ });
76
+ }
77
+
78
+ /**
79
+ * ่Žทๅ–็›ธๅ…ณๅ•†ๅ“
80
+ * @param {string} productId - ๅ•†ๅ“ ID
81
+ * @param {Object} params - ๆŽจ่ๅ‚ๆ•ฐ
82
+ */
83
+ async getRelatedProducts(productId, params = {}) {
84
+ return this.get(`/related/product/${productId}`, params);
85
+ }
86
+
87
+ /**
88
+ * ่Žทๅ–็›ธไผผ็”จๆˆท
89
+ * @param {string} userId - ็”จๆˆท ID
90
+ * @param {Object} params - ๆŽจ่ๅ‚ๆ•ฐ
91
+ */
92
+ async getSimilarUsers(userId, params = {}) {
93
+ return this.get(`/related/user/${userId}`, params);
94
+ }
95
+
96
+ // ============ ๅœบๆ™ฏๆŽจ่ ============
97
+
98
+ /**
99
+ * ่Žทๅ–็Œœไฝ ๅ–œๆฌข
100
+ * @param {Object} params - ๆŽจ่ๅ‚ๆ•ฐ
101
+ */
102
+ async getGuessYouLike(params = {}) {
103
+ return this.get('/guess-you-like', params);
104
+ }
105
+ async getAlsoViewed(itemId, itemType = 'content', params = {}) {
106
+ return this.get('/also-viewed', {
107
+ item_id: itemId,
108
+ item_type: itemType,
109
+ ...params
110
+ });
111
+ }
112
+ async getAlsoBought(itemId, itemType = 'product', params = {}) {
113
+ return this.get('/also-bought', {
114
+ item_id: itemId,
115
+ item_type: itemType,
116
+ ...params
117
+ });
118
+ }
119
+
120
+ /**
121
+ * ่Žทๅ–็ƒญ้—จๆŽจ่
122
+ * @param {Object} params - ๆŽจ่ๅ‚ๆ•ฐ
123
+ */
124
+ async getHotRecommendations(params = {}) {
125
+ return this.get('/hot', params);
126
+ }
127
+
128
+ /**
129
+ * ่Žทๅ–ๆ–ฐๅ“ๆŽจ่
130
+ * @param {Object} params - ๆŽจ่ๅ‚ๆ•ฐ
131
+ */
132
+ async getNewRecommendations(params = {}) {
133
+ return this.get('/new', params);
134
+ }
135
+
136
+ /**
137
+ * ่Žทๅ–ไธ“้ข˜ๆŽจ่
138
+ * @param {string} topicId - ไธ“้ข˜ ID
139
+ * @param {Object} params - ๆŽจ่ๅ‚ๆ•ฐ
140
+ */
141
+ async getTopicRecommendations(topicId, params = {}) {
142
+ return this.get(`/topic/${topicId}`, params);
143
+ }
144
+
145
+ // ============ ๅ้ฆˆ ============
146
+
147
+ /**
148
+ * ไธๆ„Ÿๅ…ด่ถฃ
149
+ * @param {string} itemId - ้กน็›ฎ ID
150
+ * @param {string} itemType - ้กน็›ฎ็ฑปๅž‹
151
+ * @param {string} reason - ๅŽŸๅ› 
152
+ */
153
+ async notInterested(itemId, itemType, reason = '') {
154
+ return this.post('/feedback/not-interested', {
155
+ item_id: itemId,
156
+ item_type: itemType,
157
+ reason
158
+ });
159
+ }
160
+ async markNotInterested(itemType, itemId, reason = '') {
161
+ return this.notInterested(itemId, itemType, reason);
162
+ }
163
+ async feedback(itemType, itemId, feedbackType, context = {}) {
164
+ return this.post('/feedback', {
165
+ item_type: itemType,
166
+ item_id: itemId,
167
+ feedback_type: feedbackType,
168
+ ...context
169
+ });
170
+ }
171
+
172
+ /**
173
+ * ่ฎฐๅฝ•็‚นๅ‡ป
174
+ * @param {string} itemId - ้กน็›ฎ ID
175
+ * @param {string} itemType - ้กน็›ฎ็ฑปๅž‹
176
+ * @param {Object} context - ไธŠไธ‹ๆ–‡
177
+ */
178
+ async trackClick(itemId, itemType, context = {}) {
179
+ return this.post('/feedback/click', {
180
+ item_id: itemId,
181
+ item_type: itemType,
182
+ ...context
183
+ });
184
+ }
185
+
186
+ /**
187
+ * ่ฎฐๅฝ•ๆ›ๅ…‰
188
+ * @param {Object[]} items - ๆ›ๅ…‰้กน็›ฎๅˆ—่กจ
189
+ */
190
+ async trackExposure(items) {
191
+ return this.post('/feedback/exposure', {
192
+ items
193
+ });
194
+ }
195
+
196
+ // ============ ๅๅฅฝ่ฎพ็ฝฎ ============
197
+
198
+ /**
199
+ * ่Žทๅ–ๆŽจ่ๅๅฅฝ
200
+ */
201
+ async getPreferences() {
202
+ return this.get('/preferences');
203
+ }
204
+ async getUserPreferences() {
205
+ return this.getPreferences();
206
+ }
207
+
208
+ /**
209
+ * ๆ›ดๆ–ฐๆŽจ่ๅๅฅฝ
210
+ * @param {Object} preferences - ๅๅฅฝ่ฎพ็ฝฎ
211
+ */
212
+ async updatePreferences(preferences) {
213
+ return this.put('/preferences', preferences);
214
+ }
215
+
216
+ /**
217
+ * ่Žทๅ–ๅ…ด่ถฃๆ ‡็ญพ
218
+ */
219
+ async getInterestTags() {
220
+ return this.get('/interests');
221
+ }
222
+
223
+ /**
224
+ * ๆ›ดๆ–ฐๅ…ด่ถฃๆ ‡็ญพ
225
+ * @param {string[]} tagIds - ๆ ‡็ญพ ID ๅˆ—่กจ
226
+ */
227
+ async updateInterestTags(tagIds) {
228
+ return this.put('/interests', {
229
+ tag_ids: tagIds
230
+ });
231
+ }
232
+ async getColdStartQuestions(params = {}) {
233
+ return this.get('/cold-start/questions', params);
234
+ }
235
+ async submitColdStartAnswers(answers) {
236
+ return this.post('/cold-start/answers', {
237
+ answers
238
+ });
239
+ }
240
+ }
241
+
242
+ // ๅˆ›ๅปบ้ป˜่ฎคๅฎžไพ‹
243
+ const recommendApi = new RecommendApiClient();
244
+
245
+ /**
246
+ * Recommend SDK - ็ฑปๅž‹ๅฎšไน‰
247
+ */
248
+
249
+ // ๆŽจ่็ฑปๅž‹
250
+ const RecommendType = {
251
+ CONTENT: 'content',
252
+ PRODUCT: 'product',
253
+ USER: 'user',
254
+ COURSE: 'course',
255
+ GROUP: 'group',
256
+ ACTIVITY: 'activity'
257
+ };
258
+
259
+ // ๆŽจ่็ฎ—ๆณ•
260
+ const RecommendAlgorithm = {
261
+ COLLABORATIVE: 'collaborative',
262
+ // ๅๅŒ่ฟ‡ๆปค
263
+ CONTENT_BASED: 'content_based',
264
+ // ๅŸบไบŽๅ†…ๅฎน
265
+ HYBRID: 'hybrid',
266
+ // ๆททๅˆๆŽจ่
267
+ POPULARITY: 'popularity',
268
+ // ็ƒญ้—จๆŽจ่
269
+ TRENDING: 'trending',
270
+ // ่ถ‹ๅŠฟๆŽจ่
271
+ SIMILAR: 'similar' // ็›ธไผผๆŽจ่
272
+ };
273
+
274
+ // ๅœบๆ™ฏ
275
+ const RecommendScene = {
276
+ HOME_FEED: 'home_feed',
277
+ DETAIL_PAGE: 'detail_page',
278
+ SEARCH_RESULT: 'search_result',
279
+ CART: 'cart',
280
+ CHECKOUT: 'checkout',
281
+ PROFILE: 'profile'
282
+ };
283
+
284
+ // ๅ้ฆˆ็ฑปๅž‹
285
+ const FeedbackType = {
286
+ CLICK: 'click',
287
+ VIEW: 'view',
288
+ LIKE: 'like',
289
+ DISLIKE: 'dislike',
290
+ SHARE: 'share',
291
+ PURCHASE: 'purchase',
292
+ NOT_INTERESTED: 'not_interested'
293
+ };
294
+
295
+ /**
296
+ * Recommend SDK - React Hooks
297
+ */
298
+
299
+
300
+ /**
301
+ * useRecommendations - ๆŽจ่ๅˆ—่กจHook
302
+ */
303
+ function useRecommendations(type, options = {}) {
304
+ const [items, setItems] = react.useState([]);
305
+ const [loading, setLoading] = react.useState(false);
306
+ const [refreshing, setRefreshing] = react.useState(false);
307
+ const loadRecommendations = react.useCallback(async (isRefresh = false) => {
308
+ if (isRefresh) {
309
+ setRefreshing(true);
310
+ } else {
311
+ setLoading(true);
312
+ }
313
+ try {
314
+ const result = await recommendApi.getRecommendations(type, options);
315
+ setItems(result.items || []);
316
+ } finally {
317
+ setLoading(false);
318
+ setRefreshing(false);
319
+ }
320
+ }, [type, options.scene, options.limit, options.algorithm]);
321
+
322
+ // ๆไบคๅ้ฆˆ
323
+ const feedback = react.useCallback(async (itemId, feedbackType) => {
324
+ try {
325
+ await recommendApi.feedback(type, itemId, feedbackType);
326
+ return true;
327
+ } catch (e) {
328
+ return false;
329
+ }
330
+ }, [type]);
331
+
332
+ // ๆ ‡่ฎฐไธๆ„Ÿๅ…ด่ถฃ
333
+ const markNotInterested = react.useCallback(async (itemId, reason) => {
334
+ try {
335
+ await recommendApi.markNotInterested(type, itemId, reason);
336
+ // ไปŽๅˆ—่กจไธญ็งป้™ค
337
+ setItems(prev => prev.filter(item => item.id !== itemId));
338
+ return true;
339
+ } catch (e) {
340
+ return false;
341
+ }
342
+ }, [type]);
343
+
344
+ // ๅˆทๆ–ฐ
345
+ const refresh = react.useCallback(() => {
346
+ return loadRecommendations(true);
347
+ }, [loadRecommendations]);
348
+ react.useEffect(() => {
349
+ loadRecommendations();
350
+ }, [type, options.scene]);
351
+ return {
352
+ items,
353
+ loading,
354
+ refreshing,
355
+ refresh,
356
+ feedback,
357
+ markNotInterested
358
+ };
359
+ }
360
+
361
+ /**
362
+ * useSimilar - ็›ธไผผๆŽจ่Hook
363
+ */
364
+ function useSimilar(itemType, itemId, limit = 10) {
365
+ const [items, setItems] = react.useState([]);
366
+ const [loading, setLoading] = react.useState(false);
367
+ const loadSimilar = react.useCallback(async () => {
368
+ if (!itemType || !itemId) return;
369
+ setLoading(true);
370
+ try {
371
+ const result = await recommendApi.getSimilar(itemType, itemId, limit);
372
+ setItems(result.items || []);
373
+ } finally {
374
+ setLoading(false);
375
+ }
376
+ }, [itemType, itemId, limit]);
377
+ react.useEffect(() => {
378
+ loadSimilar();
379
+ }, [itemType, itemId]);
380
+ return {
381
+ items,
382
+ loading,
383
+ refresh: loadSimilar
384
+ };
385
+ }
386
+
387
+ /**
388
+ * useHomeFeed - ้ฆ–้กตFeed Hook
389
+ */
390
+ function useHomeFeed() {
391
+ const [items, setItems] = react.useState([]);
392
+ const [loading, setLoading] = react.useState(false);
393
+ const [refreshing, setRefreshing] = react.useState(false);
394
+ const [page, setPage] = react.useState(1);
395
+ const [hasMore, setHasMore] = react.useState(true);
396
+ const loadFeed = react.useCallback(async (reset = false) => {
397
+ const currentPage = reset ? 1 : page;
398
+ if (reset) {
399
+ setRefreshing(true);
400
+ } else {
401
+ setLoading(true);
402
+ }
403
+ try {
404
+ const result = await recommendApi.getHomeFeed({
405
+ page: currentPage,
406
+ pageSize: 20
407
+ });
408
+ const newItems = result.items || [];
409
+ setItems(prev => reset ? newItems : [...prev, ...newItems]);
410
+ setHasMore(newItems.length >= 20);
411
+ if (reset) setPage(1);
412
+ } finally {
413
+ setLoading(false);
414
+ setRefreshing(false);
415
+ }
416
+ }, [page]);
417
+ const loadMore = react.useCallback(() => {
418
+ if (hasMore && !loading) {
419
+ setPage(p => p + 1);
420
+ }
421
+ }, [hasMore, loading]);
422
+ const refresh = react.useCallback(() => {
423
+ return loadFeed(true);
424
+ }, [loadFeed]);
425
+ react.useEffect(() => {
426
+ loadFeed(true);
427
+ }, []);
428
+ react.useEffect(() => {
429
+ if (page > 1) loadFeed();
430
+ }, [page]);
431
+ return {
432
+ items,
433
+ loading,
434
+ refreshing,
435
+ hasMore,
436
+ loadMore,
437
+ refresh
438
+ };
439
+ }
440
+
441
+ /**
442
+ * useColdStart - ๅ†ทๅฏๅŠจๅผ•ๅฏผHook
443
+ */
444
+ function useColdStart() {
445
+ const [questions, setQuestions] = react.useState([]);
446
+ const [answers, setAnswers] = react.useState({});
447
+ const [loading, setLoading] = react.useState(false);
448
+ const [submitting, setSubmitting] = react.useState(false);
449
+ const [completed, setCompleted] = react.useState(false);
450
+ const loadQuestions = react.useCallback(async () => {
451
+ setLoading(true);
452
+ try {
453
+ const result = await recommendApi.getColdStartQuestions();
454
+ setQuestions(result.questions || []);
455
+ } finally {
456
+ setLoading(false);
457
+ }
458
+ }, []);
459
+ const setAnswer = react.useCallback((questionId, answer) => {
460
+ setAnswers(prev => ({
461
+ ...prev,
462
+ [questionId]: answer
463
+ }));
464
+ }, []);
465
+ const submit = react.useCallback(async () => {
466
+ setSubmitting(true);
467
+ try {
468
+ await recommendApi.submitColdStartAnswers(answers);
469
+ setCompleted(true);
470
+ return true;
471
+ } catch (e) {
472
+ return false;
473
+ } finally {
474
+ setSubmitting(false);
475
+ }
476
+ }, [answers]);
477
+ react.useEffect(() => {
478
+ loadQuestions();
479
+ }, []);
480
+ return {
481
+ questions,
482
+ answers,
483
+ loading,
484
+ submitting,
485
+ completed,
486
+ setAnswer,
487
+ submit,
488
+ isComplete: Object.keys(answers).length >= questions.length
489
+ };
490
+ }
491
+
492
+ function RecommendCard() {
493
+ return null;
494
+ }
495
+ function RecommendSection() {
496
+ return null;
497
+ }
498
+ function GuessYouLike() {
499
+ return null;
500
+ }
501
+ function SimilarItems() {
502
+ return null;
503
+ }
504
+
505
+ /**
506
+ * QuantaBit Recommend SDK - i18n support
507
+ */
508
+
509
+ const messages = {
510
+ en: {
511
+ recommendation: 'Recommendations',
512
+ guessYouLike: 'Guess You Like',
513
+ similarItems: 'Similar Items',
514
+ alsoViewed: 'People also viewed',
515
+ alsoBought: 'People also bought',
516
+ notInterested: 'Not Interested',
517
+ notInterestedFeedback: 'We will show you fewer items like this',
518
+ loading: 'Loading recommendations...',
519
+ noData: 'No recommendations available'
520
+ },
521
+ zh: {
522
+ recommendation: 'ไธชๆ€งๅŒ–ๆŽจ่',
523
+ guessYouLike: '็Œœไฝ ๅ–œๆฌข',
524
+ similarItems: '็›ธไผผๆŽจ่',
525
+ alsoViewed: '็œ‹ไบ†่ฟ˜็œ‹',
526
+ alsoBought: 'ไนฐไบ†่ฟ˜ไนฐ',
527
+ notInterested: 'ไธๆ„Ÿๅ…ด่ถฃ',
528
+ notInterestedFeedback: 'ๅฐ†ๅ‡ๅฐ‘ๆญค็ฑปๅ†…ๅฎน็š„ๆŽจ่',
529
+ loading: 'ๆญฃๅœจๅŠ ่ฝฝๆŽจ่ๅ†…ๅฎน...',
530
+ noData: 'ๆš‚ๆ— ๆŽจ่ๅ†…ๅฎน'
531
+ },
532
+ ja: {
533
+ recommendation: 'ใŠใ™ใ™ใ‚',
534
+ guessYouLike: 'ใ‚ใชใŸใธใฎใŠใ™ใ™ใ‚',
535
+ similarItems: 'ไผผใŸใ‚ˆใ†ใชๅ•†ๅ“',
536
+ alsoViewed: 'ใ“ใฎๅ•†ๅ“ใ‚’่ฆ‹ใŸไบบใฏใ“ใ‚“ใชๅ•†ๅ“ใ‚‚่ฆ‹ใฆใ„ใพใ™',
537
+ alsoBought: 'ใ“ใฎๅ•†ๅ“ใ‚’่ฒทใฃใŸไบบใฏใ“ใ‚“ใชๅ•†ๅ“ใ‚‚่ฒทใฃใฆใ„ใพใ™',
538
+ notInterested: '่ˆˆๅ‘ณใŒใชใ„',
539
+ notInterestedFeedback: 'ใ“ใฎใ‚ˆใ†ใชใ‚ขใ‚คใƒ†ใƒ ใฎ่กจ็คบใ‚’ๆธ›ใ‚‰ใ—ใพใ™',
540
+ loading: '่ชญใฟ่พผใฟไธญ...',
541
+ noData: 'ใŠใ™ใ™ใ‚ใฏใ‚ใ‚Šใพใ›ใ‚“'
542
+ },
543
+ ko: {
544
+ recommendation: '์ถ”์ฒœ ์ฝ˜ํ…์ธ ',
545
+ guessYouLike: '์ด๋Ÿฐ ์ฝ˜ํ…์ธ ๋Š” ์–ด๋– ์„ธ์š”?',
546
+ similarItems: '๋น„์Šทํ•œ ์ฝ˜ํ…์ธ ',
547
+ alsoViewed: 'ํ•จ๊ป˜ ๋ณธ ์ฝ˜ํ…์ธ ',
548
+ alsoBought: 'ํ•จ๊ป˜ ๊ตฌ๋งคํ•œ ์ƒํ’ˆ',
549
+ notInterested: '๊ด€์‹ฌ ์—†์Œ',
550
+ notInterestedFeedback: '์ด์™€ ๊ฐ™์€ ์ฝ˜ํ…์ธ  ์ถ”์ฒœ์„ ์ค„์ž…๋‹ˆ๋‹ค',
551
+ loading: '์ถ”์ฒœ ์ฝ˜ํ…์ธ ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์ค‘...',
552
+ noData: '์ถ”์ฒœํ•  ์ฝ˜ํ…์ธ ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค'
553
+ }
554
+ };
555
+ const SUPPORTED_LANGUAGES = ['en', 'zh', 'ja', 'ko'];
556
+ let currentLanguage = 'en';
557
+ function setLanguage(lang) {
558
+ if (SUPPORTED_LANGUAGES.includes(lang)) currentLanguage = lang;
559
+ }
560
+ function getLanguage() {
561
+ return currentLanguage;
562
+ }
563
+ function t(key) {
564
+ return (messages[currentLanguage] || messages.en)[key] || key;
565
+ }
566
+
567
+ /**
568
+ * @quantabit/recommend-sdk
569
+ * Recommendation SDK - Full Version
570
+ */
571
+
572
+ const getRecommendations = (...args) => recommendApi.getRecommendations(...args);
573
+ const getHomeFeed = (...args) => recommendApi.getHomeFeed(...args);
574
+ const getSimilar = (...args) => recommendApi.getSimilar(...args);
575
+ const getGuessYouLike = (...args) => recommendApi.getGuessYouLike(...args);
576
+ const getAlsoViewed = (...args) => recommendApi.getAlsoViewed(...args);
577
+ const getAlsoBought = (...args) => recommendApi.getAlsoBought(...args);
578
+ const feedback = (...args) => recommendApi.feedback(...args);
579
+ const markNotInterested = (...args) => recommendApi.markNotInterested(...args);
580
+ const getUserPreferences = (...args) => recommendApi.getUserPreferences(...args);
581
+ const updatePreferences = (...args) => recommendApi.updatePreferences(...args);
582
+ const getColdStartQuestions = (...args) => recommendApi.getColdStartQuestions(...args);
583
+ const submitColdStartAnswers = (...args) => recommendApi.submitColdStartAnswers(...args);
584
+
585
+ exports.FeedbackType = FeedbackType;
586
+ exports.GuessYouLike = GuessYouLike;
587
+ exports.RecommendAlgorithm = RecommendAlgorithm;
588
+ exports.RecommendApiClient = RecommendApiClient;
589
+ exports.RecommendCard = RecommendCard;
590
+ exports.RecommendScene = RecommendScene;
591
+ exports.RecommendSection = RecommendSection;
592
+ exports.RecommendType = RecommendType;
593
+ exports.SUPPORTED_LANGUAGES = SUPPORTED_LANGUAGES;
594
+ exports.SimilarItems = SimilarItems;
595
+ exports.feedback = feedback;
596
+ exports.getAlsoBought = getAlsoBought;
597
+ exports.getAlsoViewed = getAlsoViewed;
598
+ exports.getColdStartQuestions = getColdStartQuestions;
599
+ exports.getGuessYouLike = getGuessYouLike;
600
+ exports.getHomeFeed = getHomeFeed;
601
+ exports.getLanguage = getLanguage;
602
+ exports.getRecommendations = getRecommendations;
603
+ exports.getSimilar = getSimilar;
604
+ exports.getUserPreferences = getUserPreferences;
605
+ exports.markNotInterested = markNotInterested;
606
+ exports.messages = messages;
607
+ exports.recommendApi = recommendApi;
608
+ exports.setLanguage = setLanguage;
609
+ exports.submitColdStartAnswers = submitColdStartAnswers;
610
+ exports.t = t;
611
+ exports.updatePreferences = updatePreferences;
612
+ exports.useColdStart = useColdStart;
613
+ exports.useHomeFeed = useHomeFeed;
614
+ exports.useRecommendations = useRecommendations;
615
+ exports.useSimilar = useSimilar;
616
+ //# sourceMappingURL=index.cjs.map