@verma-consulting/common-library 0.1.43 → 0.1.45

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
@@ -13,6 +13,7 @@ declare const formatPhoneNumber: (value: string) => string;
13
13
  declare const openInNewTab: (url: string) => void;
14
14
  declare function stripHtmlTags(html: string): string;
15
15
  declare const toCurrencyValue: (value: number | string) => number;
16
+ declare const formatRelativeTime: (input?: string | Date | number) => string;
16
17
 
17
18
  interface GenericPayload {
18
19
  label?: string;
@@ -2032,6 +2033,9 @@ declare enum FrequencyType {
2032
2033
  Annually = "Annually"
2033
2034
  }
2034
2035
  declare enum action {
2036
+ lookup = "lookup"
2037
+ }
2038
+ declare enum trigger {
2035
2039
  create = "create",
2036
2040
  update = "update",
2037
2041
  delete = "delete",
@@ -3782,4 +3786,4 @@ declare const defaultTypes: {
3782
3786
  };
3783
3787
  };
3784
3788
 
3785
- export { type ActivityInterface, type AddressInterface, type AmountDetailsInterface, type AnalyticsQueryInterface, AppMode, type AutomaticPaymentMethodsInterface, type AutomaticTaxInterface, type BatchShipmentInterface, type BillingDetailsInterface, CalculationType, type CampaignInterface, CampaignType, type CancellationDetailsInterface, type CardInterface, type CarrierAccountInterface, type CarrierAccountResponseInterface, type CarrierMappingInterface, CategoryType, ChartType, type ChatInterface, type ClientInterface, type CommentInterface, type ContactInterface, type ContentInterface, ContentType, type CurrentRateInterface, type CustomsItemInterface, type DealInterface, DealType, DeviceNotification, type DisputeInterface, type EmailInterface, type EngagementInterface, type EvidenceDetailsInterface, type EvidenceInterface, FeatureType, type FileInterface, type FilterInterface, FilterType, FormFieldOrder, FormFieldType, FrequencyType, Gender, type GenericPayload, type IntegrationInterface, type InventoryInterface, type InvoiceInterface, type LabelOptionsInterface, LandingPath, LandingView, type LeadInterface, LeadType, type ListInterface, type MarketingFeatureInterface, type ModelInterface, ModelType, type Notation, type NotificationInterface, type OperationInterface, type OrderAddressInterface, type OrderInterface, OrganizationFeatures, type OrganizationInterface, type OrganizationModelInterface, type PackageDimensionsInterface, type ParcelInputInterface, type PauseCollectionInterface, type PaymentInterface, type PaymentMethodInterface, type PermissionInterface, PermissionType, PlatformLanguage, type PoolInterface, type PriceInterface, type PriceRecurringInterface, Priority, type ProductInterface, type PromptInterface, type QueryFilterInterface, type RatesOptionsInterface, type RefundInterface, type RefundResponseInterface, type RegisterInterface, type ReportInterface, type SchemaInterface, type SentEmailInterface, type ServiceLevelsResponseInterface, type ShippingInterface, type ShippingRateInterface, type ShippingTransactionInterface, type ShippoAddressInterface, type ShippoBatchResponseInterface, type ShippoCustomsDeclarationInputInterface, type ShippoCustomsResponseInterface, type ShippoParcelInterface, type ShippoParcelResponseInterface, type ShippoRatesResponseInterface, type ShippoTrackingResponseInterface, type ShippoTransactionResponseInterface, SourceType, type StatisticInterface, type StripeAccountInterface, type StripeCustomer, type StripePaymentIntent, type SubscriptionInterface, type TagInterface, type TaskInterface, type TokenInterface, type TrackingHistoryInterface, type TrackingInfoInterface, type UsageInterface, UsageType, type UserInterface, UserSettingType, type WaitlistInterface, accountType, action, addressType, automaticTaxStatus, billingReason, billingScheme, camelCaseToWords, capitalizeSentence, captureMethod, chatType, clientType, collectionMethod, commentRole, constants, currency, customerType, defaultTypes, defaults, disputeReason, disputeStatus, financialStatus, formatPhoneNumber, fulfillmentStatus, getRandomArbitrary, girth, grabAge, integrationCategory, integrationType, isNumber, largeNumberLabel, missingPaymentMethod, normalizeKey, openInNewTab, operationType, organizationFilterType, packageType, paymentAllowRedirect, paymentCancellationReason, paymentFutureUsage, paymentMethodAllowReDisplay, paymentMethodType, paymentStatus, prettifyString, priceType, productType, refundFailureReason, refundPendingReason, refundReason, refundStatus, shippingProvider, shippingServiceLevel, snakeToPretty, status, stripHtmlTags, subscriptionCancellationReason, taxBehavior, taxExempt, tiersMode, toCurrencyValue, unit, userRole, userSource, userStatus, validEmail, weightUnit };
3789
+ export { type ActivityInterface, type AddressInterface, type AmountDetailsInterface, type AnalyticsQueryInterface, AppMode, type AutomaticPaymentMethodsInterface, type AutomaticTaxInterface, type BatchShipmentInterface, type BillingDetailsInterface, CalculationType, type CampaignInterface, CampaignType, type CancellationDetailsInterface, type CardInterface, type CarrierAccountInterface, type CarrierAccountResponseInterface, type CarrierMappingInterface, CategoryType, ChartType, type ChatInterface, type ClientInterface, type CommentInterface, type ContactInterface, type ContentInterface, ContentType, type CurrentRateInterface, type CustomsItemInterface, type DealInterface, DealType, DeviceNotification, type DisputeInterface, type EmailInterface, type EngagementInterface, type EvidenceDetailsInterface, type EvidenceInterface, FeatureType, type FileInterface, type FilterInterface, FilterType, FormFieldOrder, FormFieldType, FrequencyType, Gender, type GenericPayload, type IntegrationInterface, type InventoryInterface, type InvoiceInterface, type LabelOptionsInterface, LandingPath, LandingView, type LeadInterface, LeadType, type ListInterface, type MarketingFeatureInterface, type ModelInterface, ModelType, type Notation, type NotificationInterface, type OperationInterface, type OrderAddressInterface, type OrderInterface, OrganizationFeatures, type OrganizationInterface, type OrganizationModelInterface, type PackageDimensionsInterface, type ParcelInputInterface, type PauseCollectionInterface, type PaymentInterface, type PaymentMethodInterface, type PermissionInterface, PermissionType, PlatformLanguage, type PoolInterface, type PriceInterface, type PriceRecurringInterface, Priority, type ProductInterface, type PromptInterface, type QueryFilterInterface, type RatesOptionsInterface, type RefundInterface, type RefundResponseInterface, type RegisterInterface, type ReportInterface, type SchemaInterface, type SentEmailInterface, type ServiceLevelsResponseInterface, type ShippingInterface, type ShippingRateInterface, type ShippingTransactionInterface, type ShippoAddressInterface, type ShippoBatchResponseInterface, type ShippoCustomsDeclarationInputInterface, type ShippoCustomsResponseInterface, type ShippoParcelInterface, type ShippoParcelResponseInterface, type ShippoRatesResponseInterface, type ShippoTrackingResponseInterface, type ShippoTransactionResponseInterface, SourceType, type StatisticInterface, type StripeAccountInterface, type StripeCustomer, type StripePaymentIntent, type SubscriptionInterface, type TagInterface, type TaskInterface, type TokenInterface, type TrackingHistoryInterface, type TrackingInfoInterface, type UsageInterface, UsageType, type UserInterface, UserSettingType, type WaitlistInterface, accountType, action, addressType, automaticTaxStatus, billingReason, billingScheme, camelCaseToWords, capitalizeSentence, captureMethod, chatType, clientType, collectionMethod, commentRole, constants, currency, customerType, defaultTypes, defaults, disputeReason, disputeStatus, financialStatus, formatPhoneNumber, formatRelativeTime, fulfillmentStatus, getRandomArbitrary, girth, grabAge, integrationCategory, integrationType, isNumber, largeNumberLabel, missingPaymentMethod, normalizeKey, openInNewTab, operationType, organizationFilterType, packageType, paymentAllowRedirect, paymentCancellationReason, paymentFutureUsage, paymentMethodAllowReDisplay, paymentMethodType, paymentStatus, prettifyString, priceType, productType, refundFailureReason, refundPendingReason, refundReason, refundStatus, shippingProvider, shippingServiceLevel, snakeToPretty, status, stripHtmlTags, subscriptionCancellationReason, taxBehavior, taxExempt, tiersMode, toCurrencyValue, trigger, unit, userRole, userSource, userStatus, validEmail, weightUnit };
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@ declare const formatPhoneNumber: (value: string) => string;
13
13
  declare const openInNewTab: (url: string) => void;
14
14
  declare function stripHtmlTags(html: string): string;
15
15
  declare const toCurrencyValue: (value: number | string) => number;
16
+ declare const formatRelativeTime: (input?: string | Date | number) => string;
16
17
 
17
18
  interface GenericPayload {
18
19
  label?: string;
@@ -2032,6 +2033,9 @@ declare enum FrequencyType {
2032
2033
  Annually = "Annually"
2033
2034
  }
2034
2035
  declare enum action {
2036
+ lookup = "lookup"
2037
+ }
2038
+ declare enum trigger {
2035
2039
  create = "create",
2036
2040
  update = "update",
2037
2041
  delete = "delete",
@@ -3782,4 +3786,4 @@ declare const defaultTypes: {
3782
3786
  };
3783
3787
  };
3784
3788
 
3785
- export { type ActivityInterface, type AddressInterface, type AmountDetailsInterface, type AnalyticsQueryInterface, AppMode, type AutomaticPaymentMethodsInterface, type AutomaticTaxInterface, type BatchShipmentInterface, type BillingDetailsInterface, CalculationType, type CampaignInterface, CampaignType, type CancellationDetailsInterface, type CardInterface, type CarrierAccountInterface, type CarrierAccountResponseInterface, type CarrierMappingInterface, CategoryType, ChartType, type ChatInterface, type ClientInterface, type CommentInterface, type ContactInterface, type ContentInterface, ContentType, type CurrentRateInterface, type CustomsItemInterface, type DealInterface, DealType, DeviceNotification, type DisputeInterface, type EmailInterface, type EngagementInterface, type EvidenceDetailsInterface, type EvidenceInterface, FeatureType, type FileInterface, type FilterInterface, FilterType, FormFieldOrder, FormFieldType, FrequencyType, Gender, type GenericPayload, type IntegrationInterface, type InventoryInterface, type InvoiceInterface, type LabelOptionsInterface, LandingPath, LandingView, type LeadInterface, LeadType, type ListInterface, type MarketingFeatureInterface, type ModelInterface, ModelType, type Notation, type NotificationInterface, type OperationInterface, type OrderAddressInterface, type OrderInterface, OrganizationFeatures, type OrganizationInterface, type OrganizationModelInterface, type PackageDimensionsInterface, type ParcelInputInterface, type PauseCollectionInterface, type PaymentInterface, type PaymentMethodInterface, type PermissionInterface, PermissionType, PlatformLanguage, type PoolInterface, type PriceInterface, type PriceRecurringInterface, Priority, type ProductInterface, type PromptInterface, type QueryFilterInterface, type RatesOptionsInterface, type RefundInterface, type RefundResponseInterface, type RegisterInterface, type ReportInterface, type SchemaInterface, type SentEmailInterface, type ServiceLevelsResponseInterface, type ShippingInterface, type ShippingRateInterface, type ShippingTransactionInterface, type ShippoAddressInterface, type ShippoBatchResponseInterface, type ShippoCustomsDeclarationInputInterface, type ShippoCustomsResponseInterface, type ShippoParcelInterface, type ShippoParcelResponseInterface, type ShippoRatesResponseInterface, type ShippoTrackingResponseInterface, type ShippoTransactionResponseInterface, SourceType, type StatisticInterface, type StripeAccountInterface, type StripeCustomer, type StripePaymentIntent, type SubscriptionInterface, type TagInterface, type TaskInterface, type TokenInterface, type TrackingHistoryInterface, type TrackingInfoInterface, type UsageInterface, UsageType, type UserInterface, UserSettingType, type WaitlistInterface, accountType, action, addressType, automaticTaxStatus, billingReason, billingScheme, camelCaseToWords, capitalizeSentence, captureMethod, chatType, clientType, collectionMethod, commentRole, constants, currency, customerType, defaultTypes, defaults, disputeReason, disputeStatus, financialStatus, formatPhoneNumber, fulfillmentStatus, getRandomArbitrary, girth, grabAge, integrationCategory, integrationType, isNumber, largeNumberLabel, missingPaymentMethod, normalizeKey, openInNewTab, operationType, organizationFilterType, packageType, paymentAllowRedirect, paymentCancellationReason, paymentFutureUsage, paymentMethodAllowReDisplay, paymentMethodType, paymentStatus, prettifyString, priceType, productType, refundFailureReason, refundPendingReason, refundReason, refundStatus, shippingProvider, shippingServiceLevel, snakeToPretty, status, stripHtmlTags, subscriptionCancellationReason, taxBehavior, taxExempt, tiersMode, toCurrencyValue, unit, userRole, userSource, userStatus, validEmail, weightUnit };
3789
+ export { type ActivityInterface, type AddressInterface, type AmountDetailsInterface, type AnalyticsQueryInterface, AppMode, type AutomaticPaymentMethodsInterface, type AutomaticTaxInterface, type BatchShipmentInterface, type BillingDetailsInterface, CalculationType, type CampaignInterface, CampaignType, type CancellationDetailsInterface, type CardInterface, type CarrierAccountInterface, type CarrierAccountResponseInterface, type CarrierMappingInterface, CategoryType, ChartType, type ChatInterface, type ClientInterface, type CommentInterface, type ContactInterface, type ContentInterface, ContentType, type CurrentRateInterface, type CustomsItemInterface, type DealInterface, DealType, DeviceNotification, type DisputeInterface, type EmailInterface, type EngagementInterface, type EvidenceDetailsInterface, type EvidenceInterface, FeatureType, type FileInterface, type FilterInterface, FilterType, FormFieldOrder, FormFieldType, FrequencyType, Gender, type GenericPayload, type IntegrationInterface, type InventoryInterface, type InvoiceInterface, type LabelOptionsInterface, LandingPath, LandingView, type LeadInterface, LeadType, type ListInterface, type MarketingFeatureInterface, type ModelInterface, ModelType, type Notation, type NotificationInterface, type OperationInterface, type OrderAddressInterface, type OrderInterface, OrganizationFeatures, type OrganizationInterface, type OrganizationModelInterface, type PackageDimensionsInterface, type ParcelInputInterface, type PauseCollectionInterface, type PaymentInterface, type PaymentMethodInterface, type PermissionInterface, PermissionType, PlatformLanguage, type PoolInterface, type PriceInterface, type PriceRecurringInterface, Priority, type ProductInterface, type PromptInterface, type QueryFilterInterface, type RatesOptionsInterface, type RefundInterface, type RefundResponseInterface, type RegisterInterface, type ReportInterface, type SchemaInterface, type SentEmailInterface, type ServiceLevelsResponseInterface, type ShippingInterface, type ShippingRateInterface, type ShippingTransactionInterface, type ShippoAddressInterface, type ShippoBatchResponseInterface, type ShippoCustomsDeclarationInputInterface, type ShippoCustomsResponseInterface, type ShippoParcelInterface, type ShippoParcelResponseInterface, type ShippoRatesResponseInterface, type ShippoTrackingResponseInterface, type ShippoTransactionResponseInterface, SourceType, type StatisticInterface, type StripeAccountInterface, type StripeCustomer, type StripePaymentIntent, type SubscriptionInterface, type TagInterface, type TaskInterface, type TokenInterface, type TrackingHistoryInterface, type TrackingInfoInterface, type UsageInterface, UsageType, type UserInterface, UserSettingType, type WaitlistInterface, accountType, action, addressType, automaticTaxStatus, billingReason, billingScheme, camelCaseToWords, capitalizeSentence, captureMethod, chatType, clientType, collectionMethod, commentRole, constants, currency, customerType, defaultTypes, defaults, disputeReason, disputeStatus, financialStatus, formatPhoneNumber, formatRelativeTime, fulfillmentStatus, getRandomArbitrary, girth, grabAge, integrationCategory, integrationType, isNumber, largeNumberLabel, missingPaymentMethod, normalizeKey, openInNewTab, operationType, organizationFilterType, packageType, paymentAllowRedirect, paymentCancellationReason, paymentFutureUsage, paymentMethodAllowReDisplay, paymentMethodType, paymentStatus, prettifyString, priceType, productType, refundFailureReason, refundPendingReason, refundReason, refundStatus, shippingProvider, shippingServiceLevel, snakeToPretty, status, stripHtmlTags, subscriptionCancellationReason, taxBehavior, taxExempt, tiersMode, toCurrencyValue, trigger, unit, userRole, userSource, userStatus, validEmail, weightUnit };
package/dist/index.js CHANGED
@@ -67,6 +67,7 @@ __export(index_exports, {
67
67
  disputeStatus: () => disputeStatus,
68
68
  financialStatus: () => financialStatus,
69
69
  formatPhoneNumber: () => formatPhoneNumber,
70
+ formatRelativeTime: () => formatRelativeTime,
70
71
  fulfillmentStatus: () => fulfillmentStatus,
71
72
  getRandomArbitrary: () => getRandomArbitrary,
72
73
  girth: () => girth,
@@ -104,6 +105,7 @@ __export(index_exports, {
104
105
  taxExempt: () => taxExempt,
105
106
  tiersMode: () => tiersMode,
106
107
  toCurrencyValue: () => toCurrencyValue,
108
+ trigger: () => trigger,
107
109
  unit: () => unit,
108
110
  userRole: () => userRole,
109
111
  userSource: () => userSource,
@@ -196,6 +198,26 @@ var toCurrencyValue = (value) => {
196
198
  const num = parseFloat(String(value)) || 0;
197
199
  return parseFloat(num.toFixed(2));
198
200
  };
201
+ var formatRelativeTime = (input) => {
202
+ if (input == null) return "";
203
+ const date = typeof input === "number" ? new Date(input) : typeof input === "string" ? new Date(input) : input;
204
+ if (isNaN(date.getTime())) return "";
205
+ const now = /* @__PURE__ */ new Date();
206
+ const diffMs = now.getTime() - date.getTime();
207
+ if (diffMs < 0) return "Just now";
208
+ const diffMins = Math.floor(diffMs / 6e4);
209
+ const diffHours = Math.floor(diffMs / 36e5);
210
+ const diffDays = Math.floor(diffMs / 864e5);
211
+ if (diffMins < 1) return "Just now";
212
+ if (diffMins < 60) return `${diffMins}m ago`;
213
+ if (diffHours < 24) return `${diffHours}h ago`;
214
+ if (diffDays < 7) return `${diffDays}d ago`;
215
+ return date.toLocaleDateString("en-US", {
216
+ month: "short",
217
+ day: "numeric",
218
+ year: date.getFullYear() !== now.getFullYear() ? "numeric" : void 0
219
+ });
220
+ };
199
221
 
200
222
  // src/enums.ts
201
223
  var LandingPath = /* @__PURE__ */ ((LandingPath2) => {
@@ -764,12 +786,16 @@ var FrequencyType = /* @__PURE__ */ ((FrequencyType2) => {
764
786
  return FrequencyType2;
765
787
  })(FrequencyType || {});
766
788
  var action = /* @__PURE__ */ ((action2) => {
767
- action2["create"] = "create";
768
- action2["update"] = "update";
769
- action2["delete"] = "delete";
770
- action2["undo"] = "undo";
789
+ action2["lookup"] = "lookup";
771
790
  return action2;
772
791
  })(action || {});
792
+ var trigger = /* @__PURE__ */ ((trigger2) => {
793
+ trigger2["create"] = "create";
794
+ trigger2["update"] = "update";
795
+ trigger2["delete"] = "delete";
796
+ trigger2["undo"] = "undo";
797
+ return trigger2;
798
+ })(trigger || {});
773
799
  var ChartType = /* @__PURE__ */ ((ChartType2) => {
774
800
  ChartType2["line"] = "line";
775
801
  ChartType2["bar"] = "bar";
@@ -3191,6 +3217,7 @@ var defaultTypes_default = defaultTypes;
3191
3217
  disputeStatus,
3192
3218
  financialStatus,
3193
3219
  formatPhoneNumber,
3220
+ formatRelativeTime,
3194
3221
  fulfillmentStatus,
3195
3222
  getRandomArbitrary,
3196
3223
  girth,
@@ -3228,6 +3255,7 @@ var defaultTypes_default = defaultTypes;
3228
3255
  taxExempt,
3229
3256
  tiersMode,
3230
3257
  toCurrencyValue,
3258
+ trigger,
3231
3259
  unit,
3232
3260
  userRole,
3233
3261
  userSource,