@sudobility/sudojo_lib 0.0.114 → 0.0.116
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.
|
@@ -3,7 +3,7 @@ import type { Level } from '@sudobility/sudojo_types';
|
|
|
3
3
|
* Compute the fraction of puzzles accessible for a given offering.
|
|
4
4
|
*
|
|
5
5
|
* Sums the `percentage` field (decimal 0–1) of matching levels based
|
|
6
|
-
* on their derived
|
|
6
|
+
* on their derived subscription offer ID:
|
|
7
7
|
*
|
|
8
8
|
* - No offerId — only free levels (no subscription required)
|
|
9
9
|
* - `'1_blue_belt'` — free levels + blue_belt levels
|
|
@@ -4,7 +4,7 @@ import { getSubscriptionOfferId } from '@sudobility/sudojo_types';
|
|
|
4
4
|
* Compute the fraction of puzzles accessible for a given offering.
|
|
5
5
|
*
|
|
6
6
|
* Sums the `percentage` field (decimal 0–1) of matching levels based
|
|
7
|
-
* on their derived
|
|
7
|
+
* on their derived subscription offer ID:
|
|
8
8
|
*
|
|
9
9
|
* - No offerId — only free levels (no subscription required)
|
|
10
10
|
* - `'1_blue_belt'` — free levels + blue_belt levels
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePuzzleDistribution.js","sourceRoot":"","sources":["../../src/hooks/usePuzzleDistribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAAe,EACf,OAAuB;IAEvB,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,IAAI,OAAO,IAAI,OAAO,KAAK,aAAa;YAAE,OAAO,GAAG,CAAC;QAErD,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,MAAM,YAAY,GAAG,sBAAsB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAC/D,IACE,CAAC,YAAY;gBACb,CAAC,OAAO,KAAK,aAAa,IAAI,YAAY,KAAK,aAAa,CAAC,EAC7D,CAAC;gBACD,KAAK,IAAI,KAAK,CAAC,UAAU,IAAI,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AACxB,CAAC","sourcesContent":["import { useMemo } from 'react';\nimport type { Level } from '@sudobility/sudojo_types';\nimport { getSubscriptionOfferId } from '@sudobility/sudojo_types';\n\n/**\n * Compute the fraction of puzzles accessible for a given offering.\n *\n * Sums the `percentage` field (decimal 0–1) of matching levels based\n * on their derived
|
|
1
|
+
{"version":3,"file":"usePuzzleDistribution.js","sourceRoot":"","sources":["../../src/hooks/usePuzzleDistribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CACnC,MAAe,EACf,OAAuB;IAEvB,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,IAAI,OAAO,IAAI,OAAO,KAAK,aAAa;YAAE,OAAO,GAAG,CAAC;QAErD,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,MAAM,YAAY,GAAG,sBAAsB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAC/D,IACE,CAAC,YAAY;gBACb,CAAC,OAAO,KAAK,aAAa,IAAI,YAAY,KAAK,aAAa,CAAC,EAC7D,CAAC;gBACD,KAAK,IAAI,KAAK,CAAC,UAAU,IAAI,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AACxB,CAAC","sourcesContent":["import { useMemo } from 'react';\nimport type { Level } from '@sudobility/sudojo_types';\nimport { getSubscriptionOfferId } from '@sudobility/sudojo_types';\n\n/**\n * Compute the fraction of puzzles accessible for a given offering.\n *\n * Sums the `percentage` field (decimal 0–1) of matching levels based\n * on their derived subscription offer ID:\n *\n * - No offerId — only free levels (no subscription required)\n * - `'1_blue_belt'` — free levels + blue_belt levels\n * - Anything else — returns 1.0 (all puzzles)\n */\nexport function usePuzzleDistribution(\n levels: Level[],\n offerId?: string | null\n): number {\n return useMemo(() => {\n if (offerId && offerId !== '1_blue_belt') return 1.0;\n\n let total = 0;\n for (const level of levels) {\n const levelOfferId = getSubscriptionOfferId(level.entitlement);\n if (\n !levelOfferId ||\n (offerId === '1_blue_belt' && levelOfferId === '1_blue_belt')\n ) {\n total += level.percentage ?? 0;\n }\n }\n return total;\n }, [levels, offerId]);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudobility/sudojo_lib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.116",
|
|
4
4
|
"description": "Business logic library for Sudojo app",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"author": "Sudobility team",
|
|
47
47
|
"license": "BUSL-1.1",
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@sudobility/di": "^1.5.
|
|
50
|
-
"@sudobility/sudojo_client": "^0.0.
|
|
51
|
-
"@sudobility/sudojo_types": "^1.2.
|
|
52
|
-
"@sudobility/types": "^1.9.
|
|
49
|
+
"@sudobility/di": "^1.5.49",
|
|
50
|
+
"@sudobility/sudojo_client": "^0.0.94",
|
|
51
|
+
"@sudobility/sudojo_types": "^1.2.45",
|
|
52
|
+
"@sudobility/types": "^1.9.60",
|
|
53
53
|
"@tanstack/react-query": "^5.90.11",
|
|
54
54
|
"@testing-library/dom": "^10.4.1",
|
|
55
55
|
"@testing-library/react": "^16.3.0",
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
"zustand": "^5.0.9"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@sudobility/di": "^1.5.
|
|
76
|
-
"@sudobility/sudojo_client": "^0.0.
|
|
77
|
-
"@sudobility/sudojo_types": "^1.2.
|
|
78
|
-
"@sudobility/types": "^1.9.
|
|
75
|
+
"@sudobility/di": "^1.5.49",
|
|
76
|
+
"@sudobility/sudojo_client": "^0.0.94",
|
|
77
|
+
"@sudobility/sudojo_types": "^1.2.45",
|
|
78
|
+
"@sudobility/types": "^1.9.60",
|
|
79
79
|
"@tanstack/react-query": ">=5.0.0",
|
|
80
80
|
"react": ">=18.0.0",
|
|
81
81
|
"zustand": ">=5.0.0"
|
|
@@ -85,5 +85,9 @@
|
|
|
85
85
|
},
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "restricted"
|
|
88
|
+
},
|
|
89
|
+
"repository": {
|
|
90
|
+
"type": "git",
|
|
91
|
+
"url": "https://github.com/johnqh/sudojo_lib.git"
|
|
88
92
|
}
|
|
89
93
|
}
|