@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.cjs CHANGED
@@ -8002,17 +8002,21 @@ function getAllSectionComponents(allSections) {
8002
8002
  id: section.id,
8003
8003
  label: section.label,
8004
8004
  schema: [
8005
- ...(section.fields || []).reduce((acc, field) => {
8006
- if (field.id && field.type) {
8007
- acc.push({
8008
- prop: toEasyblocksFieldId(field.id),
8009
- label: field.label,
8010
- optional: true,
8011
- ...schemaToEasyblocksProps(field)
8012
- });
8013
- }
8014
- return acc;
8015
- }, []),
8005
+ ...(section.fields || []).reduce(
8006
+ (acc, field, currentIndex) => {
8007
+ if (field.type) {
8008
+ const fieldId = field.id || `${field.type}_${currentIndex}`;
8009
+ acc.push({
8010
+ prop: toEasyblocksFieldId(fieldId),
8011
+ label: field.label,
8012
+ optional: true,
8013
+ ...schemaToEasyblocksProps(field)
8014
+ });
8015
+ }
8016
+ return acc;
8017
+ },
8018
+ []
8019
+ ),
8016
8020
  ...hasBlocks ? [
8017
8021
  {
8018
8022
  prop: "Blocks",
@@ -8099,10 +8103,11 @@ function getAllSectionComponents(allSections) {
8099
8103
  id: `Block__${section.id}__${block.type}`,
8100
8104
  label: block.label,
8101
8105
  schema: (block.fields || []).reduce(
8102
- (acc, field) => {
8103
- if (field.id && field.type) {
8106
+ (acc, field, currentIndex) => {
8107
+ if (field.type) {
8108
+ const fieldId = field.id || `${field.type}_${currentIndex}`;
8104
8109
  acc.push({
8105
- prop: toEasyblocksFieldId(field.id),
8110
+ prop: toEasyblocksFieldId(fieldId),
8106
8111
  label: field.label,
8107
8112
  optional: true,
8108
8113
  ...schemaToEasyblocksProps(field)
@@ -15727,15 +15732,15 @@ function ShopifyPage(_instance, page) {
15727
15732
  return new ShopifyResource({
15728
15733
  author: void 0,
15729
15734
  // Not supported
15730
- content: defer(() => page.content),
15731
- handle: defer(() => page.slug),
15735
+ content: deferWith(page, (page2) => page2.content),
15736
+ handle: deferWith(page, (page2) => page2.slug),
15732
15737
  id: 0,
15733
15738
  metafields: {},
15734
15739
  published_at: deferWith(
15735
15740
  page,
15736
15741
  (page2) => page2.date_published || page2.date_created
15737
15742
  ),
15738
- template_suffix: defer(() => page.theme_template),
15743
+ template_suffix: deferWith(page, (page2) => page2.theme_template),
15739
15744
  title: deferWith(page, (page2) => page2.title || page2.name),
15740
15745
  // Due to deprecated name field
15741
15746
  url: deferWith(page, (page2) => `/pages/${page2.slug}`)