@swell/apps-sdk 1.0.136 → 1.0.138

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.mjs CHANGED
@@ -7869,17 +7869,21 @@ function getAllSectionComponents(allSections) {
7869
7869
  id: section.id,
7870
7870
  label: section.label,
7871
7871
  schema: [
7872
- ...(section.fields || []).reduce((acc, field) => {
7873
- if (field.id && field.type) {
7874
- acc.push({
7875
- prop: toEasyblocksFieldId(field.id),
7876
- label: field.label,
7877
- optional: true,
7878
- ...schemaToEasyblocksProps(field)
7879
- });
7880
- }
7881
- return acc;
7882
- }, []),
7872
+ ...(section.fields || []).reduce(
7873
+ (acc, field, currentIndex) => {
7874
+ if (field.type) {
7875
+ const fieldId = field.id || `${field.type}_${currentIndex}`;
7876
+ acc.push({
7877
+ prop: toEasyblocksFieldId(fieldId),
7878
+ label: field.label,
7879
+ optional: true,
7880
+ ...schemaToEasyblocksProps(field)
7881
+ });
7882
+ }
7883
+ return acc;
7884
+ },
7885
+ []
7886
+ ),
7883
7887
  ...hasBlocks ? [
7884
7888
  {
7885
7889
  prop: "Blocks",
@@ -7966,10 +7970,11 @@ function getAllSectionComponents(allSections) {
7966
7970
  id: `Block__${section.id}__${block.type}`,
7967
7971
  label: block.label,
7968
7972
  schema: (block.fields || []).reduce(
7969
- (acc, field) => {
7970
- if (field.id && field.type) {
7973
+ (acc, field, currentIndex) => {
7974
+ if (field.type) {
7975
+ const fieldId = field.id || `${field.type}_${currentIndex}`;
7971
7976
  acc.push({
7972
- prop: toEasyblocksFieldId(field.id),
7977
+ prop: toEasyblocksFieldId(fieldId),
7973
7978
  label: field.label,
7974
7979
  optional: true,
7975
7980
  ...schemaToEasyblocksProps(field)
@@ -15594,15 +15599,15 @@ function ShopifyPage(_instance, page) {
15594
15599
  return new ShopifyResource({
15595
15600
  author: void 0,
15596
15601
  // Not supported
15597
- content: defer(() => page.content),
15598
- handle: defer(() => page.slug),
15602
+ content: deferWith(page, (page2) => page2.content),
15603
+ handle: deferWith(page, (page2) => page2.slug),
15599
15604
  id: 0,
15600
15605
  metafields: {},
15601
15606
  published_at: deferWith(
15602
15607
  page,
15603
15608
  (page2) => page2.date_published || page2.date_created
15604
15609
  ),
15605
- template_suffix: defer(() => page.theme_template),
15610
+ template_suffix: deferWith(page, (page2) => page2.theme_template),
15606
15611
  title: deferWith(page, (page2) => page2.title || page2.name),
15607
15612
  // Due to deprecated name field
15608
15613
  url: deferWith(page, (page2) => `/pages/${page2.slug}`)