arky-sdk 0.3.62 → 0.3.64
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 +46 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -4
- package/dist/index.d.ts +19 -4
- package/dist/index.js +46 -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,23 @@ interface HttpClientConfig {
|
|
|
23
22
|
isAuthenticated?: () => boolean;
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
interface ScanDataParams {
|
|
26
|
+
key: string;
|
|
27
|
+
}
|
|
28
|
+
interface PutDataParams {
|
|
29
|
+
key: string;
|
|
30
|
+
value: any;
|
|
31
|
+
oldKey?: string;
|
|
32
|
+
}
|
|
33
|
+
interface DeleteDataParams {
|
|
34
|
+
key: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare const SDK_VERSION = "0.3.64";
|
|
27
38
|
declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
|
|
28
39
|
interface ApiConfig {
|
|
29
40
|
httpClient: any;
|
|
30
41
|
businessId: string;
|
|
31
|
-
storageUrl: string;
|
|
32
42
|
baseUrl: string;
|
|
33
43
|
market: string;
|
|
34
44
|
locale: string;
|
|
@@ -156,6 +166,11 @@ declare function createArkySDK(config: HttpClientConfig & {
|
|
|
156
166
|
getProviders(params: GetProvidersParams, options?: RequestOptions): Promise<any>;
|
|
157
167
|
getProviderWorkingTime(params: GetBusinessServiceWorkingTimeParams, options?: RequestOptions): Promise<any>;
|
|
158
168
|
};
|
|
169
|
+
database: {
|
|
170
|
+
scanData(params: ScanDataParams, options?: RequestOptions): Promise<any[]>;
|
|
171
|
+
putData(params: PutDataParams, options?: RequestOptions): Promise<void>;
|
|
172
|
+
deleteData(params: DeleteDataParams, options?: RequestOptions): Promise<void>;
|
|
173
|
+
};
|
|
159
174
|
setBusinessId: (businessId: string) => void;
|
|
160
175
|
getBusinessId: () => string;
|
|
161
176
|
setMarket: (market: string) => void;
|
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,23 @@ interface HttpClientConfig {
|
|
|
23
22
|
isAuthenticated?: () => boolean;
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
interface ScanDataParams {
|
|
26
|
+
key: string;
|
|
27
|
+
}
|
|
28
|
+
interface PutDataParams {
|
|
29
|
+
key: string;
|
|
30
|
+
value: any;
|
|
31
|
+
oldKey?: string;
|
|
32
|
+
}
|
|
33
|
+
interface DeleteDataParams {
|
|
34
|
+
key: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare const SDK_VERSION = "0.3.64";
|
|
27
38
|
declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
|
|
28
39
|
interface ApiConfig {
|
|
29
40
|
httpClient: any;
|
|
30
41
|
businessId: string;
|
|
31
|
-
storageUrl: string;
|
|
32
42
|
baseUrl: string;
|
|
33
43
|
market: string;
|
|
34
44
|
locale: string;
|
|
@@ -156,6 +166,11 @@ declare function createArkySDK(config: HttpClientConfig & {
|
|
|
156
166
|
getProviders(params: GetProvidersParams, options?: RequestOptions): Promise<any>;
|
|
157
167
|
getProviderWorkingTime(params: GetBusinessServiceWorkingTimeParams, options?: RequestOptions): Promise<any>;
|
|
158
168
|
};
|
|
169
|
+
database: {
|
|
170
|
+
scanData(params: ScanDataParams, options?: RequestOptions): Promise<any[]>;
|
|
171
|
+
putData(params: PutDataParams, options?: RequestOptions): Promise<void>;
|
|
172
|
+
deleteData(params: DeleteDataParams, options?: RequestOptions): Promise<void>;
|
|
173
|
+
};
|
|
159
174
|
setBusinessId: (businessId: string) => void;
|
|
160
175
|
getBusinessId: () => string;
|
|
161
176
|
setMarket: (market: string) => void;
|
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
|
},
|
|
@@ -1171,6 +1157,42 @@ var createReservationApi = (apiConfig) => {
|
|
|
1171
1157
|
};
|
|
1172
1158
|
};
|
|
1173
1159
|
|
|
1160
|
+
// src/api/database.ts
|
|
1161
|
+
var createDatabaseApi = (apiConfig) => {
|
|
1162
|
+
return {
|
|
1163
|
+
async scanData(params, options) {
|
|
1164
|
+
const response = await apiConfig.httpClient.get(
|
|
1165
|
+
`/v1/operations/data`,
|
|
1166
|
+
{
|
|
1167
|
+
...options,
|
|
1168
|
+
params: {
|
|
1169
|
+
key: params.key
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
);
|
|
1173
|
+
return response.value || [];
|
|
1174
|
+
},
|
|
1175
|
+
async putData(params, options) {
|
|
1176
|
+
return apiConfig.httpClient.post(
|
|
1177
|
+
`/v1/operations/data`,
|
|
1178
|
+
params,
|
|
1179
|
+
options
|
|
1180
|
+
);
|
|
1181
|
+
},
|
|
1182
|
+
async deleteData(params, options) {
|
|
1183
|
+
return apiConfig.httpClient.delete(
|
|
1184
|
+
`/v1/operations/data`,
|
|
1185
|
+
{
|
|
1186
|
+
...options,
|
|
1187
|
+
params: {
|
|
1188
|
+
key: params.key
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
);
|
|
1192
|
+
}
|
|
1193
|
+
};
|
|
1194
|
+
};
|
|
1195
|
+
|
|
1174
1196
|
// src/utils/currency.ts
|
|
1175
1197
|
function getCurrencySymbol(currency) {
|
|
1176
1198
|
const currencySymbols = {
|
|
@@ -1526,7 +1548,7 @@ async function injectSvgIntoElement(mediaObject, targetElement, className) {
|
|
|
1526
1548
|
}
|
|
1527
1549
|
|
|
1528
1550
|
// src/index.ts
|
|
1529
|
-
var SDK_VERSION = "0.3.
|
|
1551
|
+
var SDK_VERSION = "0.3.64";
|
|
1530
1552
|
var SUPPORTED_FRAMEWORKS = [
|
|
1531
1553
|
"astro",
|
|
1532
1554
|
"react",
|
|
@@ -1540,11 +1562,9 @@ function createArkySDK(config) {
|
|
|
1540
1562
|
`[Arky SDK v${SDK_VERSION}] Initializing with market: ${config.market}, businessId: ${config.businessId}, locale: ${locale}`
|
|
1541
1563
|
);
|
|
1542
1564
|
const httpClient = createHttpClient(config);
|
|
1543
|
-
const storageUrl = config.storageUrl || "https://storage.arky.io/dev";
|
|
1544
1565
|
const apiConfig = {
|
|
1545
1566
|
httpClient,
|
|
1546
1567
|
businessId: config.businessId,
|
|
1547
|
-
storageUrl,
|
|
1548
1568
|
baseUrl: config.baseUrl,
|
|
1549
1569
|
market: config.market,
|
|
1550
1570
|
locale,
|
|
@@ -1564,6 +1584,7 @@ function createArkySDK(config) {
|
|
|
1564
1584
|
cms: createCmsApi(apiConfig),
|
|
1565
1585
|
eshop: createEshopApi(apiConfig),
|
|
1566
1586
|
reservation: createReservationApi(apiConfig),
|
|
1587
|
+
database: createDatabaseApi(apiConfig),
|
|
1567
1588
|
setBusinessId: (businessId) => {
|
|
1568
1589
|
apiConfig.businessId = businessId;
|
|
1569
1590
|
},
|
|
@@ -1581,7 +1602,7 @@ function createArkySDK(config) {
|
|
|
1581
1602
|
setToken: config.setToken,
|
|
1582
1603
|
utils: {
|
|
1583
1604
|
// Block utilities
|
|
1584
|
-
getImageUrl: (imageBlock, isBlock = true) => getImageUrl(imageBlock, isBlock
|
|
1605
|
+
getImageUrl: (imageBlock, isBlock = true) => getImageUrl(imageBlock, isBlock),
|
|
1585
1606
|
getBlockValue,
|
|
1586
1607
|
getBlockValues,
|
|
1587
1608
|
getBlockLabel,
|