@proveanything/smartlinks 2.1.12 → 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/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/openapi.yaml CHANGED
@@ -9641,6 +9641,38 @@ paths:
9641
9641
  description: Unauthorized
9642
9642
  404:
9643
9643
  description: Not found
9644
+ /authkit/{clientId}/auth/microsoft:
9645
+ post:
9646
+ tags:
9647
+ - authKit
9648
+ summary: authKit.microsoftLogin
9649
+ operationId: authKit_microsoftLogin
9650
+ security: []
9651
+ parameters:
9652
+ - name: clientId
9653
+ in: path
9654
+ required: true
9655
+ schema:
9656
+ type: string
9657
+ responses:
9658
+ 200:
9659
+ description: Success
9660
+ content:
9661
+ application/json:
9662
+ schema:
9663
+ $ref: "#/components/schemas/AuthLoginResponse"
9664
+ 400:
9665
+ description: Bad request
9666
+ 401:
9667
+ description: Unauthorized
9668
+ 404:
9669
+ description: Not found
9670
+ requestBody:
9671
+ required: true
9672
+ content:
9673
+ application/json:
9674
+ schema:
9675
+ $ref: "#/components/schemas/MicrosoftLoginOptions"
9644
9676
  /authkit/{clientId}/auth/phone/send-code:
9645
9677
  post:
9646
9678
  tags:
@@ -21248,6 +21280,10 @@ components:
21248
21280
  type: string
21249
21281
  fetch:
21250
21282
  type: string
21283
+ describeEvents:
21284
+ type: string
21285
+ lookup:
21286
+ type: string
21251
21287
  panels:
21252
21288
  type: array
21253
21289
  items:
@@ -23933,6 +23969,35 @@ components:
23933
23969
  additionalProperties: true
23934
23970
  required:
23935
23971
  - success
23972
+ MicrosoftLoginOptions:
23973
+ type: object
23974
+ properties:
23975
+ returnOrigin:
23976
+ type: string
23977
+ trustedDeviceToken:
23978
+ type: string
23979
+ AuthKitAccess:
23980
+ type: object
23981
+ properties:
23982
+ mode:
23983
+ type: string
23984
+ enum:
23985
+ - anyone
23986
+ - organisation
23987
+ domains:
23988
+ type: array
23989
+ items:
23990
+ type: string
23991
+ emails:
23992
+ type: array
23993
+ items:
23994
+ type: string
23995
+ microsoftTenants:
23996
+ type: object
23997
+ additionalProperties:
23998
+ type: string
23999
+ required:
24000
+ - mode
23936
24001
  AppleLoginOptions:
23937
24002
  type: object
23938
24003
  properties:
@@ -24449,6 +24514,10 @@ components:
24449
24514
  enum:
24450
24515
  - open
24451
24516
  - invite
24517
+ access:
24518
+ $ref: "#/components/schemas/AuthKitAccess"
24519
+ microsoftClientId:
24520
+ type: string
24452
24521
  required:
24453
24522
  - id
24454
24523
  AuthKitInviteRequest:
@@ -24581,6 +24650,7 @@ components:
24581
24650
  - ACCOUNT_EXISTS_UNVERIFIED
24582
24651
  - APPLE_AUTH_FAILED
24583
24652
  - SIGN_UP_CLOSED
24653
+ - NOT_IN_ORGANISATION
24584
24654
  MfaFactor:
24585
24655
  type: string
24586
24656
  enum:
@@ -28948,9 +29018,48 @@ components:
28948
29018
  additionalProperties: true
28949
29019
  required:
28950
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
28951
29052
  IntegrationFlowConfig:
28952
29053
  type: object
28953
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"
28954
29063
  connection:
28955
29064
  $ref: "#/components/schemas/FlowConnection"
28956
29065
  fieldMappings:
@@ -28983,9 +29092,11 @@ components:
28983
29092
  schedule:
28984
29093
  type: string
28985
29094
  sourceEntity:
28986
- type: string
29095
+ type: object
29096
+ additionalProperties: true
28987
29097
  targetEntity:
28988
- type: string
29098
+ type: object
29099
+ additionalProperties: true
28989
29100
  config:
28990
29101
  $ref: "#/components/schemas/IntegrationFlowConfig"
28991
29102
  createdBy:
@@ -29358,6 +29469,131 @@ components:
29358
29469
  settings:
29359
29470
  type: object
29360
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
29361
29597
  CapturedRequest:
29362
29598
  type: object
29363
29599
  properties:
@@ -29697,6 +29933,24 @@ components:
29697
29933
  - webhook
29698
29934
  - oauth2
29699
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
29700
29954
  UpdateFlowInput:
29701
29955
  $ref: "#/components/schemas/CreateFlowInput"
29702
29956
  ConnectorConsoleStep:
@@ -29707,6 +29961,8 @@ components:
29707
29961
  - sample
29708
29962
  - shape
29709
29963
  - serialize
29964
+ - describeEvents
29965
+ - lookup
29710
29966
  RunTrigger:
29711
29967
  type: string
29712
29968
  enum:
package/package.json CHANGED
@@ -1,87 +1,87 @@
1
- {
2
- "name": "@proveanything/smartlinks",
3
- "version": "2.1.12",
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
+ }