@car-cutter/react-webplayer 0.10.0 → 0.12.0
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 +1 -1
- package/dist/index.d.ts +23 -7
- package/dist/index.js +59 -52
- package/dist/legacy.cjs +1 -1
- package/dist/legacy.d.ts +23 -7
- package/dist/legacy.js +49 -41
- package/dist/shared-Cs2DFbEI.cjs +16 -0
- package/dist/shared-DKvJSb9q.js +4712 -0
- package/dist/style.css +1 -0
- package/package.json +6 -6
- package/dist/shared-DQuprS5K.js +0 -2880
- package/dist/shared-QPXPDOqW.cjs +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./shared-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./shared-Cs2DFbEI.cjs");require("react/jsx-runtime");const g=require("react"),W=require("react-dom/client");var S=Object.defineProperty,L=(e,t,r)=>t in e?S(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,b=(e,t,r)=>(L(e,typeof t!="symbol"?t+"":t,r),r);const I={stringify:e=>e,parse:e=>e},R={stringify:e=>`${e}`,parse:e=>parseFloat(e)},V={stringify:e=>e?"true":"false",parse:e=>/^[ty1-9]/i.test(e)},M={stringify:e=>e.name,parse:(e,t,r)=>{const i=(()=>{if(typeof window<"u"&&e in window)return window[e];if(typeof global<"u"&&e in global)return global[e]})();return typeof i=="function"?i.bind(r):void 0}},D={stringify:e=>JSON.stringify(e),parse:e=>JSON.parse(e)},y={string:I,number:R,boolean:V,function:M,json:D};function w(e){return e.replace(/([a-z0-9])([A-Z])/g,(t,r,i)=>`${r}-${i.toLowerCase()}`)}const T=Symbol.for("r2wc.render"),m=Symbol.for("r2wc.connected"),u=Symbol.for("r2wc.context"),l=Symbol.for("r2wc.props");function G(e,t,r){var i,O,A;t.props||(t.props=e.propTypes?Object.keys(e.propTypes):[]);const d=Array.isArray(t.props)?t.props.slice():Object.keys(t.props),p={},f={},h={};for(const s of d){p[s]=Array.isArray(t.props)?"string":t.props[s];const o=w(s);f[s]=o,h[o]=s}class P extends HTMLElement{constructor(){super(),b(this,i,!0),b(this,O),b(this,A,{}),b(this,"container"),t.shadow?this.container=this.attachShadow({mode:t.shadow}):this.container=this,this[l].container=this.container;for(const o of d){const _=f[o],c=this.getAttribute(_),a=p[o],E=a?y[a]:null;E!=null&&E.parse&&c&&(this[l][o]=E.parse(c,_,this))}}static get observedAttributes(){return Object.keys(h)}connectedCallback(){this[m]=!0,this[T]()}disconnectedCallback(){this[m]=!1,this[u]&&r.unmount(this[u]),delete this[u]}attributeChangedCallback(o,_,c){const a=h[o],E=p[a],N=E?y[E]:null;a in p&&N!=null&&N.parse&&c&&(this[l][a]=N.parse(c,o,this),this[T]())}[(i=m,O=u,A=l,T)](){this[m]&&(this[u]?r.update(this[u],this[l]):this[u]=r.mount(this.container,e,this[l]))}}for(const s of d){const o=f[s],_=p[s];Object.defineProperty(P.prototype,s,{enumerable:!0,configurable:!0,get(){return this[l][s]},set(c){this[l][s]=c;const a=_?y[_]:null;if(a!=null&&a.stringify){const E=a.stringify(c,o,this);this.getAttribute(o)!==E&&this.setAttribute(o,E)}else this[T]()}})}return P}function F(e,t,r){const i=W.createRoot(e),O=g.createElement(t,r);return i.render(O),{root:i,ReactComponent:t}}function v({root:e,ReactComponent:t},r){const i=g.createElement(t,r);e.render(i)}function Y({root:e}){setTimeout(()=>{e.unmount()},0)}function C(e,t={}){return G(e,t,{mount:F,update:v,unmount:Y})}const j=C(n.WebPlayerWithInjectedStyles,{props:{compositionUrl:"string",hideCategoriesNav:"boolean",infiniteCarrousel:"boolean",permanentGallery:"boolean",minMediaWidth:"number",maxMediaWidth:"number",mediaLoadStrategy:"string",preloadRange:"number",autoLoad360:"boolean",autoLoadInterior360:"boolean",categoriesFilter:"string",extendBehavior:"string",eventPrefix:"string",demoSpin:"boolean",reverse360:"boolean"}}),k=C(n.WebPlayerCustomMedia,{shadow:"closed",props:{index:"number",thumbnailSrc:"string"}}),B=C(n.WebPlayerIcon,{shadow:"closed",props:{name:"string"}});function x(){customElements.define(n.WEB_PLAYER_WC_TAG,j),customElements.define(n.WEB_PLAYER_CUSTOM_MEDIA_WC_TAG,k),customElements.define(n.WEB_PLAYER_ICON_WC_TAG,B)}function H(){n.checkCustomElementsDefinition()||x()}H();exports.DEFAULT_EVENT_PREFIX=n.DEFAULT_EVENT_PREFIX;exports.EVENT_COMPOSITION_LOADED=n.EVENT_COMPOSITION_LOADED;exports.EVENT_COMPOSITION_LOADING=n.EVENT_COMPOSITION_LOADING;exports.EVENT_COMPOSITION_LOAD_ERROR=n.EVENT_COMPOSITION_LOAD_ERROR;exports.EVENT_EXTEND_MODE_OFF=n.EVENT_EXTEND_MODE_OFF;exports.EVENT_EXTEND_MODE_ON=n.EVENT_EXTEND_MODE_ON;exports.EVENT_GALLERY_CLOSE=n.EVENT_GALLERY_CLOSE;exports.EVENT_GALLERY_OPEN=n.EVENT_GALLERY_OPEN;exports.EVENT_HOTSPOTS_OFF=n.EVENT_HOTSPOTS_OFF;exports.EVENT_HOTSPOTS_ON=n.EVENT_HOTSPOTS_ON;exports.EVENT_ITEM_CHANGE=n.EVENT_ITEM_CHANGE;exports.WEB_PLAYER_ICON_WC_TAG=n.WEB_PLAYER_ICON_WC_TAG;exports.WEB_PLAYER_WC_TAG=n.WEB_PLAYER_WC_TAG;exports.WebPlayer=n.WebPlayer;exports.WebPlayerCustomMedia=n.WebPlayerCustomMedia$1;exports.WebPlayerIcon=n.WebPlayerIcon$1;exports.generateCompositionUrl=n.generateCompositionUrl;
|
package/dist/index.d.ts
CHANGED
|
@@ -38,18 +38,20 @@ export declare const EVENT_HOTSPOTS_ON = "hotspots-on";
|
|
|
38
38
|
|
|
39
39
|
export declare const EVENT_ITEM_CHANGE = "item-change";
|
|
40
40
|
|
|
41
|
+
declare type ExtendBehavior = "full_screen" | "event" | "none";
|
|
42
|
+
|
|
41
43
|
/**
|
|
42
44
|
* Generates a URL for fetching the composition JSON for a given customer and vehicle.
|
|
43
45
|
*
|
|
44
|
-
* @param {string}
|
|
46
|
+
* @param {string} customerToken - The CarCutter Customer Token (computed by hasing the Customer ID with SHA-256).
|
|
45
47
|
* @param {string} vin - The Vehicle Identification Number.
|
|
46
48
|
* @returns {string} The URL to fetch the composition JSON.
|
|
47
49
|
*/
|
|
48
50
|
export declare function generateCompositionUrl(
|
|
49
|
-
|
|
51
|
+
customerToken: string,
|
|
50
52
|
vin: string
|
|
51
53
|
): string {
|
|
52
|
-
return `https://cdn.car-cutter.com/gallery/${
|
|
54
|
+
return `https://cdn.car-cutter.com/gallery/${customerToken}/${vin}/composition_v3.json`;
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
declare type Hotspot = {
|
|
@@ -73,7 +75,16 @@ declare type ImageWithHotspots = {
|
|
|
73
75
|
hotspots?: Hotspot[];
|
|
74
76
|
};
|
|
75
77
|
|
|
76
|
-
|
|
78
|
+
declare type InteriorThreeSixtyItem = {
|
|
79
|
+
type: "interior-360";
|
|
80
|
+
poster?: string;
|
|
81
|
+
} & ImageWithHotspots;
|
|
82
|
+
|
|
83
|
+
export declare type Item =
|
|
84
|
+
| ImageItem
|
|
85
|
+
| VideoItem
|
|
86
|
+
| ThreeSixtyItem
|
|
87
|
+
| InteriorThreeSixtyItem;
|
|
77
88
|
|
|
78
89
|
export declare type MediaLoadStrategy = "quality" | "balanced" | "speed";
|
|
79
90
|
|
|
@@ -119,6 +130,7 @@ declare type WebPlayerIconName =
|
|
|
119
130
|
| "UI_PLUS" // Increase zoom
|
|
120
131
|
| "UI_REDUCE" // Reducing an extended view
|
|
121
132
|
| "UI_360" // 360-degree view
|
|
133
|
+
| "UI_INTERIOR_360" // interior 360 view
|
|
122
134
|
| "UI_VOLUME" // Video volume
|
|
123
135
|
| "UI_VOLUME_OFF" // Muted video
|
|
124
136
|
| "CONTROLS_PREV" // Go to previous media
|
|
@@ -150,7 +162,7 @@ declare type WebPlayerProps_2 = {
|
|
|
150
162
|
compositionUrl: string;
|
|
151
163
|
|
|
152
164
|
// Layout
|
|
153
|
-
|
|
165
|
+
hideCategoriesNav?: boolean;
|
|
154
166
|
infiniteCarrousel?: boolean;
|
|
155
167
|
permanentGallery?: boolean;
|
|
156
168
|
|
|
@@ -159,10 +171,14 @@ declare type WebPlayerProps_2 = {
|
|
|
159
171
|
minMediaWidth?: MediaWidth;
|
|
160
172
|
maxMediaWidth?: MediaWidth;
|
|
161
173
|
preloadRange?: number;
|
|
174
|
+
autoLoad360?: boolean;
|
|
175
|
+
autoLoadInterior360?: boolean;
|
|
162
176
|
|
|
163
|
-
//
|
|
164
|
-
|
|
177
|
+
// Miscellaneous
|
|
178
|
+
categoriesFilter?: string;
|
|
179
|
+
extendBehavior?: ExtendBehavior;
|
|
165
180
|
eventPrefix?: string;
|
|
181
|
+
demoSpin?: boolean;
|
|
166
182
|
reverse360?: boolean;
|
|
167
183
|
};
|
|
168
184
|
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { W as P, a as W, b as S, c as w, d as
|
|
2
|
-
import { D as oe, j as
|
|
1
|
+
import { W as P, a as W, b as S, c as w, d as L, e as I, f as M } from "./shared-DKvJSb9q.js";
|
|
2
|
+
import { D as oe, j as re, E as se, k as ie, n as ae, m as ce, r as le, q as ue, p as pe, o as me, l as fe, g as be, h as Ee, i as de, s as he } from "./shared-DKvJSb9q.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import A from "react";
|
|
5
5
|
import { createRoot as D } from "react-dom/client";
|
|
6
|
-
var R = Object.defineProperty, V = (e, t, n) => t in e ? R(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n,
|
|
6
|
+
var R = Object.defineProperty, V = (e, t, n) => t in e ? R(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, b = (e, t, n) => (V(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
7
7
|
const v = {
|
|
8
8
|
stringify: (e) => e,
|
|
9
9
|
parse: (e) => e
|
|
@@ -16,18 +16,18 @@ const v = {
|
|
|
16
16
|
}, x = {
|
|
17
17
|
stringify: (e) => e.name,
|
|
18
18
|
parse: (e, t, n) => {
|
|
19
|
-
const
|
|
19
|
+
const r = (() => {
|
|
20
20
|
if (typeof window < "u" && e in window)
|
|
21
21
|
return window[e];
|
|
22
22
|
if (typeof global < "u" && e in global)
|
|
23
23
|
return global[e];
|
|
24
24
|
})();
|
|
25
|
-
return typeof
|
|
25
|
+
return typeof r == "function" ? r.bind(n) : void 0;
|
|
26
26
|
}
|
|
27
27
|
}, F = {
|
|
28
28
|
stringify: (e) => JSON.stringify(e),
|
|
29
29
|
parse: (e) => JSON.parse(e)
|
|
30
|
-
},
|
|
30
|
+
}, O = {
|
|
31
31
|
string: v,
|
|
32
32
|
number: j,
|
|
33
33
|
boolean: k,
|
|
@@ -37,26 +37,26 @@ const v = {
|
|
|
37
37
|
function G(e) {
|
|
38
38
|
return e.replace(
|
|
39
39
|
/([a-z0-9])([A-Z])/g,
|
|
40
|
-
(t, n,
|
|
40
|
+
(t, n, r) => `${n}-${r.toLowerCase()}`
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
|
-
const
|
|
43
|
+
const E = Symbol.for("r2wc.render"), d = Symbol.for("r2wc.connected"), u = Symbol.for("r2wc.context"), l = Symbol.for("r2wc.props");
|
|
44
44
|
function Y(e, t, n) {
|
|
45
|
-
var
|
|
45
|
+
var r, f, C;
|
|
46
46
|
t.props || (t.props = e.propTypes ? Object.keys(e.propTypes) : []);
|
|
47
|
-
const
|
|
48
|
-
for (const
|
|
49
|
-
m[
|
|
50
|
-
const o = G(
|
|
51
|
-
y[
|
|
47
|
+
const h = Array.isArray(t.props) ? t.props.slice() : Object.keys(t.props), m = {}, y = {}, _ = {};
|
|
48
|
+
for (const s of h) {
|
|
49
|
+
m[s] = Array.isArray(t.props) ? "string" : t.props[s];
|
|
50
|
+
const o = G(s);
|
|
51
|
+
y[s] = o, _[o] = s;
|
|
52
52
|
}
|
|
53
53
|
class N extends HTMLElement {
|
|
54
54
|
constructor() {
|
|
55
|
-
super(),
|
|
55
|
+
super(), b(this, r, !0), b(this, f), b(this, C, {}), b(this, "container"), t.shadow ? this.container = this.attachShadow({
|
|
56
56
|
mode: t.shadow
|
|
57
57
|
}) : this.container = this, this[l].container = this.container;
|
|
58
|
-
for (const o of
|
|
59
|
-
const p = y[o], c = this.getAttribute(p), i = m[o], a = i ?
|
|
58
|
+
for (const o of h) {
|
|
59
|
+
const p = y[o], c = this.getAttribute(p), i = m[o], a = i ? O[i] : null;
|
|
60
60
|
a != null && a.parse && c && (this[l][o] = a.parse(c, p, this));
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -64,75 +64,82 @@ function Y(e, t, n) {
|
|
|
64
64
|
return Object.keys(_);
|
|
65
65
|
}
|
|
66
66
|
connectedCallback() {
|
|
67
|
-
this[
|
|
67
|
+
this[d] = !0, this[E]();
|
|
68
68
|
}
|
|
69
69
|
disconnectedCallback() {
|
|
70
|
-
this[
|
|
70
|
+
this[d] = !1, this[u] && n.unmount(this[u]), delete this[u];
|
|
71
71
|
}
|
|
72
72
|
attributeChangedCallback(o, p, c) {
|
|
73
|
-
const i = _[o], a = m[i],
|
|
74
|
-
i in m &&
|
|
73
|
+
const i = _[o], a = m[i], g = a ? O[a] : null;
|
|
74
|
+
i in m && g != null && g.parse && c && (this[l][i] = g.parse(c, o, this), this[E]());
|
|
75
75
|
}
|
|
76
|
-
[(
|
|
77
|
-
this[
|
|
76
|
+
[(r = d, f = u, C = l, E)]() {
|
|
77
|
+
this[d] && (this[u] ? n.update(this[u], this[l]) : this[u] = n.mount(
|
|
78
78
|
this.container,
|
|
79
79
|
e,
|
|
80
80
|
this[l]
|
|
81
81
|
));
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
for (const
|
|
85
|
-
const o = y[
|
|
86
|
-
Object.defineProperty(N.prototype,
|
|
84
|
+
for (const s of h) {
|
|
85
|
+
const o = y[s], p = m[s];
|
|
86
|
+
Object.defineProperty(N.prototype, s, {
|
|
87
87
|
enumerable: !0,
|
|
88
88
|
configurable: !0,
|
|
89
89
|
get() {
|
|
90
|
-
return this[l][
|
|
90
|
+
return this[l][s];
|
|
91
91
|
},
|
|
92
92
|
set(c) {
|
|
93
|
-
this[l][
|
|
94
|
-
const i = p ?
|
|
93
|
+
this[l][s] = c;
|
|
94
|
+
const i = p ? O[p] : null;
|
|
95
95
|
if (i != null && i.stringify) {
|
|
96
96
|
const a = i.stringify(c, o, this);
|
|
97
97
|
this.getAttribute(o) !== a && this.setAttribute(o, a);
|
|
98
98
|
} else
|
|
99
|
-
this[
|
|
99
|
+
this[E]();
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
return N;
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
const
|
|
107
|
-
return
|
|
108
|
-
root:
|
|
105
|
+
function B(e, t, n) {
|
|
106
|
+
const r = D(e), f = A.createElement(t, n);
|
|
107
|
+
return r.render(f), {
|
|
108
|
+
root: r,
|
|
109
109
|
ReactComponent: t
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
const
|
|
114
|
-
e.render(
|
|
112
|
+
function H({ root: e, ReactComponent: t }, n) {
|
|
113
|
+
const r = A.createElement(t, n);
|
|
114
|
+
e.render(r);
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function U({ root: e }) {
|
|
117
117
|
setTimeout(() => {
|
|
118
118
|
e.unmount();
|
|
119
119
|
}, 0);
|
|
120
120
|
}
|
|
121
121
|
function T(e, t = {}) {
|
|
122
|
-
return Y(e, t, { mount:
|
|
122
|
+
return Y(e, t, { mount: B, update: H, unmount: U });
|
|
123
123
|
}
|
|
124
|
-
const
|
|
125
|
-
shadow: "open",
|
|
124
|
+
const $ = T(P, {
|
|
126
125
|
props: {
|
|
127
126
|
compositionUrl: "string",
|
|
128
|
-
|
|
127
|
+
// Layout
|
|
128
|
+
hideCategoriesNav: "boolean",
|
|
129
129
|
infiniteCarrousel: "boolean",
|
|
130
130
|
permanentGallery: "boolean",
|
|
131
|
+
// Medias loading
|
|
131
132
|
minMediaWidth: "number",
|
|
132
133
|
maxMediaWidth: "number",
|
|
133
134
|
mediaLoadStrategy: "string",
|
|
134
|
-
|
|
135
|
+
preloadRange: "number",
|
|
136
|
+
autoLoad360: "boolean",
|
|
137
|
+
autoLoadInterior360: "boolean",
|
|
138
|
+
// Miscellaneous
|
|
139
|
+
categoriesFilter: "string",
|
|
140
|
+
extendBehavior: "string",
|
|
135
141
|
eventPrefix: "string",
|
|
142
|
+
demoSpin: "boolean",
|
|
136
143
|
reverse360: "boolean"
|
|
137
144
|
}
|
|
138
145
|
}), J = T(W, {
|
|
@@ -148,8 +155,8 @@ const B = T(P, {
|
|
|
148
155
|
}
|
|
149
156
|
});
|
|
150
157
|
function q() {
|
|
151
|
-
customElements.define(
|
|
152
|
-
|
|
158
|
+
customElements.define(L, $), customElements.define(
|
|
159
|
+
I,
|
|
153
160
|
J
|
|
154
161
|
), customElements.define(M, X);
|
|
155
162
|
}
|
|
@@ -159,8 +166,8 @@ function z() {
|
|
|
159
166
|
z();
|
|
160
167
|
export {
|
|
161
168
|
oe as DEFAULT_EVENT_PREFIX,
|
|
162
|
-
|
|
163
|
-
|
|
169
|
+
re as EVENT_COMPOSITION_LOADED,
|
|
170
|
+
se as EVENT_COMPOSITION_LOADING,
|
|
164
171
|
ie as EVENT_COMPOSITION_LOAD_ERROR,
|
|
165
172
|
ae as EVENT_EXTEND_MODE_OFF,
|
|
166
173
|
ce as EVENT_EXTEND_MODE_ON,
|
|
@@ -170,9 +177,9 @@ export {
|
|
|
170
177
|
me as EVENT_HOTSPOTS_ON,
|
|
171
178
|
fe as EVENT_ITEM_CHANGE,
|
|
172
179
|
M as WEB_PLAYER_ICON_WC_TAG,
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
180
|
+
L as WEB_PLAYER_WC_TAG,
|
|
181
|
+
be as WebPlayer,
|
|
182
|
+
Ee as WebPlayerCustomMedia,
|
|
183
|
+
de as WebPlayerIcon,
|
|
184
|
+
he as generateCompositionUrl
|
|
178
185
|
};
|
package/dist/legacy.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./shared-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./shared-Cs2DFbEI.cjs");require("react/jsx-runtime");const W=require("react"),y=require("react-dom");var S=Object.defineProperty,L=(e,t,r)=>t in e?S(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,O=(e,t,r)=>(L(e,typeof t!="symbol"?t+"":t,r),r);const I={stringify:e=>e,parse:e=>e},V={stringify:e=>`${e}`,parse:e=>parseFloat(e)},M={stringify:e=>e?"true":"false",parse:e=>/^[ty1-9]/i.test(e)},R={stringify:e=>e.name,parse:(e,t,r)=>{const s=(()=>{if(typeof window<"u"&&e in window)return window[e];if(typeof global<"u"&&e in global)return global[e]})();return typeof s=="function"?s.bind(r):void 0}},D={stringify:e=>JSON.stringify(e),parse:e=>JSON.parse(e)},N={string:I,number:V,boolean:M,function:R,json:D};function w(e){return e.replace(/([a-z0-9])([A-Z])/g,(t,r,s)=>`${r}-${s.toLowerCase()}`)}const b=Symbol.for("r2wc.render"),T=Symbol.for("r2wc.connected"),u=Symbol.for("r2wc.context"),l=Symbol.for("r2wc.props");function G(e,t,r){var s,A,P;t.props||(t.props=e.propTypes?Object.keys(e.propTypes):[]);const d=Array.isArray(t.props)?t.props.slice():Object.keys(t.props),p={},m={},f={};for(const i of d){p[i]=Array.isArray(t.props)?"string":t.props[i];const o=w(i);m[i]=o,f[o]=i}class g extends HTMLElement{constructor(){super(),O(this,s,!0),O(this,A),O(this,P,{}),O(this,"container"),t.shadow?this.container=this.attachShadow({mode:t.shadow}):this.container=this,this[l].container=this.container;for(const o of d){const _=m[o],c=this.getAttribute(_),a=p[o],E=a?N[a]:null;E!=null&&E.parse&&c&&(this[l][o]=E.parse(c,_,this))}}static get observedAttributes(){return Object.keys(f)}connectedCallback(){this[T]=!0,this[b]()}disconnectedCallback(){this[T]=!1,this[u]&&r.unmount(this[u]),delete this[u]}attributeChangedCallback(o,_,c){const a=f[o],E=p[a],h=E?N[E]:null;a in p&&h!=null&&h.parse&&c&&(this[l][a]=h.parse(c,o,this),this[b]())}[(s=T,A=u,P=l,b)](){this[T]&&(this[u]?r.update(this[u],this[l]):this[u]=r.mount(this.container,e,this[l]))}}for(const i of d){const o=m[i],_=p[i];Object.defineProperty(g.prototype,i,{enumerable:!0,configurable:!0,get(){return this[l][i]},set(c){this[l][i]=c;const a=_?N[_]:null;if(a!=null&&a.stringify){const E=a.stringify(c,o,this);this.getAttribute(o)!==E&&this.setAttribute(o,E)}else this[b]()}})}return g}function F(e,t,r){const s=W.createElement(t,r);return y.render(s,e),{container:e,ReactComponent:t}}function v({container:e,ReactComponent:t},r){const s=W.createElement(t,r);y.render(s,e)}function Y({container:e}){y.unmountComponentAtNode(e)}function C(e,t={}){return G(e,t,{mount:F,update:v,unmount:Y})}const j=C(n.WebPlayerWithInjectedStyles,{shadow:"open",props:{compositionUrl:"string",hideCategoriesNav:"boolean",infiniteCarrousel:"boolean",permanentGallery:"boolean",minMediaWidth:"number",maxMediaWidth:"number",mediaLoadStrategy:"string",preloadRange:"number",autoLoad360:"boolean",autoLoadInterior360:"boolean",categoriesFilter:"string",extendBehavior:"string",eventPrefix:"string",demoSpin:"boolean",reverse360:"boolean"}}),k=C(n.WebPlayerCustomMedia,{shadow:"closed",props:{index:"number",thumbnailSrc:"string"}}),B=C(n.WebPlayerIcon,{shadow:"closed",props:{name:"string"}});function $(){customElements.define(n.WEB_PLAYER_WC_TAG,j),customElements.define(n.WEB_PLAYER_CUSTOM_MEDIA_WC_TAG,k),customElements.define(n.WEB_PLAYER_ICON_WC_TAG,B)}function x(){n.checkCustomElementsDefinition()||$()}x();exports.DEFAULT_EVENT_PREFIX=n.DEFAULT_EVENT_PREFIX;exports.EVENT_COMPOSITION_LOADED=n.EVENT_COMPOSITION_LOADED;exports.EVENT_COMPOSITION_LOADING=n.EVENT_COMPOSITION_LOADING;exports.EVENT_COMPOSITION_LOAD_ERROR=n.EVENT_COMPOSITION_LOAD_ERROR;exports.EVENT_EXTEND_MODE_OFF=n.EVENT_EXTEND_MODE_OFF;exports.EVENT_EXTEND_MODE_ON=n.EVENT_EXTEND_MODE_ON;exports.EVENT_GALLERY_CLOSE=n.EVENT_GALLERY_CLOSE;exports.EVENT_GALLERY_OPEN=n.EVENT_GALLERY_OPEN;exports.EVENT_HOTSPOTS_OFF=n.EVENT_HOTSPOTS_OFF;exports.EVENT_HOTSPOTS_ON=n.EVENT_HOTSPOTS_ON;exports.EVENT_ITEM_CHANGE=n.EVENT_ITEM_CHANGE;exports.WEB_PLAYER_ICON_WC_TAG=n.WEB_PLAYER_ICON_WC_TAG;exports.WEB_PLAYER_WC_TAG=n.WEB_PLAYER_WC_TAG;exports.WebPlayer=n.WebPlayer;exports.WebPlayerCustomMedia=n.WebPlayerCustomMedia$1;exports.WebPlayerIcon=n.WebPlayerIcon$1;exports.generateCompositionUrl=n.generateCompositionUrl;
|
package/dist/legacy.d.ts
CHANGED
|
@@ -38,18 +38,20 @@ export declare const EVENT_HOTSPOTS_ON = "hotspots-on";
|
|
|
38
38
|
|
|
39
39
|
export declare const EVENT_ITEM_CHANGE = "item-change";
|
|
40
40
|
|
|
41
|
+
declare type ExtendBehavior = "full_screen" | "event" | "none";
|
|
42
|
+
|
|
41
43
|
/**
|
|
42
44
|
* Generates a URL for fetching the composition JSON for a given customer and vehicle.
|
|
43
45
|
*
|
|
44
|
-
* @param {string}
|
|
46
|
+
* @param {string} customerToken - The CarCutter Customer Token (computed by hasing the Customer ID with SHA-256).
|
|
45
47
|
* @param {string} vin - The Vehicle Identification Number.
|
|
46
48
|
* @returns {string} The URL to fetch the composition JSON.
|
|
47
49
|
*/
|
|
48
50
|
export declare function generateCompositionUrl(
|
|
49
|
-
|
|
51
|
+
customerToken: string,
|
|
50
52
|
vin: string
|
|
51
53
|
): string {
|
|
52
|
-
return `https://cdn.car-cutter.com/gallery/${
|
|
54
|
+
return `https://cdn.car-cutter.com/gallery/${customerToken}/${vin}/composition_v3.json`;
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
declare type Hotspot = {
|
|
@@ -73,7 +75,16 @@ declare type ImageWithHotspots = {
|
|
|
73
75
|
hotspots?: Hotspot[];
|
|
74
76
|
};
|
|
75
77
|
|
|
76
|
-
|
|
78
|
+
declare type InteriorThreeSixtyItem = {
|
|
79
|
+
type: "interior-360";
|
|
80
|
+
poster?: string;
|
|
81
|
+
} & ImageWithHotspots;
|
|
82
|
+
|
|
83
|
+
export declare type Item =
|
|
84
|
+
| ImageItem
|
|
85
|
+
| VideoItem
|
|
86
|
+
| ThreeSixtyItem
|
|
87
|
+
| InteriorThreeSixtyItem;
|
|
77
88
|
|
|
78
89
|
export declare type MediaLoadStrategy = "quality" | "balanced" | "speed";
|
|
79
90
|
|
|
@@ -119,6 +130,7 @@ declare type WebPlayerIconName =
|
|
|
119
130
|
| "UI_PLUS" // Increase zoom
|
|
120
131
|
| "UI_REDUCE" // Reducing an extended view
|
|
121
132
|
| "UI_360" // 360-degree view
|
|
133
|
+
| "UI_INTERIOR_360" // interior 360 view
|
|
122
134
|
| "UI_VOLUME" // Video volume
|
|
123
135
|
| "UI_VOLUME_OFF" // Muted video
|
|
124
136
|
| "CONTROLS_PREV" // Go to previous media
|
|
@@ -150,7 +162,7 @@ declare type WebPlayerProps_2 = {
|
|
|
150
162
|
compositionUrl: string;
|
|
151
163
|
|
|
152
164
|
// Layout
|
|
153
|
-
|
|
165
|
+
hideCategoriesNav?: boolean;
|
|
154
166
|
infiniteCarrousel?: boolean;
|
|
155
167
|
permanentGallery?: boolean;
|
|
156
168
|
|
|
@@ -159,10 +171,14 @@ declare type WebPlayerProps_2 = {
|
|
|
159
171
|
minMediaWidth?: MediaWidth;
|
|
160
172
|
maxMediaWidth?: MediaWidth;
|
|
161
173
|
preloadRange?: number;
|
|
174
|
+
autoLoad360?: boolean;
|
|
175
|
+
autoLoadInterior360?: boolean;
|
|
162
176
|
|
|
163
|
-
//
|
|
164
|
-
|
|
177
|
+
// Miscellaneous
|
|
178
|
+
categoriesFilter?: string;
|
|
179
|
+
extendBehavior?: ExtendBehavior;
|
|
165
180
|
eventPrefix?: string;
|
|
181
|
+
demoSpin?: boolean;
|
|
166
182
|
reverse360?: boolean;
|
|
167
183
|
};
|
|
168
184
|
|
package/dist/legacy.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { W, a as S, b as w, c as
|
|
2
|
-
import { D as oe, j as re, E as se, k as ie, n as ae, m as ce, r as le, q as
|
|
1
|
+
import { W, a as S, b as w, c as L, d as I, e as M, f as D } from "./shared-DKvJSb9q.js";
|
|
2
|
+
import { D as oe, j as re, E as se, k as ie, n as ae, m as ce, r as le, q as ue, p as pe, o as me, l as fe, g as be, h as Ee, i as de, s as he } from "./shared-DKvJSb9q.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import P from "react";
|
|
5
|
-
import
|
|
6
|
-
var
|
|
5
|
+
import O from "react-dom";
|
|
6
|
+
var R = Object.defineProperty, V = (e, t, n) => t in e ? R(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, f = (e, t, n) => (V(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
7
7
|
const v = {
|
|
8
8
|
stringify: (e) => e,
|
|
9
9
|
parse: (e) => e
|
|
@@ -27,7 +27,7 @@ const v = {
|
|
|
27
27
|
}, F = {
|
|
28
28
|
stringify: (e) => JSON.stringify(e),
|
|
29
29
|
parse: (e) => JSON.parse(e)
|
|
30
|
-
},
|
|
30
|
+
}, g = {
|
|
31
31
|
string: v,
|
|
32
32
|
number: j,
|
|
33
33
|
boolean: k,
|
|
@@ -40,49 +40,49 @@ function G(e) {
|
|
|
40
40
|
(t, n, s) => `${n}-${s.toLowerCase()}`
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
|
-
const
|
|
43
|
+
const b = Symbol.for("r2wc.render"), E = Symbol.for("r2wc.connected"), u = Symbol.for("r2wc.context"), l = Symbol.for("r2wc.props");
|
|
44
44
|
function $(e, t, n) {
|
|
45
45
|
var s, T, N;
|
|
46
46
|
t.props || (t.props = e.propTypes ? Object.keys(e.propTypes) : []);
|
|
47
|
-
const
|
|
48
|
-
for (const r of
|
|
47
|
+
const d = Array.isArray(t.props) ? t.props.slice() : Object.keys(t.props), m = {}, h = {}, y = {};
|
|
48
|
+
for (const r of d) {
|
|
49
49
|
m[r] = Array.isArray(t.props) ? "string" : t.props[r];
|
|
50
50
|
const o = G(r);
|
|
51
|
-
|
|
51
|
+
h[r] = o, y[o] = r;
|
|
52
52
|
}
|
|
53
53
|
class A extends HTMLElement {
|
|
54
54
|
constructor() {
|
|
55
55
|
super(), f(this, s, !0), f(this, T), f(this, N, {}), f(this, "container"), t.shadow ? this.container = this.attachShadow({
|
|
56
56
|
mode: t.shadow
|
|
57
57
|
}) : this.container = this, this[l].container = this.container;
|
|
58
|
-
for (const o of
|
|
59
|
-
const
|
|
60
|
-
a != null && a.parse && c && (this[l][o] = a.parse(c,
|
|
58
|
+
for (const o of d) {
|
|
59
|
+
const p = h[o], c = this.getAttribute(p), i = m[o], a = i ? g[i] : null;
|
|
60
|
+
a != null && a.parse && c && (this[l][o] = a.parse(c, p, this));
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
static get observedAttributes() {
|
|
64
64
|
return Object.keys(y);
|
|
65
65
|
}
|
|
66
66
|
connectedCallback() {
|
|
67
|
-
this[
|
|
67
|
+
this[E] = !0, this[b]();
|
|
68
68
|
}
|
|
69
69
|
disconnectedCallback() {
|
|
70
|
-
this[
|
|
70
|
+
this[E] = !1, this[u] && n.unmount(this[u]), delete this[u];
|
|
71
71
|
}
|
|
72
|
-
attributeChangedCallback(o,
|
|
73
|
-
const i = y[o], a = m[i], _ = a ?
|
|
74
|
-
i in m && _ != null && _.parse && c && (this[l][i] = _.parse(c, o, this), this[
|
|
72
|
+
attributeChangedCallback(o, p, c) {
|
|
73
|
+
const i = y[o], a = m[i], _ = a ? g[a] : null;
|
|
74
|
+
i in m && _ != null && _.parse && c && (this[l][i] = _.parse(c, o, this), this[b]());
|
|
75
75
|
}
|
|
76
|
-
[(s =
|
|
77
|
-
this[
|
|
76
|
+
[(s = E, T = u, N = l, b)]() {
|
|
77
|
+
this[E] && (this[u] ? n.update(this[u], this[l]) : this[u] = n.mount(
|
|
78
78
|
this.container,
|
|
79
79
|
e,
|
|
80
80
|
this[l]
|
|
81
81
|
));
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
for (const r of
|
|
85
|
-
const o =
|
|
84
|
+
for (const r of d) {
|
|
85
|
+
const o = h[r], p = m[r];
|
|
86
86
|
Object.defineProperty(A.prototype, r, {
|
|
87
87
|
enumerable: !0,
|
|
88
88
|
configurable: !0,
|
|
@@ -91,12 +91,12 @@ function $(e, t, n) {
|
|
|
91
91
|
},
|
|
92
92
|
set(c) {
|
|
93
93
|
this[l][r] = c;
|
|
94
|
-
const i =
|
|
94
|
+
const i = p ? g[p] : null;
|
|
95
95
|
if (i != null && i.stringify) {
|
|
96
96
|
const a = i.stringify(c, o, this);
|
|
97
97
|
this.getAttribute(o) !== a && this.setAttribute(o, a);
|
|
98
98
|
} else
|
|
99
|
-
this[
|
|
99
|
+
this[b]();
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
}
|
|
@@ -104,33 +104,41 @@ function $(e, t, n) {
|
|
|
104
104
|
}
|
|
105
105
|
function Y(e, t, n) {
|
|
106
106
|
const s = P.createElement(t, n);
|
|
107
|
-
return
|
|
107
|
+
return O.render(s, e), {
|
|
108
108
|
container: e,
|
|
109
109
|
ReactComponent: t
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function B({ container: e, ReactComponent: t }, n) {
|
|
113
113
|
const s = P.createElement(t, n);
|
|
114
|
-
|
|
114
|
+
O.render(s, e);
|
|
115
115
|
}
|
|
116
|
-
function
|
|
117
|
-
|
|
116
|
+
function H({ container: e }) {
|
|
117
|
+
O.unmountComponentAtNode(e);
|
|
118
118
|
}
|
|
119
119
|
function C(e, t = {}) {
|
|
120
|
-
return $(e, t, { mount: Y, update:
|
|
120
|
+
return $(e, t, { mount: Y, update: B, unmount: H });
|
|
121
121
|
}
|
|
122
|
-
const
|
|
122
|
+
const U = C(W, {
|
|
123
123
|
shadow: "open",
|
|
124
124
|
props: {
|
|
125
125
|
compositionUrl: "string",
|
|
126
|
-
|
|
126
|
+
// Layout
|
|
127
|
+
hideCategoriesNav: "boolean",
|
|
127
128
|
infiniteCarrousel: "boolean",
|
|
128
129
|
permanentGallery: "boolean",
|
|
130
|
+
// Medias loading
|
|
129
131
|
minMediaWidth: "number",
|
|
130
132
|
maxMediaWidth: "number",
|
|
131
133
|
mediaLoadStrategy: "string",
|
|
132
|
-
|
|
134
|
+
preloadRange: "number",
|
|
135
|
+
autoLoad360: "boolean",
|
|
136
|
+
autoLoadInterior360: "boolean",
|
|
137
|
+
// Miscellaneous
|
|
138
|
+
categoriesFilter: "string",
|
|
139
|
+
extendBehavior: "string",
|
|
133
140
|
eventPrefix: "string",
|
|
141
|
+
demoSpin: "boolean",
|
|
134
142
|
reverse360: "boolean"
|
|
135
143
|
}
|
|
136
144
|
}), J = C(S, {
|
|
@@ -146,13 +154,13 @@ const B = C(W, {
|
|
|
146
154
|
}
|
|
147
155
|
});
|
|
148
156
|
function q() {
|
|
149
|
-
customElements.define(
|
|
157
|
+
customElements.define(I, U), customElements.define(
|
|
150
158
|
M,
|
|
151
159
|
J
|
|
152
160
|
), customElements.define(D, X);
|
|
153
161
|
}
|
|
154
162
|
function z() {
|
|
155
|
-
|
|
163
|
+
L() || q();
|
|
156
164
|
}
|
|
157
165
|
z();
|
|
158
166
|
export {
|
|
@@ -163,14 +171,14 @@ export {
|
|
|
163
171
|
ae as EVENT_EXTEND_MODE_OFF,
|
|
164
172
|
ce as EVENT_EXTEND_MODE_ON,
|
|
165
173
|
le as EVENT_GALLERY_CLOSE,
|
|
166
|
-
|
|
167
|
-
|
|
174
|
+
ue as EVENT_GALLERY_OPEN,
|
|
175
|
+
pe as EVENT_HOTSPOTS_OFF,
|
|
168
176
|
me as EVENT_HOTSPOTS_ON,
|
|
169
177
|
fe as EVENT_ITEM_CHANGE,
|
|
170
178
|
D as WEB_PLAYER_ICON_WC_TAG,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
179
|
+
I as WEB_PLAYER_WC_TAG,
|
|
180
|
+
be as WebPlayer,
|
|
181
|
+
Ee as WebPlayerCustomMedia,
|
|
182
|
+
de as WebPlayerIcon,
|
|
183
|
+
he as generateCompositionUrl
|
|
176
184
|
};
|