@keak/sdk 1.0.1 → 1.0.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"telemetryService.d.ts","sourceRoot":"","sources":["../../../src/services/telemetry/telemetryService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAkB,MAAM,SAAS,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAMxF,qBAAa,gBAAgB;IACzB,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,gBAAgB,CAAuB;IAE/C;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAoBzC;;OAEG;IACH,OAAO,CAAC,OAAO;IAOf;;OAEG;IACH,OAAO,CAAC,WAAW;IAQnB;;OAEG;IACG,YAAY,CAAC,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IA2BrE;;OAEG;IACH,mBAAmB,IAAI,MAAM,GAAG,IAAI;IAIpC;;OAEG;IACH,UAAU,IAAI,IAAI;IAQlB;;MAEE;IACI,cAAc,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAoC/E;;;OAGG;IACG,oBAAoB,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC;QAC7D,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;KAC9B,CAAC;IAsBF;;;OAGG;IACG,uBAAuB,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IA0C9F,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO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G,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAoC/E;;;OAGG;IACG,oBAAoB,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC;QAC7D,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;KAC9B,CAAC;IAsBF;;;OAGG;IACG,uBAAuB,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IA0C9F,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBxE,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpD,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItD,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA6BvE,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBnD;;OAEG;IACH,OAAO,IAAI,IAAI;IAIf;;OAEG;IACH,MAAM,IAAI,IAAI;CAKjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keak/sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Production-ready A/B testing and experimentation SDK for React applications with visual editing, source mapping, and real-time variant testing",
5
5
  "author": "Keak Team",
6
6
  "homepage": "https://www.keak.com/",
@@ -131,14 +131,14 @@ class LocalAIHelper {
131
131
  result.push(lines[i]);
132
132
 
133
133
  if (i === lastImportLine && !importAdded) {
134
- result.push("import { KeakProvider } from 'keak-sdk';");
134
+ result.push("import { KeakProvider } from '@keak/sdk';");
135
135
  importAdded = true;
136
136
  }
137
137
  }
138
138
 
139
139
  // If no imports found, add at the beginning
140
140
  if (!importAdded) {
141
- result.unshift("import { KeakProvider } from 'keak-sdk';");
141
+ result.unshift("import { KeakProvider } from '@keak/sdk';");
142
142
  }
143
143
 
144
144
  // Now wrap the appropriate component
@@ -19,7 +19,7 @@ class CodeTransformer {
19
19
  this.importAdded = false;
20
20
 
21
21
  // Skip if file already has Conversion imports
22
- if (content.includes('import') && content.includes('Conversion') && content.includes('keak-sdk')) {
22
+ if (content.includes('import') && content.includes('Conversion') && content.includes('@keak/sdk')) {
23
23
  return content;
24
24
  }
25
25
 
@@ -281,7 +281,7 @@ class KeakInstaller {
281
281
  if (!this.entryFile) return false;
282
282
 
283
283
  const content = fs.readFileSync(this.entryFile, 'utf-8');
284
- return content.includes('KeakProvider') || content.includes('keak-sdk');
284
+ return content.includes('KeakProvider') || content.includes('@keak/sdk');
285
285
  }
286
286
 
287
287
  async autoInstall() {
@@ -325,7 +325,7 @@ class KeakInstaller {
325
325
  // Next.js 13+ App Directory
326
326
  if (!content.includes('KeakProvider')) {
327
327
  // Add import - include both KeakProvider and KeakToolbar
328
- const importLine = "import { KeakProvider, KeakToolbar } from 'keak-sdk';\n";
328
+ const importLine = "import { KeakProvider, KeakToolbar } from '@keak/sdk';\n";
329
329
  let modified = content;
330
330
 
331
331
  // Add import after existing imports
@@ -356,7 +356,7 @@ ${bodyContent}
356
356
  // Next.js Pages Directory
357
357
  if (!content.includes('KeakProvider')) {
358
358
  // Add import - include both KeakProvider and KeakToolbar
359
- const importLine = "import { KeakProvider, KeakToolbar } from 'keak-sdk';\n";
359
+ const importLine = "import { KeakProvider, KeakToolbar } from '@keak/sdk';\n";
360
360
  let modified = content;
361
361
 
362
362
  const lastImportIndex = modified.lastIndexOf('import ');
@@ -391,7 +391,7 @@ ${bodyContent}
391
391
 
392
392
  // Add import - include both KeakProvider and KeakToolbar
393
393
  if (!content.includes('KeakProvider')) {
394
- const importLine = "import { KeakProvider, KeakToolbar } from 'keak-sdk';\n";
394
+ const importLine = "import { KeakProvider, KeakToolbar } from '@keak/sdk';\n";
395
395
 
396
396
  const lastImportIndex = modified.lastIndexOf('import ');
397
397
  if (lastImportIndex !== -1) {
@@ -510,7 +510,7 @@ Please add Keak to your app manually:
510
510
  1. Open ${colors.cyan}${relativeEntry}${colors.reset}
511
511
 
512
512
  2. Add this import at the top:
513
- ${colors.green}import { KeakProvider } from 'keak-sdk';${colors.reset}
513
+ ${colors.green}import { KeakProvider } from '@keak/sdk';${colors.reset}
514
514
 
515
515
  3. Wrap your main component:
516
516
  ${colors.green}<KeakProvider config={{ apiKey: 'demo', debug: true }}><YourApp /></KeakProvider>${colors.reset}
@@ -524,7 +524,7 @@ ${this.getFrameworkExample()}
524
524
  const examples = {
525
525
  'nextjs': `
526
526
  // app/layout.tsx
527
- import { KeakProvider } from 'keak-sdk';
527
+ import { KeakProvider } from '@keak/sdk';
528
528
 
529
529
  export default function RootLayout({ children }) {
530
530
  return (
@@ -536,7 +536,7 @@ export default function RootLayout({ children }) {
536
536
  }`,
537
537
  'create-react-app': `
538
538
  // src/index.js
539
- import { KeakProvider } from 'keak-sdk';
539
+ import { KeakProvider } from '@keak/sdk';
540
540
 
541
541
  root.render(
542
542
  <KeakProvider config={{ apiKey: 'demo', debug: true }}>
@@ -545,7 +545,7 @@ root.render(
545
545
  );`,
546
546
  'vite-react': `
547
547
  // src/main.tsx
548
- import { KeakProvider } from 'keak-sdk';
548
+ import { KeakProvider } from '@keak/sdk';
549
549
 
550
550
  ReactDOM.createRoot(document.getElementById('root')).render(
551
551
  <KeakProvider config={{ apiKey: 'demo', debug: true }}>
@@ -113,7 +113,7 @@ class ConversionReverter {
113
113
  let modified = content;
114
114
 
115
115
  // Remove Conversion imports
116
- modified = modified.replace(/import\s*{\s*Conversion\s*}\s*from\s*['"]keak-sdk['"];\s*\n?/g, '');
116
+ modified = modified.replace(/import\s*{\s*Conversion\s*}\s*from\s*['"]@keak\/sdk['"];\s*\n?/g, '');
117
117
 
118
118
  // Remove orphaned Conversion wrapper tags (in case of partial cleanup)
119
119
  modified = modified.replace(/]*\s*\n?/g, '');
@@ -15,7 +15,7 @@ class SafeTransformer {
15
15
  // Safe approach: Only transform simple, well-formed JSX elements
16
16
  transformReactFile(content, filePath) {
17
17
  // Skip if file already has Conversion imports
18
- if (content.includes('import') && content.includes('Conversion') && content.includes('keak-sdk')) {
18
+ if (content.includes('import') && content.includes('Conversion') && content.includes('@keak/sdk')) {
19
19
  return content;
20
20
  }
21
21
 
@@ -188,7 +188,7 @@ class SafeTransformer {
188
188
 
189
189
  // Add import statement safely
190
190
  addImport(content) {
191
- if (content.includes("import { Conversion } from 'keak-sdk'")) {
191
+ if (content.includes("import { Conversion } from '@keak/sdk'")) {
192
192
  return content;
193
193
  }
194
194
 
@@ -227,7 +227,7 @@ class SafeTransformer {
227
227
  }
228
228
  }
229
229
 
230
- lines.splice(insertIndex, 0, "import { Conversion } from 'keak-sdk';");
230
+ lines.splice(insertIndex, 0, "import { Conversion } from '@keak/sdk';");
231
231
  return lines.join('\n');
232
232
  }
233
233
 
@@ -15,7 +15,7 @@ class SimpleTransformer {
15
15
  // Simple approach: Transform React files to add Conversion wrapper using AST-like approach
16
16
  transformReactFile(content, filePath) {
17
17
  // Skip if file already has Conversion imports
18
- if (content.includes('import') && content.includes('Conversion') && content.includes('keak-sdk')) {
18
+ if (content.includes('import') && content.includes('Conversion') && content.includes('@keak/sdk')) {
19
19
  return content;
20
20
  }
21
21
 
@@ -109,7 +109,7 @@ class SimpleTransformer {
109
109
 
110
110
  // Add import statement
111
111
  addImport(content) {
112
- if (content.includes("import { Conversion } from 'keak-sdk'")) {
112
+ if (content.includes("import { Conversion } from '@keak/sdk'")) {
113
113
  return content;
114
114
  }
115
115
 
@@ -8,14 +8,14 @@ Automatically injects `data-keak-src` attributes into JSX elements for precise e
8
8
 
9
9
  ### Installation
10
10
 
11
- The plugin is included with `keak-sdk` - no additional installation needed.
11
+ The plugin is included with `@keak/sdk` - no additional installation needed.
12
12
 
13
13
  ### Usage
14
14
 
15
15
  **For CommonJS (next.config.js):**
16
16
 
17
17
  ```javascript
18
- const { withKeak } = require('keak-sdk/plugins/next');
18
+ const { withKeak } = require('@keak/sdk/plugins/next');
19
19
 
20
20
  /** @type {import('next').NextConfig} */
21
21
  const nextConfig = {
@@ -30,7 +30,7 @@ module.exports = withKeak(nextConfig);
30
30
  **For ES Modules (next.config.mjs):**
31
31
 
32
32
  ```javascript
33
- import { withKeak } from 'keak-sdk/plugins/next';
33
+ import { withKeak } from '@keak/sdk/plugins/next';
34
34
 
35
35
  /** @type {import('next').NextConfig} */
36
36
  const nextConfig = {
@@ -67,7 +67,7 @@ If you have a custom Babel setup:
67
67
  module.exports = {
68
68
  plugins: [
69
69
  [
70
- 'keak-sdk/plugins/babel-source-inject',
70
+ '@keak/sdk/plugins/babel-source-inject',
71
71
  {
72
72
  includeElementIndex: true // Optional
73
73
  }
@@ -90,7 +90,7 @@ export default defineConfig({
90
90
  react({
91
91
  babel: {
92
92
  plugins: [
93
- ['keak-sdk/plugins/babel-source-inject', { includeElementIndex: true }]
93
+ ['@keak/sdk/plugins/babel-source-inject', { includeElementIndex: true }]
94
94
  ]
95
95
  }
96
96
  })
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * Usage in next.config.js:
8
8
  *
9
- * const { withKeak } = require('keak-sdk/plugins/next');
9
+ * const { withKeak } = require('@keak/sdk/plugins/next');
10
10
  *
11
11
  * module.exports = withKeak({
12
12
  * // your existing Next.js config
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * Or for ESM (next.config.mjs):
16
16
  *
17
- * import { withKeak } from 'keak-sdk/plugins/next';
17
+ * import { withKeak } from '@keak/sdk/plugins/next';
18
18
  * export default withKeak({ ... });
19
19
  */
20
20
 
@@ -40,8 +40,8 @@ function withKeak(nextConfig = {}) {
40
40
  paths: [process.cwd()]
41
41
  });
42
42
  } catch (e) {
43
- // Fallback to resolving from keak-sdk's context
44
- console.warn(`[Keak] Could not resolve ${moduleName} from project, falling back to keak-sdk`);
43
+ // Fallback to resolving from @keak/sdk's context
44
+ console.warn(`[Keak] Could not resolve ${moduleName} from project, falling back to @keak/sdk`);
45
45
  return require.resolve(moduleName);
46
46
  }
47
47
  };