@retaila/shared-types 2.0.10 → 2.0.14
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/index.d.mts +101 -3
- package/dist/index.d.ts +101 -3
- package/dist/index.js +100 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +88 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1065,6 +1065,13 @@ var BillingInterval = /* @__PURE__ */ ((BillingInterval2) => {
|
|
|
1065
1065
|
BillingInterval2["ANNUAL"] = "ANNUAL";
|
|
1066
1066
|
return BillingInterval2;
|
|
1067
1067
|
})(BillingInterval || {});
|
|
1068
|
+
var PaymentFrequency = /* @__PURE__ */ ((PaymentFrequency2) => {
|
|
1069
|
+
PaymentFrequency2["MONTHLY"] = "MONTHLY";
|
|
1070
|
+
PaymentFrequency2["QUARTERLY"] = "QUARTERLY";
|
|
1071
|
+
PaymentFrequency2["SEMIANNUAL"] = "SEMIANNUAL";
|
|
1072
|
+
PaymentFrequency2["ANNUAL"] = "ANNUAL";
|
|
1073
|
+
return PaymentFrequency2;
|
|
1074
|
+
})(PaymentFrequency || {});
|
|
1068
1075
|
var AccountServicePlanStatus = /* @__PURE__ */ ((AccountServicePlanStatus2) => {
|
|
1069
1076
|
AccountServicePlanStatus2["ACTIVE"] = "ACTIVE";
|
|
1070
1077
|
AccountServicePlanStatus2["ENDED"] = "ENDED";
|
|
@@ -1085,12 +1092,81 @@ var ChargeStatus = /* @__PURE__ */ ((ChargeStatus2) => {
|
|
|
1085
1092
|
return ChargeStatus2;
|
|
1086
1093
|
})(ChargeStatus || {});
|
|
1087
1094
|
|
|
1095
|
+
// src/serviceBilling/billingSchedule.ts
|
|
1096
|
+
var SERVICE_BILLING_FREE_DAYS_VALUES = [0, 7, 15, 30, 60];
|
|
1097
|
+
function normalizeServiceBillingFreeDays(value) {
|
|
1098
|
+
const n = value == null || value === "" ? 0 : Number(value);
|
|
1099
|
+
if (!Number.isFinite(n)) return 0;
|
|
1100
|
+
return SERVICE_BILLING_FREE_DAYS_VALUES.includes(n) ? n : 0;
|
|
1101
|
+
}
|
|
1102
|
+
function contractTermMonths(contract) {
|
|
1103
|
+
switch (contract) {
|
|
1104
|
+
case "MONTHLY" /* MONTHLY */:
|
|
1105
|
+
return 1;
|
|
1106
|
+
case "SEMIANNUAL" /* SEMIANNUAL */:
|
|
1107
|
+
return 6;
|
|
1108
|
+
case "ANNUAL" /* ANNUAL */:
|
|
1109
|
+
return 12;
|
|
1110
|
+
default:
|
|
1111
|
+
return 1;
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
function paymentFrequencyMonths(freq) {
|
|
1115
|
+
switch (freq) {
|
|
1116
|
+
case "MONTHLY" /* MONTHLY */:
|
|
1117
|
+
return 1;
|
|
1118
|
+
case "QUARTERLY" /* QUARTERLY */:
|
|
1119
|
+
return 3;
|
|
1120
|
+
case "SEMIANNUAL" /* SEMIANNUAL */:
|
|
1121
|
+
return 6;
|
|
1122
|
+
case "ANNUAL" /* ANNUAL */:
|
|
1123
|
+
return 12;
|
|
1124
|
+
default:
|
|
1125
|
+
return 1;
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
function subscriptionInstallmentCount(contract, payment) {
|
|
1129
|
+
const cm = contractTermMonths(contract);
|
|
1130
|
+
const pm = paymentFrequencyMonths(payment);
|
|
1131
|
+
if (pm > cm) return null;
|
|
1132
|
+
if (cm % pm !== 0) return null;
|
|
1133
|
+
return cm / pm;
|
|
1134
|
+
}
|
|
1135
|
+
function resolveEffectivePaymentFrequency(contract, paymentFrequency) {
|
|
1136
|
+
if (paymentFrequency != null) return paymentFrequency;
|
|
1137
|
+
return contract;
|
|
1138
|
+
}
|
|
1139
|
+
function subscriptionAmountPerInstallment(contractTotalAmount, contract, payment) {
|
|
1140
|
+
const n = subscriptionInstallmentCount(contract, payment);
|
|
1141
|
+
if (n == null || n <= 0) return null;
|
|
1142
|
+
return Math.round(contractTotalAmount / n * 100) / 100;
|
|
1143
|
+
}
|
|
1144
|
+
function aiCreditsPerSubscriptionInstallment(creditsIncludedPerContract, contract, payment) {
|
|
1145
|
+
const n = subscriptionInstallmentCount(contract, payment);
|
|
1146
|
+
if (n == null || n <= 0) return creditsIncludedPerContract;
|
|
1147
|
+
return Math.round(creditsIncludedPerContract / n);
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1088
1150
|
// src/holiday/types.ts
|
|
1089
1151
|
var HolidayType = /* @__PURE__ */ ((HolidayType2) => {
|
|
1090
1152
|
HolidayType2["NON_WORKING"] = "NON_WORKING";
|
|
1091
1153
|
HolidayType2["WORKING"] = "WORKING";
|
|
1092
1154
|
return HolidayType2;
|
|
1093
1155
|
})(HolidayType || {});
|
|
1156
|
+
|
|
1157
|
+
// src/gestionUser/types.ts
|
|
1158
|
+
var GestionUserRole = /* @__PURE__ */ ((GestionUserRole2) => {
|
|
1159
|
+
GestionUserRole2["OWNER"] = "OWNER";
|
|
1160
|
+
GestionUserRole2["ADMIN"] = "ADMIN";
|
|
1161
|
+
GestionUserRole2["ANALYST"] = "ANALYST";
|
|
1162
|
+
return GestionUserRole2;
|
|
1163
|
+
})(GestionUserRole || {});
|
|
1164
|
+
var GestionUserStatus = /* @__PURE__ */ ((GestionUserStatus2) => {
|
|
1165
|
+
GestionUserStatus2["ACTIVE"] = "ACTIVE";
|
|
1166
|
+
GestionUserStatus2["INACTIVE"] = "INACTIVE";
|
|
1167
|
+
GestionUserStatus2["LOCKED"] = "LOCKED";
|
|
1168
|
+
return GestionUserStatus2;
|
|
1169
|
+
})(GestionUserStatus || {});
|
|
1094
1170
|
export {
|
|
1095
1171
|
AccountBranchScheduleDay,
|
|
1096
1172
|
AccountBranchScheduleStatus,
|
|
@@ -1140,6 +1216,8 @@ export {
|
|
|
1140
1216
|
FulfillmentStatus,
|
|
1141
1217
|
FunnelStep,
|
|
1142
1218
|
GeoZoneStatus,
|
|
1219
|
+
GestionUserRole,
|
|
1220
|
+
GestionUserStatus,
|
|
1143
1221
|
HolidayType,
|
|
1144
1222
|
IntegrationCategory,
|
|
1145
1223
|
IntegrationDeliveryZoneStatus,
|
|
@@ -1153,6 +1231,7 @@ export {
|
|
|
1153
1231
|
OrderStatus,
|
|
1154
1232
|
PageType,
|
|
1155
1233
|
PaymentCardBrandKey,
|
|
1234
|
+
PaymentFrequency,
|
|
1156
1235
|
PaymentMethodType,
|
|
1157
1236
|
PaymentStatus,
|
|
1158
1237
|
ProductAttributeStatus,
|
|
@@ -1169,6 +1248,7 @@ export {
|
|
|
1169
1248
|
PubSubTopics,
|
|
1170
1249
|
RoundingMethod,
|
|
1171
1250
|
RoundingRule,
|
|
1251
|
+
SERVICE_BILLING_FREE_DAYS_VALUES,
|
|
1172
1252
|
SUPPORTED_COUNTRIES,
|
|
1173
1253
|
StandardCategoryStatus,
|
|
1174
1254
|
StoreBannerStatus,
|
|
@@ -1183,6 +1263,8 @@ export {
|
|
|
1183
1263
|
SupportConversationStatus,
|
|
1184
1264
|
SupportConversationVisibility,
|
|
1185
1265
|
TrafficSource,
|
|
1266
|
+
aiCreditsPerSubscriptionInstallment,
|
|
1267
|
+
contractTermMonths,
|
|
1186
1268
|
getAccountPaymentMethodStatusInfo,
|
|
1187
1269
|
getCountryDefaults,
|
|
1188
1270
|
getCurrencySymbol,
|
|
@@ -1198,6 +1280,11 @@ export {
|
|
|
1198
1280
|
isLegacyLayout,
|
|
1199
1281
|
isSupportedCountry,
|
|
1200
1282
|
isZonedLayout,
|
|
1201
|
-
|
|
1283
|
+
normalizeServiceBillingFreeDays,
|
|
1284
|
+
parsePriceFormatPattern,
|
|
1285
|
+
paymentFrequencyMonths,
|
|
1286
|
+
resolveEffectivePaymentFrequency,
|
|
1287
|
+
subscriptionAmountPerInstallment,
|
|
1288
|
+
subscriptionInstallmentCount
|
|
1202
1289
|
};
|
|
1203
1290
|
//# sourceMappingURL=index.mjs.map
|