arky-sdk 0.3.6 → 0.3.8

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.
@@ -0,0 +1,87 @@
1
+ import { Price, Payment } from './types.js';
2
+
3
+ interface Block {
4
+ id: string;
5
+ key: string;
6
+ type: string;
7
+ properties: any;
8
+ value: any;
9
+ }
10
+ interface Collection {
11
+ id: string;
12
+ blocks: Block[];
13
+ }
14
+ interface CollectionEntry {
15
+ id: string;
16
+ collection_id: string;
17
+ blocks: Block[];
18
+ }
19
+ declare function getBlockLabel(block: any, locale?: string): string;
20
+ declare function formatBlockValue(block: any): string;
21
+ declare function prepareBlocksForSubmission(formData: any): any[];
22
+ declare function extractBlockValues(blocks: any[]): Record<string, any>;
23
+ declare function getBlockTextValue(block: any, locale?: string): string;
24
+ declare const getBlockValue: (entry: any, blockKey: string) => any;
25
+ declare const getBlockValues: (entry: any, blockKey: string) => any;
26
+ declare const getBlockObjectValues: (entry: any, blockKey: string, locale?: string) => any;
27
+ declare const getBlockFromArray: (entry: any, blockKey: string, locale?: string) => any;
28
+ declare const getImageUrl: (imageBlock: any, isBlock?: boolean, storageUrl?: string) => any;
29
+ declare function getGalleryThumbnail(gallery: any): any;
30
+ declare function thumbnailUrl(service: any, storageUrl?: string): string;
31
+ declare const translateMap: (labels: any, lang: string, fallback?: string) => any;
32
+
33
+ declare function convertToMajor(minorAmount: number): number;
34
+ declare function convertToMinor(majorAmount: number): number;
35
+ declare function getCurrencyFromMarket(marketId: string): string;
36
+ declare function formatCurrencyAmount(amount: number, currency: string, options?: {
37
+ showSymbols?: boolean;
38
+ decimalPlaces?: number;
39
+ customSymbol?: string;
40
+ }): string;
41
+ declare function formatMinor(amountMinor: number, currency: string, options?: {
42
+ showSymbols?: boolean;
43
+ decimalPlaces?: number;
44
+ customSymbol?: string;
45
+ }): string;
46
+ declare function formatPayment(payment: Payment, options?: {
47
+ showSymbols?: boolean;
48
+ decimalPlaces?: number;
49
+ showBreakdown?: boolean;
50
+ }): string;
51
+ declare function getMarketPrice(prices: Price[], marketId: string, businessMarkets?: any[], options?: {
52
+ showSymbols?: boolean;
53
+ decimalPlaces?: number;
54
+ showCompareAt?: boolean;
55
+ fallbackMarket?: string;
56
+ }): string;
57
+ declare function getPriceAmount(prices: Price[], marketId: string, fallbackMarket?: string): number;
58
+ declare function createPaymentForCheckout(subtotalMinor: number, marketId: string, currency: string, paymentMethod: any, options?: {
59
+ discount?: number;
60
+ tax?: number;
61
+ promoCodeId?: string;
62
+ }): Payment;
63
+
64
+ /**
65
+ * Maps currency codes to their display symbols
66
+ */
67
+ declare function getCurrencySymbol(currency: string): string;
68
+
69
+ interface ValidationResult {
70
+ isValid: boolean;
71
+ error?: string;
72
+ }
73
+ declare function validatePhoneNumber(phone: string): ValidationResult;
74
+ declare function validateEmail(email: string): ValidationResult;
75
+ declare function validateVerificationCode(code: string): ValidationResult;
76
+ declare function validateRequired(value: any, fieldName?: string): ValidationResult;
77
+
78
+ declare const tzGroups: {
79
+ label: string;
80
+ zones: {
81
+ label: string;
82
+ value: string;
83
+ }[];
84
+ }[];
85
+ declare function findTimeZone(groups: typeof tzGroups): string;
86
+
87
+ export { tzGroups as A, type Block as B, type Collection as C, validateEmail as D, validateVerificationCode as E, validateRequired as F, type ValidationResult as V, getMarketPrice as a, getPriceAmount as b, formatMinor as c, createPaymentForCheckout as d, getCurrencySymbol as e, formatPayment as f, getGalleryThumbnail as g, findTimeZone as h, type CollectionEntry as i, getBlockLabel as j, formatBlockValue as k, extractBlockValues as l, getBlockTextValue as m, getBlockValue as n, getBlockValues as o, prepareBlocksForSubmission as p, getBlockObjectValues as q, getBlockFromArray as r, getImageUrl as s, thumbnailUrl as t, translateMap as u, validatePhoneNumber as v, convertToMajor as w, convertToMinor as x, getCurrencyFromMarket as y, formatCurrencyAmount as z };
@@ -0,0 +1,87 @@
1
+ import { Price, Payment } from './types.cjs';
2
+
3
+ interface Block {
4
+ id: string;
5
+ key: string;
6
+ type: string;
7
+ properties: any;
8
+ value: any;
9
+ }
10
+ interface Collection {
11
+ id: string;
12
+ blocks: Block[];
13
+ }
14
+ interface CollectionEntry {
15
+ id: string;
16
+ collection_id: string;
17
+ blocks: Block[];
18
+ }
19
+ declare function getBlockLabel(block: any, locale?: string): string;
20
+ declare function formatBlockValue(block: any): string;
21
+ declare function prepareBlocksForSubmission(formData: any): any[];
22
+ declare function extractBlockValues(blocks: any[]): Record<string, any>;
23
+ declare function getBlockTextValue(block: any, locale?: string): string;
24
+ declare const getBlockValue: (entry: any, blockKey: string) => any;
25
+ declare const getBlockValues: (entry: any, blockKey: string) => any;
26
+ declare const getBlockObjectValues: (entry: any, blockKey: string, locale?: string) => any;
27
+ declare const getBlockFromArray: (entry: any, blockKey: string, locale?: string) => any;
28
+ declare const getImageUrl: (imageBlock: any, isBlock?: boolean, storageUrl?: string) => any;
29
+ declare function getGalleryThumbnail(gallery: any): any;
30
+ declare function thumbnailUrl(service: any, storageUrl?: string): string;
31
+ declare const translateMap: (labels: any, lang: string, fallback?: string) => any;
32
+
33
+ declare function convertToMajor(minorAmount: number): number;
34
+ declare function convertToMinor(majorAmount: number): number;
35
+ declare function getCurrencyFromMarket(marketId: string): string;
36
+ declare function formatCurrencyAmount(amount: number, currency: string, options?: {
37
+ showSymbols?: boolean;
38
+ decimalPlaces?: number;
39
+ customSymbol?: string;
40
+ }): string;
41
+ declare function formatMinor(amountMinor: number, currency: string, options?: {
42
+ showSymbols?: boolean;
43
+ decimalPlaces?: number;
44
+ customSymbol?: string;
45
+ }): string;
46
+ declare function formatPayment(payment: Payment, options?: {
47
+ showSymbols?: boolean;
48
+ decimalPlaces?: number;
49
+ showBreakdown?: boolean;
50
+ }): string;
51
+ declare function getMarketPrice(prices: Price[], marketId: string, businessMarkets?: any[], options?: {
52
+ showSymbols?: boolean;
53
+ decimalPlaces?: number;
54
+ showCompareAt?: boolean;
55
+ fallbackMarket?: string;
56
+ }): string;
57
+ declare function getPriceAmount(prices: Price[], marketId: string, fallbackMarket?: string): number;
58
+ declare function createPaymentForCheckout(subtotalMinor: number, marketId: string, currency: string, paymentMethod: any, options?: {
59
+ discount?: number;
60
+ tax?: number;
61
+ promoCodeId?: string;
62
+ }): Payment;
63
+
64
+ /**
65
+ * Maps currency codes to their display symbols
66
+ */
67
+ declare function getCurrencySymbol(currency: string): string;
68
+
69
+ interface ValidationResult {
70
+ isValid: boolean;
71
+ error?: string;
72
+ }
73
+ declare function validatePhoneNumber(phone: string): ValidationResult;
74
+ declare function validateEmail(email: string): ValidationResult;
75
+ declare function validateVerificationCode(code: string): ValidationResult;
76
+ declare function validateRequired(value: any, fieldName?: string): ValidationResult;
77
+
78
+ declare const tzGroups: {
79
+ label: string;
80
+ zones: {
81
+ label: string;
82
+ value: string;
83
+ }[];
84
+ }[];
85
+ declare function findTimeZone(groups: typeof tzGroups): string;
86
+
87
+ export { tzGroups as A, type Block as B, type Collection as C, validateEmail as D, validateVerificationCode as E, validateRequired as F, type ValidationResult as V, getMarketPrice as a, getPriceAmount as b, formatMinor as c, createPaymentForCheckout as d, getCurrencySymbol as e, formatPayment as f, getGalleryThumbnail as g, findTimeZone as h, type CollectionEntry as i, getBlockLabel as j, formatBlockValue as k, extractBlockValues as l, getBlockTextValue as m, getBlockValue as n, getBlockValues as o, prepareBlocksForSubmission as p, getBlockObjectValues as q, getBlockFromArray as r, getImageUrl as s, thumbnailUrl as t, translateMap as u, validatePhoneNumber as v, convertToMajor as w, convertToMinor as x, getCurrencyFromMarket as y, formatCurrencyAmount as z };
package/dist/utils.d.cts CHANGED
@@ -1,2 +1,165 @@
1
- export { Z as Block, C as Collection, i as CollectionEntry, E as ERROR_CODES, x as ERROR_CONSTANTS, R as RequestError, y as ServerError, V as ValidationError, U as ValidationResult, P as categorify, D as convertServerErrorToRequestError, G as convertToMajor, H as convertToMinor, d as createPaymentForCheckout, F as errors, l as extractBlockValues, K as fetchSvgContent, h as findTimeZone, k as formatBlockValue, J as formatCurrencyAmount, Q as formatDate, c as formatMinor, f as formatPayment, r as getBlockFromArray, j as getBlockLabel, q as getBlockObjectValues, m as getBlockTextValue, n as getBlockValue, o as getBlockValues, I as getCurrencyFromMarket, e as getCurrencySymbol, z as getErrorMessage, g as getGalleryThumbnail, s as getImageUrl, a as getMarketPrice, b as getPriceAmount, L as getSvgContentForAstro, O as humanize, M as injectSvgIntoElement, A as isErrorCode, p as prepareBlocksForSubmission, N as slugify, t as thumbnailUrl, B as transformErrors, u as translateMap, T as tzGroups, W as validateEmail, v as validatePhoneNumber, Y as validateRequired, X as validateVerificationCode } from './index-DOEos-hV.cjs';
1
+ export { B as Block, C as Collection, i as CollectionEntry, V as ValidationResult, w as convertToMajor, x as convertToMinor, d as createPaymentForCheckout, l as extractBlockValues, h as findTimeZone, k as formatBlockValue, z as formatCurrencyAmount, c as formatMinor, f as formatPayment, r as getBlockFromArray, j as getBlockLabel, q as getBlockObjectValues, m as getBlockTextValue, n as getBlockValue, o as getBlockValues, y as getCurrencyFromMarket, e as getCurrencySymbol, g as getGalleryThumbnail, s as getImageUrl, a as getMarketPrice, b as getPriceAmount, p as prepareBlocksForSubmission, t as thumbnailUrl, u as translateMap, A as tzGroups, D as validateEmail, v as validatePhoneNumber, F as validateRequired, E as validateVerificationCode } from './timezone-Ctc3v4hK.cjs';
2
2
  import './types.cjs';
3
+
4
+ declare const ERROR_CODES: {
5
+ "GENERAL.001": string;
6
+ "GENERAL.002": string;
7
+ "GENERAL.003": string;
8
+ "GENERAL.004": string;
9
+ "GENERAL.005": string;
10
+ "GENERAL.006": string;
11
+ "GOOGLE.001": string;
12
+ "GOOGLE.002": string;
13
+ "GOOGLE.003": string;
14
+ "GOOGLE.004": string;
15
+ "GOOGLE.005": string;
16
+ "GOOGLE.006": string;
17
+ "GOOGLE.007": string;
18
+ "USER.001": string;
19
+ "USER.002": string;
20
+ "USER.003": string;
21
+ "USER.004": string;
22
+ "USER.005": string;
23
+ "USER.006": string;
24
+ "BUSINESS.001": string;
25
+ "BUSINESS.002": string;
26
+ "BUSINESS.003": string;
27
+ "BUSINESS.004": string;
28
+ "BUSINESS.005": string;
29
+ "BUSINESS.006": string;
30
+ "BUSINESS.007": string;
31
+ "BUSINESS.010": string;
32
+ "BUSINESS.011": string;
33
+ "PROVIDER.001": string;
34
+ "PROVIDER.002": string;
35
+ "PROVIDER.003": string;
36
+ "PROVIDER.004": string;
37
+ "PROVIDER.005": string;
38
+ "PROVIDER.006": string;
39
+ "PROVIDER.007": string;
40
+ "PROVIDER.008": string;
41
+ };
42
+ declare const ERROR_CONSTANTS: {
43
+ GENERAL: {
44
+ BAD_REQUEST: string;
45
+ VALIDATION_ERROR: string;
46
+ FORBIDDEN_ERROR: string;
47
+ INTERNAL_SERVER_ERROR: string;
48
+ UNAUTHORIZED: string;
49
+ UNAUTHENTICATED: string;
50
+ };
51
+ USER: {
52
+ NOT_FOUND: string;
53
+ FAILED_TO_CREATE: string;
54
+ FAILED_TO_UPDATE: string;
55
+ FAILED_TO_DELETE: string;
56
+ EMAIL_EXISTS: string;
57
+ FAILED_TO_GET_UPLOAD_URL: string;
58
+ };
59
+ BUSINESS: {
60
+ NOT_FOUND: string;
61
+ FAILED_TO_CREATE: string;
62
+ FAILED_TO_UPDATE: string;
63
+ FAILED_TO_DELETE: string;
64
+ FAILED_TO_GET_UPLOAD_URL: string;
65
+ NAME_REQUIRED: string;
66
+ BUSINESS_ID_REQUIRED: string;
67
+ DESCRIPTION_REQUIRED: string;
68
+ SLUG_INVALID: string;
69
+ };
70
+ };
71
+ type ServerError = {
72
+ message: string;
73
+ error: string;
74
+ statusCode: number;
75
+ validationErrors: {
76
+ field: string;
77
+ error: string;
78
+ }[];
79
+ };
80
+ type ValidationError = {
81
+ field: string;
82
+ error: string;
83
+ };
84
+ type RequestError = {
85
+ validationErrors: ValidationError[];
86
+ };
87
+ declare function getErrorMessage(code: string): string;
88
+ declare function isErrorCode(code: string): boolean;
89
+ declare const transformErrors: (zodError: any) => ValidationError[];
90
+ declare const convertServerErrorToRequestError: (serverError: ServerError, renameRules?: {
91
+ [key: string]: string;
92
+ }) => RequestError;
93
+ declare const errors: {
94
+ GENERAL: {
95
+ BAD_REQUEST: string;
96
+ VALIDATION_ERROR: string;
97
+ FORBIDDEN_ERROR: string;
98
+ INTERNAL_SERVER_ERROR: string;
99
+ UNAUTHORIZED: string;
100
+ UNAUTHENTICATED: string;
101
+ };
102
+ USER: {
103
+ NOT_FOUND: string;
104
+ FAILED_TO_CREATE: string;
105
+ FAILED_TO_UPDATE: string;
106
+ FAILED_TO_DELETE: string;
107
+ EMAIL_EXISTS: string;
108
+ FAILED_TO_GET_UPLOAD_URL: string;
109
+ };
110
+ BUSINESS: {
111
+ NOT_FOUND: string;
112
+ FAILED_TO_CREATE: string;
113
+ FAILED_TO_UPDATE: string;
114
+ FAILED_TO_DELETE: string;
115
+ FAILED_TO_GET_UPLOAD_URL: string;
116
+ NAME_REQUIRED: string;
117
+ BUSINESS_ID_REQUIRED: string;
118
+ DESCRIPTION_REQUIRED: string;
119
+ SLUG_INVALID: string;
120
+ };
121
+ };
122
+
123
+ declare function fetchSvgContent(mediaObject: any): Promise<string | null>;
124
+ /**
125
+ * Server-side helper for Astro components to fetch SVG content during SSR
126
+ *
127
+ * @param mediaObject The media object from the CMS
128
+ * @returns The SVG content as a string, or empty string on failure
129
+ */
130
+ declare function getSvgContentForAstro(mediaObject: any): Promise<string>;
131
+ /**
132
+ * Client-side helper to fetch and inject SVG content into DOM elements
133
+ *
134
+ * @param mediaObject The media object from the CMS
135
+ * @param targetElement The DOM element to inject the SVG into
136
+ * @param className Optional CSS class to add to the SVG
137
+ */
138
+ declare function injectSvgIntoElement(mediaObject: any, targetElement: HTMLElement, className?: string): Promise<void>;
139
+
140
+ declare const locales: readonly ["en", "sr-latn"];
141
+ /**
142
+ * * returns "slugified" text.
143
+ * @param text: string - text to slugify
144
+ */
145
+ declare function slugify(text: string): string;
146
+ /**
147
+ * * returns "humanized" text. runs slugify() and then replaces - with space and upper case first letter of every word, and lower case the rest
148
+ * @param text: string - text to humanize
149
+ */
150
+ declare function humanize(text: string): string;
151
+ /**
152
+ * * returns "categorified" text. runs slugify() and then replaces - with space and upper cases everything
153
+ * @param text: string - text to categorify
154
+ * @returns string - categorified text
155
+ */
156
+ declare function categorify(text: string): string;
157
+ /**
158
+ * * returns a nicely formatted string of the date passed
159
+ * @param date: string | number | Date - date to format
160
+ * @param locale: string - locale to format the date in
161
+ * @returns string - formatted date
162
+ */
163
+ declare function formatDate(date: string | number | Date, locale: (typeof locales)[number]): string;
164
+
165
+ export { ERROR_CODES, ERROR_CONSTANTS, type RequestError, type ServerError, type ValidationError, categorify, convertServerErrorToRequestError, errors, fetchSvgContent, formatDate, getErrorMessage, getSvgContentForAstro, humanize, injectSvgIntoElement, isErrorCode, slugify, transformErrors };
package/dist/utils.d.ts CHANGED
@@ -1,2 +1,165 @@
1
- export { Z as Block, C as Collection, i as CollectionEntry, E as ERROR_CODES, x as ERROR_CONSTANTS, R as RequestError, y as ServerError, V as ValidationError, U as ValidationResult, P as categorify, D as convertServerErrorToRequestError, G as convertToMajor, H as convertToMinor, d as createPaymentForCheckout, F as errors, l as extractBlockValues, K as fetchSvgContent, h as findTimeZone, k as formatBlockValue, J as formatCurrencyAmount, Q as formatDate, c as formatMinor, f as formatPayment, r as getBlockFromArray, j as getBlockLabel, q as getBlockObjectValues, m as getBlockTextValue, n as getBlockValue, o as getBlockValues, I as getCurrencyFromMarket, e as getCurrencySymbol, z as getErrorMessage, g as getGalleryThumbnail, s as getImageUrl, a as getMarketPrice, b as getPriceAmount, L as getSvgContentForAstro, O as humanize, M as injectSvgIntoElement, A as isErrorCode, p as prepareBlocksForSubmission, N as slugify, t as thumbnailUrl, B as transformErrors, u as translateMap, T as tzGroups, W as validateEmail, v as validatePhoneNumber, Y as validateRequired, X as validateVerificationCode } from './index-DEmVFs0E.js';
1
+ export { B as Block, C as Collection, i as CollectionEntry, V as ValidationResult, w as convertToMajor, x as convertToMinor, d as createPaymentForCheckout, l as extractBlockValues, h as findTimeZone, k as formatBlockValue, z as formatCurrencyAmount, c as formatMinor, f as formatPayment, r as getBlockFromArray, j as getBlockLabel, q as getBlockObjectValues, m as getBlockTextValue, n as getBlockValue, o as getBlockValues, y as getCurrencyFromMarket, e as getCurrencySymbol, g as getGalleryThumbnail, s as getImageUrl, a as getMarketPrice, b as getPriceAmount, p as prepareBlocksForSubmission, t as thumbnailUrl, u as translateMap, A as tzGroups, D as validateEmail, v as validatePhoneNumber, F as validateRequired, E as validateVerificationCode } from './timezone-Cnh6zsAn.js';
2
2
  import './types.js';
3
+
4
+ declare const ERROR_CODES: {
5
+ "GENERAL.001": string;
6
+ "GENERAL.002": string;
7
+ "GENERAL.003": string;
8
+ "GENERAL.004": string;
9
+ "GENERAL.005": string;
10
+ "GENERAL.006": string;
11
+ "GOOGLE.001": string;
12
+ "GOOGLE.002": string;
13
+ "GOOGLE.003": string;
14
+ "GOOGLE.004": string;
15
+ "GOOGLE.005": string;
16
+ "GOOGLE.006": string;
17
+ "GOOGLE.007": string;
18
+ "USER.001": string;
19
+ "USER.002": string;
20
+ "USER.003": string;
21
+ "USER.004": string;
22
+ "USER.005": string;
23
+ "USER.006": string;
24
+ "BUSINESS.001": string;
25
+ "BUSINESS.002": string;
26
+ "BUSINESS.003": string;
27
+ "BUSINESS.004": string;
28
+ "BUSINESS.005": string;
29
+ "BUSINESS.006": string;
30
+ "BUSINESS.007": string;
31
+ "BUSINESS.010": string;
32
+ "BUSINESS.011": string;
33
+ "PROVIDER.001": string;
34
+ "PROVIDER.002": string;
35
+ "PROVIDER.003": string;
36
+ "PROVIDER.004": string;
37
+ "PROVIDER.005": string;
38
+ "PROVIDER.006": string;
39
+ "PROVIDER.007": string;
40
+ "PROVIDER.008": string;
41
+ };
42
+ declare const ERROR_CONSTANTS: {
43
+ GENERAL: {
44
+ BAD_REQUEST: string;
45
+ VALIDATION_ERROR: string;
46
+ FORBIDDEN_ERROR: string;
47
+ INTERNAL_SERVER_ERROR: string;
48
+ UNAUTHORIZED: string;
49
+ UNAUTHENTICATED: string;
50
+ };
51
+ USER: {
52
+ NOT_FOUND: string;
53
+ FAILED_TO_CREATE: string;
54
+ FAILED_TO_UPDATE: string;
55
+ FAILED_TO_DELETE: string;
56
+ EMAIL_EXISTS: string;
57
+ FAILED_TO_GET_UPLOAD_URL: string;
58
+ };
59
+ BUSINESS: {
60
+ NOT_FOUND: string;
61
+ FAILED_TO_CREATE: string;
62
+ FAILED_TO_UPDATE: string;
63
+ FAILED_TO_DELETE: string;
64
+ FAILED_TO_GET_UPLOAD_URL: string;
65
+ NAME_REQUIRED: string;
66
+ BUSINESS_ID_REQUIRED: string;
67
+ DESCRIPTION_REQUIRED: string;
68
+ SLUG_INVALID: string;
69
+ };
70
+ };
71
+ type ServerError = {
72
+ message: string;
73
+ error: string;
74
+ statusCode: number;
75
+ validationErrors: {
76
+ field: string;
77
+ error: string;
78
+ }[];
79
+ };
80
+ type ValidationError = {
81
+ field: string;
82
+ error: string;
83
+ };
84
+ type RequestError = {
85
+ validationErrors: ValidationError[];
86
+ };
87
+ declare function getErrorMessage(code: string): string;
88
+ declare function isErrorCode(code: string): boolean;
89
+ declare const transformErrors: (zodError: any) => ValidationError[];
90
+ declare const convertServerErrorToRequestError: (serverError: ServerError, renameRules?: {
91
+ [key: string]: string;
92
+ }) => RequestError;
93
+ declare const errors: {
94
+ GENERAL: {
95
+ BAD_REQUEST: string;
96
+ VALIDATION_ERROR: string;
97
+ FORBIDDEN_ERROR: string;
98
+ INTERNAL_SERVER_ERROR: string;
99
+ UNAUTHORIZED: string;
100
+ UNAUTHENTICATED: string;
101
+ };
102
+ USER: {
103
+ NOT_FOUND: string;
104
+ FAILED_TO_CREATE: string;
105
+ FAILED_TO_UPDATE: string;
106
+ FAILED_TO_DELETE: string;
107
+ EMAIL_EXISTS: string;
108
+ FAILED_TO_GET_UPLOAD_URL: string;
109
+ };
110
+ BUSINESS: {
111
+ NOT_FOUND: string;
112
+ FAILED_TO_CREATE: string;
113
+ FAILED_TO_UPDATE: string;
114
+ FAILED_TO_DELETE: string;
115
+ FAILED_TO_GET_UPLOAD_URL: string;
116
+ NAME_REQUIRED: string;
117
+ BUSINESS_ID_REQUIRED: string;
118
+ DESCRIPTION_REQUIRED: string;
119
+ SLUG_INVALID: string;
120
+ };
121
+ };
122
+
123
+ declare function fetchSvgContent(mediaObject: any): Promise<string | null>;
124
+ /**
125
+ * Server-side helper for Astro components to fetch SVG content during SSR
126
+ *
127
+ * @param mediaObject The media object from the CMS
128
+ * @returns The SVG content as a string, or empty string on failure
129
+ */
130
+ declare function getSvgContentForAstro(mediaObject: any): Promise<string>;
131
+ /**
132
+ * Client-side helper to fetch and inject SVG content into DOM elements
133
+ *
134
+ * @param mediaObject The media object from the CMS
135
+ * @param targetElement The DOM element to inject the SVG into
136
+ * @param className Optional CSS class to add to the SVG
137
+ */
138
+ declare function injectSvgIntoElement(mediaObject: any, targetElement: HTMLElement, className?: string): Promise<void>;
139
+
140
+ declare const locales: readonly ["en", "sr-latn"];
141
+ /**
142
+ * * returns "slugified" text.
143
+ * @param text: string - text to slugify
144
+ */
145
+ declare function slugify(text: string): string;
146
+ /**
147
+ * * returns "humanized" text. runs slugify() and then replaces - with space and upper case first letter of every word, and lower case the rest
148
+ * @param text: string - text to humanize
149
+ */
150
+ declare function humanize(text: string): string;
151
+ /**
152
+ * * returns "categorified" text. runs slugify() and then replaces - with space and upper cases everything
153
+ * @param text: string - text to categorify
154
+ * @returns string - categorified text
155
+ */
156
+ declare function categorify(text: string): string;
157
+ /**
158
+ * * returns a nicely formatted string of the date passed
159
+ * @param date: string | number | Date - date to format
160
+ * @param locale: string - locale to format the date in
161
+ * @returns string - formatted date
162
+ */
163
+ declare function formatDate(date: string | number | Date, locale: (typeof locales)[number]): string;
164
+
165
+ export { ERROR_CODES, ERROR_CONSTANTS, type RequestError, type ServerError, type ValidationError, categorify, convertServerErrorToRequestError, errors, fetchSvgContent, formatDate, getErrorMessage, getSvgContentForAstro, humanize, injectSvgIntoElement, isErrorCode, slugify, transformErrors };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arky-sdk",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "Official TypeScript SDK for Arky - All-in-one business platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -11,16 +11,6 @@
11
11
  "types": "./dist/index.d.ts",
12
12
  "import": "./dist/index.js",
13
13
  "require": "./dist/index.cjs"
14
- },
15
- "./utils": {
16
- "types": "./dist/utils.d.ts",
17
- "import": "./dist/utils.js",
18
- "require": "./dist/utils.cjs"
19
- },
20
- "./types": {
21
- "types": "./dist/types.d.ts",
22
- "import": "./dist/types.js",
23
- "require": "./dist/types.cjs"
24
14
  }
25
15
  },
26
16
  "files": [