@mpgd/target-config 0.5.0 → 0.6.1

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.
package/dist/runtime.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { MpgdLocale } from '@mpgd/i18n';
1
2
  import type { PlatformCapabilities, PlatformGateway } from '@mpgd/platform';
2
3
  import type { EffectiveTargetConfig } from './effective.js';
3
4
  export type PlatformFeature = 'iap' | 'rewardedAds' | 'interstitialAds' | 'leaderboard' | 'localization';
@@ -28,6 +29,9 @@ export interface TargetCapabilityConfig {
28
29
  readonly storage: StorageSupport;
29
30
  readonly localization: boolean;
30
31
  }
32
+ export interface TargetLocalizationConfig {
33
+ readonly fallbackLocale: MpgdLocale;
34
+ }
31
35
  export interface TargetMonetizationConfig {
32
36
  readonly iap: boolean;
33
37
  readonly rewardedAds: boolean;
@@ -50,6 +54,7 @@ export interface TargetConfig {
50
54
  readonly runtime: TargetRuntimeKind;
51
55
  readonly features: TargetFeatureConfig;
52
56
  readonly capabilities: TargetCapabilityConfig;
57
+ readonly localization: TargetLocalizationConfig;
53
58
  readonly monetization: TargetMonetizationConfig;
54
59
  readonly leaderboard: TargetLeaderboardConfig;
55
60
  readonly release: TargetReleaseConfig;
@@ -109,6 +114,11 @@ export interface TargetConfiguredGateway extends PlatformGateway {
109
114
  }
110
115
  export declare const platformFeatures: readonly ["iap", "rewardedAds", "interstitialAds", "leaderboard", "localization"];
111
116
  export declare const targetIntegrations: readonly ["identityUpgrade", "presentation", "sharing", "inboundShare", "notifications"];
117
+ type CompleteValueList<Union, Values extends readonly Union[]> = Exclude<Union, Values[number]> extends never ? Values : never;
118
+ declare const integrationAvailabilityStateValues: readonly ["available", "disabled", "approval-required", "configuration-required", "unsupported"];
119
+ export declare const integrationAvailabilityStates: CompleteValueList<IntegrationAvailabilityState, typeof integrationAvailabilityStateValues>;
120
+ declare const presentationModeValues: readonly ["fullscreen", "inline-expanded"];
121
+ export declare const presentationModes: CompleteValueList<PresentationMode, typeof presentationModeValues>;
112
122
  export declare const defaultTargetIntegrationConfig: {
113
123
  readonly identityUpgrade: 'disabled';
114
124
  readonly presentation: 'disabled';
package/dist/runtime.js CHANGED
@@ -12,6 +12,19 @@ export const targetIntegrations = [
12
12
  'inboundShare',
13
13
  'notifications',
14
14
  ];
15
+ const integrationAvailabilityStateValues = [
16
+ 'available',
17
+ 'disabled',
18
+ 'approval-required',
19
+ 'configuration-required',
20
+ 'unsupported',
21
+ ];
22
+ export const integrationAvailabilityStates = integrationAvailabilityStateValues;
23
+ const presentationModeValues = [
24
+ 'fullscreen',
25
+ 'inline-expanded',
26
+ ];
27
+ export const presentationModes = presentationModeValues;
15
28
  export const defaultTargetIntegrationConfig = {
16
29
  identityUpgrade: 'disabled',
17
30
  presentation: 'disabled',
@@ -20,13 +33,8 @@ export const defaultTargetIntegrationConfig = {
20
33
  notifications: 'unsupported',
21
34
  presentationMode: 'fullscreen',
22
35
  };
23
- const integrationAvailabilityStates = new Set([
24
- 'available',
25
- 'disabled',
26
- 'approval-required',
27
- 'configuration-required',
28
- 'unsupported',
29
- ]);
36
+ const integrationAvailabilityStateSet = new Set(integrationAvailabilityStates);
37
+ const presentationModeSet = new Set(presentationModes);
30
38
  export function normalizeTargetIntegrationConfig(config) {
31
39
  if (config === undefined) {
32
40
  return defaultTargetIntegrationConfig;
@@ -94,7 +102,7 @@ export function createTargetRuntimeSnapshot(input) {
94
102
  leaderboard: getFeatureAvailability('leaderboard', input.config, input.capabilities),
95
103
  localization: getFeatureAvailability('localization', input.config, input.capabilities),
96
104
  };
97
- const integrationConfig = normalizeTargetIntegrationConfig(input.config.integrations);
105
+ const integrationConfig = normalizeTargetIntegrationConfig(input.effectiveConfig?.integrations ?? input.config.integrations);
98
106
  const integrationEntries = targetIntegrations.map((integration) => {
99
107
  const availability = createIntegrationAvailability(integration, integrationConfig[integration], input.gateway);
100
108
  return [integration, availability];
@@ -124,7 +132,7 @@ export function createTargetRuntimeSnapshot(input) {
124
132
  export function withTargetAvailability(gateway, config, options = {}) {
125
133
  const configTarget = options.configTarget ?? targetConfigKeyForPlatform(gateway.target);
126
134
  const { identity: gatewayIdentity, presentation: gatewayPresentation, sharing: gatewaySharing, notifications: gatewayNotifications, ...gatewayWithoutIntegrations } = gateway;
127
- const integrations = normalizeTargetIntegrationConfig(config.integrations);
135
+ const integrations = normalizeTargetIntegrationConfig(options.effectiveConfig?.integrations ?? config.integrations);
128
136
  const isIntegrationAvailable = (integration) => (createIntegrationAvailability(integration, integrations[integration], gateway).state
129
137
  === 'available');
130
138
  const identityUpgradeAvailable = isIntegrationAvailable('identityUpgrade');
@@ -303,13 +311,13 @@ function createIntegrationAvailability(integration, configuredState, gateway) {
303
311
  };
304
312
  }
305
313
  function normalizeIntegrationAvailabilityState(input, fallback) {
306
- if (input !== undefined && integrationAvailabilityStates.has(input)) {
314
+ if (input !== undefined && integrationAvailabilityStateSet.has(input)) {
307
315
  return input;
308
316
  }
309
317
  return fallback;
310
318
  }
311
319
  function normalizePresentationMode(input) {
312
- if (input === 'inline-expanded' || input === 'fullscreen') {
320
+ if (input !== undefined && presentationModeSet.has(input)) {
313
321
  return input;
314
322
  }
315
323
  return defaultTargetIntegrationConfig.presentationMode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpgd/target-config",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "Target-specific platform feature availability and effective config helpers for mpgd.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -36,13 +36,14 @@
36
36
  "targets.json"
37
37
  ],
38
38
  "dependencies": {
39
- "typia": "rc",
40
- "@mpgd/catalog": "0.3.3",
41
- "@mpgd/platform": "0.4.0"
39
+ "typia": "13.0.2",
40
+ "@mpgd/catalog": "0.3.5",
41
+ "@mpgd/i18n": "0.5.1",
42
+ "@mpgd/platform": "0.5.1"
42
43
  },
43
44
  "devDependencies": {
44
- "ttsc": "0.16.9",
45
- "typescript": "7.0.1-rc"
45
+ "ttsc": "0.18.4",
46
+ "typescript": "7.0.2"
46
47
  },
47
48
  "main": "./dist/index.js",
48
49
  "types": "./dist/index.d.ts",
package/targets.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2026-07-10",
2
+ "version": "2026-07-12",
3
3
  "targets": {
4
4
  "web-preview": {
5
5
  "runtime": "web-preview",
@@ -14,6 +14,9 @@
14
14
  "storage": "local",
15
15
  "localization": true
16
16
  },
17
+ "localization": {
18
+ "fallbackLocale": "en"
19
+ },
17
20
  "monetization": {
18
21
  "iap": false,
19
22
  "rewardedAds": false,
@@ -54,6 +57,9 @@
54
57
  "storage": "local",
55
58
  "localization": true
56
59
  },
60
+ "localization": {
61
+ "fallbackLocale": "en"
62
+ },
57
63
  "monetization": {
58
64
  "iap": false,
59
65
  "rewardedAds": false,
@@ -94,6 +100,9 @@
94
100
  "storage": "native",
95
101
  "localization": true
96
102
  },
103
+ "localization": {
104
+ "fallbackLocale": "en"
105
+ },
97
106
  "monetization": {
98
107
  "iap": true,
99
108
  "rewardedAds": true,
@@ -134,6 +143,9 @@
134
143
  "storage": "native",
135
144
  "localization": true
136
145
  },
146
+ "localization": {
147
+ "fallbackLocale": "en"
148
+ },
137
149
  "monetization": {
138
150
  "iap": true,
139
151
  "rewardedAds": true,
@@ -174,6 +186,9 @@
174
186
  "storage": "none",
175
187
  "localization": true
176
188
  },
189
+ "localization": {
190
+ "fallbackLocale": "ko"
191
+ },
177
192
  "monetization": {
178
193
  "iap": true,
179
194
  "rewardedAds": true,
@@ -214,6 +229,9 @@
214
229
  "storage": "native",
215
230
  "localization": true
216
231
  },
232
+ "localization": {
233
+ "fallbackLocale": "en"
234
+ },
217
235
  "monetization": {
218
236
  "iap": false,
219
237
  "rewardedAds": false,