@vigneshreddy/cms-sdk 1.0.0 → 1.0.2

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 CHANGED
@@ -10,15 +10,7 @@ This SDK is:
10
10
  ## Install
11
11
 
12
12
  ```bash
13
- npm install cms
14
- ```
15
-
16
- ## Publish to npm
17
-
18
- ```bash
19
- npm login
20
- npm run build
21
- npm publish --access public
13
+ npm install @vigneshreddy/cms-sdk
22
14
  ```
23
15
 
24
16
  ## Runtime requirements
@@ -45,7 +37,7 @@ global.Response = Response as any;
45
37
  Create the client once and reuse it across calls.
46
38
 
47
39
  ```ts
48
- import { CMS } from "cms";
40
+ import { CMS } from "@vigneshreddy/cms-sdk";
49
41
 
50
42
  const sdk = new CMS({
51
43
  apiKey: process.env.CMS_API_KEY!,
@@ -58,12 +50,12 @@ const sdk = new CMS({
58
50
  ### Class-based usage (throws on error)
59
51
 
60
52
  ```ts
61
- import { CMS } from "cms";
53
+ import { CMS } from "@vigneshreddy/cms-sdk";
62
54
 
63
55
  const sdk = new CMS({ apiKey: "sk_live_123" });
64
56
 
65
57
  const leadResponse = await sdk.trackLead({
66
- clickId: "dub_123",
58
+ clickId: "id_123",
67
59
  eventName: "signup_started",
68
60
  customerId: "user_42",
69
61
  });
@@ -74,12 +66,12 @@ console.log("Lead response:", leadResponse);
74
66
  ### Functional helper (Result pattern)
75
67
 
76
68
  ```ts
77
- import { CMS, trackLead } from "cms";
69
+ import { CMS, trackLead } from "@vigneshreddy/cms-sdk";
78
70
 
79
71
  const sdk = new CMS({ apiKey: "sk_live_123" });
80
72
 
81
73
  const res = await trackLead(sdk, {
82
- clickId: "dub_123",
74
+ clickId: "id_123",
83
75
  eventName: "signup_started",
84
76
  customerId: "user_42",
85
77
  });
@@ -96,12 +88,12 @@ if (res.ok) {
96
88
  ### Class-based usage (throws on error)
97
89
 
98
90
  ```ts
99
- import { CMS } from "cms";
91
+ import { CMS } from "@vigneshreddy/cms-sdk";
100
92
 
101
93
  const sdk = new CMS({ apiKey: "sk_live_123" });
102
94
 
103
95
  const saleResponse = await sdk.trackSale({
104
- clickId: "dub_123",
96
+ clickId: "id_123",
105
97
  eventName: "purchase_completed",
106
98
  invoiceId: "inv_987",
107
99
  amount: 4999,
@@ -119,7 +111,7 @@ import { CMS, trackSale } from "cms";
119
111
  const sdk = new CMS({ apiKey: "sk_live_123" });
120
112
 
121
113
  const res = await trackSale(sdk, {
122
- clickId: "dub_123",
114
+ clickId: "id_123",
123
115
  eventName: "purchase_completed",
124
116
  invoiceId: "inv_987",
125
117
  amount: 4999,
@@ -158,13 +150,13 @@ export interface CMSConfig {
158
150
  You can override retries and timeout on a single request.
159
151
 
160
152
  ```ts
161
- import { CMS } from "cms";
153
+ import { CMS } from "@vigneshreddy/cms-sdk";
162
154
 
163
155
  const sdk = new CMS({ apiKey: "sk_live_123" });
164
156
 
165
157
  await sdk.trackLead(
166
158
  {
167
- clickId: "dub_123",
159
+ clickId: "id_123",
168
160
  eventName: "signup_started",
169
161
  customerId: "user_42",
170
162
  },
@@ -180,13 +172,13 @@ await sdk.trackLead(
180
172
  All thrown errors from class-based methods are normalized as `CMSAPIError` or its specific subclasses.
181
173
 
182
174
  ```ts
183
- import { CMS, CMSAPIError } from "cms";
175
+ import { CMS, CMSAPIError } from "@vigneshreddy/cms-sdk";
184
176
 
185
177
  const sdk = new CMS({ apiKey: "sk_live_123" });
186
178
 
187
179
  try {
188
180
  await sdk.trackLead({
189
- clickId: "dub_123",
181
+ clickId: "id_123",
190
182
  eventName: "signup_started",
191
183
  customerId: "user_42",
192
184
  });
@@ -206,10 +198,10 @@ try {
206
198
  ## Exports
207
199
 
208
200
  ```ts
209
- import { CMS } from "cms";
210
- import { trackLead, trackSale } from "cms";
211
- import { CMSAPIError } from "cms";
212
- import type { TrackLeadRequest, TrackSaleRequest, TrackResponse } from "cms";
201
+ import { CMS } from "@vigneshreddy/cms-sdk";
202
+ import { trackLead, trackSale } from "@vigneshreddy/cms-sdk";
203
+ import { CMSAPIError } from "@vigneshreddy/cms-sdk";
204
+ import type { TrackLeadRequest, TrackSaleRequest, TrackResponse } from "@vigneshreddy/cms-sdk";
213
205
  ```
214
206
 
215
207
  ## Security
@@ -10,7 +10,7 @@ class CMS {
10
10
  if (!config.apiKey) {
11
11
  throw new Error("CMS SDK: apiKey is required.");
12
12
  }
13
- const basePath = "https://www.cutmeshort.com/api";
13
+ const basePath = "www.app.dev.cutmeshort.com/sdk";
14
14
  // Retry configuration with sensible defaults
15
15
  this.maxRetries = (_a = config.maxRetries) !== null && _a !== void 0 ? _a : 2;
16
16
  this.retryDelayMs = (_b = config.retryDelayMs) !== null && _b !== void 0 ? _b : 500;
package/package.json CHANGED
@@ -1,13 +1,10 @@
1
1
  {
2
2
  "name": "@vigneshreddy/cms-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Official TypeScript SDK for CutMeShort CMS API",
5
-
6
5
  "main": "dist/index.js",
7
6
  "types": "dist/index.d.ts",
8
-
9
7
  "type": "commonjs",
10
-
11
8
  "exports": {
12
9
  ".": {
13
10
  "require": "./dist/index.js",
@@ -26,16 +23,13 @@
26
23
  "types": "./dist/funcs/index.d.ts"
27
24
  }
28
25
  },
29
-
30
26
  "files": [
31
27
  "dist"
32
28
  ],
33
-
34
29
  "scripts": {
35
30
  "build": "tsc -p tsconfig.json",
36
31
  "test": "vitest"
37
32
  },
38
-
39
33
  "keywords": [
40
34
  "cutmeshort",
41
35
  "cms",
@@ -43,22 +37,16 @@
43
37
  "typescript",
44
38
  "api"
45
39
  ],
46
-
47
40
  "repository": {
48
41
  "type": "git",
49
42
  "url": "https://github.com/YOUR_USERNAME/cms-sdk"
50
43
  },
51
-
52
44
  "homepage": "https://github.com/YOUR_USERNAME/cms-sdk#readme",
53
-
54
45
  "publishConfig": {
55
46
  "access": "public"
56
47
  },
57
-
58
48
  "author": "Vignesh Reddy",
59
-
60
49
  "license": "MIT",
61
-
62
50
  "devDependencies": {
63
51
  "typescript": "^5.7.0",
64
52
  "vitest": "^4.0.18"