arky-sdk 0.3.71 → 0.3.72
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 +26 -26
- 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 +26 -26
- 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.72";
|
|
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.72";
|
|
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.72";
|
|
1674
1674
|
var SUPPORTED_FRAMEWORKS = [
|
|
1675
1675
|
"astro",
|
|
1676
1676
|
"react",
|
|
@@ -1678,7 +1678,7 @@ 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
1683
|
console.log(
|
|
1684
1684
|
`[Arky SDK v${SDK_VERSION}] Initializing with market: ${config.market}, businessId: ${config.businessId}, locale: ${locale}`
|
|
@@ -1695,6 +1695,28 @@ function createArkySDK(config) {
|
|
|
1695
1695
|
};
|
|
1696
1696
|
const userApi = createUserApi(apiConfig);
|
|
1697
1697
|
const autoGuest = config.autoGuest !== void 0 ? config.autoGuest : true;
|
|
1698
|
+
if (autoGuest) {
|
|
1699
|
+
try {
|
|
1700
|
+
const tokens = await config.getToken();
|
|
1701
|
+
if (!tokens.accessToken && !tokens.refreshToken) {
|
|
1702
|
+
const result = await httpClient.post("/v1/users/login", {
|
|
1703
|
+
provider: "GUEST"
|
|
1704
|
+
});
|
|
1705
|
+
const token = result.accessToken || result.token || "";
|
|
1706
|
+
if (token) {
|
|
1707
|
+
config.setToken(result);
|
|
1708
|
+
}
|
|
1709
|
+
console.log(
|
|
1710
|
+
"[SDK Init] Created guest token:",
|
|
1711
|
+
token ? "Success" : "Failed"
|
|
1712
|
+
);
|
|
1713
|
+
} else {
|
|
1714
|
+
console.log("[SDK Init] Using existing token from storage");
|
|
1715
|
+
}
|
|
1716
|
+
} catch (error) {
|
|
1717
|
+
console.error("[SDK Init] Failed to initialize auth:", error);
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1698
1720
|
const sdk = {
|
|
1699
1721
|
user: userApi,
|
|
1700
1722
|
business: createBusinessApi(apiConfig),
|
|
@@ -1723,6 +1745,8 @@ function createArkySDK(config) {
|
|
|
1723
1745
|
isAuthenticated: config.isAuthenticated || (() => false),
|
|
1724
1746
|
logout: config.logout,
|
|
1725
1747
|
setToken: config.setToken,
|
|
1748
|
+
// Top-level block utilities for convenience
|
|
1749
|
+
extractBlockValues,
|
|
1726
1750
|
utils: {
|
|
1727
1751
|
// Block utilities
|
|
1728
1752
|
getImageUrl: (imageBlock, isBlock = true) => getImageUrl(imageBlock, isBlock),
|
|
@@ -1759,30 +1783,6 @@ function createArkySDK(config) {
|
|
|
1759
1783
|
injectSvgIntoElement
|
|
1760
1784
|
}
|
|
1761
1785
|
};
|
|
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
1786
|
return sdk;
|
|
1787
1787
|
}
|
|
1788
1788
|
|