@mpgd/target-config 0.12.0 → 0.13.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/effective.d.ts +1 -0
- package/dist/effective.js +4 -7
- package/dist/index.js +37 -20
- package/dist/runtime.d.ts +8 -3
- package/dist/runtime.js +39 -15
- package/package.json +4 -4
- package/targets.json +2 -0
package/dist/effective.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export interface EffectiveMonetizationConfig {
|
|
|
39
39
|
readonly products: readonly EffectiveProductConfig[];
|
|
40
40
|
}
|
|
41
41
|
export interface EffectiveAdsConfig {
|
|
42
|
+
readonly bannerAds: boolean;
|
|
42
43
|
readonly rewardedAds: boolean;
|
|
43
44
|
readonly interstitialAds: boolean;
|
|
44
45
|
readonly placements: readonly EffectiveAdPlacementConfig[];
|
package/dist/effective.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { resolveAdPlacementPlatformId, resolveProductPlatformId, } from '@mpgd/catalog';
|
|
2
|
-
import { assertTargetIntegrationRuntimeBounds, } from './runtime.js';
|
|
2
|
+
import { adPlacementFeatureFor, assertTargetIntegrationRuntimeBounds, } from './runtime.js';
|
|
3
3
|
export const defaultLeaderboardId = 'default';
|
|
4
4
|
const disabledAuthoritativeMonetization = {
|
|
5
5
|
iap: false,
|
|
6
|
+
bannerAds: false,
|
|
6
7
|
rewardedAds: false,
|
|
7
8
|
interstitialAds: false,
|
|
8
9
|
};
|
|
@@ -44,6 +45,7 @@ export function createEffectiveTargetConfig(input) {
|
|
|
44
45
|
products,
|
|
45
46
|
},
|
|
46
47
|
ads: {
|
|
48
|
+
bannerAds: config.monetization.bannerAds === true,
|
|
47
49
|
rewardedAds: config.monetization.rewardedAds,
|
|
48
50
|
interstitialAds: config.monetization.interstitialAds,
|
|
49
51
|
placements,
|
|
@@ -132,9 +134,7 @@ function effectiveProductReason(runtime, targetEnabled, product, platformProduct
|
|
|
132
134
|
return effectiveItemReason(targetEnabled, platformProductId);
|
|
133
135
|
}
|
|
134
136
|
function createEffectiveAdPlacementConfig(target, config, placement) {
|
|
135
|
-
const featureEnabled =
|
|
136
|
-
? config.features.rewardedAds
|
|
137
|
-
: config.features.interstitialAds;
|
|
137
|
+
const featureEnabled = config.features[adPlacementFeatureFor(placement.type)] === true;
|
|
138
138
|
const platformPlacementId = resolveAdPlacementPlatformId(placement, target);
|
|
139
139
|
const reason = effectiveItemReason(featureEnabled, platformPlacementId);
|
|
140
140
|
return {
|
|
@@ -156,6 +156,3 @@ function effectiveItemReason(targetEnabled, platformId) {
|
|
|
156
156
|
function effectiveTargetConfigVersion(input) {
|
|
157
157
|
return `${input.targetConfig}+catalog.${input.productCatalog}+ads.${input.adPlacements}`;
|
|
158
158
|
}
|
|
159
|
-
function isRewardedPlacement(placement) {
|
|
160
|
-
return placement.type === 'rewarded';
|
|
161
|
-
}
|
package/dist/index.js
CHANGED
|
@@ -179,7 +179,12 @@ export const assertEffectiveTargetConfigMatrix = (() => {
|
|
|
179
179
|
expected: "(number & ExclusiveMinimum<0> & Maximum<1.7976931348623157e+308>)",
|
|
180
180
|
value: input.amount
|
|
181
181
|
}, _errorFactory));
|
|
182
|
-
const _ao14 = (input, _path, _exceptionable = true) =>
|
|
182
|
+
const _ao14 = (input, _path, _exceptionable = true) => ("boolean" === typeof input.bannerAds || _assertGuard_1._assertGuard(_exceptionable, {
|
|
183
|
+
method: "typia.createAssert",
|
|
184
|
+
path: _path + ".bannerAds",
|
|
185
|
+
expected: "boolean",
|
|
186
|
+
value: input.bannerAds
|
|
187
|
+
}, _errorFactory)) && _ap2(input, _path, true && _exceptionable) && _ap3(input, _path, true && _exceptionable) && ((Array.isArray(input.placements) || _assertGuard_1._assertGuard(_exceptionable, {
|
|
183
188
|
method: "typia.createAssert",
|
|
184
189
|
path: _path + ".placements",
|
|
185
190
|
expected: "ReadonlyArray<EffectiveAdPlacementConfig>",
|
|
@@ -200,10 +205,10 @@ export const assertEffectiveTargetConfigMatrix = (() => {
|
|
|
200
205
|
expected: "ReadonlyArray<EffectiveAdPlacementConfig>",
|
|
201
206
|
value: input.placements
|
|
202
207
|
}, _errorFactory));
|
|
203
|
-
const _ao15 = (input, _path, _exceptionable = true) => _ap5(input, _path, true && _exceptionable) && ("interstitial" === input.type || "rewarded" === input.type || _assertGuard_1._assertGuard(_exceptionable, {
|
|
208
|
+
const _ao15 = (input, _path, _exceptionable = true) => _ap5(input, _path, true && _exceptionable) && ("banner" === input.type || "interstitial" === input.type || "rewarded" === input.type || _assertGuard_1._assertGuard(_exceptionable, {
|
|
204
209
|
method: "typia.createAssert",
|
|
205
210
|
path: _path + ".type",
|
|
206
|
-
expected: "(\"interstitial\" | \"rewarded\")",
|
|
211
|
+
expected: "(\"banner\" | \"interstitial\" | \"rewarded\")",
|
|
207
212
|
value: input.type
|
|
208
213
|
}, _errorFactory)) && (undefined === input.reward || ("object" === typeof input.reward && null !== input.reward || _assertGuard_1._assertGuard(_exceptionable, {
|
|
209
214
|
method: "typia.createAssert",
|
|
@@ -409,7 +414,12 @@ export const assertEffectiveTargetConfigMatrix = (() => {
|
|
|
409
414
|
expected: "(\"app-store\" | \"apps-in-toss\" | \"devvit\" | \"google-play\" | \"microsoft-store\" | \"verse8\" | \"web\" | \"web-preview\")",
|
|
410
415
|
value: input.profile
|
|
411
416
|
}, _errorFactory);
|
|
412
|
-
const _ao4 = (input, _path, _exceptionable = true) => _ap1(input, _path, true && _exceptionable) &&
|
|
417
|
+
const _ao4 = (input, _path, _exceptionable = true) => _ap1(input, _path, true && _exceptionable) && (undefined === input.bannerAds || "boolean" === typeof input.bannerAds || _assertGuard_1._assertGuard(_exceptionable, {
|
|
418
|
+
method: "typia.createAssert",
|
|
419
|
+
path: _path + ".bannerAds",
|
|
420
|
+
expected: "(boolean | undefined)",
|
|
421
|
+
value: input.bannerAds
|
|
422
|
+
}, _errorFactory)) && _ap2(input, _path, true && _exceptionable) && _ap3(input, _path, true && _exceptionable) && ("boolean" === typeof input.leaderboard || _assertGuard_1._assertGuard(_exceptionable, {
|
|
413
423
|
method: "typia.createAssert",
|
|
414
424
|
path: _path + ".leaderboard",
|
|
415
425
|
expected: "boolean",
|
|
@@ -564,8 +574,8 @@ export const assertEffectiveTargetConfigMatrix = (() => {
|
|
|
564
574
|
const _io11 = input => _ip8(input) && _ip9(input) && _ip10(input);
|
|
565
575
|
const _io12 = input => "entitlement" === input.type && "string" === typeof input.entitlement;
|
|
566
576
|
const _io13 = input => "resource" === input.type && ("string" === typeof input.resource && 1 <= input.resource.length) && ("number" === typeof input.amount && (0 < input.amount && input.amount <= 1.7976931348623157e+308));
|
|
567
|
-
const _io14 = input => _ip2(input) && _ip3(input) && (Array.isArray(input.placements) && input.placements.every(elem => "object" === typeof elem && null !== elem && _io15(elem)));
|
|
568
|
-
const _io15 = input => _ip5(input) && ("interstitial" === input.type || "rewarded" === input.type) && (undefined === input.reward || "object" === typeof input.reward && null !== input.reward && _iu1(input.reward)) && ("object" === typeof input.frequencyCap && null !== input.frequencyCap && _io18(input.frequencyCap)) && _ip6(input) && _ip7(input) && (undefined === input.platformPlacementId || "string" === typeof input.platformPlacementId);
|
|
577
|
+
const _io14 = input => "boolean" === typeof input.bannerAds && _ip2(input) && _ip3(input) && (Array.isArray(input.placements) && input.placements.every(elem => "object" === typeof elem && null !== elem && _io15(elem)));
|
|
578
|
+
const _io15 = input => _ip5(input) && ("banner" === input.type || "interstitial" === input.type || "rewarded" === input.type) && (undefined === input.reward || "object" === typeof input.reward && null !== input.reward && _iu1(input.reward)) && ("object" === typeof input.frequencyCap && null !== input.frequencyCap && _io18(input.frequencyCap)) && _ip6(input) && _ip7(input) && (undefined === input.platformPlacementId || "string" === typeof input.platformPlacementId);
|
|
569
579
|
const _io16 = input => "continue" === input.type && _ip10(input);
|
|
570
580
|
const _io17 = input => _ip8(input) && _ip10(input) && _ip9(input);
|
|
571
581
|
const _io18 = input => "number" === typeof input.cooldownSeconds && (undefined === input.maxPerSession || "number" === typeof input.maxPerSession) && (undefined === input.minStageInterval || "number" === typeof input.minStageInterval);
|
|
@@ -574,7 +584,7 @@ export const assertEffectiveTargetConfigMatrix = (() => {
|
|
|
574
584
|
const _io20 = input => ("local" === input.support || "native" === input.support || "none" === input.support) && _ip6(input);
|
|
575
585
|
const _io21 = input => _ip6(input) && ("en" === input.fallbackLocale || "ko" === input.fallbackLocale);
|
|
576
586
|
const _io3 = input => "app-store" === input.profile || "apps-in-toss" === input.profile || "devvit" === input.profile || "google-play" === input.profile || "microsoft-store" === input.profile || "verse8" === input.profile || "web" === input.profile || "web-preview" === input.profile;
|
|
577
|
-
const _io4 = input => _ip1(input) && _ip2(input) && _ip3(input) && "boolean" === typeof input.leaderboard && _ip4(input);
|
|
587
|
+
const _io4 = input => _ip1(input) && (undefined === input.bannerAds || "boolean" === typeof input.bannerAds) && _ip2(input) && _ip3(input) && "boolean" === typeof input.leaderboard && _ip4(input);
|
|
578
588
|
const _io5 = input => ("local" === input.storage || "native" === input.storage || "none" === input.storage) && _ip4(input);
|
|
579
589
|
const _io6 = input => ("approval-required" === input.identityUpgrade || "available" === input.identityUpgrade || "configuration-required" === input.identityUpgrade || "disabled" === input.identityUpgrade || "unsupported" === input.identityUpgrade) && ("approval-required" === input.presentation || "available" === input.presentation || "configuration-required" === input.presentation || "disabled" === input.presentation || "unsupported" === input.presentation) && ("approval-required" === input.sharing || "available" === input.sharing || "configuration-required" === input.sharing || "disabled" === input.sharing || "unsupported" === input.sharing) && ("approval-required" === input.inboundShare || "available" === input.inboundShare || "configuration-required" === input.inboundShare || "disabled" === input.inboundShare || "unsupported" === input.inboundShare) && ("approval-required" === input.notifications || "available" === input.notifications || "configuration-required" === input.notifications || "disabled" === input.notifications || "unsupported" === input.notifications) && ("fullscreen" === input.presentationMode || "inline-expanded" === input.presentationMode);
|
|
580
590
|
const _io7 = input => "boolean" === typeof input.externalPaymentAllowed && "boolean" === typeof input.remoteExecutableCodeAllowed && "boolean" === typeof input.installOtherAppCTAAllowed && "boolean" === typeof input.requiresStoreReview && "boolean" === typeof input.requiresAitReview;
|
|
@@ -620,9 +630,10 @@ export const assertEffectiveTargetConfigMatrix = (() => {
|
|
|
620
630
|
})();
|
|
621
631
|
export const assertTargetConfigMatrix = (() => {
|
|
622
632
|
const _ip0 = input => "boolean" === typeof input["iap"];
|
|
623
|
-
const _ip1 = input => "boolean" === typeof input["
|
|
624
|
-
const _ip2 = input => "boolean" === typeof input["
|
|
625
|
-
const _ip3 = input => "boolean" === typeof input["
|
|
633
|
+
const _ip1 = input => undefined === input["bannerAds"] || "boolean" === typeof input["bannerAds"];
|
|
634
|
+
const _ip2 = input => "boolean" === typeof input["rewardedAds"];
|
|
635
|
+
const _ip3 = input => "boolean" === typeof input["interstitialAds"];
|
|
636
|
+
const _ip4 = input => "boolean" === typeof input["localization"];
|
|
626
637
|
const _ae0 = "(\"apps-in-toss\" | \"capacitor-android\" | \"capacitor-ios\" | \"devvit-web\" | \"microsoft-store-pwa\" | \"verse8-web\" | \"web\" | \"web-preview\")";
|
|
627
638
|
const _ap0 = (input, _path, _exceptionable = true) => "boolean" === typeof input["iap"] || _assertGuard_1._assertGuard(_exceptionable, {
|
|
628
639
|
method: "typia.createAssert",
|
|
@@ -630,19 +641,25 @@ export const assertTargetConfigMatrix = (() => {
|
|
|
630
641
|
expected: "boolean",
|
|
631
642
|
value: input["iap"]
|
|
632
643
|
}, _errorFactory);
|
|
633
|
-
const _ap1 = (input, _path, _exceptionable = true) => "boolean" === typeof input["
|
|
644
|
+
const _ap1 = (input, _path, _exceptionable = true) => undefined === input["bannerAds"] || "boolean" === typeof input["bannerAds"] || _assertGuard_1._assertGuard(_exceptionable, {
|
|
645
|
+
method: "typia.createAssert",
|
|
646
|
+
path: _path + ".bannerAds",
|
|
647
|
+
expected: "(boolean | undefined)",
|
|
648
|
+
value: input["bannerAds"]
|
|
649
|
+
}, _errorFactory);
|
|
650
|
+
const _ap2 = (input, _path, _exceptionable = true) => "boolean" === typeof input["rewardedAds"] || _assertGuard_1._assertGuard(_exceptionable, {
|
|
634
651
|
method: "typia.createAssert",
|
|
635
652
|
path: _path + ".rewardedAds",
|
|
636
653
|
expected: "boolean",
|
|
637
654
|
value: input["rewardedAds"]
|
|
638
655
|
}, _errorFactory);
|
|
639
|
-
const
|
|
656
|
+
const _ap3 = (input, _path, _exceptionable = true) => "boolean" === typeof input["interstitialAds"] || _assertGuard_1._assertGuard(_exceptionable, {
|
|
640
657
|
method: "typia.createAssert",
|
|
641
658
|
path: _path + ".interstitialAds",
|
|
642
659
|
expected: "boolean",
|
|
643
660
|
value: input["interstitialAds"]
|
|
644
661
|
}, _errorFactory);
|
|
645
|
-
const
|
|
662
|
+
const _ap4 = (input, _path, _exceptionable = true) => "boolean" === typeof input["localization"] || _assertGuard_1._assertGuard(_exceptionable, {
|
|
646
663
|
method: "typia.createAssert",
|
|
647
664
|
path: _path + ".localization",
|
|
648
665
|
expected: "boolean",
|
|
@@ -797,25 +814,25 @@ export const assertTargetConfigMatrix = (() => {
|
|
|
797
814
|
expected: "(TargetIntegrationConfig | undefined)",
|
|
798
815
|
value: input.integrations
|
|
799
816
|
}, _errorFactory));
|
|
800
|
-
const _ao3 = (input, _path, _exceptionable = true) => _ap0(input, _path, true && _exceptionable) && _ap1(input, _path, true && _exceptionable) && _ap2(input, _path, true && _exceptionable) && ("boolean" === typeof input.leaderboard || _assertGuard_1._assertGuard(_exceptionable, {
|
|
817
|
+
const _ao3 = (input, _path, _exceptionable = true) => _ap0(input, _path, true && _exceptionable) && _ap1(input, _path, true && _exceptionable) && _ap2(input, _path, true && _exceptionable) && _ap3(input, _path, true && _exceptionable) && ("boolean" === typeof input.leaderboard || _assertGuard_1._assertGuard(_exceptionable, {
|
|
801
818
|
method: "typia.createAssert",
|
|
802
819
|
path: _path + ".leaderboard",
|
|
803
820
|
expected: "boolean",
|
|
804
821
|
value: input.leaderboard
|
|
805
|
-
}, _errorFactory)) &&
|
|
822
|
+
}, _errorFactory)) && _ap4(input, _path, true && _exceptionable);
|
|
806
823
|
const _ao4 = (input, _path, _exceptionable = true) => ("local" === input.storage || "native" === input.storage || "none" === input.storage || _assertGuard_1._assertGuard(_exceptionable, {
|
|
807
824
|
method: "typia.createAssert",
|
|
808
825
|
path: _path + ".storage",
|
|
809
826
|
expected: "(\"local\" | \"native\" | \"none\")",
|
|
810
827
|
value: input.storage
|
|
811
|
-
}, _errorFactory)) &&
|
|
828
|
+
}, _errorFactory)) && _ap4(input, _path, true && _exceptionable);
|
|
812
829
|
const _ao5 = (input, _path, _exceptionable = true) => "en" === input.fallbackLocale || "ko" === input.fallbackLocale || _assertGuard_1._assertGuard(_exceptionable, {
|
|
813
830
|
method: "typia.createAssert",
|
|
814
831
|
path: _path + ".fallbackLocale",
|
|
815
832
|
expected: "(\"en\" | \"ko\")",
|
|
816
833
|
value: input.fallbackLocale
|
|
817
834
|
}, _errorFactory);
|
|
818
|
-
const _ao6 = (input, _path, _exceptionable = true) => _ap0(input, _path, true && _exceptionable) && _ap1(input, _path, true && _exceptionable) && _ap2(input, _path, true && _exceptionable);
|
|
835
|
+
const _ao6 = (input, _path, _exceptionable = true) => _ap0(input, _path, true && _exceptionable) && _ap1(input, _path, true && _exceptionable) && _ap2(input, _path, true && _exceptionable) && _ap3(input, _path, true && _exceptionable);
|
|
819
836
|
const _ao7 = (input, _path, _exceptionable = true) => "boolean" === typeof input.native || _assertGuard_1._assertGuard(_exceptionable, {
|
|
820
837
|
method: "typia.createAssert",
|
|
821
838
|
path: _path + ".native",
|
|
@@ -863,10 +880,10 @@ export const assertTargetConfigMatrix = (() => {
|
|
|
863
880
|
});
|
|
864
881
|
const _io10 = input => ("approval-required" === input.identityUpgrade || "available" === input.identityUpgrade || "configuration-required" === input.identityUpgrade || "disabled" === input.identityUpgrade || "unsupported" === input.identityUpgrade) && ("approval-required" === input.presentation || "available" === input.presentation || "configuration-required" === input.presentation || "disabled" === input.presentation || "unsupported" === input.presentation) && ("approval-required" === input.sharing || "available" === input.sharing || "configuration-required" === input.sharing || "disabled" === input.sharing || "unsupported" === input.sharing) && ("approval-required" === input.inboundShare || "available" === input.inboundShare || "configuration-required" === input.inboundShare || "disabled" === input.inboundShare || "unsupported" === input.inboundShare) && ("approval-required" === input.notifications || "available" === input.notifications || "configuration-required" === input.notifications || "disabled" === input.notifications || "unsupported" === input.notifications) && ("fullscreen" === input.presentationMode || "inline-expanded" === input.presentationMode);
|
|
865
882
|
const _io2 = input => ("apps-in-toss" === input.runtime || "capacitor-android" === input.runtime || "capacitor-ios" === input.runtime || "devvit-web" === input.runtime || "microsoft-store-pwa" === input.runtime || "verse8-web" === input.runtime || "web" === input.runtime || "web-preview" === input.runtime) && ("object" === typeof input.features && null !== input.features && _io3(input.features)) && ("object" === typeof input.capabilities && null !== input.capabilities && _io4(input.capabilities)) && ("object" === typeof input.localization && null !== input.localization && _io5(input.localization)) && ("object" === typeof input.monetization && null !== input.monetization && _io6(input.monetization)) && ("object" === typeof input.leaderboard && null !== input.leaderboard && _io7(input.leaderboard)) && ("object" === typeof input.release && null !== input.release && _io8(input.release)) && ("object" === typeof input.policy && null !== input.policy && _io9(input.policy)) && (undefined === input.integrations || "object" === typeof input.integrations && null !== input.integrations && _io10(input.integrations));
|
|
866
|
-
const _io3 = input => _ip0(input) && _ip1(input) && _ip2(input) && "boolean" === typeof input.leaderboard &&
|
|
867
|
-
const _io4 = input => ("local" === input.storage || "native" === input.storage || "none" === input.storage) &&
|
|
883
|
+
const _io3 = input => _ip0(input) && _ip1(input) && _ip2(input) && _ip3(input) && "boolean" === typeof input.leaderboard && _ip4(input);
|
|
884
|
+
const _io4 = input => ("local" === input.storage || "native" === input.storage || "none" === input.storage) && _ip4(input);
|
|
868
885
|
const _io5 = input => "en" === input.fallbackLocale || "ko" === input.fallbackLocale;
|
|
869
|
-
const _io6 = input => _ip0(input) && _ip1(input) && _ip2(input);
|
|
886
|
+
const _io6 = input => _ip0(input) && _ip1(input) && _ip2(input) && _ip3(input);
|
|
870
887
|
const _io7 = input => "boolean" === typeof input.native;
|
|
871
888
|
const _io8 = input => "app-store" === input.profile || "apps-in-toss" === input.profile || "devvit" === input.profile || "google-play" === input.profile || "microsoft-store" === input.profile || "verse8" === input.profile || "web" === input.profile || "web-preview" === input.profile;
|
|
872
889
|
const _io9 = input => "boolean" === typeof input.externalPaymentAllowed && "boolean" === typeof input.remoteExecutableCodeAllowed && "boolean" === typeof input.installOtherAppCTAAllowed && "boolean" === typeof input.requiresStoreReview && "boolean" === typeof input.requiresAitReview;
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { MpgdLocale } from '@mpgd/i18n';
|
|
2
2
|
import type { PlatformCapabilities, PlatformGateway } from '@mpgd/platform';
|
|
3
3
|
import type { EffectiveTargetConfig } from './effective.js';
|
|
4
|
-
export type PlatformFeature = 'iap' | 'rewardedAds' | 'interstitialAds' | 'leaderboard' | 'localization';
|
|
5
|
-
export type AdPlacementType = 'rewarded' | 'interstitial';
|
|
4
|
+
export type PlatformFeature = 'iap' | 'bannerAds' | 'rewardedAds' | 'interstitialAds' | 'leaderboard' | 'localization';
|
|
5
|
+
export type AdPlacementType = 'rewarded' | 'interstitial' | 'banner';
|
|
6
6
|
type PlatformConfigTarget = PlatformGateway['target'];
|
|
7
7
|
export type TargetRuntimeKind = 'web' | 'web-preview' | 'microsoft-store-pwa' | 'capacitor-android' | 'capacitor-ios' | 'apps-in-toss' | 'devvit-web' | 'verse8-web';
|
|
8
8
|
export type ReleaseProfile = 'web' | 'web-preview' | 'microsoft-store' | 'google-play' | 'app-store' | 'apps-in-toss' | 'devvit' | 'verse8';
|
|
@@ -20,6 +20,8 @@ export interface TargetIntegrationConfig {
|
|
|
20
20
|
}
|
|
21
21
|
export interface TargetFeatureConfig {
|
|
22
22
|
readonly iap: boolean;
|
|
23
|
+
/** Optional for target matrices authored before inline banner support. */
|
|
24
|
+
readonly bannerAds?: boolean;
|
|
23
25
|
readonly rewardedAds: boolean;
|
|
24
26
|
readonly interstitialAds: boolean;
|
|
25
27
|
readonly leaderboard: boolean;
|
|
@@ -34,6 +36,8 @@ export interface TargetLocalizationConfig {
|
|
|
34
36
|
}
|
|
35
37
|
export interface TargetMonetizationConfig {
|
|
36
38
|
readonly iap: boolean;
|
|
39
|
+
/** Optional for target matrices authored before inline banner support. */
|
|
40
|
+
readonly bannerAds?: boolean;
|
|
37
41
|
readonly rewardedAds: boolean;
|
|
38
42
|
readonly interstitialAds: boolean;
|
|
39
43
|
}
|
|
@@ -112,7 +116,8 @@ export interface TargetConfiguredGateway extends PlatformGateway {
|
|
|
112
116
|
readonly effectiveConfig?: EffectiveTargetConfig;
|
|
113
117
|
getTargetRuntime(): Promise<TargetRuntimeSnapshot>;
|
|
114
118
|
}
|
|
115
|
-
export declare const platformFeatures: readonly ["iap", "rewardedAds", "interstitialAds", "leaderboard", "localization"];
|
|
119
|
+
export declare const platformFeatures: readonly ["iap", "bannerAds", "rewardedAds", "interstitialAds", "leaderboard", "localization"];
|
|
120
|
+
export declare function adPlacementFeatureFor(type: AdPlacementType): PlatformFeature;
|
|
116
121
|
export declare const targetIntegrations: readonly ["identityUpgrade", "presentation", "sharing", "inboundShare", "notifications"];
|
|
117
122
|
type CompleteValueList<Union, Values extends readonly Union[]> = Exclude<Union, Values[number]> extends never ? Values : never;
|
|
118
123
|
declare const integrationAvailabilityStateValues: readonly ["available", "disabled", "approval-required", "configuration-required", "unsupported"];
|
package/dist/runtime.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
const adPlacementFeatureByType = {
|
|
2
|
+
rewarded: 'rewardedAds',
|
|
3
|
+
interstitial: 'interstitialAds',
|
|
4
|
+
banner: 'bannerAds',
|
|
5
|
+
};
|
|
1
6
|
export const platformFeatures = [
|
|
2
7
|
'iap',
|
|
8
|
+
'bannerAds',
|
|
3
9
|
'rewardedAds',
|
|
4
10
|
'interstitialAds',
|
|
5
11
|
'leaderboard',
|
|
6
12
|
'localization',
|
|
7
13
|
];
|
|
14
|
+
export function adPlacementFeatureFor(type) {
|
|
15
|
+
return adPlacementFeatureByType[type];
|
|
16
|
+
}
|
|
8
17
|
export const targetIntegrations = [
|
|
9
18
|
'identityUpgrade',
|
|
10
19
|
'presentation',
|
|
@@ -100,23 +109,27 @@ export function getTargetConfig(matrix, target) {
|
|
|
100
109
|
return config;
|
|
101
110
|
}
|
|
102
111
|
export function isPlatformFeatureEnabled(config, feature) {
|
|
103
|
-
return config.features[feature];
|
|
112
|
+
return config.features[feature] === true;
|
|
104
113
|
}
|
|
105
114
|
export function applyTargetConfigToCapabilities(capabilities, config) {
|
|
115
|
+
const bannerAds = capabilities.bannerAds === true && config.features.bannerAds === true;
|
|
116
|
+
const rewardedAds = capabilities.rewardedAds && config.features.rewardedAds;
|
|
117
|
+
const interstitialAds = capabilities.interstitialAds && config.features.interstitialAds;
|
|
106
118
|
return {
|
|
107
119
|
...capabilities,
|
|
108
120
|
nativeIap: capabilities.nativeIap && config.features.iap,
|
|
109
121
|
nativeAds: capabilities.nativeAds &&
|
|
110
|
-
(
|
|
111
|
-
|
|
112
|
-
|
|
122
|
+
(bannerAds || rewardedAds || interstitialAds),
|
|
123
|
+
bannerAds,
|
|
124
|
+
rewardedAds,
|
|
125
|
+
interstitialAds,
|
|
113
126
|
nativeLeaderboard: capabilities.nativeLeaderboard && config.features.leaderboard,
|
|
114
127
|
remoteLeaderboard: capabilities.remoteLeaderboard && config.features.leaderboard,
|
|
115
128
|
localizedContent: capabilities.localizedContent && config.features.localization,
|
|
116
129
|
};
|
|
117
130
|
}
|
|
118
131
|
export function getFeatureAvailability(feature, config, capabilities) {
|
|
119
|
-
const targetEnabled = config.features[feature];
|
|
132
|
+
const targetEnabled = config.features[feature] === true;
|
|
120
133
|
const capabilitySupported = isFeatureCapabilitySupported(feature, capabilities);
|
|
121
134
|
const enabled = targetEnabled && capabilitySupported;
|
|
122
135
|
return {
|
|
@@ -140,6 +153,7 @@ export function createTargetRuntimeSnapshot(input) {
|
|
|
140
153
|
const availabilityConfig = resolveAvailabilityConfig(input.config, input.effectiveConfig);
|
|
141
154
|
const features = {
|
|
142
155
|
iap: getFeatureAvailability('iap', availabilityConfig, input.capabilities),
|
|
156
|
+
bannerAds: getFeatureAvailability('bannerAds', availabilityConfig, input.capabilities),
|
|
143
157
|
rewardedAds: getFeatureAvailability('rewardedAds', availabilityConfig, input.capabilities),
|
|
144
158
|
interstitialAds: getFeatureAvailability('interstitialAds', availabilityConfig, input.capabilities),
|
|
145
159
|
leaderboard: getFeatureAvailability('leaderboard', availabilityConfig, input.capabilities),
|
|
@@ -161,7 +175,7 @@ export function createTargetRuntimeSnapshot(input) {
|
|
|
161
175
|
features,
|
|
162
176
|
integrations,
|
|
163
177
|
adPlacements: (input.adPlacements ?? []).map((placement) => {
|
|
164
|
-
const feature = placement.type
|
|
178
|
+
const feature = adPlacementFeatureFor(placement.type);
|
|
165
179
|
const availability = features[feature];
|
|
166
180
|
return {
|
|
167
181
|
id: placement.id,
|
|
@@ -219,20 +233,16 @@ export function withTargetAvailability(gateway, config, options = {}) {
|
|
|
219
233
|
if (actualType !== undefined && actualType !== expectedType) {
|
|
220
234
|
return false;
|
|
221
235
|
}
|
|
222
|
-
return expectedType ===
|
|
223
|
-
? availabilityConfig.features.rewardedAds
|
|
224
|
-
: availabilityConfig.features.interstitialAds;
|
|
236
|
+
return availabilityConfig.features[adPlacementFeatureFor(expectedType)] === true;
|
|
225
237
|
};
|
|
226
238
|
const canPreloadAdPlacement = (placementId) => {
|
|
227
239
|
const actualType = options.resolveAdPlacementType?.(placementId);
|
|
228
|
-
if (actualType
|
|
229
|
-
return availabilityConfig.features
|
|
230
|
-
}
|
|
231
|
-
if (actualType === 'interstitial') {
|
|
232
|
-
return availabilityConfig.features.interstitialAds;
|
|
240
|
+
if (actualType !== undefined) {
|
|
241
|
+
return availabilityConfig.features[adPlacementFeatureFor(actualType)] === true;
|
|
233
242
|
}
|
|
234
243
|
return (availabilityConfig.features.rewardedAds ||
|
|
235
|
-
availabilityConfig.features.interstitialAds
|
|
244
|
+
availabilityConfig.features.interstitialAds ||
|
|
245
|
+
availabilityConfig.features.bannerAds === true);
|
|
236
246
|
};
|
|
237
247
|
return {
|
|
238
248
|
...gatewayWithoutIntegrations,
|
|
@@ -310,6 +320,18 @@ export function withTargetAvailability(gateway, config, options = {}) {
|
|
|
310
320
|
}
|
|
311
321
|
return gateway.ads.showInterstitial(input);
|
|
312
322
|
},
|
|
323
|
+
async mountBanner(input) {
|
|
324
|
+
if (!isAdPlacementAllowed(input.placementId, 'banner')
|
|
325
|
+
|| gateway.ads.mountBanner === undefined) {
|
|
326
|
+
return { status: 'unavailable' };
|
|
327
|
+
}
|
|
328
|
+
return gateway.ads.mountBanner(input);
|
|
329
|
+
},
|
|
330
|
+
async unmountBanner(input) {
|
|
331
|
+
if (gateway.ads.unmountBanner !== undefined) {
|
|
332
|
+
await gateway.ads.unmountBanner(input);
|
|
333
|
+
}
|
|
334
|
+
},
|
|
313
335
|
},
|
|
314
336
|
leaderboard: {
|
|
315
337
|
async submitScore(input) {
|
|
@@ -343,6 +365,8 @@ function isFeatureCapabilitySupported(feature, capabilities) {
|
|
|
343
365
|
switch (feature) {
|
|
344
366
|
case 'iap':
|
|
345
367
|
return capabilities.nativeIap;
|
|
368
|
+
case 'bannerAds':
|
|
369
|
+
return capabilities.bannerAds === true;
|
|
346
370
|
case 'rewardedAds':
|
|
347
371
|
return capabilities.rewardedAds;
|
|
348
372
|
case 'interstitialAds':
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpgd/target-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "Target-specific platform feature availability and effective config helpers for mpgd.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"typia": "13.0.2",
|
|
40
|
-
"@mpgd/catalog": "0.
|
|
41
|
-
"@mpgd/
|
|
42
|
-
"@mpgd/
|
|
40
|
+
"@mpgd/catalog": "0.7.1",
|
|
41
|
+
"@mpgd/platform": "0.11.0",
|
|
42
|
+
"@mpgd/i18n": "0.5.7"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"ttsc": "0.18.4",
|
package/targets.json
CHANGED
|
@@ -220,6 +220,7 @@
|
|
|
220
220
|
"runtime": "apps-in-toss",
|
|
221
221
|
"features": {
|
|
222
222
|
"iap": true,
|
|
223
|
+
"bannerAds": true,
|
|
223
224
|
"rewardedAds": true,
|
|
224
225
|
"interstitialAds": true,
|
|
225
226
|
"leaderboard": true,
|
|
@@ -234,6 +235,7 @@
|
|
|
234
235
|
},
|
|
235
236
|
"monetization": {
|
|
236
237
|
"iap": true,
|
|
238
|
+
"bannerAds": true,
|
|
237
239
|
"rewardedAds": true,
|
|
238
240
|
"interstitialAds": true
|
|
239
241
|
},
|