{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "DA652CA2-2596-4C2F-88BB-D303C4DECE72",
    "name": "ShipStation: Shopify order intake with stock hold"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -65.26315789473684,
        "y": -515.023923444976,
        "zoom": 0.96
      },
      "autoSave": false,
      "descriptions": {
        "flow": "When a Shopify order comes in, compares live rates across your carriers and adds the order to ShipStation with the cheapest carrier and service, its weight, your store, ship-from location and source tag. If Shopify shows any item short, puts the order on hold, rechecks stock on a schedule, and releases the order once every item is back in stock.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "When a Shopify order comes in, adds it to ShipStation and tags its source. If Shopify shows any item short, puts the order on hold, rechecks stock on a schedule, and releases the order once every item is back in stock.",
    "elements": [
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Short items": "17a7c46f-5cb5-4f6b-92b5-a1874907d108",
            "Checks": "ec84fdfa-7233-4c3d-8a0b-8e9ff17cf704"
          },
          "position": {
            "x": 400,
            "y": 40
          }
        },
        "flowElementId": "913920B0-3DEA-4190-85F4-C6F8773C9E6F",
        "groupId": "EFEC88C7-4A6F-46D1-8916-79D28A85A527",
        "id": "7EBDF9B7-F9EE-453A-91DE-F22C607A358B",
        "metaInfo": {
          "bucketName": "Default",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "Short items",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 0
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "Checks",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - Checks",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.Checks",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "Checks",
                        "optional": false
                      }
                    ]
                  },
                  {
                    "id": "PLUS",
                    "label": null,
                    "type": "OPERATOR",
                    "value": "+"
                  },
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 1
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "reset",
          "storeResult": true
        },
        "name": "Reset the count",
        "nextElementIds": [],
        "nextGroupIds": [
          "E8270F2E-6F15-4FF3-84C2-F900EEC49A66"
        ],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": true,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Short items"
          },
          "position": {
            "x": 400,
            "y": 220
          }
        },
        "flowElementId": "0D474456-A5B0-4A9D-9DDE-F61B26168F00",
        "groupId": "9F4F0D8A-21B6-4F73-9639-8F1F70C83CCA",
        "id": "E933C6C5-2F54-4E9E-B421-949618E6315C",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "count",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - Short items",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.Short items",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "Short items",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "found",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Product match",
                    "subPathSegments": [
                      {
                        "key": "products",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "4341773E-ABE9-42C8-852A-977595E60AAE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sku",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "sku",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "9F4F0D8A-21B6-4F73-9639-8F1F70C83CCA"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const products = Array.isArray(found) ? found : [];\nlet variant = null;\nproducts.forEach(p => (p.variants || []).forEach(v => { if (v.sku === sku) variant = v; }));\nconst available = variant ? variant.inventoryQuantity : null;\nconst short = typeof available === 'number' && available < 0;\nreturn (Number(count) || 0) + (short ? 1 : 0);"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Short count",
          "retryPolicy": null,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Short items"
          },
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Count it if short",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Places an order on hold until a specified date. On the hold-until date the order automatically returns to the awaiting_shipment status.",
          "elementId": "EXTENSION:::SHARED:::default:::shipstation:::holdOrderUntil",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Hold the order Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::shipstation:::holdOrderUntil",
          "legacyElementId": "JS###v1###ShipStation###holdOrderUntil",
          "methodName": "holdOrderUntil",
          "position": {
            "x": 845,
            "y": 1090
          }
        },
        "flowElementId": "C490E0C2-7616-4789-AD60-4BCE5541C5AC",
        "groupId": null,
        "id": "EF44DE04-2A9B-4BA9-B96F-762A1B753B02",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "orderId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "ShipStation order",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8EC7CA72-8A08-486A-839C-86DFCC5B5412"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "holdUntilDate",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "holdUntil",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "holdOrderUntil",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Hold",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "shipstation",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Hold the order",
        "nextElementIds": [],
        "nextGroupIds": [
          "EFEC88C7-4A6F-46D1-8916-79D28A85A527"
        ],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": true,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Short items"
          },
          "position": {
            "x": 400,
            "y": 400
          }
        },
        "flowElementId": "AE34C01E-2941-405B-AB0A-3F49106CAD3B",
        "groupId": "E8270F2E-6F15-4FF3-84C2-F900EEC49A66",
        "id": "F74CEE02-5097-4D49-930B-D8414397FC62",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "count",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - Short items",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.Short items",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "Short items",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "found",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Product recheck",
                    "subPathSegments": [
                      {
                        "key": "products",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "C209AB9D-8EF7-48D5-9594-3FD9C5ABAC03"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "sku",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "sku",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "E8270F2E-6F15-4FF3-84C2-F900EEC49A66"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const products = Array.isArray(found) ? found : [];\nlet variant = null;\nproducts.forEach(p => (p.variants || []).forEach(v => { if (v.sku === sku) variant = v; }));\nconst available = variant ? variant.inventoryQuantity : null;\nconst short = typeof available === 'number' && available < 0;\nreturn (Number(count) || 0) + (short ? 1 : 0);"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Short recount",
          "retryPolicy": null,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Short items"
          },
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Count it if still short",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Triggers when a new order is created in your Shopify store. Polling interval can be customized (minimum 30 seconds). Each cycle inspects the 50 most recent orders, so bursts of more than 50 new orders between polls may be missed.",
          "elementId": "EXTENSION:::SHARED:::default:::shopify:::onNewOrder",
          "isFirstElement": true,
          "blockDefinitionId": "EXTENSION:::SHARED:::default:::shopify:::onNewOrder",
          "newElementId": "EXTENSION:::SHARED:::default:::shopify:::onNewOrder",
          "legacyElementId": "JS###v1###Shopify###onNewOrder",
          "methodName": "onNewOrder",
          "position": {
            "x": 133,
            "y": 580
          }
        },
        "flowElementId": "90D076F3-BD58-4A2E-92A6-1DC05AD20FA1",
        "groupId": null,
        "id": "CD225DC3-7A62-4066-8D3B-8AA42568153A",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": "Block: 'New Shopify order', Error: OAuth Connection is required",
            "valid": false
          },
          "condition": null,
          "connectionId": null,
          "dynamicData": [],
          "eventName": "onNewOrder",
          "frequency": {
            "repeat": {
              "every": 300
            },
            "schedule": "custom"
          },
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "New order",
          "serviceId": "shopify",
          "slaConditions": [],
          "staticData": {},
          "storeResult": true,
          "subtype": "POLLING",
          "type": "CUSTOM"
        },
        "name": "New Shopify order",
        "nextElementIds": [
          "B57CFE8A-A9C5-412F-B859-3F564F87D56D"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "notes": "Retrieves a list of products from your Shopify store with optional filtering and pagination.",
          "elementId": "EXTENSION:::SHARED:::default:::shopify:::getProducts",
          "isFirstElement": true,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Look the item up again Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::shopify:::getProducts",
          "legacyElementId": "JS###v1###Shopify###getProducts",
          "methodName": "getProducts",
          "position": {
            "x": 110,
            "y": 400
          }
        },
        "flowElementId": "AAD4CA12-6340-428C-A1B9-47BA0BAAA628",
        "groupId": "E8270F2E-6F15-4FF3-84C2-F900EEC49A66",
        "id": "C209AB9D-8EF7-48D5-9594-3FD9C5ABAC03",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "limit",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 5
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "status",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "searchQuery",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "sku:\""
                  },
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "sku",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "E8270F2E-6F15-4FF3-84C2-F900EEC49A66"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "\""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cursor",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Look the item up again', Error: OAuth Connection is required",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "getProducts",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Product recheck",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "shopify",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Look the item up again",
        "nextElementIds": [
          "F74CEE02-5097-4D49-930B-D8414397FC62"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1220,
            "y": 1099
          }
        },
        "flowElementId": "25F33BD3-9522-439A-B7A5-DA851DB2BF14",
        "groupId": null,
        "id": "1C37D914-D4F7-40BE-A724-3A66B5B5F05A",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "2d656477-ebad-49ad-a573-814be4bce216",
                "nestedOperation": null,
                "operation": ">",
                "property": {
                  "expression": [
                    {
                      "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                      "label": "Default - Short items",
                      "subPathSegments": null,
                      "type": "EXECUTION_CONTEXT_PATH",
                      "value": "executionContext.dataBuckets.Default.Short items",
                      "valueSegments": [
                        {
                          "key": "executionContext",
                          "optional": false
                        },
                        {
                          "key": "dataBuckets",
                          "optional": false
                        },
                        {
                          "key": "Default",
                          "optional": false
                        },
                        {
                          "key": "Short items",
                          "optional": false
                        }
                      ]
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "INT",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "NUMBER",
                        "label": null,
                        "type": "INPUT",
                        "value": 0
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "2d656477-ebad-49ad-a573-814be4bce216"
            ]
          },
          "elseComponent": null,
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "cshort",
          "storeResult": false,
          "thenComponent": {
            "componentId": "EF44DE04-2A9B-4BA9-B96F-762A1B753B02",
            "componentType": "ELEMENT"
          }
        },
        "name": "Any item short?",
        "nextElementIds": [
          "EF44DE04-2A9B-4BA9-B96F-762A1B753B02"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "elementId": "wait",
          "isFirstElement": true,
          "blockDefinitionId": "wait",
          "mode": "ADVANCED",
          "position": {
            "x": 110,
            "y": 40
          }
        },
        "flowElementId": "C7A7DD7F-2E23-4D81-BCEA-A93B85EFD97E",
        "groupId": "EFEC88C7-4A6F-46D1-8916-79D28A85A527",
        "id": "F4EA6D5A-20FE-437B-AD44-754C7611FDB8",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "delay": {
            "expression": [
              {
                "id": "ELEMENT_RESULT",
                "label": "Mapped order",
                "subPathSegments": [
                  {
                    "key": "waitSeconds",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": "DOUBLE"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "wait",
          "storeResult": true
        },
        "name": "Wait before the next check",
        "nextElementIds": [
          "7EBDF9B7-F9EE-453A-91DE-F22C607A358B"
        ],
        "nextGroupIds": [],
        "type": "WAIT"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Short items": "4ab0ac90-db88-4886-9a1b-3b9cac22547d",
            "Checks": "50e69709-8afb-4a59-be8e-a2435a04f8c7"
          },
          "position": {
            "x": 841,
            "y": 929
          }
        },
        "flowElementId": "AD38EEF0-C582-447A-9C0E-50F1D80A6D0C",
        "groupId": null,
        "id": "17F5A0B2-AB38-43C7-81AE-E7B659A9ED17",
        "metaInfo": {
          "bucketName": "Default",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "Short items",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 0
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "Checks",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 0
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "start",
          "storeResult": true
        },
        "name": "Start the stock check",
        "nextElementIds": [],
        "nextGroupIds": [
          "9F4F0D8A-21B6-4F73-9639-8F1F70C83CCA"
        ],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "notes": "Retrieves the order tags configured in the ShipStation account, each with its numeric ID, name, and display color. Use this to discover the tag IDs accepted by Add Tag to Order and Remove Tag from Order.",
          "elementId": "EXTENSION:::SHARED:::default:::shipstation:::listTags",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Look up your ShipStation tags Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::shipstation:::listTags",
          "legacyElementId": "JS###v1###ShipStation###listTags",
          "methodName": "listTags",
          "position": {
            "x": 812,
            "y": 580
          }
        },
        "flowElementId": "A384A562-5A8B-47E2-8A9C-98B3C8647770",
        "groupId": null,
        "id": "3D945FB6-40D6-43B2-B237-218C86B33031",
        "metaInfo": {
          "bodyParams": [],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "listTags",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Tags",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "shipstation",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Look up your ShipStation tags",
        "nextElementIds": [
          "27AF7575-BA77-40B6-B4BA-08FBF696C34D"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 133,
            "y": 1099
          }
        },
        "flowElementId": "505A9D09-42D6-4FCF-8B96-77C9A613F208",
        "groupId": null,
        "id": "C737AFDD-914F-4204-8543-815A5D37709F",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "650b0d66-5a34-4ade-8fb9-a2ae9ca890f9",
                "nestedOperation": null,
                "operation": "equal",
                "property": {
                  "expression": [
                    {
                      "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                      "label": "Default - Short items",
                      "subPathSegments": null,
                      "type": "EXECUTION_CONTEXT_PATH",
                      "value": "executionContext.dataBuckets.Default.Short items",
                      "valueSegments": [
                        {
                          "key": "executionContext",
                          "optional": false
                        },
                        {
                          "key": "dataBuckets",
                          "optional": false
                        },
                        {
                          "key": "Default",
                          "optional": false
                        },
                        {
                          "key": "Short items",
                          "optional": false
                        }
                      ]
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "INT",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "NUMBER",
                        "label": null,
                        "type": "INPUT",
                        "value": 0
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "650b0d66-5a34-4ade-8fb9-a2ae9ca890f9"
            ]
          },
          "elseComponent": null,
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "cin",
          "storeResult": false,
          "thenComponent": {
            "componentId": "F57A0EA8-72D6-478E-8B95-8103CBB1B98E",
            "componentType": "ELEMENT"
          }
        },
        "name": "Stock in now?",
        "nextElementIds": [
          "F57A0EA8-72D6-478E-8B95-8103CBB1B98E"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Retrieves a single order by its ID with full details: line items with their weight and tax lines, customer, addresses, total weight and custom attributes.",
          "elementId": "EXTENSION:::SHARED:::default:::shopify:::getOrder",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Read the full order Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::shopify:::getOrder",
          "legacyElementId": "JS###v1###Shopify###getOrder",
          "methodName": "getOrder",
          "position": {
            "x": 484,
            "y": 580
          }
        },
        "flowElementId": "D70DA227-4A39-48D5-91C5-099912C5E0A1",
        "groupId": null,
        "id": "B57CFE8A-A9C5-412F-B859-3F564F87D56D",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "orderId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "New order",
                    "subPathSegments": [
                      {
                        "key": "id",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "CD225DC3-7A62-4066-8D3B-8AA42568153A"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Read the full order', Error: OAuth Connection is required",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "getOrder",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Shopify order",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "shopify",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Read the full order",
        "nextElementIds": [
          "3D945FB6-40D6-43B2-B237-218C86B33031"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Creates a new order or updates an existing one in ShipStation. Supplying an existing orderKey updates the matching order; otherwise a new order is created. Includes shipping and billing addresses, line items, totals, and shipping preferences.",
          "elementId": "EXTENSION:::SHARED:::default:::shipstation:::createOrUpdateOrder",
          "isFirstElement": false,
          "dynamicOptionLabels": {
            "orderStatus": {
              "awaiting_shipment": "Awaiting Shipment"
            }
          },
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Add the order to ShipStation Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::shipstation:::createOrUpdateOrder",
          "legacyElementId": "JS###v1###ShipStation###createOrUpdateOrder",
          "methodName": "createOrUpdateOrder",
          "position": {
            "x": 456,
            "y": 920
          }
        },
        "flowElementId": "5A00DA19-865D-4DA9-8579-0DBDE190F336",
        "groupId": null,
        "id": "8EC7CA72-8A08-486A-839C-86DFCC5B5412",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "orderNumber",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "orderNumber",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "orderDate",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "orderDate",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "orderStatus",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "awaiting_shipment"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "orderKey",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "orderKey",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "customerUsername",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "customerEmail",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "email",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "items",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "items",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "amountPaid",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "amountPaid",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "taxAmount",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "taxAmount",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "shippingAmount",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "shippingAmount",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "customerNotes",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "internalNotes",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "gift",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "giftMessage",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "shipTo",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "shipTo",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "billTo",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "billTo",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "carrierCode",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Best rate",
                    "subPathSegments": [
                      {
                        "key": "carrierCode",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "AB476BD9-C132-4679-A8AF-7532AD0C37FA"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "serviceCode",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Best rate",
                    "subPathSegments": [
                      {
                        "key": "serviceCode",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "AB476BD9-C132-4679-A8AF-7532AD0C37FA"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "weightValue",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "weightOunces",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "weightUnits",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "ounces"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "storeId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "storeId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "warehouseId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "warehouseId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "tagIds",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "tagIds",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "createOrUpdateOrder",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "ShipStation order",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "shipstation",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Add the order to ShipStation",
        "nextElementIds": [
          "17F5A0B2-AB38-43C7-81AE-E7B659A9ED17"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Map the order for ShipStation Result"
          },
          "position": {
            "x": 814,
            "y": 759
          }
        },
        "flowElementId": "4D9BA34F-04F3-4CC9-ABFC-55601860AB3F",
        "groupId": null,
        "id": "5C67DBDA-56CC-4591-AED5-E2A619A4F370",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "order",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Shopify order",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "B57CFE8A-A9C5-412F-B859-3F564F87D56D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "tags",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Tags",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "3D945FB6-40D6-43B2-B237-218C86B33031"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "tagName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Source tag",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Source tag"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "warehouses",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Warehouses",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "27AF7575-BA77-40B6-B4BA-08FBF696C34D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "warehouseName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Ship-from location",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Ship-from location"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "stores",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Stores",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "BF6838E6-A613-462C-9AD9-83A30CA2658D"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "storeName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "ShipStation store",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "ShipStation store"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "holdDays",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Days to hold",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Days to hold"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "hoursBetween",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Hours between stock checks",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Hours between stock checks"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const ship = order.shippingAddress || {};\nconst bill = order.billingAddress || ship;\nconst customer = order.customer || {};\nconst address = (a) => ({\n  name: [a.firstName, a.lastName].filter(Boolean).join(' ') || customer.displayName || '',\n  company: a.company || '',\n  street1: a.address1 || '',\n  street2: a.address2 || '',\n  city: a.city || '',\n  state: a.provinceCode || a.province || '',\n  postalCode: a.zip || '',\n  country: a.countryCode || '',\n  phone: a.phone || '',\n});\nconst units = { GRAMS: 'grams', KILOGRAMS: 'grams', OUNCES: 'ounces', POUNDS: 'pounds' };\nconst perOunce = { GRAMS: 1 / 28.3495, KILOGRAMS: 35.274, OUNCES: 1, POUNDS: 16 };\nlet ounces = 0;\nconst items = (order.lineItems || []).map(item => {\n  const w = item.weight || {};\n  const value = w.unit === 'KILOGRAMS' ? Number(w.value) * 1000 : Number(w.value) || 0;\n  const quantity = Number(item.quantity) || 1;\n  ounces += (Number(w.value) || 0) * (perOunce[w.unit] || 1) * quantity;\n  return {\n    sku: item.sku || '',\n    name: item.variantTitle && item.variantTitle !== 'Default Title' ? `${item.title} - ${item.variantTitle}` : item.title,\n    quantity,\n    unitPrice: Number(item.price) || 0,\n    weight: { value, units: units[w.unit] || 'grams' },\n  };\n});\nconst same = (a, b) => String(a || '').trim().toLowerCase() === String(b || '').trim().toLowerCase();\nconst tagList = Array.isArray(tags) ? tags : [];\nconst tag = tagList.find(t => same(t.name, tagName));\nconst whList = Array.isArray(warehouses) ? warehouses : [];\nconst warehouse = whList.find(w => same(w.warehouseName, warehouseName))\n  || whList.find(w => w.isDefault) || whList[0] || {};\nconst from = warehouse.originAddress || {};\nconst storeList = Array.isArray(stores) ? stores : [];\nconst store = storeList.find(s => same(s.storeName, storeName));\nconst shipTo = address(ship);\nconst days = Number(holdDays) || 7;\nconst hours = Number(hoursBetween) || 6;\nreturn {\n  orderNumber: String(order.name || '').replace(/^#/, ''),\n  orderKey: order.id,\n  orderDate: String(order.createdAt || new Date().toISOString()).replace(/Z$/, ''),\n  email: customer.email || order.email || '',\n  shipTo,\n  billTo: address(bill),\n  items,\n  skus: items.filter(i => i.sku).map(i => ({ sku: i.sku, quantity: i.quantity })),\n  amountPaid: Number(order.totalPrice) || 0,\n  taxAmount: Number(order.totalTax) || 0,\n  shippingAmount: Number(order.totalShipping) || 0,\n  weightOunces: Math.round(ounces * 100) / 100,\n  tagIds: tag ? [tag.tagId] : [],\n  storeId: store ? store.storeId : null,\n  warehouseId: warehouse.warehouseId || null,\n  fromPostalCode: from.postalCode || '',\n  fromCity: from.city || '',\n  fromState: from.state || '',\n  toPostalCode: shipTo.postalCode,\n  toCountry: shipTo.country,\n  toState: shipTo.state,\n  toCity: shipTo.city,\n  holdUntil: new Date(Date.now() + days * 86400000).toISOString().slice(0, 10),\n  maxChecks: Math.max(1, Math.floor((days * 24) / hours)),\n  waitSeconds: Math.min(hours, 168) * 3600,\n};"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Mapped order",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Map the order for ShipStation",
        "nextElementIds": [
          "4FA07859-2E78-4B2E-816F-86F2782C9778"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Retrieves a list of products from your Shopify store with optional filtering and pagination.",
          "elementId": "EXTENSION:::SHARED:::default:::shopify:::getProducts",
          "isFirstElement": true,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Find the item in Shopify Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::shopify:::getProducts",
          "legacyElementId": "JS###v1###Shopify###getProducts",
          "methodName": "getProducts",
          "position": {
            "x": 110,
            "y": 220
          }
        },
        "flowElementId": "66E7C20C-94CD-4C96-A091-4CEE41097792",
        "groupId": "9F4F0D8A-21B6-4F73-9639-8F1F70C83CCA",
        "id": "4341773E-ABE9-42C8-852A-977595E60AAE",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "limit",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 5
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "status",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "searchQuery",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "sku:\""
                  },
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": [
                      {
                        "key": "sku",
                        "optional": false
                      }
                    ],
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "9F4F0D8A-21B6-4F73-9639-8F1F70C83CCA"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "\""
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "cursor",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": "Block: 'Find the item in Shopify', Error: OAuth Connection is required",
            "valid": false
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "getProducts",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Product match",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "shopify",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Find the item in Shopify",
        "nextElementIds": [
          "E933C6C5-2F54-4E9E-B421-949618E6315C"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Restores an order from on-hold status back to awaiting_shipment immediately, regardless of any previously set hold-until date.",
          "elementId": "EXTENSION:::SHARED:::default:::shipstation:::restoreOrderFromHold",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Release the order Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::shipstation:::restoreOrderFromHold",
          "legacyElementId": "JS###v1###ShipStation###restoreOrderFromHold",
          "methodName": "restoreOrderFromHold",
          "position": {
            "x": 133,
            "y": 1260
          }
        },
        "flowElementId": "FA2521EC-074E-478C-8481-7B698AEB9AE4",
        "groupId": null,
        "id": "F57A0EA8-72D6-478E-8B95-8103CBB1B98E",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "orderId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "ShipStation order",
                    "subPathSegments": [
                      {
                        "key": "orderId",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "8EC7CA72-8A08-486A-839C-86DFCC5B5412"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "restoreOrderFromHold",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Released",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "shipstation",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Release the order",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Retrieves the list of warehouses (Ship From Locations) configured in the ShipStation account, including their origin and return addresses.",
          "elementId": "EXTENSION:::SHARED:::default:::shipstation:::listWarehouses",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Look up your ship-from locations Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::shipstation:::listWarehouses",
          "legacyElementId": "JS###v1###ShipStation###listWarehouses",
          "methodName": "listWarehouses",
          "position": {
            "x": 1177,
            "y": 580
          }
        },
        "flowElementId": "CC51197A-F59A-4D01-A656-2E875EB660DC",
        "groupId": null,
        "id": "27AF7575-BA77-40B6-B4BA-08FBF696C34D",
        "metaInfo": {
          "bodyParams": [],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "listWarehouses",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Warehouses",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "shipstation",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Look up your ship-from locations",
        "nextElementIds": [
          "BF6838E6-A613-462C-9AD9-83A30CA2658D"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "data-bucket",
          "isFirstElement": false,
          "blockDefinitionId": "data-bucket",
          "fieldKeys": {
            "Rates": "13760ab0-e0d9-45d0-867e-25df0b304956"
          },
          "position": {
            "x": 475,
            "y": 759
          }
        },
        "flowElementId": "150A48D2-9154-4D31-ABFF-8EA0E41E8689",
        "groupId": null,
        "id": "4FA07859-2E78-4B2E-816F-86F2782C9778",
        "metaInfo": {
          "bucketName": "Default",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "fields": [
            {
              "name": "Rates",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EMPTY_LIST",
                    "label": null,
                    "type": "KEYWORD",
                    "value": "arrays.create()"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "bucket",
          "storeResult": true
        },
        "name": "Start an empty rate list",
        "nextElementIds": [],
        "nextGroupIds": [
          "F59134D2-33A5-4C66-8E90-61312CBC4BAE"
        ],
        "type": "DATA_BUCKET"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": true,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Rates"
          },
          "position": {
            "x": 400,
            "y": 760
          }
        },
        "flowElementId": "C52FA4D7-9920-4B2E-9F0E-685CE48525A0",
        "groupId": "F59134D2-33A5-4C66-8E90-61312CBC4BAE",
        "id": "6038B440-4A14-4196-A2CA-36DFF279F251",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "all",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - Rates",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.Rates",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "Rates",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "rates",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Carrier rates",
                    "subPathSegments": null,
                    "type": "ELEMENT_LINK",
                    "value": "A77CC0EB-FD73-46F5-8368-DD17A7495B7F"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "carrier",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": null,
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "F59134D2-33A5-4C66-8E90-61312CBC4BAE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const kept = Array.isArray(all) ? all : [];\nconst found = Array.isArray(rates) ? rates : [];\nreturn kept.concat(found.map(r => ({\n  carrierCode: r.carrierCode || carrier,\n  serviceCode: r.serviceCode,\n  serviceName: r.serviceName,\n  cost: (Number(r.shipmentCost) || 0) + (Number(r.otherCost) || 0),\n})));"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Kept rates",
          "retryPolicy": null,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Rates"
          },
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Keep the carrier's rates",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Returns the available shipping rates for the supplied carrier between the supplied origin and destination addresses. Each rate carries the carrierCode it was quoted for, so a row can feed a label action directly. Useful for letting customers select shipping options at checkout or for choosing the cheapest service before purchasing a label.",
          "elementId": "EXTENSION:::SHARED:::default:::shipstation:::getShipmentRates",
          "isFirstElement": true,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Get this carrier's rates Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::shipstation:::getShipmentRates",
          "legacyElementId": "JS###v1###ShipStation###getShipmentRates",
          "methodName": "getShipmentRates",
          "position": {
            "x": 110,
            "y": 850
          }
        },
        "flowElementId": "2461EBE7-61BE-428C-9517-F35DFC4A8540",
        "groupId": "F59134D2-33A5-4C66-8E90-61312CBC4BAE",
        "id": "A77CC0EB-FD73-46F5-8368-DD17A7495B7F",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "carrierCode",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "label": null,
                    "subPathSegments": null,
                    "type": "LIST_ITERATOR_CURRENT_ELEMENT",
                    "value": "F59134D2-33A5-4C66-8E90-61312CBC4BAE"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fromPostalCode",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "fromPostalCode",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "toPostalCode",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "toPostalCode",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "toCountry",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "toCountry",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "weight",
              "type": "OBJECT",
              "value": [
                {
                  "name": "value",
                  "type": "SIMPLE",
                  "value": {
                    "expression": [
                      {
                        "id": "ELEMENT_RESULT",
                        "label": "Mapped order",
                        "subPathSegments": [
                          {
                            "key": "weightOunces",
                            "optional": false
                          }
                        ],
                        "type": "ELEMENT_LINK",
                        "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                },
                {
                  "name": "units",
                  "type": "SIMPLE",
                  "value": {
                    "expression": [
                      {
                        "id": "TEXT",
                        "label": null,
                        "type": "INPUT",
                        "value": "ounces"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                }
              ]
            },
            {
              "name": "serviceCode",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "packageCode",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fromCity",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "fromCity",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "fromState",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "fromState",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "toCity",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "toCity",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "toState",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Mapped order",
                    "subPathSegments": [
                      {
                        "key": "toState",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "confirmation",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "residential",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "getShipmentRates",
          "onFailElemId": "4487DCD1-5898-4CED-BF22-04D4E1BD80A5",
          "packageId": "default",
          "resultAlias": "Carrier rates",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "shipstation",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Get this carrier's rates",
        "nextElementIds": [
          "6038B440-4A14-4196-A2CA-36DFF279F251"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Retrieves the list of stores connected to the ShipStation account, with an option to include inactive stores or filter by marketplace.",
          "elementId": "EXTENSION:::SHARED:::default:::shipstation:::listStores",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Look up your ShipStation stores Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::shipstation:::listStores",
          "legacyElementId": "JS###v1###ShipStation###listStores",
          "methodName": "listStores",
          "position": {
            "x": 1181,
            "y": 750
          }
        },
        "flowElementId": "474A7CFD-AE06-4888-ABBA-514714879B1F",
        "groupId": null,
        "id": "BF6838E6-A613-462C-9AD9-83A30CA2658D",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "showInactive",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "marketplaceId",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "listStores",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Stores",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "shipstation",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Look up your ShipStation stores",
        "nextElementIds": [
          "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "error-handler",
          "isFirstElement": false,
          "blockDefinitionId": "error-handler",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Skip a carrier with no rates Result"
          },
          "position": {
            "x": 400,
            "y": 940
          }
        },
        "flowElementId": "8B6E8DD3-6BE6-4A4E-BA99-EEB17C722375",
        "groupId": "F59134D2-33A5-4C66-8E90-61312CBC4BAE",
        "id": "4487DCD1-5898-4CED-BF22-04D4E1BD80A5",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Carrier error",
          "saveToVariable": null,
          "storeResult": true
        },
        "name": "Skip a carrier with no rates",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "ERROR_HANDLER"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Pick the cheapest rate Result"
          },
          "position": {
            "x": 126,
            "y": 929
          }
        },
        "flowElementId": "B0AADAC1-EBAC-4B98-987D-3C718C419C85",
        "groupId": null,
        "id": "AB476BD9-C132-4679-A8AF-7532AD0C37FA",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "rates",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                    "label": "Default - Rates",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_PATH",
                    "value": "executionContext.dataBuckets.Default.Rates",
                    "valueSegments": [
                      {
                        "key": "executionContext",
                        "optional": false
                      },
                      {
                        "key": "dataBuckets",
                        "optional": false
                      },
                      {
                        "key": "Default",
                        "optional": false
                      },
                      {
                        "key": "Rates",
                        "optional": false
                      }
                    ]
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const list = (Array.isArray(rates) ? rates : []).filter(r => r.carrierCode && r.serviceCode && r.cost > 0);\nlist.sort((a, b) => a.cost - b.cost);\nconst best = list[0];\nif (!best) {\n  return { found: false, carrierCode: null, serviceCode: null, serviceName: null, cost: null };\n}\nreturn {\n  found: true,\n  carrierCode: best.carrierCode,\n  serviceCode: best.serviceCode,\n  serviceName: best.serviceName,\n  cost: best.cost.toFixed(2),\n};"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Best rate",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Pick the cheapest rate",
        "nextElementIds": [
          "8EC7CA72-8A08-486A-839C-86DFCC5B5412"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      }
    ],
    "firstElementId": "CD225DC3-7A62-4066-8D3B-8AA42568153A",
    "groups": [
      {
        "clientMetadata": {
          "elementId": "list-iterator",
          "isFirstElement": false,
          "blockDefinitionId": "list-iterator",
          "viewport": {
            "x": 0,
            "y": 0,
            "zoom": 0.8
          },
          "position": {
            "x": 690,
            "y": 40
          }
        },
        "flowElementId": "7C400BEB-EF1E-4773-B014-AAF2012C6026",
        "groupId": "EFEC88C7-4A6F-46D1-8916-79D28A85A527",
        "id": "E8270F2E-6F15-4FF3-84C2-F900EEC49A66",
        "loopType": "LIST_ITERATOR",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": "Block: 'Recheck each item', Error: Children have error",
            "valid": false
          },
          "enabled": true,
          "firstElementId": "C209AB9D-8EF7-48D5-9594-3FD9C5ABAC03",
          "list": {
            "expression": [
              {
                "id": "ELEMENT_RESULT",
                "label": "Mapped order",
                "subPathSegments": [
                  {
                    "key": "skus",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "onFailElemId": null,
          "resultAlias": "loop2",
          "storeResult": true
        },
        "name": "Recheck each item",
        "nextElementIds": [],
        "nextGroupIds": [],
        "type": "LOOP"
      },
      {
        "clientMetadata": {
          "elementId": "repeat",
          "isFirstElement": false,
          "blockDefinitionId": "repeat",
          "viewport": {
            "x": 0,
            "y": 0,
            "zoom": 0.8
          },
          "position": {
            "x": 455,
            "y": 1099
          }
        },
        "flowElementId": "9871BB80-CF51-4FA5-A086-462F3F1D1933",
        "groupId": null,
        "id": "EFEC88C7-4A6F-46D1-8916-79D28A85A527",
        "loopType": "REPEAT",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": "Block: 'Recheck stock until it arrives', Error: Children have error",
            "valid": false
          },
          "condition": {
            "conditionParts": [
              {
                "id": "f172daab-fedd-4644-b1f5-3ebed71ea9c1",
                "nestedOperation": null,
                "operation": ">",
                "property": {
                  "expression": [
                    {
                      "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                      "label": "Default - Short items",
                      "subPathSegments": null,
                      "type": "EXECUTION_CONTEXT_PATH",
                      "value": "executionContext.dataBuckets.Default.Short items",
                      "valueSegments": [
                        {
                          "key": "executionContext",
                          "optional": false
                        },
                        {
                          "key": "dataBuckets",
                          "optional": false
                        },
                        {
                          "key": "Default",
                          "optional": false
                        },
                        {
                          "key": "Short items",
                          "optional": false
                        }
                      ]
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "INT",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "NUMBER",
                        "label": null,
                        "type": "INPUT",
                        "value": 0
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              },
              {
                "id": "e077b87c-7b1c-4ca5-b319-63208d9f1c36",
                "nestedOperation": null,
                "operation": "<",
                "property": {
                  "expression": [
                    {
                      "id": "EXECUTION_CONTEXT_DATA_BUCKET_VARIABLE",
                      "label": "Default - Checks",
                      "subPathSegments": null,
                      "type": "EXECUTION_CONTEXT_PATH",
                      "value": "executionContext.dataBuckets.Default.Checks",
                      "valueSegments": [
                        {
                          "key": "executionContext",
                          "optional": false
                        },
                        {
                          "key": "dataBuckets",
                          "optional": false
                        },
                        {
                          "key": "Default",
                          "optional": false
                        },
                        {
                          "key": "Checks",
                          "optional": false
                        }
                      ]
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "INT",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "ELEMENT_RESULT",
                        "label": "Mapped order",
                        "subPathSegments": [
                          {
                            "key": "maxChecks",
                            "optional": false
                          }
                        ],
                        "type": "ELEMENT_LINK",
                        "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "f172daab-fedd-4644-b1f5-3ebed71ea9c1",
              "AND",
              "e077b87c-7b1c-4ca5-b319-63208d9f1c36"
            ]
          },
          "enabled": true,
          "firstElementId": "F4EA6D5A-20FE-437B-AD44-754C7611FDB8",
          "maxIterations": 1000,
          "onFailElemId": null,
          "resultAlias": "rep",
          "storeResult": true
        },
        "name": "Recheck stock until it arrives",
        "nextElementIds": [
          "C737AFDD-914F-4204-8543-815A5D37709F"
        ],
        "nextGroupIds": [],
        "type": "LOOP"
      },
      {
        "clientMetadata": {
          "elementId": "list-iterator",
          "isFirstElement": false,
          "blockDefinitionId": "list-iterator",
          "viewport": {
            "x": 0,
            "y": 0,
            "zoom": 0.8
          },
          "position": {
            "x": 1201,
            "y": 929
          }
        },
        "flowElementId": "A2837596-4D65-4008-B4C2-DB5707D218B7",
        "groupId": null,
        "id": "9F4F0D8A-21B6-4F73-9639-8F1F70C83CCA",
        "loopType": "LIST_ITERATOR",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": "Block: 'Check stock for each item', Error: Children have error",
            "valid": false
          },
          "enabled": true,
          "firstElementId": "4341773E-ABE9-42C8-852A-977595E60AAE",
          "list": {
            "expression": [
              {
                "id": "ELEMENT_RESULT",
                "label": "Mapped order",
                "subPathSegments": [
                  {
                    "key": "skus",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "5C67DBDA-56CC-4591-AED5-E2A619A4F370"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "onFailElemId": null,
          "resultAlias": "loop1",
          "storeResult": true
        },
        "name": "Check stock for each item",
        "nextElementIds": [
          "1C37D914-D4F7-40BE-A724-3A66B5B5F05A"
        ],
        "nextGroupIds": [],
        "type": "LOOP"
      },
      {
        "clientMetadata": {
          "elementId": "list-iterator",
          "isFirstElement": false,
          "blockDefinitionId": "list-iterator",
          "viewport": {
            "x": 0,
            "y": 0,
            "zoom": 0.8
          },
          "position": {
            "x": 110,
            "y": 759
          }
        },
        "flowElementId": "87772F2C-A9A5-4C0C-B5F2-48349090F8A6",
        "groupId": null,
        "id": "F59134D2-33A5-4C66-8E90-61312CBC4BAE",
        "loopType": "LIST_ITERATOR",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "enabled": true,
          "firstElementId": "A77CC0EB-FD73-46F5-8368-DD17A7495B7F",
          "list": {
            "expression": [
              {
                "id": "PLACEHOLDER_DATA",
                "label": "Carriers",
                "subPathSegments": null,
                "type": "EXECUTION_CONTEXT_STATIC_DATA",
                "value": "Carriers"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "onFailElemId": null,
          "resultAlias": "loop",
          "storeResult": true
        },
        "name": "Get rates from each carrier",
        "nextElementIds": [
          "AB476BD9-C132-4679-A8AF-7532AD0C37FA"
        ],
        "nextGroupIds": [],
        "type": "LOOP"
      }
    ],
    "id": "F169F713-1738-4076-9E93-485E093C6231",
    "metaInfo": {
      "clientValidationState": {
        "errorMessage": "Please fix problems before start. Blocks with issues have red badge in the top-right corner of a block, hover it to see what needs to be done.",
        "valid": false
      },
      "errorMessage": "Please fix problems before start. Blocks with issues have red badge in the top-right corner of a block, hover it to see what needs to be done.",
      "executionStaticData": [
        {
          "description": "Name of the ShipStation order tag that marks where the order came from. If no tag has this name, the order goes in untagged.",
          "error": null,
          "name": "Source tag",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "How long a short order stays on hold while the flow waits for stock.",
          "error": null,
          "name": "Days to hold",
          "type": "INT",
          "value": ""
        },
        {
          "description": "How often the flow rechecks Shopify stock for a held order.",
          "error": null,
          "name": "Hours between stock checks",
          "type": "INT",
          "value": ""
        },
        {
          "description": "ShipStation carrier codes to compare rates across.",
          "error": null,
          "name": "Carriers",
          "type": "ARRAY",
          "value": ""
        },
        {
          "description": "Name of the ShipStation store the orders go under. If no store has this name, ShipStation files them under its first manual store.",
          "error": null,
          "name": "ShipStation store",
          "type": "STRING",
          "value": ""
        },
        {
          "description": "Name of the ShipStation Ship From Location the orders ship from and are rated from. If no location has this name, the account's default location is used.",
          "error": null,
          "name": "Ship-from location",
          "type": "STRING",
          "value": ""
        }
      ],
      "initialData": null,
      "initialDataDefaultValues": {},
      "ownerFlowVersionId": null,
      "schedule": null,
      "sharedMemory": {
        "anchor": {
          "missingAnchorPolicy": null,
          "path": null,
          "type": "FLOW_MEMORY"
        },
        "expirationInSec": null
      },
      "wasLive": false
    }
  },
  "slaCalendars": [],
  "slaGoals": [],
  "subFlows": [],
  "exportDate": "2026-11-19T02:35:46.013Z"
}
