@returningai/widget-sdk 1.8.6 → 1.8.7

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.
@@ -15570,7 +15570,7 @@ class CustomWidget extends BaseWidget {
15570
15570
  }
15571
15571
  }
15572
15572
  }
15573
- console.log(`[rai-widget] v${"1.8.6"}`);
15573
+ console.log(`[rai-widget] v${"1.8.7"}`);
15574
15574
  class StoreWidgetCompat extends StoreWidget {
15575
15575
  }
15576
15576
  const WIDGET_REGISTRY = [
@@ -15634,7 +15634,7 @@ function exposePublicApi() {
15634
15634
  })();
15635
15635
  const widget = container == null ? void 0 : container.querySelector(ALL_WIDGET_SELECTOR);
15636
15636
  window.ReturningAIWidget = {
15637
- version: "1.8.6",
15637
+ version: "1.8.7",
15638
15638
  reload: () => (widget == null ? void 0 : widget.reload()) ?? Promise.resolve(),
15639
15639
  logout: () => (widget == null ? void 0 : widget.logoutPublic()) ?? Promise.resolve(),
15640
15640
  isAuthenticated: () => (widget == null ? void 0 : widget.isAuthenticated()) ?? false,
@@ -1,8 +1,4 @@
1
- // Shared attribute shape for all widget elements
2
- interface RaiWidgetAttributes {
3
- 'community-id': string
4
- 'channel-id'?: string
5
- 'widget-id'?: string // deprecated — use 'community-id'
1
+ interface RaiSharedWidgetAttributes {
6
2
  'data-email'?: string
7
3
  'widget-type'?: 'store' | 'channel' | 'milestone' | 'social' | 'currency-view' | 'referral-conditions' | 'custom'
8
4
  theme?: 'light' | 'dark'
@@ -24,45 +20,58 @@ interface RaiWidgetAttributes {
24
20
  style?: string
25
21
  }
26
22
 
27
- type RaiWidgetElementAttributes = RaiWidgetAttributes & {
23
+ interface RaiCommunityWidgetAttributes extends RaiSharedWidgetAttributes {
24
+ 'community-id': string
25
+ 'channel-id'?: string
26
+ /** @deprecated Standard widgets should use community-id. */
27
+ 'widget-id'?: string
28
+ }
29
+
30
+ interface RaiCustomWidgetAttributes extends RaiSharedWidgetAttributes {
31
+ 'widget-id': string
32
+ 'community-id'?: never
33
+ 'channel-id'?: never
34
+ }
35
+
36
+ type RaiWidgetElementAttributes<TAttributes> = TAttributes & {
28
37
  [attributeName: string]: unknown
29
38
  }
30
39
 
40
+ type RaiCommunityWidgetElementAttributes =
41
+ RaiWidgetElementAttributes<RaiCommunityWidgetAttributes>
42
+
43
+ type RaiCustomWidgetElementAttributes =
44
+ RaiWidgetElementAttributes<RaiCustomWidgetAttributes>
45
+
31
46
  interface RaiWidgetIntrinsicElements {
32
- 'rai-store-widget': RaiWidgetElementAttributes
33
- 'rai-channel-widget': RaiWidgetElementAttributes
34
- 'rai-milestone-widget': RaiWidgetElementAttributes
35
- 'rai-social-widget': RaiWidgetElementAttributes
36
- 'rai-currency-widget': RaiWidgetElementAttributes
37
- 'rai-referral-widget': RaiWidgetElementAttributes
38
- 'rai-custom-widget': RaiWidgetElementAttributes
39
- 'rai-widget': RaiWidgetElementAttributes // deprecated
47
+ 'rai-store-widget': RaiCommunityWidgetElementAttributes
48
+ 'rai-channel-widget': RaiCommunityWidgetElementAttributes
49
+ 'rai-milestone-widget': RaiCommunityWidgetElementAttributes
50
+ 'rai-social-widget': RaiCommunityWidgetElementAttributes
51
+ 'rai-currency-widget': RaiCommunityWidgetElementAttributes
52
+ 'rai-referral-widget': RaiCommunityWidgetElementAttributes
53
+ 'rai-custom-widget': RaiCustomWidgetElementAttributes
54
+ 'rai-widget': RaiCommunityWidgetElementAttributes
40
55
  }
41
56
 
42
- // ── React ──────────────────────────────────────────────────────────────────
43
57
  declare global {
44
58
  namespace React {
45
59
  namespace JSX {
46
60
  interface IntrinsicElements extends RaiWidgetIntrinsicElements {}
47
61
  }
48
62
  }
49
-
50
- namespace JSX {
51
- interface IntrinsicElements extends RaiWidgetIntrinsicElements {}
52
- }
53
63
  }
54
64
 
55
- // ── Vue 3 (Volar / vue-tsc) ────────────────────────────────────────────────
56
65
  declare module '@vue/runtime-core' {
57
66
  interface GlobalComponents {
58
- RaiStoreWidget: { $props: RaiWidgetAttributes }
59
- RaiChannelWidget: { $props: RaiWidgetAttributes }
60
- RaiMilestoneWidget: { $props: RaiWidgetAttributes }
61
- RaiSocialWidget: { $props: RaiWidgetAttributes }
62
- RaiCurrencyWidget: { $props: RaiWidgetAttributes }
63
- RaiReferralWidget: { $props: RaiWidgetAttributes }
64
- RaiCustomWidget: { $props: RaiWidgetAttributes }
65
- RaiWidget: { $props: RaiWidgetAttributes } // deprecated
67
+ RaiStoreWidget: { $props: RaiCommunityWidgetElementAttributes }
68
+ RaiChannelWidget: { $props: RaiCommunityWidgetElementAttributes }
69
+ RaiMilestoneWidget: { $props: RaiCommunityWidgetElementAttributes }
70
+ RaiSocialWidget: { $props: RaiCommunityWidgetElementAttributes }
71
+ RaiCurrencyWidget: { $props: RaiCommunityWidgetElementAttributes }
72
+ RaiReferralWidget: { $props: RaiCommunityWidgetElementAttributes }
73
+ RaiCustomWidget: { $props: RaiCustomWidgetElementAttributes }
74
+ RaiWidget: { $props: RaiCommunityWidgetElementAttributes }
66
75
  }
67
76
  }
68
77
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@returningai/widget-sdk",
3
- "version": "1.8.6",
3
+ "version": "1.8.7",
4
4
  "description": "Shadow DOM isolated widget SDK for ReturningAI",
5
5
  "main": "dist/rai-widget.iife.js",
6
6
  "module": "dist/rai-widget.js",
@@ -37,17 +37,19 @@
37
37
  "test:auth-session-coordinator": "rm -rf test/.tmp && tsc -p test/tsconfig.json && node test/.tmp/test/auth-session-coordinator.test.js",
38
38
  "test:startup-performance": "rm -rf test/.tmp && tsc -p test/tsconfig.json && node test/.tmp/test/startup-performance.test.js",
39
39
  "test:widget-error-presentation": "rm -rf test/.tmp && tsc -p test/tsconfig.json && node test/.tmp/test/widget-error-presentation.test.js",
40
- "test:jsx-types": "tsc --noEmit --strict --lib ES2020,DOM --skipLibCheck false src/jsx.d.ts",
40
+ "test:jsx-types": "npm run types && node --test test/jsx/declaration-shape.test.mjs test/jsx/packed-consumer.test.mjs && tsc -p test/jsx/tsconfig.react.json && tsc -p test/jsx/tsconfig.vue.json",
41
41
  "coverage:repowise": "rm -rf coverage && npm run coverage:host-callback && npm run coverage:bundle-readiness && npm run test:jsx-types",
42
42
  "coverage:host-callback": "rm -rf test/.tmp && tsc -p test/tsconfig.json && c8 --reporter=lcov --reports-dir=coverage/host-callback --exclude-after-remap --exclude='**/*.test.ts' node test/.tmp/test/postmessage-host-callback.test.js && node scripts/name-lcov-test.mjs coverage/host-callback/lcov.info test/postmessage-host-callback.test.ts",
43
43
  "coverage:bundle-readiness": "rm -rf test/.tmp && tsc -p test/tsconfig.json && c8 --reporter=lcov --reports-dir=coverage/bundle-readiness --exclude-after-remap --exclude='**/*.test.ts' node test/.tmp/test/bundle-readiness.test.js && node scripts/name-lcov-test.mjs coverage/bundle-readiness/lcov.info test/bundle-readiness.test.ts",
44
44
  "prepublishOnly": "npm run build:all:min && npm run types"
45
45
  },
46
46
  "devDependencies": {
47
+ "@types/react": "^19.1.10",
47
48
  "c8": "^11.0.0",
48
49
  "terser": "^5.46.0",
49
50
  "typescript": "^5.3.3",
50
- "vite": "^5.1.0"
51
+ "vite": "^5.1.0",
52
+ "vue": "^3.5.21"
51
53
  },
52
54
  "dependencies": {
53
55
  "dompurify": "^3.4.12",