@epigraph/solutions 0.38.0-beta.1 → 0.38.0-beta.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.
@@ -31,7 +31,7 @@ var xd=(o=>(o.Release="release",o.Staging="staging",o.Dev="dev",o))(xd||{});let
31
31
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32
32
  * See the License for the specific language governing permissions and
33
33
  * limitations under the License.
34
- */var gS;const Yc=Symbol("analyticsPluginsMap");gS=Yc;class MM{constructor(e,t){this[gS]=new Map,this.__consentPlugin=null,e&&t&&(this.__consentPlugin=this.buildConsentPlugin(e,t)),window.addEventListener("epigraphAnalyticsConsentChange",this.__onConsentChangeFromEvent)}__onConsentChangeFromEvent(e){let t=e;this.__overrideConsent=t.detail.hasConsent;for(const i of this[Yc].values())this.__hasConsent()||i.setStatus(Vr.RESTRICTED)}addEventPlugin(e){this[Yc].has(e.getUniquePluginIdentifier())||(this[Yc].set(e.getUniquePluginIdentifier(),e),e.setupPlugin())}__hasConsent(){let e=!0;return this.__overrideConsent!==void 0?(e=this.__overrideConsent,e):(this.__consentPlugin&&(e=this.__consentPlugin.hasConsent()),e)}sendEvent(e){this[Yc].forEach(t=>{t.sendEvent(e,this.__hasConsent())})}buildConsentPlugin(e,t){return e.toLowerCase()===hS.OneTrust.toLowerCase()?new xM(t):null}}let AS=class{constructor(e,t,i,a=""){this._success=e,this._payload=t,this._status=i,this._message=a}get success(){return this._success}get payload(){return this._payload}get status(){return this._status}get message(){return this._message}};function IM(o,e,t=""){return new AS(!0,o,e,t)}function tb(o,e,t=""){return new AS(!1,o,e,t)}let I0=class{constructor(e="https://api.myepigraph.com/api/",t,i,a="",l="",h="v1/"){this.epigraphXPath="",this.epigraphComponentVersion=a,this.epigraphSessionId=i,this.epigraphXPath=l,this.baseUrl=e+h,this.epgLocation=t}async getButtonBySku(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/sku/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getButtonByShopifyVariantId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/shopify_variant_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getButtonByUpc(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/upc/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getButtonByAsin(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/asin/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getButtonByUuid(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/uuid/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerBySku(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/sku/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerByShopifyVariantId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/shopify_variant_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerByUpc(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/upc/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerByAsin(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/asin/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerByUuid(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/uuid/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourBySku(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/sku/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourByShopifyVariantId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/shopify_variant_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourByUpc(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/upc/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourByAsin(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/asin/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourByUuid(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/uuid/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerBySku(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/sku/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerByShopifyVariantId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/shopify_variant_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerByUpc(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/upc/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerByAsin(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/asin/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerByUuid(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/uuid/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getConfiguratorByExperienceId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/configurator/experience_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getConfiguratorByClientAccessKey(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/configurator/client_access_key/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getConfiguratorLiteByExperienceId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/configurator-lite/experience_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getConfiguratorLiteByProjectId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/configurator-lite/project_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async postExperienceSaveAndShare(e,t){const i=`experience/${e}/save`,a=this.buildNexusUrl(i),l={save_data:JSON.stringify(t)},h=new Headers;return h.set("Content-Type","application/json"),await this.callNexusAPI(a,"POST",JSON.stringify(l),h)}async getExperienceSaveAndShare(e,t){const i=`experience/${e}/save/${t}`,a=this.buildNexusUrl(i);return await this.callNexusAPI(a,"GET")}async callNexusAPI(e,t="GET",i,a=new Headers){a=this.addRequiredHeaders(a);const l={method:t,body:i,headers:a};try{const h=await fetch(e,l),d=await h.json();if(!h.ok){let p="Unable to retrieve configurator experience";return d.message&&(p=d.message),Promise.resolve(tb(d,h.status,p))}return Promise.resolve(IM(d,h.status))}catch{return Promise.resolve(tb({},500,"Unknown error"))}}buildNexusUrl(e,t={}){let i=new URL(this.baseUrl);i.pathname+=e;for(const[a,l]of Object.entries(t))i.searchParams.set(a,l);return i}addRequiredHeaders(e){return e.has("accept")||e.set("accept","application/json"),e.has("EPG-Location")||e.set("EPG-location",this.epgLocation),e.has("EPG-Session-ID")||e.set("EPG-Session-ID",this.epigraphSessionId),e.has("EPG-XPATH")||e.set("EPG-XPATH",this.epigraphXPath),e.has("EPG-Version")||e.set("EPG-Version",this.epigraphComponentVersion),e}};var Cd=(o=>(o.PRODUCTION="https://api.myepigraph.com/api/",o.STAGING="https://nexus.epigraph.dev/api/",o.LOCAL="https://nexus.test/api/",o))(Cd||{});/**
34
+ */var gS;const Yc=Symbol("analyticsPluginsMap");gS=Yc;class MM{constructor(e,t){this[gS]=new Map,this.__consentPlugin=null,e&&t&&(this.__consentPlugin=this.buildConsentPlugin(e,t)),window.addEventListener("epigraphAnalyticsConsentChange",this.__onConsentChangeFromEvent)}__onConsentChangeFromEvent(e){let t=e;this.__overrideConsent=t.detail.hasConsent;for(const i of this[Yc].values())this.__hasConsent()||i.setStatus(Vr.RESTRICTED)}addEventPlugin(e){this[Yc].has(e.getUniquePluginIdentifier())||(this[Yc].set(e.getUniquePluginIdentifier(),e),e.setupPlugin())}__hasConsent(){let e=!0;return this.__overrideConsent!==void 0?(e=this.__overrideConsent,e):(this.__consentPlugin&&(e=this.__consentPlugin.hasConsent()),e)}sendEvent(e){this[Yc].forEach(t=>{t.sendEvent(e,this.__hasConsent())})}buildConsentPlugin(e,t){return e.toLowerCase()===hS.OneTrust.toLowerCase()?new xM(t):null}}let AS=class{constructor(e,t,i,a=""){this._success=e,this._payload=t,this._status=i,this._message=a}get success(){return this._success}get payload(){return this._payload}get status(){return this._status}get message(){return this._message}};function IM(o,e,t=""){return new AS(!0,o,e,t)}function tb(o,e,t=""){return new AS(!1,o,e,t)}let I0=class{constructor(e="https://api.myepigraph.com/api/",t,i,a="",l="",h="v1/"){this.epigraphXPath="",this.epigraphComponentVersion=a,this.epigraphSessionId=i,this.epigraphXPath=l,this.baseUrl=e+h,this.epgLocation=t}async getButtonBySku(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/sku/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getButtonByShopifyVariantId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/shopify_variant_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getButtonByUpc(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/upc/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getButtonByAsin(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/asin/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getButtonByUuid(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/button/uuid/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerBySku(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/sku/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerByShopifyVariantId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/shopify_variant_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerByUpc(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/upc/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerByAsin(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/asin/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getViewerByUuid(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/viewer/uuid/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourBySku(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/sku/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourByShopifyVariantId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/shopify_variant_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourByUpc(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/upc/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourByAsin(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/asin/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getTourByUuid(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/tour/uuid/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerBySku(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/sku/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerByShopifyVariantId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/shopify_variant_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerByUpc(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/upc/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerByAsin(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/asin/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getCustomizerByUuid(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/customizer/uuid/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getConfiguratorByExperienceId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/configurator/experience_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getConfiguratorByClientAccessKey(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/configurator/client_access_key/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getConfiguratorLiteByExperienceId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/configurator-lite/experience_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async getConfiguratorLiteByProjectId(e,t=""){const i={};t!==""&&(i.version_id=t);const a=`experience/configurator-lite/project_id/${e}`,l=this.buildNexusUrl(a,i);return await this.callNexusAPI(l,"GET")}async postExperienceSaveAndShare(e,t){const i=`experience/${e}/save`,a=this.buildNexusUrl(i),l={save_data:JSON.stringify(t)},h=new Headers;return h.set("Content-Type","application/json"),await this.callNexusAPI(a,"POST",JSON.stringify(l),h)}async getExperienceSaveAndShare(e,t){const i=`experience/${e}/save/${t}`,a=this.buildNexusUrl(i);return await this.callNexusAPI(a,"GET")}async callNexusAPI(e,t="GET",i,a=new Headers){a=this.addRequiredHeaders(a);const l={method:t,body:i,headers:a};try{const h=await fetch(e,l),d=await h.json();if(!h.ok){let p="Unable to retrieve configurator experience";return d.message&&(p=d.message),Promise.resolve(tb(d,h.status,p))}return Promise.resolve(IM(d,h.status))}catch(h){return console.log(h),Promise.resolve(tb({},500,"Unknown error"))}}buildNexusUrl(e,t={}){let i=new URL(this.baseUrl);i.pathname+=e;for(const[a,l]of Object.entries(t))i.searchParams.set(a,l);return i}addRequiredHeaders(e){return e.has("accept")||e.set("accept","application/json"),e.has("EPG-Location")||e.set("EPG-location",this.epgLocation),e.has("EPG-Session-ID")||e.set("EPG-Session-ID",this.epigraphSessionId),e.has("EPG-XPATH")||e.set("EPG-XPATH",this.epigraphXPath),e.has("EPG-Version")||e.set("EPG-Version",this.epigraphComponentVersion),e}};var Cd=(o=>(o.PRODUCTION="https://api.myepigraph.com/api/",o.STAGING="https://nexus.epigraph.dev/api/",o.LOCAL="https://nexus.test/api/",o))(Cd||{});/**
35
35
  * @license
36
36
  * Copyright 2019 Google LLC
37
37
  * SPDX-License-Identifier: BSD-3-Clause
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epigraph/solutions",
3
- "version": "0.38.0-beta.1",
3
+ "version": "0.38.0-beta.2",
4
4
  "type": "module",
5
5
  "main": "./dist/epigraph-solutions.js",
6
6
  "files": [