@product7/product7-js 0.1.2 → 0.1.3

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.
@@ -1886,7 +1886,12 @@
1886
1886
  .feedback-widget,
1887
1887
  .messenger-widget,
1888
1888
  .changelog-widget,
1889
- .feedback-survey {
1889
+ .feedback-survey,
1890
+ .feedback-panel,
1891
+ .feedback-modal,
1892
+ .changelog-modal,
1893
+ .changelog-list-modal,
1894
+ .product7-notification {
1890
1895
  box-sizing: border-box;
1891
1896
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', Oxygen, Ubuntu, Cantarell, sans-serif;
1892
1897
  }
@@ -1902,7 +1907,19 @@
1902
1907
  .changelog-widget *::after,
1903
1908
  .feedback-survey *,
1904
1909
  .feedback-survey *::before,
1905
- .feedback-survey *::after {
1910
+ .feedback-survey *::after,
1911
+ .feedback-panel *,
1912
+ .feedback-panel *::before,
1913
+ .feedback-panel *::after,
1914
+ .feedback-modal *,
1915
+ .feedback-modal *::before,
1916
+ .feedback-modal *::after,
1917
+ .changelog-modal *,
1918
+ .changelog-modal *::before,
1919
+ .changelog-modal *::after,
1920
+ .changelog-list-modal *,
1921
+ .changelog-list-modal *::before,
1922
+ .changelog-list-modal *::after {
1906
1923
  box-sizing: border-box;
1907
1924
  }
1908
1925
 
@@ -2203,6 +2220,10 @@
2203
2220
  font-size: var(--font-size-md);
2204
2221
  line-height: var(--line-height-loose);
2205
2222
  color: var(--color-text-secondary);
2223
+ display: -webkit-box;
2224
+ -webkit-line-clamp: 2;
2225
+ -webkit-box-orient: vertical;
2226
+ overflow: hidden;
2206
2227
  }
2207
2228
 
2208
2229
  .changelog-popup-btn {
@@ -7410,9 +7431,8 @@
7410
7431
  const date = changelog.published_at
7411
7432
  ? this._formatDate(changelog.published_at)
7412
7433
  : '';
7413
- const description = this._truncateDescription(
7414
- changelog.excerpt || changelog.description,
7415
- 100
7434
+ const description = this._stripHtml(
7435
+ changelog.excerpt || changelog.description
7416
7436
  );
7417
7437
  const labelsHTML =
7418
7438
  changelog.labels && changelog.labels.length > 0
@@ -7481,9 +7501,8 @@
7481
7501
  const hasImage = changelog.cover_image || changelog.image;
7482
7502
  const imageUrl = changelog.cover_image || changelog.image;
7483
7503
  const hasMultiple = this.changelogs.length > 1;
7484
- const description = this._truncateDescription(
7485
- changelog.excerpt || changelog.description,
7486
- 160
7504
+ const description = this._stripHtml(
7505
+ changelog.excerpt || changelog.description
7487
7506
  );
7488
7507
 
7489
7508
  content.innerHTML = `
@@ -8987,6 +9006,13 @@
8987
9006
  this._attachChangelogEvents();
8988
9007
  }
8989
9008
 
9009
+ _stripHtml(html) {
9010
+ if (!html) return '';
9011
+ const tmp = document.createElement('div');
9012
+ tmp.innerHTML = html;
9013
+ return (tmp.textContent || tmp.innerText || '').trim();
9014
+ }
9015
+
8990
9016
  _renderChangelogCard(item) {
8991
9017
  const dateStr = this._formatDate(item.publishedAt || item.date);
8992
9018
  const labelsHtml =
@@ -9008,7 +9034,7 @@
9008
9034
  ${labelsHtml}
9009
9035
  </div>
9010
9036
  <h3 class="messenger-changelog-title">${item.title}</h3>
9011
- ${item.description ? `<p class="messenger-changelog-description">${item.description}</p>` : ''}
9037
+ ${item.description ? `<p class="messenger-changelog-description">${this._stripHtml(item.description)}</p>` : ''}
9012
9038
  </div>
9013
9039
  ${item.coverImage ? `<div class="messenger-changelog-thumb"><img src="${item.coverImage}" alt="${item.title}" onerror="this.style.display='none';" /></div>` : ''}
9014
9040
  <iconify-icon icon="ph:caret-right" class="messenger-changelog-arrow" width="16" height="16"></iconify-icon>
@@ -13123,7 +13149,9 @@
13123
13149
  includeEligibility: true,
13124
13150
  includeIneligible: true,
13125
13151
  });
13126
- const surveyConfig = surveys.find((s) => s.id === surveyId);
13152
+ const surveyConfig = surveys.find(
13153
+ (s) => s.surveyId === surveyId || s.id === surveyId
13154
+ );
13127
13155
 
13128
13156
  if (!surveyConfig) {
13129
13157
  throw new SDKError(
@@ -13803,26 +13831,6 @@
13803
13831
  }
13804
13832
  };
13805
13833
 
13806
- function injectStyles() {
13807
- if (typeof document === 'undefined') return;
13808
-
13809
- if (!document.querySelector('#product7-styles')) {
13810
- const style = document.createElement('style');
13811
- style.id = 'product7-styles';
13812
- style.textContent = CSS_STYLES;
13813
- document.head.appendChild(style);
13814
- }
13815
-
13816
- if (!document.querySelector('#product7-iconify')) {
13817
- const script = document.createElement('script');
13818
- script.id = 'product7-iconify';
13819
- script.src =
13820
- 'https://cdn.jsdelivr.net/npm/iconify-icon@2/dist/iconify-icon.min.js';
13821
- script.async = true;
13822
- document.head.appendChild(script);
13823
- }
13824
- }
13825
-
13826
13834
  // --- Identify: transform flat user data into internal format ---
13827
13835
 
13828
13836
  function transformIdentifyData(data) {
@@ -13909,7 +13917,6 @@
13909
13917
  if (Product7._sdk) return Product7._sdk;
13910
13918
 
13911
13919
  if (options.organization) {
13912
- injectStyles();
13913
13920
  const config = cleanUndefined({
13914
13921
  workspace: options.organization,
13915
13922
  debug: options.debug,
@@ -13948,8 +13955,6 @@
13948
13955
 
13949
13956
  async identify(data = {}, callback) {
13950
13957
  try {
13951
- injectStyles();
13952
-
13953
13958
  const transformed = transformIdentifyData(data);
13954
13959
  Product7._organization = transformed.workspace;
13955
13960
 
@@ -14035,8 +14040,6 @@
14035
14040
  return null;
14036
14041
  }
14037
14042
 
14038
- injectStyles();
14039
-
14040
14043
  const widgetOptions = cleanUndefined({
14041
14044
  displayMode: options.displayMode || 'panel',
14042
14045
  theme: options.theme || sdk.config.theme || 'light',
@@ -14143,8 +14146,6 @@
14143
14146
  return null;
14144
14147
  }
14145
14148
 
14146
- injectStyles();
14147
-
14148
14149
  const widgetOptions = cleanUndefined({
14149
14150
  theme: options.theme || sdk.config.theme || 'light',
14150
14151
  primaryColor: options.primaryColor,
@@ -14248,8 +14249,6 @@
14248
14249
  return null;
14249
14250
  }
14250
14251
 
14251
- injectStyles();
14252
-
14253
14252
  // placement → position
14254
14253
  let position = 'right';
14255
14254
  if (options.placement === 'right') {