:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(warehouse-sources): add squarespace fulfillment options table (#119526)
Tom Owers28ecc189cd87
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.mdindex 7513103407fd..883e641d62f6 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md@@ -11626,13 +11626,14 @@ Note: Square's OpenAPI 3.0 spec has 255 paths; PostHog exposes 5 tables and none## Squarespace — gaps-Today (6): `inventory`, `orders`, `products`, `profiles`, `store_pages`, `transactions`+Today (7): `fulfillment_options`, `inventory`, `orders`, `products`, `profiles`, `store_pages`, `transactions`Diffed against: <https://developers.squarespace.com/commerce-apis/overview>- [ ] `GET /v1/contacts (Contacts API)` — the marketing contact record, distinct from commerce profiles; holds newsletter/marketing state we have no source for (high)- [ ] `GET /v1/commerce/discounts (Discounts API)` — lookup resolving the promo codes and discount rules applied on the orders we already sync (medium)- [ ] `Contacts address book entries (GET under /v1/contacts/{contactId})` — shipping addresses per contact, useful for geographic breakdowns (low)+- [x] `GET /v1/fulfillments/fulfillment-options (Discounts API)` — lookup of a site's shipping option IDs and carrier services, the targets of free shipping discounts (low)- [ ] `POST /v1/analytics/transaction-summaries` — per-contact lifetime order/donation/refund totals, though it requires supplying contactIds so it only works as a follow-on to a contacts sync (low)Note: Squarespace's public Commerce API is small: Contacts, Analytics, Discounts, Products, Websites (store pages), Inventory, Orders, Transactions, Profiles, WebhookSubscriptions. PostHog covers 6 of the 8 data-bearing ones. Order fulfillments and inventory adjustments exist but are POST-only writes, not readable collections.diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/squarespace/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/squarespace/canonical_descriptions.pyindex 7ec6976e0fbc..e0be7a9fb72e 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/squarespace/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/squarespace/canonical_descriptions.py@@ -105,4 +105,15 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"transactionsSummary": "Summary of the profile's orders and donations.",},},+ "fulfillment_options": {+ "description": "Shipping options configured on the Squarespace site and the carrier services "+ "each one offers. Used to target free shipping discounts.",+ "docs_url": "https://developers.squarespace.com/commerce-apis/discounts#get-fulfillment-options",+ "columns": {+ "id": "Unique fulfillment option id.",+ "name": "Name of the shipping option shown to customers (e.g. Standard Shipping).",+ "type": "Fulfillment option type (e.g. SHIPPING).",+ "availableServices": "Carrier services available for the option, each with a name and description.",+ },+ },}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/squarespace/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/squarespace/settings.pyindex 7db0e5119e8e..817ffe060ed3 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/squarespace/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/squarespace/settings.py@@ -117,6 +117,16 @@ SQUARESPACE_ENDPOINTS: dict[str, SquarespaceEndpointConfig] = {incremental_fields=[],extra_params={"sortField": "createdOn", "sortDirection": "asc"},),+ # Fulfillment options (Discounts API) is a single unpaginated lookup of the site's shipping+ # options and carrier services, with no timestamp fields, so full refresh only.+ "fulfillment_options": SquarespaceEndpointConfig(+ name="fulfillment_options",+ api_version="v1",+ path="/fulfillments/fulfillment-options",+ data_key="fulfillmentOptions",+ primary_keys=["id"],+ incremental_fields=[],+ ),}ENDPOINTS = tuple(SQUARESPACE_ENDPOINTS.keys())diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/squarespace/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/squarespace/source.pyindex 43addf48e046..c9e028592ce8 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/squarespace/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/squarespace/source.py@@ -68,6 +68,7 @@ Create an **API key** in your Squarespace site under **Settings → Advanced →- **Orders** (orders, transactions)- **Products** (products, inventory, store pages)- **Profiles** (profiles)+- **Discounts** (fulfillment options)The Commerce APIs (orders, inventory) require the merchant to be on a Commerce plan. Webhook subscriptions are not available with API-key auth, so this source polls on a schedule.""",iconPath="/static/services/squarespace.png",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/squarespace/test_squarespace.py b/products/warehouse_sources/backend/temporal/data_imports/sources/squarespace/test_squarespace.pyindex 29af7fc18911..56c6844966f0 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/squarespace/test_squarespace.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/squarespace/test_squarespace.py@@ -147,10 +147,15 @@ class TestGetRowsPagination:("inventory", "inventory"),("store_pages", "storePages"),("profiles", "profiles"),+ # Unpaginated: the response carries no `pagination` object.+ ("fulfillment_options", "fulfillmentOptions", False),])- def test_yields_rows_using_endpoint_data_key(self, endpoint: str, data_key: str) -> None:- result = self._driver().run(endpoint, [_page(data_key, [{"id": "a"}, {"id": "b"}])])+ def test_yields_rows_using_endpoint_data_key(self, endpoint: str, data_key: str, paginated: bool = True) -> None:+ rows = [{"id": "a"}, {"id": "b"}]+ response = _page(data_key, rows) if paginated else ScriptedResponse(json={data_key: rows})++ result = self._driver().run(endpoint, [response])assert result.items == [[{"id": "a"}, {"id": "b"}]]