@car-cutter/vanilla-webplayer 3.0.1 → 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.d.ts +16 -1
- package/dist/index.js +40 -37
- package/dist/index.umd.cjs +1 -1
- package/package.json +2 -2
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
|
|
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
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
Object.entries(
|
|
5
|
-
([o,
|
|
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
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const
|
|
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, ...
|
|
14
|
-
|
|
15
|
-
const r =
|
|
16
|
-
|
|
17
|
-
}),
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const r =
|
|
21
|
-
|
|
22
|
-
}), _.appendChild(
|
|
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
|
|
25
|
-
function
|
|
26
|
-
return `https://cdn.car-cutter.com/gallery/${_}/${
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
};
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e
|
|
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.
|
|
3
|
+
"version": "3.0.2",
|
|
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.
|
|
34
|
+
"@car-cutter/wc-webplayer": "3.0.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@car-cutter/eslint-config": "*",
|