@codeguide/core 0.0.8 → 0.0.9
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/codeguide.d.ts +2 -1
- package/dist/codeguide.js +1 -0
- package/dist/services/cancellation-funnel/cancellation-funnel-service.d.ts +163 -0
- package/dist/services/cancellation-funnel/cancellation-funnel-service.js +85 -0
- package/dist/services/cancellation-funnel/index.d.ts +1 -0
- package/dist/services/cancellation-funnel/index.js +5 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.js +4 -1
- package/dist/types.d.ts +55 -0
- package/package.json +1 -1
- package/services/cancellation-funnel/cancellation-funnel-service.ts +1 -1
package/dist/codeguide.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GenerationService, ProjectService, UsageService, RepositoryAnalysisService, TaskService, ApiKeyEnhancedService, SubscriptionService } from './services';
|
|
1
|
+
import { GenerationService, ProjectService, UsageService, RepositoryAnalysisService, TaskService, ApiKeyEnhancedService, SubscriptionService, CancellationFunnelService } from './services';
|
|
2
2
|
import { APIServiceConfig, CodeGuideOptions } from './types';
|
|
3
3
|
export declare class CodeGuide {
|
|
4
4
|
generation: GenerationService;
|
|
@@ -8,6 +8,7 @@ export declare class CodeGuide {
|
|
|
8
8
|
tasks: TaskService;
|
|
9
9
|
apiKeyEnhanced: ApiKeyEnhancedService;
|
|
10
10
|
subscription: SubscriptionService;
|
|
11
|
+
cancellationFunnel: CancellationFunnelService;
|
|
11
12
|
private options;
|
|
12
13
|
constructor(config: APIServiceConfig, options?: CodeGuideOptions);
|
|
13
14
|
getGuidance(prompt: string): Promise<any>;
|
package/dist/codeguide.js
CHANGED
|
@@ -23,6 +23,7 @@ class CodeGuide {
|
|
|
23
23
|
this.tasks = new services_1.TaskService(config);
|
|
24
24
|
this.apiKeyEnhanced = new services_1.ApiKeyEnhancedService(config);
|
|
25
25
|
this.subscription = new services_1.SubscriptionService(config);
|
|
26
|
+
this.cancellationFunnel = new services_1.CancellationFunnelService(config);
|
|
26
27
|
}
|
|
27
28
|
// Convenience method for backward compatibility
|
|
28
29
|
async getGuidance(prompt) {
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { BaseService } from '../base/base-service';
|
|
2
|
+
import { CancellationFunnelInitiateRequest, CancellationFunnelInitiateResponse, CancellationFunnelPauseOfferRequest, CancellationFunnelPauseOfferResponse, CancellationFunnelSurveyRequest, CancellationFunnelSurveyResponse } from '../../types';
|
|
3
|
+
export declare class CancellationFunnelService extends BaseService {
|
|
4
|
+
constructor(config: any);
|
|
5
|
+
/**
|
|
6
|
+
* Initiate Cancellation Flow
|
|
7
|
+
* POST /cancellation-funnel/initiate
|
|
8
|
+
*/
|
|
9
|
+
initiateCancellation(request: CancellationFunnelInitiateRequest): Promise<CancellationFunnelInitiateResponse>;
|
|
10
|
+
/**
|
|
11
|
+
* Log Pause Offer Response
|
|
12
|
+
* POST /cancellation-funnel/pause-offer
|
|
13
|
+
*/
|
|
14
|
+
logPauseOfferResponse(request: CancellationFunnelPauseOfferRequest): Promise<CancellationFunnelPauseOfferResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Log Survey Response
|
|
17
|
+
* POST /cancellation-funnel/survey
|
|
18
|
+
*/
|
|
19
|
+
logSurveyResponse(request: CancellationFunnelSurveyRequest): Promise<CancellationFunnelSurveyResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Get Cancellation Funnel Status
|
|
22
|
+
* GET /cancellation-funnel/{subscription_id}/status
|
|
23
|
+
*/
|
|
24
|
+
getCancellationFunnelStatus(subscriptionId: string): Promise<{
|
|
25
|
+
status: string;
|
|
26
|
+
data: {
|
|
27
|
+
funnel_id: string;
|
|
28
|
+
subscription_id: string;
|
|
29
|
+
current_step: string;
|
|
30
|
+
initiated_at: string;
|
|
31
|
+
pause_offer_response?: {
|
|
32
|
+
action: 'accepted' | 'declined';
|
|
33
|
+
pause_duration_months?: number;
|
|
34
|
+
responded_at: string;
|
|
35
|
+
};
|
|
36
|
+
survey_response?: {
|
|
37
|
+
reason: string;
|
|
38
|
+
feedback?: string;
|
|
39
|
+
competitor_name?: string;
|
|
40
|
+
submitted_at: string;
|
|
41
|
+
};
|
|
42
|
+
is_completed: boolean;
|
|
43
|
+
completed_at?: string;
|
|
44
|
+
};
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Get Available Cancellation Offers
|
|
48
|
+
* GET /cancellation-funnel/{subscription_id}/offers
|
|
49
|
+
*/
|
|
50
|
+
getAvailableOffers(subscriptionId: string): Promise<{
|
|
51
|
+
status: string;
|
|
52
|
+
data: {
|
|
53
|
+
subscription_id: string;
|
|
54
|
+
available_offers: Array<{
|
|
55
|
+
type: 'pause' | 'discount' | 'downgrade' | 'feature_change';
|
|
56
|
+
title: string;
|
|
57
|
+
description: string;
|
|
58
|
+
details?: Record<string, any>;
|
|
59
|
+
valid_until?: string;
|
|
60
|
+
}>;
|
|
61
|
+
eligibility_check: {
|
|
62
|
+
is_eligible: boolean;
|
|
63
|
+
reasons?: string[];
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
}>;
|
|
67
|
+
/**
|
|
68
|
+
* Complete Cancellation Funnel
|
|
69
|
+
* POST /cancellation-funnel/{subscription_id}/complete
|
|
70
|
+
*/
|
|
71
|
+
completeCancellationFunnel(subscriptionId: string, finalAction: 'cancel' | 'retain'): Promise<{
|
|
72
|
+
status: string;
|
|
73
|
+
message: string;
|
|
74
|
+
data: {
|
|
75
|
+
funnel_id: string;
|
|
76
|
+
subscription_id: string;
|
|
77
|
+
final_action: 'cancel' | 'retain';
|
|
78
|
+
completed_at: string;
|
|
79
|
+
outcome: {
|
|
80
|
+
subscription_cancelled: boolean;
|
|
81
|
+
effective_date?: string;
|
|
82
|
+
retention_action?: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* Get Cancellation Reasons (for survey dropdown)
|
|
88
|
+
* GET /cancellation-funnel/reasons
|
|
89
|
+
*/
|
|
90
|
+
getCancellationReasons(): Promise<{
|
|
91
|
+
status: string;
|
|
92
|
+
data: Array<{
|
|
93
|
+
id: string;
|
|
94
|
+
label: string;
|
|
95
|
+
description: string;
|
|
96
|
+
requires_feedback: boolean;
|
|
97
|
+
requires_competitor: boolean;
|
|
98
|
+
category: 'pricing' | 'features' | 'usability' | 'support' | 'other';
|
|
99
|
+
}>;
|
|
100
|
+
}>;
|
|
101
|
+
/**
|
|
102
|
+
* Save Funnel Progress (for multi-step funnels)
|
|
103
|
+
* PUT /cancellation-funnel/{subscription_id}/progress
|
|
104
|
+
*/
|
|
105
|
+
saveFunnelProgress(subscriptionId: string, progress: {
|
|
106
|
+
current_step: string;
|
|
107
|
+
step_data?: Record<string, any>;
|
|
108
|
+
completed_steps: string[];
|
|
109
|
+
}): Promise<{
|
|
110
|
+
status: string;
|
|
111
|
+
message: string;
|
|
112
|
+
data: {
|
|
113
|
+
funnel_id: string;
|
|
114
|
+
subscription_id: string;
|
|
115
|
+
progress: {
|
|
116
|
+
current_step: string;
|
|
117
|
+
step_data?: Record<string, any>;
|
|
118
|
+
completed_steps: string[];
|
|
119
|
+
last_updated: string;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
}>;
|
|
123
|
+
/**
|
|
124
|
+
* Skip Funnel Step (for optional steps)
|
|
125
|
+
* POST /cancellation-funnel/{subscription_id}/skip-step
|
|
126
|
+
*/
|
|
127
|
+
skipFunnelStep(subscriptionId: string, stepToSkip: string): Promise<{
|
|
128
|
+
status: string;
|
|
129
|
+
message: string;
|
|
130
|
+
data: {
|
|
131
|
+
funnel_id: string;
|
|
132
|
+
subscription_id: string;
|
|
133
|
+
skipped_step: string;
|
|
134
|
+
next_step: string;
|
|
135
|
+
progress_updated_at: string;
|
|
136
|
+
};
|
|
137
|
+
}>;
|
|
138
|
+
/**
|
|
139
|
+
* Get Retention Offers (based on cancellation reason)
|
|
140
|
+
* GET /cancellation-funnel/{subscription_id}/retention-offers
|
|
141
|
+
*/
|
|
142
|
+
getRetentionOffers(subscriptionId: string, reason?: string): Promise<{
|
|
143
|
+
status: string;
|
|
144
|
+
data: {
|
|
145
|
+
subscription_id: string;
|
|
146
|
+
cancellation_reason?: string;
|
|
147
|
+
retention_offers: Array<{
|
|
148
|
+
id: string;
|
|
149
|
+
type: 'discount' | 'upgrade' | 'extension' | 'feature_unlock';
|
|
150
|
+
title: string;
|
|
151
|
+
description: string;
|
|
152
|
+
value: {
|
|
153
|
+
amount?: number;
|
|
154
|
+
percentage?: number;
|
|
155
|
+
duration?: string;
|
|
156
|
+
features?: string[];
|
|
157
|
+
};
|
|
158
|
+
expiration_date?: string;
|
|
159
|
+
auto_apply: boolean;
|
|
160
|
+
}>;
|
|
161
|
+
};
|
|
162
|
+
}>;
|
|
163
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CancellationFunnelService = void 0;
|
|
4
|
+
const base_service_1 = require("../base/base-service");
|
|
5
|
+
class CancellationFunnelService extends base_service_1.BaseService {
|
|
6
|
+
constructor(config) {
|
|
7
|
+
super(config);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Initiate Cancellation Flow
|
|
11
|
+
* POST /cancellation-funnel/initiate
|
|
12
|
+
*/
|
|
13
|
+
async initiateCancellation(request) {
|
|
14
|
+
return this.post('/cancellation-funnel/initiate', request);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Log Pause Offer Response
|
|
18
|
+
* POST /cancellation-funnel/pause-offer
|
|
19
|
+
*/
|
|
20
|
+
async logPauseOfferResponse(request) {
|
|
21
|
+
return this.post('/cancellation-funnel/pause-offer', request);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Log Survey Response
|
|
25
|
+
* POST /cancellation-funnel/survey
|
|
26
|
+
*/
|
|
27
|
+
async logSurveyResponse(request) {
|
|
28
|
+
return this.post('/cancellation-funnel/survey', request);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get Cancellation Funnel Status
|
|
32
|
+
* GET /cancellation-funnel/{subscription_id}/status
|
|
33
|
+
*/
|
|
34
|
+
async getCancellationFunnelStatus(subscriptionId) {
|
|
35
|
+
return this.get(`/cancellation-funnel/${subscriptionId}/status`);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Get Available Cancellation Offers
|
|
39
|
+
* GET /cancellation-funnel/{subscription_id}/offers
|
|
40
|
+
*/
|
|
41
|
+
async getAvailableOffers(subscriptionId) {
|
|
42
|
+
return this.get(`/cancellation-funnel/${subscriptionId}/offers`);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Complete Cancellation Funnel
|
|
46
|
+
* POST /cancellation-funnel/{subscription_id}/complete
|
|
47
|
+
*/
|
|
48
|
+
async completeCancellationFunnel(subscriptionId, finalAction) {
|
|
49
|
+
return this.post(`/cancellation-funnel/${subscriptionId}/complete`, {
|
|
50
|
+
final_action: finalAction,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get Cancellation Reasons (for survey dropdown)
|
|
55
|
+
* GET /cancellation-funnel/reasons
|
|
56
|
+
*/
|
|
57
|
+
async getCancellationReasons() {
|
|
58
|
+
return this.get('/cancellation-funnel/reasons');
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Save Funnel Progress (for multi-step funnels)
|
|
62
|
+
* PUT /cancellation-funnel/{subscription_id}/progress
|
|
63
|
+
*/
|
|
64
|
+
async saveFunnelProgress(subscriptionId, progress) {
|
|
65
|
+
return this.put(`/cancellation-funnel/${subscriptionId}/progress`, progress);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Skip Funnel Step (for optional steps)
|
|
69
|
+
* POST /cancellation-funnel/{subscription_id}/skip-step
|
|
70
|
+
*/
|
|
71
|
+
async skipFunnelStep(subscriptionId, stepToSkip) {
|
|
72
|
+
return this.post(`/cancellation-funnel/${subscriptionId}/skip-step`, {
|
|
73
|
+
step_to_skip: stepToSkip,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get Retention Offers (based on cancellation reason)
|
|
78
|
+
* GET /cancellation-funnel/{subscription_id}/retention-offers
|
|
79
|
+
*/
|
|
80
|
+
async getRetentionOffers(subscriptionId, reason) {
|
|
81
|
+
const params = reason ? `?reason=${encodeURIComponent(reason)}` : '';
|
|
82
|
+
return this.get(`/cancellation-funnel/${subscriptionId}/retention-offers${params}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.CancellationFunnelService = CancellationFunnelService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CancellationFunnelService } from './cancellation-funnel-service';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CancellationFunnelService = void 0;
|
|
4
|
+
var cancellation_funnel_service_1 = require("./cancellation-funnel-service");
|
|
5
|
+
Object.defineProperty(exports, "CancellationFunnelService", { enumerable: true, get: function () { return cancellation_funnel_service_1.CancellationFunnelService; } });
|
package/dist/services/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { RepositoryAnalysisService } from './repository-analysis';
|
|
|
6
6
|
export { TaskService } from './tasks';
|
|
7
7
|
export { ApiKeyEnhancedService } from './api-key-enhanced';
|
|
8
8
|
export { SubscriptionService } from './subscriptions';
|
|
9
|
+
export { CancellationFunnelService } from './cancellation-funnel';
|
|
9
10
|
export * from './generation';
|
|
10
11
|
export * from './projects';
|
|
11
12
|
export * from './usage';
|
|
@@ -13,3 +14,4 @@ export * from './repository-analysis';
|
|
|
13
14
|
export * from './tasks';
|
|
14
15
|
export * from './api-key-enhanced';
|
|
15
16
|
export * from './subscriptions';
|
|
17
|
+
export * from './cancellation-funnel';
|
package/dist/services/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.SubscriptionService = exports.ApiKeyEnhancedService = exports.TaskService = exports.RepositoryAnalysisService = exports.UsageService = exports.ProjectService = exports.GenerationService = exports.BaseService = void 0;
|
|
20
|
+
exports.CancellationFunnelService = exports.SubscriptionService = exports.ApiKeyEnhancedService = exports.TaskService = exports.RepositoryAnalysisService = exports.UsageService = exports.ProjectService = exports.GenerationService = exports.BaseService = void 0;
|
|
21
21
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
22
22
|
const path_1 = __importDefault(require("path"));
|
|
23
23
|
// Load environment variables from project root
|
|
@@ -41,6 +41,8 @@ var api_key_enhanced_1 = require("./api-key-enhanced");
|
|
|
41
41
|
Object.defineProperty(exports, "ApiKeyEnhancedService", { enumerable: true, get: function () { return api_key_enhanced_1.ApiKeyEnhancedService; } });
|
|
42
42
|
var subscriptions_1 = require("./subscriptions");
|
|
43
43
|
Object.defineProperty(exports, "SubscriptionService", { enumerable: true, get: function () { return subscriptions_1.SubscriptionService; } });
|
|
44
|
+
var cancellation_funnel_1 = require("./cancellation-funnel");
|
|
45
|
+
Object.defineProperty(exports, "CancellationFunnelService", { enumerable: true, get: function () { return cancellation_funnel_1.CancellationFunnelService; } });
|
|
44
46
|
// Re-export all types for convenience
|
|
45
47
|
__exportStar(require("./generation"), exports);
|
|
46
48
|
__exportStar(require("./projects"), exports);
|
|
@@ -49,3 +51,4 @@ __exportStar(require("./repository-analysis"), exports);
|
|
|
49
51
|
__exportStar(require("./tasks"), exports);
|
|
50
52
|
__exportStar(require("./api-key-enhanced"), exports);
|
|
51
53
|
__exportStar(require("./subscriptions"), exports);
|
|
54
|
+
__exportStar(require("./cancellation-funnel"), exports);
|
package/dist/types.d.ts
CHANGED
|
@@ -150,3 +150,58 @@ export interface CancelSubscriptionResponse {
|
|
|
150
150
|
message: string;
|
|
151
151
|
data: Subscription;
|
|
152
152
|
}
|
|
153
|
+
export interface CancellationFunnelInitiateRequest {
|
|
154
|
+
subscription_id: string;
|
|
155
|
+
}
|
|
156
|
+
export interface CancellationFunnelInitiateResponse {
|
|
157
|
+
status: string;
|
|
158
|
+
message: string;
|
|
159
|
+
data: {
|
|
160
|
+
funnel_id: string;
|
|
161
|
+
subscription_id: string;
|
|
162
|
+
current_step: 'initiated';
|
|
163
|
+
created_at: string;
|
|
164
|
+
available_offers: string[];
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
export interface CancellationFunnelPauseOfferRequest {
|
|
168
|
+
subscription_id: string;
|
|
169
|
+
action: 'accepted' | 'declined';
|
|
170
|
+
pause_duration_months?: number;
|
|
171
|
+
}
|
|
172
|
+
export interface CancellationFunnelPauseOfferResponse {
|
|
173
|
+
status: string;
|
|
174
|
+
message: string;
|
|
175
|
+
data: {
|
|
176
|
+
funnel_id: string;
|
|
177
|
+
subscription_id: string;
|
|
178
|
+
pause_offer: {
|
|
179
|
+
action: 'accepted' | 'declined';
|
|
180
|
+
pause_duration_months?: number;
|
|
181
|
+
pause_start_date?: string;
|
|
182
|
+
pause_end_date?: string;
|
|
183
|
+
};
|
|
184
|
+
next_step: string;
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
export interface CancellationFunnelSurveyRequest {
|
|
188
|
+
subscription_id: string;
|
|
189
|
+
reason: string;
|
|
190
|
+
feedback?: string;
|
|
191
|
+
competitor_name?: string;
|
|
192
|
+
}
|
|
193
|
+
export interface CancellationFunnelSurveyResponse {
|
|
194
|
+
status: string;
|
|
195
|
+
message: string;
|
|
196
|
+
data: {
|
|
197
|
+
funnel_id: string;
|
|
198
|
+
subscription_id: string;
|
|
199
|
+
survey_response: {
|
|
200
|
+
reason: string;
|
|
201
|
+
feedback?: string;
|
|
202
|
+
competitor_name?: string;
|
|
203
|
+
submitted_at: string;
|
|
204
|
+
};
|
|
205
|
+
next_step: string;
|
|
206
|
+
};
|
|
207
|
+
}
|
package/package.json
CHANGED