@spiffcommerce/core 16.4.2-0 → 16.4.2-1
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/index.js +484 -484
- package/dist/index.umd.cjs +1 -1
- package/package.json +2 -2
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(u,M){typeof exports=="object"&&typeof module<"u"?M(exports,require("@apollo/client/core"),require("@spiffcommerce/papyrus"),require("@apollo/client/link/context"),require("@apollo/client/link/error"),require("pith"),require("lodash.debounce"),require("lodash.isequal"),require("lodash.clonedeep"),require("qrcode"),require("unicode-default-word-boundary"),require("svg-path-bbox")):typeof define=="function"&&define.amd?define(["exports","@apollo/client/core","@spiffcommerce/papyrus","@apollo/client/link/context","@apollo/client/link/error","pith","lodash.debounce","lodash.isequal","lodash.clonedeep","qrcode","unicode-default-word-boundary","svg-path-bbox"],M):(u=typeof globalThis<"u"?globalThis:u||self,M(u.Core={},u.core,u.papyrus,u.context,u.error,u.pith,u.debounce,u.isEqual,u.cloneDeep,u.qrcode,u.unicodeDefaultWordBoundary,u.svgPathBbox))})(this,function(u,M,r,gA,lA,$e,_e,et,te,tt,ye,Ye){"use strict";class At extends Error{constructor(e){super(e),this.name=this.constructor.name}}class Ae extends At{constructor(e){super(`ConfigurationError - ${e}`)}}class ae extends Ae{constructor(e){super(`Option not Configured: ${e.stepTitle}`),this.optionId=(e==null?void 0:e.optionId)||"N/A"}}class v extends Ae{constructor(e){super(`Panel not Found: ${e.panelId}`),this.panelId=(e==null?void 0:e.panelId)||"N/A"}}class z extends Ae{constructor(e){super(`Asset not found for variant: ${e.name}`),this.variant=e}}class W extends Ae{constructor(e){super(`Resource not found for asset: ${e.name}`),this.asset=e}}class ne extends Ae{constructor(e,t){super(`Workflow Misconfiguration: ${e.stepName} - ${t}`),this.step=e}}class he extends At{constructor(e){super(`ImplementationError - ${e}`)}}class G extends he{constructor(e){super(`Unhandled Behavior Encountered: ${e}`)}}class X extends he{constructor(e){super(`Parsing Error: ${e}`)}}class U extends he{constructor(e){super(`Client Error: ${e}`)}}class Ce extends he{constructor(e){super(`Resource Generation Failed: ${e}`)}}class BA{get(e){return localStorage.getItem(e)||void 0}set(e,t){localStorage.setItem(e,t)}remove(e){localStorage.removeItem(e)}getMap(e){const t=this.get(e);if(t)return new Map(JSON.parse(t))}setMap(e,t){const A=JSON.stringify([...t.entries()]);this.set(e,A)}}class at{constructor(){this.storage=new Map}get(e){return this.storage.get(e)||void 0}set(e,t){this.storage.set(e,t)}remove(e){this.storage.delete(e)}getMap(e){const t=this.get(e);if(t)return new Map(JSON.parse(t))}setMap(e,t){const A=JSON.stringify([...t.entries()]);this.set(e,A)}}const N=(()=>{try{return localStorage?new BA:new at}catch{return console.warn("Local storage was unavilable due to browser security settings. Using in-memory storage instead."),new at}})();class dA{constructor(){this.defaultServerUrl="https://api.spiff.com.au",this.defaultServicesApiUrl="https://services.spiff.com.au",this.defaultHubUrl="https://hub.spiff.com.au",this.serverUrl=this.defaultServerUrl,this.servicesApiUrl=this.defaultServicesApiUrl,this.hubUrl=this.defaultHubUrl,this.serverUrlCallbacks=[]}getServerUrl(){return this.serverUrl}getServicesApiUrl(){return this.servicesApiUrl}getHubUrl(){return this.hubUrl}setServerUrl(e){this.serverUrl=e,this.serverUrlCallbacks.forEach(t=>t())}setServicesApiUrl(e){this.servicesApiUrl=e}setHubUrl(e){this.hubUrl=e}addServerUrlCallback(e){this.serverUrlCallbacks.push(e)}}const ie=new dA;let nt;const q=l=>{nt=l};let it;const Ne=l=>{it=l};let ot;const st=l=>{ot=l};let rt;const wA=l=>{rt=l},EA=()=>new Promise(l=>{const e=ie.getHubUrl(),t=A=>{A.origin===e&&(window.removeEventListener("message",t),l(A.data))};window.parent!==window&&(window.addEventListener("message",t,!1),window.parent.postMessage("ready",e))}),hA=async()=>{const l={applicationKey:rt,bundleOwnerId:it,customerToken:ot,transactionOwnerId:nt};return typeof window<"u"&&(window.location.href.includes("/workflows/product/")||window.location.href.includes("hub=true"))?{...await EA(),...l}:l};class CA{constructor(){this.shadowGraphqlClient=this.constructShadowGraphqlClient(),ie.addServerUrlCallback(()=>{this.shadowGraphqlClient=this.constructShadowGraphqlClient()})}getShadowGraphqlClient(){return this.shadowGraphqlClient}constructShadowGraphqlClient(){console.log(`constructing shadow gql client with ${r.
|
|
1
|
+
(function(u,M){typeof exports=="object"&&typeof module<"u"?M(exports,require("@apollo/client/core"),require("@spiffcommerce/papyrus"),require("@apollo/client/link/context"),require("@apollo/client/link/error"),require("pith"),require("lodash.debounce"),require("lodash.isequal"),require("lodash.clonedeep"),require("qrcode"),require("unicode-default-word-boundary"),require("svg-path-bbox")):typeof define=="function"&&define.amd?define(["exports","@apollo/client/core","@spiffcommerce/papyrus","@apollo/client/link/context","@apollo/client/link/error","pith","lodash.debounce","lodash.isequal","lodash.clonedeep","qrcode","unicode-default-word-boundary","svg-path-bbox"],M):(u=typeof globalThis<"u"?globalThis:u||self,M(u.Core={},u.core,u.papyrus,u.context,u.error,u.pith,u.debounce,u.isEqual,u.cloneDeep,u.qrcode,u.unicodeDefaultWordBoundary,u.svgPathBbox))})(this,function(u,M,r,gA,lA,$e,_e,et,te,tt,ye,Ye){"use strict";class At extends Error{constructor(e){super(e),this.name=this.constructor.name}}class Ae extends At{constructor(e){super(`ConfigurationError - ${e}`)}}class ae extends Ae{constructor(e){super(`Option not Configured: ${e.stepTitle}`),this.optionId=(e==null?void 0:e.optionId)||"N/A"}}class v extends Ae{constructor(e){super(`Panel not Found: ${e.panelId}`),this.panelId=(e==null?void 0:e.panelId)||"N/A"}}class z extends Ae{constructor(e){super(`Asset not found for variant: ${e.name}`),this.variant=e}}class W extends Ae{constructor(e){super(`Resource not found for asset: ${e.name}`),this.asset=e}}class ne extends Ae{constructor(e,t){super(`Workflow Misconfiguration: ${e.stepName} - ${t}`),this.step=e}}class he extends At{constructor(e){super(`ImplementationError - ${e}`)}}class G extends he{constructor(e){super(`Unhandled Behavior Encountered: ${e}`)}}class X extends he{constructor(e){super(`Parsing Error: ${e}`)}}class U extends he{constructor(e){super(`Client Error: ${e}`)}}class Ce extends he{constructor(e){super(`Resource Generation Failed: ${e}`)}}class BA{get(e){return localStorage.getItem(e)||void 0}set(e,t){localStorage.setItem(e,t)}remove(e){localStorage.removeItem(e)}getMap(e){const t=this.get(e);if(t)return new Map(JSON.parse(t))}setMap(e,t){const A=JSON.stringify([...t.entries()]);this.set(e,A)}}class at{constructor(){this.storage=new Map}get(e){return this.storage.get(e)||void 0}set(e,t){this.storage.set(e,t)}remove(e){this.storage.delete(e)}getMap(e){const t=this.get(e);if(t)return new Map(JSON.parse(t))}setMap(e,t){const A=JSON.stringify([...t.entries()]);this.set(e,A)}}const N=(()=>{try{return localStorage?new BA:new at}catch{return console.warn("Local storage was unavilable due to browser security settings. Using in-memory storage instead."),new at}})();class dA{constructor(){this.defaultServerUrl="https://api.spiff.com.au",this.defaultServicesApiUrl="https://services.spiff.com.au",this.defaultHubUrl="https://hub.spiff.com.au",this.serverUrl=this.defaultServerUrl,this.servicesApiUrl=this.defaultServicesApiUrl,this.hubUrl=this.defaultHubUrl,this.serverUrlCallbacks=[]}getServerUrl(){return this.serverUrl}getServicesApiUrl(){return this.servicesApiUrl}getHubUrl(){return this.hubUrl}setServerUrl(e){this.serverUrl=e,this.serverUrlCallbacks.forEach(t=>t())}setServicesApiUrl(e){this.servicesApiUrl=e}setHubUrl(e){this.hubUrl=e}addServerUrlCallback(e){this.serverUrlCallbacks.push(e)}}const ie=new dA;let nt;const q=l=>{nt=l};let it;const Ne=l=>{it=l};let ot;const st=l=>{ot=l};let rt;const wA=l=>{rt=l},EA=()=>new Promise(l=>{const e=ie.getHubUrl(),t=A=>{A.origin===e&&(window.removeEventListener("message",t),l(A.data))};window.parent!==window&&(window.addEventListener("message",t,!1),window.parent.postMessage("ready",e))}),hA=async()=>{const l={applicationKey:rt,bundleOwnerId:it,customerToken:ot,transactionOwnerId:nt};return typeof window<"u"&&(window.location.href.includes("/workflows/product/")||window.location.href.includes("hub=true"))?{...await EA(),...l}:l};class CA{constructor(){this.shadowGraphqlClient=this.constructShadowGraphqlClient(),ie.addServerUrlCallback(()=>{this.shadowGraphqlClient=this.constructShadowGraphqlClient()})}getShadowGraphqlClient(){return this.shadowGraphqlClient}constructShadowGraphqlClient(){console.log(`constructing shadow gql client with ${r.fetchImpl.__spiffId}`);const e=M.createHttpLink({uri:`${ie.getServerUrl()}/graphql`,fetch:r.fetch}),t=gA.setContext(async(i,o)=>{const{headers:s}=o,c=s||{},g=await hA(),d=o.bearer??g.bearer,B=o.partnerId??g.partnerId,w=o.activeIntegration??g.activeIntegration,h=o.transactionOwnerId??g.transactionOwnerId,C=o.customerToken??g.customerToken,E=o.applicationKey??g.applicationKey,m=o.bundleOwnerId??g.bundleOwnerId;return d&&(c.Authorization=`Bearer ${d}`),B&&(c.partnerId=B),w&&(c.activeIntegration=w),h&&(c.transactionOwnerId=h),C&&(c.customerToken=C),E&&(c["X-Application-Key"]=E),m&&(c.bundleOwnerId=m),{headers:c}}),A=lA.onError(({operation:i,graphQLErrors:o,networkError:s})=>{const c=o||[];s&&console.log("GraphQL Network error"),c.forEach(()=>console.log("GraphQL Error: "+i.operationName))});function a(){return{read(i=null){return i},merge(i,o){return o||i||null}}}const n=new M.InMemoryCache({addTypename:!1,typePolicies:{Transaction:{fields:{bulkEmailAddress:a(),transactionOwnerId:a(),customLogoLink:a(),workflowFooterLogoLink:a(),workflowState:a(),bulkSourceUrl:a(),externalDesignProductId:a(),externalDesignProductVariantId:a(),externalCartProductId:a(),externalCartProductVariantId:a(),lastSyncedAt:a(),lineItem:a()}},WorkflowProduct:{fields:{isPresent:a()}},Product:{fields:{imageUrl:a(),overlayImageUrl:a(),preloadImageUrl:a(),weight:a(),conversionConfiguration:a(),bulkConfiguration:a()}}}});return new M.ApolloClient({link:M.from([A,t,e]),cache:n,name:"Core"})}}const P=new CA,QA=M.gql`
|
|
2
2
|
fragment AssetMetadataFields on Asset {
|
|
3
3
|
metadata {
|
|
4
4
|
key
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spiffcommerce/core",
|
|
3
|
-
"version": "16.4.2-
|
|
3
|
+
"version": "16.4.2-1",
|
|
4
4
|
"description": "Core client API for interacting with the Spiff Commerce backend.",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/index.umd.cjs",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@apollo/client": "^3.8.3",
|
|
55
|
-
"@spiffcommerce/papyrus": "6.1.2-
|
|
55
|
+
"@spiffcommerce/papyrus": "6.1.2-1",
|
|
56
56
|
"graphql": "^16.8.0",
|
|
57
57
|
"lodash.clonedeep": "^4.5.0",
|
|
58
58
|
"lodash.debounce": "^4.0.8",
|