droplinked-editor-configs 1.9.6 → 1.9.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "droplinked-editor-configs",
3
3
  "private": false,
4
- "version": "1.9.6",
4
+ "version": "1.9.8",
5
5
  "type": "module",
6
6
  "main": "dist/droplinked-editor.umd.js",
7
7
  "module": "dist/droplinked-editor.es.js",
@@ -59,7 +59,7 @@ export default function ProductImageSlider({ product, isHovered, isEditing }: Pr
59
59
  }
60
60
 
61
61
  // If we're in editing mode or there's only one image, render simple image without keen slider
62
- if (isEditing || sliderImages.length === 1) {
62
+ if (isEditing || !sliderImages[0] || sliderImages.length === 1) {
63
63
  return (
64
64
  <div className="relative overflow-hidden rounded-lg aspect-square cursor-pointer">
65
65
  <img
@@ -1,30 +1,49 @@
1
1
  import { getShopService } from "apis/shop/service";
2
- import { useAppStore } from 'AppStoreProvider'
2
+ import { useAppStore } from "AppStoreProvider";
3
3
  import { shopStates } from "lib/stores/app/shopModel";
4
4
  import { normalize_templates } from "./utils";
5
5
  import { useState, useCallback } from "react";
6
6
 
7
7
  export function useAppShop() {
8
- const { methods: { updateState } } = useAppStore()
9
- const [loading, setLoading] = useState(false)
8
+ const {
9
+ methods: { updateState },
10
+ } = useAppStore();
11
+ const [loading, setLoading] = useState(false);
10
12
 
11
- const get = useCallback(async (shopName: string) => {
12
- setLoading(true)
13
- try {
14
- const { data } = await getShopService({ shopName })
15
- const newData = { ...data, data: { ...data.data, template_options: normalize_templates(data?.data?.template_options) } }
16
- updateState({ state: 'shop', value: shopStates(newData?.data) })
17
- return data?.data
18
- } finally {
19
- setLoading(false)
20
- }
21
- }, [updateState])
13
+ const get = useCallback(
14
+ async (shopName: string) => {
15
+ setLoading(true);
16
+ try {
17
+ const { data } = await getShopService({ shopName });
18
+ const newData = {
19
+ ...data,
20
+ data: {
21
+ ...data.data,
22
+ currency: data?.data?.currency || {
23
+ conversionRateToUSD: 1,
24
+ symbol: '$',
25
+ abbreviation: 'USD',
26
+ },
27
+ template_options: normalize_templates(data?.data?.template_options),
28
+ },
29
+ };
30
+ updateState({ state: "shop", value: shopStates(newData?.data) });
31
+ return data?.data;
32
+ } finally {
33
+ setLoading(false);
34
+ }
35
+ },
36
+ [updateState]
37
+ );
22
38
 
23
- const clear = useCallback(async () => updateState({ state: 'shop', value: null }), [updateState])
39
+ const clear = useCallback(
40
+ async () => updateState({ state: "shop", value: null }),
41
+ [updateState]
42
+ );
24
43
 
25
44
  return {
26
45
  clear,
27
46
  get,
28
- loading
47
+ loading,
29
48
  };
30
49
  }