@zenky/storefront-api 0.0.34 → 0.0.36
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/LICENSE.md +1 -1
- package/dist/index.d.ts +184 -151
- package/dist/zenky-storefront-api.es.js +107 -83
- package/dist/zenky-storefront-api.umd.js +2 -2
- package/package.json +2 -6
package/LICENSE.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -372,6 +372,14 @@ export interface NestedCategory extends Category {
|
|
|
372
372
|
export interface CategoriesListRequest extends ListRequest {
|
|
373
373
|
featured?: boolean;
|
|
374
374
|
}
|
|
375
|
+
export interface ProductsCollection {
|
|
376
|
+
id: string;
|
|
377
|
+
name: string | null;
|
|
378
|
+
description: string | null;
|
|
379
|
+
cover: Media | null;
|
|
380
|
+
}
|
|
381
|
+
export interface CollectionsListRequest extends PaginationRequest, SearchRequest, OrderingRequest {
|
|
382
|
+
}
|
|
375
383
|
export interface FeatureValue {
|
|
376
384
|
id: string;
|
|
377
385
|
alias: string;
|
|
@@ -405,157 +413,6 @@ export interface FeaturesGroup {
|
|
|
405
413
|
description: string | null;
|
|
406
414
|
features: Feature[];
|
|
407
415
|
}
|
|
408
|
-
export declare class CategoriesResource extends AbstractResource {
|
|
409
|
-
getCategories(storeId: string, request?: CategoriesListRequest): Promise<PaginatedResponse<Category>>;
|
|
410
|
-
getCategoriesTree(storeId: string, request?: InclusionRequest): Promise<NestedCategory[]>;
|
|
411
|
-
getCategory(storeId: string, categoryId: string, request?: InclusionRequest): Promise<Category>;
|
|
412
|
-
getFeaturesGroups(storeId: string, categoryId: string): Promise<FeaturesGroup[]>;
|
|
413
|
-
getFeatures(storeId: string, categoryId: string): Promise<Feature[]>;
|
|
414
|
-
}
|
|
415
|
-
export declare class ZenkyError extends Error {
|
|
416
|
-
readonly err: ApiError | null;
|
|
417
|
-
constructor(message: string, error: ApiError | null);
|
|
418
|
-
}
|
|
419
|
-
export declare class ZenkyErrorBuilder {
|
|
420
|
-
static build(response: any): Promise<ZenkyError>;
|
|
421
|
-
}
|
|
422
|
-
export interface Stock {
|
|
423
|
-
id: string;
|
|
424
|
-
name: string | null;
|
|
425
|
-
description: string | null;
|
|
426
|
-
address: string | null;
|
|
427
|
-
coordinates: GeoLocation | null;
|
|
428
|
-
links: Contact[];
|
|
429
|
-
phones: Phone[];
|
|
430
|
-
schedule: Schedule | null;
|
|
431
|
-
}
|
|
432
|
-
export interface DeliveryZone {
|
|
433
|
-
id: string;
|
|
434
|
-
name: string | null;
|
|
435
|
-
coordinates: GeoLocation[];
|
|
436
|
-
description: string | null;
|
|
437
|
-
color: string | null;
|
|
438
|
-
min_price: number | null;
|
|
439
|
-
free_delivery_price: number | null;
|
|
440
|
-
delivery_price: number | null;
|
|
441
|
-
delivery_time: string | null;
|
|
442
|
-
}
|
|
443
|
-
export interface City {
|
|
444
|
-
id: string;
|
|
445
|
-
is_default: boolean;
|
|
446
|
-
name: string | null;
|
|
447
|
-
timezone: string;
|
|
448
|
-
coordinates: GeoLocation | null;
|
|
449
|
-
stocks?: Stock[];
|
|
450
|
-
delivery_zones?: DeliveryZone[];
|
|
451
|
-
phones?: Phone[];
|
|
452
|
-
}
|
|
453
|
-
export interface StoreSettings {
|
|
454
|
-
country: string;
|
|
455
|
-
currency: string;
|
|
456
|
-
orders: {
|
|
457
|
-
authentication_method: OrderAuthenticationMethod;
|
|
458
|
-
use_early_delivery: boolean;
|
|
459
|
-
addresses_provider: AddressesProvider;
|
|
460
|
-
};
|
|
461
|
-
products: {
|
|
462
|
-
use_stock_filter: boolean;
|
|
463
|
-
};
|
|
464
|
-
loyalty: {
|
|
465
|
-
enabled: boolean;
|
|
466
|
-
bonuses: {
|
|
467
|
-
on_demand_balance_enabled: boolean;
|
|
468
|
-
pin_enabled: boolean;
|
|
469
|
-
};
|
|
470
|
-
};
|
|
471
|
-
recaptcha: {
|
|
472
|
-
actions: RecaptchaAction[];
|
|
473
|
-
key: string;
|
|
474
|
-
} | null;
|
|
475
|
-
websockets: {
|
|
476
|
-
app_id: string;
|
|
477
|
-
app_key: string;
|
|
478
|
-
options: {
|
|
479
|
-
host: string;
|
|
480
|
-
port: number;
|
|
481
|
-
};
|
|
482
|
-
} | null;
|
|
483
|
-
}
|
|
484
|
-
export interface Store {
|
|
485
|
-
id: string;
|
|
486
|
-
name: string;
|
|
487
|
-
domain: string | null;
|
|
488
|
-
app_store_url: string | null;
|
|
489
|
-
google_play_url: string | null;
|
|
490
|
-
logo: Media | null;
|
|
491
|
-
square_logo: Media | null;
|
|
492
|
-
links: Contact[];
|
|
493
|
-
phones: Phone[];
|
|
494
|
-
cities: City[];
|
|
495
|
-
settings: StoreSettings;
|
|
496
|
-
}
|
|
497
|
-
export declare class StoreResource extends AbstractResource {
|
|
498
|
-
getStore(storeId: string): Promise<Store>;
|
|
499
|
-
getStoreByBundleId(bundleId: string): Promise<Store>;
|
|
500
|
-
}
|
|
501
|
-
export interface ProductsCollection {
|
|
502
|
-
id: string;
|
|
503
|
-
name: string | null;
|
|
504
|
-
description: string | null;
|
|
505
|
-
cover: Media | null;
|
|
506
|
-
}
|
|
507
|
-
export interface CollectionsListRequest extends PaginationRequest, SearchRequest, OrderingRequest {
|
|
508
|
-
}
|
|
509
|
-
export declare class CollectionsResource extends AbstractResource {
|
|
510
|
-
getCollections(storeId: string, request?: CollectionsListRequest): Promise<PaginatedResponse<ProductsCollection>>;
|
|
511
|
-
getCollection(storeId: string, id: string): Promise<ProductsCollection>;
|
|
512
|
-
}
|
|
513
|
-
export interface OfferBanner {
|
|
514
|
-
title: string | null;
|
|
515
|
-
description: string | null;
|
|
516
|
-
image: Media | null;
|
|
517
|
-
}
|
|
518
|
-
export interface OfferArticle {
|
|
519
|
-
title: string | null;
|
|
520
|
-
intro: string | null;
|
|
521
|
-
body: string | null;
|
|
522
|
-
cover: Media | null;
|
|
523
|
-
}
|
|
524
|
-
export interface Offer {
|
|
525
|
-
id: string;
|
|
526
|
-
short_id: string;
|
|
527
|
-
slug: string | null;
|
|
528
|
-
banners: {
|
|
529
|
-
desktop: OfferBanner | null;
|
|
530
|
-
mobile: OfferBanner | null;
|
|
531
|
-
};
|
|
532
|
-
article?: OfferArticle | null;
|
|
533
|
-
}
|
|
534
|
-
export declare class OffersResource extends AbstractResource {
|
|
535
|
-
getOffers(storeId: string, request?: ListRequest): Promise<PaginatedResponse<Offer>>;
|
|
536
|
-
getOffer(storeId: string, offerId: string, request?: InclusionRequest): Promise<Offer>;
|
|
537
|
-
}
|
|
538
|
-
export interface Feedback {
|
|
539
|
-
id: string;
|
|
540
|
-
name: string | null;
|
|
541
|
-
email: string | null;
|
|
542
|
-
phone: Phone | null;
|
|
543
|
-
comment: string | null;
|
|
544
|
-
created_at: string;
|
|
545
|
-
}
|
|
546
|
-
export interface FeedbackRequest extends RecaptchaRequest {
|
|
547
|
-
name?: string;
|
|
548
|
-
email?: string;
|
|
549
|
-
phone?: PhoneRequest;
|
|
550
|
-
comment?: string;
|
|
551
|
-
}
|
|
552
|
-
export interface CallbackRequest extends RecaptchaRequest {
|
|
553
|
-
phone: PhoneRequest;
|
|
554
|
-
}
|
|
555
|
-
export declare class FeedbackResource extends AbstractResource {
|
|
556
|
-
createFeedback(storeId: string, request: FeedbackRequest): Promise<Feedback>;
|
|
557
|
-
createCallback(storeId: string, request: CallbackRequest): Promise<boolean>;
|
|
558
|
-
}
|
|
559
416
|
export interface Modifier {
|
|
560
417
|
id: string;
|
|
561
418
|
sku: string | null;
|
|
@@ -710,6 +567,169 @@ export interface ProductVariantPriceCalculationRequest {
|
|
|
710
567
|
stock_id?: string;
|
|
711
568
|
modifiers?: ProductModifiersRequest[];
|
|
712
569
|
}
|
|
570
|
+
export interface CatalogItem {
|
|
571
|
+
type: "category" | "collection";
|
|
572
|
+
products_count: number;
|
|
573
|
+
category?: Category | null;
|
|
574
|
+
collection?: ProductsCollection | null;
|
|
575
|
+
products: Product[];
|
|
576
|
+
}
|
|
577
|
+
export declare class CatalogResource extends AbstractResource {
|
|
578
|
+
getCatalog(storeId: string): Promise<CatalogItem[]>;
|
|
579
|
+
}
|
|
580
|
+
export declare class CategoriesResource extends AbstractResource {
|
|
581
|
+
getCategories(storeId: string, request?: CategoriesListRequest): Promise<PaginatedResponse<Category>>;
|
|
582
|
+
getCategoriesTree(storeId: string, request?: InclusionRequest): Promise<NestedCategory[]>;
|
|
583
|
+
getCategory(storeId: string, categoryId: string, request?: InclusionRequest): Promise<Category>;
|
|
584
|
+
getFeaturesGroups(storeId: string, categoryId: string): Promise<FeaturesGroup[]>;
|
|
585
|
+
getFeatures(storeId: string, categoryId: string): Promise<Feature[]>;
|
|
586
|
+
}
|
|
587
|
+
export declare class ZenkyError extends Error {
|
|
588
|
+
readonly err: ApiError | null;
|
|
589
|
+
constructor(message: string, error: ApiError | null);
|
|
590
|
+
}
|
|
591
|
+
export declare class ZenkyErrorBuilder {
|
|
592
|
+
static build(response: any): Promise<ZenkyError>;
|
|
593
|
+
}
|
|
594
|
+
export interface Stock {
|
|
595
|
+
id: string;
|
|
596
|
+
name: string | null;
|
|
597
|
+
description: string | null;
|
|
598
|
+
address: string | null;
|
|
599
|
+
coordinates: GeoLocation | null;
|
|
600
|
+
links: Contact[];
|
|
601
|
+
phones: Phone[];
|
|
602
|
+
schedule: Schedule | null;
|
|
603
|
+
}
|
|
604
|
+
export interface DeliveryZone {
|
|
605
|
+
id: string;
|
|
606
|
+
name: string | null;
|
|
607
|
+
coordinates: GeoLocation[];
|
|
608
|
+
description: string | null;
|
|
609
|
+
color: string | null;
|
|
610
|
+
min_price: number | null;
|
|
611
|
+
free_delivery_price: number | null;
|
|
612
|
+
delivery_price: number | null;
|
|
613
|
+
delivery_time: string | null;
|
|
614
|
+
}
|
|
615
|
+
export interface City {
|
|
616
|
+
id: string;
|
|
617
|
+
is_default: boolean;
|
|
618
|
+
name: string | null;
|
|
619
|
+
timezone: string;
|
|
620
|
+
coordinates: GeoLocation | null;
|
|
621
|
+
stocks?: Stock[];
|
|
622
|
+
delivery_zones?: DeliveryZone[];
|
|
623
|
+
phones?: Phone[];
|
|
624
|
+
}
|
|
625
|
+
export interface StoreSettings {
|
|
626
|
+
country: string;
|
|
627
|
+
currency: string;
|
|
628
|
+
orders: {
|
|
629
|
+
authentication_method: OrderAuthenticationMethod;
|
|
630
|
+
use_early_delivery: boolean;
|
|
631
|
+
addresses_provider: AddressesProvider;
|
|
632
|
+
repeats: {
|
|
633
|
+
enabled: boolean;
|
|
634
|
+
};
|
|
635
|
+
checkout_ui: {
|
|
636
|
+
enabled: boolean;
|
|
637
|
+
message: string | null;
|
|
638
|
+
};
|
|
639
|
+
};
|
|
640
|
+
products: {
|
|
641
|
+
use_stock_filter: boolean;
|
|
642
|
+
search: {
|
|
643
|
+
enabled: boolean;
|
|
644
|
+
};
|
|
645
|
+
};
|
|
646
|
+
loyalty: {
|
|
647
|
+
enabled: boolean;
|
|
648
|
+
bonuses: {
|
|
649
|
+
on_demand_balance_enabled: boolean;
|
|
650
|
+
pin_enabled: boolean;
|
|
651
|
+
};
|
|
652
|
+
};
|
|
653
|
+
recaptcha: {
|
|
654
|
+
actions: RecaptchaAction[];
|
|
655
|
+
key: string;
|
|
656
|
+
} | null;
|
|
657
|
+
websockets: {
|
|
658
|
+
app_id: string;
|
|
659
|
+
app_key: string;
|
|
660
|
+
options: {
|
|
661
|
+
host: string;
|
|
662
|
+
port: number;
|
|
663
|
+
};
|
|
664
|
+
} | null;
|
|
665
|
+
}
|
|
666
|
+
export interface Store {
|
|
667
|
+
id: string;
|
|
668
|
+
name: string;
|
|
669
|
+
domain: string | null;
|
|
670
|
+
app_store_url: string | null;
|
|
671
|
+
google_play_url: string | null;
|
|
672
|
+
logo: Media | null;
|
|
673
|
+
square_logo: Media | null;
|
|
674
|
+
links: Contact[];
|
|
675
|
+
phones: Phone[];
|
|
676
|
+
cities: City[];
|
|
677
|
+
settings: StoreSettings;
|
|
678
|
+
}
|
|
679
|
+
export declare class StoreResource extends AbstractResource {
|
|
680
|
+
getStore(storeId: string): Promise<Store>;
|
|
681
|
+
getStoreByBundleId(bundleId: string): Promise<Store>;
|
|
682
|
+
}
|
|
683
|
+
export declare class CollectionsResource extends AbstractResource {
|
|
684
|
+
getCollections(storeId: string, request?: CollectionsListRequest): Promise<PaginatedResponse<ProductsCollection>>;
|
|
685
|
+
getCollection(storeId: string, id: string): Promise<ProductsCollection>;
|
|
686
|
+
}
|
|
687
|
+
export interface OfferBanner {
|
|
688
|
+
title: string | null;
|
|
689
|
+
description: string | null;
|
|
690
|
+
image: Media | null;
|
|
691
|
+
}
|
|
692
|
+
export interface OfferArticle {
|
|
693
|
+
title: string | null;
|
|
694
|
+
intro: string | null;
|
|
695
|
+
body: string | null;
|
|
696
|
+
cover: Media | null;
|
|
697
|
+
}
|
|
698
|
+
export interface Offer {
|
|
699
|
+
id: string;
|
|
700
|
+
short_id: string;
|
|
701
|
+
slug: string | null;
|
|
702
|
+
banners: {
|
|
703
|
+
desktop: OfferBanner | null;
|
|
704
|
+
mobile: OfferBanner | null;
|
|
705
|
+
};
|
|
706
|
+
article?: OfferArticle | null;
|
|
707
|
+
}
|
|
708
|
+
export declare class OffersResource extends AbstractResource {
|
|
709
|
+
getOffers(storeId: string, request?: ListRequest): Promise<PaginatedResponse<Offer>>;
|
|
710
|
+
getOffer(storeId: string, offerId: string, request?: InclusionRequest): Promise<Offer>;
|
|
711
|
+
}
|
|
712
|
+
export interface Feedback {
|
|
713
|
+
id: string;
|
|
714
|
+
name: string | null;
|
|
715
|
+
email: string | null;
|
|
716
|
+
phone: Phone | null;
|
|
717
|
+
comment: string | null;
|
|
718
|
+
created_at: string;
|
|
719
|
+
}
|
|
720
|
+
export interface FeedbackRequest extends RecaptchaRequest {
|
|
721
|
+
name?: string;
|
|
722
|
+
email?: string;
|
|
723
|
+
phone?: PhoneRequest;
|
|
724
|
+
comment?: string;
|
|
725
|
+
}
|
|
726
|
+
export interface CallbackRequest extends RecaptchaRequest {
|
|
727
|
+
phone: PhoneRequest;
|
|
728
|
+
}
|
|
729
|
+
export declare class FeedbackResource extends AbstractResource {
|
|
730
|
+
createFeedback(storeId: string, request: FeedbackRequest): Promise<Feedback>;
|
|
731
|
+
createCallback(storeId: string, request: CallbackRequest): Promise<boolean>;
|
|
732
|
+
}
|
|
713
733
|
export declare class ProductsResource extends AbstractResource {
|
|
714
734
|
getProducts(storeId: string, request?: ListProductsRequest): Promise<PaginatedResponse<Product>>;
|
|
715
735
|
getProduct(storeId: string, productId: string, request?: ViewProductRequest): Promise<Product>;
|
|
@@ -1101,6 +1121,7 @@ export interface Order {
|
|
|
1101
1121
|
statuses?: OrderStatus[];
|
|
1102
1122
|
progress?: OrderStatusProgress[];
|
|
1103
1123
|
payments?: OrderPaymentTransaction[];
|
|
1124
|
+
promocode?: OrderPromocode | null;
|
|
1104
1125
|
}
|
|
1105
1126
|
export interface OrderPaymentMethod {
|
|
1106
1127
|
id: PaymentMethod;
|
|
@@ -1218,6 +1239,9 @@ export interface OrderPaymentMethodRequest {
|
|
|
1218
1239
|
export interface SetOrderPaymentsRequest {
|
|
1219
1240
|
payments: OrderPaymentMethodRequest[];
|
|
1220
1241
|
}
|
|
1242
|
+
export interface SetOrderPromocodeRequest {
|
|
1243
|
+
promocode: string;
|
|
1244
|
+
}
|
|
1221
1245
|
export interface OrderCheckoutBonusesPreview {
|
|
1222
1246
|
bonuses: number;
|
|
1223
1247
|
unpaid: number;
|
|
@@ -1277,6 +1301,11 @@ export interface OrderPromotionReward {
|
|
|
1277
1301
|
total_amount: number | null;
|
|
1278
1302
|
count: number;
|
|
1279
1303
|
}
|
|
1304
|
+
export interface OrderPromocode {
|
|
1305
|
+
type: "plain";
|
|
1306
|
+
promocode: string;
|
|
1307
|
+
message: string;
|
|
1308
|
+
}
|
|
1280
1309
|
export declare class OrdersResource extends AbstractResource {
|
|
1281
1310
|
protected getOrderUrl(storeId: string, credentials: OrderCredentials, path: string, request?: any): string;
|
|
1282
1311
|
protected getApiToken(credentials: OrderCredentials): undefined | string;
|
|
@@ -1291,6 +1320,9 @@ export declare class OrdersResource extends AbstractResource {
|
|
|
1291
1320
|
setOrderCustomer(storeId: string, credentials: OrderCredentials, request: SetOrderCustomerRequest): Promise<boolean>;
|
|
1292
1321
|
setOrderDeliveryMethod(storeId: string, credentials: OrderCredentials, request: SetOrderDeliveryRequest): Promise<Order>;
|
|
1293
1322
|
setOrderPayments(storeId: string, credentials: OrderCredentials, request: SetOrderPaymentsRequest): Promise<Order>;
|
|
1323
|
+
getOrderPromocode(storeId: string, credentials: OrderCredentials, request: SetOrderPromocodeRequest): Promise<OrderPromocode | null>;
|
|
1324
|
+
setOrderPromocode(storeId: string, credentials: OrderCredentials, request: SetOrderPromocodeRequest): Promise<OrderPromocode>;
|
|
1325
|
+
removeOrderPromocode(storeId: string, credentials: OrderCredentials): Promise<boolean>;
|
|
1294
1326
|
getOrderBonusesPreview(storeId: string, credentials: OrderCredentials, amount: number | string): Promise<OrderCheckoutBonusesPreview>;
|
|
1295
1327
|
getOrderTotal(storeId: string, credentials: OrderCredentials): Promise<OrderCheckoutTotal>;
|
|
1296
1328
|
checkoutOrder(storeId: string, credentials: OrderCredentials, request: OrderCheckoutRequest): Promise<OrderCheckoutResult>;
|
|
@@ -1336,6 +1368,7 @@ export declare class ZenkyStorefront {
|
|
|
1336
1368
|
readonly store: StoreResource;
|
|
1337
1369
|
readonly auth: AuthenticationResource;
|
|
1338
1370
|
readonly customer: CustomersResource;
|
|
1371
|
+
readonly catalog: CatalogResource;
|
|
1339
1372
|
readonly categories: CategoriesResource;
|
|
1340
1373
|
readonly products: ProductsResource;
|
|
1341
1374
|
readonly addresses: AddressesResource;
|
|
@@ -24,7 +24,7 @@ class d {
|
|
|
24
24
|
return t.data;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
class
|
|
27
|
+
class q extends d {
|
|
28
28
|
async getArticleCategories(t) {
|
|
29
29
|
const e = this.getStoreUrl(t, "/articles/categories");
|
|
30
30
|
return this.getPaginatedResponse(await this.client.request("GET", e));
|
|
@@ -42,7 +42,13 @@ class S extends d {
|
|
|
42
42
|
return this.getResponse(await this.client.request("GET", n));
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
class
|
|
45
|
+
class S extends d {
|
|
46
|
+
async getCatalog(t) {
|
|
47
|
+
const e = this.getStoreUrl(t, "/catalog");
|
|
48
|
+
return this.getResponse(await this.client.request("GET", e));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
class A extends d {
|
|
46
52
|
async getCategories(t, e) {
|
|
47
53
|
const s = this.getStoreUrl(t, "/categories", e);
|
|
48
54
|
return this.getPaginatedResponse(await this.client.request("GET", s));
|
|
@@ -71,7 +77,7 @@ class E extends Error {
|
|
|
71
77
|
this.err = s;
|
|
72
78
|
}
|
|
73
79
|
}
|
|
74
|
-
class
|
|
80
|
+
class b {
|
|
75
81
|
static async build(t) {
|
|
76
82
|
const e = await t.json();
|
|
77
83
|
switch (t.status) {
|
|
@@ -139,10 +145,10 @@ class k {
|
|
|
139
145
|
const o = await this.fetchFunction.call(null, `${this.baseUrl}${e}`, a);
|
|
140
146
|
if (o.ok)
|
|
141
147
|
return o.status === 204 ? !0 : o.json();
|
|
142
|
-
throw await
|
|
148
|
+
throw await b.build(o);
|
|
143
149
|
}
|
|
144
150
|
}
|
|
145
|
-
class
|
|
151
|
+
class T extends d {
|
|
146
152
|
async getStore(t) {
|
|
147
153
|
const e = this.client.getUrl(`/store/${t}`);
|
|
148
154
|
return this.getResponse(await this.client.request("GET", e));
|
|
@@ -162,7 +168,7 @@ class _ extends d {
|
|
|
162
168
|
return this.getResponse(await this.client.request("GET", s));
|
|
163
169
|
}
|
|
164
170
|
}
|
|
165
|
-
class
|
|
171
|
+
class C extends d {
|
|
166
172
|
async getOffers(t, e) {
|
|
167
173
|
const s = this.getStoreUrl(t, "/offers", e);
|
|
168
174
|
return this.getPaginatedResponse(await this.client.request("GET", s));
|
|
@@ -172,7 +178,7 @@ class T extends d {
|
|
|
172
178
|
return this.getResponse(await this.client.request("GET", n));
|
|
173
179
|
}
|
|
174
180
|
}
|
|
175
|
-
class
|
|
181
|
+
class N extends d {
|
|
176
182
|
async createFeedback(t, e) {
|
|
177
183
|
const s = this.getStoreUrl(t, "/feedback", e);
|
|
178
184
|
return this.getResponse(await this.client.request("POST", s));
|
|
@@ -182,7 +188,7 @@ class C extends d {
|
|
|
182
188
|
return await this.client.request("POST", s), !0;
|
|
183
189
|
}
|
|
184
190
|
}
|
|
185
|
-
class
|
|
191
|
+
class $ extends d {
|
|
186
192
|
async getProducts(t, e) {
|
|
187
193
|
const s = this.getStoreUrl(t, "/products", e);
|
|
188
194
|
return this.getPaginatedResponse(await this.client.request("GET", s));
|
|
@@ -196,7 +202,7 @@ class N extends d {
|
|
|
196
202
|
return this.getResponse(await this.client.request("POST", i, n));
|
|
197
203
|
}
|
|
198
204
|
}
|
|
199
|
-
class
|
|
205
|
+
class G extends d {
|
|
200
206
|
getOrderUrl(t, e, s, n) {
|
|
201
207
|
const i = typeof e == "string" ? e : e.id, a = typeof e == "string" ? void 0 : e.token;
|
|
202
208
|
return this.getStoreUrl(t, `/orders/${i}${s}${a ? "?token=" + a : ""}`, n);
|
|
@@ -265,6 +271,22 @@ class $ extends d {
|
|
|
265
271
|
await this.client.request("POST", n, s, this.getApiToken(e))
|
|
266
272
|
);
|
|
267
273
|
}
|
|
274
|
+
async getOrderPromocode(t, e, s) {
|
|
275
|
+
const n = this.getOrderUrl(t, e, "/checkout/promocode");
|
|
276
|
+
return this.getResponse(
|
|
277
|
+
await this.client.request("GET", n, s, this.getApiToken(e))
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
async setOrderPromocode(t, e, s) {
|
|
281
|
+
const n = this.getOrderUrl(t, e, "/checkout/promocode");
|
|
282
|
+
return this.getResponse(
|
|
283
|
+
await this.client.request("POST", n, s, this.getApiToken(e))
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
async removeOrderPromocode(t, e) {
|
|
287
|
+
const s = this.getOrderUrl(t, e, "/checkout/promocode");
|
|
288
|
+
return await this.client.request("DELETE", s, null, this.getApiToken(e)), !0;
|
|
289
|
+
}
|
|
268
290
|
async getOrderBonusesPreview(t, e, s) {
|
|
269
291
|
const n = this.getOrderUrl(t, e, "/checkout/payments/bonuses", { amount: s });
|
|
270
292
|
return this.getResponse(
|
|
@@ -322,7 +344,7 @@ class $ extends d {
|
|
|
322
344
|
);
|
|
323
345
|
}
|
|
324
346
|
}
|
|
325
|
-
class
|
|
347
|
+
class D extends d {
|
|
326
348
|
async getAddressSuggestions(t, e) {
|
|
327
349
|
const s = this.getStoreUrl(t, "/suggestions/address");
|
|
328
350
|
return this.getResponse(await this.client.request("POST", s, e));
|
|
@@ -393,17 +415,17 @@ class V extends d {
|
|
|
393
415
|
@author Jacob Kelley <jakie8@gmail.com>
|
|
394
416
|
@license MIT
|
|
395
417
|
**/
|
|
396
|
-
var p = "application/x-postmate-v1+json",
|
|
418
|
+
var p = "application/x-postmate-v1+json", x = 5, I = 0, L = function() {
|
|
397
419
|
return ++I;
|
|
398
|
-
},
|
|
420
|
+
}, c = function() {
|
|
399
421
|
var t;
|
|
400
422
|
return g.debug ? (t = console).log.apply(t, arguments) : null;
|
|
401
|
-
},
|
|
423
|
+
}, M = function(t) {
|
|
402
424
|
var e = document.createElement("a");
|
|
403
425
|
e.href = t;
|
|
404
426
|
var s = e.protocol.length > 4 ? e.protocol : window.location.protocol, n = e.host.length ? e.port === "80" || e.port === "443" ? e.hostname : e.host : window.location.host;
|
|
405
427
|
return e.origin || s + "//" + n;
|
|
406
|
-
},
|
|
428
|
+
}, z = {
|
|
407
429
|
handshake: 1,
|
|
408
430
|
"handshake-reply": 1,
|
|
409
431
|
call: 1,
|
|
@@ -417,26 +439,26 @@ var p = "application/x-postmate-v1+json", D = 5, I = 0, x = function() {
|
|
|
417
439
|
* @return {Boolean}
|
|
418
440
|
*/
|
|
419
441
|
}, O = function(t, e) {
|
|
420
|
-
return !(typeof e == "string" && t.origin !== e || !t.data || typeof t.data == "object" && !("postmate" in t.data) || t.data.type !== p || !
|
|
421
|
-
},
|
|
442
|
+
return !(typeof e == "string" && t.origin !== e || !t.data || typeof t.data == "object" && !("postmate" in t.data) || t.data.type !== p || !z[t.data.postmate]);
|
|
443
|
+
}, j = function(t, e) {
|
|
422
444
|
var s = typeof t[e] == "function" ? t[e]() : t[e];
|
|
423
445
|
return g.Promise.resolve(s);
|
|
424
|
-
},
|
|
446
|
+
}, H = /* @__PURE__ */ function() {
|
|
425
447
|
function r(e) {
|
|
426
448
|
var s = this;
|
|
427
|
-
this.parent = e.parent, this.frame = e.frame, this.child = e.child, this.childOrigin = e.childOrigin, this.events = {}, process.env.NODE_ENV !== "production" && (
|
|
449
|
+
this.parent = e.parent, this.frame = e.frame, this.child = e.child, this.childOrigin = e.childOrigin, this.events = {}, process.env.NODE_ENV !== "production" && (c("Parent: Registering API"), c("Parent: Awaiting messages...")), this.listener = function(n) {
|
|
428
450
|
if (!O(n, s.childOrigin))
|
|
429
451
|
return !1;
|
|
430
452
|
var i = ((n || {}).data || {}).value || {}, a = i.data, o = i.name;
|
|
431
|
-
n.data.postmate === "emit" && (process.env.NODE_ENV !== "production" &&
|
|
432
|
-
}, this.parent.addEventListener("message", this.listener, !1), process.env.NODE_ENV !== "production" &&
|
|
453
|
+
n.data.postmate === "emit" && (process.env.NODE_ENV !== "production" && c("Parent: Received event emission: " + o), o in s.events && s.events[o].call(s, a));
|
|
454
|
+
}, this.parent.addEventListener("message", this.listener, !1), process.env.NODE_ENV !== "production" && c("Parent: Awaiting event emissions from Child");
|
|
433
455
|
}
|
|
434
456
|
var t = r.prototype;
|
|
435
457
|
return t.get = function(s) {
|
|
436
458
|
var n = this;
|
|
437
459
|
return new g.Promise(function(i) {
|
|
438
|
-
var a =
|
|
439
|
-
h.data.uid === a && h.data.postmate === "reply" && (n.parent.removeEventListener("message",
|
|
460
|
+
var a = L(), o = function u(h) {
|
|
461
|
+
h.data.uid === a && h.data.postmate === "reply" && (n.parent.removeEventListener("message", u, !1), i(h.data.value));
|
|
440
462
|
};
|
|
441
463
|
n.parent.addEventListener("message", o, !1), n.child.postMessage({
|
|
442
464
|
postmate: "request",
|
|
@@ -455,20 +477,20 @@ var p = "application/x-postmate-v1+json", D = 5, I = 0, x = function() {
|
|
|
455
477
|
}, t.on = function(s, n) {
|
|
456
478
|
this.events[s] = n;
|
|
457
479
|
}, t.destroy = function() {
|
|
458
|
-
process.env.NODE_ENV !== "production" &&
|
|
480
|
+
process.env.NODE_ENV !== "production" && c("Parent: Destroying Postmate instance"), window.removeEventListener("message", this.listener, !1), this.frame.parentNode.removeChild(this.frame);
|
|
459
481
|
}, r;
|
|
460
|
-
}(),
|
|
482
|
+
}(), F = /* @__PURE__ */ function() {
|
|
461
483
|
function r(e) {
|
|
462
484
|
var s = this;
|
|
463
|
-
this.model = e.model, this.parent = e.parent, this.parentOrigin = e.parentOrigin, this.child = e.child, process.env.NODE_ENV !== "production" && (
|
|
485
|
+
this.model = e.model, this.parent = e.parent, this.parentOrigin = e.parentOrigin, this.child = e.child, process.env.NODE_ENV !== "production" && (c("Child: Registering API"), c("Child: Awaiting messages...")), this.child.addEventListener("message", function(n) {
|
|
464
486
|
if (O(n, s.parentOrigin)) {
|
|
465
|
-
process.env.NODE_ENV !== "production" &&
|
|
466
|
-
var i = n.data, a = i.property, o = i.uid,
|
|
487
|
+
process.env.NODE_ENV !== "production" && c("Child: Received request", n.data);
|
|
488
|
+
var i = n.data, a = i.property, o = i.uid, u = i.data;
|
|
467
489
|
if (n.data.postmate === "call") {
|
|
468
|
-
a in s.model && typeof s.model[a] == "function" && s.model[a](
|
|
490
|
+
a in s.model && typeof s.model[a] == "function" && s.model[a](u);
|
|
469
491
|
return;
|
|
470
492
|
}
|
|
471
|
-
|
|
493
|
+
j(s.model, a).then(function(h) {
|
|
472
494
|
return n.source.postMessage({
|
|
473
495
|
property: a,
|
|
474
496
|
postmate: "reply",
|
|
@@ -482,7 +504,7 @@ var p = "application/x-postmate-v1+json", D = 5, I = 0, x = function() {
|
|
|
482
504
|
}
|
|
483
505
|
var t = r.prototype;
|
|
484
506
|
return t.emit = function(s, n) {
|
|
485
|
-
process.env.NODE_ENV !== "production" &&
|
|
507
|
+
process.env.NODE_ENV !== "production" && c('Child: Emitting Event "' + s + '"', n), this.parent.postMessage({
|
|
486
508
|
postmate: "emit",
|
|
487
509
|
type: p,
|
|
488
510
|
value: {
|
|
@@ -493,29 +515,29 @@ var p = "application/x-postmate-v1+json", D = 5, I = 0, x = function() {
|
|
|
493
515
|
}, r;
|
|
494
516
|
}(), g = /* @__PURE__ */ function() {
|
|
495
517
|
function r(e) {
|
|
496
|
-
var s = e.container, n = s === void 0 ? typeof n < "u" ? n : document.body : s, i = e.model, a = e.url, o = e.name,
|
|
518
|
+
var s = e.container, n = s === void 0 ? typeof n < "u" ? n : document.body : s, i = e.model, a = e.url, o = e.name, u = e.classListArray, h = u === void 0 ? [] : u;
|
|
497
519
|
return this.parent = window, this.frame = document.createElement("iframe"), this.frame.name = o || "", this.frame.classList.add.apply(this.frame.classList, h), n.appendChild(this.frame), this.child = this.frame.contentWindow || this.frame.contentDocument.parentWindow, this.model = i || {}, this.sendHandshake(a);
|
|
498
520
|
}
|
|
499
521
|
var t = r.prototype;
|
|
500
522
|
return t.sendHandshake = function(s) {
|
|
501
|
-
var n = this, i =
|
|
502
|
-
return new r.Promise(function(
|
|
523
|
+
var n = this, i = M(s), a = 0, o;
|
|
524
|
+
return new r.Promise(function(u, h) {
|
|
503
525
|
var m = function v(y) {
|
|
504
|
-
return O(y, i) ? y.data.postmate === "handshake-reply" ? (clearInterval(o), process.env.NODE_ENV !== "production" &&
|
|
526
|
+
return O(y, i) ? y.data.postmate === "handshake-reply" ? (clearInterval(o), process.env.NODE_ENV !== "production" && c("Parent: Received handshake reply from Child"), n.parent.removeEventListener("message", v, !1), n.childOrigin = y.origin, process.env.NODE_ENV !== "production" && c("Parent: Saving Child origin", n.childOrigin), u(new H(n))) : (process.env.NODE_ENV !== "production" && c("Parent: Invalid handshake reply"), h("Failed handshake")) : !1;
|
|
505
527
|
};
|
|
506
528
|
n.parent.addEventListener("message", m, !1);
|
|
507
529
|
var f = function() {
|
|
508
|
-
a++, process.env.NODE_ENV !== "production" &&
|
|
530
|
+
a++, process.env.NODE_ENV !== "production" && c("Parent: Sending handshake attempt " + a, {
|
|
509
531
|
childOrigin: i
|
|
510
532
|
}), n.child.postMessage({
|
|
511
533
|
postmate: "handshake",
|
|
512
534
|
type: p,
|
|
513
535
|
model: n.model
|
|
514
|
-
}, i), a ===
|
|
536
|
+
}, i), a === x && clearInterval(o);
|
|
515
537
|
}, w = function() {
|
|
516
538
|
f(), o = setInterval(f, 500);
|
|
517
539
|
};
|
|
518
|
-
n.frame.attachEvent ? n.frame.attachEvent("onload", w) : n.frame.onload = w, process.env.NODE_ENV !== "production" &&
|
|
540
|
+
n.frame.attachEvent ? n.frame.attachEvent("onload", w) : n.frame.onload = w, process.env.NODE_ENV !== "production" && c("Parent: Loading frame", {
|
|
519
541
|
url: s
|
|
520
542
|
}), n.frame.src = s;
|
|
521
543
|
});
|
|
@@ -537,17 +559,17 @@ g.Model = /* @__PURE__ */ function() {
|
|
|
537
559
|
return t.sendHandshakeReply = function() {
|
|
538
560
|
var s = this;
|
|
539
561
|
return new g.Promise(function(n, i) {
|
|
540
|
-
var a = function o(
|
|
541
|
-
if (
|
|
542
|
-
if (
|
|
543
|
-
process.env.NODE_ENV !== "production" &&
|
|
562
|
+
var a = function o(u) {
|
|
563
|
+
if (u.data.postmate) {
|
|
564
|
+
if (u.data.postmate === "handshake") {
|
|
565
|
+
process.env.NODE_ENV !== "production" && c("Child: Received handshake from Parent"), s.child.removeEventListener("message", o, !1), process.env.NODE_ENV !== "production" && c("Child: Sending handshake reply to Parent"), u.source.postMessage({
|
|
544
566
|
postmate: "handshake-reply",
|
|
545
567
|
type: p
|
|
546
|
-
},
|
|
547
|
-
var h =
|
|
568
|
+
}, u.origin), s.parentOrigin = u.origin;
|
|
569
|
+
var h = u.data.model;
|
|
548
570
|
return h && (Object.keys(h).forEach(function(m) {
|
|
549
571
|
s.model[m] = h[m];
|
|
550
|
-
}), process.env.NODE_ENV !== "production" &&
|
|
572
|
+
}), process.env.NODE_ENV !== "production" && c("Child: Inherited and extended model from Parent")), process.env.NODE_ENV !== "production" && c("Child: Saving Parent origin", s.parentOrigin), n(new F(s));
|
|
551
573
|
}
|
|
552
574
|
return i("Handshake Reply Failed");
|
|
553
575
|
}
|
|
@@ -556,7 +578,7 @@ g.Model = /* @__PURE__ */ function() {
|
|
|
556
578
|
});
|
|
557
579
|
}, r;
|
|
558
580
|
}();
|
|
559
|
-
class
|
|
581
|
+
class W extends d {
|
|
560
582
|
async checkPhone(t, e) {
|
|
561
583
|
const s = this.getStoreUrl(t, "/auth/check");
|
|
562
584
|
return this.getResponse(await this.client.request("POST", s, e));
|
|
@@ -607,12 +629,13 @@ class F extends d {
|
|
|
607
629
|
};
|
|
608
630
|
}
|
|
609
631
|
}
|
|
610
|
-
class
|
|
632
|
+
class Oe {
|
|
611
633
|
constructor(t, e) {
|
|
612
634
|
l(this, "client");
|
|
613
635
|
l(this, "store");
|
|
614
636
|
l(this, "auth");
|
|
615
637
|
l(this, "customer");
|
|
638
|
+
l(this, "catalog");
|
|
616
639
|
l(this, "categories");
|
|
617
640
|
l(this, "products");
|
|
618
641
|
l(this, "addresses");
|
|
@@ -622,51 +645,52 @@ class ke {
|
|
|
622
645
|
l(this, "articles");
|
|
623
646
|
l(this, "feedback");
|
|
624
647
|
const s = k.build(t, e);
|
|
625
|
-
this.store = new
|
|
648
|
+
this.store = new T(s), this.auth = new W(s), this.customer = new V(s), this.catalog = new S(s), this.categories = new A(s), this.products = new $(s), this.addresses = new D(s), this.orders = new G(s), this.collections = new _(s), this.offers = new C(s), this.articles = new q(s), this.feedback = new N(s), this.client = s;
|
|
626
649
|
}
|
|
627
650
|
setApiToken(t) {
|
|
628
651
|
return this.client.setToken(t), this;
|
|
629
652
|
}
|
|
630
653
|
}
|
|
631
|
-
var
|
|
654
|
+
var Z = /* @__PURE__ */ ((r) => (r.Female = "female", r.Male = "male", r.Other = "other", r))(Z || {}), J = /* @__PURE__ */ ((r) => (r.CloudPayments = "cloudpayments", r))(J || {}), X = /* @__PURE__ */ ((r) => (r.Visa = "visa", r.MasterCard = "master-card", r.MIR = "mir", r.Maestro = "maestro", r.AmericanExpress = "american-express", r.DinersClub = "diners-club", r.Discover = "discover", r.JCB = "jcb", r.UnionPay = "union-pay", r))(X || {}), B = /* @__PURE__ */ ((r) => (r.Select = "select", r.MutipleSelect = "mutiple_select", r.Checkboxes = "checkboxes", r.Radios = "radios", r.Range = "range", r.Text = "text", r))(B || {}), Y = /* @__PURE__ */ ((r) => (r.Integer = "integer", r.Float = "float", r))(Y || {}), Q = /* @__PURE__ */ ((r) => (r.Increase = "increase", r.Decrease = "decrease", r))(Q || {}), K = /* @__PURE__ */ ((r) => (r.Pending = "pending", r.Confirmed = "confirmed", r.Cancelled = "cancelled", r.Rejected = "rejected", r.Refunded = "refunded", r.PartiallyRefunded = "partially_refunded", r))(K || {}), ee = /* @__PURE__ */ ((r) => (r.Manual = "manual", r.Cashback = "cashback", r.ReferralReward = "referral_reward", r.RecruitReward = "recruit_reward", r.Payment = "payment", r.Cancellation = "cancellation", r.Refund = "refund", r.Adjustment = "adjustment", r.WelcomeBonuses = "welcome_bonuses", r.PromotionReward = "promotion_reward", r.External = "external", r))(ee || {}), te = /* @__PURE__ */ ((r) => (r.Delivery = "delivery", r.Pickup = "pickup", r.OnPremise = "on_premise", r))(te || {}), re = /* @__PURE__ */ ((r) => (r.Payment = "payment", r.Refund = "refund", r))(re || {}), se = /* @__PURE__ */ ((r) => (r.Cash = "cash", r.CreditCard = "credit-card", r.CloudPayments = "cloudpayments", r.CardToken = "card_token", r.Bonuses = "bonuses", r))(se || {}), ne = /* @__PURE__ */ ((r) => (r.Pending = "pending", r.Confirmed = "confirmed", r.Cancelled = "cancelled", r.PendingRefund = "pending_refund", r.Refunding = "refunding", r.Refunded = "refunded", r))(ne || {}), ie = /* @__PURE__ */ ((r) => (r.Auth = "auth", r.Charge = "charge", r))(ie || {}), ae = /* @__PURE__ */ ((r) => (r.PersonsCount = "persons_count", r.DeliveryTime = "delivery_time", r.DeliveryIntervals = "delivery_intervals", r))(ae || {}), oe = /* @__PURE__ */ ((r) => (r.PriceMismatch = "price_mismatch", r.OutOfStock = "out_of_stock", r.Unavailable = "unavailable", r))(oe || {}), le = /* @__PURE__ */ ((r) => (r.None = "none", r.Cleanup = "cleanup", r))(le || {}), ce = /* @__PURE__ */ ((r) => (r.Piece = "piece", r.Gram = "gram", r.Kilogram = "kilogram", r.Meter = "meter", r))(ce || {}), ue = /* @__PURE__ */ ((r) => (r.Weight = "weight", r.Width = "width", r.Height = "height", r.Length = "length", r))(ue || {}), he = /* @__PURE__ */ ((r) => (r.Netto = "netto", r.Brutto = "brutto", r))(he || {}), de = /* @__PURE__ */ ((r) => (r.Color = "color", r))(de || {}), ge = /* @__PURE__ */ ((r) => (r.Category = "category", r.Group = "group", r.VariantOption = "variant_option", r.VariantOptionValue = "variant_option_value", r))(ge || {}), pe = /* @__PURE__ */ ((r) => (r.Amount = "amount", r.Percentage = "percentage", r))(pe || {}), me = /* @__PURE__ */ ((r) => (r.Email = "email", r.Website = "website", r.Vk = "vk", r.Facebook = "facebook", r.Instagram = "instagram", r.Twitter = "twitter", r.Ok = "ok", r.Tiktok = "tiktok", r))(me || {}), ve = /* @__PURE__ */ ((r) => (r.Yes = "yes", r.No = "no", r.Both = "both", r))(ve || {}), fe = /* @__PURE__ */ ((r) => (r.Disabled = "disabled", r.Preauth = "preauth", r.Confirmation = "confirmation", r))(fe || {}), we = /* @__PURE__ */ ((r) => (r.Dadata = "dadata", r.Manual = "manual", r))(we || {}), ye = /* @__PURE__ */ ((r) => (r.Registration = "registration", r.ResendRegistrationCode = "resend_registration_code", r.ResetPassword = "reset_password", r.OrderSubmission = "order_submission", r.FeedbackRequest = "feedback_request", r.CallbackRequest = "callback_request", r))(ye || {});
|
|
632
655
|
export {
|
|
633
|
-
|
|
656
|
+
J as AcquiringType,
|
|
634
657
|
U as AddressSuggestionsProvider,
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
658
|
+
we as AddressesProvider,
|
|
659
|
+
q as ArticlesResource,
|
|
660
|
+
ee as BonusesTransactionReason,
|
|
661
|
+
K as BonusesTransactionStatus,
|
|
662
|
+
Q as BonusesTransactionType,
|
|
663
|
+
S as CatalogResource,
|
|
664
|
+
A as CategoriesResource,
|
|
665
|
+
ie as CloudpaymentsChargeType,
|
|
642
666
|
_ as CollectionsResource,
|
|
643
|
-
|
|
644
|
-
|
|
667
|
+
me as ContactType,
|
|
668
|
+
te as DeliveryMethod,
|
|
645
669
|
ue as Dimension,
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
670
|
+
he as DimensionType,
|
|
671
|
+
pe as DiscountType,
|
|
672
|
+
Y as FeatureRange,
|
|
673
|
+
B as FeatureType,
|
|
674
|
+
N as FeedbackResource,
|
|
675
|
+
Z as Gender,
|
|
676
|
+
C as OffersResource,
|
|
677
|
+
fe as OrderAuthenticationMethod,
|
|
678
|
+
le as OrderCartCheckerResultAction,
|
|
679
|
+
oe as OrderCartCheckerResultReason,
|
|
680
|
+
ae as OrderOptionKind,
|
|
681
|
+
ne as OrderPaymentTransactionStatus,
|
|
682
|
+
re as OrderPaymentTransactionType,
|
|
683
|
+
G as OrdersResource,
|
|
684
|
+
se as PaymentMethod,
|
|
685
|
+
X as PaymentSystemType,
|
|
686
|
+
ge as ProductContextType,
|
|
687
|
+
$ as ProductsResource,
|
|
688
|
+
ye as RecaptchaAction,
|
|
689
|
+
T as StoreResource,
|
|
690
|
+
ve as TernaryFilter,
|
|
691
|
+
ce as UnitType,
|
|
692
|
+
de as VariantOptionType,
|
|
669
693
|
E as ZenkyError,
|
|
670
|
-
|
|
671
|
-
|
|
694
|
+
b as ZenkyErrorBuilder,
|
|
695
|
+
Oe as ZenkyStorefront
|
|
672
696
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(function(i,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(i=typeof globalThis<"u"?globalThis:i||self,g(i.zenkyStorefrontApi={}))})(this,function(i){"use strict";var we=Object.defineProperty;var ke=(i,g,h)=>g in i?we(i,g,{enumerable:!0,configurable:!0,writable:!0,value:h}):i[g]=h;var u=(i,g,h)=>(ke(i,typeof g!="symbol"?g+"":g,h),h);var g=(r=>(r.DADATA="dadata",r))(g||{});class h{constructor(t){this.client=t}getStoreUrl(t,e,s={}){return this.client.getStoreUrl(t,e,s)}getPaginatedResponse(t){if(!t||!Array.isArray(t.data)||!t.meta||!t.meta.pagination)throw new Error("getPaginatedResponse(): Invalid response.");const e=t.data,s=t.meta.pagination;return{items:e,pagination:s}}getResponse(t){if(!t||!t.data)throw new Error("getResponse(): Invalid response.");return t.data}}class U extends h{async getArticleCategories(t){const e=this.getStoreUrl(t,"/articles/categories");return this.getPaginatedResponse(await this.client.request("GET",e))}async getArticleCategory(t,e){const s=this.getStoreUrl(t,`/articles/categories/${e}`);return this.getResponse(await this.client.request("GET",s))}async getArticles(t,e){const s=this.getStoreUrl(t,"/articles",e);return this.getPaginatedResponse(await this.client.request("GET",s))}async getArticle(t,e,s){const n=this.getStoreUrl(t,`/articles/${e}`,s);return this.getResponse(await this.client.request("GET",n))}}class S extends h{async getCategories(t,e){const s=this.getStoreUrl(t,"/categories",e);return this.getPaginatedResponse(await this.client.request("GET",s))}async getCategoriesTree(t,e){const s=this.getStoreUrl(t,"/categories/tree",e);return this.getResponse(await this.client.request("GET",s))}async getCategory(t,e,s){const n=this.getStoreUrl(t,`/categories/${e}`,s);return this.getResponse(await this.client.request("GET",n))}async getFeaturesGroups(t,e){const s=this.getStoreUrl(t,`/categories/${e}/features/groups`);return this.getResponse(await this.client.request("GET",s))}async getFeatures(t,e){const s=this.getStoreUrl(t,`/categories/${e}/features`);return this.getResponse(await this.client.request("GET",s))}}class O extends Error{constructor(e,s){super(e);u(this,"err");this.err=s}}class q{static async build(t){const e=await t.json();switch(t.status){case 401:return new O((e==null?void 0:e.message)??"Unauthenticated.",null);default:return new O(e==null?void 0:e.message,(e==null?void 0:e.error)||null)}}}class R{constructor(t,e,s,n,a,o,l){u(this,"baseUrl");u(this,"baseAuthUrl");u(this,"token");u(this,"client");u(this,"timezone");u(this,"fetchFunction");u(this,"fetchOptions");this.baseUrl=t,this.baseAuthUrl=e,this.token=s,this.client=n,this.timezone=a,this.fetchFunction=typeof o=="function"?o:fetch,this.fetchOptions=typeof l<"u"?l:{}}static build(t,e){return new R((t==null?void 0:t.baseUrl)||"https://storefront.zenky.io/v1",(t==null?void 0:t.baseAuthUrl)||"https://auth.zenky.io/",(t==null?void 0:t.token)||null,(t==null?void 0:t.client)||"web",(t==null?void 0:t.timezone)||"UTC",e,t==null?void 0:t.fetchOptions)}setToken(t){return this.token=t,this}getBaseAuthUrl(){return this.baseAuthUrl}getStoreUrl(t,e,s={}){return this.getUrl(`/store/${t}${e}`,s)}getUrl(t,e={}){if(!Object.keys(e).length)return t;const s=[];Object.keys(e).forEach(a=>{s.push(`${a}=${e[a]}`)});const n=t.includes("?")?"&":"?";return`${t}${n}${s.join("&")}`}async request(t,e,s,n){const a={Accept:"application/json","X-Zenky-Client":this.client,"X-Timezone":this.timezone};n?a.Authorization=`Bearer ${n}`:this.token&&(a.Authorization=`Bearer ${this.token}`);const o={method:t,mode:"cors",...this.fetchOptions};s&&(a["Content-Type"]="application/json",o.body=JSON.stringify(s)),o.headers=a;const l=await this.fetchFunction.call(null,`${this.baseUrl}${e}`,o);if(l.ok)return l.status===204?!0:l.json();throw await q.build(l)}}class T extends h{async getStore(t){const e=this.client.getUrl(`/store/${t}`);return this.getResponse(await this.client.request("GET",e))}async getStoreByBundleId(t){const e=this.client.getUrl(`/store/by-bundle/${t}`);return this.getResponse(await this.client.request("GET",e))}}class A extends h{async getCollections(t,e){const s=this.getStoreUrl(t,"/collections",e);return this.getPaginatedResponse(await this.client.request("GET",s))}async getCollection(t,e){const s=this.getStoreUrl(t,`/collections/${e}`);return this.getResponse(await this.client.request("GET",s))}}class b extends h{async getOffers(t,e){const s=this.getStoreUrl(t,"/offers",e);return this.getPaginatedResponse(await this.client.request("GET",s))}async getOffer(t,e,s){const n=this.getStoreUrl(t,`/offers/${e}`,s);return this.getResponse(await this.client.request("GET",n))}}class _ extends h{async createFeedback(t,e){const s=this.getStoreUrl(t,"/feedback",e);return this.getResponse(await this.client.request("POST",s))}async createCallback(t,e){const s=this.getStoreUrl(t,"/callback",e);return await this.client.request("POST",s),!0}}class C extends h{async getProducts(t,e){const s=this.getStoreUrl(t,"/products",e);return this.getPaginatedResponse(await this.client.request("GET",s))}async getProduct(t,e,s){const n=this.getStoreUrl(t,`/products/${e}`,s);return this.getResponse(await this.client.request("GET",n))}async getProductVariantPrice(t,e,s,n){const a=this.getStoreUrl(t,`/products/${e}/variants/${s}/price`);return this.getResponse(await this.client.request("POST",a,n))}}class N extends h{getOrderUrl(t,e,s,n){const a=typeof e=="string"?e:e.id,o=typeof e=="string"?void 0:e.token;return this.getStoreUrl(t,`/orders/${a}${s}${o?"?token="+o:""}`,n)}getApiToken(t){if(!(typeof t=="string"||typeof t.api_token>"u"))return t.api_token}async getOrders(t,e,s){const n=this.getStoreUrl(t,"/orders",e);return this.getPaginatedResponse(await this.client.request("GET",n,void 0,s))}async createOrder(t,e,s){const n=this.getStoreUrl(t,"/orders");return this.getResponse(await this.client.request("POST",n,e,s))}async getOrder(t,e,s){const n=this.getOrderUrl(t,e,"",s);return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOrderSettings(t,e){const s=this.getOrderUrl(t,e,"/settings");return this.getResponse(await this.client.request("GET",s,void 0,this.getApiToken(e)))}async addProductVariantToOrder(t,e,s){const n=this.getOrderUrl(t,e,"/products");return this.getResponse(await this.client.request("POST",n,s,this.getApiToken(e)))}async removeProductVariantFromOrder(t,e,s){const n=this.getOrderUrl(t,e,"/products/remove");return this.getResponse(await this.client.request("POST",n,s,this.getApiToken(e)))}async checkProducts(t,e){const s=this.getOrderUrl(t,e,"/products/check");return this.getResponse(await this.client.request("POST",s,void 0,this.getApiToken(e)))}async getOrderCheckoutUrl(t,e,s){const n=this.getOrderUrl(t,e,"/checkout/url");return this.getResponse(await this.client.request("POST",n,{redirect_url:s},this.getApiToken(e))).url}async setOrderCustomer(t,e,s){const n=this.getOrderUrl(t,e,"/checkout/customer");return await this.client.request("POST",n,s,this.getApiToken(e)),!0}async setOrderDeliveryMethod(t,e,s){const n=this.getOrderUrl(t,e,"/checkout/delivery");return this.getResponse(await this.client.request("POST",n,s,this.getApiToken(e)))}async setOrderPayments(t,e,s){const n=this.getOrderUrl(t,e,"/checkout/payments");return this.getResponse(await this.client.request("POST",n,s,this.getApiToken(e)))}async getOrderBonusesPreview(t,e,s){const n=this.getOrderUrl(t,e,"/checkout/payments/bonuses",{amount:s});return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOrderTotal(t,e){const s=this.getOrderUrl(t,e,"/checkout/total");return this.getResponse(await this.client.request("GET",s,void 0,this.getApiToken(e)))}async checkoutOrder(t,e,s){const n=this.getOrderUrl(t,e,"/checkout");return this.getResponse(await this.client.request("POST",n,s,this.getApiToken(e)))}async confirmOrder(t,e,s){const n=this.getOrderUrl(t,e,"/confirm");return await this.client.request("POST",n,s,this.getApiToken(e)),!0}async resendOrderConfirmationCode(t,e){const s=this.getOrderUrl(t,e,"/confirm/resend");return await this.client.request("POST",s,void 0,this.getApiToken(e)),!0}async getOrderBonusesTransactions(t,e,s){const n=this.getOrderUrl(t,e,"/loyalty/transactions",s);return this.getPaginatedResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOrderCashbackTransaction(t,e){const s=this.getOrderUrl(t,e,"/loyalty/transactions/cashback");return this.getResponse(await this.client.request("GET",s,void 0,this.getApiToken(e)))}async dispatchPromotionsChecker(t,e){const s=this.getOrderUrl(t,e,"/loyalty/promotions/check");return this.getResponse(await this.client.request("POST",s,void 0,this.getApiToken(e))).dispatched}async getOrderPromotionRewards(t,e){const s=this.getOrderUrl(t,e,"/loyalty/promotions/rewards");return this.getResponse(await this.client.request("GET",s,void 0,this.getApiToken(e)))}async getCloudpaymentsReceipt(t,e,s){const n=this.getOrderUrl(t,e,`/payments/${s}/receipt`);return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}}class oe extends h{async getAddressSuggestions(t,e){const s=this.getStoreUrl(t,"/suggestions/address");return this.getResponse(await this.client.request("POST",s,e))}}class le extends h{async getProfile(t,e,s){const n=this.getStoreUrl(t,"/me",e);return this.getResponse(await this.client.request("GET",n,null,s))}async updateProfile(t,e,s){const n=this.getStoreUrl(t,"/me");return this.getResponse(await this.client.request("PUT",n,e,s))}async removeProfile(t,e,s){const n=this.getStoreUrl(t,"/me");return await this.client.request("DELETE",n,e,s),!0}async getSettings(t,e){const s=this.getStoreUrl(t,"/me/settings");return this.getResponse(await this.client.request("GET",s,null,e))}async updateSettings(t,e,s){const n=this.getStoreUrl(t,"/me/settings");return this.getResponse(await this.client.request("PUT",n,e,s))}async getAddresses(t,e,s){const n=this.getStoreUrl(t,"/me/addresses",e);return this.getPaginatedResponse(await this.client.request("GET",n,null,s))}async createAddress(t,e,s){const n=this.getStoreUrl(t,"/me/addresses");return this.getResponse(await this.client.request("POST",n,e,s))}async updateAddress(t,e,s,n){const a=this.getStoreUrl(t,`/me/addresses/${e}`);return this.getResponse(await this.client.request("PUT",a,s,n))}async deleteAddress(t,e,s){const n=this.getStoreUrl(t,`/me/addresses/${e}`);return await this.client.request("DELETE",n,null,s),!0}async getPaymentMethods(t,e,s){const n=this.getStoreUrl(t,"/me/payment-methods",e);return this.getPaginatedResponse(await this.client.request("GET",n,null,s))}async deletePaymentMethod(t,e,s){const n=this.getStoreUrl(t,`/me/payment-methods/${e}`);return await this.client.request("DELETE",n,null,s),!0}async getBonusesTransactions(t,e,s){const n=this.getStoreUrl(t,"/me/loyalty/transactions",e);return this.getPaginatedResponse(await this.client.request("GET",n,null,s))}async getBonusesBalance(t,e){const s=this.getStoreUrl(t,"/me/loyalty/balance");return this.getResponse(await this.client.request("GET",s,null,e))}async revokeToken(t,e){const s=this.getStoreUrl(t,"/me/logout");return await this.client.request("POST",s,null,e),!0}}/**
|
|
1
|
+
(function(i,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(i=typeof globalThis<"u"?globalThis:i||self,g(i.zenkyStorefrontApi={}))})(this,function(i){"use strict";var ke=Object.defineProperty;var Oe=(i,g,u)=>g in i?ke(i,g,{enumerable:!0,configurable:!0,writable:!0,value:u}):i[g]=u;var c=(i,g,u)=>(Oe(i,typeof g!="symbol"?g+"":g,u),u);var g=(s=>(s.DADATA="dadata",s))(g||{});class u{constructor(t){this.client=t}getStoreUrl(t,e,r={}){return this.client.getStoreUrl(t,e,r)}getPaginatedResponse(t){if(!t||!Array.isArray(t.data)||!t.meta||!t.meta.pagination)throw new Error("getPaginatedResponse(): Invalid response.");const e=t.data,r=t.meta.pagination;return{items:e,pagination:r}}getResponse(t){if(!t||!t.data)throw new Error("getResponse(): Invalid response.");return t.data}}class U extends u{async getArticleCategories(t){const e=this.getStoreUrl(t,"/articles/categories");return this.getPaginatedResponse(await this.client.request("GET",e))}async getArticleCategory(t,e){const r=this.getStoreUrl(t,`/articles/categories/${e}`);return this.getResponse(await this.client.request("GET",r))}async getArticles(t,e){const r=this.getStoreUrl(t,"/articles",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getArticle(t,e,r){const n=this.getStoreUrl(t,`/articles/${e}`,r);return this.getResponse(await this.client.request("GET",n))}}class S extends u{async getCatalog(t){const e=this.getStoreUrl(t,"/catalog");return this.getResponse(await this.client.request("GET",e))}}class q extends u{async getCategories(t,e){const r=this.getStoreUrl(t,"/categories",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getCategoriesTree(t,e){const r=this.getStoreUrl(t,"/categories/tree",e);return this.getResponse(await this.client.request("GET",r))}async getCategory(t,e,r){const n=this.getStoreUrl(t,`/categories/${e}`,r);return this.getResponse(await this.client.request("GET",n))}async getFeaturesGroups(t,e){const r=this.getStoreUrl(t,`/categories/${e}/features/groups`);return this.getResponse(await this.client.request("GET",r))}async getFeatures(t,e){const r=this.getStoreUrl(t,`/categories/${e}/features`);return this.getResponse(await this.client.request("GET",r))}}class O extends Error{constructor(e,r){super(e);c(this,"err");this.err=r}}class T{static async build(t){const e=await t.json();switch(t.status){case 401:return new O((e==null?void 0:e.message)??"Unauthenticated.",null);default:return new O(e==null?void 0:e.message,(e==null?void 0:e.error)||null)}}}class R{constructor(t,e,r,n,a,o,l){c(this,"baseUrl");c(this,"baseAuthUrl");c(this,"token");c(this,"client");c(this,"timezone");c(this,"fetchFunction");c(this,"fetchOptions");this.baseUrl=t,this.baseAuthUrl=e,this.token=r,this.client=n,this.timezone=a,this.fetchFunction=typeof o=="function"?o:fetch,this.fetchOptions=typeof l<"u"?l:{}}static build(t,e){return new R((t==null?void 0:t.baseUrl)||"https://storefront.zenky.io/v1",(t==null?void 0:t.baseAuthUrl)||"https://auth.zenky.io/",(t==null?void 0:t.token)||null,(t==null?void 0:t.client)||"web",(t==null?void 0:t.timezone)||"UTC",e,t==null?void 0:t.fetchOptions)}setToken(t){return this.token=t,this}getBaseAuthUrl(){return this.baseAuthUrl}getStoreUrl(t,e,r={}){return this.getUrl(`/store/${t}${e}`,r)}getUrl(t,e={}){if(!Object.keys(e).length)return t;const r=[];Object.keys(e).forEach(a=>{r.push(`${a}=${e[a]}`)});const n=t.includes("?")?"&":"?";return`${t}${n}${r.join("&")}`}async request(t,e,r,n){const a={Accept:"application/json","X-Zenky-Client":this.client,"X-Timezone":this.timezone};n?a.Authorization=`Bearer ${n}`:this.token&&(a.Authorization=`Bearer ${this.token}`);const o={method:t,mode:"cors",...this.fetchOptions};r&&(a["Content-Type"]="application/json",o.body=JSON.stringify(r)),o.headers=a;const l=await this.fetchFunction.call(null,`${this.baseUrl}${e}`,o);if(l.ok)return l.status===204?!0:l.json();throw await T.build(l)}}class A extends u{async getStore(t){const e=this.client.getUrl(`/store/${t}`);return this.getResponse(await this.client.request("GET",e))}async getStoreByBundleId(t){const e=this.client.getUrl(`/store/by-bundle/${t}`);return this.getResponse(await this.client.request("GET",e))}}class b extends u{async getCollections(t,e){const r=this.getStoreUrl(t,"/collections",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getCollection(t,e){const r=this.getStoreUrl(t,`/collections/${e}`);return this.getResponse(await this.client.request("GET",r))}}class _ extends u{async getOffers(t,e){const r=this.getStoreUrl(t,"/offers",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getOffer(t,e,r){const n=this.getStoreUrl(t,`/offers/${e}`,r);return this.getResponse(await this.client.request("GET",n))}}class C extends u{async createFeedback(t,e){const r=this.getStoreUrl(t,"/feedback",e);return this.getResponse(await this.client.request("POST",r))}async createCallback(t,e){const r=this.getStoreUrl(t,"/callback",e);return await this.client.request("POST",r),!0}}class N extends u{async getProducts(t,e){const r=this.getStoreUrl(t,"/products",e);return this.getPaginatedResponse(await this.client.request("GET",r))}async getProduct(t,e,r){const n=this.getStoreUrl(t,`/products/${e}`,r);return this.getResponse(await this.client.request("GET",n))}async getProductVariantPrice(t,e,r,n){const a=this.getStoreUrl(t,`/products/${e}/variants/${r}/price`);return this.getResponse(await this.client.request("POST",a,n))}}class G extends u{getOrderUrl(t,e,r,n){const a=typeof e=="string"?e:e.id,o=typeof e=="string"?void 0:e.token;return this.getStoreUrl(t,`/orders/${a}${r}${o?"?token="+o:""}`,n)}getApiToken(t){if(!(typeof t=="string"||typeof t.api_token>"u"))return t.api_token}async getOrders(t,e,r){const n=this.getStoreUrl(t,"/orders",e);return this.getPaginatedResponse(await this.client.request("GET",n,void 0,r))}async createOrder(t,e,r){const n=this.getStoreUrl(t,"/orders");return this.getResponse(await this.client.request("POST",n,e,r))}async getOrder(t,e,r){const n=this.getOrderUrl(t,e,"",r);return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOrderSettings(t,e){const r=this.getOrderUrl(t,e,"/settings");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async addProductVariantToOrder(t,e,r){const n=this.getOrderUrl(t,e,"/products");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async removeProductVariantFromOrder(t,e,r){const n=this.getOrderUrl(t,e,"/products/remove");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async checkProducts(t,e){const r=this.getOrderUrl(t,e,"/products/check");return this.getResponse(await this.client.request("POST",r,void 0,this.getApiToken(e)))}async getOrderCheckoutUrl(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/url");return this.getResponse(await this.client.request("POST",n,{redirect_url:r},this.getApiToken(e))).url}async setOrderCustomer(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/customer");return await this.client.request("POST",n,r,this.getApiToken(e)),!0}async setOrderDeliveryMethod(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/delivery");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async setOrderPayments(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/payments");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async getOrderPromocode(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/promocode");return this.getResponse(await this.client.request("GET",n,r,this.getApiToken(e)))}async setOrderPromocode(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/promocode");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async removeOrderPromocode(t,e){const r=this.getOrderUrl(t,e,"/checkout/promocode");return await this.client.request("DELETE",r,null,this.getApiToken(e)),!0}async getOrderBonusesPreview(t,e,r){const n=this.getOrderUrl(t,e,"/checkout/payments/bonuses",{amount:r});return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOrderTotal(t,e){const r=this.getOrderUrl(t,e,"/checkout/total");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async checkoutOrder(t,e,r){const n=this.getOrderUrl(t,e,"/checkout");return this.getResponse(await this.client.request("POST",n,r,this.getApiToken(e)))}async confirmOrder(t,e,r){const n=this.getOrderUrl(t,e,"/confirm");return await this.client.request("POST",n,r,this.getApiToken(e)),!0}async resendOrderConfirmationCode(t,e){const r=this.getOrderUrl(t,e,"/confirm/resend");return await this.client.request("POST",r,void 0,this.getApiToken(e)),!0}async getOrderBonusesTransactions(t,e,r){const n=this.getOrderUrl(t,e,"/loyalty/transactions",r);return this.getPaginatedResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}async getOrderCashbackTransaction(t,e){const r=this.getOrderUrl(t,e,"/loyalty/transactions/cashback");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async dispatchPromotionsChecker(t,e){const r=this.getOrderUrl(t,e,"/loyalty/promotions/check");return this.getResponse(await this.client.request("POST",r,void 0,this.getApiToken(e))).dispatched}async getOrderPromotionRewards(t,e){const r=this.getOrderUrl(t,e,"/loyalty/promotions/rewards");return this.getResponse(await this.client.request("GET",r,void 0,this.getApiToken(e)))}async getCloudpaymentsReceipt(t,e,r){const n=this.getOrderUrl(t,e,`/payments/${r}/receipt`);return this.getResponse(await this.client.request("GET",n,void 0,this.getApiToken(e)))}}class le extends u{async getAddressSuggestions(t,e){const r=this.getStoreUrl(t,"/suggestions/address");return this.getResponse(await this.client.request("POST",r,e))}}class ce extends u{async getProfile(t,e,r){const n=this.getStoreUrl(t,"/me",e);return this.getResponse(await this.client.request("GET",n,null,r))}async updateProfile(t,e,r){const n=this.getStoreUrl(t,"/me");return this.getResponse(await this.client.request("PUT",n,e,r))}async removeProfile(t,e,r){const n=this.getStoreUrl(t,"/me");return await this.client.request("DELETE",n,e,r),!0}async getSettings(t,e){const r=this.getStoreUrl(t,"/me/settings");return this.getResponse(await this.client.request("GET",r,null,e))}async updateSettings(t,e,r){const n=this.getStoreUrl(t,"/me/settings");return this.getResponse(await this.client.request("PUT",n,e,r))}async getAddresses(t,e,r){const n=this.getStoreUrl(t,"/me/addresses",e);return this.getPaginatedResponse(await this.client.request("GET",n,null,r))}async createAddress(t,e,r){const n=this.getStoreUrl(t,"/me/addresses");return this.getResponse(await this.client.request("POST",n,e,r))}async updateAddress(t,e,r,n){const a=this.getStoreUrl(t,`/me/addresses/${e}`);return this.getResponse(await this.client.request("PUT",a,r,n))}async deleteAddress(t,e,r){const n=this.getStoreUrl(t,`/me/addresses/${e}`);return await this.client.request("DELETE",n,null,r),!0}async getPaymentMethods(t,e,r){const n=this.getStoreUrl(t,"/me/payment-methods",e);return this.getPaginatedResponse(await this.client.request("GET",n,null,r))}async deletePaymentMethod(t,e,r){const n=this.getStoreUrl(t,`/me/payment-methods/${e}`);return await this.client.request("DELETE",n,null,r),!0}async getBonusesTransactions(t,e,r){const n=this.getStoreUrl(t,"/me/loyalty/transactions",e);return this.getPaginatedResponse(await this.client.request("GET",n,null,r))}async getBonusesBalance(t,e){const r=this.getStoreUrl(t,"/me/loyalty/balance");return this.getResponse(await this.client.request("GET",r,null,e))}async revokeToken(t,e){const r=this.getStoreUrl(t,"/me/logout");return await this.client.request("POST",r,null,e),!0}}/**
|
|
2
2
|
postmate - A powerful, simple, promise-based postMessage library
|
|
3
3
|
@version v1.5.2
|
|
4
4
|
@link https://github.com/dollarshaveclub/postmate
|
|
5
5
|
@author Jacob Kelley <jakie8@gmail.com>
|
|
6
6
|
@license MIT
|
|
7
|
-
**/var f="application/x-postmate-v1+json",ue=5,ce=0,he=function(){return++ce},c=function(){var t;return m.debug?(t=console).log.apply(t,arguments):null},de=function(t){var e=document.createElement("a");e.href=t;var s=e.protocol.length>4?e.protocol:window.location.protocol,n=e.host.length?e.port==="80"||e.port==="443"?e.hostname:e.host:window.location.host;return e.origin||s+"//"+n},ge={handshake:1,"handshake-reply":1,call:1,emit:1,reply:1,request:1},E=function(t,e){return!(typeof e=="string"&&t.origin!==e||!t.data||typeof t.data=="object"&&!("postmate"in t.data)||t.data.type!==f||!ge[t.data.postmate])},pe=function(t,e){var s=typeof t[e]=="function"?t[e]():t[e];return m.Promise.resolve(s)},me=function(){function r(e){var s=this;this.parent=e.parent,this.frame=e.frame,this.child=e.child,this.childOrigin=e.childOrigin,this.events={},process.env.NODE_ENV!=="production"&&(c("Parent: Registering API"),c("Parent: Awaiting messages...")),this.listener=function(n){if(!E(n,s.childOrigin))return!1;var a=((n||{}).data||{}).value||{},o=a.data,l=a.name;n.data.postmate==="emit"&&(process.env.NODE_ENV!=="production"&&c("Parent: Received event emission: "+l),l in s.events&&s.events[l].call(s,o))},this.parent.addEventListener("message",this.listener,!1),process.env.NODE_ENV!=="production"&&c("Parent: Awaiting event emissions from Child")}var t=r.prototype;return t.get=function(s){var n=this;return new m.Promise(function(a){var o=he(),l=function d(p){p.data.uid===o&&p.data.postmate==="reply"&&(n.parent.removeEventListener("message",d,!1),a(p.data.value))};n.parent.addEventListener("message",l,!1),n.child.postMessage({postmate:"request",type:f,property:s,uid:o},n.childOrigin)})},t.call=function(s,n){this.child.postMessage({postmate:"call",type:f,property:s,data:n},this.childOrigin)},t.on=function(s,n){this.events[s]=n},t.destroy=function(){process.env.NODE_ENV!=="production"&&c("Parent: Destroying Postmate instance"),window.removeEventListener("message",this.listener,!1),this.frame.parentNode.removeChild(this.frame)},r}(),fe=function(){function r(e){var s=this;this.model=e.model,this.parent=e.parent,this.parentOrigin=e.parentOrigin,this.child=e.child,process.env.NODE_ENV!=="production"&&(c("Child: Registering API"),c("Child: Awaiting messages...")),this.child.addEventListener("message",function(n){if(E(n,s.parentOrigin)){process.env.NODE_ENV!=="production"&&c("Child: Received request",n.data);var a=n.data,o=a.property,l=a.uid,d=a.data;if(n.data.postmate==="call"){o in s.model&&typeof s.model[o]=="function"&&s.model[o](d);return}pe(s.model,o).then(function(p){return n.source.postMessage({property:o,postmate:"reply",type:f,uid:l,value:p},n.origin)})}})}var t=r.prototype;return t.emit=function(s,n){process.env.NODE_ENV!=="production"&&c('Child: Emitting Event "'+s+'"',n),this.parent.postMessage({postmate:"emit",type:f,value:{name:s,data:n}},this.parentOrigin)},r}(),m=function(){function r(e){var s=e.container,n=s===void 0?typeof n<"u"?n:document.body:s,a=e.model,o=e.url,l=e.name,d=e.classListArray,p=d===void 0?[]:d;return this.parent=window,this.frame=document.createElement("iframe"),this.frame.name=l||"",this.frame.classList.add.apply(this.frame.classList,p),n.appendChild(this.frame),this.child=this.frame.contentWindow||this.frame.contentDocument.parentWindow,this.model=a||{},this.sendHandshake(o)}var t=r.prototype;return t.sendHandshake=function(s){var n=this,a=de(s),o=0,l;return new r.Promise(function(d,p){var v=function y(P){return E(P,a)?P.data.postmate==="handshake-reply"?(clearInterval(l),process.env.NODE_ENV!=="production"&&c("Parent: Received handshake reply from Child"),n.parent.removeEventListener("message",y,!1),n.childOrigin=P.origin,process.env.NODE_ENV!=="production"&&c("Parent: Saving Child origin",n.childOrigin),d(new me(n))):(process.env.NODE_ENV!=="production"&&c("Parent: Invalid handshake reply"),p("Failed handshake")):!1};n.parent.addEventListener("message",v,!1);var w=function(){o++,process.env.NODE_ENV!=="production"&&c("Parent: Sending handshake attempt "+o,{childOrigin:a}),n.child.postMessage({postmate:"handshake",type:f,model:n.model},a),o===ue&&clearInterval(l)},k=function(){w(),l=setInterval(w,500)};n.frame.attachEvent?n.frame.attachEvent("onload",k):n.frame.onload=k,process.env.NODE_ENV!=="production"&&c("Parent: Loading frame",{url:s}),n.frame.src=s})},r}();m.debug=!1,m.Promise=function(){try{return window?window.Promise:Promise}catch{return null}}(),m.Model=function(){function r(e){return this.child=window,this.model=e,this.parent=this.child.parent,this.sendHandshakeReply()}var t=r.prototype;return t.sendHandshakeReply=function(){var s=this;return new m.Promise(function(n,a){var o=function l(d){if(d.data.postmate){if(d.data.postmate==="handshake"){process.env.NODE_ENV!=="production"&&c("Child: Received handshake from Parent"),s.child.removeEventListener("message",l,!1),process.env.NODE_ENV!=="production"&&c("Child: Sending handshake reply to Parent"),d.source.postMessage({postmate:"handshake-reply",type:f},d.origin),s.parentOrigin=d.origin;var p=d.data.model;return p&&(Object.keys(p).forEach(function(v){s.model[v]=p[v]}),process.env.NODE_ENV!=="production"&&c("Child: Inherited and extended model from Parent")),process.env.NODE_ENV!=="production"&&c("Child: Saving Parent origin",s.parentOrigin),n(new fe(s))}return a("Handshake Reply Failed")}};s.child.addEventListener("message",o,!1)})},r}();class ve extends h{async checkPhone(t,e){const s=this.getStoreUrl(t,"/auth/check");return this.getResponse(await this.client.request("POST",s,e))}async register(t,e){const s=this.getStoreUrl(t,"/auth/register");return this.getResponse(await this.client.request("POST",s,e))}async confirmRegistration(t,e){const s=this.getStoreUrl(t,"/auth/register/confirm");return this.getResponse(await this.client.request("POST",s,e))}async resendRegistrationConfirmation(t,e){const s=this.getStoreUrl(t,"/auth/register/resend");return this.getResponse(await this.client.request("POST",s,e))}async login(t,e){const s=this.getStoreUrl(t,"/auth/login");return this.getResponse(await this.client.request("POST",s,e))}async dispatchPasswordReset(t,e){const s=this.getStoreUrl(t,"/auth/password/request");return this.getResponse(await this.client.request("POST",s,e))}async resetPassword(t,e){const s=this.getStoreUrl(t,"/auth/password/reset");return this.getResponse(await this.client.request("POST",s,e))}useAuthenticationModal(t,e,s,n={}){const a=`${this.client.getBaseAuthUrl()}/?store_id=${t}&response_type=post_message`;let o=null,l=null;return{initAuthenticationModal:async()=>new Promise(v=>{const w=typeof e=="string"?document.querySelector(e):e;o=new m({...n,container:w,url:a}),o.then(k=>{l=k,l.on("zenky:auth:token",s),l.on("zenky:auth:resize",y=>{l.frame.style.height=`${y}px`}),v(!0)})}),destroyAuthenticationModal:()=>{l&&l.destroy()}}}}class ye{constructor(t,e){u(this,"client");u(this,"store");u(this,"auth");u(this,"customer");u(this,"categories");u(this,"products");u(this,"addresses");u(this,"orders");u(this,"collections");u(this,"offers");u(this,"articles");u(this,"feedback");const s=R.build(t,e);this.store=new T(s),this.auth=new ve(s),this.customer=new le(s),this.categories=new S(s),this.products=new C(s),this.addresses=new oe(s),this.orders=new N(s),this.collections=new A(s),this.offers=new b(s),this.articles=new U(s),this.feedback=new _(s),this.client=s}setApiToken(t){return this.client.setToken(t),this}}var $=(r=>(r.Female="female",r.Male="male",r.Other="other",r))($||{}),G=(r=>(r.CloudPayments="cloudpayments",r))(G||{}),D=(r=>(r.Visa="visa",r.MasterCard="master-card",r.MIR="mir",r.Maestro="maestro",r.AmericanExpress="american-express",r.DinersClub="diners-club",r.Discover="discover",r.JCB="jcb",r.UnionPay="union-pay",r))(D||{}),V=(r=>(r.Select="select",r.MutipleSelect="mutiple_select",r.Checkboxes="checkboxes",r.Radios="radios",r.Range="range",r.Text="text",r))(V||{}),I=(r=>(r.Integer="integer",r.Float="float",r))(I||{}),M=(r=>(r.Increase="increase",r.Decrease="decrease",r))(M||{}),L=(r=>(r.Pending="pending",r.Confirmed="confirmed",r.Cancelled="cancelled",r.Rejected="rejected",r.Refunded="refunded",r.PartiallyRefunded="partially_refunded",r))(L||{}),z=(r=>(r.Manual="manual",r.Cashback="cashback",r.ReferralReward="referral_reward",r.RecruitReward="recruit_reward",r.Payment="payment",r.Cancellation="cancellation",r.Refund="refund",r.Adjustment="adjustment",r.WelcomeBonuses="welcome_bonuses",r.PromotionReward="promotion_reward",r.External="external",r))(z||{}),j=(r=>(r.Delivery="delivery",r.Pickup="pickup",r.OnPremise="on_premise",r))(j||{}),F=(r=>(r.Payment="payment",r.Refund="refund",r))(F||{}),H=(r=>(r.Cash="cash",r.CreditCard="credit-card",r.CloudPayments="cloudpayments",r.CardToken="card_token",r.Bonuses="bonuses",r))(H||{}),Z=(r=>(r.Pending="pending",r.Confirmed="confirmed",r.Cancelled="cancelled",r.PendingRefund="pending_refund",r.Refunding="refunding",r.Refunded="refunded",r))(Z||{}),W=(r=>(r.Auth="auth",r.Charge="charge",r))(W||{}),B=(r=>(r.PersonsCount="persons_count",r.DeliveryTime="delivery_time",r.DeliveryIntervals="delivery_intervals",r))(B||{}),J=(r=>(r.PriceMismatch="price_mismatch",r.OutOfStock="out_of_stock",r.Unavailable="unavailable",r))(J||{}),X=(r=>(r.None="none",r.Cleanup="cleanup",r))(X||{}),Y=(r=>(r.Piece="piece",r.Gram="gram",r.Kilogram="kilogram",r.Meter="meter",r))(Y||{}),K=(r=>(r.Weight="weight",r.Width="width",r.Height="height",r.Length="length",r))(K||{}),Q=(r=>(r.Netto="netto",r.Brutto="brutto",r))(Q||{}),x=(r=>(r.Color="color",r))(x||{}),ee=(r=>(r.Category="category",r.Group="group",r.VariantOption="variant_option",r.VariantOptionValue="variant_option_value",r))(ee||{}),te=(r=>(r.Amount="amount",r.Percentage="percentage",r))(te||{}),re=(r=>(r.Email="email",r.Website="website",r.Vk="vk",r.Facebook="facebook",r.Instagram="instagram",r.Twitter="twitter",r.Ok="ok",r.Tiktok="tiktok",r))(re||{}),se=(r=>(r.Yes="yes",r.No="no",r.Both="both",r))(se||{}),ne=(r=>(r.Disabled="disabled",r.Preauth="preauth",r.Confirmation="confirmation",r))(ne||{}),ie=(r=>(r.Dadata="dadata",r.Manual="manual",r))(ie||{}),ae=(r=>(r.Registration="registration",r.ResendRegistrationCode="resend_registration_code",r.ResetPassword="reset_password",r.OrderSubmission="order_submission",r.FeedbackRequest="feedback_request",r.CallbackRequest="callback_request",r))(ae||{});i.AcquiringType=G,i.AddressSuggestionsProvider=g,i.AddressesProvider=ie,i.ArticlesResource=U,i.BonusesTransactionReason=z,i.BonusesTransactionStatus=L,i.BonusesTransactionType=M,i.CategoriesResource=S,i.CloudpaymentsChargeType=W,i.CollectionsResource=A,i.ContactType=re,i.DeliveryMethod=j,i.Dimension=K,i.DimensionType=Q,i.DiscountType=te,i.FeatureRange=I,i.FeatureType=V,i.FeedbackResource=_,i.Gender=$,i.OffersResource=b,i.OrderAuthenticationMethod=ne,i.OrderCartCheckerResultAction=X,i.OrderCartCheckerResultReason=J,i.OrderOptionKind=B,i.OrderPaymentTransactionStatus=Z,i.OrderPaymentTransactionType=F,i.OrdersResource=N,i.PaymentMethod=H,i.PaymentSystemType=D,i.ProductContextType=ee,i.ProductsResource=C,i.RecaptchaAction=ae,i.StoreResource=T,i.TernaryFilter=se,i.UnitType=Y,i.VariantOptionType=x,i.ZenkyError=O,i.ZenkyErrorBuilder=q,i.ZenkyStorefront=ye,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|
|
7
|
+
**/var f="application/x-postmate-v1+json",ue=5,he=0,de=function(){return++he},h=function(){var t;return m.debug?(t=console).log.apply(t,arguments):null},ge=function(t){var e=document.createElement("a");e.href=t;var r=e.protocol.length>4?e.protocol:window.location.protocol,n=e.host.length?e.port==="80"||e.port==="443"?e.hostname:e.host:window.location.host;return e.origin||r+"//"+n},pe={handshake:1,"handshake-reply":1,call:1,emit:1,reply:1,request:1},E=function(t,e){return!(typeof e=="string"&&t.origin!==e||!t.data||typeof t.data=="object"&&!("postmate"in t.data)||t.data.type!==f||!pe[t.data.postmate])},me=function(t,e){var r=typeof t[e]=="function"?t[e]():t[e];return m.Promise.resolve(r)},fe=function(){function s(e){var r=this;this.parent=e.parent,this.frame=e.frame,this.child=e.child,this.childOrigin=e.childOrigin,this.events={},process.env.NODE_ENV!=="production"&&(h("Parent: Registering API"),h("Parent: Awaiting messages...")),this.listener=function(n){if(!E(n,r.childOrigin))return!1;var a=((n||{}).data||{}).value||{},o=a.data,l=a.name;n.data.postmate==="emit"&&(process.env.NODE_ENV!=="production"&&h("Parent: Received event emission: "+l),l in r.events&&r.events[l].call(r,o))},this.parent.addEventListener("message",this.listener,!1),process.env.NODE_ENV!=="production"&&h("Parent: Awaiting event emissions from Child")}var t=s.prototype;return t.get=function(r){var n=this;return new m.Promise(function(a){var o=de(),l=function d(p){p.data.uid===o&&p.data.postmate==="reply"&&(n.parent.removeEventListener("message",d,!1),a(p.data.value))};n.parent.addEventListener("message",l,!1),n.child.postMessage({postmate:"request",type:f,property:r,uid:o},n.childOrigin)})},t.call=function(r,n){this.child.postMessage({postmate:"call",type:f,property:r,data:n},this.childOrigin)},t.on=function(r,n){this.events[r]=n},t.destroy=function(){process.env.NODE_ENV!=="production"&&h("Parent: Destroying Postmate instance"),window.removeEventListener("message",this.listener,!1),this.frame.parentNode.removeChild(this.frame)},s}(),ve=function(){function s(e){var r=this;this.model=e.model,this.parent=e.parent,this.parentOrigin=e.parentOrigin,this.child=e.child,process.env.NODE_ENV!=="production"&&(h("Child: Registering API"),h("Child: Awaiting messages...")),this.child.addEventListener("message",function(n){if(E(n,r.parentOrigin)){process.env.NODE_ENV!=="production"&&h("Child: Received request",n.data);var a=n.data,o=a.property,l=a.uid,d=a.data;if(n.data.postmate==="call"){o in r.model&&typeof r.model[o]=="function"&&r.model[o](d);return}me(r.model,o).then(function(p){return n.source.postMessage({property:o,postmate:"reply",type:f,uid:l,value:p},n.origin)})}})}var t=s.prototype;return t.emit=function(r,n){process.env.NODE_ENV!=="production"&&h('Child: Emitting Event "'+r+'"',n),this.parent.postMessage({postmate:"emit",type:f,value:{name:r,data:n}},this.parentOrigin)},s}(),m=function(){function s(e){var r=e.container,n=r===void 0?typeof n<"u"?n:document.body:r,a=e.model,o=e.url,l=e.name,d=e.classListArray,p=d===void 0?[]:d;return this.parent=window,this.frame=document.createElement("iframe"),this.frame.name=l||"",this.frame.classList.add.apply(this.frame.classList,p),n.appendChild(this.frame),this.child=this.frame.contentWindow||this.frame.contentDocument.parentWindow,this.model=a||{},this.sendHandshake(o)}var t=s.prototype;return t.sendHandshake=function(r){var n=this,a=ge(r),o=0,l;return new s.Promise(function(d,p){var v=function y(P){return E(P,a)?P.data.postmate==="handshake-reply"?(clearInterval(l),process.env.NODE_ENV!=="production"&&h("Parent: Received handshake reply from Child"),n.parent.removeEventListener("message",y,!1),n.childOrigin=P.origin,process.env.NODE_ENV!=="production"&&h("Parent: Saving Child origin",n.childOrigin),d(new fe(n))):(process.env.NODE_ENV!=="production"&&h("Parent: Invalid handshake reply"),p("Failed handshake")):!1};n.parent.addEventListener("message",v,!1);var w=function(){o++,process.env.NODE_ENV!=="production"&&h("Parent: Sending handshake attempt "+o,{childOrigin:a}),n.child.postMessage({postmate:"handshake",type:f,model:n.model},a),o===ue&&clearInterval(l)},k=function(){w(),l=setInterval(w,500)};n.frame.attachEvent?n.frame.attachEvent("onload",k):n.frame.onload=k,process.env.NODE_ENV!=="production"&&h("Parent: Loading frame",{url:r}),n.frame.src=r})},s}();m.debug=!1,m.Promise=function(){try{return window?window.Promise:Promise}catch{return null}}(),m.Model=function(){function s(e){return this.child=window,this.model=e,this.parent=this.child.parent,this.sendHandshakeReply()}var t=s.prototype;return t.sendHandshakeReply=function(){var r=this;return new m.Promise(function(n,a){var o=function l(d){if(d.data.postmate){if(d.data.postmate==="handshake"){process.env.NODE_ENV!=="production"&&h("Child: Received handshake from Parent"),r.child.removeEventListener("message",l,!1),process.env.NODE_ENV!=="production"&&h("Child: Sending handshake reply to Parent"),d.source.postMessage({postmate:"handshake-reply",type:f},d.origin),r.parentOrigin=d.origin;var p=d.data.model;return p&&(Object.keys(p).forEach(function(v){r.model[v]=p[v]}),process.env.NODE_ENV!=="production"&&h("Child: Inherited and extended model from Parent")),process.env.NODE_ENV!=="production"&&h("Child: Saving Parent origin",r.parentOrigin),n(new ve(r))}return a("Handshake Reply Failed")}};r.child.addEventListener("message",o,!1)})},s}();class ye extends u{async checkPhone(t,e){const r=this.getStoreUrl(t,"/auth/check");return this.getResponse(await this.client.request("POST",r,e))}async register(t,e){const r=this.getStoreUrl(t,"/auth/register");return this.getResponse(await this.client.request("POST",r,e))}async confirmRegistration(t,e){const r=this.getStoreUrl(t,"/auth/register/confirm");return this.getResponse(await this.client.request("POST",r,e))}async resendRegistrationConfirmation(t,e){const r=this.getStoreUrl(t,"/auth/register/resend");return this.getResponse(await this.client.request("POST",r,e))}async login(t,e){const r=this.getStoreUrl(t,"/auth/login");return this.getResponse(await this.client.request("POST",r,e))}async dispatchPasswordReset(t,e){const r=this.getStoreUrl(t,"/auth/password/request");return this.getResponse(await this.client.request("POST",r,e))}async resetPassword(t,e){const r=this.getStoreUrl(t,"/auth/password/reset");return this.getResponse(await this.client.request("POST",r,e))}useAuthenticationModal(t,e,r,n={}){const a=`${this.client.getBaseAuthUrl()}/?store_id=${t}&response_type=post_message`;let o=null,l=null;return{initAuthenticationModal:async()=>new Promise(v=>{const w=typeof e=="string"?document.querySelector(e):e;o=new m({...n,container:w,url:a}),o.then(k=>{l=k,l.on("zenky:auth:token",r),l.on("zenky:auth:resize",y=>{l.frame.style.height=`${y}px`}),v(!0)})}),destroyAuthenticationModal:()=>{l&&l.destroy()}}}}class we{constructor(t,e){c(this,"client");c(this,"store");c(this,"auth");c(this,"customer");c(this,"catalog");c(this,"categories");c(this,"products");c(this,"addresses");c(this,"orders");c(this,"collections");c(this,"offers");c(this,"articles");c(this,"feedback");const r=R.build(t,e);this.store=new A(r),this.auth=new ye(r),this.customer=new ce(r),this.catalog=new S(r),this.categories=new q(r),this.products=new N(r),this.addresses=new le(r),this.orders=new G(r),this.collections=new b(r),this.offers=new _(r),this.articles=new U(r),this.feedback=new C(r),this.client=r}setApiToken(t){return this.client.setToken(t),this}}var $=(s=>(s.Female="female",s.Male="male",s.Other="other",s))($||{}),D=(s=>(s.CloudPayments="cloudpayments",s))(D||{}),V=(s=>(s.Visa="visa",s.MasterCard="master-card",s.MIR="mir",s.Maestro="maestro",s.AmericanExpress="american-express",s.DinersClub="diners-club",s.Discover="discover",s.JCB="jcb",s.UnionPay="union-pay",s))(V||{}),I=(s=>(s.Select="select",s.MutipleSelect="mutiple_select",s.Checkboxes="checkboxes",s.Radios="radios",s.Range="range",s.Text="text",s))(I||{}),M=(s=>(s.Integer="integer",s.Float="float",s))(M||{}),L=(s=>(s.Increase="increase",s.Decrease="decrease",s))(L||{}),z=(s=>(s.Pending="pending",s.Confirmed="confirmed",s.Cancelled="cancelled",s.Rejected="rejected",s.Refunded="refunded",s.PartiallyRefunded="partially_refunded",s))(z||{}),j=(s=>(s.Manual="manual",s.Cashback="cashback",s.ReferralReward="referral_reward",s.RecruitReward="recruit_reward",s.Payment="payment",s.Cancellation="cancellation",s.Refund="refund",s.Adjustment="adjustment",s.WelcomeBonuses="welcome_bonuses",s.PromotionReward="promotion_reward",s.External="external",s))(j||{}),F=(s=>(s.Delivery="delivery",s.Pickup="pickup",s.OnPremise="on_premise",s))(F||{}),H=(s=>(s.Payment="payment",s.Refund="refund",s))(H||{}),Z=(s=>(s.Cash="cash",s.CreditCard="credit-card",s.CloudPayments="cloudpayments",s.CardToken="card_token",s.Bonuses="bonuses",s))(Z||{}),W=(s=>(s.Pending="pending",s.Confirmed="confirmed",s.Cancelled="cancelled",s.PendingRefund="pending_refund",s.Refunding="refunding",s.Refunded="refunded",s))(W||{}),B=(s=>(s.Auth="auth",s.Charge="charge",s))(B||{}),J=(s=>(s.PersonsCount="persons_count",s.DeliveryTime="delivery_time",s.DeliveryIntervals="delivery_intervals",s))(J||{}),X=(s=>(s.PriceMismatch="price_mismatch",s.OutOfStock="out_of_stock",s.Unavailable="unavailable",s))(X||{}),Y=(s=>(s.None="none",s.Cleanup="cleanup",s))(Y||{}),K=(s=>(s.Piece="piece",s.Gram="gram",s.Kilogram="kilogram",s.Meter="meter",s))(K||{}),Q=(s=>(s.Weight="weight",s.Width="width",s.Height="height",s.Length="length",s))(Q||{}),x=(s=>(s.Netto="netto",s.Brutto="brutto",s))(x||{}),ee=(s=>(s.Color="color",s))(ee||{}),te=(s=>(s.Category="category",s.Group="group",s.VariantOption="variant_option",s.VariantOptionValue="variant_option_value",s))(te||{}),re=(s=>(s.Amount="amount",s.Percentage="percentage",s))(re||{}),se=(s=>(s.Email="email",s.Website="website",s.Vk="vk",s.Facebook="facebook",s.Instagram="instagram",s.Twitter="twitter",s.Ok="ok",s.Tiktok="tiktok",s))(se||{}),ne=(s=>(s.Yes="yes",s.No="no",s.Both="both",s))(ne||{}),ie=(s=>(s.Disabled="disabled",s.Preauth="preauth",s.Confirmation="confirmation",s))(ie||{}),ae=(s=>(s.Dadata="dadata",s.Manual="manual",s))(ae||{}),oe=(s=>(s.Registration="registration",s.ResendRegistrationCode="resend_registration_code",s.ResetPassword="reset_password",s.OrderSubmission="order_submission",s.FeedbackRequest="feedback_request",s.CallbackRequest="callback_request",s))(oe||{});i.AcquiringType=D,i.AddressSuggestionsProvider=g,i.AddressesProvider=ae,i.ArticlesResource=U,i.BonusesTransactionReason=j,i.BonusesTransactionStatus=z,i.BonusesTransactionType=L,i.CatalogResource=S,i.CategoriesResource=q,i.CloudpaymentsChargeType=B,i.CollectionsResource=b,i.ContactType=se,i.DeliveryMethod=F,i.Dimension=Q,i.DimensionType=x,i.DiscountType=re,i.FeatureRange=M,i.FeatureType=I,i.FeedbackResource=C,i.Gender=$,i.OffersResource=_,i.OrderAuthenticationMethod=ie,i.OrderCartCheckerResultAction=Y,i.OrderCartCheckerResultReason=X,i.OrderOptionKind=J,i.OrderPaymentTransactionStatus=W,i.OrderPaymentTransactionType=H,i.OrdersResource=G,i.PaymentMethod=Z,i.PaymentSystemType=V,i.ProductContextType=te,i.ProductsResource=N,i.RecaptchaAction=oe,i.StoreResource=A,i.TernaryFilter=ne,i.UnitType=K,i.VariantOptionType=ee,i.ZenkyError=O,i.ZenkyErrorBuilder=T,i.ZenkyStorefront=we,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenky/storefront-api",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.36",
|
|
4
4
|
"description": "Zenky Storefront API SDK",
|
|
5
5
|
"author": "Timur Zurbaev <hello@zurbaev.ru>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,8 +22,6 @@
|
|
|
22
22
|
"dev": "vite",
|
|
23
23
|
"build": "tsc && vite build",
|
|
24
24
|
"preview": "vite preview",
|
|
25
|
-
"test": "vitest",
|
|
26
|
-
"coverage": "vitest run --coverage",
|
|
27
25
|
"types": "dts-bundle-generator --out-file ./dist/index.d.ts ./src/index.ts"
|
|
28
26
|
},
|
|
29
27
|
"devDependencies": {
|
|
@@ -33,9 +31,7 @@
|
|
|
33
31
|
"dts-bundle-generator": "^8.0.1",
|
|
34
32
|
"typescript": "^5.0.2",
|
|
35
33
|
"vite": "^4.3.9",
|
|
36
|
-
"vite-plugin-dts": "^2.3.0"
|
|
37
|
-
"vitest": "^0.32.0",
|
|
38
|
-
"vitest-fetch-mock": "^0.2.2"
|
|
34
|
+
"vite-plugin-dts": "^2.3.0"
|
|
39
35
|
},
|
|
40
36
|
"dependencies": {
|
|
41
37
|
"postmate": "^1.5.2"
|