@anker-in/shopify-sdk 1.2.0-beta.14 → 1.2.0-beta.16

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.js CHANGED
@@ -6,23 +6,21 @@ var shopifyCore = require('@anker-in/shopify-core');
6
6
  var SPECIAL_METAFIELD_NAMESPACES = ["__discountCodeApp", "discounts_function"];
7
7
  function constructMetafieldIdentifiersQueryParams(metafieldIdentifiers, metafieldNamespacePrefix) {
8
8
  if (!metafieldIdentifiers || Object.keys(metafieldIdentifiers).length === 0) {
9
- return {
10
- productMetafieldIdentifiers: [],
11
- variantMetafieldIdentifiers: []
12
- };
9
+ return {};
13
10
  }
14
11
  const identifiers = Object.entries(metafieldIdentifiers).reduce(
15
12
  (queryInput, [key, value]) => {
16
13
  const metafieldIdentifiers2 = value;
14
+ const comboNamespace = `${metafieldNamespacePrefix}combo`;
17
15
  const mappedIdentifiers = metafieldIdentifiers2.map((item) => {
18
- if (SPECIAL_METAFIELD_NAMESPACES.includes(item.namespace)) {
16
+ if (SPECIAL_METAFIELD_NAMESPACES.includes(item.namespace) || item.namespace?.startsWith(comboNamespace)) {
19
17
  return {
20
18
  namespace: item.namespace,
21
19
  key: item.key
22
20
  };
23
21
  }
24
22
  return {
25
- namespace: `${metafieldNamespacePrefix}combo`,
23
+ namespace: comboNamespace,
26
24
  key: item.namespace
27
25
  };
28
26
  });
@@ -696,8 +694,6 @@ var articleFragment = (
696
694
  name
697
695
  }
698
696
  }
699
- ${imageFragment}
700
- ${seoFragment}
701
697
  `
702
698
  );
703
699
  var articleWithMetafieldsFragment = (
@@ -726,9 +722,6 @@ var articleWithMetafieldsFragment = (
726
722
  ...metafield
727
723
  }
728
724
  }
729
- ${imageFragment}
730
- ${seoFragment}
731
- ${metafieldFragment}
732
725
  `
733
726
  );
734
727
  var blogFragment = (
@@ -742,7 +735,6 @@ var blogFragment = (
742
735
  ...seo
743
736
  }
744
737
  }
745
- ${seoFragment}
746
738
  `
747
739
  );
748
740
  var blogWithMetafieldsFragment = (
@@ -759,8 +751,6 @@ var blogWithMetafieldsFragment = (
759
751
  ...metafield
760
752
  }
761
753
  }
762
- ${seoFragment}
763
- ${metafieldFragment}
764
754
  `
765
755
  );
766
756
 
@@ -813,9 +803,14 @@ var shopFragment = (
813
803
  fragment shop on Shop {
814
804
  name
815
805
  description
806
+ moneyFormat
816
807
  primaryDomain {
817
- url
818
808
  host
809
+ url
810
+ }
811
+ paymentSettings {
812
+ currencyCode
813
+ enabledPresentmentCurrencies
819
814
  }
820
815
  brand {
821
816
  logo {
@@ -841,9 +836,14 @@ var shopWithMetafieldsFragment = (
841
836
  fragment shopWithMetafields on Shop {
842
837
  name
843
838
  description
839
+ moneyFormat
844
840
  primaryDomain {
845
- url
846
841
  host
842
+ url
843
+ }
844
+ paymentSettings {
845
+ currencyCode
846
+ enabledPresentmentCurrencies
847
847
  }
848
848
  brand {
849
849
  logo {
@@ -2287,6 +2287,9 @@ async function getBlog(client, options) {
2287
2287
  ...${hasMetafields ? "blogWithMetafields" : "blog"}
2288
2288
  }
2289
2289
  }
2290
+ ${imageFragment}
2291
+ ${metafieldFragment}
2292
+ ${seoFragment}
2290
2293
  ${fragment}
2291
2294
  `
2292
2295
  );
@@ -2334,6 +2337,9 @@ async function fetchAllPages2(client, options, afterCursor) {
2334
2337
  }
2335
2338
  }
2336
2339
  }
2340
+ ${imageFragment}
2341
+ ${metafieldFragment}
2342
+ ${seoFragment}
2337
2343
  ${fragment}
2338
2344
  ${pageInfoFragment}
2339
2345
  `
@@ -2390,6 +2396,9 @@ async function getArticle(client, options) {
2390
2396
  }
2391
2397
  }
2392
2398
  }
2399
+ ${imageFragment}
2400
+ ${metafieldFragment}
2401
+ ${seoFragment}
2393
2402
  ${articleFrag}
2394
2403
  ${blogFrag}
2395
2404
  `
@@ -2449,6 +2458,9 @@ async function fetchAllArticles(client, options, afterCursor) {
2449
2458
  }
2450
2459
  }
2451
2460
  }
2461
+ ${imageFragment}
2462
+ ${metafieldFragment}
2463
+ ${seoFragment}
2452
2464
  ${fragment}
2453
2465
  ${pageInfoFragment}
2454
2466
  `
@@ -2485,7 +2497,7 @@ async function getArticles(client, options) {
2485
2497
  }
2486
2498
 
2487
2499
  // src/api/blog/get-articles-in-blog.ts
2488
- async function fetchAllPages3(client, options, afterCursor) {
2500
+ async function fetchArticlesInBlog(client, options, afterCursor) {
2489
2501
  const {
2490
2502
  blogHandle,
2491
2503
  first = 250,
@@ -2529,6 +2541,9 @@ async function fetchAllPages3(client, options, afterCursor) {
2529
2541
  }
2530
2542
  }
2531
2543
  }
2544
+ ${imageFragment}
2545
+ ${metafieldFragment}
2546
+ ${seoFragment}
2532
2547
  ${articleFrag}
2533
2548
  ${blogFrag}
2534
2549
  ${pageInfoFragment}
@@ -2554,13 +2569,17 @@ async function fetchAllPages3(client, options, afterCursor) {
2554
2569
  }
2555
2570
  const articles = data.blog.articles.edges?.map((edge) => normalizeArticle(edge.node)) || [];
2556
2571
  if (data.blog.articles.pageInfo.hasNextPage) {
2557
- const nextArticles = await fetchAllPages3(client, options, data.blog.articles.pageInfo.endCursor);
2572
+ const nextArticles = await fetchArticlesInBlog(
2573
+ client,
2574
+ options,
2575
+ data.blog.articles.pageInfo.endCursor
2576
+ );
2558
2577
  return [...articles, ...nextArticles];
2559
2578
  }
2560
2579
  return articles;
2561
2580
  }
2562
2581
  async function getArticlesInBlog(client, options) {
2563
- return fetchAllPages3(client, options);
2582
+ return fetchArticlesInBlog(client, options);
2564
2583
  }
2565
2584
 
2566
2585
  // src/api/page/normalize.ts
@@ -2622,6 +2641,8 @@ function normalizeShop(shop) {
2622
2641
  return {
2623
2642
  name: shop.name,
2624
2643
  description: shop.description || "",
2644
+ moneyFormat: shop.moneyFormat,
2645
+ paymentSettings: shop.paymentSettings,
2625
2646
  primaryDomain: shop.primaryDomain,
2626
2647
  brand: shop.brand || void 0,
2627
2648
  metafields: normalizeMetafields(shop.metafields)