@car-cutter/vue-webplayer 3.0.0 → 3.0.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
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),e=require("./utils-CbTbWQZC.cjs"),O=require("@car-cutter/wc-webplayer"),C=o.defineComponent({__name:"WebPlayer",props:{compositionUrl:{},integration:{type:Boolean},maxItemsShown:{},hideCategoriesNav:{type:Boolean},infiniteCarrousel:{type:Boolean},permanentGallery:{type:Boolean},mediaLoadStrategy:{},minMediaWidth:{},maxMediaWidth:{},preloadRange:{},autoLoad360:{type:Boolean},autoLoadInterior360:{type:Boolean},categoriesFilter:{},extendBehavior:{},eventPrefix:{},demoSpin:{type:Boolean},reverse360:{type:Boolean},class:{},style:{}},emits:["compositionLoading","compositionLoaded","compositionLoadError","itemChange","extendModeOn","extendModeOff","hotspotsOn","hotspotsOff","galleryOpen","galleryClose"],setup(_,{emit:s}){O.ensureCustomElementsDefinition();const r=_,{class:a,style:i,...c}=r,l={display:"block",...i??{}},N=O.webPlayerPropsToAttributes(c),E=s,p=r.eventPrefix??e.DEFAULT_EVENT_PREFIX,d=t=>`${p}${t}`,m={[e.EVENT_COMPOSITION_LOADING]:t=>E("compositionLoading",t),[e.EVENT_COMPOSITION_LOADED]:t=>E("compositionLoaded",t),[e.EVENT_COMPOSITION_LOAD_ERROR]:t=>E("compositionLoadError",t),[e.EVENT_ITEM_CHANGE]:t=>E("itemChange",t),[e.EVENT_EXTEND_MODE_ON]:()=>E("extendModeOn"),[e.EVENT_EXTEND_MODE_OFF]:()=>E("extendModeOff"),[e.EVENT_HOTSPOTS_ON]:()=>E("hotspotsOn"),[e.EVENT_HOTSPOTS_OFF]:()=>E("hotspotsOff"),[e.EVENT_GALLERY_OPEN]:()=>E("galleryOpen"),[e.EVENT_GALLERY_CLOSE]:()=>E("galleryClose")},T=new Map;return Object.entries(m).forEach(([t,n])=>{if(!n)return;const P=d(t),u=L=>n(L.detail);T.set(P,u)}),o.onMounted(()=>{T.forEach((t,n)=>{document.addEventListener(n,t)})}),o.onUnmounted(()=>{T.forEach((t,n)=>{document.removeEventListener(n,t)})}),(t,n)=>(o.openBlock(),o.createElementBlock("cc-webplayer",o.mergeProps(o.unref(N),{class:o.unref(a),style:l}),[o.renderSlot(t.$slots,"default")],16))}}),A=o.defineComponent({__name:"WebPlayerCustomMedia",props:{index:{},thumbnailSrc:{}},setup(_){const s=_,r=O.webPlayerCustomMediaPropsToAttributes(s);return(a,i)=>(o.openBlock(),o.createElementBlock("cc-webplayer-custom-media",o.normalizeProps(o.guardReactiveProps(o.unref(r))),[o.renderSlot(a.$slots,"default")],16))}}),I=o.defineComponent({__name:"WebPlayerIcon",props:{name:{}},setup(_){const s=_,r=O.webPlayerIconPropsToAttributes(s);return(a,i)=>(o.openBlock(),o.createElementBlock("cc-webplayer-icon",o.normalizeProps(o.guardReactiveProps(o.unref(r))),[o.renderSlot(a.$slots,"default")],16))}});exports.DEFAULT_EVENT_PREFIX=e.DEFAULT_EVENT_PREFIX;exports.EVENT_COMPOSITION_LOADED=e.EVENT_COMPOSITION_LOADED;exports.EVENT_COMPOSITION_LOADING=e.EVENT_COMPOSITION_LOADING;exports.EVENT_COMPOSITION_LOAD_ERROR=e.EVENT_COMPOSITION_LOAD_ERROR;exports.EVENT_EXTEND_MODE_OFF=e.EVENT_EXTEND_MODE_OFF;exports.EVENT_EXTEND_MODE_ON=e.EVENT_EXTEND_MODE_ON;exports.EVENT_GALLERY_CLOSE=e.EVENT_GALLERY_CLOSE;exports.EVENT_GALLERY_OPEN=e.EVENT_GALLERY_OPEN;exports.EVENT_HOTSPOTS_OFF=e.EVENT_HOTSPOTS_OFF;exports.EVENT_HOTSPOTS_ON=e.EVENT_HOTSPOTS_ON;exports.EVENT_ITEM_CHANGE=e.EVENT_ITEM_CHANGE;exports.WEB_PLAYER_CUSTOM_MEDIA_WC_TAG=e.WEB_PLAYER_CUSTOM_MEDIA_WC_TAG;exports.WEB_PLAYER_ICON_WC_TAG=e.WEB_PLAYER_ICON_WC_TAG;exports.WEB_PLAYER_WC_TAG=e.WEB_PLAYER_WC_TAG;exports.generateCompositionUrl=e.generateCompositionUrl;exports.WebPlayer=C;exports.WebPlayerCustomMedia=A;exports.WebPlayerIcon=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),e=require("./utils-Bfc4MSUL.cjs"),i=require("@car-cutter/wc-webplayer"),S=n.defineComponent({__name:"WebPlayer",props:{compositionUrl:{},integration:{type:Boolean},maxItemsShown:{},hideCategoriesNav:{type:Boolean},infiniteCarrousel:{type:Boolean},permanentGallery:{type:Boolean},mediaLoadStrategy:{},minMediaWidth:{},maxMediaWidth:{},preloadRange:{},autoLoad360:{type:Boolean},autoLoadInterior360:{type:Boolean},categoriesFilter:{},extendBehavior:{},eventPrefix:{},demoSpin:{type:Boolean},reverse360:{type:Boolean},analyticsEventPrefix:{},analyticsUrl:{},analyticsBearer:{},analyticsSimpleRequestsOnly:{type:Boolean},analyticsDryRun:{type:Boolean},analyticsDebug:{type:Boolean},class:{},style:{}},emits:["compositionLoading","compositionLoaded","compositionLoadError","itemChange","extendModeOn","extendModeOff","hotspotsOn","hotspotsOff","galleryOpen","galleryClose","analyticsIdentify","analyticsPage","analyticsTrack"],setup(r,{emit:s}){i.ensureCustomElementsDefinition();const a=r,{class:_,style:c,...A}=a,d={display:"block",...c??{}},L=i.webPlayerPropsToAttributes(A),E=s,m=a.eventPrefix??e.DEFAULT_EVENT_PREFIX,y=a.analyticsEventPrefix??e.DEFAULT_ANALYTICS_EVENT_PREFIX,P=t=>`${m}${t}`,C=t=>`${y}${t}`,I={[e.EVENT_COMPOSITION_LOADING]:t=>E("compositionLoading",t),[e.EVENT_COMPOSITION_LOADED]:t=>E("compositionLoaded",t),[e.EVENT_COMPOSITION_LOAD_ERROR]:t=>E("compositionLoadError",t),[e.EVENT_ITEM_CHANGE]:t=>E("itemChange",t),[e.EVENT_EXTEND_MODE_ON]:()=>E("extendModeOn"),[e.EVENT_EXTEND_MODE_OFF]:()=>E("extendModeOff"),[e.EVENT_HOTSPOTS_ON]:()=>E("hotspotsOn"),[e.EVENT_HOTSPOTS_OFF]:()=>E("hotspotsOff"),[e.EVENT_GALLERY_OPEN]:()=>E("galleryOpen"),[e.EVENT_GALLERY_CLOSE]:()=>E("galleryClose")},u={[e.ANALYTICS_EVENT_IDENTIFY]:t=>E("analyticsIdentify",t),[e.ANALYTICS_EVENT_PAGE]:t=>E("analyticsPage",t),[e.ANALYTICS_EVENT_TRACK]:t=>E("analyticsTrack",t)},T=new Map,l=new Map;return Object.entries(I).forEach(([t,o])=>{if(!o)return;const N=P(t),O=p=>o(p.detail);T.set(N,O)}),Object.entries(u).forEach(([t,o])=>{if(!o)return;const N=C(t),O=p=>o(p.detail);l.set(N,O)}),n.onMounted(()=>{T.forEach((t,o)=>{document.addEventListener(o,t)}),l.forEach((t,o)=>{document.addEventListener(o,t)})}),n.onUnmounted(()=>{T.forEach((t,o)=>{document.removeEventListener(o,t)}),l.forEach((t,o)=>{document.removeEventListener(o,t)})}),(t,o)=>(n.openBlock(),n.createElementBlock("cc-webplayer",n.mergeProps(n.unref(L),{class:n.unref(_),style:d}),[n.renderSlot(t.$slots,"default")],16))}}),V=n.defineComponent({__name:"WebPlayerCustomMedia",props:{index:{},thumbnailSrc:{}},setup(r){const s=r,a=i.webPlayerCustomMediaPropsToAttributes(s);return(_,c)=>(n.openBlock(),n.createElementBlock("cc-webplayer-custom-media",n.normalizeProps(n.guardReactiveProps(n.unref(a))),[n.renderSlot(_.$slots,"default")],16))}}),f=n.defineComponent({__name:"WebPlayerIcon",props:{name:{}},setup(r){const s=r,a=i.webPlayerIconPropsToAttributes(s);return(_,c)=>(n.openBlock(),n.createElementBlock("cc-webplayer-icon",n.normalizeProps(n.guardReactiveProps(n.unref(a))),[n.renderSlot(_.$slots,"default")],16))}});exports.ANALYTICS_EVENT_IDENTIFY=e.ANALYTICS_EVENT_IDENTIFY;exports.ANALYTICS_EVENT_PAGE=e.ANALYTICS_EVENT_PAGE;exports.ANALYTICS_EVENT_TRACK=e.ANALYTICS_EVENT_TRACK;exports.DEFAULT_EVENT_PREFIX=e.DEFAULT_EVENT_PREFIX;exports.EVENT_COMPOSITION_LOADED=e.EVENT_COMPOSITION_LOADED;exports.EVENT_COMPOSITION_LOADING=e.EVENT_COMPOSITION_LOADING;exports.EVENT_COMPOSITION_LOAD_ERROR=e.EVENT_COMPOSITION_LOAD_ERROR;exports.EVENT_EXTEND_MODE_OFF=e.EVENT_EXTEND_MODE_OFF;exports.EVENT_EXTEND_MODE_ON=e.EVENT_EXTEND_MODE_ON;exports.EVENT_GALLERY_CLOSE=e.EVENT_GALLERY_CLOSE;exports.EVENT_GALLERY_OPEN=e.EVENT_GALLERY_OPEN;exports.EVENT_HOTSPOTS_OFF=e.EVENT_HOTSPOTS_OFF;exports.EVENT_HOTSPOTS_ON=e.EVENT_HOTSPOTS_ON;exports.EVENT_ITEM_CHANGE=e.EVENT_ITEM_CHANGE;exports.WEB_PLAYER_CUSTOM_MEDIA_WC_TAG=e.WEB_PLAYER_CUSTOM_MEDIA_WC_TAG;exports.WEB_PLAYER_ICON_WC_TAG=e.WEB_PLAYER_ICON_WC_TAG;exports.WEB_PLAYER_WC_TAG=e.WEB_PLAYER_WC_TAG;exports.generateCompositionUrl=e.generateCompositionUrl;exports.WebPlayer=S;exports.WebPlayerCustomMedia=V;exports.WebPlayerIcon=f;
package/dist/index.d.ts CHANGED
@@ -17,6 +17,9 @@ hotspotsOn: () => any;
17
17
  hotspotsOff: () => any;
18
18
  galleryOpen: () => any;
19
19
  galleryClose: () => any;
20
+ analyticsIdentify: (event: AnalyticsIdentifyEvent) => any;
21
+ analyticsPage: (event: AnalyticsPageEvent) => any;
22
+ analyticsTrack: (event: AnalyticsTrackEvent) => any;
20
23
  }, string, PublicProps, Readonly<WebPlayerProps> & Readonly<{
21
24
  onCompositionLoading?: ((url: string) => any) | undefined;
22
25
  onCompositionLoaded?: ((composition: Composition) => any) | undefined;
@@ -31,6 +34,9 @@ onHotspotsOn?: (() => any) | undefined;
31
34
  onHotspotsOff?: (() => any) | undefined;
32
35
  onGalleryOpen?: (() => any) | undefined;
33
36
  onGalleryClose?: (() => any) | undefined;
37
+ onAnalyticsIdentify?: ((event: AnalyticsIdentifyEvent) => any) | undefined;
38
+ onAnalyticsPage?: ((event: AnalyticsPageEvent) => any) | undefined;
39
+ onAnalyticsTrack?: ((event: AnalyticsTrackEvent) => any) | undefined;
34
40
  }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
35
41
 
36
42
  declare const __VLS_component_2: DefineComponent<WebPlayerCustomMediaProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<WebPlayerCustomMediaProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
@@ -85,6 +91,107 @@ declare type __VLS_WithTemplateSlots_3<T, S> = T & {
85
91
  };
86
92
  };
87
93
 
94
+ export declare const ANALYTICS_EVENT_IDENTIFY = "analytics-identify";
95
+
96
+ export declare const ANALYTICS_EVENT_PAGE = "analytics-page";
97
+
98
+ export declare const ANALYTICS_EVENT_TRACK = "analytics-track";
99
+
100
+ declare type AnalyticsEventBase = {
101
+ type: AnalyticsEventType;
102
+ timestamp: string;
103
+ instance_id: string;
104
+ };
105
+
106
+ declare type AnalyticsEventType =
107
+ | AnalyticsEventTypeIdentify
108
+ | AnalyticsEventTypePage
109
+ | AnalyticsEventTypeTrack;
110
+
111
+ declare type AnalyticsEventTypeIdentify = "identify";
112
+
113
+ declare type AnalyticsEventTypePage = "page";
114
+
115
+ declare type AnalyticsEventTypeTrack = "track";
116
+
117
+ declare type AnalyticsIdentifyEvent = Omit<AnalyticsEventBase, "type"> &
118
+ AnalyticsIdentifyEventProps;
119
+
120
+ declare type AnalyticsIdentifyEventProps = {
121
+ type: AnalyticsEventTypeIdentify;
122
+ browser_id: string;
123
+ session_id: string;
124
+ referrer: string;
125
+ origin: string;
126
+ page_url: string;
127
+ user_agent: string;
128
+ wp_properties: {
129
+ composition_url: string;
130
+
131
+ // Integration mode
132
+ integration: boolean;
133
+ max_items_shown: number;
134
+
135
+ // Layout
136
+ hide_categories_nav: boolean;
137
+ infinite_carrousel: boolean;
138
+ permanent_gallery: boolean;
139
+
140
+ // Medias loading
141
+ media_load_strategy: string;
142
+ min_media_width: number;
143
+ max_media_width: number;
144
+ preload_range: number;
145
+ auto_load_360: boolean;
146
+ auto_load_interior_360: boolean;
147
+
148
+ // Miscellaneous
149
+ categories_filter: string;
150
+ extend_behavior: string;
151
+ event_prefix: string;
152
+ demo_spin: boolean;
153
+ reverse_360: boolean;
154
+ };
155
+ };
156
+
157
+ declare type AnalyticsPageEvent = Omit<AnalyticsEventBase, "type"> &
158
+ AnalyticsPageEventProps;
159
+
160
+ declare type AnalyticsPageEventProps = {
161
+ type: AnalyticsEventTypePage;
162
+ category_id: string;
163
+ category_name: string;
164
+ items_count: number;
165
+ page_properties: {
166
+ item_type: string;
167
+ item_position: number;
168
+ };
169
+ };
170
+
171
+ declare type AnalyticsTrackEvent = Omit<AnalyticsEventBase, "type"> &
172
+ AnalyticsTrackEventProps;
173
+
174
+ declare type AnalyticsTrackEventProps = {
175
+ type: AnalyticsEventTypeTrack;
176
+ category_id: string;
177
+ category_name: string;
178
+ item_type: string;
179
+ item_position: number;
180
+ action_properties: {
181
+ action_name: string;
182
+ action_field: string;
183
+ action_value:
184
+ | bigint
185
+ | boolean
186
+ | null
187
+ | number
188
+ | string
189
+ | symbol
190
+ | undefined
191
+ | object;
192
+ };
193
+ };
194
+
88
195
  declare type AspectRatio = `${number}:${number}`;
89
196
 
90
197
  declare type Category = {
@@ -127,7 +234,7 @@ declare type ExtendBehavior = "full_screen" | "event" | "none";
127
234
  /**
128
235
  * Generates a URL for fetching the composition JSON for a given customer and vehicle.
129
236
  *
130
- * @param {string} customerToken - The CarCutter Customer Token (computed by hasing the Customer ID with SHA-256).
237
+ * @param {string} customerToken - The CarCutter Customer Token (computed by hashing the Customer ID with SHA-256).
131
238
  * @param {string} vin - The Vehicle Identification Number.
132
239
  * @returns {string} The URL to fetch the composition JSON.
133
240
  */
@@ -142,6 +249,7 @@ declare type Hotspot = {
142
249
  title: string;
143
250
  icon?: string;
144
251
  description?: string;
252
+ type?: "damage" | "feature";
145
253
  position: {
146
254
  x: number;
147
255
  y: number;
@@ -214,6 +322,9 @@ export declare type WebPlayerEvents = {
214
322
  hotspotsOff: [];
215
323
  galleryOpen: [];
216
324
  galleryClose: [];
325
+ analyticsIdentify: [event: AnalyticsIdentifyEvent];
326
+ analyticsPage: [event: AnalyticsPageEvent];
327
+ analyticsTrack: [event: AnalyticsTrackEvent];
217
328
  };
218
329
 
219
330
  export declare const WebPlayerIcon: __VLS_WithTemplateSlots_3<typeof __VLS_component_3, __VLS_TemplateResult_3["slots"]>;
@@ -231,8 +342,10 @@ declare type WebPlayerIconName =
231
342
  | "UI_PLAY" // Play video
232
343
  | "UI_PLUS" // Increase zoom
233
344
  | "UI_REDUCE" // Reducing an extended view
234
- | "UI_360" // 360-degree view
235
- | "UI_INTERIOR_360" // interior 360 view
345
+ | "UI_360" // Exterior 360 view
346
+ | "UI_360_PLAY" // Play exterior 360
347
+ | "UI_INTERIOR_360" // Interior 360 view
348
+ | "UI_INTERIOR_360_PLAY" // Play interior 360 view
236
349
  | "UI_VOLUME" // Video volume
237
350
  | "UI_VOLUME_OFF" // Muted video
238
351
  | "CONTROLS_PREV" // Go to previous media
@@ -275,6 +388,14 @@ declare type WebPlayerProps_2 = {
275
388
  eventPrefix?: string;
276
389
  demoSpin?: boolean;
277
390
  reverse360?: boolean;
391
+
392
+ // Analytics
393
+ analyticsEventPrefix?: string;
394
+ analyticsUrl?: string;
395
+ analyticsBearer?: string;
396
+ analyticsSimpleRequestsOnly?: boolean;
397
+ analyticsDryRun?: boolean;
398
+ analyticsDebug?: boolean;
278
399
  };
279
400
 
280
401
  export { }
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { defineComponent as l, onMounted as M, onUnmounted as h, createElementBlock as E, openBlock as _, mergeProps as g, unref as r, renderSlot as m, normalizeProps as d, guardReactiveProps as O } from "vue";
2
- import { D as A, E as I, a as v, b as W, c as B, d as S, e as x, f as D, g as R, h as V, i as w } from "./utils-TWVtfImY.js";
3
- import { j as K, k as Q, W as Z, l as ee } from "./utils-TWVtfImY.js";
4
- import { ensureCustomElementsDefinition as G, webPlayerPropsToAttributes as F, webPlayerCustomMediaPropsToAttributes as $, webPlayerIconPropsToAttributes as U } from "@car-cutter/wc-webplayer";
5
- const X = /* @__PURE__ */ l({
1
+ import { defineComponent as d, onMounted as g, onUnmounted as h, createElementBlock as y, openBlock as T, mergeProps as S, unref as r, renderSlot as u, normalizeProps as O, guardReactiveProps as f } from "vue";
2
+ import { D as B, a as x, E as D, b as R, c as V, d as W, e as w, f as F, g as Y, h as G, i as $, j as U, A as k, k as X, l as j } from "./utils-BfR5YfQn.js";
3
+ import { m as se, n as re, W as ie, o as ce } from "./utils-BfR5YfQn.js";
4
+ import { ensureCustomElementsDefinition as H, webPlayerPropsToAttributes as q, webPlayerCustomMediaPropsToAttributes as z, webPlayerIconPropsToAttributes as K } from "@car-cutter/wc-webplayer";
5
+ const ee = /* @__PURE__ */ d({
6
6
  __name: "WebPlayer",
7
7
  props: {
8
8
  compositionUrl: {},
@@ -22,85 +22,107 @@ const X = /* @__PURE__ */ l({
22
22
  eventPrefix: {},
23
23
  demoSpin: { type: Boolean },
24
24
  reverse360: { type: Boolean },
25
+ analyticsEventPrefix: {},
26
+ analyticsUrl: {},
27
+ analyticsBearer: {},
28
+ analyticsSimpleRequestsOnly: { type: Boolean },
29
+ analyticsDryRun: { type: Boolean },
30
+ analyticsDebug: { type: Boolean },
25
31
  class: {},
26
32
  style: {}
27
33
  },
28
- emits: ["compositionLoading", "compositionLoaded", "compositionLoadError", "itemChange", "extendModeOn", "extendModeOff", "hotspotsOn", "hotspotsOff", "galleryOpen", "galleryClose"],
34
+ emits: ["compositionLoading", "compositionLoaded", "compositionLoadError", "itemChange", "extendModeOn", "extendModeOff", "hotspotsOn", "hotspotsOff", "galleryOpen", "galleryClose", "analyticsIdentify", "analyticsPage", "analyticsTrack"],
29
35
  setup(n, { emit: i }) {
30
- G();
31
- const s = n, { class: a, style: p, ...u } = s, y = { display: "block", ...p ?? {} }, f = F(u), o = i, P = s.eventPrefix ?? A, T = (e) => `${P}${e}`, L = {
32
- [w]: (e) => o("compositionLoading", e),
33
- [V]: (e) => o("compositionLoaded", e),
34
- [R]: (e) => o("compositionLoadError", e),
35
- [D]: (e) => o("itemChange", e),
36
- [x]: () => o("extendModeOn"),
37
- [S]: () => o("extendModeOff"),
38
- [B]: () => o("hotspotsOn"),
39
- [W]: () => o("hotspotsOff"),
40
- [v]: () => o("galleryOpen"),
41
- [I]: () => o("galleryClose")
42
- }, c = /* @__PURE__ */ new Map();
43
- return Object.entries(L).forEach(([e, t]) => {
36
+ H();
37
+ const a = n, { class: s, style: c, ...N } = a, P = { display: "block", ...c ?? {} }, L = q(N), o = i, A = a.eventPrefix ?? B, C = a.analyticsEventPrefix ?? x, b = (e) => `${A}${e}`, v = (e) => `${C}${e}`, I = {
38
+ [U]: (e) => o("compositionLoading", e),
39
+ [$]: (e) => o("compositionLoaded", e),
40
+ [G]: (e) => o("compositionLoadError", e),
41
+ [Y]: (e) => o("itemChange", e),
42
+ [F]: () => o("extendModeOn"),
43
+ [w]: () => o("extendModeOff"),
44
+ [W]: () => o("hotspotsOn"),
45
+ [V]: () => o("hotspotsOff"),
46
+ [R]: () => o("galleryOpen"),
47
+ [D]: () => o("galleryClose")
48
+ }, M = {
49
+ [j]: (e) => o("analyticsIdentify", e),
50
+ [X]: (e) => o("analyticsPage", e),
51
+ [k]: (e) => o("analyticsTrack", e)
52
+ }, l = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map();
53
+ return Object.entries(I).forEach(([e, t]) => {
44
54
  if (!t)
45
55
  return;
46
- const N = T(e), b = (C) => t(C.detail);
47
- c.set(N, b);
48
- }), M(() => {
49
- c.forEach((e, t) => {
56
+ const p = b(e), _ = (m) => t(m.detail);
57
+ l.set(p, _);
58
+ }), Object.entries(M).forEach(([e, t]) => {
59
+ if (!t)
60
+ return;
61
+ const p = v(e), _ = (m) => t(m.detail);
62
+ E.set(p, _);
63
+ }), g(() => {
64
+ l.forEach((e, t) => {
65
+ document.addEventListener(t, e);
66
+ }), E.forEach((e, t) => {
50
67
  document.addEventListener(t, e);
51
68
  });
52
69
  }), h(() => {
53
- c.forEach((e, t) => {
70
+ l.forEach((e, t) => {
71
+ document.removeEventListener(t, e);
72
+ }), E.forEach((e, t) => {
54
73
  document.removeEventListener(t, e);
55
74
  });
56
- }), (e, t) => (_(), E("cc-webplayer", g(r(f), {
57
- class: r(a),
58
- style: y
75
+ }), (e, t) => (T(), y("cc-webplayer", S(r(L), {
76
+ class: r(s),
77
+ style: P
59
78
  }), [
60
- m(e.$slots, "default")
79
+ u(e.$slots, "default")
61
80
  ], 16));
62
81
  }
63
- }), j = /* @__PURE__ */ l({
82
+ }), te = /* @__PURE__ */ d({
64
83
  __name: "WebPlayerCustomMedia",
65
84
  props: {
66
85
  index: {},
67
86
  thumbnailSrc: {}
68
87
  },
69
88
  setup(n) {
70
- const s = $(n);
71
- return (a, p) => (_(), E("cc-webplayer-custom-media", d(O(r(s))), [
72
- m(a.$slots, "default")
89
+ const a = z(n);
90
+ return (s, c) => (T(), y("cc-webplayer-custom-media", O(f(r(a))), [
91
+ u(s.$slots, "default")
73
92
  ], 16));
74
93
  }
75
- }), z = /* @__PURE__ */ l({
94
+ }), oe = /* @__PURE__ */ d({
76
95
  __name: "WebPlayerIcon",
77
96
  props: {
78
97
  name: {}
79
98
  },
80
99
  setup(n) {
81
- const s = U(n);
82
- return (a, p) => (_(), E("cc-webplayer-icon", d(O(r(s))), [
83
- m(a.$slots, "default")
100
+ const a = K(n);
101
+ return (s, c) => (T(), y("cc-webplayer-icon", O(f(r(a))), [
102
+ u(s.$slots, "default")
84
103
  ], 16));
85
104
  }
86
105
  });
87
106
  export {
88
- A as DEFAULT_EVENT_PREFIX,
89
- V as EVENT_COMPOSITION_LOADED,
90
- w as EVENT_COMPOSITION_LOADING,
91
- R as EVENT_COMPOSITION_LOAD_ERROR,
92
- S as EVENT_EXTEND_MODE_OFF,
93
- x as EVENT_EXTEND_MODE_ON,
94
- I as EVENT_GALLERY_CLOSE,
95
- v as EVENT_GALLERY_OPEN,
96
- W as EVENT_HOTSPOTS_OFF,
97
- B as EVENT_HOTSPOTS_ON,
98
- D as EVENT_ITEM_CHANGE,
99
- K as WEB_PLAYER_CUSTOM_MEDIA_WC_TAG,
100
- Q as WEB_PLAYER_ICON_WC_TAG,
101
- Z as WEB_PLAYER_WC_TAG,
102
- X as WebPlayer,
103
- j as WebPlayerCustomMedia,
104
- z as WebPlayerIcon,
105
- ee as generateCompositionUrl
107
+ j as ANALYTICS_EVENT_IDENTIFY,
108
+ X as ANALYTICS_EVENT_PAGE,
109
+ k as ANALYTICS_EVENT_TRACK,
110
+ B as DEFAULT_EVENT_PREFIX,
111
+ $ as EVENT_COMPOSITION_LOADED,
112
+ U as EVENT_COMPOSITION_LOADING,
113
+ G as EVENT_COMPOSITION_LOAD_ERROR,
114
+ w as EVENT_EXTEND_MODE_OFF,
115
+ F as EVENT_EXTEND_MODE_ON,
116
+ D as EVENT_GALLERY_CLOSE,
117
+ R as EVENT_GALLERY_OPEN,
118
+ V as EVENT_HOTSPOTS_OFF,
119
+ W as EVENT_HOTSPOTS_ON,
120
+ Y as EVENT_ITEM_CHANGE,
121
+ se as WEB_PLAYER_CUSTOM_MEDIA_WC_TAG,
122
+ re as WEB_PLAYER_ICON_WC_TAG,
123
+ ie as WEB_PLAYER_WC_TAG,
124
+ ee as WebPlayer,
125
+ te as WebPlayerCustomMedia,
126
+ oe as WebPlayerIcon,
127
+ ce as generateCompositionUrl
106
128
  };
@@ -0,0 +1,25 @@
1
+ const s = "cc-webplayer", c = "cc-webplayer-custom-media", _ = "cc-webplayer-icon", t = "composition-loading", a = "composition-loaded", n = "composition-load-error", T = "item-change", e = "extend-mode-on", N = "extend-mode-off", O = "hotspots-on", A = "hotspots-off", i = "gallery-open", l = "gallery-close", r = "analytics-identify", I = "analytics-page", L = "analytics-track", C = "cc-webplayer:", p = "cc-analytics:";
2
+ function V(E, o) {
3
+ return `https://cdn.car-cutter.com/gallery/${E}/${o}/composition_v3.json`;
4
+ }
5
+ export {
6
+ L as A,
7
+ C as D,
8
+ l as E,
9
+ s as W,
10
+ p as a,
11
+ i as b,
12
+ A as c,
13
+ O as d,
14
+ N as e,
15
+ e as f,
16
+ T as g,
17
+ n as h,
18
+ a as i,
19
+ t as j,
20
+ I as k,
21
+ r as l,
22
+ c as m,
23
+ _ as n,
24
+ V as o
25
+ };
@@ -0,0 +1 @@
1
+ "use strict";const T="cc-webplayer",N="cc-webplayer-custom-media",o="cc-webplayer-icon",O="composition-loading",A="composition-loaded",t="composition-load-error",c="item-change",n="extend-mode-on",s="extend-mode-off",I="hotspots-on",e="hotspots-off",L="gallery-open",C="gallery-close",V="analytics-identify",S="analytics-page",a="analytics-track",i="cc-webplayer:",D="cc-analytics:";function P(E,_){return`https://cdn.car-cutter.com/gallery/${E}/${_}/composition_v3.json`}exports.ANALYTICS_EVENT_IDENTIFY=V;exports.ANALYTICS_EVENT_PAGE=S;exports.ANALYTICS_EVENT_TRACK=a;exports.DEFAULT_ANALYTICS_EVENT_PREFIX=D;exports.DEFAULT_EVENT_PREFIX=i;exports.EVENT_COMPOSITION_LOADED=A;exports.EVENT_COMPOSITION_LOADING=O;exports.EVENT_COMPOSITION_LOAD_ERROR=t;exports.EVENT_EXTEND_MODE_OFF=s;exports.EVENT_EXTEND_MODE_ON=n;exports.EVENT_GALLERY_CLOSE=C;exports.EVENT_GALLERY_OPEN=L;exports.EVENT_HOTSPOTS_OFF=e;exports.EVENT_HOTSPOTS_ON=I;exports.EVENT_ITEM_CHANGE=c;exports.WEB_PLAYER_CUSTOM_MEDIA_WC_TAG=N;exports.WEB_PLAYER_ICON_WC_TAG=o;exports.WEB_PLAYER_WC_TAG=T;exports.generateCompositionUrl=P;
package/dist/vue2.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),e=require("./utils-CbTbWQZC.cjs"),_=require("@car-cutter/wc-webplayer");_.ensureCustomElementsDefinition();const O=t.defineComponent({props:{compositionUrl:{type:String,required:!0},hideCategoriesNav:Boolean,infiniteCarrousel:Boolean,permanentGallery:Boolean,mediaLoadStrategy:String,minMediaWidth:Number,maxMediaWidth:Number,preloadRange:Number,autoLoad360:Boolean,autoLoadInterior360:Boolean,categoriesFilter:String,extendBehavior:String,eventPrefix:String,demoSpin:Boolean,reverse360:Boolean},data(){return{eventCbMap:new Map}},computed:{attributes(){return _.webPlayerPropsToAttributes(this.$props)}},methods:{generateEventName(r){return`${this.eventPrefix||e.DEFAULT_EVENT_PREFIX}${r}`},setupEventListeners(){const r={[e.EVENT_COMPOSITION_LOADING]:o=>this.$emit("compositionLoading",o),[e.EVENT_COMPOSITION_LOADED]:o=>this.$emit("compositionLoaded",o),[e.EVENT_COMPOSITION_LOAD_ERROR]:o=>this.$emit("compositionLoadError",o),[e.EVENT_ITEM_CHANGE]:o=>this.$emit("itemChange",o),[e.EVENT_EXTEND_MODE_ON]:()=>this.$emit("extendModeOn"),[e.EVENT_EXTEND_MODE_OFF]:()=>this.$emit("extendModeOff"),[e.EVENT_HOTSPOTS_ON]:()=>this.$emit("hotspotsOn"),[e.EVENT_HOTSPOTS_OFF]:()=>this.$emit("hotspotsOff"),[e.EVENT_GALLERY_OPEN]:()=>this.$emit("galleryOpen"),[e.EVENT_GALLERY_CLOSE]:()=>this.$emit("galleryClose")};Object.entries(r).forEach(([o,n])=>{if(!n)return;const E=this.generateEventName(o),i=s=>n(s.detail);this.eventCbMap.set(E,i),document.addEventListener(E,i)})}},mounted(){this.setupEventListeners()},beforeDestroy(){this.eventCbMap.forEach((r,o)=>{document.removeEventListener(o,r)})}}),a=(r,o)=>{const n=r.__vccOpts||r;for(const[E,i]of o)n[E]=i;return n};function T(r,o,n,E,i,s){return t.openBlock(),t.createElementBlock("cc-webplayer",t.normalizeProps(t.guardReactiveProps(r.attributes)),[t.renderSlot(r.$slots,"default")],16)}const N=a(O,[["render",T]]),p=t.defineComponent({props:{index:{type:Number,required:!0},thumbnailSrc:String},computed:{attributes(){return _.webPlayerCustomMediaPropsToAttributes(this.$props)}}});function c(r,o,n,E,i,s){return t.openBlock(),t.createElementBlock("cc-webplayer-custom-media",t.normalizeProps(t.guardReactiveProps(r.attributes)),[t.renderSlot(r.$slots,"default")],16)}const u=a(p,[["render",c]]),d=t.defineComponent({props:{name:{type:String,required:!0}},computed:{attributes(){return _.webPlayerIconPropsToAttributes(this.$props)}}});function l(r,o,n,E,i,s){return t.openBlock(),t.createElementBlock("cc-webplayer-icon",t.normalizeProps(t.guardReactiveProps(r.attributes)),[t.renderSlot(r.$slots,"default")],16)}const m=a(d,[["render",l]]);exports.DEFAULT_EVENT_PREFIX=e.DEFAULT_EVENT_PREFIX;exports.EVENT_COMPOSITION_LOADED=e.EVENT_COMPOSITION_LOADED;exports.EVENT_COMPOSITION_LOADING=e.EVENT_COMPOSITION_LOADING;exports.EVENT_COMPOSITION_LOAD_ERROR=e.EVENT_COMPOSITION_LOAD_ERROR;exports.EVENT_EXTEND_MODE_OFF=e.EVENT_EXTEND_MODE_OFF;exports.EVENT_EXTEND_MODE_ON=e.EVENT_EXTEND_MODE_ON;exports.EVENT_GALLERY_CLOSE=e.EVENT_GALLERY_CLOSE;exports.EVENT_GALLERY_OPEN=e.EVENT_GALLERY_OPEN;exports.EVENT_HOTSPOTS_OFF=e.EVENT_HOTSPOTS_OFF;exports.EVENT_HOTSPOTS_ON=e.EVENT_HOTSPOTS_ON;exports.EVENT_ITEM_CHANGE=e.EVENT_ITEM_CHANGE;exports.WEB_PLAYER_CUSTOM_MEDIA_WC_TAG=e.WEB_PLAYER_CUSTOM_MEDIA_WC_TAG;exports.WEB_PLAYER_ICON_WC_TAG=e.WEB_PLAYER_ICON_WC_TAG;exports.WEB_PLAYER_WC_TAG=e.WEB_PLAYER_WC_TAG;exports.generateCompositionUrl=e.generateCompositionUrl;exports.WebPlayer=N;exports.WebPlayerCustomMedia=u;exports.WebPlayerIcon=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue"),e=require("./utils-Bfc4MSUL.cjs"),a=require("@car-cutter/wc-webplayer");a.ensureCustomElementsDefinition();const T=r.defineComponent({props:{compositionUrl:{type:String,required:!0},hideCategoriesNav:Boolean,infiniteCarrousel:Boolean,permanentGallery:Boolean,mediaLoadStrategy:String,minMediaWidth:Number,maxMediaWidth:Number,preloadRange:Number,autoLoad360:Boolean,autoLoadInterior360:Boolean,categoriesFilter:String,extendBehavior:String,eventPrefix:String,demoSpin:Boolean,reverse360:Boolean,analyticsEventPrefix:String,analyticsUrl:String,analyticsBearer:String,analyticsSimpleRequestsOnly:Boolean,analyticsDryRun:Boolean,analyticsDebug:Boolean},data(){return{eventCbMap:new Map,analyticsEventCbMap:new Map}},computed:{attributes(){return a.webPlayerPropsToAttributes(this.$props)}},methods:{generateEventName(n){return`${this.eventPrefix||e.DEFAULT_EVENT_PREFIX}${n}`},setupEventListeners(){const n={[e.EVENT_COMPOSITION_LOADING]:t=>this.$emit("compositionLoading",t),[e.EVENT_COMPOSITION_LOADED]:t=>this.$emit("compositionLoaded",t),[e.EVENT_COMPOSITION_LOAD_ERROR]:t=>this.$emit("compositionLoadError",t),[e.EVENT_ITEM_CHANGE]:t=>this.$emit("itemChange",t),[e.EVENT_EXTEND_MODE_ON]:()=>this.$emit("extendModeOn"),[e.EVENT_EXTEND_MODE_OFF]:()=>this.$emit("extendModeOff"),[e.EVENT_HOTSPOTS_ON]:()=>this.$emit("hotspotsOn"),[e.EVENT_HOTSPOTS_OFF]:()=>this.$emit("hotspotsOff"),[e.EVENT_GALLERY_OPEN]:()=>this.$emit("galleryOpen"),[e.EVENT_GALLERY_CLOSE]:()=>this.$emit("galleryClose")};Object.entries(n).forEach(([t,E])=>{if(!E)return;const i=this.generateEventName(t),o=s=>E(s.detail);this.eventCbMap.set(i,o),document.addEventListener(i,o)})},generateAnalyticsEventName(n){return`${this.analyticsEventPrefix||e.DEFAULT_ANALYTICS_EVENT_PREFIX}${n}`},setupAnalyticsEventListeners(){const n={[e.ANALYTICS_EVENT_IDENTIFY]:t=>this.$emit("analyticsIdentify",t),[e.ANALYTICS_EVENT_PAGE]:t=>this.$emit("analyticsPage",t),[e.ANALYTICS_EVENT_TRACK]:t=>this.$emit("analyticsTrack",t)};Object.entries(n).forEach(([t,E])=>{if(!E)return;const i=this.generateAnalyticsEventName(t),o=s=>E(s.detail);this.analyticsEventCbMap.set(i,o),document.addEventListener(i,o)})}},mounted(){this.setupEventListeners(),this.setupAnalyticsEventListeners()},beforeDestroy(){this.eventCbMap.forEach((n,t)=>{document.removeEventListener(t,n)}),this.analyticsEventCbMap.forEach((n,t)=>{document.removeEventListener(t,n)})}}),_=(n,t)=>{const E=n.__vccOpts||n;for(const[i,o]of t)E[i]=o;return E};function N(n,t,E,i,o,s){return r.openBlock(),r.createElementBlock("cc-webplayer",r.normalizeProps(r.guardReactiveProps(n.attributes)),[r.renderSlot(n.$slots,"default")],16)}const c=_(T,[["render",N]]),O=r.defineComponent({props:{index:{type:Number,required:!0},thumbnailSrc:String},computed:{attributes(){return a.webPlayerCustomMediaPropsToAttributes(this.$props)}}});function l(n,t,E,i,o,s){return r.openBlock(),r.createElementBlock("cc-webplayer-custom-media",r.normalizeProps(r.guardReactiveProps(n.attributes)),[r.renderSlot(n.$slots,"default")],16)}const p=_(O,[["render",l]]),u=r.defineComponent({props:{name:{type:String,required:!0}},computed:{attributes(){return a.webPlayerIconPropsToAttributes(this.$props)}}});function m(n,t,E,i,o,s){return r.openBlock(),r.createElementBlock("cc-webplayer-icon",r.normalizeProps(r.guardReactiveProps(n.attributes)),[r.renderSlot(n.$slots,"default")],16)}const A=_(u,[["render",m]]);exports.ANALYTICS_EVENT_IDENTIFY=e.ANALYTICS_EVENT_IDENTIFY;exports.ANALYTICS_EVENT_PAGE=e.ANALYTICS_EVENT_PAGE;exports.ANALYTICS_EVENT_TRACK=e.ANALYTICS_EVENT_TRACK;exports.DEFAULT_EVENT_PREFIX=e.DEFAULT_EVENT_PREFIX;exports.EVENT_COMPOSITION_LOADED=e.EVENT_COMPOSITION_LOADED;exports.EVENT_COMPOSITION_LOADING=e.EVENT_COMPOSITION_LOADING;exports.EVENT_COMPOSITION_LOAD_ERROR=e.EVENT_COMPOSITION_LOAD_ERROR;exports.EVENT_EXTEND_MODE_OFF=e.EVENT_EXTEND_MODE_OFF;exports.EVENT_EXTEND_MODE_ON=e.EVENT_EXTEND_MODE_ON;exports.EVENT_GALLERY_CLOSE=e.EVENT_GALLERY_CLOSE;exports.EVENT_GALLERY_OPEN=e.EVENT_GALLERY_OPEN;exports.EVENT_HOTSPOTS_OFF=e.EVENT_HOTSPOTS_OFF;exports.EVENT_HOTSPOTS_ON=e.EVENT_HOTSPOTS_ON;exports.EVENT_ITEM_CHANGE=e.EVENT_ITEM_CHANGE;exports.WEB_PLAYER_CUSTOM_MEDIA_WC_TAG=e.WEB_PLAYER_CUSTOM_MEDIA_WC_TAG;exports.WEB_PLAYER_ICON_WC_TAG=e.WEB_PLAYER_ICON_WC_TAG;exports.WEB_PLAYER_WC_TAG=e.WEB_PLAYER_WC_TAG;exports.generateCompositionUrl=e.generateCompositionUrl;exports.WebPlayer=c;exports.WebPlayerCustomMedia=p;exports.WebPlayerIcon=A;
package/dist/vue2.d.ts CHANGED
@@ -4,6 +4,12 @@ import { DefineComponent } from 'vue';
4
4
  import { ExtractPropTypes } from 'vue';
5
5
  import { PublicProps } from 'vue';
6
6
 
7
+ export declare const ANALYTICS_EVENT_IDENTIFY = "analytics-identify";
8
+
9
+ export declare const ANALYTICS_EVENT_PAGE = "analytics-page";
10
+
11
+ export declare const ANALYTICS_EVENT_TRACK = "analytics-track";
12
+
7
13
  declare type AspectRatio = `${number}:${number}`;
8
14
 
9
15
  declare type CamelToDashed<S extends string> = S extends `${infer T}${infer U}`
@@ -50,7 +56,7 @@ declare type ExtendBehavior = "full_screen" | "event" | "none";
50
56
  /**
51
57
  * Generates a URL for fetching the composition JSON for a given customer and vehicle.
52
58
  *
53
- * @param {string} customerToken - The CarCutter Customer Token (computed by hasing the Customer ID with SHA-256).
59
+ * @param {string} customerToken - The CarCutter Customer Token (computed by hashing the Customer ID with SHA-256).
54
60
  * @param {string} vin - The Vehicle Identification Number.
55
61
  * @returns {string} The URL to fetch the composition JSON.
56
62
  */
@@ -65,6 +71,7 @@ declare type Hotspot = {
65
71
  title: string;
66
72
  icon?: string;
67
73
  description?: string;
74
+ type?: "damage" | "feature";
68
75
  position: {
69
76
  x: number;
70
77
  y: number;
@@ -141,13 +148,22 @@ extendBehavior: StringConstructor;
141
148
  eventPrefix: StringConstructor;
142
149
  demoSpin: BooleanConstructor;
143
150
  reverse360: BooleanConstructor;
151
+ analyticsEventPrefix: StringConstructor;
152
+ analyticsUrl: StringConstructor;
153
+ analyticsBearer: StringConstructor;
154
+ analyticsSimpleRequestsOnly: BooleanConstructor;
155
+ analyticsDryRun: BooleanConstructor;
156
+ analyticsDebug: BooleanConstructor;
144
157
  }>, {}, {
145
158
  eventCbMap: Map<string, EventListener>;
159
+ analyticsEventCbMap: Map<string, EventListener>;
146
160
  }, {
147
161
  attributes(): PropsToAttributes<WebPlayerProps>;
148
162
  }, {
149
163
  generateEventName(event: string): string;
150
164
  setupEventListeners(): void;
165
+ generateAnalyticsEventName(event: string): string;
166
+ setupAnalyticsEventListeners(): void;
151
167
  }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
152
168
  compositionUrl: {
153
169
  type: StringConstructor;
@@ -167,6 +183,12 @@ extendBehavior: StringConstructor;
167
183
  eventPrefix: StringConstructor;
168
184
  demoSpin: BooleanConstructor;
169
185
  reverse360: BooleanConstructor;
186
+ analyticsEventPrefix: StringConstructor;
187
+ analyticsUrl: StringConstructor;
188
+ analyticsBearer: StringConstructor;
189
+ analyticsSimpleRequestsOnly: BooleanConstructor;
190
+ analyticsDryRun: BooleanConstructor;
191
+ analyticsDebug: BooleanConstructor;
170
192
  }>> & Readonly<{}>, {
171
193
  hideCategoriesNav: boolean;
172
194
  infiniteCarrousel: boolean;
@@ -175,6 +197,9 @@ autoLoad360: boolean;
175
197
  autoLoadInterior360: boolean;
176
198
  demoSpin: boolean;
177
199
  reverse360: boolean;
200
+ analyticsSimpleRequestsOnly: boolean;
201
+ analyticsDryRun: boolean;
202
+ analyticsDebug: boolean;
178
203
  }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
179
204
 
180
205
  export declare const WebPlayerCustomMedia: DefineComponent<ExtractPropTypes< {
@@ -225,8 +250,10 @@ declare type WebPlayerIconName =
225
250
  | "UI_PLAY" // Play video
226
251
  | "UI_PLUS" // Increase zoom
227
252
  | "UI_REDUCE" // Reducing an extended view
228
- | "UI_360" // 360-degree view
229
- | "UI_INTERIOR_360" // interior 360 view
253
+ | "UI_360" // Exterior 360 view
254
+ | "UI_360_PLAY" // Play exterior 360
255
+ | "UI_INTERIOR_360" // Interior 360 view
256
+ | "UI_INTERIOR_360_PLAY" // Play interior 360 view
230
257
  | "UI_VOLUME" // Video volume
231
258
  | "UI_VOLUME_OFF" // Muted video
232
259
  | "CONTROLS_PREV" // Go to previous media
@@ -264,6 +291,14 @@ export declare type WebPlayerProps = {
264
291
  eventPrefix?: string;
265
292
  demoSpin?: boolean;
266
293
  reverse360?: boolean;
294
+
295
+ // Analytics
296
+ analyticsEventPrefix?: string;
297
+ analyticsUrl?: string;
298
+ analyticsBearer?: string;
299
+ analyticsSimpleRequestsOnly?: boolean;
300
+ analyticsDryRun?: boolean;
301
+ analyticsDebug?: boolean;
267
302
  };
268
303
 
269
304
  export { }
package/dist/vue2.js CHANGED
@@ -1,9 +1,9 @@
1
- import { defineComponent as i, createElementBlock as a, openBlock as p, normalizeProps as m, guardReactiveProps as E, renderSlot as c } from "vue";
2
- import { D as d, E as _, a as l, b as f, c as O, d as $, e as h, f as N, g as b, h as T, i as P } from "./utils-TWVtfImY.js";
3
- import { j as Y, k, W as U, l as q } from "./utils-TWVtfImY.js";
4
- import { ensureCustomElementsDefinition as L, webPlayerPropsToAttributes as v, webPlayerCustomMediaPropsToAttributes as C, webPlayerIconPropsToAttributes as g } from "@car-cutter/wc-webplayer";
5
- L();
6
- const S = i({
1
+ import { defineComponent as i, createElementBlock as o, openBlock as c, normalizeProps as E, guardReactiveProps as p, renderSlot as m } from "vue";
2
+ import { a as u, D as _, A as d, k as h, l as f, E as N, b as T, c as v, d as $, e as y, f as O, g as L, h as b, i as A, j as P } from "./utils-BfR5YfQn.js";
3
+ import { m as X, n as j, W as H, o as z } from "./utils-BfR5YfQn.js";
4
+ import { ensureCustomElementsDefinition as C, webPlayerPropsToAttributes as g, webPlayerCustomMediaPropsToAttributes as S, webPlayerIconPropsToAttributes as M } from "@car-cutter/wc-webplayer";
5
+ C();
6
+ const I = i({
7
7
  props: {
8
8
  compositionUrl: { type: String, required: !0 },
9
9
  hideCategoriesNav: Boolean,
@@ -19,110 +19,139 @@ const S = i({
19
19
  extendBehavior: String,
20
20
  eventPrefix: String,
21
21
  demoSpin: Boolean,
22
- reverse360: Boolean
22
+ reverse360: Boolean,
23
+ analyticsEventPrefix: String,
24
+ analyticsUrl: String,
25
+ analyticsBearer: String,
26
+ analyticsSimpleRequestsOnly: Boolean,
27
+ analyticsDryRun: Boolean,
28
+ analyticsDebug: Boolean
23
29
  },
24
30
  data() {
25
31
  return {
26
- eventCbMap: /* @__PURE__ */ new Map()
32
+ eventCbMap: /* @__PURE__ */ new Map(),
33
+ analyticsEventCbMap: /* @__PURE__ */ new Map()
27
34
  };
28
35
  },
29
36
  computed: {
30
37
  attributes() {
31
- return v(this.$props);
38
+ return g(this.$props);
32
39
  }
33
40
  },
34
41
  methods: {
35
- generateEventName(e) {
36
- return `${this.eventPrefix || d}${e}`;
42
+ // Functional events
43
+ generateEventName(t) {
44
+ return `${this.eventPrefix || _}${t}`;
37
45
  },
38
46
  setupEventListeners() {
39
- const e = {
40
- [P]: (t) => this.$emit("compositionLoading", t),
41
- [T]: (t) => this.$emit("compositionLoaded", t),
42
- [b]: (t) => this.$emit("compositionLoadError", t),
43
- [N]: (t) => this.$emit("itemChange", t),
44
- [h]: () => this.$emit("extendModeOn"),
45
- [$]: () => this.$emit("extendModeOff"),
46
- [O]: () => this.$emit("hotspotsOn"),
47
- [f]: () => this.$emit("hotspotsOff"),
48
- [l]: () => this.$emit("galleryOpen"),
49
- [_]: () => this.$emit("galleryClose")
47
+ const t = {
48
+ [P]: (e) => this.$emit("compositionLoading", e),
49
+ [A]: (e) => this.$emit("compositionLoaded", e),
50
+ [b]: (e) => this.$emit("compositionLoadError", e),
51
+ [L]: (e) => this.$emit("itemChange", e),
52
+ [O]: () => this.$emit("extendModeOn"),
53
+ [y]: () => this.$emit("extendModeOff"),
54
+ [$]: () => this.$emit("hotspotsOn"),
55
+ [v]: () => this.$emit("hotspotsOff"),
56
+ [T]: () => this.$emit("galleryOpen"),
57
+ [N]: () => this.$emit("galleryClose")
58
+ };
59
+ Object.entries(t).forEach(([e, n]) => {
60
+ if (!n) return;
61
+ const r = this.generateEventName(e), s = (a) => n(a.detail);
62
+ this.eventCbMap.set(r, s), document.addEventListener(r, s);
63
+ });
64
+ },
65
+ // Analytics events
66
+ generateAnalyticsEventName(t) {
67
+ return `${this.analyticsEventPrefix || u}${t}`;
68
+ },
69
+ setupAnalyticsEventListeners() {
70
+ const t = {
71
+ [f]: (e) => this.$emit("analyticsIdentify", e),
72
+ [h]: (e) => this.$emit("analyticsPage", e),
73
+ [d]: (e) => this.$emit("analyticsTrack", e)
50
74
  };
51
- Object.entries(e).forEach(([t, r]) => {
52
- if (!r) return;
53
- const o = this.generateEventName(t), n = (s) => r(s.detail);
54
- this.eventCbMap.set(o, n), document.addEventListener(o, n);
75
+ Object.entries(t).forEach(([e, n]) => {
76
+ if (!n) return;
77
+ const r = this.generateAnalyticsEventName(e), s = (a) => n(a.detail);
78
+ this.analyticsEventCbMap.set(r, s), document.addEventListener(r, s);
55
79
  });
56
80
  }
57
81
  },
58
82
  mounted() {
59
- this.setupEventListeners();
83
+ this.setupEventListeners(), this.setupAnalyticsEventListeners();
60
84
  },
61
85
  beforeDestroy() {
62
- this.eventCbMap.forEach((e, t) => {
63
- document.removeEventListener(t, e);
86
+ this.eventCbMap.forEach((t, e) => {
87
+ document.removeEventListener(e, t);
88
+ }), this.analyticsEventCbMap.forEach((t, e) => {
89
+ document.removeEventListener(e, t);
64
90
  });
65
91
  }
66
- }), u = (e, t) => {
67
- const r = e.__vccOpts || e;
68
- for (const [o, n] of t)
69
- r[o] = n;
70
- return r;
92
+ }), l = (t, e) => {
93
+ const n = t.__vccOpts || t;
94
+ for (const [r, s] of e)
95
+ n[r] = s;
96
+ return n;
71
97
  };
72
- function M(e, t, r, o, n, s) {
73
- return p(), a("cc-webplayer", m(E(e.attributes)), [
74
- c(e.$slots, "default")
98
+ function B(t, e, n, r, s, a) {
99
+ return c(), o("cc-webplayer", E(p(t.attributes)), [
100
+ m(t.$slots, "default")
75
101
  ], 16);
76
102
  }
77
- const V = /* @__PURE__ */ u(S, [["render", M]]), y = i({
103
+ const G = /* @__PURE__ */ l(I, [["render", B]]), D = i({
78
104
  props: {
79
105
  index: { type: Number, required: !0 },
80
106
  thumbnailSrc: String
81
107
  },
82
108
  computed: {
83
109
  attributes() {
84
- return C(this.$props);
110
+ return S(this.$props);
85
111
  }
86
112
  }
87
113
  });
88
- function A(e, t, r, o, n, s) {
89
- return p(), a("cc-webplayer-custom-media", m(E(e.attributes)), [
90
- c(e.$slots, "default")
114
+ function R(t, e, n, r, s, a) {
115
+ return c(), o("cc-webplayer-custom-media", E(p(t.attributes)), [
116
+ m(t.$slots, "default")
91
117
  ], 16);
92
118
  }
93
- const x = /* @__PURE__ */ u(y, [["render", A]]), I = i({
119
+ const w = /* @__PURE__ */ l(D, [["render", R]]), V = i({
94
120
  props: {
95
121
  name: { type: String, required: !0 }
96
122
  },
97
123
  computed: {
98
124
  attributes() {
99
- return g(this.$props);
125
+ return M(this.$props);
100
126
  }
101
127
  }
102
128
  });
103
- function B(e, t, r, o, n, s) {
104
- return p(), a("cc-webplayer-icon", m(E(e.attributes)), [
105
- c(e.$slots, "default")
129
+ function x(t, e, n, r, s, a) {
130
+ return c(), o("cc-webplayer-icon", E(p(t.attributes)), [
131
+ m(t.$slots, "default")
106
132
  ], 16);
107
133
  }
108
- const G = /* @__PURE__ */ u(I, [["render", B]]);
134
+ const U = /* @__PURE__ */ l(V, [["render", x]]);
109
135
  export {
110
- d as DEFAULT_EVENT_PREFIX,
111
- T as EVENT_COMPOSITION_LOADED,
136
+ f as ANALYTICS_EVENT_IDENTIFY,
137
+ h as ANALYTICS_EVENT_PAGE,
138
+ d as ANALYTICS_EVENT_TRACK,
139
+ _ as DEFAULT_EVENT_PREFIX,
140
+ A as EVENT_COMPOSITION_LOADED,
112
141
  P as EVENT_COMPOSITION_LOADING,
113
142
  b as EVENT_COMPOSITION_LOAD_ERROR,
114
- $ as EVENT_EXTEND_MODE_OFF,
115
- h as EVENT_EXTEND_MODE_ON,
116
- _ as EVENT_GALLERY_CLOSE,
117
- l as EVENT_GALLERY_OPEN,
118
- f as EVENT_HOTSPOTS_OFF,
119
- O as EVENT_HOTSPOTS_ON,
120
- N as EVENT_ITEM_CHANGE,
121
- Y as WEB_PLAYER_CUSTOM_MEDIA_WC_TAG,
122
- k as WEB_PLAYER_ICON_WC_TAG,
123
- U as WEB_PLAYER_WC_TAG,
124
- V as WebPlayer,
125
- x as WebPlayerCustomMedia,
126
- G as WebPlayerIcon,
127
- q as generateCompositionUrl
143
+ y as EVENT_EXTEND_MODE_OFF,
144
+ O as EVENT_EXTEND_MODE_ON,
145
+ N as EVENT_GALLERY_CLOSE,
146
+ T as EVENT_GALLERY_OPEN,
147
+ v as EVENT_HOTSPOTS_OFF,
148
+ $ as EVENT_HOTSPOTS_ON,
149
+ L as EVENT_ITEM_CHANGE,
150
+ X as WEB_PLAYER_CUSTOM_MEDIA_WC_TAG,
151
+ j as WEB_PLAYER_ICON_WC_TAG,
152
+ H as WEB_PLAYER_WC_TAG,
153
+ G as WebPlayer,
154
+ w as WebPlayerCustomMedia,
155
+ U as WebPlayerIcon,
156
+ z as generateCompositionUrl
128
157
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@car-cutter/vue-webplayer",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "license": "Apache-2.0",
5
5
  "author": {
6
6
  "name": "CarCutter",
@@ -41,7 +41,7 @@
41
41
  "analyze": "vite-bundle-visualizer"
42
42
  },
43
43
  "dependencies": {
44
- "@car-cutter/wc-webplayer": "3.0.0"
44
+ "@car-cutter/wc-webplayer": "3.0.2"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "vue": ">=2"
@@ -1 +0,0 @@
1
- "use strict";const O="cc-webplayer",o="cc-webplayer-custom-media",T="cc-webplayer-icon",N="composition-loading",t="composition-loaded",c="composition-load-error",n="item-change",e="extend-mode-on",s="extend-mode-off",A="hotspots-on",L="hotspots-off",C="gallery-open",I="gallery-close",V="cc-webplayer:";function D(E,_){return`https://cdn.car-cutter.com/gallery/${E}/${_}/composition_v3.json`}exports.DEFAULT_EVENT_PREFIX=V;exports.EVENT_COMPOSITION_LOADED=t;exports.EVENT_COMPOSITION_LOADING=N;exports.EVENT_COMPOSITION_LOAD_ERROR=c;exports.EVENT_EXTEND_MODE_OFF=s;exports.EVENT_EXTEND_MODE_ON=e;exports.EVENT_GALLERY_CLOSE=I;exports.EVENT_GALLERY_OPEN=C;exports.EVENT_HOTSPOTS_OFF=L;exports.EVENT_HOTSPOTS_ON=A;exports.EVENT_ITEM_CHANGE=n;exports.WEB_PLAYER_CUSTOM_MEDIA_WC_TAG=o;exports.WEB_PLAYER_ICON_WC_TAG=T;exports.WEB_PLAYER_WC_TAG=O;exports.generateCompositionUrl=D;
@@ -1,21 +0,0 @@
1
- const s = "cc-webplayer", _ = "cc-webplayer-custom-media", c = "cc-webplayer-icon", t = "composition-loading", n = "composition-loaded", e = "composition-load-error", a = "item-change", O = "extend-mode-on", T = "extend-mode-off", N = "hotspots-on", r = "hotspots-off", i = "gallery-open", l = "gallery-close", p = "cc-webplayer:";
2
- function A(o, E) {
3
- return `https://cdn.car-cutter.com/gallery/${o}/${E}/composition_v3.json`;
4
- }
5
- export {
6
- p as D,
7
- l as E,
8
- s as W,
9
- i as a,
10
- r as b,
11
- N as c,
12
- T as d,
13
- O as e,
14
- a as f,
15
- e as g,
16
- n as h,
17
- t as i,
18
- _ as j,
19
- c as k,
20
- A as l
21
- };