@proveanything/smartlinks 2.1.13 → 2.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/API_SUMMARY.md +97 -7
- package/dist/docs/connectors.md +42 -4
- package/dist/docs/entitlements.md +90 -0
- package/dist/docs/integrations.md +159 -9
- package/dist/docs/interactions.md +545 -540
- package/dist/docs/loyalty.md +17 -0
- package/dist/docs/server-functions.md +2 -0
- package/dist/openapi.yaml +192 -2
- package/dist/types/appManifest.d.ts +19 -1
- package/dist/types/integrations.d.ts +148 -3
- package/docs/API_SUMMARY.md +97 -7
- package/docs/connectors.md +42 -4
- package/docs/entitlements.md +90 -0
- package/docs/integrations.md +159 -9
- package/docs/interactions.md +545 -540
- package/docs/loyalty.md +17 -0
- package/docs/server-functions.md +2 -0
- package/openapi.yaml +192 -2
- package/package.json +87 -87
package/dist/docs/loyalty.md
CHANGED
|
@@ -302,6 +302,23 @@ A loyalty failure never causes the interaction event to fail — errors are caug
|
|
|
302
302
|
|
|
303
303
|
---
|
|
304
304
|
|
|
305
|
+
## External loyalty platforms
|
|
306
|
+
|
|
307
|
+
The schemes above are SmartLinks' own points. When a brand runs its programme on an external loyalty or
|
|
308
|
+
engagement platform, the platform stays the record of truth and SmartLinks connects to it through a
|
|
309
|
+
**connector app** and the integration engine — no member base is mirrored here:
|
|
310
|
+
|
|
311
|
+
| Flow | How |
|
|
312
|
+
|---|---|
|
|
313
|
+
| **Earn** — what happens on a pack or in a Hub awards points there | an outbound flow with `sourceEntity: 'interaction' \| 'event'`, an `eventMapping` onto the provider's registered events, signed delivery, retries — [integrations.md](integrations.md#event-sourced-flows-and-the-envelope) |
|
|
314
|
+
| **Profile** — member id, tier and points on the contact | the connector's webhook function calls `ctx.sl.members.apply(...)`; the contact gets `customFields.loyalty` and flat `loyaltyTier / loyaltyPoints / loyaltyMemberId`, usable in segments and comms targeting — [connectors.md](connectors.md#loyalty-and-crm-connectors) |
|
|
315
|
+
| **Gate / display** — "Gold members only", live balance | the entitlement check, answered on demand from a signed claim, the connector's cached `lookup`, or the contact's fields — [entitlements.md](entitlements.md) |
|
|
316
|
+
|
|
317
|
+
A collection runs one loyalty source: the native schemes here, or an external provider through a
|
|
318
|
+
connector.
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
305
322
|
## TypeScript Types
|
|
306
323
|
|
|
307
324
|
```typescript
|
|
@@ -517,6 +517,8 @@ Prefer the platform primitives above over a dependency; when you do need one, pi
|
|
|
517
517
|
| Check a tapped tag is real | `ctx.sl.tags.resolve(proofId)` → `{ id, claimSetId, code }` or `null` | `sl:tags:read` |
|
|
518
518
|
| Put a visitor's details on a contact | `ctx.sl.contacts.upsert({ email, firstName, … })` → `{ contactId, created }` (fills empty fields only) | `sl:contacts:write` |
|
|
519
519
|
| Record "they did X" | `ctx.sl.interactions.record({ interactionId, contactId, outcome, metadata })` | `sl:interactions:write` |
|
|
520
|
+
| Land a loyalty / CRM provider's view of a person (member id, tier, points, tags, external ids) | `ctx.sl.members.apply({ identity, contact?, loyalty?, tags?, externalIds? }, { provider })` → `{ contactId, op }` — matches by id, external id, email or phone; profile fields fill-empty only; see [connectors.md](connectors.md#loyalty-and-crm-connectors) | `sl:members:write` |
|
|
521
|
+
| Ask "is this person gold or above?" without holding their member record | `ctx.sl.entitlements.check('tier>=gold')` → `{ allowed, basis, asOf, attributes }` for the signed-in caller (or `{ identity, token, fallback }`); see [entitlements.md](entitlements.md) | `sl:entitlements:read` |
|
|
520
522
|
| Take a booking with your own checks (hours, queue token, payment) | `ctx.sl.bookings.create({ slotId \| resource + time, contactId, status, idempotencyKey })` — never oversold, never double-booked; also `confirm` / `cancel` / `move` / `mine` / `freebusy` / `message` (everyone booked, hydrated) / `slots.*` / `blocks.*` (see [bookings.md](bookings.md)) | `sl:bookings:write` (`sl:bookings:read` to read) |
|
|
521
523
|
|
|
522
524
|
Notes:
|
package/dist/openapi.yaml
CHANGED
|
@@ -21280,6 +21280,10 @@ components:
|
|
|
21280
21280
|
type: string
|
|
21281
21281
|
fetch:
|
|
21282
21282
|
type: string
|
|
21283
|
+
describeEvents:
|
|
21284
|
+
type: string
|
|
21285
|
+
lookup:
|
|
21286
|
+
type: string
|
|
21283
21287
|
panels:
|
|
21284
21288
|
type: array
|
|
21285
21289
|
items:
|
|
@@ -29014,9 +29018,48 @@ components:
|
|
|
29014
29018
|
additionalProperties: true
|
|
29015
29019
|
required:
|
|
29016
29020
|
- appId
|
|
29021
|
+
EventMappingRule:
|
|
29022
|
+
type: object
|
|
29023
|
+
properties:
|
|
29024
|
+
id:
|
|
29025
|
+
type: string
|
|
29026
|
+
match:
|
|
29027
|
+
type: object
|
|
29028
|
+
additionalProperties: true
|
|
29029
|
+
event:
|
|
29030
|
+
type: string
|
|
29031
|
+
attributes:
|
|
29032
|
+
type: object
|
|
29033
|
+
additionalProperties:
|
|
29034
|
+
type: object
|
|
29035
|
+
additionalProperties: true
|
|
29036
|
+
required:
|
|
29037
|
+
- event
|
|
29038
|
+
EventMapping:
|
|
29039
|
+
type: object
|
|
29040
|
+
properties:
|
|
29041
|
+
rules:
|
|
29042
|
+
type: array
|
|
29043
|
+
items:
|
|
29044
|
+
$ref: "#/components/schemas/EventMappingRule"
|
|
29045
|
+
unmatched:
|
|
29046
|
+
type: string
|
|
29047
|
+
enum:
|
|
29048
|
+
- skip
|
|
29049
|
+
- passthrough
|
|
29050
|
+
required:
|
|
29051
|
+
- rules
|
|
29017
29052
|
IntegrationFlowConfig:
|
|
29018
29053
|
type: object
|
|
29019
29054
|
properties:
|
|
29055
|
+
signing:
|
|
29056
|
+
type: object
|
|
29057
|
+
additionalProperties: true
|
|
29058
|
+
identity:
|
|
29059
|
+
type: object
|
|
29060
|
+
additionalProperties: true
|
|
29061
|
+
eventMapping:
|
|
29062
|
+
$ref: "#/components/schemas/EventMapping"
|
|
29020
29063
|
connection:
|
|
29021
29064
|
$ref: "#/components/schemas/FlowConnection"
|
|
29022
29065
|
fieldMappings:
|
|
@@ -29049,9 +29092,11 @@ components:
|
|
|
29049
29092
|
schedule:
|
|
29050
29093
|
type: string
|
|
29051
29094
|
sourceEntity:
|
|
29052
|
-
type:
|
|
29095
|
+
type: object
|
|
29096
|
+
additionalProperties: true
|
|
29053
29097
|
targetEntity:
|
|
29054
|
-
type:
|
|
29098
|
+
type: object
|
|
29099
|
+
additionalProperties: true
|
|
29055
29100
|
config:
|
|
29056
29101
|
$ref: "#/components/schemas/IntegrationFlowConfig"
|
|
29057
29102
|
createdBy:
|
|
@@ -29424,6 +29469,131 @@ components:
|
|
|
29424
29469
|
settings:
|
|
29425
29470
|
type: object
|
|
29426
29471
|
additionalProperties: true
|
|
29472
|
+
ConnectorEventsSchema:
|
|
29473
|
+
type: object
|
|
29474
|
+
properties:
|
|
29475
|
+
events:
|
|
29476
|
+
type: array
|
|
29477
|
+
items:
|
|
29478
|
+
type: object
|
|
29479
|
+
additionalProperties: true
|
|
29480
|
+
limits:
|
|
29481
|
+
type: object
|
|
29482
|
+
additionalProperties: true
|
|
29483
|
+
required:
|
|
29484
|
+
- events
|
|
29485
|
+
ConnectorLookupInput:
|
|
29486
|
+
type: object
|
|
29487
|
+
properties:
|
|
29488
|
+
installation:
|
|
29489
|
+
$ref: "#/components/schemas/ConnectorInstallation"
|
|
29490
|
+
identity:
|
|
29491
|
+
type: object
|
|
29492
|
+
additionalProperties: true
|
|
29493
|
+
want:
|
|
29494
|
+
type: array
|
|
29495
|
+
items:
|
|
29496
|
+
type: string
|
|
29497
|
+
required:
|
|
29498
|
+
- installation
|
|
29499
|
+
- identity
|
|
29500
|
+
ConnectorLookupResult:
|
|
29501
|
+
type: object
|
|
29502
|
+
properties:
|
|
29503
|
+
found:
|
|
29504
|
+
type: boolean
|
|
29505
|
+
memberId:
|
|
29506
|
+
type: string
|
|
29507
|
+
tier:
|
|
29508
|
+
type: string
|
|
29509
|
+
points:
|
|
29510
|
+
type: number
|
|
29511
|
+
status:
|
|
29512
|
+
type: string
|
|
29513
|
+
attributes:
|
|
29514
|
+
type: object
|
|
29515
|
+
additionalProperties: true
|
|
29516
|
+
asOf:
|
|
29517
|
+
type: string
|
|
29518
|
+
required:
|
|
29519
|
+
- found
|
|
29520
|
+
EventEnvelope:
|
|
29521
|
+
type: object
|
|
29522
|
+
properties:
|
|
29523
|
+
id:
|
|
29524
|
+
type: string
|
|
29525
|
+
type:
|
|
29526
|
+
type: string
|
|
29527
|
+
entityType:
|
|
29528
|
+
type: string
|
|
29529
|
+
entityId:
|
|
29530
|
+
type: string
|
|
29531
|
+
occurredAt:
|
|
29532
|
+
type: string
|
|
29533
|
+
collectionId:
|
|
29534
|
+
type: string
|
|
29535
|
+
orgId:
|
|
29536
|
+
type: string
|
|
29537
|
+
appId:
|
|
29538
|
+
type: string
|
|
29539
|
+
identity:
|
|
29540
|
+
type: object
|
|
29541
|
+
additionalProperties: true
|
|
29542
|
+
contactId:
|
|
29543
|
+
type: string
|
|
29544
|
+
userId:
|
|
29545
|
+
type: string
|
|
29546
|
+
externalIds:
|
|
29547
|
+
type: object
|
|
29548
|
+
additionalProperties:
|
|
29549
|
+
type: string
|
|
29550
|
+
emailHash:
|
|
29551
|
+
type: string
|
|
29552
|
+
phoneHash:
|
|
29553
|
+
type: string
|
|
29554
|
+
hashAlgorithm:
|
|
29555
|
+
type: string
|
|
29556
|
+
enum:
|
|
29557
|
+
- hmac-sha256
|
|
29558
|
+
email:
|
|
29559
|
+
type: string
|
|
29560
|
+
phone:
|
|
29561
|
+
type: string
|
|
29562
|
+
identityPolicy:
|
|
29563
|
+
$ref: "#/components/schemas/IdentityPolicy"
|
|
29564
|
+
product:
|
|
29565
|
+
type: object
|
|
29566
|
+
additionalProperties: true
|
|
29567
|
+
proof:
|
|
29568
|
+
type: object
|
|
29569
|
+
additionalProperties: true
|
|
29570
|
+
subject:
|
|
29571
|
+
type: object
|
|
29572
|
+
additionalProperties: true
|
|
29573
|
+
event:
|
|
29574
|
+
type: object
|
|
29575
|
+
additionalProperties: true
|
|
29576
|
+
attributes:
|
|
29577
|
+
type: object
|
|
29578
|
+
additionalProperties: true
|
|
29579
|
+
required:
|
|
29580
|
+
- id
|
|
29581
|
+
- type
|
|
29582
|
+
- entityType
|
|
29583
|
+
- entityId
|
|
29584
|
+
- occurredAt
|
|
29585
|
+
- collectionId
|
|
29586
|
+
- orgId
|
|
29587
|
+
- appId
|
|
29588
|
+
- identity
|
|
29589
|
+
- contactId
|
|
29590
|
+
- userId
|
|
29591
|
+
- externalIds
|
|
29592
|
+
- identityPolicy
|
|
29593
|
+
- product
|
|
29594
|
+
- proof
|
|
29595
|
+
- subject
|
|
29596
|
+
- attributes
|
|
29427
29597
|
CapturedRequest:
|
|
29428
29598
|
type: object
|
|
29429
29599
|
properties:
|
|
@@ -29763,6 +29933,24 @@ components:
|
|
|
29763
29933
|
- webhook
|
|
29764
29934
|
- oauth2
|
|
29765
29935
|
- none
|
|
29936
|
+
IdentityPolicy:
|
|
29937
|
+
type: string
|
|
29938
|
+
enum:
|
|
29939
|
+
- externalIds
|
|
29940
|
+
- hashed
|
|
29941
|
+
- raw
|
|
29942
|
+
FlowSourceEntity:
|
|
29943
|
+
type: string
|
|
29944
|
+
enum:
|
|
29945
|
+
- product
|
|
29946
|
+
- interaction
|
|
29947
|
+
- contact
|
|
29948
|
+
- event
|
|
29949
|
+
FlowTargetEntity:
|
|
29950
|
+
type: string
|
|
29951
|
+
enum:
|
|
29952
|
+
- product
|
|
29953
|
+
- contact
|
|
29766
29954
|
UpdateFlowInput:
|
|
29767
29955
|
$ref: "#/components/schemas/CreateFlowInput"
|
|
29768
29956
|
ConnectorConsoleStep:
|
|
@@ -29773,6 +29961,8 @@ components:
|
|
|
29773
29961
|
- sample
|
|
29774
29962
|
- shape
|
|
29775
29963
|
- serialize
|
|
29964
|
+
- describeEvents
|
|
29965
|
+
- lookup
|
|
29776
29966
|
RunTrigger:
|
|
29777
29967
|
type: string
|
|
29778
29968
|
enum:
|
|
@@ -1078,6 +1078,18 @@ export interface AppConnectorDeclaration {
|
|
|
1078
1078
|
send?: string;
|
|
1079
1079
|
/** (ConnectorFetchInput) → ConnectorRecords: inbound pull, one page per call. */
|
|
1080
1080
|
fetch?: string;
|
|
1081
|
+
/**
|
|
1082
|
+
* Loyalty / engagement providers: → ConnectorEventsSchema, the event names (and attributes) the
|
|
1083
|
+
* provider has registered for this installation. A flow's eventMapping is validated against it when
|
|
1084
|
+
* saved, so a mapping that names an unregistered event or breaks a limit is refused with the reason.
|
|
1085
|
+
*/
|
|
1086
|
+
describeEvents?: string;
|
|
1087
|
+
/**
|
|
1088
|
+
* (ConnectorLookupInput) → ConnectorLookupResult: one identity → member id, tier, points, status.
|
|
1089
|
+
* Called by the entitlement check (see docs/entitlements.md) through a cache keyed on an identity
|
|
1090
|
+
* hash, for the TTL the collection sets — one call per active person per TTL, never a sync.
|
|
1091
|
+
*/
|
|
1092
|
+
lookup?: string;
|
|
1081
1093
|
};
|
|
1082
1094
|
panels?: ConnectorPanel[];
|
|
1083
1095
|
/** Path (under the app's public files) of a guide the AI mapping assistant reads. */
|
|
@@ -1088,9 +1100,15 @@ export interface AppConnectorDeclaration {
|
|
|
1088
1100
|
* Default 'id'; a flow can override it with `config.upsert.externalIdPath`.
|
|
1089
1101
|
*/
|
|
1090
1102
|
recordId?: string;
|
|
1091
|
-
/**
|
|
1103
|
+
/**
|
|
1104
|
+
* Requests per second toward the provider, shared by every SmartLinks worker; and, for providers that
|
|
1105
|
+
* cap registered events, how many distinct events / attributes per event they accept (a flow's
|
|
1106
|
+
* eventMapping is checked against them when saved).
|
|
1107
|
+
*/
|
|
1092
1108
|
limits?: {
|
|
1093
1109
|
requestsPerSecond?: number;
|
|
1110
|
+
maxEvents?: number;
|
|
1111
|
+
maxAttributes?: number;
|
|
1094
1112
|
};
|
|
1095
1113
|
}
|
|
1096
1114
|
/**
|
|
@@ -38,7 +38,60 @@ export interface FlowConnectorRef {
|
|
|
38
38
|
/** Per-flow settings, layered over the installation's. */
|
|
39
39
|
settings?: Record<string, unknown>;
|
|
40
40
|
}
|
|
41
|
+
import type { ConnectorInstallation } from './appManifest.js';
|
|
42
|
+
/** What about a person an event-sourced flow lets leave. Default 'hashed'. */
|
|
43
|
+
export type IdentityPolicy = 'externalIds' | 'hashed' | 'raw';
|
|
44
|
+
/**
|
|
45
|
+
* Many SmartLinks events → the provider's few registered event names. Rules are tried in order; the
|
|
46
|
+
* first match names the provider event and renders its attributes (a literal, a Liquid template over
|
|
47
|
+
* the envelope, or `{ path, default }`). An unmatched event is skipped (recorded as such) unless
|
|
48
|
+
* `unmatched: 'passthrough'`. Validated against the connector's `describeEvents` when the flow is saved.
|
|
49
|
+
*/
|
|
50
|
+
export interface EventMappingRule {
|
|
51
|
+
id?: string;
|
|
52
|
+
match?: {
|
|
53
|
+
types?: string[];
|
|
54
|
+
interactionIds?: string[];
|
|
55
|
+
outcomes?: string[];
|
|
56
|
+
appIds?: string[];
|
|
57
|
+
};
|
|
58
|
+
/** The provider's registered event name. */
|
|
59
|
+
event: string;
|
|
60
|
+
attributes?: Record<string, string | number | boolean | {
|
|
61
|
+
path: string;
|
|
62
|
+
default?: unknown;
|
|
63
|
+
} | {
|
|
64
|
+
value: unknown;
|
|
65
|
+
}>;
|
|
66
|
+
}
|
|
67
|
+
export interface EventMapping {
|
|
68
|
+
rules: EventMappingRule[];
|
|
69
|
+
unmatched?: 'skip' | 'passthrough';
|
|
70
|
+
}
|
|
71
|
+
/** What an outbound flow reads: the product that changed, or ONE spine event as the envelope. */
|
|
72
|
+
export type FlowSourceEntity = 'product' | 'interaction' | 'contact' | 'event';
|
|
73
|
+
/** What an inbound flow writes. */
|
|
74
|
+
export type FlowTargetEntity = 'product' | 'contact';
|
|
41
75
|
export interface IntegrationFlowConfig {
|
|
76
|
+
/**
|
|
77
|
+
* Signed deliveries: X-SmartLinks-Signature `t=<unix>,v1=<hex HMAC-SHA256(secret, t + '.' + body)>`
|
|
78
|
+
* over the exact bytes sent. `previousCredentialRef` keeps the old secret signing during a rotation.
|
|
79
|
+
*/
|
|
80
|
+
signing?: {
|
|
81
|
+
credentialRef: string;
|
|
82
|
+
previousCredentialRef?: string;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Event-sourced flows: what about the person leaves (default 'hashed': ids + HMAC hashes of email and
|
|
86
|
+
* phone, never the values). `hashKeyCredentialRef` names the brand's own hash key, so hashes match a
|
|
87
|
+
* mirror they built; otherwise a per-collection platform key is used.
|
|
88
|
+
*/
|
|
89
|
+
identity?: {
|
|
90
|
+
policy?: IdentityPolicy;
|
|
91
|
+
hashKeyCredentialRef?: string;
|
|
92
|
+
};
|
|
93
|
+
/** Event-sourced flows: fold SmartLinks events into the provider's registered events. */
|
|
94
|
+
eventMapping?: EventMapping;
|
|
42
95
|
connection?: FlowConnection;
|
|
43
96
|
fieldMappings?: FieldMapping[];
|
|
44
97
|
/** Run this flow through a connector app's functions instead of the built-in mapper/transport. */
|
|
@@ -57,8 +110,10 @@ export interface IntegrationFlow {
|
|
|
57
110
|
eventTypes: string[];
|
|
58
111
|
/** Cron/interval string for scheduled flows, or null. */
|
|
59
112
|
schedule: string | null;
|
|
60
|
-
|
|
61
|
-
|
|
113
|
+
/** Outbound: what the flow reads (product | interaction | contact | event). */
|
|
114
|
+
sourceEntity: FlowSourceEntity | string | null;
|
|
115
|
+
/** Inbound: what the flow writes (product | contact). */
|
|
116
|
+
targetEntity: FlowTargetEntity | string | null;
|
|
62
117
|
config: IntegrationFlowConfig;
|
|
63
118
|
createdBy: string | null;
|
|
64
119
|
createdAt: string;
|
|
@@ -267,7 +322,97 @@ export interface SaveConnectorInstallationInput {
|
|
|
267
322
|
settings?: Record<string, unknown>;
|
|
268
323
|
}
|
|
269
324
|
/** Steps the console may run directly (send and fetch only run inside a flow; shape/serialize as dry runs). */
|
|
270
|
-
export type ConnectorConsoleStep = 'testConnection' | 'describeTarget' | 'sample' | 'shape' | 'serialize';
|
|
325
|
+
export type ConnectorConsoleStep = 'testConnection' | 'describeTarget' | 'sample' | 'shape' | 'serialize' | 'describeEvents' | 'lookup';
|
|
326
|
+
/** `describeEvents` → what the provider has registered for this installation (loyalty / engagement). */
|
|
327
|
+
export interface ConnectorEventsSchema {
|
|
328
|
+
events: Array<{
|
|
329
|
+
name: string;
|
|
330
|
+
title?: string;
|
|
331
|
+
attributes?: Array<{
|
|
332
|
+
name: string;
|
|
333
|
+
type?: string;
|
|
334
|
+
required?: boolean;
|
|
335
|
+
}>;
|
|
336
|
+
}>;
|
|
337
|
+
limits?: {
|
|
338
|
+
maxEvents?: number;
|
|
339
|
+
maxAttributes?: number;
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
/** `lookup` input: one identity, as the collection's lookup policy sends it (raw, or hashed). */
|
|
343
|
+
export interface ConnectorLookupInput {
|
|
344
|
+
installation: ConnectorInstallation;
|
|
345
|
+
identity: {
|
|
346
|
+
externalId?: string | null;
|
|
347
|
+
email?: string | null;
|
|
348
|
+
phone?: string | null;
|
|
349
|
+
emailHash?: string | null;
|
|
350
|
+
phoneHash?: string | null;
|
|
351
|
+
contactId?: string | null;
|
|
352
|
+
};
|
|
353
|
+
/** Attribute names the gate wants, e.g. ['tier', 'points', 'status']. */
|
|
354
|
+
want?: string[];
|
|
355
|
+
}
|
|
356
|
+
/** `lookup` result. Throw (or return non-2xx) for an outage — never `found: false`. */
|
|
357
|
+
export interface ConnectorLookupResult {
|
|
358
|
+
found: boolean;
|
|
359
|
+
memberId?: string | null;
|
|
360
|
+
tier?: string | null;
|
|
361
|
+
points?: number | null;
|
|
362
|
+
status?: string | null;
|
|
363
|
+
attributes?: Record<string, unknown>;
|
|
364
|
+
/** When the provider's answer is from (ISO). */
|
|
365
|
+
asOf?: string | null;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* The one shape a SmartLinks event has when it leaves the platform — what event-sourced flows hand a
|
|
369
|
+
* connector's `serialize` / `send`, after the flow's identity policy and event mapping.
|
|
370
|
+
*/
|
|
371
|
+
export interface EventEnvelope {
|
|
372
|
+
/** The event's id: stable across retries; use it as the provider's transaction / idempotency id. */
|
|
373
|
+
id: string;
|
|
374
|
+
/** Spine event name, e.g. 'interaction.submitted:<typeId>', 'contact.updated', 'tag.scanned:scan_redirect'. */
|
|
375
|
+
type: string;
|
|
376
|
+
entityType: string | null;
|
|
377
|
+
entityId: string | null;
|
|
378
|
+
occurredAt: string;
|
|
379
|
+
collectionId: string;
|
|
380
|
+
orgId: string;
|
|
381
|
+
appId: string | null;
|
|
382
|
+
identity: {
|
|
383
|
+
contactId: string | null;
|
|
384
|
+
userId: string | null;
|
|
385
|
+
/** Ids other systems know this person by, keyed by system (a connector's `provider`). */
|
|
386
|
+
externalIds: Record<string, string>;
|
|
387
|
+
emailHash?: string | null;
|
|
388
|
+
phoneHash?: string | null;
|
|
389
|
+
hashAlgorithm?: 'hmac-sha256' | null;
|
|
390
|
+
/** Only under identity policy 'raw'. */
|
|
391
|
+
email?: string | null;
|
|
392
|
+
phone?: string | null;
|
|
393
|
+
};
|
|
394
|
+
identityPolicy: IdentityPolicy;
|
|
395
|
+
product: {
|
|
396
|
+
id: string;
|
|
397
|
+
name?: string | null;
|
|
398
|
+
sku?: string | null;
|
|
399
|
+
gtin?: string | null;
|
|
400
|
+
variantId?: string | null;
|
|
401
|
+
batchId?: string | null;
|
|
402
|
+
} | null;
|
|
403
|
+
proof: {
|
|
404
|
+
id: string;
|
|
405
|
+
} | null;
|
|
406
|
+
/** The event's own fields: an interaction's interactionId / outcome / metadata, a scan's codeId / country, a contact's profile. */
|
|
407
|
+
subject: Record<string, unknown>;
|
|
408
|
+
/** From the flow's event mapping, when it has one. */
|
|
409
|
+
event?: {
|
|
410
|
+
name: string;
|
|
411
|
+
attributes: Record<string, unknown>;
|
|
412
|
+
rule: string | null;
|
|
413
|
+
};
|
|
414
|
+
attributes: Record<string, unknown>;
|
|
415
|
+
}
|
|
271
416
|
export type RunTrigger = 'manual' | 'event' | 'schedule' | 'test';
|
|
272
417
|
export type FlowRunStatus = 'running' | 'success' | 'partial' | 'failed' | 'skipped';
|
|
273
418
|
export type FlowRunItemStatus = 'sent' | 'failed' | 'skipped';
|
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.14 | Generated: 2026-11-09T13:01:05.900Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -64,8 +64,9 @@ For detailed guides on specific features:
|
|
|
64
64
|
- **[Analytics](analytics.md)** - Web analytics, link-click tracking, QR/tag scan telemetry, and event reporting
|
|
65
65
|
- **[Analytics Metadata Conventions](analytics-metadata-conventions.md)** - Standard recommended keys and conventions for analytics metadata fields
|
|
66
66
|
- **[Loyalty: Points, Members & Earning Rules](loyalty.md)** - Loyalty schemes, automatic point earning via interaction rules, member balances, transaction history, and manual adjustments
|
|
67
|
-
- **[Integrations](integrations.md)** - Inbound/outbound integration flows + the sealed-secret store; triggers (manual/event/schedule),
|
|
68
|
-
- **[Connectors](connectors.md)** - Connector apps (adapters for one external provider): a manifest `connector` block + server functions (testConnection/describeTarget/sample/fetch/shape/serialize/send); core does the mapping
|
|
67
|
+
- **[Integrations](integrations.md)** - Inbound/outbound integration flows + the sealed-secret store; triggers (manual/event/schedule), event patterns, the event envelope (interaction/contact/event sources), identity policy, event mapping, signed deliveries, contact as a target, field mappings
|
|
68
|
+
- **[Connectors](connectors.md)** - Connector apps (adapters for one external provider): a manifest `connector` block + server functions (testConnection/describeTarget/sample/fetch/shape/serialize/send/describeEvents/lookup); loyalty and CRM connectors; core does the mapping
|
|
69
|
+
- **[Entitlements](entitlements.md)** - "Is this person gold or above?" answered on demand from signed claims, a connector lookup (cached), or the contact — never a mirrored member base; gates on interaction types and in server functions
|
|
69
70
|
- **[AI Tools & Skills](ai-tools-and-skills.md)** - The AI capability catalog: skills apps invoke by name (e.g. research.brand), the tools the AI reaches for (web fetch/screenshot/brand assets/image gen), the agent loop, and how apps discover them
|
|
70
71
|
- **[Deep Link Discovery](deep-link-discovery.md)** - Registering and discovering navigable app states for portal menus and AI orchestration
|
|
71
72
|
- **[AI Guide Template](ai-guide-template.md)** - A sample for an app on how to build an AI setup guide
|
|
@@ -3129,11 +3130,13 @@ interface AppConnectorDeclaration {
|
|
|
3129
3130
|
serialize?: string
|
|
3130
3131
|
send?: string
|
|
3131
3132
|
fetch?: string
|
|
3133
|
+
describeEvents?: string
|
|
3134
|
+
lookup?: string
|
|
3132
3135
|
}
|
|
3133
3136
|
panels?: ConnectorPanel[]
|
|
3134
3137
|
aiGuide?: string
|
|
3135
3138
|
recordId?: string
|
|
3136
|
-
limits?: { requestsPerSecond?: number }
|
|
3139
|
+
limits?: { requestsPerSecond?: number; maxEvents?: number; maxAttributes?: number }
|
|
3137
3140
|
}
|
|
3138
3141
|
```
|
|
3139
3142
|
|
|
@@ -7953,9 +7956,30 @@ interface FlowConnectorRef {
|
|
|
7953
7956
|
}
|
|
7954
7957
|
```
|
|
7955
7958
|
|
|
7959
|
+
**EventMappingRule** (interface)
|
|
7960
|
+
```typescript
|
|
7961
|
+
interface EventMappingRule {
|
|
7962
|
+
id?: string
|
|
7963
|
+
match?: { types?: string[]; interactionIds?: string[]; outcomes?: string[]; appIds?: string[] }
|
|
7964
|
+
event: string
|
|
7965
|
+
attributes?: Record<string, string | number | boolean | { path: string; default?: unknown } | { value: unknown }>
|
|
7966
|
+
}
|
|
7967
|
+
```
|
|
7968
|
+
|
|
7969
|
+
**EventMapping** (interface)
|
|
7970
|
+
```typescript
|
|
7971
|
+
interface EventMapping {
|
|
7972
|
+
rules: EventMappingRule[]
|
|
7973
|
+
unmatched?: 'skip' | 'passthrough'
|
|
7974
|
+
}
|
|
7975
|
+
```
|
|
7976
|
+
|
|
7956
7977
|
**IntegrationFlowConfig** (interface)
|
|
7957
7978
|
```typescript
|
|
7958
7979
|
interface IntegrationFlowConfig {
|
|
7980
|
+
signing?: { credentialRef: string; previousCredentialRef?: string }
|
|
7981
|
+
identity?: { policy?: IdentityPolicy; hashKeyCredentialRef?: string }
|
|
7982
|
+
eventMapping?: EventMapping
|
|
7959
7983
|
connection?: FlowConnection
|
|
7960
7984
|
fieldMappings?: FieldMapping[]
|
|
7961
7985
|
connector?: FlowConnectorRef
|
|
@@ -7975,8 +7999,8 @@ interface IntegrationFlow {
|
|
|
7975
7999
|
status: FlowStatus
|
|
7976
8000
|
eventTypes: string[]
|
|
7977
8001
|
schedule: string | null
|
|
7978
|
-
sourceEntity: string | null
|
|
7979
|
-
targetEntity: string | null
|
|
8002
|
+
sourceEntity: FlowSourceEntity | string | null
|
|
8003
|
+
targetEntity: FlowTargetEntity | string | null
|
|
7980
8004
|
config: IntegrationFlowConfig
|
|
7981
8005
|
createdBy: string | null
|
|
7982
8006
|
createdAt: string
|
|
@@ -8165,6 +8189,66 @@ interface SaveConnectorInstallationInput {
|
|
|
8165
8189
|
}
|
|
8166
8190
|
```
|
|
8167
8191
|
|
|
8192
|
+
**ConnectorEventsSchema** (interface)
|
|
8193
|
+
```typescript
|
|
8194
|
+
interface ConnectorEventsSchema {
|
|
8195
|
+
events: Array<{ name: string; title?: string; attributes?: Array<{ name: string; type?: string; required?: boolean }> }>
|
|
8196
|
+
limits?: { maxEvents?: number; maxAttributes?: number }
|
|
8197
|
+
}
|
|
8198
|
+
```
|
|
8199
|
+
|
|
8200
|
+
**ConnectorLookupInput** (interface)
|
|
8201
|
+
```typescript
|
|
8202
|
+
interface ConnectorLookupInput {
|
|
8203
|
+
installation: ConnectorInstallation
|
|
8204
|
+
identity: { externalId?: string | null; email?: string | null; phone?: string | null; emailHash?: string | null; phoneHash?: string | null; contactId?: string | null }
|
|
8205
|
+
want?: string[]
|
|
8206
|
+
}
|
|
8207
|
+
```
|
|
8208
|
+
|
|
8209
|
+
**ConnectorLookupResult** (interface)
|
|
8210
|
+
```typescript
|
|
8211
|
+
interface ConnectorLookupResult {
|
|
8212
|
+
found: boolean
|
|
8213
|
+
memberId?: string | null
|
|
8214
|
+
tier?: string | null
|
|
8215
|
+
points?: number | null
|
|
8216
|
+
status?: string | null
|
|
8217
|
+
attributes?: Record<string, unknown>
|
|
8218
|
+
asOf?: string | null
|
|
8219
|
+
}
|
|
8220
|
+
```
|
|
8221
|
+
|
|
8222
|
+
**EventEnvelope** (interface)
|
|
8223
|
+
```typescript
|
|
8224
|
+
interface EventEnvelope {
|
|
8225
|
+
id: string
|
|
8226
|
+
type: string
|
|
8227
|
+
entityType: string | null
|
|
8228
|
+
entityId: string | null
|
|
8229
|
+
occurredAt: string
|
|
8230
|
+
collectionId: string
|
|
8231
|
+
orgId: string
|
|
8232
|
+
appId: string | null
|
|
8233
|
+
identity: {
|
|
8234
|
+
contactId: string | null
|
|
8235
|
+
userId: string | null
|
|
8236
|
+
externalIds: Record<string, string>
|
|
8237
|
+
emailHash?: string | null
|
|
8238
|
+
phoneHash?: string | null
|
|
8239
|
+
hashAlgorithm?: 'hmac-sha256' | null
|
|
8240
|
+
email?: string | null
|
|
8241
|
+
phone?: string | null
|
|
8242
|
+
}
|
|
8243
|
+
identityPolicy: IdentityPolicy
|
|
8244
|
+
product: { id: string; name?: string | null; sku?: string | null; gtin?: string | null; variantId?: string | null; batchId?: string | null } | null
|
|
8245
|
+
proof: { id: string } | null
|
|
8246
|
+
subject: Record<string, unknown>
|
|
8247
|
+
event?: { name: string; attributes: Record<string, unknown>; rule: string | null }
|
|
8248
|
+
attributes: Record<string, unknown>
|
|
8249
|
+
}
|
|
8250
|
+
```
|
|
8251
|
+
|
|
8168
8252
|
**CapturedRequest** (interface)
|
|
8169
8253
|
```typescript
|
|
8170
8254
|
interface CapturedRequest {
|
|
@@ -8367,9 +8451,15 @@ interface RecordTypesResponse {
|
|
|
8367
8451
|
|
|
8368
8452
|
**FlowAuthMethod** = `'api_key' | 'bearer' | 'basic' | 'webhook' | 'oauth2' | 'none'`
|
|
8369
8453
|
|
|
8454
|
+
**IdentityPolicy** = `'externalIds' | 'hashed' | 'raw'`
|
|
8455
|
+
|
|
8456
|
+
**FlowSourceEntity** = `'product' | 'interaction' | 'contact' | 'event'`
|
|
8457
|
+
|
|
8458
|
+
**FlowTargetEntity** = `'product' | 'contact'`
|
|
8459
|
+
|
|
8370
8460
|
**UpdateFlowInput** = `Partial<Omit<CreateFlowInput, 'direction'>> & {`
|
|
8371
8461
|
|
|
8372
|
-
**ConnectorConsoleStep** = `'testConnection' | 'describeTarget' | 'sample' | 'shape' | 'serialize'`
|
|
8462
|
+
**ConnectorConsoleStep** = `'testConnection' | 'describeTarget' | 'sample' | 'shape' | 'serialize' | 'describeEvents' | 'lookup'`
|
|
8373
8463
|
|
|
8374
8464
|
**RunTrigger** = `'manual' | 'event' | 'schedule' | 'test'`
|
|
8375
8465
|
|