@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/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
|
package/docs/server-functions.md
CHANGED
|
@@ -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/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:
|
package/package.json
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@proveanything/smartlinks",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"import": "./dist/index.js",
|
|
12
|
-
"default": "./dist/index.js"
|
|
13
|
-
},
|
|
14
|
-
"./testing": {
|
|
15
|
-
"types": "./dist/testing/index.d.ts",
|
|
16
|
-
"import": "./dist/testing/index.js",
|
|
17
|
-
"default": "./dist/testing/index.js"
|
|
18
|
-
},
|
|
19
|
-
"./*": {
|
|
20
|
-
"types": "./dist/*.d.ts",
|
|
21
|
-
"import": "./dist/*.js",
|
|
22
|
-
"default": "./dist/*.js"
|
|
23
|
-
},
|
|
24
|
-
"./baseline.css": "./dist/baseline.css",
|
|
25
|
-
"./baseline.classes.json": "./dist/baseline.classes.json",
|
|
26
|
-
"./theme.css": "./dist/theme.css",
|
|
27
|
-
"./theme-boot.js": "./dist/theme-boot.js",
|
|
28
|
-
"./package.json": "./package.json"
|
|
29
|
-
},
|
|
30
|
-
"bin": {
|
|
31
|
-
"smartlinks-register-release": "scripts/register-release.mjs",
|
|
32
|
-
"smartlinks-publish": "scripts/publish.mjs",
|
|
33
|
-
"smartlinks-doctor": "scripts/doctor.mjs",
|
|
34
|
-
"smartlinks-headless": "scripts/headless-check.mjs"
|
|
35
|
-
},
|
|
36
|
-
"files": [
|
|
37
|
-
"dist/",
|
|
38
|
-
"docs/",
|
|
39
|
-
"scripts/register-release.mjs",
|
|
40
|
-
"scripts/publish.mjs",
|
|
41
|
-
"scripts/doctor.mjs",
|
|
42
|
-
"scripts/headless-check.mjs",
|
|
43
|
-
"scripts/lib/",
|
|
44
|
-
"openapi.yaml",
|
|
45
|
-
"README.md"
|
|
46
|
-
],
|
|
47
|
-
"scripts": {
|
|
48
|
-
"test": "node test/run.cjs",
|
|
49
|
-
"build": "tsc && node scripts/fix-esm-extensions.mjs && node generate-api-summary.cjs && node generate-openapi.cjs && node scripts/copy-docs-to-dist.cjs && node scripts/build-baseline.mjs",
|
|
50
|
-
"docs": "typedoc",
|
|
51
|
-
"docs:summary": "node generate-api-summary.cjs",
|
|
52
|
-
"docs:openapi": "node generate-openapi.cjs",
|
|
53
|
-
"docs:openapi:lint": "npx --yes @redocly/cli@latest lint openapi.yaml",
|
|
54
|
-
"docs:openapi:check": "node generate-openapi.cjs && npx --yes @redocly/cli@latest lint openapi.yaml",
|
|
55
|
-
"build:docs": "tsc build-docs.ts --outDir dist && node dist/build-docs.js",
|
|
56
|
-
"prepublishOnly": "npm run build"
|
|
57
|
-
},
|
|
58
|
-
"keywords": [
|
|
59
|
-
"smartlinks",
|
|
60
|
-
"api",
|
|
61
|
-
"authentication",
|
|
62
|
-
"traceability",
|
|
63
|
-
"blockchain",
|
|
64
|
-
"typescript",
|
|
65
|
-
"sdk"
|
|
66
|
-
],
|
|
67
|
-
"author": "Glenn Shoosmith",
|
|
68
|
-
"license": "MIT",
|
|
69
|
-
"publishConfig": {
|
|
70
|
-
"access": "public"
|
|
71
|
-
},
|
|
72
|
-
"dependencies": {
|
|
73
|
-
"cross-fetch": "^3.1.5",
|
|
74
|
-
"es-module-lexer": "^1.7.0"
|
|
75
|
-
},
|
|
76
|
-
"devDependencies": {
|
|
77
|
-
"ts-node": "^10.9.1",
|
|
78
|
-
"typedoc": "^0.25.13",
|
|
79
|
-
"typedoc-plugin-markdown": "^3.17.1",
|
|
80
|
-
"typescript": "^4.9.0"
|
|
81
|
-
},
|
|
82
|
-
"repository": {
|
|
83
|
-
"type": "git",
|
|
84
|
-
"url": "https://github.com/Prove-Anything/smartlinks.git"
|
|
85
|
-
},
|
|
86
|
-
"homepage": "https://smartlinks.app"
|
|
87
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@proveanything/smartlinks",
|
|
3
|
+
"version": "2.1.14",
|
|
4
|
+
"description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./testing": {
|
|
15
|
+
"types": "./dist/testing/index.d.ts",
|
|
16
|
+
"import": "./dist/testing/index.js",
|
|
17
|
+
"default": "./dist/testing/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./*": {
|
|
20
|
+
"types": "./dist/*.d.ts",
|
|
21
|
+
"import": "./dist/*.js",
|
|
22
|
+
"default": "./dist/*.js"
|
|
23
|
+
},
|
|
24
|
+
"./baseline.css": "./dist/baseline.css",
|
|
25
|
+
"./baseline.classes.json": "./dist/baseline.classes.json",
|
|
26
|
+
"./theme.css": "./dist/theme.css",
|
|
27
|
+
"./theme-boot.js": "./dist/theme-boot.js",
|
|
28
|
+
"./package.json": "./package.json"
|
|
29
|
+
},
|
|
30
|
+
"bin": {
|
|
31
|
+
"smartlinks-register-release": "scripts/register-release.mjs",
|
|
32
|
+
"smartlinks-publish": "scripts/publish.mjs",
|
|
33
|
+
"smartlinks-doctor": "scripts/doctor.mjs",
|
|
34
|
+
"smartlinks-headless": "scripts/headless-check.mjs"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist/",
|
|
38
|
+
"docs/",
|
|
39
|
+
"scripts/register-release.mjs",
|
|
40
|
+
"scripts/publish.mjs",
|
|
41
|
+
"scripts/doctor.mjs",
|
|
42
|
+
"scripts/headless-check.mjs",
|
|
43
|
+
"scripts/lib/",
|
|
44
|
+
"openapi.yaml",
|
|
45
|
+
"README.md"
|
|
46
|
+
],
|
|
47
|
+
"scripts": {
|
|
48
|
+
"test": "node test/run.cjs",
|
|
49
|
+
"build": "tsc && node scripts/fix-esm-extensions.mjs && node generate-api-summary.cjs && node generate-openapi.cjs && node scripts/copy-docs-to-dist.cjs && node scripts/build-baseline.mjs",
|
|
50
|
+
"docs": "typedoc",
|
|
51
|
+
"docs:summary": "node generate-api-summary.cjs",
|
|
52
|
+
"docs:openapi": "node generate-openapi.cjs",
|
|
53
|
+
"docs:openapi:lint": "npx --yes @redocly/cli@latest lint openapi.yaml",
|
|
54
|
+
"docs:openapi:check": "node generate-openapi.cjs && npx --yes @redocly/cli@latest lint openapi.yaml",
|
|
55
|
+
"build:docs": "tsc build-docs.ts --outDir dist && node dist/build-docs.js",
|
|
56
|
+
"prepublishOnly": "npm run build"
|
|
57
|
+
},
|
|
58
|
+
"keywords": [
|
|
59
|
+
"smartlinks",
|
|
60
|
+
"api",
|
|
61
|
+
"authentication",
|
|
62
|
+
"traceability",
|
|
63
|
+
"blockchain",
|
|
64
|
+
"typescript",
|
|
65
|
+
"sdk"
|
|
66
|
+
],
|
|
67
|
+
"author": "Glenn Shoosmith",
|
|
68
|
+
"license": "MIT",
|
|
69
|
+
"publishConfig": {
|
|
70
|
+
"access": "public"
|
|
71
|
+
},
|
|
72
|
+
"dependencies": {
|
|
73
|
+
"cross-fetch": "^3.1.5",
|
|
74
|
+
"es-module-lexer": "^1.7.0"
|
|
75
|
+
},
|
|
76
|
+
"devDependencies": {
|
|
77
|
+
"ts-node": "^10.9.1",
|
|
78
|
+
"typedoc": "^0.25.13",
|
|
79
|
+
"typedoc-plugin-markdown": "^3.17.1",
|
|
80
|
+
"typescript": "^4.9.0"
|
|
81
|
+
},
|
|
82
|
+
"repository": {
|
|
83
|
+
"type": "git",
|
|
84
|
+
"url": "https://github.com/Prove-Anything/smartlinks.git"
|
|
85
|
+
},
|
|
86
|
+
"homepage": "https://smartlinks.app"
|
|
87
|
+
}
|