@spiffcommerce/core 22.2.0 → 22.2.1-beta.2b2fdb9d-9fa3-5cbb-abad-c5aef7887af6
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.d.ts +14 -1
- package/dist/index.js +86 -77
- package/dist/index.umd.cjs +43 -31
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { Animatable, AnyStepData, AspectType, Asset, AssetType, BringForwardComm
|
|
|
4
4
|
import { ApolloClient, MutationOptions, FetchResult } from '@apollo/client/core';
|
|
5
5
|
import { RenderableContextService, RenderableContext, ThreeDPreviewService, ModelContainer } from '@spiffcommerce/preview';
|
|
6
6
|
import * as lodash from 'lodash';
|
|
7
|
+
import { ThemeInstallConfigurationResource } from '@spiffcommerce/theme-bridge';
|
|
7
8
|
import { FuseResult } from 'fuse.js';
|
|
8
9
|
|
|
9
10
|
declare class OptionService {
|
|
@@ -1793,6 +1794,13 @@ interface GetWorkflowFromExternalProductOptions extends GetNewWorkflowOptionsBas
|
|
|
1793
1794
|
}
|
|
1794
1795
|
type GetNewWorkflowOptions = GetWorkflowFromIntegrationProductOptions | GetWorkflowFromExternalProductOptions;
|
|
1795
1796
|
type GetWorkflowOptions = GetWorkflowFromTransactionOptions | GetNewWorkflowOptions;
|
|
1797
|
+
interface ClientConfiguration {
|
|
1798
|
+
hubUrl: string;
|
|
1799
|
+
serverUrl: string;
|
|
1800
|
+
servicesApiUrl: string;
|
|
1801
|
+
marketplaceThemeInstallId: string;
|
|
1802
|
+
marketplaceThemeInstallConfigurationId: string;
|
|
1803
|
+
}
|
|
1796
1804
|
/**
|
|
1797
1805
|
* The Spiff Commerce Javascript Client. Required for
|
|
1798
1806
|
* creating workflow experiences.
|
|
@@ -1803,12 +1811,17 @@ declare class SpiffCommerceClient {
|
|
|
1803
1811
|
private currencyCode?;
|
|
1804
1812
|
private customer?;
|
|
1805
1813
|
private activeIntegration?;
|
|
1814
|
+
private marketplaceThemeInstallId?;
|
|
1815
|
+
private marketplaceThemeInstallConfigurationId?;
|
|
1806
1816
|
/**
|
|
1807
1817
|
* @deprecated This object is passed to the WorkflowExperience constructor and is no longer needed on this object.
|
|
1808
1818
|
* Any functionality referencing this object will be removed in a future release.
|
|
1809
1819
|
*/
|
|
1810
1820
|
private experienceOptions?;
|
|
1811
1821
|
constructor(options: ClientOptions);
|
|
1822
|
+
/** @deprecated Use configureClient instead */
|
|
1823
|
+
configureUrls(hubUrl: string, serverUrl: string, servicesApiUrl: string): void;
|
|
1824
|
+
configure(configuration: ClientConfiguration): void;
|
|
1812
1825
|
/**
|
|
1813
1826
|
* @returns The asset manager allows for common operations related to assets
|
|
1814
1827
|
* and the Spiff Commerce platform.
|
|
@@ -1937,7 +1950,6 @@ declare class SpiffCommerceClient {
|
|
|
1937
1950
|
* @returns The transaction associated with this client.
|
|
1938
1951
|
*/
|
|
1939
1952
|
getTransaction(): Transaction;
|
|
1940
|
-
configureUrls(hubUrl: string, serverUrl: string, servicesApiUrl: string): void;
|
|
1941
1953
|
/**
|
|
1942
1954
|
* A function used to synchronize transaction state with the server.
|
|
1943
1955
|
* @param options New state details. To be spread into the query.
|
|
@@ -2317,6 +2329,7 @@ interface Transaction {
|
|
|
2317
2329
|
transactionShareActions?: TransactionShareAction[];
|
|
2318
2330
|
/** Whether any share actions for this Transaction require the user to be authenticated as a stakeholder */
|
|
2319
2331
|
hasAuthenticatedActions?: boolean;
|
|
2332
|
+
marketplaceThemeInstallConfiguration?: ThemeInstallConfigurationResource;
|
|
2320
2333
|
}
|
|
2321
2334
|
interface TransactionShareAction {
|
|
2322
2335
|
id: string;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHttpLink as xA, InMemoryCache as NA, ApolloClient as RA, from as HA, gql as f } from "@apollo/client/core";
|
|
2
|
-
import { fetch as ot, getAttributesFromArrayBuffer as Tt, AssetType as _e, StepType as F, getFrameData as rt, frameDataCache as vA, modifySVGColors as UA, svgToDataUrl as kA, GroupCommand as k, UpdateFramePattern as Ot, UpdateFrameThresholdSettingsCommand as GA, calculateOffsets as ct, LayoutElementType as G, generate as J, CreateElementCommand as O, generateSVGWithUnknownColors as Oe, svgObjectURL as Re, fetchAsString as
|
|
2
|
+
import { fetch as ot, getAttributesFromArrayBuffer as Tt, AssetType as _e, StepType as F, getFrameData as rt, frameDataCache as vA, modifySVGColors as UA, svgToDataUrl as kA, GroupCommand as k, UpdateFramePattern as Ot, UpdateFrameThresholdSettingsCommand as GA, calculateOffsets as ct, LayoutElementType as G, generate as J, CreateElementCommand as O, generateSVGWithUnknownColors as Oe, svgObjectURL as Re, fetchAsString as $, DeleteElementCommand as te, generateDefaultRectangleFrameSvg as ft, GetSVGDimensions as bA, patternImageDataCache as Ft, fetchAsArrayBuffer as JA, findElement as He, modifySVGWithElementProperties as TA, IllustrationColorCommand as et, IllustrationCacheCommand as OA, getFontMetrics as LA, getPatternImageData as tt, FontAlignmentCommand as zA, FontColorCommand as KA, FontImageFillCommand as Ve, applyTextTransformations as At, determineCorrectFontSizeAndLines as xe, FontSourceCommand as yt, loadFont as gt, TextChangeCommand as jA, FontSizeCommand as VA, createElementNS as WA, createElement as Ie, _loadFontExternalDataURL as lt, UpdateWorkflowStateCommand as Mt, CommandContext as XA, createCanvas as ve, getSvgElement as Lt, LayoutRenderingPurpose as zt, renderPapyrusComponentAsString as Kt, loadImage as jt, getDomParser as Vt, toBase64 as St, getVariant as qA, generateFrameSVG as ZA, getDefaultVariant as Le, domParser as Wt, sanitizeSvgTree as Xt, traverse as $A, xmlSerializer as qt, CreateLayoutCommand as _A, AspectType as oe, rehydrateSerializedLayout as ae } from "@spiffcommerce/papyrus";
|
|
3
3
|
import { AspectType as Fs, AssetType as ys, BringForwardCommand as Ms, BringToBackCommand as Ss, BringToFrontCommand as Ys, CanvasCommand as Ps, CommandContext as xs, CreateElementCommand as Ns, CreateLayoutCommand as Rs, DeleteElementCommand as Hs, FontAlignmentCommand as vs, FontColorCommand as Us, FontSizeCommand as ks, FontSourceCommand as Gs, GroupCommand as bs, LayoutElementFactory as Js, LayoutElementType as Ts, MoveCommand as Os, ResizeCommand as Ls, RotateCommand as zs, SendBackwardsCommand as Ks, StepAspectType as js, StepType as Vs, TextChangeCommand as Ws, UnitOfMeasurement as Xs, UpdateImageSourceCommand as qs, dataUrlFromExternalUrl as Zs, determineCorrectFontSizeAndLines as $s, findElement as _s, frameDataCache as eo, generate as to, generateSVGWithUnknownColors as Ao, getAttributesFromArrayBuffer as ao, getAxisAlignedBoundingBox as no, getFrameData as io, getSvgElement as so, loadFont as oo, patternImageDataCache as ro, registerFetchImplementation as co, registerWindowImplementation as go, rehydrateSerializedLayout as lo, setCanvasModule as Bo, svgToDataUrl as Co } from "@spiffcommerce/papyrus";
|
|
4
4
|
import { setContext as ea } from "@apollo/client/link/context";
|
|
5
5
|
import { onError as ta } from "@apollo/client/link/error";
|
|
@@ -148,7 +148,7 @@ class ia {
|
|
|
148
148
|
this.serverUrlCallbacks.push(e);
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
const
|
|
151
|
+
const q = new ia();
|
|
152
152
|
let AA;
|
|
153
153
|
const xt = (c) => {
|
|
154
154
|
AA = c;
|
|
@@ -161,7 +161,7 @@ let aA;
|
|
|
161
161
|
const ds = (c) => {
|
|
162
162
|
aA = c;
|
|
163
163
|
}, ra = () => new Promise((c) => {
|
|
164
|
-
const e =
|
|
164
|
+
const e = q.getHubUrl(), t = (A) => {
|
|
165
165
|
A.origin === e && (window.removeEventListener("message", t), c(A.data));
|
|
166
166
|
};
|
|
167
167
|
window.parent !== window && (window.addEventListener("message", t, !1), window.parent.postMessage("ready", e));
|
|
@@ -175,7 +175,7 @@ const ds = (c) => {
|
|
|
175
175
|
};
|
|
176
176
|
class ga {
|
|
177
177
|
constructor() {
|
|
178
|
-
this.shadowGraphqlClient = this.constructShadowGraphqlClient(),
|
|
178
|
+
this.shadowGraphqlClient = this.constructShadowGraphqlClient(), q.addServerUrlCallback(() => {
|
|
179
179
|
this.shadowGraphqlClient = this.constructShadowGraphqlClient();
|
|
180
180
|
});
|
|
181
181
|
}
|
|
@@ -184,7 +184,7 @@ class ga {
|
|
|
184
184
|
}
|
|
185
185
|
constructShadowGraphqlClient() {
|
|
186
186
|
const e = xA({
|
|
187
|
-
uri: `${
|
|
187
|
+
uri: `${q.getServerUrl()}/graphql`,
|
|
188
188
|
fetch: ot
|
|
189
189
|
}), t = ea(async (i, s) => {
|
|
190
190
|
const { headers: o } = s, r = o || {}, g = await ca(), B = s.bearer ?? g.bearer, l = s.partnerId ?? g.partnerId, C = s.activeIntegration ?? g.activeIntegration, d = s.transactionOwnerId, E = s.customerToken ?? g.customerToken, w = s.applicationKey ?? g.applicationKey, u = s.bundleOwnerId;
|
|
@@ -562,7 +562,7 @@ class ua {
|
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
|
-
const le = "persistentAssets", nA = class
|
|
565
|
+
const le = "persistentAssets", nA = class _ {
|
|
566
566
|
/**
|
|
567
567
|
* Add a new asset to persistence
|
|
568
568
|
* @param asset The asset to add.
|
|
@@ -577,7 +577,7 @@ const le = "persistentAssets", nA = class $ {
|
|
|
577
577
|
const A = Y.getMap(le);
|
|
578
578
|
A && A.forEach((a, n) => {
|
|
579
579
|
t.set(n, a);
|
|
580
|
-
}), Y.setMap(le, t),
|
|
580
|
+
}), Y.setMap(le, t), _.executeCallbacks();
|
|
581
581
|
}
|
|
582
582
|
/**
|
|
583
583
|
* Remove an existing asset from persistence. Noop if the asset doesn't exist.
|
|
@@ -588,7 +588,7 @@ const le = "persistentAssets", nA = class $ {
|
|
|
588
588
|
if (!t)
|
|
589
589
|
return;
|
|
590
590
|
const A = Array.from(t.entries()).find((a) => a[0] === e);
|
|
591
|
-
A && (t.delete(A[0]), Y.setMap(le, t),
|
|
591
|
+
A && (t.delete(A[0]), Y.setMap(le, t), _.executeCallbacks());
|
|
592
592
|
}
|
|
593
593
|
/**
|
|
594
594
|
* Get a list of all persisted assets.
|
|
@@ -601,16 +601,16 @@ const le = "persistentAssets", nA = class $ {
|
|
|
601
601
|
* Adds a callback that will be called whenever assets are added/removed from persistence.
|
|
602
602
|
*/
|
|
603
603
|
static addCallback(e) {
|
|
604
|
-
|
|
604
|
+
_.callbacks.push(e);
|
|
605
605
|
}
|
|
606
606
|
/**
|
|
607
607
|
* Removes an existing callback.
|
|
608
608
|
*/
|
|
609
609
|
static removeCallback(e) {
|
|
610
|
-
|
|
610
|
+
_.callbacks = _.callbacks.filter((t) => t !== e);
|
|
611
611
|
}
|
|
612
612
|
static executeCallbacks() {
|
|
613
|
-
|
|
613
|
+
_.callbacks.forEach((e) => e());
|
|
614
614
|
}
|
|
615
615
|
};
|
|
616
616
|
nA.callbacks = [];
|
|
@@ -835,6 +835,8 @@ const ge = f`
|
|
|
835
835
|
$claim: Boolean
|
|
836
836
|
$workflowId: String
|
|
837
837
|
$designName: String
|
|
838
|
+
$marketplaceThemeInstallId: String
|
|
839
|
+
$marketplaceThemeInstallConfigurationId: String
|
|
838
840
|
) {
|
|
839
841
|
transactionCreate(
|
|
840
842
|
integrationProductId: $integrationProductId
|
|
@@ -843,6 +845,8 @@ const ge = f`
|
|
|
843
845
|
claim: $claim
|
|
844
846
|
workflowId: $workflowId
|
|
845
847
|
designName: $designName
|
|
848
|
+
marketplaceThemeInstallId: $marketplaceThemeInstallId
|
|
849
|
+
marketplaceThemeInstallConfigurationId: $marketplaceThemeInstallConfigurationId
|
|
846
850
|
) {
|
|
847
851
|
id
|
|
848
852
|
designName
|
|
@@ -920,8 +924,16 @@ const ge = f`
|
|
|
920
924
|
}
|
|
921
925
|
`, Pa = f`
|
|
922
926
|
${ge}
|
|
923
|
-
mutation CreateTransactions(
|
|
924
|
-
|
|
927
|
+
mutation CreateTransactions(
|
|
928
|
+
$inputs: [TransactionCreateInput]!
|
|
929
|
+
$marketplaceThemeInstallId: String
|
|
930
|
+
$marketplaceThemeInstallConfigurationId: String
|
|
931
|
+
) {
|
|
932
|
+
transactionCreateMany(
|
|
933
|
+
inputs: $inputs
|
|
934
|
+
marketplaceThemeInstallId: $marketplaceThemeInstallId
|
|
935
|
+
marketplaceThemeInstallConfigurationId: $marketplaceThemeInstallConfigurationId
|
|
936
|
+
) {
|
|
925
937
|
id
|
|
926
938
|
designName
|
|
927
939
|
transactionOwnerId
|
|
@@ -1391,7 +1403,7 @@ const va = f`
|
|
|
1391
1403
|
}
|
|
1392
1404
|
`, Ga = f`
|
|
1393
1405
|
${sA}
|
|
1394
|
-
query
|
|
1406
|
+
query ReadTransactionForStakeholders($id: String!) {
|
|
1395
1407
|
transactions(ids: [$id]) {
|
|
1396
1408
|
stakeholders {
|
|
1397
1409
|
...StakeholderFields
|
|
@@ -1857,7 +1869,7 @@ class Ht {
|
|
|
1857
1869
|
u("Undefined vector silent step source");
|
|
1858
1870
|
return;
|
|
1859
1871
|
}
|
|
1860
|
-
|
|
1872
|
+
$(l, !0).then((h) => {
|
|
1861
1873
|
w(h);
|
|
1862
1874
|
}).catch((h) => console.error(h));
|
|
1863
1875
|
}))()), E = {
|
|
@@ -1911,7 +1923,7 @@ class Ht {
|
|
|
1911
1923
|
}
|
|
1912
1924
|
}
|
|
1913
1925
|
const Ka = async (c) => {
|
|
1914
|
-
const e = `${
|
|
1926
|
+
const e = `${q.getServicesApiUrl()}/shortener`;
|
|
1915
1927
|
try {
|
|
1916
1928
|
return (await (await fetch(e, {
|
|
1917
1929
|
method: "POST",
|
|
@@ -4787,7 +4799,7 @@ class $a {
|
|
|
4787
4799
|
throw new Ae(e);
|
|
4788
4800
|
const a = A.fileLink;
|
|
4789
4801
|
if (a)
|
|
4790
|
-
return
|
|
4802
|
+
return $(a, !0);
|
|
4791
4803
|
throw new ue(A);
|
|
4792
4804
|
};
|
|
4793
4805
|
}
|
|
@@ -4949,7 +4961,7 @@ class $a {
|
|
|
4949
4961
|
}
|
|
4950
4962
|
async loadPatternFromString(e, t, A = !0, a = void 0, n) {
|
|
4951
4963
|
if (e.endsWith("svg")) {
|
|
4952
|
-
const i = await bA(e), s = i.width, o = i.height, r = await
|
|
4964
|
+
const i = await bA(e), s = i.width, o = i.height, r = await $(e);
|
|
4953
4965
|
if (n) {
|
|
4954
4966
|
const l = r.match(/<(image|linearGradient|radialGradient)(\s|>|\/>)/gim);
|
|
4955
4967
|
if (l && l.length > 0)
|
|
@@ -5156,11 +5168,11 @@ class $a {
|
|
|
5156
5168
|
), this.validateColorCount(t, A);
|
|
5157
5169
|
}
|
|
5158
5170
|
}
|
|
5159
|
-
const
|
|
5171
|
+
const ee = new $a();
|
|
5160
5172
|
class _a {
|
|
5161
5173
|
async getIllustrationBody(e) {
|
|
5162
5174
|
return new Promise((t) => {
|
|
5163
|
-
|
|
5175
|
+
$(e, !0).then((A) => {
|
|
5164
5176
|
t(A);
|
|
5165
5177
|
}).catch((A) => console.error(A));
|
|
5166
5178
|
});
|
|
@@ -8077,7 +8089,7 @@ async function pA(c) {
|
|
|
8077
8089
|
if (c === "Favourites")
|
|
8078
8090
|
return new un();
|
|
8079
8091
|
if (c === "Maltesers") {
|
|
8080
|
-
const e =
|
|
8092
|
+
const e = $("https://assets.spiff.com.au/public/modules/img/MaltesersBackground.svg"), t = $("https://assets.spiff.com.au/public/modules/img/MaltesersBackgroundShort.svg"), A = await Promise.all([e, t]);
|
|
8081
8093
|
return new mn(A[0], A[1]);
|
|
8082
8094
|
}
|
|
8083
8095
|
if (c === "Vegemite")
|
|
@@ -8603,7 +8615,7 @@ class fn {
|
|
|
8603
8615
|
r.connectWorkflowManager(this, o.stepName), this.stepSpecificServices[o.stepName] = {
|
|
8604
8616
|
frameService: r
|
|
8605
8617
|
}, A.push(
|
|
8606
|
-
|
|
8618
|
+
ee.init(o, this, this.reloadedState)
|
|
8607
8619
|
);
|
|
8608
8620
|
}
|
|
8609
8621
|
break;
|
|
@@ -8704,7 +8716,7 @@ class fn {
|
|
|
8704
8716
|
return Oa(this.allScenes, this.stepSelections, this.singleVariantsRenderable);
|
|
8705
8717
|
}
|
|
8706
8718
|
}
|
|
8707
|
-
class
|
|
8719
|
+
class Z {
|
|
8708
8720
|
constructor(e) {
|
|
8709
8721
|
this.variantData = e;
|
|
8710
8722
|
}
|
|
@@ -8819,21 +8831,21 @@ const DA = class it {
|
|
|
8819
8831
|
getCurrentVariant() {
|
|
8820
8832
|
const t = this.manager.getWorkflowSelections()[this.step.stepName], A = t == null ? void 0 : t.selections[0];
|
|
8821
8833
|
if (A)
|
|
8822
|
-
return new
|
|
8834
|
+
return new Z(A);
|
|
8823
8835
|
}
|
|
8824
8836
|
/**
|
|
8825
8837
|
* @returns A list of valid variants for this step. Does not include disabled variants.
|
|
8826
8838
|
*/
|
|
8827
8839
|
getAvailableVariants() {
|
|
8828
8840
|
var t, A;
|
|
8829
|
-
return (((A = (t = this.step.option) == null ? void 0 : t.variants) == null ? void 0 : A.filter((a) => a.enabled)) || []).map((a) => new
|
|
8841
|
+
return (((A = (t = this.step.option) == null ? void 0 : t.variants) == null ? void 0 : A.filter((a) => a.enabled)) || []).map((a) => new Z(a));
|
|
8830
8842
|
}
|
|
8831
8843
|
/**
|
|
8832
8844
|
* @returns A list of all variants for this step, including disabled ones.
|
|
8833
8845
|
*/
|
|
8834
8846
|
getAllVariants() {
|
|
8835
8847
|
var t;
|
|
8836
|
-
return (((t = this.step.option) == null ? void 0 : t.variants) || []).map((A) => new
|
|
8848
|
+
return (((t = this.step.option) == null ? void 0 : t.variants) || []).map((A) => new Z(A));
|
|
8837
8849
|
}
|
|
8838
8850
|
/**
|
|
8839
8851
|
* @returns A unique identifier for this step within the workflow.
|
|
@@ -9487,35 +9499,22 @@ const kn = async (c) => {
|
|
|
9487
9499
|
}), a;
|
|
9488
9500
|
}, bn = (c, e, t, A) => {
|
|
9489
9501
|
const a = {};
|
|
9490
|
-
let n;
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
|
|
9496
|
-
|
|
9502
|
+
let n = {};
|
|
9503
|
+
t ? n = st(t, e, !1) : A && (n = A);
|
|
9504
|
+
const s = e.steps.map((o) => o.stepTitle).filter((o, r, g) => g.indexOf(o) == r);
|
|
9505
|
+
for (const o of s) {
|
|
9506
|
+
if (Object.keys(c).includes(o)) {
|
|
9507
|
+
const r = c[o], g = e.steps.find((B) => B.stepTitle === o);
|
|
9508
|
+
a[`${g == null ? void 0 : g.stepTitle} selection`] = {
|
|
9509
|
+
value: r[0].name,
|
|
9510
|
+
priceModifier: r[0].priceModifier
|
|
9497
9511
|
};
|
|
9498
|
-
|
|
9499
|
-
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
value: n[i],
|
|
9512
|
+
}
|
|
9513
|
+
for (const r of Object.keys(n))
|
|
9514
|
+
[`${o} color`, `${o} colors`, `${o} text`, `${o} image`].includes(r) && (a[r] = {
|
|
9515
|
+
value: n[r],
|
|
9503
9516
|
priceModifier: 0
|
|
9504
|
-
};
|
|
9505
|
-
}
|
|
9506
|
-
for (const i of Object.keys(c)) {
|
|
9507
|
-
const s = c[i], o = e.steps.find((r) => r.stepTitle === i);
|
|
9508
|
-
if (s.length === 1)
|
|
9509
|
-
a[`${o == null ? void 0 : o.stepTitle} selection`] = {
|
|
9510
|
-
value: s[0].name,
|
|
9511
|
-
priceModifier: s[0].priceModifier
|
|
9512
|
-
};
|
|
9513
|
-
else if (s.length > 1)
|
|
9514
|
-
for (let r = 0; r < s.length; r++)
|
|
9515
|
-
a[`${o == null ? void 0 : o.stepTitle} selection ${r + 1}`] = {
|
|
9516
|
-
value: s[r].name,
|
|
9517
|
-
priceModifier: s[r].priceModifier
|
|
9518
|
-
};
|
|
9517
|
+
});
|
|
9519
9518
|
}
|
|
9520
9519
|
return a;
|
|
9521
9520
|
}, fA = (c, e, t, A, a, n, i, s) => {
|
|
@@ -10288,7 +10287,7 @@ const Kn = [
|
|
|
10288
10287
|
const s = (Q = i.asset) == null ? void 0 : Q.fileLink;
|
|
10289
10288
|
if (!s)
|
|
10290
10289
|
return console.error(`No asset link for variant with ID: ${a.illustrationVariantId}`), [];
|
|
10291
|
-
const o = await
|
|
10290
|
+
const o = await $(s, !0), r = /<svg.*?<\/svg>/s, g = o.match(r) || [], B = (g == null ? void 0 : g.length) > 0 ? g[0] : "", d = Wt().parseFromString(B, "image/svg+xml").firstElementChild;
|
|
10292
10291
|
if (!d)
|
|
10293
10292
|
return console.error("Failed to read SVG."), [];
|
|
10294
10293
|
Xt(d);
|
|
@@ -10506,7 +10505,7 @@ const Kn = [
|
|
|
10506
10505
|
console.error(r);
|
|
10507
10506
|
}
|
|
10508
10507
|
else {
|
|
10509
|
-
const r = await
|
|
10508
|
+
const r = await $(n, !0), g = (B) => {
|
|
10510
10509
|
const l = /<svg.*?<\/svg>/s, C = B.match(l) || [], d = (C == null ? void 0 : C.length) > 0 ? C[0] : "", u = Wt().parseFromString(d, "image/svg+xml").firstElementChild;
|
|
10511
10510
|
if (!u)
|
|
10512
10511
|
throw new de("Failed to read SVG.");
|
|
@@ -11467,7 +11466,7 @@ class SA extends pt {
|
|
|
11467
11466
|
const e = this.getStateValue();
|
|
11468
11467
|
if (e) {
|
|
11469
11468
|
const a = (A = this.optionResource.variants) == null ? void 0 : A.find((n) => n.id === e);
|
|
11470
|
-
return a ? new
|
|
11469
|
+
return a ? new Z(a) : void 0;
|
|
11471
11470
|
} else {
|
|
11472
11471
|
const a = (t = this.optionResource.variants) == null ? void 0 : t.find(
|
|
11473
11472
|
(n) => {
|
|
@@ -11475,7 +11474,7 @@ class SA extends pt {
|
|
|
11475
11474
|
return n.id === ((s = (i = this.optionResource) == null ? void 0 : i.defaultVariant) == null ? void 0 : s.id);
|
|
11476
11475
|
}
|
|
11477
11476
|
);
|
|
11478
|
-
return a ? new
|
|
11477
|
+
return a ? new Z(a) : void 0;
|
|
11479
11478
|
}
|
|
11480
11479
|
}
|
|
11481
11480
|
/**
|
|
@@ -11483,14 +11482,14 @@ class SA extends pt {
|
|
|
11483
11482
|
*/
|
|
11484
11483
|
getAvailableVariants() {
|
|
11485
11484
|
var t, A;
|
|
11486
|
-
return (((A = (t = this.optionResource) == null ? void 0 : t.variants) == null ? void 0 : A.filter((a) => a.enabled)) || []).map((a) => new
|
|
11485
|
+
return (((A = (t = this.optionResource) == null ? void 0 : t.variants) == null ? void 0 : A.filter((a) => a.enabled)) || []).map((a) => new Z(a));
|
|
11487
11486
|
}
|
|
11488
11487
|
/**
|
|
11489
11488
|
* @returns A list of all variants for this step, including disabled ones.
|
|
11490
11489
|
*/
|
|
11491
11490
|
getAllVariants() {
|
|
11492
11491
|
var t;
|
|
11493
|
-
return (((t = this.optionResource) == null ? void 0 : t.variants) || []).map((A) => new
|
|
11492
|
+
return (((t = this.optionResource) == null ? void 0 : t.variants) || []).map((A) => new Z(A));
|
|
11494
11493
|
}
|
|
11495
11494
|
/**
|
|
11496
11495
|
* Select a given variant on the option for all shared steps.
|
|
@@ -11508,7 +11507,7 @@ class SA extends pt {
|
|
|
11508
11507
|
if (!t)
|
|
11509
11508
|
return Promise.resolve();
|
|
11510
11509
|
const A = (n = (a = this.optionResource) == null ? void 0 : a.variants) == null ? void 0 : n.find((i) => i.id === t);
|
|
11511
|
-
return A ? this.applyVariantSelection(new
|
|
11510
|
+
return A ? this.applyVariantSelection(new Z(A), e) : Promise.resolve();
|
|
11512
11511
|
}
|
|
11513
11512
|
async applyVariantSelection(e, t) {
|
|
11514
11513
|
const a = this.getSharedSteps(t).map((n) => n.selectVariant(e));
|
|
@@ -11535,7 +11534,7 @@ class Gt extends SA {
|
|
|
11535
11534
|
if (!t)
|
|
11536
11535
|
return Promise.resolve();
|
|
11537
11536
|
const A = (n = (a = this.optionResource) == null ? void 0 : a.variants) == null ? void 0 : n.find((i) => i.id === t);
|
|
11538
|
-
return A ? this.applyColorVariant(new
|
|
11537
|
+
return A ? this.applyColorVariant(new Z(A), e) : Promise.resolve();
|
|
11539
11538
|
}
|
|
11540
11539
|
async applyColorVariant(e, t) {
|
|
11541
11540
|
const a = this.getSharedSteps(t).map((n) => {
|
|
@@ -13472,7 +13471,14 @@ class $i {
|
|
|
13472
13471
|
} catch (A) {
|
|
13473
13472
|
throw console.error(A), new v("Critical - Unable to synchronize workflow state with server.");
|
|
13474
13473
|
}
|
|
13475
|
-
}, this.initialized = !1, this.options = e, this.options.applicationKey && sa(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 22.1
|
|
13474
|
+
}, this.initialized = !1, this.options = e, this.options.applicationKey && sa(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 22.2.1"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
|
13475
|
+
}
|
|
13476
|
+
/** @deprecated Use configureClient instead */
|
|
13477
|
+
configureUrls(e, t, A) {
|
|
13478
|
+
q.setHubUrl(e), q.setServerUrl(t), q.setServicesApiUrl(A), this.getIntegration();
|
|
13479
|
+
}
|
|
13480
|
+
configure(e) {
|
|
13481
|
+
q.setHubUrl(e.hubUrl), q.setServerUrl(e.serverUrl), q.setServicesApiUrl(e.servicesApiUrl), this.marketplaceThemeInstallId = e.marketplaceThemeInstallId, this.marketplaceThemeInstallConfigurationId = e.marketplaceThemeInstallConfigurationId, this.getIntegration();
|
|
13476
13482
|
}
|
|
13477
13483
|
/**
|
|
13478
13484
|
* @returns The asset manager allows for common operations related to assets
|
|
@@ -13845,7 +13851,9 @@ class $i {
|
|
|
13845
13851
|
...I,
|
|
13846
13852
|
workflowId: a.workflowId,
|
|
13847
13853
|
designName: a.designName,
|
|
13848
|
-
claim: !0
|
|
13854
|
+
claim: !0,
|
|
13855
|
+
marketplaceThemeInstallId: this.marketplaceThemeInstallId,
|
|
13856
|
+
marketplaceThemeInstallConfigurationId: this.marketplaceThemeInstallConfigurationId
|
|
13849
13857
|
},
|
|
13850
13858
|
errorPolicy: "all",
|
|
13851
13859
|
fetchPolicy: "no-cache",
|
|
@@ -13955,7 +13963,9 @@ class $i {
|
|
|
13955
13963
|
workflowId: S.option.workflowId,
|
|
13956
13964
|
designName: S.option.designName,
|
|
13957
13965
|
claim: !0
|
|
13958
|
-
}))
|
|
13966
|
+
})),
|
|
13967
|
+
marketplaceThemeInstallId: this.marketplaceThemeInstallId,
|
|
13968
|
+
marketplaceThemeInstallConfigurationId: this.marketplaceThemeInstallConfigurationId
|
|
13959
13969
|
},
|
|
13960
13970
|
errorPolicy: "all",
|
|
13961
13971
|
fetchPolicy: "no-cache"
|
|
@@ -14026,7 +14036,9 @@ class $i {
|
|
|
14026
14036
|
mutation: Rt,
|
|
14027
14037
|
variables: {
|
|
14028
14038
|
integrationProductId: e,
|
|
14029
|
-
claim: !0
|
|
14039
|
+
claim: !0,
|
|
14040
|
+
marketplaceThemeInstallId: this.marketplaceThemeInstallId,
|
|
14041
|
+
marketplaceThemeInstallConfigurationId: this.marketplaceThemeInstallConfigurationId
|
|
14030
14042
|
},
|
|
14031
14043
|
errorPolicy: "all",
|
|
14032
14044
|
fetchPolicy: "no-cache",
|
|
@@ -14204,9 +14216,6 @@ class $i {
|
|
|
14204
14216
|
throw new v("Cannot get transaction: Not initialized.");
|
|
14205
14217
|
return this.experienceOptions.transaction;
|
|
14206
14218
|
}
|
|
14207
|
-
configureUrls(e, t, A) {
|
|
14208
|
-
ee.setHubUrl(e), ee.setServerUrl(t), ee.setServicesApiUrl(A), this.getIntegration();
|
|
14209
|
-
}
|
|
14210
14219
|
storeCustomer(e) {
|
|
14211
14220
|
const t = Y.getMap("partnerCustomerIds") || /* @__PURE__ */ new Map();
|
|
14212
14221
|
t.set(e.partner.id, e.id), Y.setMap("partnerCustomerIds", t);
|
|
@@ -14412,7 +14421,7 @@ class es extends X {
|
|
|
14412
14421
|
}
|
|
14413
14422
|
selectVariant(e) {
|
|
14414
14423
|
const t = this.manager.getRegionElements(this.step.stepName);
|
|
14415
|
-
return
|
|
14424
|
+
return ee.selectVariant(
|
|
14416
14425
|
this.step,
|
|
14417
14426
|
e.getResource(),
|
|
14418
14427
|
t,
|
|
@@ -14433,7 +14442,7 @@ class es extends X {
|
|
|
14433
14442
|
*/
|
|
14434
14443
|
async selectImage(e, t = !0, A = !0) {
|
|
14435
14444
|
var a;
|
|
14436
|
-
if (await
|
|
14445
|
+
if (await ee.selectImage(this.step, e, this.manager, A), t) {
|
|
14437
14446
|
const n = ((a = this.manager.getStepStorage(this.step.stepName)) == null ? void 0 : a.framePatternData) || {};
|
|
14438
14447
|
this.manager.updateStorage(this.step.stepName, {
|
|
14439
14448
|
framePatternData: {
|
|
@@ -14473,7 +14482,7 @@ class es extends X {
|
|
|
14473
14482
|
if (!t)
|
|
14474
14483
|
throw new Error("You must supply an image selection before attempting to remove the background.");
|
|
14475
14484
|
const A = await U.removeBackgroundFromAsset(t);
|
|
14476
|
-
e && await
|
|
14485
|
+
e && await ee.selectImage(this.step, A, this.manager, !1);
|
|
14477
14486
|
const a = ((n = this.manager.getStepStorage(this.step.stepName)) == null ? void 0 : n.framePatternData) || {};
|
|
14478
14487
|
return this.manager.updateStorage(this.step.stepName, {
|
|
14479
14488
|
framePatternData: {
|
|
@@ -14484,7 +14493,7 @@ class es extends X {
|
|
|
14484
14493
|
}), A;
|
|
14485
14494
|
}
|
|
14486
14495
|
changeColors(e) {
|
|
14487
|
-
|
|
14496
|
+
ee.changeColors(this.step, this.manager, e);
|
|
14488
14497
|
}
|
|
14489
14498
|
getImageData() {
|
|
14490
14499
|
if (this.frameService)
|
|
@@ -14494,7 +14503,7 @@ class es extends X {
|
|
|
14494
14503
|
return this.step.data.colorOption;
|
|
14495
14504
|
}
|
|
14496
14505
|
getAvailableColors() {
|
|
14497
|
-
return this.step.data.colorPickerEnabled ?
|
|
14506
|
+
return this.step.data.colorPickerEnabled ? ee.availableColors(this.step, this.manager) : Promise.resolve([]);
|
|
14498
14507
|
}
|
|
14499
14508
|
isColorPickerEnabled() {
|
|
14500
14509
|
return this.step.data.colorPickerEnabled ?? !1;
|
|
@@ -14507,7 +14516,7 @@ class es extends X {
|
|
|
14507
14516
|
return this.step.data.maxColors;
|
|
14508
14517
|
}
|
|
14509
14518
|
getUniqueColorCount() {
|
|
14510
|
-
return
|
|
14519
|
+
return ee.getUniqueColorCount(this.step, this.manager);
|
|
14511
14520
|
}
|
|
14512
14521
|
getCurrentFrameStep(e, t, A, a) {
|
|
14513
14522
|
return a && a.length > 1 && e === void 0 ? "SelectFrame" : t || A || this.getImageData() ? "Position" : "SelectImage";
|
|
@@ -14656,7 +14665,7 @@ export {
|
|
|
14656
14665
|
b as UnhandledBehaviorError,
|
|
14657
14666
|
Xs as UnitOfMeasurement,
|
|
14658
14667
|
qs as UpdateImageSourceCommand,
|
|
14659
|
-
|
|
14668
|
+
Z as Variant,
|
|
14660
14669
|
zn as WorkflowExperienceEventType,
|
|
14661
14670
|
Me as WorkflowExperienceImpl,
|
|
14662
14671
|
U as assetService,
|
|
@@ -14669,7 +14678,7 @@ export {
|
|
|
14669
14678
|
_s as findElement,
|
|
14670
14679
|
hs as findPmsColors,
|
|
14671
14680
|
eo as frameDataCache,
|
|
14672
|
-
|
|
14681
|
+
ee as frameStepService,
|
|
14673
14682
|
to as generate,
|
|
14674
14683
|
ti as generateCommands,
|
|
14675
14684
|
Ao as generateSVGWithUnknownColors,
|
|
@@ -14702,7 +14711,7 @@ export {
|
|
|
14702
14711
|
Bo as setCanvasModule,
|
|
14703
14712
|
we as shapeStepService,
|
|
14704
14713
|
Ka as shortenUrl,
|
|
14705
|
-
|
|
14714
|
+
q as spiffCoreConfiguration,
|
|
14706
14715
|
us as stepAspectValuesToDesignInputSteps,
|
|
14707
14716
|
Co as svgToDataUrl,
|
|
14708
14717
|
V as textStepService,
|