@syntrologie/adapt-gamification 2.8.0-canary.21 → 2.8.0-canary.211

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 CHANGED
@@ -1,12 +1,19 @@
1
1
  /**
2
2
  * CDN Entry Point for Adaptive Gamification
3
3
  *
4
- * This module is bundled for CDN delivery and self-registers with the global
5
- * SynOS app registry when loaded dynamically via the AppLoader.
6
- */
7
- /**
8
- * App manifest for registry registration.
9
- * Follows the AppManifest interface expected by AppLoader/AppRegistry.
4
+ * Bundled for CDN delivery and loaded on-demand by the host runtime's
5
+ * AppLoader when a config references gamification actions/widgets.
6
+ *
7
+ * Mirrors the pattern in adaptive-mcp/src/cdn.ts: builds the manifest from
8
+ * the runtime export, then self-registers with the host's app registry on
9
+ * import. The host's AppLoader fetches this bundle, esbuild's IIFE wrapper
10
+ * runs the registration, and AppRegistry.activate() can then wire the
11
+ * executors into the runtime.
12
+ *
13
+ * Without this entry, the build script (build-adaptives-only.js) silently
14
+ * skips the package — gamification ends up "lazy in name only" with no
15
+ * bundle on disk, and any config using `gamification:awardBadge` /
16
+ * `gamification:addPoints` hits "Unknown action kind".
10
17
  */
11
18
  export declare const manifest: {
12
19
  id: string;
@@ -23,17 +30,18 @@ export declare const manifest: {
23
30
  handler: (_event: unknown, _ctx: unknown) => void;
24
31
  }[];
25
32
  };
26
- editor: {
27
- panel: {
28
- title: string;
29
- icon: string;
30
- description: string;
31
- };
32
- component: typeof import("./editor").GamificationEditor;
33
- };
34
33
  metadata: {
35
34
  isBuiltIn: boolean;
36
35
  };
37
36
  };
37
+ declare global {
38
+ interface Window {
39
+ SynOS?: {
40
+ appRegistry?: {
41
+ register?: (m: unknown) => void;
42
+ };
43
+ };
44
+ }
45
+ }
38
46
  export default manifest;
39
47
  //# sourceMappingURL=cdn.d.ts.map
package/dist/cdn.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBpB,CAAC;AAaF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;CAYpB,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,KAAK,CAAC,EAAE;YACN,WAAW,CAAC,EAAE;gBACZ,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;aACjC,CAAC;SACH,CAAC;KACH;CACF;AASD,eAAe,QAAQ,CAAC"}
package/dist/runtime.js CHANGED
@@ -1,90 +1,52 @@
1
- /**
2
- * Adaptive Gamification - Runtime Module
3
- *
4
- * Gamification actions: awardBadge, addPoints.
5
- * Provides gamification features like badges, points, and rewards.
6
- */
7
- // ============================================================================
8
- // Executors
9
- // ============================================================================
10
- /**
11
- * Execute an awardBadge action
12
- *
13
- * Note: This executor uses publishEvent to track badge awards.
14
- * State management is handled at the app level via AppContext,
15
- * not at the action executor level.
16
- */
17
- export const executeAwardBadge = async (action, context) => {
18
- const { badgeId } = action;
19
- // Emit telemetry event (state management handled at app level)
20
- context.publishEvent('gamification.badge_awarded', {
21
- badgeId,
22
- awardedAt: Date.now(),
23
- });
24
- return {
25
- cleanup: () => {
26
- // Badge awards are permanent, no cleanup needed
27
- },
28
- };
1
+ // src/runtime.ts
2
+ var executeAwardBadge = async (action, context) => {
3
+ const { badgeId } = action;
4
+ context.publishEvent("gamification.badge_awarded", {
5
+ badgeId,
6
+ awardedAt: Date.now()
7
+ });
8
+ return {
9
+ cleanup: () => {
10
+ }
11
+ };
29
12
  };
30
- /**
31
- * Execute an addPoints action
32
- *
33
- * Note: This executor uses publishEvent to track points.
34
- * State management is handled at the app level via AppContext,
35
- * not at the action executor level.
36
- */
37
- export const executeAddPoints = async (action, context) => {
38
- const { points, reason } = action;
39
- // Emit telemetry event (state management handled at app level)
40
- context.publishEvent('gamification.points_added', {
41
- points,
42
- reason,
43
- timestamp: Date.now(),
44
- });
45
- return {
46
- cleanup: () => {
47
- // Points are permanent, no cleanup needed
48
- },
49
- };
13
+ var executeAddPoints = async (action, context) => {
14
+ const { points, reason } = action;
15
+ context.publishEvent("gamification.points_added", {
16
+ points,
17
+ reason,
18
+ timestamp: Date.now()
19
+ });
20
+ return {
21
+ cleanup: () => {
22
+ }
23
+ };
50
24
  };
51
- // ============================================================================
52
- // Event Handlers
53
- // ============================================================================
54
- /**
55
- * Event handler for auto-awarding badges based on triggers.
56
- */
57
- export const badgeTriggerHandler = {
58
- names: ['page_view', 'button_click'],
59
- handler: (_event, _ctx) => {
60
- // Auto-award badges based on event triggers
61
- // This would check badge trigger conditions in the config
62
- console.log('[Gamification] Event received for badge trigger check');
63
- },
25
+ var badgeTriggerHandler = {
26
+ names: ["page_view", "button_click"],
27
+ handler: (_event, _ctx) => {
28
+ console.log("[Gamification] Event received for badge trigger check");
29
+ }
64
30
  };
65
- // ============================================================================
66
- // Executor Definitions for Registration
67
- // ============================================================================
68
- /**
69
- * All executors provided by this app.
70
- * These are registered with the runtime's ExecutorRegistry.
71
- */
72
- export const executors = [
73
- { kind: 'gamification:awardBadge', executor: executeAwardBadge },
74
- { kind: 'gamification:addPoints', executor: executeAddPoints },
31
+ var executors = [
32
+ { kind: "gamification:awardBadge", executor: executeAwardBadge },
33
+ { kind: "gamification:addPoints", executor: executeAddPoints }
75
34
  ];
76
- /**
77
- * Event handlers provided by this app.
78
- */
79
- export const eventHandlers = [badgeTriggerHandler];
80
- /**
81
- * App runtime manifest.
82
- */
83
- export const runtime = {
84
- id: 'adaptive-gamification',
85
- version: '1.0.0',
86
- name: 'Gamification',
87
- description: 'Badges, rewards, points, and engagement mechanics',
88
- executors,
89
- eventHandlers,
35
+ var eventHandlers = [badgeTriggerHandler];
36
+ var runtime = {
37
+ id: "adaptive-gamification",
38
+ version: "1.0.0",
39
+ name: "Gamification",
40
+ description: "Badges, rewards, points, and engagement mechanics",
41
+ executors,
42
+ eventHandlers
90
43
  };
44
+ export {
45
+ badgeTriggerHandler,
46
+ eventHandlers,
47
+ executeAddPoints,
48
+ executeAwardBadge,
49
+ executors,
50
+ runtime
51
+ };
52
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/runtime.ts"],
4
+ "sourcesContent": ["/**\n * Adaptive Gamification - Runtime Module\n *\n * Gamification actions: awardBadge, addPoints.\n * Provides gamification features like badges, points, and rewards.\n */\n\nimport type { ActionExecutor, ExecutorResult } from './types';\n\n// ============================================================================\n// Action Types\n// ============================================================================\n\n/**\n * Award badge action\n */\nexport interface AwardBadgeAction {\n kind: 'gamification:awardBadge';\n badgeId: string;\n anchorId?: string;\n label?: string;\n}\n\n/**\n * Add points action\n */\nexport interface AddPointsAction {\n kind: 'gamification:addPoints';\n points: number;\n reason?: string;\n label?: string;\n}\n\n// ============================================================================\n// Executors\n// ============================================================================\n\n/**\n * Execute an awardBadge action\n *\n * Note: This executor uses publishEvent to track badge awards.\n * State management is handled at the app level via AppContext,\n * not at the action executor level.\n */\nexport const executeAwardBadge: ActionExecutor<AwardBadgeAction> = async (\n action,\n context\n): Promise<ExecutorResult> => {\n const { badgeId } = action;\n\n // Emit telemetry event (state management handled at app level)\n context.publishEvent('gamification.badge_awarded', {\n badgeId,\n awardedAt: Date.now(),\n });\n\n return {\n cleanup: () => {\n // Badge awards are permanent, no cleanup needed\n },\n };\n};\n\n/**\n * Execute an addPoints action\n *\n * Note: This executor uses publishEvent to track points.\n * State management is handled at the app level via AppContext,\n * not at the action executor level.\n */\nexport const executeAddPoints: ActionExecutor<AddPointsAction> = async (\n action,\n context\n): Promise<ExecutorResult> => {\n const { points, reason } = action;\n\n // Emit telemetry event (state management handled at app level)\n context.publishEvent('gamification.points_added', {\n points,\n reason,\n timestamp: Date.now(),\n });\n\n return {\n cleanup: () => {\n // Points are permanent, no cleanup needed\n },\n };\n};\n\n// ============================================================================\n// Event Handlers\n// ============================================================================\n\n/**\n * Event handler for auto-awarding badges based on triggers.\n */\nexport const badgeTriggerHandler = {\n names: ['page_view', 'button_click'],\n handler: (_event: unknown, _ctx: unknown) => {\n // Auto-award badges based on event triggers\n // This would check badge trigger conditions in the config\n console.log('[Gamification] Event received for badge trigger check');\n },\n};\n\n// ============================================================================\n// Executor Definitions for Registration\n// ============================================================================\n\n/**\n * All executors provided by this app.\n * These are registered with the runtime's ExecutorRegistry.\n */\nexport const executors = [\n { kind: 'gamification:awardBadge', executor: executeAwardBadge },\n { kind: 'gamification:addPoints', executor: executeAddPoints },\n] as const;\n\n/**\n * Event handlers provided by this app.\n */\nexport const eventHandlers = [badgeTriggerHandler];\n\n/**\n * App runtime manifest.\n */\nexport const runtime = {\n id: 'adaptive-gamification',\n version: '1.0.0',\n name: 'Gamification',\n description: 'Badges, rewards, points, and engagement mechanics',\n executors,\n eventHandlers,\n};\n"],
5
+ "mappings": ";AA4CO,IAAM,oBAAsD,OACjE,QACA,YAC4B;AAC5B,QAAM,EAAE,QAAQ,IAAI;AAGpB,UAAQ,aAAa,8BAA8B;AAAA,IACjD;AAAA,IACA,WAAW,KAAK,IAAI;AAAA,EACtB,CAAC;AAED,SAAO;AAAA,IACL,SAAS,MAAM;AAAA,IAEf;AAAA,EACF;AACF;AASO,IAAM,mBAAoD,OAC/D,QACA,YAC4B;AAC5B,QAAM,EAAE,QAAQ,OAAO,IAAI;AAG3B,UAAQ,aAAa,6BAA6B;AAAA,IAChD;AAAA,IACA;AAAA,IACA,WAAW,KAAK,IAAI;AAAA,EACtB,CAAC;AAED,SAAO;AAAA,IACL,SAAS,MAAM;AAAA,IAEf;AAAA,EACF;AACF;AASO,IAAM,sBAAsB;AAAA,EACjC,OAAO,CAAC,aAAa,cAAc;AAAA,EACnC,SAAS,CAAC,QAAiB,SAAkB;AAG3C,YAAQ,IAAI,uDAAuD;AAAA,EACrE;AACF;AAUO,IAAM,YAAY;AAAA,EACvB,EAAE,MAAM,2BAA2B,UAAU,kBAAkB;AAAA,EAC/D,EAAE,MAAM,0BAA0B,UAAU,iBAAiB;AAC/D;AAKO,IAAM,gBAAgB,CAAC,mBAAmB;AAK1C,IAAM,UAAU;AAAA,EACrB,IAAI;AAAA,EACJ,SAAS;AAAA,EACT,MAAM;AAAA,EACN,aAAa;AAAA,EACb;AAAA,EACA;AACF;",
6
+ "names": []
7
+ }