@syntrologie/adapt-gamification 2.1.0 → 2.2.0-canary.10
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/cdn.d.ts +1 -1
- package/dist/cdn.js +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/schema.d.ts +117 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +34 -1
- package/dist/types.d.ts +1 -14
- package/dist/types.d.ts.map +1 -1
- package/package.json +15 -6
package/dist/cdn.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare const manifest: {
|
|
|
16
16
|
runtime: {
|
|
17
17
|
actions: {
|
|
18
18
|
kind: "gamification:awardBadge" | "gamification:addPoints";
|
|
19
|
-
executor: import("
|
|
19
|
+
executor: import("packages/sdk-contracts/dist").ActionExecutor<import("./runtime").AwardBadgeAction> | import("packages/sdk-contracts/dist").ActionExecutor<import("./runtime").AddPointsAction>;
|
|
20
20
|
}[];
|
|
21
21
|
events: {
|
|
22
22
|
names: string[];
|
package/dist/cdn.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* SynOS app registry when loaded dynamically via the AppLoader.
|
|
6
6
|
*/
|
|
7
7
|
import { editor } from './editor';
|
|
8
|
-
import {
|
|
8
|
+
import { eventHandlers, executors, runtime } from './runtime';
|
|
9
9
|
/**
|
|
10
10
|
* App manifest for registry registration.
|
|
11
11
|
* Follows the AppManifest interface expected by AppLoader/AppRegistry.
|
package/dist/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,SAAS,CAAC;AAM9D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,yBAAyB,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,wBAAwB,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAMD;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAAC,gBAAgB,CAiB9D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,eAAe,CAkB5D,CAAC;AAMF;;GAEG;AACH,eAAO,MAAM,mBAAmB;;sBAEZ,OAAO,QAAQ,OAAO;CAKzC,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;EAGZ,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,aAAa;;sBAvBN,OAAO,QAAQ,OAAO;GAuBQ,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;0BA5BA,OAAO,QAAQ,OAAO;;CAmCzC,CAAC"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -4,6 +4,43 @@
|
|
|
4
4
|
* Zod schema for validating gamification app configuration.
|
|
5
5
|
*/
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
+
/**
|
|
8
|
+
* Badge definition schema.
|
|
9
|
+
*/
|
|
10
|
+
export declare const badgeSchema: z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
icon: z.ZodString;
|
|
14
|
+
description: z.ZodOptional<z.ZodString>;
|
|
15
|
+
trigger: z.ZodObject<{
|
|
16
|
+
event: z.ZodString;
|
|
17
|
+
conditions: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
event: string;
|
|
20
|
+
conditions?: unknown[] | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
event: string;
|
|
23
|
+
conditions?: unknown[] | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
icon: string;
|
|
29
|
+
trigger: {
|
|
30
|
+
event: string;
|
|
31
|
+
conditions?: unknown[] | undefined;
|
|
32
|
+
};
|
|
33
|
+
description?: string | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
icon: string;
|
|
38
|
+
trigger: {
|
|
39
|
+
event: string;
|
|
40
|
+
conditions?: unknown[] | undefined;
|
|
41
|
+
};
|
|
42
|
+
description?: string | undefined;
|
|
43
|
+
}>;
|
|
7
44
|
/**
|
|
8
45
|
* Gamification app config schema.
|
|
9
46
|
*/
|
|
@@ -102,4 +139,84 @@ export declare const configSchema: z.ZodObject<{
|
|
|
102
139
|
} | undefined;
|
|
103
140
|
}>;
|
|
104
141
|
export type GamificationConfig = z.infer<typeof configSchema>;
|
|
142
|
+
/**
|
|
143
|
+
* Schema for awarding a badge to a user.
|
|
144
|
+
*/
|
|
145
|
+
export declare const AwardBadgeSchema: z.ZodObject<{
|
|
146
|
+
kind: z.ZodLiteral<"gamification:awardBadge">;
|
|
147
|
+
badgeId: z.ZodString;
|
|
148
|
+
anchorId: z.ZodOptional<z.ZodString>;
|
|
149
|
+
label: z.ZodOptional<z.ZodString>;
|
|
150
|
+
}, "strip", z.ZodTypeAny, {
|
|
151
|
+
badgeId: string;
|
|
152
|
+
kind: "gamification:awardBadge";
|
|
153
|
+
anchorId?: string | undefined;
|
|
154
|
+
label?: string | undefined;
|
|
155
|
+
}, {
|
|
156
|
+
badgeId: string;
|
|
157
|
+
kind: "gamification:awardBadge";
|
|
158
|
+
anchorId?: string | undefined;
|
|
159
|
+
label?: string | undefined;
|
|
160
|
+
}>;
|
|
161
|
+
/**
|
|
162
|
+
* Schema for adding points to a user's score.
|
|
163
|
+
*/
|
|
164
|
+
export declare const AddPointsSchema: z.ZodObject<{
|
|
165
|
+
kind: z.ZodLiteral<"gamification:addPoints">;
|
|
166
|
+
points: z.ZodNumber;
|
|
167
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
168
|
+
label: z.ZodOptional<z.ZodString>;
|
|
169
|
+
}, "strip", z.ZodTypeAny, {
|
|
170
|
+
points: number;
|
|
171
|
+
kind: "gamification:addPoints";
|
|
172
|
+
reason?: string | undefined;
|
|
173
|
+
label?: string | undefined;
|
|
174
|
+
}, {
|
|
175
|
+
points: number;
|
|
176
|
+
kind: "gamification:addPoints";
|
|
177
|
+
reason?: string | undefined;
|
|
178
|
+
label?: string | undefined;
|
|
179
|
+
}>;
|
|
180
|
+
/**
|
|
181
|
+
* Action step schemas for unified JSON Schema generation.
|
|
182
|
+
* The build script reads this array to merge adaptive actions into the
|
|
183
|
+
* unified canvas-config.schema.json.
|
|
184
|
+
*/
|
|
185
|
+
export declare const actionStepSchemas: ({
|
|
186
|
+
defName: string;
|
|
187
|
+
schema: z.ZodObject<{
|
|
188
|
+
kind: z.ZodLiteral<"gamification:awardBadge">;
|
|
189
|
+
badgeId: z.ZodString;
|
|
190
|
+
anchorId: z.ZodOptional<z.ZodString>;
|
|
191
|
+
label: z.ZodOptional<z.ZodString>;
|
|
192
|
+
}, "strip", z.ZodTypeAny, {
|
|
193
|
+
badgeId: string;
|
|
194
|
+
kind: "gamification:awardBadge";
|
|
195
|
+
anchorId?: string | undefined;
|
|
196
|
+
label?: string | undefined;
|
|
197
|
+
}, {
|
|
198
|
+
badgeId: string;
|
|
199
|
+
kind: "gamification:awardBadge";
|
|
200
|
+
anchorId?: string | undefined;
|
|
201
|
+
label?: string | undefined;
|
|
202
|
+
}>;
|
|
203
|
+
} | {
|
|
204
|
+
defName: string;
|
|
205
|
+
schema: z.ZodObject<{
|
|
206
|
+
kind: z.ZodLiteral<"gamification:addPoints">;
|
|
207
|
+
points: z.ZodNumber;
|
|
208
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
209
|
+
label: z.ZodOptional<z.ZodString>;
|
|
210
|
+
}, "strip", z.ZodTypeAny, {
|
|
211
|
+
points: number;
|
|
212
|
+
kind: "gamification:addPoints";
|
|
213
|
+
reason?: string | undefined;
|
|
214
|
+
label?: string | undefined;
|
|
215
|
+
}, {
|
|
216
|
+
points: number;
|
|
217
|
+
kind: "gamification:addPoints";
|
|
218
|
+
reason?: string | undefined;
|
|
219
|
+
label?: string | undefined;
|
|
220
|
+
}>;
|
|
221
|
+
})[];
|
|
105
222
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAStB,CAAC;AAUH;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASvB,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAM9D;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;EAK3B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;EAK1B,CAAC;AAMH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAG7B,CAAC"}
|
package/dist/schema.js
CHANGED
|
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
|
|
7
7
|
/**
|
|
8
8
|
* Badge definition schema.
|
|
9
9
|
*/
|
|
10
|
-
const badgeSchema = z.object({
|
|
10
|
+
export const badgeSchema = z.object({
|
|
11
11
|
id: z.string(),
|
|
12
12
|
name: z.string(),
|
|
13
13
|
icon: z.string(),
|
|
@@ -37,3 +37,36 @@ export const configSchema = z.object({
|
|
|
37
37
|
})
|
|
38
38
|
.optional(),
|
|
39
39
|
});
|
|
40
|
+
// ============================================================================
|
|
41
|
+
// Executor Action Schemas
|
|
42
|
+
// ============================================================================
|
|
43
|
+
/**
|
|
44
|
+
* Schema for awarding a badge to a user.
|
|
45
|
+
*/
|
|
46
|
+
export const AwardBadgeSchema = z.object({
|
|
47
|
+
kind: z.literal('gamification:awardBadge'),
|
|
48
|
+
badgeId: z.string(),
|
|
49
|
+
anchorId: z.string().optional(),
|
|
50
|
+
label: z.string().optional(),
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Schema for adding points to a user's score.
|
|
54
|
+
*/
|
|
55
|
+
export const AddPointsSchema = z.object({
|
|
56
|
+
kind: z.literal('gamification:addPoints'),
|
|
57
|
+
points: z.number(),
|
|
58
|
+
reason: z.string().optional(),
|
|
59
|
+
label: z.string().optional(),
|
|
60
|
+
});
|
|
61
|
+
// ============================================================================
|
|
62
|
+
// Unified Schema Export
|
|
63
|
+
// ============================================================================
|
|
64
|
+
/**
|
|
65
|
+
* Action step schemas for unified JSON Schema generation.
|
|
66
|
+
* The build script reads this array to merge adaptive actions into the
|
|
67
|
+
* unified canvas-config.schema.json.
|
|
68
|
+
*/
|
|
69
|
+
export const actionStepSchemas = [
|
|
70
|
+
{ defName: 'awardBadge', schema: AwardBadgeSchema },
|
|
71
|
+
{ defName: 'addPoints', schema: AddPointsSchema },
|
|
72
|
+
];
|
package/dist/types.d.ts
CHANGED
|
@@ -15,18 +15,5 @@ export interface EditorPanelProps {
|
|
|
15
15
|
};
|
|
16
16
|
platformClient?: unknown;
|
|
17
17
|
}
|
|
18
|
-
export type ExecutorCleanup
|
|
19
|
-
export type ExecutorUpdate = (changes: Record<string, unknown>) => void | Promise<void>;
|
|
20
|
-
export interface ExecutorResult {
|
|
21
|
-
cleanup: ExecutorCleanup;
|
|
22
|
-
updateFn?: ExecutorUpdate;
|
|
23
|
-
}
|
|
24
|
-
export interface ExecutorContext {
|
|
25
|
-
overlayRoot: HTMLElement;
|
|
26
|
-
resolveAnchor: (anchorId: string) => HTMLElement | null;
|
|
27
|
-
generateId: () => string;
|
|
28
|
-
publishEvent: (name: string, props?: Record<string, unknown>) => void;
|
|
29
|
-
adaptiveId?: string;
|
|
30
|
-
}
|
|
31
|
-
export type ActionExecutor<T> = (action: T, context: ExecutorContext) => Promise<ExecutorResult>;
|
|
18
|
+
export type { ActionExecutor, ExecutorCleanup, ExecutorContext, ExecutorResult, ExecutorUpdate, } from '@syntrologie/sdk-contracts';
|
|
32
19
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpD,MAAM,EAAE;QACN,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;QACnC,YAAY,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QAC1B,OAAO,EAAE,CAAC,iBAAiB,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KACzD,CAAC;IACF,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAMD,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpD,MAAM,EAAE;QACN,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;QACnC,YAAY,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QAC1B,OAAO,EAAE,CAAC,iBAAiB,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KACzD,CAAC;IACF,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAMD,YAAY,EACV,cAAc,EACd,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,GACf,MAAM,4BAA4B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syntrologie/adapt-gamification",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0-canary.10",
|
|
4
4
|
"description": "Adaptive Gamification app - Badges, rewards, points, and engagement mechanics",
|
|
5
5
|
"license": "Proprietary",
|
|
6
6
|
"private": false,
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/SyntropyForge/amazing-demos.git",
|
|
11
|
-
"directory": "
|
|
11
|
+
"directory": "packages/adaptives/adaptive-gamification"
|
|
12
12
|
},
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public"
|
|
@@ -34,17 +34,26 @@
|
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "tsc",
|
|
36
36
|
"typecheck": "tsc --noEmit",
|
|
37
|
-
"clean": "rm -rf dist"
|
|
37
|
+
"clean": "rm -rf dist",
|
|
38
|
+
"test": "vitest run",
|
|
39
|
+
"test:watch": "vitest"
|
|
38
40
|
},
|
|
39
41
|
"peerDependencies": {
|
|
40
|
-
"@syntrologie/runtime-sdk": "^2.0.0",
|
|
41
42
|
"react": ">=18.0.0",
|
|
42
43
|
"react-dom": ">=18.0.0",
|
|
43
44
|
"zod": "^3.0.0"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"
|
|
47
|
+
"@testing-library/react": "^16.3.2",
|
|
48
|
+
"@types/react": "^19.2.0",
|
|
49
|
+
"jsdom": "^26.1.0",
|
|
50
|
+
"react": "^19.2.0",
|
|
51
|
+
"react-dom": "^19.2.0",
|
|
52
|
+
"typescript": "^5.9.3",
|
|
53
|
+
"vitest": "^4.0.18",
|
|
48
54
|
"zod": "^3.25.76"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@syntrologie/sdk-contracts": "*"
|
|
49
58
|
}
|
|
50
59
|
}
|