@car-cutter/react-webplayer 0.10.0 → 0.11.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 +10 -5
- package/dist/index.js +52 -45
- package/dist/legacy.cjs +1 -1
- package/dist/legacy.d.ts +10 -5
- package/dist/legacy.js +44 -37
- package/dist/shared-B4kKjNn6.js +2935 -0
- package/dist/shared-DURk-_r6.cjs +1 -0
- package/package.json +5 -5
- 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-DURk-_r6.cjs");require("react/jsx-runtime");const g=require("react"),W=require("react-dom/client");var S=Object.defineProperty,L=(e,t,o)=>t in e?S(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,b=(e,t,o)=>(L(e,typeof t!="symbol"?t+"":t,o),o);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,o)=>{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(o):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,o,i)=>`${o}-${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,o){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 r=w(s);f[s]=r,h[r]=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 r of d){const _=f[r],c=this.getAttribute(_),a=p[r],E=a?y[a]:null;E!=null&&E.parse&&c&&(this[l][r]=E.parse(c,_,this))}}static get observedAttributes(){return Object.keys(h)}connectedCallback(){this[m]=!0,this[T]()}disconnectedCallback(){this[m]=!1,this[u]&&o.unmount(this[u]),delete this[u]}attributeChangedCallback(r,_,c){const a=h[r],E=p[a],N=E?y[E]:null;a in p&&N!=null&&N.parse&&c&&(this[l][a]=N.parse(c,r,this),this[T]())}[(i=m,O=u,A=l,T)](){this[m]&&(this[u]?o.update(this[u],this[l]):this[u]=o.mount(this.container,e,this[l]))}}for(const s of d){const r=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,r,this);this.getAttribute(r)!==E&&this.setAttribute(r,E)}else this[T]()}})}return P}function F(e,t,o){const i=W.createRoot(e),O=g.createElement(t,o);return i.render(O),{root:i,ReactComponent:t}}function v({root:e,ReactComponent:t},o){const i=g.createElement(t,o);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,{shadow:"open",props:{compositionUrl:"string",hideCategoriesNav:"boolean",infiniteCarrousel:"boolean",permanentGallery:"boolean",minMediaWidth:"number",maxMediaWidth:"number",mediaLoadStrategy:"string",preloadRange:"number",autoLoad360:"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 = {
|
|
@@ -150,7 +152,7 @@ declare type WebPlayerProps_2 = {
|
|
|
150
152
|
compositionUrl: string;
|
|
151
153
|
|
|
152
154
|
// Layout
|
|
153
|
-
|
|
155
|
+
hideCategoriesNav?: boolean;
|
|
154
156
|
infiniteCarrousel?: boolean;
|
|
155
157
|
permanentGallery?: boolean;
|
|
156
158
|
|
|
@@ -159,10 +161,13 @@ declare type WebPlayerProps_2 = {
|
|
|
159
161
|
minMediaWidth?: MediaWidth;
|
|
160
162
|
maxMediaWidth?: MediaWidth;
|
|
161
163
|
preloadRange?: number;
|
|
164
|
+
autoLoad360?: boolean;
|
|
162
165
|
|
|
163
166
|
// Miscelaneous
|
|
164
|
-
|
|
167
|
+
categoriesFilter?: string;
|
|
168
|
+
extendBehavior?: ExtendBehavior;
|
|
165
169
|
eventPrefix?: string;
|
|
170
|
+
demoSpin?: boolean;
|
|
166
171
|
reverse360?: boolean;
|
|
167
172
|
};
|
|
168
173
|
|
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-B4kKjNn6.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 he, s as de } from "./shared-B4kKjNn6.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"), h = 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
47
|
const d = Array.isArray(t.props) ? t.props.slice() : Object.keys(t.props), m = {}, y = {}, _ = {};
|
|
48
|
-
for (const
|
|
49
|
-
m[
|
|
50
|
-
const o = G(
|
|
51
|
-
y[
|
|
48
|
+
for (const s of d) {
|
|
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
58
|
for (const o of d) {
|
|
59
|
-
const p = y[o], c = this.getAttribute(p), i = m[o], a = i ?
|
|
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,16 +64,16 @@ function Y(e, t, n) {
|
|
|
64
64
|
return Object.keys(_);
|
|
65
65
|
}
|
|
66
66
|
connectedCallback() {
|
|
67
|
-
this[h] = !0, this[
|
|
67
|
+
this[h] = !0, this[E]();
|
|
68
68
|
}
|
|
69
69
|
disconnectedCallback() {
|
|
70
70
|
this[h] = !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
|
-
[(
|
|
76
|
+
[(r = h, f = u, C = l, E)]() {
|
|
77
77
|
this[h] && (this[u] ? n.update(this[u], this[l]) : this[u] = n.mount(
|
|
78
78
|
this.container,
|
|
79
79
|
e,
|
|
@@ -81,58 +81,65 @@ function Y(e, t, n) {
|
|
|
81
81
|
));
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
for (const
|
|
85
|
-
const o = y[
|
|
86
|
-
Object.defineProperty(N.prototype,
|
|
84
|
+
for (const s of d) {
|
|
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
|
|
124
|
+
const $ = T(P, {
|
|
125
125
|
shadow: "open",
|
|
126
126
|
props: {
|
|
127
127
|
compositionUrl: "string",
|
|
128
|
-
|
|
128
|
+
// Layout
|
|
129
|
+
hideCategoriesNav: "boolean",
|
|
129
130
|
infiniteCarrousel: "boolean",
|
|
130
131
|
permanentGallery: "boolean",
|
|
132
|
+
// Medias loading
|
|
131
133
|
minMediaWidth: "number",
|
|
132
134
|
maxMediaWidth: "number",
|
|
133
135
|
mediaLoadStrategy: "string",
|
|
134
|
-
|
|
136
|
+
preloadRange: "number",
|
|
137
|
+
autoLoad360: "boolean",
|
|
138
|
+
// Miscelaneous
|
|
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
|
-
|
|
180
|
+
L as WEB_PLAYER_WC_TAG,
|
|
181
|
+
be as WebPlayer,
|
|
182
|
+
Ee as WebPlayerCustomMedia,
|
|
176
183
|
he as WebPlayerIcon,
|
|
177
184
|
de 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-DURk-_r6.cjs");require("react/jsx-runtime");const W=require("react"),y=require("react-dom");var S=Object.defineProperty,L=(e,t,o)=>t in e?S(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,O=(e,t,o)=>(L(e,typeof t!="symbol"?t+"":t,o),o);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,o)=>{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(o):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,o,s)=>`${o}-${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,o){var s,A,P;t.props||(t.props=e.propTypes?Object.keys(e.propTypes):[]);const m=Array.isArray(t.props)?t.props.slice():Object.keys(t.props),p={},d={},f={};for(const i of m){p[i]=Array.isArray(t.props)?"string":t.props[i];const r=w(i);d[i]=r,f[r]=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 r of m){const _=d[r],c=this.getAttribute(_),a=p[r],E=a?N[a]:null;E!=null&&E.parse&&c&&(this[l][r]=E.parse(c,_,this))}}static get observedAttributes(){return Object.keys(f)}connectedCallback(){this[T]=!0,this[b]()}disconnectedCallback(){this[T]=!1,this[u]&&o.unmount(this[u]),delete this[u]}attributeChangedCallback(r,_,c){const a=f[r],E=p[a],h=E?N[E]:null;a in p&&h!=null&&h.parse&&c&&(this[l][a]=h.parse(c,r,this),this[b]())}[(s=T,A=u,P=l,b)](){this[T]&&(this[u]?o.update(this[u],this[l]):this[u]=o.mount(this.container,e,this[l]))}}for(const i of m){const r=d[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,r,this);this.getAttribute(r)!==E&&this.setAttribute(r,E)}else this[b]()}})}return g}function F(e,t,o){const s=W.createElement(t,o);return y.render(s,e),{container:e,ReactComponent:t}}function v({container:e,ReactComponent:t},o){const s=W.createElement(t,o);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",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 = {
|
|
@@ -150,7 +152,7 @@ declare type WebPlayerProps_2 = {
|
|
|
150
152
|
compositionUrl: string;
|
|
151
153
|
|
|
152
154
|
// Layout
|
|
153
|
-
|
|
155
|
+
hideCategoriesNav?: boolean;
|
|
154
156
|
infiniteCarrousel?: boolean;
|
|
155
157
|
permanentGallery?: boolean;
|
|
156
158
|
|
|
@@ -159,10 +161,13 @@ declare type WebPlayerProps_2 = {
|
|
|
159
161
|
minMediaWidth?: MediaWidth;
|
|
160
162
|
maxMediaWidth?: MediaWidth;
|
|
161
163
|
preloadRange?: number;
|
|
164
|
+
autoLoad360?: boolean;
|
|
162
165
|
|
|
163
166
|
// Miscelaneous
|
|
164
|
-
|
|
167
|
+
categoriesFilter?: string;
|
|
168
|
+
extendBehavior?: ExtendBehavior;
|
|
165
169
|
eventPrefix?: string;
|
|
170
|
+
demoSpin?: boolean;
|
|
166
171
|
reverse360?: boolean;
|
|
167
172
|
};
|
|
168
173
|
|
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 pe, p as ue, o as me, l as fe, g as
|
|
1
|
+
import { W, a as S, b as w, c as L, d as I, e as M, f as D } from "./shared-B4kKjNn6.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 pe, p as ue, o as me, l as fe, g as be, h as Ee, i as de, s as he } from "./shared-B4kKjNn6.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,23 +40,23 @@ 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"), p = 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 u =
|
|
58
|
+
for (const o of d) {
|
|
59
|
+
const u = h[o], c = this.getAttribute(u), i = m[o], a = i ? g[i] : null;
|
|
60
60
|
a != null && a.parse && c && (this[l][o] = a.parse(c, u, this));
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -64,25 +64,25 @@ function $(e, t, n) {
|
|
|
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[p] && n.unmount(this[p]), delete this[p];
|
|
71
71
|
}
|
|
72
72
|
attributeChangedCallback(o, u, c) {
|
|
73
|
-
const i = y[o], a = m[i], _ = a ?
|
|
74
|
-
i in m && _ != null && _.parse && c && (this[l][i] = _.parse(c, o, this), this[
|
|
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 = p, N = l, b)]() {
|
|
77
|
+
this[E] && (this[p] ? n.update(this[p], this[l]) : this[p] = 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], u = 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 = u ?
|
|
94
|
+
const i = u ? g[u] : 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,40 @@ 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
|
+
// Miscelaneous
|
|
137
|
+
categoriesFilter: "string",
|
|
138
|
+
extendBehavior: "string",
|
|
133
139
|
eventPrefix: "string",
|
|
140
|
+
demoSpin: "boolean",
|
|
134
141
|
reverse360: "boolean"
|
|
135
142
|
}
|
|
136
143
|
}), J = C(S, {
|
|
@@ -146,13 +153,13 @@ const B = C(W, {
|
|
|
146
153
|
}
|
|
147
154
|
});
|
|
148
155
|
function q() {
|
|
149
|
-
customElements.define(
|
|
156
|
+
customElements.define(I, U), customElements.define(
|
|
150
157
|
M,
|
|
151
158
|
J
|
|
152
159
|
), customElements.define(D, X);
|
|
153
160
|
}
|
|
154
161
|
function z() {
|
|
155
|
-
|
|
162
|
+
L() || q();
|
|
156
163
|
}
|
|
157
164
|
z();
|
|
158
165
|
export {
|
|
@@ -168,9 +175,9 @@ export {
|
|
|
168
175
|
me as EVENT_HOTSPOTS_ON,
|
|
169
176
|
fe as EVENT_ITEM_CHANGE,
|
|
170
177
|
D as WEB_PLAYER_ICON_WC_TAG,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
178
|
+
I as WEB_PLAYER_WC_TAG,
|
|
179
|
+
be as WebPlayer,
|
|
180
|
+
Ee as WebPlayerCustomMedia,
|
|
181
|
+
de as WebPlayerIcon,
|
|
182
|
+
he as generateCompositionUrl
|
|
176
183
|
};
|