@gem-sdk/core 1.14.0-next.243 → 1.14.0-next.247
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const disableWrap=["Col","CollectionBanner","Row","Section","Image","Text","Button","ProductButton","Cart","Tabs","TabItem","Carousel","CarouselItem","ShopPayButton","AccordionItem","Video","Header","HeroBanner","Icon","IconList","HTMLCode","IconListHoz","IconListItem","CSSCode","FormEmail","FormDropdown","SubmitButton","Dialog","TextField","FormTextarea","ProductPrice","Product","ProductImages","Sticky"],customRenderChildren=["Accordion","AccordionItem","Row","IconList","Tabs"];exports.customRenderChildren=customRenderChildren,exports.disableWrap=disableWrap;
|
|
1
|
+
"use strict";const disableWrap=["Col","CollectionBanner","Row","Section","Image","Text","Button","ProductButton","Cart","Tabs","TabItem","Carousel","CarouselItem","ShopPayButton","AccordionItem","Video","Header","HeroBanner","Icon","IconList","HTMLCode","IconListHoz","IconListItem","CSSCode","FormEmail","FormDropdown","SubmitButton","Dialog","TextField","FormTextarea","ProductPrice","Product","ProductImages","ProductImagesV2","Sticky"],customRenderChildren=["Accordion","AccordionItem","Row","IconList","Tabs"];exports.customRenderChildren=customRenderChildren,exports.disableWrap=disableWrap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var useSWR=require("swr"),productValueLabel_generated=require("../graphql/queries/product-value-label.generated.js"),variantPresets=require("../components/src/product/helpers/variant-presets.js"),shop=require("./shop.js"),useFetchHandle=require("./useFetchHandle.js");const initialSwatchOptionValue={label:"",colors:[],imageUrl:""},initialGlobalSwatchesData={optionTitle:"",optionType:"",optionValues:[]};let swatchChange=!1,colorChange=!1;const useSwatchesOptions=e=>{let t=useFetchHandle.useFetchHandle(),{swatches:a}=shop.useSwatches(),{data:o}=useSWR({},async()=>fetchProductValueLabel(t),{}),l=[];if(a?.forEach(e=>{l.push(e.optionTitle)}),o?.productOptionName?.forEach(e=>{l.includes(e)||(swatchChange=!0,a?.push({optionTitle:e,optionType:"rectangle_list",optionValues:[]}))}),!e)return[];setDefaultSwatches(a,e);let
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var useSWR=require("swr"),productValueLabel_generated=require("../graphql/queries/product-value-label.generated.js"),variantPresets=require("../components/src/product/helpers/variant-presets.js"),shop=require("./shop.js"),useFetchHandle=require("./useFetchHandle.js");const initialSwatchOptionValue={label:"",colors:[],imageUrl:""},initialGlobalSwatchesData={optionTitle:"",optionType:"",optionValues:[]};let swatchChange=!1,colorChange=!1;const useSwatchesOptions=e=>{let t=useFetchHandle.useFetchHandle(),{swatches:a}=shop.useSwatches(),{data:o}=useSWR(["/query/productOptionName",{}],async()=>fetchProductValueLabel(t),{revalidateOnMount:!0}),l=[];if(a?.forEach(e=>{l.push(e.optionTitle)}),o?.productOptionName?.forEach(e=>{l.includes(e)||(swatchChange=!0,a?.push({optionTitle:e,optionType:"rectangle_list",optionValues:[]}))}),!e)return[];setDefaultSwatches(a,e);let r=e?.map(e=>{let t=a?.find(t=>t?.optionTitle===e?.name)||{...initialGlobalSwatchesData};return{...e,optionType:t&&t.optionType?t.optionType:"rectangle_list",values:e.values?.map(e=>{let a=t&&t?.optionValues?.find(t=>t?.label===e?.label)||{...initialSwatchOptionValue};return{...e,colors:a?.colors||[],imageUrl:a?.imageUrl||""}})}});return a?.length&&(swatchChange||colorChange)?(window?.parent?.postMessage?.(JSON.stringify({type:"update-swatches",swatches:a}),"*"),swatchChange=!1,colorChange=!1,[]):r},getColorDefault=(e,t)=>{let a=e?variantPresets.colorPreset[e.toLocaleLowerCase()]:void 0,o=a?[a]:[],l=t?.[0];return!l&&o.length&&(colorChange=!0),l?[l]:o},getProductOptionsLabelByName=(e,t)=>{let a=[],o=e.find(e=>e.name===t);return o?.values.forEach(e=>{a.push(e.label??"")}),a},getSwatchesOptionsLabel=e=>{let t=[];return e.forEach(e=>{t.push(e.label??"")}),t},setDefaultSwatches=(e,t)=>(e&&e?.map(e=>{let a=getProductOptionsLabelByName(t,e.optionTitle),o=getSwatchesOptionsLabel(e.optionValues);a.forEach(t=>{o.includes(t)||e.optionValues.push({label:t,colors:getColorDefault(t),imageUrl:""})}),e.optionValues.map(e=>({...e,colors:getColorDefault(e.label,e.colors)}))}),e),fetchProductValueLabel=async e=>{let t={},a=async t=>{let a=await e([productValueLabel_generated.ProductOptionNameDocument,t]);return a};return a(t)};exports.default=useSwatchesOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let disableWrap=["Col","CollectionBanner","Row","Section","Image","Text","Button","ProductButton","Cart","Tabs","TabItem","Carousel","CarouselItem","ShopPayButton","AccordionItem","Video","Header","HeroBanner","Icon","IconList","HTMLCode","IconListHoz","IconListItem","CSSCode","FormEmail","FormDropdown","SubmitButton","Dialog","TextField","FormTextarea","ProductPrice","Product","ProductImages","Sticky"],customRenderChildren=["Accordion","AccordionItem","Row","IconList","Tabs"];export{customRenderChildren,disableWrap};
|
|
1
|
+
let disableWrap=["Col","CollectionBanner","Row","Section","Image","Text","Button","ProductButton","Cart","Tabs","TabItem","Carousel","CarouselItem","ShopPayButton","AccordionItem","Video","Header","HeroBanner","Icon","IconList","HTMLCode","IconListHoz","IconListItem","CSSCode","FormEmail","FormDropdown","SubmitButton","Dialog","TextField","FormTextarea","ProductPrice","Product","ProductImages","ProductImagesV2","Sticky"],customRenderChildren=["Accordion","AccordionItem","Row","IconList","Tabs"];export{customRenderChildren,disableWrap};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"swr";import{ProductOptionNameDocument as t}from"../graphql/queries/product-value-label.generated.js";import{colorPreset as a}from"../components/src/product/helpers/variant-presets.js";import{useSwatches as o}from"./shop.js";import{useFetchHandle as l}from"./useFetchHandle.js";let initialSwatchOptionValue={label:"",colors:[],imageUrl:""},initialGlobalSwatchesData={optionTitle:"",optionType:"",optionValues:[]},swatchChange=!1,colorChange=!1,useSwatchesOptions=t=>{let a=l(),{swatches:r}=o(),{data:
|
|
1
|
+
import e from"swr";import{ProductOptionNameDocument as t}from"../graphql/queries/product-value-label.generated.js";import{colorPreset as a}from"../components/src/product/helpers/variant-presets.js";import{useSwatches as o}from"./shop.js";import{useFetchHandle as l}from"./useFetchHandle.js";let initialSwatchOptionValue={label:"",colors:[],imageUrl:""},initialGlobalSwatchesData={optionTitle:"",optionType:"",optionValues:[]},swatchChange=!1,colorChange=!1,useSwatchesOptions=t=>{let a=l(),{swatches:r}=o(),{data:n}=e(["/query/productOptionName",{}],async()=>fetchProductValueLabel(a),{revalidateOnMount:!0}),s=[];if(r?.forEach(e=>{s.push(e.optionTitle)}),n?.productOptionName?.forEach(e=>{s.includes(e)||(swatchChange=!0,r?.push({optionTitle:e,optionType:"rectangle_list",optionValues:[]}))}),!t)return[];setDefaultSwatches(r,t);let i=t?.map(e=>{let t=r?.find(t=>t?.optionTitle===e?.name)||{...initialGlobalSwatchesData};return{...e,optionType:t&&t.optionType?t.optionType:"rectangle_list",values:e.values?.map(e=>{let a=t&&t?.optionValues?.find(t=>t?.label===e?.label)||{...initialSwatchOptionValue};return{...e,colors:a?.colors||[],imageUrl:a?.imageUrl||""}})}});return r?.length&&(swatchChange||colorChange)?(window?.parent?.postMessage?.(JSON.stringify({type:"update-swatches",swatches:r}),"*"),swatchChange=!1,colorChange=!1,[]):i},getColorDefault=(e,t)=>{let o=e?a[e.toLocaleLowerCase()]:void 0,l=o?[o]:[],r=t?.[0];return!r&&l.length&&(colorChange=!0),r?[r]:l},getProductOptionsLabelByName=(e,t)=>{let a=[],o=e.find(e=>e.name===t);return o?.values.forEach(e=>{a.push(e.label??"")}),a},getSwatchesOptionsLabel=e=>{let t=[];return e.forEach(e=>{t.push(e.label??"")}),t},setDefaultSwatches=(e,t)=>(e&&e?.map(e=>{let a=getProductOptionsLabelByName(t,e.optionTitle),o=getSwatchesOptionsLabel(e.optionValues);a.forEach(t=>{o.includes(t)||e.optionValues.push({label:t,colors:getColorDefault(t),imageUrl:""})}),e.optionValues.map(e=>({...e,colors:getColorDefault(e.label,e.colors)}))}),e),fetchProductValueLabel=async e=>{let a={},o=async a=>{let o=await e([t,a]);return o};return o(a)};export{useSwatchesOptions as default};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -835,18 +835,6 @@ type TypographyV2ControlType<T> = SharedControlType<T> & {
|
|
|
835
835
|
};
|
|
836
836
|
};
|
|
837
837
|
|
|
838
|
-
type ImageShape<T> = SharedControlType<T> & {
|
|
839
|
-
type: 'image-shape';
|
|
840
|
-
placeholder?: string;
|
|
841
|
-
readonly?: boolean;
|
|
842
|
-
};
|
|
843
|
-
|
|
844
|
-
type GridArrange<T> = SharedControlType<T> & {
|
|
845
|
-
type: 'grid-arrange';
|
|
846
|
-
placeholder?: string;
|
|
847
|
-
readonly?: boolean;
|
|
848
|
-
};
|
|
849
|
-
|
|
850
838
|
type StickyDisplayControlType<T> = SharedControlType<T> & {
|
|
851
839
|
type: 'sticky-display';
|
|
852
840
|
};
|
|
@@ -884,7 +872,19 @@ type StepsGuide<T> = {
|
|
|
884
872
|
[K in keyof T]-?: Mapped<K, T[K]>;
|
|
885
873
|
}[keyof T];
|
|
886
874
|
|
|
887
|
-
type
|
|
875
|
+
type ImageShape<T> = SharedControlType<T> & {
|
|
876
|
+
type: 'image-shape';
|
|
877
|
+
placeholder?: string;
|
|
878
|
+
readonly?: boolean;
|
|
879
|
+
};
|
|
880
|
+
|
|
881
|
+
type GridArrange<T> = SharedControlType<T> & {
|
|
882
|
+
type: 'grid-arrange';
|
|
883
|
+
placeholder?: string;
|
|
884
|
+
readonly?: boolean;
|
|
885
|
+
};
|
|
886
|
+
|
|
887
|
+
type ControlProp<T> = AngleControlType<T> | CheckboxControlType<T> | ColorPickerControlType<T> | GroupControlType<T> | IconControlType<T> | InputFixContentControlType<T> | InputNumberControlType<T> | InputUnitControlType<T> | InputUnitSpacingControlType<T> | InputUnitWidthControlType<T> | InputControlType<T> | MarginControlType<T> | PaddingControlType<T> | PositionControlType<T> | RadioGroupControlType | RangeControlType<T> | SegmentControlType<T> | SelectControlType<T> | TextareaControlType<T> | ToggleControlType<T> | ImageControlType<T> | ChildrensControlType | GridControlType<T> | FlexControlType<T> | TextEditorControlType<T> | ProductControlType<T> | TypographyControlType<T> | TypographyV2ControlType<T> | MenuControlType<T> | BehaviorStateControlType<T> | PickLinkControlType<T> | BoxShadowControlType<T> | TextShadowControlType<T> | BorderControlType<T> | BorderRadiusControlType<T> | RadiusPresetControlType<T> | SizeControlType<T> | ChildItemType<T> | PickMultiProductControlType<T> | CollectionControlType<T> | BackgroundControlType<T> | VisibilityControlType<T> | SelectVariantControlType | CountdownEvergreenType | Timezone<T> | CustomContentControlType<T> | DateTimePickerControlType | CountdownDailyType | KlaviyoCodes | YotpoLoyaltyCodes | InputWidthControlType<T> | LayoutSegmentControlType<T> | InputSpacing<T> | UniqueIdControlType<T> | PositionSquareControlType<T> | CustomCodeEditor | LayoutControlType<T> | SwatchesLinkControlType<T> | VariantSwatchesPresetControlType<T> | ProductListControlType<T> | CollectionBannerControlType<T> | Ratio<T> | StickyDisplayControlType<T> | SyncProductPropertiesControlType<T> | StepsGuide<T> | ImageShape<T> | GridArrange<T>;
|
|
888
888
|
type Setting<P extends BaseProps> = {
|
|
889
889
|
id: 'setting';
|
|
890
890
|
note?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/core",
|
|
3
|
-
"version": "1.14.0-next.
|
|
3
|
+
"version": "1.14.0-next.247",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@gem-sdk/adapter-shopify": "1.12.0",
|
|
28
|
-
"@gem-sdk/styles": "1.14.0-next.
|
|
28
|
+
"@gem-sdk/styles": "1.14.0-next.247"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"react-error-boundary": "4.0.10",
|