@commercengine/storefront-sdk 0.14.2 → 0.14.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +40 -26
- package/dist/index.iife.js +98 -125
- package/dist/index.iife.js.map +1 -1
- package/dist/index.mjs +1 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.iife.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
var CE_SDK = (function(exports) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
//#region ../../node_modules/.pnpm/openapi-fetch@0.17.0/node_modules/openapi-fetch/dist/index.mjs
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
//#region ../../node_modules/.pnpm/openapi-fetch@0.17.0/node_modules/openapi-fetch/dist/index.mjs
|
|
6
4
|
const PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
7
5
|
const supportsRequestInitExt = () => {
|
|
8
6
|
return typeof process === "object" && Number.parseInt(process?.versions?.node?.substring(0, 2)) >= 18 && process.versions.undici;
|
|
@@ -378,10 +376,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
378
376
|
if (url.endsWith("/")) return url.substring(0, url.length - 1);
|
|
379
377
|
return url;
|
|
380
378
|
}
|
|
381
|
-
|
|
382
|
-
//#
|
|
383
|
-
|
|
384
|
-
/**
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region ../sdk-core/dist/index.mjs
|
|
381
|
+
/**
|
|
385
382
|
* Response utilities for debugging and working with Response objects
|
|
386
383
|
*/
|
|
387
384
|
var ResponseUtils = class {
|
|
@@ -807,10 +804,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
807
804
|
return url.split("?")[0] || url;
|
|
808
805
|
}
|
|
809
806
|
}
|
|
810
|
-
|
|
811
|
-
//#
|
|
812
|
-
|
|
813
|
-
/**
|
|
807
|
+
//#endregion
|
|
808
|
+
//#region src/lib/shared/url-utils.ts
|
|
809
|
+
/**
|
|
814
810
|
* URL utility functions for the Storefront SDK
|
|
815
811
|
*/
|
|
816
812
|
/**
|
|
@@ -838,10 +834,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
838
834
|
default: return `https://prod.api.commercengine.io/api/v1/${config.storeId}/storefront`;
|
|
839
835
|
}
|
|
840
836
|
}
|
|
841
|
-
|
|
842
|
-
//#
|
|
843
|
-
|
|
844
|
-
/**
|
|
837
|
+
//#endregion
|
|
838
|
+
//#region src/lib/shared/client.ts
|
|
839
|
+
/**
|
|
845
840
|
* Shared base class for Storefront API clients.
|
|
846
841
|
*
|
|
847
842
|
* This centralizes Storefront-specific URL construction, default header
|
|
@@ -878,9 +873,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
878
873
|
this.client.use(middleware);
|
|
879
874
|
}
|
|
880
875
|
};
|
|
881
|
-
|
|
882
|
-
//#
|
|
883
|
-
//#region src/lib/session/client.ts
|
|
876
|
+
//#endregion
|
|
877
|
+
//#region src/lib/session/client.ts
|
|
884
878
|
function attachSessionAuth(client, sessionManager) {
|
|
885
879
|
client.useMiddleware(sessionManager.createAuthMiddleware());
|
|
886
880
|
}
|
|
@@ -1009,10 +1003,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1009
1003
|
};
|
|
1010
1004
|
}
|
|
1011
1005
|
};
|
|
1012
|
-
|
|
1013
|
-
//#
|
|
1014
|
-
|
|
1015
|
-
/**
|
|
1006
|
+
//#endregion
|
|
1007
|
+
//#region src/lib/shared/catalog.ts
|
|
1008
|
+
/**
|
|
1016
1009
|
* Client for interacting with catalog endpoints
|
|
1017
1010
|
*/
|
|
1018
1011
|
var BaseCatalogClient = class extends StorefrontAPIClientBase {
|
|
@@ -1585,10 +1578,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1585
1578
|
} }));
|
|
1586
1579
|
}
|
|
1587
1580
|
};
|
|
1588
|
-
|
|
1589
|
-
//#
|
|
1590
|
-
|
|
1591
|
-
/**
|
|
1581
|
+
//#endregion
|
|
1582
|
+
//#region src/lib/public/client.ts
|
|
1583
|
+
/**
|
|
1592
1584
|
* Storefront API client that always authenticates with `X-Api-Key`.
|
|
1593
1585
|
*
|
|
1594
1586
|
* This class is kept as the advanced public transport client. Concrete public
|
|
@@ -1607,10 +1599,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1607
1599
|
return request;
|
|
1608
1600
|
} });
|
|
1609
1601
|
}
|
|
1610
|
-
|
|
1611
|
-
//#
|
|
1612
|
-
|
|
1613
|
-
/**
|
|
1602
|
+
//#endregion
|
|
1603
|
+
//#region src/lib/public/catalog.ts
|
|
1604
|
+
/**
|
|
1614
1605
|
* Client for interacting with catalog endpoints
|
|
1615
1606
|
*/
|
|
1616
1607
|
var PublicCatalogClient = class extends BaseCatalogClient {
|
|
@@ -1619,10 +1610,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1619
1610
|
attachPublicAuth(this);
|
|
1620
1611
|
}
|
|
1621
1612
|
};
|
|
1622
|
-
|
|
1623
|
-
//#
|
|
1624
|
-
|
|
1625
|
-
/**
|
|
1613
|
+
//#endregion
|
|
1614
|
+
//#region src/lib/catalog.ts
|
|
1615
|
+
/**
|
|
1626
1616
|
* Client for interacting with catalog endpoints
|
|
1627
1617
|
*/
|
|
1628
1618
|
var CatalogClient = class extends BaseCatalogClient {
|
|
@@ -1674,10 +1664,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1674
1664
|
}));
|
|
1675
1665
|
}
|
|
1676
1666
|
};
|
|
1677
|
-
|
|
1678
|
-
//#
|
|
1679
|
-
|
|
1680
|
-
/**
|
|
1667
|
+
//#endregion
|
|
1668
|
+
//#region src/lib/cart.ts
|
|
1669
|
+
/**
|
|
1681
1670
|
* Client for interacting with cart endpoints
|
|
1682
1671
|
*/
|
|
1683
1672
|
var CartClient = class extends SessionStorefrontAPIClient {
|
|
@@ -2331,10 +2320,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2331
2320
|
}));
|
|
2332
2321
|
}
|
|
2333
2322
|
};
|
|
2334
|
-
|
|
2335
|
-
//#
|
|
2336
|
-
|
|
2337
|
-
/**
|
|
2323
|
+
//#endregion
|
|
2324
|
+
//#region src/lib/auth.ts
|
|
2325
|
+
/**
|
|
2338
2326
|
* Client for interacting with authentication endpoints
|
|
2339
2327
|
*/
|
|
2340
2328
|
var AuthClient = class extends SessionStorefrontAPIClient {
|
|
@@ -3017,10 +3005,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3017
3005
|
return this.executeRequest(() => this.client.POST("/auth/verified-email-phone", { body }));
|
|
3018
3006
|
}
|
|
3019
3007
|
};
|
|
3020
|
-
|
|
3021
|
-
//#
|
|
3022
|
-
|
|
3023
|
-
/**
|
|
3008
|
+
//#endregion
|
|
3009
|
+
//#region src/lib/order.ts
|
|
3010
|
+
/**
|
|
3024
3011
|
* Client for interacting with order endpoints
|
|
3025
3012
|
*/
|
|
3026
3013
|
var OrderClient = class extends SessionStorefrontAPIClient {
|
|
@@ -3381,10 +3368,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3381
3368
|
}));
|
|
3382
3369
|
}
|
|
3383
3370
|
};
|
|
3384
|
-
|
|
3385
|
-
//#
|
|
3386
|
-
|
|
3387
|
-
/**
|
|
3371
|
+
//#endregion
|
|
3372
|
+
//#region src/lib/payments.ts
|
|
3373
|
+
/**
|
|
3388
3374
|
* Client for interacting with payment endpoints
|
|
3389
3375
|
*/
|
|
3390
3376
|
var PaymentsClient = class extends SessionStorefrontAPIClient {
|
|
@@ -3528,10 +3514,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3528
3514
|
return this.executeRequest(() => this.client.POST("/payments/resend-direct-otp", { body }));
|
|
3529
3515
|
}
|
|
3530
3516
|
};
|
|
3531
|
-
|
|
3532
|
-
//#
|
|
3533
|
-
|
|
3534
|
-
/**
|
|
3517
|
+
//#endregion
|
|
3518
|
+
//#region src/lib/shared/helper.ts
|
|
3519
|
+
/**
|
|
3535
3520
|
* Client for interacting with helper endpoints
|
|
3536
3521
|
*/
|
|
3537
3522
|
var BaseHelpersClient = class extends StorefrontAPIClientBase {
|
|
@@ -3642,10 +3627,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3642
3627
|
} }));
|
|
3643
3628
|
}
|
|
3644
3629
|
};
|
|
3645
|
-
|
|
3646
|
-
//#
|
|
3647
|
-
|
|
3648
|
-
/**
|
|
3630
|
+
//#endregion
|
|
3631
|
+
//#region src/lib/public/helper.ts
|
|
3632
|
+
/**
|
|
3649
3633
|
* Client for interacting with helper endpoints
|
|
3650
3634
|
*/
|
|
3651
3635
|
var PublicHelpersClient = class extends BaseHelpersClient {
|
|
@@ -3654,10 +3638,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3654
3638
|
attachPublicAuth(this);
|
|
3655
3639
|
}
|
|
3656
3640
|
};
|
|
3657
|
-
|
|
3658
|
-
//#
|
|
3659
|
-
|
|
3660
|
-
/**
|
|
3641
|
+
//#endregion
|
|
3642
|
+
//#region src/lib/helper.ts
|
|
3643
|
+
/**
|
|
3661
3644
|
* Client for interacting with helper endpoints
|
|
3662
3645
|
*/
|
|
3663
3646
|
var HelpersClient = class extends BaseHelpersClient {
|
|
@@ -3666,10 +3649,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3666
3649
|
attachSessionAuth(this, config.sessionManager);
|
|
3667
3650
|
}
|
|
3668
3651
|
};
|
|
3669
|
-
|
|
3670
|
-
//#
|
|
3671
|
-
|
|
3672
|
-
/**
|
|
3652
|
+
//#endregion
|
|
3653
|
+
//#region src/lib/customer.ts
|
|
3654
|
+
/**
|
|
3673
3655
|
* Client for interacting with customer endpoints
|
|
3674
3656
|
*/
|
|
3675
3657
|
var CustomerClient = class extends SessionStorefrontAPIClient {
|
|
@@ -3737,10 +3719,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3737
3719
|
return this.executeRequest(() => this.client.GET("/customers/{customer_id}/cards", { params: { path: resolvedPathParams } }));
|
|
3738
3720
|
}
|
|
3739
3721
|
};
|
|
3740
|
-
|
|
3741
|
-
//#
|
|
3742
|
-
|
|
3743
|
-
/**
|
|
3722
|
+
//#endregion
|
|
3723
|
+
//#region src/lib/shared/store-config.ts
|
|
3724
|
+
/**
|
|
3744
3725
|
* Client for interacting with store config endpoints
|
|
3745
3726
|
*/
|
|
3746
3727
|
var BaseStoreConfigClient = class extends StorefrontAPIClientBase {
|
|
@@ -3791,10 +3772,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3791
3772
|
return this.executeRequest(() => this.client.GET("/store/config"));
|
|
3792
3773
|
}
|
|
3793
3774
|
};
|
|
3794
|
-
|
|
3795
|
-
//#
|
|
3796
|
-
|
|
3797
|
-
/**
|
|
3775
|
+
//#endregion
|
|
3776
|
+
//#region src/lib/public/store-config.ts
|
|
3777
|
+
/**
|
|
3798
3778
|
* Client for interacting with store config endpoints
|
|
3799
3779
|
*/
|
|
3800
3780
|
var PublicStoreConfigClient = class extends BaseStoreConfigClient {
|
|
@@ -3803,10 +3783,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3803
3783
|
attachPublicAuth(this);
|
|
3804
3784
|
}
|
|
3805
3785
|
};
|
|
3806
|
-
|
|
3807
|
-
//#
|
|
3808
|
-
|
|
3809
|
-
/**
|
|
3786
|
+
//#endregion
|
|
3787
|
+
//#region src/lib/store-config.ts
|
|
3788
|
+
/**
|
|
3810
3789
|
* Client for interacting with store config endpoints
|
|
3811
3790
|
*/
|
|
3812
3791
|
var StoreConfigClient = class extends BaseStoreConfigClient {
|
|
@@ -3815,10 +3794,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3815
3794
|
attachSessionAuth(this, config.sessionManager);
|
|
3816
3795
|
}
|
|
3817
3796
|
};
|
|
3818
|
-
|
|
3819
|
-
//#
|
|
3820
|
-
|
|
3821
|
-
/**
|
|
3797
|
+
//#endregion
|
|
3798
|
+
//#region src/lib/storage/token-storage.ts
|
|
3799
|
+
/**
|
|
3822
3800
|
* Simple in-memory token storage implementation
|
|
3823
3801
|
*/
|
|
3824
3802
|
var MemoryTokenStorage = class {
|
|
@@ -3935,10 +3913,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3935
3913
|
document.cookie = cookieString;
|
|
3936
3914
|
}
|
|
3937
3915
|
};
|
|
3938
|
-
|
|
3939
|
-
//#
|
|
3940
|
-
|
|
3941
|
-
/**
|
|
3916
|
+
//#endregion
|
|
3917
|
+
//#region src/lib/session/jwt-utils.ts
|
|
3918
|
+
/**
|
|
3942
3919
|
* Decode a JWT token payload without signature verification.
|
|
3943
3920
|
* This is a lightweight replacement for jose's decodeJwt.
|
|
3944
3921
|
*
|
|
@@ -4037,9 +4014,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4037
4014
|
function isUserAnonymous(token) {
|
|
4038
4015
|
return extractUserInfoFromToken(token)?.isAnonymous ?? true;
|
|
4039
4016
|
}
|
|
4040
|
-
|
|
4041
|
-
//#
|
|
4042
|
-
//#region src/types/auth-operation-metadata.ts
|
|
4017
|
+
//#endregion
|
|
4018
|
+
//#region src/types/auth-operation-metadata.ts
|
|
4043
4019
|
const API_KEY_ONLY_OPERATIONS = [
|
|
4044
4020
|
{
|
|
4045
4021
|
method: "POST",
|
|
@@ -4078,9 +4054,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4078
4054
|
path: "/store/sellers/{id}/reviews"
|
|
4079
4055
|
}
|
|
4080
4056
|
];
|
|
4081
|
-
|
|
4082
|
-
//#
|
|
4083
|
-
//#region src/lib/session/auth-utils.ts
|
|
4057
|
+
//#endregion
|
|
4058
|
+
//#region src/lib/session/auth-utils.ts
|
|
4084
4059
|
const TOKEN_RETURNING_OPERATIONS = [
|
|
4085
4060
|
{
|
|
4086
4061
|
method: "POST",
|
|
@@ -4156,10 +4131,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4156
4131
|
function isTokenReturningOperation(method, pathname) {
|
|
4157
4132
|
return matchesOperationList(method, pathname, TOKEN_RETURNING_OPERATIONS);
|
|
4158
4133
|
}
|
|
4159
|
-
|
|
4160
|
-
//#
|
|
4161
|
-
|
|
4162
|
-
/**
|
|
4134
|
+
//#endregion
|
|
4135
|
+
//#region src/lib/session/manager.ts
|
|
4136
|
+
/**
|
|
4163
4137
|
* Internal per-SDK session controller.
|
|
4164
4138
|
*
|
|
4165
4139
|
* A single instance is shared by all API clients created from the same
|
|
@@ -4533,10 +4507,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4533
4507
|
if (refreshToken) await this.tokenStorage.setRefreshToken(refreshToken);
|
|
4534
4508
|
}
|
|
4535
4509
|
};
|
|
4536
|
-
|
|
4537
|
-
//#
|
|
4538
|
-
|
|
4539
|
-
/**
|
|
4510
|
+
//#endregion
|
|
4511
|
+
//#region src/index.ts
|
|
4512
|
+
/**
|
|
4540
4513
|
* Public SDK class for the Storefront API.
|
|
4541
4514
|
*
|
|
4542
4515
|
* This surface is intentionally limited to API-key-backed, public read
|
|
@@ -4915,29 +4888,29 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4915
4888
|
session
|
|
4916
4889
|
};
|
|
4917
4890
|
}
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
exports.
|
|
4921
|
-
exports.
|
|
4922
|
-
exports.
|
|
4923
|
-
exports.
|
|
4924
|
-
exports.
|
|
4925
|
-
exports.
|
|
4926
|
-
exports.
|
|
4927
|
-
exports.
|
|
4928
|
-
exports.
|
|
4929
|
-
exports.
|
|
4930
|
-
exports.
|
|
4931
|
-
exports.
|
|
4932
|
-
exports.
|
|
4933
|
-
exports.
|
|
4934
|
-
exports.
|
|
4935
|
-
exports.
|
|
4936
|
-
exports.
|
|
4937
|
-
exports.
|
|
4938
|
-
exports.
|
|
4939
|
-
exports.
|
|
4940
|
-
exports
|
|
4941
|
-
return exports;
|
|
4891
|
+
//#endregion
|
|
4892
|
+
exports.AuthClient = AuthClient;
|
|
4893
|
+
exports.BrowserTokenStorage = BrowserTokenStorage;
|
|
4894
|
+
exports.CartClient = CartClient;
|
|
4895
|
+
exports.CatalogClient = CatalogClient;
|
|
4896
|
+
exports.CookieTokenStorage = CookieTokenStorage;
|
|
4897
|
+
exports.CustomerClient = CustomerClient;
|
|
4898
|
+
exports.Environment = Environment;
|
|
4899
|
+
exports.HelpersClient = HelpersClient;
|
|
4900
|
+
exports.MemoryTokenStorage = MemoryTokenStorage;
|
|
4901
|
+
exports.OrderClient = OrderClient;
|
|
4902
|
+
exports.PaymentsClient = PaymentsClient;
|
|
4903
|
+
exports.PublicCatalogClient = PublicCatalogClient;
|
|
4904
|
+
exports.PublicHelpersClient = PublicHelpersClient;
|
|
4905
|
+
exports.PublicStoreConfigClient = PublicStoreConfigClient;
|
|
4906
|
+
exports.PublicStorefrontAPIClient = PublicStorefrontAPIClient;
|
|
4907
|
+
exports.PublicStorefrontSDK = PublicStorefrontSDK;
|
|
4908
|
+
exports.ResponseUtils = ResponseUtils;
|
|
4909
|
+
exports.SessionStorefrontAPIClient = SessionStorefrontAPIClient;
|
|
4910
|
+
exports.SessionStorefrontSDK = SessionStorefrontSDK;
|
|
4911
|
+
exports.StoreConfigClient = StoreConfigClient;
|
|
4912
|
+
exports.createStorefront = createStorefront;
|
|
4913
|
+
return exports;
|
|
4942
4914
|
})({});
|
|
4915
|
+
|
|
4943
4916
|
//# sourceMappingURL=index.iife.js.map
|