@saasicat/nest 0.25.0 → 0.26.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.
- package/dist/_entries.cjs +25 -5
- package/dist/billing/index.js +7 -7
- package/dist/catalog/index.js +5 -5
- package/dist/checkout-offer/index.js +2 -2
- package/dist/{chunk-VQQWF7MW.js → chunk-37HEKVDH.js} +25 -5
- package/dist/{chunk-4O6R6ARQ.js → chunk-B6IWLV7R.js} +1 -1
- package/dist/{chunk-RPZKPFWI.js → chunk-J62YI25C.js} +20 -20
- package/dist/{chunk-7ZPFQXHM.js → chunk-UOWK2HYG.js} +1 -1
- package/dist/{chunk-A7FHAN2I.js → chunk-V3MRZ7SH.js} +11 -11
- package/dist/entitlement/index.js +3 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +53 -53
- package/dist/platform/index.js +29 -29
- package/dist/promo/index.d.cts +48 -2
- package/dist/promo/index.d.ts +48 -2
- package/dist/promo/index.js +4 -4
- package/dist/testing/index.js +12 -12
- package/package.json +4 -4
- package/dist/{chunk-XTVAFJ3P.js → chunk-I4XD43AN.js} +3 -3
- package/dist/{chunk-7X5MSAIL.js → chunk-QB7MICKQ.js} +9 -9
- package/dist/{chunk-NNNXXUPT.js → chunk-RPO4IVUY.js} +6 -6
package/dist/_entries.cjs
CHANGED
|
@@ -4820,12 +4820,32 @@ function addCycles(date, cycle, n) {
|
|
|
4820
4820
|
return r;
|
|
4821
4821
|
}
|
|
4822
4822
|
__name(addCycles, "addCycles");
|
|
4823
|
-
|
|
4823
|
+
var LEGACY_LABEL_LOCALE = "de-DE";
|
|
4824
|
+
var LEGACY_LABEL_CURRENCY = "EUR";
|
|
4825
|
+
var ICU_NON_BREAKING_SPACES = /[\u00A0\u202F]/g;
|
|
4826
|
+
function requireSupportedLocale(locale) {
|
|
4827
|
+
if (Intl.NumberFormat.supportedLocalesOf([
|
|
4828
|
+
locale
|
|
4829
|
+
]).length === 0) {
|
|
4830
|
+
throw new RangeError(`buildLabel: locale "${locale}" names a language this runtime cannot serve. It would be formatted as "${new Intl.NumberFormat(locale).resolvedOptions().locale}" instead \u2014 a language nobody chose. Pass a tag the runtime serves.`);
|
|
4831
|
+
}
|
|
4832
|
+
}
|
|
4833
|
+
__name(requireSupportedLocale, "requireSupportedLocale");
|
|
4834
|
+
function formatPromoValue(value, valueType, { locale = LEGACY_LABEL_LOCALE, currency = LEGACY_LABEL_CURRENCY }) {
|
|
4835
|
+
requireSupportedLocale(locale);
|
|
4836
|
+
const numberFormat = valueType === "PERCENT" ? {
|
|
4837
|
+
style: "unit",
|
|
4838
|
+
unit: "percent"
|
|
4839
|
+
} : {
|
|
4840
|
+
style: "currency",
|
|
4841
|
+
currency
|
|
4842
|
+
};
|
|
4843
|
+
return new Intl.NumberFormat(locale, numberFormat).format(value).replace(ICU_NON_BREAKING_SPACES, " ");
|
|
4844
|
+
}
|
|
4845
|
+
__name(formatPromoValue, "formatPromoValue");
|
|
4846
|
+
function buildLabel(code, cycle, options = {}) {
|
|
4824
4847
|
const value = Number(code.value);
|
|
4825
|
-
const valueStr = code.valueType
|
|
4826
|
-
minimumFractionDigits: 2,
|
|
4827
|
-
maximumFractionDigits: 2
|
|
4828
|
-
})} \u20AC`;
|
|
4848
|
+
const valueStr = formatPromoValue(value, code.valueType, options);
|
|
4829
4849
|
if (code.durationType === "ONCE") {
|
|
4830
4850
|
return `${valueStr} once`;
|
|
4831
4851
|
}
|
package/dist/billing/index.js
CHANGED
|
@@ -60,8 +60,8 @@ import {
|
|
|
60
60
|
periodEndWithMinLead,
|
|
61
61
|
resolveBundleCancelEffectiveAt,
|
|
62
62
|
resolveBundlePriceNet
|
|
63
|
-
} from "../chunk-
|
|
64
|
-
import "../chunk-
|
|
63
|
+
} from "../chunk-V3MRZ7SH.js";
|
|
64
|
+
import "../chunk-37HEKVDH.js";
|
|
65
65
|
import "../chunk-B7NRY2LV.js";
|
|
66
66
|
import {
|
|
67
67
|
AUDIT_CONTEXT_RESOLVER_TOKEN,
|
|
@@ -77,13 +77,11 @@ import {
|
|
|
77
77
|
classifyBundleVersionDiff,
|
|
78
78
|
classifyPlanDiff
|
|
79
79
|
} from "../chunk-WPUVJRIN.js";
|
|
80
|
-
import "../chunk-E56W4U2P.js";
|
|
81
80
|
import "../chunk-BSK6YBLI.js";
|
|
82
|
-
import "../chunk-YSC46BGM.js";
|
|
83
81
|
import {
|
|
84
82
|
SUBSCRIPTION_BUNDLE_CONFIG_TOKEN,
|
|
85
83
|
SUBSCRIPTION_BUNDLE_REPOSITORY_TOKEN
|
|
86
|
-
} from "../chunk-
|
|
84
|
+
} from "../chunk-RPO4IVUY.js";
|
|
87
85
|
import {
|
|
88
86
|
PLAN_CATALOG_READ_SINK_TOKEN,
|
|
89
87
|
PLAN_CATALOG_TOKEN,
|
|
@@ -100,11 +98,13 @@ import {
|
|
|
100
98
|
isFeaturePlannedOnly
|
|
101
99
|
} from "../chunk-DQKCK7DX.js";
|
|
102
100
|
import "../chunk-NYLON2VC.js";
|
|
103
|
-
import "../chunk-EBJJNTW6.js";
|
|
104
101
|
import "../chunk-WKVBNTYC.js";
|
|
105
102
|
import "../chunk-L4KTQ6CL.js";
|
|
106
|
-
import "../chunk-SABTXESR.js";
|
|
107
103
|
import "../chunk-L4SUWH5B.js";
|
|
104
|
+
import "../chunk-E56W4U2P.js";
|
|
105
|
+
import "../chunk-YSC46BGM.js";
|
|
106
|
+
import "../chunk-EBJJNTW6.js";
|
|
107
|
+
import "../chunk-SABTXESR.js";
|
|
108
108
|
import "../chunk-SHUYVCID.js";
|
|
109
109
|
export {
|
|
110
110
|
AUDIT_CONTEXT_RESOLVER_TOKEN,
|
package/dist/catalog/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
runSeedGateFromFile,
|
|
7
7
|
seedGateExitCode,
|
|
8
8
|
validateSeedAgainstSnapshot
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-UOWK2HYG.js";
|
|
10
10
|
import "../chunk-74SCJ4HF.js";
|
|
11
11
|
import {
|
|
12
12
|
ADVISORY_STRICT_MODE_CODES,
|
|
@@ -56,10 +56,8 @@ import {
|
|
|
56
56
|
quotaApprovalSignature,
|
|
57
57
|
validateBundleDraft,
|
|
58
58
|
validatePlanDraft
|
|
59
|
-
} from "../chunk-
|
|
59
|
+
} from "../chunk-QB7MICKQ.js";
|
|
60
60
|
import "../chunk-WPUVJRIN.js";
|
|
61
|
-
import "../chunk-E56W4U2P.js";
|
|
62
|
-
import "../chunk-YSC46BGM.js";
|
|
63
61
|
import "../chunk-5ZXBXYXU.js";
|
|
64
62
|
import "../chunk-WKVBNTYC.js";
|
|
65
63
|
import {
|
|
@@ -71,8 +69,10 @@ import {
|
|
|
71
69
|
PLAN_REPOSITORY_TOKEN,
|
|
72
70
|
PROMOTION_REPOSITORY_TOKEN
|
|
73
71
|
} from "../chunk-L4KTQ6CL.js";
|
|
74
|
-
import "../chunk-SABTXESR.js";
|
|
75
72
|
import "../chunk-L4SUWH5B.js";
|
|
73
|
+
import "../chunk-E56W4U2P.js";
|
|
74
|
+
import "../chunk-YSC46BGM.js";
|
|
75
|
+
import "../chunk-SABTXESR.js";
|
|
76
76
|
import "../chunk-SHUYVCID.js";
|
|
77
77
|
export {
|
|
78
78
|
ADVISORY_STRICT_MODE_CODES,
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
CreateCheckoutOfferDto,
|
|
7
7
|
UpdateCheckoutOfferDto,
|
|
8
8
|
buildCheckoutOfferController
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-I4XD43AN.js";
|
|
10
10
|
import "../chunk-BSK6YBLI.js";
|
|
11
|
-
import "../chunk-YSC46BGM.js";
|
|
12
11
|
import "../chunk-L4KTQ6CL.js";
|
|
12
|
+
import "../chunk-YSC46BGM.js";
|
|
13
13
|
import "../chunk-SABTXESR.js";
|
|
14
14
|
import "../chunk-SHUYVCID.js";
|
|
15
15
|
export {
|
|
@@ -43,12 +43,32 @@ function addCycles(date, cycle, n) {
|
|
|
43
43
|
return r;
|
|
44
44
|
}
|
|
45
45
|
__name(addCycles, "addCycles");
|
|
46
|
-
|
|
46
|
+
var LEGACY_LABEL_LOCALE = "de-DE";
|
|
47
|
+
var LEGACY_LABEL_CURRENCY = "EUR";
|
|
48
|
+
var ICU_NON_BREAKING_SPACES = /[\u00A0\u202F]/g;
|
|
49
|
+
function requireSupportedLocale(locale) {
|
|
50
|
+
if (Intl.NumberFormat.supportedLocalesOf([
|
|
51
|
+
locale
|
|
52
|
+
]).length === 0) {
|
|
53
|
+
throw new RangeError(`buildLabel: locale "${locale}" names a language this runtime cannot serve. It would be formatted as "${new Intl.NumberFormat(locale).resolvedOptions().locale}" instead \u2014 a language nobody chose. Pass a tag the runtime serves.`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
__name(requireSupportedLocale, "requireSupportedLocale");
|
|
57
|
+
function formatPromoValue(value, valueType, { locale = LEGACY_LABEL_LOCALE, currency = LEGACY_LABEL_CURRENCY }) {
|
|
58
|
+
requireSupportedLocale(locale);
|
|
59
|
+
const numberFormat = valueType === "PERCENT" ? {
|
|
60
|
+
style: "unit",
|
|
61
|
+
unit: "percent"
|
|
62
|
+
} : {
|
|
63
|
+
style: "currency",
|
|
64
|
+
currency
|
|
65
|
+
};
|
|
66
|
+
return new Intl.NumberFormat(locale, numberFormat).format(value).replace(ICU_NON_BREAKING_SPACES, " ");
|
|
67
|
+
}
|
|
68
|
+
__name(formatPromoValue, "formatPromoValue");
|
|
69
|
+
function buildLabel(code, cycle, options = {}) {
|
|
47
70
|
const value = Number(code.value);
|
|
48
|
-
const valueStr = code.valueType
|
|
49
|
-
minimumFractionDigits: 2,
|
|
50
|
-
maximumFractionDigits: 2
|
|
51
|
-
})} \u20AC`;
|
|
71
|
+
const valueStr = formatPromoValue(value, code.valueType, options);
|
|
52
72
|
if (code.durationType === "ONCE") {
|
|
53
73
|
return `${valueStr} once`;
|
|
54
74
|
}
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PromoCodesModule
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
AdminManifestModule,
|
|
6
|
-
AdminManifestService,
|
|
7
|
-
AdminModule,
|
|
8
|
-
AdminResourcesModule,
|
|
9
|
-
AdminStatsModule,
|
|
10
|
-
MfaService,
|
|
11
|
-
SuperAdminGuard
|
|
12
|
-
} from "./chunk-SN5UOC43.js";
|
|
3
|
+
} from "./chunk-B6IWLV7R.js";
|
|
13
4
|
import {
|
|
14
5
|
FEATURE_GUARD_MARKER,
|
|
15
6
|
PublicCatalogModule,
|
|
@@ -17,39 +8,48 @@ import {
|
|
|
17
8
|
SubscriptionBundleModule,
|
|
18
9
|
TenantBillingModule,
|
|
19
10
|
isPlatformFeatureGuard
|
|
20
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-V3MRZ7SH.js";
|
|
21
12
|
import {
|
|
22
13
|
SubscriptionContractModule
|
|
23
14
|
} from "./chunk-B7NRY2LV.js";
|
|
24
15
|
import {
|
|
25
16
|
CatalogModule
|
|
26
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-QB7MICKQ.js";
|
|
27
18
|
import {
|
|
28
19
|
CheckoutOfferModule
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import {
|
|
31
|
-
SaaSiCatPublicRoute
|
|
32
|
-
} from "./chunk-YSC46BGM.js";
|
|
20
|
+
} from "./chunk-I4XD43AN.js";
|
|
33
21
|
import {
|
|
34
22
|
DiscoveryModule
|
|
35
23
|
} from "./chunk-6WL6VQ7Z.js";
|
|
36
24
|
import {
|
|
37
25
|
EntitlementModule,
|
|
38
26
|
LimitExceededError
|
|
39
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-RPO4IVUY.js";
|
|
40
28
|
import {
|
|
41
29
|
PLAN_CATALOG_TOKEN,
|
|
42
30
|
PlanCatalogModule
|
|
43
31
|
} from "./chunk-DQKCK7DX.js";
|
|
32
|
+
import {
|
|
33
|
+
ENFORCE_QUOTA_KEY
|
|
34
|
+
} from "./chunk-L4SUWH5B.js";
|
|
35
|
+
import {
|
|
36
|
+
AdminManifestModule,
|
|
37
|
+
AdminManifestService,
|
|
38
|
+
AdminModule,
|
|
39
|
+
AdminResourcesModule,
|
|
40
|
+
AdminStatsModule,
|
|
41
|
+
MfaService,
|
|
42
|
+
SuperAdminGuard
|
|
43
|
+
} from "./chunk-SN5UOC43.js";
|
|
44
|
+
import {
|
|
45
|
+
SaaSiCatPublicRoute
|
|
46
|
+
} from "./chunk-YSC46BGM.js";
|
|
44
47
|
import {
|
|
45
48
|
codedError
|
|
46
49
|
} from "./chunk-EBJJNTW6.js";
|
|
47
50
|
import {
|
|
48
51
|
asProvider
|
|
49
52
|
} from "./chunk-SABTXESR.js";
|
|
50
|
-
import {
|
|
51
|
-
ENFORCE_QUOTA_KEY
|
|
52
|
-
} from "./chunk-L4SUWH5B.js";
|
|
53
53
|
import {
|
|
54
54
|
__name
|
|
55
55
|
} from "./chunk-SHUYVCID.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PromoCodesService
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-37HEKVDH.js";
|
|
4
4
|
import {
|
|
5
5
|
SubscriptionContractService
|
|
6
6
|
} from "./chunk-B7NRY2LV.js";
|
|
@@ -16,19 +16,13 @@ import {
|
|
|
16
16
|
USER_EMAIL_RESOLVER_TOKEN,
|
|
17
17
|
USER_ID_RESOLVER_TOKEN
|
|
18
18
|
} from "./chunk-WPUVJRIN.js";
|
|
19
|
-
import {
|
|
20
|
-
AdminAuditService
|
|
21
|
-
} from "./chunk-E56W4U2P.js";
|
|
22
|
-
import {
|
|
23
|
-
SaaSiCatPublicRoute
|
|
24
|
-
} from "./chunk-YSC46BGM.js";
|
|
25
19
|
import {
|
|
26
20
|
EntitlementService,
|
|
27
21
|
SUBSCRIPTION_BUNDLE_CONFIG_TOKEN,
|
|
28
22
|
SUBSCRIPTION_BUNDLE_REPOSITORY_TOKEN,
|
|
29
23
|
isLimitExceededError,
|
|
30
24
|
toEffectiveLimitsSnapshot
|
|
31
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-RPO4IVUY.js";
|
|
32
26
|
import {
|
|
33
27
|
PLAN_CATALOG_TOKEN,
|
|
34
28
|
findPlan,
|
|
@@ -38,9 +32,6 @@ import {
|
|
|
38
32
|
import {
|
|
39
33
|
SUBSCRIPTION_CONTRACT_REPOSITORY_TOKEN
|
|
40
34
|
} from "./chunk-NYLON2VC.js";
|
|
41
|
-
import {
|
|
42
|
-
codedError
|
|
43
|
-
} from "./chunk-EBJJNTW6.js";
|
|
44
35
|
import {
|
|
45
36
|
ENTITLEMENT_SERVICE_TOKEN
|
|
46
37
|
} from "./chunk-WKVBNTYC.js";
|
|
@@ -49,6 +40,15 @@ import {
|
|
|
49
40
|
CATALOG_ENTRY_REPOSITORY_TOKEN,
|
|
50
41
|
PLAN_REPOSITORY_TOKEN
|
|
51
42
|
} from "./chunk-L4KTQ6CL.js";
|
|
43
|
+
import {
|
|
44
|
+
AdminAuditService
|
|
45
|
+
} from "./chunk-E56W4U2P.js";
|
|
46
|
+
import {
|
|
47
|
+
SaaSiCatPublicRoute
|
|
48
|
+
} from "./chunk-YSC46BGM.js";
|
|
49
|
+
import {
|
|
50
|
+
codedError
|
|
51
|
+
} from "./chunk-EBJJNTW6.js";
|
|
52
52
|
import {
|
|
53
53
|
asProvider
|
|
54
54
|
} from "./chunk-SABTXESR.js";
|
|
@@ -19,10 +19,9 @@ import {
|
|
|
19
19
|
mergeSubscriptionBundlesIntoLimits,
|
|
20
20
|
resolveEntitlementPlan,
|
|
21
21
|
toEffectiveLimitsSnapshot
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-RPO4IVUY.js";
|
|
23
23
|
import "../chunk-DQKCK7DX.js";
|
|
24
24
|
import "../chunk-NYLON2VC.js";
|
|
25
|
-
import "../chunk-EBJJNTW6.js";
|
|
26
25
|
import {
|
|
27
26
|
ENTITLEMENT_RESOLUTION_CONFIG_TOKEN,
|
|
28
27
|
ENTITLEMENT_SERVICE_TOKEN,
|
|
@@ -31,8 +30,9 @@ import {
|
|
|
31
30
|
TRANSACTION_RUNNER_TOKEN
|
|
32
31
|
} from "../chunk-WKVBNTYC.js";
|
|
33
32
|
import "../chunk-L4KTQ6CL.js";
|
|
34
|
-
import "../chunk-SABTXESR.js";
|
|
35
33
|
import "../chunk-L4SUWH5B.js";
|
|
34
|
+
import "../chunk-EBJJNTW6.js";
|
|
35
|
+
import "../chunk-SABTXESR.js";
|
|
36
36
|
import "../chunk-SHUYVCID.js";
|
|
37
37
|
export {
|
|
38
38
|
ENTITLEMENT_RESOLUTION_CONFIG_TOKEN,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { P as ProviderSpec, a as asProvider } from './di-CcNeq9v-.cjs';
|
|
2
2
|
import { S as SetupService } from './define-saasicat-D30I-WET.cjs';
|
|
3
3
|
export { a as SAASICAT_PUBLIC_ROUTE_KEY, b as SETUP_CONFIG_TOKEN, c as SETUP_PROVISIONING_PORT_TOKEN, d as SaaSiCatPublicRoute, e as SetupConfig, f as defineSaaSiCat, i as isSaaSiCatPublicRoute } from './define-saasicat-D30I-WET.cjs';
|
|
4
|
-
export { CreatePromoCodeDto, PROMO_CODE_REDEMPTION_REPOSITORY_TOKEN, PROMO_CODE_REPOSITORY_TOKEN, PROMO_CODE_VALIDATION_LOG_REPOSITORY_TOKEN, PROMO_FIRST_TIME_CUSTOMER_CHECK_TOKEN, PROMO_REVENUE_DEDUCTION_AGGREGATOR_TOKEN, PROMO_SERVICE_CONFIG_TOKEN, PROMO_SUBSCRIPTION_LOOKUP_TOKEN, PROMO_TRANSACTION_RUNNER_TOKEN, PreviewPromoCodeDto, PromoCodeExpirer, PromoCodeForCalc, PromoCodePublicController, UpdatePromoCodeDto, addCycles, buildLabel, buildPromoCodeAdminController, computeDiscountGross, computeDiscountedGross, computeIncludedVat, computeRegularStartsAt, grossFromNet, round2 } from './promo/index.cjs';
|
|
4
|
+
export { CreatePromoCodeDto, PROMO_CODE_REDEMPTION_REPOSITORY_TOKEN, PROMO_CODE_REPOSITORY_TOKEN, PROMO_CODE_VALIDATION_LOG_REPOSITORY_TOKEN, PROMO_FIRST_TIME_CUSTOMER_CHECK_TOKEN, PROMO_REVENUE_DEDUCTION_AGGREGATOR_TOKEN, PROMO_SERVICE_CONFIG_TOKEN, PROMO_SUBSCRIPTION_LOOKUP_TOKEN, PROMO_TRANSACTION_RUNNER_TOKEN, PreviewPromoCodeDto, PromoCodeExpirer, PromoCodeForCalc, PromoCodePublicController, PromoLabelOptions, UpdatePromoCodeDto, addCycles, buildLabel, buildPromoCodeAdminController, computeDiscountGross, computeDiscountedGross, computeIncludedVat, computeRegularStartsAt, grossFromNet, round2 } from './promo/index.cjs';
|
|
5
5
|
export { a as PreviewInput, b as PreviewInvalid, c as PreviewReason, d as PreviewResult, e as PreviewValid, f as PromoCodeStats, g as PromoCodesService, P as PromoServiceConfig, R as RedeemInput } from './service-D48clObR.cjs';
|
|
6
6
|
export { P as PromoCodeRateLimitGuard, h as hashIp, i as ipFingerprint } from './rate-limit.guard-dntqAlfZ.cjs';
|
|
7
7
|
export { P as PromoCodesModule, a as PromoCodesModuleOptions } from './module-CHMIyWlf.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { P as ProviderSpec, a as asProvider } from './di-CcNeq9v-.js';
|
|
2
2
|
import { S as SetupService } from './define-saasicat-BK6RRWWG.js';
|
|
3
3
|
export { a as SAASICAT_PUBLIC_ROUTE_KEY, b as SETUP_CONFIG_TOKEN, c as SETUP_PROVISIONING_PORT_TOKEN, d as SaaSiCatPublicRoute, e as SetupConfig, f as defineSaaSiCat, i as isSaaSiCatPublicRoute } from './define-saasicat-BK6RRWWG.js';
|
|
4
|
-
export { CreatePromoCodeDto, PROMO_CODE_REDEMPTION_REPOSITORY_TOKEN, PROMO_CODE_REPOSITORY_TOKEN, PROMO_CODE_VALIDATION_LOG_REPOSITORY_TOKEN, PROMO_FIRST_TIME_CUSTOMER_CHECK_TOKEN, PROMO_REVENUE_DEDUCTION_AGGREGATOR_TOKEN, PROMO_SERVICE_CONFIG_TOKEN, PROMO_SUBSCRIPTION_LOOKUP_TOKEN, PROMO_TRANSACTION_RUNNER_TOKEN, PreviewPromoCodeDto, PromoCodeExpirer, PromoCodeForCalc, PromoCodePublicController, UpdatePromoCodeDto, addCycles, buildLabel, buildPromoCodeAdminController, computeDiscountGross, computeDiscountedGross, computeIncludedVat, computeRegularStartsAt, grossFromNet, round2 } from './promo/index.js';
|
|
4
|
+
export { CreatePromoCodeDto, PROMO_CODE_REDEMPTION_REPOSITORY_TOKEN, PROMO_CODE_REPOSITORY_TOKEN, PROMO_CODE_VALIDATION_LOG_REPOSITORY_TOKEN, PROMO_FIRST_TIME_CUSTOMER_CHECK_TOKEN, PROMO_REVENUE_DEDUCTION_AGGREGATOR_TOKEN, PROMO_SERVICE_CONFIG_TOKEN, PROMO_SUBSCRIPTION_LOOKUP_TOKEN, PROMO_TRANSACTION_RUNNER_TOKEN, PreviewPromoCodeDto, PromoCodeExpirer, PromoCodeForCalc, PromoCodePublicController, PromoLabelOptions, UpdatePromoCodeDto, addCycles, buildLabel, buildPromoCodeAdminController, computeDiscountGross, computeDiscountedGross, computeIncludedVat, computeRegularStartsAt, grossFromNet, round2 } from './promo/index.js';
|
|
5
5
|
export { a as PreviewInput, b as PreviewInvalid, c as PreviewReason, d as PreviewResult, e as PreviewValid, f as PromoCodeStats, g as PromoCodesService, P as PromoServiceConfig, R as RedeemInput } from './service-D48clObR.js';
|
|
6
6
|
export { P as PromoCodeRateLimitGuard, h as hashIp, i as ipFingerprint } from './rate-limit.guard-dntqAlfZ.js';
|
|
7
7
|
export { P as PromoCodesModule, a as PromoCodesModuleOptions } from './module-BE17XFLg.js';
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,6 @@ import {
|
|
|
38
38
|
slugify,
|
|
39
39
|
verifyOtpCode
|
|
40
40
|
} from "./chunk-MJ32VNZD.js";
|
|
41
|
-
import "./chunk-UF53DWWR.js";
|
|
42
41
|
import {
|
|
43
42
|
formatPreflightReport,
|
|
44
43
|
formatSeedGateReport,
|
|
@@ -47,7 +46,7 @@ import {
|
|
|
47
46
|
runSeedGateFromFile,
|
|
48
47
|
seedGateExitCode,
|
|
49
48
|
validateSeedAgainstSnapshot
|
|
50
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-UOWK2HYG.js";
|
|
51
50
|
import "./chunk-DBZGV3HC.js";
|
|
52
51
|
import {
|
|
53
52
|
DefinesQuota,
|
|
@@ -60,6 +59,7 @@ import {
|
|
|
60
59
|
DiscoverySnapshotNotFoundError,
|
|
61
60
|
loadDiscoverySnapshotFromFile
|
|
62
61
|
} from "./chunk-74SCJ4HF.js";
|
|
62
|
+
import "./chunk-UF53DWWR.js";
|
|
63
63
|
import {
|
|
64
64
|
defineSaaSiCat
|
|
65
65
|
} from "./chunk-FY4EJTV4.js";
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
SetupController,
|
|
71
71
|
SetupModule,
|
|
72
72
|
SetupService
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-J62YI25C.js";
|
|
74
74
|
import {
|
|
75
75
|
CreatePromoCodeDto,
|
|
76
76
|
PreviewPromoCodeDto,
|
|
@@ -82,34 +82,7 @@ import {
|
|
|
82
82
|
buildPromoCodeAdminController,
|
|
83
83
|
hashIp,
|
|
84
84
|
ipFingerprint
|
|
85
|
-
} from "./chunk-
|
|
86
|
-
import {
|
|
87
|
-
ADMIN_MANIFEST_CONFIG,
|
|
88
|
-
ADMIN_RESOURCES_PORT_TOKEN,
|
|
89
|
-
ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN,
|
|
90
|
-
AUDIT_STATS_PORT_TOKEN,
|
|
91
|
-
AdminBypassRlsInterceptor,
|
|
92
|
-
AdminManifestModule,
|
|
93
|
-
AdminManifestService,
|
|
94
|
-
AdminModule,
|
|
95
|
-
AdminPublicBootController,
|
|
96
|
-
AdminResourcesModule,
|
|
97
|
-
AdminResourcesService,
|
|
98
|
-
AdminStatsController,
|
|
99
|
-
AdminStatsModule,
|
|
100
|
-
AdminStatsService,
|
|
101
|
-
MfaGuard,
|
|
102
|
-
MfaService,
|
|
103
|
-
PLATFORM_CORE_CONTRIBUTION_TOKEN,
|
|
104
|
-
PLATFORM_CORE_MANIFEST_CONTRIBUTION,
|
|
105
|
-
PROMO_CODE_STATS_PORT_TOKEN,
|
|
106
|
-
REQUIRE_MFA_KEY,
|
|
107
|
-
RequireMfa,
|
|
108
|
-
SUBSCRIPTION_STATS_PORT_TOKEN,
|
|
109
|
-
SuperAdminGuard,
|
|
110
|
-
SuspendTenantDto,
|
|
111
|
-
buildAdminStatsController
|
|
112
|
-
} from "./chunk-SN5UOC43.js";
|
|
85
|
+
} from "./chunk-B6IWLV7R.js";
|
|
113
86
|
import {
|
|
114
87
|
CONTRACT_FREEZE_PORT_TOKEN,
|
|
115
88
|
CONTRACT_FREEZE_PROJECT_KEY_TOKEN,
|
|
@@ -172,7 +145,7 @@ import {
|
|
|
172
145
|
periodEndWithMinLead,
|
|
173
146
|
resolveBundleCancelEffectiveAt,
|
|
174
147
|
resolveBundlePriceNet
|
|
175
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-V3MRZ7SH.js";
|
|
176
149
|
import {
|
|
177
150
|
PROMO_CODE_REDEMPTION_REPOSITORY_TOKEN,
|
|
178
151
|
PROMO_CODE_REPOSITORY_TOKEN,
|
|
@@ -188,7 +161,7 @@ import {
|
|
|
188
161
|
computeDiscountGross,
|
|
189
162
|
computeDiscountedGross,
|
|
190
163
|
computeRegularStartsAt
|
|
191
|
-
} from "./chunk-
|
|
164
|
+
} from "./chunk-37HEKVDH.js";
|
|
192
165
|
import {
|
|
193
166
|
SubscriptionContractModule,
|
|
194
167
|
SubscriptionContractService,
|
|
@@ -244,7 +217,7 @@ import {
|
|
|
244
217
|
quotaApprovalSignature,
|
|
245
218
|
validateBundleDraft,
|
|
246
219
|
validatePlanDraft
|
|
247
|
-
} from "./chunk-
|
|
220
|
+
} from "./chunk-QB7MICKQ.js";
|
|
248
221
|
import {
|
|
249
222
|
AUDIT_CONTEXT_RESOLVER_TOKEN,
|
|
250
223
|
PENDING_PLAN_QUERY_PORT_TOKEN,
|
|
@@ -259,12 +232,6 @@ import {
|
|
|
259
232
|
classifyBundleVersionDiff,
|
|
260
233
|
classifyPlanDiff
|
|
261
234
|
} from "./chunk-WPUVJRIN.js";
|
|
262
|
-
import {
|
|
263
|
-
AUDIT_PORT_TOKEN,
|
|
264
|
-
AdminAuditService,
|
|
265
|
-
MFA_PORT_TOKEN,
|
|
266
|
-
RLS_BYPASS_PORT_TOKEN
|
|
267
|
-
} from "./chunk-E56W4U2P.js";
|
|
268
235
|
import {
|
|
269
236
|
CHECKOUT_OFFER_REPOSITORY_TOKEN,
|
|
270
237
|
CheckoutOfferModule,
|
|
@@ -272,13 +239,8 @@ import {
|
|
|
272
239
|
CreateCheckoutOfferDto,
|
|
273
240
|
UpdateCheckoutOfferDto,
|
|
274
241
|
buildCheckoutOfferController
|
|
275
|
-
} from "./chunk-
|
|
242
|
+
} from "./chunk-I4XD43AN.js";
|
|
276
243
|
import "./chunk-BSK6YBLI.js";
|
|
277
|
-
import {
|
|
278
|
-
SAASICAT_PUBLIC_ROUTE_KEY,
|
|
279
|
-
SaaSiCatPublicRoute,
|
|
280
|
-
isSaaSiCatPublicRoute
|
|
281
|
-
} from "./chunk-YSC46BGM.js";
|
|
282
244
|
import {
|
|
283
245
|
DiscoveryModule,
|
|
284
246
|
buildDiscoveryController
|
|
@@ -312,7 +274,7 @@ import {
|
|
|
312
274
|
mergeSubscriptionBundlesIntoLimits,
|
|
313
275
|
resolveEntitlementPlan,
|
|
314
276
|
toEffectiveLimitsSnapshot
|
|
315
|
-
} from "./chunk-
|
|
277
|
+
} from "./chunk-RPO4IVUY.js";
|
|
316
278
|
import {
|
|
317
279
|
PLAN_CATALOG_READ_SINK_TOKEN,
|
|
318
280
|
PLAN_CATALOG_TOKEN,
|
|
@@ -334,9 +296,6 @@ import {
|
|
|
334
296
|
import {
|
|
335
297
|
SUBSCRIPTION_CONTRACT_REPOSITORY_TOKEN
|
|
336
298
|
} from "./chunk-NYLON2VC.js";
|
|
337
|
-
import {
|
|
338
|
-
codedError
|
|
339
|
-
} from "./chunk-EBJJNTW6.js";
|
|
340
299
|
import {
|
|
341
300
|
ENTITLEMENT_RESOLUTION_CONFIG_TOKEN,
|
|
342
301
|
ENTITLEMENT_SERVICE_TOKEN,
|
|
@@ -353,9 +312,6 @@ import {
|
|
|
353
312
|
PLAN_REPOSITORY_TOKEN,
|
|
354
313
|
PROMOTION_REPOSITORY_TOKEN
|
|
355
314
|
} from "./chunk-L4KTQ6CL.js";
|
|
356
|
-
import {
|
|
357
|
-
asProvider
|
|
358
|
-
} from "./chunk-SABTXESR.js";
|
|
359
315
|
import {
|
|
360
316
|
DEFINES_QUOTA_KEY,
|
|
361
317
|
DISCOVERY_SNAPSHOT_TOKEN,
|
|
@@ -363,6 +319,50 @@ import {
|
|
|
363
319
|
IMPLEMENTS_CAPABILITY_KEY,
|
|
364
320
|
REQUIRES_CAPABILITY_KEY
|
|
365
321
|
} from "./chunk-L4SUWH5B.js";
|
|
322
|
+
import {
|
|
323
|
+
ADMIN_MANIFEST_CONFIG,
|
|
324
|
+
ADMIN_RESOURCES_PORT_TOKEN,
|
|
325
|
+
ADMIN_STATS_AUDIT_WINDOW_DAYS_TOKEN,
|
|
326
|
+
AUDIT_STATS_PORT_TOKEN,
|
|
327
|
+
AdminBypassRlsInterceptor,
|
|
328
|
+
AdminManifestModule,
|
|
329
|
+
AdminManifestService,
|
|
330
|
+
AdminModule,
|
|
331
|
+
AdminPublicBootController,
|
|
332
|
+
AdminResourcesModule,
|
|
333
|
+
AdminResourcesService,
|
|
334
|
+
AdminStatsController,
|
|
335
|
+
AdminStatsModule,
|
|
336
|
+
AdminStatsService,
|
|
337
|
+
MfaGuard,
|
|
338
|
+
MfaService,
|
|
339
|
+
PLATFORM_CORE_CONTRIBUTION_TOKEN,
|
|
340
|
+
PLATFORM_CORE_MANIFEST_CONTRIBUTION,
|
|
341
|
+
PROMO_CODE_STATS_PORT_TOKEN,
|
|
342
|
+
REQUIRE_MFA_KEY,
|
|
343
|
+
RequireMfa,
|
|
344
|
+
SUBSCRIPTION_STATS_PORT_TOKEN,
|
|
345
|
+
SuperAdminGuard,
|
|
346
|
+
SuspendTenantDto,
|
|
347
|
+
buildAdminStatsController
|
|
348
|
+
} from "./chunk-SN5UOC43.js";
|
|
349
|
+
import {
|
|
350
|
+
AUDIT_PORT_TOKEN,
|
|
351
|
+
AdminAuditService,
|
|
352
|
+
MFA_PORT_TOKEN,
|
|
353
|
+
RLS_BYPASS_PORT_TOKEN
|
|
354
|
+
} from "./chunk-E56W4U2P.js";
|
|
355
|
+
import {
|
|
356
|
+
SAASICAT_PUBLIC_ROUTE_KEY,
|
|
357
|
+
SaaSiCatPublicRoute,
|
|
358
|
+
isSaaSiCatPublicRoute
|
|
359
|
+
} from "./chunk-YSC46BGM.js";
|
|
360
|
+
import {
|
|
361
|
+
codedError
|
|
362
|
+
} from "./chunk-EBJJNTW6.js";
|
|
363
|
+
import {
|
|
364
|
+
asProvider
|
|
365
|
+
} from "./chunk-SABTXESR.js";
|
|
366
366
|
import "./chunk-SHUYVCID.js";
|
|
367
367
|
export {
|
|
368
368
|
ACTIVATION_ORCHESTRATOR_TOKEN,
|
package/dist/platform/index.js
CHANGED
|
@@ -17,22 +17,10 @@ import {
|
|
|
17
17
|
SubscriptionPlanResolver,
|
|
18
18
|
TenantManifestService,
|
|
19
19
|
buildTenantManifestController
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-J62YI25C.js";
|
|
21
21
|
import {
|
|
22
22
|
PromoCodeRateLimitGuard
|
|
23
|
-
} from "../chunk-
|
|
24
|
-
import {
|
|
25
|
-
AdminBypassRlsInterceptor,
|
|
26
|
-
AdminManifestModule,
|
|
27
|
-
AdminManifestService,
|
|
28
|
-
AdminModule,
|
|
29
|
-
AdminResourcesService,
|
|
30
|
-
AdminStatsModule,
|
|
31
|
-
AdminStatsService,
|
|
32
|
-
MfaGuard,
|
|
33
|
-
MfaService,
|
|
34
|
-
SuperAdminGuard
|
|
35
|
-
} from "../chunk-SN5UOC43.js";
|
|
23
|
+
} from "../chunk-B6IWLV7R.js";
|
|
36
24
|
import {
|
|
37
25
|
ComposedTenantAuthGuard,
|
|
38
26
|
PendingPlanMaterializationService,
|
|
@@ -41,10 +29,10 @@ import {
|
|
|
41
29
|
SubscriptionBundlesService,
|
|
42
30
|
TenantAdminGuard,
|
|
43
31
|
TenantBillingController
|
|
44
|
-
} from "../chunk-
|
|
32
|
+
} from "../chunk-V3MRZ7SH.js";
|
|
45
33
|
import {
|
|
46
34
|
PromoCodesService
|
|
47
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-37HEKVDH.js";
|
|
48
36
|
import {
|
|
49
37
|
SubscriptionContractModule,
|
|
50
38
|
SubscriptionContractService
|
|
@@ -58,35 +46,47 @@ import {
|
|
|
58
46
|
PlansService,
|
|
59
47
|
PromotionsService,
|
|
60
48
|
PublicMarketingCatalogService
|
|
61
|
-
} from "../chunk-
|
|
49
|
+
} from "../chunk-QB7MICKQ.js";
|
|
62
50
|
import "../chunk-WPUVJRIN.js";
|
|
63
|
-
import {
|
|
64
|
-
AdminAuditService
|
|
65
|
-
} from "../chunk-E56W4U2P.js";
|
|
66
51
|
import {
|
|
67
52
|
CheckoutOfferModule,
|
|
68
53
|
CheckoutOfferService
|
|
69
|
-
} from "../chunk-
|
|
54
|
+
} from "../chunk-I4XD43AN.js";
|
|
70
55
|
import "../chunk-BSK6YBLI.js";
|
|
71
|
-
import {
|
|
72
|
-
SAASICAT_PUBLIC_ROUTE_KEY,
|
|
73
|
-
SaaSiCatPublicRoute,
|
|
74
|
-
isSaaSiCatPublicRoute
|
|
75
|
-
} from "../chunk-YSC46BGM.js";
|
|
76
56
|
import "../chunk-6WL6VQ7Z.js";
|
|
77
57
|
import {
|
|
78
58
|
DiscoveryScanner
|
|
79
59
|
} from "../chunk-5ZXBXYXU.js";
|
|
80
60
|
import {
|
|
81
61
|
EntitlementService
|
|
82
|
-
} from "../chunk-
|
|
62
|
+
} from "../chunk-RPO4IVUY.js";
|
|
83
63
|
import "../chunk-DQKCK7DX.js";
|
|
84
64
|
import "../chunk-NYLON2VC.js";
|
|
85
|
-
import "../chunk-EBJJNTW6.js";
|
|
86
65
|
import "../chunk-WKVBNTYC.js";
|
|
87
66
|
import "../chunk-L4KTQ6CL.js";
|
|
88
|
-
import "../chunk-SABTXESR.js";
|
|
89
67
|
import "../chunk-L4SUWH5B.js";
|
|
68
|
+
import {
|
|
69
|
+
AdminBypassRlsInterceptor,
|
|
70
|
+
AdminManifestModule,
|
|
71
|
+
AdminManifestService,
|
|
72
|
+
AdminModule,
|
|
73
|
+
AdminResourcesService,
|
|
74
|
+
AdminStatsModule,
|
|
75
|
+
AdminStatsService,
|
|
76
|
+
MfaGuard,
|
|
77
|
+
MfaService,
|
|
78
|
+
SuperAdminGuard
|
|
79
|
+
} from "../chunk-SN5UOC43.js";
|
|
80
|
+
import {
|
|
81
|
+
AdminAuditService
|
|
82
|
+
} from "../chunk-E56W4U2P.js";
|
|
83
|
+
import {
|
|
84
|
+
SAASICAT_PUBLIC_ROUTE_KEY,
|
|
85
|
+
SaaSiCatPublicRoute,
|
|
86
|
+
isSaaSiCatPublicRoute
|
|
87
|
+
} from "../chunk-YSC46BGM.js";
|
|
88
|
+
import "../chunk-EBJJNTW6.js";
|
|
89
|
+
import "../chunk-SABTXESR.js";
|
|
90
90
|
import "../chunk-SHUYVCID.js";
|
|
91
91
|
export {
|
|
92
92
|
AdminAuditService,
|
package/dist/promo/index.d.cts
CHANGED
|
@@ -31,7 +31,53 @@ declare function computeDiscountedGross(planGross: number, discountGross: number
|
|
|
31
31
|
*/
|
|
32
32
|
declare function computeRegularStartsAt(startsAt: Date, cycle: BillingCycle, durationType: PromoCodeDurationType, durationValue: number | null): Date;
|
|
33
33
|
declare function addCycles(date: Date, cycle: BillingCycle, n: number): Date;
|
|
34
|
-
|
|
34
|
+
/** Number locale and currency for {@link buildLabel}. */
|
|
35
|
+
interface PromoLabelOptions {
|
|
36
|
+
/**
|
|
37
|
+
* BCP-47 tag deciding grouping, decimal separator, and where the currency
|
|
38
|
+
* symbol sits: `'de-DE'` produces `1.234,56 €`, `'en-US'` produces
|
|
39
|
+
* `€1,234.56`.
|
|
40
|
+
*
|
|
41
|
+
* A tag whose LANGUAGE the runtime cannot serve is a configuration error
|
|
42
|
+
* and throws. `Intl` alone does not give that: it rejects a malformed tag,
|
|
43
|
+
* but a well-formed one it does not know — `'zz-ZZ'` — silently resolves to
|
|
44
|
+
* the runtime default, which on this one is `en-US`. An amount then reaches
|
|
45
|
+
* the customer formatted in a language nobody chose.
|
|
46
|
+
*
|
|
47
|
+
* The check reaches exactly that far, and it is worth knowing where it
|
|
48
|
+
* stops: `supportedLocalesOf` accepts an unknown REGION on a known language,
|
|
49
|
+
* so `'de-ED'` passes and formats as `de`. Measured, not assumed. That
|
|
50
|
+
* fallback stays inside the language the caller asked for, which is the
|
|
51
|
+
* difference between a typo costing a separator and costing a language.
|
|
52
|
+
*/
|
|
53
|
+
locale?: string;
|
|
54
|
+
/**
|
|
55
|
+
* ISO-4217 code for `ABSOLUTE` values, e.g. `'EUR'`, `'CHF'`, `'JPY'`.
|
|
56
|
+
* The code also decides the number of decimals — two for EUR, none for
|
|
57
|
+
* JPY — because the minor-unit count is a property of the currency, not a
|
|
58
|
+
* formatting preference. Percentages ignore this.
|
|
59
|
+
*
|
|
60
|
+
* Not checked against a list, unlike the locale. `Intl` rejects a code that
|
|
61
|
+
* is not three letters and renders a three-letter one it does not know as
|
|
62
|
+
* itself — `1.234,56 XBT` is wrong but visible, where a wrong locale is
|
|
63
|
+
* silent. And no enumeration available here separates a made-up code from a
|
|
64
|
+
* real one it omits: `Intl.supportedValuesOf('currency')` leaves out `XAU`,
|
|
65
|
+
* `XAG` and `XPT`, which are assigned. See `requireSupportedLocale`.
|
|
66
|
+
*/
|
|
67
|
+
currency?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Human-readable summary of a promo code, e.g. `25 % once` or
|
|
71
|
+
* `1.234,56 € for the first month`.
|
|
72
|
+
*
|
|
73
|
+
* The words are English and cannot be swapped here — translating them needs
|
|
74
|
+
* the parts (`valueType`, `value`, `durationType`, `durationValue`), which the
|
|
75
|
+
* promo preview response already carries next to this string. Composing the
|
|
76
|
+
* sentence in the consumer's own i18n layer is the better answer and the one
|
|
77
|
+
* planned for the next breaking release; until then `options` at least stops
|
|
78
|
+
* the function from deciding number locale and currency for everyone.
|
|
79
|
+
*/
|
|
80
|
+
declare function buildLabel(code: Pick<PromoCodeForCalc, 'valueType' | 'value' | 'durationType' | 'durationValue'>, cycle: BillingCycle, options?: PromoLabelOptions): string;
|
|
35
81
|
|
|
36
82
|
declare function round2(n: number): number;
|
|
37
83
|
/** Gross = net * (1 + vatRate/100). */
|
|
@@ -120,4 +166,4 @@ declare class UpdatePromoCodeDto {
|
|
|
120
166
|
revenueDeductionAccount?: string | null;
|
|
121
167
|
}
|
|
122
168
|
|
|
123
|
-
export { CreatePromoCodeDto, PROMO_CODE_REDEMPTION_REPOSITORY_TOKEN, PROMO_CODE_REPOSITORY_TOKEN, PROMO_CODE_VALIDATION_LOG_REPOSITORY_TOKEN, PROMO_FIRST_TIME_CUSTOMER_CHECK_TOKEN, PROMO_REVENUE_DEDUCTION_AGGREGATOR_TOKEN, PROMO_SERVICE_CONFIG_TOKEN, PROMO_SUBSCRIPTION_LOOKUP_TOKEN, PROMO_TRANSACTION_RUNNER_TOKEN, PreviewPromoCodeDto, PreviewResult, PromoCodeExpirer, type PromoCodeForCalc, PromoCodePublicController, PromoCodesService, UpdatePromoCodeDto, addCycles, buildLabel, buildPromoCodeAdminController, computeDiscountGross, computeDiscountedGross, computeIncludedVat, computeRegularStartsAt, grossFromNet, round2 };
|
|
169
|
+
export { CreatePromoCodeDto, PROMO_CODE_REDEMPTION_REPOSITORY_TOKEN, PROMO_CODE_REPOSITORY_TOKEN, PROMO_CODE_VALIDATION_LOG_REPOSITORY_TOKEN, PROMO_FIRST_TIME_CUSTOMER_CHECK_TOKEN, PROMO_REVENUE_DEDUCTION_AGGREGATOR_TOKEN, PROMO_SERVICE_CONFIG_TOKEN, PROMO_SUBSCRIPTION_LOOKUP_TOKEN, PROMO_TRANSACTION_RUNNER_TOKEN, PreviewPromoCodeDto, PreviewResult, PromoCodeExpirer, type PromoCodeForCalc, PromoCodePublicController, PromoCodesService, type PromoLabelOptions, UpdatePromoCodeDto, addCycles, buildLabel, buildPromoCodeAdminController, computeDiscountGross, computeDiscountedGross, computeIncludedVat, computeRegularStartsAt, grossFromNet, round2 };
|
package/dist/promo/index.d.ts
CHANGED
|
@@ -31,7 +31,53 @@ declare function computeDiscountedGross(planGross: number, discountGross: number
|
|
|
31
31
|
*/
|
|
32
32
|
declare function computeRegularStartsAt(startsAt: Date, cycle: BillingCycle, durationType: PromoCodeDurationType, durationValue: number | null): Date;
|
|
33
33
|
declare function addCycles(date: Date, cycle: BillingCycle, n: number): Date;
|
|
34
|
-
|
|
34
|
+
/** Number locale and currency for {@link buildLabel}. */
|
|
35
|
+
interface PromoLabelOptions {
|
|
36
|
+
/**
|
|
37
|
+
* BCP-47 tag deciding grouping, decimal separator, and where the currency
|
|
38
|
+
* symbol sits: `'de-DE'` produces `1.234,56 €`, `'en-US'` produces
|
|
39
|
+
* `€1,234.56`.
|
|
40
|
+
*
|
|
41
|
+
* A tag whose LANGUAGE the runtime cannot serve is a configuration error
|
|
42
|
+
* and throws. `Intl` alone does not give that: it rejects a malformed tag,
|
|
43
|
+
* but a well-formed one it does not know — `'zz-ZZ'` — silently resolves to
|
|
44
|
+
* the runtime default, which on this one is `en-US`. An amount then reaches
|
|
45
|
+
* the customer formatted in a language nobody chose.
|
|
46
|
+
*
|
|
47
|
+
* The check reaches exactly that far, and it is worth knowing where it
|
|
48
|
+
* stops: `supportedLocalesOf` accepts an unknown REGION on a known language,
|
|
49
|
+
* so `'de-ED'` passes and formats as `de`. Measured, not assumed. That
|
|
50
|
+
* fallback stays inside the language the caller asked for, which is the
|
|
51
|
+
* difference between a typo costing a separator and costing a language.
|
|
52
|
+
*/
|
|
53
|
+
locale?: string;
|
|
54
|
+
/**
|
|
55
|
+
* ISO-4217 code for `ABSOLUTE` values, e.g. `'EUR'`, `'CHF'`, `'JPY'`.
|
|
56
|
+
* The code also decides the number of decimals — two for EUR, none for
|
|
57
|
+
* JPY — because the minor-unit count is a property of the currency, not a
|
|
58
|
+
* formatting preference. Percentages ignore this.
|
|
59
|
+
*
|
|
60
|
+
* Not checked against a list, unlike the locale. `Intl` rejects a code that
|
|
61
|
+
* is not three letters and renders a three-letter one it does not know as
|
|
62
|
+
* itself — `1.234,56 XBT` is wrong but visible, where a wrong locale is
|
|
63
|
+
* silent. And no enumeration available here separates a made-up code from a
|
|
64
|
+
* real one it omits: `Intl.supportedValuesOf('currency')` leaves out `XAU`,
|
|
65
|
+
* `XAG` and `XPT`, which are assigned. See `requireSupportedLocale`.
|
|
66
|
+
*/
|
|
67
|
+
currency?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Human-readable summary of a promo code, e.g. `25 % once` or
|
|
71
|
+
* `1.234,56 € for the first month`.
|
|
72
|
+
*
|
|
73
|
+
* The words are English and cannot be swapped here — translating them needs
|
|
74
|
+
* the parts (`valueType`, `value`, `durationType`, `durationValue`), which the
|
|
75
|
+
* promo preview response already carries next to this string. Composing the
|
|
76
|
+
* sentence in the consumer's own i18n layer is the better answer and the one
|
|
77
|
+
* planned for the next breaking release; until then `options` at least stops
|
|
78
|
+
* the function from deciding number locale and currency for everyone.
|
|
79
|
+
*/
|
|
80
|
+
declare function buildLabel(code: Pick<PromoCodeForCalc, 'valueType' | 'value' | 'durationType' | 'durationValue'>, cycle: BillingCycle, options?: PromoLabelOptions): string;
|
|
35
81
|
|
|
36
82
|
declare function round2(n: number): number;
|
|
37
83
|
/** Gross = net * (1 + vatRate/100). */
|
|
@@ -120,4 +166,4 @@ declare class UpdatePromoCodeDto {
|
|
|
120
166
|
revenueDeductionAccount?: string | null;
|
|
121
167
|
}
|
|
122
168
|
|
|
123
|
-
export { CreatePromoCodeDto, PROMO_CODE_REDEMPTION_REPOSITORY_TOKEN, PROMO_CODE_REPOSITORY_TOKEN, PROMO_CODE_VALIDATION_LOG_REPOSITORY_TOKEN, PROMO_FIRST_TIME_CUSTOMER_CHECK_TOKEN, PROMO_REVENUE_DEDUCTION_AGGREGATOR_TOKEN, PROMO_SERVICE_CONFIG_TOKEN, PROMO_SUBSCRIPTION_LOOKUP_TOKEN, PROMO_TRANSACTION_RUNNER_TOKEN, PreviewPromoCodeDto, PreviewResult, PromoCodeExpirer, type PromoCodeForCalc, PromoCodePublicController, PromoCodesService, UpdatePromoCodeDto, addCycles, buildLabel, buildPromoCodeAdminController, computeDiscountGross, computeDiscountedGross, computeIncludedVat, computeRegularStartsAt, grossFromNet, round2 };
|
|
169
|
+
export { CreatePromoCodeDto, PROMO_CODE_REDEMPTION_REPOSITORY_TOKEN, PROMO_CODE_REPOSITORY_TOKEN, PROMO_CODE_VALIDATION_LOG_REPOSITORY_TOKEN, PROMO_FIRST_TIME_CUSTOMER_CHECK_TOKEN, PROMO_REVENUE_DEDUCTION_AGGREGATOR_TOKEN, PROMO_SERVICE_CONFIG_TOKEN, PROMO_SUBSCRIPTION_LOOKUP_TOKEN, PROMO_TRANSACTION_RUNNER_TOKEN, PreviewPromoCodeDto, PreviewResult, PromoCodeExpirer, type PromoCodeForCalc, PromoCodePublicController, PromoCodesService, type PromoLabelOptions, UpdatePromoCodeDto, addCycles, buildLabel, buildPromoCodeAdminController, computeDiscountGross, computeDiscountedGross, computeIncludedVat, computeRegularStartsAt, grossFromNet, round2 };
|
package/dist/promo/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
buildPromoCodeAdminController,
|
|
11
11
|
hashIp,
|
|
12
12
|
ipFingerprint
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-B6IWLV7R.js";
|
|
14
14
|
import {
|
|
15
15
|
PROMO_CODE_REDEMPTION_REPOSITORY_TOKEN,
|
|
16
16
|
PROMO_CODE_REPOSITORY_TOKEN,
|
|
@@ -26,14 +26,14 @@ import {
|
|
|
26
26
|
computeDiscountGross,
|
|
27
27
|
computeDiscountedGross,
|
|
28
28
|
computeRegularStartsAt
|
|
29
|
-
} from "../chunk-
|
|
30
|
-
import "../chunk-E56W4U2P.js";
|
|
31
|
-
import "../chunk-YSC46BGM.js";
|
|
29
|
+
} from "../chunk-37HEKVDH.js";
|
|
32
30
|
import {
|
|
33
31
|
computeIncludedVat,
|
|
34
32
|
grossFromNet,
|
|
35
33
|
round2
|
|
36
34
|
} from "../chunk-DQKCK7DX.js";
|
|
35
|
+
import "../chunk-E56W4U2P.js";
|
|
36
|
+
import "../chunk-YSC46BGM.js";
|
|
37
37
|
import "../chunk-EBJJNTW6.js";
|
|
38
38
|
import "../chunk-SABTXESR.js";
|
|
39
39
|
import "../chunk-SHUYVCID.js";
|
package/dist/testing/index.js
CHANGED
|
@@ -5,28 +5,28 @@ import {
|
|
|
5
5
|
StaticEntitlementService,
|
|
6
6
|
StaticFeatureGuard,
|
|
7
7
|
StaticPlanResolver
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-VQQWF7MW.js";
|
|
8
|
+
} from "../chunk-J62YI25C.js";
|
|
9
|
+
import "../chunk-B6IWLV7R.js";
|
|
10
|
+
import "../chunk-V3MRZ7SH.js";
|
|
11
|
+
import "../chunk-37HEKVDH.js";
|
|
13
12
|
import "../chunk-B7NRY2LV.js";
|
|
14
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-QB7MICKQ.js";
|
|
15
14
|
import "../chunk-WPUVJRIN.js";
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-XTVAFJ3P.js";
|
|
15
|
+
import "../chunk-I4XD43AN.js";
|
|
18
16
|
import "../chunk-BSK6YBLI.js";
|
|
19
|
-
import "../chunk-YSC46BGM.js";
|
|
20
17
|
import "../chunk-6WL6VQ7Z.js";
|
|
21
18
|
import "../chunk-5ZXBXYXU.js";
|
|
22
|
-
import "../chunk-
|
|
19
|
+
import "../chunk-RPO4IVUY.js";
|
|
23
20
|
import "../chunk-DQKCK7DX.js";
|
|
24
21
|
import "../chunk-NYLON2VC.js";
|
|
25
|
-
import "../chunk-EBJJNTW6.js";
|
|
26
22
|
import "../chunk-WKVBNTYC.js";
|
|
27
23
|
import "../chunk-L4KTQ6CL.js";
|
|
28
|
-
import "../chunk-SABTXESR.js";
|
|
29
24
|
import "../chunk-L4SUWH5B.js";
|
|
25
|
+
import "../chunk-SN5UOC43.js";
|
|
26
|
+
import "../chunk-E56W4U2P.js";
|
|
27
|
+
import "../chunk-YSC46BGM.js";
|
|
28
|
+
import "../chunk-EBJJNTW6.js";
|
|
29
|
+
import "../chunk-SABTXESR.js";
|
|
30
30
|
import {
|
|
31
31
|
__name
|
|
32
32
|
} from "../chunk-SHUYVCID.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saasicat/nest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "NestJS implementation of SaaSiCat: capability discovery, catalog packaging, contracts, entitlement enforcement, billing and admin APIs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -137,8 +137,8 @@
|
|
|
137
137
|
"js-yaml": "^4.3.1",
|
|
138
138
|
"otplib": "^13.4.1",
|
|
139
139
|
"qrcode": "^1.5.4",
|
|
140
|
-
"@saasicat/spec": "^0.
|
|
141
|
-
"@saasicat/types": "^0.
|
|
140
|
+
"@saasicat/spec": "^0.26.0",
|
|
141
|
+
"@saasicat/types": "^0.26.0"
|
|
142
142
|
},
|
|
143
143
|
"peerDependencies": {
|
|
144
144
|
"@nestjs/common": "^11.0.0",
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
"access": "public"
|
|
181
181
|
},
|
|
182
182
|
"scripts": {
|
|
183
|
-
"build": "tsup && tsup --config tsup.cjs.config.ts && node scripts/build-cjs-stubs.mjs",
|
|
183
|
+
"build": "node ../../scripts/build-and-prune.mjs \"tsup && tsup --config tsup.cjs.config.ts && node scripts/build-cjs-stubs.mjs\"",
|
|
184
184
|
"pretest": "pnpm run build",
|
|
185
185
|
"test": "node --test tests/**/*.test.js"
|
|
186
186
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
appendImplicitDiscountLineItem
|
|
3
3
|
} from "./chunk-BSK6YBLI.js";
|
|
4
|
-
import {
|
|
5
|
-
SaaSiCatPublicRoute
|
|
6
|
-
} from "./chunk-YSC46BGM.js";
|
|
7
4
|
import {
|
|
8
5
|
BUNDLE_REPOSITORY_TOKEN,
|
|
9
6
|
CATALOG_ENTRY_REPOSITORY_TOKEN,
|
|
10
7
|
PLAN_REPOSITORY_TOKEN
|
|
11
8
|
} from "./chunk-L4KTQ6CL.js";
|
|
9
|
+
import {
|
|
10
|
+
SaaSiCatPublicRoute
|
|
11
|
+
} from "./chunk-YSC46BGM.js";
|
|
12
12
|
import {
|
|
13
13
|
asProvider
|
|
14
14
|
} from "./chunk-SABTXESR.js";
|
|
@@ -5,12 +5,6 @@ import {
|
|
|
5
5
|
classifyBundleVersionDiff,
|
|
6
6
|
classifyPlanDiff
|
|
7
7
|
} from "./chunk-WPUVJRIN.js";
|
|
8
|
-
import {
|
|
9
|
-
AdminAuditService
|
|
10
|
-
} from "./chunk-E56W4U2P.js";
|
|
11
|
-
import {
|
|
12
|
-
SaaSiCatPublicRoute
|
|
13
|
-
} from "./chunk-YSC46BGM.js";
|
|
14
8
|
import {
|
|
15
9
|
DiscoveryScanner
|
|
16
10
|
} from "./chunk-5ZXBXYXU.js";
|
|
@@ -27,12 +21,18 @@ import {
|
|
|
27
21
|
PLAN_REPOSITORY_TOKEN,
|
|
28
22
|
PROMOTION_REPOSITORY_TOKEN
|
|
29
23
|
} from "./chunk-L4KTQ6CL.js";
|
|
30
|
-
import {
|
|
31
|
-
asProvider
|
|
32
|
-
} from "./chunk-SABTXESR.js";
|
|
33
24
|
import {
|
|
34
25
|
DISCOVERY_SNAPSHOT_TOKEN
|
|
35
26
|
} from "./chunk-L4SUWH5B.js";
|
|
27
|
+
import {
|
|
28
|
+
AdminAuditService
|
|
29
|
+
} from "./chunk-E56W4U2P.js";
|
|
30
|
+
import {
|
|
31
|
+
SaaSiCatPublicRoute
|
|
32
|
+
} from "./chunk-YSC46BGM.js";
|
|
33
|
+
import {
|
|
34
|
+
asProvider
|
|
35
|
+
} from "./chunk-SABTXESR.js";
|
|
36
36
|
import {
|
|
37
37
|
__name
|
|
38
38
|
} from "./chunk-SHUYVCID.js";
|
|
@@ -5,9 +5,6 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
SUBSCRIPTION_CONTRACT_REPOSITORY_TOKEN
|
|
7
7
|
} from "./chunk-NYLON2VC.js";
|
|
8
|
-
import {
|
|
9
|
-
codedError
|
|
10
|
-
} from "./chunk-EBJJNTW6.js";
|
|
11
8
|
import {
|
|
12
9
|
ENTITLEMENT_RESOLUTION_CONFIG_TOKEN,
|
|
13
10
|
ENTITLEMENT_SERVICE_TOKEN,
|
|
@@ -18,12 +15,15 @@ import {
|
|
|
18
15
|
import {
|
|
19
16
|
BUNDLE_REPOSITORY_TOKEN
|
|
20
17
|
} from "./chunk-L4KTQ6CL.js";
|
|
21
|
-
import {
|
|
22
|
-
asProvider
|
|
23
|
-
} from "./chunk-SABTXESR.js";
|
|
24
18
|
import {
|
|
25
19
|
DISCOVERY_SNAPSHOT_TOKEN
|
|
26
20
|
} from "./chunk-L4SUWH5B.js";
|
|
21
|
+
import {
|
|
22
|
+
codedError
|
|
23
|
+
} from "./chunk-EBJJNTW6.js";
|
|
24
|
+
import {
|
|
25
|
+
asProvider
|
|
26
|
+
} from "./chunk-SABTXESR.js";
|
|
27
27
|
import {
|
|
28
28
|
__name
|
|
29
29
|
} from "./chunk-SHUYVCID.js";
|