@swell/apps-sdk 1.0.168 → 1.0.169
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 +123 -57
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +121 -57
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +122 -57
- package/dist/index.mjs.map +4 -4
- package/dist/src/cache/content-cache.d.ts +21 -0
- package/dist/src/cache/index.d.ts +2 -0
- package/dist/src/index.d.ts +2 -1
- package/dist/src/liquid/filters/index.d.ts +2 -0
- package/dist/src/liquid/filters/shopify/img_url.d.ts +3 -0
- package/dist/src/theme.d.ts +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type CreateCacheOptions } from './cache';
|
|
2
|
+
export interface ContentCacheOptions extends CreateCacheOptions {
|
|
3
|
+
defaultTtl?: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Simple content cache exposing only get/set operations.
|
|
7
|
+
* Designed for caching versioned, immutable content like rendered assets.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ContentCache {
|
|
10
|
+
private cache;
|
|
11
|
+
private defaultTtl;
|
|
12
|
+
constructor(options?: ContentCacheOptions);
|
|
13
|
+
/**
|
|
14
|
+
* Get content from cache
|
|
15
|
+
*/
|
|
16
|
+
get<T = any>(key: string): Promise<T | undefined>;
|
|
17
|
+
/**
|
|
18
|
+
* Set content in cache
|
|
19
|
+
*/
|
|
20
|
+
set<T = any>(key: string, value: T, ttl?: number): Promise<void>;
|
|
21
|
+
}
|
|
@@ -3,5 +3,7 @@ export { RequestCache } from './request-cache';
|
|
|
3
3
|
export { ResourceCache } from './resource-cache';
|
|
4
4
|
export { ThemeCache } from './theme-cache';
|
|
5
5
|
export { ThemeFileCache } from './theme-file-cache';
|
|
6
|
+
export { ContentCache } from './content-cache';
|
|
7
|
+
export type { ContentCacheOptions } from './content-cache';
|
|
6
8
|
export type { ThemeFileCacheInterface, PutFilesResult, FileWarning, } from './theme-file-cache';
|
|
7
9
|
export type { KVFlavor } from './kv-variety';
|
package/dist/src/index.d.ts
CHANGED
|
@@ -12,4 +12,5 @@ export * from './compatibility/shopify';
|
|
|
12
12
|
export * from './compatibility/shopify-objects';
|
|
13
13
|
export * from './editor/resources';
|
|
14
14
|
export * from './cache/html-cache';
|
|
15
|
-
export
|
|
15
|
+
export { ContentCache } from './cache';
|
|
16
|
+
export type { ContentCacheOptions, PutFilesResult, FileWarning } from './cache';
|
|
@@ -38,6 +38,7 @@ import translate from './translate';
|
|
|
38
38
|
import where from './where';
|
|
39
39
|
import asset_img_url from './shopify/asset_img_url';
|
|
40
40
|
import hex_to_rgba from './shopify/hex_to_rgba';
|
|
41
|
+
import img_url from './shopify/img_url';
|
|
41
42
|
import payment_button from './shopify/payment_button';
|
|
42
43
|
import payment_terms from './shopify/payment_terms';
|
|
43
44
|
import placeholder_svg_tag from './shopify/placeholder_svg_tag';
|
|
@@ -97,6 +98,7 @@ export declare const filters: {
|
|
|
97
98
|
where: typeof where;
|
|
98
99
|
asset_img_url: typeof asset_img_url;
|
|
99
100
|
hex_to_rgba: typeof hex_to_rgba;
|
|
101
|
+
img_url: typeof img_url;
|
|
100
102
|
item_count_for_variant: {
|
|
101
103
|
bind(_liquidSwell: LiquidSwell): (cart: any, variantId: string) => any;
|
|
102
104
|
resolve: string[][];
|
package/dist/src/theme.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare class SwellTheme {
|
|
|
11
11
|
globals: ThemeGlobals;
|
|
12
12
|
forms?: ThemeFormConfig[];
|
|
13
13
|
resources?: ThemeResources;
|
|
14
|
+
dynamicAssetUrl?: string;
|
|
14
15
|
liquidSwell: LiquidSwell;
|
|
15
16
|
themeLoader: ThemeLoader;
|
|
16
17
|
page?: ThemePage;
|
|
@@ -26,6 +27,7 @@ export declare class SwellTheme {
|
|
|
26
27
|
forms?: ThemeFormConfig[];
|
|
27
28
|
resources?: ThemeResources;
|
|
28
29
|
globals?: ThemeGlobals;
|
|
30
|
+
dynamicAssetUrl?: string;
|
|
29
31
|
shopifyCompatibilityClass?: typeof ShopifyCompatibility;
|
|
30
32
|
});
|
|
31
33
|
/**
|
|
@@ -132,6 +134,7 @@ export declare class SwellTheme {
|
|
|
132
134
|
private _getTemplateConfig;
|
|
133
135
|
getThemeTemplateConfigByType(type: string, name: string, suffix?: string): Promise<SwellThemeConfig | null>;
|
|
134
136
|
getAssetConfig(assetName: string): Promise<SwellThemeConfig | null>;
|
|
137
|
+
getDynamicAssetUrl(filePath: string): Promise<string | null>;
|
|
135
138
|
getAssetUrl(filePath: string): Promise<string | null>;
|
|
136
139
|
renderTemplate(config: SwellThemeConfig | null, data?: SwellData): Promise<string>;
|
|
137
140
|
renderTemplateString(templateString: string, data?: SwellData): Promise<string>;
|