@r2u/javascript-ar-sdk 6.9.8 → 6.9.11
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/analytics.bundle.js +1 -0
- package/dist/ar.bundle.js +522 -0
- package/dist/ar.bundle.js.LICENSE.txt +14 -0
- package/dist/components/R2UModelViewer/index.d.ts +1 -1
- package/dist/config.bundle.js +1 -0
- package/dist/index.d.ts +63 -19
- package/dist/index.js +1 -1043
- package/dist/init.bundle.js +1 -0
- package/dist/methods/types.d.ts +1 -1
- package/dist/qrCode.bundle.js +1 -0
- package/dist/services/analytics.d.ts +1 -7
- package/dist/sku.bundle.js +1 -0
- package/dist/vendors.26f845e8367231e774c6.bundle.js +2 -0
- package/dist/vendors.26f845e8367231e774c6.bundle.js.LICENSE.txt +32 -0
- package/dist/vendors.2864f1aaf3fa743e1983.bundle.js +1 -0
- package/dist/vendors.2db75630f9badcccad76.bundle.js +102 -0
- package/dist/vendors.2db75630f9badcccad76.bundle.js.LICENSE.txt +10 -0
- package/dist/vendors.3cb4b15ac4289730c591.bundle.js +2 -0
- package/dist/vendors.3cb4b15ac4289730c591.bundle.js.LICENSE.txt +8 -0
- package/dist/vendors.6c46067ffeb7a1054cd1.bundle.js +1 -0
- package/dist/vendors.72e0cdbf51fef996d405.bundle.js +2 -0
- package/dist/vendors.72e0cdbf51fef996d405.bundle.js.LICENSE.txt +8 -0
- package/dist/vendors.c62254af47e909101bf5.bundle.js +20 -0
- package/dist/viewer.bundle.js +123 -0
- package/package.json +3 -4
- package/dist/index.js.LICENSE.txt +0 -103
- package/dist/methods/customizer.d.ts +0 -14
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkR2U=self.webpackChunkR2U||[]).push([[142],{9448:function(e,n,t){t.r(n);var o=t(2367),s=function(e,n,t,o){return new(t||(t=Promise))((function(s,u){function c(e){try{a(o.next(e))}catch(e){u(e)}}function i(e){try{a(o.throw(e))}catch(e){u(e)}}function a(e){var n;e.done?s(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(c,i)}a((o=o.apply(e,n||[])).next())}))};n.default={send:function({event:e,data:n,scope:t}){return s(this,void 0,void 0,(function*(){o.Z.analytics.send({event:e,data:n,scope:t})}))}}},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}}]);
|
|
@@ -0,0 +1,522 @@
|
|
|
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,o=e||t||"en",c=(0,l.Bv)(),m=yield(0,l.ki)(`${c}/locales/${o}/${n}.json`),u=m?n:"translation",p=["translation",...m?[n]:[]];return new Promise(((e,t)=>{d.use(r.Z).init({debug:!1,react:{useSuspense:!1},lng:o,fallbackLng:!1,supportedLngs:["pt","en","es"],ns:p,defaultNS:u,fallbackNS:"translation",load:"currentOnly",preload:[o],interpolation:{escapeValue:!1},backend:{backends:[i.Z,a.Z],backendOptions:[{prefix:"i18next_res_r2u_sdk_",enabled:!0,expirationTime:6048e5},{loadPath:`${c}/locales/{{lng}}/{{ns}}.json`,allowMultiloading:!0}]}},(n=>{n&&t(new Error("R2U - Translation init failed")),e()}))}))}))}},5128:function(e,t,n){n.r(t),n.d(t,{default:function(){return ce}});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),u=n(7374),p=n(2297),f=n(6339),g=n(6504);const b=(0,o.createContext)({}),h=({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(b.Provider,{value:{isOpen:a,openModal:l,closeModal:()=>{r(),i(!1)},toggleModal:()=>{i(!a)}}},o.createElement(f.a,{i18n:g.f2},a?e:null))};var v=n(6793),x=n(1841),w=n.n(x),E=n(9163);const y=E.default.div`
|
|
3
|
+
.text {
|
|
4
|
+
margin: auto;
|
|
5
|
+
padding: 10px;
|
|
6
|
+
font-family: proxima-nova, sans-serif;
|
|
7
|
+
font-size: 16px;
|
|
8
|
+
font-weight: 300;
|
|
9
|
+
font-stretch: normal;
|
|
10
|
+
font-style: normal;
|
|
11
|
+
line-height: 1.25;
|
|
12
|
+
letter-spacing: normal;
|
|
13
|
+
text-align: center;
|
|
14
|
+
color: #222222;
|
|
15
|
+
b {
|
|
16
|
+
font-weight: bold;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.error {
|
|
21
|
+
margin-top: 100px;
|
|
22
|
+
font-size: 24px;
|
|
23
|
+
font-weight: bold;
|
|
24
|
+
line-height: 1.21;
|
|
25
|
+
color: #d45b5b;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.top {
|
|
29
|
+
width: 250px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.bottom {
|
|
33
|
+
width: 250px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.fallback-viewer-container {
|
|
37
|
+
width: 324px;
|
|
38
|
+
height: 324px;
|
|
39
|
+
margin: auto;
|
|
40
|
+
margin-top: 10px;
|
|
41
|
+
margin-bottom: 10px;
|
|
42
|
+
background-image: linear-gradient(to bottom, #e9eaeb, #e4e5e7);
|
|
43
|
+
|
|
44
|
+
model-viewer {
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.watermark {
|
|
51
|
+
margin-top: 40px;
|
|
52
|
+
margin-bottom: 20px;
|
|
53
|
+
padding-bottom: 22px;
|
|
54
|
+
}
|
|
55
|
+
`;var k=n(5060),O=n(3026);const S=E.default.div`
|
|
56
|
+
display: block;
|
|
57
|
+
position: fixed;
|
|
58
|
+
top: 0;
|
|
59
|
+
left: 0;
|
|
60
|
+
right: 0;
|
|
61
|
+
bottom: 0;
|
|
62
|
+
background-color: ${({color:e})=>e};
|
|
63
|
+
z-index: 9999999;
|
|
64
|
+
overflow: auto;
|
|
65
|
+
|
|
66
|
+
.exit {
|
|
67
|
+
position: fixed;
|
|
68
|
+
top: 0;
|
|
69
|
+
left: 0;
|
|
70
|
+
z-index: 999999;
|
|
71
|
+
margin: 12px;
|
|
72
|
+
padding: 3px;
|
|
73
|
+
background: none;
|
|
74
|
+
border: none;
|
|
75
|
+
outline: none;
|
|
76
|
+
}
|
|
77
|
+
`,j=E.createGlobalStyle`
|
|
78
|
+
html {
|
|
79
|
+
overflow: hidden;
|
|
80
|
+
}
|
|
81
|
+
body {
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
}
|
|
84
|
+
`;var N=n(9429);var L=({children:e,color:t="white"})=>o.createElement(N.ZP.div,null,o.createElement(S,{color:t},o.createElement(j,null),e));var C=({glb:e})=>{const{closeModal:t}=(0,o.useContext)(b),{t:n}=(0,v.$)();return o.createElement(L,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`
|
|
85
|
+
width: 100%;
|
|
86
|
+
height: 100%;
|
|
87
|
+
background-image: linear-gradient(to bottom, #e9eaeb, #e4e5e7);
|
|
88
|
+
|
|
89
|
+
model-viewer {
|
|
90
|
+
width: 100%;
|
|
91
|
+
height: 100%;
|
|
92
|
+
}
|
|
93
|
+
`;var R=({glb:e})=>{const{closeModal:t}=(0,o.useContext)(b);return o.createElement(L,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 z=({openerElement:e,openerEvent:t,fallbackOptions:{alertMessage:n,fallback:r},glb:a})=>(n&&e.addEventListener(t,(()=>{alert(n)})),"viewer"===r&&a?o.createElement(h,{openerElement:e,openerEvent:t},o.createElement(C,{glb:a})):"full"===r&&a?o.createElement(h,{openerElement:e,openerEvent:t},o.createElement(R,{glb:a})):null);const A=E.default.div`
|
|
94
|
+
display: flex;
|
|
95
|
+
flex-direction: column;
|
|
96
|
+
align-items: center;
|
|
97
|
+
justify-content: space-evenly;
|
|
98
|
+
|
|
99
|
+
.powered {
|
|
100
|
+
display: flex;
|
|
101
|
+
text-decoration: unset;
|
|
102
|
+
flex-direction: row;
|
|
103
|
+
align-items: center;
|
|
104
|
+
margin-top: 2%;
|
|
105
|
+
|
|
106
|
+
img {
|
|
107
|
+
width: 32.9px;
|
|
108
|
+
height: 17px;
|
|
109
|
+
object-fit: contain;
|
|
110
|
+
margin: 5px;
|
|
111
|
+
filter: brightness(85%);
|
|
112
|
+
}
|
|
113
|
+
h1 {
|
|
114
|
+
width: 90px;
|
|
115
|
+
height: 20px;
|
|
116
|
+
font-family: proxima-Nova, sans-serif;
|
|
117
|
+
font-size: 16px;
|
|
118
|
+
font-weight: bold;
|
|
119
|
+
font-stretch: normal;
|
|
120
|
+
font-style: normal;
|
|
121
|
+
line-height: 1.25;
|
|
122
|
+
letter-spacing: normal;
|
|
123
|
+
text-align: center;
|
|
124
|
+
color: #d8d8d8;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.instructions {
|
|
129
|
+
width: min(90vw, 50vh);
|
|
130
|
+
height: min(90vw, 50vh);
|
|
131
|
+
border: solid 20px #f2f2f2;
|
|
132
|
+
margin: 12px;
|
|
133
|
+
|
|
134
|
+
.border {
|
|
135
|
+
border-radius: 20px;
|
|
136
|
+
box-shadow: 0 0 0 20px #f2f2f2;
|
|
137
|
+
width: 100%;
|
|
138
|
+
height: 100%;
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-direction: row;
|
|
141
|
+
justify-content: space-between;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.example {
|
|
145
|
+
height: 100%;
|
|
146
|
+
object-fit: contain;
|
|
147
|
+
border-radius: 20px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.instructionsColumn {
|
|
151
|
+
display: flex;
|
|
152
|
+
flex-direction: column;
|
|
153
|
+
justify-content: space-evenly;
|
|
154
|
+
align-items: center;
|
|
155
|
+
width: 50%;
|
|
156
|
+
span {
|
|
157
|
+
font-family: proxima-Nova, sans-serif;
|
|
158
|
+
font-size: 14px;
|
|
159
|
+
font-weight: bold;
|
|
160
|
+
font-stretch: normal;
|
|
161
|
+
font-style: normal;
|
|
162
|
+
line-height: 1.22;
|
|
163
|
+
letter-spacing: normal;
|
|
164
|
+
text-align: center;
|
|
165
|
+
color: #000000;
|
|
166
|
+
}
|
|
167
|
+
.icon {
|
|
168
|
+
width: 50%;
|
|
169
|
+
object-fit: contain;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.no-watermark {
|
|
175
|
+
margin-top: 60px;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.text {
|
|
179
|
+
h1 {
|
|
180
|
+
font-family: proxima-Nova, sans-serif;
|
|
181
|
+
font-size: 26px;
|
|
182
|
+
font-weight: bold;
|
|
183
|
+
font-stretch: normal;
|
|
184
|
+
font-style: normal;
|
|
185
|
+
line-height: 1.23;
|
|
186
|
+
letter-spacing: normal;
|
|
187
|
+
text-align: center;
|
|
188
|
+
color: #000000;
|
|
189
|
+
}
|
|
190
|
+
h3 {
|
|
191
|
+
font-family: proxima-Nova, sans-serif;
|
|
192
|
+
font-size: 18px;
|
|
193
|
+
font-weight: 300;
|
|
194
|
+
font-stretch: normal;
|
|
195
|
+
font-style: normal;
|
|
196
|
+
line-height: 1.22;
|
|
197
|
+
letter-spacing: normal;
|
|
198
|
+
text-align: center;
|
|
199
|
+
color: #707070;
|
|
200
|
+
margin: 5px 20px 30px 20px;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.ar-button {
|
|
205
|
+
width: calc(100vw - 40px);
|
|
206
|
+
height: 50px;
|
|
207
|
+
border: none;
|
|
208
|
+
margin: auto;
|
|
209
|
+
border-radius: 23px;
|
|
210
|
+
background-color: #000000;
|
|
211
|
+
&:disabled {
|
|
212
|
+
background-color: gray;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
span {
|
|
216
|
+
font-family: proxima-Nova, sans-serif;
|
|
217
|
+
font-size: 18px;
|
|
218
|
+
font-weight: bold;
|
|
219
|
+
font-stretch: normal;
|
|
220
|
+
font-style: normal;
|
|
221
|
+
line-height: 1.22;
|
|
222
|
+
letter-spacing: normal;
|
|
223
|
+
text-align: center;
|
|
224
|
+
color: #ffffff;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
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)(b),{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(A,null,o.createElement(O.Ao,{width:30,height:30,color:"#707070",cursor:"pointer",className:"exit",onClick:i}),t?o.createElement("a",{href:"https://r2u.io",className:"powered",target:"_blank",rel:"noopener noreferrer"},o.createElement("h1",null,l("poweredBy")),o.createElement("img",{src:"https://sdk.r2u.io/assets/r2u-full-white-logo.png",alt:"",className:"icon"})):null,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 W=E.default.div`
|
|
228
|
+
display: flex;
|
|
229
|
+
flex-direction: column;
|
|
230
|
+
align-items: center;
|
|
231
|
+
justify-content: space-between;
|
|
232
|
+
height: 100vh;
|
|
233
|
+
|
|
234
|
+
.logo {
|
|
235
|
+
display: flex;
|
|
236
|
+
align-items: center;
|
|
237
|
+
justify-content: center;
|
|
238
|
+
background-color: #f80032;
|
|
239
|
+
width: 100%;
|
|
240
|
+
border-radius: 0px 0px 16px 16px;
|
|
241
|
+
padding: 28px 0px;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.instructions {
|
|
245
|
+
overflow: hidden;
|
|
246
|
+
width: 100%;
|
|
247
|
+
margin: 29px 0;
|
|
248
|
+
display: flex;
|
|
249
|
+
flex-direction: row;
|
|
250
|
+
justify-content: space-evenly;
|
|
251
|
+
|
|
252
|
+
.example {
|
|
253
|
+
width: 25vh;
|
|
254
|
+
height: auto;
|
|
255
|
+
border-radius: 16px;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
@media screen and (max-width: 359px) {
|
|
259
|
+
.example {
|
|
260
|
+
width: 20vh;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.instructions-column {
|
|
265
|
+
display: flex;
|
|
266
|
+
flex-direction: column;
|
|
267
|
+
align-items: center;
|
|
268
|
+
justify-content: space-evenly;
|
|
269
|
+
|
|
270
|
+
.instruction-unit {
|
|
271
|
+
display: flex;
|
|
272
|
+
flex-direction: column;
|
|
273
|
+
align-items: center;
|
|
274
|
+
justify-content: center;
|
|
275
|
+
|
|
276
|
+
.icon {
|
|
277
|
+
width: 50px;
|
|
278
|
+
height: auto;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
span {
|
|
282
|
+
font-family: 'Roboto', sans-serif;
|
|
283
|
+
font-weight: 400;
|
|
284
|
+
margin-top: 12px;
|
|
285
|
+
color: #333333;
|
|
286
|
+
width: 140px;
|
|
287
|
+
font-size: 14px;
|
|
288
|
+
text-align: center;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
@media screen and (max-width: 359px) {
|
|
292
|
+
span {
|
|
293
|
+
width: 130px;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.footer {
|
|
301
|
+
padding-top: 32px;
|
|
302
|
+
margin-top: 28px;
|
|
303
|
+
border-radius: 16px 16px 0px 0px;
|
|
304
|
+
width: 100%;
|
|
305
|
+
background-color: #ffffff;
|
|
306
|
+
display: flex;
|
|
307
|
+
flex-direction: column;
|
|
308
|
+
align-items: center;
|
|
309
|
+
|
|
310
|
+
span {
|
|
311
|
+
font-family: 'Roboto', sans-serif;
|
|
312
|
+
font-weight: 400;
|
|
313
|
+
width: 280px;
|
|
314
|
+
font-size: 16px;
|
|
315
|
+
color: #333333;
|
|
316
|
+
text-align: center;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
@media screen and (max-width: 359px) {
|
|
320
|
+
span {
|
|
321
|
+
width: 200px;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.ar-button {
|
|
326
|
+
margin: 24px;
|
|
327
|
+
width: 90%;
|
|
328
|
+
border: none;
|
|
329
|
+
height: 54px;
|
|
330
|
+
border-radius: 12px;
|
|
331
|
+
background-color: #f80032;
|
|
332
|
+
span {
|
|
333
|
+
font-family: 'Roboto', sans-serif;
|
|
334
|
+
font-weight: 700;
|
|
335
|
+
color: #ffffff;
|
|
336
|
+
font-size: 17px;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
`;var X=n.p+"fonts/Roboto.ttf",T=E.createGlobalStyle`
|
|
341
|
+
@font-face {
|
|
342
|
+
font-family: 'Roboto';
|
|
343
|
+
src: url(${X}) format('truetype');
|
|
344
|
+
}
|
|
345
|
+
`,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 H=e=>{var{onOpen:t,activateAR:n}=e,r=Z(e,["onOpen","activateAR"]);const{closeModal:a}=(0,o.useContext)(b),[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(T,null),o.createElement(W,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")))))},$=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 U=({customerId:e})=>"701ba5cb-152f-4724-9a5f-bb5b1c42d81c"===e?H:I;var _=e=>{var{openerElement:t,openerEvent:n,customerId:r}=e,a=$(e,["openerElement","openerEvent","customerId"]);const i=U({customerId:r});return o.createElement(h,{openerElement:t,openerEvent:n},o.createElement(i,Object.assign({},a)))};const D=E.default.div`
|
|
346
|
+
display: grid;
|
|
347
|
+
place-content: center;
|
|
348
|
+
margin-top: 45%;
|
|
349
|
+
|
|
350
|
+
span {
|
|
351
|
+
font-family: Proxima-Nova, sans-serif;
|
|
352
|
+
font-stretch: normal;
|
|
353
|
+
font-style: normal;
|
|
354
|
+
line-height: 1.25;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.balloon {
|
|
358
|
+
width: min(90vh, 38vh);
|
|
359
|
+
height: min(90vw, 32vh);
|
|
360
|
+
border-radius: 10px;
|
|
361
|
+
box-shadow: 0 0 32px 0 rgba(0, 0, 0, 0.49);
|
|
362
|
+
background-color: #ffffff;
|
|
363
|
+
display: flex;
|
|
364
|
+
flex-direction: column;
|
|
365
|
+
|
|
366
|
+
.title {
|
|
367
|
+
font-weight: bold;
|
|
368
|
+
line-height: 1.25;
|
|
369
|
+
letter-spacing: normal;
|
|
370
|
+
text-align: center;
|
|
371
|
+
color: #000000;
|
|
372
|
+
margin-bottom: 2px;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
button.close {
|
|
376
|
+
border: none;
|
|
377
|
+
border-top: solid 1px #c9c9c9;
|
|
378
|
+
outline: none;
|
|
379
|
+
background: none;
|
|
380
|
+
display: flex;
|
|
381
|
+
justify-content: center;
|
|
382
|
+
align-items: center;
|
|
383
|
+
margin-top: auto;
|
|
384
|
+
height: 50px;
|
|
385
|
+
|
|
386
|
+
span {
|
|
387
|
+
font-size: 14px;
|
|
388
|
+
line-height: 1.25;
|
|
389
|
+
letter-spacing: normal;
|
|
390
|
+
text-align: center;
|
|
391
|
+
color: #000000;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
`,F=E.default.div`
|
|
396
|
+
display: flex;
|
|
397
|
+
flex-direction: column;
|
|
398
|
+
justify-content: left;
|
|
399
|
+
align-items: center;
|
|
400
|
+
width: 100%;
|
|
401
|
+
height: 100%;
|
|
402
|
+
|
|
403
|
+
.title {
|
|
404
|
+
padding: 20px;
|
|
405
|
+
padding-bottom: 0;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.buttons {
|
|
409
|
+
display: flex;
|
|
410
|
+
flex-direction: row;
|
|
411
|
+
align-items: center;
|
|
412
|
+
justify-content: space-evenly;
|
|
413
|
+
width: 100%;
|
|
414
|
+
height: 100%;
|
|
415
|
+
|
|
416
|
+
& > button {
|
|
417
|
+
width: 24%;
|
|
418
|
+
height: 55px;
|
|
419
|
+
border-radius: 5px;
|
|
420
|
+
border: none;
|
|
421
|
+
margin: none;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.dislike {
|
|
425
|
+
background-color: #d96a6a;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.like {
|
|
429
|
+
background-color: #a9ce8f;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
`,J=E.default.div`
|
|
433
|
+
display: flex;
|
|
434
|
+
flex-direction: column;
|
|
435
|
+
justify-content: space-evenly;
|
|
436
|
+
align-items: center;
|
|
437
|
+
text-align: center;
|
|
438
|
+
width: 100%;
|
|
439
|
+
height: 100%;
|
|
440
|
+
`;var B=()=>{const{closeModal:e}=(0,o.useContext)(b),{t:t}=(0,v.$)();return setTimeout(e,2e3),o.createElement(J,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 q=({onLike:e,onDislike:t})=>{const{t:n}=(0,v.$)();return o.createElement(F,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 G=({onLike:e,onDislike:t,onOpen:n})=>{const{closeModal:r}=(0,o.useContext)(b),{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(D,null,o.createElement("div",{className:"balloon"},i?o.createElement(B,null):o.createElement(q,{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"))))))},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 V=e=>{var{openerElement:t,openerEvent:n,onClose:r}=e,a=K(e,["openerElement","openerEvent","onClose"]);return o.createElement(h,{onClose:r,openerElement:t,openerEvent:n},o.createElement(G,Object.assign({onClose:r},a)))};const Q=E.default.div`
|
|
441
|
+
display: flex;
|
|
442
|
+
width: 100%;
|
|
443
|
+
height: 100%;
|
|
444
|
+
justify-content: center;
|
|
445
|
+
align-items: center;
|
|
446
|
+
|
|
447
|
+
.balloon {
|
|
448
|
+
height: max-content;
|
|
449
|
+
width: 90%;
|
|
450
|
+
height: 50%;
|
|
451
|
+
background-color: white;
|
|
452
|
+
border-radius: 10px;
|
|
453
|
+
|
|
454
|
+
position: relative;
|
|
455
|
+
|
|
456
|
+
display: flex;
|
|
457
|
+
flex-direction: column;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.info {
|
|
461
|
+
padding: 25px;
|
|
462
|
+
display: flex;
|
|
463
|
+
justify-content: center;
|
|
464
|
+
align-items: center;
|
|
465
|
+
flex-direction: column;
|
|
466
|
+
|
|
467
|
+
img {
|
|
468
|
+
max-width: 100%;
|
|
469
|
+
margin: 0;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
h2 {
|
|
473
|
+
margin: 5px 10px 5px 10px;
|
|
474
|
+
font-family: Proxima-Nova, sans-serif;
|
|
475
|
+
font-size: 18px;
|
|
476
|
+
font-weight: bold;
|
|
477
|
+
font-stretch: normal;
|
|
478
|
+
font-style: normal;
|
|
479
|
+
line-height: 1.22;
|
|
480
|
+
letter-spacing: normal;
|
|
481
|
+
text-align: center;
|
|
482
|
+
color: #222222;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
p {
|
|
486
|
+
margin: 5px 3px 15px 3px;
|
|
487
|
+
font-family: Proxima-Nova, sans-serif;
|
|
488
|
+
font-size: 14px;
|
|
489
|
+
font-weight: normal;
|
|
490
|
+
font-stretch: normal;
|
|
491
|
+
font-style: normal;
|
|
492
|
+
line-height: 1.21;
|
|
493
|
+
letter-spacing: normal;
|
|
494
|
+
text-align: center;
|
|
495
|
+
color: #222222;
|
|
496
|
+
|
|
497
|
+
u {
|
|
498
|
+
font-weight: bold;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
button {
|
|
504
|
+
padding: 20px;
|
|
505
|
+
border: none;
|
|
506
|
+
border-top: solid 0.1px rgba(0, 0, 0, 0.2);
|
|
507
|
+
margin-top: auto;
|
|
508
|
+
height: 20%;
|
|
509
|
+
outline: none;
|
|
510
|
+
background: none;
|
|
511
|
+
|
|
512
|
+
font-family: Proxima-Nova, sans-serif;
|
|
513
|
+
font-size: 16px;
|
|
514
|
+
font-weight: normal;
|
|
515
|
+
font-stretch: normal;
|
|
516
|
+
font-style: normal;
|
|
517
|
+
line-height: 1.19;
|
|
518
|
+
letter-spacing: normal;
|
|
519
|
+
text-align: center;
|
|
520
|
+
color: #3d71ba;
|
|
521
|
+
}
|
|
522
|
+
`;var Y=()=>{const{closeModal:e}=(0,o.useContext)(b),{t:t}=(0,v.$)();return o.createElement(L,{color:"rgba(0, 0, 0, 0.3)"},o.createElement(Q,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(h,{openerElement:e,openerEvent:t},o.createElement(Y,null)),te=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 ne=/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 re=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())}))},ae=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 ie="#no-ar-fallback",le=e=>{var{container:t}=e,n=ae(e,["container"]);const a="r2u-feedback-open",i=document.createElement("div");return i.className="feedback",t.appendChild(i),r.render(o.createElement(V,Object.assign({openerElement:i,openerEvent:a},n)),i),{open:()=>{i.dispatchEvent(new Event(a))},render:()=>{}}};function se({element:e,event:t="click"}){return re(this,void 0,void 0,(function*(){e.dispatchEvent(new Event(t))}))}var ce={attach:function({sku:e,price:t,element:n,callToAction:p,event:f="click",showInstructions:g="once",showFeedback:b=!0,fallbackOptions:h={alertMessage:"Sentimos muito, mas infelizmente seu dispositivo não é compatível com a visualização em Realidade Aumentada"}}){return re(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:v,activateAR:x,WebXREvents:w}=yield a,E=()=>re(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 u.fm();i.Z.growthbook=new te.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 u.KN(n),u.fQ(o),"webxr-v3"===o})),{glb:y,usdz:k,name:O,placement:S,sound:j,resize:N,pdpUrl:L}=yield(0,m.Z)(e),C=N?"resizable":"fixed",[P,R]="pt"===i.Z.customer.language?["pt-BR","BRL"]:["en-US","USD"],A=p?Object.assign(Object.assign({},p),{onClick:()=>{p.onClick(),document.dispatchEvent(new Event("r2u-webxr-close")),u.ar.onClick()}}):void 0,M={glb:y,usdz:k,price:t,placement:S,scale:C,sound:j,callToAction:A,pdpUrl:L,title:O,mode:"ar_preferred"},I=Boolean(i.Z.customer.waterMarkPosition),W=()=>{const e=c("feedback");return b&&!e},X={model:{name:O,description:t?new Intl.NumberFormat(P,{style:"currency",currency:R}).format(Number(t)):"",glb:y,placement:S,resizable:N,url:L,showInstructions:(()=>{switch(g){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:()=>{u.J1.onLike(),u.XH.onLike()},onDislike:()=>{u.J1.onDislike(),u.XH.onDislike()},onClose:()=>document.dispatchEvent(new Event("r2u-webxr-close")),onOpen:()=>d("feedback")});W()?t():document.dispatchEvent(new Event("r2u-webxr-close"))},callToAction:A,language:i.Z.customer.language};u.J1.componentDidMount();const{open:T,render:Z}=(({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:h,glb:M.glb}),{open:H,render:$}=(e=>{var{hasWaterMark:t,onOpen:n,activateAR:a}=e,l=ae(e,["hasWaterMark","onOpen","activateAR"]);const s=document.createElement("div"),c="r2u-open-instructions";document.body.appendChild(s);const d=e=>{r.render(o.createElement(_,Object.assign({openerElement:s,openerEvent:c,onOpen:n,hasWaterMark:t,activateAR:a,customerId:i.Z.customer._id},e)),s)};return d(l),{open:()=>{s.dispatchEvent(new Event(c))},render:d}})(Object.assign({hasWaterMark:I,activateAR:x,onOpen:()=>d("instructions")},M)),{open:U}=le({container:document.body.appendChild(document.createElement("div")),onLike:()=>u.J1.onLike(),onDislike:()=>u.J1.onDislike(),onClose:()=>{},onOpen:()=>d("feedback")}),{open:D}=(()=>{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=>re(this,void 0,void 0,(function*(){const t=yield(0,m.Z)(e);M.glb=t.glb,M.usdz=t.usdz,M.placement=t.placement,M.sound=t.sound,M.scale=t.resize?"resizable":"fixed",M.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,$(M),Z(M)})),J=()=>re(this,void 0,void 0,(function*(){if(oe&&/instagram|FBAN|FBAV|LinkedInApp/i.test(navigator.userAgent))return void D();var e;ne&&"wall"!==S&&(yield E())?(e=w,u.XH.setSession(),document.addEventListener(e.r2uWebxrSessionStart,u.XH.onSessionStart,{once:!0}),document.addEventListener(e.r2uWebxrSessionEnd,u.XH.onSessionEnd,{once:!0}),document.addEventListener(e.r2uWebxrCompatible,(()=>u.XH.setCompatible(!0)),{once:!0}),document.addEventListener(e.r2uWebxrNotCompatible,(()=>u.XH.setCompatible(!1)),{once:!0}),document.addEventListener(e.r2uWebxrPlaneMapped,u.XH.setPlaneMapped,{once:!0}),document.addEventListener(e.r2uWebxrObjectPlaced,u.XH.setObjectPlaced,{once:!0}),document.addEventListener(e.r2uWebxrShowTranslatingInstructions,(()=>{u.XH.setTranslateInstructions(),s("translate")}),{once:!0}),document.addEventListener(e.r2uWebxrShowRotatingInstructions,(()=>{u.XH.setRotateInstructions(),s("rotate")}),{once:!0}),document.addEventListener(e.r2uWebxrTranslating,(()=>{u.XH.setFirstTranslation(),s("translate")}),{once:!0}),document.addEventListener(e.r2uWebxrRotating,(()=>{u.XH.setFirstRotation(),s("rotate")}),{once:!0}),document.addEventListener(e.r2uWebxrReset,u.XH.setReset,{once:!0}),document.addEventListener(e.r2uWebxrFallbackToSceneviewer,u.XH.onSceneViewerFallback,{once:!0}),window.addEventListener("hashchange",(()=>{window.location.hash===ie&&u.XH.onFallback()}),{once:!0}),document.addEventListener(e.r2uWebxrShare,u.XH.onShare),document.addEventListener(e.r2uWebxrExit,u.XH.onExit),document.addEventListener(e.r2uWebxrCallToAction,u.XH.onCallToAction),document.addEventListener(e.r2uWebxrTranslating,u.XH.onTranslation),document.addEventListener(e.r2uWebxrRotating,u.XH.onRotation),v(X)):(()=>{switch(g){case"always":return!0;case"never":return!1;default:return!c("instructions")}})()?H():x(M),yield u.J1.onClick();const t=(new Date).getTime(),n=()=>{if(document.hidden)return;const e=(new Date).getTime();u.J1.onSessionTimeCollect(e-t),W()&&U(),document.removeEventListener("visibilitychange",n)},o=()=>{const e=(new Date).getTime();u.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 B=new URL(window.location.href),q="true"===B.searchParams.get("r2u_redirect"),G=B.searchParams.get("r2u_sku");return q&&!i.Z.hasAutoOpenedAR&&(i.Z.hasAutoOpenedAR=!0,G&&(yield F(G)),se({element:n,event:f})),window.addEventListener("hashchange",(()=>{window.location.hash===ie&&(u.J1.onFallback(),n.removeEventListener(f,J),n.addEventListener(f,T),se({element:n,event:f}))}),{once:!0}),{setSku:F}}))},open:se,getLink:function(e){return re(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,p.U2)(`/sdk-ar/openar-link?customerId=${t}&productSku=${e}`);return Promise.resolve(n)}))}}}}]);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* @license
|
|
2
|
+
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkR2U=self.webpackChunkR2U||[]).push([[497],{7328:function(n,e,t){t.r(e);var o=t(2297),r=t(8665),u=t(2367),c=function(n,e,t,o){return new(t||(t=Promise))((function(r,u){function c(n){try{a(o.next(n))}catch(n){u(n)}}function i(n){try{a(o.throw(n))}catch(n){u(n)}}function a(n){var e;n.done?r(n.value):(e=n.value,e instanceof t?e:new t((function(n){n(e)}))).then(c,i)}a((o=o.apply(n,e||[])).next())}))};e.default={changeLanguage:function(n){return c(this,void 0,void 0,(function*(){const e=u.Z.customer.slug,t=(0,o.Bv)(),c=yield(0,o.ki)(`${t}/locales/${n}/${e}.json`);return new Promise(((e,t)=>{c||r.Z.setDefaultNamespace("translation"),r.Z.changeLanguage(n,(n=>{n&&t(new Error("R2U - Change language failed")),e()}))}))}))}}},2297:function(n,e,t){t.d(e,{U2:function(){return u},ki:function(){return c},Bv:function(){return i}});var o=t(2367),r=function(n,e,t,o){return new(t||(t=Promise))((function(r,u){function c(n){try{a(o.next(n))}catch(n){u(n)}}function i(n){try{a(o.throw(n))}catch(n){u(n)}}function a(n){var e;n.done?r(n.value):(e=n.value,e instanceof t?e:new t((function(n){n(e)}))).then(c,i)}a((o=o.apply(n,e||[])).next())}))};function u(n){return r(this,void 0,void 0,(function*(){const e={};o.Z.refreshCache&&(e["Cache-Control"]="max-age=0");return(yield fetch(`https://api.r2u.io${n}`,{method:"get",headers:e})).json()}))}function c(n){return r(this,void 0,void 0,(function*(){try{const{status:e}=yield fetch(n,{method:"HEAD"});return 200===e}catch(n){return console.error(n),!1}}))}const i=()=>"https://sdk.r2u.io"},2367:function(n,e){const t={init:!1,customer:{_id:"",slug:"",language:"en",hdri:null,exposure:null,bloom:null,experiments:{overrides:{}},viewerOptions:{}},analytics:{set:(n,e)=>{},send:({event:n,data:e,scope:t})=>Promise.resolve()},products:{},hasAutoOpenedAR:!1,growthbook:{},refreshCache:!1};e.Z=t}}]);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import { ProductCustomization } from '@r2u/customizer/dist/services/types';
|
|
2
1
|
import type { CallToAction } from '@r2u/react-ar-components';
|
|
3
|
-
import init from './methods/init';
|
|
4
|
-
import sku from './methods/sku';
|
|
5
|
-
import ar from './methods/ar';
|
|
6
|
-
import viewer from './methods/viewer';
|
|
7
|
-
import analytics from './methods/analytics';
|
|
8
|
-
import customizer from './methods/customizer';
|
|
9
|
-
import qrCode from './methods/qrCode';
|
|
10
|
-
import config from './methods/config';
|
|
11
2
|
import { SKUHandler, ViewerRef } from './methods/types';
|
|
12
3
|
import { Product } from '@services/product';
|
|
13
4
|
export default interface R2U {
|
|
@@ -66,15 +57,6 @@ export default interface R2U {
|
|
|
66
57
|
scope?: 'event' | 'page' | 'session' | 'sku';
|
|
67
58
|
}) => Promise<void>;
|
|
68
59
|
};
|
|
69
|
-
customizer: {
|
|
70
|
-
isActive: (sku: string) => Promise<boolean>;
|
|
71
|
-
create: (params: {
|
|
72
|
-
element: HTMLElement;
|
|
73
|
-
sku: string;
|
|
74
|
-
onConfirm: (productCustomization: ProductCustomization) => void;
|
|
75
|
-
resultContainer?: HTMLElement;
|
|
76
|
-
}) => Promise<void>;
|
|
77
|
-
};
|
|
78
60
|
qrCode: {
|
|
79
61
|
create: (params: {
|
|
80
62
|
element: HTMLElement;
|
|
@@ -88,4 +70,66 @@ declare global {
|
|
|
88
70
|
R2U: R2U;
|
|
89
71
|
}
|
|
90
72
|
}
|
|
91
|
-
|
|
73
|
+
declare const init: (params: {
|
|
74
|
+
customerId: string;
|
|
75
|
+
language?: 'pt' | 'en' | 'es';
|
|
76
|
+
analyticsParams?: {
|
|
77
|
+
dataLayerIntegration?: boolean;
|
|
78
|
+
sessionDurationMinutes?: number;
|
|
79
|
+
};
|
|
80
|
+
refreshCache?: boolean;
|
|
81
|
+
}) => Promise<void>;
|
|
82
|
+
declare const config: {
|
|
83
|
+
changeLanguage: (language: 'pt' | 'en' | 'es') => Promise<void>;
|
|
84
|
+
};
|
|
85
|
+
declare const ar: {
|
|
86
|
+
open: (params: {
|
|
87
|
+
element: HTMLElement;
|
|
88
|
+
event: string;
|
|
89
|
+
}) => Promise<void>;
|
|
90
|
+
attach: (params: {
|
|
91
|
+
element: HTMLElement;
|
|
92
|
+
sku: string;
|
|
93
|
+
price?: string;
|
|
94
|
+
eventType?: string;
|
|
95
|
+
resize?: boolean;
|
|
96
|
+
callToAction?: CallToAction;
|
|
97
|
+
showInstructions?: 'once' | 'always' | 'never';
|
|
98
|
+
showFeedback?: boolean;
|
|
99
|
+
fallbackOptions?: {
|
|
100
|
+
alertMessage?: string;
|
|
101
|
+
fallback?: 'viewer' | 'full';
|
|
102
|
+
};
|
|
103
|
+
}) => Promise<SKUHandler>;
|
|
104
|
+
getLink: (sku: string) => Promise<string>;
|
|
105
|
+
};
|
|
106
|
+
declare const sku: {
|
|
107
|
+
isActive: (sku: string) => Promise<boolean>;
|
|
108
|
+
getData: (sku: string) => Promise<Product>;
|
|
109
|
+
};
|
|
110
|
+
declare const viewer: {
|
|
111
|
+
create: (params: {
|
|
112
|
+
element: HTMLElement;
|
|
113
|
+
sku: string;
|
|
114
|
+
name?: string;
|
|
115
|
+
popup?: boolean;
|
|
116
|
+
progressBarPosition?: 'top' | 'middle' | 'bottom';
|
|
117
|
+
poster?: string;
|
|
118
|
+
autoRotate?: boolean;
|
|
119
|
+
}) => Promise<SKUHandler & ViewerRef>;
|
|
120
|
+
};
|
|
121
|
+
declare const analytics: {
|
|
122
|
+
send: (params: {
|
|
123
|
+
event: string;
|
|
124
|
+
data: Record<string, string | number>;
|
|
125
|
+
scope?: 'event' | 'page' | 'session' | 'sku';
|
|
126
|
+
}) => Promise<void>;
|
|
127
|
+
};
|
|
128
|
+
declare const qrCode: {
|
|
129
|
+
create: (params: {
|
|
130
|
+
element: HTMLElement;
|
|
131
|
+
sku: string;
|
|
132
|
+
showInstructions?: 'once' | 'always' | 'never';
|
|
133
|
+
}) => Promise<SKUHandler>;
|
|
134
|
+
};
|
|
135
|
+
export { init, sku, ar, viewer, analytics, qrCode, config };
|