@spiffcommerce/core 0.9.8 → 0.9.9

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/types.d.ts CHANGED
@@ -131,6 +131,36 @@ declare class Poller {
131
131
  */
132
132
  constructor(predicate: () => Promise<boolean>, onSuccess: () => void, onFailure: () => void, interval?: number, maxAttempts?: number);
133
133
  }
134
+ interface StorageService {
135
+ /**
136
+ * Get a value.
137
+ * @param key The key to lookup the value with.
138
+ */
139
+ get(key: string): string | undefined;
140
+ /**
141
+ * Set a value.
142
+ * @param key The key to set.
143
+ * @param val The new value.
144
+ */
145
+ set(key: string, val: string): void;
146
+ /**
147
+ * Remove a value.
148
+ * @param key The key to remove, does nothing if the key doesn't exist.
149
+ */
150
+ remove(key: string): void;
151
+ /**
152
+ * Get a map from persistence.
153
+ * @param key The key to search by.
154
+ */
155
+ getMap<K = any, V = any>(key: string): Map<K, V> | undefined;
156
+ /**
157
+ * St a map into persistence.
158
+ * @param key The key to set the map at.
159
+ * @param val The map to set.
160
+ */
161
+ setMap<K = any, V = any>(key: string, val: Map<K, V>): void;
162
+ }
163
+ export const persistenceService: StorageService;
134
164
  declare class Configuration {
135
165
  constructor();
136
166
  getServerUrl(): string;
@@ -169,13 +199,20 @@ declare class AssetService {
169
199
  getMaterialLocalOrFromServer(id: string): Promise<IServerModel<MaterialResource>>;
170
200
  /**
171
201
  * Upload a user asset to the server. Using callbacks to notify important events.
202
+ * The asset will be stored via the persistence service for future access, if available.
172
203
  */
173
204
  uploadAssetWithProgress(file: FileInfo, assetType: _AssetType1, onProgress: (val: number) => void, onComplete: (asset: IServerModel<_Asset1>) => void, anonymous?: boolean, partnerId?: string): Promise<IServerModel<_Asset1>>;
205
+ removePersistedAsset(assetKey: string): void;
206
+ getPersistedAssets(): PersistedAsset[];
174
207
  /**
175
208
  * Convert a File object for an image into a FileInfo.
176
209
  */
177
210
  loadImageAsFileInfo: (file: File) => Promise<FileInfo>;
178
211
  }
212
+ interface PersistedAsset {
213
+ assetKey: string;
214
+ src: string;
215
+ }
179
216
  export const assetService: AssetService;
180
217
  interface SVGCreateOpts {
181
218
  stepName?: string;
@@ -1010,27 +1047,6 @@ export const AdvancedEditor: FunctionComponent<{
1010
1047
  handleContextMenu?: (event: MouseEvent) => void;
1011
1048
  onElementSelected?: (id: string | undefined, element: PointerEvent) => void;
1012
1049
  }>;
1013
- interface StorageService {
1014
- /**
1015
- * Get a value.
1016
- * @param key The key to lookup the value with.
1017
- */
1018
- get(key: string): string | undefined;
1019
- /**
1020
- * Set a value.
1021
- * @param key The key to set.
1022
- * @param val The new value.
1023
- */
1024
- set(key: string, val: string): void;
1025
- /**
1026
- * Remove a value.
1027
- * @param key The key to remove, does nothing if the key doesn't exist.
1028
- */
1029
- remove(key: string): void;
1030
- getMap(key: string): Map<any, any> | undefined;
1031
- setMap(key: string, val: Map<any, any>): void;
1032
- }
1033
- export const persistenceService: StorageService;
1034
1050
  /**
1035
1051
  * An abstract base class to be extended by step handles to implement type specific behavior.
1036
1052
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/core",
3
- "version": "0.9.8",
3
+ "version": "0.9.9",
4
4
  "description": "Core client API for interacting with the Spiff Commerce backend.",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/main.js",