@spiffcommerce/core 8.0.3 → 8.1.0

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
@@ -1805,6 +1805,7 @@ interface ClientOptions {
1805
1805
  /**
1806
1806
  * When set to true, the client will treat the workflow as a bulk order
1807
1807
  * containing multiple variations of the base design.
1808
+ * @deprecated Specify when calling getWorkflowExperience instead.
1808
1809
  */
1809
1810
  bulk?: boolean;
1810
1811
  /**
@@ -1813,6 +1814,37 @@ interface ClientOptions {
1813
1814
  */
1814
1815
  applicationKey?: string;
1815
1816
  }
1817
+ interface GetWorkflowFromTransactionOptions {
1818
+ /** The existing Transaction to use. */
1819
+ transactionId: string;
1820
+ /** If set to true, the workflow will display in a read-only mode. */
1821
+ readOnly?: boolean;
1822
+ /** An existing workflow state, if available. */
1823
+ workflowState?: string;
1824
+ type: "transaction";
1825
+ }
1826
+ interface GetWorkflowFromIntegrationProductOptions {
1827
+ /** The workflow to load. */
1828
+ workflowId: string;
1829
+ integrationProductId: string;
1830
+ /** An existing workflow state, if available. */
1831
+ workflowState?: string;
1832
+ bulk?: boolean;
1833
+ type: "integration";
1834
+ }
1835
+ interface GetWorkflowFromExternalProductOptions {
1836
+ /** The workflow to load. */
1837
+ workflowId: string;
1838
+ /** The external ID associated with an integration. */
1839
+ externalIntegrationId: string;
1840
+ /** The ID of the product from the external system. */
1841
+ externalProductId: string;
1842
+ /** An existing workflow state, if available. */
1843
+ workflowState?: string;
1844
+ bulk?: boolean;
1845
+ type: "external";
1846
+ }
1847
+ export type GetWorkflowOptions = GetWorkflowFromTransactionOptions | GetWorkflowFromIntegrationProductOptions | GetWorkflowFromExternalProductOptions;
1816
1848
  /**
1817
1849
  * The Spiff Commerce Javascript Client. Required for
1818
1850
  * creating workflow experiences.
@@ -1828,22 +1860,25 @@ export class SpiffCommerceClient {
1828
1860
  /**
1829
1861
  * Initialize the client from an integration product.
1830
1862
  * @param integrationProductId The integration product to use.
1863
+ * @deprecated Use getWorkflowExperience to initialize the experience.
1831
1864
  */
1832
1865
  initFromIntegrationProduct(integrationProductId: string): Promise<void>;
1833
1866
  /**
1834
1867
  * Initialize the client from an existing transaction.
1835
1868
  * @param transactionId The id of the transaction
1836
1869
  * @returns A promise resolving at initialization completion.
1870
+ * @deprecated Use getWorkflowExperience to initialize the experience.
1837
1871
  */
1838
1872
  initFromTransaction(transactionId: string, readOnly?: boolean): Promise<void>;
1839
1873
  /**
1840
1874
  * Creates a new instance of WorkflowExperience. A high level wrapper for workflows.
1841
- * @param workflowId The id of the workflow to be run.
1842
- * @param workflowState An existing workflow state if available.
1875
+ * @param workflowId The id of the workflow to be run. Deprecated: Provide options instead.
1876
+ * @param workflowState An existing workflow state if available. Deprecated: Provide options instead.
1843
1877
  * @param previewServiceConstructor A function called during initialization. Takes a class implementing ThreeDPreviewService in return.
1878
+ * @param options Options to configure loading the transaction and workflow.
1844
1879
  * @returns A workflow experience configured as requested.
1845
1880
  */
1846
- getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: _Workflow1) => any): Promise<WorkflowExperience>;
1881
+ getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: _Workflow1) => any, options?: GetWorkflowOptions): Promise<WorkflowExperience>;
1847
1882
  /**
1848
1883
  * @returns The preview service that was provided during construction.
1849
1884
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/core",
3
- "version": "8.0.3",
3
+ "version": "8.1.0",
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",