arky-sdk 0.3.71 → 0.3.73
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 +19 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +19 -29
- package/dist/index.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, CreateFeatureFlagParams, FeatureFlag, GetFeatureFlagParams, GetFeatureFlagsParams, UpdateFeatureFlagParams, DeleteFeatureFlagParams, GetFeatureFlagResultsParams, FlagResults, GetVariantParams, GetVariantResponse, TrackEventParams, TrackEventResponse } 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,
|
|
3
|
+
import { e as extractBlockValues, g as getBlockLabel, a as getBlockTextValue, f as formatBlockValue, p as prepareBlocksForSubmission, 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;
|
|
@@ -44,7 +44,7 @@ interface RunScriptResponse {
|
|
|
44
44
|
message: string;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
declare const SDK_VERSION = "0.3.
|
|
47
|
+
declare const SDK_VERSION = "0.3.73";
|
|
48
48
|
declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
|
|
49
49
|
interface ApiConfig {
|
|
50
50
|
httpClient: any;
|
|
@@ -59,7 +59,7 @@ interface ApiConfig {
|
|
|
59
59
|
declare function createArkySDK(config: HttpClientConfig & {
|
|
60
60
|
market: string;
|
|
61
61
|
locale?: string;
|
|
62
|
-
}): {
|
|
62
|
+
}): Promise<{
|
|
63
63
|
user: {
|
|
64
64
|
updateUser(params: UpdateUserProfileParams, options?: RequestOptions): Promise<any>;
|
|
65
65
|
deleteUser(params: DeleteUserParams, options?: RequestOptions): Promise<any>;
|
|
@@ -212,6 +212,7 @@ declare function createArkySDK(config: HttpClientConfig & {
|
|
|
212
212
|
isAuthenticated: () => boolean;
|
|
213
213
|
logout: () => void;
|
|
214
214
|
setToken: (tokens: AuthTokens) => void;
|
|
215
|
+
extractBlockValues: typeof extractBlockValues;
|
|
215
216
|
utils: {
|
|
216
217
|
getImageUrl: (imageBlock: any, isBlock?: boolean) => any;
|
|
217
218
|
getBlockValue: (entry: any, blockKey: string) => any;
|
|
@@ -246,6 +247,6 @@ declare function createArkySDK(config: HttpClientConfig & {
|
|
|
246
247
|
fetchSvgContent: typeof fetchSvgContent;
|
|
247
248
|
injectSvgIntoElement: typeof injectSvgIntoElement;
|
|
248
249
|
};
|
|
249
|
-
}
|
|
250
|
+
}>;
|
|
250
251
|
|
|
251
252
|
export { type ApiConfig, type HttpClientConfig, SDK_VERSION, SUPPORTED_FRAMEWORKS, createArkySDK };
|
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, CreateFeatureFlagParams, FeatureFlag, GetFeatureFlagParams, GetFeatureFlagsParams, UpdateFeatureFlagParams, DeleteFeatureFlagParams, GetFeatureFlagResultsParams, FlagResults, GetVariantParams, GetVariantResponse, TrackEventParams, TrackEventResponse } 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,
|
|
3
|
+
import { e as extractBlockValues, g as getBlockLabel, a as getBlockTextValue, f as formatBlockValue, p as prepareBlocksForSubmission, 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;
|
|
@@ -44,7 +44,7 @@ interface RunScriptResponse {
|
|
|
44
44
|
message: string;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
declare const SDK_VERSION = "0.3.
|
|
47
|
+
declare const SDK_VERSION = "0.3.73";
|
|
48
48
|
declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
|
|
49
49
|
interface ApiConfig {
|
|
50
50
|
httpClient: any;
|
|
@@ -59,7 +59,7 @@ interface ApiConfig {
|
|
|
59
59
|
declare function createArkySDK(config: HttpClientConfig & {
|
|
60
60
|
market: string;
|
|
61
61
|
locale?: string;
|
|
62
|
-
}): {
|
|
62
|
+
}): Promise<{
|
|
63
63
|
user: {
|
|
64
64
|
updateUser(params: UpdateUserProfileParams, options?: RequestOptions): Promise<any>;
|
|
65
65
|
deleteUser(params: DeleteUserParams, options?: RequestOptions): Promise<any>;
|
|
@@ -212,6 +212,7 @@ declare function createArkySDK(config: HttpClientConfig & {
|
|
|
212
212
|
isAuthenticated: () => boolean;
|
|
213
213
|
logout: () => void;
|
|
214
214
|
setToken: (tokens: AuthTokens) => void;
|
|
215
|
+
extractBlockValues: typeof extractBlockValues;
|
|
215
216
|
utils: {
|
|
216
217
|
getImageUrl: (imageBlock: any, isBlock?: boolean) => any;
|
|
217
218
|
getBlockValue: (entry: any, blockKey: string) => any;
|
|
@@ -246,6 +247,6 @@ declare function createArkySDK(config: HttpClientConfig & {
|
|
|
246
247
|
fetchSvgContent: typeof fetchSvgContent;
|
|
247
248
|
injectSvgIntoElement: typeof injectSvgIntoElement;
|
|
248
249
|
};
|
|
249
|
-
}
|
|
250
|
+
}>;
|
|
250
251
|
|
|
251
252
|
export { type ApiConfig, type HttpClientConfig, SDK_VERSION, SUPPORTED_FRAMEWORKS, createArkySDK };
|
package/dist/index.js
CHANGED
|
@@ -1670,7 +1670,7 @@ async function injectSvgIntoElement(mediaObject, targetElement, className) {
|
|
|
1670
1670
|
}
|
|
1671
1671
|
|
|
1672
1672
|
// src/index.ts
|
|
1673
|
-
var SDK_VERSION = "0.3.
|
|
1673
|
+
var SDK_VERSION = "0.3.73";
|
|
1674
1674
|
var SUPPORTED_FRAMEWORKS = [
|
|
1675
1675
|
"astro",
|
|
1676
1676
|
"react",
|
|
@@ -1678,11 +1678,8 @@ var SUPPORTED_FRAMEWORKS = [
|
|
|
1678
1678
|
"svelte",
|
|
1679
1679
|
"vanilla"
|
|
1680
1680
|
];
|
|
1681
|
-
function createArkySDK(config) {
|
|
1681
|
+
async function createArkySDK(config) {
|
|
1682
1682
|
const locale = config.locale || "en";
|
|
1683
|
-
console.log(
|
|
1684
|
-
`[Arky SDK v${SDK_VERSION}] Initializing with market: ${config.market}, businessId: ${config.businessId}, locale: ${locale}`
|
|
1685
|
-
);
|
|
1686
1683
|
const httpClient = createHttpClient(config);
|
|
1687
1684
|
const apiConfig = {
|
|
1688
1685
|
httpClient,
|
|
@@ -1695,6 +1692,21 @@ function createArkySDK(config) {
|
|
|
1695
1692
|
};
|
|
1696
1693
|
const userApi = createUserApi(apiConfig);
|
|
1697
1694
|
const autoGuest = config.autoGuest !== void 0 ? config.autoGuest : true;
|
|
1695
|
+
if (autoGuest) {
|
|
1696
|
+
try {
|
|
1697
|
+
const tokens = await config.getToken();
|
|
1698
|
+
if (!tokens.accessToken && !tokens.refreshToken) {
|
|
1699
|
+
const result = await httpClient.post("/v1/users/login", {
|
|
1700
|
+
provider: "GUEST"
|
|
1701
|
+
});
|
|
1702
|
+
const token = result.accessToken || result.token || "";
|
|
1703
|
+
if (token) {
|
|
1704
|
+
config.setToken(result);
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
} catch (error) {
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1698
1710
|
const sdk = {
|
|
1699
1711
|
user: userApi,
|
|
1700
1712
|
business: createBusinessApi(apiConfig),
|
|
@@ -1723,6 +1735,8 @@ function createArkySDK(config) {
|
|
|
1723
1735
|
isAuthenticated: config.isAuthenticated || (() => false),
|
|
1724
1736
|
logout: config.logout,
|
|
1725
1737
|
setToken: config.setToken,
|
|
1738
|
+
// Top-level block utilities for convenience
|
|
1739
|
+
extractBlockValues,
|
|
1726
1740
|
utils: {
|
|
1727
1741
|
// Block utilities
|
|
1728
1742
|
getImageUrl: (imageBlock, isBlock = true) => getImageUrl(imageBlock, isBlock),
|
|
@@ -1759,30 +1773,6 @@ function createArkySDK(config) {
|
|
|
1759
1773
|
injectSvgIntoElement
|
|
1760
1774
|
}
|
|
1761
1775
|
};
|
|
1762
|
-
if (autoGuest) {
|
|
1763
|
-
Promise.resolve().then(async () => {
|
|
1764
|
-
try {
|
|
1765
|
-
const tokens = await config.getToken();
|
|
1766
|
-
if (!tokens.accessToken && !tokens.refreshToken) {
|
|
1767
|
-
const result = await httpClient.post("/v1/users/login", {
|
|
1768
|
-
provider: "GUEST"
|
|
1769
|
-
});
|
|
1770
|
-
const token = result.accessToken || result.token || "";
|
|
1771
|
-
if (token) {
|
|
1772
|
-
config.setToken(result);
|
|
1773
|
-
}
|
|
1774
|
-
console.log(
|
|
1775
|
-
"[SDK Init] Created guest token:",
|
|
1776
|
-
token ? "Success" : "Failed"
|
|
1777
|
-
);
|
|
1778
|
-
} else {
|
|
1779
|
-
console.log("[SDK Init] Using existing token from storage");
|
|
1780
|
-
}
|
|
1781
|
-
} catch (error) {
|
|
1782
|
-
console.error("[SDK Init] Failed to initialize auth:", error);
|
|
1783
|
-
}
|
|
1784
|
-
});
|
|
1785
|
-
}
|
|
1786
1776
|
return sdk;
|
|
1787
1777
|
}
|
|
1788
1778
|
|