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