@perceptimagery/dita-configurator-staging 0.1.7100 → 0.1.7201
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.js +109 -614
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
try {
|
|
5
5
|
if (typeof document != "undefined") {
|
|
6
6
|
var elementStyle = document.createElement("style");
|
|
7
|
-
elementStyle.appendChild(document.createTextNode("@import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@200;300;400;500;600;700;800&display=swap');\n\n#Sprie-config-html,\n#Sprie-config-body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n font-family: 'Work Sans', sans-serif;\n box-sizing: border-box;\n}\n\n#Sprie-config-body * {\n box-sizing: border-box;\n}\n\n.sprie-config-loadingBox {\n position: fixed;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n font-size: 24px;\n font-weight: 500;\n z-index: 1000;\n background: #f2f2f2;\n}\n.my-btn {\n border: 1px solid gray;\n border-radius: 5px;\n padding: 5px 10px;\n cursor: pointer;\n transition: all 300ms ease-in;\n}\n\n.my-btn:hover {\n box-shadow: 0 0 2px 3px gray;\n}\n.my-panel {\n border: 1px solid gray;\n padding: 10px 20px;\n border-radius: 10px;\n margin: 10px auto;\n}\n\n.my-panel h3 {\n font-family: sans-serif;\n}\n#Sprie-config-Main-Container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column-reverse;\n background: #ffffff;\n}\n\n#Sprie-config-Viewer-Container {\n width: 100%;\n position: relative;\n height: 100%;\n}\n\n#Sprie-config-Viewer-Container .sprie-config-webgl {\n width: 100%;\n height: 100%;\n}\n\n#Sprie-config-Checkout-Container {\n width: 100%;\n padding: 0.75rem;\n height: min(70%, 45rem);\n}\n\n#Sprie-config-Checkout-box {\n width: 100%;\n background: #efefef;\n padding: 1rem;\n min-height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n#Sprie-config-Checkout-header {\n right: 0;\n display: flex;\n flex-direction: column;\n width: 100%;\n justify-content: center;\n align-items: center;\n gap: 1rem;\n padding-bottom: 0.9rem;\n border-bottom: 1px solid #ccc;\n margin-bottom: 2.5rem;\n}\n\n#Sprie-config-Checkout-header #Sprie-config-frameName {\n color: #222;\n font-size: 1.375rem;\n font-weight: 400;\n line-height: 1.5275rem; /* 111.091% */\n letter-spacing: -0.05rem;\n text-transform: uppercase;\n}\n\n#Sprie-config-Checkout-header #Sprie-config-lensPrice {\n color: #222;\n font-size: 1.3125rem;\n font-weight: 400;\n line-height: 2.275rem; /* 173.333% */\n}\n\n#Sprie-config-Checkout-body {\n display: flex;\n flex-direction: column;\n}\n\n#Sprie-config-Dropdown-Container {\n flex-direction: column;\n gap: 1.5rem;\n}\n\n#Sprie-config-Checkout-button {\n display: flex;\n padding: 0rem 1.25rem;\n align-items: center;\n justify-content: center;\n width: 100%;\n background: #222;\n color: #fff;\n text-align: center;\n font-size: 0.875rem;\n font-weight: 600;\n line-height: 3.5rem; /* 400% */\n letter-spacing: 0.125rem;\n text-transform: uppercase;\n cursor: pointer;\n margin-top: 6rem;\n}\n\n.sprie-config-loadingFrame {\n position: absolute;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n fontsize: 24px;\n font-weight: 500;\n z-index: 1000;\n background: #f2f2f2;\n opacity: 0.8;\n}\n\n.sprie-config-loader {\n border: 8px solid #f3f3f3; /* Light grey */\n border-top: 8px solid #222222; /* Blue */\n border-radius: 50%;\n width: 60px;\n height: 60px;\n animation: spin 1.5s linear infinite;\n}\n\n@keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\n/* Breakpoints */\n\n@media (min-width: 800px) {\n #Sprie-config-Main-Container {\n flex-direction: row-reverse;\n }\n\n #Sprie-config-Checkout-Container {\n width: auto;\n padding: 2.5rem;\n height: 100%;\n }\n\n #Sprie-config-Checkout-box {\n width: 350px;\n padding: 1.5rem;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n\n #Sprie-config-Dropdown-Container {\n gap: 2.5rem;\n }\n\n #Sprie-config-Viewer-Container .sprie-config-webgl {\n height: 99%;\n }\n}\n\n@media (min-width: 992px) {\n #Sprie-config-Checkout-box {\n width: 450px;\n padding: 2.5rem;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n}\n/* Dropdown.css */\n\n.sprie-config-label {\n color: rgba(34, 34, 34, 0.7);\n font-size: 0.75rem;\n font-weight: 400;\n letter-spacing: 0.02813rem;\n margin-bottom: 0.5rem;\n display: flex;\n align-items: center;\n margin-left: 0.1rem;\n}\n\n.sprie-config-dropdown-wrapper {\n position: relative;\n width: 100%;\n}\n\n.sprie-config-select-box {\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 10px;\n /* border: 1px solid #ccc; */\n border-radius: 5px;\n position: relative;\n user-select: none;\n width: 100%;\n box-sizing: border-box;\n transition: border-radius 0.3s ease;\n padding: 1rem 1.25rem;\n background-color: #ffffff;\n max-height: 17rem; /* Set the fixed height for the dropdown */\n overflow-y: auto;\n}\n\n.sprie-config-select-box.sprie-config-open {\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n}\n\n.sprie-config-selected-option {\n flex: 1;\n}\n\n.sprie-config-arrow {\n margin-left: 10px;\n transition: transform 0.3s ease;\n}\n\n.sprie-config-arrow.sprie-config-up {\n transform: rotate(180deg);\n}\n\n.sprie-config-dropdown-options {\n list-style: none;\n margin: 0;\n padding: 0;\n position: absolute;\n top: 100%;\n left: 0;\n width: 100%;\n z-index: 1;\n background-color: #fff;\n border-top: 1px solid #ccc;\n border-radius: 0 0 5px 5px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n opacity: 0;\n visibility: hidden;\n overflow: hidden;\n transition: height 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;\n max-height: 17rem; /* Set the fixed height for the dropdown */\n overflow-y: auto;\n}\n\n.sprie-config-dropdown-options.sprie-config-open {\n opacity: 1;\n visibility: visible;\n height: auto;\n z-index: 1000;\n}\n\n.sprie-config-dropdown-options li {\n padding: 0.75rem 1rem;\n cursor: pointer;\n transition: background-color 0.3s ease;\n}\n\n.sprie-config-dropdown-options li:hover {\n background-color: #f0f0f0;\n}\n\n.sprie-config-dropdown-options li.sprie-config-selected {\n background-color: #f2f2f2; /* Highlight color for selected option */\n}\n\n.sprie-config-selected-option {\n width: 90%;\n}\n\n.sprie-config-frame-details-wrapper {\n display: flex;\n gap: 1rem;\n height: auto;\n overflow: hidden;\n}\n\n.sprie-config-variantImgBox {\n width: 3.4rem;\n height: 100%;\n display: flex;\n align-items: center; /* Center vertically */\n justify-content: center; /* Center horizontally */\n background: #fff;\n}\n\n.sprie-config-details {\n display: flex;\n flex-direction: column;\n gap: 2px;\n overflow: hidden;\n}\n\n.sprie-config-details .sprie-config-frameName {\n color: #4d4d4d;\n font-size: 1rem;\n font-weight: 400;\n line-height: 1.5rem; /* 150% */\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n margin : 0\n}\n\n.sprie-config-details .sprie-config-skuName {\n color: rgba(34, 34, 34, 0.7);\n font-size: 0.875rem;\n font-weight: 400;\n line-height: 0.96125rem; /* 109.857% */\n letter-spacing: 0.02813rem;\n text-transform: uppercase;\n margin : 0\n}\n/* LensDropdown.css */\n\n.sprie-config-label {\n color: rgba(34, 34, 34, 0.7);\n font-size: 0.75rem;\n font-weight: 400;\n letter-spacing: 0.02813rem;\n margin-bottom: 0.5rem;\n display: flex;\n align-items: center;\n margin-left: 0.1rem;\n}\n\n.sprie-config-dropdown-wrapper {\n position: relative;\n width: 100%;\n}\n\n.sprie-config-select-box {\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n border-radius: 0.125rem;\n position: relative;\n user-select: none;\n width: 100%;\n box-sizing: border-box;\n transition: border-radius 0.3s ease;\n background-color: #ffffff;\n}\n\n.sprie-config-select-box.sprie-config-open {\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n}\n\n.sprie-config-selected-lens {\n flex: 1;\n display: flex;\n gap: 1rem;\n height: auto;\n}\n\n.sprie-config-selected-lens .sprie-config-lens-details {\n display: flex;\n flex-direction: column;\n justify-content: center;\n height: auto;\n padding-bottom: 0.2rem;\n}\n\n.sprie-config-colorBox {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.sprie-config-lensName {\n color: #4d4d4d;\n font-size: 1rem;\n font-weight: 400;\n line-height: 1.5rem; /* 150% */\n margin: 0;\n}\n\n.sprie-config-lensColor {\n color: rgba(34, 34, 34, 0.7);\n font-size: 0.875rem;\n font-weight: 400;\n line-height: 0.96125rem; /* 109.857% */\n letter-spacing: 0.02813rem;\n text-transform: uppercase;\n margin: 0;\n}\n\n.sprie-config-arrow {\n margin-left: 10px;\n transition: transform 0.3s ease;\n}\n\n.sprie-config-arrow.sprie-config-up {\n transform: rotate(180deg);\n}\n\n.sprie-config-lens-dropdown-options {\n list-style: none;\n margin: 0;\n padding: 0;\n position: absolute;\n top: 100%;\n left: 0;\n width: 100%;\n z-index: 100; /* Adjust z-index to ensure dropdown options are above other elements */\n background-color: transparent;\n border-radius: 0 0 0.125rem 0.125rem;\n border: 0;\n box-shadow: none;\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.3s ease, visibility 0.3s ease;\n max-height: 4rem; /* Set the fixed height for the dropdown */\n overflow-x: auto;\n overflow-y: hidden;\n display: flex;\n flex-direction: row;\n flex-wrap: no-wrap;\n padding: 0;\n}\n\n.sprie-config-lens-dropdown-options.sprie-config-open {\n opacity: 1;\n visibility: visible;\n}\n\n.sprie-config-lens-dropdown-options li {\n padding: 1rem 1.25rem;\n cursor: pointer;\n transition: background-color 0.3s ease;\n padding: 0.25rem;\n}\n\n.sprie-config-lens-dropdown-options li .sprie-config-li-element {\n width: 100%;\n height: 100%;\n z-index: 10;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.sprie-config-lens-dropdown-options li .sprie-config-tooltip {\n display: none;\n}\n\n@media (min-width: 768px) {\n .sprie-config-lens-dropdown-options {\n max-height: 9.2rem;\n overflow-x: hidden;\n overflow-y: auto;\n display: grid;\n grid-template-columns: repeat(5, auto);\n padding: 0.5rem;\n border-top: 1px solid #ccc;\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .sprie-config-lens-dropdown-options li {\n min-width: auto;\n }\n\n .sprie-config-lens-dropdown-options li .sprie-config-tooltip {\n position: absolute;\n width: auto;\n height: 2rem;\n flex-shrink: 0;\n border-radius: 0.125rem;\n background: #fff;\n box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.25);\n text-align: center;\n line-height: 2rem;\n transition: opacity 0.3s ease, visibility 0.3s ease;\n display: block;\n\n /* Font style properties */\n color: rgba(34, 34, 34, 0.7);\n font-size: 0.875rem;\n font-weight: 400;\n letter-spacing: 0.02813rem;\n text-transform: uppercase;\n white-space: nowrap; /* Ensure text is in one line */\n z-index: 200;\n }\n\n .sprie-config-tooltip.sprie-config-top {\n bottom: 12%;\n }\n\n .sprie-config-tooltip.sprie-config-right {\n right: 2%;\n }\n}"));
|
|
7
|
+
elementStyle.appendChild(document.createTextNode("@import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@200;300;400;500;600;700;800&display=swap');\n\n#Sprie-config-html,\n#Sprie-config-body {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n font-family: 'Work Sans', sans-serif;\n box-sizing: border-box;\n}\n\n#Sprie-config-body * {\n box-sizing: border-box;\n}\n\n.sprie-config-loadingBox {\n position: fixed;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n font-size: 24px;\n font-weight: 500;\n z-index: 1000;\n background: #f2f2f2;\n}\n#Sprie-config-Main-Container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column-reverse;\n background: #ffffff;\n}\n\n#Sprie-config-Viewer-Container {\n width: 100%;\n position: relative;\n height: 100%;\n}\n\n#Sprie-config-Viewer-Container .sprie-config-webgl {\n width: 100%;\n height: 100%;\n}\n\n#Sprie-config-Checkout-Container {\n width: 100%;\n padding: 0.75rem;\n height: min(70%, 45rem);\n}\n\n#Sprie-config-Checkout-box {\n width: 100%;\n background: #efefef;\n padding: 1rem;\n min-height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n}\n\n#Sprie-config-Checkout-header {\n right: 0;\n display: flex;\n flex-direction: column;\n width: 100%;\n justify-content: center;\n align-items: center;\n gap: 1rem;\n padding-bottom: 0.9rem;\n border-bottom: 1px solid #ccc;\n margin-bottom: 2.5rem;\n}\n\n#Sprie-config-Checkout-header #Sprie-config-frameName {\n color: #222;\n font-size: 1.375rem;\n font-weight: 400;\n line-height: 1.5275rem; /* 111.091% */\n letter-spacing: -0.05rem;\n text-transform: uppercase;\n}\n\n#Sprie-config-Checkout-header #Sprie-config-lensPrice {\n color: #222;\n font-size: 1.3125rem;\n font-weight: 400;\n line-height: 2.275rem; /* 173.333% */\n}\n\n#Sprie-config-Checkout-body {\n display: flex;\n flex-direction: column;\n}\n\n#Sprie-config-Dropdown-Container {\n flex-direction: column;\n gap: 1.5rem;\n}\n\n#Sprie-config-Checkout-button {\n display: flex;\n padding: 0rem 1.25rem;\n align-items: center;\n justify-content: center;\n width: 100%;\n background: #222;\n color: #fff;\n text-align: center;\n font-size: 0.875rem;\n font-weight: 600;\n line-height: 3.5rem; /* 400% */\n letter-spacing: 0.125rem;\n text-transform: uppercase;\n cursor: pointer;\n margin-top: 6rem;\n}\n\n.sprie-config-loadingFrame {\n position: absolute;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n fontsize: 24px;\n font-weight: 500;\n z-index: 1000;\n background: #f2f2f2;\n opacity: 0.8;\n}\n\n.sprie-config-loader {\n border: 8px solid #f3f3f3; /* Light grey */\n border-top: 8px solid #222222; /* Blue */\n border-radius: 50%;\n width: 60px;\n height: 60px;\n animation: spin 1.5s linear infinite;\n}\n\n@keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\n/* Breakpoints */\n\n@media (min-width: 800px) {\n #Sprie-config-Main-Container {\n flex-direction: row-reverse;\n }\n\n #Sprie-config-Checkout-Container {\n width: auto;\n padding: 2.5rem;\n height: 100%;\n }\n\n #Sprie-config-Checkout-box {\n width: 350px;\n padding: 1.5rem;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n\n #Sprie-config-Dropdown-Container {\n gap: 2.5rem;\n }\n\n #Sprie-config-Viewer-Container .sprie-config-webgl {\n height: 99%;\n }\n}\n\n@media (min-width: 992px) {\n #Sprie-config-Checkout-box {\n width: 450px;\n padding: 2.5rem;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n}\n/* Dropdown.css */\n\n.sprie-config-label {\n color: rgba(34, 34, 34, 0.7);\n font-size: 0.75rem;\n font-weight: 400;\n letter-spacing: 0.02813rem;\n margin-bottom: 0.5rem;\n display: flex;\n align-items: center;\n margin-left: 0.1rem;\n}\n\n.sprie-config-dropdown-wrapper {\n position: relative;\n width: 100%;\n}\n\n.sprie-config-select-box {\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 10px;\n /* border: 1px solid #ccc; */\n border-radius: 5px;\n position: relative;\n user-select: none;\n width: 100%;\n box-sizing: border-box;\n transition: border-radius 0.3s ease;\n padding: 1rem 1.25rem;\n background-color: #ffffff;\n max-height: 17rem; /* Set the fixed height for the dropdown */\n overflow-y: auto;\n}\n\n.sprie-config-select-box.sprie-config-open {\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n}\n\n.sprie-config-selected-option {\n flex: 1;\n}\n\n.sprie-config-arrow {\n margin-left: 10px;\n transition: transform 0.3s ease;\n}\n\n.sprie-config-arrow.sprie-config-up {\n transform: rotate(180deg);\n}\n\n.sprie-config-dropdown-options {\n list-style: none;\n margin: 0;\n padding: 0;\n position: absolute;\n top: 100%;\n left: 0;\n width: 100%;\n z-index: 1;\n background-color: #fff;\n border-top: 1px solid #ccc;\n border-radius: 0 0 5px 5px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n opacity: 0;\n visibility: hidden;\n overflow: hidden;\n transition: height 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;\n max-height: 17rem; /* Set the fixed height for the dropdown */\n overflow-y: auto;\n}\n\n.sprie-config-dropdown-options.sprie-config-open {\n opacity: 1;\n visibility: visible;\n height: auto;\n z-index: 1000;\n}\n\n.sprie-config-dropdown-options li {\n padding: 0.75rem 1rem;\n cursor: pointer;\n transition: background-color 0.3s ease;\n}\n\n.sprie-config-dropdown-options li:hover {\n background-color: #f0f0f0;\n}\n\n.sprie-config-dropdown-options li.sprie-config-selected {\n background-color: #f2f2f2; /* Highlight color for selected option */\n}\n\n.sprie-config-selected-option {\n width: 90%;\n}\n\n.sprie-config-frame-details-wrapper {\n display: flex;\n gap: 1rem;\n height: auto;\n overflow: hidden;\n}\n\n.sprie-config-variantImgBox {\n width: 3.4rem;\n height: 100%;\n display: flex;\n align-items: center; /* Center vertically */\n justify-content: center; /* Center horizontally */\n background: #fff;\n}\n\n.sprie-config-details {\n display: flex;\n flex-direction: column;\n gap: 2px;\n overflow: hidden;\n}\n\n.sprie-config-details .sprie-config-frameName {\n color: #4d4d4d;\n font-size: 1rem;\n font-weight: 400;\n line-height: 1.5rem; /* 150% */\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n margin : 0\n}\n\n.sprie-config-details .sprie-config-skuName {\n color: rgba(34, 34, 34, 0.7);\n font-size: 0.875rem;\n font-weight: 400;\n line-height: 0.96125rem; /* 109.857% */\n letter-spacing: 0.02813rem;\n text-transform: uppercase;\n margin : 0\n}\n/* LensDropdown.css */\n\n.sprie-config-label {\n color: rgba(34, 34, 34, 0.7);\n font-size: 0.75rem;\n font-weight: 400;\n letter-spacing: 0.02813rem;\n margin-bottom: 0.5rem;\n display: flex;\n align-items: center;\n margin-left: 0.1rem;\n}\n\n.sprie-config-dropdown-wrapper {\n position: relative;\n width: 100%;\n}\n\n.sprie-config-select-box {\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n border-radius: 0.125rem;\n position: relative;\n user-select: none;\n width: 100%;\n box-sizing: border-box;\n transition: border-radius 0.3s ease;\n background-color: #ffffff;\n}\n\n.sprie-config-select-box.sprie-config-open {\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n}\n\n.sprie-config-selected-lens {\n flex: 1;\n display: flex;\n gap: 1rem;\n height: auto;\n}\n\n.sprie-config-selected-lens .sprie-config-lens-details {\n display: flex;\n flex-direction: column;\n justify-content: center;\n height: auto;\n padding-bottom: 0.2rem;\n}\n\n.sprie-config-colorBox {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.sprie-config-lensName {\n color: #4d4d4d;\n font-size: 1rem;\n font-weight: 400;\n line-height: 1.5rem; /* 150% */\n margin: 0;\n}\n\n.sprie-config-lensColor {\n color: rgba(34, 34, 34, 0.7);\n font-size: 0.875rem;\n font-weight: 400;\n line-height: 0.96125rem; /* 109.857% */\n letter-spacing: 0.02813rem;\n text-transform: uppercase;\n margin: 0;\n}\n\n.sprie-config-arrow {\n margin-left: 10px;\n transition: transform 0.3s ease;\n}\n\n.sprie-config-arrow.sprie-config-up {\n transform: rotate(180deg);\n}\n\n.sprie-config-lens-dropdown-options {\n list-style: none;\n margin: 0;\n padding: 0;\n position: absolute;\n top: 100%;\n left: 0;\n width: 100%;\n z-index: 100; /* Adjust z-index to ensure dropdown options are above other elements */\n background-color: transparent;\n border-radius: 0 0 0.125rem 0.125rem;\n border: 0;\n box-shadow: none;\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.3s ease, visibility 0.3s ease;\n max-height: 4rem; /* Set the fixed height for the dropdown */\n overflow-x: auto;\n overflow-y: hidden;\n display: flex;\n flex-direction: row;\n flex-wrap: no-wrap;\n padding: 0;\n}\n\n.sprie-config-lens-dropdown-options.sprie-config-open {\n opacity: 1;\n visibility: visible;\n}\n\n.sprie-config-lens-dropdown-options li {\n padding: 1rem 1.25rem;\n cursor: pointer;\n transition: background-color 0.3s ease;\n padding: 0.25rem;\n}\n\n.sprie-config-lens-dropdown-options li .sprie-config-li-element {\n width: 100%;\n height: 100%;\n z-index: 10;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.sprie-config-lens-dropdown-options li .sprie-config-tooltip {\n display: none;\n}\n\n@media (min-width: 768px) {\n .sprie-config-lens-dropdown-options {\n max-height: 9.2rem;\n overflow-x: hidden;\n overflow-y: auto;\n display: grid;\n grid-template-columns: repeat(5, auto);\n padding: 0.5rem;\n border-top: 1px solid #ccc;\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .sprie-config-lens-dropdown-options li {\n min-width: auto;\n }\n\n .sprie-config-lens-dropdown-options li .sprie-config-tooltip {\n position: absolute;\n width: auto;\n height: 2rem;\n flex-shrink: 0;\n border-radius: 0.125rem;\n background: #fff;\n box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.25);\n text-align: center;\n line-height: 2rem;\n transition: opacity 0.3s ease, visibility 0.3s ease;\n display: block;\n\n /* Font style properties */\n color: rgba(34, 34, 34, 0.7);\n font-size: 0.875rem;\n font-weight: 400;\n letter-spacing: 0.02813rem;\n text-transform: uppercase;\n white-space: nowrap; /* Ensure text is in one line */\n z-index: 200;\n }\n\n .sprie-config-tooltip.sprie-config-top {\n bottom: 12%;\n }\n\n .sprie-config-tooltip.sprie-config-right {\n right: 2%;\n }\n}"));
|
|
8
8
|
document.head.appendChild(elementStyle);
|
|
9
9
|
}
|
|
10
10
|
} catch (e) {
|
|
@@ -111,7 +111,7 @@ var __publicField = (obj, key, value) => {
|
|
|
111
111
|
host: "https://api.sprie.io"
|
|
112
112
|
};
|
|
113
113
|
const config = Object.freeze(Config$1);
|
|
114
|
-
const version$1 = "0.1.
|
|
114
|
+
const version$1 = "0.1.7201";
|
|
115
115
|
function modifyLensArr(arr, element) {
|
|
116
116
|
const index = arr.findIndex((e) => e["sku"] === element["sku"]);
|
|
117
117
|
if (index !== -1) {
|
|
@@ -198,17 +198,17 @@ var __publicField = (obj, key, value) => {
|
|
|
198
198
|
throw new Error("Failed to download model asset.");
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
async HandleAssetUsage(asset) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
201
|
+
// async HandleAssetUsage(asset: string) {
|
|
202
|
+
// if (!this.fetcher.IsConfigExpired() && asset) {
|
|
203
|
+
// const bodyData = {
|
|
204
|
+
// org: this.fetcher.config.ORGID,
|
|
205
|
+
// asset,
|
|
206
|
+
// timestamp: new Date().toISOString(),
|
|
207
|
+
// };
|
|
208
|
+
// const url = '/v1/analytics/trigger';
|
|
209
|
+
// await this.fetcher.Post(url, bodyData);
|
|
210
|
+
// }
|
|
211
|
+
// }
|
|
212
212
|
}
|
|
213
213
|
const Prefix = "SprieEmbedEvent";
|
|
214
214
|
function EventWrapper(eventName, argValue) {
|
|
@@ -223,15 +223,6 @@ var __publicField = (obj, key, value) => {
|
|
|
223
223
|
FetchingData: () => EventWrapper("FetchingData"),
|
|
224
224
|
EmbedLoaded: () => EventWrapper("EmbedLoaded")
|
|
225
225
|
};
|
|
226
|
-
var ESDKStatus = /* @__PURE__ */ ((ESDKStatus2) => {
|
|
227
|
-
ESDKStatus2["Init"] = "init";
|
|
228
|
-
ESDKStatus2["Preparing"] = "preparing";
|
|
229
|
-
ESDKStatus2["Authenticating"] = "authenticating";
|
|
230
|
-
ESDKStatus2["Fetching"] = "fetching";
|
|
231
|
-
ESDKStatus2["Loading"] = "loading";
|
|
232
|
-
ESDKStatus2["Done"] = "done";
|
|
233
|
-
return ESDKStatus2;
|
|
234
|
-
})(ESDKStatus || {});
|
|
235
226
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
236
227
|
function getDefaultExportFromCjs(x2) {
|
|
237
228
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
@@ -41443,27 +41434,31 @@ bool bvhIntersectFirstHit(
|
|
|
41443
41434
|
positions: { value: positions },
|
|
41444
41435
|
opacities: { value: opacities }
|
|
41445
41436
|
};
|
|
41437
|
+
const rgbeLoader = new RGBELoader();
|
|
41446
41438
|
document.getElementById("gui-container");
|
|
41447
|
-
const
|
|
41439
|
+
const gemstoneMaterial = new MeshRefractionMaterial();
|
|
41448
41440
|
const BLOOM_SCENE = 1;
|
|
41449
41441
|
const bloomLayer = new Layers();
|
|
41450
41442
|
bloomLayer.set(BLOOM_SCENE);
|
|
41451
41443
|
new MeshBasicMaterial({ color: "black" });
|
|
41452
41444
|
class CustomRenderer {
|
|
41453
|
-
// lensMaterial:THREE.MeshPhysicalMaterial| any
|
|
41454
41445
|
constructor(apiService) {
|
|
41455
41446
|
__publicField(this, "scene");
|
|
41456
41447
|
__publicField(this, "camera");
|
|
41457
41448
|
__publicField(this, "renderer");
|
|
41458
41449
|
__publicField(this, "canvas");
|
|
41459
41450
|
__publicField(this, "apiService");
|
|
41451
|
+
__publicField(this, "canvasSize");
|
|
41452
|
+
__publicField(this, "isInitialised");
|
|
41460
41453
|
this.apiService = apiService;
|
|
41461
41454
|
this.scene = new Scene();
|
|
41455
|
+
this.canvasSize = new Vector2();
|
|
41456
|
+
this.isInitialised = false;
|
|
41462
41457
|
}
|
|
41463
41458
|
async intialize() {
|
|
41464
|
-
var _a;
|
|
41465
41459
|
const newWidth = document.querySelector("canvas.sprie-config-webgl").clientWidth;
|
|
41466
41460
|
const newHeight = document.querySelector("canvas.sprie-config-webgl").clientHeight;
|
|
41461
|
+
this.canvasSize.set(newWidth, newHeight);
|
|
41467
41462
|
this.camera = new PerspectiveCamera(
|
|
41468
41463
|
12,
|
|
41469
41464
|
newWidth / newHeight,
|
|
@@ -41479,7 +41474,6 @@ bool bvhIntersectFirstHit(
|
|
|
41479
41474
|
});
|
|
41480
41475
|
this.renderer.setSize(newWidth, newHeight);
|
|
41481
41476
|
this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
|
|
41482
|
-
const rgbeLoader = new RGBELoader();
|
|
41483
41477
|
rgbeLoader.load(
|
|
41484
41478
|
"https://sprie-jarvis-public.s3.eu-west-2.amazonaws.com/environment_desaturated.hdr",
|
|
41485
41479
|
(environmentMap) => {
|
|
@@ -41487,18 +41481,22 @@ bool bvhIntersectFirstHit(
|
|
|
41487
41481
|
this.scene.environment = environmentMap;
|
|
41488
41482
|
}
|
|
41489
41483
|
);
|
|
41484
|
+
this.isInitialised = true;
|
|
41485
|
+
}
|
|
41486
|
+
initGemstoneDependencies() {
|
|
41487
|
+
var _a;
|
|
41490
41488
|
rgbeLoader.load(
|
|
41491
41489
|
"https://sprie-jarvis-public.s3.eu-west-2.amazonaws.com/environment_gemstones.hdr",
|
|
41492
41490
|
(reflectionMap) => {
|
|
41493
41491
|
reflectionMap.mapping = EquirectangularReflectionMapping;
|
|
41494
|
-
|
|
41492
|
+
gemstoneMaterial.uniforms.envMap.value = reflectionMap;
|
|
41495
41493
|
envMap = reflectionMap;
|
|
41496
41494
|
}
|
|
41497
41495
|
);
|
|
41498
41496
|
const aberrationStrength = 0.01;
|
|
41499
41497
|
const isCubeTexture = (def) => def && def.isCubeTexture;
|
|
41500
|
-
|
|
41501
|
-
|
|
41498
|
+
gemstoneMaterial.uniforms.aberrationStrength.value = aberrationStrength;
|
|
41499
|
+
gemstoneMaterial.uniforms.resolution.value = this.canvasSize;
|
|
41502
41500
|
const temp5 = {};
|
|
41503
41501
|
const isCubeMap = isCubeTexture(envMap);
|
|
41504
41502
|
const w2 = (isCubeMap ? (_a = envMap == null ? void 0 : envMap.image[0]) == null ? void 0 : _a.width : envMap == null ? void 0 : envMap.image.width) ?? 1024;
|
|
@@ -41514,7 +41512,7 @@ bool bvhIntersectFirstHit(
|
|
|
41514
41512
|
temp5.CUBEUV_MAX_MIP = `${_lodMax}.0`;
|
|
41515
41513
|
temp5.CHROMATIC_ABERRATIONS = "";
|
|
41516
41514
|
temp5.FAST_CHROMA = "";
|
|
41517
|
-
|
|
41515
|
+
gemstoneMaterial.defines = temp5;
|
|
41518
41516
|
}
|
|
41519
41517
|
cleanUp() {
|
|
41520
41518
|
if (this.renderer) {
|
|
@@ -41532,6 +41530,45 @@ bool bvhIntersectFirstHit(
|
|
|
41532
41530
|
});
|
|
41533
41531
|
});
|
|
41534
41532
|
}
|
|
41533
|
+
async downloadModel(orgId, assetId) {
|
|
41534
|
+
return await this.apiService.DownloadMA({
|
|
41535
|
+
orgId,
|
|
41536
|
+
assetsId: assetId
|
|
41537
|
+
});
|
|
41538
|
+
}
|
|
41539
|
+
async loadFirstFrame(orgId, frame) {
|
|
41540
|
+
if (frame && orgId) {
|
|
41541
|
+
const apiRes = await this.downloadModel(orgId, frame._id);
|
|
41542
|
+
const specialLens = frame.customisation.length == 0;
|
|
41543
|
+
const includedLens = specialLens ? null : frame.customisation.find((x2) => x2.type == "Lens");
|
|
41544
|
+
await this.renderModel(apiRes.asset.cloudfrontUrl, specialLens, apiRes.decryptionKey).then(() => {
|
|
41545
|
+
if (includedLens) {
|
|
41546
|
+
this.setupLensMaterial(
|
|
41547
|
+
includedLens
|
|
41548
|
+
);
|
|
41549
|
+
}
|
|
41550
|
+
});
|
|
41551
|
+
} else {
|
|
41552
|
+
return;
|
|
41553
|
+
}
|
|
41554
|
+
}
|
|
41555
|
+
async changeFrame(orgId, frame, selectedLens) {
|
|
41556
|
+
if (frame && orgId) {
|
|
41557
|
+
const apiRes = await this.downloadModel(orgId, frame._id);
|
|
41558
|
+
const specialLens = frame.customisation.length == 0;
|
|
41559
|
+
const customLensMaterial = specialLens ? null : frame.customisation.find((x2) => x2.type == "Lens");
|
|
41560
|
+
const renderAsIs = specialLens && selectedLens.sku == "lens-default";
|
|
41561
|
+
await this.renderModel(apiRes.asset.cloudfrontUrl, renderAsIs, apiRes.decryptionKey).then(async () => {
|
|
41562
|
+
if (selectedLens.sku == "lens-default") {
|
|
41563
|
+
if (customLensMaterial) {
|
|
41564
|
+
this.setupLensMaterial(customLensMaterial);
|
|
41565
|
+
}
|
|
41566
|
+
} else {
|
|
41567
|
+
this.setupLensMaterial(selectedLens);
|
|
41568
|
+
}
|
|
41569
|
+
});
|
|
41570
|
+
}
|
|
41571
|
+
}
|
|
41535
41572
|
async renderModel(modelContent, renderAsIs, decryptionKey) {
|
|
41536
41573
|
const loader = new GLTFLoader();
|
|
41537
41574
|
if (modelContent) {
|
|
@@ -41574,7 +41611,6 @@ bool bvhIntersectFirstHit(
|
|
|
41574
41611
|
gltf.scene.traverse((node) => {
|
|
41575
41612
|
if (node.isMesh) {
|
|
41576
41613
|
bottom = Math.min(bottom, this.getMinY(node));
|
|
41577
|
-
console.log("node name", node.name);
|
|
41578
41614
|
if (node.material && node.material.name == "Lenses") {
|
|
41579
41615
|
let lowestY = Number.POSITIVE_INFINITY;
|
|
41580
41616
|
let highestY = Number.NEGATIVE_INFINITY;
|
|
@@ -41680,12 +41716,12 @@ bool bvhIntersectFirstHit(
|
|
|
41680
41716
|
}
|
|
41681
41717
|
}
|
|
41682
41718
|
if (node.material && node.name === "Diamonds") {
|
|
41683
|
-
|
|
41684
|
-
|
|
41685
|
-
|
|
41719
|
+
this.initGemstoneDependencies();
|
|
41720
|
+
gemstoneMaterial.uniforms.bvh.value = new MeshBVHUniformStruct();
|
|
41721
|
+
gemstoneMaterial.uniforms.bvh.value.updateFrom(
|
|
41686
41722
|
new MeshBVH(node.geometry.clone().toNonIndexed(), { strategy: SAH })
|
|
41687
41723
|
);
|
|
41688
|
-
node.material =
|
|
41724
|
+
node.material = gemstoneMaterial;
|
|
41689
41725
|
}
|
|
41690
41726
|
}
|
|
41691
41727
|
});
|
|
@@ -41721,206 +41757,6 @@ bool bvhIntersectFirstHit(
|
|
|
41721
41757
|
}
|
|
41722
41758
|
return result == null ? void 0 : result.scene;
|
|
41723
41759
|
}
|
|
41724
|
-
async setupDropdownAndListeners(response) {
|
|
41725
|
-
const selectDropdown = document.getElementById("Framedropdown");
|
|
41726
|
-
const button = document.getElementById("FramedropdownBtn");
|
|
41727
|
-
const frameContainer = document.getElementById("FrameContainer");
|
|
41728
|
-
const frameElement = document.getElementById("frameName");
|
|
41729
|
-
frameElement.textContent = response.group.name;
|
|
41730
|
-
if (Array.isArray(response.variants)) {
|
|
41731
|
-
response.variants.forEach((frame) => {
|
|
41732
|
-
const option = document.createElement("li");
|
|
41733
|
-
const optionContent = document.createElement("div");
|
|
41734
|
-
optionContent.id = "FrameDetailsContainer";
|
|
41735
|
-
optionContent.classList.add("FramedropdownStyle");
|
|
41736
|
-
optionContent.setAttribute("data-id", frame._id);
|
|
41737
|
-
const wrapper = document.createElement("div");
|
|
41738
|
-
wrapper.classList.add("detalisWrapper");
|
|
41739
|
-
const imageElement = document.createElement("img");
|
|
41740
|
-
imageElement.id = "FramedropdownImg";
|
|
41741
|
-
imageElement.src = frame.variantImage;
|
|
41742
|
-
imageElement.alt = frame.name;
|
|
41743
|
-
const nameElement = document.createElement("div");
|
|
41744
|
-
nameElement.id = "FramedropdownName";
|
|
41745
|
-
nameElement.textContent = frame.name;
|
|
41746
|
-
const skuElement = document.createElement("div");
|
|
41747
|
-
skuElement.id = "FramedropdownDesc";
|
|
41748
|
-
skuElement.textContent = frame.sku;
|
|
41749
|
-
optionContent.appendChild(imageElement);
|
|
41750
|
-
optionContent.appendChild(wrapper);
|
|
41751
|
-
wrapper.appendChild(nameElement);
|
|
41752
|
-
wrapper.appendChild(skuElement);
|
|
41753
|
-
option.appendChild(optionContent);
|
|
41754
|
-
selectDropdown == null ? void 0 : selectDropdown.appendChild(option);
|
|
41755
|
-
});
|
|
41756
|
-
} else {
|
|
41757
|
-
console.error(
|
|
41758
|
-
'The "variants" property is not an array in the JSON data.'
|
|
41759
|
-
);
|
|
41760
|
-
}
|
|
41761
|
-
if (selectDropdown) {
|
|
41762
|
-
selectDropdown.addEventListener("mousedown", async (event) => {
|
|
41763
|
-
if (event.target.matches("div")) {
|
|
41764
|
-
const selectedOption = event.target;
|
|
41765
|
-
selectedOption.style.background = "#f2f2f2";
|
|
41766
|
-
const modelId = selectedOption.getAttribute("data-id");
|
|
41767
|
-
if (modelId) {
|
|
41768
|
-
const modelAsset = await this.apiService.DownloadMA({
|
|
41769
|
-
orgId: this.apiService.fetcher.config.ORGID,
|
|
41770
|
-
assetsId: selectedOption.getAttribute("data-id")
|
|
41771
|
-
});
|
|
41772
|
-
this.renderModel(
|
|
41773
|
-
modelAsset.asset.cloudfrontUrl,
|
|
41774
|
-
true,
|
|
41775
|
-
modelAsset.decryptionKey
|
|
41776
|
-
);
|
|
41777
|
-
frameContainer.innerHTML = selectedOption.innerHTML;
|
|
41778
|
-
}
|
|
41779
|
-
}
|
|
41780
|
-
selectDropdown.style.display = "none";
|
|
41781
|
-
});
|
|
41782
|
-
}
|
|
41783
|
-
button.addEventListener("mousedown", () => {
|
|
41784
|
-
if (selectDropdown.style.display === "block") {
|
|
41785
|
-
selectDropdown.style.display = "none";
|
|
41786
|
-
} else {
|
|
41787
|
-
selectDropdown.style.display = "block";
|
|
41788
|
-
}
|
|
41789
|
-
});
|
|
41790
|
-
}
|
|
41791
|
-
async setupLensDropdownAndListeners(response) {
|
|
41792
|
-
const selectDropdown = document.getElementById("Lensdropdown");
|
|
41793
|
-
const button = document.getElementById("LensdropdownBtn");
|
|
41794
|
-
if (Array.isArray(response.data)) {
|
|
41795
|
-
response.data.forEach((lens) => {
|
|
41796
|
-
if (lens.name != "CLEAR") {
|
|
41797
|
-
const option = document.createElement("li");
|
|
41798
|
-
const optionContent = document.createElement("div");
|
|
41799
|
-
optionContent.id = "LensdetailsContainer";
|
|
41800
|
-
if (lens.direction == "u") {
|
|
41801
|
-
optionContent.setAttribute("data-color", lens.color);
|
|
41802
|
-
} else {
|
|
41803
|
-
optionContent.setAttribute(
|
|
41804
|
-
"data-color",
|
|
41805
|
-
JSON.stringify(lens.gradientColors)
|
|
41806
|
-
);
|
|
41807
|
-
}
|
|
41808
|
-
optionContent.setAttribute("data-direction", lens.direction);
|
|
41809
|
-
optionContent.setAttribute("data-opacity", `${lens.opacity}`);
|
|
41810
|
-
optionContent.setAttribute("data-metalness", `${lens.metalness}`);
|
|
41811
|
-
optionContent.setAttribute("data-finish", lens.finish);
|
|
41812
|
-
optionContent.setAttribute("data-roughness", `${lens.roughness}`);
|
|
41813
|
-
optionContent.setAttribute("data-name", lens.name);
|
|
41814
|
-
optionContent.setAttribute("data-desc", lens.metadata[0].value);
|
|
41815
|
-
optionContent.setAttribute("data-price", `${lens.price}`);
|
|
41816
|
-
optionContent.classList.add("LensdropdownStyle");
|
|
41817
|
-
const wrapper = document.createElement("div");
|
|
41818
|
-
wrapper.classList.add("LensdetalisWrapper");
|
|
41819
|
-
const imageElement = document.createElement("img");
|
|
41820
|
-
imageElement.id = "LensdropdownImg";
|
|
41821
|
-
imageElement.style.background = lens.color;
|
|
41822
|
-
const nameElement = document.createElement("div");
|
|
41823
|
-
nameElement.textContent = lens.name;
|
|
41824
|
-
const skuElement = document.createElement("div");
|
|
41825
|
-
skuElement.textContent = lens.metadata[0].value;
|
|
41826
|
-
optionContent.appendChild(imageElement);
|
|
41827
|
-
optionContent.appendChild(wrapper);
|
|
41828
|
-
wrapper.appendChild(nameElement);
|
|
41829
|
-
wrapper.appendChild(skuElement);
|
|
41830
|
-
option.appendChild(optionContent);
|
|
41831
|
-
selectDropdown == null ? void 0 : selectDropdown.appendChild(option);
|
|
41832
|
-
}
|
|
41833
|
-
});
|
|
41834
|
-
} else {
|
|
41835
|
-
console.error(
|
|
41836
|
-
'The "variants" property is not an array in the JSON data.'
|
|
41837
|
-
);
|
|
41838
|
-
}
|
|
41839
|
-
if (selectDropdown) {
|
|
41840
|
-
selectDropdown.addEventListener("mousedown", async (event) => {
|
|
41841
|
-
if (event.target.matches("div")) {
|
|
41842
|
-
console.log(event.target, event);
|
|
41843
|
-
const selectedOption = event.target;
|
|
41844
|
-
selectedOption.style.background = "#f2f2f2";
|
|
41845
|
-
if (lensMaterial) {
|
|
41846
|
-
if (selectedOption.getAttribute("data-direction") == "u") {
|
|
41847
|
-
lensMaterial.color = new Color(
|
|
41848
|
-
selectedOption.getAttribute("data-color")
|
|
41849
|
-
);
|
|
41850
|
-
lensMaterial.opacity = selectedOption.getAttribute(
|
|
41851
|
-
"data-opacity"
|
|
41852
|
-
);
|
|
41853
|
-
gu.uAlpha.value = false;
|
|
41854
|
-
const image = document.getElementById("LensdropdownImgD");
|
|
41855
|
-
image.style.background = selectedOption.getAttribute("data-color");
|
|
41856
|
-
} else if (selectedOption.getAttribute("data-direction") == "tb") {
|
|
41857
|
-
const gradientColors = JSON.parse(
|
|
41858
|
-
selectedOption.getAttribute("data-color")
|
|
41859
|
-
);
|
|
41860
|
-
gu.uAlpha.value = true;
|
|
41861
|
-
let index = 0;
|
|
41862
|
-
gradientColors.forEach(() => {
|
|
41863
|
-
gu.colors.value[index] = new Color(
|
|
41864
|
-
gradientColors[index].color
|
|
41865
|
-
);
|
|
41866
|
-
gu.positions.value[index] = gradientColors[index].position;
|
|
41867
|
-
gu.opacities.value[index] = gradientColors[index].alpha;
|
|
41868
|
-
index++;
|
|
41869
|
-
});
|
|
41870
|
-
}
|
|
41871
|
-
if (selectedOption.getAttribute("data-finish") == "MIRBLKHMC") {
|
|
41872
|
-
lensMaterial.clearcoat = 1;
|
|
41873
|
-
lensMaterial.clearcoatRoughness = 0;
|
|
41874
|
-
} else if (selectedOption.getAttribute("data-finish") == "HMCCR") {
|
|
41875
|
-
lensMaterial.clearcoat = 0;
|
|
41876
|
-
lensMaterial.clearcoatRoughness = 1;
|
|
41877
|
-
} else if (selectedOption.getAttribute("data-finish") == "MIRSILHMC") {
|
|
41878
|
-
lensMaterial.clearcoat = 1;
|
|
41879
|
-
lensMaterial.clearcoatRoughness = 0;
|
|
41880
|
-
}
|
|
41881
|
-
lensMaterial.roughness = selectedOption.getAttribute(
|
|
41882
|
-
"data-roughness"
|
|
41883
|
-
);
|
|
41884
|
-
lensMaterial.metalness = selectedOption.getAttribute(
|
|
41885
|
-
"data-metalness"
|
|
41886
|
-
);
|
|
41887
|
-
const name = document.getElementById("LensdropdownNameD");
|
|
41888
|
-
name.textContent = selectedOption.getAttribute("data-name");
|
|
41889
|
-
const desc = document.getElementById("LensdropdownSkuD");
|
|
41890
|
-
desc.textContent = selectedOption.getAttribute("data-desc");
|
|
41891
|
-
const priceElement = document.getElementById("lensPrice");
|
|
41892
|
-
priceElement.textContent = "+ $" + selectedOption.getAttribute("data-price") + ".00 USD";
|
|
41893
|
-
}
|
|
41894
|
-
}
|
|
41895
|
-
selectDropdown.style.display = "none";
|
|
41896
|
-
});
|
|
41897
|
-
}
|
|
41898
|
-
button.addEventListener("mousedown", () => {
|
|
41899
|
-
if (selectDropdown.style.display === "block") {
|
|
41900
|
-
selectDropdown.style.display = "none";
|
|
41901
|
-
} else {
|
|
41902
|
-
selectDropdown.style.display = "block";
|
|
41903
|
-
}
|
|
41904
|
-
});
|
|
41905
|
-
}
|
|
41906
|
-
async setupLensDefault(response) {
|
|
41907
|
-
if (lensMaterial) {
|
|
41908
|
-
lensMaterial.color = new Color(response.customisation[0].color);
|
|
41909
|
-
lensMaterial.opacity = response.customisation[0].opacity;
|
|
41910
|
-
lensMaterial.metalness = response.customisation[0].metalness;
|
|
41911
|
-
lensMaterial.roughness = response.customisation[0].roughness;
|
|
41912
|
-
if (response.customisation[0].finish == "MIRBLKHMC") {
|
|
41913
|
-
lensMaterial.clearcoat = 1;
|
|
41914
|
-
lensMaterial.clearcoatRoughness = 0;
|
|
41915
|
-
} else if (response.customisation[0].finish == "HMCCR") {
|
|
41916
|
-
lensMaterial.clearcoat = 0;
|
|
41917
|
-
lensMaterial.clearcoatRoughness = 1;
|
|
41918
|
-
} else if (response.customisation[0].finish == "MIRSILHMC") {
|
|
41919
|
-
lensMaterial.clearcoat = 1;
|
|
41920
|
-
lensMaterial.clearcoatRoughness = 0;
|
|
41921
|
-
}
|
|
41922
|
-
}
|
|
41923
|
-
}
|
|
41924
41760
|
setupLensMaterial(selectedLens) {
|
|
41925
41761
|
if (lensMaterial) {
|
|
41926
41762
|
if (selectedLens.direction == "u") {
|
|
@@ -42095,8 +41931,8 @@ bool bvhIntersectFirstHit(
|
|
|
42095
41931
|
this.renderer.setRenderTarget(null);
|
|
42096
41932
|
this.renderer.setClearAlpha(initialClearAlpha);
|
|
42097
41933
|
this.scene.background = initialBackground;
|
|
42098
|
-
|
|
42099
|
-
|
|
41934
|
+
gemstoneMaterial.uniforms.viewMatrixInverse.value = this.camera.matrixWorld;
|
|
41935
|
+
gemstoneMaterial.uniforms.projectionMatrixInverse.value = this.camera.projectionMatrixInverse;
|
|
42100
41936
|
requestAnimationFrame(animate);
|
|
42101
41937
|
composer.render();
|
|
42102
41938
|
};
|
|
@@ -42114,54 +41950,32 @@ bool bvhIntersectFirstHit(
|
|
|
42114
41950
|
});
|
|
42115
41951
|
}
|
|
42116
41952
|
});
|
|
42117
|
-
|
|
42118
|
-
this.scene.add(Modelscene);
|
|
41953
|
+
this.scene.add(model);
|
|
42119
41954
|
}
|
|
42120
41955
|
}
|
|
42121
|
-
const { warn } = console;
|
|
42122
41956
|
class SDKServiceFactory {
|
|
42123
41957
|
constructor({
|
|
42124
41958
|
log: log2,
|
|
42125
41959
|
logErr: logErr2,
|
|
42126
41960
|
apiService,
|
|
42127
|
-
metaData
|
|
42128
|
-
config: config2
|
|
41961
|
+
metaData
|
|
42129
41962
|
}) {
|
|
42130
41963
|
__publicField(this, "log");
|
|
42131
41964
|
__publicField(this, "logErr");
|
|
42132
41965
|
__publicField(this, "metaData");
|
|
42133
|
-
__publicField(this, "loaderName");
|
|
42134
41966
|
__publicField(this, "apiKey");
|
|
42135
41967
|
__publicField(this, "scriptStreamEncoderId");
|
|
42136
|
-
__publicField(this, "rawNodeList");
|
|
42137
|
-
__publicField(this, "targetNodeList");
|
|
42138
|
-
__publicField(this, "status");
|
|
42139
41968
|
__publicField(this, "isLoaded");
|
|
42140
|
-
__publicField(this, "loadCount");
|
|
42141
|
-
__publicField(this, "mutationObserver");
|
|
42142
|
-
__publicField(this, "config");
|
|
42143
41969
|
__publicField(this, "apiService");
|
|
42144
|
-
this
|
|
41970
|
+
__publicField(this, "customRenderer");
|
|
42145
41971
|
this.apiService = apiService;
|
|
42146
41972
|
this.metaData = metaData;
|
|
42147
41973
|
this.apiKey = null;
|
|
42148
41974
|
this.scriptStreamEncoderId = `sprie-embed🔴${Date.now().toString()}`;
|
|
42149
|
-
this.rawNodeList = document.getElementsByClassName(
|
|
42150
|
-
this.metaData.targetClassName
|
|
42151
|
-
);
|
|
42152
|
-
this.targetNodeList = [];
|
|
42153
|
-
this.status = ESDKStatus.Init;
|
|
42154
41975
|
this.isLoaded = false;
|
|
42155
|
-
this.loadCount = 0;
|
|
42156
|
-
this.loaderName = "sprie-embed-loader";
|
|
42157
41976
|
this.log = log2.bind(this);
|
|
42158
41977
|
this.logErr = logErr2.bind(this);
|
|
42159
|
-
this.
|
|
42160
|
-
}
|
|
42161
|
-
loadMesage() {
|
|
42162
|
-
this.log(
|
|
42163
|
-
`🚀 Loaded SprieEmbed @${this.metaData.appVersion} (${this.config.host.replace(/^https?:\/\//, "").replace(/\/$/, "").replace(".sprie.io", "@sprie")})`
|
|
42164
|
-
);
|
|
41978
|
+
this.customRenderer = new CustomRenderer(apiService);
|
|
42165
41979
|
}
|
|
42166
41980
|
/**
|
|
42167
41981
|
* Scans the current script tag for api key and sets it to this.apiKey
|
|
@@ -42183,63 +41997,11 @@ bool bvhIntersectFirstHit(
|
|
|
42183
41997
|
}
|
|
42184
41998
|
}
|
|
42185
41999
|
/**
|
|
42186
|
-
*
|
|
42187
|
-
*/
|
|
42188
|
-
prepareTargetNodeList() {
|
|
42189
|
-
this.status = ESDKStatus.Preparing;
|
|
42190
|
-
if (!this.apiService.isAuthenticated || !this.apiKey || this.apiService.fetcher.IsConfigExpired()) {
|
|
42191
|
-
throw new Error("Sprie not authenticated");
|
|
42192
|
-
}
|
|
42193
|
-
for (let i = 0; i < this.rawNodeList.length; i += 1) {
|
|
42194
|
-
const targetRawElement = this.rawNodeList[i];
|
|
42195
|
-
const sku = targetRawElement.getAttribute("data-sprie-sku") || targetRawElement.getAttribute("data-sku");
|
|
42196
|
-
const barcode = targetRawElement.getAttribute("data-sprie-barcode");
|
|
42197
|
-
const customClass = targetRawElement.getAttribute("data-class") || "";
|
|
42198
|
-
const styleElement = targetRawElement;
|
|
42199
|
-
styleElement.style.position = "relative";
|
|
42200
|
-
styleElement.style.height = "max-content";
|
|
42201
|
-
const nodeElement = {
|
|
42202
|
-
id: `sprie-embed-${this.apiService.fetcher.config.ORGID}-${barcode || sku}-${Math.ceil(
|
|
42203
|
-
Math.random() * 1e5
|
|
42204
|
-
)}`,
|
|
42205
|
-
htmlNode: targetRawElement,
|
|
42206
|
-
sku,
|
|
42207
|
-
barcode,
|
|
42208
|
-
status: "loading",
|
|
42209
|
-
customClass,
|
|
42210
|
-
customOptions: targetRawElement.getAttribute("data-model-options") || ""
|
|
42211
|
-
};
|
|
42212
|
-
this.targetNodeList.push(nodeElement);
|
|
42213
|
-
}
|
|
42214
|
-
}
|
|
42215
|
-
async loadBySku(sku, classSelector) {
|
|
42216
|
-
if (!sku) {
|
|
42217
|
-
throw new Error("SKU is required");
|
|
42218
|
-
}
|
|
42219
|
-
const loadBySkuSelector = classSelector ? `.${classSelector}` : `.${this.metaData.targetClassName}`;
|
|
42220
|
-
const targetElement = document.querySelector(loadBySkuSelector);
|
|
42221
|
-
if (!targetElement) {
|
|
42222
|
-
throw new Error("Target element not found");
|
|
42223
|
-
}
|
|
42224
|
-
targetElement.setAttribute("data-sprie-sku", sku);
|
|
42225
|
-
await this.fetchData({
|
|
42226
|
-
id: `sprie-embed-${this.apiService.fetcher.config.ORGID}-${sku}-${Math.ceil(
|
|
42227
|
-
Math.random() * 1e5
|
|
42228
|
-
)}`,
|
|
42229
|
-
htmlNode: targetElement,
|
|
42230
|
-
status: "loading",
|
|
42231
|
-
barcode: null,
|
|
42232
|
-
customClass: "",
|
|
42233
|
-
sku
|
|
42234
|
-
});
|
|
42235
|
-
}
|
|
42236
|
-
/**
|
|
42237
|
-
* Authenticates with Spire Server with apikey.
|
|
42000
|
+
* Authenticates with Sprie Server with apikey.
|
|
42238
42001
|
* @returns {void}
|
|
42239
42002
|
*/
|
|
42240
42003
|
async authenticate() {
|
|
42241
42004
|
EventService.AuthLoading({ isLoading: true });
|
|
42242
|
-
this.status = ESDKStatus.Authenticating;
|
|
42243
42005
|
if (this.apiService.isAuthenticated)
|
|
42244
42006
|
return;
|
|
42245
42007
|
if (!this.apiKey) {
|
|
@@ -42258,240 +42020,6 @@ bool bvhIntersectFirstHit(
|
|
|
42258
42020
|
EventService.AuthLoading({ isLoading: false });
|
|
42259
42021
|
EventService.AuthDone();
|
|
42260
42022
|
}
|
|
42261
|
-
async fetchData(elemen) {
|
|
42262
|
-
const newElement = { ...elemen };
|
|
42263
|
-
if (!elemen.barcode && !elemen.sku) {
|
|
42264
|
-
warn(`Pass either "data-sprie-barcode" or "data-spri-sku". Received neither for ${elemen.htmlNode.tagName}`);
|
|
42265
|
-
return null;
|
|
42266
|
-
}
|
|
42267
|
-
try {
|
|
42268
|
-
const assetResult = await this.apiService.FetchAssetBySKUOrBarcode({
|
|
42269
|
-
barcode: elemen.barcode,
|
|
42270
|
-
sku: elemen.sku
|
|
42271
|
-
});
|
|
42272
|
-
if (assetResult && this.apiService.fetcher.config.ORGID) {
|
|
42273
|
-
newElement.status = "loaded";
|
|
42274
|
-
newElement.title = assetResult.name;
|
|
42275
|
-
const modelAsset = await this.apiService.DownloadMA({
|
|
42276
|
-
orgId: this.apiService.fetcher.config.ORGID,
|
|
42277
|
-
assetsId: assetResult._id
|
|
42278
|
-
});
|
|
42279
|
-
const customRenderer2 = new CustomRenderer(this.apiService);
|
|
42280
|
-
if (modelAsset) {
|
|
42281
|
-
customRenderer2.renderModel(modelAsset.asset.cloudfrontUrl, false, modelAsset.decryptionKey);
|
|
42282
|
-
customRenderer2.setupDropdownAndListeners(assetResult);
|
|
42283
|
-
customRenderer2.setupLensDefault(assetResult);
|
|
42284
|
-
const list = await this.apiService.FetchCustomisationList();
|
|
42285
|
-
customRenderer2.setupLensDropdownAndListeners(list);
|
|
42286
|
-
}
|
|
42287
|
-
}
|
|
42288
|
-
if (assetResult == null ? void 0 : assetResult._id) {
|
|
42289
|
-
this.apiService.HandleAssetUsage(assetResult._id);
|
|
42290
|
-
}
|
|
42291
|
-
} catch (err2) {
|
|
42292
|
-
warn("Error fetching or downloading asset:", err2);
|
|
42293
|
-
}
|
|
42294
|
-
return newElement;
|
|
42295
|
-
}
|
|
42296
|
-
/**
|
|
42297
|
-
* Fetches all asset data from targetNodeList and updates it.
|
|
42298
|
-
*/
|
|
42299
|
-
async fetchAllData() {
|
|
42300
|
-
this.status = ESDKStatus.Fetching;
|
|
42301
|
-
EventService.FetchingData();
|
|
42302
|
-
this.targetNodeList = await Promise.all(this.targetNodeList.map((x2) => x2 ? this.fetchData(x2) : null));
|
|
42303
|
-
}
|
|
42304
|
-
/**
|
|
42305
|
-
* Add event listener for all the data nodes data-sku change event.
|
|
42306
|
-
*/
|
|
42307
|
-
addTargetNodeChangeListener() {
|
|
42308
|
-
var _a;
|
|
42309
|
-
if (!this.apiService.isAuthenticated || !this.apiKey || this.apiService.fetcher.IsConfigExpired()) {
|
|
42310
|
-
throw new Error("Sprie not authenticated");
|
|
42311
|
-
}
|
|
42312
|
-
const org = this.apiService.fetcher.config.ORGID;
|
|
42313
|
-
const callback = async (mutationList) => {
|
|
42314
|
-
mutationList.forEach(async (mutationRecord) => {
|
|
42315
|
-
if (mutationRecord.type === "attributes" && (mutationRecord.attributeName === "data-sku" || mutationRecord.attributeName === "data-sprie-sku" || mutationRecord.attributeName === "data-sprie-barcode")) {
|
|
42316
|
-
const changedNodeItem = this.targetNodeList.find((item) => (item == null ? void 0 : item.htmlNode) === mutationRecord.target);
|
|
42317
|
-
const htmlTargetDataset = mutationRecord.target.dataset;
|
|
42318
|
-
const changedSku = htmlTargetDataset.sprieSku || htmlTargetDataset.sprieBarcode || htmlTargetDataset.sku;
|
|
42319
|
-
if (changedNodeItem) {
|
|
42320
|
-
changedNodeItem.id = `sprie-embed-${org}-${changedSku}-${Math.ceil(
|
|
42321
|
-
Math.random() * 1e5
|
|
42322
|
-
)}`;
|
|
42323
|
-
if (htmlTargetDataset.sprieSku || htmlTargetDataset.sku) {
|
|
42324
|
-
changedNodeItem.sku = changedSku || "";
|
|
42325
|
-
}
|
|
42326
|
-
if (htmlTargetDataset.sprieBarcode) {
|
|
42327
|
-
changedNodeItem.barcode = changedSku || "";
|
|
42328
|
-
}
|
|
42329
|
-
const changedSKUData = await this.fetchData(changedNodeItem);
|
|
42330
|
-
const iframeElement = changedNodeItem.htmlNode.querySelector("iframe");
|
|
42331
|
-
if (iframeElement && changedSKUData) {
|
|
42332
|
-
const url = changedSKUData.content + this.metaData.previewUrlPrams + changedSKUData.customOptions || "";
|
|
42333
|
-
iframeElement.setAttribute("src", url);
|
|
42334
|
-
}
|
|
42335
|
-
}
|
|
42336
|
-
}
|
|
42337
|
-
});
|
|
42338
|
-
};
|
|
42339
|
-
this.mutationObserver = new MutationObserver(callback);
|
|
42340
|
-
for (let i = 0; i < this.targetNodeList.length; i += 1) {
|
|
42341
|
-
const targetNode = (_a = this.targetNodeList[i]) == null ? void 0 : _a.htmlNode;
|
|
42342
|
-
if (targetNode) {
|
|
42343
|
-
this.mutationObserver.observe(targetNode, {
|
|
42344
|
-
attributes: true,
|
|
42345
|
-
attributeOldValue: true
|
|
42346
|
-
// presever old value.
|
|
42347
|
-
});
|
|
42348
|
-
}
|
|
42349
|
-
}
|
|
42350
|
-
}
|
|
42351
|
-
/**
|
|
42352
|
-
* Mounts new iframe with targetElementNode data
|
|
42353
|
-
*/
|
|
42354
|
-
// mountElement() {
|
|
42355
|
-
// this.status = ESDKStatus.Loading;
|
|
42356
|
-
// this.targetNodeList.map(async (elemen) => {
|
|
42357
|
-
// if (!elemen?.content) {
|
|
42358
|
-
// return;
|
|
42359
|
-
// }
|
|
42360
|
-
// const nodeElement: IEmbedTargetNode = elemen;
|
|
42361
|
-
// const targetContainer: Element = document.createElement('iframe');
|
|
42362
|
-
// targetContainer.id = nodeElement.id;
|
|
42363
|
-
// const targetContent = nodeElement.content
|
|
42364
|
-
// + this.metaData.previewUrlPrams
|
|
42365
|
-
// + nodeElement.customOptions || '';
|
|
42366
|
-
// targetContainer.setAttribute('title', nodeElement.title || '');
|
|
42367
|
-
// targetContainer.setAttribute('frameborder', '0');
|
|
42368
|
-
// targetContainer.setAttribute('marginheight', '0');
|
|
42369
|
-
// targetContainer.setAttribute('marginwidth', '0');
|
|
42370
|
-
// targetContainer.setAttribute('marginheight', '0');
|
|
42371
|
-
// if (nodeElement.customClass) {
|
|
42372
|
-
// targetContainer.classList.add(nodeElement.customClass);
|
|
42373
|
-
// }
|
|
42374
|
-
// targetContainer.setAttribute('src', targetContent);
|
|
42375
|
-
// nodeElement.htmlNode.appendChild(targetContainer);
|
|
42376
|
-
// this.loadCount += 1;
|
|
42377
|
-
// });
|
|
42378
|
-
// EventService.EmbedLoaded();
|
|
42379
|
-
// }
|
|
42380
|
-
mountElement() {
|
|
42381
|
-
this.status = ESDKStatus.Loading;
|
|
42382
|
-
this.targetNodeList.map(async (elemen) => {
|
|
42383
|
-
if (!(elemen == null ? void 0 : elemen.content)) {
|
|
42384
|
-
return;
|
|
42385
|
-
}
|
|
42386
|
-
const nodeElement = elemen;
|
|
42387
|
-
const targetContainer = document.createElement("iframe");
|
|
42388
|
-
targetContainer.id = nodeElement.id;
|
|
42389
|
-
const targetContent = nodeElement.content + this.metaData.previewUrlPrams + nodeElement.customOptions || "";
|
|
42390
|
-
targetContainer.setAttribute("title", nodeElement.title || "");
|
|
42391
|
-
targetContainer.setAttribute("frameborder", "0");
|
|
42392
|
-
targetContainer.setAttribute("marginheight", "0");
|
|
42393
|
-
targetContainer.setAttribute("marginwidth", "0");
|
|
42394
|
-
targetContainer.setAttribute("marginheight", "0");
|
|
42395
|
-
if (nodeElement.customClass) {
|
|
42396
|
-
targetContainer.classList.add(nodeElement.customClass);
|
|
42397
|
-
}
|
|
42398
|
-
targetContainer.setAttribute("src", targetContent);
|
|
42399
|
-
nodeElement.htmlNode.appendChild(targetContainer);
|
|
42400
|
-
this.loadCount += 1;
|
|
42401
|
-
});
|
|
42402
|
-
EventService.EmbedLoaded();
|
|
42403
|
-
}
|
|
42404
|
-
Unmount() {
|
|
42405
|
-
if (this.targetNodeList.length === 0) {
|
|
42406
|
-
this.logErr("No targetNode found! Nothing to Unmount.");
|
|
42407
|
-
}
|
|
42408
|
-
this.targetNodeList.forEach((elem) => {
|
|
42409
|
-
if (elem && elem.htmlNode) {
|
|
42410
|
-
const eh = elem.htmlNode;
|
|
42411
|
-
eh.textContent = "";
|
|
42412
|
-
}
|
|
42413
|
-
});
|
|
42414
|
-
this.isLoaded = false;
|
|
42415
|
-
this.targetNodeList = [];
|
|
42416
|
-
if (this.mutationObserver) {
|
|
42417
|
-
this.mutationObserver.disconnect();
|
|
42418
|
-
}
|
|
42419
|
-
}
|
|
42420
|
-
showLoader() {
|
|
42421
|
-
this.targetNodeList.map(async (elemen) => {
|
|
42422
|
-
if (!(elemen == null ? void 0 : elemen.content)) {
|
|
42423
|
-
return;
|
|
42424
|
-
}
|
|
42425
|
-
const nodeElement = elemen;
|
|
42426
|
-
const divContainer = document.createElement("div");
|
|
42427
|
-
divContainer.setAttribute("class", this.loaderName);
|
|
42428
|
-
divContainer.style.position = "absolute";
|
|
42429
|
-
divContainer.style.boxSizing = "border-box";
|
|
42430
|
-
divContainer.style.width = "100%";
|
|
42431
|
-
divContainer.style.display = "flex";
|
|
42432
|
-
divContainer.style.height = "100%";
|
|
42433
|
-
divContainer.style.backgroundColor = "#00000032";
|
|
42434
|
-
divContainer.style.zIndex = "9998";
|
|
42435
|
-
divContainer.style.justifyContent = "center";
|
|
42436
|
-
divContainer.style.accentColor = "center";
|
|
42437
|
-
divContainer.style.left = "0";
|
|
42438
|
-
divContainer.style.top = "0";
|
|
42439
|
-
divContainer.style.backdropFilter = "blur(6px)";
|
|
42440
|
-
const div = document.createElement("div");
|
|
42441
|
-
div.style.position = "relative";
|
|
42442
|
-
div.style.left = "-9999px";
|
|
42443
|
-
div.style.top = "45%";
|
|
42444
|
-
div.style.zIndex = "9999";
|
|
42445
|
-
div.style.height = "15px";
|
|
42446
|
-
div.style.width = "15px";
|
|
42447
|
-
div.style.color = "white";
|
|
42448
|
-
div.style.boxShadow = "9974px 0 0 0 #303045, 9999px 0 0 0 #303045, 10024px 0 0 0 #303045";
|
|
42449
|
-
div.style.borderRadius = "8px";
|
|
42450
|
-
div.style.animation = " dotTyping 1s infinite linear";
|
|
42451
|
-
div.animate(
|
|
42452
|
-
[
|
|
42453
|
-
{
|
|
42454
|
-
boxShadow: "9974px 0 0 0 #303045, 9999px 0 0 0 #303045, 10024px 0 0 0 #303045"
|
|
42455
|
-
},
|
|
42456
|
-
{
|
|
42457
|
-
boxShadow: "9974px -10px 0 0 #303045, 9999px 0 0 0 #303045, 10024px 0 0 0 #303045"
|
|
42458
|
-
},
|
|
42459
|
-
{
|
|
42460
|
-
boxShadow: "9974px 0 0 0 #303045, 9999px 0 0 0 #303045, 10024px 0 0 0 #303045"
|
|
42461
|
-
},
|
|
42462
|
-
{
|
|
42463
|
-
boxShadow: "9974px 0 0 0 #303045, 9999px -10px 0 0 #303045, 10024px 0 0 0 #303045"
|
|
42464
|
-
},
|
|
42465
|
-
{
|
|
42466
|
-
boxShadow: "9974px 0 0 0 #303045, 9999px 0 0 0 #303045, 10024px 0 0 0 #303045"
|
|
42467
|
-
},
|
|
42468
|
-
{
|
|
42469
|
-
boxShadow: "9974px 0 0 0 #303045, 9999px 0 0 0 #303045, 10024px -10px 0 0 #303045"
|
|
42470
|
-
},
|
|
42471
|
-
{
|
|
42472
|
-
boxShadow: "9974px 0 0 0 #303045, 9999px 0 0 0 #303045, 10024px 0 0 0 #303045"
|
|
42473
|
-
}
|
|
42474
|
-
],
|
|
42475
|
-
{
|
|
42476
|
-
duration: 1e3,
|
|
42477
|
-
iterations: Infinity
|
|
42478
|
-
}
|
|
42479
|
-
);
|
|
42480
|
-
divContainer.appendChild(div);
|
|
42481
|
-
nodeElement == null ? void 0 : nodeElement.htmlNode.appendChild(divContainer);
|
|
42482
|
-
});
|
|
42483
|
-
}
|
|
42484
|
-
hideLoader() {
|
|
42485
|
-
const elms = document.querySelectorAll(`[class='${this.loaderName}']`);
|
|
42486
|
-
let counter = 0;
|
|
42487
|
-
while (counter <= elms.length) {
|
|
42488
|
-
const elem = elms[counter];
|
|
42489
|
-
if (elem) {
|
|
42490
|
-
elms[counter].style.display = "none";
|
|
42491
|
-
}
|
|
42492
|
-
counter += 1;
|
|
42493
|
-
}
|
|
42494
|
-
}
|
|
42495
42023
|
/**
|
|
42496
42024
|
* Main entry point for SprieEmbed
|
|
42497
42025
|
* @returns {boolean} true if success, false if error
|
|
@@ -42500,18 +42028,7 @@ bool bvhIntersectFirstHit(
|
|
|
42500
42028
|
try {
|
|
42501
42029
|
this.scanApiKeyFromCurrentScriptTag();
|
|
42502
42030
|
await this.authenticate();
|
|
42503
|
-
this.prepareTargetNodeList();
|
|
42504
|
-
this.addTargetNodeChangeListener();
|
|
42505
|
-
await this.fetchAllData();
|
|
42506
|
-
this.showLoader();
|
|
42507
|
-
await this.mountElement();
|
|
42508
|
-
this.status = ESDKStatus.Done;
|
|
42509
42031
|
this.isLoaded = true;
|
|
42510
|
-
if (this.isLoaded) {
|
|
42511
|
-
setTimeout(() => {
|
|
42512
|
-
this.hideLoader();
|
|
42513
|
-
}, 1800);
|
|
42514
|
-
}
|
|
42515
42032
|
return true;
|
|
42516
42033
|
} catch (e) {
|
|
42517
42034
|
this.log("SprieEmbed Loading failed.");
|
|
@@ -42855,8 +42372,6 @@ bool bvhIntersectFirstHit(
|
|
|
42855
42372
|
}
|
|
42856
42373
|
var jsxRuntimeExports = jsxRuntime.exports;
|
|
42857
42374
|
const App$1 = "";
|
|
42858
|
-
const Button = "";
|
|
42859
|
-
const Panel = "";
|
|
42860
42375
|
const MainContainer$1 = "";
|
|
42861
42376
|
const FrameDropdown$1 = "";
|
|
42862
42377
|
const dropdownIcon = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTE5IDlMMTIuNzgwOSAxNC4zMzA2QzEyLjMzMTYgMTQuNzE1OCAxMS42Njg0IDE0LjcxNTggMTEuMjE5MSAxNC4zMzA2TDUgOSIgc3Ryb2tlPSIjNEQ0RDREIiBzdHJva2Utd2lkdGg9IjEuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIi8+Cjwvc3ZnPgo=";
|
|
@@ -43079,34 +42594,29 @@ bool bvhIntersectFirstHit(
|
|
|
43079
42594
|
async function changeCustomRenderer({
|
|
43080
42595
|
orgId,
|
|
43081
42596
|
apiService,
|
|
42597
|
+
sdkService,
|
|
43082
42598
|
frameList,
|
|
43083
42599
|
setLoading
|
|
43084
42600
|
}) {
|
|
43085
|
-
customRenderer =
|
|
43086
|
-
customRenderer.
|
|
43087
|
-
|
|
42601
|
+
customRenderer = sdkService.customRenderer;
|
|
42602
|
+
if (!customRenderer.isInitialised) {
|
|
42603
|
+
customRenderer.intialize();
|
|
42604
|
+
customRenderer.setupAndRenderScene();
|
|
42605
|
+
}
|
|
43088
42606
|
setLoading(true);
|
|
43089
42607
|
const frame = frameList[0];
|
|
43090
|
-
|
|
43091
|
-
|
|
43092
|
-
|
|
43093
|
-
|
|
43094
|
-
hasSpecialDefaultLens = frame.customisation.length == 0;
|
|
43095
|
-
const includedLens = hasSpecialDefaultLens ? null : frame.customisation.find((x2) => x2.type == "Lens");
|
|
43096
|
-
customRenderer.renderModel(apiRes.asset.cloudfrontUrl, hasSpecialDefaultLens, apiRes.decryptionKey).then(() => {
|
|
43097
|
-
if (includedLens) {
|
|
43098
|
-
customRenderer.setupLensMaterial(
|
|
43099
|
-
includedLens
|
|
43100
|
-
);
|
|
42608
|
+
customRenderer.loadFirstFrame(orgId, frame).then(
|
|
42609
|
+
() => {
|
|
42610
|
+
currentFrame = frame;
|
|
42611
|
+
setLoading(false);
|
|
43101
42612
|
}
|
|
43102
|
-
|
|
43103
|
-
setLoading(false);
|
|
43104
|
-
});
|
|
42613
|
+
);
|
|
43105
42614
|
}
|
|
43106
42615
|
function MainContainer({
|
|
43107
|
-
|
|
42616
|
+
frameName,
|
|
43108
42617
|
customEvent,
|
|
43109
42618
|
apiService,
|
|
42619
|
+
sdkService,
|
|
43110
42620
|
frameList,
|
|
43111
42621
|
lensList,
|
|
43112
42622
|
viewerOnly
|
|
@@ -43123,25 +42633,7 @@ bool bvhIntersectFirstHit(
|
|
|
43123
42633
|
(async () => {
|
|
43124
42634
|
if (selectedLens) {
|
|
43125
42635
|
setModelLoading(true);
|
|
43126
|
-
|
|
43127
|
-
orgId,
|
|
43128
|
-
assetsId: frame._id
|
|
43129
|
-
});
|
|
43130
|
-
hasSpecialDefaultLens = frame.customisation.length == 0;
|
|
43131
|
-
const includedLens = hasSpecialDefaultLens ? null : frame.customisation.find((x2) => x2.type == "Lens");
|
|
43132
|
-
const renderAsIs = hasSpecialDefaultLens && selectedLens.sku == "lens-default";
|
|
43133
|
-
customRenderer.renderModel(apiRes.asset.cloudfrontUrl, renderAsIs, apiRes.decryptionKey).then(async () => {
|
|
43134
|
-
if (selectedLens.sku == "lens-default") {
|
|
43135
|
-
if (includedLens) {
|
|
43136
|
-
customRenderer.setupLensMaterial(
|
|
43137
|
-
includedLens
|
|
43138
|
-
);
|
|
43139
|
-
}
|
|
43140
|
-
} else {
|
|
43141
|
-
customRenderer.setupLensMaterial(
|
|
43142
|
-
selectedLens
|
|
43143
|
-
);
|
|
43144
|
-
}
|
|
42636
|
+
await customRenderer.changeFrame(orgId, frame, selectedLens).then(() => {
|
|
43145
42637
|
currentFrame = frame;
|
|
43146
42638
|
setModelLoading(false);
|
|
43147
42639
|
});
|
|
@@ -43197,6 +42689,7 @@ bool bvhIntersectFirstHit(
|
|
|
43197
42689
|
if (apiService && frameList && orgId) {
|
|
43198
42690
|
changeCustomRenderer({
|
|
43199
42691
|
apiService,
|
|
42692
|
+
sdkService,
|
|
43200
42693
|
frameList,
|
|
43201
42694
|
orgId,
|
|
43202
42695
|
setLoading: setModelLoading
|
|
@@ -43210,7 +42703,7 @@ bool bvhIntersectFirstHit(
|
|
|
43210
42703
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { id: "Sprie-config-Main-Container", children: [
|
|
43211
42704
|
!viewerOnly && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "Sprie-config-Checkout-Container", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { id: "Sprie-config-Checkout-box", children: [
|
|
43212
42705
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { id: "Sprie-config-Checkout-header", children: [
|
|
43213
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "Sprie-config-frameName", children:
|
|
42706
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "Sprie-config-frameName", children: frameName }),
|
|
43214
42707
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "Sprie-config-lensPrice", children: `${(selectedLens == null ? void 0 : selectedLens.price) ? `+ $${selectedLens == null ? void 0 : selectedLens.price}.00 USD` : ""}` })
|
|
43215
42708
|
] }),
|
|
43216
42709
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { id: "Sprie-config-Checkout-body", children: [
|
|
@@ -43303,11 +42796,11 @@ bool bvhIntersectFirstHit(
|
|
|
43303
42796
|
] })
|
|
43304
42797
|
] });
|
|
43305
42798
|
}
|
|
43306
|
-
function App({ apiService, sku, events: events2, viewerOnly = false }) {
|
|
42799
|
+
function App({ apiService, sdkService, sku, events: events2, viewerOnly = false }) {
|
|
43307
42800
|
const [settings, setSettings] = reactExports.useState(null);
|
|
43308
42801
|
const frameList = (settings == null ? void 0 : settings.frameList) || null;
|
|
43309
42802
|
const lensList = (settings == null ? void 0 : settings.lensList) || null;
|
|
43310
|
-
const
|
|
42803
|
+
const frameName = (settings == null ? void 0 : settings.frameName) || "";
|
|
43311
42804
|
reactExports.useEffect(() => {
|
|
43312
42805
|
(async () => {
|
|
43313
42806
|
const apiRes = await apiService.FetchAssetBySKUOrBarcode({
|
|
@@ -43318,7 +42811,7 @@ bool bvhIntersectFirstHit(
|
|
|
43318
42811
|
setSettings({
|
|
43319
42812
|
frameList: apiRes == null ? void 0 : apiRes.variants,
|
|
43320
42813
|
lensList: lensApiRes == null ? void 0 : lensApiRes.data,
|
|
43321
|
-
|
|
42814
|
+
frameName: apiRes == null ? void 0 : apiRes.group.name
|
|
43322
42815
|
});
|
|
43323
42816
|
})();
|
|
43324
42817
|
}, [apiService, sku]);
|
|
@@ -43328,8 +42821,9 @@ bool bvhIntersectFirstHit(
|
|
|
43328
42821
|
MainContainer,
|
|
43329
42822
|
{
|
|
43330
42823
|
customEvent: events2,
|
|
43331
|
-
|
|
42824
|
+
frameName,
|
|
43332
42825
|
apiService,
|
|
42826
|
+
sdkService,
|
|
43333
42827
|
frameList,
|
|
43334
42828
|
lensList,
|
|
43335
42829
|
viewerOnly
|
|
@@ -50583,13 +50077,16 @@ bool bvhIntersectFirstHit(
|
|
|
50583
50077
|
class UIService {
|
|
50584
50078
|
constructor({
|
|
50585
50079
|
apiService,
|
|
50080
|
+
sdkService,
|
|
50586
50081
|
events: events2
|
|
50587
50082
|
}) {
|
|
50588
50083
|
__publicField(this, "targetElement");
|
|
50589
50084
|
__publicField(this, "apiService");
|
|
50085
|
+
__publicField(this, "sdkService");
|
|
50590
50086
|
__publicField(this, "events");
|
|
50591
50087
|
__publicField(this, "htmlTarget");
|
|
50592
50088
|
this.apiService = apiService;
|
|
50089
|
+
this.sdkService = sdkService;
|
|
50593
50090
|
this.events = events2;
|
|
50594
50091
|
}
|
|
50595
50092
|
mount(sku, options) {
|
|
@@ -50605,6 +50102,7 @@ bool bvhIntersectFirstHit(
|
|
|
50605
50102
|
}
|
|
50606
50103
|
this.targetElement.render(React.createElement(App, {
|
|
50607
50104
|
apiService: this.apiService,
|
|
50105
|
+
sdkService: this.sdkService,
|
|
50608
50106
|
events: this.events,
|
|
50609
50107
|
sku,
|
|
50610
50108
|
viewerOnly: options.viewerOnly
|
|
@@ -51004,7 +50502,6 @@ bool bvhIntersectFirstHit(
|
|
|
51004
50502
|
const logErr = (...data) => {
|
|
51005
50503
|
error("❌ Sprie Error:", ...data);
|
|
51006
50504
|
};
|
|
51007
|
-
const previewUrlPrams = "&ui_animations=0&ui_infos=0&ui_stop=0&ui_inspector=0&ui_watermark_link=0&ui_watermark=0&ui_ar=0&ui_help=0&ui_settings=0&ui_vr=0&ui_fullscreen=0&ui_annotations=0&ui_start=0&";
|
|
51008
50505
|
const fetcherConfig = {
|
|
51009
50506
|
HOST: config.host,
|
|
51010
50507
|
STORE_PREFIX: config.storePrefix
|
|
@@ -51017,23 +50514,21 @@ bool bvhIntersectFirstHit(
|
|
|
51017
50514
|
__publicField(this, "events");
|
|
51018
50515
|
this.events = new CustomEventEmitter();
|
|
51019
50516
|
this.apiService = new APIServiceFactory(new FetcherServiceFactory(fetcherConfig));
|
|
51020
|
-
this.uiService = new UIService({
|
|
51021
|
-
apiService: this.apiService,
|
|
51022
|
-
events: this.events
|
|
51023
|
-
});
|
|
51024
50517
|
const sdkProps = {
|
|
51025
50518
|
apiService: this.apiService,
|
|
51026
|
-
config,
|
|
51027
50519
|
log,
|
|
51028
50520
|
logErr,
|
|
51029
50521
|
metaData: {
|
|
51030
|
-
appVersion: version$1
|
|
51031
|
-
previewUrlPrams,
|
|
51032
|
-
targetClassName: "sprie-embed-element"
|
|
50522
|
+
appVersion: version$1
|
|
51033
50523
|
}
|
|
51034
50524
|
};
|
|
51035
50525
|
this.sdkService = new SDKServiceFactory(sdkProps);
|
|
51036
50526
|
this.sdkService.Init();
|
|
50527
|
+
this.uiService = new UIService({
|
|
50528
|
+
apiService: this.apiService,
|
|
50529
|
+
sdkService: this.sdkService,
|
|
50530
|
+
events: this.events
|
|
50531
|
+
});
|
|
51037
50532
|
}
|
|
51038
50533
|
load(sku, customId) {
|
|
51039
50534
|
this.uiService.unmount();
|