shopar-plugin
Advanced tools
Comparing version 0.8.2-alpha.2 to 0.8.2
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ShopAR__analytics={})}(this,(function(t){"use strict";function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function i(t){return Number.isInteger(t)&&t>=0}function n(t){this.name="ArgumentError",this.message=t}var s=e((function(t,e){if(e=e||{},"function"!=typeof t)throw new n("fetch must be a function");if("object"!=typeof e)throw new n("defaults must be an object");if(void 0!==e.retries&&!i(e.retries))throw new n("retries must be a positive integer");if(void 0!==e.retryDelay&&!i(e.retryDelay)&&"function"!=typeof e.retryDelay)throw new n("retryDelay must be a positive integer or a function returning a positive integer");if(void 0!==e.retryOn&&!Array.isArray(e.retryOn)&&"function"!=typeof e.retryOn)throw new n("retryOn property expects an array or function");return e=Object.assign({retries:3,retryDelay:1e3,retryOn:[]},e),function(s,r){var a=e.retries,o=e.retryDelay,c=e.retryOn;if(r&&void 0!==r.retries){if(!i(r.retries))throw new n("retries must be a positive integer");a=r.retries}if(r&&void 0!==r.retryDelay){if(!i(r.retryDelay)&&"function"!=typeof r.retryDelay)throw new n("retryDelay must be a positive integer or a function returning a positive integer");o=r.retryDelay}if(r&&r.retryOn){if(!Array.isArray(r.retryOn)&&"function"!=typeof r.retryOn)throw new n("retryOn property expects an array or function");c=r.retryOn}return new Promise((function(e,i){var n=function(n){var o="undefined"!=typeof Request&&s instanceof Request?s.clone():s;t(o,r).then((function(t){if(Array.isArray(c)&&-1===c.indexOf(t.status))e(t);else if("function"==typeof c)try{return Promise.resolve(c(n,null,t)).then((function(i){i?u(n,null,t):e(t)})).catch(i)}catch(t){i(t)}else n<a?u(n,null,t):e(t)})).catch((function(t){if("function"==typeof c)try{Promise.resolve(c(n,t,null)).then((function(e){e?u(n,t,null):i(t)})).catch((function(t){i(t)}))}catch(t){i(t)}else n<a?u(n,t,null):i(t)}))};function u(t,e,i){var s="function"==typeof o?o(t,e,i):o;setTimeout((function(){n(++t)}),s)}n(0)}))}}));var r,a;!function(t){t.unknown="unknown",t.user="user",t.organization="organization",t.anonymous="anonymous"}(r||(r={})),function(t){t.api="api",t.query="query",t.ingest="ingest"}(a||(a={}));class o{scope;type;value;remaining;reset;constructor(t=r.unknown,e=a.api,i=0,n=-1,s=new Date){this.scope=t,this.type=e,this.value=i,this.remaining=n,this.reset=s}}function c(t,e,i,n,s){let a=new o;const c=t.headers.get(e.toLowerCase())||r.unknown;a.scope=r[c];const u=t.headers.get(i.toLowerCase())||"",h=parseInt(u,10);isNaN(h)||(a.value=h);const l=t.headers.get(n.toLowerCase())||"",f=parseInt(l,10);isNaN(f)||(a.remaining=f);const m=t.headers.get(s.toLowerCase())||"",y=parseInt(m,10);return isNaN(y)||(a.reset=new Date(1e3*y)),a}class u{config;constructor(t){this.config=t}async doReq(t,e,i={},n={}){let r=`${this.config.baseUrl}${t}`;const o=this._prepareSearchParams(n);o&&(r+=`?${o.toString()}`);const u={...this.config.headers,...i.headers},l=await s(fetch)(r,{retries:3,retryDelay:function(t,e,i){return 1e3*Math.pow(2,t)},retryOn:[503,502,504,500],headers:u,method:e,body:i.body?i.body:void 0});if(204===l.status)return l;if(429==l.status){const t=function(t){let e;return t.url?.endsWith("/ingest")?(e=c(t,"","X-IngestLimit-Limit","X-IngestLimit-Remaining","X-IngestLimit-Reset"),e.type=a.ingest):t.url?.endsWith("/query")||t.url?.endsWith("/_apl")?(e=c(t,"","X-QueryLimit-Limit","X-QueryLimit-Remaining","X-QueryLimit-Reset"),e.type=a.query):(e=c(t,"X-RateLimit-Scope","X-RateLimit-Limit","X-RateLimit-Remaining","X-RateLimit-Reset"),e.type=a.api),e}(l);return Promise.reject(new h(t))}if(401===l.status)return Promise.reject(new Error("Forbidden"));if(l.status>=400){const t=await l.json();return Promise.reject(new Error(t.message))}return await l.json()}post(t,e={},i={}){return this.doReq(t,"POST",e,i)}get(t,e={},i={}){return this.doReq(t,"GET",e,i)}put(t,e={},i={}){return this.doReq(t,"PUT",e,i)}delete(t,e={},i={}){return this.doReq(t,"DELETE",e,i)}_prepareSearchParams=t=>{const e=new URLSearchParams;let i=!1;return Object.keys(t).forEach((n=>{t[n]&&(e.append(n,t[n]),i=!0)})),i?e:null}}class h extends Error{limit;shortcircuit;message="";constructor(t,e=!1){super(),this.limit=t,this.shortcircuit=e,Object.setPrototypeOf(this,h.prototype);const i=h.timeUntilReset(t);this.message=`${t.type} limit exceeded, try again in ${i.minutes}m${i.seconds}s`,t.type==a.api&&(this.message=`${t.scope} `+this.message)}static timeUntilReset(t){const e=t.reset.getTime()-(new Date).getTime(),i=Math.floor(e/1e3%60);return{total:e,minutes:Math.floor(e/1e3/60%60),seconds:i}}}class l{client;constructor({orgId:t="",token:e,url:i}){e||console.warn("Missing Axiom token");const n=i??"https://api.axiom.co",s={Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+e};"undefined"==typeof window&&(s["User-Agent"]="axiom-js/1.0.0-rc.1"),t&&(s["X-Axiom-Org-Id"]=t),this.client=new u({baseUrl:n,headers:s,timeout:3e3})}}var f,m,y,p,d,g;!function(t){t.TimestampField="_time";t.Service=class extends l{localPath="/v1/datasets";list=()=>this.client.get(this.localPath);get=t=>this.client.get(this.localPath+"/"+t);create=t=>this.client.post(this.localPath,{body:JSON.stringify(t)});update=(t,e)=>this.client.put(this.localPath+"/"+t,{body:JSON.stringify(e)});delete=t=>this.client.delete(this.localPath+"/"+t);trim=(t,e)=>{const i={maxDuration:e};return this.client.post(this.localPath+"/"+t+"/trim",{body:JSON.stringify(i)})}}}(f||(f={})),function(t){t.Service=class extends l{current=()=>this.client.get("/v1/user")}}(m||(m={}));class w{ingestFn;id;options;events=[];activeFlush=Promise.resolve();nextFlush=setTimeout((()=>{}),0);lastFlush=new Date;constructor(t,e,i){this.ingestFn=t,this.id=e,this.options=i}ingest=t=>{Array.isArray(t)?this.events=this.events.concat(t):this.events.push(t),this.events.length>=1e3||this.lastFlush.getTime()<Date.now()-1e3?(clearTimeout(this.nextFlush),this.activeFlush=this.flush()):(clearTimeout(this.nextFlush),this.nextFlush=setTimeout((()=>{this.activeFlush=this.flush()}),1e3))};flush=async()=>{const t=this.events.splice(0,this.events.length);if(clearTimeout(this.nextFlush),await this.activeFlush,0===t.length)return void(this.lastFlush=new Date);const e=await this.ingestFn(this.id,t,this.options);return this.lastFlush=new Date,e}}class v extends l{datasets;users;localPath="/v1";constructor(t){super(t),this.datasets=new f.Service(t),this.users=new m.Service(t)}ingestRaw=(t,e,i=y.JSON,n=p.Identity,s)=>this.client.post(this.localPath+"/datasets/"+t+"/ingest",{headers:{"Content-Type":i,"Content-Encoding":n},body:e},{"timestamp-field":s?.timestampField,"timestamp-format":s?.timestampFormat,"csv-delimiter":s?.csvDelimiter});queryLegacy=(t,e,i)=>this.client.post(this.localPath+"/datasets/"+t+"/query",{body:JSON.stringify(e)},{"streaming-duration":i?.streamingDuration,nocache:i?.noCache});query=(t,e)=>{const i={apl:t};return e?.startTime&&(i.startTime=e?.startTime),e?.endTime&&(i.endTime=e?.endTime),this.client.post(this.localPath+"/datasets/_apl",{body:JSON.stringify(i)},{"streaming-duration":e?.streamingDuration,nocache:e?.noCache,format:"legacy"})};aplQuery=(t,e)=>this.query(t,e)}class b extends v{batch={};ingest=(t,e,i)=>{const n=function(t,e){return`${t}:${e?.timestampField||"-"}:${e?.timestampFormat||"-"}:${e?.csvDelimiter||"-"}`}(t,i);return this.batch[n]||(this.batch[n]=new w(((t,e,i)=>{const n=(Array.isArray(e)?e:[e]).map((t=>JSON.stringify(t))).join("\n");return this.ingestRaw(t,n,y.NDJSON,p.Identity,i)}),t,i)),this.batch[n].ingest(e)};flush=async()=>{let t=[];for(const e in this.batch)t.push(this.batch[e].flush());await Promise.all(t)}}let x;!function(t){t.JSON="application/json",t.NDJSON="application/x-ndjson",t.CSV="text/csv"}(y||(y={})),function(t){t.Identity="",t.GZIP="gzip"}(p||(p={})),function(t){t.Count="count",t.Distinct="distinct",t.Sum="sum",t.Avg="avg",t.Min="min",t.Max="max",t.Topk="topk",t.Percentiles="percentiles",t.Histogram="histogram",t.Variance="variance",t.Stdev="stdev",t.ArgMin="argmin",t.ArgMax="argmax",t.MakeSet="makeset",t.MakeSetIf="makesetif",t.CountIf="countif",t.CountDistinctIf="distinctif"}(d||(d={})),function(t){t.And="and",t.Or="or",t.Not="not",t.Equal="==",t.NotEqual="!=",t.Exists="exists",t.NotExists="not-exists",t.GreaterThan=">",t.GreaterThanOrEqualTo=">=",t.LessThan="<",t.LessThanOrEqualTo="<=",t.Gt="gt",t.Gte="gte",t.Lt="lt",t.Lte="lte",t.StartsWith="starts-with",t.NotStartsWith="not-starts-with",t.EndsWith="ends-with",t.NotEndsWith="not-ends-with",t.Contains="contains",t.NotContains="not-contains",t.Regexp="regexp",t.NotRegexp="not-regexp"}(g||(g={})),t.initializeImpl=function(){x=new b({token:"xaat-16d05fdd-4ab9-4990-acba-7cee24974bfb"})},t.trackEventImpl=function(t,e){x.ingest("shopar-plugin-alpha",Object.assign({name:t},e))}})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ShopAR__analytics={})}(this,(function(t){"use strict";function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function i(t){return Number.isInteger(t)&&t>=0}function n(t){this.name="ArgumentError",this.message=t}var s=e((function(t,e){if(e=e||{},"function"!=typeof t)throw new n("fetch must be a function");if("object"!=typeof e)throw new n("defaults must be an object");if(void 0!==e.retries&&!i(e.retries))throw new n("retries must be a positive integer");if(void 0!==e.retryDelay&&!i(e.retryDelay)&&"function"!=typeof e.retryDelay)throw new n("retryDelay must be a positive integer or a function returning a positive integer");if(void 0!==e.retryOn&&!Array.isArray(e.retryOn)&&"function"!=typeof e.retryOn)throw new n("retryOn property expects an array or function");return e=Object.assign({retries:3,retryDelay:1e3,retryOn:[]},e),function(s,r){var a=e.retries,o=e.retryDelay,c=e.retryOn;if(r&&void 0!==r.retries){if(!i(r.retries))throw new n("retries must be a positive integer");a=r.retries}if(r&&void 0!==r.retryDelay){if(!i(r.retryDelay)&&"function"!=typeof r.retryDelay)throw new n("retryDelay must be a positive integer or a function returning a positive integer");o=r.retryDelay}if(r&&r.retryOn){if(!Array.isArray(r.retryOn)&&"function"!=typeof r.retryOn)throw new n("retryOn property expects an array or function");c=r.retryOn}return new Promise((function(e,i){var n=function(n){var o="undefined"!=typeof Request&&s instanceof Request?s.clone():s;t(o,r).then((function(t){if(Array.isArray(c)&&-1===c.indexOf(t.status))e(t);else if("function"==typeof c)try{return Promise.resolve(c(n,null,t)).then((function(i){i?u(n,null,t):e(t)})).catch(i)}catch(t){i(t)}else n<a?u(n,null,t):e(t)})).catch((function(t){if("function"==typeof c)try{Promise.resolve(c(n,t,null)).then((function(e){e?u(n,t,null):i(t)})).catch((function(t){i(t)}))}catch(t){i(t)}else n<a?u(n,t,null):i(t)}))};function u(t,e,i){var s="function"==typeof o?o(t,e,i):o;setTimeout((function(){n(++t)}),s)}n(0)}))}}));var r,a;!function(t){t.unknown="unknown",t.user="user",t.organization="organization",t.anonymous="anonymous"}(r||(r={})),function(t){t.api="api",t.query="query",t.ingest="ingest"}(a||(a={}));class o{scope;type;value;remaining;reset;constructor(t=r.unknown,e=a.api,i=0,n=-1,s=new Date){this.scope=t,this.type=e,this.value=i,this.remaining=n,this.reset=s}}function c(t,e,i,n,s){let a=new o;const c=t.headers.get(e.toLowerCase())||r.unknown;a.scope=r[c];const u=t.headers.get(i.toLowerCase())||"",h=parseInt(u,10);isNaN(h)||(a.value=h);const l=t.headers.get(n.toLowerCase())||"",f=parseInt(l,10);isNaN(f)||(a.remaining=f);const m=t.headers.get(s.toLowerCase())||"",y=parseInt(m,10);return isNaN(y)||(a.reset=new Date(1e3*y)),a}class u{config;constructor(t){this.config=t}async doReq(t,e,i={},n={}){let r=`${this.config.baseUrl}${t}`;const o=this._prepareSearchParams(n);o&&(r+=`?${o.toString()}`);const u={...this.config.headers,...i.headers},l=await s(fetch)(r,{retries:3,retryDelay:function(t,e,i){return 1e3*Math.pow(2,t)},retryOn:[503,502,504,500],headers:u,method:e,body:i.body?i.body:void 0});if(204===l.status)return l;if(429==l.status){const t=function(t){let e;return t.url?.endsWith("/ingest")?(e=c(t,"","X-IngestLimit-Limit","X-IngestLimit-Remaining","X-IngestLimit-Reset"),e.type=a.ingest):t.url?.endsWith("/query")||t.url?.endsWith("/_apl")?(e=c(t,"","X-QueryLimit-Limit","X-QueryLimit-Remaining","X-QueryLimit-Reset"),e.type=a.query):(e=c(t,"X-RateLimit-Scope","X-RateLimit-Limit","X-RateLimit-Remaining","X-RateLimit-Reset"),e.type=a.api),e}(l);return Promise.reject(new h(t))}if(401===l.status)return Promise.reject(new Error("Forbidden"));if(l.status>=400){const t=await l.json();return Promise.reject(new Error(t.message))}return await l.json()}post(t,e={},i={}){return this.doReq(t,"POST",e,i)}get(t,e={},i={}){return this.doReq(t,"GET",e,i)}put(t,e={},i={}){return this.doReq(t,"PUT",e,i)}delete(t,e={},i={}){return this.doReq(t,"DELETE",e,i)}_prepareSearchParams=t=>{const e=new URLSearchParams;let i=!1;return Object.keys(t).forEach((n=>{t[n]&&(e.append(n,t[n]),i=!0)})),i?e:null}}class h extends Error{limit;shortcircuit;message="";constructor(t,e=!1){super(),this.limit=t,this.shortcircuit=e,Object.setPrototypeOf(this,h.prototype);const i=h.timeUntilReset(t);this.message=`${t.type} limit exceeded, try again in ${i.minutes}m${i.seconds}s`,t.type==a.api&&(this.message=`${t.scope} `+this.message)}static timeUntilReset(t){const e=t.reset.getTime()-(new Date).getTime(),i=Math.floor(e/1e3%60);return{total:e,minutes:Math.floor(e/1e3/60%60),seconds:i}}}class l{client;constructor({orgId:t="",token:e,url:i}){e||console.warn("Missing Axiom token");const n=i??"https://api.axiom.co",s={Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer "+e};"undefined"==typeof window&&(s["User-Agent"]="axiom-js/1.0.0-rc.1"),t&&(s["X-Axiom-Org-Id"]=t),this.client=new u({baseUrl:n,headers:s,timeout:3e3})}}var f,m,y,p,d,g;!function(t){t.TimestampField="_time";t.Service=class extends l{localPath="/v1/datasets";list=()=>this.client.get(this.localPath);get=t=>this.client.get(this.localPath+"/"+t);create=t=>this.client.post(this.localPath,{body:JSON.stringify(t)});update=(t,e)=>this.client.put(this.localPath+"/"+t,{body:JSON.stringify(e)});delete=t=>this.client.delete(this.localPath+"/"+t);trim=(t,e)=>{const i={maxDuration:e};return this.client.post(this.localPath+"/"+t+"/trim",{body:JSON.stringify(i)})}}}(f||(f={})),function(t){t.Service=class extends l{current=()=>this.client.get("/v1/user")}}(m||(m={}));class w{ingestFn;id;options;events=[];activeFlush=Promise.resolve();nextFlush=setTimeout((()=>{}),0);lastFlush=new Date;constructor(t,e,i){this.ingestFn=t,this.id=e,this.options=i}ingest=t=>{Array.isArray(t)?this.events=this.events.concat(t):this.events.push(t),this.events.length>=1e3||this.lastFlush.getTime()<Date.now()-1e3?(clearTimeout(this.nextFlush),this.activeFlush=this.flush()):(clearTimeout(this.nextFlush),this.nextFlush=setTimeout((()=>{this.activeFlush=this.flush()}),1e3))};flush=async()=>{const t=this.events.splice(0,this.events.length);if(clearTimeout(this.nextFlush),await this.activeFlush,0===t.length)return void(this.lastFlush=new Date);const e=await this.ingestFn(this.id,t,this.options);return this.lastFlush=new Date,e}}class v extends l{datasets;users;localPath="/v1";constructor(t){super(t),this.datasets=new f.Service(t),this.users=new m.Service(t)}ingestRaw=(t,e,i=y.JSON,n=p.Identity,s)=>this.client.post(this.localPath+"/datasets/"+t+"/ingest",{headers:{"Content-Type":i,"Content-Encoding":n},body:e},{"timestamp-field":s?.timestampField,"timestamp-format":s?.timestampFormat,"csv-delimiter":s?.csvDelimiter});queryLegacy=(t,e,i)=>this.client.post(this.localPath+"/datasets/"+t+"/query",{body:JSON.stringify(e)},{"streaming-duration":i?.streamingDuration,nocache:i?.noCache});query=(t,e)=>{const i={apl:t};return e?.startTime&&(i.startTime=e?.startTime),e?.endTime&&(i.endTime=e?.endTime),this.client.post(this.localPath+"/datasets/_apl",{body:JSON.stringify(i)},{"streaming-duration":e?.streamingDuration,nocache:e?.noCache,format:"legacy"})};aplQuery=(t,e)=>this.query(t,e)}class x extends v{batch={};ingest=(t,e,i)=>{const n=function(t,e){return`${t}:${e?.timestampField||"-"}:${e?.timestampFormat||"-"}:${e?.csvDelimiter||"-"}`}(t,i);return this.batch[n]||(this.batch[n]=new w(((t,e,i)=>{const n=(Array.isArray(e)?e:[e]).map((t=>JSON.stringify(t))).join("\n");return this.ingestRaw(t,n,y.NDJSON,p.Identity,i)}),t,i)),this.batch[n].ingest(e)};flush=async()=>{let t=[];for(const e in this.batch)t.push(this.batch[e].flush());await Promise.all(t)}}let b;!function(t){t.JSON="application/json",t.NDJSON="application/x-ndjson",t.CSV="text/csv"}(y||(y={})),function(t){t.Identity="",t.GZIP="gzip"}(p||(p={})),function(t){t.Count="count",t.Distinct="distinct",t.Sum="sum",t.Avg="avg",t.Min="min",t.Max="max",t.Topk="topk",t.Percentiles="percentiles",t.Histogram="histogram",t.Variance="variance",t.Stdev="stdev",t.ArgMin="argmin",t.ArgMax="argmax",t.MakeSet="makeset",t.MakeSetIf="makesetif",t.CountIf="countif",t.CountDistinctIf="distinctif"}(d||(d={})),function(t){t.And="and",t.Or="or",t.Not="not",t.Equal="==",t.NotEqual="!=",t.Exists="exists",t.NotExists="not-exists",t.GreaterThan=">",t.GreaterThanOrEqualTo=">=",t.LessThan="<",t.LessThanOrEqualTo="<=",t.Gt="gt",t.Gte="gte",t.Lt="lt",t.Lte="lte",t.StartsWith="starts-with",t.NotStartsWith="not-starts-with",t.EndsWith="ends-with",t.NotEndsWith="not-ends-with",t.Contains="contains",t.NotContains="not-contains",t.Regexp="regexp",t.NotRegexp="not-regexp"}(g||(g={})),t.initializeImpl=function(){b=new x({token:"xaat-f69a9dd7-3988-4fc2-849b-4a0978468c25"})},t.trackEventImpl=function(t,e){b.ingest("shopar-plugin",Object.assign({name:t},e))}})); |
{ | ||
"name": "shopar-plugin", | ||
"version": "0.8.2-alpha.2", | ||
"version": "0.8.2", | ||
"description": "Plugin for the Web that seamlessly integrates into your webpage to create embedded virtual try-on and 3D preview capabilities.", | ||
@@ -5,0 +5,0 @@ "main": "dist/shopar-plugin.esm.js", |
@@ -35,3 +35,3 @@ # ShopAR Plugin | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/shopar-plugin@{{VERSION}}/dist/shopar-plugin.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/shopar-plugin@0.8.2/dist/shopar-plugin.js"></script> | ||
``` | ||
@@ -157,3 +157,3 @@ | ||
- If provided, defines where the additional ShopAR plugin files are fetched from. | ||
- Default value: `https://cdn.jsdelivr.net/npm/shopar-plugin@{{VERSION}}/dist` | ||
- Default value: `https://cdn.jsdelivr.net/npm/shopar-plugin@0.8.2/dist` | ||
- `defaultUI` (optional) | ||
@@ -160,0 +160,0 @@ - Type: `boolean` |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72687612