@r2u/javascript-ar-sdk 6.23.1 → 6.23.2

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/ar.bundle.js CHANGED
@@ -1,5 +1,24 @@
1
1
  /*! For license information please see ar.bundle.js.LICENSE.txt */
2
- "use strict";(self.webpackChunkR2U=self.webpackChunkR2U||[]).push([[850],{6504:function(e,t,n){n.d(t,{f2:function(){return d}});var o=n(8665),r=n(1580),a=n(5538),i=n(660),l=n(2297),s=n(2367),c=function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{s(o.next(e))}catch(e){a(e)}}function l(e){try{s(o.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,l)}s((o=o.apply(e,t||[])).next())}))};const d=o.Z.createInstance();t.ZP={init:({language:e})=>c(void 0,void 0,void 0,(function*(){const t=s.Z.customer.language,n=(s.Z.customer.slug,e||t||"en"),o=(0,l.Bv)(),c=["translation"];return new Promise(((e,t)=>{d.use(r.Z).init({debug:!1,react:{useSuspense:!1},lng:n,fallbackLng:!1,supportedLngs:["pt","en","es"],ns:c,defaultNS:"translation",fallbackNS:"translation",load:"currentOnly",preload:[n],interpolation:{escapeValue:!1},backend:{backends:[i.Z,a.Z],backendOptions:[{prefix:"i18next_res_r2u_sdk_",enabled:!0,expirationTime:6048e5},{loadPath:`${o}/locales/{{lng}}/{{ns}}.json`,allowMultiloading:!0}]}},(n=>{n&&t(new Error("R2U - Translation init failed")),e()}))}))}))}},9408:function(e,t,n){n.r(t),n.d(t,{default:function(){return Pe}});var o=n(7294),r=n(3935),a=n(5865),i=n(2367);function l(e){const t=`r2u-webxr-seen-${e}`;return Boolean(JSON.parse(localStorage.getItem(t)||"false"))}function s(e){const t=`r2u-webxr-seen-${e}`;localStorage.setItem(t,JSON.stringify(!0))}function c(e){const t=`r2u-ar-opened-${e}`;return Boolean(JSON.parse(localStorage.getItem(t)||"false"))}function d(e){const t=`r2u-ar-opened-${e}`;localStorage.setItem(t,JSON.stringify(!0))}var m=n(7523),p=n(7374),u=n(2297),f=n(6339),h=n(6504);const g=(0,o.createContext)({}),b=({children:e,openerElement:t,openerEvent:n,onClose:r=(()=>{})})=>{const[a,i]=(0,o.useState)(!1),l=()=>{i(!0)};return t&&n&&t.addEventListener(n,l),o.createElement(g.Provider,{value:{isOpen:a,openModal:l,closeModal:()=>{r(),i(!1)},toggleModal:()=>{i(!a)}}},o.createElement(f.a,{i18n:h.f2},a?e:null))};var v=n(6793),x=n(1841),w=n.n(x),E=n(9163);const y=E.default.div`
2
+ "use strict";(self.webpackChunkR2U=self.webpackChunkR2U||[]).push([[850],{3026:function(e,t,n){n.d(t,{Ao:function(){return r},mn:function(){return a},L7:function(){return i},Ov:function(){return l},H_:function(){return s},cu:function(){return c},yY:function(){return d}});var o=n(7294);const r=e=>o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e),o.createElement("line",{x1:"19",y1:"12",x2:"5",y2:"12"}),o.createElement("polyline",{points:"12 19 5 12 12 5"})),a=e=>o.createElement("svg",Object.assign({viewBox:"0 0 1024 1024",fill:"#8ec396"},e),o.createElement("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})),i=e=>o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",className:"icon",viewBox:"0 0 1024 1024",fill:"#fff"},e),o.createElement("path",{d:"M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 0 0-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 0 0 471 99.9c-52 0-98 35-111.8 85.1l-85.9 311h-.3v428h472.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM112 528v364c0 17.7 14.3 32 32 32h65V496h-65c-17.7 0-32 14.3-32 32z"})),l=e=>o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",className:"icon",viewBox:"0 0 1024 1024",fill:"#fff"},e),o.createElement("path",{d:"M885.9 490.3c3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-51.6-30.7-98.1-78.3-118.4a66.1 66.1 0 0 0-26.5-5.4H273v428h.3l85.8 310.8C372.9 889 418.9 924 470.9 924c29.7 0 57.4-11.8 77.9-33.4 20.5-21.5 31-49.7 29.5-79.4l-6-122.9h239.9c12.1 0 23.9-3.2 34.3-9.3 40.4-23.5 65.5-66.1 65.5-111 0-28.3-9.3-55.5-26.1-77.7zM112 132v364c0 17.7 14.3 32 32 32h65V100h-65c-17.7 0-32 14.3-32 32z"})),s=e=>o.createElement("svg",Object.assign({width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),o.createElement("path",{d:"M15.0002 37.4C15.0002 38.3167 15.7502 39.0667 16.6668 39.0667H23.3335C24.2502 39.0667 25.0002 38.3167 25.0002 37.4V35.7334H15.0002V37.4ZM20.0002 6.93335C13.5668 6.93335 8.3335 12.1667 8.3335 18.6C8.3335 22.5667 10.3168 26.05 13.3335 28.1667V31.9334C13.3335 32.85 14.0835 33.6 15.0002 33.6H25.0002C25.9168 33.6 26.6668 32.85 26.6668 31.9334V28.1667C29.6835 26.05 31.6668 22.5667 31.6668 18.6C31.6668 12.1667 26.4335 6.93335 20.0002 6.93335ZM24.7502 25.4334L23.3335 26.4334V30.2667H16.6668V26.4334L15.2502 25.4334C13.0002 23.8667 11.6668 21.3167 11.6668 18.6C11.6668 14 15.4002 10.2667 20.0002 10.2667C24.6002 10.2667 28.3335 14 28.3335 18.6C28.3335 21.3167 27.0002 23.8667 24.7502 25.4334Z",fill:"#AFAFAF"})),c=e=>o.createElement("svg",Object.assign({width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),o.createElement("path",{d:"M15.3716 37.26C15.3716 38.107 16.0659 38.8 16.9145 38.8H23.0859C23.9345 38.8 24.6288 38.107 24.6288 37.26V35.72H15.3716V37.26ZM20.0002 8C14.0448 8 9.2002 12.8356 9.2002 18.78C9.2002 22.4452 11.0362 25.6638 13.8288 27.6196V31.1C13.8288 31.947 14.5231 32.64 15.3716 32.64H24.6288C25.4773 32.64 26.1716 31.947 26.1716 31.1V27.6196C28.9642 25.6638 30.8002 22.4452 30.8002 18.78C30.8002 12.8356 25.9556 8 20.0002 8ZM24.3973 25.094L23.0859 26.018V29.56H16.9145V26.018L15.6031 25.094C13.5202 23.6464 12.2859 21.2902 12.2859 18.78C12.2859 14.5296 15.7419 11.08 20.0002 11.08C24.2585 11.08 27.7145 14.5296 27.7145 18.78C27.7145 21.2902 26.4802 23.6464 24.3973 25.094Z",fill:"#003E58"}),o.createElement("path",{d:"M34.0166 6.51666L31.6666 4.16666L28.6833 7.16666L31.0333 9.51666L34.0166 6.51666ZM21.5999 5L18.2666 5L18.2666 -5.134e-06L21.5999 -4.84259e-06L21.5999 5ZM38.2666 20L33.2666 20L33.2666 16.6667L38.2666 16.6667L38.2666 20ZM6.59993 20L1.59993 20L1.59993 16.6667L6.59993 16.6667L6.59993 20ZM11.1999 7.15L8.2166 4.14999L5.8666 6.49999L8.8666 9.48333L11.1999 7.15Z",fill:"#003E58"})),d=e=>o.createElement("svg",Object.assign({width:"137",height:"27",viewBox:"0 0 137 27",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.0906369 23.7492V27H137V23.7492H0.0906369ZM129.725 6.59205C133.546 6.59205 135.365 8.127 135.546 10.9262H132.089C131.907 9.66195 131.089 9.21038 129.724 9.21038C128.268 9.21038 127.543 9.66195 127.543 10.2938C127.543 11.3771 128.633 11.3771 131.728 12.1898C134.275 12.8216 135.822 13.9961 135.913 16.1629C135.731 19.5946 133.275 20.6779 129.909 20.6779C126.088 20.6779 123.905 19.0526 123.814 15.982H127.362C127.544 17.8781 128.997 17.9685 130.182 17.9685C131.366 17.9685 132.363 17.6074 132.363 16.7042C132.453 15.44 130.27 15.44 128.269 14.8082C126.361 14.3566 124.084 13.6343 124.175 11.0153C124.358 7.58498 127.178 6.59205 129.725 6.59205ZM115.988 6.59205C118.08 6.59205 121.628 6.95318 121.628 10.746V18.5119C121.645 18.7407 121.711 18.9633 121.821 19.1655C121.93 19.3676 122.081 19.5448 122.264 19.6857V20.2257H118.535C118.327 19.7064 118.205 19.1577 118.171 18.6003C117.681 19.2188 117.061 19.7249 116.355 20.0837C115.649 20.4425 114.873 20.6454 114.08 20.6786C111.714 20.6786 109.895 19.2341 109.895 16.7056C109.985 13.5452 111.803 12.823 114.807 12.281C116.263 12.1905 118.173 12.011 118.173 10.8365C118.173 9.39195 116.99 9.39195 115.899 9.3015C114.443 9.39195 113.807 9.8415 113.625 11.1976H110.259C110.53 7.94678 112.531 6.59205 115.988 6.59205ZM86.8771 6.59205C89.5152 6.59205 92.4264 7.4952 92.4264 10.3849V18.2412C92.3921 18.5138 92.4435 18.7902 92.5738 19.0327C92.7041 19.2752 92.9068 19.4719 93.1542 19.5959V20.1359H89.3332C89.2061 19.6313 89.115 19.1183 89.0606 18.601C88.5409 19.202 87.9004 19.6891 87.1799 20.0312C86.4594 20.3732 85.6749 20.5627 84.8763 20.5875C82.3289 20.4971 80.6913 19.2328 80.6913 16.6145C80.782 13.6343 82.5995 12.4605 86.7865 12.0994C87.8769 12.0089 88.8787 11.6478 88.8787 10.7447C88.8787 9.38993 87.6049 9.38993 86.6979 9.30015C84.9697 9.3906 84.7898 10.0224 84.5172 11.1962H81.0553C81.3285 7.94678 83.3294 6.59205 86.8771 6.59205ZM73.2312 6.5016C77.4161 6.5016 78.9624 8.57858 79.235 11.5587L75.5959 11.6492C75.3233 10.1142 74.4136 9.48173 73.3218 9.48173C70.8685 9.48173 70.5959 11.8294 70.5959 13.7261C70.5959 16.2547 71.4137 17.6992 73.2339 17.6992C74.8695 17.6087 75.2354 17.0674 75.5993 15.3515H79.1471C78.6919 18.5119 76.5997 20.5889 73.1433 20.5889C68.8677 20.4984 66.9575 17.9699 66.9575 13.7261C66.9547 8.9397 69.4108 6.59205 73.2319 6.5016H73.2312ZM42.2102 6.59205C45.576 6.59205 48.5779 8.21745 48.4873 14.4484H43.9844H39.4816C39.4816 16.5254 40.6639 17.7896 42.4835 17.7896C42.9893 17.8059 43.4879 17.6672 43.9112 17.3925C44.3345 17.1178 44.662 16.7205 44.8489 16.2547H48.3967C47.9421 18.6023 45.6708 20.5889 42.3928 20.5889C41.2105 20.5889 35.9338 20.2277 35.9338 13.6363C35.9338 8.48812 39.0263 6.59205 42.2109 6.59205H42.2102ZM6.09175 6.59205C8.72976 6.59205 11.7317 7.3143 11.7317 10.2944V18.2412C11.6973 18.5138 11.7488 18.7902 11.8791 19.0327C12.0093 19.2752 12.2121 19.4719 12.4595 19.5959V20.1359H8.64253C8.49995 19.6346 8.40862 19.1204 8.36994 18.601C7.85016 19.2021 7.20952 19.6893 6.48893 20.0313C5.76834 20.3734 4.98364 20.5628 4.18497 20.5875C1.72823 20.5875 0 19.2341 0 16.6151C0 12.7325 3.27519 12.3707 6.09516 12.1C7.27753 12.0096 8.2759 11.6485 8.2759 10.7453C8.2759 9.3906 7.00221 9.3906 6.09516 9.30083C4.36692 9.39128 4.18701 10.0231 3.82106 11.1969H0.454547C0.727821 7.2225 3.6391 6.59205 6.09516 6.59205H6.09175ZM102.976 6.59205C105.523 6.6825 107.524 7.58565 107.524 11.288V20.2277H103.98V12.1007C104.071 10.5658 103.526 9.48173 101.8 9.48173C99.6188 9.48173 99.0736 11.288 99.0736 13.0032V20.2257H95.5258V6.9525H98.9829V8.84858C99.3599 8.13204 99.9372 7.53819 100.646 7.13802C101.355 6.73786 102.165 6.54832 102.979 6.59205H102.976ZM29.6532 6.59205C33.1104 6.86205 34.0202 9.21105 33.8382 11.8294V20.2271H30.2932V11.7389C30.3094 11.4655 30.2701 11.1917 30.1777 10.9336C30.0852 10.6755 29.9414 10.4384 29.7548 10.2363C29.5682 10.0342 29.3425 9.87127 29.0912 9.75708C28.8399 9.64289 28.568 9.57978 28.2917 9.5715C26.4721 9.8415 26.1995 10.7453 26.0176 12.2803V20.2271H22.4698V12.281C22.5604 10.746 22.1059 9.57218 20.5616 9.57218C18.3441 9.65993 18.2889 10.6927 18.2875 12.0832V20.2277H14.737V6.9525H18.1028V8.84858C18.4402 8.13805 18.9842 7.54356 19.665 7.14138C20.3458 6.7392 21.1324 6.54767 21.9239 6.59137C22.6967 6.51854 23.4722 6.70025 24.1301 7.10835C24.7881 7.51645 25.2917 8.12813 25.563 8.84858C25.9642 8.13104 26.5604 7.53927 27.284 7.14041C28.0076 6.74155 28.8296 6.55157 29.6567 6.59205H29.6532ZM64.222 6.86205V20.1366H60.6776V6.86273L64.222 6.86205ZM58.4908 6.59205H58.5814V10.1135C56.6733 10.0231 54.3058 9.84353 54.3058 13.8159V20.1373H50.8527V6.86273H54.1279V9.21038C55.4043 6.9525 56.6753 6.5016 58.4942 6.59205H58.4908ZM8.36926 13.7255C6.91362 14.7191 3.54779 14.0866 3.54779 16.4342C3.63842 17.6081 4.18429 18.0596 5.27602 18.0596C7.82339 17.6087 8.46058 16.8865 8.36926 13.7255ZM88.8787 13.7255C88.1504 14.1286 87.3443 14.3748 86.5132 14.4477C85.0576 14.5382 84.1478 14.9877 84.1478 16.3438C84.2384 17.6081 84.8756 18.0596 85.876 18.0596C88.4241 17.6087 89.1519 16.6151 88.8787 13.7255ZM118.171 13.7255C117.407 14.1178 116.575 14.3629 115.718 14.4477C114.718 14.5382 113.353 14.8993 113.353 16.3438C113.353 17.7883 114.353 17.9692 115.081 18.0596C117.444 17.8794 118.169 16.796 118.169 13.7255H118.171ZM42.3015 9.39128C40.3934 9.39128 39.7541 10.746 39.6635 12.1905H45.0308C45.0395 11.8286 44.9756 11.4686 44.8427 11.1313C44.7098 10.7941 44.5106 10.4864 44.2567 10.226C44.0028 9.96557 43.6993 9.7577 43.3636 9.61442C43.028 9.47113 42.667 9.39528 42.3015 9.39128ZM0.0906369 0V3.2508H137V0H0.0906369Z",fill:"white"}))},5060:function(e,t,n){n.d(t,{Z:function(){return i}});var o=n(7294),r=n(9163);const a=r.default.div`
3
+ a {
4
+ content: url('https://sdk.r2u.io/assets/r2u-icon-gray.svg');
5
+ height: 22px;
6
+ position: absolute;
7
+ z-index: 999999;
8
+ margin: 10px;
9
+ ${e=>{const t=e.position?e.position.toLowerCase():"";return r.css`
10
+ ${t.includes("left")&&"left: 0;"}
11
+ ${t.includes("right")&&"right: 0;"}
12
+ ${t.includes("bottom")&&"bottom: 0;"}
13
+ ${t.includes("top")&&"top: 0;"}
14
+ ${t.includes("center")&&"left: 0; right: 0; margin: auto;"}
15
+ ${t.includes("absolute")&&"position: absolute;"}
16
+ `}};
17
+ }
18
+ a:hover {
19
+ content: url('https://sdk.r2u.io/assets/r2u-icon.svg');
20
+ }
21
+ `;var i=({position:e})=>o.createElement(a,{position:e},o.createElement("a",{href:"https://r2u.io",target:"_blank",rel:"noopener noreferrer"},o.createElement("img",{alt:""})))},6504:function(e,t,n){n.d(t,{f2:function(){return d}});var o=n(8665),r=n(1580),a=n(5538),i=n(660),l=n(2297),s=n(2367),c=function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{s(o.next(e))}catch(e){a(e)}}function l(e){try{s(o.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,l)}s((o=o.apply(e,t||[])).next())}))};const d=o.Z.createInstance();t.ZP={init:({language:e})=>c(void 0,void 0,void 0,(function*(){const t=s.Z.customer.language,n=(s.Z.customer.slug,e||t||"en"),o=(0,l.Bv)(),c=["translation"];return new Promise(((e,t)=>{d.use(r.Z).init({debug:!1,react:{useSuspense:!1},lng:n,fallbackLng:!1,supportedLngs:["pt","en","es"],ns:c,defaultNS:"translation",fallbackNS:"translation",load:"currentOnly",preload:[n],interpolation:{escapeValue:!1},backend:{backends:[i.Z,a.Z],backendOptions:[{prefix:"i18next_res_r2u_sdk_",enabled:!0,expirationTime:6048e5},{loadPath:`${o}/locales/{{lng}}/{{ns}}.json`,allowMultiloading:!0}]}},(n=>{n&&t(new Error("R2U - Translation init failed")),e()}))}))}))}},9408:function(e,t,n){n.r(t),n.d(t,{default:function(){return He}});var o=n(7294),r=n(3935),a=n(5865),i=n(2367);function l(e){const t=`r2u-webxr-seen-${e}`;return Boolean(JSON.parse(localStorage.getItem(t)||"false"))}function s(e){const t=`r2u-webxr-seen-${e}`;localStorage.setItem(t,JSON.stringify(!0))}function c(e){const t=`r2u-ar-opened-${e}`;return Boolean(JSON.parse(localStorage.getItem(t)||"false"))}function d(e){const t=`r2u-ar-opened-${e}`;localStorage.setItem(t,JSON.stringify(!0))}var m=n(7523),p=n(7374),u=n(2297),f=n(6339),h=n(6504);const g=(0,o.createContext)({}),b=({children:e,openerElement:t,openerEvent:n,onClose:r=(()=>{})})=>{const[a,i]=(0,o.useState)(!1),l=()=>{i(!0)};return t&&n&&t.addEventListener(n,l),o.createElement(g.Provider,{value:{isOpen:a,openModal:l,closeModal:()=>{r(),i(!1)},toggleModal:()=>{i(!a)}}},o.createElement(f.a,{i18n:h.f2},a?e:null))};var v=n(6793),x=n(1841),w=n.n(x),E=n(9163);const y=E.default.div`
3
22
  .text {
4
23
  margin: auto;
5
24
  padding: 10px;
@@ -52,7 +71,7 @@
52
71
  margin-bottom: 20px;
53
72
  padding-bottom: 22px;
54
73
  }
55
- `;var k=n(5060),O=n(3026);const N=E.default.div`
74
+ `;var k=n(5060),C=n(3026);const O=E.default.div`
56
75
  display: block;
57
76
  position: fixed;
58
77
  top: 0;
@@ -74,14 +93,14 @@
74
93
  border: none;
75
94
  outline: none;
76
95
  }
77
- `,j=E.createGlobalStyle`
96
+ `,N=E.createGlobalStyle`
78
97
  html {
79
98
  overflow: hidden;
80
99
  }
81
100
  body {
82
101
  overflow: hidden;
83
102
  }
84
- `;var S=n(9429);var C=({children:e,color:t="white"})=>o.createElement(S.ZP.div,null,o.createElement(N,{color:t},o.createElement(j,null),e));var L=({glb:e})=>{const{closeModal:t}=(0,o.useContext)(g),{t:n}=(0,v.$)();return o.createElement(C,null,o.createElement(y,null,o.createElement(O.Ao,{width:30,height:30,color:"#707070",cursor:"pointer",className:"exit",onClick:()=>{t()}}),o.createElement("div",{className:"text error"},n("fallback.viewer.title")),o.createElement("div",{className:"text top"},n("fallback.viewer.topText")),o.createElement("div",{className:"fallback-viewer-container"},o.createElement(w(),{glbSrc:e})),o.createElement("div",{className:"text bottom"},n("fallback.viewer.bottomText")),o.createElement("div",{className:"watermark"},o.createElement(k.Z,{position:"centerAbsolute"}))))};const P=E.default.div`
103
+ `;var j=n(9429);var L=({children:e,color:t="white"})=>o.createElement(j.ZP.div,null,o.createElement(O,{color:t},o.createElement(N,null),e));var S=({glb:e})=>{const{closeModal:t}=(0,o.useContext)(g),{t:n}=(0,v.$)();return o.createElement(L,null,o.createElement(y,null,o.createElement(C.Ao,{width:30,height:30,color:"#707070",cursor:"pointer",className:"exit",onClick:()=>{t()}}),o.createElement("div",{className:"text error"},n("fallback.viewer.title")),o.createElement("div",{className:"text top"},n("fallback.viewer.topText")),o.createElement("div",{className:"fallback-viewer-container"},o.createElement(w(),{glbSrc:e})),o.createElement("div",{className:"text bottom"},n("fallback.viewer.bottomText")),o.createElement("div",{className:"watermark"},o.createElement(k.Z,{position:"centerAbsolute"}))))};const H=E.default.div`
85
104
  width: 100%;
86
105
  height: 100%;
87
106
  background-image: linear-gradient(to bottom, #e9eaeb, #e4e5e7);
@@ -90,7 +109,7 @@
90
109
  width: 100%;
91
110
  height: 100%;
92
111
  }
93
- `;var z=({glb:e})=>{const{closeModal:t}=(0,o.useContext)(g);return o.createElement(C,null,o.createElement(O.Ao,{width:30,height:30,color:"#707070",cursor:"pointer",className:"exit",onClick:t}),o.createElement(P,null,o.createElement(w(),{glbSrc:e})))};var R=({openerElement:e,openerEvent:t,fallbackOptions:{alertMessage:n,fallback:r},glb:a})=>(n&&e.addEventListener(t,(()=>{alert(n)})),"viewer"===r&&a?o.createElement(b,{openerElement:e,openerEvent:t},o.createElement(L,{glb:a})):"full"===r&&a?o.createElement(b,{openerElement:e,openerEvent:t},o.createElement(z,{glb:a})):null);const A=E.default.div`
112
+ `;var M=({glb:e})=>{const{closeModal:t}=(0,o.useContext)(g);return o.createElement(L,null,o.createElement(C.Ao,{width:30,height:30,color:"#707070",cursor:"pointer",className:"exit",onClick:t}),o.createElement(H,null,o.createElement(w(),{glbSrc:e})))};var z=({openerElement:e,openerEvent:t,fallbackOptions:{alertMessage:n,fallback:r},glb:a})=>(n&&e.addEventListener(t,(()=>{alert(n)})),"viewer"===r&&a?o.createElement(b,{openerElement:e,openerEvent:t},o.createElement(S,{glb:a})):"full"===r&&a?o.createElement(b,{openerElement:e,openerEvent:t},o.createElement(M,{glb:a})):null);const P=E.default.div`
94
113
  display: flex;
95
114
  flex-direction: column;
96
115
  align-items: center;
@@ -224,7 +243,7 @@
224
243
  color: #ffffff;
225
244
  }
226
245
  }
227
- `;var M=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};var I=e=>{var{hasWaterMark:t=!0,onOpen:n,activateAR:r}=e,a=M(e,["hasWaterMark","onOpen","activateAR"]);const{closeModal:i}=(0,o.useContext)(g),{t:l}=(0,v.$)(),[s,c]=(0,o.useState)(!1);return(0,o.useEffect)(n,[]),document.addEventListener("visibilitychange",(()=>i()),{once:!0}),window.addEventListener("hashchange",(()=>i()),{once:!0}),o.createElement(C,null,o.createElement(A,null,o.createElement(O.Ao,{width:30,height:30,color:"#707070",cursor:"pointer",className:"exit",onClick:i}),o.createElement("a",{href:"https://r2u.io",className:"powered",target:"_blank",rel:"noopener noreferrer",style:{visibility:t?void 0:"hidden"}},o.createElement("h1",null,l("poweredBy")),o.createElement("img",{src:"https://sdk.r2u.io/assets/r2u-full-white-logo.png",alt:"",className:"icon"})),o.createElement("div",{className:`instructions ${!t&&"no-watermark"}`},o.createElement("div",{className:"border"},o.createElement("img",{src:"https://sdk.r2u.io/assets/instruction-cover.jpg",alt:"",className:"example"}),o.createElement("div",{className:"instructionsColumn"},o.createElement("span",null,l("instructions.handMove")),o.createElement("img",{src:"https://sdk.r2u.io/assets/instruction-hand-move.png",alt:"",className:"icon"}),o.createElement("span",null,l("instructions.handRotate")),o.createElement("img",{src:"https://sdk.r2u.io/assets/instruction-hand-rotate.png",alt:"",className:"icon"})))),o.createElement("div",{className:"text"},o.createElement("h3",null,l("instructions.text"))),o.createElement("button",{type:"button",className:"ar-button",disabled:s,onClick:()=>{r(a),c(!0)}},s?o.createElement("span",null,l("instructions.loading")):o.createElement("span",null,l("instructions.button")))))};const T=E.default.div`
246
+ `;var Z=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};var R=e=>{var{hasWaterMark:t=!0,onOpen:n,activateAR:r}=e,a=Z(e,["hasWaterMark","onOpen","activateAR"]);const{closeModal:i}=(0,o.useContext)(g),{t:l}=(0,v.$)(),[s,c]=(0,o.useState)(!1);return(0,o.useEffect)(n,[]),document.addEventListener("visibilitychange",(()=>i()),{once:!0}),window.addEventListener("hashchange",(()=>i()),{once:!0}),o.createElement(L,null,o.createElement(P,null,o.createElement(C.Ao,{width:30,height:30,color:"#707070",cursor:"pointer",className:"exit",onClick:i}),o.createElement("a",{href:"https://r2u.io",className:"powered",target:"_blank",rel:"noopener noreferrer",style:{visibility:t?void 0:"hidden"}},o.createElement("h1",null,l("poweredBy")),o.createElement("img",{src:"https://sdk.r2u.io/assets/r2u-full-white-logo.png",alt:"",className:"icon"})),o.createElement("div",{className:`instructions ${!t&&"no-watermark"}`},o.createElement("div",{className:"border"},o.createElement("img",{src:"https://sdk.r2u.io/assets/instruction-cover.jpg",alt:"",className:"example"}),o.createElement("div",{className:"instructionsColumn"},o.createElement("span",null,l("instructions.handMove")),o.createElement("img",{src:"https://sdk.r2u.io/assets/instruction-hand-move.png",alt:"",className:"icon"}),o.createElement("span",null,l("instructions.handRotate")),o.createElement("img",{src:"https://sdk.r2u.io/assets/instruction-hand-rotate.png",alt:"",className:"icon"})))),o.createElement("div",{className:"text"},o.createElement("h3",null,l("instructions.text"))),o.createElement("button",{type:"button",className:"ar-button",disabled:s,onClick:()=>{r(a),c(!0)}},s?o.createElement("span",null,l("instructions.loading")):o.createElement("span",null,l("instructions.button")))))};const A=E.default.div`
228
247
  display: flex;
229
248
  flex-direction: column;
230
249
  align-items: center;
@@ -337,12 +356,12 @@
337
356
  }
338
357
  }
339
358
  }
340
- `;var W=n.p+"fonts/Roboto.ttf",H=E.createGlobalStyle`
359
+ `;var V=n.p+"fonts/Roboto.ttf",I=E.createGlobalStyle`
341
360
  @font-face {
342
361
  font-family: 'Roboto';
343
- src: url(${W}) format('truetype');
362
+ src: url(${V}) format('truetype');
344
363
  }
345
- `,X=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};var Z=e=>{var{onOpen:t,activateAR:n}=e,r=X(e,["onOpen","activateAR"]);const{closeModal:a}=(0,o.useContext)(g),[i,l]=(0,o.useState)(!1);return(0,o.useEffect)(t,[]),document.addEventListener("visibilitychange",(()=>a()),{once:!0}),window.addEventListener("hashchange",(()=>a()),{once:!0}),o.createElement(C,{color:"#F1F1F1"},o.createElement(H,null),o.createElement(T,null,o.createElement("div",{className:"logo"},o.createElement(O.yY,null)),o.createElement("div",{className:"instructions"},o.createElement("img",{src:"https://sdk.r2u.io/assets/instruction-cover.jpg",alt:"",className:"example"}),o.createElement("div",{className:"instructions-column"},o.createElement("div",{className:"instruction-unit"},o.createElement("img",{src:"https://sdk.r2u.io/assets/instruction-hand-move.png",alt:"",className:"icon"}),o.createElement("span",null,"segure e arraste o produto para mover")),o.createElement("div",{className:"instruction-unit"},o.createElement("img",{src:"https://sdk.r2u.io/assets/instruction-hand-rotate.png",alt:"",className:"icon"}),o.createElement("span",null,"segure o produto com dois dedos para girar")))),o.createElement("div",{className:"footer"},o.createElement("span",null,"coloque o produto em seu espaço para verificar todas as dimensões"),o.createElement("button",{type:"button",className:"ar-button",disabled:i,onClick:()=>{n(r),l(!0)}},i?o.createElement("span",null,"carregando ..."):o.createElement("span",null,"veja como fica no seu espaço")))))},$=n.p+"82702c4b09713a8e6a2429734fd2d0f5.png",_=n.p+"a084c0aa29ee4c4dac200f2842cfe66e.png";const U=E.default.div`
364
+ `,T=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};var W=e=>{var{onOpen:t,activateAR:n}=e,r=T(e,["onOpen","activateAR"]);const{closeModal:a}=(0,o.useContext)(g),[i,l]=(0,o.useState)(!1);return(0,o.useEffect)(t,[]),document.addEventListener("visibilitychange",(()=>a()),{once:!0}),window.addEventListener("hashchange",(()=>a()),{once:!0}),o.createElement(L,{color:"#F1F1F1"},o.createElement(I,null),o.createElement(A,null,o.createElement("div",{className:"logo"},o.createElement(C.yY,null)),o.createElement("div",{className:"instructions"},o.createElement("img",{src:"https://sdk.r2u.io/assets/instruction-cover.jpg",alt:"",className:"example"}),o.createElement("div",{className:"instructions-column"},o.createElement("div",{className:"instruction-unit"},o.createElement("img",{src:"https://sdk.r2u.io/assets/instruction-hand-move.png",alt:"",className:"icon"}),o.createElement("span",null,"segure e arraste o produto para mover")),o.createElement("div",{className:"instruction-unit"},o.createElement("img",{src:"https://sdk.r2u.io/assets/instruction-hand-rotate.png",alt:"",className:"icon"}),o.createElement("span",null,"segure o produto com dois dedos para girar")))),o.createElement("div",{className:"footer"},o.createElement("span",null,"coloque o produto em seu espaço para verificar todas as dimensões"),o.createElement("button",{type:"button",className:"ar-button",disabled:i,onClick:()=>{n(r),l(!0)}},i?o.createElement("span",null,"carregando ..."):o.createElement("span",null,"veja como fica no seu espaço")))))},$=n.p+"82702c4b09713a8e6a2429734fd2d0f5.png",X=n.p+"a084c0aa29ee4c4dac200f2842cfe66e.png";const _=E.default.div`
346
365
  position: fixed;
347
366
  z-index: 1000;
348
367
  top: 0px;
@@ -407,14 +426,14 @@
407
426
  height: 1.5vh !important;
408
427
 
409
428
  &.slick-active {
410
- background-image: url(${_});
429
+ background-image: url(${X});
411
430
  }
412
431
 
413
432
  button:before {
414
433
  content: '' !important;
415
434
  }
416
435
  }
417
- `;var F=n(6066),J=n.p+"83f0399669efdba15c656d7c17423195.png",D=n.p+"ad55b6672b7bd0340ba4780a05326dc5.png",B=n.p+"d620f91e28306433451f02b1daba365a.png",V=n.p+"b51da9ff8634426464c8c961e247a5ad.png",q=n.p+"1efd7d6f1d3140590592827519a99ae0.png",Y=n.p+"14d30dedf2d3ff75f65eac0bfea1cd79.jpg",G=n.p+"f3338f821a8950fe14196747564ad00c.png",K=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};var Q=e=>{var{onOpen:t,activateAR:n}=e,r=K(e,["onOpen","activateAR"]);const{closeModal:a}=(0,o.useContext)(g),[i,l]=(0,o.useState)(!1),[s,c]=(0,o.useState)(!1);let d;(0,o.useEffect)(t,[]),document.addEventListener("visibilitychange",(()=>a()),{once:!0}),window.addEventListener("hashchange",(()=>a()),{once:!0});const m=()=>{null==d||d.slickNext(),console.log(d)};return o.createElement(o.Fragment,null,o.createElement("link",{rel:"stylesheet",type:"text/css",href:"https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.css"}),o.createElement("link",{rel:"stylesheet",type:"text/css",href:"https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick-theme.min.css"}),o.createElement(U,{background:i?G:Y},o.createElement("div",{style:{width:"100vw",position:"absolute",top:"6vh"}},!i&&o.createElement("img",{src:D,alt:"Realidade Aumentada",style:{width:"60vw",display:"block",margin:"auto",maxHeight:"12vh"}})),i&&o.createElement(F.Z,Object.assign({ref:e=>{d=e}},{dots:!0,infinite:!1,speed:500,slidesToShow:1,slidesToScroll:1,arrows:!1,style:{position:"relative",margin:"auto",top:"50%",msTransform:"translateY(-50%)",transform:"translateY(-50%)"}}),o.createElement("div",{className:"slide"},o.createElement("img",{src:B,alt:"Tutorial 1"}),o.createElement("button",{className:"red-button next",onClick:m},"Próximo")),o.createElement("div",{className:"slide"},o.createElement("img",{src:V,alt:"Tutorial 2"}),o.createElement("button",{className:"red-button next",onClick:m},"Próximo")),o.createElement("div",{className:"slide"},o.createElement("img",{src:q,alt:"Tutorial 3"}),o.createElement("button",{className:"red-button next",disabled:s,onClick:()=>{c(!0),n(r)}},s?"Carregando...":"Começar!"))),!i&&o.createElement("button",{className:"red-button",style:{msTransform:"translateY(-50%)",transform:"translateY(-50%)",position:"absolute",bottom:"22vh",left:"25vw",display:i?"hidden":"auto"},onClick:()=>{l(!0)}},"Veja como usar"),o.createElement("div",{style:{width:"100vw",position:"absolute",bottom:"14vh"}},!i&&o.createElement("img",{src:J,alt:"Logo",style:{width:"50vw",display:"block",margin:"auto",maxHeight:"9vh"}})),o.createElement(O.Ao,{width:40,height:40,color:"#505050",cursor:"pointer",className:"exit",onClick:a,style:{position:"absolute",top:"10px",left:"10px"}})))};const ee=E.default.div`
436
+ `;var B=n(6066),U=n.p+"83f0399669efdba15c656d7c17423195.png",F=n.p+"ad55b6672b7bd0340ba4780a05326dc5.png",J=n.p+"d620f91e28306433451f02b1daba365a.png",D=n.p+"b51da9ff8634426464c8c961e247a5ad.png",q=n.p+"1efd7d6f1d3140590592827519a99ae0.png",Y=n.p+"14d30dedf2d3ff75f65eac0bfea1cd79.jpg",G=n.p+"f3338f821a8950fe14196747564ad00c.png",K=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};var Q=e=>{var{onOpen:t,activateAR:n}=e,r=K(e,["onOpen","activateAR"]);const{closeModal:a}=(0,o.useContext)(g),[i,l]=(0,o.useState)(!1),[s,c]=(0,o.useState)(!1);let d;(0,o.useEffect)(t,[]),document.addEventListener("visibilitychange",(()=>a()),{once:!0}),window.addEventListener("hashchange",(()=>a()),{once:!0});const m=()=>{null==d||d.slickNext(),console.log(d)};return o.createElement(o.Fragment,null,o.createElement("link",{rel:"stylesheet",type:"text/css",href:"https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.css"}),o.createElement("link",{rel:"stylesheet",type:"text/css",href:"https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick-theme.min.css"}),o.createElement(_,{background:i?G:Y},o.createElement("div",{style:{width:"100vw",position:"absolute",top:"6vh"}},!i&&o.createElement("img",{src:F,alt:"Realidade Aumentada",style:{width:"60vw",display:"block",margin:"auto",maxHeight:"12vh"}})),i&&o.createElement(B.Z,Object.assign({ref:e=>{d=e}},{dots:!0,infinite:!1,speed:500,slidesToShow:1,slidesToScroll:1,arrows:!1,style:{position:"relative",margin:"auto",top:"50%",msTransform:"translateY(-50%)",transform:"translateY(-50%)"}}),o.createElement("div",{className:"slide"},o.createElement("img",{src:J,alt:"Tutorial 1"}),o.createElement("button",{className:"red-button next",onClick:m},"Próximo")),o.createElement("div",{className:"slide"},o.createElement("img",{src:D,alt:"Tutorial 2"}),o.createElement("button",{className:"red-button next",onClick:m},"Próximo")),o.createElement("div",{className:"slide"},o.createElement("img",{src:q,alt:"Tutorial 3"}),o.createElement("button",{className:"red-button next",disabled:s,onClick:()=>{c(!0),n(r)}},s?"Carregando...":"Começar!"))),!i&&o.createElement("button",{className:"red-button",style:{msTransform:"translateY(-50%)",transform:"translateY(-50%)",position:"absolute",bottom:"22vh",left:"25vw",display:i?"hidden":"auto"},onClick:()=>{l(!0)}},"Veja como usar"),o.createElement("div",{style:{width:"100vw",position:"absolute",bottom:"14vh"}},!i&&o.createElement("img",{src:U,alt:"Logo",style:{width:"50vw",display:"block",margin:"auto",maxHeight:"9vh"}})),o.createElement(C.Ao,{width:40,height:40,color:"#505050",cursor:"pointer",className:"exit",onClick:a,style:{position:"absolute",top:"10px",left:"10px"}})))};const ee=E.default.div`
418
437
  display: flex;
419
438
  flex-direction: column;
420
439
  align-items: center;
@@ -548,7 +567,7 @@
548
567
  color: #ffffff;
549
568
  }
550
569
  }
551
- `;var te=n.p+"f91bfc6bd31271563d950a9321ba989b.jpg",ne=JSON.parse('{"NE":{"fu":"Hold and drag the product to move","SS":"Hold the product with two fingers to rotate","fL":"Place the product in your surroundings to check all dimensions","LI":"Check this product in your space!","V_":"Loading ..."},"Pn":"powered by"}'),oe=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};var re=e=>{var{hasWaterMark:t=!0,onOpen:n,activateAR:r}=e,a=oe(e,["hasWaterMark","onOpen","activateAR"]);const{closeModal:i}=(0,o.useContext)(g),[l,s]=(0,o.useState)(!1);return(0,o.useEffect)(n,[]),document.addEventListener("visibilitychange",(()=>i()),{once:!0}),window.addEventListener("hashchange",(()=>i()),{once:!0}),o.createElement(C,null,o.createElement(ee,null,o.createElement(O.Ao,{width:30,height:30,color:"#707070",cursor:"pointer",className:"exit",onClick:i}),o.createElement("a",{href:"https://r2u.io",className:"powered",target:"_blank",rel:"noopener noreferrer",style:{visibility:t?void 0:"hidden"}},o.createElement("h1",null,ne.Pn),o.createElement("img",{src:"https://sdk.r2u.io/assets/r2u-full-white-logo.png",alt:"",className:"icon"})),o.createElement("div",{className:`instructions ${!t&&"no-watermark"}`},o.createElement("div",{className:"border"},o.createElement("img",{src:te,alt:"",className:"example"}),o.createElement("div",{className:"instructionsColumn"},o.createElement("span",null,ne.NE.fu),o.createElement("img",{src:"https://sdk.r2u.io/assets/instruction-hand-move.png",alt:"",className:"icon"}),o.createElement("span",null,ne.NE.SS),o.createElement("img",{src:"https://sdk.r2u.io/assets/instruction-hand-rotate.png",alt:"",className:"icon"})))),o.createElement("div",{className:"text"},o.createElement("h3",null,ne.NE.fL)),o.createElement("button",{type:"button",className:"ar-button",disabled:l,onClick:()=>{r(a),s(!0)}},l?o.createElement("span",null,ne.NE.V_):o.createElement("span",null,ne.NE.LI))))};const ae=E.default.div`
570
+ `;var te=n.p+"f91bfc6bd31271563d950a9321ba989b.jpg",ne=JSON.parse('{"NE":{"fu":"Hold and drag the product to move","SS":"Hold the product with two fingers to rotate","fL":"Place the product in your surroundings to check all dimensions","LI":"Check this product in your space!","V_":"Loading ..."},"Pn":"powered by"}'),oe=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};var re=e=>{var{hasWaterMark:t=!0,onOpen:n,activateAR:r}=e,a=oe(e,["hasWaterMark","onOpen","activateAR"]);const{closeModal:i}=(0,o.useContext)(g),[l,s]=(0,o.useState)(!1);return(0,o.useEffect)(n,[]),document.addEventListener("visibilitychange",(()=>i()),{once:!0}),window.addEventListener("hashchange",(()=>i()),{once:!0}),o.createElement(L,null,o.createElement(ee,null,o.createElement(C.Ao,{width:30,height:30,color:"#707070",cursor:"pointer",className:"exit",onClick:i}),o.createElement("a",{href:"https://r2u.io",className:"powered",target:"_blank",rel:"noopener noreferrer",style:{visibility:t?void 0:"hidden"}},o.createElement("h1",null,ne.Pn),o.createElement("img",{src:"https://sdk.r2u.io/assets/r2u-full-white-logo.png",alt:"",className:"icon"})),o.createElement("div",{className:`instructions ${!t&&"no-watermark"}`},o.createElement("div",{className:"border"},o.createElement("img",{src:te,alt:"",className:"example"}),o.createElement("div",{className:"instructionsColumn"},o.createElement("span",null,ne.NE.fu),o.createElement("img",{src:"https://sdk.r2u.io/assets/instruction-hand-move.png",alt:"",className:"icon"}),o.createElement("span",null,ne.NE.SS),o.createElement("img",{src:"https://sdk.r2u.io/assets/instruction-hand-rotate.png",alt:"",className:"icon"})))),o.createElement("div",{className:"text"},o.createElement("h3",null,ne.NE.fL)),o.createElement("button",{type:"button",className:"ar-button",disabled:l,onClick:()=>{r(a),s(!0)}},l?o.createElement("span",null,ne.NE.V_):o.createElement("span",null,ne.NE.LI))))};const ae=E.default.div`
552
571
  display: flex;
553
572
  flex-direction: column;
554
573
  align-items: center;
@@ -682,7 +701,7 @@
682
701
  color: #ffffff;
683
702
  }
684
703
  }
685
- `;var ie=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};var le=e=>{var{hasWaterMark:t=!0,onOpen:n,activateAR:r}=e,a=ie(e,["hasWaterMark","onOpen","activateAR"]);const{closeModal:i}=(0,o.useContext)(g),[l,s]=(0,o.useState)(!1);(0,o.useEffect)(n,[]),document.addEventListener("visibilitychange",(()=>i()),{once:!0}),window.addEventListener("hashchange",(()=>i()),{once:!0});return o.createElement(C,null,o.createElement(ae,null,o.createElement(O.Ao,{width:30,height:30,color:"#707070",cursor:"pointer",className:"exit",onClick:i}),o.createElement("a",{href:"https://r2u.io",className:"powered",target:"_blank",rel:"noopener noreferrer",style:{visibility:t?void 0:"hidden"}},o.createElement("h1",null,ne.Pn),o.createElement("img",{src:"https://sdk.r2u.io/assets/r2u-full-white-logo.png",alt:"",className:"icon"})),o.createElement("div",{className:`instructions ${!t&&"no-watermark"}`},o.createElement("div",{className:"border"},o.createElement("video",{autoPlay:!0,muted:!0,loop:!0,playsInline:!0,style:{width:"100%",height:"auto"}},o.createElement("source",{src:"https://storage.googleapis.com/r2u-integrations-bucket/y-digital/V-UP.mp4",type:"video/mp4"})))),o.createElement("button",{type:"button",className:"ar-button",disabled:l,onClick:()=>{r(a),s(!0)}},l?o.createElement("span",null,ne.NE.V_):o.createElement("span",null,"Start the experience"))))},se=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};const ce=({customerId:e,sku:t})=>{switch(e){case"89e502ed-f9ae-4147-82e1-f0868d2bb74b":switch(t){case"rav4":return re;case"vodacom-portal":return le;default:return I}case"701ba5cb-152f-4724-9a5f-bb5b1c42d81c":return Z;case"60f02fd9ff756f00088eb928":return Q;default:return I}};var de=e=>{var{openerElement:t,openerEvent:n,customerId:r,sku:a}=e,i=se(e,["openerElement","openerEvent","customerId","sku"]);const l=ce({customerId:r,sku:a});return o.createElement(b,{openerElement:t,openerEvent:n},o.createElement(l,Object.assign({},i,"89e502ed-f9ae-4147-82e1-f0868d2bb74b"===r||"c46943ac-ac1a-4170-8f52-c8705b963538"===r?{hasWaterMark:!1}:{})))};const me=E.default.div`
704
+ `;var ie=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};var le=e=>{var{hasWaterMark:t=!0,onOpen:n,activateAR:r}=e,a=ie(e,["hasWaterMark","onOpen","activateAR"]);const{closeModal:i}=(0,o.useContext)(g),[l,s]=(0,o.useState)(!1);(0,o.useEffect)(n,[]),document.addEventListener("visibilitychange",(()=>i()),{once:!0}),window.addEventListener("hashchange",(()=>i()),{once:!0});return o.createElement(L,null,o.createElement(ae,null,o.createElement(C.Ao,{width:30,height:30,color:"#707070",cursor:"pointer",className:"exit",onClick:i}),o.createElement("a",{href:"https://r2u.io",className:"powered",target:"_blank",rel:"noopener noreferrer",style:{visibility:t?void 0:"hidden"}},o.createElement("h1",null,ne.Pn),o.createElement("img",{src:"https://sdk.r2u.io/assets/r2u-full-white-logo.png",alt:"",className:"icon"})),o.createElement("div",{className:`instructions ${!t&&"no-watermark"}`},o.createElement("div",{className:"border"},o.createElement("video",{autoPlay:!0,muted:!0,loop:!0,playsInline:!0,style:{width:"100%",height:"auto"}},o.createElement("source",{src:"https://storage.googleapis.com/r2u-integrations-bucket/y-digital/V-UP.mp4",type:"video/mp4"})))),o.createElement("button",{type:"button",className:"ar-button",disabled:l,onClick:()=>{r(a),s(!0)}},l?o.createElement("span",null,ne.NE.V_):o.createElement("span",null,"Start the experience"))))},se=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};const ce=({customerId:e,sku:t})=>{switch(e){case"89e502ed-f9ae-4147-82e1-f0868d2bb74b":switch(t){case"rav4":return re;case"vodacom-portal":return le;default:return R}case"701ba5cb-152f-4724-9a5f-bb5b1c42d81c":return W;case"60f02fd9ff756f00088eb928":return Q;default:return R}};var de=e=>{var{openerElement:t,openerEvent:n,customerId:r,sku:a}=e,i=se(e,["openerElement","openerEvent","customerId","sku"]);const l=ce({customerId:r,sku:a});return o.createElement(b,{openerElement:t,openerEvent:n},o.createElement(l,Object.assign({},i,"89e502ed-f9ae-4147-82e1-f0868d2bb74b"===r||"c46943ac-ac1a-4170-8f52-c8705b963538"===r?{hasWaterMark:!1}:{})))};const me=E.default.div`
686
705
  display: grid;
687
706
  place-content: center;
688
707
  margin-top: 45%;
@@ -777,7 +796,7 @@
777
796
  text-align: center;
778
797
  width: 100%;
779
798
  height: 100%;
780
- `;var fe=()=>{const{closeModal:e}=(0,o.useContext)(g),{t:t}=(0,v.$)();return setTimeout(e,2e3),o.createElement(ue,null,o.createElement(O.mn,{width:60,height:60,cursor:"pointer"}),o.createElement("span",{className:"title"},t("feedback.confirm.title")),o.createElement("span",null,t("feedback.confirm.text")))};var he=({onLike:e,onDislike:t})=>{const{t:n}=(0,v.$)();return o.createElement(pe,null,o.createElement("span",{className:"title"},n("feedback.main.title")),o.createElement("div",{className:"buttons"},o.createElement("button",{type:"button",className:"dislike",onClick:t},o.createElement(O.Ov,{width:30,height:30,cursor:"pointer"})),o.createElement("button",{type:"button",className:"like",onClick:e},o.createElement(O.L7,{width:30,height:30,cursor:"pointer"}))))};var ge=({onLike:e,onDislike:t,onOpen:n})=>{const{closeModal:r}=(0,o.useContext)(g),{t:a}=(0,v.$)(),[i,l]=(0,o.useState)(!1);(0,o.useEffect)(n,[]);return o.createElement(C,{color:"RGBA(0, 0, 0, 0.5)"},o.createElement(me,null,o.createElement("div",{className:"balloon"},i?o.createElement(fe,null):o.createElement(he,{onLike:()=>{l(!0),e()},onDislike:()=>{l(!0),t()}}),o.createElement("button",{type:"button",className:"close",onClick:()=>r()},o.createElement("span",{className:"finish"},a(i?"feedback.confirm.button":"feedback.main.button"))))))},be=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};var ve=e=>{var{openerElement:t,openerEvent:n,onClose:r}=e,a=be(e,["openerElement","openerEvent","onClose"]);return o.createElement(b,{onClose:r,openerElement:t,openerEvent:n},o.createElement(ge,Object.assign({onClose:r},a)))};const xe=E.default.div`
799
+ `;var fe=()=>{const{closeModal:e}=(0,o.useContext)(g),{t:t}=(0,v.$)();return setTimeout(e,2e3),o.createElement(ue,null,o.createElement(C.mn,{width:60,height:60,cursor:"pointer"}),o.createElement("span",{className:"title"},t("feedback.confirm.title")),o.createElement("span",null,t("feedback.confirm.text")))};var he=({onLike:e,onDislike:t})=>{const{t:n}=(0,v.$)();return o.createElement(pe,null,o.createElement("span",{className:"title"},n("feedback.main.title")),o.createElement("div",{className:"buttons"},o.createElement("button",{type:"button",className:"dislike",onClick:t},o.createElement(C.Ov,{width:30,height:30,cursor:"pointer"})),o.createElement("button",{type:"button",className:"like",onClick:e},o.createElement(C.L7,{width:30,height:30,cursor:"pointer"}))))};var ge=({onLike:e,onDislike:t,onOpen:n})=>{const{closeModal:r}=(0,o.useContext)(g),{t:a}=(0,v.$)(),[i,l]=(0,o.useState)(!1);(0,o.useEffect)(n,[]);return o.createElement(L,{color:"RGBA(0, 0, 0, 0.5)"},o.createElement(me,null,o.createElement("div",{className:"balloon"},i?o.createElement(fe,null):o.createElement(he,{onLike:()=>{l(!0),e()},onDislike:()=>{l(!0),t()}}),o.createElement("button",{type:"button",className:"close",onClick:()=>r()},o.createElement("span",{className:"finish"},a(i?"feedback.confirm.button":"feedback.main.button"))))))},be=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};var ve=e=>{var{openerElement:t,openerEvent:n,onClose:r}=e,a=be(e,["openerElement","openerEvent","onClose"]);return o.createElement(b,{onClose:r,openerElement:t,openerEvent:n},o.createElement(ge,Object.assign({onClose:r},a)))};const xe=E.default.div`
781
800
  display: flex;
782
801
  width: 100%;
783
802
  height: 100%;
@@ -859,4 +878,4 @@
859
878
  text-align: center;
860
879
  color: #3d71ba;
861
880
  }
862
- `;var we=()=>{const{closeModal:e}=(0,o.useContext)(g),{t:t}=(0,v.$)();return o.createElement(C,{color:"rgba(0, 0, 0, 0.3)"},o.createElement(xe,null,o.createElement("div",{className:"balloon"},o.createElement("div",{className:"info"},o.createElement("h2",null,t("fallback.social.title")),o.createElement("p",null,t("fallback.social.text")),o.createElement("img",{src:"https://sdk.r2u.io/assets/instruction-open-safari.png",alt:""})),o.createElement("button",{type:"button",onClick:e},t("fallback.social.button")))))};var Ee=({openerElement:e,openerEvent:t})=>o.createElement(b,{openerElement:e,openerEvent:t},o.createElement(we,null)),ye=n(2151);null!=navigator.xr&&null!=self.XRSession&&null!=navigator.xr.isSessionSupported&&self.XRSession.prototype.requestHitTestSource,self.ResizeObserver,self.IntersectionObserver,(()=>{const e=navigator.userAgent||navigator.vendor||self.opera;let t=!1;(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0)})(),/\bCrOS\b/.test(navigator.userAgent);const ke=/android/i.test(navigator.userAgent),Oe=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1;(()=>{const e=document.createElement("a");Boolean(e.relList&&e.relList.supports&&e.relList.supports("ar"))})(),/Safari\//.test(navigator.userAgent),/firefox/i.test(navigator.userAgent),/OculusBrowser/.test(navigator.userAgent),Oe&&/CriOS\//.test(navigator.userAgent);var Ne=function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{s(o.next(e))}catch(e){a(e)}}function l(e){try{s(o.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,l)}s((o=o.apply(e,t||[])).next())}))},je=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};const Se="#no-ar-fallback",Ce=e=>{var{container:t}=e,n=je(e,["container"]);const a="r2u-feedback-open",i=document.createElement("div");return i.className="feedback",t.appendChild(i),r.render(o.createElement(ve,Object.assign({openerElement:i,openerEvent:a},n)),i),{open:()=>{i.dispatchEvent(new Event(a))},render:()=>{}}};function Le({element:e,event:t="click"}){return Ne(this,void 0,void 0,(function*(){e.dispatchEvent(new Event(t))}))}var Pe={attach:function({sku:e,price:t,element:n,callToAction:u,event:f="click",showInstructions:h="once",showFeedback:g=!0,fallbackOptions:b={alertMessage:"Sentimos muito, mas infelizmente seu dispositivo não é compatível com a visualização em Realidade Aumentada"},resize:v}){return Ne(this,void 0,void 0,(function*(){if(!i.Z.init)return Promise.reject(new Error("R2U - Not initialized"));if(!e)return Promise.reject(new Error("R2U - Missing SKU"));const{activateWebXR:x,activateAR:w,WebXREvents:E}=yield a,y=()=>Ne(this,void 0,void 0,(function*(){const e=new URLSearchParams(window.location.search);if(e.has("r2u_ar_mode"))return"webxr"===e.get("r2u_ar_mode");const t=yield p.fm();i.Z.growthbook=new ye.Z({user:{id:t},overrides:i.Z.customer.experiments.overrides});const n="webxr-vs-sceneviewer-v3",{value:o}=i.Z.growthbook.run({key:n,variations:["sceneviewer-v3","webxr-v3"]});return p.KN(n),p.fQ(o),"webxr-v3"===o})),{glb:k,usdz:O,name:N,placement:j,sound:S,resize:C,pdpUrl:L}=yield(0,m.Z)(e),P=v||C,z=P?"resizable":"fixed",[A,M]="pt"===i.Z.customer.language?["pt-BR","BRL"]:["en-US","USD"],I=u?Object.assign(Object.assign({},u),{onClick:()=>{u.onClick(),document.dispatchEvent(new Event("r2u-webxr-close")),p.ar.onClick()}}):void 0,T={glb:k,usdz:O,price:t,placement:j,scale:z,sound:S,callToAction:I,pdpUrl:L,title:N,mode:"ar_preferred"},W=Boolean(i.Z.customer.waterMarkPosition),H=()=>{const e=c("feedback");return g&&!e},X={model:{name:N,description:t?new Intl.NumberFormat(A,{style:"currency",currency:M}).format(Number(t)):"",glb:k,placement:j,resizable:P,url:L,showInstructions:(()=>{switch(h){case"always":return{translate:!0,rotate:!0};case"never":return{translate:!1,rotate:!1};default:const e=l("translate"),t=l("rotate");return{translate:!e,rotate:!t}}})()},beforeClose:e=>{const{open:t}=Ce({container:e,onLike:()=>{p.J1.onLike(),p.XH.onLike()},onDislike:()=>{p.J1.onDislike(),p.XH.onDislike()},onClose:()=>document.dispatchEvent(new Event("r2u-webxr-close")),onOpen:()=>d("feedback")});H()?t():document.dispatchEvent(new Event("r2u-webxr-close"))},callToAction:I,language:i.Z.customer.language};p.J1.componentDidMount();const{open:Z,render:$}=(({glb:e,fallbackOptions:t})=>{const n=document.createElement("div"),a="r2u-open-fallback";document.body.appendChild(n);const i=e=>{r.render(o.createElement(R,Object.assign({openerElement:n,openerEvent:a,fallbackOptions:t},e)),n)};return i({glb:e}),{open:()=>{n.dispatchEvent(new Event(a))},render:i}})({fallbackOptions:b,glb:T.glb}),{open:_,render:U}=(e=>{var{hasWaterMark:t,onOpen:n,activateAR:a,sku:l}=e,s=je(e,["hasWaterMark","onOpen","activateAR","sku"]);const c=document.createElement("div"),d="r2u-open-instructions";document.body.appendChild(c);const m=e=>{r.render(o.createElement(de,Object.assign({openerElement:c,openerEvent:d,onOpen:n,hasWaterMark:t,activateAR:a,customerId:i.Z.customer._id,sku:l},e)),c)};return m(s),{open:()=>{c.dispatchEvent(new Event(d))},render:m}})(Object.assign({hasWaterMark:W,sku:e,activateAR:w,onOpen:()=>d("instructions")},T)),{open:F}=Ce({container:document.body.appendChild(document.createElement("div")),onLike:()=>p.J1.onLike(),onDislike:()=>p.J1.onDislike(),onClose:()=>{},onOpen:()=>d("feedback")}),{open:J}=(()=>{const e=document.createElement("div"),t="r2u-open-social-fallback";return document.body.appendChild(e),r.render(o.createElement(Ee,{openerElement:e,openerEvent:t}),e),{open:()=>{e.dispatchEvent(new Event(t))},render:()=>{}}})(),D=e=>Ne(this,void 0,void 0,(function*(){const t=yield(0,m.Z)(e);T.glb=t.glb,T.usdz=t.usdz,T.placement=t.placement,T.sound=t.sound,T.scale=t.resize?"resizable":"fixed",T.title=t.name,X.model.glb=t.glb,X.model.name=t.name,X.model.placement=t.placement,X.model.url=t.pdpUrl,X.model.resizable=t.resize,U(T),$(T)})),B=()=>Ne(this,void 0,void 0,(function*(){if(Oe&&/instagram|FBAN|FBAV|LinkedInApp/i.test(navigator.userAgent))return void J();var e;ke&&"wall"!==j&&(yield y())?(e=E,p.XH.setSession(),document.addEventListener(e.r2uWebxrSessionStart,p.XH.onSessionStart,{once:!0}),document.addEventListener(e.r2uWebxrSessionEnd,p.XH.onSessionEnd,{once:!0}),document.addEventListener(e.r2uWebxrCompatible,(()=>p.XH.setCompatible(!0)),{once:!0}),document.addEventListener(e.r2uWebxrNotCompatible,(()=>p.XH.setCompatible(!1)),{once:!0}),document.addEventListener(e.r2uWebxrPlaneMapped,p.XH.setPlaneMapped,{once:!0}),document.addEventListener(e.r2uWebxrObjectPlaced,p.XH.setObjectPlaced,{once:!0}),document.addEventListener(e.r2uWebxrShowTranslatingInstructions,(()=>{p.XH.setTranslateInstructions(),s("translate")}),{once:!0}),document.addEventListener(e.r2uWebxrShowRotatingInstructions,(()=>{p.XH.setRotateInstructions(),s("rotate")}),{once:!0}),document.addEventListener(e.r2uWebxrTranslating,(()=>{p.XH.setFirstTranslation(),s("translate")}),{once:!0}),document.addEventListener(e.r2uWebxrRotating,(()=>{p.XH.setFirstRotation(),s("rotate")}),{once:!0}),document.addEventListener(e.r2uWebxrReset,p.XH.setReset,{once:!0}),document.addEventListener(e.r2uWebxrFallbackToSceneviewer,p.XH.onSceneViewerFallback,{once:!0}),window.addEventListener("hashchange",(()=>{window.location.hash===Se&&p.XH.onFallback()}),{once:!0}),document.addEventListener(e.r2uWebxrShare,p.XH.onShare),document.addEventListener(e.r2uWebxrExit,p.XH.onExit),document.addEventListener(e.r2uWebxrCallToAction,p.XH.onCallToAction),document.addEventListener(e.r2uWebxrTranslating,p.XH.onTranslation),document.addEventListener(e.r2uWebxrRotating,p.XH.onRotation),x(X)):(()=>{switch(h){case"always":return!0;case"never":return!1;default:return!c("instructions")}})()?_():w(T),yield p.J1.onClick();const t=(new Date).getTime(),n=()=>{if(document.hidden)return;const e=(new Date).getTime();p.J1.onSessionTimeCollect(e-t),H()&&F(),document.removeEventListener("visibilitychange",n)},o=()=>{const e=(new Date).getTime();p.J1.onSessionTimeCollect(e-t),document.removeEventListener("r2u-webxr-close",o),document.removeEventListener("visibilitychange",n)};document.addEventListener("r2u-webxr-close",o),document.addEventListener("visibilitychange",n)}));n.addEventListener(f,B);const V=new URL(window.location.href),q="true"===V.searchParams.get("r2u_redirect"),Y=V.searchParams.get("r2u_sku");return q&&!i.Z.hasAutoOpenedAR&&(i.Z.hasAutoOpenedAR=!0,Y&&(yield D(Y)),Le({element:n,event:f})),window.addEventListener("hashchange",(()=>{window.location.hash===Se&&(p.J1.onFallback(),n.removeEventListener(f,B),n.addEventListener(f,Z),Le({element:n,event:f}))}),{once:!0}),{setSku:D}}))},open:Le,getLink:function(e){return Ne(this,void 0,void 0,(function*(){if(!i.Z.init)return Promise.reject(new Error("R2U - Not initialized"));if(!e)return Promise.reject(new Error("R2U - Missing SKU"));const t=i.Z.customer._id,n=yield(0,u.U2)(`/sdk-ar/openar-link?customerId=${t}&productSku=${e}`);return Promise.resolve(n)}))}}}}]);
881
+ `;var we=()=>{const{closeModal:e}=(0,o.useContext)(g),{t:t}=(0,v.$)();return o.createElement(L,{color:"rgba(0, 0, 0, 0.3)"},o.createElement(xe,null,o.createElement("div",{className:"balloon"},o.createElement("div",{className:"info"},o.createElement("h2",null,t("fallback.social.title")),o.createElement("p",null,t("fallback.social.text")),o.createElement("img",{src:"https://sdk.r2u.io/assets/instruction-open-safari.png",alt:""})),o.createElement("button",{type:"button",onClick:e},t("fallback.social.button")))))};var Ee=({openerElement:e,openerEvent:t})=>o.createElement(b,{openerElement:e,openerEvent:t},o.createElement(we,null)),ye=n(2151);null!=navigator.xr&&null!=self.XRSession&&null!=navigator.xr.isSessionSupported&&self.XRSession.prototype.requestHitTestSource,self.ResizeObserver,self.IntersectionObserver,(()=>{const e=navigator.userAgent||navigator.vendor||self.opera;let t=!1;(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0)})(),/\bCrOS\b/.test(navigator.userAgent);const ke=/android/i.test(navigator.userAgent),Ce=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1;(()=>{const e=document.createElement("a");Boolean(e.relList&&e.relList.supports&&e.relList.supports("ar"))})(),/Safari\//.test(navigator.userAgent),/firefox/i.test(navigator.userAgent),/OculusBrowser/.test(navigator.userAgent),Ce&&/CriOS\//.test(navigator.userAgent);var Oe=function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{s(o.next(e))}catch(e){a(e)}}function l(e){try{s(o.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,l)}s((o=o.apply(e,t||[])).next())}))},Ne=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n};const je="#no-ar-fallback",Le=e=>{var{container:t}=e,n=Ne(e,["container"]);const a="r2u-feedback-open",i=document.createElement("div");return i.className="feedback",t.appendChild(i),r.render(o.createElement(ve,Object.assign({openerElement:i,openerEvent:a},n)),i),{open:()=>{i.dispatchEvent(new Event(a))},render:()=>{}}};function Se({element:e,event:t="click"}){return Oe(this,void 0,void 0,(function*(){e.dispatchEvent(new Event(t))}))}var He={attach:function({sku:e,price:t,element:n,callToAction:u,event:f="click",showInstructions:h="once",showFeedback:g=!0,fallbackOptions:b={alertMessage:"Sentimos muito, mas infelizmente seu dispositivo não é compatível com a visualização em Realidade Aumentada"},resize:v}){return Oe(this,void 0,void 0,(function*(){if(!i.Z.init)return Promise.reject(new Error("R2U - Not initialized"));if(!e)return Promise.reject(new Error("R2U - Missing SKU"));const{activateWebXR:x,activateAR:w,WebXREvents:E}=yield a,y=()=>Oe(this,void 0,void 0,(function*(){const e=new URLSearchParams(window.location.search);if(e.has("r2u_ar_mode"))return"webxr"===e.get("r2u_ar_mode");const t=yield p.fm();i.Z.growthbook=new ye.Z({user:{id:t},overrides:i.Z.customer.experiments.overrides});const n="webxr-vs-sceneviewer-v3",{value:o}=i.Z.growthbook.run({key:n,variations:["sceneviewer-v3","webxr-v3"]});return p.KN(n),p.fQ(o),"webxr-v3"===o})),{glb:k,usdz:C,name:O,placement:N,sound:j,resize:L,pdpUrl:S}=yield(0,m.Z)(e),H=v||L,M=H?"resizable":"fixed",[P,Z]="pt"===i.Z.customer.language?["pt-BR","BRL"]:["en-US","USD"],R=u?Object.assign(Object.assign({},u),{onClick:()=>{u.onClick(),document.dispatchEvent(new Event("r2u-webxr-close")),p.ar.onClick()}}):void 0,A={glb:k,usdz:C,price:t,placement:N,scale:M,sound:j,callToAction:R,pdpUrl:S,title:O,mode:"ar_preferred"},V=Boolean(i.Z.customer.waterMarkPosition),I=()=>{const e=c("feedback");return g&&!e},T={model:{name:O,description:t?new Intl.NumberFormat(P,{style:"currency",currency:Z}).format(Number(t)):"",glb:k,placement:N,resizable:H,url:S,showInstructions:(()=>{switch(h){case"always":return{translate:!0,rotate:!0};case"never":return{translate:!1,rotate:!1};default:const e=l("translate"),t=l("rotate");return{translate:!e,rotate:!t}}})()},beforeClose:e=>{const{open:t}=Le({container:e,onLike:()=>{p.J1.onLike(),p.XH.onLike()},onDislike:()=>{p.J1.onDislike(),p.XH.onDislike()},onClose:()=>document.dispatchEvent(new Event("r2u-webxr-close")),onOpen:()=>d("feedback")});I()?t():document.dispatchEvent(new Event("r2u-webxr-close"))},callToAction:R,language:i.Z.customer.language};p.J1.componentDidMount();const{open:W,render:$}=(({glb:e,fallbackOptions:t})=>{const n=document.createElement("div"),a="r2u-open-fallback";document.body.appendChild(n);const i=e=>{r.render(o.createElement(z,Object.assign({openerElement:n,openerEvent:a,fallbackOptions:t},e)),n)};return i({glb:e}),{open:()=>{n.dispatchEvent(new Event(a))},render:i}})({fallbackOptions:b,glb:A.glb}),{open:X,render:_}=(e=>{var{hasWaterMark:t,onOpen:n,activateAR:a,sku:l}=e,s=Ne(e,["hasWaterMark","onOpen","activateAR","sku"]);const c=document.createElement("div"),d="r2u-open-instructions";document.body.appendChild(c);const m=e=>{r.render(o.createElement(de,Object.assign({openerElement:c,openerEvent:d,onOpen:n,hasWaterMark:t,activateAR:a,customerId:i.Z.customer._id,sku:l},e)),c)};return m(s),{open:()=>{c.dispatchEvent(new Event(d))},render:m}})(Object.assign({hasWaterMark:V,sku:e,activateAR:w,onOpen:()=>d("instructions")},A)),{open:B}=Le({container:document.body.appendChild(document.createElement("div")),onLike:()=>p.J1.onLike(),onDislike:()=>p.J1.onDislike(),onClose:()=>{},onOpen:()=>d("feedback")}),{open:U}=(()=>{const e=document.createElement("div"),t="r2u-open-social-fallback";return document.body.appendChild(e),r.render(o.createElement(Ee,{openerElement:e,openerEvent:t}),e),{open:()=>{e.dispatchEvent(new Event(t))},render:()=>{}}})(),F=e=>Oe(this,void 0,void 0,(function*(){const t=yield(0,m.Z)(e);A.glb=t.glb,A.usdz=t.usdz,A.placement=t.placement,A.sound=t.sound,A.scale=t.resize?"resizable":"fixed",A.title=t.name,T.model.glb=t.glb,T.model.name=t.name,T.model.placement=t.placement,T.model.url=t.pdpUrl,T.model.resizable=t.resize,_(A),$(A)})),J=()=>Oe(this,void 0,void 0,(function*(){if(Ce&&/instagram|FBAN|FBAV|LinkedInApp/i.test(navigator.userAgent))return void U();var e;ke&&"wall"!==N&&(yield y())?(e=E,p.XH.setSession(),document.addEventListener(e.r2uWebxrSessionStart,p.XH.onSessionStart,{once:!0}),document.addEventListener(e.r2uWebxrSessionEnd,p.XH.onSessionEnd,{once:!0}),document.addEventListener(e.r2uWebxrCompatible,(()=>p.XH.setCompatible(!0)),{once:!0}),document.addEventListener(e.r2uWebxrNotCompatible,(()=>p.XH.setCompatible(!1)),{once:!0}),document.addEventListener(e.r2uWebxrPlaneMapped,p.XH.setPlaneMapped,{once:!0}),document.addEventListener(e.r2uWebxrObjectPlaced,p.XH.setObjectPlaced,{once:!0}),document.addEventListener(e.r2uWebxrShowTranslatingInstructions,(()=>{p.XH.setTranslateInstructions(),s("translate")}),{once:!0}),document.addEventListener(e.r2uWebxrShowRotatingInstructions,(()=>{p.XH.setRotateInstructions(),s("rotate")}),{once:!0}),document.addEventListener(e.r2uWebxrTranslating,(()=>{p.XH.setFirstTranslation(),s("translate")}),{once:!0}),document.addEventListener(e.r2uWebxrRotating,(()=>{p.XH.setFirstRotation(),s("rotate")}),{once:!0}),document.addEventListener(e.r2uWebxrReset,p.XH.setReset,{once:!0}),document.addEventListener(e.r2uWebxrFallbackToSceneviewer,p.XH.onSceneViewerFallback,{once:!0}),window.addEventListener("hashchange",(()=>{window.location.hash===je&&p.XH.onFallback()}),{once:!0}),document.addEventListener(e.r2uWebxrShare,p.XH.onShare),document.addEventListener(e.r2uWebxrExit,p.XH.onExit),document.addEventListener(e.r2uWebxrCallToAction,p.XH.onCallToAction),document.addEventListener(e.r2uWebxrTranslating,p.XH.onTranslation),document.addEventListener(e.r2uWebxrRotating,p.XH.onRotation),x(T)):(()=>{switch(h){case"always":return!0;case"never":return!1;default:return!c("instructions")}})()?X():w(A),yield p.J1.onClick();const t=(new Date).getTime(),n=()=>{if(document.hidden)return;const e=(new Date).getTime();p.J1.onSessionTimeCollect(e-t),I()&&B(),document.removeEventListener("visibilitychange",n)},o=()=>{const e=(new Date).getTime();p.J1.onSessionTimeCollect(e-t),document.removeEventListener("r2u-webxr-close",o),document.removeEventListener("visibilitychange",n)};document.addEventListener("r2u-webxr-close",o),document.addEventListener("visibilitychange",n)}));n.addEventListener(f,J);const D=new URL(window.location.href),q="true"===D.searchParams.get("r2u_redirect"),Y=D.searchParams.get("r2u_sku");return q&&!i.Z.hasAutoOpenedAR&&(i.Z.hasAutoOpenedAR=!0,Y&&(yield F(Y)),Se({element:n,event:f})),window.addEventListener("hashchange",(()=>{window.location.hash===je&&(p.J1.onFallback(),n.removeEventListener(f,J),n.addEventListener(f,W),Se({element:n,event:f}))}),{once:!0}),{setSku:F}}))},open:Se,getLink:function(e){return Oe(this,void 0,void 0,(function*(){if(!i.Z.init)return Promise.reject(new Error("R2U - Not initialized"));if(!e)return Promise.reject(new Error("R2U - Missing SKU"));const t=i.Z.customer._id,n=yield(0,u.U2)(`/sdk-ar/openar-link?customerId=${t}&productSku=${e}`);return Promise.resolve(n)}))}}}}]);
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- !function(){"use strict";var e,n,t,r,o={},u={};function i(e){var n=u[e];if(void 0!==n)return n.exports;var t=u[e]={exports:{}};return o[e].call(t.exports,t,t.exports,i),t.exports}i.m=o,i.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(n,{a:n}),n},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},i.t=function(t,r){if(1&r&&(t=this(t)),8&r)return t;if("object"==typeof t&&t){if(4&r&&t.__esModule)return t;if(16&r&&"function"==typeof t.then)return t}var o=Object.create(null);i.r(o);var u={};e=e||[null,n({}),n([]),n(n)];for(var a=2&r&&t;"object"==typeof a&&!~e.indexOf(a);a=n(a))Object.getOwnPropertyNames(a).forEach((function(e){u[e]=function(){return t[e]}}));return u.default=function(){return t},i.d(o,u),o},i.d=function(e,n){for(var t in n)i.o(n,t)&&!i.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},i.f={},i.e=function(e){return Promise.all(Object.keys(i.f).reduce((function(n,t){return i.f[t](e,n),n}),[]))},i.u=function(e){return 691===e?"vendors.72e0cdbf51fef996d405.bundle.js":665===e?"vendors.6c46067ffeb7a1054cd1.bundle.js":215===e?"vendors.2864f1aaf3fa743e1983.bundle.js":410===e?"init.bundle.js":497===e?"config.bundle.js":30===e?"vendors.d0043338c48c5993c6a9.bundle.js":10===e?"vendors.74899dd75aec843bf8a8.bundle.js":603===e?"vendors.5861a640ff3844504854.bundle.js":593===e?"vendors.17c6142917e7e009f251.bundle.js":850===e?"ar.bundle.js":465===e?"sku.bundle.js":361===e?"vendors.6e3f8af05556e404968a.bundle.js":428===e?"viewer.bundle.js":142===e?"analytics.bundle.js":869===e?"qrCode.bundle.js":void 0},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t={},r="R2U:",i.l=function(e,n,o,u){if(t[e])t[e].push(n);else{var a,d;if(void 0!==o)for(var c=document.getElementsByTagName("script"),f=0;f<c.length;f++){var l=c[f];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==r+o){a=l;break}}a||(d=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.setAttribute("data-webpack",r+o),a.src=e),t[e]=[n];var s=function(n,r){a.onerror=a.onload=null,clearTimeout(b);var o=t[e];if(delete t[e],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach((function(e){return e(r)})),n)return n(r)},b=setTimeout(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),d&&document.head.appendChild(a)}},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.p="https://unpkg.com/@r2u/javascript-ar-sdk@6.23.1/dist/",function(){var e={179:0};i.f.j=function(n,t){var r=i.o(e,n)?e[n]:void 0;if(0!==r)if(r)t.push(r[2]);else{var o=new Promise((function(t,o){r=e[n]=[t,o]}));t.push(r[2]=o);var u=i.p+i.u(n),a=new Error;i.l(u,(function(t){if(i.o(e,n)&&(0!==(r=e[n])&&(e[n]=void 0),r)){var o=t&&("load"===t.type?"missing":t.type),u=t&&t.target&&t.target.src;a.message="Loading chunk "+n+" failed.\n("+o+": "+u+")",a.name="ChunkLoadError",a.type=o,a.request=u,r[1](a)}}),"chunk-"+n,n)}};var n=function(n,t){var r,o,u=t[0],a=t[1],d=t[2],c=0;if(u.some((function(n){return 0!==e[n]}))){for(r in a)i.o(a,r)&&(i.m[r]=a[r]);if(d)d(i)}for(n&&n(t);c<u.length;c++)o=u[c],i.o(e,o)&&e[o]&&e[o][0](),e[u[c]]=0},t=self.webpackChunkR2U=self.webpackChunkR2U||[];t.forEach(n.bind(null,0)),t.push=n.bind(null,t.push.bind(t))}();var a={};i.r(a),i.d(a,{init:function(){return d},sku:function(){return l},ar:function(){return f},viewer:function(){return s},analytics:function(){return b},qrCode:function(){return h},config:function(){return c}});const d=e=>Promise.all([i.e(691),i.e(665),i.e(215),i.e(410)]).then(i.bind(i,6526)).then((n=>n.default(e))),c={changeLanguage:e=>Promise.all([i.e(665),i.e(497)]).then(i.bind(i,7328)).then((n=>n.default.changeLanguage(e)))},f={open:e=>Promise.all([i.e(691),i.e(30),i.e(665),i.e(10),i.e(215),i.e(603),i.e(593),i.e(850)]).then(i.bind(i,9408)).then((n=>n.default.open(e))),attach:e=>Promise.all([i.e(691),i.e(30),i.e(665),i.e(10),i.e(215),i.e(603),i.e(593),i.e(850)]).then(i.bind(i,9408)).then((n=>n.default.attach(e))),getLink:e=>Promise.all([i.e(691),i.e(30),i.e(665),i.e(10),i.e(215),i.e(603),i.e(593),i.e(850)]).then(i.bind(i,9408)).then((n=>n.default.getLink(e)))},l={isActive:e=>Promise.all([i.e(691),i.e(465)]).then(i.bind(i,6025)).then((n=>n.default.isActive(e))),getData:e=>Promise.all([i.e(691),i.e(465)]).then(i.bind(i,6025)).then((n=>n.default.getData(e)))},s={create:e=>Promise.all([i.e(691),i.e(30),i.e(10),i.e(361),i.e(593),i.e(428)]).then(i.bind(i,8305)).then((n=>n.default.create(e)))},b={send:e=>i.e(142).then(i.bind(i,9448)).then((n=>n.default.send(e)))},h={create:e=>Promise.all([i.e(30),i.e(361),i.e(869)]).then(i.bind(i,5004)).then((n=>n.default.create(e)))};document.dispatchEvent(new CustomEvent("r2u-sdk-loaded")),window.R2U=a}();
1
+ !function(){"use strict";var e,n,t,r,o={},u={};function i(e){var n=u[e];if(void 0!==n)return n.exports;var t=u[e]={exports:{}};return o[e].call(t.exports,t,t.exports,i),t.exports}i.m=o,i.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(n,{a:n}),n},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},i.t=function(t,r){if(1&r&&(t=this(t)),8&r)return t;if("object"==typeof t&&t){if(4&r&&t.__esModule)return t;if(16&r&&"function"==typeof t.then)return t}var o=Object.create(null);i.r(o);var u={};e=e||[null,n({}),n([]),n(n)];for(var a=2&r&&t;"object"==typeof a&&!~e.indexOf(a);a=n(a))Object.getOwnPropertyNames(a).forEach((function(e){u[e]=function(){return t[e]}}));return u.default=function(){return t},i.d(o,u),o},i.d=function(e,n){for(var t in n)i.o(n,t)&&!i.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},i.f={},i.e=function(e){return Promise.all(Object.keys(i.f).reduce((function(n,t){return i.f[t](e,n),n}),[]))},i.u=function(e){return 691===e?"vendors.72e0cdbf51fef996d405.bundle.js":665===e?"vendors.6c46067ffeb7a1054cd1.bundle.js":215===e?"vendors.2864f1aaf3fa743e1983.bundle.js":410===e?"init.bundle.js":497===e?"config.bundle.js":30===e?"vendors.d0043338c48c5993c6a9.bundle.js":10===e?"vendors.74899dd75aec843bf8a8.bundle.js":603===e?"vendors.5861a640ff3844504854.bundle.js":74===e?"vendors.5a5d3beed91e455e8aa4.bundle.js":850===e?"ar.bundle.js":465===e?"sku.bundle.js":361===e?"vendors.6e3f8af05556e404968a.bundle.js":428===e?"viewer.bundle.js":142===e?"analytics.bundle.js":869===e?"qrCode.bundle.js":void 0},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t={},r="R2U:",i.l=function(e,n,o,u){if(t[e])t[e].push(n);else{var a,d;if(void 0!==o)for(var c=document.getElementsByTagName("script"),f=0;f<c.length;f++){var l=c[f];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==r+o){a=l;break}}a||(d=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.setAttribute("data-webpack",r+o),a.src=e),t[e]=[n];var s=function(n,r){a.onerror=a.onload=null,clearTimeout(b);var o=t[e];if(delete t[e],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach((function(e){return e(r)})),n)return n(r)},b=setTimeout(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),d&&document.head.appendChild(a)}},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.p="https://unpkg.com/@r2u/javascript-ar-sdk@6.23.2/dist/",function(){var e={179:0};i.f.j=function(n,t){var r=i.o(e,n)?e[n]:void 0;if(0!==r)if(r)t.push(r[2]);else{var o=new Promise((function(t,o){r=e[n]=[t,o]}));t.push(r[2]=o);var u=i.p+i.u(n),a=new Error;i.l(u,(function(t){if(i.o(e,n)&&(0!==(r=e[n])&&(e[n]=void 0),r)){var o=t&&("load"===t.type?"missing":t.type),u=t&&t.target&&t.target.src;a.message="Loading chunk "+n+" failed.\n("+o+": "+u+")",a.name="ChunkLoadError",a.type=o,a.request=u,r[1](a)}}),"chunk-"+n,n)}};var n=function(n,t){var r,o,u=t[0],a=t[1],d=t[2],c=0;if(u.some((function(n){return 0!==e[n]}))){for(r in a)i.o(a,r)&&(i.m[r]=a[r]);if(d)d(i)}for(n&&n(t);c<u.length;c++)o=u[c],i.o(e,o)&&e[o]&&e[o][0](),e[u[c]]=0},t=self.webpackChunkR2U=self.webpackChunkR2U||[];t.forEach(n.bind(null,0)),t.push=n.bind(null,t.push.bind(t))}();var a={};i.r(a),i.d(a,{init:function(){return d},sku:function(){return l},ar:function(){return f},viewer:function(){return s},analytics:function(){return b},qrCode:function(){return h},config:function(){return c}});const d=e=>Promise.all([i.e(691),i.e(665),i.e(215),i.e(410)]).then(i.bind(i,6526)).then((n=>n.default(e))),c={changeLanguage:e=>Promise.all([i.e(665),i.e(497)]).then(i.bind(i,7328)).then((n=>n.default.changeLanguage(e)))},f={open:e=>Promise.all([i.e(691),i.e(30),i.e(665),i.e(10),i.e(215),i.e(603),i.e(74),i.e(850)]).then(i.bind(i,9408)).then((n=>n.default.open(e))),attach:e=>Promise.all([i.e(691),i.e(30),i.e(665),i.e(10),i.e(215),i.e(603),i.e(74),i.e(850)]).then(i.bind(i,9408)).then((n=>n.default.attach(e))),getLink:e=>Promise.all([i.e(691),i.e(30),i.e(665),i.e(10),i.e(215),i.e(603),i.e(74),i.e(850)]).then(i.bind(i,9408)).then((n=>n.default.getLink(e)))},l={isActive:e=>Promise.all([i.e(691),i.e(74),i.e(465)]).then(i.bind(i,6025)).then((n=>n.default.isActive(e))),getData:e=>Promise.all([i.e(691),i.e(74),i.e(465)]).then(i.bind(i,6025)).then((n=>n.default.getData(e)))},s={create:e=>Promise.all([i.e(691),i.e(30),i.e(10),i.e(361),i.e(74),i.e(428)]).then(i.bind(i,8305)).then((n=>n.default.create(e)))},b={send:e=>i.e(142).then(i.bind(i,9448)).then((n=>n.default.send(e)))},h={create:e=>Promise.all([i.e(30),i.e(361),i.e(869)]).then(i.bind(i,5004)).then((n=>n.default.create(e)))};document.dispatchEvent(new CustomEvent("r2u-sdk-loaded")),window.R2U=a}();
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkR2U=self.webpackChunkR2U||[]).push([[410],{6504:function(e,n,t){t.d(n,{f2:function(){return u}});var i=t(8665),a=t(1580),s=t(5538),r=t(660),o=t(2297),c=t(2367),l=function(e,n,t,i){return new(t||(t=Promise))((function(a,s){function r(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var n;e.done?a(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(r,o)}c((i=i.apply(e,n||[])).next())}))};const u=i.Z.createInstance();n.ZP={init:({language:e})=>l(void 0,void 0,void 0,(function*(){const n=c.Z.customer.language,t=(c.Z.customer.slug,e||n||"en"),i=(0,o.Bv)(),l=["translation"];return new Promise(((e,n)=>{u.use(a.Z).init({debug:!1,react:{useSuspense:!1},lng:t,fallbackLng:!1,supportedLngs:["pt","en","es"],ns:l,defaultNS:"translation",fallbackNS:"translation",load:"currentOnly",preload:[t],interpolation:{escapeValue:!1},backend:{backends:[r.Z,s.Z],backendOptions:[{prefix:"i18next_res_r2u_sdk_",enabled:!0,expirationTime:6048e5},{loadPath:`${i}/locales/{{lng}}/{{ns}}.json`,allowMultiloading:!0}]}},(t=>{t&&n(new Error("R2U - Translation init failed")),e()}))}))}))}},6526:function(e,n,t){t.r(n),t.d(n,{default:function(){return l}});var i=t(2367),a=t(7374),s=t(2297),r=function(e,n,t,i){return new(t||(t=Promise))((function(a,s){function r(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var n;e.done?a(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(r,o)}c((i=i.apply(e,n||[])).next())}))};var o=t(6504),c=function(e,n,t,i){return new(t||(t=Promise))((function(a,s){function r(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var n;e.done?a(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(r,o)}c((i=i.apply(e,n||[])).next())}))};function l({customerId:e,language:n,analyticsParams:t={dataLayerIntegration:!0,sessionDuration:30},refreshCache:l=!1}){return c(this,void 0,void 0,(function*(){if(!/^(?=[a-f\d]{24}$)(\d+[a-f]|[a-f]+\d)/i.test(e)&&!/^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i.test(e))throw new Error(`Invalid customer '${e}'`);i.Z.init=!0,i.Z.refreshCache=l;const c=yield function(e){return r(this,void 0,void 0,(function*(){return yield(0,s.U2)(`/customers/${e}`)}))}(e),u=yield(0,a.ZP)({client:e,dataLayerIntegration:t.dataLayerIntegration,sessionDurationMinutes:t.sessionDuration});i.Z.analytics=u,i.Z.customer=c,yield Promise.all([o.ZP.init({language:n})])}))}},7374:function(e,n,t){t.d(n,{J1:function(){return u},E9:function(){return d},XH:function(){return p},ar:function(){return f},KN:function(){return w},fQ:function(){return g},hN:function(){return y},lY:function(){return v},G0:function(){return b},fm:function(){return m}});var i=t(2085),a=t(5877),s=t(2367),r=function(e,n,t,i){return new(t||(t=Promise))((function(a,s){function r(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var n;e.done?a(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(r,o)}c((i=i.apply(e,n||[])).next())}))};const o="ar_link",c="ar_model_viewer",l="cta",u={componentDidMount:()=>s.Z.analytics.send({event:i.U3.impression,data:{[i.MB.placement]:o},scope:"page"}),onClick:()=>s.Z.analytics.send({event:i.U3.click,data:{[i.MB.placement]:o}}),onFallback:()=>s.Z.analytics.send({event:i.U3.fallback,data:{[i.MB.placement]:o}}),onLike:()=>s.Z.analytics.send({event:i.U3.like,data:{[i.MB.placement]:o}}),onDislike:()=>s.Z.analytics.send({event:i.U3.dislike,data:{[i.MB.placement]:o}}),onSessionTimeCollect:e=>s.Z.analytics.send({event:i.U3.interaction_duration,eventCount:e,data:{[i.MB.placement]:o}})},d={componentDidMount:()=>s.Z.analytics.send({event:i.U3.impression,data:{[i.MB.placement]:c},scope:"page"}),onClick:()=>s.Z.analytics.send({event:i.U3.click,data:{[i.MB.placement]:c}}),onSessionTimeCollect:e=>s.Z.analytics.send({event:i.U3.interaction_duration,eventCount:e,data:{[i.MB.placement]:c}})},p={onSessionStart:()=>s.Z.analytics.webxrSend({webxrEvent:i.Ui.session_start}),onSessionEnd:()=>s.Z.analytics.webxrSend({webxrEvent:i.Ui.session_end}),setSession:()=>{s.Z.analytics.webxrSet(i.D1.session_id,(0,a.v4)())},setCompatible:e=>{s.Z.analytics.webxrSet(i.D1.compatible,`${e}`)},onSceneViewerFallback:()=>Promise.all([s.Z.analytics.webxrSend({webxrEvent:i.Ui.scene_viewer_fallback}),s.Z.analytics.send({event:i.U3.fallback,data:{[i.MB.placement]:o},context:"webxr"})]),onFallback:()=>s.Z.analytics.webxrSend({webxrEvent:i.Ui.fallback}),setPlaneMapped:()=>{s.Z.analytics.webxrSet(i.D1.plane_mapped,(new Date).toISOString())},setObjectPlaced:()=>{s.Z.analytics.webxrSet(i.D1.object_placed,(new Date).toISOString())},setTranslateInstructions:()=>{s.Z.analytics.webxrSet(i.D1.translate_instructions,(new Date).toISOString())},setRotateInstructions:()=>{s.Z.analytics.webxrSet(i.D1.rotate_instructions,(new Date).toISOString())},setFirstTranslation:()=>{s.Z.analytics.webxrSet(i.D1.first_translation,(new Date).toISOString())},setFirstRotation:()=>{s.Z.analytics.webxrSet(i.D1.first_rotation,(new Date).toISOString())},setReset:()=>{s.Z.analytics.webxrSet(i.D1.reset,(new Date).toISOString())},onShare:()=>s.Z.analytics.webxrSend({webxrEvent:i.Ui.share}),onExit:()=>s.Z.analytics.webxrSend({webxrEvent:i.Ui.exit}),onLike:()=>s.Z.analytics.webxrSend({webxrEvent:i.Ui.like}),onDislike:()=>s.Z.analytics.webxrSend({webxrEvent:i.Ui.dislike}),onCallToAction:()=>s.Z.analytics.webxrSend({webxrEvent:i.Ui.call_to_action}),onTranslation:()=>s.Z.analytics.webxrSend({webxrEvent:i.Ui.translation}),onRotation:()=>s.Z.analytics.webxrSend({webxrEvent:i.Ui.rotation})},f={onClick:()=>s.Z.analytics.send({event:i.U3.click,data:{[i.MB.placement]:l},context:"cart"})},y=e=>{s.Z.analytics.set(i.MB.sku,e)},v=e=>{s.Z.analytics.set(i.MB.manufacturer_id,e)},b=e=>{s.Z.analytics.set(i.MB.is_active_3d,`${e}`),s.Z.analytics.send({event:i.U3.product_page_view})},w=e=>{s.Z.analytics.set(i.MB.experiment_id,e)},g=e=>{s.Z.analytics.set(i.MB.variation_id,e)},m=()=>r(void 0,void 0,void 0,(function*(){const e=yield(0,i.cE)();return s.Z.analytics.set(i.MB.fingerprint,e),e}));n.ZP=({client:e,dataLayerIntegration:n,sessionDurationMinutes:t,info:a={}})=>r(void 0,void 0,void 0,(function*(){const s={version:"6.23.1",gcpAnalyticsUrl:"https://us-central1-r2u-analytics.cloudfunctions.net/reportEvent",webxrGcpAnalyticsUrl:"https://us-central1-r2u-analytics.cloudfunctions.net/reportWebXREvent",debug:!!new URLSearchParams(window.location.search).get("realidade-aumentada-debug"),sessionDurationMinutes:t,dataLayerIntegration:n},r=new i.ZP(s,Object.assign(Object.assign({},a),{[i.MB.client]:e}));return yield r.init(),r}))},2297:function(e,n,t){t.d(n,{U2:function(){return r},v_:function(){return o},Bv:function(){return c}});var i=t(2367),a=function(e,n,t,i){return new(t||(t=Promise))((function(a,s){function r(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var n;e.done?a(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(r,o)}c((i=i.apply(e,n||[])).next())}))};const s="https://api.r2u.io";function r(e){return a(this,void 0,void 0,(function*(){const n={};i.Z.refreshCache&&(n["Cache-Control"]="max-age=0");return(yield fetch(`${s}${e}`,{method:"get",headers:n})).json()}))}function o(e,n){return a(this,void 0,void 0,(function*(){return(yield fetch(`${s}${e}`,{method:"POST",body:JSON.stringify(n)})).json()}))}const c=()=>"https://sdk.r2u.io"},2367:function(e,n){const t={init:!1,customer:{_id:"",slug:"",language:"en",hdri:null,exposure:null,bloom:null,experiments:{overrides:{}},viewerOptions:{}},analytics:{set:(e,n)=>{},send:({event:e,data:n,scope:t})=>Promise.resolve()},products:{},hasAutoOpenedAR:!1,growthbook:{},refreshCache:!1};n.Z=t},4147:function(e){e.exports=JSON.parse('{"name":"@r2u/javascript-ar-sdk","version":"6.23.1","main":"dist/index.js","unpkg":"dist/index.js","types":"dist/src/index.d.ts","repository":"https://github.com/r2u-io/javascript-ar-sdk","files":["dist"],"scripts":{"dev":"yarn build:dev && webpack serve --mode=development","build:dev":"REACT_APP_VERSION=$(node -p \\"require(\'./package.json\').version\\") webpack --mode=development && yarn build:types","build":"REACT_APP_VERSION=$(jq -r \\".version\\" package.json) webpack --mode=production && yarn build:types","build:types":"tsc && npx tsc-alias","clean":"rm -rf dist/ public/dist/","test":"jest --config ./jest.config.js","stage":"yarn build:dev && gsutil -m cp -R ./public gs://r2u-integrations-bucket/_staging/sdk/","prettier":"prettier --write src","lint":"eslint \\"./src/**/*.{js,ts,tsx}\\"","eject":"rescripts eject"},"peerDependencies":{"react":"^16.13.1","react-dom":"^16.13.1"},"dependencies":{"@r2u/analytics":"^4.3.3","@r2u/react-ar-components":"^5.4.16","@r2u/viewer":"^1.13.2","@types/react-slick":"^0.23.10","i18next":"^20.2.1","i18next-chained-backend":"^2.1.0","i18next-http-backend":"^1.2.1","i18next-localstorage-backend":"^3.1.2","qrcode.react":"^1.0.1","querystring":"^0.2.0","react":"^17.0.2","react-dom":"^17.0.2","react-i18next":"^11.8.13","react-shadow":"^19.0.2","react-slick":"^0.29.0","styled-components":"^5.2.3"},"devDependencies":{"@fingerprintjs/fingerprintjs":"^3.3.0","@growthbook/growthbook":"^0.12.0","@types/jest":"^26.0.15","@types/node":"^13.11.1","@types/qrcode.react":"^1.0.1","@types/react":"^16.9.33","@types/react-dom":"^16.9.6","@types/styled-components":"^5.1.9","@typescript-eslint/eslint-plugin":"^2.3.1","@typescript-eslint/parser":"^2.3.1","eslint":"^7.22.0","eslint-config-prettier":"^6.12.0","eslint-config-standard":"^12.0.0","eslint-plugin-import":"^2.17.2","eslint-plugin-jest":"^22.17.0","eslint-plugin-node":"^8.0.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-promise":"^4.1.1","eslint-plugin-react":"^7.14.3","eslint-plugin-standard":"^4.0.0","file-loader":"^6.2.0","jest":"^24.9.0","prettier":"^2.1.2","process":"^0.11.10","three":"^0.131.2","ts-jest":"^26.4.4","ts-loader":"^8.0.17","tsc-alias":"^1.8.11","tsconfig-paths-webpack-plugin":"^3.5.1","typescript":"^3.8.3","util":"^0.12.3","webpack":"^5.24.3","webpack-bundle-analyzer":"^4.4.0","webpack-cli":"^4.5.0","webpack-dev-server":"3.10.3"},"browserslist":{"production":[">0.2%","not dead","not op_mini all"],"development":["last 1 chrome version","last 1 firefox version","last 1 safari version"]}}')}}]);
1
+ "use strict";(self.webpackChunkR2U=self.webpackChunkR2U||[]).push([[410],{6504:function(e,t,n){n.d(t,{f2:function(){return u}});var i=n(8665),r=n(1580),a=n(5538),o=n(660),s=n(2297),c=n(2367),l=function(e,t,n,i){return new(n||(n=Promise))((function(r,a){function o(e){try{c(i.next(e))}catch(e){a(e)}}function s(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((i=i.apply(e,t||[])).next())}))};const u=i.Z.createInstance();t.ZP={init:({language:e})=>l(void 0,void 0,void 0,(function*(){const t=c.Z.customer.language,n=(c.Z.customer.slug,e||t||"en"),i=(0,s.Bv)(),l=["translation"];return new Promise(((e,t)=>{u.use(r.Z).init({debug:!1,react:{useSuspense:!1},lng:n,fallbackLng:!1,supportedLngs:["pt","en","es"],ns:l,defaultNS:"translation",fallbackNS:"translation",load:"currentOnly",preload:[n],interpolation:{escapeValue:!1},backend:{backends:[o.Z,a.Z],backendOptions:[{prefix:"i18next_res_r2u_sdk_",enabled:!0,expirationTime:6048e5},{loadPath:`${i}/locales/{{lng}}/{{ns}}.json`,allowMultiloading:!0}]}},(n=>{n&&t(new Error("R2U - Translation init failed")),e()}))}))}))}},6526:function(e,t,n){n.r(t),n.d(t,{default:function(){return u}});var i=n(2367),r=n(7374),a=n(2297),o=function(e,t,n,i){return new(n||(n=Promise))((function(r,a){function o(e){try{c(i.next(e))}catch(e){a(e)}}function s(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((i=i.apply(e,t||[])).next())}))};var s=n(188),c=n(6504),l=function(e,t,n,i){return new(n||(n=Promise))((function(r,a){function o(e){try{c(i.next(e))}catch(e){a(e)}}function s(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((i=i.apply(e,t||[])).next())}))};function u({customerId:e,language:t,analyticsParams:n={dataLayerIntegration:!0,sessionDuration:30},refreshCache:u=!1}){return l(this,void 0,void 0,(function*(){if(!/^(?=[a-f\d]{24}$)(\d+[a-f]|[a-f]+\d)/i.test(e)&&!/^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i.test(e))throw new Error(`Invalid customer '${e}'`);const l=u||(0,s.x1)();i.Z.init=!0,i.Z.refreshCache=l,l&&(yield(0,s.z6)());const d=yield function(e){return o(this,void 0,void 0,(function*(){return yield(0,a.U2)(`/customers/${e}`)}))}(e),f=yield(0,r.ZP)({client:e,dataLayerIntegration:n.dataLayerIntegration,sessionDurationMinutes:n.sessionDuration});i.Z.analytics=f,i.Z.customer=d,yield Promise.all([c.ZP.init({language:t})])}))}},7374:function(e,t,n){n.d(t,{J1:function(){return u},E9:function(){return d},XH:function(){return f},ar:function(){return p},KN:function(){return w},fQ:function(){return g},hN:function(){return v},lY:function(){return y},G0:function(){return h},fm:function(){return b}});var i=n(2085),r=n(5877),a=n(2367),o=function(e,t,n,i){return new(n||(n=Promise))((function(r,a){function o(e){try{c(i.next(e))}catch(e){a(e)}}function s(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((i=i.apply(e,t||[])).next())}))};const s="ar_link",c="ar_model_viewer",l="cta",u={componentDidMount:()=>a.Z.analytics.send({event:i.U3.impression,data:{[i.MB.placement]:s},scope:"page"}),onClick:()=>a.Z.analytics.send({event:i.U3.click,data:{[i.MB.placement]:s}}),onFallback:()=>a.Z.analytics.send({event:i.U3.fallback,data:{[i.MB.placement]:s}}),onLike:()=>a.Z.analytics.send({event:i.U3.like,data:{[i.MB.placement]:s}}),onDislike:()=>a.Z.analytics.send({event:i.U3.dislike,data:{[i.MB.placement]:s}}),onSessionTimeCollect:e=>a.Z.analytics.send({event:i.U3.interaction_duration,eventCount:e,data:{[i.MB.placement]:s}})},d={componentDidMount:()=>a.Z.analytics.send({event:i.U3.impression,data:{[i.MB.placement]:c},scope:"page"}),onClick:()=>a.Z.analytics.send({event:i.U3.click,data:{[i.MB.placement]:c}}),onSessionTimeCollect:e=>a.Z.analytics.send({event:i.U3.interaction_duration,eventCount:e,data:{[i.MB.placement]:c}})},f={onSessionStart:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.session_start}),onSessionEnd:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.session_end}),setSession:()=>{a.Z.analytics.webxrSet(i.D1.session_id,(0,r.v4)())},setCompatible:e=>{a.Z.analytics.webxrSet(i.D1.compatible,`${e}`)},onSceneViewerFallback:()=>Promise.all([a.Z.analytics.webxrSend({webxrEvent:i.Ui.scene_viewer_fallback}),a.Z.analytics.send({event:i.U3.fallback,data:{[i.MB.placement]:s},context:"webxr"})]),onFallback:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.fallback}),setPlaneMapped:()=>{a.Z.analytics.webxrSet(i.D1.plane_mapped,(new Date).toISOString())},setObjectPlaced:()=>{a.Z.analytics.webxrSet(i.D1.object_placed,(new Date).toISOString())},setTranslateInstructions:()=>{a.Z.analytics.webxrSet(i.D1.translate_instructions,(new Date).toISOString())},setRotateInstructions:()=>{a.Z.analytics.webxrSet(i.D1.rotate_instructions,(new Date).toISOString())},setFirstTranslation:()=>{a.Z.analytics.webxrSet(i.D1.first_translation,(new Date).toISOString())},setFirstRotation:()=>{a.Z.analytics.webxrSet(i.D1.first_rotation,(new Date).toISOString())},setReset:()=>{a.Z.analytics.webxrSet(i.D1.reset,(new Date).toISOString())},onShare:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.share}),onExit:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.exit}),onLike:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.like}),onDislike:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.dislike}),onCallToAction:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.call_to_action}),onTranslation:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.translation}),onRotation:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.rotation})},p={onClick:()=>a.Z.analytics.send({event:i.U3.click,data:{[i.MB.placement]:l},context:"cart"})},v=e=>{a.Z.analytics.set(i.MB.sku,e)},y=e=>{a.Z.analytics.set(i.MB.manufacturer_id,e)},h=e=>{a.Z.analytics.set(i.MB.is_active_3d,`${e}`),a.Z.analytics.send({event:i.U3.product_page_view})},w=e=>{a.Z.analytics.set(i.MB.experiment_id,e)},g=e=>{a.Z.analytics.set(i.MB.variation_id,e)},b=()=>o(void 0,void 0,void 0,(function*(){const e=yield(0,i.cE)();return a.Z.analytics.set(i.MB.fingerprint,e),e}));t.ZP=({client:e,dataLayerIntegration:t,sessionDurationMinutes:n,info:r={}})=>o(void 0,void 0,void 0,(function*(){const a={version:"6.23.2",gcpAnalyticsUrl:"https://us-central1-r2u-analytics.cloudfunctions.net/reportEvent",webxrGcpAnalyticsUrl:"https://us-central1-r2u-analytics.cloudfunctions.net/reportWebXREvent",debug:!!new URLSearchParams(window.location.search).get("realidade-aumentada-debug"),sessionDurationMinutes:n,dataLayerIntegration:t},o=new i.ZP(a,Object.assign(Object.assign({},r),{[i.MB.client]:e}));return yield o.init(),o}))},188:function(e,t,n){n.d(t,{Lu:function(){return d},x1:function(){return f},z6:function(){return u},vj:function(){return l}});var i=function(e,t,n,i){return new(n||(n=Promise))((function(r,a){function o(e){try{c(i.next(e))}catch(e){a(e)}}function s(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((i=i.apply(e,t||[])).next())}))};var r=function(e,t,n,i){return new(n||(n=Promise))((function(r,a){function o(e){try{c(i.next(e))}catch(e){a(e)}}function s(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((i=i.apply(e,t||[])).next())}))};const a="r2u-sdk-cache",o=new Map,s={get(e){try{return localStorage.getItem(e)}catch(e){return null}},set(e,t){try{localStorage.setItem(e,t)}catch(e){}},remove(e){try{localStorage.removeItem(e)}catch(e){}}};function c(e){return r(this,void 0,void 0,(function*(){return`r2u-sdk-cache-v6.23.2-${yield function(e){return i(this,void 0,void 0,(function*(){try{const t=(new TextEncoder).encode(e),n=yield crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map((e=>e.toString(16).padStart(2,"0"))).join("")}catch(t){return e}}))}(e)}`}))}function l(e){return r(this,void 0,void 0,(function*(){const{path:t,value:n,status:i="ok"}=e,r="notfound"===i?3e4:3e5,a=yield c(t),o={value:n,expiresAt:Date.now()+r};s.set(a,JSON.stringify(o))}))}function u(e){return r(this,void 0,void 0,(function*(){if(e)return s.remove(yield c(e)),void o.delete(e);o.clear();try{for(let e=localStorage.length-1;e>=0;e-=1){const t=localStorage.key(e);t&&t.startsWith(a)&&localStorage.removeItem(t)}}catch(e){}}))}function d(e){return r(this,void 0,void 0,(function*(){const{path:t,fetcher:n,options:i={}}=e;if(!i.refreshCache){const e=yield function(e){return r(this,void 0,void 0,(function*(){const t=s.get(yield c(e));if(t)try{const n=JSON.parse(t);return n.expiresAt<Date.now()?void s.remove(yield c(e)):n.value}catch(t){return void s.remove(yield c(e))}}))}(t);if(void 0!==e)return e}const a=o.get(t);if(a)return a;const l=function(e){return r(this,void 0,void 0,(function*(){try{return yield e.fetcher()}finally{o.delete(e.path)}}))}({path:t,fetcher:n});return o.set(t,l),l}))}function f(){try{return"true"===sessionStorage.getItem("r2u-sdk-refresh-cache")}catch(e){return!1}}},2297:function(e,t,n){n.d(t,{U2:function(){return c},v_:function(){return l},Bv:function(){return u}});var i=n(2367),r=n(188),a=function(e,t,n,i){return new(n||(n=Promise))((function(r,a){function o(e){try{c(i.next(e))}catch(e){a(e)}}function s(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((i=i.apply(e,t||[])).next())}))};const o="https://api.r2u.io";function s(e){return a(this,void 0,void 0,(function*(){const t={};i.Z.refreshCache&&(t["Cache-Control"]="max-age=0");const n=yield fetch(`${o}${e}`,{method:"get",headers:t});if(!n.ok&&404!==n.status)throw new Error(`R2U - HTTP ${n.status}`);const a=yield n.json();return yield(0,r.vj)({path:e,value:a,status:404===n.status?"notfound":"ok"}),a}))}function c(e){return a(this,void 0,void 0,(function*(){return(0,r.Lu)({path:e,fetcher:s.bind(null,e),options:{refreshCache:i.Z.refreshCache}})}))}function l(e,t){return a(this,void 0,void 0,(function*(){return(yield fetch(`${o}${e}`,{method:"POST",body:JSON.stringify(t)})).json()}))}const u=()=>"https://sdk.r2u.io"},2367:function(e,t){const n={init:!1,customer:{_id:"",slug:"",language:"en",hdri:null,exposure:null,bloom:null,experiments:{overrides:{}},viewerOptions:{}},analytics:{set:(e,t)=>{},send:({event:e,data:t,scope:n})=>Promise.resolve()},products:{},hasAutoOpenedAR:!1,growthbook:{},refreshCache:!1};t.Z=n},4147:function(e){e.exports=JSON.parse('{"name":"@r2u/javascript-ar-sdk","version":"6.23.2","main":"dist/index.js","unpkg":"dist/index.js","types":"dist/src/index.d.ts","repository":"https://github.com/r2u-io/javascript-ar-sdk","files":["dist"],"scripts":{"dev":"yarn build:dev && webpack serve --mode=development","dev:watch":"REACT_APP_VERSION=$(node -p \\"require(\'./package.json\').version\\") webpack serve --mode=development","build:dev":"REACT_APP_VERSION=$(node -p \\"require(\'./package.json\').version\\") webpack --mode=development && yarn build:types","build":"REACT_APP_VERSION=$(jq -r \\".version\\" package.json) webpack --mode=production && yarn build:types","build:types":"tsc && npx tsc-alias","clean":"rm -rf dist/ public/dist/","test":"jest --config ./jest.config.js","stage":"yarn build:dev && gsutil -m cp -R ./public gs://r2u-integrations-bucket/_staging/sdk/","prettier":"prettier --write src","lint":"eslint \\"./src/**/*.{js,ts,tsx}\\"","eject":"rescripts eject"},"peerDependencies":{"react":"^16.13.1","react-dom":"^16.13.1"},"dependencies":{"@r2u/analytics":"^4.3.3","@r2u/react-ar-components":"^5.4.16","@r2u/viewer":"^1.13.2","@types/react-slick":"^0.23.10","i18next":"^20.2.1","i18next-chained-backend":"^2.1.0","i18next-http-backend":"^1.2.1","i18next-localstorage-backend":"^3.1.2","qrcode.react":"^1.0.1","querystring":"^0.2.0","react":"^17.0.2","react-dom":"^17.0.2","react-i18next":"^11.8.13","react-shadow":"^19.0.2","react-slick":"^0.29.0","styled-components":"^5.2.3"},"devDependencies":{"@fingerprintjs/fingerprintjs":"^3.3.0","@growthbook/growthbook":"^0.12.0","@types/jest":"^26.0.15","@types/node":"^13.11.1","@types/qrcode.react":"^1.0.1","@types/react":"^16.9.33","@types/react-dom":"^16.9.6","@types/styled-components":"^5.1.9","@typescript-eslint/eslint-plugin":"^2.3.1","@typescript-eslint/parser":"^2.3.1","eslint":"^7.22.0","eslint-config-prettier":"^6.12.0","eslint-config-standard":"^12.0.0","eslint-plugin-import":"^2.17.2","eslint-plugin-jest":"^22.17.0","eslint-plugin-node":"^8.0.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-promise":"^4.1.1","eslint-plugin-react":"^7.14.3","eslint-plugin-standard":"^4.0.0","file-loader":"^6.2.0","jest":"^24.9.0","prettier":"^2.1.2","process":"^0.11.10","three":"^0.131.2","ts-jest":"^26.4.4","ts-loader":"^8.0.17","tsc-alias":"^1.8.11","tsconfig-paths-webpack-plugin":"^3.5.1","typescript":"^3.8.3","util":"^0.12.3","webpack":"^5.24.3","webpack-bundle-analyzer":"^4.4.0","webpack-cli":"^4.5.0","webpack-dev-server":"3.10.3"},"browserslist":{"production":[">0.2%","not dead","not op_mini all"],"development":["last 1 chrome version","last 1 firefox version","last 1 safari version"]}}')}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkR2U=self.webpackChunkR2U||[]).push([[465],{2587:function(e){function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,n,i,r){n=n||"&",i=i||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(n);var o=1e3;r&&"number"==typeof r.maxKeys&&(o=r.maxKeys);var c=e.length;o>0&&c>o&&(c=o);for(var l=0;l<c;++l){var u,d,p,f,v=e[l].replace(s,"%20"),y=v.indexOf(i);y>=0?(u=v.substr(0,y),d=v.substr(y+1)):(u=v,d=""),p=decodeURIComponent(u),f=decodeURIComponent(d),t(a,p)?Array.isArray(a[p])?a[p].push(f):a[p]=[a[p],f]:a[p]=f}return a}},2361:function(e){var t=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,n,i,r){return n=n||"&",i=i||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map((function(r){var a=encodeURIComponent(t(r))+i;return Array.isArray(e[r])?e[r].map((function(e){return a+encodeURIComponent(t(e))})).join(n):a+encodeURIComponent(t(e[r]))})).filter(Boolean).join(n):r?encodeURIComponent(t(r))+i+encodeURIComponent(t(e)):""}},7673:function(e,t,n){t.decode=t.parse=n(2587),t.encode=t.stringify=n(2361)},6025:function(e,t,n){n.r(t);var i=n(2367),r=n(7523),a=n(7374),s=function(e,t,n,i){return new(n||(n=Promise))((function(r,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}c((i=i.apply(e,t||[])).next())}))};t.default={isActive:function(e){return s(this,void 0,void 0,(function*(){if(!i.Z.init)return Promise.reject(new Error("R2U - Not initialized"));if(!e)return Promise.reject(new Error("R2U - Missing SKU"));a.hN(e);try{const{isActive:t,manufacturerId:n}=yield(0,r.Z)(e);return n&&a.lY(n),a.G0(t),t}catch(e){return!1}}))},getData:function(e){return s(this,void 0,void 0,(function*(){if(!i.Z.init)return Promise.reject(new Error("R2U - Not initialized"));if(!e)return Promise.reject(new Error("R2U - Missing SKU"));return yield(0,r.Z)(e)}))}}},7374:function(e,t,n){n.d(t,{J1:function(){return u},E9:function(){return d},XH:function(){return p},ar:function(){return f},KN:function(){return m},fQ:function(){return w},hN:function(){return v},lY:function(){return y},G0:function(){return b},fm:function(){return x}});var i=n(2085),r=n(5877),a=n(2367),s=function(e,t,n,i){return new(n||(n=Promise))((function(r,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}c((i=i.apply(e,t||[])).next())}))};const o="ar_link",c="ar_model_viewer",l="cta",u={componentDidMount:()=>a.Z.analytics.send({event:i.U3.impression,data:{[i.MB.placement]:o},scope:"page"}),onClick:()=>a.Z.analytics.send({event:i.U3.click,data:{[i.MB.placement]:o}}),onFallback:()=>a.Z.analytics.send({event:i.U3.fallback,data:{[i.MB.placement]:o}}),onLike:()=>a.Z.analytics.send({event:i.U3.like,data:{[i.MB.placement]:o}}),onDislike:()=>a.Z.analytics.send({event:i.U3.dislike,data:{[i.MB.placement]:o}}),onSessionTimeCollect:e=>a.Z.analytics.send({event:i.U3.interaction_duration,eventCount:e,data:{[i.MB.placement]:o}})},d={componentDidMount:()=>a.Z.analytics.send({event:i.U3.impression,data:{[i.MB.placement]:c},scope:"page"}),onClick:()=>a.Z.analytics.send({event:i.U3.click,data:{[i.MB.placement]:c}}),onSessionTimeCollect:e=>a.Z.analytics.send({event:i.U3.interaction_duration,eventCount:e,data:{[i.MB.placement]:c}})},p={onSessionStart:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.session_start}),onSessionEnd:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.session_end}),setSession:()=>{a.Z.analytics.webxrSet(i.D1.session_id,(0,r.v4)())},setCompatible:e=>{a.Z.analytics.webxrSet(i.D1.compatible,`${e}`)},onSceneViewerFallback:()=>Promise.all([a.Z.analytics.webxrSend({webxrEvent:i.Ui.scene_viewer_fallback}),a.Z.analytics.send({event:i.U3.fallback,data:{[i.MB.placement]:o},context:"webxr"})]),onFallback:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.fallback}),setPlaneMapped:()=>{a.Z.analytics.webxrSet(i.D1.plane_mapped,(new Date).toISOString())},setObjectPlaced:()=>{a.Z.analytics.webxrSet(i.D1.object_placed,(new Date).toISOString())},setTranslateInstructions:()=>{a.Z.analytics.webxrSet(i.D1.translate_instructions,(new Date).toISOString())},setRotateInstructions:()=>{a.Z.analytics.webxrSet(i.D1.rotate_instructions,(new Date).toISOString())},setFirstTranslation:()=>{a.Z.analytics.webxrSet(i.D1.first_translation,(new Date).toISOString())},setFirstRotation:()=>{a.Z.analytics.webxrSet(i.D1.first_rotation,(new Date).toISOString())},setReset:()=>{a.Z.analytics.webxrSet(i.D1.reset,(new Date).toISOString())},onShare:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.share}),onExit:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.exit}),onLike:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.like}),onDislike:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.dislike}),onCallToAction:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.call_to_action}),onTranslation:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.translation}),onRotation:()=>a.Z.analytics.webxrSend({webxrEvent:i.Ui.rotation})},f={onClick:()=>a.Z.analytics.send({event:i.U3.click,data:{[i.MB.placement]:l},context:"cart"})},v=e=>{a.Z.analytics.set(i.MB.sku,e)},y=e=>{a.Z.analytics.set(i.MB.manufacturer_id,e)},b=e=>{a.Z.analytics.set(i.MB.is_active_3d,`${e}`),a.Z.analytics.send({event:i.U3.product_page_view})},m=e=>{a.Z.analytics.set(i.MB.experiment_id,e)},w=e=>{a.Z.analytics.set(i.MB.variation_id,e)},x=()=>s(void 0,void 0,void 0,(function*(){const e=yield(0,i.cE)();return a.Z.analytics.set(i.MB.fingerprint,e),e}));t.ZP=({client:e,dataLayerIntegration:t,sessionDurationMinutes:n,info:r={}})=>s(void 0,void 0,void 0,(function*(){const a={version:"6.23.1",gcpAnalyticsUrl:"https://us-central1-r2u-analytics.cloudfunctions.net/reportEvent",webxrGcpAnalyticsUrl:"https://us-central1-r2u-analytics.cloudfunctions.net/reportWebXREvent",debug:!!new URLSearchParams(window.location.search).get("realidade-aumentada-debug"),sessionDurationMinutes:n,dataLayerIntegration:t},s=new i.ZP(a,Object.assign(Object.assign({},r),{[i.MB.client]:e}));return yield s.init(),s}))},7523:function(e,t,n){n.d(t,{Z:function(){return o}});var i=n(2297),r=n(2367),a=n(7673),s=function(e,t,n,i){return new(n||(n=Promise))((function(r,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}c((i=i.apply(e,t||[])).next())}))};function o(e){return s(this,void 0,void 0,(function*(){if(r.Z.products[e])return Promise.resolve(r.Z.products[e]);const t=a.encode({"product.sku":e,"asset.types":["GLB","USDZ"].join(","),"product_review.status":"RUNNING"}),[n]=yield(0,i.U2)(`/customers/${r.Z.customer._id}/products/assets?${t}`);if(!n)throw new Error("R2U - SKU not found");const s=n.assets||[],o=n.product_reviews||[],c=s.find((e=>"GLB"===e.type)),l=s.find((e=>"USDZ"===e.type)),u={glb:c?c.url:"",usdz:l?l.url:"",isActive:o.length>0,name:n.name,placement:n.placement||"floor",resize:n.resize||!1,sound:n.soundUrl,modelId:n.modelId,manufacturerId:n.manufacturerId,pdpUrl:n.pdpUrl,hdri:n.hdri,exposure:n.exposure,bloom:n.bloom,viewerOptions:n.viewerOptions||{}};return r.Z.products[e]=u,u}))}},2297:function(e,t,n){n.d(t,{U2:function(){return s},v_:function(){return o},Bv:function(){return c}});var i=n(2367),r=function(e,t,n,i){return new(n||(n=Promise))((function(r,a){function s(e){try{c(i.next(e))}catch(e){a(e)}}function o(e){try{c(i.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}c((i=i.apply(e,t||[])).next())}))};const a="https://api.r2u.io";function s(e){return r(this,void 0,void 0,(function*(){const t={};i.Z.refreshCache&&(t["Cache-Control"]="max-age=0");return(yield fetch(`${a}${e}`,{method:"get",headers:t})).json()}))}function o(e,t){return r(this,void 0,void 0,(function*(){return(yield fetch(`${a}${e}`,{method:"POST",body:JSON.stringify(t)})).json()}))}const c=()=>"https://sdk.r2u.io"},2367:function(e,t){const n={init:!1,customer:{_id:"",slug:"",language:"en",hdri:null,exposure:null,bloom:null,experiments:{overrides:{}},viewerOptions:{}},analytics:{set:(e,t)=>{},send:({event:e,data:t,scope:n})=>Promise.resolve()},products:{},hasAutoOpenedAR:!1,growthbook:{},refreshCache:!1};t.Z=n},4147:function(e){e.exports=JSON.parse('{"name":"@r2u/javascript-ar-sdk","version":"6.23.1","main":"dist/index.js","unpkg":"dist/index.js","types":"dist/src/index.d.ts","repository":"https://github.com/r2u-io/javascript-ar-sdk","files":["dist"],"scripts":{"dev":"yarn build:dev && webpack serve --mode=development","build:dev":"REACT_APP_VERSION=$(node -p \\"require(\'./package.json\').version\\") webpack --mode=development && yarn build:types","build":"REACT_APP_VERSION=$(jq -r \\".version\\" package.json) webpack --mode=production && yarn build:types","build:types":"tsc && npx tsc-alias","clean":"rm -rf dist/ public/dist/","test":"jest --config ./jest.config.js","stage":"yarn build:dev && gsutil -m cp -R ./public gs://r2u-integrations-bucket/_staging/sdk/","prettier":"prettier --write src","lint":"eslint \\"./src/**/*.{js,ts,tsx}\\"","eject":"rescripts eject"},"peerDependencies":{"react":"^16.13.1","react-dom":"^16.13.1"},"dependencies":{"@r2u/analytics":"^4.3.3","@r2u/react-ar-components":"^5.4.16","@r2u/viewer":"^1.13.2","@types/react-slick":"^0.23.10","i18next":"^20.2.1","i18next-chained-backend":"^2.1.0","i18next-http-backend":"^1.2.1","i18next-localstorage-backend":"^3.1.2","qrcode.react":"^1.0.1","querystring":"^0.2.0","react":"^17.0.2","react-dom":"^17.0.2","react-i18next":"^11.8.13","react-shadow":"^19.0.2","react-slick":"^0.29.0","styled-components":"^5.2.3"},"devDependencies":{"@fingerprintjs/fingerprintjs":"^3.3.0","@growthbook/growthbook":"^0.12.0","@types/jest":"^26.0.15","@types/node":"^13.11.1","@types/qrcode.react":"^1.0.1","@types/react":"^16.9.33","@types/react-dom":"^16.9.6","@types/styled-components":"^5.1.9","@typescript-eslint/eslint-plugin":"^2.3.1","@typescript-eslint/parser":"^2.3.1","eslint":"^7.22.0","eslint-config-prettier":"^6.12.0","eslint-config-standard":"^12.0.0","eslint-plugin-import":"^2.17.2","eslint-plugin-jest":"^22.17.0","eslint-plugin-node":"^8.0.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-promise":"^4.1.1","eslint-plugin-react":"^7.14.3","eslint-plugin-standard":"^4.0.0","file-loader":"^6.2.0","jest":"^24.9.0","prettier":"^2.1.2","process":"^0.11.10","three":"^0.131.2","ts-jest":"^26.4.4","ts-loader":"^8.0.17","tsc-alias":"^1.8.11","tsconfig-paths-webpack-plugin":"^3.5.1","typescript":"^3.8.3","util":"^0.12.3","webpack":"^5.24.3","webpack-bundle-analyzer":"^4.4.0","webpack-cli":"^4.5.0","webpack-dev-server":"3.10.3"},"browserslist":{"production":[">0.2%","not dead","not op_mini all"],"development":["last 1 chrome version","last 1 firefox version","last 1 safari version"]}}')}}]);
1
+ "use strict";(self.webpackChunkR2U=self.webpackChunkR2U||[]).push([[465],{2587:function(e){function n(e,n){return Object.prototype.hasOwnProperty.call(e,n)}e.exports=function(e,r,t,o){r=r||"&",t=t||"=";var i={};if("string"!=typeof e||0===e.length)return i;var u=/\+/g;e=e.split(r);var c=1e3;o&&"number"==typeof o.maxKeys&&(c=o.maxKeys);var a=e.length;c>0&&a>c&&(a=c);for(var s=0;s<a;++s){var f,p,d,l,y=e[s].replace(u,"%20"),m=y.indexOf(t);m>=0?(f=y.substr(0,m),p=y.substr(m+1)):(f=y,p=""),d=decodeURIComponent(f),l=decodeURIComponent(p),n(i,d)?Array.isArray(i[d])?i[d].push(l):i[d]=[i[d],l]:i[d]=l}return i}},2361:function(e){var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,r,t,o){return r=r||"&",t=t||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map((function(o){var i=encodeURIComponent(n(o))+t;return Array.isArray(e[o])?e[o].map((function(e){return i+encodeURIComponent(n(e))})).join(r):i+encodeURIComponent(n(e[o]))})).filter(Boolean).join(r):o?encodeURIComponent(n(o))+t+encodeURIComponent(n(e)):""}},7673:function(e,n,r){n.decode=n.parse=r(2587),n.encode=n.stringify=r(2361)},6025:function(e,n,r){r.r(n);var t=r(2367),o=r(7523),i=r(7374),u=function(e,n,r,t){return new(r||(r=Promise))((function(o,i){function u(e){try{a(t.next(e))}catch(e){i(e)}}function c(e){try{a(t.throw(e))}catch(e){i(e)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(u,c)}a((t=t.apply(e,n||[])).next())}))};n.default={isActive:function(e){return u(this,void 0,void 0,(function*(){if(!t.Z.init)return Promise.reject(new Error("R2U - Not initialized"));if(!e)return Promise.reject(new Error("R2U - Missing SKU"));i.hN(e);try{const{isActive:n,manufacturerId:r}=yield(0,o.Z)(e);return r&&i.lY(r),i.G0(n),n}catch(e){return!1}}))},getData:function(e){return u(this,void 0,void 0,(function*(){if(!t.Z.init)return Promise.reject(new Error("R2U - Not initialized"));if(!e)return Promise.reject(new Error("R2U - Missing SKU"));return yield(0,o.Z)(e)}))}}}}]);
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import state from '../state';
11
11
  import getAnalytics from '../services/analytics';
12
12
  import { getCustomer } from '../services/customer';
13
+ import { getSessionRefreshCache, invalidate as invalidateRequestCache, } from '../services/cache';
13
14
  import i18n from '../config/i18n';
14
15
  export default function init({ customerId, language, analyticsParams = {
15
16
  dataLayerIntegration: true,
@@ -21,23 +22,12 @@ export default function init({ customerId, language, analyticsParams = {
21
22
  if (!ObjectIdRegex.test(customerId) && !UUIDv4Regex.test(customerId)) {
22
23
  throw new Error(`Invalid customer '${customerId}'`);
23
24
  }
25
+ const shouldRefreshCache = refreshCache || getSessionRefreshCache();
24
26
  state.init = true;
25
- state.refreshCache = refreshCache;
27
+ state.refreshCache = shouldRefreshCache;
28
+ if (shouldRefreshCache)
29
+ yield invalidateRequestCache();
26
30
  const customer = yield getCustomer(customerId);
27
- // Uncomment block to run a growthbook experiment
28
- // Remember to change values to current running experiment
29
- // const userId = await getUserId()
30
- // state.growthbook = new GrowthBook({
31
- // user: {
32
- // id: userId,
33
- // },
34
- // overrides: customer.experiments.overrides,
35
- // })
36
- // const experimentId = 'experiment-id'
37
- // const { value: variationId } = state.growthbook.run({
38
- // key: experimentId,
39
- // variations: ['A', 'B', 'C'],
40
- // })
41
31
  const analytics = yield getAnalytics({
42
32
  client: customerId,
43
33
  dataLayerIntegration: analyticsParams.dataLayerIntegration,
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/methods/init.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,UAAU,CAAA;AAE5B,OAAO,YAAY,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,IAAI,MAAM,gBAAgB,CAAA;AAYjC,MAAM,CAAC,OAAO,UAAgB,IAAI,CAAC,EACjC,UAAU,EACV,QAAQ,EACR,eAAe,GAAG;IAChB,oBAAoB,EAAE,IAAI;IAC1B,eAAe,EAAE,EAAE;CACpB,EACD,YAAY,GAAG,KAAK,GACb;;QACP,MAAM,aAAa,GAAG,uCAAuC,CAAA;QAC7D,MAAM,WAAW,GACf,0EAA0E,CAAA;QAC5E,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YACpE,MAAM,IAAI,KAAK,CAAC,qBAAqB,UAAU,GAAG,CAAC,CAAA;SACpD;QAED,KAAK,CAAC,IAAI,GAAG,IAAI,CAAA;QACjB,KAAK,CAAC,YAAY,GAAG,YAAY,CAAA;QAEjC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,UAAU,CAAC,CAAA;QAE9C,iDAAiD;QACjD,0DAA0D;QAE1D,mCAAmC;QAEnC,sCAAsC;QACtC,YAAY;QACZ,kBAAkB;QAClB,OAAO;QACP,+CAA+C;QAC/C,KAAK;QAEL,uCAAuC;QACvC,wDAAwD;QACxD,uBAAuB;QACvB,iCAAiC;QACjC,KAAK;QAEL,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC;YACnC,MAAM,EAAE,UAAU;YAClB,oBAAoB,EAAE,eAAe,CAAC,oBAAoB;YAC1D,sBAAsB,EAAE,eAAe,CAAC,eAAe;SAMxD,CAAC,CAAA;QAEF,KAAK,CAAC,SAAS,GAAG,SAAS,CAAA;QAC3B,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAA;QAEzB,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;IAC9C,CAAC;CAAA"}
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/methods/init.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,UAAU,CAAA;AAE5B,OAAO,YAAY,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EACL,sBAAsB,EACtB,UAAU,IAAI,sBAAsB,GACrC,MAAM,iBAAiB,CAAA;AAExB,OAAO,IAAI,MAAM,gBAAgB,CAAA;AAYjC,MAAM,CAAC,OAAO,UAAgB,IAAI,CAAC,EACjC,UAAU,EACV,QAAQ,EACR,eAAe,GAAG;IAChB,oBAAoB,EAAE,IAAI;IAC1B,eAAe,EAAE,EAAE;CACpB,EACD,YAAY,GAAG,KAAK,GACb;;QACP,MAAM,aAAa,GAAG,uCAAuC,CAAA;QAC7D,MAAM,WAAW,GACf,0EAA0E,CAAA;QAC5E,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YACpE,MAAM,IAAI,KAAK,CAAC,qBAAqB,UAAU,GAAG,CAAC,CAAA;SACpD;QAED,MAAM,kBAAkB,GAAG,YAAY,IAAI,sBAAsB,EAAE,CAAA;QAEnE,KAAK,CAAC,IAAI,GAAG,IAAI,CAAA;QACjB,KAAK,CAAC,YAAY,GAAG,kBAAkB,CAAA;QAEvC,IAAI,kBAAkB;YAAE,MAAM,sBAAsB,EAAE,CAAA;QAEtD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,UAAU,CAAC,CAAA;QAE9C,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC;YACnC,MAAM,EAAE,UAAU;YAClB,oBAAoB,EAAE,eAAe,CAAC,oBAAoB;YAC1D,sBAAsB,EAAE,eAAe,CAAC,eAAe;SACxD,CAAC,CAAA;QAEF,KAAK,CAAC,SAAS,GAAG,SAAS,CAAA;QAC3B,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAA;QAEzB,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;IAC9C,CAAC;CAAA"}
@@ -0,0 +1,18 @@
1
+ export declare function readCache(path: string): Promise<unknown | undefined>;
2
+ interface WriteCacheArgs {
3
+ path: string;
4
+ value: unknown;
5
+ status?: 'ok' | 'notfound';
6
+ }
7
+ export declare function writeCache(args: WriteCacheArgs): Promise<void>;
8
+ export declare function invalidate(path?: string): Promise<void>;
9
+ interface DedupedFetchArgs<T> {
10
+ path: string;
11
+ fetcher: () => Promise<T>;
12
+ options?: {
13
+ refreshCache?: boolean;
14
+ };
15
+ }
16
+ export declare function dedupedFetch<T>(args: DedupedFetchArgs<T>): Promise<T>;
17
+ export declare function getSessionRefreshCache(): boolean;
18
+ export {};
@@ -0,0 +1,133 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { generateSHA256 } from '../../src/utils/generateSHA256';
11
+ const LS_PREFIX_PROJECT = 'r2u-sdk-cache';
12
+ const LS_PREFIX_VERSION = `v${process.env.REACT_APP_VERSION}`;
13
+ const LS_PREFIX = `${LS_PREFIX_PROJECT}-${LS_PREFIX_VERSION}`;
14
+ const TTL_OK_MS = 5 * 60 * 1000;
15
+ const TTL_NOTFOUND_MS = 30 * 1000;
16
+ const SESSION_REFRESH_CACHE_KEY = 'r2u-sdk-refresh-cache';
17
+ const pendingPromisesMap = new Map();
18
+ const safeLS = {
19
+ get(key) {
20
+ try {
21
+ return localStorage.getItem(key);
22
+ }
23
+ catch (_a) {
24
+ return null;
25
+ }
26
+ },
27
+ set(key, value) {
28
+ try {
29
+ localStorage.setItem(key, value);
30
+ }
31
+ catch (_a) {
32
+ // noop - window.localStorage not available in some environments
33
+ }
34
+ },
35
+ remove(key) {
36
+ try {
37
+ localStorage.removeItem(key);
38
+ }
39
+ catch (_a) {
40
+ // noop - window.localStorage not available in some environments
41
+ }
42
+ },
43
+ };
44
+ function hashKey(path) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ const hash = yield generateSHA256(path);
47
+ return `${LS_PREFIX}-${hash}`;
48
+ });
49
+ }
50
+ export function readCache(path) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ const raw = safeLS.get(yield hashKey(path));
53
+ if (!raw)
54
+ return undefined;
55
+ try {
56
+ const entry = JSON.parse(raw);
57
+ if (entry.expiresAt < Date.now()) {
58
+ safeLS.remove(yield hashKey(path));
59
+ return undefined;
60
+ }
61
+ return entry.value;
62
+ }
63
+ catch (_a) {
64
+ safeLS.remove(yield hashKey(path));
65
+ return undefined;
66
+ }
67
+ });
68
+ }
69
+ export function writeCache(args) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ const { path, value, status = 'ok' } = args;
72
+ const ttl = status === 'notfound' ? TTL_NOTFOUND_MS : TTL_OK_MS;
73
+ const key = yield hashKey(path);
74
+ const entry = { value, expiresAt: Date.now() + ttl };
75
+ safeLS.set(key, JSON.stringify(entry));
76
+ });
77
+ }
78
+ export function invalidate(path) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ if (path) {
81
+ safeLS.remove(yield hashKey(path));
82
+ pendingPromisesMap.delete(path);
83
+ return;
84
+ }
85
+ pendingPromisesMap.clear();
86
+ try {
87
+ for (let i = localStorage.length - 1; i >= 0; i -= 1) {
88
+ const key = localStorage.key(i);
89
+ if (key && key.startsWith(LS_PREFIX_PROJECT))
90
+ localStorage.removeItem(key);
91
+ }
92
+ }
93
+ catch (_a) {
94
+ // noop
95
+ }
96
+ });
97
+ }
98
+ function createFetchPromise(args) {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ try {
101
+ const response = yield args.fetcher();
102
+ return response;
103
+ }
104
+ finally {
105
+ pendingPromisesMap.delete(args.path);
106
+ }
107
+ });
108
+ }
109
+ export function dedupedFetch(args) {
110
+ return __awaiter(this, void 0, void 0, function* () {
111
+ const { path, fetcher, options = {} } = args;
112
+ if (!options.refreshCache) {
113
+ const cached = yield readCache(path);
114
+ if (cached !== undefined)
115
+ return cached;
116
+ }
117
+ const pending = pendingPromisesMap.get(path);
118
+ if (pending)
119
+ return pending;
120
+ const promise = createFetchPromise({ path, fetcher });
121
+ pendingPromisesMap.set(path, promise);
122
+ return promise;
123
+ });
124
+ }
125
+ export function getSessionRefreshCache() {
126
+ try {
127
+ return sessionStorage.getItem(SESSION_REFRESH_CACHE_KEY) === 'true';
128
+ }
129
+ catch (_a) {
130
+ return false;
131
+ }
132
+ }
133
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/services/cache.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAOzD,MAAM,iBAAiB,GAAG,eAAe,CAAA;AACzC,MAAM,iBAAiB,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAA;AAC7D,MAAM,SAAS,GAAG,GAAG,iBAAiB,IAAI,iBAAiB,EAAE,CAAA;AAE7D,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA;AAC/B,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,CAAA;AAEjC,MAAM,yBAAyB,GAAG,uBAAuB,CAAA;AAEzD,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAA4B,CAAA;AAE9D,MAAM,MAAM,GAAG;IACb,GAAG,CAAC,GAAW;QACb,IAAI;YACF,OAAO,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;SACjC;QAAC,WAAM;YACN,OAAO,IAAI,CAAA;SACZ;IACH,CAAC;IACD,GAAG,CAAC,GAAW,EAAE,KAAa;QAC5B,IAAI;YACF,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;SACjC;QAAC,WAAM;YACN,gEAAgE;SACjE;IACH,CAAC;IACD,MAAM,CAAC,GAAW;QAChB,IAAI;YACF,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;SAC7B;QAAC,WAAM;YACN,gEAAgE;SACjE;IACH,CAAC;CACF,CAAA;AAED,SAAe,OAAO,CAAC,IAAY;;QACjC,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,CAAA;QACvC,OAAO,GAAG,SAAS,IAAI,IAAI,EAAE,CAAA;IAC/B,CAAC;CAAA;AAED,MAAM,UAAgB,SAAS,CAAC,IAAY;;QAC1C,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;QAC3C,IAAI,CAAC,GAAG;YAAE,OAAO,SAAS,CAAA;QAE1B,IAAI;YACF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAe,CAAA;YAC3C,IAAI,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE;gBAChC,MAAM,CAAC,MAAM,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;gBAClC,OAAO,SAAS,CAAA;aACjB;YACD,OAAO,KAAK,CAAC,KAAK,CAAA;SACnB;QAAC,WAAM;YACN,MAAM,CAAC,MAAM,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;YAClC,OAAO,SAAS,CAAA;SACjB;IACH,CAAC;CAAA;AAQD,MAAM,UAAgB,UAAU,CAAC,IAAoB;;QACnD,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,IAAI,CAAA;QAE3C,MAAM,GAAG,GAAG,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,CAAA;QAC/D,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;QAC/B,MAAM,KAAK,GAAe,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,EAAE,CAAA;QAEhE,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;IACxC,CAAC;CAAA;AAED,MAAM,UAAgB,UAAU,CAAC,IAAa;;QAC5C,IAAI,IAAI,EAAE;YACR,MAAM,CAAC,MAAM,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;YAClC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;YAC/B,OAAM;SACP;QAED,kBAAkB,CAAC,KAAK,EAAE,CAAA;QAE1B,IAAI;YACF,KAAK,IAAI,CAAC,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE;gBACpD,MAAM,GAAG,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;gBAC/B,IAAI,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,iBAAiB,CAAC;oBAAE,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;aAC3E;SACF;QAAC,WAAM;YACN,OAAO;SACR;IACH,CAAC;CAAA;AAOD,SAAe,kBAAkB,CAC/B,IAA+B;;QAE/B,IAAI;YACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAA;YACrC,OAAO,QAAQ,CAAA;SAChB;gBAAS;YACR,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;SACrC;IACH,CAAC;CAAA;AAQD,MAAM,UAAgB,YAAY,CAAI,IAAyB;;QAC7D,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,IAAI,CAAA;QAE5C,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;YACzB,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,CAAA;YACpC,IAAI,MAAM,KAAK,SAAS;gBAAE,OAAO,MAAW,CAAA;SAC7C;QAED,MAAM,OAAO,GAAG,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAC5C,IAAI,OAAO;YAAE,OAAO,OAAqB,CAAA;QAEzC,MAAM,OAAO,GAAG,kBAAkB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;QAErD,kBAAkB,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAErC,OAAO,OAAO,CAAA;IAChB,CAAC;CAAA;AAED,MAAM,UAAU,sBAAsB;IACpC,IAAI;QACF,OAAO,cAAc,CAAC,OAAO,CAAC,yBAAyB,CAAC,KAAK,MAAM,CAAA;KACpE;IAAC,WAAM;QACN,OAAO,KAAK,CAAA;KACb;AACH,CAAC"}
@@ -12,8 +12,6 @@ import state from '../state';
12
12
  import querystring from 'querystring';
13
13
  export default function (sku) {
14
14
  return __awaiter(this, void 0, void 0, function* () {
15
- if (state.products[sku])
16
- return Promise.resolve(state.products[sku]);
17
15
  const query = querystring.encode({
18
16
  'product.sku': sku,
19
17
  'asset.types': ['GLB', 'USDZ'].join(','),
@@ -42,7 +40,6 @@ export default function (sku) {
42
40
  bloom: customerProduct.bloom,
43
41
  viewerOptions: customerProduct.viewerOptions || {},
44
42
  };
45
- state.products[sku] = product;
46
43
  return product;
47
44
  });
48
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"product.js","sourceRoot":"","sources":["../../../src/services/product.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAA;AAChC,OAAO,KAAK,MAAM,UAAU,CAAA;AAC5B,OAAO,WAAW,MAAM,aAAa,CAAA;AA8CrC,MAAM,CAAC,OAAO,WAAiB,GAAW;;QACxC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;QAEpE,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC;YAC/B,aAAa,EAAE,GAAG;YAClB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YACxC,uBAAuB,EAAE,SAAS;SACnC,CAAC,CAAA;QACF,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,GAAG,CAClC,cAAc,KAAK,CAAC,QAAQ,CAAC,GAAG,oBAAoB,KAAK,EAAE,CAC5D,CAAsB,CAAA;QAEvB,IAAI,CAAC,eAAe;YAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;QAE5D,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,IAAI,EAAE,CAAA;QAC3C,MAAM,cAAc,GAAG,eAAe,CAAC,eAAe,IAAI,EAAE,CAAA;QAC5D,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAY,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,CAAA;QACpE,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAY,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAA;QAEtE,MAAM,OAAO,GAAY;YACvB,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YACjC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YACpC,QAAQ,EAAE,cAAc,CAAC,MAAM,GAAG,CAAC;YACnC,IAAI,EAAE,eAAe,CAAC,IAAI;YAC1B,SAAS,EAAE,eAAe,CAAC,SAAS,IAAI,OAAO;YAC/C,MAAM,EAAE,eAAe,CAAC,MAAM,IAAI,KAAK;YACvC,KAAK,EAAE,eAAe,CAAC,QAAQ;YAC/B,OAAO,EAAE,eAAe,CAAC,OAAO;YAChC,cAAc,EAAE,eAAe,CAAC,cAAc;YAC9C,MAAM,EAAE,eAAe,CAAC,MAAM;YAC9B,IAAI,EAAE,eAAe,CAAC,IAAI;YAC1B,QAAQ,EAAE,eAAe,CAAC,QAAQ;YAClC,KAAK,EAAE,eAAe,CAAC,KAAK;YAC5B,aAAa,EAAE,eAAe,CAAC,aAAa,IAAK,EAAoB;SACtE,CAAA;QAED,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,OAAO,CAAA;QAE7B,OAAO,OAAO,CAAA;IAChB,CAAC;CAAA"}
1
+ {"version":3,"file":"product.js","sourceRoot":"","sources":["../../../src/services/product.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAA;AAChC,OAAO,KAAK,MAAM,UAAU,CAAA;AAC5B,OAAO,WAAW,MAAM,aAAa,CAAA;AA8CrC,MAAM,CAAC,OAAO,WAAiB,GAAW;;QACxC,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC;YAC/B,aAAa,EAAE,GAAG;YAClB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YACxC,uBAAuB,EAAE,SAAS;SACnC,CAAC,CAAA;QACF,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,GAAG,CAClC,cAAc,KAAK,CAAC,QAAQ,CAAC,GAAG,oBAAoB,KAAK,EAAE,CAC5D,CAAsB,CAAA;QAEvB,IAAI,CAAC,eAAe;YAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;QAE5D,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,IAAI,EAAE,CAAA;QAC3C,MAAM,cAAc,GAAG,eAAe,CAAC,eAAe,IAAI,EAAE,CAAA;QAC5D,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAY,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,CAAA;QACpE,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,KAAY,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAA;QAEtE,MAAM,OAAO,GAAY;YACvB,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YACjC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YACpC,QAAQ,EAAE,cAAc,CAAC,MAAM,GAAG,CAAC;YACnC,IAAI,EAAE,eAAe,CAAC,IAAI;YAC1B,SAAS,EAAE,eAAe,CAAC,SAAS,IAAI,OAAO;YAC/C,MAAM,EAAE,eAAe,CAAC,MAAM,IAAI,KAAK;YACvC,KAAK,EAAE,eAAe,CAAC,QAAQ;YAC/B,OAAO,EAAE,eAAe,CAAC,OAAO;YAChC,cAAc,EAAE,eAAe,CAAC,cAAc;YAC9C,MAAM,EAAE,eAAe,CAAC,MAAM;YAC9B,IAAI,EAAE,eAAe,CAAC,IAAI;YAC1B,QAAQ,EAAE,eAAe,CAAC,QAAQ;YAClC,KAAK,EAAE,eAAe,CAAC,KAAK;YAC5B,aAAa,EAAE,eAAe,CAAC,aAAa,IAAK,EAAoB;SACtE,CAAA;QAED,OAAO,OAAO,CAAA;IAChB,CAAC;CAAA"}
@@ -8,10 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import state from '../state';
11
+ import { dedupedFetch, writeCache } from './cache';
11
12
  const endpoint = process.env.NODE_ENV === 'development'
12
13
  ? 'https://dev-api.r2u.io'
13
14
  : 'https://api.r2u.io';
14
- export function get(path) {
15
+ function _get(path) {
15
16
  return __awaiter(this, void 0, void 0, function* () {
16
17
  const headers = {};
17
18
  if (state.refreshCache) {
@@ -21,7 +22,25 @@ export function get(path) {
21
22
  method: 'get',
22
23
  headers,
23
24
  });
24
- return response.json();
25
+ if (!response.ok && response.status !== 404) {
26
+ throw new Error(`R2U - HTTP ${response.status}`);
27
+ }
28
+ const value = yield response.json();
29
+ yield writeCache({
30
+ path,
31
+ value,
32
+ status: response.status === 404 ? 'notfound' : 'ok',
33
+ });
34
+ return value;
35
+ });
36
+ }
37
+ export function get(path) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ return dedupedFetch({
40
+ path,
41
+ fetcher: _get.bind(null, path),
42
+ options: { refreshCache: state.refreshCache },
43
+ });
25
44
  });
26
45
  }
27
46
  export function post(path, body) {
@@ -1 +1 @@
1
- {"version":3,"file":"requests.js","sourceRoot":"","sources":["../../../src/services/requests.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,UAAU,CAAA;AAE5B,MAAM,QAAQ,GACZ,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa;IACpC,CAAC,CAAC,wBAAwB;IAC1B,CAAC,CAAC,oBAAoB,CAAA;AAE1B,MAAM,UAAgB,GAAG,CAAC,IAAY;;QACpC,MAAM,OAAO,GAAgB,EAAE,CAAA;QAC/B,IAAI,KAAK,CAAC,YAAY,EAAE;YACtB,OAAO,CAAC,eAAe,CAAC,GAAG,WAAW,CAAA;SACvC;QACD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,QAAQ,GAAG,IAAI,EAAE,EAAE;YACjD,MAAM,EAAE,KAAK;YACb,OAAO;SACR,CAAC,CAAA;QACF,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAA;IACxB,CAAC;CAAA;AAED,MAAM,UAAgB,IAAI,CAAC,IAAY,EAAE,IAAa;;QACpD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,QAAQ,GAAG,IAAI,EAAE,EAAE;YACjD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3B,CAAC,CAAA;QAEF,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAA;IACxB,CAAC;CAAA;AAED,MAAM,UAAgB,UAAU,CAAC,GAAW;;QAC1C,IAAI;YACF,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;gBAClC,MAAM,EAAE,MAAM;aACf,CAAC,CAAA;YACF,OAAO,MAAM,KAAK,GAAG,CAAA;SACtB;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAClB,OAAO,KAAK,CAAA;SACb;IACH,CAAC;CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAW,EAAE;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa;QAC3C,CAAC,CAAC,uBAAuB;QACzB,CAAC,CAAC,oBAAoB,CAAA;AAC1B,CAAC,CAAA"}
1
+ {"version":3,"file":"requests.js","sourceRoot":"","sources":["../../../src/services/requests.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,UAAU,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAElD,MAAM,QAAQ,GACZ,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa;IACpC,CAAC,CAAC,wBAAwB;IAC1B,CAAC,CAAC,oBAAoB,CAAA;AAE1B,SAAe,IAAI,CAAC,IAAY;;QAC9B,MAAM,OAAO,GAAgB,EAAE,CAAA;QAC/B,IAAI,KAAK,CAAC,YAAY,EAAE;YACtB,OAAO,CAAC,eAAe,CAAC,GAAG,WAAW,CAAA;SACvC;QAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,QAAQ,GAAG,IAAI,EAAE,EAAE;YACjD,MAAM,EAAE,KAAK;YACb,OAAO;SACR,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;YAC3C,MAAM,IAAI,KAAK,CAAC,cAAc,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;SACjD;QAED,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QACnC,MAAM,UAAU,CAAC;YACf,IAAI;YACJ,KAAK;YACL,MAAM,EAAE,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI;SACpD,CAAC,CAAA;QACF,OAAO,KAAK,CAAA;IACd,CAAC;CAAA;AAED,MAAM,UAAgB,GAAG,CAAC,IAAY;;QACpC,OAAO,YAAY,CAAC;YAClB,IAAI;YACJ,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC;YAC9B,OAAO,EAAE,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE;SAC9C,CAAC,CAAA;IACJ,CAAC;CAAA;AAED,MAAM,UAAgB,IAAI,CAAC,IAAY,EAAE,IAAa;;QACpD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,QAAQ,GAAG,IAAI,EAAE,EAAE;YACjD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3B,CAAC,CAAA;QAEF,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAA;IACxB,CAAC;CAAA;AAED,MAAM,UAAgB,UAAU,CAAC,GAAW;;QAC1C,IAAI;YACF,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;gBAClC,MAAM,EAAE,MAAM;aACf,CAAC,CAAA;YACF,OAAO,MAAM,KAAK,GAAG,CAAA;SACtB;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAClB,OAAO,KAAK,CAAA;SACb;IACH,CAAC;CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAW,EAAE;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa;QAC3C,CAAC,CAAC,uBAAuB;QACzB,CAAC,CAAC,oBAAoB,CAAA;AAC1B,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export declare function generateSHA256(value: string): Promise<string>;
@@ -0,0 +1,25 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ export function generateSHA256(value) {
11
+ return __awaiter(this, void 0, void 0, function* () {
12
+ try {
13
+ const encoder = new TextEncoder();
14
+ const data = encoder.encode(value);
15
+ const hashBuffer = yield crypto.subtle.digest('SHA-256', data);
16
+ return Array.from(new Uint8Array(hashBuffer))
17
+ .map((b) => b.toString(16).padStart(2, '0'))
18
+ .join('');
19
+ }
20
+ catch (_a) {
21
+ return value;
22
+ }
23
+ });
24
+ }
25
+ //# sourceMappingURL=generateSHA256.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateSHA256.js","sourceRoot":"","sources":["../../../src/utils/generateSHA256.ts"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,UAAgB,cAAc,CAAC,KAAa;;QAChD,IAAI;YACF,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;YACjC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YAElC,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;YAE9D,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;iBAC1C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;iBAC3C,IAAI,CAAC,EAAE,CAAC,CAAA;SACZ;QAAC,WAAM;YACN,OAAO,KAAK,CAAA;SACb;IACH,CAAC;CAAA"}
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkR2U=self.webpackChunkR2U||[]).push([[74],{7374:function(e,t,n){n.d(t,{J1:function(){return u},E9:function(){return d},XH:function(){return p},ar:function(){return f},KN:function(){return w},fQ:function(){return m},hN:function(){return v},lY:function(){return y},G0:function(){return h},fm:function(){return b}});var i=n(2085),r=n(5877),o=n(2367),a=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))};const s="ar_link",c="ar_model_viewer",l="cta",u={componentDidMount:()=>o.Z.analytics.send({event:i.U3.impression,data:{[i.MB.placement]:s},scope:"page"}),onClick:()=>o.Z.analytics.send({event:i.U3.click,data:{[i.MB.placement]:s}}),onFallback:()=>o.Z.analytics.send({event:i.U3.fallback,data:{[i.MB.placement]:s}}),onLike:()=>o.Z.analytics.send({event:i.U3.like,data:{[i.MB.placement]:s}}),onDislike:()=>o.Z.analytics.send({event:i.U3.dislike,data:{[i.MB.placement]:s}}),onSessionTimeCollect:e=>o.Z.analytics.send({event:i.U3.interaction_duration,eventCount:e,data:{[i.MB.placement]:s}})},d={componentDidMount:()=>o.Z.analytics.send({event:i.U3.impression,data:{[i.MB.placement]:c},scope:"page"}),onClick:()=>o.Z.analytics.send({event:i.U3.click,data:{[i.MB.placement]:c}}),onSessionTimeCollect:e=>o.Z.analytics.send({event:i.U3.interaction_duration,eventCount:e,data:{[i.MB.placement]:c}})},p={onSessionStart:()=>o.Z.analytics.webxrSend({webxrEvent:i.Ui.session_start}),onSessionEnd:()=>o.Z.analytics.webxrSend({webxrEvent:i.Ui.session_end}),setSession:()=>{o.Z.analytics.webxrSet(i.D1.session_id,(0,r.v4)())},setCompatible:e=>{o.Z.analytics.webxrSet(i.D1.compatible,`${e}`)},onSceneViewerFallback:()=>Promise.all([o.Z.analytics.webxrSend({webxrEvent:i.Ui.scene_viewer_fallback}),o.Z.analytics.send({event:i.U3.fallback,data:{[i.MB.placement]:s},context:"webxr"})]),onFallback:()=>o.Z.analytics.webxrSend({webxrEvent:i.Ui.fallback}),setPlaneMapped:()=>{o.Z.analytics.webxrSet(i.D1.plane_mapped,(new Date).toISOString())},setObjectPlaced:()=>{o.Z.analytics.webxrSet(i.D1.object_placed,(new Date).toISOString())},setTranslateInstructions:()=>{o.Z.analytics.webxrSet(i.D1.translate_instructions,(new Date).toISOString())},setRotateInstructions:()=>{o.Z.analytics.webxrSet(i.D1.rotate_instructions,(new Date).toISOString())},setFirstTranslation:()=>{o.Z.analytics.webxrSet(i.D1.first_translation,(new Date).toISOString())},setFirstRotation:()=>{o.Z.analytics.webxrSet(i.D1.first_rotation,(new Date).toISOString())},setReset:()=>{o.Z.analytics.webxrSet(i.D1.reset,(new Date).toISOString())},onShare:()=>o.Z.analytics.webxrSend({webxrEvent:i.Ui.share}),onExit:()=>o.Z.analytics.webxrSend({webxrEvent:i.Ui.exit}),onLike:()=>o.Z.analytics.webxrSend({webxrEvent:i.Ui.like}),onDislike:()=>o.Z.analytics.webxrSend({webxrEvent:i.Ui.dislike}),onCallToAction:()=>o.Z.analytics.webxrSend({webxrEvent:i.Ui.call_to_action}),onTranslation:()=>o.Z.analytics.webxrSend({webxrEvent:i.Ui.translation}),onRotation:()=>o.Z.analytics.webxrSend({webxrEvent:i.Ui.rotation})},f={onClick:()=>o.Z.analytics.send({event:i.U3.click,data:{[i.MB.placement]:l},context:"cart"})},v=e=>{o.Z.analytics.set(i.MB.sku,e)},y=e=>{o.Z.analytics.set(i.MB.manufacturer_id,e)},h=e=>{o.Z.analytics.set(i.MB.is_active_3d,`${e}`),o.Z.analytics.send({event:i.U3.product_page_view})},w=e=>{o.Z.analytics.set(i.MB.experiment_id,e)},m=e=>{o.Z.analytics.set(i.MB.variation_id,e)},b=()=>a(void 0,void 0,void 0,(function*(){const e=yield(0,i.cE)();return o.Z.analytics.set(i.MB.fingerprint,e),e}));t.ZP=({client:e,dataLayerIntegration:t,sessionDurationMinutes:n,info:r={}})=>a(void 0,void 0,void 0,(function*(){const o={version:"6.23.2",gcpAnalyticsUrl:"https://us-central1-r2u-analytics.cloudfunctions.net/reportEvent",webxrGcpAnalyticsUrl:"https://us-central1-r2u-analytics.cloudfunctions.net/reportWebXREvent",debug:!!new URLSearchParams(window.location.search).get("realidade-aumentada-debug"),sessionDurationMinutes:n,dataLayerIntegration:t},a=new i.ZP(o,Object.assign(Object.assign({},r),{[i.MB.client]:e}));return yield a.init(),a}))},188:function(e,t,n){n.d(t,{Lu:function(){return d},x1:function(){return p},z6:function(){return u},vj:function(){return l}});var i=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))};var r=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))};const o="r2u-sdk-cache",a=new Map,s={get(e){try{return localStorage.getItem(e)}catch(e){return null}},set(e,t){try{localStorage.setItem(e,t)}catch(e){}},remove(e){try{localStorage.removeItem(e)}catch(e){}}};function c(e){return r(this,void 0,void 0,(function*(){return`r2u-sdk-cache-v6.23.2-${yield function(e){return i(this,void 0,void 0,(function*(){try{const t=(new TextEncoder).encode(e),n=yield crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map((e=>e.toString(16).padStart(2,"0"))).join("")}catch(t){return e}}))}(e)}`}))}function l(e){return r(this,void 0,void 0,(function*(){const{path:t,value:n,status:i="ok"}=e,r="notfound"===i?3e4:3e5,o=yield c(t),a={value:n,expiresAt:Date.now()+r};s.set(o,JSON.stringify(a))}))}function u(e){return r(this,void 0,void 0,(function*(){if(e)return s.remove(yield c(e)),void a.delete(e);a.clear();try{for(let e=localStorage.length-1;e>=0;e-=1){const t=localStorage.key(e);t&&t.startsWith(o)&&localStorage.removeItem(t)}}catch(e){}}))}function d(e){return r(this,void 0,void 0,(function*(){const{path:t,fetcher:n,options:i={}}=e;if(!i.refreshCache){const e=yield function(e){return r(this,void 0,void 0,(function*(){const t=s.get(yield c(e));if(t)try{const n=JSON.parse(t);return n.expiresAt<Date.now()?void s.remove(yield c(e)):n.value}catch(t){return void s.remove(yield c(e))}}))}(t);if(void 0!==e)return e}const o=a.get(t);if(o)return o;const l=function(e){return r(this,void 0,void 0,(function*(){try{return yield e.fetcher()}finally{a.delete(e.path)}}))}({path:t,fetcher:n});return a.set(t,l),l}))}function p(){try{return"true"===sessionStorage.getItem("r2u-sdk-refresh-cache")}catch(e){return!1}}},7523:function(e,t,n){n.d(t,{Z:function(){return s}});var i=n(2297),r=n(2367),o=n(7673),a=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))};function s(e){return a(this,void 0,void 0,(function*(){const t=o.encode({"product.sku":e,"asset.types":["GLB","USDZ"].join(","),"product_review.status":"RUNNING"}),[n]=yield(0,i.U2)(`/customers/${r.Z.customer._id}/products/assets?${t}`);if(!n)throw new Error("R2U - SKU not found");const a=n.assets||[],s=n.product_reviews||[],c=a.find((e=>"GLB"===e.type)),l=a.find((e=>"USDZ"===e.type));return{glb:c?c.url:"",usdz:l?l.url:"",isActive:s.length>0,name:n.name,placement:n.placement||"floor",resize:n.resize||!1,sound:n.soundUrl,modelId:n.modelId,manufacturerId:n.manufacturerId,pdpUrl:n.pdpUrl,hdri:n.hdri,exposure:n.exposure,bloom:n.bloom,viewerOptions:n.viewerOptions||{}}}))}},2297:function(e,t,n){n.d(t,{U2:function(){return c},v_:function(){return l},Bv:function(){return u}});var i=n(2367),r=n(188),o=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))};const a="https://api.r2u.io";function s(e){return o(this,void 0,void 0,(function*(){const t={};i.Z.refreshCache&&(t["Cache-Control"]="max-age=0");const n=yield fetch(`${a}${e}`,{method:"get",headers:t});if(!n.ok&&404!==n.status)throw new Error(`R2U - HTTP ${n.status}`);const o=yield n.json();return yield(0,r.vj)({path:e,value:o,status:404===n.status?"notfound":"ok"}),o}))}function c(e){return o(this,void 0,void 0,(function*(){return(0,r.Lu)({path:e,fetcher:s.bind(null,e),options:{refreshCache:i.Z.refreshCache}})}))}function l(e,t){return o(this,void 0,void 0,(function*(){return(yield fetch(`${a}${e}`,{method:"POST",body:JSON.stringify(t)})).json()}))}const u=()=>"https://sdk.r2u.io"},2367:function(e,t){const n={init:!1,customer:{_id:"",slug:"",language:"en",hdri:null,exposure:null,bloom:null,experiments:{overrides:{}},viewerOptions:{}},analytics:{set:(e,t)=>{},send:({event:e,data:t,scope:n})=>Promise.resolve()},products:{},hasAutoOpenedAR:!1,growthbook:{},refreshCache:!1};t.Z=n},4147:function(e){e.exports=JSON.parse('{"name":"@r2u/javascript-ar-sdk","version":"6.23.2","main":"dist/index.js","unpkg":"dist/index.js","types":"dist/src/index.d.ts","repository":"https://github.com/r2u-io/javascript-ar-sdk","files":["dist"],"scripts":{"dev":"yarn build:dev && webpack serve --mode=development","dev:watch":"REACT_APP_VERSION=$(node -p \\"require(\'./package.json\').version\\") webpack serve --mode=development","build:dev":"REACT_APP_VERSION=$(node -p \\"require(\'./package.json\').version\\") webpack --mode=development && yarn build:types","build":"REACT_APP_VERSION=$(jq -r \\".version\\" package.json) webpack --mode=production && yarn build:types","build:types":"tsc && npx tsc-alias","clean":"rm -rf dist/ public/dist/","test":"jest --config ./jest.config.js","stage":"yarn build:dev && gsutil -m cp -R ./public gs://r2u-integrations-bucket/_staging/sdk/","prettier":"prettier --write src","lint":"eslint \\"./src/**/*.{js,ts,tsx}\\"","eject":"rescripts eject"},"peerDependencies":{"react":"^16.13.1","react-dom":"^16.13.1"},"dependencies":{"@r2u/analytics":"^4.3.3","@r2u/react-ar-components":"^5.4.16","@r2u/viewer":"^1.13.2","@types/react-slick":"^0.23.10","i18next":"^20.2.1","i18next-chained-backend":"^2.1.0","i18next-http-backend":"^1.2.1","i18next-localstorage-backend":"^3.1.2","qrcode.react":"^1.0.1","querystring":"^0.2.0","react":"^17.0.2","react-dom":"^17.0.2","react-i18next":"^11.8.13","react-shadow":"^19.0.2","react-slick":"^0.29.0","styled-components":"^5.2.3"},"devDependencies":{"@fingerprintjs/fingerprintjs":"^3.3.0","@growthbook/growthbook":"^0.12.0","@types/jest":"^26.0.15","@types/node":"^13.11.1","@types/qrcode.react":"^1.0.1","@types/react":"^16.9.33","@types/react-dom":"^16.9.6","@types/styled-components":"^5.1.9","@typescript-eslint/eslint-plugin":"^2.3.1","@typescript-eslint/parser":"^2.3.1","eslint":"^7.22.0","eslint-config-prettier":"^6.12.0","eslint-config-standard":"^12.0.0","eslint-plugin-import":"^2.17.2","eslint-plugin-jest":"^22.17.0","eslint-plugin-node":"^8.0.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-promise":"^4.1.1","eslint-plugin-react":"^7.14.3","eslint-plugin-standard":"^4.0.0","file-loader":"^6.2.0","jest":"^24.9.0","prettier":"^2.1.2","process":"^0.11.10","three":"^0.131.2","ts-jest":"^26.4.4","ts-loader":"^8.0.17","tsc-alias":"^1.8.11","tsconfig-paths-webpack-plugin":"^3.5.1","typescript":"^3.8.3","util":"^0.12.3","webpack":"^5.24.3","webpack-bundle-analyzer":"^4.4.0","webpack-cli":"^4.5.0","webpack-dev-server":"3.10.3"},"browserslist":{"production":[">0.2%","not dead","not op_mini all"],"development":["last 1 chrome version","last 1 firefox version","last 1 safari version"]}}')}}]);
@@ -1,4 +1,23 @@
1
- "use strict";(self.webpackChunkR2U=self.webpackChunkR2U||[]).push([[428],{8305:function(e,o,t){t.r(o),t.d(o,{default:function(){return z}});var n=t(7294),r=t(3935),i=t(9361),l=t.n(i),u=t(2367),a=t(5060),c=t(3026),s=t(9163);const d=s.default.div`
1
+ "use strict";(self.webpackChunkR2U=self.webpackChunkR2U||[]).push([[428],{3026:function(e,t,o){o.d(t,{Ao:function(){return r},mn:function(){return i},L7:function(){return l},Ov:function(){return a},H_:function(){return c},cu:function(){return u},yY:function(){return s}});var n=o(7294);const r=e=>n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e),n.createElement("line",{x1:"19",y1:"12",x2:"5",y2:"12"}),n.createElement("polyline",{points:"12 19 5 12 12 5"})),i=e=>n.createElement("svg",Object.assign({viewBox:"0 0 1024 1024",fill:"#8ec396"},e),n.createElement("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})),l=e=>n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",className:"icon",viewBox:"0 0 1024 1024",fill:"#fff"},e),n.createElement("path",{d:"M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 0 0-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 0 0 471 99.9c-52 0-98 35-111.8 85.1l-85.9 311h-.3v428h472.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM112 528v364c0 17.7 14.3 32 32 32h65V496h-65c-17.7 0-32 14.3-32 32z"})),a=e=>n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",className:"icon",viewBox:"0 0 1024 1024",fill:"#fff"},e),n.createElement("path",{d:"M885.9 490.3c3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-51.6-30.7-98.1-78.3-118.4a66.1 66.1 0 0 0-26.5-5.4H273v428h.3l85.8 310.8C372.9 889 418.9 924 470.9 924c29.7 0 57.4-11.8 77.9-33.4 20.5-21.5 31-49.7 29.5-79.4l-6-122.9h239.9c12.1 0 23.9-3.2 34.3-9.3 40.4-23.5 65.5-66.1 65.5-111 0-28.3-9.3-55.5-26.1-77.7zM112 132v364c0 17.7 14.3 32 32 32h65V100h-65c-17.7 0-32 14.3-32 32z"})),c=e=>n.createElement("svg",Object.assign({width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.createElement("path",{d:"M15.0002 37.4C15.0002 38.3167 15.7502 39.0667 16.6668 39.0667H23.3335C24.2502 39.0667 25.0002 38.3167 25.0002 37.4V35.7334H15.0002V37.4ZM20.0002 6.93335C13.5668 6.93335 8.3335 12.1667 8.3335 18.6C8.3335 22.5667 10.3168 26.05 13.3335 28.1667V31.9334C13.3335 32.85 14.0835 33.6 15.0002 33.6H25.0002C25.9168 33.6 26.6668 32.85 26.6668 31.9334V28.1667C29.6835 26.05 31.6668 22.5667 31.6668 18.6C31.6668 12.1667 26.4335 6.93335 20.0002 6.93335ZM24.7502 25.4334L23.3335 26.4334V30.2667H16.6668V26.4334L15.2502 25.4334C13.0002 23.8667 11.6668 21.3167 11.6668 18.6C11.6668 14 15.4002 10.2667 20.0002 10.2667C24.6002 10.2667 28.3335 14 28.3335 18.6C28.3335 21.3167 27.0002 23.8667 24.7502 25.4334Z",fill:"#AFAFAF"})),u=e=>n.createElement("svg",Object.assign({width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.createElement("path",{d:"M15.3716 37.26C15.3716 38.107 16.0659 38.8 16.9145 38.8H23.0859C23.9345 38.8 24.6288 38.107 24.6288 37.26V35.72H15.3716V37.26ZM20.0002 8C14.0448 8 9.2002 12.8356 9.2002 18.78C9.2002 22.4452 11.0362 25.6638 13.8288 27.6196V31.1C13.8288 31.947 14.5231 32.64 15.3716 32.64H24.6288C25.4773 32.64 26.1716 31.947 26.1716 31.1V27.6196C28.9642 25.6638 30.8002 22.4452 30.8002 18.78C30.8002 12.8356 25.9556 8 20.0002 8ZM24.3973 25.094L23.0859 26.018V29.56H16.9145V26.018L15.6031 25.094C13.5202 23.6464 12.2859 21.2902 12.2859 18.78C12.2859 14.5296 15.7419 11.08 20.0002 11.08C24.2585 11.08 27.7145 14.5296 27.7145 18.78C27.7145 21.2902 26.4802 23.6464 24.3973 25.094Z",fill:"#003E58"}),n.createElement("path",{d:"M34.0166 6.51666L31.6666 4.16666L28.6833 7.16666L31.0333 9.51666L34.0166 6.51666ZM21.5999 5L18.2666 5L18.2666 -5.134e-06L21.5999 -4.84259e-06L21.5999 5ZM38.2666 20L33.2666 20L33.2666 16.6667L38.2666 16.6667L38.2666 20ZM6.59993 20L1.59993 20L1.59993 16.6667L6.59993 16.6667L6.59993 20ZM11.1999 7.15L8.2166 4.14999L5.8666 6.49999L8.8666 9.48333L11.1999 7.15Z",fill:"#003E58"})),s=e=>n.createElement("svg",Object.assign({width:"137",height:"27",viewBox:"0 0 137 27",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.0906369 23.7492V27H137V23.7492H0.0906369ZM129.725 6.59205C133.546 6.59205 135.365 8.127 135.546 10.9262H132.089C131.907 9.66195 131.089 9.21038 129.724 9.21038C128.268 9.21038 127.543 9.66195 127.543 10.2938C127.543 11.3771 128.633 11.3771 131.728 12.1898C134.275 12.8216 135.822 13.9961 135.913 16.1629C135.731 19.5946 133.275 20.6779 129.909 20.6779C126.088 20.6779 123.905 19.0526 123.814 15.982H127.362C127.544 17.8781 128.997 17.9685 130.182 17.9685C131.366 17.9685 132.363 17.6074 132.363 16.7042C132.453 15.44 130.27 15.44 128.269 14.8082C126.361 14.3566 124.084 13.6343 124.175 11.0153C124.358 7.58498 127.178 6.59205 129.725 6.59205ZM115.988 6.59205C118.08 6.59205 121.628 6.95318 121.628 10.746V18.5119C121.645 18.7407 121.711 18.9633 121.821 19.1655C121.93 19.3676 122.081 19.5448 122.264 19.6857V20.2257H118.535C118.327 19.7064 118.205 19.1577 118.171 18.6003C117.681 19.2188 117.061 19.7249 116.355 20.0837C115.649 20.4425 114.873 20.6454 114.08 20.6786C111.714 20.6786 109.895 19.2341 109.895 16.7056C109.985 13.5452 111.803 12.823 114.807 12.281C116.263 12.1905 118.173 12.011 118.173 10.8365C118.173 9.39195 116.99 9.39195 115.899 9.3015C114.443 9.39195 113.807 9.8415 113.625 11.1976H110.259C110.53 7.94678 112.531 6.59205 115.988 6.59205ZM86.8771 6.59205C89.5152 6.59205 92.4264 7.4952 92.4264 10.3849V18.2412C92.3921 18.5138 92.4435 18.7902 92.5738 19.0327C92.7041 19.2752 92.9068 19.4719 93.1542 19.5959V20.1359H89.3332C89.2061 19.6313 89.115 19.1183 89.0606 18.601C88.5409 19.202 87.9004 19.6891 87.1799 20.0312C86.4594 20.3732 85.6749 20.5627 84.8763 20.5875C82.3289 20.4971 80.6913 19.2328 80.6913 16.6145C80.782 13.6343 82.5995 12.4605 86.7865 12.0994C87.8769 12.0089 88.8787 11.6478 88.8787 10.7447C88.8787 9.38993 87.6049 9.38993 86.6979 9.30015C84.9697 9.3906 84.7898 10.0224 84.5172 11.1962H81.0553C81.3285 7.94678 83.3294 6.59205 86.8771 6.59205ZM73.2312 6.5016C77.4161 6.5016 78.9624 8.57858 79.235 11.5587L75.5959 11.6492C75.3233 10.1142 74.4136 9.48173 73.3218 9.48173C70.8685 9.48173 70.5959 11.8294 70.5959 13.7261C70.5959 16.2547 71.4137 17.6992 73.2339 17.6992C74.8695 17.6087 75.2354 17.0674 75.5993 15.3515H79.1471C78.6919 18.5119 76.5997 20.5889 73.1433 20.5889C68.8677 20.4984 66.9575 17.9699 66.9575 13.7261C66.9547 8.9397 69.4108 6.59205 73.2319 6.5016H73.2312ZM42.2102 6.59205C45.576 6.59205 48.5779 8.21745 48.4873 14.4484H43.9844H39.4816C39.4816 16.5254 40.6639 17.7896 42.4835 17.7896C42.9893 17.8059 43.4879 17.6672 43.9112 17.3925C44.3345 17.1178 44.662 16.7205 44.8489 16.2547H48.3967C47.9421 18.6023 45.6708 20.5889 42.3928 20.5889C41.2105 20.5889 35.9338 20.2277 35.9338 13.6363C35.9338 8.48812 39.0263 6.59205 42.2109 6.59205H42.2102ZM6.09175 6.59205C8.72976 6.59205 11.7317 7.3143 11.7317 10.2944V18.2412C11.6973 18.5138 11.7488 18.7902 11.8791 19.0327C12.0093 19.2752 12.2121 19.4719 12.4595 19.5959V20.1359H8.64253C8.49995 19.6346 8.40862 19.1204 8.36994 18.601C7.85016 19.2021 7.20952 19.6893 6.48893 20.0313C5.76834 20.3734 4.98364 20.5628 4.18497 20.5875C1.72823 20.5875 0 19.2341 0 16.6151C0 12.7325 3.27519 12.3707 6.09516 12.1C7.27753 12.0096 8.2759 11.6485 8.2759 10.7453C8.2759 9.3906 7.00221 9.3906 6.09516 9.30083C4.36692 9.39128 4.18701 10.0231 3.82106 11.1969H0.454547C0.727821 7.2225 3.6391 6.59205 6.09516 6.59205H6.09175ZM102.976 6.59205C105.523 6.6825 107.524 7.58565 107.524 11.288V20.2277H103.98V12.1007C104.071 10.5658 103.526 9.48173 101.8 9.48173C99.6188 9.48173 99.0736 11.288 99.0736 13.0032V20.2257H95.5258V6.9525H98.9829V8.84858C99.3599 8.13204 99.9372 7.53819 100.646 7.13802C101.355 6.73786 102.165 6.54832 102.979 6.59205H102.976ZM29.6532 6.59205C33.1104 6.86205 34.0202 9.21105 33.8382 11.8294V20.2271H30.2932V11.7389C30.3094 11.4655 30.2701 11.1917 30.1777 10.9336C30.0852 10.6755 29.9414 10.4384 29.7548 10.2363C29.5682 10.0342 29.3425 9.87127 29.0912 9.75708C28.8399 9.64289 28.568 9.57978 28.2917 9.5715C26.4721 9.8415 26.1995 10.7453 26.0176 12.2803V20.2271H22.4698V12.281C22.5604 10.746 22.1059 9.57218 20.5616 9.57218C18.3441 9.65993 18.2889 10.6927 18.2875 12.0832V20.2277H14.737V6.9525H18.1028V8.84858C18.4402 8.13805 18.9842 7.54356 19.665 7.14138C20.3458 6.7392 21.1324 6.54767 21.9239 6.59137C22.6967 6.51854 23.4722 6.70025 24.1301 7.10835C24.7881 7.51645 25.2917 8.12813 25.563 8.84858C25.9642 8.13104 26.5604 7.53927 27.284 7.14041C28.0076 6.74155 28.8296 6.55157 29.6567 6.59205H29.6532ZM64.222 6.86205V20.1366H60.6776V6.86273L64.222 6.86205ZM58.4908 6.59205H58.5814V10.1135C56.6733 10.0231 54.3058 9.84353 54.3058 13.8159V20.1373H50.8527V6.86273H54.1279V9.21038C55.4043 6.9525 56.6753 6.5016 58.4942 6.59205H58.4908ZM8.36926 13.7255C6.91362 14.7191 3.54779 14.0866 3.54779 16.4342C3.63842 17.6081 4.18429 18.0596 5.27602 18.0596C7.82339 17.6087 8.46058 16.8865 8.36926 13.7255ZM88.8787 13.7255C88.1504 14.1286 87.3443 14.3748 86.5132 14.4477C85.0576 14.5382 84.1478 14.9877 84.1478 16.3438C84.2384 17.6081 84.8756 18.0596 85.876 18.0596C88.4241 17.6087 89.1519 16.6151 88.8787 13.7255ZM118.171 13.7255C117.407 14.1178 116.575 14.3629 115.718 14.4477C114.718 14.5382 113.353 14.8993 113.353 16.3438C113.353 17.7883 114.353 17.9692 115.081 18.0596C117.444 17.8794 118.169 16.796 118.169 13.7255H118.171ZM42.3015 9.39128C40.3934 9.39128 39.7541 10.746 39.6635 12.1905H45.0308C45.0395 11.8286 44.9756 11.4686 44.8427 11.1313C44.7098 10.7941 44.5106 10.4864 44.2567 10.226C44.0028 9.96557 43.6993 9.7577 43.3636 9.61442C43.028 9.47113 42.667 9.39528 42.3015 9.39128ZM0.0906369 0V3.2508H137V0H0.0906369Z",fill:"white"}))},5060:function(e,t,o){o.d(t,{Z:function(){return l}});var n=o(7294),r=o(9163);const i=r.default.div`
2
+ a {
3
+ content: url('https://sdk.r2u.io/assets/r2u-icon-gray.svg');
4
+ height: 22px;
5
+ position: absolute;
6
+ z-index: 999999;
7
+ margin: 10px;
8
+ ${e=>{const t=e.position?e.position.toLowerCase():"";return r.css`
9
+ ${t.includes("left")&&"left: 0;"}
10
+ ${t.includes("right")&&"right: 0;"}
11
+ ${t.includes("bottom")&&"bottom: 0;"}
12
+ ${t.includes("top")&&"top: 0;"}
13
+ ${t.includes("center")&&"left: 0; right: 0; margin: auto;"}
14
+ ${t.includes("absolute")&&"position: absolute;"}
15
+ `}};
16
+ }
17
+ a:hover {
18
+ content: url('https://sdk.r2u.io/assets/r2u-icon.svg');
19
+ }
20
+ `;var l=({position:e})=>n.createElement(i,{position:e},n.createElement("a",{href:"https://r2u.io",target:"_blank",rel:"noopener noreferrer"},n.createElement("img",{alt:""})))},8305:function(e,t,o){o.r(t),o.d(t,{default:function(){return S}});var n=o(7294),r=o(3935),i=o(9361),l=o.n(i),a=o(2367),c=o(5060),u=o(3026),s=o(9163);const d=s.default.div`
2
21
  width: 100%;
3
22
  height: 100%;
4
23
 
@@ -120,4 +139,4 @@
120
139
  box-shadow: none;
121
140
  }
122
141
  }
123
- `;var p=function(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t};const v=(0,n.forwardRef)(((e,o)=>{const{exitImgSrc:t="https://sdk.r2u.io/assets/exit-icon.png",expandImgSrc:r="https://sdk.r2u.io/assets/expand-icon.png",popup:i=!0,children:l=null,waterMarkPosition:u,refViewerPopup:s,ModelViewerElement:v,refViewerFunctions:m}=e,f=p(e,["exitImgSrc","expandImgSrc","popup","children","waterMarkPosition","refViewerPopup","ModelViewerElement","refViewerFunctions"]),[g,b]=(0,n.useState)(!1),h=()=>{b(!1)};(0,n.useEffect)((()=>{s&&s.current&&s.current.addEventListener("mousedown",(e=>(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),!1)))}),[s]);const w=(0,n.useRef)(null),[y,x]=(0,n.useState)(!1),[E,k]=(0,n.useState)(f.glbSrc);return(0,n.useImperativeHandle)(o,(()=>({updateGlb:e=>{k(e)}})),[]),n.createElement(d,{expanded:g,bloom:y},n.createElement("div",{className:"viewer-container"},E&&n.createElement(v,Object.assign({ref:m,componentDidMount:f.componentDidMount,onClick:f.onClick,onSessionTimeCollect:f.onSessionTimeCollect},f,{glbSrc:E}),l,i&&n.createElement("button",{className:"expand-button",type:"button",onClick:()=>{b(!0)}},n.createElement("img",{className:"expand-image",alt:"",src:r})),u&&n.createElement(a.Z,{position:u}))),i&&g&&n.createElement("div",{className:"background",onMouseDown:h},n.createElement("div",{className:"viewer-container popup"},E&&n.createElement(v,Object.assign({ref:w,componentDidMount:f.componentDidMount,onClick:f.onClick,onSessionTimeCollect:f.onSessionTimeCollect},f,{enableBloomButton:!1,glbSrc:E}),l,f.bloom&&n.createElement("button",{className:"bloomButton",type:"button",onMouseDown:e=>e.stopPropagation(),onClick:()=>{x(!y),w.current&&w.current.updateBloom(!y)}},y?n.createElement(c.cu,{className:"lamp"}):n.createElement(c.H_,{className:"lamp"})),n.createElement("button",{className:"exit-button",type:"button",onClick:h},n.createElement("img",{alt:"",src:t})),u&&n.createElement(a.Z,{position:u})))))}));v.displayName="R2UModelViewer";var m=v,f=t(1841),g=t.n(f),b=t(7523),h=t(7374),w=t(2297),y=function(e,o,t,n){return new(t||(t=Promise))((function(r,i){function l(e){try{a(n.next(e))}catch(e){i(e)}}function u(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var o;e.done?r(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(l,u)}a((n=n.apply(e,o||[])).next())}))};function x(e,o){return y(this,void 0,void 0,(function*(){try{const t=`/viewer-customization/customer/${u.Z.customer._id}/products/${e}?customization=${encodeURI(JSON.stringify(o))}`;return(yield(0,w.U2)(t))||{}}catch(e){return console.error(`Error on getting customized model: ${e.message}`),Promise.reject(e)}}))}function E(e){return y(this,void 0,void 0,(function*(){try{const{status:o}=yield(0,w.U2)(`/job-status/${e}`);return["waiting","processing"].includes(o)?E(e):o}catch(e){return console.error(`Error on retry check conversion: ${e.message}`),Promise.reject(e)}}))}var k=t(5865);const S=({materialSlots:e,modelSlots:o})=>{e.sort(((e,o)=>e.slot>o.slot?1:e.slot<o.slot?-1:0)),o.sort(((e,o)=>e.slot>o.slot?1:e.slot<o.slot?-1:0)),o.forEach((e=>{e.activeModel&&S(e.activeModel)}))};var M=S;class C extends Error{constructor(e){super(e),this.name="ViewerError"}}var P=function(e,o,t,n){return new(t||(t=Promise))((function(r,i){function l(e){try{a(n.next(e))}catch(e){i(e)}}function u(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var o;e.done?r(e.value):(o=e.value,o instanceof t?o:new t((function(e){e(o)}))).then(l,u)}a((n=n.apply(e,o||[])).next())}))};var z={create:({element:e,sku:o,name:t,popup:i=!0,progressBarPosition:a="top",progressBarColor:c,poster:s,autoRotate:d=!0,viewerProps:p})=>P(void 0,void 0,void 0,(function*(){return new Promise(((v,f)=>P(void 0,void 0,void 0,(function*(){if(!u.Z.init)return f(new Error("R2U - Not initialized"));if(!o)return f(new Error("R2U - Missing SKU"));const{glb:S,name:z,viewerOptions:R}=yield(0,b.Z)(o);let O=S;const $=u.Z.customer.waterMarkPosition,N=R||u.Z.customer.viewerOptions||void 0,j=(0,n.createRef)(),H=(0,n.createRef)(),I=(0,n.createRef)(),U=(0,n.createRef)(),A=e=>P(void 0,void 0,void 0,(function*(){return new Promise(((o,t)=>P(void 0,void 0,void 0,(function*(){var n,r;try{const{glb:t}=yield(0,b.Z)(e);O=t,yield null===(n=I.current)||void 0===n?void 0:n.updateGlb(t),null===(r=U.current)||void 0===r||r.updateGlb(t),o()}catch(e){t(e)}}))))})),B=(...e)=>{var o;null===(o=I.current)||void 0===o||o.insertModelNode(...e)},Z=(...e)=>P(void 0,void 0,void 0,(function*(){var o;yield null===(o=I.current)||void 0===o?void 0:o.insertSlotModelNode(...e)})),V=(...e)=>{var o;null===(o=I.current)||void 0===o||o.deleteModelNode(...e)},T=(...e)=>{var o;null===(o=I.current)||void 0===o||o.updateBloom(...e)},D=({sku:e,glb:o})=>P(void 0,void 0,void 0,(function*(){var t,n;if(o)return(null===(t=I.current)||void 0===t?void 0:t.loadMaterials(o))||!1;if(e){const{glb:o}=yield(0,b.Z)(e);return(null===(n=I.current)||void 0===n?void 0:n.loadMaterials(o))||!1}return!1})),F=(...e)=>{var o;null===(o=I.current)||void 0===o||o.setMaterial(...e)},G=(...e)=>{var o;return(null===(o=I.current)||void 0===o?void 0:o.setCustomMaterial(...e))||Promise.resolve(!1)},_=()=>{var e;return(null===(e=I.current)||void 0===e?void 0:e.getAllSlotsMaterials())||null},L=()=>{var e;return(null===(e=I.current)||void 0===e?void 0:e.getAllSlotsModels())||null},J=(...e)=>{var o;null===(o=I.current)||void 0===o||o.setModel(...e)},Q=(...e)=>{var o;null===(o=I.current)||void 0===o||o.setCamera(...e)},q=(...e)=>{var o;null===(o=I.current)||void 0===o||o.updateShadow(...e)},K=(...e)=>{var o;null===(o=I.current)||void 0===o||o.updateFog(...e)},W=(...e)=>{var o;null===(o=I.current)||void 0===o||o.updateBloomProps(...e)},X=(...e)=>{var o;null===(o=I.current)||void 0===o||o.updateEnvironment(...e)},Y=()=>{var e;return(null===(e=I.current)||void 0===e?void 0:e.getCamera())||null},ee=(e,t=!0)=>P(void 0,void 0,void 0,(function*(){try{if(!I.current)throw new C("Viewer not completely loaded!");let n=null;try{n=I.current.getCurrentCustomization(e)}catch(e){console.error(`Error on get current customization: ${e.message}`)}if(!n)throw new C("No customization returned!");M(n);const r=yield x(o,n);if(!r.glb){let e=null;try{e=yield I.current.getCustomizedModel(t)}catch(e){console.error(`Error on export the customization glb: ${e.message}`)}if(!e)throw new C("Could not export the customization glb!");r.glb=yield function(e,o,t){return y(this,void 0,void 0,(function*(){try{const n=`/viewer-customization/customer/${u.Z.customer._id}/products/${e}/upload-customization-data?customization=${encodeURI(JSON.stringify(o))}`,r=yield(0,w.U2)(n),i=new File([t],r.filename),l=new FormData;return Object.keys(r.fields).forEach((e=>l.append(e,r.fields[e]))),l.append("file",i),yield fetch(r.url,{method:"POST",body:l}),r.url.concat(r.fields.key)}catch(e){return console.error(`Error on upload customization: ${e.message}`),Promise.reject(e)}}))}(o,n,e)}if(!r.usdz){const e=yield function(e,o){return y(this,void 0,void 0,(function*(){try{const t=`/viewer-customization/customers/${u.Z.customer._id}/products/${e}/convert`;return yield(0,w.v_)(t,{filename:o})}catch(e){return console.error(`Error on request sku conversion: ${e.message}`),Promise.reject(e)}}))}(o,r.glb.split("/").pop());if("success"!==(yield E(e.jobId)))throw new C("Error while converting to usdz!");r.usdz=e.usdz}return x(o,n),r}catch(e){return console.error(`Error getting customization AR: ${e.message}`),Promise.reject(e)}})),oe=(e=!1,o=!0)=>P(void 0,void 0,void 0,(function*(){try{const t=yield ee(e,o);return(0,k.activateAR)({glb:t.glb,usdz:t.usdz,mode:"ar_preferred"}),!0}catch(e){return console.error(`Error opening AR: ${e.message}`),!1}})),te=(e,o=!1,t=!0)=>P(void 0,void 0,void 0,(function*(){try{const i=yield ee(o,t),u=`https://viewer.r2u.io/?customizationUri=${encodeURIComponent(i.glb.replace("https://storage.googleapis.com/","").replace(/\.glb$/,""))}&autoOpen=1`;return r.render(n.createElement(l(),Object.assign({},{"data-url":u},{value:u,style:{width:"100%",height:"100%"},renderAs:"svg"})),e),!0}catch(e){return console.error(`Error generating QR Code: ${e.message}`),!1}})),ne=(e=!1,o=!0)=>P(void 0,void 0,void 0,(function*(){try{const t=yield ee(e,o);return`https://viewer.r2u.io/?customizationUri=${encodeURIComponent(t.glb.replace("https://storage.googleapis.com/","").replace(/\.glb$/,""))}&autoOpen=1`}catch(e){return console.error(`Error generating viewer URL: ${e.message}`),null}})),re=(...e)=>{I.current&&I.current.downloadGlb(...e)},ie=e=>P(void 0,void 0,void 0,(function*(){return I.current?I.current.getCustomizedModel(e):null})),le=e=>P(void 0,void 0,void 0,(function*(){const o=setInterval((()=>{I.current&&(clearInterval(o),e())}),200);setTimeout((()=>{if(!I.current)throw clearInterval(o),new Error("Internal error: Unable to load viewerRefFunctions.")}),1e4)})),ue=(...e)=>P(void 0,void 0,void 0,(function*(){yield le((()=>{var o;return null===(o=I.current)||void 0===o?void 0:o.insertHotspot(...e)}))})),ae=(...e)=>P(void 0,void 0,void 0,(function*(){yield le((()=>{var o;return null===(o=I.current)||void 0===o?void 0:o.updateHotspot(...e)}))})),ce=(...e)=>P(void 0,void 0,void 0,(function*(){yield le((()=>{var o;return null===(o=I.current)||void 0===o?void 0:o.deleteHotspot(...e)}))})),se=(...e)=>P(void 0,void 0,void 0,(function*(){yield le((()=>{var o;return null===(o=I.current)||void 0===o?void 0:o.showHotspot(...e)}))})),de=(...e)=>P(void 0,void 0,void 0,(function*(){yield le((()=>{var o;return null===(o=I.current)||void 0===o?void 0:o.hideHotspot(...e)}))})),pe=(...e)=>P(void 0,void 0,void 0,(function*(){yield le((()=>{var o;return null===(o=I.current)||void 0===o?void 0:o.focusHotspot(...e)}))})),ve=()=>{var e;return(null===(e=I.current)||void 0===e?void 0:e.getActiveHotspotId())||null},me=(...e)=>P(void 0,void 0,void 0,(function*(){yield le((()=>{var o;return null===(o=I.current)||void 0===o?void 0:o.lookToHotspot(...e)}))})),fe=()=>{var e;return(null===(e=I.current)||void 0===e?void 0:e.getSceneTree())||null},ge=(...e)=>{var o;null===(o=I.current)||void 0===o||o.playAnimation(...e)},be=()=>{var e;null===(e=I.current)||void 0===e||e.pauseAnimation()},he=(...e)=>P(void 0,void 0,void 0,(function*(){var o;null===(o=I.current)||void 0===o||o.stopAnimation(...e)})),we=(...e)=>P(void 0,void 0,void 0,(function*(){var o;return(null===(o=I.current)||void 0===o?void 0:o.takeSnapshot(...e))||null})),ye=(...e)=>{var o;return(null===(o=I.current)||void 0===o?void 0:o.setRendererOptions(...e))||null},xe=(...e)=>P(void 0,void 0,void 0,(function*(){var o;null===(o=I.current)||void 0===o||o.updateBackground(...e)}));r.render(n.createElement(m,Object.assign({ref:U,alt:t||z,autoRotate:d,poster:s,refViewer:j,refViewerPopup:H,refViewerFunctions:I,waterMarkPosition:$,progressBarPosition:a,progressBarColor:c,popup:i},N,p,{componentDidMount:h.E9.componentDidMount,onClick:e=>{h.E9.onClick(),(null==p?void 0:p.onClick)&&(null==p||p.onClick(e))},onSessionTimeCollect:h.E9.onSessionTimeCollect,ModelViewerElement:g(),onLoad:()=>{v({setSku:A,insertModelNode:B,insertSlotModelNode:Z,deleteModelNode:V,loadMaterials:D,setMaterial:F,setCustomMaterial:G,getAllSlotsMaterials:_,updateBloom:T,getAllSlotsModels:L,setModel:J,setCamera:Q,updateShadow:q,updateFog:K,updateBloomProps:W,updateEnvironment:X,getCamera:Y,insertHotspot:ue,updateHotspot:ae,deleteHotspot:ce,showHotspot:se,hideHotspot:de,focusHotspot:pe,getActiveHotspotId:ve,lookToHotspot:me,customization:{openAR:oe,renderQRCode:te,getViewerURL:ne,getGlb:ie},getSceneTree:fe,playAnimation:ge,pauseAnimation:be,stopAnimation:he,downloadGlb:re,takeSnapshot:we,setRendererOptions:ye,updateBackground:xe})},glbSrc:O})),e)}))))}))}},5671:function(e,o,t){function n(e,o){if(!(e instanceof o))throw new TypeError("Cannot call a class as a function")}t.d(o,{Z:function(){return n}})},3144:function(e,o,t){function n(e,o){for(var t=0;t<o.length;t++){var n=o[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e,o,t){return o&&n(e.prototype,o),t&&n(e,t),e}t.d(o,{Z:function(){return r}})},4942:function(e,o,t){function n(e,o,t){return o in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t,e}t.d(o,{Z:function(){return n}})},1002:function(e,o,t){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}t.d(o,{Z:function(){return n}})}}]);
142
+ `;var p=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o};const v=(0,n.forwardRef)(((e,t)=>{const{exitImgSrc:o="https://sdk.r2u.io/assets/exit-icon.png",expandImgSrc:r="https://sdk.r2u.io/assets/expand-icon.png",popup:i=!0,children:l=null,waterMarkPosition:a,refViewerPopup:s,ModelViewerElement:v,refViewerFunctions:m}=e,f=p(e,["exitImgSrc","expandImgSrc","popup","children","waterMarkPosition","refViewerPopup","ModelViewerElement","refViewerFunctions"]),[g,C]=(0,n.useState)(!1),h=()=>{C(!1)};(0,n.useEffect)((()=>{s&&s.current&&s.current.addEventListener("mousedown",(e=>(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),!1)))}),[s]);const w=(0,n.useRef)(null),[b,x]=(0,n.useState)(!1),[y,M]=(0,n.useState)(f.glbSrc);return(0,n.useImperativeHandle)(t,(()=>({updateGlb:e=>{M(e)}})),[]),n.createElement(d,{expanded:g,bloom:b},n.createElement("div",{className:"viewer-container"},y&&n.createElement(v,Object.assign({ref:m,componentDidMount:f.componentDidMount,onClick:f.onClick,onSessionTimeCollect:f.onSessionTimeCollect},f,{glbSrc:y}),l,i&&n.createElement("button",{className:"expand-button",type:"button",onClick:()=>{C(!0)}},n.createElement("img",{className:"expand-image",alt:"",src:r})),a&&n.createElement(c.Z,{position:a}))),i&&g&&n.createElement("div",{className:"background",onMouseDown:h},n.createElement("div",{className:"viewer-container popup"},y&&n.createElement(v,Object.assign({ref:w,componentDidMount:f.componentDidMount,onClick:f.onClick,onSessionTimeCollect:f.onSessionTimeCollect},f,{enableBloomButton:!1,glbSrc:y}),l,f.bloom&&n.createElement("button",{className:"bloomButton",type:"button",onMouseDown:e=>e.stopPropagation(),onClick:()=>{x(!b),w.current&&w.current.updateBloom(!b)}},b?n.createElement(u.cu,{className:"lamp"}):n.createElement(u.H_,{className:"lamp"})),n.createElement("button",{className:"exit-button",type:"button",onClick:h},n.createElement("img",{alt:"",src:o})),a&&n.createElement(c.Z,{position:a})))))}));v.displayName="R2UModelViewer";var m=v,f=o(1841),g=o.n(f),C=o(7523),h=o(7374),w=o(2297),b=function(e,t,o,n){return new(o||(o=Promise))((function(r,i){function l(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(l,a)}c((n=n.apply(e,t||[])).next())}))};function x(e,t){return b(this,void 0,void 0,(function*(){try{const o=`/viewer-customization/customer/${a.Z.customer._id}/products/${e}?customization=${encodeURI(JSON.stringify(t))}`;return(yield(0,w.U2)(o))||{}}catch(e){return console.error(`Error on getting customized model: ${e.message}`),Promise.reject(e)}}))}function y(e){return b(this,void 0,void 0,(function*(){try{const{status:t}=yield(0,w.U2)(`/job-status/${e}`);return["waiting","processing"].includes(t)?y(e):t}catch(e){return console.error(`Error on retry check conversion: ${e.message}`),Promise.reject(e)}}))}var M=o(5865);const E=({materialSlots:e,modelSlots:t})=>{e.sort(((e,t)=>e.slot>t.slot?1:e.slot<t.slot?-1:0)),t.sort(((e,t)=>e.slot>t.slot?1:e.slot<t.slot?-1:0)),t.forEach((e=>{e.activeModel&&E(e.activeModel)}))};var H=E;class V extends Error{constructor(e){super(e),this.name="ViewerError"}}var k=function(e,t,o,n){return new(o||(o=Promise))((function(r,i){function l(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(l,a)}c((n=n.apply(e,t||[])).next())}))};var S={create:({element:e,sku:t,name:o,popup:i=!0,progressBarPosition:c="top",progressBarColor:u,poster:s,autoRotate:d=!0,viewerProps:p})=>k(void 0,void 0,void 0,(function*(){return new Promise(((v,f)=>k(void 0,void 0,void 0,(function*(){if(!a.Z.init)return f(new Error("R2U - Not initialized"));if(!t)return f(new Error("R2U - Missing SKU"));const{glb:E,name:S,viewerOptions:Z}=yield(0,C.Z)(t);let z=E;const L=a.Z.customer.waterMarkPosition,O=Z||a.Z.customer.viewerOptions||void 0,$=(0,n.createRef)(),P=(0,n.createRef)(),R=(0,n.createRef)(),j=(0,n.createRef)(),A=e=>k(void 0,void 0,void 0,(function*(){return new Promise(((t,o)=>k(void 0,void 0,void 0,(function*(){var n,r;try{const{glb:o}=yield(0,C.Z)(e);z=o,yield null===(n=R.current)||void 0===n?void 0:n.updateGlb(o),null===(r=j.current)||void 0===r||r.updateGlb(o),t()}catch(e){o(e)}}))))})),B=(...e)=>{var t;null===(t=R.current)||void 0===t||t.insertModelNode(...e)},N=(...e)=>k(void 0,void 0,void 0,(function*(){var t;yield null===(t=R.current)||void 0===t?void 0:t.insertSlotModelNode(...e)})),I=(...e)=>{var t;null===(t=R.current)||void 0===t||t.deleteModelNode(...e)},U=(...e)=>{var t;null===(t=R.current)||void 0===t||t.updateBloom(...e)},T=({sku:e,glb:t})=>k(void 0,void 0,void 0,(function*(){var o,n;if(t)return(null===(o=R.current)||void 0===o?void 0:o.loadMaterials(t))||!1;if(e){const{glb:t}=yield(0,C.Z)(e);return(null===(n=R.current)||void 0===n?void 0:n.loadMaterials(t))||!1}return!1})),F=(...e)=>{var t;null===(t=R.current)||void 0===t||t.setMaterial(...e)},D=(...e)=>{var t;return(null===(t=R.current)||void 0===t?void 0:t.setCustomMaterial(...e))||Promise.resolve(!1)},_=()=>{var e;return(null===(e=R.current)||void 0===e?void 0:e.getAllSlotsMaterials())||null},G=()=>{var e;return(null===(e=R.current)||void 0===e?void 0:e.getAllSlotsModels())||null},J=(...e)=>{var t;null===(t=R.current)||void 0===t||t.setModel(...e)},Q=(...e)=>{var t;null===(t=R.current)||void 0===t||t.setCamera(...e)},q=(...e)=>{var t;null===(t=R.current)||void 0===t||t.updateShadow(...e)},K=(...e)=>{var t;null===(t=R.current)||void 0===t||t.updateFog(...e)},W=(...e)=>{var t;null===(t=R.current)||void 0===t||t.updateBloomProps(...e)},Y=(...e)=>{var t;null===(t=R.current)||void 0===t||t.updateEnvironment(...e)},X=()=>{var e;return(null===(e=R.current)||void 0===e?void 0:e.getCamera())||null},ee=(e,o=!0)=>k(void 0,void 0,void 0,(function*(){try{if(!R.current)throw new V("Viewer not completely loaded!");let n=null;try{n=R.current.getCurrentCustomization(e)}catch(e){console.error(`Error on get current customization: ${e.message}`)}if(!n)throw new V("No customization returned!");H(n);const r=yield x(t,n);if(!r.glb){let e=null;try{e=yield R.current.getCustomizedModel(o)}catch(e){console.error(`Error on export the customization glb: ${e.message}`)}if(!e)throw new V("Could not export the customization glb!");r.glb=yield function(e,t,o){return b(this,void 0,void 0,(function*(){try{const n=`/viewer-customization/customer/${a.Z.customer._id}/products/${e}/upload-customization-data?customization=${encodeURI(JSON.stringify(t))}`,r=yield(0,w.U2)(n),i=new File([o],r.filename),l=new FormData;return Object.keys(r.fields).forEach((e=>l.append(e,r.fields[e]))),l.append("file",i),yield fetch(r.url,{method:"POST",body:l}),r.url.concat(r.fields.key)}catch(e){return console.error(`Error on upload customization: ${e.message}`),Promise.reject(e)}}))}(t,n,e)}if(!r.usdz){const e=yield function(e,t){return b(this,void 0,void 0,(function*(){try{const o=`/viewer-customization/customers/${a.Z.customer._id}/products/${e}/convert`;return yield(0,w.v_)(o,{filename:t})}catch(e){return console.error(`Error on request sku conversion: ${e.message}`),Promise.reject(e)}}))}(t,r.glb.split("/").pop());if("success"!==(yield y(e.jobId)))throw new V("Error while converting to usdz!");r.usdz=e.usdz}return x(t,n),r}catch(e){return console.error(`Error getting customization AR: ${e.message}`),Promise.reject(e)}})),te=(e=!1,t=!0)=>k(void 0,void 0,void 0,(function*(){try{const o=yield ee(e,t);return(0,M.activateAR)({glb:o.glb,usdz:o.usdz,mode:"ar_preferred"}),!0}catch(e){return console.error(`Error opening AR: ${e.message}`),!1}})),oe=(e,t=!1,o=!0)=>k(void 0,void 0,void 0,(function*(){try{const i=yield ee(t,o),a=`https://viewer.r2u.io/?customizationUri=${encodeURIComponent(i.glb.replace("https://storage.googleapis.com/","").replace(/\.glb$/,""))}&autoOpen=1`;return r.render(n.createElement(l(),Object.assign({},{"data-url":a},{value:a,style:{width:"100%",height:"100%"},renderAs:"svg"})),e),!0}catch(e){return console.error(`Error generating QR Code: ${e.message}`),!1}})),ne=(e=!1,t=!0)=>k(void 0,void 0,void 0,(function*(){try{const o=yield ee(e,t);return`https://viewer.r2u.io/?customizationUri=${encodeURIComponent(o.glb.replace("https://storage.googleapis.com/","").replace(/\.glb$/,""))}&autoOpen=1`}catch(e){return console.error(`Error generating viewer URL: ${e.message}`),null}})),re=(...e)=>{R.current&&R.current.downloadGlb(...e)},ie=e=>k(void 0,void 0,void 0,(function*(){return R.current?R.current.getCustomizedModel(e):null})),le=e=>k(void 0,void 0,void 0,(function*(){const t=setInterval((()=>{R.current&&(clearInterval(t),e())}),200);setTimeout((()=>{if(!R.current)throw clearInterval(t),new Error("Internal error: Unable to load viewerRefFunctions.")}),1e4)})),ae=(...e)=>k(void 0,void 0,void 0,(function*(){yield le((()=>{var t;return null===(t=R.current)||void 0===t?void 0:t.insertHotspot(...e)}))})),ce=(...e)=>k(void 0,void 0,void 0,(function*(){yield le((()=>{var t;return null===(t=R.current)||void 0===t?void 0:t.updateHotspot(...e)}))})),ue=(...e)=>k(void 0,void 0,void 0,(function*(){yield le((()=>{var t;return null===(t=R.current)||void 0===t?void 0:t.deleteHotspot(...e)}))})),se=(...e)=>k(void 0,void 0,void 0,(function*(){yield le((()=>{var t;return null===(t=R.current)||void 0===t?void 0:t.showHotspot(...e)}))})),de=(...e)=>k(void 0,void 0,void 0,(function*(){yield le((()=>{var t;return null===(t=R.current)||void 0===t?void 0:t.hideHotspot(...e)}))})),pe=(...e)=>k(void 0,void 0,void 0,(function*(){yield le((()=>{var t;return null===(t=R.current)||void 0===t?void 0:t.focusHotspot(...e)}))})),ve=()=>{var e;return(null===(e=R.current)||void 0===e?void 0:e.getActiveHotspotId())||null},me=(...e)=>k(void 0,void 0,void 0,(function*(){yield le((()=>{var t;return null===(t=R.current)||void 0===t?void 0:t.lookToHotspot(...e)}))})),fe=()=>{var e;return(null===(e=R.current)||void 0===e?void 0:e.getSceneTree())||null},ge=(...e)=>{var t;null===(t=R.current)||void 0===t||t.playAnimation(...e)},Ce=()=>{var e;null===(e=R.current)||void 0===e||e.pauseAnimation()},he=(...e)=>k(void 0,void 0,void 0,(function*(){var t;null===(t=R.current)||void 0===t||t.stopAnimation(...e)})),we=(...e)=>k(void 0,void 0,void 0,(function*(){var t;return(null===(t=R.current)||void 0===t?void 0:t.takeSnapshot(...e))||null})),be=(...e)=>{var t;return(null===(t=R.current)||void 0===t?void 0:t.setRendererOptions(...e))||null},xe=(...e)=>k(void 0,void 0,void 0,(function*(){var t;null===(t=R.current)||void 0===t||t.updateBackground(...e)}));r.render(n.createElement(m,Object.assign({ref:j,alt:o||S,autoRotate:d,poster:s,refViewer:$,refViewerPopup:P,refViewerFunctions:R,waterMarkPosition:L,progressBarPosition:c,progressBarColor:u,popup:i},O,p,{componentDidMount:h.E9.componentDidMount,onClick:e=>{h.E9.onClick(),(null==p?void 0:p.onClick)&&(null==p||p.onClick(e))},onSessionTimeCollect:h.E9.onSessionTimeCollect,ModelViewerElement:g(),onLoad:()=>{v({setSku:A,insertModelNode:B,insertSlotModelNode:N,deleteModelNode:I,loadMaterials:T,setMaterial:F,setCustomMaterial:D,getAllSlotsMaterials:_,updateBloom:U,getAllSlotsModels:G,setModel:J,setCamera:Q,updateShadow:q,updateFog:K,updateBloomProps:W,updateEnvironment:Y,getCamera:X,insertHotspot:ae,updateHotspot:ce,deleteHotspot:ue,showHotspot:se,hideHotspot:de,focusHotspot:pe,getActiveHotspotId:ve,lookToHotspot:me,customization:{openAR:te,renderQRCode:oe,getViewerURL:ne,getGlb:ie},getSceneTree:fe,playAnimation:ge,pauseAnimation:Ce,stopAnimation:he,downloadGlb:re,takeSnapshot:we,setRendererOptions:be,updateBackground:xe})},glbSrc:z})),e)}))))}))}},5671:function(e,t,o){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}o.d(t,{Z:function(){return n}})},3144:function(e,t,o){function n(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}o.d(t,{Z:function(){return r}})},4942:function(e,t,o){function n(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}o.d(t,{Z:function(){return n}})},1002:function(e,t,o){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}o.d(t,{Z:function(){return n}})}}]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r2u/javascript-ar-sdk",
3
- "version": "6.23.1",
3
+ "version": "6.23.2",
4
4
  "main": "dist/index.js",
5
5
  "unpkg": "dist/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -10,6 +10,7 @@
10
10
  ],
11
11
  "scripts": {
12
12
  "dev": "yarn build:dev && webpack serve --mode=development",
13
+ "dev:watch": "REACT_APP_VERSION=$(node -p \"require('./package.json').version\") webpack serve --mode=development",
13
14
  "build:dev": "REACT_APP_VERSION=$(node -p \"require('./package.json').version\") webpack --mode=development && yarn build:types",
14
15
  "build": "REACT_APP_VERSION=$(jq -r \".version\" package.json) webpack --mode=production && yarn build:types",
15
16
  "build:types": "tsc && npx tsc-alias",
package/CHANGELOG.md DELETED
@@ -1,65 +0,0 @@
1
- # [Version - 3.2.0]()
2
- ## Updates
3
- * Add `R2U.customizer.open`
4
-
5
- # [Version - 3.1.0]()
6
- ## Updates
7
- * Add `R2U.analytics.send`
8
-
9
- # [Version - 3.0.0]()
10
- ## Updates
11
- * Rename SDK from Real2U to R2U and host under `@r2u/javascript-ar-sdk`
12
-
13
- # [Version - 2.1.3]()
14
- ## Updates
15
- * Update the `getOpenARLink` function to automatically detect the `customerId` parameter after `Real2U.init`
16
-
17
- # [Version - 2.1.2]()
18
- ## Updates
19
- * Update the `getOpenARLink` function in response to [@real2u/react-ar-components](https://www.npmjs.com/package/@real2u/react-ar-components) 3.0.0.
20
-
21
- # [Version - 2.1.1]()
22
- ## New Feature
23
- * Addition of the `getOpenARLink` function.
24
- This function returns a shareable url that will redirect users to the AR experience.
25
-
26
- # [Version - 2.0.1]()
27
- * Remove unused service (calling the API to get customer data)
28
-
29
- # [Version - 2.0.0]()
30
- ## Updates
31
- * Version compatible with the latest version of [Google Model Viewer (1.0.0)](https://github.com/google/model-viewer/releases/tag/v1.0.0), which brought several improvements and corrections.
32
- You can check these improvements in more detail by checking the link above.
33
-
34
- Among the improvements, we highlight:
35
- * Read the field-of-view outer and inner limits with new accessors
36
- * Use 3DOM to customize textures on a loaded model
37
-
38
- ## Our improvements
39
- * Improvements in the rendering of the popup, with the resumption of the model display instead of a static image captured in real time. After several tests, we realized that usability is very favored with this strategy and that performance issues are very similar.
40
- * Improvements in the stylization of the model, allowing the resizing in a more practical and functional way.
41
-
42
-
43
- # [Version - 1.1.1]()
44
- ## New Feature
45
- * New parameter for defining the color of the progress bar (progressBarColor). The color can be defined in any format and will be applied as a css attribute of the element.
46
-
47
- # [Version - 1.0.1]()
48
- ## Refactoring
49
- * Refactoring the ARLink activation function, following official Google recommendations.
50
- According to the documentation, the corrections contribute to a better composition of the AR trigger URL on Android devices. They also contribute to greater device support and compatibility.
51
-
52
- # [Version - 1.0.0]()
53
-
54
- ## General
55
-
56
- Version compatible with the latest version of [Google Model Viewer (0.10.0)](https://github.com/google/model-viewer/releases/tag/v0.10.0), which brought several improvements and corrections.
57
- You can check these improvements in more detail by checking the link above.
58
-
59
- Among the improvements, we highlight:
60
- * Correction of flaws in Windows for some types of GPU.
61
- * Animations running on AR based on WebXR.
62
-
63
- ## Our improvements
64
- 1. In this version, we redefined the strategy for displaying the popup. Previously, the viewer was duplicated to be displayed in the standard component and in the modal at the same time. With the updates, as soon as the modal is triggered, we use the feature of generating a blob object in real time to generate a static image of the model in its exact position. Thus, the root element receives this image as a background when using the popup, which promotes a better experience when using this resource.
65
- 2. We also improved some UX details, controlling possible user actions according to the model's loading status and smoothing transitions.
@@ -1,20 +0,0 @@
1
- "use strict";(self.webpackChunkR2U=self.webpackChunkR2U||[]).push([[593],{3026:function(e,t,n){n.d(t,{Ao:function(){return s},mn:function(){return r},L7:function(){return a},Ov:function(){return o},H_:function(){return c},cu:function(){return l},yY:function(){return u}});var i=n(7294);const s=e=>i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e),i.createElement("line",{x1:"19",y1:"12",x2:"5",y2:"12"}),i.createElement("polyline",{points:"12 19 5 12 12 5"})),r=e=>i.createElement("svg",Object.assign({viewBox:"0 0 1024 1024",fill:"#8ec396"},e),i.createElement("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})),a=e=>i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",className:"icon",viewBox:"0 0 1024 1024",fill:"#fff"},e),i.createElement("path",{d:"M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 0 0-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 0 0 471 99.9c-52 0-98 35-111.8 85.1l-85.9 311h-.3v428h472.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM112 528v364c0 17.7 14.3 32 32 32h65V496h-65c-17.7 0-32 14.3-32 32z"})),o=e=>i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",className:"icon",viewBox:"0 0 1024 1024",fill:"#fff"},e),i.createElement("path",{d:"M885.9 490.3c3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-51.6-30.7-98.1-78.3-118.4a66.1 66.1 0 0 0-26.5-5.4H273v428h.3l85.8 310.8C372.9 889 418.9 924 470.9 924c29.7 0 57.4-11.8 77.9-33.4 20.5-21.5 31-49.7 29.5-79.4l-6-122.9h239.9c12.1 0 23.9-3.2 34.3-9.3 40.4-23.5 65.5-66.1 65.5-111 0-28.3-9.3-55.5-26.1-77.7zM112 132v364c0 17.7 14.3 32 32 32h65V100h-65c-17.7 0-32 14.3-32 32z"})),c=e=>i.createElement("svg",Object.assign({width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),i.createElement("path",{d:"M15.0002 37.4C15.0002 38.3167 15.7502 39.0667 16.6668 39.0667H23.3335C24.2502 39.0667 25.0002 38.3167 25.0002 37.4V35.7334H15.0002V37.4ZM20.0002 6.93335C13.5668 6.93335 8.3335 12.1667 8.3335 18.6C8.3335 22.5667 10.3168 26.05 13.3335 28.1667V31.9334C13.3335 32.85 14.0835 33.6 15.0002 33.6H25.0002C25.9168 33.6 26.6668 32.85 26.6668 31.9334V28.1667C29.6835 26.05 31.6668 22.5667 31.6668 18.6C31.6668 12.1667 26.4335 6.93335 20.0002 6.93335ZM24.7502 25.4334L23.3335 26.4334V30.2667H16.6668V26.4334L15.2502 25.4334C13.0002 23.8667 11.6668 21.3167 11.6668 18.6C11.6668 14 15.4002 10.2667 20.0002 10.2667C24.6002 10.2667 28.3335 14 28.3335 18.6C28.3335 21.3167 27.0002 23.8667 24.7502 25.4334Z",fill:"#AFAFAF"})),l=e=>i.createElement("svg",Object.assign({width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),i.createElement("path",{d:"M15.3716 37.26C15.3716 38.107 16.0659 38.8 16.9145 38.8H23.0859C23.9345 38.8 24.6288 38.107 24.6288 37.26V35.72H15.3716V37.26ZM20.0002 8C14.0448 8 9.2002 12.8356 9.2002 18.78C9.2002 22.4452 11.0362 25.6638 13.8288 27.6196V31.1C13.8288 31.947 14.5231 32.64 15.3716 32.64H24.6288C25.4773 32.64 26.1716 31.947 26.1716 31.1V27.6196C28.9642 25.6638 30.8002 22.4452 30.8002 18.78C30.8002 12.8356 25.9556 8 20.0002 8ZM24.3973 25.094L23.0859 26.018V29.56H16.9145V26.018L15.6031 25.094C13.5202 23.6464 12.2859 21.2902 12.2859 18.78C12.2859 14.5296 15.7419 11.08 20.0002 11.08C24.2585 11.08 27.7145 14.5296 27.7145 18.78C27.7145 21.2902 26.4802 23.6464 24.3973 25.094Z",fill:"#003E58"}),i.createElement("path",{d:"M34.0166 6.51666L31.6666 4.16666L28.6833 7.16666L31.0333 9.51666L34.0166 6.51666ZM21.5999 5L18.2666 5L18.2666 -5.134e-06L21.5999 -4.84259e-06L21.5999 5ZM38.2666 20L33.2666 20L33.2666 16.6667L38.2666 16.6667L38.2666 20ZM6.59993 20L1.59993 20L1.59993 16.6667L6.59993 16.6667L6.59993 20ZM11.1999 7.15L8.2166 4.14999L5.8666 6.49999L8.8666 9.48333L11.1999 7.15Z",fill:"#003E58"})),u=e=>i.createElement("svg",Object.assign({width:"137",height:"27",viewBox:"0 0 137 27",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.0906369 23.7492V27H137V23.7492H0.0906369ZM129.725 6.59205C133.546 6.59205 135.365 8.127 135.546 10.9262H132.089C131.907 9.66195 131.089 9.21038 129.724 9.21038C128.268 9.21038 127.543 9.66195 127.543 10.2938C127.543 11.3771 128.633 11.3771 131.728 12.1898C134.275 12.8216 135.822 13.9961 135.913 16.1629C135.731 19.5946 133.275 20.6779 129.909 20.6779C126.088 20.6779 123.905 19.0526 123.814 15.982H127.362C127.544 17.8781 128.997 17.9685 130.182 17.9685C131.366 17.9685 132.363 17.6074 132.363 16.7042C132.453 15.44 130.27 15.44 128.269 14.8082C126.361 14.3566 124.084 13.6343 124.175 11.0153C124.358 7.58498 127.178 6.59205 129.725 6.59205ZM115.988 6.59205C118.08 6.59205 121.628 6.95318 121.628 10.746V18.5119C121.645 18.7407 121.711 18.9633 121.821 19.1655C121.93 19.3676 122.081 19.5448 122.264 19.6857V20.2257H118.535C118.327 19.7064 118.205 19.1577 118.171 18.6003C117.681 19.2188 117.061 19.7249 116.355 20.0837C115.649 20.4425 114.873 20.6454 114.08 20.6786C111.714 20.6786 109.895 19.2341 109.895 16.7056C109.985 13.5452 111.803 12.823 114.807 12.281C116.263 12.1905 118.173 12.011 118.173 10.8365C118.173 9.39195 116.99 9.39195 115.899 9.3015C114.443 9.39195 113.807 9.8415 113.625 11.1976H110.259C110.53 7.94678 112.531 6.59205 115.988 6.59205ZM86.8771 6.59205C89.5152 6.59205 92.4264 7.4952 92.4264 10.3849V18.2412C92.3921 18.5138 92.4435 18.7902 92.5738 19.0327C92.7041 19.2752 92.9068 19.4719 93.1542 19.5959V20.1359H89.3332C89.2061 19.6313 89.115 19.1183 89.0606 18.601C88.5409 19.202 87.9004 19.6891 87.1799 20.0312C86.4594 20.3732 85.6749 20.5627 84.8763 20.5875C82.3289 20.4971 80.6913 19.2328 80.6913 16.6145C80.782 13.6343 82.5995 12.4605 86.7865 12.0994C87.8769 12.0089 88.8787 11.6478 88.8787 10.7447C88.8787 9.38993 87.6049 9.38993 86.6979 9.30015C84.9697 9.3906 84.7898 10.0224 84.5172 11.1962H81.0553C81.3285 7.94678 83.3294 6.59205 86.8771 6.59205ZM73.2312 6.5016C77.4161 6.5016 78.9624 8.57858 79.235 11.5587L75.5959 11.6492C75.3233 10.1142 74.4136 9.48173 73.3218 9.48173C70.8685 9.48173 70.5959 11.8294 70.5959 13.7261C70.5959 16.2547 71.4137 17.6992 73.2339 17.6992C74.8695 17.6087 75.2354 17.0674 75.5993 15.3515H79.1471C78.6919 18.5119 76.5997 20.5889 73.1433 20.5889C68.8677 20.4984 66.9575 17.9699 66.9575 13.7261C66.9547 8.9397 69.4108 6.59205 73.2319 6.5016H73.2312ZM42.2102 6.59205C45.576 6.59205 48.5779 8.21745 48.4873 14.4484H43.9844H39.4816C39.4816 16.5254 40.6639 17.7896 42.4835 17.7896C42.9893 17.8059 43.4879 17.6672 43.9112 17.3925C44.3345 17.1178 44.662 16.7205 44.8489 16.2547H48.3967C47.9421 18.6023 45.6708 20.5889 42.3928 20.5889C41.2105 20.5889 35.9338 20.2277 35.9338 13.6363C35.9338 8.48812 39.0263 6.59205 42.2109 6.59205H42.2102ZM6.09175 6.59205C8.72976 6.59205 11.7317 7.3143 11.7317 10.2944V18.2412C11.6973 18.5138 11.7488 18.7902 11.8791 19.0327C12.0093 19.2752 12.2121 19.4719 12.4595 19.5959V20.1359H8.64253C8.49995 19.6346 8.40862 19.1204 8.36994 18.601C7.85016 19.2021 7.20952 19.6893 6.48893 20.0313C5.76834 20.3734 4.98364 20.5628 4.18497 20.5875C1.72823 20.5875 0 19.2341 0 16.6151C0 12.7325 3.27519 12.3707 6.09516 12.1C7.27753 12.0096 8.2759 11.6485 8.2759 10.7453C8.2759 9.3906 7.00221 9.3906 6.09516 9.30083C4.36692 9.39128 4.18701 10.0231 3.82106 11.1969H0.454547C0.727821 7.2225 3.6391 6.59205 6.09516 6.59205H6.09175ZM102.976 6.59205C105.523 6.6825 107.524 7.58565 107.524 11.288V20.2277H103.98V12.1007C104.071 10.5658 103.526 9.48173 101.8 9.48173C99.6188 9.48173 99.0736 11.288 99.0736 13.0032V20.2257H95.5258V6.9525H98.9829V8.84858C99.3599 8.13204 99.9372 7.53819 100.646 7.13802C101.355 6.73786 102.165 6.54832 102.979 6.59205H102.976ZM29.6532 6.59205C33.1104 6.86205 34.0202 9.21105 33.8382 11.8294V20.2271H30.2932V11.7389C30.3094 11.4655 30.2701 11.1917 30.1777 10.9336C30.0852 10.6755 29.9414 10.4384 29.7548 10.2363C29.5682 10.0342 29.3425 9.87127 29.0912 9.75708C28.8399 9.64289 28.568 9.57978 28.2917 9.5715C26.4721 9.8415 26.1995 10.7453 26.0176 12.2803V20.2271H22.4698V12.281C22.5604 10.746 22.1059 9.57218 20.5616 9.57218C18.3441 9.65993 18.2889 10.6927 18.2875 12.0832V20.2277H14.737V6.9525H18.1028V8.84858C18.4402 8.13805 18.9842 7.54356 19.665 7.14138C20.3458 6.7392 21.1324 6.54767 21.9239 6.59137C22.6967 6.51854 23.4722 6.70025 24.1301 7.10835C24.7881 7.51645 25.2917 8.12813 25.563 8.84858C25.9642 8.13104 26.5604 7.53927 27.284 7.14041C28.0076 6.74155 28.8296 6.55157 29.6567 6.59205H29.6532ZM64.222 6.86205V20.1366H60.6776V6.86273L64.222 6.86205ZM58.4908 6.59205H58.5814V10.1135C56.6733 10.0231 54.3058 9.84353 54.3058 13.8159V20.1373H50.8527V6.86273H54.1279V9.21038C55.4043 6.9525 56.6753 6.5016 58.4942 6.59205H58.4908ZM8.36926 13.7255C6.91362 14.7191 3.54779 14.0866 3.54779 16.4342C3.63842 17.6081 4.18429 18.0596 5.27602 18.0596C7.82339 17.6087 8.46058 16.8865 8.36926 13.7255ZM88.8787 13.7255C88.1504 14.1286 87.3443 14.3748 86.5132 14.4477C85.0576 14.5382 84.1478 14.9877 84.1478 16.3438C84.2384 17.6081 84.8756 18.0596 85.876 18.0596C88.4241 17.6087 89.1519 16.6151 88.8787 13.7255ZM118.171 13.7255C117.407 14.1178 116.575 14.3629 115.718 14.4477C114.718 14.5382 113.353 14.8993 113.353 16.3438C113.353 17.7883 114.353 17.9692 115.081 18.0596C117.444 17.8794 118.169 16.796 118.169 13.7255H118.171ZM42.3015 9.39128C40.3934 9.39128 39.7541 10.746 39.6635 12.1905H45.0308C45.0395 11.8286 44.9756 11.4686 44.8427 11.1313C44.7098 10.7941 44.5106 10.4864 44.2567 10.226C44.0028 9.96557 43.6993 9.7577 43.3636 9.61442C43.028 9.47113 42.667 9.39528 42.3015 9.39128ZM0.0906369 0V3.2508H137V0H0.0906369Z",fill:"white"}))},5060:function(e,t,n){n.d(t,{Z:function(){return a}});var i=n(7294),s=n(9163);const r=s.default.div`
2
- a {
3
- content: url('https://sdk.r2u.io/assets/r2u-icon-gray.svg');
4
- height: 22px;
5
- position: absolute;
6
- z-index: 999999;
7
- margin: 10px;
8
- ${e=>{const t=e.position?e.position.toLowerCase():"";return s.css`
9
- ${t.includes("left")&&"left: 0;"}
10
- ${t.includes("right")&&"right: 0;"}
11
- ${t.includes("bottom")&&"bottom: 0;"}
12
- ${t.includes("top")&&"top: 0;"}
13
- ${t.includes("center")&&"left: 0; right: 0; margin: auto;"}
14
- ${t.includes("absolute")&&"position: absolute;"}
15
- `}};
16
- }
17
- a:hover {
18
- content: url('https://sdk.r2u.io/assets/r2u-icon.svg');
19
- }
20
- `;var a=({position:e})=>i.createElement(r,{position:e},i.createElement("a",{href:"https://r2u.io",target:"_blank",rel:"noopener noreferrer"},i.createElement("img",{alt:""})))},7374:function(e,t,n){n.d(t,{J1:function(){return u},E9:function(){return d},XH:function(){return p},ar:function(){return C},KN:function(){return m},fQ:function(){return g},hN:function(){return v},lY:function(){return f},G0:function(){return w},fm:function(){return h}});var i=n(2085),s=n(5877),r=n(2367),a=function(e,t,n,i){return new(n||(n=Promise))((function(s,r){function a(e){try{c(i.next(e))}catch(e){r(e)}}function o(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};const o="ar_link",c="ar_model_viewer",l="cta",u={componentDidMount:()=>r.Z.analytics.send({event:i.U3.impression,data:{[i.MB.placement]:o},scope:"page"}),onClick:()=>r.Z.analytics.send({event:i.U3.click,data:{[i.MB.placement]:o}}),onFallback:()=>r.Z.analytics.send({event:i.U3.fallback,data:{[i.MB.placement]:o}}),onLike:()=>r.Z.analytics.send({event:i.U3.like,data:{[i.MB.placement]:o}}),onDislike:()=>r.Z.analytics.send({event:i.U3.dislike,data:{[i.MB.placement]:o}}),onSessionTimeCollect:e=>r.Z.analytics.send({event:i.U3.interaction_duration,eventCount:e,data:{[i.MB.placement]:o}})},d={componentDidMount:()=>r.Z.analytics.send({event:i.U3.impression,data:{[i.MB.placement]:c},scope:"page"}),onClick:()=>r.Z.analytics.send({event:i.U3.click,data:{[i.MB.placement]:c}}),onSessionTimeCollect:e=>r.Z.analytics.send({event:i.U3.interaction_duration,eventCount:e,data:{[i.MB.placement]:c}})},p={onSessionStart:()=>r.Z.analytics.webxrSend({webxrEvent:i.Ui.session_start}),onSessionEnd:()=>r.Z.analytics.webxrSend({webxrEvent:i.Ui.session_end}),setSession:()=>{r.Z.analytics.webxrSet(i.D1.session_id,(0,s.v4)())},setCompatible:e=>{r.Z.analytics.webxrSet(i.D1.compatible,`${e}`)},onSceneViewerFallback:()=>Promise.all([r.Z.analytics.webxrSend({webxrEvent:i.Ui.scene_viewer_fallback}),r.Z.analytics.send({event:i.U3.fallback,data:{[i.MB.placement]:o},context:"webxr"})]),onFallback:()=>r.Z.analytics.webxrSend({webxrEvent:i.Ui.fallback}),setPlaneMapped:()=>{r.Z.analytics.webxrSet(i.D1.plane_mapped,(new Date).toISOString())},setObjectPlaced:()=>{r.Z.analytics.webxrSet(i.D1.object_placed,(new Date).toISOString())},setTranslateInstructions:()=>{r.Z.analytics.webxrSet(i.D1.translate_instructions,(new Date).toISOString())},setRotateInstructions:()=>{r.Z.analytics.webxrSet(i.D1.rotate_instructions,(new Date).toISOString())},setFirstTranslation:()=>{r.Z.analytics.webxrSet(i.D1.first_translation,(new Date).toISOString())},setFirstRotation:()=>{r.Z.analytics.webxrSet(i.D1.first_rotation,(new Date).toISOString())},setReset:()=>{r.Z.analytics.webxrSet(i.D1.reset,(new Date).toISOString())},onShare:()=>r.Z.analytics.webxrSend({webxrEvent:i.Ui.share}),onExit:()=>r.Z.analytics.webxrSend({webxrEvent:i.Ui.exit}),onLike:()=>r.Z.analytics.webxrSend({webxrEvent:i.Ui.like}),onDislike:()=>r.Z.analytics.webxrSend({webxrEvent:i.Ui.dislike}),onCallToAction:()=>r.Z.analytics.webxrSend({webxrEvent:i.Ui.call_to_action}),onTranslation:()=>r.Z.analytics.webxrSend({webxrEvent:i.Ui.translation}),onRotation:()=>r.Z.analytics.webxrSend({webxrEvent:i.Ui.rotation})},C={onClick:()=>r.Z.analytics.send({event:i.U3.click,data:{[i.MB.placement]:l},context:"cart"})},v=e=>{r.Z.analytics.set(i.MB.sku,e)},f=e=>{r.Z.analytics.set(i.MB.manufacturer_id,e)},w=e=>{r.Z.analytics.set(i.MB.is_active_3d,`${e}`),r.Z.analytics.send({event:i.U3.product_page_view})},m=e=>{r.Z.analytics.set(i.MB.experiment_id,e)},g=e=>{r.Z.analytics.set(i.MB.variation_id,e)},h=()=>a(void 0,void 0,void 0,(function*(){const e=yield(0,i.cE)();return r.Z.analytics.set(i.MB.fingerprint,e),e}));t.ZP=({client:e,dataLayerIntegration:t,sessionDurationMinutes:n,info:s={}})=>a(void 0,void 0,void 0,(function*(){const r={version:"6.23.1",gcpAnalyticsUrl:"https://us-central1-r2u-analytics.cloudfunctions.net/reportEvent",webxrGcpAnalyticsUrl:"https://us-central1-r2u-analytics.cloudfunctions.net/reportWebXREvent",debug:!!new URLSearchParams(window.location.search).get("realidade-aumentada-debug"),sessionDurationMinutes:n,dataLayerIntegration:t},a=new i.ZP(r,Object.assign(Object.assign({},s),{[i.MB.client]:e}));return yield a.init(),a}))},7523:function(e,t,n){n.d(t,{Z:function(){return o}});var i=n(2297),s=n(2367),r=n(7673),a=function(e,t,n,i){return new(n||(n=Promise))((function(s,r){function a(e){try{c(i.next(e))}catch(e){r(e)}}function o(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};function o(e){return a(this,void 0,void 0,(function*(){if(s.Z.products[e])return Promise.resolve(s.Z.products[e]);const t=r.encode({"product.sku":e,"asset.types":["GLB","USDZ"].join(","),"product_review.status":"RUNNING"}),[n]=yield(0,i.U2)(`/customers/${s.Z.customer._id}/products/assets?${t}`);if(!n)throw new Error("R2U - SKU not found");const a=n.assets||[],o=n.product_reviews||[],c=a.find((e=>"GLB"===e.type)),l=a.find((e=>"USDZ"===e.type)),u={glb:c?c.url:"",usdz:l?l.url:"",isActive:o.length>0,name:n.name,placement:n.placement||"floor",resize:n.resize||!1,sound:n.soundUrl,modelId:n.modelId,manufacturerId:n.manufacturerId,pdpUrl:n.pdpUrl,hdri:n.hdri,exposure:n.exposure,bloom:n.bloom,viewerOptions:n.viewerOptions||{}};return s.Z.products[e]=u,u}))}},2297:function(e,t,n){n.d(t,{U2:function(){return a},v_:function(){return o},Bv:function(){return c}});var i=n(2367),s=function(e,t,n,i){return new(n||(n=Promise))((function(s,r){function a(e){try{c(i.next(e))}catch(e){r(e)}}function o(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};const r="https://api.r2u.io";function a(e){return s(this,void 0,void 0,(function*(){const t={};i.Z.refreshCache&&(t["Cache-Control"]="max-age=0");return(yield fetch(`${r}${e}`,{method:"get",headers:t})).json()}))}function o(e,t){return s(this,void 0,void 0,(function*(){return(yield fetch(`${r}${e}`,{method:"POST",body:JSON.stringify(t)})).json()}))}const c=()=>"https://sdk.r2u.io"},2367:function(e,t){const n={init:!1,customer:{_id:"",slug:"",language:"en",hdri:null,exposure:null,bloom:null,experiments:{overrides:{}},viewerOptions:{}},analytics:{set:(e,t)=>{},send:({event:e,data:t,scope:n})=>Promise.resolve()},products:{},hasAutoOpenedAR:!1,growthbook:{},refreshCache:!1};t.Z=n},4147:function(e){e.exports=JSON.parse('{"name":"@r2u/javascript-ar-sdk","version":"6.23.1","main":"dist/index.js","unpkg":"dist/index.js","types":"dist/src/index.d.ts","repository":"https://github.com/r2u-io/javascript-ar-sdk","files":["dist"],"scripts":{"dev":"yarn build:dev && webpack serve --mode=development","build:dev":"REACT_APP_VERSION=$(node -p \\"require(\'./package.json\').version\\") webpack --mode=development && yarn build:types","build":"REACT_APP_VERSION=$(jq -r \\".version\\" package.json) webpack --mode=production && yarn build:types","build:types":"tsc && npx tsc-alias","clean":"rm -rf dist/ public/dist/","test":"jest --config ./jest.config.js","stage":"yarn build:dev && gsutil -m cp -R ./public gs://r2u-integrations-bucket/_staging/sdk/","prettier":"prettier --write src","lint":"eslint \\"./src/**/*.{js,ts,tsx}\\"","eject":"rescripts eject"},"peerDependencies":{"react":"^16.13.1","react-dom":"^16.13.1"},"dependencies":{"@r2u/analytics":"^4.3.3","@r2u/react-ar-components":"^5.4.16","@r2u/viewer":"^1.13.2","@types/react-slick":"^0.23.10","i18next":"^20.2.1","i18next-chained-backend":"^2.1.0","i18next-http-backend":"^1.2.1","i18next-localstorage-backend":"^3.1.2","qrcode.react":"^1.0.1","querystring":"^0.2.0","react":"^17.0.2","react-dom":"^17.0.2","react-i18next":"^11.8.13","react-shadow":"^19.0.2","react-slick":"^0.29.0","styled-components":"^5.2.3"},"devDependencies":{"@fingerprintjs/fingerprintjs":"^3.3.0","@growthbook/growthbook":"^0.12.0","@types/jest":"^26.0.15","@types/node":"^13.11.1","@types/qrcode.react":"^1.0.1","@types/react":"^16.9.33","@types/react-dom":"^16.9.6","@types/styled-components":"^5.1.9","@typescript-eslint/eslint-plugin":"^2.3.1","@typescript-eslint/parser":"^2.3.1","eslint":"^7.22.0","eslint-config-prettier":"^6.12.0","eslint-config-standard":"^12.0.0","eslint-plugin-import":"^2.17.2","eslint-plugin-jest":"^22.17.0","eslint-plugin-node":"^8.0.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-promise":"^4.1.1","eslint-plugin-react":"^7.14.3","eslint-plugin-standard":"^4.0.0","file-loader":"^6.2.0","jest":"^24.9.0","prettier":"^2.1.2","process":"^0.11.10","three":"^0.131.2","ts-jest":"^26.4.4","ts-loader":"^8.0.17","tsc-alias":"^1.8.11","tsconfig-paths-webpack-plugin":"^3.5.1","typescript":"^3.8.3","util":"^0.12.3","webpack":"^5.24.3","webpack-bundle-analyzer":"^4.4.0","webpack-cli":"^4.5.0","webpack-dev-server":"3.10.3"},"browserslist":{"production":[">0.2%","not dead","not op_mini all"],"development":["last 1 chrome version","last 1 firefox version","last 1 safari version"]}}')}}]);