heartraite 1.0.230 → 1.0.232

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.
@@ -0,0 +1,20 @@
1
+ export declare enum DQPursuitPhase {
2
+ FIRST_READING = "first_reading",
3
+ FULL = "full"
4
+ }
5
+ export declare enum DQPursuitPausedReason {
6
+ BANK = "bank",
7
+ COMPLETE = "complete",
8
+ USER = "user"
9
+ }
10
+ export declare enum DQReflectionKind {
11
+ LEARNING = "learning",
12
+ DIRECTION = "direction",
13
+ NONE = "none"
14
+ }
15
+ export declare enum DQSetPursuitOutcome {
16
+ STARTED = "started",
17
+ CLEARED = "cleared",
18
+ NOT_ALLOWED = "not_allowed",
19
+ DISABLED = "disabled"
20
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DQSetPursuitOutcome = exports.DQReflectionKind = exports.DQPursuitPausedReason = exports.DQPursuitPhase = void 0;
4
+ var DQPursuitPhase;
5
+ (function (DQPursuitPhase) {
6
+ DQPursuitPhase["FIRST_READING"] = "first_reading";
7
+ DQPursuitPhase["FULL"] = "full";
8
+ })(DQPursuitPhase || (exports.DQPursuitPhase = DQPursuitPhase = {}));
9
+ var DQPursuitPausedReason;
10
+ (function (DQPursuitPausedReason) {
11
+ DQPursuitPausedReason["BANK"] = "bank";
12
+ DQPursuitPausedReason["COMPLETE"] = "complete";
13
+ DQPursuitPausedReason["USER"] = "user";
14
+ })(DQPursuitPausedReason || (exports.DQPursuitPausedReason = DQPursuitPausedReason = {}));
15
+ var DQReflectionKind;
16
+ (function (DQReflectionKind) {
17
+ DQReflectionKind["LEARNING"] = "learning";
18
+ DQReflectionKind["DIRECTION"] = "direction";
19
+ DQReflectionKind["NONE"] = "none";
20
+ })(DQReflectionKind || (exports.DQReflectionKind = DQReflectionKind = {}));
21
+ var DQSetPursuitOutcome;
22
+ (function (DQSetPursuitOutcome) {
23
+ DQSetPursuitOutcome["STARTED"] = "started";
24
+ DQSetPursuitOutcome["CLEARED"] = "cleared";
25
+ DQSetPursuitOutcome["NOT_ALLOWED"] = "not_allowed";
26
+ DQSetPursuitOutcome["DISABLED"] = "disabled";
27
+ })(DQSetPursuitOutcome || (exports.DQSetPursuitOutcome = DQSetPursuitOutcome = {}));
@@ -3,6 +3,7 @@ export * from "./ca.enum";
3
3
  export * from "./cloudfunction.enum";
4
4
  export * from "./consultation.enum";
5
5
  export * from "./country.enum";
6
+ export * from "./dq.enum";
6
7
  export * from "./evaluation.enum";
7
8
  export * from "./environment.enum";
8
9
  export * from "./error.enum";
@@ -19,6 +19,7 @@ __exportStar(require("./ca.enum"), exports);
19
19
  __exportStar(require("./cloudfunction.enum"), exports);
20
20
  __exportStar(require("./consultation.enum"), exports);
21
21
  __exportStar(require("./country.enum"), exports);
22
+ __exportStar(require("./dq.enum"), exports);
22
23
  __exportStar(require("./evaluation.enum"), exports);
23
24
  __exportStar(require("./environment.enum"), exports);
24
25
  __exportStar(require("./error.enum"), exports);
@@ -5,3 +5,58 @@ export declare enum SACategoryID {
5
5
  LOVE_LANGUAGE = "self_awareness_love_language",
6
6
  VALUES = "self_awareness_values"
7
7
  }
8
+ export declare enum SASectionPart {
9
+ INSIGHT = "insight",
10
+ REFLECTION = "reflection",
11
+ TIPS = "tips",
12
+ CHAPTER = "chapter"
13
+ }
14
+ export declare enum SAEvidenceBand {
15
+ FEW = "few",
16
+ FAIRLY_CLEAR = "fairly_clear",
17
+ CLEAR = "clear"
18
+ }
19
+ export declare enum SAChapterId {
20
+ A = "self_awareness_chapter_a",
21
+ C = "self_awareness_chapter_c",
22
+ I = "self_awareness_chapter_i",
23
+ R = "self_awareness_chapter_r",
24
+ E = "self_awareness_chapter_e",
25
+ G = "self_awareness_chapter_g"
26
+ }
27
+ export declare enum SAItemKind {
28
+ CATEGORY = "category",
29
+ CHAPTER = "chapter",
30
+ LETTER = "letter"
31
+ }
32
+ export declare enum SAItemAccess {
33
+ FULL = "full",
34
+ DESCRIBED = "described"
35
+ }
36
+ export declare enum SAAccessState {
37
+ MEMBER = "member",
38
+ LEGACY = "legacy",
39
+ LAPSED = "lapsed",
40
+ FREE = "free"
41
+ }
42
+ export declare enum SAEntitlementGrant {
43
+ FREE = "free",
44
+ MEMBER = "member",
45
+ LEGACY = "legacy",
46
+ PAYONCE = "payonce",
47
+ GRANT = "grant"
48
+ }
49
+ export declare enum SAChapterStage {
50
+ FIRST_READING = "first_reading",
51
+ FULL = "full"
52
+ }
53
+ export declare enum SAClaimValence {
54
+ NEUTRAL = "neutral",
55
+ STRENGTH = "strength",
56
+ COST = "cost"
57
+ }
58
+ export declare enum SAClaimFeedbackValue {
59
+ YES = "yes",
60
+ PARTIAL = "partial",
61
+ NO = "no"
62
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SACategoryID = void 0;
3
+ exports.SAClaimFeedbackValue = exports.SAClaimValence = exports.SAChapterStage = exports.SAEntitlementGrant = exports.SAAccessState = exports.SAItemAccess = exports.SAItemKind = exports.SAChapterId = exports.SAEvidenceBand = exports.SASectionPart = exports.SACategoryID = void 0;
4
4
  var SACategoryID;
5
5
  (function (SACategoryID) {
6
6
  SACategoryID["PERSONALITY"] = "self_awareness_personality";
@@ -9,3 +9,68 @@ var SACategoryID;
9
9
  SACategoryID["LOVE_LANGUAGE"] = "self_awareness_love_language";
10
10
  SACategoryID["VALUES"] = "self_awareness_values";
11
11
  })(SACategoryID || (exports.SACategoryID = SACategoryID = {}));
12
+ var SASectionPart;
13
+ (function (SASectionPart) {
14
+ SASectionPart["INSIGHT"] = "insight";
15
+ SASectionPart["REFLECTION"] = "reflection";
16
+ SASectionPart["TIPS"] = "tips";
17
+ SASectionPart["CHAPTER"] = "chapter";
18
+ })(SASectionPart || (exports.SASectionPart = SASectionPart = {}));
19
+ var SAEvidenceBand;
20
+ (function (SAEvidenceBand) {
21
+ SAEvidenceBand["FEW"] = "few";
22
+ SAEvidenceBand["FAIRLY_CLEAR"] = "fairly_clear";
23
+ SAEvidenceBand["CLEAR"] = "clear";
24
+ })(SAEvidenceBand || (exports.SAEvidenceBand = SAEvidenceBand = {}));
25
+ var SAChapterId;
26
+ (function (SAChapterId) {
27
+ SAChapterId["A"] = "self_awareness_chapter_a";
28
+ SAChapterId["C"] = "self_awareness_chapter_c";
29
+ SAChapterId["I"] = "self_awareness_chapter_i";
30
+ SAChapterId["R"] = "self_awareness_chapter_r";
31
+ SAChapterId["E"] = "self_awareness_chapter_e";
32
+ SAChapterId["G"] = "self_awareness_chapter_g";
33
+ })(SAChapterId || (exports.SAChapterId = SAChapterId = {}));
34
+ var SAItemKind;
35
+ (function (SAItemKind) {
36
+ SAItemKind["CATEGORY"] = "category";
37
+ SAItemKind["CHAPTER"] = "chapter";
38
+ SAItemKind["LETTER"] = "letter";
39
+ })(SAItemKind || (exports.SAItemKind = SAItemKind = {}));
40
+ var SAItemAccess;
41
+ (function (SAItemAccess) {
42
+ SAItemAccess["FULL"] = "full";
43
+ SAItemAccess["DESCRIBED"] = "described";
44
+ })(SAItemAccess || (exports.SAItemAccess = SAItemAccess = {}));
45
+ var SAAccessState;
46
+ (function (SAAccessState) {
47
+ SAAccessState["MEMBER"] = "member";
48
+ SAAccessState["LEGACY"] = "legacy";
49
+ SAAccessState["LAPSED"] = "lapsed";
50
+ SAAccessState["FREE"] = "free";
51
+ })(SAAccessState || (exports.SAAccessState = SAAccessState = {}));
52
+ var SAEntitlementGrant;
53
+ (function (SAEntitlementGrant) {
54
+ SAEntitlementGrant["FREE"] = "free";
55
+ SAEntitlementGrant["MEMBER"] = "member";
56
+ SAEntitlementGrant["LEGACY"] = "legacy";
57
+ SAEntitlementGrant["PAYONCE"] = "payonce";
58
+ SAEntitlementGrant["GRANT"] = "grant";
59
+ })(SAEntitlementGrant || (exports.SAEntitlementGrant = SAEntitlementGrant = {}));
60
+ var SAChapterStage;
61
+ (function (SAChapterStage) {
62
+ SAChapterStage["FIRST_READING"] = "first_reading";
63
+ SAChapterStage["FULL"] = "full";
64
+ })(SAChapterStage || (exports.SAChapterStage = SAChapterStage = {}));
65
+ var SAClaimValence;
66
+ (function (SAClaimValence) {
67
+ SAClaimValence["NEUTRAL"] = "neutral";
68
+ SAClaimValence["STRENGTH"] = "strength";
69
+ SAClaimValence["COST"] = "cost";
70
+ })(SAClaimValence || (exports.SAClaimValence = SAClaimValence = {}));
71
+ var SAClaimFeedbackValue;
72
+ (function (SAClaimFeedbackValue) {
73
+ SAClaimFeedbackValue["YES"] = "yes";
74
+ SAClaimFeedbackValue["PARTIAL"] = "partial";
75
+ SAClaimFeedbackValue["NO"] = "no";
76
+ })(SAClaimFeedbackValue || (exports.SAClaimFeedbackValue = SAClaimFeedbackValue = {}));
@@ -5,6 +5,9 @@
5
5
  * Internal backend details (psychometrics, scoring, etc.) belong in backend only.
6
6
  */
7
7
  import { Locale } from "../enum/localization.enum";
8
+ import { DQPursuitPausedReason, DQPursuitPhase, DQReflectionKind, DQSetPursuitOutcome } from "../enum/dq.enum";
9
+ import { SAChapterId, SAChapterStage } from "../enum/sa.enum";
10
+ import type { SAReadiness } from "./sa.types";
8
11
  /**
9
12
  * DQ locale codes for question content
10
13
  * Currently supports Swedish and Danish
@@ -129,4 +132,40 @@ export interface GetQuestionResponse {
129
132
  allQuestionsCompleted?: boolean;
130
133
  /** User's discovery progress (streaks, counts) */
131
134
  progress?: DiscoveryProgress;
135
+ pursuit?: DQPursuit;
136
+ }
137
+ export interface DQPursuit {
138
+ chapterId: SAChapterId;
139
+ phase: DQPursuitPhase;
140
+ startedAt: string;
141
+ pausedReason?: DQPursuitPausedReason;
142
+ readiness?: SAReadiness;
143
+ }
144
+ export interface DQReflection {
145
+ kind: DQReflectionKind;
146
+ text: string;
147
+ traitId?: string;
148
+ traitName?: string;
149
+ answersOnTrait?: number;
150
+ }
151
+ export interface DQChapterEvent {
152
+ chapterId: SAChapterId;
153
+ stage: SAChapterStage;
154
+ }
155
+ export interface DQSubmitAnswerResponse {
156
+ answerId: string;
157
+ nextQuestion: DQQuestion | null;
158
+ progress: DiscoveryProgress;
159
+ quotaExhausted: boolean;
160
+ quotaResetsAt?: string;
161
+ pursuit?: DQPursuit;
162
+ reflection?: DQReflection;
163
+ chapterEvent?: DQChapterEvent;
164
+ }
165
+ export interface DQSetPursuitRequest {
166
+ chapterId: SAChapterId | null;
167
+ }
168
+ export interface DQSetPursuitResponse {
169
+ outcome: DQSetPursuitOutcome;
170
+ pursuit: DQPursuit | null;
132
171
  }
@@ -1,4 +1,6 @@
1
+ import { LoveLanguageTrait, PersonalityTrait, SAAccessState, SACategoryID, SAChapterId, SAChapterStage, SAClaimFeedbackValue, SAClaimValence, SAEntitlementGrant, SAEvidenceBand, SAItemAccess, SAItemKind } from "../enum";
1
2
  import { LoveLanguages, Personality } from "./ca.types";
3
+ import type { DQPursuit } from "./dq.types";
2
4
  export type SelfAwareness = {
3
5
  userId: string;
4
6
  categories: SACategory[];
@@ -6,6 +8,8 @@ export type SelfAwareness = {
6
8
  personality: Personality;
7
9
  loveLanguages: LoveLanguages;
8
10
  processing?: boolean;
11
+ readState?: SAReadState;
12
+ evidence?: SAEvidence;
9
13
  };
10
14
  export type SACategory = {
11
15
  id: string;
@@ -17,3 +21,128 @@ export type SACategorySection = {
17
21
  reflection: string;
18
22
  tip: string;
19
23
  };
24
+ export type SASectionReadState = {
25
+ insight?: string;
26
+ reflection?: string;
27
+ tips?: string;
28
+ chapter?: string;
29
+ };
30
+ export type SACategoryReadState = {
31
+ sections: Record<string, SASectionReadState>;
32
+ };
33
+ export type SAReadState = {
34
+ firstOpenedAt?: string;
35
+ categories: Record<string, SACategoryReadState>;
36
+ };
37
+ export type SAEvidenceItem = {
38
+ answers: number;
39
+ band: SAEvidenceBand;
40
+ };
41
+ export type SAPersonalityEvidence = Record<PersonalityTrait, SAEvidenceItem>;
42
+ export type SALoveLanguageEvidence = Record<LoveLanguageTrait, SAEvidenceItem>;
43
+ export type SAEvidence = {
44
+ personality: SAPersonalityEvidence;
45
+ loveLanguages?: SALoveLanguageEvidence;
46
+ };
47
+ export type SALetterItemId = `self_awareness_letter_${string}`;
48
+ export type SAItemId = SACategoryID | SAChapterId | SALetterItemId;
49
+ export type SATraitRef = {
50
+ traitId: string;
51
+ name: string;
52
+ };
53
+ export type SAReadiness = {
54
+ traitsAt3: number;
55
+ traitsAt4: number;
56
+ traitsTotal: number;
57
+ firstReadingReady: boolean;
58
+ fullReady: boolean;
59
+ writtenParagraphs: number;
60
+ nextTrait?: SATraitRef;
61
+ answersToNextParagraph?: number;
62
+ };
63
+ export type SAChapterBadge = {
64
+ answers: number;
65
+ traitsAt3: number;
66
+ traitsTotal: number;
67
+ };
68
+ export type SAClaimFeedback = {
69
+ value: SAClaimFeedbackValue;
70
+ note?: string;
71
+ at: string;
72
+ };
73
+ export type SAClaim = {
74
+ id: string;
75
+ text: string;
76
+ basis: string[];
77
+ band: SAEvidenceBand;
78
+ valence: SAClaimValence;
79
+ feedback?: SAClaimFeedback;
80
+ rewrittenAt?: string;
81
+ retired?: boolean;
82
+ };
83
+ export type SAChapterGap = {
84
+ text: string;
85
+ traitId: string;
86
+ answersToClose: number;
87
+ };
88
+ export type SAChapter = {
89
+ chapterId: SAChapterId;
90
+ version: number;
91
+ stage: SAChapterStage;
92
+ generatedAt: string;
93
+ badge: SAChapterBadge;
94
+ framingId: string;
95
+ framing?: string;
96
+ claims: SAClaim[];
97
+ gap?: SAChapterGap;
98
+ reflection: string;
99
+ practice: string;
100
+ art9OptIn: boolean;
101
+ refreshedAt?: string;
102
+ };
103
+ export type SAChapters = Partial<Record<SAChapterId, SAChapter>>;
104
+ export type SAEntitlementStamp = {
105
+ grantedAt: string;
106
+ grantedUnder: SAEntitlementGrant;
107
+ };
108
+ export type SAEntitlements = Partial<Record<SAItemId, SAEntitlementStamp>>;
109
+ export type SAArt9OptIn = Partial<Record<SAItemId, boolean>>;
110
+ export type SAItem = {
111
+ itemId: SAItemId;
112
+ kind: SAItemKind;
113
+ access: SAItemAccess;
114
+ title?: string;
115
+ description?: string;
116
+ framingId?: string;
117
+ framing?: string;
118
+ readiness?: SAReadiness;
119
+ stage?: SAChapterStage;
120
+ writing?: boolean;
121
+ stamped?: boolean;
122
+ pursuable?: boolean;
123
+ };
124
+ export type SelfAwarenessV2 = SelfAwareness & {
125
+ accessState: SAAccessState;
126
+ items: SAItem[];
127
+ chapters: SAChapters;
128
+ pursuit?: DQPursuit;
129
+ freeChapterId?: SAChapterId;
130
+ freeChapterSwitchUsed?: boolean;
131
+ art9OptIn?: SAArt9OptIn;
132
+ };
133
+ export type SAClaimFeedbackResponse = {
134
+ claim: SAClaim;
135
+ };
136
+ export type SASetArt9OptInResponse = {
137
+ art9OptIn: SAArt9OptIn;
138
+ };
139
+ export type SAClaimFeedbackRequest = {
140
+ chapterId: SAChapterId;
141
+ claimId: string;
142
+ value: SAClaimFeedbackValue;
143
+ note?: string;
144
+ };
145
+ export type SASetArt9OptInRequest = {
146
+ chapterId: SAChapterId;
147
+ optIn: boolean;
148
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heartraite",
3
- "version": "1.0.230",
3
+ "version": "1.0.232",
4
4
  "description": "Heartraite npm package for common functionality",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,23 @@
1
+ export enum DQPursuitPhase {
2
+ FIRST_READING = "first_reading",
3
+ FULL = "full",
4
+ }
5
+
6
+ export enum DQPursuitPausedReason {
7
+ BANK = "bank",
8
+ COMPLETE = "complete",
9
+ USER = "user",
10
+ }
11
+
12
+ export enum DQReflectionKind {
13
+ LEARNING = "learning",
14
+ DIRECTION = "direction",
15
+ NONE = "none",
16
+ }
17
+
18
+ export enum DQSetPursuitOutcome {
19
+ STARTED = "started",
20
+ CLEARED = "cleared",
21
+ NOT_ALLOWED = "not_allowed",
22
+ DISABLED = "disabled",
23
+ }
package/src/enum/index.ts CHANGED
@@ -3,6 +3,7 @@ export * from "./ca.enum";
3
3
  export * from "./cloudfunction.enum";
4
4
  export * from "./consultation.enum";
5
5
  export * from "./country.enum";
6
+ export * from "./dq.enum";
6
7
  export * from "./evaluation.enum";
7
8
  export * from "./environment.enum";
8
9
  export * from "./error.enum";
@@ -5,3 +5,68 @@ export enum SACategoryID {
5
5
  LOVE_LANGUAGE = "self_awareness_love_language",
6
6
  VALUES = "self_awareness_values",
7
7
  }
8
+
9
+ export enum SASectionPart {
10
+ INSIGHT = "insight",
11
+ REFLECTION = "reflection",
12
+ TIPS = "tips",
13
+ CHAPTER = "chapter",
14
+ }
15
+
16
+ export enum SAEvidenceBand {
17
+ FEW = "few",
18
+ FAIRLY_CLEAR = "fairly_clear",
19
+ CLEAR = "clear",
20
+ }
21
+
22
+ export enum SAChapterId {
23
+ A = "self_awareness_chapter_a",
24
+ C = "self_awareness_chapter_c",
25
+ I = "self_awareness_chapter_i",
26
+ R = "self_awareness_chapter_r",
27
+ E = "self_awareness_chapter_e",
28
+ G = "self_awareness_chapter_g",
29
+ }
30
+
31
+ export enum SAItemKind {
32
+ CATEGORY = "category",
33
+ CHAPTER = "chapter",
34
+ LETTER = "letter",
35
+ }
36
+
37
+ export enum SAItemAccess {
38
+ FULL = "full",
39
+ DESCRIBED = "described",
40
+ }
41
+
42
+ export enum SAAccessState {
43
+ MEMBER = "member",
44
+ LEGACY = "legacy",
45
+ LAPSED = "lapsed",
46
+ FREE = "free",
47
+ }
48
+
49
+ export enum SAEntitlementGrant {
50
+ FREE = "free",
51
+ MEMBER = "member",
52
+ LEGACY = "legacy",
53
+ PAYONCE = "payonce",
54
+ GRANT = "grant",
55
+ }
56
+
57
+ export enum SAChapterStage {
58
+ FIRST_READING = "first_reading",
59
+ FULL = "full",
60
+ }
61
+
62
+ export enum SAClaimValence {
63
+ NEUTRAL = "neutral",
64
+ STRENGTH = "strength",
65
+ COST = "cost",
66
+ }
67
+
68
+ export enum SAClaimFeedbackValue {
69
+ YES = "yes",
70
+ PARTIAL = "partial",
71
+ NO = "no",
72
+ }
@@ -6,6 +6,14 @@
6
6
  */
7
7
 
8
8
  import { Locale } from "../enum/localization.enum";
9
+ import {
10
+ DQPursuitPausedReason,
11
+ DQPursuitPhase,
12
+ DQReflectionKind,
13
+ DQSetPursuitOutcome,
14
+ } from "../enum/dq.enum";
15
+ import { SAChapterId, SAChapterStage } from "../enum/sa.enum";
16
+ import type { SAReadiness } from "./sa.types";
9
17
 
10
18
  // ========== BASIC TYPES ==========
11
19
 
@@ -170,4 +178,47 @@ export interface GetQuestionResponse {
170
178
 
171
179
  /** User's discovery progress (streaks, counts) */
172
180
  progress?: DiscoveryProgress;
181
+
182
+ pursuit?: DQPursuit;
183
+ }
184
+
185
+ export interface DQPursuit {
186
+ chapterId: SAChapterId;
187
+ phase: DQPursuitPhase;
188
+ startedAt: string;
189
+ pausedReason?: DQPursuitPausedReason;
190
+ readiness?: SAReadiness;
191
+ }
192
+
193
+ export interface DQReflection {
194
+ kind: DQReflectionKind;
195
+ text: string;
196
+ traitId?: string;
197
+ traitName?: string;
198
+ answersOnTrait?: number;
199
+ }
200
+
201
+ export interface DQChapterEvent {
202
+ chapterId: SAChapterId;
203
+ stage: SAChapterStage;
204
+ }
205
+
206
+ export interface DQSubmitAnswerResponse {
207
+ answerId: string;
208
+ nextQuestion: DQQuestion | null;
209
+ progress: DiscoveryProgress;
210
+ quotaExhausted: boolean;
211
+ quotaResetsAt?: string;
212
+ pursuit?: DQPursuit;
213
+ reflection?: DQReflection;
214
+ chapterEvent?: DQChapterEvent;
215
+ }
216
+
217
+ export interface DQSetPursuitRequest {
218
+ chapterId: SAChapterId | null;
219
+ }
220
+
221
+ export interface DQSetPursuitResponse {
222
+ outcome: DQSetPursuitOutcome;
223
+ pursuit: DQPursuit | null;
173
224
  }
@@ -1,4 +1,19 @@
1
+ import {
2
+ LoveLanguageTrait,
3
+ PersonalityTrait,
4
+ SAAccessState,
5
+ SACategoryID,
6
+ SAChapterId,
7
+ SAChapterStage,
8
+ SAClaimFeedbackValue,
9
+ SAClaimValence,
10
+ SAEntitlementGrant,
11
+ SAEvidenceBand,
12
+ SAItemAccess,
13
+ SAItemKind,
14
+ } from "../enum";
1
15
  import { LoveLanguages, Personality } from "./ca.types";
16
+ import type { DQPursuit } from "./dq.types";
2
17
 
3
18
  export type SelfAwareness = {
4
19
  userId: string;
@@ -7,6 +22,8 @@ export type SelfAwareness = {
7
22
  personality: Personality;
8
23
  loveLanguages: LoveLanguages;
9
24
  processing?: boolean;
25
+ readState?: SAReadState;
26
+ evidence?: SAEvidence;
10
27
  };
11
28
 
12
29
  export type SACategory = {
@@ -20,3 +37,154 @@ export type SACategorySection = {
20
37
  reflection: string;
21
38
  tip: string;
22
39
  };
40
+
41
+ export type SASectionReadState = {
42
+ insight?: string;
43
+ reflection?: string;
44
+ tips?: string;
45
+ chapter?: string;
46
+ };
47
+
48
+ export type SACategoryReadState = {
49
+ sections: Record<string, SASectionReadState>;
50
+ };
51
+
52
+ export type SAReadState = {
53
+ firstOpenedAt?: string;
54
+ categories: Record<string, SACategoryReadState>;
55
+ };
56
+
57
+ export type SAEvidenceItem = {
58
+ answers: number;
59
+ band: SAEvidenceBand;
60
+ };
61
+
62
+ export type SAPersonalityEvidence = Record<PersonalityTrait, SAEvidenceItem>;
63
+
64
+ export type SALoveLanguageEvidence = Record<LoveLanguageTrait, SAEvidenceItem>;
65
+
66
+ export type SAEvidence = {
67
+ personality: SAPersonalityEvidence;
68
+ loveLanguages?: SALoveLanguageEvidence;
69
+ };
70
+
71
+ export type SALetterItemId = `self_awareness_letter_${string}`;
72
+
73
+ export type SAItemId = SACategoryID | SAChapterId | SALetterItemId;
74
+
75
+ export type SATraitRef = {
76
+ traitId: string;
77
+ name: string;
78
+ };
79
+
80
+ export type SAReadiness = {
81
+ traitsAt3: number;
82
+ traitsAt4: number;
83
+ traitsTotal: number;
84
+ firstReadingReady: boolean;
85
+ fullReady: boolean;
86
+ writtenParagraphs: number;
87
+ nextTrait?: SATraitRef;
88
+ answersToNextParagraph?: number;
89
+ };
90
+
91
+ export type SAChapterBadge = {
92
+ answers: number;
93
+ traitsAt3: number;
94
+ traitsTotal: number;
95
+ };
96
+
97
+ export type SAClaimFeedback = {
98
+ value: SAClaimFeedbackValue;
99
+ note?: string;
100
+ at: string;
101
+ };
102
+
103
+ export type SAClaim = {
104
+ id: string;
105
+ text: string;
106
+ basis: string[];
107
+ band: SAEvidenceBand;
108
+ valence: SAClaimValence;
109
+ feedback?: SAClaimFeedback;
110
+ rewrittenAt?: string;
111
+ retired?: boolean;
112
+ };
113
+
114
+ export type SAChapterGap = {
115
+ text: string;
116
+ traitId: string;
117
+ answersToClose: number;
118
+ };
119
+
120
+ export type SAChapter = {
121
+ chapterId: SAChapterId;
122
+ version: number;
123
+ stage: SAChapterStage;
124
+ generatedAt: string;
125
+ badge: SAChapterBadge;
126
+ framingId: string;
127
+ framing?: string;
128
+ claims: SAClaim[];
129
+ gap?: SAChapterGap;
130
+ reflection: string;
131
+ practice: string;
132
+ art9OptIn: boolean;
133
+ refreshedAt?: string;
134
+ };
135
+
136
+ export type SAChapters = Partial<Record<SAChapterId, SAChapter>>;
137
+
138
+ export type SAEntitlementStamp = {
139
+ grantedAt: string;
140
+ grantedUnder: SAEntitlementGrant;
141
+ };
142
+
143
+ export type SAEntitlements = Partial<Record<SAItemId, SAEntitlementStamp>>;
144
+
145
+ export type SAArt9OptIn = Partial<Record<SAItemId, boolean>>;
146
+
147
+ export type SAItem = {
148
+ itemId: SAItemId;
149
+ kind: SAItemKind;
150
+ access: SAItemAccess;
151
+ title?: string;
152
+ description?: string;
153
+ framingId?: string;
154
+ framing?: string;
155
+ readiness?: SAReadiness;
156
+ stage?: SAChapterStage;
157
+ writing?: boolean;
158
+ stamped?: boolean;
159
+ pursuable?: boolean;
160
+ };
161
+
162
+ export type SelfAwarenessV2 = SelfAwareness & {
163
+ accessState: SAAccessState;
164
+ items: SAItem[];
165
+ chapters: SAChapters;
166
+ pursuit?: DQPursuit;
167
+ freeChapterId?: SAChapterId;
168
+ freeChapterSwitchUsed?: boolean;
169
+ art9OptIn?: SAArt9OptIn;
170
+ };
171
+
172
+ export type SAClaimFeedbackResponse = {
173
+ claim: SAClaim;
174
+ };
175
+
176
+ export type SASetArt9OptInResponse = {
177
+ art9OptIn: SAArt9OptIn;
178
+ };
179
+
180
+ export type SAClaimFeedbackRequest = {
181
+ chapterId: SAChapterId;
182
+ claimId: string;
183
+ value: SAClaimFeedbackValue;
184
+ note?: string;
185
+ };
186
+
187
+ export type SASetArt9OptInRequest = {
188
+ chapterId: SAChapterId;
189
+ optIn: boolean;
190
+ };