@car-cutter/react-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.cjs +1 -1
- package/dist/index.d.ts +114 -1
- package/dist/index.js +69 -59
- package/dist/legacy.cjs +1 -1
- package/dist/legacy.d.ts +114 -1
- package/dist/legacy.js +76 -66
- package/dist/shared-BQBvv8Dz.cjs +27 -0
- package/dist/shared-rIRhmgIF.js +5603 -0
- package/package.json +5 -5
- package/dist/shared-Cla45QLW.js +0 -5068
- package/dist/shared-D8bO3EfR.cjs +0 -27
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./shared-BQBvv8Dz.cjs");require("react/jsx-runtime");const P=require("react"),I=require("react-dom/client");var S=Object.defineProperty,L=(e,n,o)=>n in e?S(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,p=(e,n,o)=>(L(e,typeof n!="symbol"?n+"":n,o),o);const W={stringify:e=>e,parse:e=>e},V={stringify:e=>`${e}`,parse:e=>parseFloat(e)},R={stringify:e=>e?"true":"false",parse:e=>/^[ty1-9]/i.test(e)},D={stringify:e=>e.name,parse:(e,n,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}},M={stringify:e=>JSON.stringify(e),parse:e=>JSON.parse(e)},f={string:W,number:V,boolean:R,function:D,json:M};function w(e){return e.replace(/([a-z0-9])([A-Z])/g,(n,o,i)=>`${o}-${i.toLowerCase()}`)}const O=Symbol.for("r2wc.render"),N=Symbol.for("r2wc.connected"),u=Symbol.for("r2wc.context"),c=Symbol.for("r2wc.props");function Y(e,n,o){var i,b,C;n.props||(n.props=e.propTypes?Object.keys(e.propTypes):[]);const m=Array.isArray(n.props)?n.props.slice():Object.keys(n.props),T={},d={},y={};for(const s of m){T[s]=Array.isArray(n.props)?"string":n.props[s];const r=w(s);d[s]=r,y[r]=s}class g extends HTMLElement{constructor(){super(),p(this,i,!0),p(this,b),p(this,C,{}),p(this,"container"),n.shadow?this.container=this.attachShadow({mode:n.shadow}):this.container=this,this[c].container=this.container;for(const r of m){const _=d[r],l=this.getAttribute(_),a=T[r],E=a?f[a]:null;E!=null&&E.parse&&l&&(this[c][r]=E.parse(l,_,this))}}static get observedAttributes(){return Object.keys(y)}connectedCallback(){this[N]=!0,this[O]()}disconnectedCallback(){this[N]=!1,this[u]&&o.unmount(this[u]),delete this[u]}attributeChangedCallback(r,_,l){const a=y[r],E=T[a],A=E?f[E]:null;a in T&&A!=null&&A.parse&&l&&(this[c][a]=A.parse(l,r,this),this[O]())}[(i=N,b=u,C=c,O)](){this[N]&&(this[u]?o.update(this[u],this[c]):this[u]=o.mount(this.container,e,this[c]))}}for(const s of m){const r=d[s],_=T[s];Object.defineProperty(g.prototype,s,{enumerable:!0,configurable:!0,get(){return this[c][s]},set(l){this[c][s]=l;const a=_?f[_]:null;if(a!=null&&a.stringify){const E=a.stringify(l,r,this);this.getAttribute(r)!==E&&this.setAttribute(r,E)}else this[O]()}})}return g}function G(e,n,o){const i=I.createRoot(e),b=P.createElement(n,o);return i.render(b),{root:i,ReactComponent:n}}function F({root:e,ReactComponent:n},o){const i=P.createElement(n,o);e.render(i)}function v({root:e}){setTimeout(()=>{e.unmount()},0)}function h(e,n={}){return Y(e,n,{mount:G,update:F,unmount:v})}const j=h(t.WebPlayerWithInjectedStyles,{shadow:"closed",props:{compositionUrl:"string",hideCategoriesNav:"boolean",infiniteCarrousel:"boolean",permanentGallery:"boolean",integration:"boolean",maxItemsShown:"number",minMediaWidth:"number",maxMediaWidth:"number",mediaLoadStrategy:"string",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"}}),x=h(t.WebPlayerCustomMedia,{shadow:"closed",props:{index:"number",thumbnailSrc:"string"}}),B=h(t.WebPlayerIcon,{shadow:"closed",props:{name:"string"}});function k(){customElements.define(t.WEB_PLAYER_WC_TAG,j),customElements.define(t.WEB_PLAYER_CUSTOM_MEDIA_WC_TAG,x),customElements.define(t.WEB_PLAYER_ICON_WC_TAG,B)}function H(){t.checkCustomElementsDefinition()||k()}H();exports.ANALYTICS_EVENT_IDENTIFY=t.ANALYTICS_EVENT_IDENTIFY;exports.ANALYTICS_EVENT_PAGE=t.ANALYTICS_EVENT_PAGE;exports.ANALYTICS_EVENT_TRACK=t.ANALYTICS_EVENT_TRACK;exports.DEFAULT_EVENT_PREFIX=t.DEFAULT_EVENT_PREFIX;exports.EVENT_COMPOSITION_LOADED=t.EVENT_COMPOSITION_LOADED;exports.EVENT_COMPOSITION_LOADING=t.EVENT_COMPOSITION_LOADING;exports.EVENT_COMPOSITION_LOAD_ERROR=t.EVENT_COMPOSITION_LOAD_ERROR;exports.EVENT_EXTEND_MODE_OFF=t.EVENT_EXTEND_MODE_OFF;exports.EVENT_EXTEND_MODE_ON=t.EVENT_EXTEND_MODE_ON;exports.EVENT_GALLERY_CLOSE=t.EVENT_GALLERY_CLOSE;exports.EVENT_GALLERY_OPEN=t.EVENT_GALLERY_OPEN;exports.EVENT_HOTSPOTS_OFF=t.EVENT_HOTSPOTS_OFF;exports.EVENT_HOTSPOTS_ON=t.EVENT_HOTSPOTS_ON;exports.EVENT_ITEM_CHANGE=t.EVENT_ITEM_CHANGE;exports.WEB_PLAYER_ICON_WC_TAG=t.WEB_PLAYER_ICON_WC_TAG;exports.WEB_PLAYER_WC_TAG=t.WEB_PLAYER_WC_TAG;exports.WebPlayer=t.WebPlayer;exports.WebPlayerCustomMedia=t.WebPlayerCustomMedia$1;exports.WebPlayerIcon=t.WebPlayerIcon$1;exports.generateCompositionUrl=t.generateCompositionUrl;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,107 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
|
+
export declare const ANALYTICS_EVENT_IDENTIFY = "analytics-identify";
|
|
5
|
+
|
|
6
|
+
export declare const ANALYTICS_EVENT_PAGE = "analytics-page";
|
|
7
|
+
|
|
8
|
+
export declare const ANALYTICS_EVENT_TRACK = "analytics-track";
|
|
9
|
+
|
|
10
|
+
declare type AnalyticsEventBase = {
|
|
11
|
+
type: AnalyticsEventType;
|
|
12
|
+
timestamp: string;
|
|
13
|
+
instance_id: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare type AnalyticsEventType =
|
|
17
|
+
| AnalyticsEventTypeIdentify
|
|
18
|
+
| AnalyticsEventTypePage
|
|
19
|
+
| AnalyticsEventTypeTrack;
|
|
20
|
+
|
|
21
|
+
declare type AnalyticsEventTypeIdentify = "identify";
|
|
22
|
+
|
|
23
|
+
declare type AnalyticsEventTypePage = "page";
|
|
24
|
+
|
|
25
|
+
declare type AnalyticsEventTypeTrack = "track";
|
|
26
|
+
|
|
27
|
+
declare type AnalyticsIdentifyEvent = Omit<AnalyticsEventBase, "type"> &
|
|
28
|
+
AnalyticsIdentifyEventProps;
|
|
29
|
+
|
|
30
|
+
declare type AnalyticsIdentifyEventProps = {
|
|
31
|
+
type: AnalyticsEventTypeIdentify;
|
|
32
|
+
browser_id: string;
|
|
33
|
+
session_id: string;
|
|
34
|
+
referrer: string;
|
|
35
|
+
origin: string;
|
|
36
|
+
page_url: string;
|
|
37
|
+
user_agent: string;
|
|
38
|
+
wp_properties: {
|
|
39
|
+
composition_url: string;
|
|
40
|
+
|
|
41
|
+
// Integration mode
|
|
42
|
+
integration: boolean;
|
|
43
|
+
max_items_shown: number;
|
|
44
|
+
|
|
45
|
+
// Layout
|
|
46
|
+
hide_categories_nav: boolean;
|
|
47
|
+
infinite_carrousel: boolean;
|
|
48
|
+
permanent_gallery: boolean;
|
|
49
|
+
|
|
50
|
+
// Medias loading
|
|
51
|
+
media_load_strategy: string;
|
|
52
|
+
min_media_width: number;
|
|
53
|
+
max_media_width: number;
|
|
54
|
+
preload_range: number;
|
|
55
|
+
auto_load_360: boolean;
|
|
56
|
+
auto_load_interior_360: boolean;
|
|
57
|
+
|
|
58
|
+
// Miscellaneous
|
|
59
|
+
categories_filter: string;
|
|
60
|
+
extend_behavior: string;
|
|
61
|
+
event_prefix: string;
|
|
62
|
+
demo_spin: boolean;
|
|
63
|
+
reverse_360: boolean;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
declare type AnalyticsPageEvent = Omit<AnalyticsEventBase, "type"> &
|
|
68
|
+
AnalyticsPageEventProps;
|
|
69
|
+
|
|
70
|
+
declare type AnalyticsPageEventProps = {
|
|
71
|
+
type: AnalyticsEventTypePage;
|
|
72
|
+
category_id: string;
|
|
73
|
+
category_name: string;
|
|
74
|
+
items_count: number;
|
|
75
|
+
page_properties: {
|
|
76
|
+
item_type: string;
|
|
77
|
+
item_position: number;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
declare type AnalyticsTrackEvent = Omit<AnalyticsEventBase, "type"> &
|
|
82
|
+
AnalyticsTrackEventProps;
|
|
83
|
+
|
|
84
|
+
declare type AnalyticsTrackEventProps = {
|
|
85
|
+
type: AnalyticsEventTypeTrack;
|
|
86
|
+
category_id: string;
|
|
87
|
+
category_name: string;
|
|
88
|
+
item_type: string;
|
|
89
|
+
item_position: number;
|
|
90
|
+
action_properties: {
|
|
91
|
+
action_name: string;
|
|
92
|
+
action_field: string;
|
|
93
|
+
action_value:
|
|
94
|
+
| bigint
|
|
95
|
+
| boolean
|
|
96
|
+
| null
|
|
97
|
+
| number
|
|
98
|
+
| string
|
|
99
|
+
| symbol
|
|
100
|
+
| undefined
|
|
101
|
+
| object;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
|
|
4
105
|
declare type AspectRatio = `${number}:${number}`;
|
|
5
106
|
|
|
6
107
|
declare type Category = {
|
|
@@ -43,7 +144,7 @@ declare type ExtendBehavior = "full_screen" | "event" | "none";
|
|
|
43
144
|
/**
|
|
44
145
|
* Generates a URL for fetching the composition JSON for a given customer and vehicle.
|
|
45
146
|
*
|
|
46
|
-
* @param {string} customerToken - The CarCutter Customer Token (computed by
|
|
147
|
+
* @param {string} customerToken - The CarCutter Customer Token (computed by hashing the Customer ID with SHA-256).
|
|
47
148
|
* @param {string} vin - The Vehicle Identification Number.
|
|
48
149
|
* @returns {string} The URL to fetch the composition JSON.
|
|
49
150
|
*/
|
|
@@ -58,6 +159,7 @@ declare type Hotspot = {
|
|
|
58
159
|
title: string;
|
|
59
160
|
icon?: string;
|
|
60
161
|
description?: string;
|
|
162
|
+
type?: "damage" | "feature";
|
|
61
163
|
position: {
|
|
62
164
|
x: number;
|
|
63
165
|
y: number;
|
|
@@ -158,6 +260,9 @@ export declare type WebPlayerProps = PropsWithChildren<WebPlayerProps_2> & {
|
|
|
158
260
|
onHotspotsOff?: () => void;
|
|
159
261
|
onGalleryOpen?: () => void;
|
|
160
262
|
onGalleryClose?: () => void;
|
|
263
|
+
onAnalyticsIdentify?: (event: AnalyticsIdentifyEvent) => void;
|
|
264
|
+
onAnalyticsPage?: (event: AnalyticsPageEvent) => void;
|
|
265
|
+
onAnalyticsTrack?: (event: AnalyticsTrackEvent) => void;
|
|
161
266
|
} & Pick<React.HTMLAttributes<HTMLElement>, "className" | "style">;
|
|
162
267
|
|
|
163
268
|
declare type WebPlayerProps_2 = {
|
|
@@ -186,6 +291,14 @@ declare type WebPlayerProps_2 = {
|
|
|
186
291
|
eventPrefix?: string;
|
|
187
292
|
demoSpin?: boolean;
|
|
188
293
|
reverse360?: boolean;
|
|
294
|
+
|
|
295
|
+
// Analytics
|
|
296
|
+
analyticsEventPrefix?: string;
|
|
297
|
+
analyticsUrl?: string;
|
|
298
|
+
analyticsBearer?: string;
|
|
299
|
+
analyticsSimpleRequestsOnly?: boolean;
|
|
300
|
+
analyticsDryRun?: boolean;
|
|
301
|
+
analyticsDebug?: boolean;
|
|
189
302
|
};
|
|
190
303
|
|
|
191
304
|
export { }
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { W as
|
|
2
|
-
import {
|
|
1
|
+
import { W as S, a as P, b as I, c as W, d as w, e as L, f as D } from "./shared-rIRhmgIF.js";
|
|
2
|
+
import { A as oe, s as re, t as se, D as ie, j as ae, E as le, k as ce, n as ue, m as pe, r as me, q as Ee, p as be, o as fe, l as de, g as he, h as ye, i as _e, u as ge } from "./shared-rIRhmgIF.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
|
-
import
|
|
5
|
-
import { createRoot as
|
|
6
|
-
var
|
|
4
|
+
import N from "react";
|
|
5
|
+
import { createRoot as R } from "react-dom/client";
|
|
6
|
+
var V = Object.defineProperty, M = (e, t, n) => t in e ? V(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, b = (e, t, n) => (M(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
|
+
}, T = {
|
|
31
31
|
string: v,
|
|
32
32
|
number: x,
|
|
33
33
|
boolean: j,
|
|
@@ -40,9 +40,9 @@ function G(e) {
|
|
|
40
40
|
(t, n, r) => `${n}-${r.toLowerCase()}`
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
|
-
const
|
|
43
|
+
const f = Symbol.for("r2wc.render"), d = Symbol.for("r2wc.connected"), u = Symbol.for("r2wc.context"), c = Symbol.for("r2wc.props");
|
|
44
44
|
function Y(e, t, n) {
|
|
45
|
-
var r,
|
|
45
|
+
var r, E, C;
|
|
46
46
|
t.props || (t.props = e.propTypes ? Object.keys(e.propTypes) : []);
|
|
47
47
|
const h = Array.isArray(t.props) ? t.props.slice() : Object.keys(t.props), m = {}, y = {}, _ = {};
|
|
48
48
|
for (const s of h) {
|
|
@@ -50,78 +50,78 @@ function Y(e, t, n) {
|
|
|
50
50
|
const o = G(s);
|
|
51
51
|
y[s] = o, _[o] = s;
|
|
52
52
|
}
|
|
53
|
-
class
|
|
53
|
+
class A extends HTMLElement {
|
|
54
54
|
constructor() {
|
|
55
|
-
super(),
|
|
55
|
+
super(), b(this, r, !0), b(this, E), b(this, C, {}), b(this, "container"), t.shadow ? this.container = this.attachShadow({
|
|
56
56
|
mode: t.shadow
|
|
57
|
-
}) : this.container = this, this[
|
|
57
|
+
}) : this.container = this, this[c].container = this.container;
|
|
58
58
|
for (const o of h) {
|
|
59
|
-
const p = y[o],
|
|
60
|
-
a != null && a.parse &&
|
|
59
|
+
const p = y[o], l = this.getAttribute(p), i = m[o], a = i ? T[i] : null;
|
|
60
|
+
a != null && a.parse && l && (this[c][o] = a.parse(l, p, this));
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
static get observedAttributes() {
|
|
64
64
|
return Object.keys(_);
|
|
65
65
|
}
|
|
66
66
|
connectedCallback() {
|
|
67
|
-
this[d] = !0, this[
|
|
67
|
+
this[d] = !0, this[f]();
|
|
68
68
|
}
|
|
69
69
|
disconnectedCallback() {
|
|
70
70
|
this[d] = !1, this[u] && n.unmount(this[u]), delete this[u];
|
|
71
71
|
}
|
|
72
|
-
attributeChangedCallback(o, p,
|
|
73
|
-
const i = _[o], a = m[i], g = a ?
|
|
74
|
-
i in m && g != null && g.parse &&
|
|
72
|
+
attributeChangedCallback(o, p, l) {
|
|
73
|
+
const i = _[o], a = m[i], g = a ? T[a] : null;
|
|
74
|
+
i in m && g != null && g.parse && l && (this[c][i] = g.parse(l, o, this), this[f]());
|
|
75
75
|
}
|
|
76
|
-
[(r = d,
|
|
77
|
-
this[d] && (this[u] ? n.update(this[u], this[
|
|
76
|
+
[(r = d, E = u, C = c, f)]() {
|
|
77
|
+
this[d] && (this[u] ? n.update(this[u], this[c]) : this[u] = n.mount(
|
|
78
78
|
this.container,
|
|
79
79
|
e,
|
|
80
|
-
this[
|
|
80
|
+
this[c]
|
|
81
81
|
));
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
for (const s of h) {
|
|
85
85
|
const o = y[s], p = m[s];
|
|
86
|
-
Object.defineProperty(
|
|
86
|
+
Object.defineProperty(A.prototype, s, {
|
|
87
87
|
enumerable: !0,
|
|
88
88
|
configurable: !0,
|
|
89
89
|
get() {
|
|
90
|
-
return this[
|
|
90
|
+
return this[c][s];
|
|
91
91
|
},
|
|
92
|
-
set(
|
|
93
|
-
this[
|
|
94
|
-
const i = p ?
|
|
92
|
+
set(l) {
|
|
93
|
+
this[c][s] = l;
|
|
94
|
+
const i = p ? T[p] : null;
|
|
95
95
|
if (i != null && i.stringify) {
|
|
96
|
-
const a = i.stringify(
|
|
96
|
+
const a = i.stringify(l, o, this);
|
|
97
97
|
this.getAttribute(o) !== a && this.setAttribute(o, a);
|
|
98
98
|
} else
|
|
99
|
-
this[
|
|
99
|
+
this[f]();
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
return
|
|
103
|
+
return A;
|
|
104
104
|
}
|
|
105
105
|
function B(e, t, n) {
|
|
106
|
-
const r =
|
|
107
|
-
return r.render(
|
|
106
|
+
const r = R(e), E = N.createElement(t, n);
|
|
107
|
+
return r.render(E), {
|
|
108
108
|
root: r,
|
|
109
109
|
ReactComponent: t
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
const r =
|
|
112
|
+
function U({ root: e, ReactComponent: t }, n) {
|
|
113
|
+
const r = N.createElement(t, n);
|
|
114
114
|
e.render(r);
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function H({ root: e }) {
|
|
117
117
|
setTimeout(() => {
|
|
118
118
|
e.unmount();
|
|
119
119
|
}, 0);
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
return Y(e, t, { mount: B, update:
|
|
121
|
+
function O(e, t = {}) {
|
|
122
|
+
return Y(e, t, { mount: B, update: U, unmount: H });
|
|
123
123
|
}
|
|
124
|
-
const $ =
|
|
124
|
+
const $ = O(S, {
|
|
125
125
|
shadow: "closed",
|
|
126
126
|
props: {
|
|
127
127
|
compositionUrl: "string",
|
|
@@ -143,46 +143,56 @@ const $ = T(P, {
|
|
|
143
143
|
extendBehavior: "string",
|
|
144
144
|
eventPrefix: "string",
|
|
145
145
|
demoSpin: "boolean",
|
|
146
|
-
reverse360: "boolean"
|
|
146
|
+
reverse360: "boolean",
|
|
147
|
+
// Analytics
|
|
148
|
+
analyticsEventPrefix: "string",
|
|
149
|
+
analyticsUrl: "string",
|
|
150
|
+
analyticsBearer: "string",
|
|
151
|
+
analyticsSimpleRequestsOnly: "boolean",
|
|
152
|
+
analyticsDryRun: "boolean",
|
|
153
|
+
analyticsDebug: "boolean"
|
|
147
154
|
}
|
|
148
|
-
}), J =
|
|
155
|
+
}), J = O(P, {
|
|
149
156
|
shadow: "closed",
|
|
150
157
|
props: {
|
|
151
158
|
index: "number",
|
|
152
159
|
thumbnailSrc: "string"
|
|
153
160
|
}
|
|
154
|
-
}), X =
|
|
161
|
+
}), X = O(I, {
|
|
155
162
|
shadow: "closed",
|
|
156
163
|
props: {
|
|
157
164
|
name: "string"
|
|
158
165
|
}
|
|
159
166
|
});
|
|
160
167
|
function q() {
|
|
161
|
-
customElements.define(
|
|
168
|
+
customElements.define(w, $), customElements.define(
|
|
162
169
|
L,
|
|
163
170
|
J
|
|
164
|
-
), customElements.define(
|
|
171
|
+
), customElements.define(D, X);
|
|
165
172
|
}
|
|
166
173
|
function z() {
|
|
167
|
-
|
|
174
|
+
W() || q();
|
|
168
175
|
}
|
|
169
176
|
z();
|
|
170
177
|
export {
|
|
171
|
-
oe as
|
|
172
|
-
re as
|
|
173
|
-
se as
|
|
174
|
-
ie as
|
|
175
|
-
ae as
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
ue as
|
|
179
|
-
pe as
|
|
180
|
-
me as
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
he as
|
|
178
|
+
oe as ANALYTICS_EVENT_IDENTIFY,
|
|
179
|
+
re as ANALYTICS_EVENT_PAGE,
|
|
180
|
+
se as ANALYTICS_EVENT_TRACK,
|
|
181
|
+
ie as DEFAULT_EVENT_PREFIX,
|
|
182
|
+
ae as EVENT_COMPOSITION_LOADED,
|
|
183
|
+
le as EVENT_COMPOSITION_LOADING,
|
|
184
|
+
ce as EVENT_COMPOSITION_LOAD_ERROR,
|
|
185
|
+
ue as EVENT_EXTEND_MODE_OFF,
|
|
186
|
+
pe as EVENT_EXTEND_MODE_ON,
|
|
187
|
+
me as EVENT_GALLERY_CLOSE,
|
|
188
|
+
Ee as EVENT_GALLERY_OPEN,
|
|
189
|
+
be as EVENT_HOTSPOTS_OFF,
|
|
190
|
+
fe as EVENT_HOTSPOTS_ON,
|
|
191
|
+
de as EVENT_ITEM_CHANGE,
|
|
192
|
+
D as WEB_PLAYER_ICON_WC_TAG,
|
|
193
|
+
w as WEB_PLAYER_WC_TAG,
|
|
194
|
+
he as WebPlayer,
|
|
195
|
+
ye as WebPlayerCustomMedia,
|
|
196
|
+
_e as WebPlayerIcon,
|
|
197
|
+
ge as generateCompositionUrl
|
|
188
198
|
};
|
package/dist/legacy.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./shared-BQBvv8Dz.cjs");require("react/jsx-runtime");const I=require("react"),f=require("react-dom");var S=Object.defineProperty,L=(e,n,r)=>n in e?S(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,p=(e,n,r)=>(L(e,typeof n!="symbol"?n+"":n,r),r);const W={stringify:e=>e,parse:e=>e},V={stringify:e=>`${e}`,parse:e=>parseFloat(e)},R={stringify:e=>e?"true":"false",parse:e=>/^[ty1-9]/i.test(e)},D={stringify:e=>e.name,parse:(e,n,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}},M={stringify:e=>JSON.stringify(e),parse:e=>JSON.parse(e)},A={string:W,number:V,boolean:R,function:D,json:M};function w(e){return e.replace(/([a-z0-9])([A-Z])/g,(n,r,s)=>`${r}-${s.toLowerCase()}`)}const b=Symbol.for("r2wc.render"),N=Symbol.for("r2wc.connected"),u=Symbol.for("r2wc.context"),c=Symbol.for("r2wc.props");function Y(e,n,r){var s,C,g;n.props||(n.props=e.propTypes?Object.keys(e.propTypes):[]);const O=Array.isArray(n.props)?n.props.slice():Object.keys(n.props),T={},d={},m={};for(const i of O){T[i]=Array.isArray(n.props)?"string":n.props[i];const o=w(i);d[i]=o,m[o]=i}class P extends HTMLElement{constructor(){super(),p(this,s,!0),p(this,C),p(this,g,{}),p(this,"container"),n.shadow?this.container=this.attachShadow({mode:n.shadow}):this.container=this,this[c].container=this.container;for(const o of O){const _=d[o],l=this.getAttribute(_),a=T[o],E=a?A[a]:null;E!=null&&E.parse&&l&&(this[c][o]=E.parse(l,_,this))}}static get observedAttributes(){return Object.keys(m)}connectedCallback(){this[N]=!0,this[b]()}disconnectedCallback(){this[N]=!1,this[u]&&r.unmount(this[u]),delete this[u]}attributeChangedCallback(o,_,l){const a=m[o],E=T[a],y=E?A[E]:null;a in T&&y!=null&&y.parse&&l&&(this[c][a]=y.parse(l,o,this),this[b]())}[(s=N,C=u,g=c,b)](){this[N]&&(this[u]?r.update(this[u],this[c]):this[u]=r.mount(this.container,e,this[c]))}}for(const i of O){const o=d[i],_=T[i];Object.defineProperty(P.prototype,i,{enumerable:!0,configurable:!0,get(){return this[c][i]},set(l){this[c][i]=l;const a=_?A[_]:null;if(a!=null&&a.stringify){const E=a.stringify(l,o,this);this.getAttribute(o)!==E&&this.setAttribute(o,E)}else this[b]()}})}return P}function G(e,n,r){const s=I.createElement(n,r);return f.render(s,e),{container:e,ReactComponent:n}}function F({container:e,ReactComponent:n},r){const s=I.createElement(n,r);f.render(s,e)}function v({container:e}){f.unmountComponentAtNode(e)}function h(e,n={}){return Y(e,n,{mount:G,update:F,unmount:v})}const j=h(t.WebPlayerWithInjectedStyles,{shadow:"closed",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",analyticsEventPrefix:"string",analyticsUrl:"string",analyticsBearer:"string",analyticsSimpleRequestsOnly:"boolean",analyticsDryRun:"boolean",analyticsDebug:"boolean"}}),B=h(t.WebPlayerCustomMedia,{shadow:"closed",props:{index:"number",thumbnailSrc:"string"}}),k=h(t.WebPlayerIcon,{shadow:"closed",props:{name:"string"}});function x(){customElements.define(t.WEB_PLAYER_WC_TAG,j),customElements.define(t.WEB_PLAYER_CUSTOM_MEDIA_WC_TAG,B),customElements.define(t.WEB_PLAYER_ICON_WC_TAG,k)}function $(){t.checkCustomElementsDefinition()||x()}$();exports.ANALYTICS_EVENT_IDENTIFY=t.ANALYTICS_EVENT_IDENTIFY;exports.ANALYTICS_EVENT_PAGE=t.ANALYTICS_EVENT_PAGE;exports.ANALYTICS_EVENT_TRACK=t.ANALYTICS_EVENT_TRACK;exports.DEFAULT_EVENT_PREFIX=t.DEFAULT_EVENT_PREFIX;exports.EVENT_COMPOSITION_LOADED=t.EVENT_COMPOSITION_LOADED;exports.EVENT_COMPOSITION_LOADING=t.EVENT_COMPOSITION_LOADING;exports.EVENT_COMPOSITION_LOAD_ERROR=t.EVENT_COMPOSITION_LOAD_ERROR;exports.EVENT_EXTEND_MODE_OFF=t.EVENT_EXTEND_MODE_OFF;exports.EVENT_EXTEND_MODE_ON=t.EVENT_EXTEND_MODE_ON;exports.EVENT_GALLERY_CLOSE=t.EVENT_GALLERY_CLOSE;exports.EVENT_GALLERY_OPEN=t.EVENT_GALLERY_OPEN;exports.EVENT_HOTSPOTS_OFF=t.EVENT_HOTSPOTS_OFF;exports.EVENT_HOTSPOTS_ON=t.EVENT_HOTSPOTS_ON;exports.EVENT_ITEM_CHANGE=t.EVENT_ITEM_CHANGE;exports.WEB_PLAYER_ICON_WC_TAG=t.WEB_PLAYER_ICON_WC_TAG;exports.WEB_PLAYER_WC_TAG=t.WEB_PLAYER_WC_TAG;exports.WebPlayer=t.WebPlayer;exports.WebPlayerCustomMedia=t.WebPlayerCustomMedia$1;exports.WebPlayerIcon=t.WebPlayerIcon$1;exports.generateCompositionUrl=t.generateCompositionUrl;
|
package/dist/legacy.d.ts
CHANGED
|
@@ -1,6 +1,107 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
3
|
|
|
4
|
+
export declare const ANALYTICS_EVENT_IDENTIFY = "analytics-identify";
|
|
5
|
+
|
|
6
|
+
export declare const ANALYTICS_EVENT_PAGE = "analytics-page";
|
|
7
|
+
|
|
8
|
+
export declare const ANALYTICS_EVENT_TRACK = "analytics-track";
|
|
9
|
+
|
|
10
|
+
declare type AnalyticsEventBase = {
|
|
11
|
+
type: AnalyticsEventType;
|
|
12
|
+
timestamp: string;
|
|
13
|
+
instance_id: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare type AnalyticsEventType =
|
|
17
|
+
| AnalyticsEventTypeIdentify
|
|
18
|
+
| AnalyticsEventTypePage
|
|
19
|
+
| AnalyticsEventTypeTrack;
|
|
20
|
+
|
|
21
|
+
declare type AnalyticsEventTypeIdentify = "identify";
|
|
22
|
+
|
|
23
|
+
declare type AnalyticsEventTypePage = "page";
|
|
24
|
+
|
|
25
|
+
declare type AnalyticsEventTypeTrack = "track";
|
|
26
|
+
|
|
27
|
+
declare type AnalyticsIdentifyEvent = Omit<AnalyticsEventBase, "type"> &
|
|
28
|
+
AnalyticsIdentifyEventProps;
|
|
29
|
+
|
|
30
|
+
declare type AnalyticsIdentifyEventProps = {
|
|
31
|
+
type: AnalyticsEventTypeIdentify;
|
|
32
|
+
browser_id: string;
|
|
33
|
+
session_id: string;
|
|
34
|
+
referrer: string;
|
|
35
|
+
origin: string;
|
|
36
|
+
page_url: string;
|
|
37
|
+
user_agent: string;
|
|
38
|
+
wp_properties: {
|
|
39
|
+
composition_url: string;
|
|
40
|
+
|
|
41
|
+
// Integration mode
|
|
42
|
+
integration: boolean;
|
|
43
|
+
max_items_shown: number;
|
|
44
|
+
|
|
45
|
+
// Layout
|
|
46
|
+
hide_categories_nav: boolean;
|
|
47
|
+
infinite_carrousel: boolean;
|
|
48
|
+
permanent_gallery: boolean;
|
|
49
|
+
|
|
50
|
+
// Medias loading
|
|
51
|
+
media_load_strategy: string;
|
|
52
|
+
min_media_width: number;
|
|
53
|
+
max_media_width: number;
|
|
54
|
+
preload_range: number;
|
|
55
|
+
auto_load_360: boolean;
|
|
56
|
+
auto_load_interior_360: boolean;
|
|
57
|
+
|
|
58
|
+
// Miscellaneous
|
|
59
|
+
categories_filter: string;
|
|
60
|
+
extend_behavior: string;
|
|
61
|
+
event_prefix: string;
|
|
62
|
+
demo_spin: boolean;
|
|
63
|
+
reverse_360: boolean;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
declare type AnalyticsPageEvent = Omit<AnalyticsEventBase, "type"> &
|
|
68
|
+
AnalyticsPageEventProps;
|
|
69
|
+
|
|
70
|
+
declare type AnalyticsPageEventProps = {
|
|
71
|
+
type: AnalyticsEventTypePage;
|
|
72
|
+
category_id: string;
|
|
73
|
+
category_name: string;
|
|
74
|
+
items_count: number;
|
|
75
|
+
page_properties: {
|
|
76
|
+
item_type: string;
|
|
77
|
+
item_position: number;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
declare type AnalyticsTrackEvent = Omit<AnalyticsEventBase, "type"> &
|
|
82
|
+
AnalyticsTrackEventProps;
|
|
83
|
+
|
|
84
|
+
declare type AnalyticsTrackEventProps = {
|
|
85
|
+
type: AnalyticsEventTypeTrack;
|
|
86
|
+
category_id: string;
|
|
87
|
+
category_name: string;
|
|
88
|
+
item_type: string;
|
|
89
|
+
item_position: number;
|
|
90
|
+
action_properties: {
|
|
91
|
+
action_name: string;
|
|
92
|
+
action_field: string;
|
|
93
|
+
action_value:
|
|
94
|
+
| bigint
|
|
95
|
+
| boolean
|
|
96
|
+
| null
|
|
97
|
+
| number
|
|
98
|
+
| string
|
|
99
|
+
| symbol
|
|
100
|
+
| undefined
|
|
101
|
+
| object;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
|
|
4
105
|
declare type AspectRatio = `${number}:${number}`;
|
|
5
106
|
|
|
6
107
|
declare type Category = {
|
|
@@ -43,7 +144,7 @@ declare type ExtendBehavior = "full_screen" | "event" | "none";
|
|
|
43
144
|
/**
|
|
44
145
|
* Generates a URL for fetching the composition JSON for a given customer and vehicle.
|
|
45
146
|
*
|
|
46
|
-
* @param {string} customerToken - The CarCutter Customer Token (computed by
|
|
147
|
+
* @param {string} customerToken - The CarCutter Customer Token (computed by hashing the Customer ID with SHA-256).
|
|
47
148
|
* @param {string} vin - The Vehicle Identification Number.
|
|
48
149
|
* @returns {string} The URL to fetch the composition JSON.
|
|
49
150
|
*/
|
|
@@ -58,6 +159,7 @@ declare type Hotspot = {
|
|
|
58
159
|
title: string;
|
|
59
160
|
icon?: string;
|
|
60
161
|
description?: string;
|
|
162
|
+
type?: "damage" | "feature";
|
|
61
163
|
position: {
|
|
62
164
|
x: number;
|
|
63
165
|
y: number;
|
|
@@ -158,6 +260,9 @@ export declare type WebPlayerProps = PropsWithChildren<WebPlayerProps_2> & {
|
|
|
158
260
|
onHotspotsOff?: () => void;
|
|
159
261
|
onGalleryOpen?: () => void;
|
|
160
262
|
onGalleryClose?: () => void;
|
|
263
|
+
onAnalyticsIdentify?: (event: AnalyticsIdentifyEvent) => void;
|
|
264
|
+
onAnalyticsPage?: (event: AnalyticsPageEvent) => void;
|
|
265
|
+
onAnalyticsTrack?: (event: AnalyticsTrackEvent) => void;
|
|
161
266
|
} & Pick<React.HTMLAttributes<HTMLElement>, "className" | "style">;
|
|
162
267
|
|
|
163
268
|
declare type WebPlayerProps_2 = {
|
|
@@ -186,6 +291,14 @@ declare type WebPlayerProps_2 = {
|
|
|
186
291
|
eventPrefix?: string;
|
|
187
292
|
demoSpin?: boolean;
|
|
188
293
|
reverse360?: boolean;
|
|
294
|
+
|
|
295
|
+
// Analytics
|
|
296
|
+
analyticsEventPrefix?: string;
|
|
297
|
+
analyticsUrl?: string;
|
|
298
|
+
analyticsBearer?: string;
|
|
299
|
+
analyticsSimpleRequestsOnly?: boolean;
|
|
300
|
+
analyticsDryRun?: boolean;
|
|
301
|
+
analyticsDebug?: boolean;
|
|
189
302
|
};
|
|
190
303
|
|
|
191
304
|
export { }
|