fansunited-data-layer 0.5.7 → 0.6.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 (46) hide show
  1. package/api/fansunited/football/matches/transformer.d.ts +6 -1
  2. package/api/fansunited/football/matches/transformer.d.ts.map +1 -1
  3. package/api/fansunited-sdk/index.d.ts +10 -0
  4. package/api/fansunited-sdk/index.d.ts.map +1 -0
  5. package/api/fansunited-sdk/loyalty/index.d.ts +8 -0
  6. package/api/fansunited-sdk/loyalty/index.d.ts.map +1 -0
  7. package/api/fansunited-sdk/loyalty/matches.d.ts +81 -0
  8. package/api/fansunited-sdk/loyalty/matches.d.ts.map +1 -0
  9. package/api/fansunited-sdk/loyalty/template.d.ts +40 -0
  10. package/api/fansunited-sdk/loyalty/template.d.ts.map +1 -0
  11. package/api/fansunited-sdk/odds/index.d.ts +9 -0
  12. package/api/fansunited-sdk/odds/index.d.ts.map +1 -0
  13. package/api/fansunited-sdk/odds/matches.d.ts +56 -0
  14. package/api/fansunited-sdk/odds/matches.d.ts.map +1 -0
  15. package/client.cjs +4 -4
  16. package/client.d.ts +5 -1
  17. package/client.d.ts.map +1 -1
  18. package/client.js +1555 -1368
  19. package/fansunited-data-layer.cjs +1 -1
  20. package/fansunited-data-layer.js +457 -580
  21. package/index.d.ts +2 -0
  22. package/index.d.ts.map +1 -1
  23. package/{index-BCFUYnU-.js → matches-CBFdPkPa.js} +602 -321
  24. package/matches-DKjnuuq_.cjs +1 -0
  25. package/package.json +1 -1
  26. package/providers/index.d.ts +3 -0
  27. package/providers/index.d.ts.map +1 -1
  28. package/providers/leaderboard/hooks/useMatchHelpers.d.ts +12 -0
  29. package/providers/leaderboard/hooks/useMatchHelpers.d.ts.map +1 -0
  30. package/providers/leaderboard/hooks/useTemplateHelpers.d.ts +11 -0
  31. package/providers/leaderboard/hooks/useTemplateHelpers.d.ts.map +1 -0
  32. package/providers/leaderboard.context.d.ts +8 -0
  33. package/providers/leaderboard.context.d.ts.map +1 -0
  34. package/providers/leaderboard.provider.d.ts +3 -0
  35. package/providers/leaderboard.provider.d.ts.map +1 -0
  36. package/providers/leaderboard.types.d.ts +113 -0
  37. package/providers/leaderboard.types.d.ts.map +1 -0
  38. package/providers/match/hooks/useBatchMatchOdds.d.ts +75 -0
  39. package/providers/match/hooks/useBatchMatchOdds.d.ts.map +1 -0
  40. package/types/canonical/index.d.ts +1 -1
  41. package/types/canonical/index.d.ts.map +1 -1
  42. package/types/canonical/odds.types.d.ts +5 -0
  43. package/types/canonical/odds.types.d.ts.map +1 -1
  44. package/types/index.d.ts +1 -1
  45. package/types/index.d.ts.map +1 -1
  46. package/index-DG3P0DPW.cjs +0 -1
@@ -2,7 +2,7 @@
2
2
  * Transform raw match data to canonical FUSports types
3
3
  */
4
4
  import type { FUSportsMatch, FUSportsPlayerMatchStats, FUSportsMatchStatistics, FUSportsMatchLineups } from "../../../../types/canonical";
5
- import type { RawMatchResponse, RawMatchesResponse, RawPlayerStats, RawMatchStats, RawLineups } from "./types";
5
+ import type { RawMatchResponse, RawMatchesResponse, RawMatch, RawPlayerStats, RawMatchStats, RawLineups } from "./types";
6
6
  /**
7
7
  * Transform raw player stats to canonical format
8
8
  */
@@ -15,6 +15,11 @@ export declare function transformMatchStatistics(raw: RawMatchStats, homeTeamId:
15
15
  * Transform raw lineups to canonical format
16
16
  */
17
17
  export declare function transformLineups(raw: RawLineups, matchId: string, homeTeamId: string, awayTeamId: string): FUSportsMatchLineups;
18
+ /**
19
+ * Transform unwrapped match data to canonical FUSportsMatch
20
+ * Exported for reuse in SDK-based functions
21
+ */
22
+ export declare function transformMatchData(raw: RawMatch): FUSportsMatch;
18
23
  /**
19
24
  * Transform raw match response to canonical FUSportsMatch
20
25
  * The API wraps the match data in a "data" property
@@ -1 +1 @@
1
- {"version":3,"file":"transformer.d.ts","sourceRoot":"","sources":["../../../../../src/lib/api/fansunited/football/matches/transformer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACR,aAAa,EAKb,wBAAwB,EACxB,uBAAuB,EAEvB,oBAAoB,EAGvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EACR,gBAAgB,EAChB,kBAAkB,EAMlB,cAAc,EACd,aAAa,EAEb,UAAU,EAIb,MAAM,SAAS,CAAC;AAkKjB;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,cAAc,GAAG,wBAAwB,CAuDlF;AA+DD;;GAEG;AACH,wBAAgB,wBAAwB,CACpC,GAAG,EAAE,aAAa,EAClB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACnB,uBAAuB,CA6EzB;AAgDD;;GAEG;AACH,wBAAgB,gBAAgB,CAC5B,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACnB,oBAAoB,CAOtB;AA0BD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,gBAAgB,GAAG,aAAa,CAEnE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,kBAAkB,GAAG,aAAa,EAAE,CAEzE"}
1
+ {"version":3,"file":"transformer.d.ts","sourceRoot":"","sources":["../../../../../src/lib/api/fansunited/football/matches/transformer.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACR,aAAa,EAKb,wBAAwB,EACxB,uBAAuB,EAEvB,oBAAoB,EAGvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EACR,gBAAgB,EAChB,kBAAkB,EAClB,QAAQ,EAKR,cAAc,EACd,aAAa,EAEb,UAAU,EAIb,MAAM,SAAS,CAAC;AAkKjB;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,cAAc,GAAG,wBAAwB,CAuDlF;AA+DD;;GAEG;AACH,wBAAgB,wBAAwB,CACpC,GAAG,EAAE,aAAa,EAClB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACnB,uBAAuB,CA6EzB;AAgDD;;GAEG;AACH,wBAAgB,gBAAgB,CAC5B,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACnB,oBAAoB,CAOtB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,QAAQ,GAAG,aAAa,CAmB/D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,gBAAgB,GAAG,aAAa,CAEnE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,kBAAkB,GAAG,aAAa,EAAE,CAEzE"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * FansUnited SDK-based API operations
3
+ *
4
+ * These functions require the FansUnited SDK instance and are typically
5
+ * used in client-side React components with the useFansUnitedSDK() hook.
6
+ */
7
+ export { getLeaderboardMatches, getLeaderboardTeamMatches, getLeaderboardTemplate } from "./loyalty";
8
+ export { getBatchMatchOdds } from "./odds";
9
+ export type { GetBatchMatchOddsOptions } from "./odds";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/api/fansunited-sdk/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAGrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,YAAY,EAAE,wBAAwB,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * FansUnited SDK Loyalty/Predictor operations
3
+ *
4
+ * Functions that use the FansUnited SDK's loyalty namespace
5
+ */
6
+ export { getLeaderboardMatches, getLeaderboardTeamMatches } from "./matches";
7
+ export { getLeaderboardTemplate } from "./template";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/api/fansunited-sdk/loyalty/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * SDK-based loyalty/predictor leaderboard match operations
3
+ *
4
+ * These functions use the FansUnited SDK's loyalty namespace to fetch matches
5
+ * associated with predictor leaderboards/templates and transform them to canonical types.
6
+ */
7
+ import type FansUnitedSDKModel from "fansunited-sdk-esm/Core/Global/Models/FansUnitedSDKModel";
8
+ import type { FUSportsMatch } from "../../../types/canonical";
9
+ /**
10
+ * Get all matches for a predictor leaderboard/template
11
+ *
12
+ * Fetches matches associated with a predictor leaderboard template using the SDK's
13
+ * loyalty.getTemplateMatches() method and transforms them to canonical FUSportsMatch types.
14
+ *
15
+ * @param sdk - The FansUnited SDK instance
16
+ * @param predictorLeaderboardId - The predictor leaderboard/template ID
17
+ * @param options - Optional parameters
18
+ * @param options.groupId - Optional group ID to filter matches by specific group
19
+ * @param options.disableCache - Whether to disable API cache (default: false)
20
+ * @returns Array of matches in canonical format
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * import { useFansUnitedSDK } from 'fansunited-data-layer';
25
+ * import { getLeaderboardMatches } from 'fansunited-data-layer/client';
26
+ *
27
+ * function MyComponent() {
28
+ * const sdk = useFansUnitedSDK();
29
+ *
30
+ * const fetchMatches = async () => {
31
+ * if (!sdk) return;
32
+ * const matches = await getLeaderboardMatches(sdk, 'template-123');
33
+ * console.log(matches); // Array of FUSportsMatch
34
+ * };
35
+ * }
36
+ * ```
37
+ */
38
+ export declare function getLeaderboardMatches(sdk: FansUnitedSDKModel, predictorLeaderboardId: string, options?: {
39
+ groupId?: string;
40
+ disableCache?: boolean;
41
+ }): Promise<FUSportsMatch[]>;
42
+ /**
43
+ * Get matches for a specific team within a predictor leaderboard/template
44
+ *
45
+ * Fetches matches associated with a predictor leaderboard template and filters them
46
+ * to only include matches where the specified team is participating (either as home or away).
47
+ *
48
+ * @param sdk - The FansUnited SDK instance
49
+ * @param predictorLeaderboardId - The predictor leaderboard/template ID
50
+ * @param teamId - The team ID to filter matches by
51
+ * @param options - Optional parameters
52
+ * @param options.groupId - Optional group ID to filter matches by specific group
53
+ * @param options.disableCache - Whether to disable API cache (default: false)
54
+ * @returns Array of matches for the specified team in canonical format
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * import { useFansUnitedSDK } from 'fansunited-data-layer';
59
+ * import { getLeaderboardTeamMatches } from 'fansunited-data-layer/client';
60
+ *
61
+ * function TeamLeaderboard() {
62
+ * const sdk = useFansUnitedSDK();
63
+ *
64
+ * const fetchTeamMatches = async () => {
65
+ * if (!sdk) return;
66
+ * // Get only matches for Manchester United
67
+ * const matches = await getLeaderboardTeamMatches(
68
+ * sdk,
69
+ * 'template-123',
70
+ * 'fb:t:8102'
71
+ * );
72
+ * console.log(matches); // Array of FUSportsMatch for the team
73
+ * };
74
+ * }
75
+ * ```
76
+ */
77
+ export declare function getLeaderboardTeamMatches(sdk: FansUnitedSDKModel, predictorLeaderboardId: string, teamId: string, options?: {
78
+ groupId?: string;
79
+ disableCache?: boolean;
80
+ }): Promise<FUSportsMatch[]>;
81
+ //# sourceMappingURL=matches.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matches.d.ts","sourceRoot":"","sources":["../../../../src/lib/api/fansunited-sdk/loyalty/matches.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,kBAAkB,MAAM,0DAA0D,CAAC;AAC/F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAc9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,qBAAqB,CACvC,GAAG,EAAE,kBAAkB,EACvB,sBAAsB,EAAE,MAAM,EAC9B,OAAO,CAAC,EAAE;IACN,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B,GACF,OAAO,CAAC,aAAa,EAAE,CAAC,CAW1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,yBAAyB,CAC3C,GAAG,EAAE,kBAAkB,EACvB,sBAAsB,EAAE,MAAM,EAC9B,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;IACN,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B,GACF,OAAO,CAAC,aAAa,EAAE,CAAC,CAM1B"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * SDK-based loyalty/predictor template operations
3
+ *
4
+ * These functions use the FansUnited SDK's loyalty namespace to fetch template data.
5
+ */
6
+ import type FansUnitedSDKModel from "fansunited-sdk-esm/Core/Global/Models/FansUnitedSDKModel";
7
+ import type { SerializedTemplate } from "../../../providers/leaderboard.types";
8
+ /**
9
+ * Get template/leaderboard by ID
10
+ *
11
+ * Fetches a predictor leaderboard template using the SDK's loyalty.getTemplateById() method.
12
+ * The SDK returns a class instance which needs to be serialized for use in React Server Components.
13
+ *
14
+ * @param sdk - The FansUnited SDK instance
15
+ * @param templateId - The template/leaderboard ID
16
+ * @param options - Optional parameters
17
+ * @param options.disableCache - Whether to disable API cache (default: false)
18
+ * @returns Template data as a serializable plain object
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * import { useFansUnitedSDK } from 'fansunited-data-layer';
23
+ * import { getLeaderboardTemplate } from 'fansunited-data-layer/client';
24
+ *
25
+ * function MyComponent() {
26
+ * const sdk = useFansUnitedSDK();
27
+ *
28
+ * const fetchTemplate = async () => {
29
+ * if (!sdk) return;
30
+ * const template = await getLeaderboardTemplate(sdk, 'template-123');
31
+ * console.log(template.name); // Template name
32
+ * console.log(template.groups); // Template groups
33
+ * };
34
+ * }
35
+ * ```
36
+ */
37
+ export declare function getLeaderboardTemplate(sdk: FansUnitedSDKModel, templateId: string, options?: {
38
+ disableCache?: boolean;
39
+ }): Promise<SerializedTemplate>;
40
+ //# sourceMappingURL=template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../src/lib/api/fansunited-sdk/loyalty/template.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,kBAAkB,MAAM,0DAA0D,CAAC;AAC/F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,sBAAsB,CACxC,GAAG,EAAE,kBAAkB,EACvB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;IACN,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B,GACF,OAAO,CAAC,kBAAkB,CAAC,CAmD7B"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * SDK-based odds operations
3
+ *
4
+ * These functions use the FansUnited SDK's odds namespace to fetch betting odds
5
+ * and transform them to canonical types.
6
+ */
7
+ export { getBatchMatchOdds } from "./matches";
8
+ export type { GetBatchMatchOddsOptions } from "./matches";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/api/fansunited-sdk/odds/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,YAAY,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * SDK-based odds operations for matches
3
+ *
4
+ * These functions use the FansUnited SDK's odds namespace to fetch betting odds
5
+ * for matches and transform them to canonical types.
6
+ */
7
+ import type FansUnitedSDKModel from "fansunited-sdk-esm/Core/Global/Models/FansUnitedSDKModel";
8
+ import type { FUSportsBatchMatchOdds } from "../../../types/canonical";
9
+ import type { MarketType } from "../../sportal365-sports/football/matches/types";
10
+ /**
11
+ * Options for fetching batch match odds
12
+ */
13
+ export interface GetBatchMatchOddsOptions {
14
+ /** Market types to include (e.g., ['1x2', 'OVER_UNDER']) */
15
+ marketTypes?: MarketType[];
16
+ /** Filter odds by specific bookmaker/operator IDs */
17
+ bookmakerIds?: string[];
18
+ /** Type of odds: PRE_EVENT, LIVE, or ALL (default: ALL) */
19
+ oddType?: "PRE_EVENT" | "LIVE" | "ALL";
20
+ /** Scope type for odds (default: ORDINARY_TIME) */
21
+ scopeType?: "ORDINARY_TIME" | "FULL_TIME";
22
+ /** Format of odds (default: DECIMAL) */
23
+ oddFormat?: "FRACTIONAL" | "DECIMAL" | "MONEYLINE";
24
+ }
25
+ /**
26
+ * Get betting odds for multiple matches in a single API call
27
+ *
28
+ * Fetches odds for multiple matches using the SDK's batch odds endpoint.
29
+ * This is more efficient than making individual calls for each match.
30
+ *
31
+ * @param sdk - The FansUnited SDK instance
32
+ * @param matchIds - Array of match IDs to fetch odds for
33
+ * @param options - Optional parameters for filtering odds
34
+ * @returns Map of match IDs to their betting odds in canonical format
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * import { useFansUnitedSDK } from 'fansunited-data-layer/client';
39
+ * import { getBatchMatchOdds } from 'fansunited-data-layer/client';
40
+ *
41
+ * function MyComponent() {
42
+ * const sdk = useFansUnitedSDK();
43
+ *
44
+ * const fetchOdds = async () => {
45
+ * if (!sdk) return;
46
+ * const oddsMap = await getBatchMatchOdds(sdk, ['match1', 'match2', 'match3'], {
47
+ * marketTypes: ['1x2', 'OVER_UNDER'],
48
+ * oddType: 'PRE_EVENT'
49
+ * });
50
+ * console.log(oddsMap); // Map<matchId, operators[]>
51
+ * };
52
+ * }
53
+ * ```
54
+ */
55
+ export declare function getBatchMatchOdds(sdk: FansUnitedSDKModel, matchIds: string[], options?: GetBatchMatchOddsOptions): Promise<FUSportsBatchMatchOdds>;
56
+ //# sourceMappingURL=matches.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matches.d.ts","sourceRoot":"","sources":["../../../../src/lib/api/fansunited-sdk/odds/matches.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,kBAAkB,MAAM,0DAA0D,CAAC;AAC/F,OAAO,KAAK,EAAE,sBAAsB,EAA+B,MAAM,0BAA0B,CAAC;AACpG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAC;AAEjF;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,4DAA4D;IAC5D,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC;IACvC,mDAAmD;IACnD,SAAS,CAAC,EAAE,eAAe,GAAG,WAAW,CAAC;IAC1C,wCAAwC;IACxC,SAAS,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,WAAW,CAAC;CACtD;AA8ID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,iBAAiB,CACnC,GAAG,EAAE,kBAAkB,EACvB,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,CAAC,EAAE,wBAAwB,GACnC,OAAO,CAAC,sBAAsB,CAAC,CAuBjC"}