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