@gem-sdk/core 1.46.0-staging.10 → 1.46.0-staging.12
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/cjs/components/Render.liquid.js +17 -7
- package/dist/cjs/graphql/queries/articles.generated.js +3 -1
- package/dist/cjs/graphql/queries/blogs.generated.js +3 -1
- package/dist/cjs/helpers/third-party/appConfig.js +1 -1
- package/dist/esm/components/Render.liquid.js +17 -7
- package/dist/esm/graphql/queries/articles.generated.js +3 -1
- package/dist/esm/graphql/queries/blogs.generated.js +3 -1
- package/dist/esm/helpers/third-party/appConfig.js +1 -1
- package/dist/types/index.d.ts +25 -8
- package/package.json +2 -1
|
@@ -20,6 +20,7 @@ require('dayjs');
|
|
|
20
20
|
var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
|
|
21
21
|
var convert = require('../helpers/convert.js');
|
|
22
22
|
var render = require('../helpers/render.js');
|
|
23
|
+
var cssjson = require('cssjson');
|
|
23
24
|
|
|
24
25
|
const componentsRenderWithParentId = [
|
|
25
26
|
'CarouselItem'
|
|
@@ -181,19 +182,28 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
181
182
|
};
|
|
182
183
|
}
|
|
183
184
|
};
|
|
185
|
+
const isEmptyCSS = (cssString)=>{
|
|
186
|
+
if (!cssString) return true;
|
|
187
|
+
const cssJSON = cssjson.toJSON(cssString);
|
|
188
|
+
const isObjectEmpty = (obj)=>{
|
|
189
|
+
if (typeof obj !== 'object' || obj === null) return true;
|
|
190
|
+
return !Object.keys(obj).some((key)=>{
|
|
191
|
+
return key === 'attributes' && Object.keys(obj[key]).length > 0 || typeof obj[key] === 'object' && !isObjectEmpty(obj[key]);
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
return isObjectEmpty(cssJSON.children);
|
|
195
|
+
};
|
|
184
196
|
const RenderCustomCode = (item)=>{
|
|
185
197
|
const { css, javascript, rootClassName } = item.advanced?.editorData || {};
|
|
186
198
|
const replacedCSS = css?.replaceAll(rootClassName, item.uid);
|
|
187
199
|
const replacedJS = javascript?.replaceAll(rootClassName, item.uid);
|
|
188
|
-
const cssCode = render.RenderIf(!!css, render.template`
|
|
189
|
-
<style
|
|
190
|
-
|
|
191
|
-
|
|
200
|
+
const cssCode = render.RenderIf(!!css && !isEmptyCSS(replacedCSS), render.template`
|
|
201
|
+
<style id="${`custom-css-${item?.uid}`}">
|
|
202
|
+
${replacedCSS}
|
|
203
|
+
</style>
|
|
192
204
|
`);
|
|
193
205
|
const jsCode = render.RenderIf(!!javascript, render.template`
|
|
194
|
-
<script
|
|
195
|
-
id="${`custom-js-${item?.uid}`}"
|
|
196
|
-
>
|
|
206
|
+
<script id="${`custom-js-${item?.uid}`}">
|
|
197
207
|
try {
|
|
198
208
|
${replacedJS}
|
|
199
209
|
} catch(err){}
|
|
@@ -16,6 +16,7 @@ import 'dayjs';
|
|
|
16
16
|
import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
|
|
17
17
|
import { baseAssetURL, isLocalEnv } from '../helpers/convert.js';
|
|
18
18
|
import { RenderIf, template } from '../helpers/render.js';
|
|
19
|
+
import { toJSON } from 'cssjson';
|
|
19
20
|
|
|
20
21
|
const componentsRenderWithParentId = [
|
|
21
22
|
'CarouselItem'
|
|
@@ -177,19 +178,28 @@ const Render = ({ uid, builder, components, parentId, extraFiles = {}, pageConte
|
|
|
177
178
|
};
|
|
178
179
|
}
|
|
179
180
|
};
|
|
181
|
+
const isEmptyCSS = (cssString)=>{
|
|
182
|
+
if (!cssString) return true;
|
|
183
|
+
const cssJSON = toJSON(cssString);
|
|
184
|
+
const isObjectEmpty = (obj)=>{
|
|
185
|
+
if (typeof obj !== 'object' || obj === null) return true;
|
|
186
|
+
return !Object.keys(obj).some((key)=>{
|
|
187
|
+
return key === 'attributes' && Object.keys(obj[key]).length > 0 || typeof obj[key] === 'object' && !isObjectEmpty(obj[key]);
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
return isObjectEmpty(cssJSON.children);
|
|
191
|
+
};
|
|
180
192
|
const RenderCustomCode = (item)=>{
|
|
181
193
|
const { css, javascript, rootClassName } = item.advanced?.editorData || {};
|
|
182
194
|
const replacedCSS = css?.replaceAll(rootClassName, item.uid);
|
|
183
195
|
const replacedJS = javascript?.replaceAll(rootClassName, item.uid);
|
|
184
|
-
const cssCode = RenderIf(!!css, template`
|
|
185
|
-
<style
|
|
186
|
-
|
|
187
|
-
|
|
196
|
+
const cssCode = RenderIf(!!css && !isEmptyCSS(replacedCSS), template`
|
|
197
|
+
<style id="${`custom-css-${item?.uid}`}">
|
|
198
|
+
${replacedCSS}
|
|
199
|
+
</style>
|
|
188
200
|
`);
|
|
189
201
|
const jsCode = RenderIf(!!javascript, template`
|
|
190
|
-
<script
|
|
191
|
-
id="${`custom-js-${item?.uid}`}"
|
|
192
|
-
>
|
|
202
|
+
<script id="${`custom-js-${item?.uid}`}">
|
|
193
203
|
try {
|
|
194
204
|
${replacedJS}
|
|
195
205
|
} catch(err){}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ type Article$2 = {
|
|
|
75
75
|
platform?: Maybe$1<ArticlePlatform$1>;
|
|
76
76
|
platformCreatedAt?: Maybe$1<Scalars$2['Time']>;
|
|
77
77
|
platformUpdatedAt?: Maybe$1<Scalars$2['Time']>;
|
|
78
|
-
tags
|
|
78
|
+
tags?: Maybe$1<Array<Maybe$1<Tag$1>>>;
|
|
79
79
|
templateSuffix?: Maybe$1<Scalars$2['String']>;
|
|
80
80
|
title?: Maybe$1<Scalars$2['String']>;
|
|
81
81
|
titleMeta?: Maybe$1<Scalars$2['String']>;
|
|
@@ -2333,6 +2333,7 @@ type Entity = {
|
|
|
2333
2333
|
findPublishedThemePageOnlineStoreDataByID: PublishedThemePageOnlineStoreData$1;
|
|
2334
2334
|
findPublishedThemeSectionByID: PublishedThemeSection$1;
|
|
2335
2335
|
findPublishedThemeStyleByID: PublishedThemeStyle$1;
|
|
2336
|
+
findTagByID: Tag$1;
|
|
2336
2337
|
};
|
|
2337
2338
|
type EntityFindMetafieldByIdArgs = {
|
|
2338
2339
|
id: Scalars$2['ID'];
|
|
@@ -2373,6 +2374,9 @@ type EntityFindPublishedThemeSectionByIdArgs = {
|
|
|
2373
2374
|
type EntityFindPublishedThemeStyleByIdArgs = {
|
|
2374
2375
|
id: Scalars$2['ID'];
|
|
2375
2376
|
};
|
|
2377
|
+
type EntityFindTagByIdArgs = {
|
|
2378
|
+
id: Scalars$2['ID'];
|
|
2379
|
+
};
|
|
2376
2380
|
type Media$1 = {
|
|
2377
2381
|
alt?: Maybe$1<Scalars$2['String']>;
|
|
2378
2382
|
contentType?: Maybe$1<Scalars$2['String']>;
|
|
@@ -5429,9 +5433,6 @@ type PublishedThemePage$1 = {
|
|
|
5429
5433
|
themePageOnlineStoreData?: Maybe$1<Array<Maybe$1<PublishedThemePageOnlineStoreData$1>>>;
|
|
5430
5434
|
type: PublishedThemePageType$1;
|
|
5431
5435
|
updatedAt?: Maybe$1<Scalars$2['Time']>;
|
|
5432
|
-
publishedAt?: Maybe$1<Scalars$2['Time']>;
|
|
5433
|
-
isPlatformDefault?: boolean;
|
|
5434
|
-
platformOriginalTemplateContent?: string;
|
|
5435
5436
|
};
|
|
5436
5437
|
type PublishedThemePageCustomSection$1 = {
|
|
5437
5438
|
id: Scalars$2['ID'];
|
|
@@ -6334,6 +6335,12 @@ type StoreProperty$1 = {
|
|
|
6334
6335
|
primaryDomain?: Maybe$1<Scalars$2['String']>;
|
|
6335
6336
|
swatchesConfig: Scalars$2['String'];
|
|
6336
6337
|
};
|
|
6338
|
+
type Tag$1 = {
|
|
6339
|
+
createdAt?: Maybe$1<Scalars$2['Time']>;
|
|
6340
|
+
id: Scalars$2['ID'];
|
|
6341
|
+
name?: Maybe$1<Scalars$2['String']>;
|
|
6342
|
+
updatedAt?: Maybe$1<Scalars$2['Time']>;
|
|
6343
|
+
};
|
|
6337
6344
|
type TagType$1 = 'ARTICLE' | 'BLOG' | 'COLLECTION' | 'PRODUCT';
|
|
6338
6345
|
/**
|
|
6339
6346
|
* TagWhereInput is used for filtering Tag objects.
|
|
@@ -6452,7 +6459,7 @@ type VariantProductOptionWhereInput$1 = {
|
|
|
6452
6459
|
variantIDNEQ?: InputMaybe$1<Scalars$2['ID']>;
|
|
6453
6460
|
variantIDNotIn?: InputMaybe$1<Array<Scalars$2['ID']>>;
|
|
6454
6461
|
};
|
|
6455
|
-
type _Entity = Metafield$1 | Product$1 | PublishedCustomSection$1 | PublishedPageInteraction$1 | PublishedPageSection$1 | PublishedPageSectionMeta$1 | PublishedShopMeta$1 | PublishedThemePage$1 | PublishedThemePageCustomSection$1 | PublishedThemePageMeta$1 | PublishedThemePageOnlineStoreData$1 | PublishedThemeSection$1 | PublishedThemeStyle$1;
|
|
6462
|
+
type _Entity = Metafield$1 | Product$1 | PublishedCustomSection$1 | PublishedPageInteraction$1 | PublishedPageSection$1 | PublishedPageSectionMeta$1 | PublishedShopMeta$1 | PublishedThemePage$1 | PublishedThemePageCustomSection$1 | PublishedThemePageMeta$1 | PublishedThemePageOnlineStoreData$1 | PublishedThemeSection$1 | PublishedThemeStyle$1 | Tag$1;
|
|
6456
6463
|
type _Service = {
|
|
6457
6464
|
sdl?: Maybe$1<Scalars$2['String']>;
|
|
6458
6465
|
};
|
|
@@ -6471,6 +6478,7 @@ type shop_EntityFindPublishedThemePageMetaByIdArgs = EntityFindPublishedThemePag
|
|
|
6471
6478
|
type shop_EntityFindPublishedThemePageOnlineStoreDataByIdArgs = EntityFindPublishedThemePageOnlineStoreDataByIdArgs;
|
|
6472
6479
|
type shop_EntityFindPublishedThemeSectionByIdArgs = EntityFindPublishedThemeSectionByIdArgs;
|
|
6473
6480
|
type shop_EntityFindPublishedThemeStyleByIdArgs = EntityFindPublishedThemeStyleByIdArgs;
|
|
6481
|
+
type shop_EntityFindTagByIdArgs = EntityFindTagByIdArgs;
|
|
6474
6482
|
type shop_Query_EntitiesArgs = Query_EntitiesArgs;
|
|
6475
6483
|
type shop__Entity = _Entity;
|
|
6476
6484
|
type shop__Service = _Service;
|
|
@@ -6553,6 +6561,7 @@ declare namespace shop {
|
|
|
6553
6561
|
shop_EntityFindPublishedThemePageOnlineStoreDataByIdArgs as EntityFindPublishedThemePageOnlineStoreDataByIdArgs,
|
|
6554
6562
|
shop_EntityFindPublishedThemeSectionByIdArgs as EntityFindPublishedThemeSectionByIdArgs,
|
|
6555
6563
|
shop_EntityFindPublishedThemeStyleByIdArgs as EntityFindPublishedThemeStyleByIdArgs,
|
|
6564
|
+
shop_EntityFindTagByIdArgs as EntityFindTagByIdArgs,
|
|
6556
6565
|
Exact$1 as Exact,
|
|
6557
6566
|
InputMaybe$1 as InputMaybe,
|
|
6558
6567
|
MakeMaybe$1 as MakeMaybe,
|
|
@@ -6693,6 +6702,7 @@ declare namespace shop {
|
|
|
6693
6702
|
ShopShopify$1 as ShopShopify,
|
|
6694
6703
|
ShopTokenWhereInput$1 as ShopTokenWhereInput,
|
|
6695
6704
|
StoreProperty$1 as StoreProperty,
|
|
6705
|
+
Tag$1 as Tag,
|
|
6696
6706
|
TagType$1 as TagType,
|
|
6697
6707
|
TagWhereInput$1 as TagWhereInput,
|
|
6698
6708
|
VariantProductOptionWhereInput$1 as VariantProductOptionWhereInput,
|
|
@@ -37217,7 +37227,8 @@ type ArticlesQueryVariables = Exact$1<{
|
|
|
37217
37227
|
type ArticlesQueryResponse = {
|
|
37218
37228
|
articles?: Maybe$1<(Pick<ArticleConnection$1, 'totalCount'> & {
|
|
37219
37229
|
edges: Array<(Pick<ArticleEdge$1, 'cursor'> & {
|
|
37220
|
-
node?: Maybe$1<(Pick<Article$2, 'id' | 'title' | 'handle' | 'description' | 'templateSuffix' | 'titleMeta' | 'descriptionMeta' | 'baseID' | 'platform' | '
|
|
37230
|
+
node?: Maybe$1<(Pick<Article$2, 'id' | 'title' | 'handle' | 'description' | 'templateSuffix' | 'titleMeta' | 'descriptionMeta' | 'baseID' | 'platform' | 'isSample' | 'platformCreatedAt' | 'author'> & {
|
|
37231
|
+
tags: Array<never>;
|
|
37221
37232
|
content?: Maybe$1<Pick<ArticleContent$1, 'excerptHtml'>>;
|
|
37222
37233
|
blogs?: Maybe$1<{
|
|
37223
37234
|
edges: Array<{
|
|
@@ -37246,9 +37257,15 @@ type BlogsQueryResponse = {
|
|
|
37246
37257
|
node?: Maybe$1<(Pick<Blog$1, 'baseID' | 'description' | 'descriptionMeta' | 'handle' | 'id' | 'platform' | 'tags' | 'templateSuffix' | 'title' | 'titleMeta'> & {
|
|
37247
37258
|
articles?: Maybe$1<(Pick<ArticleConnection$1, 'totalCount'> & {
|
|
37248
37259
|
edges: Array<(Pick<ArticleEdge$1, 'cursor'> & {
|
|
37249
|
-
node?: Maybe$1<(Pick<Article$2, 'id' | 'title' | 'handle' | 'description' | 'templateSuffix' | 'titleMeta' | 'descriptionMeta' | 'baseID' | '
|
|
37260
|
+
node?: Maybe$1<(Pick<Article$2, 'id' | 'title' | 'handle' | 'description' | 'templateSuffix' | 'titleMeta' | 'descriptionMeta' | 'baseID' | 'platform' | 'isSample' | 'platformCreatedAt' | 'author'> & {
|
|
37261
|
+
tags: Array<never>;
|
|
37250
37262
|
content?: Maybe$1<Pick<ArticleContent$1, 'excerptHtml'>>;
|
|
37251
|
-
|
|
37263
|
+
blogs?: Maybe$1<{
|
|
37264
|
+
edges: Array<{
|
|
37265
|
+
node?: Maybe$1<Pick<Blog$1, 'title' | 'handle'>>;
|
|
37266
|
+
}>;
|
|
37267
|
+
}>;
|
|
37268
|
+
media?: Maybe$1<Pick<Media$1, 'alt' | 'width' | 'src' | 'height'>>;
|
|
37252
37269
|
})>;
|
|
37253
37270
|
})>;
|
|
37254
37271
|
})>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/core",
|
|
3
|
-
"version": "1.46.0-staging.
|
|
3
|
+
"version": "1.46.0-staging.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"classnames": "^2.5.1",
|
|
36
|
+
"cssjson": "2.1.3",
|
|
36
37
|
"dayjs": "^1.11.11",
|
|
37
38
|
"react-error-boundary": "4.0.10",
|
|
38
39
|
"swr": "2.1.2",
|