@wistia/wistia-player-react 0.0.16 → 0.0.18
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/WistiaPlayer.cjs +86 -79
- package/dist/WistiaPlayer.mjs +2 -2
- package/dist/{WistiaPlayerWrapper-FDHS4IRV.mjs → WistiaPlayerWrapper-PNENHYWY.mjs} +6 -2
- package/dist/chunk-CQ3OW4NK.mjs +52 -0
- package/dist/types/src/WistiaPlayer.d.ts +0 -1
- package/dist/types/src/WistiaPlayer.d.ts.map +1 -1
- package/dist/types/src/WistiaPlayerWrapper.d.ts +0 -1
- package/dist/types/src/WistiaPlayerWrapper.d.ts.map +1 -1
- package/dist/{chunk-KSSDWA5S.mjs → wistia-player-EH7IMBWN.mjs} +16 -65
- package/package.json +2 -2
package/dist/WistiaPlayer.cjs
CHANGED
|
@@ -19,7 +19,82 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
19
19
|
};
|
|
20
20
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
21
|
|
|
22
|
+
// src/utils/getMergedEmbedOption.ts
|
|
23
|
+
var getMergedEmbedOption;
|
|
24
|
+
var init_getMergedEmbedOption = __esm({
|
|
25
|
+
"src/utils/getMergedEmbedOption.ts"() {
|
|
26
|
+
getMergedEmbedOption = (mediaId, optionKey, optionValue) => {
|
|
27
|
+
let finalEmbedOption = optionValue;
|
|
28
|
+
if (typeof window === "undefined") {
|
|
29
|
+
return finalEmbedOption;
|
|
30
|
+
}
|
|
31
|
+
if (window.wistiaOptions?._all?.[optionKey] !== void 0) {
|
|
32
|
+
finalEmbedOption = window.wistiaOptions._all[optionKey];
|
|
33
|
+
}
|
|
34
|
+
const mediaIdOptions = window.wistiaOptions?.[mediaId];
|
|
35
|
+
if (mediaIdOptions !== void 0) {
|
|
36
|
+
const mediaIdOptionValue = mediaIdOptions[optionKey];
|
|
37
|
+
if (optionValue !== void 0) {
|
|
38
|
+
finalEmbedOption = mediaIdOptionValue;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return finalEmbedOption;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// src/utils/swatch.ts
|
|
47
|
+
var getSwatchMetaData, swatchUrl, getSwatchAspectRatio, defaultSwatchCSSProperties;
|
|
48
|
+
var init_swatch = __esm({
|
|
49
|
+
"src/utils/swatch.ts"() {
|
|
50
|
+
getSwatchMetaData = async (url) => {
|
|
51
|
+
const swatch = new Image();
|
|
52
|
+
swatch.src = url;
|
|
53
|
+
await swatch.decode();
|
|
54
|
+
return swatch;
|
|
55
|
+
};
|
|
56
|
+
swatchUrl = (mediaId, embedHost) => `https://${embedHost}/embed/medias/${mediaId}/swatch`;
|
|
57
|
+
getSwatchAspectRatio = async (mediaId, embedHost = "fast.wistia.com") => {
|
|
58
|
+
const swatchImg = await getSwatchMetaData(swatchUrl(mediaId, embedHost));
|
|
59
|
+
const { naturalHeight, naturalWidth } = swatchImg;
|
|
60
|
+
return naturalWidth / naturalHeight;
|
|
61
|
+
};
|
|
62
|
+
defaultSwatchCSSProperties = ({
|
|
63
|
+
mediaId,
|
|
64
|
+
embedHost = "fast.wistia.com",
|
|
65
|
+
aspect = 1.7,
|
|
66
|
+
shouldLoadSwatch = true
|
|
67
|
+
}) => {
|
|
68
|
+
return {
|
|
69
|
+
aspectRatio: `${aspect}`,
|
|
70
|
+
background: shouldLoadSwatch ? `center / contain no-repeat url(${swatchUrl(mediaId, embedHost)})` : void 0,
|
|
71
|
+
display: "block",
|
|
72
|
+
filter: "blur(5px)",
|
|
73
|
+
width: "100%"
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// src/utils/camelCaseToKebabCase.ts
|
|
80
|
+
var camelCaseToKebabCase;
|
|
81
|
+
var init_camelCaseToKebabCase = __esm({
|
|
82
|
+
"src/utils/camelCaseToKebabCase.ts"() {
|
|
83
|
+
camelCaseToKebabCase = (str) => {
|
|
84
|
+
return str.replace(
|
|
85
|
+
/[A-Z]+(?![a-z])|[A-Z]/g,
|
|
86
|
+
(letter, idx) => (idx !== 0 ? "-" : "") + letter.toLowerCase()
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
22
92
|
// ../wistia-player/dist/wistia-player.js
|
|
93
|
+
var wistia_player_exports = {};
|
|
94
|
+
__export(wistia_player_exports, {
|
|
95
|
+
WistiaPlayer: () => __webpack_exports__WistiaPlayer,
|
|
96
|
+
wistiaSwatchElement: () => __webpack_exports__wistiaSwatchElement
|
|
97
|
+
});
|
|
23
98
|
function __webpack_require__2(moduleId) {
|
|
24
99
|
var cachedModule = __webpack_module_cache__[moduleId];
|
|
25
100
|
if (cachedModule !== void 0) {
|
|
@@ -8673,7 +8748,7 @@ var init_wistia_player = __esm({
|
|
|
8673
8748
|
case 0:
|
|
8674
8749
|
options = _args.length > 1 && _args[1] !== void 0 ? _args[1] : {};
|
|
8675
8750
|
host = (_options$host = options.host) !== null && _options$host !== void 0 ? _options$host : (0, _hosts_js__WEBPACK_IMPORTED_MODULE_0__.eV1HostWithPort)();
|
|
8676
|
-
taggedVersion = "0.0.
|
|
8751
|
+
taggedVersion = "0.0.18";
|
|
8677
8752
|
if (!(taggedVersion !== "" && taggedVersion.length > 0 && options.mediaData !== true)) {
|
|
8678
8753
|
_context.next = 5;
|
|
8679
8754
|
break;
|
|
@@ -14414,7 +14489,7 @@ var init_wistia_player = __esm({
|
|
|
14414
14489
|
if (this.isValidKey(this._eventKey)) {
|
|
14415
14490
|
return this._eventKey;
|
|
14416
14491
|
}
|
|
14417
|
-
this._eventKey = uniqId("
|
|
14492
|
+
this._eventKey = uniqId("cb22c01f78e29f9a5c3516f5b15df920".substring(0, 7) + "_");
|
|
14418
14493
|
this.publicApi.trigger("eventkeychange", this._eventKey);
|
|
14419
14494
|
return this._eventKey;
|
|
14420
14495
|
};
|
|
@@ -15861,7 +15936,7 @@ var init_wistia_player = __esm({
|
|
|
15861
15936
|
var first = (0, _util_getOrSetIsFirst_js__WEBPACK_IMPORTED_MODULE_3__.u)(_this.hashedId, _ds_index_js__WEBPACK_IMPORTED_MODULE_2__.p.Scope.LIVE_EVENT, "load");
|
|
15862
15937
|
_classPrivateFieldSet(_playSession, _this, _ds_index_js__WEBPACK_IMPORTED_MODULE_2__.p.load(_classPrivateFieldGet(_clockStart, _this), {
|
|
15863
15938
|
visitor_key: _classPrivateFieldGet(_api, _this).visitorKey(),
|
|
15864
|
-
session_key: (0, utilities_uniqId_js__WEBPACK_IMPORTED_MODULE_5__.b)("".concat("
|
|
15939
|
+
session_key: (0, utilities_uniqId_js__WEBPACK_IMPORTED_MODULE_5__.b)("".concat("cb22c01f78e29f9a5c3516f5b15df920".substring(0, 7), "_")),
|
|
15865
15940
|
embed_url: _classPrivateFieldGet(_api, _this)._attrs.pageUrl,
|
|
15866
15941
|
referrer_url: _classPrivateFieldGet(_api, _this)._attrs.referrerUrl,
|
|
15867
15942
|
account_id: mediaData.accountId,
|
|
@@ -20055,7 +20130,7 @@ var init_wistia_player = __esm({
|
|
|
20055
20130
|
}, {
|
|
20056
20131
|
key: "generate",
|
|
20057
20132
|
value: function generate() {
|
|
20058
|
-
return (0, utilities_uniqId_js__WEBPACK_IMPORTED_MODULE_4__.b)("".concat("
|
|
20133
|
+
return (0, utilities_uniqId_js__WEBPACK_IMPORTED_MODULE_4__.b)("".concat("cb22c01f78e29f9a5c3516f5b15df920".substring(0, 7), "_"));
|
|
20059
20134
|
}
|
|
20060
20135
|
}]);
|
|
20061
20136
|
}();
|
|
@@ -26921,7 +26996,7 @@ var init_wistia_player = __esm({
|
|
|
26921
26996
|
Object.keys(optionSources).forEach(function(key) {
|
|
26922
26997
|
optionSources[key] = ensureOptionsAreNonCircular(optionSources[key]);
|
|
26923
26998
|
});
|
|
26924
|
-
var playerVersion = "0.0.
|
|
26999
|
+
var playerVersion = "0.0.18".length > 0 ? "0.0.18" : _utilities_player_version_js__WEBPACK_IMPORTED_MODULE_44__.H;
|
|
26925
27000
|
var data = {
|
|
26926
27001
|
player_version: playerVersion,
|
|
26927
27002
|
media_key: this._mediaData.mediaKey,
|
|
@@ -40473,7 +40548,7 @@ var init_wistia_player = __esm({
|
|
|
40473
40548
|
/* harmony export */
|
|
40474
40549
|
});
|
|
40475
40550
|
var runScript = function runScript2(src2, timeout) {
|
|
40476
|
-
var taggedVersion = "0.0.
|
|
40551
|
+
var taggedVersion = "0.0.18";
|
|
40477
40552
|
return new Promise(function(resolve, reject) {
|
|
40478
40553
|
if (timeout == null) {
|
|
40479
40554
|
timeout = 8e3;
|
|
@@ -45640,76 +45715,6 @@ var init_wistia_player = __esm({
|
|
|
45640
45715
|
}
|
|
45641
45716
|
});
|
|
45642
45717
|
|
|
45643
|
-
// src/utils/getMergedEmbedOption.ts
|
|
45644
|
-
var getMergedEmbedOption;
|
|
45645
|
-
var init_getMergedEmbedOption = __esm({
|
|
45646
|
-
"src/utils/getMergedEmbedOption.ts"() {
|
|
45647
|
-
getMergedEmbedOption = (mediaId, optionKey, optionValue) => {
|
|
45648
|
-
let finalEmbedOption = optionValue;
|
|
45649
|
-
if (typeof window === "undefined") {
|
|
45650
|
-
return finalEmbedOption;
|
|
45651
|
-
}
|
|
45652
|
-
if (window.wistiaOptions?._all?.[optionKey] !== void 0) {
|
|
45653
|
-
finalEmbedOption = window.wistiaOptions._all[optionKey];
|
|
45654
|
-
}
|
|
45655
|
-
const mediaIdOptions = window.wistiaOptions?.[mediaId];
|
|
45656
|
-
if (mediaIdOptions !== void 0) {
|
|
45657
|
-
const mediaIdOptionValue = mediaIdOptions[optionKey];
|
|
45658
|
-
if (optionValue !== void 0) {
|
|
45659
|
-
finalEmbedOption = mediaIdOptionValue;
|
|
45660
|
-
}
|
|
45661
|
-
}
|
|
45662
|
-
return finalEmbedOption;
|
|
45663
|
-
};
|
|
45664
|
-
}
|
|
45665
|
-
});
|
|
45666
|
-
|
|
45667
|
-
// src/utils/swatch.ts
|
|
45668
|
-
var getSwatchMetaData, swatchUrl, getSwatchAspectRatio, defaultSwatchCSSProperties;
|
|
45669
|
-
var init_swatch = __esm({
|
|
45670
|
-
"src/utils/swatch.ts"() {
|
|
45671
|
-
getSwatchMetaData = async (url) => {
|
|
45672
|
-
const swatch = new Image();
|
|
45673
|
-
swatch.src = url;
|
|
45674
|
-
await swatch.decode();
|
|
45675
|
-
return swatch;
|
|
45676
|
-
};
|
|
45677
|
-
swatchUrl = (mediaId, embedHost) => `https://${embedHost}/embed/medias/${mediaId}/swatch`;
|
|
45678
|
-
getSwatchAspectRatio = async (mediaId, embedHost = "fast.wistia.com") => {
|
|
45679
|
-
const swatchImg = await getSwatchMetaData(swatchUrl(mediaId, embedHost));
|
|
45680
|
-
const { naturalHeight, naturalWidth } = swatchImg;
|
|
45681
|
-
return naturalWidth / naturalHeight;
|
|
45682
|
-
};
|
|
45683
|
-
defaultSwatchCSSProperties = ({
|
|
45684
|
-
mediaId,
|
|
45685
|
-
embedHost = "fast.wistia.com",
|
|
45686
|
-
aspect = 1.7,
|
|
45687
|
-
shouldLoadSwatch = true
|
|
45688
|
-
}) => {
|
|
45689
|
-
return {
|
|
45690
|
-
aspectRatio: `${aspect}`,
|
|
45691
|
-
background: shouldLoadSwatch ? `center / contain no-repeat url(${swatchUrl(mediaId, embedHost)})` : void 0,
|
|
45692
|
-
display: "block",
|
|
45693
|
-
filter: "blur(5px)",
|
|
45694
|
-
width: "100%"
|
|
45695
|
-
};
|
|
45696
|
-
};
|
|
45697
|
-
}
|
|
45698
|
-
});
|
|
45699
|
-
|
|
45700
|
-
// src/utils/camelCaseToKebabCase.ts
|
|
45701
|
-
var camelCaseToKebabCase;
|
|
45702
|
-
var init_camelCaseToKebabCase = __esm({
|
|
45703
|
-
"src/utils/camelCaseToKebabCase.ts"() {
|
|
45704
|
-
camelCaseToKebabCase = (str) => {
|
|
45705
|
-
return str.replace(
|
|
45706
|
-
/[A-Z]+(?![a-z])|[A-Z]/g,
|
|
45707
|
-
(letter, idx) => (idx !== 0 ? "-" : "") + letter.toLowerCase()
|
|
45708
|
-
);
|
|
45709
|
-
};
|
|
45710
|
-
}
|
|
45711
|
-
});
|
|
45712
|
-
|
|
45713
45718
|
// src/WistiaPlayerWrapper.tsx
|
|
45714
45719
|
var WistiaPlayerWrapper_exports = {};
|
|
45715
45720
|
__export(WistiaPlayerWrapper_exports, {
|
|
@@ -45720,7 +45725,6 @@ var init_WistiaPlayerWrapper = __esm({
|
|
|
45720
45725
|
"src/WistiaPlayerWrapper.tsx"() {
|
|
45721
45726
|
"use client";
|
|
45722
45727
|
import_react = require("react");
|
|
45723
|
-
init_wistia_player();
|
|
45724
45728
|
init_camelCaseToKebabCase();
|
|
45725
45729
|
init_getMergedEmbedOption();
|
|
45726
45730
|
init_swatch();
|
|
@@ -45732,12 +45736,16 @@ var init_WistiaPlayerWrapper = __esm({
|
|
|
45732
45736
|
const player = (0, import_react.useRef)(null);
|
|
45733
45737
|
const [swatchAspectRatio, setSwatchAspectRatio] = (0, import_react.useState)(aspect);
|
|
45734
45738
|
const [isWistiaPlayerDefined, setIsWistiaPlayerDefined] = (0, import_react.useState)(false);
|
|
45739
|
+
const [isWistiaPlayerImported, setIsWistiaPlayerImported] = (0, import_react.useState)(false);
|
|
45735
45740
|
(0, import_react.useEffect)(() => {
|
|
45736
45741
|
if (swatch !== false && swatchAspectRatio === void 0) {
|
|
45737
45742
|
getSwatchAspectRatio(mediaId, finalEmbedHost).then((ratio) => {
|
|
45738
45743
|
setSwatchAspectRatio(ratio);
|
|
45739
45744
|
});
|
|
45740
45745
|
}
|
|
45746
|
+
void Promise.resolve().then(() => (init_wistia_player(), wistia_player_exports)).then(() => {
|
|
45747
|
+
setIsWistiaPlayerImported(true);
|
|
45748
|
+
});
|
|
45741
45749
|
void customElements.whenDefined("wistia-player").then(() => {
|
|
45742
45750
|
setIsWistiaPlayerDefined(true);
|
|
45743
45751
|
});
|
|
@@ -45761,7 +45769,7 @@ var init_WistiaPlayerWrapper = __esm({
|
|
|
45761
45769
|
};
|
|
45762
45770
|
}, [callback, isWistiaPlayerDefined]);
|
|
45763
45771
|
});
|
|
45764
|
-
const shouldDisplaySwatch = typeof window === "undefined" && swatchAspectRatio !== void 0;
|
|
45772
|
+
const shouldDisplaySwatch = (typeof window === "undefined" || !isWistiaPlayerImported) && swatchAspectRatio !== void 0;
|
|
45765
45773
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: isWistiaPlayerDefined && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
45766
45774
|
"wistia-player",
|
|
45767
45775
|
{
|
|
@@ -45802,7 +45810,6 @@ __export(WistiaPlayer_exports, {
|
|
|
45802
45810
|
});
|
|
45803
45811
|
module.exports = __toCommonJS(WistiaPlayer_exports);
|
|
45804
45812
|
var import_react2 = require("react");
|
|
45805
|
-
init_wistia_player();
|
|
45806
45813
|
init_getMergedEmbedOption();
|
|
45807
45814
|
init_swatch();
|
|
45808
45815
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
package/dist/WistiaPlayer.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defaultSwatchCSSProperties,
|
|
3
3
|
getMergedEmbedOption
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CQ3OW4NK.mjs";
|
|
5
5
|
|
|
6
6
|
// src/WistiaPlayer.tsx
|
|
7
7
|
import { forwardRef, Suspense, lazy } from "react";
|
|
8
8
|
import { jsx } from "react/jsx-runtime";
|
|
9
9
|
var WistiaPlayerWrapper = lazy(
|
|
10
|
-
async () => import("./WistiaPlayerWrapper-
|
|
10
|
+
async () => import("./WistiaPlayerWrapper-PNENHYWY.mjs").then((module) => ({
|
|
11
11
|
default: module.WistiaPlayerWrapper
|
|
12
12
|
}))
|
|
13
13
|
);
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
defaultSwatchCSSProperties,
|
|
4
4
|
getMergedEmbedOption,
|
|
5
5
|
getSwatchAspectRatio
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CQ3OW4NK.mjs";
|
|
7
7
|
|
|
8
8
|
// src/WistiaPlayerWrapper.tsx
|
|
9
9
|
import { forwardRef, useEffect, useRef, useState } from "react";
|
|
@@ -25,12 +25,16 @@ var WistiaPlayerWrapper = forwardRef(
|
|
|
25
25
|
const player = useRef(null);
|
|
26
26
|
const [swatchAspectRatio, setSwatchAspectRatio] = useState(aspect);
|
|
27
27
|
const [isWistiaPlayerDefined, setIsWistiaPlayerDefined] = useState(false);
|
|
28
|
+
const [isWistiaPlayerImported, setIsWistiaPlayerImported] = useState(false);
|
|
28
29
|
useEffect(() => {
|
|
29
30
|
if (swatch !== false && swatchAspectRatio === void 0) {
|
|
30
31
|
getSwatchAspectRatio(mediaId, finalEmbedHost).then((ratio) => {
|
|
31
32
|
setSwatchAspectRatio(ratio);
|
|
32
33
|
});
|
|
33
34
|
}
|
|
35
|
+
void import("./wistia-player-EH7IMBWN.mjs").then(() => {
|
|
36
|
+
setIsWistiaPlayerImported(true);
|
|
37
|
+
});
|
|
34
38
|
void customElements.whenDefined("wistia-player").then(() => {
|
|
35
39
|
setIsWistiaPlayerDefined(true);
|
|
36
40
|
});
|
|
@@ -54,7 +58,7 @@ var WistiaPlayerWrapper = forwardRef(
|
|
|
54
58
|
};
|
|
55
59
|
}, [callback, isWistiaPlayerDefined]);
|
|
56
60
|
});
|
|
57
|
-
const shouldDisplaySwatch = typeof window === "undefined" && swatchAspectRatio !== void 0;
|
|
61
|
+
const shouldDisplaySwatch = (typeof window === "undefined" || !isWistiaPlayerImported) && swatchAspectRatio !== void 0;
|
|
58
62
|
return /* @__PURE__ */ jsx(Fragment, { children: isWistiaPlayerDefined && /* @__PURE__ */ jsx(
|
|
59
63
|
"wistia-player",
|
|
60
64
|
{
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// src/utils/getMergedEmbedOption.ts
|
|
2
|
+
var getMergedEmbedOption = (mediaId, optionKey, optionValue) => {
|
|
3
|
+
let finalEmbedOption = optionValue;
|
|
4
|
+
if (typeof window === "undefined") {
|
|
5
|
+
return finalEmbedOption;
|
|
6
|
+
}
|
|
7
|
+
if (window.wistiaOptions?._all?.[optionKey] !== void 0) {
|
|
8
|
+
finalEmbedOption = window.wistiaOptions._all[optionKey];
|
|
9
|
+
}
|
|
10
|
+
const mediaIdOptions = window.wistiaOptions?.[mediaId];
|
|
11
|
+
if (mediaIdOptions !== void 0) {
|
|
12
|
+
const mediaIdOptionValue = mediaIdOptions[optionKey];
|
|
13
|
+
if (optionValue !== void 0) {
|
|
14
|
+
finalEmbedOption = mediaIdOptionValue;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return finalEmbedOption;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// src/utils/swatch.ts
|
|
21
|
+
var getSwatchMetaData = async (url) => {
|
|
22
|
+
const swatch = new Image();
|
|
23
|
+
swatch.src = url;
|
|
24
|
+
await swatch.decode();
|
|
25
|
+
return swatch;
|
|
26
|
+
};
|
|
27
|
+
var swatchUrl = (mediaId, embedHost) => `https://${embedHost}/embed/medias/${mediaId}/swatch`;
|
|
28
|
+
var getSwatchAspectRatio = async (mediaId, embedHost = "fast.wistia.com") => {
|
|
29
|
+
const swatchImg = await getSwatchMetaData(swatchUrl(mediaId, embedHost));
|
|
30
|
+
const { naturalHeight, naturalWidth } = swatchImg;
|
|
31
|
+
return naturalWidth / naturalHeight;
|
|
32
|
+
};
|
|
33
|
+
var defaultSwatchCSSProperties = ({
|
|
34
|
+
mediaId,
|
|
35
|
+
embedHost = "fast.wistia.com",
|
|
36
|
+
aspect = 1.7,
|
|
37
|
+
shouldLoadSwatch = true
|
|
38
|
+
}) => {
|
|
39
|
+
return {
|
|
40
|
+
aspectRatio: `${aspect}`,
|
|
41
|
+
background: shouldLoadSwatch ? `center / contain no-repeat url(${swatchUrl(mediaId, embedHost)})` : void 0,
|
|
42
|
+
display: "block",
|
|
43
|
+
filter: "blur(5px)",
|
|
44
|
+
width: "100%"
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
getMergedEmbedOption,
|
|
50
|
+
getSwatchAspectRatio,
|
|
51
|
+
defaultSwatchCSSProperties
|
|
52
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WistiaPlayer.d.ts","sourceRoot":"","sources":["../../../src/WistiaPlayer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAO,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"WistiaPlayer.d.ts","sourceRoot":"","sources":["../../../src/WistiaPlayer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAO,MAAM,OAAO,CAAC;AAKpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AASlD,eAAO,MAAM,YAAY,sCAoCgB,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { WistiaPlayer } from '@wistia/wistia-player';
|
|
3
|
-
import '@wistia/wistia-player';
|
|
4
3
|
import type { WistiaPlayerProps } from '../types';
|
|
5
4
|
export declare const WistiaPlayerWrapper: import("react").ForwardRefExoticComponent<Omit<WistiaPlayerProps, "ref"> & import("react").RefAttributes<WistiaPlayer>>;
|
|
6
5
|
//# sourceMappingURL=WistiaPlayerWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WistiaPlayerWrapper.d.ts","sourceRoot":"","sources":["../../../src/WistiaPlayerWrapper.tsx"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"WistiaPlayerWrapper.d.ts","sourceRoot":"","sources":["../../../src/WistiaPlayerWrapper.tsx"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAI1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,eAAO,MAAM,mBAAmB,yHA0G/B,CAAC"}
|
|
@@ -8631,7 +8631,7 @@ var __webpack_modules__ = {
|
|
|
8631
8631
|
case 0:
|
|
8632
8632
|
options = _args.length > 1 && _args[1] !== void 0 ? _args[1] : {};
|
|
8633
8633
|
host = (_options$host = options.host) !== null && _options$host !== void 0 ? _options$host : (0, _hosts_js__WEBPACK_IMPORTED_MODULE_0__.eV1HostWithPort)();
|
|
8634
|
-
taggedVersion = "0.0.
|
|
8634
|
+
taggedVersion = "0.0.18";
|
|
8635
8635
|
if (!(taggedVersion !== "" && taggedVersion.length > 0 && options.mediaData !== true)) {
|
|
8636
8636
|
_context.next = 5;
|
|
8637
8637
|
break;
|
|
@@ -14372,7 +14372,7 @@ var __webpack_modules__ = {
|
|
|
14372
14372
|
if (this.isValidKey(this._eventKey)) {
|
|
14373
14373
|
return this._eventKey;
|
|
14374
14374
|
}
|
|
14375
|
-
this._eventKey = uniqId("
|
|
14375
|
+
this._eventKey = uniqId("cb22c01f78e29f9a5c3516f5b15df920".substring(0, 7) + "_");
|
|
14376
14376
|
this.publicApi.trigger("eventkeychange", this._eventKey);
|
|
14377
14377
|
return this._eventKey;
|
|
14378
14378
|
};
|
|
@@ -15819,7 +15819,7 @@ var __webpack_modules__ = {
|
|
|
15819
15819
|
var first = (0, _util_getOrSetIsFirst_js__WEBPACK_IMPORTED_MODULE_3__.u)(_this.hashedId, _ds_index_js__WEBPACK_IMPORTED_MODULE_2__.p.Scope.LIVE_EVENT, "load");
|
|
15820
15820
|
_classPrivateFieldSet(_playSession, _this, _ds_index_js__WEBPACK_IMPORTED_MODULE_2__.p.load(_classPrivateFieldGet(_clockStart, _this), {
|
|
15821
15821
|
visitor_key: _classPrivateFieldGet(_api, _this).visitorKey(),
|
|
15822
|
-
session_key: (0, utilities_uniqId_js__WEBPACK_IMPORTED_MODULE_5__.b)("".concat("
|
|
15822
|
+
session_key: (0, utilities_uniqId_js__WEBPACK_IMPORTED_MODULE_5__.b)("".concat("cb22c01f78e29f9a5c3516f5b15df920".substring(0, 7), "_")),
|
|
15823
15823
|
embed_url: _classPrivateFieldGet(_api, _this)._attrs.pageUrl,
|
|
15824
15824
|
referrer_url: _classPrivateFieldGet(_api, _this)._attrs.referrerUrl,
|
|
15825
15825
|
account_id: mediaData.accountId,
|
|
@@ -20013,7 +20013,7 @@ var __webpack_modules__ = {
|
|
|
20013
20013
|
}, {
|
|
20014
20014
|
key: "generate",
|
|
20015
20015
|
value: function generate() {
|
|
20016
|
-
return (0, utilities_uniqId_js__WEBPACK_IMPORTED_MODULE_4__.b)("".concat("
|
|
20016
|
+
return (0, utilities_uniqId_js__WEBPACK_IMPORTED_MODULE_4__.b)("".concat("cb22c01f78e29f9a5c3516f5b15df920".substring(0, 7), "_"));
|
|
20017
20017
|
}
|
|
20018
20018
|
}]);
|
|
20019
20019
|
}();
|
|
@@ -26879,7 +26879,7 @@ var __webpack_modules__ = {
|
|
|
26879
26879
|
Object.keys(optionSources).forEach(function(key) {
|
|
26880
26880
|
optionSources[key] = ensureOptionsAreNonCircular(optionSources[key]);
|
|
26881
26881
|
});
|
|
26882
|
-
var playerVersion = "0.0.
|
|
26882
|
+
var playerVersion = "0.0.18".length > 0 ? "0.0.18" : _utilities_player_version_js__WEBPACK_IMPORTED_MODULE_44__.H;
|
|
26883
26883
|
var data = {
|
|
26884
26884
|
player_version: playerVersion,
|
|
26885
26885
|
media_key: this._mediaData.mediaKey,
|
|
@@ -40431,7 +40431,7 @@ var __webpack_modules__ = {
|
|
|
40431
40431
|
/* harmony export */
|
|
40432
40432
|
});
|
|
40433
40433
|
var runScript = function runScript2(src2, timeout) {
|
|
40434
|
-
var taggedVersion = "0.0.
|
|
40434
|
+
var taggedVersion = "0.0.18";
|
|
40435
40435
|
return new Promise(function(resolve, reject) {
|
|
40436
40436
|
if (timeout == null) {
|
|
40437
40437
|
timeout = 8e3;
|
|
@@ -45365,13 +45365,13 @@ var __webpack_exports__2 = {};
|
|
|
45365
45365
|
var _this$embedHost2;
|
|
45366
45366
|
var template = document.createElement("template");
|
|
45367
45367
|
var fastHost = (0, _utilities_hosts_js__WEBPACK_IMPORTED_MODULE_1__.cdnFastWistiaComHost)((_this$embedHost2 = this.embedHost) !== null && _this$embedHost2 !== void 0 ? _this$embedHost2 : "");
|
|
45368
|
-
var
|
|
45368
|
+
var swatchUrl = "https://".concat(fastHost, "/embed/medias/").concat(this.mediaId, "/swatch");
|
|
45369
45369
|
var popoverContent = _assertClassBrand(_WistiaPlayer_brand, this, _getSyncedEmbedOption).call(this, "popoverContent");
|
|
45370
45370
|
var isPopoverWithThumbnail = this.wistiaPopover && (popoverContent === void 0 || popoverContent === "" || popoverContent === "thumbnail");
|
|
45371
45371
|
var shouldDisplaySwatch = this.swatch !== false && (!this.wistiaPopover || isPopoverWithThumbnail);
|
|
45372
45372
|
var swatch = shouldDisplaySwatch ? (
|
|
45373
45373
|
/* html */
|
|
45374
|
-
'\n <div\n style="height: 100%; left: 0; position: absolute; top: 0; width: 100%"\n class="wistia_swatch"\n >\n <div\n style="height: 100%; position: relative; width: 100%"\n >\n <div\n style="\n height: 100%;\n left: 0;\n overflow: hidden;\n position: absolute;\n top: 0;\n width: 100%;\n "\n >\n <img\n src="'.concat(
|
|
45374
|
+
'\n <div\n style="height: 100%; left: 0; position: absolute; top: 0; width: 100%"\n class="wistia_swatch"\n >\n <div\n style="height: 100%; position: relative; width: 100%"\n >\n <div\n style="\n height: 100%;\n left: 0;\n overflow: hidden;\n position: absolute;\n top: 0;\n width: 100%;\n "\n >\n <img\n src="'.concat(swatchUrl, '"\n style="filter: blur(5px); height: 100%; object-fit: contain; width: 100%"\n alt=""\n aria-hidden="true"\n onload="this.parentNode.style.opacity=1;"\n />\n </div>\n </div>\n </div>\n ')
|
|
45375
45375
|
) : "";
|
|
45376
45376
|
template.innerHTML = /* html */
|
|
45377
45377
|
"\n <style>\n :host {\n display: flex;\n position: relative;\n }\n </style>\n\n ".concat(swatch, "\n ");
|
|
@@ -45558,7 +45558,7 @@ var __webpack_exports__2 = {};
|
|
|
45558
45558
|
}
|
|
45559
45559
|
}));
|
|
45560
45560
|
}
|
|
45561
|
-
var
|
|
45561
|
+
var getSwatchMetaData = /* @__PURE__ */ function() {
|
|
45562
45562
|
var _ref13 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee20(url) {
|
|
45563
45563
|
var swatch;
|
|
45564
45564
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
@@ -45576,26 +45576,26 @@ var __webpack_exports__2 = {};
|
|
|
45576
45576
|
}
|
|
45577
45577
|
}, _callee20);
|
|
45578
45578
|
}));
|
|
45579
|
-
return function
|
|
45579
|
+
return function getSwatchMetaData2(_x17) {
|
|
45580
45580
|
return _ref13.apply(this, arguments);
|
|
45581
45581
|
};
|
|
45582
45582
|
}();
|
|
45583
45583
|
var wistiaSwatchElement = /* @__PURE__ */ function() {
|
|
45584
45584
|
var _ref14 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee21(mediaId, embedHost) {
|
|
45585
|
-
var fastHost,
|
|
45585
|
+
var fastHost, swatchUrl, swatchImg, naturalHeight, naturalWidth, ratio, style;
|
|
45586
45586
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
45587
45587
|
while (1) switch (_context21.prev = _context21.next) {
|
|
45588
45588
|
case 0:
|
|
45589
45589
|
fastHost = (0, _utilities_hosts_js__WEBPACK_IMPORTED_MODULE_1__.cdnFastWistiaComHost)(embedHost !== null && embedHost !== void 0 ? embedHost : "");
|
|
45590
|
-
|
|
45590
|
+
swatchUrl = "https://".concat(fastHost, "/embed/medias/").concat(mediaId, "/swatch");
|
|
45591
45591
|
_context21.next = 4;
|
|
45592
|
-
return
|
|
45592
|
+
return getSwatchMetaData(swatchUrl);
|
|
45593
45593
|
case 4:
|
|
45594
45594
|
swatchImg = _context21.sent;
|
|
45595
45595
|
naturalHeight = swatchImg.naturalHeight, naturalWidth = swatchImg.naturalWidth;
|
|
45596
45596
|
ratio = naturalHeight / naturalWidth * 100;
|
|
45597
45597
|
style = document.createElement("style");
|
|
45598
|
-
style.innerHTML = "\n wistia-player[media-id='".concat(mediaId, "']:not(:defined) {\n padding: ").concat(ratio, "% 0 0 0;\n background: url(").concat(
|
|
45598
|
+
style.innerHTML = "\n wistia-player[media-id='".concat(mediaId, "']:not(:defined) {\n padding: ").concat(ratio, "% 0 0 0;\n background: url(").concat(swatchUrl, ");\n background-size: contain;\n filter: blur(5px);\n display: block;\n }\n ");
|
|
45599
45599
|
return _context21.abrupt("return", style);
|
|
45600
45600
|
case 10:
|
|
45601
45601
|
case "end":
|
|
@@ -45613,57 +45613,8 @@ var __webpack_exports__2 = {};
|
|
|
45613
45613
|
})();
|
|
45614
45614
|
var __webpack_exports__WistiaPlayer = __webpack_exports__2.$;
|
|
45615
45615
|
var __webpack_exports__wistiaSwatchElement = __webpack_exports__2.A;
|
|
45616
|
-
|
|
45617
|
-
// src/utils/getMergedEmbedOption.ts
|
|
45618
|
-
var getMergedEmbedOption = (mediaId, optionKey, optionValue) => {
|
|
45619
|
-
let finalEmbedOption = optionValue;
|
|
45620
|
-
if (typeof window === "undefined") {
|
|
45621
|
-
return finalEmbedOption;
|
|
45622
|
-
}
|
|
45623
|
-
if (window.wistiaOptions?._all?.[optionKey] !== void 0) {
|
|
45624
|
-
finalEmbedOption = window.wistiaOptions._all[optionKey];
|
|
45625
|
-
}
|
|
45626
|
-
const mediaIdOptions = window.wistiaOptions?.[mediaId];
|
|
45627
|
-
if (mediaIdOptions !== void 0) {
|
|
45628
|
-
const mediaIdOptionValue = mediaIdOptions[optionKey];
|
|
45629
|
-
if (optionValue !== void 0) {
|
|
45630
|
-
finalEmbedOption = mediaIdOptionValue;
|
|
45631
|
-
}
|
|
45632
|
-
}
|
|
45633
|
-
return finalEmbedOption;
|
|
45634
|
-
};
|
|
45635
|
-
|
|
45636
|
-
// src/utils/swatch.ts
|
|
45637
|
-
var getSwatchMetaData = async (url) => {
|
|
45638
|
-
const swatch = new Image();
|
|
45639
|
-
swatch.src = url;
|
|
45640
|
-
await swatch.decode();
|
|
45641
|
-
return swatch;
|
|
45642
|
-
};
|
|
45643
|
-
var swatchUrl = (mediaId, embedHost) => `https://${embedHost}/embed/medias/${mediaId}/swatch`;
|
|
45644
|
-
var getSwatchAspectRatio = async (mediaId, embedHost = "fast.wistia.com") => {
|
|
45645
|
-
const swatchImg = await getSwatchMetaData(swatchUrl(mediaId, embedHost));
|
|
45646
|
-
const { naturalHeight, naturalWidth } = swatchImg;
|
|
45647
|
-
return naturalWidth / naturalHeight;
|
|
45648
|
-
};
|
|
45649
|
-
var defaultSwatchCSSProperties = ({
|
|
45650
|
-
mediaId,
|
|
45651
|
-
embedHost = "fast.wistia.com",
|
|
45652
|
-
aspect = 1.7,
|
|
45653
|
-
shouldLoadSwatch = true
|
|
45654
|
-
}) => {
|
|
45655
|
-
return {
|
|
45656
|
-
aspectRatio: `${aspect}`,
|
|
45657
|
-
background: shouldLoadSwatch ? `center / contain no-repeat url(${swatchUrl(mediaId, embedHost)})` : void 0,
|
|
45658
|
-
display: "block",
|
|
45659
|
-
filter: "blur(5px)",
|
|
45660
|
-
width: "100%"
|
|
45661
|
-
};
|
|
45662
|
-
};
|
|
45663
|
-
|
|
45664
45616
|
export {
|
|
45665
|
-
|
|
45666
|
-
|
|
45667
|
-
defaultSwatchCSSProperties
|
|
45617
|
+
__webpack_exports__WistiaPlayer as WistiaPlayer,
|
|
45618
|
+
__webpack_exports__wistiaSwatchElement as wistiaSwatchElement
|
|
45668
45619
|
};
|
|
45669
45620
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wistia/wistia-player-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"packageManager": "yarn@4.2.2",
|
|
5
5
|
"description": "An embeddable wistia-player web component and React wrapper to add responsive, lightweight, and SEO-friendly videos to your site.",
|
|
6
6
|
"keywords": [
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"build:prod": "npm-run-all 'prebuild' 'build:react:base:prod' 'build:types'"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@wistia/wistia-player": "0.0.
|
|
35
|
+
"@wistia/wistia-player": "0.0.18"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@babel/core": "^7.24.5",
|