Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wonder-partners/ar-button

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wonder-partners/ar-button - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

9

main.js

@@ -221,8 +221,7 @@ // @ts-check

if (iosConf.callToAction) element.setAttribute('call-to-action', iosConf.callToAction);
if (iosConf.canonicalWebPageURL) {
if (iosConf.canonicalWebPageURL)
element.setAttribute('canonical-web-page-url', iosConf.canonicalWebPageURL);
}
if (iosConf.allowsContentScaling) {
if (iosConf.allowsContentScaling)
element.setAttribute('allows-content-scaling', iosConf.allowsContentScaling ? '1' : '0');
}
initIOS(element);

@@ -232,4 +231,4 @@ }

autoInit();
window.addEventListener('DOMContentLoaded', autoInit);
export { init, isARQuickLookCompatible };

@@ -1,1 +0,1 @@

class t extends Error{constructor(t){super(t),this.name="Requirement Error"}}const e="deferred",n={Android:()=>null!==navigator.userAgent.match(/Android/i),BlackBerry:()=>null!==navigator.userAgent.match(/BlackBerry/i),iOS:()=>null!==navigator.userAgent.match(/iPhone|iPad|iPod/i),Opera:()=>null!==navigator.userAgent.match(/Opera Mini/i),Windows:()=>null!==navigator.userAgent.match(/IEMobile/i)||null!==navigator.userAgent.match(/WPDesktop/i),iPadOS:()=>navigator.userAgent.includes("Mac")&&"ontouchend"in document,any:()=>n.Android()||n.iOS()||n.iPadOS||n.Opera()||n.BlackBerry()||n.Windows()};function i(){const t=document.createElement("a").relList.supports("ar");if(n.iOS()){const e=navigator.userAgent.match(/\b[0-9]+_[0-9]+(?:_[0-9]+)?\b/);return!!e&&(t&&Number(e[0].split("_")[0])>12)}return t}function o(e,n=""){if(!e)throw new t(n);return!0}function r(t,e){const n=t.getAttribute(e);if(!n)return null;return encodeURIComponent(n)}function c(t,e=""){const o=document.createElement("a");if(o.setAttribute("id","ar-anchor"),n.iOS()||n.iPadOS()){if(!i())return void console.error("AR is not available.");o.appendChild(document.createElement("img")),o.setAttribute("rel","ar"),o.addEventListener("message",(t=>{"_apple_ar_quicklook_button_tapped"===t.data&&(window.location.href=e)}),!1)}o.setAttribute("href",t),document.body.appendChild(o),o.click()}function l(t){t.setAttribute("ar","quick-look");const e=t.getAttribute("ios-src"),n=t.getAttribute("ios-link")??t.getAttribute("link")??"",i=t.getAttribute("allows-content-scaling"),o=r(t,"checkout-title"),l=r(t,"checkout-subtitle"),a=r(t,"price"),u=r(t,"call-to-action"),s=r(t,"canonical-web-page-url");let d=`${e}#`;o&&(d+=`&checkoutTitle=${o}`),l&&(d+=`&checkoutSubtitle=${l}`),a&&(d+=`&price=${a}`),u&&(d+=`&callToAction=${u}`),s&&(d+=`&canonicalWebPageURL=${s}`),"0"===i&&(d+="&allowsContentScaling=0"),t.addEventListener("click",(()=>c(d,n)))}function a(t){t.setAttribute("ar","scene-viewer");const e=t.getAttribute("src"),n=t.getAttribute("link"),i=r(t,"title"),o=r(t,"fallback-url")??"https://developers.google.com/ar",l=t.hasAttribute("occlusion");let a=`intent://arvr.google.com/scene-viewer/1.0?file=${e}&mode=ar_only`;i&&(a+=`&title=${i}`),n&&(a+=`&link=${n}`),l||(a+="&disable_occlusion=true"),a+="#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;",a+=`S.browser_fallback_url=${o};`,a+="end;",t.addEventListener("click",(()=>c(a)))}function u({element:t,androidConf:i,iosConf:r}){o(t,"element cannot be null"),t.removeAttribute(e),n.Android()&&i&&(o(i.src,"src cannot be null, undefined or empty."),t.setAttribute("src",i.src),i.title&&t.setAttribute("title",i.title),i.link&&t.setAttribute("link",i.link),i.fallbackURL&&t.setAttribute("fallback-url",i.fallbackURL),i.occlusion&&!0===i.occlusion&&t.setAttribute("occlusion",""),a(t)),(n.iOS()||n.iPadOS())&&r&&(o(r.src,"src cannot be null, undefined or empty."),r.checkoutSubtitle??="ㅤ",r.price??="",t.setAttribute("ios-src",r.src),t.setAttribute("checkout-subtitle",r.checkoutSubtitle),t.setAttribute("price",r.price),r.checkoutTitle&&t.setAttribute("checkout-title",r.checkoutTitle),r.link&&t.setAttribute("ios-link",r.link),r.callToAction&&t.setAttribute("call-to-action",r.callToAction),r.canonicalWebPageURL&&t.setAttribute("canonical-web-page-url",r.canonicalWebPageURL),r.allowsContentScaling&&t.setAttribute("allows-content-scaling",r.allowsContentScaling?"1":"0"),l(t))}!function(){if(!n.any())return void console.error("This platform does not support AR.");document.querySelectorAll("ar-button").forEach((t=>{t.hasAttribute(e)||(n.iOS()||n.iPadOS()?l(t):n.Android()&&a(t))}))}();export{u as init,i as isARQuickLookCompatible};
class t extends Error{constructor(t){super(t),this.name="Requirement Error"}}const e="deferred",n={Android:()=>null!==navigator.userAgent.match(/Android/i),BlackBerry:()=>null!==navigator.userAgent.match(/BlackBerry/i),iOS:()=>null!==navigator.userAgent.match(/iPhone|iPad|iPod/i),Opera:()=>null!==navigator.userAgent.match(/Opera Mini/i),Windows:()=>null!==navigator.userAgent.match(/IEMobile/i)||null!==navigator.userAgent.match(/WPDesktop/i),iPadOS:()=>navigator.userAgent.includes("Mac")&&"ontouchend"in document,any:()=>n.Android()||n.iOS()||n.iPadOS||n.Opera()||n.BlackBerry()||n.Windows()};function i(){const t=document.createElement("a").relList.supports("ar");if(n.iOS()){const e=navigator.userAgent.match(/\b[0-9]+_[0-9]+(?:_[0-9]+)?\b/);return!!e&&(t&&Number(e[0].split("_")[0])>12)}return t}function o(e,n=""){if(!e)throw new t(n);return!0}function r(t,e){const n=t.getAttribute(e);if(!n)return null;return encodeURIComponent(n)}function c(t,e=""){const o=document.createElement("a");if(o.setAttribute("id","ar-anchor"),n.iOS()||n.iPadOS()){if(!i())return void console.error("AR is not available.");o.appendChild(document.createElement("img")),o.setAttribute("rel","ar"),o.addEventListener("message",(t=>{"_apple_ar_quicklook_button_tapped"===t.data&&(window.location.href=e)}),!1)}o.setAttribute("href",t),document.body.appendChild(o),o.click()}function l(t){t.setAttribute("ar","quick-look");const e=t.getAttribute("ios-src"),n=t.getAttribute("ios-link")??t.getAttribute("link")??"",i=t.getAttribute("allows-content-scaling"),o=r(t,"checkout-title"),l=r(t,"checkout-subtitle"),a=r(t,"price"),u=r(t,"call-to-action"),s=r(t,"canonical-web-page-url");let d=`${e}#`;o&&(d+=`&checkoutTitle=${o}`),l&&(d+=`&checkoutSubtitle=${l}`),a&&(d+=`&price=${a}`),u&&(d+=`&callToAction=${u}`),s&&(d+=`&canonicalWebPageURL=${s}`),"0"===i&&(d+="&allowsContentScaling=0"),t.addEventListener("click",(()=>c(d,n)))}function a(t){t.setAttribute("ar","scene-viewer");const e=t.getAttribute("src"),n=t.getAttribute("link"),i=r(t,"title"),o=r(t,"fallback-url")??"https://developers.google.com/ar",l=t.hasAttribute("occlusion");let a=`intent://arvr.google.com/scene-viewer/1.0?file=${e}&mode=ar_only`;i&&(a+=`&title=${i}`),n&&(a+=`&link=${n}`),l||(a+="&disable_occlusion=true"),a+="#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;",a+=`S.browser_fallback_url=${o};`,a+="end;",t.addEventListener("click",(()=>c(a)))}function u({element:t,androidConf:i,iosConf:r}){o(t,"element cannot be null"),t.removeAttribute(e),n.Android()&&i&&(o(i.src,"src cannot be null, undefined or empty."),t.setAttribute("src",i.src),i.title&&t.setAttribute("title",i.title),i.link&&t.setAttribute("link",i.link),i.fallbackURL&&t.setAttribute("fallback-url",i.fallbackURL),i.occlusion&&!0===i.occlusion&&t.setAttribute("occlusion",""),a(t)),(n.iOS()||n.iPadOS())&&r&&(o(r.src,"src cannot be null, undefined or empty."),r.checkoutSubtitle??="ㅤ",r.price??="",t.setAttribute("ios-src",r.src),t.setAttribute("checkout-subtitle",r.checkoutSubtitle),t.setAttribute("price",r.price),r.checkoutTitle&&t.setAttribute("checkout-title",r.checkoutTitle),r.link&&t.setAttribute("ios-link",r.link),r.callToAction&&t.setAttribute("call-to-action",r.callToAction),r.canonicalWebPageURL&&t.setAttribute("canonical-web-page-url",r.canonicalWebPageURL),r.allowsContentScaling&&t.setAttribute("allows-content-scaling",r.allowsContentScaling?"1":"0"),l(t))}window.addEventListener("DOMContentLoaded",(function(){if(!n.any())return void console.error("This platform does not support AR.");document.querySelectorAll("ar-button").forEach((t=>{t.hasAttribute(e)||(n.iOS()||n.iPadOS()?l(t):n.Android()&&a(t))}))}));export{u as init,i as isARQuickLookCompatible};
{
"name": "@wonder-partners/ar-button",
"version": "1.0.0",
"version": "1.0.1",
"description": "A web component to easily display 3D models in native AR across browsers and mobile devices",

@@ -5,0 +5,0 @@ "main": "main.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc