@car-cutter/vanilla-webplayer 3.0.1 → 3.0.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.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,9 @@
1
+ export declare const ANALYTICS_EVENT_IDENTIFY = "analytics-identify";
2
+
3
+ export declare const ANALYTICS_EVENT_PAGE = "analytics-page";
4
+
5
+ export declare const ANALYTICS_EVENT_TRACK = "analytics-track";
6
+
1
7
  export declare function appendWebPlayer(parentElement: HTMLElement, webPlayerProps: WebPlayerProps, customization?: {
2
8
  customMedias?: (WebPlayerCustomMediaProps & {
3
9
  element: HTMLElement;
@@ -49,7 +55,7 @@ declare type ExtendBehavior = "full_screen" | "event" | "none";
49
55
  /**
50
56
  * Generates a URL for fetching the composition JSON for a given customer and vehicle.
51
57
  *
52
- * @param {string} customerToken - The CarCutter Customer Token (computed by hasing the Customer ID with SHA-256).
58
+ * @param {string} customerToken - The CarCutter Customer Token (computed by hashing the Customer ID with SHA-256).
53
59
  * @param {string} vin - The Vehicle Identification Number.
54
60
  * @returns {string} The URL to fetch the composition JSON.
55
61
  */
@@ -64,6 +70,7 @@ declare type Hotspot = {
64
70
  title: string;
65
71
  icon?: string;
66
72
  description?: string;
73
+ type?: "damage" | "feature";
67
74
  position: {
68
75
  x: number;
69
76
  y: number;
@@ -172,6 +179,14 @@ declare type WebPlayerProps = {
172
179
  eventPrefix?: string;
173
180
  demoSpin?: boolean;
174
181
  reverse360?: boolean;
182
+
183
+ // Analytics
184
+ analyticsEventPrefix?: string;
185
+ analyticsUrl?: string;
186
+ analyticsBearer?: string;
187
+ analyticsSimpleRequestsOnly?: boolean;
188
+ analyticsDryRun?: boolean;
189
+ analyticsDebug?: boolean;
175
190
  };
176
191
 
177
192
  export { }
package/dist/index.js CHANGED
@@ -1,45 +1,48 @@
1
- import { ensureCustomElementsDefinition as T, WEB_PLAYER_WC_TAG as A, webPlayerPropsToAttributes as l, WEB_PLAYER_CUSTOM_MEDIA_WC_TAG as p, webPlayerCustomMediaPropsToAttributes as O, WEB_PLAYER_ICON_WC_TAG as m, webPlayerIconPropsToAttributes as d } from "@car-cutter/wc-webplayer";
2
- function P(_, s, i) {
3
- const c = (t, e) => {
4
- Object.entries(e).forEach(
5
- ([o, n]) => t.setAttribute(o, n)
1
+ import { ensureCustomElementsDefinition as i, WEB_PLAYER_WC_TAG as A, webPlayerPropsToAttributes as l, WEB_PLAYER_CUSTOM_MEDIA_WC_TAG as p, webPlayerCustomMediaPropsToAttributes as C, WEB_PLAYER_ICON_WC_TAG as O, webPlayerIconPropsToAttributes as N } from "@car-cutter/wc-webplayer";
2
+ function m(_, c, a) {
3
+ const s = (e, t) => {
4
+ Object.entries(t).forEach(
5
+ ([o, E]) => e.setAttribute(o, E)
6
6
  );
7
7
  };
8
- T();
9
- const E = document.createElement(A), a = l(s);
10
- c(E, a), i?.customMedias?.forEach((t) => {
11
- const e = document.createElement(
8
+ i();
9
+ const n = document.createElement(A), T = l(c);
10
+ s(n, T), a?.customMedias?.forEach((e) => {
11
+ const t = document.createElement(
12
12
  p
13
- ), { element: o, ...n } = t;
14
- e.appendChild(o);
15
- const r = O(n);
16
- c(e, r), E.appendChild(e);
17
- }), i?.icons?.forEach((t) => {
18
- const e = document.createElement(m), { element: o, ...n } = t;
19
- e.appendChild(o);
20
- const r = d(n);
21
- c(e, r), E.appendChild(e);
22
- }), _.appendChild(E);
13
+ ), { element: o, ...E } = e;
14
+ t.appendChild(o);
15
+ const r = C(E);
16
+ s(t, r), n.appendChild(t);
17
+ }), a?.icons?.forEach((e) => {
18
+ const t = document.createElement(O), { element: o, ...E } = e;
19
+ t.appendChild(o);
20
+ const r = N(E);
21
+ s(t, r), n.appendChild(t);
22
+ }), _.appendChild(n);
23
23
  }
24
- const N = "cc-webplayer", u = "cc-webplayer-custom-media", b = "cc-webplayer-icon", W = "composition-loading", L = "composition-loaded", I = "composition-load-error", M = "item-change", R = "extend-mode-on", y = "extend-mode-off", D = "hotspots-on", G = "hotspots-off", h = "gallery-open", f = "gallery-close", S = "cc-webplayer:";
25
- function V(_, s) {
26
- return `https://cdn.car-cutter.com/gallery/${_}/${s}/composition_v3.json`;
24
+ const P = "cc-webplayer", I = "cc-webplayer-custom-media", L = "cc-webplayer-icon", u = "composition-loading", b = "composition-loaded", W = "composition-load-error", y = "item-change", R = "extend-mode-on", M = "extend-mode-off", Y = "hotspots-on", D = "hotspots-off", G = "gallery-open", S = "gallery-close", V = "analytics-identify", f = "analytics-page", h = "analytics-track", w = "cc-webplayer:";
25
+ function B(_, c) {
26
+ return `https://cdn.car-cutter.com/gallery/${_}/${c}/composition_v3.json`;
27
27
  }
28
28
  export {
29
- S as DEFAULT_EVENT_PREFIX,
30
- L as EVENT_COMPOSITION_LOADED,
31
- W as EVENT_COMPOSITION_LOADING,
32
- I as EVENT_COMPOSITION_LOAD_ERROR,
33
- y as EVENT_EXTEND_MODE_OFF,
29
+ V as ANALYTICS_EVENT_IDENTIFY,
30
+ f as ANALYTICS_EVENT_PAGE,
31
+ h as ANALYTICS_EVENT_TRACK,
32
+ w as DEFAULT_EVENT_PREFIX,
33
+ b as EVENT_COMPOSITION_LOADED,
34
+ u as EVENT_COMPOSITION_LOADING,
35
+ W as EVENT_COMPOSITION_LOAD_ERROR,
36
+ M as EVENT_EXTEND_MODE_OFF,
34
37
  R as EVENT_EXTEND_MODE_ON,
35
- f as EVENT_GALLERY_CLOSE,
36
- h as EVENT_GALLERY_OPEN,
37
- G as EVENT_HOTSPOTS_OFF,
38
- D as EVENT_HOTSPOTS_ON,
39
- M as EVENT_ITEM_CHANGE,
40
- u as WEB_PLAYER_CUSTOM_MEDIA_WC_TAG,
41
- b as WEB_PLAYER_ICON_WC_TAG,
42
- N as WEB_PLAYER_WC_TAG,
43
- P as appendWebPlayer,
44
- V as generateCompositionUrl
38
+ S as EVENT_GALLERY_CLOSE,
39
+ G as EVENT_GALLERY_OPEN,
40
+ D as EVENT_HOTSPOTS_OFF,
41
+ Y as EVENT_HOTSPOTS_ON,
42
+ y as EVENT_ITEM_CHANGE,
43
+ I as WEB_PLAYER_CUSTOM_MEDIA_WC_TAG,
44
+ L as WEB_PLAYER_ICON_WC_TAG,
45
+ P as WEB_PLAYER_WC_TAG,
46
+ m as appendWebPlayer,
47
+ B as generateCompositionUrl
45
48
  };
@@ -1 +1 @@
1
- (function(e,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("@car-cutter/wc-webplayer")):typeof define=="function"&&define.amd?define(["exports","@car-cutter/wc-webplayer"],E):(e=typeof globalThis<"u"?globalThis:e||self,E(e.CarCutterWebplayerVanilla={},e.CarCutterWebplayerWC))})(this,function(e,E){"use strict";function r(T,O,N){const i=(n,t)=>{Object.entries(t).forEach(([_,o])=>n.setAttribute(_,o))};E.ensureCustomElementsDefinition();const c=document.createElement(E.WEB_PLAYER_WC_TAG),R=E.webPlayerPropsToAttributes(O);i(c,R),N?.customMedias?.forEach(n=>{const t=document.createElement(E.WEB_PLAYER_CUSTOM_MEDIA_WC_TAG),{element:_,...o}=n;t.appendChild(_);const s=E.webPlayerCustomMediaPropsToAttributes(o);i(t,s),c.appendChild(t)}),N?.icons?.forEach(n=>{const t=document.createElement(E.WEB_PLAYER_ICON_WC_TAG),{element:_,...o}=n;t.appendChild(_);const s=E.webPlayerIconPropsToAttributes(o);i(t,s),c.appendChild(t)}),T.appendChild(c)}const A="cc-webplayer",a="cc-webplayer-custom-media",d="cc-webplayer-icon",l="composition-loading",C="composition-loaded",u="composition-load-error",P="item-change",m="extend-mode-on",L="extend-mode-off",p="hotspots-on",I="hotspots-off",V="gallery-open",f="gallery-close",D="cc-webplayer:";function M(T,O){return`https://cdn.car-cutter.com/gallery/${T}/${O}/composition_v3.json`}e.DEFAULT_EVENT_PREFIX=D,e.EVENT_COMPOSITION_LOADED=C,e.EVENT_COMPOSITION_LOADING=l,e.EVENT_COMPOSITION_LOAD_ERROR=u,e.EVENT_EXTEND_MODE_OFF=L,e.EVENT_EXTEND_MODE_ON=m,e.EVENT_GALLERY_CLOSE=f,e.EVENT_GALLERY_OPEN=V,e.EVENT_HOTSPOTS_OFF=I,e.EVENT_HOTSPOTS_ON=p,e.EVENT_ITEM_CHANGE=P,e.WEB_PLAYER_CUSTOM_MEDIA_WC_TAG=a,e.WEB_PLAYER_ICON_WC_TAG=d,e.WEB_PLAYER_WC_TAG=A,e.appendWebPlayer=r,e.generateCompositionUrl=M,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
1
+ (function(E,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("@car-cutter/wc-webplayer")):typeof define=="function"&&define.amd?define(["exports","@car-cutter/wc-webplayer"],e):(E=typeof globalThis<"u"?globalThis:E||self,e(E.CarCutterWebplayerVanilla={},E.CarCutterWebplayerWC))})(this,function(E,e){"use strict";function s(c,i,O){const A=(_,t)=>{Object.entries(t).forEach(([n,o])=>_.setAttribute(n,o))};e.ensureCustomElementsDefinition();const T=document.createElement(e.WEB_PLAYER_WC_TAG),b=e.webPlayerPropsToAttributes(i);A(T,b),O?.customMedias?.forEach(_=>{const t=document.createElement(e.WEB_PLAYER_CUSTOM_MEDIA_WC_TAG),{element:n,...o}=_;t.appendChild(n);const N=e.webPlayerCustomMediaPropsToAttributes(o);A(t,N),T.appendChild(t)}),O?.icons?.forEach(_=>{const t=document.createElement(e.WEB_PLAYER_ICON_WC_TAG),{element:n,...o}=_;t.appendChild(n);const N=e.webPlayerIconPropsToAttributes(o);A(t,N),T.appendChild(t)}),c.appendChild(T)}const a="cc-webplayer",C="cc-webplayer-custom-media",l="cc-webplayer-icon",d="composition-loading",r="composition-loaded",P="composition-load-error",I="item-change",u="extend-mode-on",L="extend-mode-off",m="hotspots-on",V="hotspots-off",S="gallery-open",D="gallery-close",f="analytics-identify",p="analytics-page",R="analytics-track",M="cc-webplayer:";function Y(c,i){return`https://cdn.car-cutter.com/gallery/${c}/${i}/composition_v3.json`}E.ANALYTICS_EVENT_IDENTIFY=f,E.ANALYTICS_EVENT_PAGE=p,E.ANALYTICS_EVENT_TRACK=R,E.DEFAULT_EVENT_PREFIX=M,E.EVENT_COMPOSITION_LOADED=r,E.EVENT_COMPOSITION_LOADING=d,E.EVENT_COMPOSITION_LOAD_ERROR=P,E.EVENT_EXTEND_MODE_OFF=L,E.EVENT_EXTEND_MODE_ON=u,E.EVENT_GALLERY_CLOSE=D,E.EVENT_GALLERY_OPEN=S,E.EVENT_HOTSPOTS_OFF=V,E.EVENT_HOTSPOTS_ON=m,E.EVENT_ITEM_CHANGE=I,E.WEB_PLAYER_CUSTOM_MEDIA_WC_TAG=C,E.WEB_PLAYER_ICON_WC_TAG=l,E.WEB_PLAYER_WC_TAG=a,E.appendWebPlayer=s,E.generateCompositionUrl=Y,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@car-cutter/vanilla-webplayer",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "license": "Apache-2.0",
5
5
  "author": {
6
6
  "name": "CarCutter",
@@ -31,7 +31,7 @@
31
31
  "analyze": "vite-bundle-visualizer"
32
32
  },
33
33
  "dependencies": {
34
- "@car-cutter/wc-webplayer": "3.0.1"
34
+ "@car-cutter/wc-webplayer": "3.0.3"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@car-cutter/eslint-config": "*",