arky-sdk 0.3.62 → 0.3.63
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.cjs +9 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.js +9 -25
- package/dist/index.js.map +1 -1
- package/dist/{svg-D_ajyHnG.d.cts → svg-3F_m7296.d.cts} +1 -1
- package/dist/{svg-WKQadzp2.d.ts → svg-4hIdMU6f.d.ts} +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.cjs +6 -20
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +6 -20
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UpdateUserProfileParams, RequestOptions, DeleteUserParams, AddPhoneNumberParams, PhoneNumberConfirmParams, GetMeParams, SearchUsersParams, SetRoleParams, LoginUserParams, RegisterUserParams, LogoutParams, ConfirmUserParams, GetLoginUrlParams, ForgotPasswordParams, ResetForgotPasswordParams, ResetPasswordParams, UserSubscribeParams, CreateBusinessParams, UpdateBusinessParams, DeleteBusinessParams, GetBusinessParams, GetBusinessesParams, GetBusinessParentsParams, TriggerBuildsParams, GetSubscriptionPlansParams, GetSubscriptionParams, SubscribeParams, CreatePortalSessionParams, InviteUserParams, HandleInvitationParams, TestWebhookParams, GetBusinessMediaParams2, SetProviderScheduleParams, ProcessRefundParams, UploadBusinessMediaParams, DeleteBusinessMediaParams, GetBusinessMediaParams, UpdateMediaParams, CreateRoleParams, UpdateRoleParams, DeleteRoleParams, GetRoleParams, GetRolesParams, TrackEmailOpenParams, GetDeliveryStatsParams, CreatePromoCodeParams, UpdatePromoCodeParams, DeletePromoCodeParams, GetPromoCodeParams, GetPromoCodesParams, GetAnalyticsParams, CreateCollectionParams, UpdateCollectionParams, DeleteCollectionParams, GetCollectionParams, GetCollectionsParams, GenerateBlocksParams, GetEntriesParams, CreateEntryParams, UpdateEntryParams, DeleteCollectionEntryParams, GetCollectionEntryParams, SendEntryParams, GetVariableMetadataParams, GetCollectionSubscribersParams, CreateProductParams, UpdateProductParams, DeleteProductParams, GetProductParams, GetProductsParams, CreateOrderParams, UpdateOrderParams, GetOrderParams, GetOrdersParams, UpdateOrderStatusParams, UpdateOrderPaymentStatusParams, GetQuoteParams, CheckoutParams, CreateReservationParams, UpdateReservationParams, ReservationCheckoutParams, GetReservationParams, SearchReservationsParams, SearchMyReservationsParams, GetReservationQuoteParams, CreateServiceParams, UpdateServiceParams, DeleteServiceParams, GetServiceParams, GetServicesParams, GetAvailableSlotsParams, CreateProviderParams, UpdateProviderParams, DeleteProviderParams, GetProviderParams, GetProvidersParams, GetBusinessServiceWorkingTimeParams } from './types.cjs';
|
|
2
2
|
export { ApiResponse, Block, Business, EshopCartItem, EshopStoreState, Price, ReservationCartItem, ReservationStoreState } from './types.cjs';
|
|
3
|
-
import { g as getBlockLabel, a as getBlockTextValue, f as formatBlockValue, p as prepareBlocksForSubmission, e as extractBlockValues, b as getMarketPrice, c as getPriceAmount, d as formatPayment, h as formatMinor, i as createPaymentForCheckout, j as getCurrencySymbol, v as validatePhoneNumber, k as findTimeZone, s as slugify, l as humanize, m as categorify, n as formatDate, o as getSvgContentForAstro, q as fetchSvgContent, r as injectSvgIntoElement } from './svg-
|
|
3
|
+
import { g as getBlockLabel, a as getBlockTextValue, f as formatBlockValue, p as prepareBlocksForSubmission, e as extractBlockValues, b as getMarketPrice, c as getPriceAmount, d as formatPayment, h as formatMinor, i as createPaymentForCheckout, j as getCurrencySymbol, v as validatePhoneNumber, k as findTimeZone, s as slugify, l as humanize, m as categorify, n as formatDate, o as getSvgContentForAstro, q as fetchSvgContent, r as injectSvgIntoElement } from './svg-3F_m7296.cjs';
|
|
4
4
|
|
|
5
5
|
interface AuthTokens {
|
|
6
6
|
accessToken: string;
|
|
@@ -12,7 +12,6 @@ interface AuthTokens {
|
|
|
12
12
|
}
|
|
13
13
|
interface HttpClientConfig {
|
|
14
14
|
baseUrl: string;
|
|
15
|
-
storageUrl?: string;
|
|
16
15
|
businessId: string;
|
|
17
16
|
getToken: () => Promise<AuthTokens> | AuthTokens;
|
|
18
17
|
setToken: (tokens: AuthTokens) => void;
|
|
@@ -23,12 +22,11 @@ interface HttpClientConfig {
|
|
|
23
22
|
isAuthenticated?: () => boolean;
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
declare const SDK_VERSION = "0.3.
|
|
25
|
+
declare const SDK_VERSION = "0.3.63";
|
|
27
26
|
declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
|
|
28
27
|
interface ApiConfig {
|
|
29
28
|
httpClient: any;
|
|
30
29
|
businessId: string;
|
|
31
|
-
storageUrl: string;
|
|
32
30
|
baseUrl: string;
|
|
33
31
|
market: string;
|
|
34
32
|
locale: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UpdateUserProfileParams, RequestOptions, DeleteUserParams, AddPhoneNumberParams, PhoneNumberConfirmParams, GetMeParams, SearchUsersParams, SetRoleParams, LoginUserParams, RegisterUserParams, LogoutParams, ConfirmUserParams, GetLoginUrlParams, ForgotPasswordParams, ResetForgotPasswordParams, ResetPasswordParams, UserSubscribeParams, CreateBusinessParams, UpdateBusinessParams, DeleteBusinessParams, GetBusinessParams, GetBusinessesParams, GetBusinessParentsParams, TriggerBuildsParams, GetSubscriptionPlansParams, GetSubscriptionParams, SubscribeParams, CreatePortalSessionParams, InviteUserParams, HandleInvitationParams, TestWebhookParams, GetBusinessMediaParams2, SetProviderScheduleParams, ProcessRefundParams, UploadBusinessMediaParams, DeleteBusinessMediaParams, GetBusinessMediaParams, UpdateMediaParams, CreateRoleParams, UpdateRoleParams, DeleteRoleParams, GetRoleParams, GetRolesParams, TrackEmailOpenParams, GetDeliveryStatsParams, CreatePromoCodeParams, UpdatePromoCodeParams, DeletePromoCodeParams, GetPromoCodeParams, GetPromoCodesParams, GetAnalyticsParams, CreateCollectionParams, UpdateCollectionParams, DeleteCollectionParams, GetCollectionParams, GetCollectionsParams, GenerateBlocksParams, GetEntriesParams, CreateEntryParams, UpdateEntryParams, DeleteCollectionEntryParams, GetCollectionEntryParams, SendEntryParams, GetVariableMetadataParams, GetCollectionSubscribersParams, CreateProductParams, UpdateProductParams, DeleteProductParams, GetProductParams, GetProductsParams, CreateOrderParams, UpdateOrderParams, GetOrderParams, GetOrdersParams, UpdateOrderStatusParams, UpdateOrderPaymentStatusParams, GetQuoteParams, CheckoutParams, CreateReservationParams, UpdateReservationParams, ReservationCheckoutParams, GetReservationParams, SearchReservationsParams, SearchMyReservationsParams, GetReservationQuoteParams, CreateServiceParams, UpdateServiceParams, DeleteServiceParams, GetServiceParams, GetServicesParams, GetAvailableSlotsParams, CreateProviderParams, UpdateProviderParams, DeleteProviderParams, GetProviderParams, GetProvidersParams, GetBusinessServiceWorkingTimeParams } from './types.js';
|
|
2
2
|
export { ApiResponse, Block, Business, EshopCartItem, EshopStoreState, Price, ReservationCartItem, ReservationStoreState } from './types.js';
|
|
3
|
-
import { g as getBlockLabel, a as getBlockTextValue, f as formatBlockValue, p as prepareBlocksForSubmission, e as extractBlockValues, b as getMarketPrice, c as getPriceAmount, d as formatPayment, h as formatMinor, i as createPaymentForCheckout, j as getCurrencySymbol, v as validatePhoneNumber, k as findTimeZone, s as slugify, l as humanize, m as categorify, n as formatDate, o as getSvgContentForAstro, q as fetchSvgContent, r as injectSvgIntoElement } from './svg-
|
|
3
|
+
import { g as getBlockLabel, a as getBlockTextValue, f as formatBlockValue, p as prepareBlocksForSubmission, e as extractBlockValues, b as getMarketPrice, c as getPriceAmount, d as formatPayment, h as formatMinor, i as createPaymentForCheckout, j as getCurrencySymbol, v as validatePhoneNumber, k as findTimeZone, s as slugify, l as humanize, m as categorify, n as formatDate, o as getSvgContentForAstro, q as fetchSvgContent, r as injectSvgIntoElement } from './svg-4hIdMU6f.js';
|
|
4
4
|
|
|
5
5
|
interface AuthTokens {
|
|
6
6
|
accessToken: string;
|
|
@@ -12,7 +12,6 @@ interface AuthTokens {
|
|
|
12
12
|
}
|
|
13
13
|
interface HttpClientConfig {
|
|
14
14
|
baseUrl: string;
|
|
15
|
-
storageUrl?: string;
|
|
16
15
|
businessId: string;
|
|
17
16
|
getToken: () => Promise<AuthTokens> | AuthTokens;
|
|
18
17
|
setToken: (tokens: AuthTokens) => void;
|
|
@@ -23,12 +22,11 @@ interface HttpClientConfig {
|
|
|
23
22
|
isAuthenticated?: () => boolean;
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
declare const SDK_VERSION = "0.3.
|
|
25
|
+
declare const SDK_VERSION = "0.3.63";
|
|
27
26
|
declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
|
|
28
27
|
interface ApiConfig {
|
|
29
28
|
httpClient: any;
|
|
30
29
|
businessId: string;
|
|
31
|
-
storageUrl: string;
|
|
32
30
|
baseUrl: string;
|
|
33
31
|
market: string;
|
|
34
32
|
locale: string;
|
package/dist/index.js
CHANGED
|
@@ -683,44 +683,30 @@ var getBlockFromArray = (entry, blockKey, locale = "en") => {
|
|
|
683
683
|
return acc;
|
|
684
684
|
});
|
|
685
685
|
};
|
|
686
|
-
var getImageUrl = (imageBlock, isBlock = true
|
|
686
|
+
var getImageUrl = (imageBlock, isBlock = true) => {
|
|
687
687
|
if (!imageBlock) return null;
|
|
688
|
-
const isExternalUrl = (url) => {
|
|
689
|
-
return url.startsWith("http://") || url.startsWith("https://");
|
|
690
|
-
};
|
|
691
688
|
if (imageBlock.type === "RELATIONSHIP" && Array.isArray(imageBlock.value)) {
|
|
692
689
|
const mediaValue = imageBlock.value[0];
|
|
693
690
|
if (mediaValue && mediaValue.mimeType) {
|
|
694
691
|
if (mediaValue.resolutions && mediaValue.resolutions.original && mediaValue.resolutions.original.url) {
|
|
695
|
-
|
|
696
|
-
return isExternalUrl(url) ? url : `${storageUrl}/${url}`;
|
|
692
|
+
return mediaValue.resolutions.original.url;
|
|
697
693
|
}
|
|
698
694
|
if (mediaValue.url) {
|
|
699
|
-
return
|
|
695
|
+
return mediaValue.url;
|
|
700
696
|
}
|
|
701
697
|
}
|
|
702
698
|
return null;
|
|
703
699
|
}
|
|
704
700
|
if (isBlock) {
|
|
705
701
|
if (typeof imageBlock === "string") {
|
|
706
|
-
|
|
707
|
-
return imageBlock;
|
|
708
|
-
}
|
|
709
|
-
return `${storageUrl}/${imageBlock}`;
|
|
702
|
+
return imageBlock;
|
|
710
703
|
}
|
|
711
704
|
if (imageBlock.url) {
|
|
712
|
-
|
|
713
|
-
return imageBlock.url;
|
|
714
|
-
}
|
|
715
|
-
return `${storageUrl}/${imageBlock.url}`;
|
|
705
|
+
return imageBlock.url;
|
|
716
706
|
}
|
|
717
707
|
}
|
|
718
708
|
if (imageBlock.resolutions && imageBlock.resolutions.original && imageBlock.resolutions.original.url) {
|
|
719
|
-
|
|
720
|
-
if (isExternalUrl(url)) {
|
|
721
|
-
return url;
|
|
722
|
-
}
|
|
723
|
-
return `${storageUrl}/${url}`;
|
|
709
|
+
return imageBlock.resolutions.original.url;
|
|
724
710
|
}
|
|
725
711
|
return null;
|
|
726
712
|
};
|
|
@@ -765,7 +751,7 @@ var createCmsApi = (apiConfig) => {
|
|
|
765
751
|
},
|
|
766
752
|
getImage(key) {
|
|
767
753
|
const block = getBlockFromArray(response, key, apiConfig.locale);
|
|
768
|
-
return getImageUrl(block, true
|
|
754
|
+
return getImageUrl(block, true);
|
|
769
755
|
}
|
|
770
756
|
};
|
|
771
757
|
},
|
|
@@ -1526,7 +1512,7 @@ async function injectSvgIntoElement(mediaObject, targetElement, className) {
|
|
|
1526
1512
|
}
|
|
1527
1513
|
|
|
1528
1514
|
// src/index.ts
|
|
1529
|
-
var SDK_VERSION = "0.3.
|
|
1515
|
+
var SDK_VERSION = "0.3.63";
|
|
1530
1516
|
var SUPPORTED_FRAMEWORKS = [
|
|
1531
1517
|
"astro",
|
|
1532
1518
|
"react",
|
|
@@ -1540,11 +1526,9 @@ function createArkySDK(config) {
|
|
|
1540
1526
|
`[Arky SDK v${SDK_VERSION}] Initializing with market: ${config.market}, businessId: ${config.businessId}, locale: ${locale}`
|
|
1541
1527
|
);
|
|
1542
1528
|
const httpClient = createHttpClient(config);
|
|
1543
|
-
const storageUrl = config.storageUrl || "https://storage.arky.io/dev";
|
|
1544
1529
|
const apiConfig = {
|
|
1545
1530
|
httpClient,
|
|
1546
1531
|
businessId: config.businessId,
|
|
1547
|
-
storageUrl,
|
|
1548
1532
|
baseUrl: config.baseUrl,
|
|
1549
1533
|
market: config.market,
|
|
1550
1534
|
locale,
|
|
@@ -1581,7 +1565,7 @@ function createArkySDK(config) {
|
|
|
1581
1565
|
setToken: config.setToken,
|
|
1582
1566
|
utils: {
|
|
1583
1567
|
// Block utilities
|
|
1584
|
-
getImageUrl: (imageBlock, isBlock = true) => getImageUrl(imageBlock, isBlock
|
|
1568
|
+
getImageUrl: (imageBlock, isBlock = true) => getImageUrl(imageBlock, isBlock),
|
|
1585
1569
|
getBlockValue,
|
|
1586
1570
|
getBlockValues,
|
|
1587
1571
|
getBlockLabel,
|