@retaila/shared-types 2.0.11 → 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 CHANGED
@@ -3403,11 +3403,19 @@ interface UpdateNotificationSettingsDTO {
3403
3403
  delayHours?: number;
3404
3404
  }
3405
3405
 
3406
+ /** Catalog price row and contract term: amount is the total for this period (e.g. full year for ANNUAL). */
3406
3407
  declare enum BillingInterval {
3407
3408
  MONTHLY = "MONTHLY",
3408
3409
  SEMIANNUAL = "SEMIANNUAL",
3409
3410
  ANNUAL = "ANNUAL"
3410
3411
  }
3412
+ /** How often a subscription charge is generated (may split the contract total into installments). */
3413
+ declare enum PaymentFrequency {
3414
+ MONTHLY = "MONTHLY",
3415
+ QUARTERLY = "QUARTERLY",
3416
+ SEMIANNUAL = "SEMIANNUAL",
3417
+ ANNUAL = "ANNUAL"
3418
+ }
3411
3419
  /** Single item in a spec category (display-like structure). */
3412
3420
  interface ServiceBillingPlanSpecItem {
3413
3421
  key: string;
@@ -3475,6 +3483,7 @@ interface ServiceBillingPlan {
3475
3483
  interface ServiceBillingPlanPrice {
3476
3484
  id: string;
3477
3485
  serviceBillingPlanId: string;
3486
+ /** Contract / pricing period this row applies to (matches account assignment contract term). */
3478
3487
  billingInterval: BillingInterval;
3479
3488
  amount: number;
3480
3489
  aiImageCreditsIncluded: number;
@@ -3493,8 +3502,12 @@ interface AccountServicePlan {
3493
3502
  serviceBillingPlanId: string;
3494
3503
  status: AccountServicePlanStatus;
3495
3504
  customAmount?: number | null;
3505
+ /** Contract term; selects `service_billing_plan_price` row (catalog total for this term). */
3496
3506
  billingInterval?: BillingInterval | null;
3497
- freePeriodsRemaining: number;
3507
+ /** Charge cadence; installments divide the contract catalog/custom total. Null = same as billingInterval (legacy). */
3508
+ paymentFrequency?: PaymentFrequency | null;
3509
+ /** Trial length in days (0, 7, 15, 30, 60); no subscription charges until startedAt + freeDays. */
3510
+ freeDays: number;
3498
3511
  installationFee?: number | null;
3499
3512
  installationFeePaidAt?: Date | null;
3500
3513
  startedAt: Date;
@@ -3523,7 +3536,8 @@ interface AccountServiceBillingCharge {
3523
3536
  amount: number;
3524
3537
  currency: string;
3525
3538
  type: ChargeType;
3526
- billingInterval?: BillingInterval | null;
3539
+ /** For SUBSCRIPTION: length of the billed period (payment frequency), e.g. MONTHLY or QUARTERLY. */
3540
+ billingInterval?: BillingInterval | PaymentFrequency | null;
3527
3541
  periodStart?: Date | null;
3528
3542
  periodEnd?: Date | null;
3529
3543
  dueDate?: Date | null;
@@ -3536,6 +3550,23 @@ interface AccountServiceBillingCharge {
3536
3550
  deletedAt?: Date | null;
3537
3551
  }
3538
3552
 
3553
+ /** Allowed “días gratis” before the first subscription charge is generated. */
3554
+ declare const SERVICE_BILLING_FREE_DAYS_VALUES: readonly [0, 7, 15, 30, 60];
3555
+ type ServiceBillingFreeDays = (typeof SERVICE_BILLING_FREE_DAYS_VALUES)[number];
3556
+ declare function normalizeServiceBillingFreeDays(value: unknown): ServiceBillingFreeDays;
3557
+ declare function contractTermMonths(contract: BillingInterval): number;
3558
+ declare function paymentFrequencyMonths(freq: PaymentFrequency): number;
3559
+ /**
3560
+ * Number of subscription charges in one full contract term, or null if incompatible
3561
+ * (e.g. quarterly billing on a 1-month contract).
3562
+ */
3563
+ declare function subscriptionInstallmentCount(contract: BillingInterval, payment: PaymentFrequency): number | null;
3564
+ declare function resolveEffectivePaymentFrequency(contract: BillingInterval, paymentFrequency: PaymentFrequency | null | undefined): PaymentFrequency;
3565
+ /** Per-charge amount from the contract-period total (catalog or custom). */
3566
+ declare function subscriptionAmountPerInstallment(contractTotalAmount: number, contract: BillingInterval, payment: PaymentFrequency): number | null;
3567
+ /** IA credits to grant per subscription charge (proportional to installments). */
3568
+ declare function aiCreditsPerSubscriptionInstallment(creditsIncludedPerContract: number, contract: BillingInterval, payment: PaymentFrequency): number;
3569
+
3539
3570
  declare enum HolidayType {
3540
3571
  /** Business is expected to be closed. Default: excluded from delivery calculation. */
3541
3572
  NON_WORKING = "NON_WORKING",
@@ -3631,4 +3662,4 @@ interface GestionLoginAttempt {
3631
3662
  createdAt: Date;
3632
3663
  }
3633
3664
 
3634
- export { type Account, type AccountAiCreditTransaction, type AccountAiCredits, type AccountBranch, type AccountBranchSchedule, AccountBranchScheduleDay, AccountBranchScheduleStatus, AccountBranchStatus, type AccountCurrencyConfig, type AccountDeliveryOption, type AccountDeliveryOptionCalculatedCost, AccountDeliveryOptionPriceLogic, type AccountDeliveryOptionRule, AccountDeliveryOptionStatus, type AccountDeliveryOptionZone, AccountDeliveryOptionZoneStatus, type AccountDomain, AccountDomainStatus, type AccountEmailDomain, AccountEmailDomainStatus, type AccountExchangeRate, type AccountExchangeRateListResponse, type AccountExchangeRateMetadata, type AccountExchangeRateQueryDto, type AccountExchangeRateResponse, AccountExchangeRateType, type AccountExchangeRateWithEffectiveRate, type AccountHolidaySchedule, type AccountIntegration, type AccountIntegrationConfigDTO, AccountIntegrationConnectionStatus, AccountIntegrationEnvironment, AccountIntegrationStatus, type AccountMailbox, type AccountPaymentMethod, AccountPaymentMethodStatus, type AccountServiceBillingCharge, type AccountServicePlan, AccountServicePlanStatus, AccountStatus, type AccountUserRoleLink, type ActiveSession, type Address, type AdminOrderStatusChangeDto, AiCreditSource, AiCreditTransactionReason, AiCreditType, type AiCreditsBalance, type AnalyticsEvent, AnalyticsEventType, type AnalyticsFunnelStep, type AnalyticsOverview, type AnalyticsPageview, type AnalyticsPagination, type AnalyticsQueryParams, type AnalyticsSession, type BaseEntity, type BaseEntityWithAccount, type BaseEntityWithAccountAndUser, type BaseEntityWithUser, BillingInterval, type BufferSafetyMarginParams, type BusinessDaysParams, type ButtonStyle, COUNTRY_DEFAULTS, type Campaign, type CampaignBudget, CampaignBudgetType, type CampaignBudgetUsage, type CampaignData, type CampaignPerformance, CampaignStatus, type Cart, type CartConfirmDto, type CartDeliveryMethod, type CartDeliveryMethodAdjustment, type CartDeliveryMethodCreateData, type CartDeliveryMethodCreateDto, type CartDeliveryMethodFindParams, type CartDeliveryMethodResponse, type CartDeliveryMethodUpdateData, type CartDeliveryMethodUpdateDto, CartDeliveryType, type CartItem, type CartItemAddDto, type CartItemAttributeDetail, CartItemErrorCode, type CartItemRemoveDto, type CartItemUpdateDto, type CartItemValidation, type CartLineItemAdjustment, type CartPromotion, CartSource, CartStatus, type CartUpdateDto, type ChargeSellerAllocation, ChargeStatus, ChargeType, type Collection, type CollectionMedia, type CollectionProductLink, type CollectionRule, CollectionRuleField, CollectionRuleFieldLabels, CollectionRuleOperator, CollectionRuleOperatorLabels, CollectionRulesLogic, CollectionStatus, CollectionStatusLabels, CollectionType, CollectionTypeLabels, type ColorVariant, type CountryDefaultBranchAddress, type CountryDefaultConfig, type CountryDefaultTax, type CreateAccountDeliveryOptionDTO, type CreateAccountExchangeRateDto, type CreateAnalyticsSessionDto, type CreateCollectionDTO, type CreateDeliveryOptionDto, type CreateDeliveryOptionRuleDTO, type CreateExchangeRateDto, type CreateFulfillmentDto, type CreateFulfillmentItemDto, type CreateLeadDTO, type CreatePromotionDTO, type CreateRoleDTO, type CreateStoreComponentTemplateDTO, type CreateStoreTemplateDTO, Currency, type CurrencyConversion, type Customer, type CustomerNotificationConfig, CustomerStatus, type CustomerUpsertDto, DayOfWeek, type DeliveryDaysParams, type DeliveryHoursParams, DeliveryOptionRuleType, DeliveryType, type DeliveryZoneInput, type DesignTokens, DeviceType, DisplayOrderStatus, type EffectiveExchangeRate, type ExchangeRate, type ExchangeRateListResponse, type ExchangeRateMetadata, type ExchangeRateQueryDto, type ExchangeRateResponse, type FixedOffsetDaysParams, type Fulfillment, type FulfillmentDeliveryOption, type FulfillmentItem, type FulfillmentLabel, type FulfillmentLabelCreateData, type FulfillmentLabelUpdateData, type FulfillmentProviderAdapter, type FulfillmentProviderContext, type FulfillmentProviderCreateInput, type FulfillmentProviderCreateOutput, type FulfillmentProviderKey, type FulfillmentProviderProcessWebhookInput, type FulfillmentProviderProcessWebhookOutput, type FulfillmentRecollectionCapabilities, type FulfillmentRecollectionConfig, type FulfillmentRecollectionMode, type FulfillmentRecollectionSchedule, FulfillmentStatus, type FulfillmentTrackingEvent, type FunnelData, FunnelStep, type FunnelStepData, type GeoZone, type GeoZoneInput, GeoZoneStatus, type GestionLoginAttempt, type GestionSession, type GestionUser, GestionUserRole, GestionUserStatus, type HistoricalDataPoint, type Holiday, HolidayType, type Integration, IntegrationCategory, type IntegrationDeliveryZone, IntegrationDeliveryZoneStatus, IntegrationStatus, type InternalNotificationConfig, InternalNotificationType, type Lead, type LinkButtonStyle, type MapPosition, type Media, MediaType, NavigationItemType, type NavigationMenuConfig, type NavigationMenuItem, type NeutralColorScale, type NextStatusAction, type Order, type OrderCreateFromCartDto, type OrderDeliveryMethod, type OrderDeliveryMethodAdjustment, type OrderDeliveryMethodCreateData, type OrderDeliveryMethodUpdateData, OrderDeliveryType, type OrderItem, type OrderItemSnapshot, type OrderLineItemAdjustment, OrderPaymentStatus, type OrderPromotion, OrderSource, OrderStatus, type PageData, PageType, type Payment, type PaymentCardBrand, PaymentCardBrandKey, type PaymentConversion, PaymentMethodType, type PaymentProviderAdapter, type PaymentProviderCaptureInput, type PaymentProviderCaptureOutput, type PaymentProviderContext, type PaymentProviderInitInput, type PaymentProviderInitOutput, type PaymentProviderKey, type PaymentProviderRefundInput, type PaymentProviderRefundOutput, type PaymentProviderWebhookResult, PaymentStatus, type Permission, type Phone, type PickupLocation, type PickupReadyHoursParams, type ProcessingDaysParams, type Product, type ProductAnalyticsData, type ProductAnalyticsItem, type ProductAttribute, type ProductAttributeOption, ProductAttributeStatus, ProductAttributeType, type ProductCategory, ProductCategoryStatus, ProductStatus, ProductType, type ProductVariant, ProductVariantStatus, type Promotion, type PromotionApplicationMethod, type PromotionApplicationMethodInput, type PromotionApplicationMethodPromotionRule, PromotionApplicationType, type PromotionListFilters, type PromotionPromotionRule, type PromotionRule, type PromotionRuleInput, PromotionRuleOperator, type PromotionRuleValue, PromotionStatus, PromotionTargetType, PromotionType, PubSubTopics, type RealtimeAnalytics, type RecentEvent, type Role, type RolePermissionLink, type RoundingConfig, RoundingMethod, RoundingRule, SUPPORTED_COUNTRIES, type SameDayCutoffParams, type Seller, type SellerPeriodBalance, type ServiceBillingPlan, type ServiceBillingPlanLimits, type ServiceBillingPlanPrice, type ServiceBillingPlanSpec, type ServiceBillingPlanSpecCategory, type ServiceBillingPlanSpecItem, type SessionHeartbeatDto, type StandardCategory, StandardCategoryStatus, type StatusChangeHistory, type StatusFlow, type StoreBanner, StoreBannerStatus, type StoreComponentTemplate, type StoreCustomization, type StoreCustomizationComponentSettings, type StoreCustomizationFooterZone, type StoreCustomizationHeaderZone, type StoreCustomizationLayout, type StoreCustomizationLayoutComponent, type StoreCustomizationLayoutLegacy, type StoreCustomizationPage, type StoreCustomizationPageComponent, type StoreCustomizationSeo, type StoreCustomizationThemeButtons, type StoreCustomizationThemeColors, type StoreCustomizationThemeTypography, type StorePage, StorePageStatus, StorePageType, type StoreSettings, type StoreTemplate, type StoreTemplateMocks, type SupportConversation, SupportConversationChannel, type SupportConversationMessage, SupportConversationMessageAiAnalysisStatus, SupportConversationMessageDeliveryStatus, SupportConversationMessageDirection, SupportConversationMessageSenderType, SupportConversationPriority, SupportConversationStatus, SupportConversationVisibility, type SupportedCountryCode, type SurfaceColors, type ThemeBorderRadius, type ThemeBorderWidth, type ThemeBorders, type ThemeButtonSize, type ThemeButtonSizes, type ThemeButtonVariant, type ThemeButtonVariants, type ThemeButtons, type ThemeColorPalette, type ThemeConfig, type ThemeFonts, type ThemeProductCard, type ThemeShadows, type ThemeSpacing, type ThemeTypography, type ThemeTypographySizes, type ThemeTypographyStyles, type TopPagesData, type TrackEventDto, type TrackPageviewDto, TrafficSource, type TrafficSourceItem, type TrafficSourcesData, type TypographyStyle, type UnifiedDeliveryConfig, type UpdateAccountDeliveryOptionDTO, type UpdateAccountExchangeRateAllDto, type UpdateAccountExchangeRateDto, type UpdateCollectionDTO, type UpdateDeliveryOptionRuleDTO, type UpdateExchangeRateDto, type UpdateFulfillmentDto, type UpdateNotificationSettingsDTO, type UpdatePromotionDTO, type UpdateRoleDTO, type UpdateStoreComponentTemplateDTO, type UpdateStoreTemplateDTO, type Webhook, type WebhookPayload, getAccountPaymentMethodStatusInfo, getCountryDefaults, getCurrencySymbol, getDisplayOrderStatus, getDisplayOrderStatusInfo, getFulfillmentStatusInfo, getIntegrationCategoryName, getOrderPaymentStatusInfo, getOrderStatusInfo, getPaymentCardBrand, getPaymentStatusInfo, getProductStatusInfo, isLegacyLayout, isSupportedCountry, isZonedLayout, parsePriceFormatPattern };
3665
+ export { type Account, type AccountAiCreditTransaction, type AccountAiCredits, type AccountBranch, type AccountBranchSchedule, AccountBranchScheduleDay, AccountBranchScheduleStatus, AccountBranchStatus, type AccountCurrencyConfig, type AccountDeliveryOption, type AccountDeliveryOptionCalculatedCost, AccountDeliveryOptionPriceLogic, type AccountDeliveryOptionRule, AccountDeliveryOptionStatus, type AccountDeliveryOptionZone, AccountDeliveryOptionZoneStatus, type AccountDomain, AccountDomainStatus, type AccountEmailDomain, AccountEmailDomainStatus, type AccountExchangeRate, type AccountExchangeRateListResponse, type AccountExchangeRateMetadata, type AccountExchangeRateQueryDto, type AccountExchangeRateResponse, AccountExchangeRateType, type AccountExchangeRateWithEffectiveRate, type AccountHolidaySchedule, type AccountIntegration, type AccountIntegrationConfigDTO, AccountIntegrationConnectionStatus, AccountIntegrationEnvironment, AccountIntegrationStatus, type AccountMailbox, type AccountPaymentMethod, AccountPaymentMethodStatus, type AccountServiceBillingCharge, type AccountServicePlan, AccountServicePlanStatus, AccountStatus, type AccountUserRoleLink, type ActiveSession, type Address, type AdminOrderStatusChangeDto, AiCreditSource, AiCreditTransactionReason, AiCreditType, type AiCreditsBalance, type AnalyticsEvent, AnalyticsEventType, type AnalyticsFunnelStep, type AnalyticsOverview, type AnalyticsPageview, type AnalyticsPagination, type AnalyticsQueryParams, type AnalyticsSession, type BaseEntity, type BaseEntityWithAccount, type BaseEntityWithAccountAndUser, type BaseEntityWithUser, BillingInterval, type BufferSafetyMarginParams, type BusinessDaysParams, type ButtonStyle, COUNTRY_DEFAULTS, type Campaign, type CampaignBudget, CampaignBudgetType, type CampaignBudgetUsage, type CampaignData, type CampaignPerformance, CampaignStatus, type Cart, type CartConfirmDto, type CartDeliveryMethod, type CartDeliveryMethodAdjustment, type CartDeliveryMethodCreateData, type CartDeliveryMethodCreateDto, type CartDeliveryMethodFindParams, type CartDeliveryMethodResponse, type CartDeliveryMethodUpdateData, type CartDeliveryMethodUpdateDto, CartDeliveryType, type CartItem, type CartItemAddDto, type CartItemAttributeDetail, CartItemErrorCode, type CartItemRemoveDto, type CartItemUpdateDto, type CartItemValidation, type CartLineItemAdjustment, type CartPromotion, CartSource, CartStatus, type CartUpdateDto, type ChargeSellerAllocation, ChargeStatus, ChargeType, type Collection, type CollectionMedia, type CollectionProductLink, type CollectionRule, CollectionRuleField, CollectionRuleFieldLabels, CollectionRuleOperator, CollectionRuleOperatorLabels, CollectionRulesLogic, CollectionStatus, CollectionStatusLabels, CollectionType, CollectionTypeLabels, type ColorVariant, type CountryDefaultBranchAddress, type CountryDefaultConfig, type CountryDefaultTax, type CreateAccountDeliveryOptionDTO, type CreateAccountExchangeRateDto, type CreateAnalyticsSessionDto, type CreateCollectionDTO, type CreateDeliveryOptionDto, type CreateDeliveryOptionRuleDTO, type CreateExchangeRateDto, type CreateFulfillmentDto, type CreateFulfillmentItemDto, type CreateLeadDTO, type CreatePromotionDTO, type CreateRoleDTO, type CreateStoreComponentTemplateDTO, type CreateStoreTemplateDTO, Currency, type CurrencyConversion, type Customer, type CustomerNotificationConfig, CustomerStatus, type CustomerUpsertDto, DayOfWeek, type DeliveryDaysParams, type DeliveryHoursParams, DeliveryOptionRuleType, DeliveryType, type DeliveryZoneInput, type DesignTokens, DeviceType, DisplayOrderStatus, type EffectiveExchangeRate, type ExchangeRate, type ExchangeRateListResponse, type ExchangeRateMetadata, type ExchangeRateQueryDto, type ExchangeRateResponse, type FixedOffsetDaysParams, type Fulfillment, type FulfillmentDeliveryOption, type FulfillmentItem, type FulfillmentLabel, type FulfillmentLabelCreateData, type FulfillmentLabelUpdateData, type FulfillmentProviderAdapter, type FulfillmentProviderContext, type FulfillmentProviderCreateInput, type FulfillmentProviderCreateOutput, type FulfillmentProviderKey, type FulfillmentProviderProcessWebhookInput, type FulfillmentProviderProcessWebhookOutput, type FulfillmentRecollectionCapabilities, type FulfillmentRecollectionConfig, type FulfillmentRecollectionMode, type FulfillmentRecollectionSchedule, FulfillmentStatus, type FulfillmentTrackingEvent, type FunnelData, FunnelStep, type FunnelStepData, type GeoZone, type GeoZoneInput, GeoZoneStatus, type GestionLoginAttempt, type GestionSession, type GestionUser, GestionUserRole, GestionUserStatus, type HistoricalDataPoint, type Holiday, HolidayType, type Integration, IntegrationCategory, type IntegrationDeliveryZone, IntegrationDeliveryZoneStatus, IntegrationStatus, type InternalNotificationConfig, InternalNotificationType, type Lead, type LinkButtonStyle, type MapPosition, type Media, MediaType, NavigationItemType, type NavigationMenuConfig, type NavigationMenuItem, type NeutralColorScale, type NextStatusAction, type Order, type OrderCreateFromCartDto, type OrderDeliveryMethod, type OrderDeliveryMethodAdjustment, type OrderDeliveryMethodCreateData, type OrderDeliveryMethodUpdateData, OrderDeliveryType, type OrderItem, type OrderItemSnapshot, type OrderLineItemAdjustment, OrderPaymentStatus, type OrderPromotion, OrderSource, OrderStatus, type PageData, PageType, type Payment, type PaymentCardBrand, PaymentCardBrandKey, type PaymentConversion, PaymentFrequency, PaymentMethodType, type PaymentProviderAdapter, type PaymentProviderCaptureInput, type PaymentProviderCaptureOutput, type PaymentProviderContext, type PaymentProviderInitInput, type PaymentProviderInitOutput, type PaymentProviderKey, type PaymentProviderRefundInput, type PaymentProviderRefundOutput, type PaymentProviderWebhookResult, PaymentStatus, type Permission, type Phone, type PickupLocation, type PickupReadyHoursParams, type ProcessingDaysParams, type Product, type ProductAnalyticsData, type ProductAnalyticsItem, type ProductAttribute, type ProductAttributeOption, ProductAttributeStatus, ProductAttributeType, type ProductCategory, ProductCategoryStatus, ProductStatus, ProductType, type ProductVariant, ProductVariantStatus, type Promotion, type PromotionApplicationMethod, type PromotionApplicationMethodInput, type PromotionApplicationMethodPromotionRule, PromotionApplicationType, type PromotionListFilters, type PromotionPromotionRule, type PromotionRule, type PromotionRuleInput, PromotionRuleOperator, type PromotionRuleValue, PromotionStatus, PromotionTargetType, PromotionType, PubSubTopics, type RealtimeAnalytics, type RecentEvent, type Role, type RolePermissionLink, type RoundingConfig, RoundingMethod, RoundingRule, SERVICE_BILLING_FREE_DAYS_VALUES, SUPPORTED_COUNTRIES, type SameDayCutoffParams, type Seller, type SellerPeriodBalance, type ServiceBillingFreeDays, type ServiceBillingPlan, type ServiceBillingPlanLimits, type ServiceBillingPlanPrice, type ServiceBillingPlanSpec, type ServiceBillingPlanSpecCategory, type ServiceBillingPlanSpecItem, type SessionHeartbeatDto, type StandardCategory, StandardCategoryStatus, type StatusChangeHistory, type StatusFlow, type StoreBanner, StoreBannerStatus, type StoreComponentTemplate, type StoreCustomization, type StoreCustomizationComponentSettings, type StoreCustomizationFooterZone, type StoreCustomizationHeaderZone, type StoreCustomizationLayout, type StoreCustomizationLayoutComponent, type StoreCustomizationLayoutLegacy, type StoreCustomizationPage, type StoreCustomizationPageComponent, type StoreCustomizationSeo, type StoreCustomizationThemeButtons, type StoreCustomizationThemeColors, type StoreCustomizationThemeTypography, type StorePage, StorePageStatus, StorePageType, type StoreSettings, type StoreTemplate, type StoreTemplateMocks, type SupportConversation, SupportConversationChannel, type SupportConversationMessage, SupportConversationMessageAiAnalysisStatus, SupportConversationMessageDeliveryStatus, SupportConversationMessageDirection, SupportConversationMessageSenderType, SupportConversationPriority, SupportConversationStatus, SupportConversationVisibility, type SupportedCountryCode, type SurfaceColors, type ThemeBorderRadius, type ThemeBorderWidth, type ThemeBorders, type ThemeButtonSize, type ThemeButtonSizes, type ThemeButtonVariant, type ThemeButtonVariants, type ThemeButtons, type ThemeColorPalette, type ThemeConfig, type ThemeFonts, type ThemeProductCard, type ThemeShadows, type ThemeSpacing, type ThemeTypography, type ThemeTypographySizes, type ThemeTypographyStyles, type TopPagesData, type TrackEventDto, type TrackPageviewDto, TrafficSource, type TrafficSourceItem, type TrafficSourcesData, type TypographyStyle, type UnifiedDeliveryConfig, type UpdateAccountDeliveryOptionDTO, type UpdateAccountExchangeRateAllDto, type UpdateAccountExchangeRateDto, type UpdateCollectionDTO, type UpdateDeliveryOptionRuleDTO, type UpdateExchangeRateDto, type UpdateFulfillmentDto, type UpdateNotificationSettingsDTO, type UpdatePromotionDTO, type UpdateRoleDTO, type UpdateStoreComponentTemplateDTO, type UpdateStoreTemplateDTO, type Webhook, type WebhookPayload, aiCreditsPerSubscriptionInstallment, contractTermMonths, getAccountPaymentMethodStatusInfo, getCountryDefaults, getCurrencySymbol, getDisplayOrderStatus, getDisplayOrderStatusInfo, getFulfillmentStatusInfo, getIntegrationCategoryName, getOrderPaymentStatusInfo, getOrderStatusInfo, getPaymentCardBrand, getPaymentStatusInfo, getProductStatusInfo, isLegacyLayout, isSupportedCountry, isZonedLayout, normalizeServiceBillingFreeDays, parsePriceFormatPattern, paymentFrequencyMonths, resolveEffectivePaymentFrequency, subscriptionAmountPerInstallment, subscriptionInstallmentCount };
package/dist/index.d.ts CHANGED
@@ -3403,11 +3403,19 @@ interface UpdateNotificationSettingsDTO {
3403
3403
  delayHours?: number;
3404
3404
  }
3405
3405
 
3406
+ /** Catalog price row and contract term: amount is the total for this period (e.g. full year for ANNUAL). */
3406
3407
  declare enum BillingInterval {
3407
3408
  MONTHLY = "MONTHLY",
3408
3409
  SEMIANNUAL = "SEMIANNUAL",
3409
3410
  ANNUAL = "ANNUAL"
3410
3411
  }
3412
+ /** How often a subscription charge is generated (may split the contract total into installments). */
3413
+ declare enum PaymentFrequency {
3414
+ MONTHLY = "MONTHLY",
3415
+ QUARTERLY = "QUARTERLY",
3416
+ SEMIANNUAL = "SEMIANNUAL",
3417
+ ANNUAL = "ANNUAL"
3418
+ }
3411
3419
  /** Single item in a spec category (display-like structure). */
3412
3420
  interface ServiceBillingPlanSpecItem {
3413
3421
  key: string;
@@ -3475,6 +3483,7 @@ interface ServiceBillingPlan {
3475
3483
  interface ServiceBillingPlanPrice {
3476
3484
  id: string;
3477
3485
  serviceBillingPlanId: string;
3486
+ /** Contract / pricing period this row applies to (matches account assignment contract term). */
3478
3487
  billingInterval: BillingInterval;
3479
3488
  amount: number;
3480
3489
  aiImageCreditsIncluded: number;
@@ -3493,8 +3502,12 @@ interface AccountServicePlan {
3493
3502
  serviceBillingPlanId: string;
3494
3503
  status: AccountServicePlanStatus;
3495
3504
  customAmount?: number | null;
3505
+ /** Contract term; selects `service_billing_plan_price` row (catalog total for this term). */
3496
3506
  billingInterval?: BillingInterval | null;
3497
- freePeriodsRemaining: number;
3507
+ /** Charge cadence; installments divide the contract catalog/custom total. Null = same as billingInterval (legacy). */
3508
+ paymentFrequency?: PaymentFrequency | null;
3509
+ /** Trial length in days (0, 7, 15, 30, 60); no subscription charges until startedAt + freeDays. */
3510
+ freeDays: number;
3498
3511
  installationFee?: number | null;
3499
3512
  installationFeePaidAt?: Date | null;
3500
3513
  startedAt: Date;
@@ -3523,7 +3536,8 @@ interface AccountServiceBillingCharge {
3523
3536
  amount: number;
3524
3537
  currency: string;
3525
3538
  type: ChargeType;
3526
- billingInterval?: BillingInterval | null;
3539
+ /** For SUBSCRIPTION: length of the billed period (payment frequency), e.g. MONTHLY or QUARTERLY. */
3540
+ billingInterval?: BillingInterval | PaymentFrequency | null;
3527
3541
  periodStart?: Date | null;
3528
3542
  periodEnd?: Date | null;
3529
3543
  dueDate?: Date | null;
@@ -3536,6 +3550,23 @@ interface AccountServiceBillingCharge {
3536
3550
  deletedAt?: Date | null;
3537
3551
  }
3538
3552
 
3553
+ /** Allowed “días gratis” before the first subscription charge is generated. */
3554
+ declare const SERVICE_BILLING_FREE_DAYS_VALUES: readonly [0, 7, 15, 30, 60];
3555
+ type ServiceBillingFreeDays = (typeof SERVICE_BILLING_FREE_DAYS_VALUES)[number];
3556
+ declare function normalizeServiceBillingFreeDays(value: unknown): ServiceBillingFreeDays;
3557
+ declare function contractTermMonths(contract: BillingInterval): number;
3558
+ declare function paymentFrequencyMonths(freq: PaymentFrequency): number;
3559
+ /**
3560
+ * Number of subscription charges in one full contract term, or null if incompatible
3561
+ * (e.g. quarterly billing on a 1-month contract).
3562
+ */
3563
+ declare function subscriptionInstallmentCount(contract: BillingInterval, payment: PaymentFrequency): number | null;
3564
+ declare function resolveEffectivePaymentFrequency(contract: BillingInterval, paymentFrequency: PaymentFrequency | null | undefined): PaymentFrequency;
3565
+ /** Per-charge amount from the contract-period total (catalog or custom). */
3566
+ declare function subscriptionAmountPerInstallment(contractTotalAmount: number, contract: BillingInterval, payment: PaymentFrequency): number | null;
3567
+ /** IA credits to grant per subscription charge (proportional to installments). */
3568
+ declare function aiCreditsPerSubscriptionInstallment(creditsIncludedPerContract: number, contract: BillingInterval, payment: PaymentFrequency): number;
3569
+
3539
3570
  declare enum HolidayType {
3540
3571
  /** Business is expected to be closed. Default: excluded from delivery calculation. */
3541
3572
  NON_WORKING = "NON_WORKING",
@@ -3631,4 +3662,4 @@ interface GestionLoginAttempt {
3631
3662
  createdAt: Date;
3632
3663
  }
3633
3664
 
3634
- export { type Account, type AccountAiCreditTransaction, type AccountAiCredits, type AccountBranch, type AccountBranchSchedule, AccountBranchScheduleDay, AccountBranchScheduleStatus, AccountBranchStatus, type AccountCurrencyConfig, type AccountDeliveryOption, type AccountDeliveryOptionCalculatedCost, AccountDeliveryOptionPriceLogic, type AccountDeliveryOptionRule, AccountDeliveryOptionStatus, type AccountDeliveryOptionZone, AccountDeliveryOptionZoneStatus, type AccountDomain, AccountDomainStatus, type AccountEmailDomain, AccountEmailDomainStatus, type AccountExchangeRate, type AccountExchangeRateListResponse, type AccountExchangeRateMetadata, type AccountExchangeRateQueryDto, type AccountExchangeRateResponse, AccountExchangeRateType, type AccountExchangeRateWithEffectiveRate, type AccountHolidaySchedule, type AccountIntegration, type AccountIntegrationConfigDTO, AccountIntegrationConnectionStatus, AccountIntegrationEnvironment, AccountIntegrationStatus, type AccountMailbox, type AccountPaymentMethod, AccountPaymentMethodStatus, type AccountServiceBillingCharge, type AccountServicePlan, AccountServicePlanStatus, AccountStatus, type AccountUserRoleLink, type ActiveSession, type Address, type AdminOrderStatusChangeDto, AiCreditSource, AiCreditTransactionReason, AiCreditType, type AiCreditsBalance, type AnalyticsEvent, AnalyticsEventType, type AnalyticsFunnelStep, type AnalyticsOverview, type AnalyticsPageview, type AnalyticsPagination, type AnalyticsQueryParams, type AnalyticsSession, type BaseEntity, type BaseEntityWithAccount, type BaseEntityWithAccountAndUser, type BaseEntityWithUser, BillingInterval, type BufferSafetyMarginParams, type BusinessDaysParams, type ButtonStyle, COUNTRY_DEFAULTS, type Campaign, type CampaignBudget, CampaignBudgetType, type CampaignBudgetUsage, type CampaignData, type CampaignPerformance, CampaignStatus, type Cart, type CartConfirmDto, type CartDeliveryMethod, type CartDeliveryMethodAdjustment, type CartDeliveryMethodCreateData, type CartDeliveryMethodCreateDto, type CartDeliveryMethodFindParams, type CartDeliveryMethodResponse, type CartDeliveryMethodUpdateData, type CartDeliveryMethodUpdateDto, CartDeliveryType, type CartItem, type CartItemAddDto, type CartItemAttributeDetail, CartItemErrorCode, type CartItemRemoveDto, type CartItemUpdateDto, type CartItemValidation, type CartLineItemAdjustment, type CartPromotion, CartSource, CartStatus, type CartUpdateDto, type ChargeSellerAllocation, ChargeStatus, ChargeType, type Collection, type CollectionMedia, type CollectionProductLink, type CollectionRule, CollectionRuleField, CollectionRuleFieldLabels, CollectionRuleOperator, CollectionRuleOperatorLabels, CollectionRulesLogic, CollectionStatus, CollectionStatusLabels, CollectionType, CollectionTypeLabels, type ColorVariant, type CountryDefaultBranchAddress, type CountryDefaultConfig, type CountryDefaultTax, type CreateAccountDeliveryOptionDTO, type CreateAccountExchangeRateDto, type CreateAnalyticsSessionDto, type CreateCollectionDTO, type CreateDeliveryOptionDto, type CreateDeliveryOptionRuleDTO, type CreateExchangeRateDto, type CreateFulfillmentDto, type CreateFulfillmentItemDto, type CreateLeadDTO, type CreatePromotionDTO, type CreateRoleDTO, type CreateStoreComponentTemplateDTO, type CreateStoreTemplateDTO, Currency, type CurrencyConversion, type Customer, type CustomerNotificationConfig, CustomerStatus, type CustomerUpsertDto, DayOfWeek, type DeliveryDaysParams, type DeliveryHoursParams, DeliveryOptionRuleType, DeliveryType, type DeliveryZoneInput, type DesignTokens, DeviceType, DisplayOrderStatus, type EffectiveExchangeRate, type ExchangeRate, type ExchangeRateListResponse, type ExchangeRateMetadata, type ExchangeRateQueryDto, type ExchangeRateResponse, type FixedOffsetDaysParams, type Fulfillment, type FulfillmentDeliveryOption, type FulfillmentItem, type FulfillmentLabel, type FulfillmentLabelCreateData, type FulfillmentLabelUpdateData, type FulfillmentProviderAdapter, type FulfillmentProviderContext, type FulfillmentProviderCreateInput, type FulfillmentProviderCreateOutput, type FulfillmentProviderKey, type FulfillmentProviderProcessWebhookInput, type FulfillmentProviderProcessWebhookOutput, type FulfillmentRecollectionCapabilities, type FulfillmentRecollectionConfig, type FulfillmentRecollectionMode, type FulfillmentRecollectionSchedule, FulfillmentStatus, type FulfillmentTrackingEvent, type FunnelData, FunnelStep, type FunnelStepData, type GeoZone, type GeoZoneInput, GeoZoneStatus, type GestionLoginAttempt, type GestionSession, type GestionUser, GestionUserRole, GestionUserStatus, type HistoricalDataPoint, type Holiday, HolidayType, type Integration, IntegrationCategory, type IntegrationDeliveryZone, IntegrationDeliveryZoneStatus, IntegrationStatus, type InternalNotificationConfig, InternalNotificationType, type Lead, type LinkButtonStyle, type MapPosition, type Media, MediaType, NavigationItemType, type NavigationMenuConfig, type NavigationMenuItem, type NeutralColorScale, type NextStatusAction, type Order, type OrderCreateFromCartDto, type OrderDeliveryMethod, type OrderDeliveryMethodAdjustment, type OrderDeliveryMethodCreateData, type OrderDeliveryMethodUpdateData, OrderDeliveryType, type OrderItem, type OrderItemSnapshot, type OrderLineItemAdjustment, OrderPaymentStatus, type OrderPromotion, OrderSource, OrderStatus, type PageData, PageType, type Payment, type PaymentCardBrand, PaymentCardBrandKey, type PaymentConversion, PaymentMethodType, type PaymentProviderAdapter, type PaymentProviderCaptureInput, type PaymentProviderCaptureOutput, type PaymentProviderContext, type PaymentProviderInitInput, type PaymentProviderInitOutput, type PaymentProviderKey, type PaymentProviderRefundInput, type PaymentProviderRefundOutput, type PaymentProviderWebhookResult, PaymentStatus, type Permission, type Phone, type PickupLocation, type PickupReadyHoursParams, type ProcessingDaysParams, type Product, type ProductAnalyticsData, type ProductAnalyticsItem, type ProductAttribute, type ProductAttributeOption, ProductAttributeStatus, ProductAttributeType, type ProductCategory, ProductCategoryStatus, ProductStatus, ProductType, type ProductVariant, ProductVariantStatus, type Promotion, type PromotionApplicationMethod, type PromotionApplicationMethodInput, type PromotionApplicationMethodPromotionRule, PromotionApplicationType, type PromotionListFilters, type PromotionPromotionRule, type PromotionRule, type PromotionRuleInput, PromotionRuleOperator, type PromotionRuleValue, PromotionStatus, PromotionTargetType, PromotionType, PubSubTopics, type RealtimeAnalytics, type RecentEvent, type Role, type RolePermissionLink, type RoundingConfig, RoundingMethod, RoundingRule, SUPPORTED_COUNTRIES, type SameDayCutoffParams, type Seller, type SellerPeriodBalance, type ServiceBillingPlan, type ServiceBillingPlanLimits, type ServiceBillingPlanPrice, type ServiceBillingPlanSpec, type ServiceBillingPlanSpecCategory, type ServiceBillingPlanSpecItem, type SessionHeartbeatDto, type StandardCategory, StandardCategoryStatus, type StatusChangeHistory, type StatusFlow, type StoreBanner, StoreBannerStatus, type StoreComponentTemplate, type StoreCustomization, type StoreCustomizationComponentSettings, type StoreCustomizationFooterZone, type StoreCustomizationHeaderZone, type StoreCustomizationLayout, type StoreCustomizationLayoutComponent, type StoreCustomizationLayoutLegacy, type StoreCustomizationPage, type StoreCustomizationPageComponent, type StoreCustomizationSeo, type StoreCustomizationThemeButtons, type StoreCustomizationThemeColors, type StoreCustomizationThemeTypography, type StorePage, StorePageStatus, StorePageType, type StoreSettings, type StoreTemplate, type StoreTemplateMocks, type SupportConversation, SupportConversationChannel, type SupportConversationMessage, SupportConversationMessageAiAnalysisStatus, SupportConversationMessageDeliveryStatus, SupportConversationMessageDirection, SupportConversationMessageSenderType, SupportConversationPriority, SupportConversationStatus, SupportConversationVisibility, type SupportedCountryCode, type SurfaceColors, type ThemeBorderRadius, type ThemeBorderWidth, type ThemeBorders, type ThemeButtonSize, type ThemeButtonSizes, type ThemeButtonVariant, type ThemeButtonVariants, type ThemeButtons, type ThemeColorPalette, type ThemeConfig, type ThemeFonts, type ThemeProductCard, type ThemeShadows, type ThemeSpacing, type ThemeTypography, type ThemeTypographySizes, type ThemeTypographyStyles, type TopPagesData, type TrackEventDto, type TrackPageviewDto, TrafficSource, type TrafficSourceItem, type TrafficSourcesData, type TypographyStyle, type UnifiedDeliveryConfig, type UpdateAccountDeliveryOptionDTO, type UpdateAccountExchangeRateAllDto, type UpdateAccountExchangeRateDto, type UpdateCollectionDTO, type UpdateDeliveryOptionRuleDTO, type UpdateExchangeRateDto, type UpdateFulfillmentDto, type UpdateNotificationSettingsDTO, type UpdatePromotionDTO, type UpdateRoleDTO, type UpdateStoreComponentTemplateDTO, type UpdateStoreTemplateDTO, type Webhook, type WebhookPayload, getAccountPaymentMethodStatusInfo, getCountryDefaults, getCurrencySymbol, getDisplayOrderStatus, getDisplayOrderStatusInfo, getFulfillmentStatusInfo, getIntegrationCategoryName, getOrderPaymentStatusInfo, getOrderStatusInfo, getPaymentCardBrand, getPaymentStatusInfo, getProductStatusInfo, isLegacyLayout, isSupportedCountry, isZonedLayout, parsePriceFormatPattern };
3665
+ export { type Account, type AccountAiCreditTransaction, type AccountAiCredits, type AccountBranch, type AccountBranchSchedule, AccountBranchScheduleDay, AccountBranchScheduleStatus, AccountBranchStatus, type AccountCurrencyConfig, type AccountDeliveryOption, type AccountDeliveryOptionCalculatedCost, AccountDeliveryOptionPriceLogic, type AccountDeliveryOptionRule, AccountDeliveryOptionStatus, type AccountDeliveryOptionZone, AccountDeliveryOptionZoneStatus, type AccountDomain, AccountDomainStatus, type AccountEmailDomain, AccountEmailDomainStatus, type AccountExchangeRate, type AccountExchangeRateListResponse, type AccountExchangeRateMetadata, type AccountExchangeRateQueryDto, type AccountExchangeRateResponse, AccountExchangeRateType, type AccountExchangeRateWithEffectiveRate, type AccountHolidaySchedule, type AccountIntegration, type AccountIntegrationConfigDTO, AccountIntegrationConnectionStatus, AccountIntegrationEnvironment, AccountIntegrationStatus, type AccountMailbox, type AccountPaymentMethod, AccountPaymentMethodStatus, type AccountServiceBillingCharge, type AccountServicePlan, AccountServicePlanStatus, AccountStatus, type AccountUserRoleLink, type ActiveSession, type Address, type AdminOrderStatusChangeDto, AiCreditSource, AiCreditTransactionReason, AiCreditType, type AiCreditsBalance, type AnalyticsEvent, AnalyticsEventType, type AnalyticsFunnelStep, type AnalyticsOverview, type AnalyticsPageview, type AnalyticsPagination, type AnalyticsQueryParams, type AnalyticsSession, type BaseEntity, type BaseEntityWithAccount, type BaseEntityWithAccountAndUser, type BaseEntityWithUser, BillingInterval, type BufferSafetyMarginParams, type BusinessDaysParams, type ButtonStyle, COUNTRY_DEFAULTS, type Campaign, type CampaignBudget, CampaignBudgetType, type CampaignBudgetUsage, type CampaignData, type CampaignPerformance, CampaignStatus, type Cart, type CartConfirmDto, type CartDeliveryMethod, type CartDeliveryMethodAdjustment, type CartDeliveryMethodCreateData, type CartDeliveryMethodCreateDto, type CartDeliveryMethodFindParams, type CartDeliveryMethodResponse, type CartDeliveryMethodUpdateData, type CartDeliveryMethodUpdateDto, CartDeliveryType, type CartItem, type CartItemAddDto, type CartItemAttributeDetail, CartItemErrorCode, type CartItemRemoveDto, type CartItemUpdateDto, type CartItemValidation, type CartLineItemAdjustment, type CartPromotion, CartSource, CartStatus, type CartUpdateDto, type ChargeSellerAllocation, ChargeStatus, ChargeType, type Collection, type CollectionMedia, type CollectionProductLink, type CollectionRule, CollectionRuleField, CollectionRuleFieldLabels, CollectionRuleOperator, CollectionRuleOperatorLabels, CollectionRulesLogic, CollectionStatus, CollectionStatusLabels, CollectionType, CollectionTypeLabels, type ColorVariant, type CountryDefaultBranchAddress, type CountryDefaultConfig, type CountryDefaultTax, type CreateAccountDeliveryOptionDTO, type CreateAccountExchangeRateDto, type CreateAnalyticsSessionDto, type CreateCollectionDTO, type CreateDeliveryOptionDto, type CreateDeliveryOptionRuleDTO, type CreateExchangeRateDto, type CreateFulfillmentDto, type CreateFulfillmentItemDto, type CreateLeadDTO, type CreatePromotionDTO, type CreateRoleDTO, type CreateStoreComponentTemplateDTO, type CreateStoreTemplateDTO, Currency, type CurrencyConversion, type Customer, type CustomerNotificationConfig, CustomerStatus, type CustomerUpsertDto, DayOfWeek, type DeliveryDaysParams, type DeliveryHoursParams, DeliveryOptionRuleType, DeliveryType, type DeliveryZoneInput, type DesignTokens, DeviceType, DisplayOrderStatus, type EffectiveExchangeRate, type ExchangeRate, type ExchangeRateListResponse, type ExchangeRateMetadata, type ExchangeRateQueryDto, type ExchangeRateResponse, type FixedOffsetDaysParams, type Fulfillment, type FulfillmentDeliveryOption, type FulfillmentItem, type FulfillmentLabel, type FulfillmentLabelCreateData, type FulfillmentLabelUpdateData, type FulfillmentProviderAdapter, type FulfillmentProviderContext, type FulfillmentProviderCreateInput, type FulfillmentProviderCreateOutput, type FulfillmentProviderKey, type FulfillmentProviderProcessWebhookInput, type FulfillmentProviderProcessWebhookOutput, type FulfillmentRecollectionCapabilities, type FulfillmentRecollectionConfig, type FulfillmentRecollectionMode, type FulfillmentRecollectionSchedule, FulfillmentStatus, type FulfillmentTrackingEvent, type FunnelData, FunnelStep, type FunnelStepData, type GeoZone, type GeoZoneInput, GeoZoneStatus, type GestionLoginAttempt, type GestionSession, type GestionUser, GestionUserRole, GestionUserStatus, type HistoricalDataPoint, type Holiday, HolidayType, type Integration, IntegrationCategory, type IntegrationDeliveryZone, IntegrationDeliveryZoneStatus, IntegrationStatus, type InternalNotificationConfig, InternalNotificationType, type Lead, type LinkButtonStyle, type MapPosition, type Media, MediaType, NavigationItemType, type NavigationMenuConfig, type NavigationMenuItem, type NeutralColorScale, type NextStatusAction, type Order, type OrderCreateFromCartDto, type OrderDeliveryMethod, type OrderDeliveryMethodAdjustment, type OrderDeliveryMethodCreateData, type OrderDeliveryMethodUpdateData, OrderDeliveryType, type OrderItem, type OrderItemSnapshot, type OrderLineItemAdjustment, OrderPaymentStatus, type OrderPromotion, OrderSource, OrderStatus, type PageData, PageType, type Payment, type PaymentCardBrand, PaymentCardBrandKey, type PaymentConversion, PaymentFrequency, PaymentMethodType, type PaymentProviderAdapter, type PaymentProviderCaptureInput, type PaymentProviderCaptureOutput, type PaymentProviderContext, type PaymentProviderInitInput, type PaymentProviderInitOutput, type PaymentProviderKey, type PaymentProviderRefundInput, type PaymentProviderRefundOutput, type PaymentProviderWebhookResult, PaymentStatus, type Permission, type Phone, type PickupLocation, type PickupReadyHoursParams, type ProcessingDaysParams, type Product, type ProductAnalyticsData, type ProductAnalyticsItem, type ProductAttribute, type ProductAttributeOption, ProductAttributeStatus, ProductAttributeType, type ProductCategory, ProductCategoryStatus, ProductStatus, ProductType, type ProductVariant, ProductVariantStatus, type Promotion, type PromotionApplicationMethod, type PromotionApplicationMethodInput, type PromotionApplicationMethodPromotionRule, PromotionApplicationType, type PromotionListFilters, type PromotionPromotionRule, type PromotionRule, type PromotionRuleInput, PromotionRuleOperator, type PromotionRuleValue, PromotionStatus, PromotionTargetType, PromotionType, PubSubTopics, type RealtimeAnalytics, type RecentEvent, type Role, type RolePermissionLink, type RoundingConfig, RoundingMethod, RoundingRule, SERVICE_BILLING_FREE_DAYS_VALUES, SUPPORTED_COUNTRIES, type SameDayCutoffParams, type Seller, type SellerPeriodBalance, type ServiceBillingFreeDays, type ServiceBillingPlan, type ServiceBillingPlanLimits, type ServiceBillingPlanPrice, type ServiceBillingPlanSpec, type ServiceBillingPlanSpecCategory, type ServiceBillingPlanSpecItem, type SessionHeartbeatDto, type StandardCategory, StandardCategoryStatus, type StatusChangeHistory, type StatusFlow, type StoreBanner, StoreBannerStatus, type StoreComponentTemplate, type StoreCustomization, type StoreCustomizationComponentSettings, type StoreCustomizationFooterZone, type StoreCustomizationHeaderZone, type StoreCustomizationLayout, type StoreCustomizationLayoutComponent, type StoreCustomizationLayoutLegacy, type StoreCustomizationPage, type StoreCustomizationPageComponent, type StoreCustomizationSeo, type StoreCustomizationThemeButtons, type StoreCustomizationThemeColors, type StoreCustomizationThemeTypography, type StorePage, StorePageStatus, StorePageType, type StoreSettings, type StoreTemplate, type StoreTemplateMocks, type SupportConversation, SupportConversationChannel, type SupportConversationMessage, SupportConversationMessageAiAnalysisStatus, SupportConversationMessageDeliveryStatus, SupportConversationMessageDirection, SupportConversationMessageSenderType, SupportConversationPriority, SupportConversationStatus, SupportConversationVisibility, type SupportedCountryCode, type SurfaceColors, type ThemeBorderRadius, type ThemeBorderWidth, type ThemeBorders, type ThemeButtonSize, type ThemeButtonSizes, type ThemeButtonVariant, type ThemeButtonVariants, type ThemeButtons, type ThemeColorPalette, type ThemeConfig, type ThemeFonts, type ThemeProductCard, type ThemeShadows, type ThemeSpacing, type ThemeTypography, type ThemeTypographySizes, type ThemeTypographyStyles, type TopPagesData, type TrackEventDto, type TrackPageviewDto, TrafficSource, type TrafficSourceItem, type TrafficSourcesData, type TypographyStyle, type UnifiedDeliveryConfig, type UpdateAccountDeliveryOptionDTO, type UpdateAccountExchangeRateAllDto, type UpdateAccountExchangeRateDto, type UpdateCollectionDTO, type UpdateDeliveryOptionRuleDTO, type UpdateExchangeRateDto, type UpdateFulfillmentDto, type UpdateNotificationSettingsDTO, type UpdatePromotionDTO, type UpdateRoleDTO, type UpdateStoreComponentTemplateDTO, type UpdateStoreTemplateDTO, type Webhook, type WebhookPayload, aiCreditsPerSubscriptionInstallment, contractTermMonths, getAccountPaymentMethodStatusInfo, getCountryDefaults, getCurrencySymbol, getDisplayOrderStatus, getDisplayOrderStatusInfo, getFulfillmentStatusInfo, getIntegrationCategoryName, getOrderPaymentStatusInfo, getOrderStatusInfo, getPaymentCardBrand, getPaymentStatusInfo, getProductStatusInfo, isLegacyLayout, isSupportedCountry, isZonedLayout, normalizeServiceBillingFreeDays, parsePriceFormatPattern, paymentFrequencyMonths, resolveEffectivePaymentFrequency, subscriptionAmountPerInstallment, subscriptionInstallmentCount };
package/dist/index.js CHANGED
@@ -84,6 +84,7 @@ __export(index_exports, {
84
84
  OrderStatus: () => OrderStatus,
85
85
  PageType: () => PageType,
86
86
  PaymentCardBrandKey: () => PaymentCardBrandKey,
87
+ PaymentFrequency: () => PaymentFrequency,
87
88
  PaymentMethodType: () => PaymentMethodType,
88
89
  PaymentStatus: () => PaymentStatus,
89
90
  ProductAttributeStatus: () => ProductAttributeStatus,
@@ -100,6 +101,7 @@ __export(index_exports, {
100
101
  PubSubTopics: () => PubSubTopics,
101
102
  RoundingMethod: () => RoundingMethod,
102
103
  RoundingRule: () => RoundingRule,
104
+ SERVICE_BILLING_FREE_DAYS_VALUES: () => SERVICE_BILLING_FREE_DAYS_VALUES,
103
105
  SUPPORTED_COUNTRIES: () => SUPPORTED_COUNTRIES,
104
106
  StandardCategoryStatus: () => StandardCategoryStatus,
105
107
  StoreBannerStatus: () => StoreBannerStatus,
@@ -114,6 +116,8 @@ __export(index_exports, {
114
116
  SupportConversationStatus: () => SupportConversationStatus,
115
117
  SupportConversationVisibility: () => SupportConversationVisibility,
116
118
  TrafficSource: () => TrafficSource,
119
+ aiCreditsPerSubscriptionInstallment: () => aiCreditsPerSubscriptionInstallment,
120
+ contractTermMonths: () => contractTermMonths,
117
121
  getAccountPaymentMethodStatusInfo: () => getAccountPaymentMethodStatusInfo,
118
122
  getCountryDefaults: () => getCountryDefaults,
119
123
  getCurrencySymbol: () => getCurrencySymbol,
@@ -129,7 +133,12 @@ __export(index_exports, {
129
133
  isLegacyLayout: () => isLegacyLayout,
130
134
  isSupportedCountry: () => isSupportedCountry,
131
135
  isZonedLayout: () => isZonedLayout,
132
- parsePriceFormatPattern: () => parsePriceFormatPattern
136
+ normalizeServiceBillingFreeDays: () => normalizeServiceBillingFreeDays,
137
+ parsePriceFormatPattern: () => parsePriceFormatPattern,
138
+ paymentFrequencyMonths: () => paymentFrequencyMonths,
139
+ resolveEffectivePaymentFrequency: () => resolveEffectivePaymentFrequency,
140
+ subscriptionAmountPerInstallment: () => subscriptionAmountPerInstallment,
141
+ subscriptionInstallmentCount: () => subscriptionInstallmentCount
133
142
  });
134
143
  module.exports = __toCommonJS(index_exports);
135
144
 
@@ -1198,6 +1207,13 @@ var BillingInterval = /* @__PURE__ */ ((BillingInterval2) => {
1198
1207
  BillingInterval2["ANNUAL"] = "ANNUAL";
1199
1208
  return BillingInterval2;
1200
1209
  })(BillingInterval || {});
1210
+ var PaymentFrequency = /* @__PURE__ */ ((PaymentFrequency2) => {
1211
+ PaymentFrequency2["MONTHLY"] = "MONTHLY";
1212
+ PaymentFrequency2["QUARTERLY"] = "QUARTERLY";
1213
+ PaymentFrequency2["SEMIANNUAL"] = "SEMIANNUAL";
1214
+ PaymentFrequency2["ANNUAL"] = "ANNUAL";
1215
+ return PaymentFrequency2;
1216
+ })(PaymentFrequency || {});
1201
1217
  var AccountServicePlanStatus = /* @__PURE__ */ ((AccountServicePlanStatus2) => {
1202
1218
  AccountServicePlanStatus2["ACTIVE"] = "ACTIVE";
1203
1219
  AccountServicePlanStatus2["ENDED"] = "ENDED";
@@ -1218,6 +1234,61 @@ var ChargeStatus = /* @__PURE__ */ ((ChargeStatus2) => {
1218
1234
  return ChargeStatus2;
1219
1235
  })(ChargeStatus || {});
1220
1236
 
1237
+ // src/serviceBilling/billingSchedule.ts
1238
+ var SERVICE_BILLING_FREE_DAYS_VALUES = [0, 7, 15, 30, 60];
1239
+ function normalizeServiceBillingFreeDays(value) {
1240
+ const n = value == null || value === "" ? 0 : Number(value);
1241
+ if (!Number.isFinite(n)) return 0;
1242
+ return SERVICE_BILLING_FREE_DAYS_VALUES.includes(n) ? n : 0;
1243
+ }
1244
+ function contractTermMonths(contract) {
1245
+ switch (contract) {
1246
+ case "MONTHLY" /* MONTHLY */:
1247
+ return 1;
1248
+ case "SEMIANNUAL" /* SEMIANNUAL */:
1249
+ return 6;
1250
+ case "ANNUAL" /* ANNUAL */:
1251
+ return 12;
1252
+ default:
1253
+ return 1;
1254
+ }
1255
+ }
1256
+ function paymentFrequencyMonths(freq) {
1257
+ switch (freq) {
1258
+ case "MONTHLY" /* MONTHLY */:
1259
+ return 1;
1260
+ case "QUARTERLY" /* QUARTERLY */:
1261
+ return 3;
1262
+ case "SEMIANNUAL" /* SEMIANNUAL */:
1263
+ return 6;
1264
+ case "ANNUAL" /* ANNUAL */:
1265
+ return 12;
1266
+ default:
1267
+ return 1;
1268
+ }
1269
+ }
1270
+ function subscriptionInstallmentCount(contract, payment) {
1271
+ const cm = contractTermMonths(contract);
1272
+ const pm = paymentFrequencyMonths(payment);
1273
+ if (pm > cm) return null;
1274
+ if (cm % pm !== 0) return null;
1275
+ return cm / pm;
1276
+ }
1277
+ function resolveEffectivePaymentFrequency(contract, paymentFrequency) {
1278
+ if (paymentFrequency != null) return paymentFrequency;
1279
+ return contract;
1280
+ }
1281
+ function subscriptionAmountPerInstallment(contractTotalAmount, contract, payment) {
1282
+ const n = subscriptionInstallmentCount(contract, payment);
1283
+ if (n == null || n <= 0) return null;
1284
+ return Math.round(contractTotalAmount / n * 100) / 100;
1285
+ }
1286
+ function aiCreditsPerSubscriptionInstallment(creditsIncludedPerContract, contract, payment) {
1287
+ const n = subscriptionInstallmentCount(contract, payment);
1288
+ if (n == null || n <= 0) return creditsIncludedPerContract;
1289
+ return Math.round(creditsIncludedPerContract / n);
1290
+ }
1291
+
1221
1292
  // src/holiday/types.ts
1222
1293
  var HolidayType = /* @__PURE__ */ ((HolidayType2) => {
1223
1294
  HolidayType2["NON_WORKING"] = "NON_WORKING";
@@ -1303,6 +1374,7 @@ var GestionUserStatus = /* @__PURE__ */ ((GestionUserStatus2) => {
1303
1374
  OrderStatus,
1304
1375
  PageType,
1305
1376
  PaymentCardBrandKey,
1377
+ PaymentFrequency,
1306
1378
  PaymentMethodType,
1307
1379
  PaymentStatus,
1308
1380
  ProductAttributeStatus,
@@ -1319,6 +1391,7 @@ var GestionUserStatus = /* @__PURE__ */ ((GestionUserStatus2) => {
1319
1391
  PubSubTopics,
1320
1392
  RoundingMethod,
1321
1393
  RoundingRule,
1394
+ SERVICE_BILLING_FREE_DAYS_VALUES,
1322
1395
  SUPPORTED_COUNTRIES,
1323
1396
  StandardCategoryStatus,
1324
1397
  StoreBannerStatus,
@@ -1333,6 +1406,8 @@ var GestionUserStatus = /* @__PURE__ */ ((GestionUserStatus2) => {
1333
1406
  SupportConversationStatus,
1334
1407
  SupportConversationVisibility,
1335
1408
  TrafficSource,
1409
+ aiCreditsPerSubscriptionInstallment,
1410
+ contractTermMonths,
1336
1411
  getAccountPaymentMethodStatusInfo,
1337
1412
  getCountryDefaults,
1338
1413
  getCurrencySymbol,
@@ -1348,6 +1423,11 @@ var GestionUserStatus = /* @__PURE__ */ ((GestionUserStatus2) => {
1348
1423
  isLegacyLayout,
1349
1424
  isSupportedCountry,
1350
1425
  isZonedLayout,
1351
- parsePriceFormatPattern
1426
+ normalizeServiceBillingFreeDays,
1427
+ parsePriceFormatPattern,
1428
+ paymentFrequencyMonths,
1429
+ resolveEffectivePaymentFrequency,
1430
+ subscriptionAmountPerInstallment,
1431
+ subscriptionInstallmentCount
1352
1432
  });
1353
1433
  //# sourceMappingURL=index.js.map