@product7/feedback-sdk 1.3.9 → 1.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@product7/feedback-sdk",
3
- "version": "1.3.9",
3
+ "version": "1.4.0",
4
4
  "description": "JavaScript SDK for integrating Product7 feedback widgets into any website",
5
5
  "main": "dist/feedback-sdk.js",
6
6
  "module": "src/index.js",
@@ -236,6 +236,10 @@ export class APIService extends BaseAPIService {
236
236
  return this.help.searchHelpArticles(query, options);
237
237
  }
238
238
 
239
+ async getChangelogs(options) {
240
+ return this.changelog.getChangelogs(options);
241
+ }
242
+
239
243
  _loadStoredSession() {
240
244
  if (typeof localStorage === 'undefined') return false;
241
245
 
@@ -124,6 +124,7 @@ export const feedbackStyles = `
124
124
  transform: translateX(calc(100% + 24px));
125
125
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
126
126
  font-family: inherit;
127
+ box-shadow: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
127
128
  }
128
129
 
129
130
  .feedback-panel.open {
@@ -136,7 +137,6 @@ export const feedbackStyles = `
136
137
  display: flex;
137
138
  flex-direction: column;
138
139
  border-radius: var(--radius-2xl);
139
- box-shadow: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
140
140
  }
141
141
 
142
142
  .feedback-panel-header {
@@ -23,7 +23,7 @@ export const surveyStyles = `
23
23
  z-index: var(--z-modal);
24
24
  background: var(--color-white);
25
25
  border-radius: var(--radius-2xl);
26
- box-shadow: var(--shadow-2xl);
26
+ box-shadow: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
27
27
  padding: var(--spacing-6);
28
28
  min-width: 320px;
29
29
  max-width: 400px;
@@ -526,26 +526,25 @@ export class MessengerWidget extends BaseWidget {
526
526
  }
527
527
  }
528
528
 
529
- async _fetchHelpArticles() {
530
- try {
531
- const response = await this.apiService.getHelpCollections();
532
- if (response.status && response.data) {
533
- return response.data.map((collection) => ({
534
- id: collection.id,
535
- title: collection.title || collection.name,
536
- description: collection.description || '',
537
- articleCount:
538
- collection.article_count || collection.articleCount || 0,
539
- icon: collection.icon || 'ph-book-open',
540
- url: collection.url || `#/help/${collection.slug || collection.id}`,
541
- }));
542
- }
543
- return [];
544
- } catch (error) {
545
- console.error('[MessengerWidget] Failed to fetch help articles:', error);
546
- return [];
547
- }
548
- }
529
+ async _fetchHelpArticles() {
530
+ try {
531
+ const response = await this.apiService.getHelpCollections();
532
+ if (response.success && response.data) {
533
+ const collections = response.data.collections || response.data;
534
+ return collections.map((collection) => ({
535
+ id: collection.id,
536
+ title: collection.title,
537
+ description: collection.description || '',
538
+ articleCount: collection.article_count || 0,
539
+ url: collection.url_slug ? `/help/${collection.url_slug}` : null,
540
+ }));
541
+ }
542
+ return [];
543
+ } catch (error) {
544
+ console.error('[MessengerWidget] Failed to fetch help articles:', error);
545
+ return [];
546
+ }
547
+ }
549
548
 
550
549
  async fetchMessages(conversationId) {
551
550
  try {
@@ -670,105 +669,89 @@ export class MessengerWidget extends BaseWidget {
670
669
  }
671
670
  }
672
671
 
673
- async _fetchChangelog() {
674
- if (this.apiService?.mock) {
675
- return {
676
- homeItems: [
677
- {
678
- id: 'changelog_5',
679
- title: 'New integrations available',
680
- description:
681
- 'Connect with more tools you love and streamline your workflow.',
682
- tags: ['Integration'],
683
- coverImage:
684
- 'https://images.unsplash.com/photo-1674027444485-cec3da58eef4?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8M3x8YWl8ZW58MHx8MHx8fDA%3D',
685
- coverText: null,
686
- publishedAt: new Date(
687
- Date.now() - 14 * 24 * 60 * 60 * 1000
688
- ).toISOString(),
689
- url: '#',
690
- },
691
- {
692
- id: 'changelog_2',
693
- title: 'A new era of Insights has arrived',
694
- description:
695
- 'We announced Fin Insights, a groundbreaking, AI-powered product that gives you complete visibility into every customer conversation.',
696
- tags: ['New feature', 'AI'],
697
- coverImage:
698
- 'https://images.unsplash.com/photo-1666875753105-c63a6f3bdc86?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTJ8fGluc2lnaHRzfGVufDB8fDB8fHww',
699
- coverText: 'Watch our major product launch on-demand',
700
- publishedAt: new Date(
701
- Date.now() - 5 * 24 * 60 * 60 * 1000
702
- ).toISOString(),
703
- url: '#',
704
- },
705
- {
706
- id: 'changelog_1',
707
- title: 'The 2025 Customer Service Transformation Report',
708
- description:
709
- 'Learn how AI has transformed customer service from the ground up—rewriting its economics and reshaping expectations.',
710
- tags: ['Report'],
711
- coverImage:
712
- 'https://images.unsplash.com/photo-1762330467475-a565d04e1808?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8N3x8YWklMjBjdXN0b21lciUyMHNlcnZpY2V8ZW58MHx8MHx8fDA%3D',
713
- coverText: 'Customer service trends as we know them are dead.',
714
- publishedAt: new Date(
715
- Date.now() - 2 * 24 * 60 * 60 * 1000
716
- ).toISOString(),
717
- url: '#',
718
- },
719
- ],
720
- changelogItems: [
721
- {
722
- id: 'changelog_4',
723
- title: 'Enhanced conversation analytics',
724
- description:
725
- 'Get deeper insights into your customer conversations with our new analytics dashboard.',
726
- tags: ['Analytics'],
727
- coverImage:
728
- 'https://images.unsplash.com/photo-1523961131990-5ea7c61b2107?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTJ8fGFuYWx5dGljc3xlbnwwfHwwfHx8MA%3D%3D',
729
- coverText: null,
730
- publishedAt: new Date(
731
- Date.now() - 10 * 24 * 60 * 60 * 1000
732
- ).toISOString(),
733
- url: '#',
734
- },
735
- {
736
- id: 'changelog_3',
737
- title: 'Escalation guidance for complex issues',
738
- description:
739
- 'New AI-powered escalation guidance helps your team handle complex customer issues more effectively.',
740
- tags: ['New feature', 'AI'],
741
- coverImage:
742
- 'https://images.unsplash.com/photo-1764773516703-b246ac2ad5ef?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8M3x8Y29tcGxleCUyMGlzc3Vlc3xlbnwwfHwwfHx8MA%3D%3D',
743
- coverText: null,
744
- publishedAt: new Date(
745
- Date.now() - 7 * 24 * 60 * 60 * 1000
746
- ).toISOString(),
747
- url: '#',
748
- },
749
- ],
750
- };
751
- }
752
-
753
- const response = await this.apiService.getChangelogs({ limit: 20 });
754
- const changelogs = response.data || [];
755
-
756
- const mappedItems = changelogs.map((item) => ({
757
- id: item.id,
758
- title: item.title,
759
- description: item.excerpt || item.description || '',
760
- tags: item.labels ? item.labels.map((label) => label.name) : [],
761
- coverImage: item.cover_image || null,
762
- coverText: null,
763
- publishedAt: item.published_at,
764
- url: item.slug ? `/changelog/${item.slug}` : '#',
765
- }));
766
-
767
- return {
768
- homeItems: mappedItems.slice(0, 3),
769
- changelogItems: mappedItems,
770
- };
771
- }
672
+ async _fetchChangelog() {
673
+ if (this.apiService?.mock) {
674
+ return {
675
+ homeItems: [
676
+ {
677
+ id: 'changelog_5',
678
+ title: 'New integrations available',
679
+ description: 'Connect with more tools you love and streamline your workflow.',
680
+ tags: ['Integration'],
681
+ coverImage: 'https://images.unsplash.com/photo-1674027444485-cec3da58eef4?w=500&auto=format&fit=crop&q=60',
682
+ publishedAt: new Date(Date.now() - 14 * 24 * 60 * 60 * 1000).toISOString(),
683
+ url: '#',
684
+ },
685
+ {
686
+ id: 'changelog_2',
687
+ title: 'A new era of Insights has arrived',
688
+ description: 'We announced Fin Insights, a groundbreaking, AI-powered product that gives you complete visibility into every customer conversation.',
689
+ tags: ['New feature', 'AI'],
690
+ coverImage: 'https://images.unsplash.com/photo-1666875753105-c63a6f3bdc86?w=500&auto=format&fit=crop&q=60',
691
+ publishedAt: new Date(Date.now() - 5 * 24 * 60 * 60 * 1000).toISOString(),
692
+ url: '#',
693
+ },
694
+ {
695
+ id: 'changelog_1',
696
+ title: 'The 2025 Customer Service Transformation Report',
697
+ description: 'Learn how AI has transformed customer service from the ground up—rewriting its economics and reshaping expectations.',
698
+ tags: ['Report'],
699
+ coverImage: 'https://images.unsplash.com/photo-1762330467475-a565d04e1808?w=500&auto=format&fit=crop&q=60',
700
+ publishedAt: new Date(Date.now() - 2 * 24 * 60 * 60 * 1000).toISOString(),
701
+ url: '#',
702
+ },
703
+ ],
704
+ changelogItems: [
705
+ {
706
+ id: 'changelog_4',
707
+ title: 'Enhanced conversation analytics',
708
+ description: 'Get deeper insights into your customer conversations with our new analytics dashboard.',
709
+ tags: ['Analytics'],
710
+ coverImage: 'https://images.unsplash.com/photo-1523961131990-5ea7c61b2107?w=500&auto=format&fit=crop&q=60',
711
+ publishedAt: new Date(Date.now() - 10 * 24 * 60 * 60 * 1000).toISOString(),
712
+ url: '#',
713
+ },
714
+ {
715
+ id: 'changelog_3',
716
+ title: 'Escalation guidance for complex issues',
717
+ description: 'New AI-powered escalation guidance helps your team handle complex customer issues more effectively.',
718
+ tags: ['New feature', 'AI'],
719
+ coverImage: 'https://images.unsplash.com/photo-1764773516703-b246ac2ad5ef?w=500&auto=format&fit=crop&q=60',
720
+ publishedAt: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString(),
721
+ url: '#',
722
+ },
723
+ ],
724
+ };
725
+ }
726
+
727
+ try {
728
+ const response = await this.apiService.getChangelogs({ limit: 20 });
729
+
730
+ if (response.success && response.data) {
731
+ const changelogs = Array.isArray(response.data) ? response.data : [];
732
+
733
+ const mappedItems = changelogs.map((item) => ({
734
+ id: item.id,
735
+ title: item.title,
736
+ description: item.excerpt || item.description || '',
737
+ tags: item.labels ? item.labels.map((label) => label.name) : [],
738
+ coverImage: item.cover_image || null,
739
+ publishedAt: item.published_at,
740
+ url: item.slug ? `/changelog/${item.slug}` : null,
741
+ }));
742
+
743
+ return {
744
+ homeItems: mappedItems.slice(0, 3),
745
+ changelogItems: mappedItems,
746
+ };
747
+ }
748
+
749
+ return { homeItems: [], changelogItems: [] };
750
+ } catch (error) {
751
+ console.error('[MessengerWidget] Failed to fetch changelog:', error);
752
+ return { homeItems: [], changelogItems: [] };
753
+ }
754
+ }
772
755
 
773
756
  async onMount() {
774
757
  this.loadInitialData();