make-mp-data 3.0.1 → 3.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.
Files changed (50) hide show
  1. package/dungeons/adspend.js +35 -1
  2. package/dungeons/anon.js +25 -1
  3. package/dungeons/{array-of-object-loopup.js → array-of-object-lookup.js} +28 -8
  4. package/dungeons/benchmark-heavy.js +2 -2
  5. package/dungeons/benchmark-light.js +2 -2
  6. package/dungeons/big.js +2 -2
  7. package/dungeons/business.js +59 -12
  8. package/dungeons/complex.js +34 -1
  9. package/dungeons/copilot.js +1 -1
  10. package/dungeons/{harness/harness-education.js → education.js} +29 -12
  11. package/dungeons/experiments.js +15 -2
  12. package/dungeons/{harness/harness-fintech.js → fintech.js} +8 -8
  13. package/dungeons/foobar.js +33 -1
  14. package/dungeons/{harness/harness-food.js → food.js} +7 -4
  15. package/dungeons/funnels.js +38 -1
  16. package/dungeons/gaming.js +25 -5
  17. package/dungeons/media.js +861 -271
  18. package/dungeons/mil.js +29 -2
  19. package/dungeons/mirror.js +33 -1
  20. package/dungeons/{kurby.js → retention-cadence.js} +1 -1
  21. package/dungeons/{harness/harness-gaming.js → rpg.js} +5 -5
  22. package/dungeons/sanity.js +31 -2
  23. package/dungeons/{harness/harness-sass.js → sass.js} +2 -2
  24. package/dungeons/scd.js +46 -1
  25. package/dungeons/simple.js +1 -1
  26. package/dungeons/{harness/harness-social.js → social.js} +2 -2
  27. package/dungeons/streaming.js +373 -0
  28. package/dungeons/strict-event-test.js +1 -1
  29. package/dungeons/student-teacher.js +18 -5
  30. package/dungeons/text-generation.js +38 -1
  31. package/dungeons/too-big-events.js +38 -1
  32. package/dungeons/{userAgent.js → user-agent.js} +21 -1
  33. package/entry.js +5 -4
  34. package/lib/utils/logger.js +0 -4
  35. package/package.json +1 -4
  36. package/dungeons/ai-chat-analytics-ed.js +0 -275
  37. package/dungeons/clinch-agi.js +0 -632
  38. package/dungeons/ecommerce-store.js +0 -0
  39. package/dungeons/harness/harness-media.js +0 -961
  40. package/dungeons/money2020-ed-also.js +0 -277
  41. package/dungeons/money2020-ed.js +0 -580
  42. package/dungeons/uday-schema.json +0 -220
  43. package/lib/templates/funnels-instructions.txt +0 -272
  44. package/lib/templates/hook-examples.json +0 -187
  45. package/lib/templates/hooks-instructions.txt +0 -721
  46. package/lib/templates/refine-instructions.txt +0 -485
  47. package/lib/templates/schema-instructions.txt +0 -285
  48. package/lib/utils/ai.js +0 -896
  49. package/lib/utils/mixpanel.js +0 -101
  50. package/lib/utils/project.js +0 -167
@@ -1,580 +0,0 @@
1
-
2
-
3
- import dayjs from "dayjs";
4
- import utc from "dayjs/plugin/utc.js";
5
- import "dotenv/config";
6
- import { weighNumRange, range, date, initChance, exhaust, choose, integer, decimal } from "../lib/utils/utils.js";
7
-
8
- const SEED = "thank sup hello 2020 money!!!";
9
- dayjs.extend(utc);
10
- const chance = initChance(SEED);
11
- const num_users = 10;
12
- const days = 100;
13
-
14
- /** @typedef {import("../types.js").Dungeon} Dungeon */
15
-
16
- /** @type {Dungeon} */
17
- const dungeon = {
18
- token: process.env.MASTER_PROJECT_TOKEN || "",
19
- seed: SEED,
20
- numDays: days,
21
- numEvents: num_users * 120,
22
- numUsers: num_users,
23
- hasAnonIds: false,
24
- hasSessionIds: false,
25
- format: "json",
26
- alsoInferFunnels: false,
27
- hasLocation: true,
28
- hasAndroidDevices: false,
29
- hasIOSDevices: false,
30
- hasDesktopDevices: true,
31
- hasBrowser: true,
32
- hasCampaigns: true,
33
- isAnonymous: false,
34
- hasAdSpend: true,
35
-
36
- hasAvatar: true,
37
- makeChart: false,
38
-
39
- batchSize: 2_500_000,
40
- concurrency: 1,
41
- writeToDisk: false,
42
- superProps: {
43
- version: "2"
44
- },
45
- // AI-generated schema content:
46
- funnels: [
47
- {
48
- "name": "User Onboarding",
49
- "sequence": [
50
- "App Opened",
51
- "View Balance",
52
- "Add Contact"
53
- ],
54
- "weight": 10,
55
- "isFirstFunnel": true,
56
- "conversionRate": 80,
57
- "timeToConvert": 0.1,
58
- "order": "sequential"
59
- },
60
- {
61
- "name": "Standard Money Transfer",
62
- "sequence": [
63
- "App Opened",
64
- "View Balance",
65
- "Initiate Transfer",
66
- "Send Money"
67
- ],
68
-
69
- "weight": 20,
70
- "conversionRate": 65,
71
- "timeToConvert": 0.2,
72
- "order": "first-and-last-fixed",
73
- "experiment": true,
74
- "conditions": {
75
- "account_tier": [
76
- "Basic",
77
- "Plus"
78
- ]
79
- }
80
- },
81
- {
82
- "name": "Premium Money Transfer",
83
- "sequence": [
84
- "App Opened",
85
- "View Balance",
86
- "Initiate Transfer",
87
- "Send Money"
88
- ],
89
- experiment: true,
90
- "weight": 15,
91
- "conversionRate": 90,
92
- "timeToConvert": 0.1,
93
- "order": "sequential",
94
- "conditions": {
95
- "account_tier": "Premium"
96
- },
97
- "props": {
98
- "is_priority_transfer": true
99
- }
100
- },
101
- {
102
- "name": "Get Financial Advice",
103
- "sequence": [
104
- "App Opened",
105
- "Prompt AI Chatbot"
106
- ],
107
- "weight": 8,
108
- "conversionRate": 95,
109
- "timeToConvert": 0.1,
110
- "order": "sequential"
111
- },
112
- {
113
- "name": "Review and Save Transaction",
114
- "sequence": [
115
- "App Opened",
116
- "View Transaction History",
117
- "Print Receipt"
118
- ],
119
- "weight": 12,
120
- "conversionRate": 50,
121
- "timeToConvert": 0.5,
122
- "order": "random"
123
- },
124
-
125
- {
126
- name: "Sign Up",
127
- sequence: [
128
- "Page View",
129
- "Sign Up"
130
- ],
131
- isFirstFunnel: true,
132
- conversionRate: 20,
133
- timeToConvert: 10,
134
- order: "sequential"
135
- },
136
- {
137
- name: "AI Interaction",
138
- sequence: [
139
- "Launch AI",
140
- "AI Prompt Sent",
141
- "AI Response Sent",
142
- "User Feedback",
143
- "AI Dismissed"
144
- ],
145
- experiment: true,
146
- isFirstFunnel: false,
147
- conversionRate: 38,
148
- timeToConvert: 5,
149
- order: "sequential",
150
- weight: 7,
151
- props: { "AI Model": ["5-turbo", "5-flash", "5-flagship", "homegrown"] }
152
- },
153
- {
154
- name: "AI Interaction Errors",
155
- sequence: [
156
- "Launch AI",
157
- "AI Prompt Sent",
158
- "AI Response Sent",
159
- "API Error",
160
- "User Feedback",
161
- "AI Dismissed"
162
- ],
163
- isFirstFunnel: false,
164
- conversionRate: 27,
165
- timeToConvert: 5,
166
- order: "sequential",
167
- weight: 3,
168
- props: { "AI Model": ["5-turbo", "5-flash", "5-flagship", "homegrown"] }
169
- }
170
- ],
171
- events: [
172
- {
173
- "event": "Page View",
174
- "weight": 15,
175
- "isFirstEvent": true,
176
- "properties": {
177
- "page_url": [
178
- "/",
179
- "/features",
180
- "/pricing",
181
- "/about",
182
- "/contact"
183
- ]
184
- }
185
- },
186
- {
187
- "event": "App Opened",
188
- "weight": 10,
189
- "isFirstEvent": true,
190
- "properties": {
191
- "platform": [
192
- "iOS",
193
- "Android",
194
- "Web"
195
- ],
196
- "app_version": [
197
- "2.1.0",
198
- "2.1.1",
199
- "2.2.0",
200
- "2.0.5"
201
- ]
202
- }
203
- },
204
- {
205
- "event": "View Balance",
206
- "weight": 8,
207
- "properties": {
208
- "account_type": [
209
- "Checking",
210
- "Savings",
211
- "Credit"
212
- ],
213
- "currency": [
214
- "USD",
215
- "EUR",
216
- "GBP",
217
- "JPY"
218
- ]
219
- }
220
- },
221
- {
222
- "event": "Initiate Transfer",
223
- "weight": 6,
224
- "properties": {
225
- "transfer_method": [
226
- "Bank Transfer",
227
- "Peer-to-Peer",
228
- "Card Payment"
229
- ],
230
- "is_international": [
231
- true,
232
- false,
233
- false
234
- ]
235
- }
236
- },
237
- {
238
- "event": "Send Money",
239
- "weight": 5,
240
- "properties": {
241
- "amount": weighNumRange(10, 5000, 0.3),
242
- "currency": [
243
- "USD",
244
- "EUR",
245
- "GBP",
246
- "JPY",
247
- "CAD"
248
- ],
249
- "fee_amount": weighNumRange(0, 50, 0.1),
250
- "transfer_speed": [
251
- "Instant",
252
- "Standard",
253
- "Economy"
254
- ]
255
- }
256
- },
257
- {
258
- "event": "Add Contact",
259
- "weight": 3,
260
- "properties": {
261
- "contact_method": [
262
- "Phone Number",
263
- "Email",
264
- "Username"
265
- ],
266
- "is_verified_user": [
267
- true,
268
- true,
269
- false
270
- ]
271
- }
272
- },
273
- {
274
- "event": "Print Receipt",
275
- "weight": 2,
276
- "properties": {
277
- "transaction_id": chance.guid.bind(chance),
278
- "format": [
279
- "PDF",
280
- "Image",
281
- "Text"
282
- ]
283
- }
284
- },
285
- {
286
- "event": "Prompt AI Chatbot",
287
- "weight": 4,
288
- "properties": {
289
- "prompt_topic": [
290
- "Budgeting",
291
- "Investment Advice",
292
- "Savings Goals",
293
- "Credit Score",
294
- "Fraud Prevention"
295
- ],
296
- "prompt_length": weighNumRange(10, 200),
297
- "response_quality_rating": weighNumRange(1, 5)
298
- }
299
- },
300
- {
301
- "event": "View Transaction History",
302
- "weight": 7,
303
- "properties": {
304
- "time_range": [
305
- "Last 7 Days",
306
- "Last 30 Days",
307
- "Last 90 Days",
308
- "All Time"
309
- ],
310
- "filter_by": [
311
- "Sent",
312
- "Received",
313
- "Failed",
314
- "None"
315
- ]
316
- }
317
- },
318
- {
319
- "event": "Request Money",
320
- "weight": 3,
321
- "properties": {
322
- "amount": weighNumRange(5, 1000, 0.4),
323
- "currency": [
324
- "USD",
325
- "EUR",
326
- "GBP"
327
- ],
328
- "request_status": [
329
- "Pending",
330
- "Accepted",
331
- "Declined"
332
- ]
333
- }
334
- },
335
- {
336
- "event": "Account Deactivated",
337
- "weight": 1,
338
- "isChurnEvent": true,
339
- "properties": {
340
- "reason": [
341
- "Switched to competitor",
342
- "Security concerns",
343
- "Poor user experience",
344
- "No longer needed"
345
- ]
346
- }
347
- },
348
-
349
- {
350
- event: "Sign Up",
351
- isFirstEvent: true,
352
- weight: 0,
353
- properties: {
354
- signup_method: [
355
- "email",
356
- "google",
357
- "github"
358
- ]
359
- }
360
- },
361
- {
362
- event: "Purchase",
363
- weight: 40,
364
- properties: {
365
- amount: weighNumRange(20, 500, 0.3),
366
- currency: [
367
- "USD",
368
- "EUR",
369
- "GBP"
370
- ],
371
- item_count: weighNumRange(1, 10)
372
- }
373
- },
374
- {
375
- event: "Launch AI",
376
- weight: 2,
377
- properties: {
378
- entry_point: [
379
- "dashboard_widget",
380
- "header_button",
381
- "in_app_prompt"
382
- ]
383
- }
384
- },
385
- {
386
- event: "AI Prompt Sent",
387
- weight: 10,
388
- properties: {
389
- prompt: [
390
- "how can I make a dashboard?",
391
- "what is a funnel?",
392
- "what drives new users?",
393
- "show me my top performing campaigns",
394
- "compare user retention by country"
395
- ],
396
- prompt_length: weighNumRange(15, 150)
397
- }
398
- },
399
- {
400
- event: "AI Response Sent",
401
- weight: 10,
402
- properties: {
403
- cost: weighNumRange(1, 10, 0.2),
404
- tokens: weighNumRange(100, 1000, 0.4),
405
- time_to_generate_ms: weighNumRange(1000, 10000, 0.2)
406
- }
407
- },
408
- {
409
- event: "User Feedback",
410
- weight: 4,
411
- properties: {
412
- feedback: [
413
- "I love it!",
414
- "meh...",
415
- "This sucks",
416
- "Fine"
417
- ],
418
- sentiment: [
419
- "thumbs up",
420
- "thumbs down"
421
- ]
422
- }
423
- },
424
- {
425
- event: "AI Dismissed",
426
- weight: 2,
427
- properties: {
428
- reason: [
429
- "finished",
430
- "clicked_away",
431
- "new_prompt",
432
- "error"
433
- ]
434
- }
435
- },
436
- {
437
- event: "API Error",
438
- weight: 2,
439
- properties: {
440
- error_code: [
441
- 400,
442
- 401,
443
- 429,
444
- 500,
445
- 503
446
- ],
447
- error_message: [
448
- "Bad Request",
449
- "Unauthorized",
450
- "Too Many Requests",
451
- "Internal Server Error",
452
- "Service Unavailable"
453
- ]
454
- }
455
- }
456
- ],
457
- userProps: {
458
- plan_type: [
459
- "free",
460
- "pro",
461
- "pro",
462
- "enterprise",
463
- "free"
464
- ],
465
- company_size: [
466
- "1-10",
467
- "11-50",
468
- "51-200",
469
- "201-1000",
470
- "1000+"
471
- ],
472
- account_tier: [
473
- "Basic",
474
- "Plus",
475
- "Premium",
476
- ],
477
- created_date: date(365, true, 'YYYY-MM-DD')
478
- },
479
-
480
- hook: function (record, type, meta) {
481
- const NOW = dayjs();
482
- const DATE_HOMEGROWN_LAUNCH = NOW.subtract(25, 'day');
483
- const DATE_HOMEGROWN_IMPROVEMENT = NOW.subtract(10, 'day');
484
- const OVER_THINGS_GET_BETTER = NOW.subtract(30, 'day');
485
-
486
- if (type === "event") {
487
- const EVENT_TIME = dayjs(record.time);
488
-
489
- if (record.prompt) {
490
- // calculate prompt length
491
- record.prompt_length = record.prompt.length;
492
- }
493
- // models: "5-turbo", "5-flash", "5-flagship", "homegrown"
494
- if (record?.["AI Model"]) {
495
- const allModels = ["5-turbo", "5-flash", "5-flash", "5-flagship", "5-flagship", "5-flagship", "homegrown"];
496
- const chosenModel = chance.pickone(allModels);
497
- record["AI Model"] = chosenModel;
498
-
499
- // choose which model based on date + weights
500
- if (EVENT_TIME.isBefore(DATE_HOMEGROWN_LAUNCH)) {
501
- if (chosenModel === "homegrown") {
502
- if (chance.bool({ likelihood: 75 })) {
503
- record["AI Model"] = "5-flagship";
504
- }
505
- }
506
- }
507
-
508
- if (EVENT_TIME.isAfter(DATE_HOMEGROWN_LAUNCH)) {
509
- if (chosenModel !== "homegrown") {
510
- if (chance.bool({ likelihood: 27 })) {
511
- record["AI Model"] = "homegrown";
512
- }
513
- }
514
-
515
- if (record["AI Model"] && record["cost"] && record["tokens"]) {
516
-
517
- // update params
518
- switch (record["AI Model"]) {
519
- // 5 turbo is most expensive and slowest
520
- case "5-turbo":
521
- record["cost"] *= decimal(1.2, 1.7, 3);
522
- record["tokens"] *= decimal(1.2, 1.7, 3);
523
- break;
524
- // 5 flash is least expensive and fastest
525
- case "5-flash":
526
- record["cost"] *= decimal(0.8, 0.8, 3);
527
- record["tokens"] *= decimal(0.8, 0.8, 3);
528
- break;
529
- // 5 flagship is in between in both areas
530
- case "5-flagship":
531
- record["cost"] *= decimal(1.0, 1.0, 3);
532
- record["tokens"] *= decimal(1.0, 1.0, 3);
533
- break;
534
- // homegrown is chaotic is chaotic
535
- case "homegrown":
536
-
537
- record["cost"] *= decimal(0.5, 2.5, 3);
538
- record["tokens"] *= decimal(0.5, 2.5, 3);
539
- if (EVENT_TIME.isBefore(DATE_HOMEGROWN_IMPROVEMENT)) {
540
- record["cost"] *= decimal(1.2, 5.0, 3);
541
- record["tokens"] *= decimal(1.2, 3.0, 3);
542
- }
543
- if (EVENT_TIME.isAfter(DATE_HOMEGROWN_IMPROVEMENT)) {
544
- record["cost"] *= decimal(0.5, 1.0, 3);
545
- record["tokens"] *= decimal(0.5, 0.75, 3);
546
- }
547
- break;
548
- default:
549
- break;
550
- }
551
- }
552
-
553
- }
554
- }
555
-
556
-
557
-
558
- }
559
- if (type === "funnel-pre") {
560
- const parsedFirstEventTime = dayjs.unix(meta.firstEventTime);
561
- if (!parsedFirstEventTime.isValid()) debugger;
562
- //stupid offset thing we need to do...
563
- const actualFunnelTime = parsedFirstEventTime.add(NOW.diff(dayjs.unix(global.FIXED_NOW), 'h'), 'h');
564
- if (actualFunnelTime.isBefore(OVER_THINGS_GET_BETTER)) {
565
- record.conversionRate *= decimal(0.5, 0.9, 3);
566
- // record.timeToConvert *= decimal(1.5, 3.0, 3);
567
- }
568
- if (actualFunnelTime.isAfter(OVER_THINGS_GET_BETTER)) {
569
- const distanceDays = Math.min(30, actualFunnelTime.diff(OVER_THINGS_GET_BETTER, 'day'));
570
- const improvementFactor = 1.0 + (distanceDays / 30) * 0.5;
571
- // record.timeToConvert *= decimal(0.5, 0.75, 3) / improvementFactor;
572
- record.conversionRate *= decimal(1.0, 2.0, 4) * improvementFactor;
573
- }
574
- }
575
- return record;
576
- }
577
- };
578
-
579
- export default dungeon;
580
-