@spiffcommerce/core 16.4.3 → 16.5.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/index.d.ts CHANGED
@@ -1656,9 +1656,10 @@ declare class CollectionProduct {
1656
1656
  /**
1657
1657
  * A helper function for getting integrations
1658
1658
  * @param type The type of integration you want.
1659
+ * @param externalId An external integration ID to further filter by. Otherwise we return the first encountered.
1659
1660
  * @returns The integration if found. Throws an error if not found as this data is typically a neccesity.
1660
1661
  */
1661
- getIntegrationByType(type: IntegrationType): IntegrationProduct;
1662
+ getIntegrationByType(type: IntegrationType, externalId?: string): IntegrationProduct;
1662
1663
  /**
1663
1664
  * A helper function for pulling the default workflow.
1664
1665
  */
package/dist/index.js CHANGED
@@ -8471,18 +8471,20 @@ class es {
8471
8471
  /**
8472
8472
  * A helper function for getting integrations
8473
8473
  * @param type The type of integration you want.
8474
+ * @param externalId An external integration ID to further filter by. Otherwise we return the first encountered.
8474
8475
  * @returns The integration if found. Throws an error if not found as this data is typically a neccesity.
8475
8476
  */
8476
- getIntegrationByType(A) {
8477
- const t = (this.product.integrationProducts || []).find((a) => {
8478
- var n, s;
8479
- return !!((n = a.integration) != null && n.type) && ((s = a.integration) == null ? void 0 : s.type) === A;
8477
+ getIntegrationByType(A, e) {
8478
+ const a = (this.product.integrationProducts || []).find((n) => {
8479
+ var r, c, B;
8480
+ const s = (r = n.integration) == null ? void 0 : r.type, i = ((c = n.integration) == null ? void 0 : c.type) === A, o = e ? ((B = n.integration) == null ? void 0 : B.externalIntegrationId) === e : !0;
8481
+ return s && i && o;
8480
8482
  });
8481
- if (!t)
8483
+ if (!a)
8482
8484
  throw new Error(
8483
8485
  "Failed to find requested integration type on product. This is generally due to a configuration error"
8484
8486
  );
8485
- return t;
8487
+ return a;
8486
8488
  }
8487
8489
  /**
8488
8490
  * A helper function for pulling the default workflow.