@fidusia/question-engine-dynamic 1.0.4
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/README.md +43 -0
- package/dist/ai-questions-loader.d.ts +43 -0
- package/dist/ai-questions-loader.d.ts.map +1 -0
- package/dist/ai-questions-loader.js +131 -0
- package/dist/config-loader.d.ts +134 -0
- package/dist/config-loader.d.ts.map +1 -0
- package/dist/config-loader.js +80 -0
- package/dist/engine.d.ts +81 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +1243 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/types.d.ts +143 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +98 -0
- package/package.json +29 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { QuestionEngine, getQuestionEngine, resetQuestionEngine } from './engine';
|
|
2
|
+
export type { I18nFunctions } from './types';
|
|
3
|
+
export type { QuestionType, ModuleCategory, ModuleQuestion, SubQuestionTemplate, QuestionTrigger, TriggerCondition, TriggerAction, ModuleTrigger, ModuleTriggerCondition, QuestionModule, QueuedModule, QueuedQuestion, QueueState, AnsweredQuestion, UserPriority, PriorityBoost, } from './types';
|
|
4
|
+
export { PRIORITY_TO_MODULES, PRIORITY_BOOSTS, BOOKED_PROVIDER_TO_MODULE, PRIORITY_TO_BOOKED_PROVIDERS, BASE_PRIORITIES, } from './types';
|
|
5
|
+
export type { ChatbotConfig } from './config-loader';
|
|
6
|
+
export { getPriorityMappings, getBookedProviderMappings, getBasePriorities, getPriorityBoosts, getSystemIds, getPriorityToBookedProviders, getPriorityCalculation, getSpecialBehaviors, } from './config-loader';
|
|
7
|
+
export type { AIQuestion } from './ai-questions-loader';
|
|
8
|
+
export { loadAllAIQuestionsForSector, convertAIQuestionToModuleQuestion, findQuestionIndexInModule, checkConditions, } from './ai-questions-loader';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACjF,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5C,YAAY,EACV,YAAY,EACZ,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,YAAY,EACZ,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,aAAa,GACd,MAAM,SAAS,CAAA;AAEhB,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EACzB,4BAA4B,EAC5B,eAAe,GAChB,MAAM,SAAS,CAAA;AAEhB,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,4BAA4B,EAC5B,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,iBAAiB,CAAA;AAExB,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EACL,2BAA2B,EAC3B,iCAAiC,EACjC,yBAAyB,EACzB,eAAe,GAChB,MAAM,uBAAuB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// =====================================================
|
|
2
|
+
// QUESTION ENGINE - EXPORTS PRINCIPAUX
|
|
3
|
+
// =====================================================
|
|
4
|
+
export { QuestionEngine, getQuestionEngine, resetQuestionEngine } from './engine';
|
|
5
|
+
export { PRIORITY_TO_MODULES, PRIORITY_BOOSTS, BOOKED_PROVIDER_TO_MODULE, PRIORITY_TO_BOOKED_PROVIDERS, BASE_PRIORITIES, } from './types';
|
|
6
|
+
export { getPriorityMappings, getBookedProviderMappings, getBasePriorities, getPriorityBoosts, getSystemIds, getPriorityToBookedProviders, getPriorityCalculation, getSpecialBehaviors, } from './config-loader';
|
|
7
|
+
export { loadAllAIQuestionsForSector, convertAIQuestionToModuleQuestion, findQuestionIndexInModule, checkConditions, } from './ai-questions-loader';
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
export type QuestionType = "text" | "email" | "phone" | "number" | "date" | "select" | "multiselect" | "yesno" | "priority_order" | "info";
|
|
2
|
+
export type ModuleCategory = "system" | "intro" | "ceremony" | "venue" | "catering" | "photography" | "videography" | "music" | "flowers" | "decoration" | "dress" | "suit" | "cake" | "rings" | "stationery" | "transport" | "honeymoon" | "final";
|
|
3
|
+
export interface ModuleQuestion {
|
|
4
|
+
id: string;
|
|
5
|
+
text: string;
|
|
6
|
+
type: QuestionType;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
options?: string[];
|
|
9
|
+
min?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
nextInModule?: string | null;
|
|
12
|
+
conditionalNextInModule?: Record<string, string | null>;
|
|
13
|
+
onAnswer?: QuestionTrigger[];
|
|
14
|
+
generateSubQuestionsFor?: SubQuestionTemplate[];
|
|
15
|
+
generateSubQuestionsFromFormData?: string;
|
|
16
|
+
subQuestionTemplates?: SubQuestionTemplate[];
|
|
17
|
+
responseMessage?: (answer: string | string[] | number | boolean, formData: Record<string, any>) => string | null;
|
|
18
|
+
generateDynamicText?: (formData: Record<string, any>) => Record<string, string>;
|
|
19
|
+
isRequired: boolean;
|
|
20
|
+
aiQuestionMetadata?: {
|
|
21
|
+
conditions?: Record<string, any> | null;
|
|
22
|
+
parentQuestionId?: string | null;
|
|
23
|
+
nextQuestionId?: string | null;
|
|
24
|
+
sectorId?: string;
|
|
25
|
+
isActive?: boolean;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface SubQuestionTemplate {
|
|
29
|
+
id: string;
|
|
30
|
+
textTemplate: string;
|
|
31
|
+
type: QuestionType;
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
isRequired: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface QuestionTrigger {
|
|
36
|
+
condition: TriggerCondition;
|
|
37
|
+
action: TriggerAction;
|
|
38
|
+
}
|
|
39
|
+
export interface TriggerCondition {
|
|
40
|
+
type: "answer_equals" | "answer_contains" | "answer_not_equals" | "answer_exists" | "answer_includes_any";
|
|
41
|
+
value?: string | string[] | boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface TriggerAction {
|
|
44
|
+
type: "hide_module" | "show_module" | "set_priority" | "skip_to_end";
|
|
45
|
+
targetModuleId?: string;
|
|
46
|
+
newPriority?: number;
|
|
47
|
+
}
|
|
48
|
+
export interface ModuleTrigger {
|
|
49
|
+
condition: ModuleTriggerCondition;
|
|
50
|
+
action: TriggerAction;
|
|
51
|
+
}
|
|
52
|
+
export interface ModuleTriggerCondition {
|
|
53
|
+
type: "form_data_equals" | "form_data_contains" | "form_data_exists" | "form_data_includes_any";
|
|
54
|
+
questionId: string;
|
|
55
|
+
value?: string | string[] | boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface QuestionModule {
|
|
58
|
+
id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
category: ModuleCategory;
|
|
61
|
+
basePriority: number;
|
|
62
|
+
isFixed: boolean;
|
|
63
|
+
isHideable: boolean;
|
|
64
|
+
questions: ModuleQuestion[];
|
|
65
|
+
entryQuestionId: string;
|
|
66
|
+
triggers?: ModuleTrigger[];
|
|
67
|
+
}
|
|
68
|
+
export interface QueuedModule {
|
|
69
|
+
moduleId: string;
|
|
70
|
+
moduleName: string;
|
|
71
|
+
effectivePriority: number;
|
|
72
|
+
status: "pending" | "active" | "completed" | "skipped" | "hidden";
|
|
73
|
+
questions: QueuedQuestion[];
|
|
74
|
+
}
|
|
75
|
+
export interface QueuedQuestion {
|
|
76
|
+
questionId: string;
|
|
77
|
+
moduleId: string;
|
|
78
|
+
text: string;
|
|
79
|
+
type: QuestionType;
|
|
80
|
+
status: "pending" | "active" | "completed" | "skipped";
|
|
81
|
+
answer?: string | string[] | number | boolean;
|
|
82
|
+
answeredAt?: Date;
|
|
83
|
+
isDynamic?: boolean;
|
|
84
|
+
parentQuestionId?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface QueueState {
|
|
87
|
+
queue: QueuedModule[];
|
|
88
|
+
currentModuleId: string | null;
|
|
89
|
+
currentQuestionId: string | null;
|
|
90
|
+
completedModules: string[];
|
|
91
|
+
hiddenModules: string[];
|
|
92
|
+
skippedModules: string[];
|
|
93
|
+
formData: Record<string, any>;
|
|
94
|
+
answeredQuestions: AnsweredQuestion[];
|
|
95
|
+
isComplete: boolean;
|
|
96
|
+
transitionInfo?: {
|
|
97
|
+
completedModuleId: string;
|
|
98
|
+
startingModuleId: string;
|
|
99
|
+
} | null;
|
|
100
|
+
}
|
|
101
|
+
export interface AnsweredQuestion {
|
|
102
|
+
questionId: string;
|
|
103
|
+
moduleId: string;
|
|
104
|
+
moduleName: string;
|
|
105
|
+
text: string;
|
|
106
|
+
answer: string | string[] | number | boolean;
|
|
107
|
+
answeredAt: Date;
|
|
108
|
+
}
|
|
109
|
+
export type UserPriority = "Le lieu de réception" | "La gastronomie et le repas" | "Les photos et vidéos" | "La musique et l'animation" | "L'ambiance et la décoration" | "La robe de mariée" | "Le costume";
|
|
110
|
+
export interface PriorityBoost {
|
|
111
|
+
moduleId: string;
|
|
112
|
+
boost: number;
|
|
113
|
+
}
|
|
114
|
+
export declare const PRIORITY_TO_MODULES: Record<string, string[]>;
|
|
115
|
+
export declare const PRIORITY_BOOSTS: Record<UserPriority, PriorityBoost[]>;
|
|
116
|
+
export declare const BOOKED_PROVIDER_TO_MODULE: Record<string, {
|
|
117
|
+
moduleId: string;
|
|
118
|
+
skipQuestion: string;
|
|
119
|
+
}>;
|
|
120
|
+
export declare const PRIORITY_TO_BOOKED_PROVIDERS: Record<string, string[]>;
|
|
121
|
+
export declare const BASE_PRIORITIES: Record<string, number>;
|
|
122
|
+
/**
|
|
123
|
+
* Interface pour les fonctions i18n nécessaires au QuestionEngine
|
|
124
|
+
* Ces fonctions doivent être fournies par le projet consommateur
|
|
125
|
+
*/
|
|
126
|
+
export interface I18nFunctions {
|
|
127
|
+
/**
|
|
128
|
+
* Fonction de traduction
|
|
129
|
+
* @param key - Clé de traduction
|
|
130
|
+
* @param params - Paramètres optionnels pour la traduction
|
|
131
|
+
* @param lang - Langue optionnelle (par défaut: 'fr')
|
|
132
|
+
* @returns Texte traduit
|
|
133
|
+
*/
|
|
134
|
+
t: (key: string, params?: Record<string, any>, lang?: string) => string;
|
|
135
|
+
/**
|
|
136
|
+
* Récupère les options d'une question
|
|
137
|
+
* @param questionId - ID de la question
|
|
138
|
+
* @param lang - Langue optionnelle (par défaut: 'fr')
|
|
139
|
+
* @returns Tableau d'options (peut être des clés i18n ou des valeurs directes)
|
|
140
|
+
*/
|
|
141
|
+
getQuestionOptions: (questionId: string, lang?: string) => string[];
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,aAAa,GACb,OAAO,GACP,gBAAgB,GAChB,MAAM,CAAA;AAGV,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,OAAO,GACP,UAAU,GACV,OAAO,GACP,UAAU,GACV,aAAa,GACb,aAAa,GACb,OAAO,GACP,SAAS,GACT,YAAY,GACZ,OAAO,GACP,MAAM,GACN,MAAM,GACN,OAAO,GACP,YAAY,GACZ,WAAW,GACX,WAAW,GACX,OAAO,CAAA;AAMX,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IAC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- TYPES & INTERFACES
|
|
3
|
+
// Architecture modulaire pour le questionnaire Aimi
|
|
4
|
+
// =====================================================
|
|
5
|
+
// Mapping des priorités utilisateur vers les modules
|
|
6
|
+
export const PRIORITY_TO_MODULES = {
|
|
7
|
+
"Le lieu de réception": ["venue"],
|
|
8
|
+
"La gastronomie et le repas": ["catering", "cake"],
|
|
9
|
+
"Les photos et vidéos": ["photography", "videography"],
|
|
10
|
+
"La musique et l'animation": ["music"],
|
|
11
|
+
"L'ambiance et la décoration": ["decoration", "flowers"], // Les fleurs font partie de l'ambiance
|
|
12
|
+
"La robe de mariée": ["dress"],
|
|
13
|
+
"Le costume": ["suit"],
|
|
14
|
+
};
|
|
15
|
+
export const PRIORITY_BOOSTS = {
|
|
16
|
+
"Le lieu de réception": [
|
|
17
|
+
{ moduleId: "venue", boost: -100 },
|
|
18
|
+
],
|
|
19
|
+
"La gastronomie et le repas": [
|
|
20
|
+
{ moduleId: "catering", boost: -350 },
|
|
21
|
+
{ moduleId: "cake", boost: -200 },
|
|
22
|
+
],
|
|
23
|
+
"Les photos et vidéos": [
|
|
24
|
+
{ moduleId: "photography", boost: -350 },
|
|
25
|
+
{ moduleId: "videography", boost: -300 },
|
|
26
|
+
],
|
|
27
|
+
"La musique et l'animation": [
|
|
28
|
+
{ moduleId: "music", boost: -350 },
|
|
29
|
+
],
|
|
30
|
+
"L'ambiance et la décoration": [
|
|
31
|
+
{ moduleId: "decoration", boost: -400 },
|
|
32
|
+
{ moduleId: "flowers", boost: -350 }, // Les fleurs font partie de l'ambiance et décoration
|
|
33
|
+
],
|
|
34
|
+
"La robe de mariée": [
|
|
35
|
+
{ moduleId: "dress", boost: -350 },
|
|
36
|
+
],
|
|
37
|
+
"Le costume": [
|
|
38
|
+
{ moduleId: "suit", boost: -350 },
|
|
39
|
+
],
|
|
40
|
+
};
|
|
41
|
+
// =====================================================
|
|
42
|
+
// MAPPING PRESTATAIRES RÉSERVÉS -> MODULES
|
|
43
|
+
// =====================================================
|
|
44
|
+
// Mapping entre les options de booked_providers et les modules correspondants
|
|
45
|
+
// Quand un prestataire est réservé, le module entier est skippé
|
|
46
|
+
// skipQuestion = entryQuestionId du module (première question)
|
|
47
|
+
export const BOOKED_PROVIDER_TO_MODULE = {
|
|
48
|
+
"Lieu de réception": { moduleId: "venue", skipQuestion: "venue_type_preference" },
|
|
49
|
+
"Traiteur": { moduleId: "catering", skipQuestion: "meal_style" },
|
|
50
|
+
"Photographe": { moduleId: "photography", skipQuestion: "photo_style" },
|
|
51
|
+
"Vidéaste": { moduleId: "videography", skipQuestion: "video_style" },
|
|
52
|
+
"DJ / Musicien": { moduleId: "music", skipQuestion: "music_preference" },
|
|
53
|
+
"Fleuriste": { moduleId: "flowers", skipQuestion: "flower_style" },
|
|
54
|
+
"Décorateur": { moduleId: "decoration", skipQuestion: "wedding_theme" },
|
|
55
|
+
"Pâtissier (gâteau)": { moduleId: "cake", skipQuestion: "cake_style" },
|
|
56
|
+
"Officiant de cérémonie": { moduleId: "ceremony", skipQuestion: "ceremony_type" },
|
|
57
|
+
// Note: Coiffeur/Maquilleur n'est pas mappé car c'est indépendant des tenues
|
|
58
|
+
// Note: Wedding planner n'est pas dans la liste car Aimi EST le wedding planner
|
|
59
|
+
};
|
|
60
|
+
// Mapping inverse : option de priorité -> options de booked_providers correspondantes
|
|
61
|
+
// Note: "Les tenues" n'a pas de mapping car il n'y a pas de prestataire "Robe" ou "Costume"
|
|
62
|
+
// dans la liste des prestataires réservables (c'est une recherche personnelle)
|
|
63
|
+
export const PRIORITY_TO_BOOKED_PROVIDERS = {
|
|
64
|
+
"Le lieu de réception": ["Lieu de réception"],
|
|
65
|
+
"La gastronomie et le repas": ["Traiteur", "Pâtissier (gâteau)"],
|
|
66
|
+
"Les photos et vidéos": ["Photographe", "Vidéaste"],
|
|
67
|
+
"La musique et l'animation": ["DJ / Musicien"],
|
|
68
|
+
"L'ambiance et la décoration": ["Décorateur", "Fleuriste"], // Inclut les fleurs
|
|
69
|
+
"La robe de mariée": [], // Pas de prestataire associé
|
|
70
|
+
"Le costume": [], // Pas de prestataire associé
|
|
71
|
+
};
|
|
72
|
+
// =====================================================
|
|
73
|
+
// CONSTANTES DE PRIORITÉ DE BASE
|
|
74
|
+
// =====================================================
|
|
75
|
+
export const BASE_PRIORITIES = {
|
|
76
|
+
// Module fixe (toujours au début)
|
|
77
|
+
intro: 0, // Date, invités, budget, coordonnées, priorité
|
|
78
|
+
// Modules réorganisables selon priorité utilisateur (200-599)
|
|
79
|
+
venue: 200,
|
|
80
|
+
catering: 250,
|
|
81
|
+
photography: 300,
|
|
82
|
+
videography: 350,
|
|
83
|
+
music: 400,
|
|
84
|
+
flowers: 450,
|
|
85
|
+
decoration: 500,
|
|
86
|
+
dress: 550, // Secteur : robe de mariée
|
|
87
|
+
suit: 560, // Secteur : costume
|
|
88
|
+
// Cérémonie - traité comme les autres prestataires
|
|
89
|
+
ceremony: 575,
|
|
90
|
+
// Modules secondaires (600+)
|
|
91
|
+
cake: 600,
|
|
92
|
+
rings: 650,
|
|
93
|
+
stationery: 700,
|
|
94
|
+
transport: 750,
|
|
95
|
+
honeymoon: 800,
|
|
96
|
+
// Module final (toujours à la fin)
|
|
97
|
+
final: 1000,
|
|
98
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fidusia/question-engine-dynamic",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "Moteur de questions avec configuration dynamique complète",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"prepublishOnly": "npm run build",
|
|
13
|
+
"dev": "tsc --watch",
|
|
14
|
+
"type-check": "tsc --noEmit"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^5"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"typescript": "^5"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|