@friggframework/core 2.0.0--canary.700.80ec1cc.0 → 2.0.0--canary.702.047d3c4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/database/documentdb-utils.js +1 -6
  2. package/errors/index.js +0 -4
  3. package/generated/prisma-mongodb/edge.js +4 -52
  4. package/generated/prisma-mongodb/index-browser.js +1 -49
  5. package/generated/prisma-mongodb/index.d.ts +60 -3506
  6. package/generated/prisma-mongodb/index.js +4 -52
  7. package/generated/prisma-mongodb/package.json +1 -1
  8. package/generated/prisma-mongodb/schema.prisma +0 -65
  9. package/generated/prisma-mongodb/wasm.js +4 -52
  10. package/generated/prisma-postgresql/edge.js +4 -52
  11. package/generated/prisma-postgresql/index-browser.js +1 -49
  12. package/generated/prisma-postgresql/index.d.ts +94 -3824
  13. package/generated/prisma-postgresql/index.js +4 -52
  14. package/generated/prisma-postgresql/package.json +1 -1
  15. package/generated/prisma-postgresql/schema.prisma +0 -63
  16. package/generated/prisma-postgresql/wasm.js +4 -52
  17. package/handlers/WEBHOOKS.md +0 -29
  18. package/handlers/app-definition-loader.js +9 -2
  19. package/handlers/app-handler-helpers.js +2 -5
  20. package/handlers/integration-event-dispatcher.js +3 -7
  21. package/handlers/routers/integration-webhook-routers.js +38 -26
  22. package/index.js +0 -2
  23. package/integrations/integration-base.js +1 -162
  24. package/integrations/integration-router.js +1 -6
  25. package/integrations/repositories/integration-mapping-repository-documentdb.js +0 -50
  26. package/integrations/repositories/integration-mapping-repository-interface.js +0 -15
  27. package/integrations/repositories/integration-mapping-repository-mongo.js +0 -29
  28. package/integrations/repositories/integration-mapping-repository-postgres.js +0 -30
  29. package/integrations/repositories/integration-mapping-repository.js +0 -29
  30. package/integrations/repositories/integration-repository-documentdb.js +2 -6
  31. package/integrations/repositories/integration-repository-interface.js +0 -3
  32. package/integrations/repositories/integration-repository-mongo.js +5 -20
  33. package/integrations/repositories/integration-repository-postgres.js +1 -5
  34. package/integrations/repositories/process-repository-mongo.js +1 -1
  35. package/integrations/use-cases/create-integration.js +4 -14
  36. package/integrations/use-cases/delete-integration-for-user.js +4 -4
  37. package/integrations/use-cases/get-integration-for-user.js +2 -4
  38. package/integrations/use-cases/get-integration-instance.js +4 -4
  39. package/integrations/use-cases/get-integrations-for-user.js +4 -4
  40. package/integrations/use-cases/get-possible-integrations.js +2 -7
  41. package/integrations/use-cases/update-integration.js +4 -4
  42. package/package.json +6 -6
  43. package/prisma-mongodb/schema.prisma +0 -65
  44. package/prisma-postgresql/schema.prisma +0 -63
  45. package/queues/queuer-util.js +2 -9
  46. package/errors/mapping-already-exists-error.js +0 -14
  47. package/handlers/workers/integration-triggers.js +0 -25
  48. package/infrastructure/scheduler/recurrence.js +0 -204
  49. package/integrations/definitions/README.md +0 -278
  50. package/integrations/definitions/canonical.js +0 -11
  51. package/integrations/definitions/capabilities/AUDIT.md +0 -480
  52. package/integrations/definitions/capabilities/acmeerp.capabilities.json +0 -633
  53. package/integrations/definitions/capabilities/asana.capabilities.json +0 -279
  54. package/integrations/definitions/capabilities/calendly.capabilities.json +0 -385
  55. package/integrations/definitions/capabilities/docusign.capabilities.json +0 -314
  56. package/integrations/definitions/capabilities/fathom.capabilities.json +0 -238
  57. package/integrations/definitions/capabilities/github.capabilities.json +0 -585
  58. package/integrations/definitions/capabilities/hubspot.capabilities.json +0 -822
  59. package/integrations/definitions/capabilities/jira.capabilities.json +0 -391
  60. package/integrations/definitions/capabilities/klaviyo.capabilities.json +0 -503
  61. package/integrations/definitions/capabilities/linear.capabilities.json +0 -378
  62. package/integrations/definitions/capabilities/netsuite.capabilities.json +0 -535
  63. package/integrations/definitions/capabilities/notion.capabilities.json +0 -208
  64. package/integrations/definitions/capabilities/phone.capabilities.json +0 -511
  65. package/integrations/definitions/capabilities/pipedrive.capabilities.json +0 -430
  66. package/integrations/definitions/capabilities/quickbooks.capabilities.json +0 -635
  67. package/integrations/definitions/capabilities/salesforce.capabilities.json +0 -568
  68. package/integrations/definitions/capabilities/shopify.capabilities.json +0 -1128
  69. package/integrations/definitions/capabilities/slack.capabilities.json +0 -373
  70. package/integrations/definitions/capabilities/stripe.capabilities.json +0 -630
  71. package/integrations/definitions/capabilities/webflow.capabilities.json +0 -196
  72. package/integrations/definitions/capabilities/zendesk.capabilities.json +0 -422
  73. package/integrations/definitions/compile.js +0 -80
  74. package/integrations/definitions/config-form.js +0 -137
  75. package/integrations/definitions/examples/acme-erp-quickbooks.definition.json +0 -467
  76. package/integrations/definitions/examples/asana-slack.definition.json +0 -219
  77. package/integrations/definitions/examples/calendly-salesforce.definition.json +0 -459
  78. package/integrations/definitions/examples/docusign-salesforce.definition.json +0 -305
  79. package/integrations/definitions/examples/fathom-hubspot-notion.definition.json +0 -575
  80. package/integrations/definitions/examples/github-linear.definition.json +0 -322
  81. package/integrations/definitions/examples/hubspot-slack.definition.json +0 -427
  82. package/integrations/definitions/examples/klaviyo-hubspot.definition.json +0 -336
  83. package/integrations/definitions/examples/phone-hubspot.definition.json +0 -633
  84. package/integrations/definitions/examples/pipedrive-hubspot.definition.json +0 -136
  85. package/integrations/definitions/examples/pipedrive-phone.definition.json +0 -340
  86. package/integrations/definitions/examples/records/phone-hubspot.definition-version.json +0 -652
  87. package/integrations/definitions/examples/records/phone-hubspot.integration.json +0 -86
  88. package/integrations/definitions/examples/records/phone-hubspot.mappings.json +0 -39
  89. package/integrations/definitions/examples/records/phone-hubspot.workflow-run.json +0 -62
  90. package/integrations/definitions/examples/shopify-klaviyo.definition.json +0 -488
  91. package/integrations/definitions/examples/shopify-netsuite.definition.json +0 -622
  92. package/integrations/definitions/examples/stripe-quickbooks.definition.json +0 -476
  93. package/integrations/definitions/examples/webflow-hubspot-slack.definition.json +0 -262
  94. package/integrations/definitions/examples/zendesk-jira.definition.json +0 -604
  95. package/integrations/definitions/expressions.js +0 -229
  96. package/integrations/definitions/index.js +0 -45
  97. package/integrations/definitions/integration-runtime.js +0 -763
  98. package/integrations/definitions/interpreter.js +0 -104
  99. package/integrations/definitions/manifests.js +0 -177
  100. package/integrations/definitions/renderers/common.js +0 -67
  101. package/integrations/definitions/renderers/html.js +0 -129
  102. package/integrations/definitions/renderers/hubspot.js +0 -59
  103. package/integrations/definitions/renderers/preview.js +0 -154
  104. package/integrations/definitions/renderers/slack.js +0 -146
  105. package/integrations/definitions/repositories/definition-version-repository.js +0 -67
  106. package/integrations/definitions/repositories/workflow-run-repository.js +0 -80
  107. package/integrations/definitions/router.js +0 -170
  108. package/integrations/definitions/runtime.js +0 -268
  109. package/integrations/definitions/schema/capability-manifest.v0.1.schema.json +0 -549
  110. package/integrations/definitions/schema/installation.v0.1.schema.json +0 -130
  111. package/integrations/definitions/schema/integration-definition.v0.1.schema.json +0 -909
  112. package/integrations/definitions/schema/records.md +0 -105
  113. package/integrations/definitions/schema-check.js +0 -58
  114. package/integrations/definitions/scripts/check-manifests.js +0 -220
  115. package/integrations/definitions/scripts/validate.js +0 -66
  116. package/integrations/definitions/steps.js +0 -123
  117. package/integrations/definitions/sync-engine.js +0 -297
  118. package/integrations/definitions/tests/helpers-fake-crm.js +0 -49
  119. package/integrations/definitions/transforms.js +0 -91
  120. package/integrations/definitions/use-cases/definition-use-cases.js +0 -245
  121. package/integrations/definitions/validate.js +0 -436
  122. package/integrations/definitions/versioning.js +0 -176
  123. package/integrations/definitions/webhooks.js +0 -119
  124. package/integrations/integration-types.js +0 -64
  125. package/integrations/triggers.js +0 -244
  126. package/integrations/use-cases/run-trigger-tick.js +0 -155
  127. package/integrations/use-cases/run-trigger.js +0 -77
  128. package/prisma-postgresql/migrations/20261018000000_add_data_defined_integrations/migration.sql +0 -66
  129. package/prisma-postgresql/migrations/20261019000000_workflow_run_waits/migration.sql +0 -7
  130. package/prisma-postgresql/migrations/20261019120000_definition_workspace/migration.sql +0 -5
@@ -1,86 +0,0 @@
1
- {
2
- "$comment": "Frigg Integration row (existing model). Only `config` is new in shape; everything else is what Frigg stores today.",
3
- "id": "int_7f3a9c",
4
- "userId": "usr_acme_admin",
5
- "status": "ENABLED",
6
- "version": "1.4.0",
7
- "entities": [
8
- {
9
- "id": "ent_phone_51",
10
- "moduleName": "phone",
11
- "externalId": "ws_9a1"
12
- },
13
- {
14
- "id": "ent_hs_88",
15
- "moduleName": "hubspot",
16
- "externalId": "12345678"
17
- }
18
- ],
19
- "config": {
20
- "definition": {
21
- "id": "phone-hubspot",
22
- "version": "1.4.0",
23
- "checksum": "sha256:386c69e18a51a7cf061634309eca3e8267c1a59629a388498eddaad9eb44be59"
24
- },
25
- "settings": {
26
- "fromNumber": "+15125550100"
27
- },
28
- "syncs": {
29
- "contacts": {
30
- "enabled": true
31
- }
32
- },
33
- "workflows": {
34
- "log-call": {
35
- "enabled": true
36
- },
37
- "call-summary": {
38
- "enabled": true
39
- },
40
- "missed-call-task": {
41
- "enabled": true,
42
- "settings": {
43
- "owner": "81273645",
44
- "dueIn": "2h"
45
- }
46
- },
47
- "texts-timeline": {
48
- "enabled": true
49
- },
50
- "won-thank-you": {
51
- "enabled": false
52
- },
53
- "stale-contacts": {
54
- "enabled": false
55
- },
56
- "text-from-card": {
57
- "enabled": true
58
- }
59
- },
60
- "ui": {
61
- "phone-card": {
62
- "enabled": true
63
- },
64
- "deals-panel": {
65
- "enabled": true
66
- }
67
- },
68
- "runtime": {
69
- "installed": {
70
- "hook": {
71
- "id": "WHk2c9",
72
- "url": "https://api.example.com/api/integration-runtime-integration/webhooks/int_7f3a9c?module=phone",
73
- "events": [
74
- "call.completed",
75
- "call.ringing",
76
- "call.summary.completed",
77
- "message.received",
78
- "contact.updated"
79
- ]
80
- }
81
- }
82
- }
83
- },
84
- "createdAt": "2026-09-02T15:20:00Z",
85
- "updatedAt": "2026-10-18T09:12:44Z"
86
- }
@@ -1,39 +0,0 @@
1
- {
2
- "$comment": "IntegrationMapping rows (existing table). link:* = the same record on both sides; idx:* = identity index (normalised email/phone); evt:* = an event already handled (insert-only, so a redelivery is a no-op).",
3
- "rows": [
4
- {
5
- "integrationId": "int_7f3a9c",
6
- "sourceId": "idx:contacts:phone:+15125550142",
7
- "mapping": {
8
- "hubspot": "51",
9
- "phone": "CT7",
10
- "linkedAt": "2026-09-02T15:31:10Z"
11
- }
12
- },
13
- {
14
- "integrationId": "int_7f3a9c",
15
- "sourceId": "link:contacts:hubspot:51",
16
- "mapping": {
17
- "hubspot": "51",
18
- "phone": "CT7",
19
- "linkedAt": "2026-09-02T15:31:10Z"
20
- }
21
- },
22
- {
23
- "integrationId": "int_7f3a9c",
24
- "sourceId": "link:contacts:phone:CT7",
25
- "mapping": {
26
- "hubspot": "51",
27
- "phone": "CT7",
28
- "linkedAt": "2026-09-02T15:31:10Z"
29
- }
30
- },
31
- {
32
- "integrationId": "int_7f3a9c",
33
- "sourceId": "evt:phone-hubspot:log-call:EVc0a1",
34
- "mapping": {
35
- "at": "2026-10-18T16:08:10.523Z"
36
- }
37
- }
38
- ]
39
- }
@@ -1,62 +0,0 @@
1
- {
2
- "$comment": "WorkflowRun row written by the runtime for one delivered Phone call.completed event. `outbound` is the captured HubSpot call (shown here for documentation; production stores a digest).",
3
- "id": "run_01JB8A0K",
4
- "integrationId": "int_7f3a9c",
5
- "definition": {
6
- "id": "phone-hubspot",
7
- "version": "1.4.0"
8
- },
9
- "workflowId": "log-call",
10
- "trigger": {
11
- "type": "webhook",
12
- "eventId": "EVc0a1"
13
- },
14
- "startedAt": "2026-10-18T14:07:13.037Z",
15
- "status": "completed",
16
- "endedAt": "2026-10-18T14:07:13.074Z",
17
- "trace": [
18
- {
19
- "id": "contact",
20
- "use": "links.find",
21
- "at": "steps[0]",
22
- "status": "ok",
23
- "ms": 0
24
- },
25
- {
26
- "id": "stop#1",
27
- "use": "stop",
28
- "at": "steps[1]",
29
- "status": "skipped"
30
- },
31
- {
32
- "id": "body",
33
- "use": "template",
34
- "at": "steps[2]",
35
- "status": "ok",
36
- "ms": 2
37
- },
38
- {
39
- "id": "engagement",
40
- "use": "hubspot.call.create",
41
- "at": "steps[3]",
42
- "status": "ok",
43
- "ms": 0
44
- }
45
- ],
46
- "outbound": [
47
- {
48
- "module": "hubspot",
49
- "method": "createCallEngagement",
50
- "args": {
51
- "contactId": "51",
52
- "properties": {
53
- "hs_call_title": "Phone call (incoming)",
54
- "hs_call_body": "Phone call with +15125550142 · 312s (completed)",
55
- "hs_call_duration": 312,
56
- "hs_call_direction": "INCOMING",
57
- "hs_timestamp": "2026-10-18T14:07:12Z"
58
- }
59
- }
60
- }
61
- ]
62
- }
@@ -1,488 +0,0 @@
1
- {
2
- "$schema": "https://friggframework.org/schemas/integration-definition/v0.1.json",
3
- "schemaVersion": "0.1",
4
- "id": "shopify-klaviyo",
5
- "version": "1.5.0",
6
- "display": {
7
- "label": "Shopify \u2192 Klaviyo",
8
- "description": "Customers become Klaviyo profiles, and orders, ordered products, abandoned checkouts and fulfillments become Klaviyo events for flows. The Shopify customer page shows the customer's Klaviyo lists.",
9
- "category": "Marketing",
10
- "tags": [
11
- "ecommerce",
12
- "email",
13
- "events"
14
- ]
15
- },
16
- "modules": {
17
- "shopify": {
18
- "module": "shopify",
19
- "version": "^3.1"
20
- },
21
- "klaviyo": {
22
- "module": "klaviyo",
23
- "version": "^1.1"
24
- }
25
- },
26
- "syncs": [
27
- {
28
- "id": "customers",
29
- "label": "Customers",
30
- "source": "shopify.customer",
31
- "target": "klaviyo.profile",
32
- "direction": "one_way",
33
- "identity": {
34
- "match": [
35
- {
36
- "source": "email",
37
- "target": "attributes.email",
38
- "transform": "lowercase",
39
- "key": "email"
40
- }
41
- ]
42
- },
43
- "mapping": [
44
- {
45
- "source": "email",
46
- "target": "attributes.email",
47
- "transform": "lowercase"
48
- },
49
- {
50
- "source": "first_name",
51
- "target": "attributes.first_name"
52
- },
53
- {
54
- "source": "last_name",
55
- "target": "attributes.last_name"
56
- },
57
- {
58
- "source": "phone",
59
- "target": "attributes.phone_number",
60
- "transform": "to_e164_phone"
61
- },
62
- {
63
- "source": "default_address.company",
64
- "target": "attributes.organization"
65
- },
66
- {
67
- "source": "default_address.city",
68
- "target": "attributes.location.city"
69
- },
70
- {
71
- "source": "default_address.province_code",
72
- "target": "attributes.location.region"
73
- },
74
- {
75
- "source": "default_address.country_code",
76
- "target": "attributes.location.country"
77
- },
78
- {
79
- "source": "default_address.zip",
80
- "target": "attributes.location.zip"
81
- },
82
- {
83
- "source": "total_spent",
84
- "target": "attributes.properties.lifetime_value",
85
- "transform": "number"
86
- },
87
- {
88
- "source": "tags",
89
- "target": "attributes.properties.shopify_tags"
90
- },
91
- {
92
- "source": "id",
93
- "target": "attributes.external_id"
94
- }
95
- ],
96
- "filter": "$.record.email exists",
97
- "backfill": {
98
- "trigger": "onInstall",
99
- "pageSize": 250
100
- },
101
- "ongoing": {
102
- "mode": "webhook"
103
- },
104
- "default": "on"
105
- }
106
- ],
107
- "workflows": [
108
- {
109
- "id": "placed-order",
110
- "label": "Placed Order and Ordered Product events",
111
- "description": "One \"Placed Order\" event per order and one \"Ordered Product\" per line item, the shape Klaviyo's ecommerce flows expect.",
112
- "purpose": "write",
113
- "default": "on",
114
- "trigger": {
115
- "type": "webhook",
116
- "module": "shopify",
117
- "topic": "order.created",
118
- "filter": "$.record.email exists"
119
- },
120
- "steps": [
121
- {
122
- "use": "klaviyo.event.create",
123
- "with": {
124
- "metric": "Placed Order",
125
- "profile": {
126
- "email": "$.record.email",
127
- "external_id": "{{record.customer.id}}"
128
- },
129
- "properties": {
130
- "OrderId": "$.record.id",
131
- "OrderNumber": "$.record.name",
132
- "Items": "$.record.line_items",
133
- "DiscountCodes": "$.record.discount_codes",
134
- "SourceName": "$.record.source_name",
135
- "ShippingCity": "$.record.shipping_address.city"
136
- },
137
- "value": "{{record.total_price | number}}",
138
- "time": "$.record.created_at",
139
- "uniqueId": "order-{{record.id}}"
140
- }
141
- },
142
- {
143
- "id": "products",
144
- "use": "foreach",
145
- "with": {
146
- "over": "$.record.line_items",
147
- "max": 100
148
- },
149
- "do": [
150
- {
151
- "id": "price",
152
- "use": "map",
153
- "with": {
154
- "record": "$.item",
155
- "mapping": [
156
- {
157
- "source": "price",
158
- "target": "value",
159
- "transform": "number"
160
- }
161
- ]
162
- }
163
- },
164
- {
165
- "use": "klaviyo.event.create",
166
- "with": {
167
- "metric": "Ordered Product",
168
- "profile": {
169
- "email": "$.record.email",
170
- "external_id": "{{record.customer.id}}"
171
- },
172
- "properties": {
173
- "OrderId": "$.record.id",
174
- "ProductID": "$.item.product_id",
175
- "SKU": "$.item.sku",
176
- "ProductName": "$.item.title",
177
- "VariantName": "$.item.variant_title",
178
- "Quantity": "$.item.quantity"
179
- },
180
- "value": "$.steps.price.value",
181
- "time": "$.record.created_at",
182
- "uniqueId": "order-{{record.id}}-line-{{item.id}}"
183
- }
184
- }
185
- ]
186
- }
187
- ]
188
- },
189
- {
190
- "id": "abandoned-checkout",
191
- "label": "Started Checkout events for abandoned checkouts",
192
- "purpose": "write",
193
- "default": "on",
194
- "trigger": {
195
- "type": "webhook",
196
- "module": "shopify",
197
- "topic": "checkout.abandoned",
198
- "filter": "$.record.email exists && !($.record.completed_at exists)"
199
- },
200
- "steps": [
201
- {
202
- "use": "klaviyo.event.create",
203
- "with": {
204
- "metric": "Started Checkout",
205
- "profile": {
206
- "email": "$.record.email",
207
- "external_id": "{{record.customer.id}}"
208
- },
209
- "properties": {
210
- "CheckoutURL": "$.record.abandoned_checkout_url",
211
- "Items": "$.record.line_items",
212
- "Currency": "$.record.currency"
213
- },
214
- "value": "{{record.total_price | number}}",
215
- "time": "$.record.created_at",
216
- "uniqueId": "checkout-{{record.token}}"
217
- }
218
- }
219
- ]
220
- },
221
- {
222
- "id": "fulfilled-order",
223
- "label": "Fulfilled Order events",
224
- "purpose": "write",
225
- "default": "on",
226
- "trigger": {
227
- "type": "webhook",
228
- "module": "shopify",
229
- "topic": "fulfillment.created"
230
- },
231
- "steps": [
232
- {
233
- "id": "order",
234
- "use": "shopify.order.get",
235
- "with": {
236
- "id": "$.record.order_id",
237
- "fields": "id,name,email,customer,total_price"
238
- }
239
- },
240
- {
241
- "use": "stop",
242
- "when": "!($.steps.order.email exists)",
243
- "with": {
244
- "reason": "Order has no email"
245
- }
246
- },
247
- {
248
- "use": "klaviyo.event.create",
249
- "with": {
250
- "metric": "Fulfilled Order",
251
- "profile": {
252
- "email": "$.steps.order.email",
253
- "external_id": "{{steps.order.customer.id}}"
254
- },
255
- "properties": {
256
- "OrderId": "$.steps.order.id",
257
- "OrderNumber": "$.steps.order.name",
258
- "TrackingCompany": "$.record.tracking_company",
259
- "TrackingNumber": "$.record.tracking_number",
260
- "TrackingUrl": "$.record.tracking_url"
261
- },
262
- "time": "$.record.created_at",
263
- "uniqueId": "fulfillment-{{record.id}}"
264
- }
265
- }
266
- ]
267
- },
268
- {
269
- "id": "add-to-list",
270
- "label": "Subscribe the customer to a Klaviyo list",
271
- "purpose": "respond",
272
- "default": "on",
273
- "settings": {
274
- "list": {
275
- "type": "option",
276
- "options": "klaviyo.list",
277
- "label": "List the button subscribes to",
278
- "required": true
279
- }
280
- },
281
- "trigger": {
282
- "type": "userAction",
283
- "label": "Subscribe to list",
284
- "from": "klaviyo-block"
285
- },
286
- "steps": [
287
- {
288
- "use": "stop",
289
- "when": "!($.record.email exists)",
290
- "with": {
291
- "reason": "Customer has no email"
292
- }
293
- },
294
- {
295
- "use": "klaviyo.profile.subscribe",
296
- "with": {
297
- "listId": "$.settings.list",
298
- "email": "$.record.email",
299
- "channels": [
300
- "email"
301
- ]
302
- }
303
- }
304
- ]
305
- }
306
- ],
307
- "queries": [
308
- {
309
- "id": "klaviyo-profile",
310
- "description": "The Klaviyo profile for this Shopify customer and the lists it is on.",
311
- "steps": [
312
- {
313
- "use": "stop",
314
- "when": "!($.record.email exists)",
315
- "with": {
316
- "reason": "Customer has no email"
317
- }
318
- },
319
- {
320
- "id": "profiles",
321
- "use": "klaviyo.profile.search",
322
- "with": {
323
- "email": "$.record.email"
324
- }
325
- },
326
- {
327
- "use": "stop",
328
- "when": "$.steps.profiles[0] == null",
329
- "with": {
330
- "reason": "No Klaviyo profile"
331
- }
332
- },
333
- {
334
- "id": "lists",
335
- "use": "klaviyo.profile.lists",
336
- "with": {
337
- "id": "$.steps.profiles[0].id"
338
- }
339
- }
340
- ],
341
- "returns": {
342
- "profile": "$.steps.profiles[0]",
343
- "lists": "$.steps.lists"
344
- }
345
- }
346
- ],
347
- "ui": [
348
- {
349
- "id": "klaviyo-block",
350
- "label": "Klaviyo",
351
- "host": "shopify",
352
- "placement": "admin.customer-details.block",
353
- "objects": [
354
- "customer"
355
- ],
356
- "data": {
357
- "query": "klaviyo-profile"
358
- },
359
- "view": {
360
- "component": "Stack",
361
- "children": [
362
- {
363
- "component": "Heading",
364
- "props": {
365
- "text": "Klaviyo"
366
- }
367
- },
368
- {
369
- "component": "Empty",
370
- "when": "!($.data.profile exists)",
371
- "props": {
372
- "text": "No Klaviyo profile for this customer yet."
373
- }
374
- },
375
- {
376
- "component": "KeyValue",
377
- "when": "$.data.profile exists",
378
- "props": {
379
- "items": [
380
- {
381
- "label": "Email consent",
382
- "value": "{{data.profile.attributes.subscriptions.email.marketing.consent | default: 'NEVER_SUBSCRIBED'}}"
383
- },
384
- {
385
- "label": "Lifetime value",
386
- "value": "{{data.profile.attributes.properties.lifetime_value | default: 0}}"
387
- }
388
- ]
389
- }
390
- },
391
- {
392
- "component": "List",
393
- "props": {
394
- "items": "$.data.lists",
395
- "title": "{{item.attributes.name}}",
396
- "meta": "since {{item.attributes.created | date}}"
397
- }
398
- },
399
- {
400
- "component": "Button",
401
- "props": {
402
- "label": "Subscribe to list",
403
- "action": {
404
- "type": "userAction",
405
- "workflow": "add-to-list"
406
- }
407
- }
408
- },
409
- {
410
- "component": "Button",
411
- "when": "$.data.profile exists",
412
- "props": {
413
- "label": "Open in Klaviyo",
414
- "action": {
415
- "type": "open_url",
416
- "url": "https://www.klaviyo.com/profile/{{data.profile.id}}"
417
- }
418
- }
419
- }
420
- ]
421
- }
422
- }
423
- ],
424
- "lifecycle": {
425
- "onInstall": [
426
- {
427
- "use": "shopify.webhook.create",
428
- "with": {
429
- "topic": "orders/create",
430
- "address": "$.install.webhookUrls.shopify",
431
- "format": "json"
432
- },
433
- "id": "hook-orders-create"
434
- },
435
- {
436
- "use": "shopify.webhook.create",
437
- "with": {
438
- "topic": "fulfillments/create",
439
- "address": "$.install.webhookUrls.shopify",
440
- "format": "json"
441
- },
442
- "id": "hook-fulfillments-create"
443
- },
444
- {
445
- "use": "shopify.webhook.create",
446
- "with": {
447
- "topic": "customers/create",
448
- "address": "$.install.webhookUrls.shopify",
449
- "format": "json"
450
- },
451
- "id": "hook-customers-create"
452
- },
453
- {
454
- "use": "shopify.webhook.create",
455
- "with": {
456
- "topic": "customers/update",
457
- "address": "$.install.webhookUrls.shopify",
458
- "format": "json"
459
- },
460
- "id": "hook-customers-update"
461
- }
462
- ],
463
- "onUninstall": [
464
- {
465
- "id": "unhook",
466
- "use": "foreach",
467
- "with": {
468
- "over": [
469
- "$.install.runtime.installed.hook-orders-create.id",
470
- "$.install.runtime.installed.hook-fulfillments-create.id",
471
- "$.install.runtime.installed.hook-customers-create.id",
472
- "$.install.runtime.installed.hook-customers-update.id"
473
- ],
474
- "max": 20
475
- },
476
- "do": [
477
- {
478
- "use": "shopify.webhook.delete",
479
- "with": {
480
- "id": "$.item"
481
- },
482
- "onError": "continue"
483
- }
484
- ]
485
- }
486
- ]
487
- }
488
- }