@cognior/iap-sdk 0.1.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.

Potentially problematic release.


This version of @cognior/iap-sdk might be problematic. Click here for more details.

Files changed (60) hide show
  1. package/.github/copilot-instructions.md +95 -0
  2. package/README.md +79 -0
  3. package/TRACKING.md +105 -0
  4. package/USER_CONTEXT_README.md +284 -0
  5. package/package.json +154 -0
  6. package/src/config.ts +25 -0
  7. package/src/core/flowEngine.ts +1833 -0
  8. package/src/core/triggerManager.ts +1011 -0
  9. package/src/experiences/banner.ts +366 -0
  10. package/src/experiences/beacon.ts +668 -0
  11. package/src/experiences/hotspotTour.ts +654 -0
  12. package/src/experiences/hotspots.ts +566 -0
  13. package/src/experiences/modal.ts +1337 -0
  14. package/src/experiences/modalSequence.ts +1247 -0
  15. package/src/experiences/popover.ts +652 -0
  16. package/src/experiences/registry.ts +21 -0
  17. package/src/experiences/survey.ts +1639 -0
  18. package/src/experiences/taskList.ts +625 -0
  19. package/src/experiences/tooltip.ts +740 -0
  20. package/src/experiences/types.ts +395 -0
  21. package/src/experiences/walkthrough.ts +670 -0
  22. package/src/flow-sequence.ts +177 -0
  23. package/src/flows.ts +512 -0
  24. package/src/http.ts +61 -0
  25. package/src/index.ts +355 -0
  26. package/src/services/flowManager.ts +905 -0
  27. package/src/services/flowNormalizer.ts +74 -0
  28. package/src/services/locationContextService.ts +189 -0
  29. package/src/services/pageContextService.ts +221 -0
  30. package/src/services/userContextService.ts +286 -0
  31. package/src/state/appState.ts +0 -0
  32. package/src/state/hooks.ts +0 -0
  33. package/src/state/index.ts +0 -0
  34. package/src/state/migration.ts +0 -0
  35. package/src/state/store.ts +0 -0
  36. package/src/styles/banner.css.ts +0 -0
  37. package/src/styles/hotspot.css.ts +0 -0
  38. package/src/styles/hotspotTour.css.ts +0 -0
  39. package/src/styles/modal.css.ts +564 -0
  40. package/src/styles/survey.css.ts +1013 -0
  41. package/src/styles/taskList.css.ts +0 -0
  42. package/src/styles/tooltip.css.ts +149 -0
  43. package/src/styles/walkthrough.css.ts +0 -0
  44. package/src/tourUtils.ts +0 -0
  45. package/src/tracking.ts +223 -0
  46. package/src/utils/debounce.ts +66 -0
  47. package/src/utils/eventSequenceValidator.ts +124 -0
  48. package/src/utils/flowTrackingSystem.ts +524 -0
  49. package/src/utils/idGenerator.ts +155 -0
  50. package/src/utils/immediateValidationPrevention.ts +184 -0
  51. package/src/utils/normalize.ts +50 -0
  52. package/src/utils/privacyManager.ts +166 -0
  53. package/src/utils/ruleEvaluator.ts +199 -0
  54. package/src/utils/sanitize.ts +79 -0
  55. package/src/utils/selectors.ts +107 -0
  56. package/src/utils/stepExecutor.ts +345 -0
  57. package/src/utils/triggerNormalizer.ts +149 -0
  58. package/src/utils/validationInterceptor.ts +650 -0
  59. package/tsconfig.json +13 -0
  60. package/tsup.config.ts +13 -0
package/package.json ADDED
@@ -0,0 +1,154 @@
1
+ {
2
+ "name": "@cognior/iap-sdk",
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "scripts": {
7
+ "build": "tsup",
8
+ "dev": "tsup --watch",
9
+ "serve": "npx http-server public -c-1 -p 5173"
10
+ },
11
+ "devDependencies": {
12
+ "http-server": "^14.1.1",
13
+ "tsup": "^8.2.4",
14
+ "typescript": "^5.6.2"
15
+ },
16
+ "description": "Cognior Intelligent Adoption platform SDK for end user experience integration",
17
+ "main": "index.js",
18
+ "dependencies": {
19
+ "acorn": "^8.15.0",
20
+ "ansi-regex": "^6.2.0",
21
+ "ansi-styles": "^6.2.1",
22
+ "any-promise": "^1.3.0",
23
+ "async": "^3.2.6",
24
+ "balanced-match": "^1.0.2",
25
+ "basic-auth": "^2.0.1",
26
+ "brace-expansion": "^2.0.2",
27
+ "bundle-require": "^5.1.0",
28
+ "cac": "^6.7.14",
29
+ "call-bind-apply-helpers": "^1.0.2",
30
+ "call-bound": "^1.0.4",
31
+ "chalk": "^4.1.2",
32
+ "chokidar": "^4.0.3",
33
+ "color-convert": "^2.0.1",
34
+ "color-name": "^1.1.4",
35
+ "commander": "^4.1.1",
36
+ "confbox": "^0.1.8",
37
+ "consola": "^3.4.2",
38
+ "corser": "^2.0.1",
39
+ "cross-spawn": "^7.0.6",
40
+ "debug": "^4.4.1",
41
+ "dunder-proto": "^1.0.1",
42
+ "eastasianwidth": "^0.2.0",
43
+ "emoji-regex": "^9.2.2",
44
+ "es-define-property": "^1.0.1",
45
+ "es-errors": "^1.3.0",
46
+ "es-object-atoms": "^1.1.1",
47
+ "esbuild": "^0.25.9",
48
+ "eventemitter3": "^4.0.7",
49
+ "fdir": "^6.5.0",
50
+ "fix-dts-default-cjs-exports": "^1.0.1",
51
+ "follow-redirects": "^1.15.11",
52
+ "foreground-child": "^3.3.1",
53
+ "function-bind": "^1.1.2",
54
+ "get-intrinsic": "^1.3.0",
55
+ "get-proto": "^1.0.1",
56
+ "glob": "^10.4.5",
57
+ "gopd": "^1.2.0",
58
+ "has-flag": "^4.0.0",
59
+ "has-symbols": "^1.1.0",
60
+ "hasown": "^2.0.2",
61
+ "he": "^1.2.0",
62
+ "html-encoding-sniffer": "^3.0.0",
63
+ "http-proxy": "^1.18.1",
64
+ "iconv-lite": "^0.6.3",
65
+ "is-fullwidth-code-point": "^3.0.0",
66
+ "isexe": "^2.0.0",
67
+ "jackspeak": "^3.4.3",
68
+ "joycon": "^3.1.1",
69
+ "lilconfig": "^3.1.3",
70
+ "lines-and-columns": "^1.2.4",
71
+ "load-tsconfig": "^0.2.5",
72
+ "lodash.sortby": "^4.7.0",
73
+ "lru-cache": "^10.4.3",
74
+ "magic-string": "^0.30.18",
75
+ "math-intrinsics": "^1.1.0",
76
+ "mime": "^1.6.0",
77
+ "minimatch": "^9.0.5",
78
+ "minimist": "^1.2.8",
79
+ "minipass": "^7.1.2",
80
+ "mlly": "^1.8.0",
81
+ "ms": "^2.1.3",
82
+ "mz": "^2.7.0",
83
+ "object-assign": "^4.1.1",
84
+ "object-inspect": "^1.13.4",
85
+ "opener": "^1.5.2",
86
+ "package-json-from-dist": "^1.0.1",
87
+ "path-key": "^3.1.1",
88
+ "path-scurry": "^1.11.1",
89
+ "pathe": "^2.0.3",
90
+ "picocolors": "^1.1.1",
91
+ "picomatch": "^4.0.3",
92
+ "pirates": "^4.0.7",
93
+ "pkg-types": "^1.3.1",
94
+ "portfinder": "^1.0.37",
95
+ "postcss-load-config": "^6.0.1",
96
+ "punycode": "^2.3.1",
97
+ "qs": "^6.14.0",
98
+ "readdirp": "^4.1.2",
99
+ "requires-port": "^1.0.0",
100
+ "resolve-from": "^5.0.0",
101
+ "rollup": "^4.49.0",
102
+ "safe-buffer": "^5.1.2",
103
+ "safer-buffer": "^2.1.2",
104
+ "secure-compare": "^3.0.1",
105
+ "shebang-command": "^2.0.0",
106
+ "shebang-regex": "^3.0.0",
107
+ "side-channel": "^1.1.0",
108
+ "side-channel-list": "^1.0.0",
109
+ "side-channel-map": "^1.0.1",
110
+ "side-channel-weakmap": "^1.0.2",
111
+ "signal-exit": "^4.1.0",
112
+ "source-map": "^0.8.0-beta.0",
113
+ "string-width": "^5.1.2",
114
+ "string-width-cjs": "^4.2.3",
115
+ "strip-ansi": "^7.1.0",
116
+ "strip-ansi-cjs": "^6.0.1",
117
+ "sucrase": "^3.35.0",
118
+ "supports-color": "^7.2.0",
119
+ "thenify": "^3.3.1",
120
+ "thenify-all": "^1.6.0",
121
+ "tinyexec": "^0.3.2",
122
+ "tinyglobby": "^0.2.14",
123
+ "tr46": "^1.0.1",
124
+ "tree-kill": "^1.2.2",
125
+ "ts-interface-checker": "^0.1.13",
126
+ "ufo": "^1.6.1",
127
+ "union": "^0.5.0",
128
+ "url-join": "^4.0.1",
129
+ "webidl-conversions": "^4.0.2",
130
+ "whatwg-encoding": "^2.0.0",
131
+ "whatwg-url": "^7.1.0",
132
+ "which": "^2.0.2",
133
+ "wrap-ansi": "^8.1.0",
134
+ "wrap-ansi-cjs": "^7.0.0"
135
+ },
136
+ "repository": {
137
+ "type": "git",
138
+ "url": "git+https://github.com/CogniorAI/WebUserModule.git"
139
+ },
140
+ "keywords": [
141
+ "Cognior",
142
+ "IAP",
143
+ "Intelligent",
144
+ "Adoption",
145
+ "Platform",
146
+ "SDK"
147
+ ],
148
+ "author": "Cognior",
149
+ "license": "UNLICENSED",
150
+ "bugs": {
151
+ "url": "https://github.com/CogniorAI/WebUserModule/issues"
152
+ },
153
+ "homepage": "https://github.com/CogniorAI/WebUserModule#readme"
154
+ }
package/src/config.ts ADDED
@@ -0,0 +1,25 @@
1
+ export interface DapConfig {
2
+ organizationid: string;
3
+ siteid: string;
4
+ apikey: string;
5
+ apiurl: string;
6
+ enableDraggableModals?: boolean; // Optional global setting to enable draggable behavior
7
+ }
8
+
9
+ export async function loadConfig(url: string, { debug = false } = {}): Promise<DapConfig> {
10
+ const res = await fetch(url, { credentials: "omit" });
11
+ if (!res.ok) throw new Error("Config load failed: " + res.status);
12
+ const json = await res.json();
13
+ validateConfig(json);
14
+ if (debug) console.log("[DAP] config", { ...json, apikey: "•••redacted•••" });
15
+ return json as DapConfig;
16
+ }
17
+
18
+ function validateConfig(j: any) {
19
+ const fields = ["organizationid", "siteid", "apikey", "apiurl"];
20
+ for (const f of fields) {
21
+ if (!j || typeof j[f] !== "string" || j[f].trim() === "") {
22
+ throw new Error(`Config missing/invalid "${f}"`);
23
+ }
24
+ }
25
+ }