@diffsome/sdk 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +322 -156
- package/dist/index.d.mts +293 -15
- package/dist/index.d.ts +293 -15
- package/dist/index.js +232 -13
- package/dist/index.mjs +232 -13
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -8387,8 +8387,18 @@ interface SocialAuthUrl {
|
|
|
8387
8387
|
url: string;
|
|
8388
8388
|
provider: string;
|
|
8389
8389
|
}
|
|
8390
|
+
interface BlogCategory {
|
|
8391
|
+
id: number;
|
|
8392
|
+
name: string;
|
|
8393
|
+
slug: string;
|
|
8394
|
+
description?: string;
|
|
8395
|
+
color?: string;
|
|
8396
|
+
icon?: string;
|
|
8397
|
+
posts_count?: number;
|
|
8398
|
+
}
|
|
8390
8399
|
interface BlogListParams extends ListParams {
|
|
8391
8400
|
category?: string;
|
|
8401
|
+
category_id?: number;
|
|
8392
8402
|
tag?: string;
|
|
8393
8403
|
search?: string;
|
|
8394
8404
|
}
|
|
@@ -8919,6 +8929,156 @@ interface ReservationListParams extends ListParams {
|
|
|
8919
8929
|
start_date?: string;
|
|
8920
8930
|
end_date?: string;
|
|
8921
8931
|
}
|
|
8932
|
+
interface WishlistItem {
|
|
8933
|
+
id: number;
|
|
8934
|
+
product_id: number;
|
|
8935
|
+
variant_id?: number;
|
|
8936
|
+
note?: string;
|
|
8937
|
+
product?: {
|
|
8938
|
+
id: number;
|
|
8939
|
+
name: string;
|
|
8940
|
+
slug: string;
|
|
8941
|
+
thumbnail?: string;
|
|
8942
|
+
sale_price?: number;
|
|
8943
|
+
regular_price?: number;
|
|
8944
|
+
status: string;
|
|
8945
|
+
stock_quantity?: number;
|
|
8946
|
+
in_stock: boolean;
|
|
8947
|
+
};
|
|
8948
|
+
variant?: {
|
|
8949
|
+
id: number;
|
|
8950
|
+
option_values?: Record<string, string>;
|
|
8951
|
+
sale_price?: number;
|
|
8952
|
+
regular_price?: number;
|
|
8953
|
+
stock_quantity?: number;
|
|
8954
|
+
image?: string;
|
|
8955
|
+
is_active: boolean;
|
|
8956
|
+
};
|
|
8957
|
+
created_at: string;
|
|
8958
|
+
}
|
|
8959
|
+
interface WishlistToggleResult {
|
|
8960
|
+
action: 'added' | 'removed';
|
|
8961
|
+
in_wishlist: boolean;
|
|
8962
|
+
}
|
|
8963
|
+
interface WishlistCheckResult {
|
|
8964
|
+
in_wishlist: boolean;
|
|
8965
|
+
}
|
|
8966
|
+
interface WishlistCheckBulkResult {
|
|
8967
|
+
items: Record<string, boolean>;
|
|
8968
|
+
}
|
|
8969
|
+
interface WishlistMoveToCartResult {
|
|
8970
|
+
moved: Array<{
|
|
8971
|
+
id: number;
|
|
8972
|
+
product_id: number;
|
|
8973
|
+
variant_id?: number;
|
|
8974
|
+
}>;
|
|
8975
|
+
failed: Array<{
|
|
8976
|
+
id: number;
|
|
8977
|
+
product_id: number;
|
|
8978
|
+
reason: string;
|
|
8979
|
+
}>;
|
|
8980
|
+
moved_count: number;
|
|
8981
|
+
failed_count: number;
|
|
8982
|
+
}
|
|
8983
|
+
interface AddToWishlistData {
|
|
8984
|
+
product_id: number;
|
|
8985
|
+
variant_id?: number;
|
|
8986
|
+
note?: string;
|
|
8987
|
+
}
|
|
8988
|
+
interface WishlistListParams extends ListParams {
|
|
8989
|
+
}
|
|
8990
|
+
type ProductType = 'physical' | 'digital' | 'subscription' | 'bundle';
|
|
8991
|
+
interface DigitalFile {
|
|
8992
|
+
id: number;
|
|
8993
|
+
name: string;
|
|
8994
|
+
original_filename: string;
|
|
8995
|
+
mime_type?: string;
|
|
8996
|
+
file_size: number;
|
|
8997
|
+
file_size_human: string;
|
|
8998
|
+
extension: string;
|
|
8999
|
+
}
|
|
9000
|
+
interface DigitalDownloadLink {
|
|
9001
|
+
id: number;
|
|
9002
|
+
token: string;
|
|
9003
|
+
file?: DigitalFile;
|
|
9004
|
+
order_id: number;
|
|
9005
|
+
download_count: number;
|
|
9006
|
+
download_limit?: number;
|
|
9007
|
+
remaining_downloads?: number;
|
|
9008
|
+
can_download: boolean;
|
|
9009
|
+
blocked_reason?: 'expired' | 'limit_exceeded';
|
|
9010
|
+
expires_at?: string;
|
|
9011
|
+
first_downloaded_at?: string;
|
|
9012
|
+
last_downloaded_at?: string;
|
|
9013
|
+
created_at: string;
|
|
9014
|
+
}
|
|
9015
|
+
type SubscriptionInterval = 'day' | 'week' | 'month' | 'year';
|
|
9016
|
+
type SubscriptionStatus = 'trialing' | 'active' | 'past_due' | 'paused' | 'canceled' | 'expired';
|
|
9017
|
+
interface SubscriptionPlan {
|
|
9018
|
+
id: number;
|
|
9019
|
+
name?: string;
|
|
9020
|
+
interval: SubscriptionInterval;
|
|
9021
|
+
interval_count: number;
|
|
9022
|
+
interval_label: string;
|
|
9023
|
+
price: number;
|
|
9024
|
+
price_display: string;
|
|
9025
|
+
trial_days: number;
|
|
9026
|
+
features?: string[];
|
|
9027
|
+
}
|
|
9028
|
+
interface MemberSubscription {
|
|
9029
|
+
id: number;
|
|
9030
|
+
product?: {
|
|
9031
|
+
id: number;
|
|
9032
|
+
name: string;
|
|
9033
|
+
slug: string;
|
|
9034
|
+
thumbnail?: string;
|
|
9035
|
+
};
|
|
9036
|
+
plan?: SubscriptionPlan;
|
|
9037
|
+
status: SubscriptionStatus;
|
|
9038
|
+
status_label: string;
|
|
9039
|
+
current_price: number;
|
|
9040
|
+
is_active: boolean;
|
|
9041
|
+
on_trial: boolean;
|
|
9042
|
+
is_canceled: boolean;
|
|
9043
|
+
is_paused: boolean;
|
|
9044
|
+
days_until_renewal?: number;
|
|
9045
|
+
trial_ends_at?: string;
|
|
9046
|
+
current_period_start?: string;
|
|
9047
|
+
current_period_end?: string;
|
|
9048
|
+
canceled_at?: string;
|
|
9049
|
+
created_at: string;
|
|
9050
|
+
}
|
|
9051
|
+
interface CreateSubscriptionData {
|
|
9052
|
+
plan_id: number;
|
|
9053
|
+
payment_method_id: string;
|
|
9054
|
+
}
|
|
9055
|
+
interface CreateSubscriptionResult {
|
|
9056
|
+
subscription: MemberSubscription;
|
|
9057
|
+
client_secret?: string;
|
|
9058
|
+
}
|
|
9059
|
+
interface SetupIntentResult {
|
|
9060
|
+
client_secret: string;
|
|
9061
|
+
}
|
|
9062
|
+
interface BundleItem {
|
|
9063
|
+
product_id: number;
|
|
9064
|
+
variant_id?: number;
|
|
9065
|
+
name: string;
|
|
9066
|
+
quantity: number;
|
|
9067
|
+
unit_price: number;
|
|
9068
|
+
subtotal: number;
|
|
9069
|
+
}
|
|
9070
|
+
interface BundlePricing {
|
|
9071
|
+
items: BundleItem[];
|
|
9072
|
+
original_total: number;
|
|
9073
|
+
discount_type?: 'fixed' | 'percent';
|
|
9074
|
+
discount_value: number;
|
|
9075
|
+
discount_amount: number;
|
|
9076
|
+
final_price: number;
|
|
9077
|
+
savings_percent: number;
|
|
9078
|
+
}
|
|
9079
|
+
interface ProductListParamsExtended extends ProductListParams {
|
|
9080
|
+
type?: ProductType;
|
|
9081
|
+
}
|
|
8922
9082
|
|
|
8923
9083
|
/**
|
|
8924
9084
|
* HTTP Client for Diffsome SDK
|
|
@@ -8974,6 +9134,10 @@ declare class HttpClient {
|
|
|
8974
9134
|
* Get current API key
|
|
8975
9135
|
*/
|
|
8976
9136
|
getApiKey(): string | null;
|
|
9137
|
+
/**
|
|
9138
|
+
* Get the base URL with tenant path
|
|
9139
|
+
*/
|
|
9140
|
+
getBaseUrl(): string;
|
|
8977
9141
|
/**
|
|
8978
9142
|
* Set cart session ID (for guest cart persistence)
|
|
8979
9143
|
*/
|
|
@@ -9192,9 +9356,9 @@ declare class BlogResource {
|
|
|
9192
9356
|
search(query: string, params?: Omit<BlogListParams, 'search'>): Promise<ListResponse<BlogPost>>;
|
|
9193
9357
|
/**
|
|
9194
9358
|
* Get blog categories
|
|
9195
|
-
* @returns Array of
|
|
9359
|
+
* @returns Array of blog categories with details
|
|
9196
9360
|
*/
|
|
9197
|
-
categories(): Promise<
|
|
9361
|
+
categories(): Promise<BlogCategory[]>;
|
|
9198
9362
|
/**
|
|
9199
9363
|
* Get blog tags
|
|
9200
9364
|
* @returns Array of tag names (always an array)
|
|
@@ -9467,6 +9631,132 @@ declare class ShopResource {
|
|
|
9467
9631
|
per_page?: number;
|
|
9468
9632
|
page?: number;
|
|
9469
9633
|
}): Promise<ListResponse<ProductReview>>;
|
|
9634
|
+
/**
|
|
9635
|
+
* Get wishlist items
|
|
9636
|
+
* Requires authentication
|
|
9637
|
+
*/
|
|
9638
|
+
getWishlist(params?: WishlistListParams): Promise<ListResponse<WishlistItem>>;
|
|
9639
|
+
/**
|
|
9640
|
+
* Add product to wishlist
|
|
9641
|
+
* Requires authentication
|
|
9642
|
+
*/
|
|
9643
|
+
addToWishlist(data: AddToWishlistData): Promise<WishlistItem>;
|
|
9644
|
+
/**
|
|
9645
|
+
* Remove item from wishlist
|
|
9646
|
+
* Requires authentication
|
|
9647
|
+
*/
|
|
9648
|
+
removeFromWishlist(wishlistId: number): Promise<void>;
|
|
9649
|
+
/**
|
|
9650
|
+
* Toggle wishlist (add if not in wishlist, remove if in wishlist)
|
|
9651
|
+
* Requires authentication
|
|
9652
|
+
*/
|
|
9653
|
+
toggleWishlist(productId: number, variantId?: number): Promise<WishlistToggleResult>;
|
|
9654
|
+
/**
|
|
9655
|
+
* Check if product is in wishlist
|
|
9656
|
+
*/
|
|
9657
|
+
isInWishlist(productId: number, variantId?: number): Promise<boolean>;
|
|
9658
|
+
/**
|
|
9659
|
+
* Check multiple products' wishlist status
|
|
9660
|
+
* Useful for product list pages
|
|
9661
|
+
*/
|
|
9662
|
+
checkWishlistBulk(productIds: number[]): Promise<Record<string, boolean>>;
|
|
9663
|
+
/**
|
|
9664
|
+
* Get wishlist count
|
|
9665
|
+
*/
|
|
9666
|
+
getWishlistCount(): Promise<number>;
|
|
9667
|
+
/**
|
|
9668
|
+
* Move wishlist items to cart
|
|
9669
|
+
* @param wishlistIds - Optional array of wishlist item IDs to move. If empty, moves all items.
|
|
9670
|
+
*/
|
|
9671
|
+
moveWishlistToCart(wishlistIds?: number[]): Promise<WishlistMoveToCartResult>;
|
|
9672
|
+
/**
|
|
9673
|
+
* Update wishlist item note
|
|
9674
|
+
*/
|
|
9675
|
+
updateWishlistNote(wishlistId: number, note: string): Promise<WishlistItem>;
|
|
9676
|
+
/**
|
|
9677
|
+
* Get product's wishlist count (how many users added this product)
|
|
9678
|
+
*/
|
|
9679
|
+
getProductWishlistCount(productSlug: string): Promise<number>;
|
|
9680
|
+
/**
|
|
9681
|
+
* Get my download links
|
|
9682
|
+
* Requires authentication
|
|
9683
|
+
*/
|
|
9684
|
+
getMyDownloads(): Promise<DigitalDownloadLink[]>;
|
|
9685
|
+
/**
|
|
9686
|
+
* Get download links for a specific order
|
|
9687
|
+
* Requires authentication
|
|
9688
|
+
*/
|
|
9689
|
+
getOrderDownloads(orderNumber: string): Promise<DigitalDownloadLink[]>;
|
|
9690
|
+
/**
|
|
9691
|
+
* Get download file URL
|
|
9692
|
+
* Returns the direct download URL for the file
|
|
9693
|
+
* Requires authentication
|
|
9694
|
+
*/
|
|
9695
|
+
downloadFile(token: string): Promise<string>;
|
|
9696
|
+
/**
|
|
9697
|
+
* Get download link info (without triggering download)
|
|
9698
|
+
* Requires authentication
|
|
9699
|
+
*/
|
|
9700
|
+
getDownloadInfo(token: string): Promise<DigitalDownloadLink>;
|
|
9701
|
+
/**
|
|
9702
|
+
* Get my subscriptions
|
|
9703
|
+
* Requires authentication
|
|
9704
|
+
*/
|
|
9705
|
+
getSubscriptions(): Promise<MemberSubscription[]>;
|
|
9706
|
+
/**
|
|
9707
|
+
* Get subscription by ID
|
|
9708
|
+
* Requires authentication
|
|
9709
|
+
*/
|
|
9710
|
+
getSubscription(id: number): Promise<MemberSubscription>;
|
|
9711
|
+
/**
|
|
9712
|
+
* Create a new subscription
|
|
9713
|
+
* Requires Stripe payment method ID
|
|
9714
|
+
* Requires authentication
|
|
9715
|
+
*/
|
|
9716
|
+
createSubscription(data: CreateSubscriptionData): Promise<CreateSubscriptionResult>;
|
|
9717
|
+
/**
|
|
9718
|
+
* Cancel subscription
|
|
9719
|
+
* @param immediately - If true, cancel immediately. Otherwise, cancel at end of billing period.
|
|
9720
|
+
* Requires authentication
|
|
9721
|
+
*/
|
|
9722
|
+
cancelSubscription(id: number, immediately?: boolean): Promise<MemberSubscription>;
|
|
9723
|
+
/**
|
|
9724
|
+
* Pause subscription
|
|
9725
|
+
* Requires authentication
|
|
9726
|
+
*/
|
|
9727
|
+
pauseSubscription(id: number): Promise<MemberSubscription>;
|
|
9728
|
+
/**
|
|
9729
|
+
* Resume paused subscription
|
|
9730
|
+
* Requires authentication
|
|
9731
|
+
*/
|
|
9732
|
+
resumeSubscription(id: number): Promise<MemberSubscription>;
|
|
9733
|
+
/**
|
|
9734
|
+
* Create Stripe Setup Intent for adding payment method
|
|
9735
|
+
* Use with Stripe.js to collect card details
|
|
9736
|
+
* Requires authentication
|
|
9737
|
+
*/
|
|
9738
|
+
createSetupIntent(): Promise<SetupIntentResult>;
|
|
9739
|
+
/**
|
|
9740
|
+
* Get bundle items and pricing
|
|
9741
|
+
* Returns all products in the bundle with calculated pricing
|
|
9742
|
+
*/
|
|
9743
|
+
getBundleItems(productSlug: string): Promise<BundlePricing>;
|
|
9744
|
+
/**
|
|
9745
|
+
* List products with type filter
|
|
9746
|
+
*/
|
|
9747
|
+
listProductsByType(type: ProductType, params?: ProductListParams): Promise<ListResponse<Product>>;
|
|
9748
|
+
/**
|
|
9749
|
+
* Get digital products
|
|
9750
|
+
*/
|
|
9751
|
+
getDigitalProducts(params?: ProductListParams): Promise<ListResponse<Product>>;
|
|
9752
|
+
/**
|
|
9753
|
+
* Get subscription products
|
|
9754
|
+
*/
|
|
9755
|
+
getSubscriptionProducts(params?: ProductListParams): Promise<ListResponse<Product>>;
|
|
9756
|
+
/**
|
|
9757
|
+
* Get bundle products
|
|
9758
|
+
*/
|
|
9759
|
+
getBundleProducts(params?: ProductListParams): Promise<ListResponse<Product>>;
|
|
9470
9760
|
}
|
|
9471
9761
|
|
|
9472
9762
|
/**
|
|
@@ -9807,18 +10097,6 @@ declare class Diffsome {
|
|
|
9807
10097
|
/** Reservations - booking services and time slots */
|
|
9808
10098
|
readonly reservation: ReservationResource;
|
|
9809
10099
|
constructor(config: DiffsomeConfig);
|
|
9810
|
-
/**
|
|
9811
|
-
* Get site theme settings
|
|
9812
|
-
*/
|
|
9813
|
-
getTheme(): Promise<{
|
|
9814
|
-
name: string;
|
|
9815
|
-
colors: Record<string, string>;
|
|
9816
|
-
fonts: Record<string, string>;
|
|
9817
|
-
}>;
|
|
9818
|
-
/**
|
|
9819
|
-
* Get site settings
|
|
9820
|
-
*/
|
|
9821
|
-
getSettings(): Promise<Record<string, any>>;
|
|
9822
10100
|
/**
|
|
9823
10101
|
* Check if user is authenticated
|
|
9824
10102
|
*/
|
|
@@ -9853,4 +10131,4 @@ declare class Diffsome {
|
|
|
9853
10131
|
getApiKey(): string | null;
|
|
9854
10132
|
}
|
|
9855
10133
|
|
|
9856
|
-
export { type $defs, type AddToCartData, type ApiError, type ApplyCouponData, type AuthResponse, type AvailableDatesParams, type AvailableSlotsParams, type BlogListParams, type BlogPost, type BlogPostCollection, type Board, type BoardCollection, type BoardComment, type BoardListParams, type BoardPost, type BoardPostCollection, type BoardPostListParams, 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 CustomEntity, Diffsome, type DiffsomeConfig, DiffsomeError, 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 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 ProductOption, type ProductOptionValue, type ProductReview, type ProductReviewAuthor, type ProductReviewListParams, type ProductReviewStats, type ProductStatus, type ProductVariant, Diffsome as Promptly, type PromptlyConfig, DiffsomeError as PromptlyError, type RegisterData, type Reservation, type ReservationListParams, type ReservationService, type ReservationSettings, type ReservationSlot, type ReservationStaff, type ResetPasswordData, type SocialAuthUrl, type SocialProvider, type StripeCheckoutData, type StripeCheckoutResponse, type StripeVerifyData, type StripeVerifyResponse, type SubmissionListParams, type SubmitFormData, 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 components, Diffsome as default, type operations, type paths, type webhooks };
|
|
10134
|
+
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 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 };
|