@ak--47/dungeon-master 1.0.0 → 1.1.0

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 (103) hide show
  1. package/README.md +7 -7
  2. package/dungeons/technical/ad-spend-schema.json +128 -0
  3. package/dungeons/technical/ad-spend.js +116 -0
  4. package/dungeons/technical/anonymous-users-schema.json +91 -0
  5. package/dungeons/technical/anonymous-users.js +102 -0
  6. package/dungeons/technical/array-of-object-lookup-schema.json +191 -0
  7. package/dungeons/{array-of-object-lookup.js → technical/array-of-object-lookup.js} +11 -4
  8. package/dungeons/technical/experiments-schema.json +197 -0
  9. package/dungeons/technical/experiments.js +168 -0
  10. package/dungeons/technical/foobar-schema.json +362 -0
  11. package/dungeons/{foobar.js → technical/foobar.js} +2 -2
  12. package/dungeons/technical/group-analytics-schema.json +149 -0
  13. package/dungeons/technical/group-analytics.js +151 -0
  14. package/dungeons/technical/mirror-strategies-schema.json +84 -0
  15. package/dungeons/technical/mirror-strategies.js +126 -0
  16. package/dungeons/technical/nested-objects-schema.json +145 -0
  17. package/dungeons/technical/nested-objects.js +207 -0
  18. package/dungeons/technical/retention-cadence-schema.json +37 -0
  19. package/dungeons/{retention-cadence.js → technical/retention-cadence.js} +1 -1
  20. package/dungeons/technical/sanity-schema.json +185 -0
  21. package/dungeons/{sanity.js → technical/sanity.js} +3 -2
  22. package/dungeons/technical/scale-test-schema.json +70 -0
  23. package/dungeons/technical/scale-test.js +90 -0
  24. package/dungeons/technical/scd-schema.json +270 -0
  25. package/dungeons/{scd.js → technical/scd.js} +19 -10
  26. package/dungeons/technical/simple-schema.json +278 -0
  27. package/dungeons/{simple.js → technical/simple.js} +6 -6
  28. package/dungeons/technical/simplest-schema.json +635 -0
  29. package/dungeons/{simplest.js → technical/simplest.js} +6 -6
  30. package/dungeons/technical/text-generation-schema.json +1059 -0
  31. package/dungeons/{text-generation.js → technical/text-generation.js} +23 -9
  32. package/dungeons/vertical/community-schema.json +557 -0
  33. package/dungeons/vertical/community.js +788 -0
  34. package/dungeons/vertical/devtools-schema.json +580 -0
  35. package/dungeons/vertical/devtools.js +837 -0
  36. package/dungeons/vertical/ecommerce-schema.json +586 -0
  37. package/dungeons/{ecommerce.js → vertical/ecommerce.js} +34 -3
  38. package/dungeons/vertical/education-schema.json +697 -0
  39. package/dungeons/{education.js → vertical/education.js} +54 -36
  40. package/dungeons/vertical/fintech-schema.json +563 -0
  41. package/dungeons/{fintech.js → vertical/fintech.js} +91 -53
  42. package/dungeons/vertical/fitness-schema.json +508 -0
  43. package/dungeons/vertical/fitness.js +802 -0
  44. package/dungeons/vertical/food-delivery-schema.json +678 -0
  45. package/dungeons/{food.js → vertical/food-delivery.js} +51 -23
  46. package/dungeons/vertical/gaming-schema.json +394 -0
  47. package/dungeons/{gaming.js → vertical/gaming.js} +9 -7
  48. package/dungeons/vertical/healthcare-schema.json +527 -0
  49. package/dungeons/vertical/healthcare.js +769 -0
  50. package/dungeons/vertical/insurance-application-schema.json +466 -0
  51. package/dungeons/{insurance-application.js → vertical/insurance-application.js} +33 -29
  52. package/dungeons/vertical/logistics-schema.json +552 -0
  53. package/dungeons/vertical/logistics.js +793 -0
  54. package/dungeons/vertical/marketplace-schema.json +511 -0
  55. package/dungeons/vertical/marketplace.js +844 -0
  56. package/dungeons/vertical/media-schema.json +787 -0
  57. package/dungeons/{media.js → vertical/media.js} +94 -16
  58. package/dungeons/vertical/rpg-schema.json +654 -0
  59. package/dungeons/{rpg.js → vertical/rpg.js} +78 -57
  60. package/dungeons/vertical/sass-schema.json +653 -0
  61. package/dungeons/{sass.js → vertical/sass.js} +49 -23
  62. package/dungeons/vertical/social-schema.json +552 -0
  63. package/dungeons/{social.js → vertical/social.js} +60 -14
  64. package/dungeons/vertical/travel-schema.json +558 -0
  65. package/dungeons/vertical/travel.js +736 -0
  66. package/index.js +19 -15
  67. package/lib/core/config-validator.js +286 -1
  68. package/lib/core/context.js +7 -5
  69. package/lib/generators/adspend.js +3 -3
  70. package/lib/generators/events.js +141 -14
  71. package/lib/generators/funnels.js +67 -7
  72. package/lib/generators/text.js +2 -2
  73. package/lib/orchestrators/user-loop.js +441 -22
  74. package/lib/templates/soup-presets.js +2 -2
  75. package/lib/utils/utils.js +4 -5
  76. package/package.json +4 -3
  77. package/scripts/dungeon-to-json.mjs +163 -0
  78. package/scripts/extract-dungeon-schema.mjs +297 -0
  79. package/scripts/json-to-dungeon.mjs +200 -0
  80. package/scripts/run-dungeon.mjs +76 -0
  81. package/scripts/run-many.mjs +118 -0
  82. package/scripts/verify-runner.mjs +42 -0
  83. package/types.d.ts +313 -1
  84. package/dungeons/array-of-object-lookup-schema.json +0 -327
  85. package/dungeons/ecommerce-schema.json +0 -462
  86. package/dungeons/education-schema.json +0 -2409
  87. package/dungeons/fintech-schema.json +0 -14034
  88. package/dungeons/foobar-schema.json +0 -403
  89. package/dungeons/food-delivery-schema.json +0 -192
  90. package/dungeons/food-delivery.js +0 -602
  91. package/dungeons/food-schema.json +0 -1152
  92. package/dungeons/gaming-schema.json +0 -1270
  93. package/dungeons/insurance-application-schema.json +0 -204
  94. package/dungeons/media-schema.json +0 -906
  95. package/dungeons/retention-cadence-schema.json +0 -78
  96. package/dungeons/rpg-schema.json +0 -4526
  97. package/dungeons/sanity-schema.json +0 -255
  98. package/dungeons/sass-schema.json +0 -1291
  99. package/dungeons/scd-schema.json +0 -919
  100. package/dungeons/simple-schema.json +0 -608
  101. package/dungeons/simplest-schema.json +0 -1418
  102. package/dungeons/social-schema.json +0 -1118
  103. package/dungeons/text-generation-schema.json +0 -3096
@@ -4,7 +4,7 @@ import dayjs from "dayjs";
4
4
  import utc from "dayjs/plugin/utc.js";
5
5
  dayjs.extend(utc);
6
6
  import { uid, comma } from 'ak-tools';
7
- import { pickAWinner, weighNumRange, date, integer, weighChoices } from "../lib/utils/utils.js";
7
+ import { weighNumRange, date, integer, weighChoices } from "../../lib/utils/utils.js";
8
8
 
9
9
  const videoCategories = ["funny", "educational", "inspirational", "music", "news", "sports", "cooking", "DIY", "travel", "gaming"];
10
10
  const spiritAnimals = ["duck", "dog", "otter", "penguin", "cat", "elephant", "lion", "cheetah", "giraffe", "zebra", "rhino", "hippo", "whale", "dolphin", "shark", "octopus", "squid", "jellyfish", "starfish", "seahorse", "crab", "lobster", "shrimp", "clam", "snail", "slug", "butterfly", "moth", "bee", "wasp", "ant", "beetle", "ladybug", "caterpillar", "centipede", "millipede", "scorpion", "spider", "tarantula", "tick", "mite", "mosquito", "fly", "dragonfly", "damselfly", "grasshopper", "cricket", "locust", "mantis", "cockroach", "termite", "praying mantis", "walking stick", "stick bug", "leaf insect", "lacewing", "aphid", "cicada", "thrips", "psyllid", "scale insect", "whitefly", "mealybug", "planthopper", "leafhopper", "treehopper", "flea", "louse", "bedbug", "flea beetle", "weevil", "longhorn beetle", "leaf beetle", "tiger beetle", "ground beetle", "lady beetle", "firefly", "click beetle", "rove beetle", "scarab beetle", "dung beetle", "stag beetle", "rhinoceros beetle", "hercules beetle", "goliath beetle", "jewel beetle", "tortoise beetle"];
@@ -68,7 +68,10 @@ const config = {
68
68
  properties: {
69
69
  currency: ["USD", "CAD", "EUR", "BTC", "ETH", "JPY"],
70
70
  coupon: weighChoices(["none", "none", "none", "none", "10%OFF", "20%OFF", "10%OFF", "20%OFF", "30%OFF", "40%OFF", "50%OFF"]),
71
- cart: makeProducts()
71
+ cart: makeProducts(),
72
+ discount_applied: [false],
73
+ discount_percent: [0],
74
+ user_segment: ["regular"],
72
75
  }
73
76
  },
74
77
  {
@@ -76,13 +79,15 @@ const config = {
76
79
  weight: 4,
77
80
  properties: {
78
81
  item: makeProducts(1),
82
+ user_segment: ["regular"],
79
83
  }
80
84
  },
81
85
  {
82
86
  event: "view item",
83
87
  weight: 8,
84
88
  properties: {
85
- item: makeProducts(1)
89
+ item: makeProducts(1),
90
+ user_segment: ["regular"],
86
91
  }
87
92
  },
88
93
  {
@@ -90,12 +95,14 @@ const config = {
90
95
  weight: 5,
91
96
  properties: {
92
97
  item: makeProducts(1),
98
+ save_context: ["weekday_intent"],
99
+ user_segment: ["regular"],
93
100
  }
94
101
  }
95
102
  ],
96
103
  funnels: [ ],
97
104
  superProps: {
98
- theme: pickAWinner(["light", "dark", "custom", "light", "dark"]),
105
+ theme: ["light", "dark", "custom", "light", "dark"],
99
106
  },
100
107
  /*
101
108
  user properties work the same as event properties
@@ -0,0 +1,197 @@
1
+ {
2
+ "events": [
3
+ {
4
+ "event": "page view",
5
+ "weight": 10,
6
+ "properties": {
7
+ "page": [
8
+ "/pricing",
9
+ "/features",
10
+ "/docs",
11
+ "/about"
12
+ ]
13
+ }
14
+ },
15
+ {
16
+ "event": "signup",
17
+ "isFirstEvent": true,
18
+ "properties": {
19
+ "method": [
20
+ "email",
21
+ "google",
22
+ "github"
23
+ ],
24
+ "referral": [
25
+ "organic",
26
+ "ad",
27
+ "friend"
28
+ ]
29
+ }
30
+ },
31
+ {
32
+ "event": "feature viewed",
33
+ "weight": 7,
34
+ "properties": {
35
+ "feature": [
36
+ "analytics",
37
+ "funnels",
38
+ "retention",
39
+ "flows",
40
+ "reports"
41
+ ],
42
+ "source": [
43
+ "nav",
44
+ "search",
45
+ "recommendation",
46
+ "link"
47
+ ]
48
+ }
49
+ },
50
+ {
51
+ "event": "action taken",
52
+ "weight": 5,
53
+ "properties": {
54
+ "action": [
55
+ "create",
56
+ "edit",
57
+ "delete",
58
+ "share",
59
+ "export"
60
+ ],
61
+ "target": [
62
+ "report",
63
+ "dashboard",
64
+ "chart",
65
+ "segment"
66
+ ]
67
+ }
68
+ },
69
+ {
70
+ "event": "checkout",
71
+ "weight": 2,
72
+ "properties": {
73
+ "amount": {
74
+ "$range": [
75
+ 129,
76
+ 400
77
+ ]
78
+ },
79
+ "plan": [
80
+ "starter",
81
+ "growth",
82
+ "enterprise"
83
+ ],
84
+ "billing": [
85
+ "monthly",
86
+ "annual"
87
+ ]
88
+ }
89
+ },
90
+ {
91
+ "event": "button click",
92
+ "weight": 8,
93
+ "properties": {
94
+ "button": [
95
+ "cta",
96
+ "upgrade",
97
+ "try-free",
98
+ "learn-more",
99
+ "contact-sales"
100
+ ],
101
+ "location": [
102
+ "hero",
103
+ "header",
104
+ "pricing-card",
105
+ "feature-section"
106
+ ]
107
+ }
108
+ },
109
+ {
110
+ "event": "help viewed",
111
+ "weight": 4,
112
+ "properties": {
113
+ "article": [
114
+ "getting-started",
115
+ "billing-faq",
116
+ "api-docs",
117
+ "integrations",
118
+ "data-export"
119
+ ]
120
+ }
121
+ }
122
+ ],
123
+ "superProps": {
124
+ "platform": [
125
+ "ios",
126
+ "web",
127
+ "android"
128
+ ]
129
+ },
130
+ "userProps": {
131
+ "plan": [
132
+ "free",
133
+ "starter",
134
+ "growth",
135
+ "enterprise"
136
+ ]
137
+ },
138
+ "funnels": [
139
+ {
140
+ "sequence": [
141
+ "page view",
142
+ "signup",
143
+ "feature viewed",
144
+ "action taken"
145
+ ],
146
+ "isFirstFunnel": true,
147
+ "conversionRate": 45,
148
+ "timeToConvert": 3,
149
+ "weight": 5,
150
+ "experiment": true
151
+ },
152
+ {
153
+ "sequence": [
154
+ "page view",
155
+ "feature viewed",
156
+ "button click",
157
+ "checkout"
158
+ ],
159
+ "conversionRate": 30,
160
+ "timeToConvert": 5,
161
+ "order": "first-and-last-fixed",
162
+ "weight": 8,
163
+ "experiment": true
164
+ },
165
+ {
166
+ "sequence": [
167
+ "feature viewed",
168
+ "action taken",
169
+ "help viewed",
170
+ "action taken"
171
+ ],
172
+ "conversionRate": 50,
173
+ "timeToConvert": 2,
174
+ "order": "random",
175
+ "weight": 4,
176
+ "requireRepeats": true,
177
+ "experiment": true,
178
+ "props": {
179
+ "experiment_cohort": [
180
+ "new_ui",
181
+ "classic_ui"
182
+ ]
183
+ }
184
+ },
185
+ {
186
+ "sequence": [
187
+ "page view",
188
+ "button click",
189
+ "signup"
190
+ ],
191
+ "isFirstFunnel": true,
192
+ "conversionRate": 40,
193
+ "timeToConvert": 1,
194
+ "weight": 6
195
+ }
196
+ ]
197
+ }
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Experiments — tests funnel experiments with A/B/C variants.
3
+ *
4
+ * Exercises: experiment: true for variant generation, bindPropsIndex
5
+ * for property binding, and multiple funnel ordering modes
6
+ * (sequential, random, first-and-last-fixed).
7
+ *
8
+ * - 2000 users, 100K events, 60 days
9
+ * - 7 events, 4 funnels with different experiment/order configs
10
+ * - No hooks
11
+ */
12
+
13
+ import Chance from 'chance';
14
+ let chance = new Chance();
15
+ import { weighNumRange, weighChoices } from "../../lib/utils/utils.js";
16
+
17
+ /** @type {import('../../types').Dungeon} */
18
+ const config = {
19
+ token: "",
20
+ seed: "experiments",
21
+ numDays: 60,
22
+ numEvents: 100_000,
23
+ numUsers: 2_000,
24
+ format: "json",
25
+ region: "US",
26
+ hasAnonIds: false,
27
+ hasSessionIds: true,
28
+ hasAdSpend: false,
29
+ hasLocation: false,
30
+ hasAndroidDevices: true,
31
+ hasIOSDevices: true,
32
+ hasDesktopDevices: true,
33
+ hasBrowser: true,
34
+ hasCampaigns: false,
35
+ isAnonymous: false,
36
+ alsoInferFunnels: false,
37
+ concurrency: 1,
38
+ batchSize: 2_500_000,
39
+ writeToDisk: false,
40
+
41
+ events: [
42
+ {
43
+ event: "page view",
44
+ weight: 10,
45
+ properties: {
46
+ page: ["/", "/features", "/pricing", "/docs", "/about"],
47
+ }
48
+ },
49
+ {
50
+ event: "signup",
51
+ weight: 1,
52
+ isFirstEvent: true,
53
+ properties: {
54
+ method: ["email", "google", "github"],
55
+ referral: weighChoices(["organic", "organic", "organic", "ad", "friend", "friend"]),
56
+ }
57
+ },
58
+ {
59
+ event: "feature viewed",
60
+ weight: 7,
61
+ properties: {
62
+ feature: ["analytics", "funnels", "retention", "flows", "reports"],
63
+ source: ["nav", "search", "recommendation", "link"],
64
+ }
65
+ },
66
+ {
67
+ event: "action taken",
68
+ weight: 5,
69
+ properties: {
70
+ action: ["create", "edit", "delete", "share", "export"],
71
+ target: ["report", "dashboard", "chart", "segment"],
72
+ }
73
+ },
74
+ {
75
+ event: "checkout",
76
+ weight: 2,
77
+ properties: {
78
+ amount: weighNumRange(29, 499, .25),
79
+ plan: ["starter", "growth", "enterprise"],
80
+ billing: ["monthly", "annual"],
81
+ }
82
+ },
83
+ {
84
+ event: "button click",
85
+ weight: 8,
86
+ properties: {
87
+ button: ["cta", "upgrade", "try-free", "learn-more", "contact-sales"],
88
+ location: ["hero", "header", "pricing-card", "feature-section"],
89
+ }
90
+ },
91
+ {
92
+ event: "help viewed",
93
+ weight: 4,
94
+ properties: {
95
+ article: ["getting-started", "billing-faq", "api-docs", "integrations", "data-export"],
96
+ }
97
+ },
98
+ ],
99
+
100
+ funnels: [
101
+ {
102
+ // A/B/C experiment with sequential order
103
+ sequence: ["page view", "signup", "feature viewed", "action taken"],
104
+ conversionRate: 45,
105
+ order: "sequential",
106
+ weight: 5,
107
+ isFirstFunnel: true,
108
+ timeToConvert: 3,
109
+ experiment: true,
110
+ name: "Onboarding Flow",
111
+ },
112
+ {
113
+ // A/B/C experiment with first-and-last-fixed order
114
+ sequence: ["page view", "feature viewed", "button click", "checkout"],
115
+ conversionRate: 30,
116
+ order: "first-and-last-fixed",
117
+ weight: 8,
118
+ timeToConvert: 5,
119
+ experiment: true,
120
+ name: "Purchase Funnel",
121
+ },
122
+ {
123
+ // A/B/C experiment with random order + bindPropsIndex
124
+ sequence: ["feature viewed", "action taken", "help viewed", "action taken"],
125
+ conversionRate: 50,
126
+ order: "random",
127
+ weight: 4,
128
+ timeToConvert: 2,
129
+ experiment: true,
130
+ requireRepeats: true,
131
+ bindPropsIndex: 2,
132
+ name: "Feature Adoption",
133
+ props: {
134
+ experiment_cohort: ["new_ui", "classic_ui"],
135
+ },
136
+ },
137
+ {
138
+ // Non-experiment control funnel (sequential, no variants)
139
+ sequence: ["page view", "button click", "signup"],
140
+ conversionRate: 40,
141
+ order: "sequential",
142
+ weight: 6,
143
+ isFirstFunnel: true,
144
+ timeToConvert: 1,
145
+ name: "Quick Signup",
146
+ },
147
+ ],
148
+
149
+ superProps: {
150
+ platform: ["web", "web", "ios", "android"],
151
+ },
152
+
153
+ userProps: {
154
+ plan: weighChoices(["free", "free", "free", "starter", "growth", "enterprise"]),
155
+ },
156
+
157
+ scdProps: {},
158
+ mirrorProps: {},
159
+ groupKeys: [],
160
+ groupProps: {},
161
+ lookupTables: [],
162
+
163
+ hook: function (record, type, meta) {
164
+ return record;
165
+ }
166
+ };
167
+
168
+ export default config;