@diffsome/sdk 3.2.7 → 3.2.9

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
@@ -7659,9 +7659,9 @@ interface operations {
7659
7659
  "product.index": {
7660
7660
  parameters: {
7661
7661
  query?: {
7662
+ type?: string;
7662
7663
  category_id?: string;
7663
7664
  category?: string;
7664
- type?: string;
7665
7665
  min_price?: string;
7666
7666
  max_price?: string;
7667
7667
  search?: string;
@@ -9220,7 +9220,7 @@ interface operations {
9220
9220
  message: "Success";
9221
9221
  data: {
9222
9222
  subscriptions: {
9223
- id: string;
9223
+ id: number;
9224
9224
  product: {
9225
9225
  id: number;
9226
9226
  name: string;
@@ -9313,7 +9313,7 @@ interface operations {
9313
9313
  message: 201;
9314
9314
  data: {
9315
9315
  subscription: {
9316
- id: string;
9316
+ id: number;
9317
9317
  product: {
9318
9318
  id: number;
9319
9319
  name: string;
@@ -9419,7 +9419,7 @@ interface operations {
9419
9419
  message: "Success";
9420
9420
  data: {
9421
9421
  subscription: {
9422
- id: string;
9422
+ id: number;
9423
9423
  product: {
9424
9424
  id: number;
9425
9425
  name: string;
@@ -9602,7 +9602,7 @@ interface operations {
9602
9602
  message: "Success";
9603
9603
  data: {
9604
9604
  subscription: {
9605
- id: string;
9605
+ id: number;
9606
9606
  product: {
9607
9607
  id: number;
9608
9608
  name: string;
@@ -9696,7 +9696,7 @@ interface operations {
9696
9696
  message: "Success";
9697
9697
  data: {
9698
9698
  subscription: {
9699
- id: string;
9699
+ id: number;
9700
9700
  product: {
9701
9701
  id: number;
9702
9702
  name: string;
@@ -9807,7 +9807,7 @@ interface operations {
9807
9807
  message: "Success";
9808
9808
  data: {
9809
9809
  subscription: {
9810
- id: string;
9810
+ id: number;
9811
9811
  product: {
9812
9812
  id: number;
9813
9813
  name: string;
@@ -9918,7 +9918,7 @@ interface operations {
9918
9918
  message: "Success";
9919
9919
  data: {
9920
9920
  subscription: {
9921
- id: string;
9921
+ id: number;
9922
9922
  product: {
9923
9923
  id: number;
9924
9924
  name: string;
@@ -10690,11 +10690,23 @@ type BoardPost = Schemas['BoardPostResource'];
10690
10690
  type BoardCollection = Schemas['BoardCollection'];
10691
10691
  type BoardPostCollection = Schemas['BoardPostCollection'];
10692
10692
  type Member = Schemas['MemberResource'];
10693
- type Product = Schemas['ProductResource'];
10693
+ type Product = Schemas['ProductResource'] & {
10694
+ /** Formatted sale price with currency symbol */
10695
+ formatted_sale_price?: string;
10696
+ /** Formatted regular price with currency symbol */
10697
+ formatted_regular_price?: string | null;
10698
+ };
10694
10699
  type ProductCategory = Schemas['ProductCategoryResource'];
10695
10700
  type ProductAttribute = Schemas['ProductAttributeResource'];
10696
10701
  type ProductAttributeValue = Schemas['ProductAttributeValueResource'];
10697
- type ProductVariant = Schemas['ProductVariantResource'];
10702
+ type ProductVariant = Schemas['ProductVariantResource'] & {
10703
+ /** Formatted sale price with currency symbol */
10704
+ formatted_sale_price?: string | null;
10705
+ /** Formatted regular price with currency symbol */
10706
+ formatted_regular_price?: string | null;
10707
+ /** Formatted final price with currency symbol */
10708
+ formatted_final_price?: string;
10709
+ };
10698
10710
  type ProductCollection = Schemas['ProductCollection'];
10699
10711
  type ProductCategoryCollection = Schemas['ProductCategoryCollection'];
10700
10712
  /** @deprecated Use ProductAttribute instead */
@@ -11072,7 +11084,14 @@ interface StripeVerifyResponse {
11072
11084
  approved_at?: string;
11073
11085
  };
11074
11086
  }
11087
+ interface CurrencyInfo {
11088
+ code: string;
11089
+ symbol: string;
11090
+ position: 'before' | 'after';
11091
+ decimals: number;
11092
+ }
11075
11093
  interface PaymentStatusResponse {
11094
+ currency: CurrencyInfo;
11076
11095
  toss: {
11077
11096
  available: boolean;
11078
11097
  };
@@ -11509,6 +11528,34 @@ interface BundlePricing {
11509
11528
  interface ProductListParamsExtended extends ProductListParams {
11510
11529
  type?: ProductType;
11511
11530
  }
11531
+ interface SiteInfo {
11532
+ id: string;
11533
+ name: string;
11534
+ tagline?: string;
11535
+ description?: string;
11536
+ logo?: string;
11537
+ favicon?: string;
11538
+ currency: CurrencyInfo;
11539
+ timezone: string;
11540
+ language: string;
11541
+ seo: {
11542
+ title?: string;
11543
+ description?: string;
11544
+ keywords?: string;
11545
+ og_image?: string;
11546
+ };
11547
+ social: {
11548
+ facebook?: string;
11549
+ instagram?: string;
11550
+ twitter?: string;
11551
+ youtube?: string;
11552
+ };
11553
+ contact: {
11554
+ email?: string;
11555
+ phone?: string;
11556
+ address?: string;
11557
+ };
11558
+ }
11512
11559
 
11513
11560
  /**
11514
11561
  * HTTP Client for Diffsome SDK
@@ -12510,6 +12557,201 @@ declare class ReservationResource {
12510
12557
  cancel(reservationNumber: string, reason?: string): Promise<Reservation>;
12511
12558
  }
12512
12559
 
12560
+ /**
12561
+ * Site Resource for Diffsome SDK
12562
+ */
12563
+
12564
+ declare class SiteResource {
12565
+ private http;
12566
+ constructor(http: HttpClient);
12567
+ /**
12568
+ * Get site information
12569
+ * Returns site settings including currency, SEO, contact info
12570
+ */
12571
+ getInfo(): Promise<SiteInfo>;
12572
+ /**
12573
+ * Get currency info only (lightweight)
12574
+ */
12575
+ getCurrency(): Promise<CurrencyInfo>;
12576
+ /**
12577
+ * Format price with site's currency settings
12578
+ * @param amount - The amount to format
12579
+ * @param currency - Optional currency info (uses fetched currency if not provided)
12580
+ */
12581
+ formatPrice(amount: number, currency: CurrencyInfo): string;
12582
+ }
12583
+
12584
+ /**
12585
+ * Chat Resource for Diffsome SDK
12586
+ * Real-time customer support chat with WebSocket support
12587
+ */
12588
+
12589
+ interface ChatConversation {
12590
+ id: number;
12591
+ visitor_id: string;
12592
+ visitor_name: string | null;
12593
+ visitor_email: string | null;
12594
+ status: 'open' | 'assigned' | 'closed';
12595
+ channel: 'web' | 'mobile' | 'api';
12596
+ created_at: string;
12597
+ last_message_at: string | null;
12598
+ }
12599
+ interface ChatMessage {
12600
+ id: number;
12601
+ conversation_id: number;
12602
+ content: string;
12603
+ type: 'text' | 'image' | 'file' | 'system';
12604
+ sender_type: 'visitor' | 'agent' | 'system';
12605
+ sender_name: string;
12606
+ is_read: boolean;
12607
+ created_at: string;
12608
+ attachments?: Array<{
12609
+ url: string;
12610
+ name: string;
12611
+ type: string;
12612
+ size: number;
12613
+ }>;
12614
+ }
12615
+ interface StartConversationData {
12616
+ visitor_name?: string;
12617
+ visitor_email?: string;
12618
+ initial_message?: string;
12619
+ channel?: 'web' | 'mobile' | 'api';
12620
+ metadata?: Record<string, unknown>;
12621
+ }
12622
+ interface SendMessageData {
12623
+ content: string;
12624
+ type?: 'text' | 'image' | 'file';
12625
+ attachments?: Array<{
12626
+ url: string;
12627
+ name: string;
12628
+ type: string;
12629
+ size: number;
12630
+ }>;
12631
+ }
12632
+ interface ChatAvailability {
12633
+ available: boolean;
12634
+ agents_online: number;
12635
+ }
12636
+ interface PollResponse {
12637
+ messages: ChatMessage[];
12638
+ conversation_status: 'open' | 'assigned' | 'closed';
12639
+ }
12640
+ interface ReverbConfig {
12641
+ host: string;
12642
+ port?: number;
12643
+ key: string;
12644
+ scheme?: 'ws' | 'wss';
12645
+ }
12646
+ type MessageCallback = (message: ChatMessage) => void;
12647
+ type StatusCallback = (status: 'open' | 'assigned' | 'closed') => void;
12648
+ type TypingCallback = (senderType: 'visitor' | 'agent') => void;
12649
+ declare class ChatResource {
12650
+ private http;
12651
+ private lastMessageIds;
12652
+ private visitorId;
12653
+ private reverbConfig;
12654
+ private websocket;
12655
+ private subscribedChannels;
12656
+ constructor(http: HttpClient);
12657
+ /**
12658
+ * Configure WebSocket connection (Laravel Reverb)
12659
+ */
12660
+ configureWebSocket(config: ReverbConfig): void;
12661
+ /**
12662
+ * Start a new chat conversation
12663
+ */
12664
+ start(data?: StartConversationData): Promise<{
12665
+ conversation_id: number;
12666
+ visitor_id: string;
12667
+ status: string;
12668
+ }>;
12669
+ /**
12670
+ * Get list of conversations
12671
+ */
12672
+ list(params?: {
12673
+ per_page?: number;
12674
+ page?: number;
12675
+ }): Promise<{
12676
+ data: ChatConversation[];
12677
+ meta: {
12678
+ current_page: number;
12679
+ last_page: number;
12680
+ total: number;
12681
+ };
12682
+ }>;
12683
+ /**
12684
+ * Get conversation details
12685
+ */
12686
+ get(conversationId: number): Promise<ChatConversation>;
12687
+ /**
12688
+ * Send a message
12689
+ */
12690
+ send(conversationId: number, data: SendMessageData): Promise<ChatMessage>;
12691
+ /**
12692
+ * Get messages for a conversation
12693
+ */
12694
+ getMessages(conversationId: number, params?: {
12695
+ after?: number;
12696
+ limit?: number;
12697
+ }): Promise<ChatMessage[]>;
12698
+ /**
12699
+ * Poll for new messages (fallback when WebSocket not available)
12700
+ */
12701
+ poll(conversationId: number, lastMessageId?: number): Promise<PollResponse>;
12702
+ /**
12703
+ * Close conversation
12704
+ */
12705
+ close(conversationId: number): Promise<void>;
12706
+ /**
12707
+ * Send typing indicator
12708
+ */
12709
+ sendTyping(conversationId: number): Promise<void>;
12710
+ /**
12711
+ * Check agent availability
12712
+ */
12713
+ checkAvailability(): Promise<ChatAvailability>;
12714
+ /**
12715
+ * Connect to a conversation with real-time updates
12716
+ * Uses WebSocket if configured, falls back to polling
12717
+ */
12718
+ connect(conversationId: number): {
12719
+ send: (content: string, type?: "text" | "image" | "file") => Promise<ChatMessage>;
12720
+ getMessages: (params?: {
12721
+ after?: number;
12722
+ limit?: number;
12723
+ }) => Promise<ChatMessage[]>;
12724
+ onMessage: (callback: MessageCallback) => () => void;
12725
+ onStatusChange: (callback: StatusCallback) => () => void;
12726
+ onTyping: (callback: TypingCallback) => () => void;
12727
+ sendTyping: () => Promise<void>;
12728
+ close: () => Promise<void>;
12729
+ disconnect: () => void;
12730
+ useWebSocket: () => Promise<void>;
12731
+ usePolling: () => void;
12732
+ };
12733
+ /**
12734
+ * Generate a random socket ID
12735
+ */
12736
+ private generateSocketId;
12737
+ /**
12738
+ * Get visitor ID header
12739
+ */
12740
+ private getVisitorHeader;
12741
+ /**
12742
+ * Set visitor ID manually (useful for server-side rendering)
12743
+ */
12744
+ setVisitorId(visitorId: string): void;
12745
+ /**
12746
+ * Get current visitor ID
12747
+ */
12748
+ getVisitorId(): string | null;
12749
+ /**
12750
+ * Disconnect WebSocket
12751
+ */
12752
+ disconnectWebSocket(): void;
12753
+ }
12754
+
12513
12755
  /**
12514
12756
  * Diffsome SDK
12515
12757
  *
@@ -12552,6 +12794,10 @@ declare class Diffsome {
12552
12794
  readonly entities: EntitiesResource;
12553
12795
  /** Reservations - booking services and time slots */
12554
12796
  readonly reservation: ReservationResource;
12797
+ /** Site settings - currency, SEO, contact info */
12798
+ readonly site: SiteResource;
12799
+ /** Live chat - customer support conversations */
12800
+ readonly chat: ChatResource;
12555
12801
  constructor(config: DiffsomeConfig);
12556
12802
  /**
12557
12803
  * Check if user is authenticated
@@ -12587,4 +12833,4 @@ declare class Diffsome {
12587
12833
  getApiKey(): string | null;
12588
12834
  }
12589
12835
 
12590
- export { type $defs, type AddToCartData, type AddToWishlistData, type ApiError, type ApplyCouponData, type AuthResponse, type AvailableDatesParams, type AvailableSlotsParams, type BlogCategory, type BlogListParams, type BlogPost, type BlogPostCollection, type Board, type BoardCollection, type BoardComment, type BoardListParams, type BoardPost, type BoardPostCollection, type BoardPostListParams, type BundleItem, type BundlePricing, type CanReviewResponse, type Cart, type CartItem, type CartShippingInfo, type Comment, type CommentCollection, type CommentListParams$1 as CommentListParams, type Coupon, type CouponType, type CouponValidation, type CreateBoardPostData, type CreateCommentData, type CreateEntityData, type CreateEntityRecordData, type CreateOrderData, type CreatePostData, type CreateProductReviewData, type CreateReservationData, type CreateReservationResult, type CreateSubscriptionData, type CreateSubscriptionResult, type CustomEntity, Diffsome, type DiffsomeConfig, DiffsomeError, type DigitalDownloadLink, type DigitalFile, type Entity, type EntityField, type EntityListParams, type EntityRecord, type EntitySchema, type ForgotPasswordData, type Form, type FormListParams, type FormSubmission, type FormSubmissionData, type ListParams, type ListResponse, type LoginCredentials, type Media, type Member, type MemberSubscription, type Order, type OrderItem, type OrderListParams, type OrderOrderer, type OrderShipping, type OrderStatus, type PaginatedResponse, type PaginationMeta, type Payment, type PaymentCancelData, type PaymentConfirmData, type PaymentMethod, type PaymentReadyData, type PaymentStatus, type PaymentStatusResponse, type PostListParams, type Product, type ProductAttribute, type ProductAttributeValue, type ProductCategory, type ProductCategoryCollection, type ProductCollection, type ProductListParams, type ProductListParamsExtended, type ProductOption, type ProductOptionValue, type ProductReview, type ProductReviewAuthor, type ProductReviewListParams, type ProductReviewStats, type ProductStatus, type ProductType, type ProductVariant, Diffsome as Promptly, type PromptlyConfig, DiffsomeError as PromptlyError, type RegisterData, type Reservation, type ReservationListParams, type ReservationService, type ReservationServiceStaff, type ReservationSettings, type ReservationSlot, type ReservationStaff, type ResetPasswordData, type SetupIntentResult, type SocialAuthUrl, type SocialProvider, type StripeCheckoutData, type StripeCheckoutResponse, type StripeVerifyData, type StripeVerifyResponse, type SubmissionListParams, type SubmitFormData, type SubscriptionInterval, type SubscriptionPlan, type SubscriptionStatus, type TossPaymentConfirmData, type TossPaymentConfirmResponse, type TossPaymentReadyData, type TossPaymentReadyResponse, type UpdateBoardPostData, type UpdateCartItemData, type UpdateCommentData, type UpdateEntityData, type UpdateEntityRecordData, type UpdatePostData, type UpdateProductReviewData, type UpdateProfileData, type WishlistCheckBulkResult, type WishlistCheckResult, type WishlistItem, type WishlistListParams, type WishlistMoveToCartResult, type WishlistToggleResult, type components, Diffsome as default, type operations, type paths, type webhooks };
12836
+ export { type $defs, type AddToCartData, type AddToWishlistData, type ApiError, type ApplyCouponData, type AuthResponse, type AvailableDatesParams, type AvailableSlotsParams, type BlogCategory, type BlogListParams, type BlogPost, type BlogPostCollection, type Board, type BoardCollection, type BoardComment, type BoardListParams, type BoardPost, type BoardPostCollection, type BoardPostListParams, type BundleItem, type BundlePricing, type CanReviewResponse, type Cart, type CartItem, type CartShippingInfo, type ChatAvailability, type ChatConversation, type ChatMessage, type Comment, type CommentCollection, type CommentListParams$1 as CommentListParams, type Coupon, type CouponType, type CouponValidation, type CreateBoardPostData, type CreateCommentData, type CreateEntityData, type CreateEntityRecordData, type CreateOrderData, type CreatePostData, type CreateProductReviewData, type CreateReservationData, type CreateReservationResult, type CreateSubscriptionData, type CreateSubscriptionResult, type CurrencyInfo, type CustomEntity, Diffsome, type DiffsomeConfig, DiffsomeError, type DigitalDownloadLink, type DigitalFile, type Entity, type EntityField, type EntityListParams, type EntityRecord, type EntitySchema, type ForgotPasswordData, type Form, type FormListParams, type FormSubmission, type FormSubmissionData, type ListParams, type ListResponse, type LoginCredentials, type Media, type Member, type MemberSubscription, type Order, type OrderItem, type OrderListParams, type OrderOrderer, type OrderShipping, type OrderStatus, type PaginatedResponse, type PaginationMeta, type Payment, type PaymentCancelData, type PaymentConfirmData, type PaymentMethod, type PaymentReadyData, type PaymentStatus, type PaymentStatusResponse, type PollResponse, type PostListParams, type Product, type ProductAttribute, type ProductAttributeValue, type ProductCategory, type ProductCategoryCollection, type ProductCollection, type ProductListParams, type ProductListParamsExtended, type ProductOption, type ProductOptionValue, type ProductReview, type ProductReviewAuthor, type ProductReviewListParams, type ProductReviewStats, type ProductStatus, type ProductType, type ProductVariant, Diffsome as Promptly, type PromptlyConfig, DiffsomeError as PromptlyError, type RegisterData, type Reservation, type ReservationListParams, type ReservationService, type ReservationServiceStaff, type ReservationSettings, type ReservationSlot, type ReservationStaff, type ResetPasswordData, type ReverbConfig, type SendMessageData, type SetupIntentResult, type SiteInfo, type SocialAuthUrl, type SocialProvider, type StartConversationData, type StripeCheckoutData, type StripeCheckoutResponse, type StripeVerifyData, type StripeVerifyResponse, type SubmissionListParams, type SubmitFormData, type SubscriptionInterval, type SubscriptionPlan, type SubscriptionStatus, type TossPaymentConfirmData, type TossPaymentConfirmResponse, type TossPaymentReadyData, type TossPaymentReadyResponse, type UpdateBoardPostData, type UpdateCartItemData, type UpdateCommentData, type UpdateEntityData, type UpdateEntityRecordData, type UpdatePostData, type UpdateProductReviewData, type UpdateProfileData, type WishlistCheckBulkResult, type WishlistCheckResult, type WishlistItem, type WishlistListParams, type WishlistMoveToCartResult, type WishlistToggleResult, type components, Diffsome as default, type operations, type paths, type webhooks };