@commercetools-frontend/mc-scripts 21.8.0 → 21.8.1

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.
Files changed (46) hide show
  1. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +20 -12
  2. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +20 -12
  3. package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +20 -12
  4. package/dist/{build-97278377.cjs.dev.js → build-3521a4f3.cjs.dev.js} +3 -3
  5. package/dist/{build-9395925a.cjs.prod.js → build-acb29f36.cjs.prod.js} +3 -3
  6. package/dist/{build-8582b673.esm.js → build-cac1a859.esm.js} +3 -3
  7. package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +1 -1
  8. package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +1 -1
  9. package/dist/commercetools-frontend-mc-scripts.esm.js +1 -1
  10. package/dist/{compile-html-4832f8c5.esm.js → compile-html-4361a0b3.esm.js} +18 -24
  11. package/dist/{compile-html-7654b5e6.cjs.prod.js → compile-html-d6331c35.cjs.prod.js} +18 -24
  12. package/dist/{compile-html-0c588a89.cjs.dev.js → compile-html-d9e731aa.cjs.dev.js} +18 -24
  13. package/dist/{config-sync-62824317.cjs.prod.js → config-sync-7bd51e9b.cjs.prod.js} +46 -74
  14. package/dist/{config-sync-d52e73f6.cjs.dev.js → config-sync-9540c47f.cjs.dev.js} +46 -74
  15. package/dist/{config-sync-20bc05e8.esm.js → config-sync-a6565737.esm.js} +46 -74
  16. package/dist/{create-postcss-config-4cbe10ab.cjs.dev.js → create-postcss-config-07259760.cjs.dev.js} +1 -1
  17. package/dist/{create-postcss-config-c1aa3525.esm.js → create-postcss-config-9e14f015.esm.js} +1 -1
  18. package/dist/{create-postcss-config-8ea16440.cjs.prod.js → create-postcss-config-c1122bfa.cjs.prod.js} +1 -1
  19. package/dist/{create-webpack-config-for-development-e2735e02.cjs.dev.js → create-webpack-config-for-development-20fbe5a5.cjs.dev.js} +1 -1
  20. package/dist/{create-webpack-config-for-development-a5e73092.cjs.prod.js → create-webpack-config-for-development-b70e9af1.cjs.prod.js} +1 -1
  21. package/dist/{create-webpack-config-for-development-8a8b84d6.esm.js → create-webpack-config-for-development-eb1432fe.esm.js} +1 -1
  22. package/dist/{create-webpack-config-for-production-7dc669e5.esm.js → create-webpack-config-for-production-331c8877.esm.js} +1 -1
  23. package/dist/{create-webpack-config-for-production-d9bf281c.cjs.dev.js → create-webpack-config-for-production-4e58ee43.cjs.dev.js} +1 -1
  24. package/dist/{create-webpack-config-for-production-4e7b56c0.cjs.prod.js → create-webpack-config-for-production-e894ffc1.cjs.prod.js} +1 -1
  25. package/dist/declarations/src/commands/compile-html.d.ts +1 -1
  26. package/dist/declarations/src/commands/config-sync.d.ts +1 -1
  27. package/dist/declarations/src/types.d.ts +3 -3
  28. package/dist/{login-7d94659e.esm.js → login-435f4c2b.esm.js} +2 -2
  29. package/dist/{login-779552b7.cjs.dev.js → login-d1cbdeca.cjs.dev.js} +2 -2
  30. package/dist/{login-706ccc9a.cjs.prod.js → login-e943a53a.cjs.prod.js} +2 -2
  31. package/dist/{package-b5c040f3.cjs.prod.js → package-8a5733b4.cjs.dev.js} +7 -7
  32. package/dist/{package-a98de907.esm.js → package-8b6676c0.esm.js} +7 -7
  33. package/dist/{package-aaf61bf0.cjs.dev.js → package-fab41a01.cjs.prod.js} +7 -7
  34. package/dist/{start-e3ccd672.cjs.prod.js → start-086879f3.cjs.prod.js} +3 -3
  35. package/dist/{start-e924bd5d.esm.js → start-52af291f.esm.js} +3 -3
  36. package/dist/{start-2b953ab0.cjs.dev.js → start-dfef24e1.cjs.dev.js} +3 -3
  37. package/dist/{user-agent-8044acd6.esm.js → user-agent-7d6d1d4a.esm.js} +1 -1
  38. package/dist/{user-agent-5da1830b.cjs.dev.js → user-agent-866e4833.cjs.dev.js} +1 -1
  39. package/dist/{user-agent-d18809af.cjs.prod.js → user-agent-94518666.cjs.prod.js} +1 -1
  40. package/package.json +7 -7
  41. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +2 -2
  42. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +2 -2
  43. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -2
  44. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +4 -4
  45. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +4 -4
  46. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +4 -4
@@ -11,7 +11,7 @@ var omit = require('lodash/omit');
11
11
  var prompts = require('prompts');
12
12
  var chalk = require('chalk');
13
13
  var applicationConfig = require('@commercetools-frontend/application-config');
14
- var userAgent = require('./user-agent-5da1830b.cjs.dev.js');
14
+ var userAgent = require('./user-agent-866e4833.cjs.dev.js');
15
15
  var graphqlRequest = require('graphql-request');
16
16
  var constants = require('@commercetools-frontend/constants');
17
17
  var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
@@ -33,7 +33,7 @@ require('fs');
33
33
  require('path');
34
34
  require('os');
35
35
  require('@commercetools/http-user-agent');
36
- require('./package-aaf61bf0.cjs.dev.js');
36
+ require('./package-8a5733b4.cjs.dev.js');
37
37
 
38
38
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
39
39
 
@@ -629,112 +629,84 @@ var getMcUrlLink = function getMcUrlLink(mcApiUrl, organizationId, applicationId
629
629
  return customAppLink;
630
630
  };
631
631
 
632
- function run() {
632
+ function run(_x) {
633
633
  return _run.apply(this, arguments);
634
634
  }
635
635
 
636
636
  function _run() {
637
- _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
637
+ _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(options) {
638
638
  var _context6;
639
639
 
640
- var options,
641
- applicationConfig$1,
642
- localCustomAppData,
643
- mcApiUrl,
644
- token,
645
- fetchedCustomApplication,
646
- _context4,
647
- _context5,
648
- userOrganizations,
649
- organizationId,
650
- organizationName,
651
- _userOrganizations$re,
652
- organization,
653
- _context3,
654
- organizationChoices,
655
- _yield$prompts,
656
- selectedOrganizationId,
657
- _yield$prompts2,
658
- _confirmation,
659
- _data,
660
- createdCustomApplication,
661
- _customAppLink,
662
- customAppLink,
663
- configDiff,
664
- _yield$prompts3,
665
- confirmation,
666
- data,
667
- _args = arguments;
640
+ var applicationConfig$1, localCustomAppData, mcApiUrl, token, fetchedCustomApplication, _context4, _context5, userOrganizations, organizationId, organizationName, _userOrganizations$re, organization, _context3, organizationChoices, _yield$prompts, selectedOrganizationId, _yield$prompts2, _confirmation, _data, createdCustomApplication, _customAppLink, customAppLink, configDiff, _yield$prompts3, confirmation, data;
668
641
 
669
642
  return _regeneratorRuntime__default["default"].wrap(function _callee$(_context7) {
670
643
  while (1) {
671
644
  switch (_context7.prev = _context7.next) {
672
645
  case 0:
673
- options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
674
646
  applicationConfig$1 = applicationConfig.processConfig();
675
647
  localCustomAppData = applicationConfig$1.data;
676
648
  mcApiUrl = applicationConfig$1.env.mcApiUrl;
677
649
  token = credentialsStorage.getToken(mcApiUrl);
678
650
 
679
651
  if (token) {
680
- _context7.next = 7;
652
+ _context7.next = 6;
681
653
  break;
682
654
  }
683
655
 
684
656
  throw new Error("You don't have a valid session for the ".concat(mcApiUrl, " environment. Please, run the \"mc-scripts login\" command to authenticate yourself."));
685
657
 
686
- case 7:
687
- _context7.next = 9;
658
+ case 6:
659
+ _context7.next = 8;
688
660
  return fetchCustomApplication({
689
661
  mcApiUrl: mcApiUrl,
690
662
  token: token,
691
663
  entryPointUriPath: localCustomAppData.entryPointUriPath
692
664
  });
693
665
 
694
- case 9:
666
+ case 8:
695
667
  fetchedCustomApplication = _context7.sent;
696
668
 
697
669
  if (fetchedCustomApplication) {
698
- _context7.next = 52;
670
+ _context7.next = 51;
699
671
  break;
700
672
  }
701
673
 
702
- _context7.next = 13;
674
+ _context7.next = 12;
703
675
  return fetchUserOrganizations({
704
676
  mcApiUrl: mcApiUrl,
705
677
  token: token
706
678
  });
707
679
 
708
- case 13:
680
+ case 12:
709
681
  userOrganizations = _context7.sent;
710
682
 
711
683
  if (!(userOrganizations.total === 0)) {
712
- _context7.next = 16;
684
+ _context7.next = 15;
713
685
  break;
714
686
  }
715
687
 
716
688
  throw new Error("It seems you are not an admin of any Organization. Please make sure to be part of the Administrators team of the Organization you want the Custom Application to be configured to.");
717
689
 
718
- case 16:
690
+ case 15:
719
691
  if (!(userOrganizations.total === 1)) {
720
- _context7.next = 22;
692
+ _context7.next = 21;
721
693
  break;
722
694
  }
723
695
 
724
696
  _userOrganizations$re = _slicedToArray(userOrganizations.results, 1), organization = _userOrganizations$re[0];
725
697
  organizationId = organization.id;
726
698
  organizationName = organization.name;
727
- _context7.next = 31;
699
+ _context7.next = 30;
728
700
  break;
729
701
 
730
- case 22:
702
+ case 21:
731
703
  organizationChoices = _mapInstanceProperty__default["default"](_context3 = userOrganizations.results).call(_context3, function (organization) {
732
704
  return {
733
705
  title: organization.name,
734
706
  value: organization.id
735
707
  };
736
708
  });
737
- _context7.next = 25;
709
+ _context7.next = 24;
738
710
  return prompts__default["default"]({
739
711
  type: 'select',
740
712
  name: 'organizationId',
@@ -743,26 +715,26 @@ function _run() {
743
715
  initial: 0
744
716
  });
745
717
 
746
- case 25:
718
+ case 24:
747
719
  _yield$prompts = _context7.sent;
748
720
  selectedOrganizationId = _yield$prompts.organizationId;
749
721
 
750
722
  if (selectedOrganizationId) {
751
- _context7.next = 29;
723
+ _context7.next = 28;
752
724
  break;
753
725
  }
754
726
 
755
727
  throw new Error("No Organization selected, aborting.");
756
728
 
757
- case 29:
729
+ case 28:
758
730
  organizationId = selectedOrganizationId;
759
731
  organizationName = _findInstanceProperty__default["default"](organizationChoices).call(organizationChoices, function (_ref) {
760
732
  var value = _ref.value;
761
733
  return value === organizationId;
762
734
  }).title;
763
735
 
764
- case 31:
765
- _context7.next = 33;
736
+ case 30:
737
+ _context7.next = 32;
766
738
  return prompts__default["default"]({
767
739
  type: 'text',
768
740
  name: 'confirmation',
@@ -770,23 +742,23 @@ function _run() {
770
742
  initial: 'yes'
771
743
  });
772
744
 
773
- case 33:
745
+ case 32:
774
746
  _yield$prompts2 = _context7.sent;
775
747
  _confirmation = _yield$prompts2.confirmation;
776
748
 
777
749
  if (!(!_confirmation || _confirmation.toLowerCase().charAt(0) !== 'y')) {
778
- _context7.next = 38;
750
+ _context7.next = 37;
779
751
  break;
780
752
  }
781
753
 
782
754
  console.log(chalk__default["default"].red('Aborted.'));
783
755
  return _context7.abrupt("return");
784
756
 
785
- case 38:
757
+ case 37:
786
758
  _data = omit__default["default"](localCustomAppData, ['id']);
787
759
 
788
- if (!options['dry-run']) {
789
- _context7.next = 44;
760
+ if (!options.dryRun) {
761
+ _context7.next = 43;
790
762
  break;
791
763
  }
792
764
 
@@ -795,8 +767,8 @@ function _run() {
795
767
  console.log(_JSON$stringify__default["default"](_data));
796
768
  return _context7.abrupt("return");
797
769
 
798
- case 44:
799
- _context7.next = 46;
770
+ case 43:
771
+ _context7.next = 45;
800
772
  return createCustomApplication({
801
773
  mcApiUrl: mcApiUrl,
802
774
  token: token,
@@ -804,36 +776,36 @@ function _run() {
804
776
  data: _data
805
777
  });
806
778
 
807
- case 46:
779
+ case 45:
808
780
  createdCustomApplication = _context7.sent;
809
781
 
810
782
  if (createdCustomApplication) {
811
- _context7.next = 49;
783
+ _context7.next = 48;
812
784
  break;
813
785
  }
814
786
 
815
787
  throw new Error('Failed to create the Custom Application.');
816
788
 
817
- case 49:
789
+ case 48:
818
790
  _customAppLink = getMcUrlLink(mcApiUrl, organizationId, createdCustomApplication.id);
819
791
  console.log(chalk__default["default"].green(_concatInstanceProperty__default["default"](_context5 = "Custom Application created.\nThe \"applicationId\" in your local Custom Application config file should be updated with the application ID: ".concat(createdCustomApplication.id, ".\nYou can see the Custom Application data in the Merchant Center at ")).call(_context5, _customAppLink, ".")));
820
792
  return _context7.abrupt("return");
821
793
 
822
- case 52:
794
+ case 51:
823
795
  customAppLink = getMcUrlLink(mcApiUrl, fetchedCustomApplication.organizationId, fetchedCustomApplication.application.id);
824
796
  configDiff = getConfigDiff(fetchedCustomApplication.application, localCustomAppData);
825
797
 
826
798
  if (configDiff) {
827
- _context7.next = 57;
799
+ _context7.next = 56;
828
800
  break;
829
801
  }
830
802
 
831
803
  console.log(chalk__default["default"].green("Custom Application is already up to date.\nYou can see the Custom Application data in the Merchant Center at ".concat(customAppLink, ".")));
832
804
  return _context7.abrupt("return");
833
805
 
834
- case 57:
806
+ case 56:
835
807
  console.log(configDiff);
836
- _context7.next = 60;
808
+ _context7.next = 59;
837
809
  return prompts__default["default"]({
838
810
  type: 'text',
839
811
  name: 'confirmation',
@@ -841,23 +813,23 @@ function _run() {
841
813
  initial: 'yes'
842
814
  });
843
815
 
844
- case 60:
816
+ case 59:
845
817
  _yield$prompts3 = _context7.sent;
846
818
  confirmation = _yield$prompts3.confirmation;
847
819
 
848
820
  if (!(!confirmation || confirmation.toLowerCase().charAt(0) !== 'y')) {
849
- _context7.next = 65;
821
+ _context7.next = 64;
850
822
  break;
851
823
  }
852
824
 
853
825
  console.log(chalk__default["default"].red('Aborted.'));
854
826
  return _context7.abrupt("return");
855
827
 
856
- case 65:
828
+ case 64:
857
829
  data = omit__default["default"](localCustomAppData, ['id']);
858
830
 
859
- if (!options['dry-run']) {
860
- _context7.next = 71;
831
+ if (!options.dryRun) {
832
+ _context7.next = 70;
861
833
  break;
862
834
  }
863
835
 
@@ -866,8 +838,8 @@ function _run() {
866
838
  console.log(_JSON$stringify__default["default"](data));
867
839
  return _context7.abrupt("return");
868
840
 
869
- case 71:
870
- _context7.next = 73;
841
+ case 70:
842
+ _context7.next = 72;
871
843
  return updateCustomApplication({
872
844
  mcApiUrl: mcApiUrl,
873
845
  token: token,
@@ -876,10 +848,10 @@ function _run() {
876
848
  applicationId: fetchedCustomApplication.application.id
877
849
  });
878
850
 
879
- case 73:
851
+ case 72:
880
852
  console.log(chalk__default["default"].green("Custom Application updated.\nYou can see the Custom Application data in the Merchant Center at ".concat(customAppLink, ".")));
881
853
 
882
- case 74:
854
+ case 73:
883
855
  case "end":
884
856
  return _context7.stop();
885
857
  }
@@ -9,7 +9,7 @@ import omit from 'lodash/omit';
9
9
  import prompts from 'prompts';
10
10
  import chalk from 'chalk';
11
11
  import { processConfig } from '@commercetools-frontend/application-config';
12
- import { u as userAgent, C as CredentialsStorage } from './user-agent-8044acd6.esm.js';
12
+ import { u as userAgent, C as CredentialsStorage } from './user-agent-7d6d1d4a.esm.js';
13
13
  import { GraphQLClient } from 'graphql-request';
14
14
  import { GRAPHQL_TARGETS } from '@commercetools-frontend/constants';
15
15
  import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
@@ -31,7 +31,7 @@ import 'fs';
31
31
  import 'path';
32
32
  import 'os';
33
33
  import '@commercetools/http-user-agent';
34
- import './package-a98de907.esm.js';
34
+ import './package-8b6676c0.esm.js';
35
35
 
36
36
  var FetchCustomApplicationFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchCustomApplicationFromCli" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "entryPointUriPath" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "organizationExtensionForCustomApplication" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "entryPointUriPath" }, value: { kind: "Variable", name: { kind: "Name", value: "entryPointUriPath" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "organizationId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "application" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "entryPointUriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "description" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "url" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "icon" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "name" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "oAuthScopes" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "mainMenuLink" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "defaultLabel" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "submenuLinks" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "uriPath" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "defaultLabel" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "permissions" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "labelAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }] } }] } }] } }], loc: { start: 0, end: 647, source: { body: "query FetchCustomApplicationFromCli($entryPointUriPath: String!) {\n organizationExtensionForCustomApplication(\n entryPointUriPath: $entryPointUriPath\n ) {\n organizationId\n application {\n id\n entryPointUriPath\n name\n description\n url\n icon\n permissions {\n name\n oAuthScopes\n }\n mainMenuLink {\n defaultLabel\n permissions\n labelAllLocales {\n locale\n value\n }\n }\n submenuLinks {\n uriPath\n defaultLabel\n permissions\n labelAllLocales {\n locale\n value\n }\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
37
37
  var UpdateCustomApplicationFromCli = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "mutation", name: { kind: "Name", value: "UpdateCustomApplicationFromCli" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "organizationId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "data" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "CustomApplicationDraftDataInput" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "applicationId" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ID" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "updateCustomApplication" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "organizationId" }, value: { kind: "Variable", name: { kind: "Name", value: "organizationId" } } }, { kind: "Argument", name: { kind: "Name", value: "data" }, value: { kind: "Variable", name: { kind: "Name", value: "data" } } }, { kind: "Argument", name: { kind: "Name", value: "applicationId" }, value: { kind: "Variable", name: { kind: "Name", value: "applicationId" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 268, source: { body: "mutation UpdateCustomApplicationFromCli(\n $organizationId: String!\n $data: CustomApplicationDraftDataInput!\n $applicationId: ID!\n) {\n updateCustomApplication(\n organizationId: $organizationId\n data: $data\n applicationId: $applicationId\n ) {\n id\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
@@ -605,112 +605,84 @@ var getMcUrlLink = function getMcUrlLink(mcApiUrl, organizationId, applicationId
605
605
  return customAppLink;
606
606
  };
607
607
 
608
- function run() {
608
+ function run(_x) {
609
609
  return _run.apply(this, arguments);
610
610
  }
611
611
 
612
612
  function _run() {
613
- _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
613
+ _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
614
614
  var _context6;
615
615
 
616
- var options,
617
- applicationConfig,
618
- localCustomAppData,
619
- mcApiUrl,
620
- token,
621
- fetchedCustomApplication,
622
- _context4,
623
- _context5,
624
- userOrganizations,
625
- organizationId,
626
- organizationName,
627
- _userOrganizations$re,
628
- organization,
629
- _context3,
630
- organizationChoices,
631
- _yield$prompts,
632
- selectedOrganizationId,
633
- _yield$prompts2,
634
- _confirmation,
635
- _data,
636
- createdCustomApplication,
637
- _customAppLink,
638
- customAppLink,
639
- configDiff,
640
- _yield$prompts3,
641
- confirmation,
642
- data,
643
- _args = arguments;
616
+ var applicationConfig, localCustomAppData, mcApiUrl, token, fetchedCustomApplication, _context4, _context5, userOrganizations, organizationId, organizationName, _userOrganizations$re, organization, _context3, organizationChoices, _yield$prompts, selectedOrganizationId, _yield$prompts2, _confirmation, _data, createdCustomApplication, _customAppLink, customAppLink, configDiff, _yield$prompts3, confirmation, data;
644
617
 
645
618
  return _regeneratorRuntime.wrap(function _callee$(_context7) {
646
619
  while (1) {
647
620
  switch (_context7.prev = _context7.next) {
648
621
  case 0:
649
- options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
650
622
  applicationConfig = processConfig();
651
623
  localCustomAppData = applicationConfig.data;
652
624
  mcApiUrl = applicationConfig.env.mcApiUrl;
653
625
  token = credentialsStorage.getToken(mcApiUrl);
654
626
 
655
627
  if (token) {
656
- _context7.next = 7;
628
+ _context7.next = 6;
657
629
  break;
658
630
  }
659
631
 
660
632
  throw new Error("You don't have a valid session for the ".concat(mcApiUrl, " environment. Please, run the \"mc-scripts login\" command to authenticate yourself."));
661
633
 
662
- case 7:
663
- _context7.next = 9;
634
+ case 6:
635
+ _context7.next = 8;
664
636
  return fetchCustomApplication({
665
637
  mcApiUrl: mcApiUrl,
666
638
  token: token,
667
639
  entryPointUriPath: localCustomAppData.entryPointUriPath
668
640
  });
669
641
 
670
- case 9:
642
+ case 8:
671
643
  fetchedCustomApplication = _context7.sent;
672
644
 
673
645
  if (fetchedCustomApplication) {
674
- _context7.next = 52;
646
+ _context7.next = 51;
675
647
  break;
676
648
  }
677
649
 
678
- _context7.next = 13;
650
+ _context7.next = 12;
679
651
  return fetchUserOrganizations({
680
652
  mcApiUrl: mcApiUrl,
681
653
  token: token
682
654
  });
683
655
 
684
- case 13:
656
+ case 12:
685
657
  userOrganizations = _context7.sent;
686
658
 
687
659
  if (!(userOrganizations.total === 0)) {
688
- _context7.next = 16;
660
+ _context7.next = 15;
689
661
  break;
690
662
  }
691
663
 
692
664
  throw new Error("It seems you are not an admin of any Organization. Please make sure to be part of the Administrators team of the Organization you want the Custom Application to be configured to.");
693
665
 
694
- case 16:
666
+ case 15:
695
667
  if (!(userOrganizations.total === 1)) {
696
- _context7.next = 22;
668
+ _context7.next = 21;
697
669
  break;
698
670
  }
699
671
 
700
672
  _userOrganizations$re = _slicedToArray(userOrganizations.results, 1), organization = _userOrganizations$re[0];
701
673
  organizationId = organization.id;
702
674
  organizationName = organization.name;
703
- _context7.next = 31;
675
+ _context7.next = 30;
704
676
  break;
705
677
 
706
- case 22:
678
+ case 21:
707
679
  organizationChoices = _mapInstanceProperty(_context3 = userOrganizations.results).call(_context3, function (organization) {
708
680
  return {
709
681
  title: organization.name,
710
682
  value: organization.id
711
683
  };
712
684
  });
713
- _context7.next = 25;
685
+ _context7.next = 24;
714
686
  return prompts({
715
687
  type: 'select',
716
688
  name: 'organizationId',
@@ -719,26 +691,26 @@ function _run() {
719
691
  initial: 0
720
692
  });
721
693
 
722
- case 25:
694
+ case 24:
723
695
  _yield$prompts = _context7.sent;
724
696
  selectedOrganizationId = _yield$prompts.organizationId;
725
697
 
726
698
  if (selectedOrganizationId) {
727
- _context7.next = 29;
699
+ _context7.next = 28;
728
700
  break;
729
701
  }
730
702
 
731
703
  throw new Error("No Organization selected, aborting.");
732
704
 
733
- case 29:
705
+ case 28:
734
706
  organizationId = selectedOrganizationId;
735
707
  organizationName = _findInstanceProperty(organizationChoices).call(organizationChoices, function (_ref) {
736
708
  var value = _ref.value;
737
709
  return value === organizationId;
738
710
  }).title;
739
711
 
740
- case 31:
741
- _context7.next = 33;
712
+ case 30:
713
+ _context7.next = 32;
742
714
  return prompts({
743
715
  type: 'text',
744
716
  name: 'confirmation',
@@ -746,23 +718,23 @@ function _run() {
746
718
  initial: 'yes'
747
719
  });
748
720
 
749
- case 33:
721
+ case 32:
750
722
  _yield$prompts2 = _context7.sent;
751
723
  _confirmation = _yield$prompts2.confirmation;
752
724
 
753
725
  if (!(!_confirmation || _confirmation.toLowerCase().charAt(0) !== 'y')) {
754
- _context7.next = 38;
726
+ _context7.next = 37;
755
727
  break;
756
728
  }
757
729
 
758
730
  console.log(chalk.red('Aborted.'));
759
731
  return _context7.abrupt("return");
760
732
 
761
- case 38:
733
+ case 37:
762
734
  _data = omit(localCustomAppData, ['id']);
763
735
 
764
- if (!options['dry-run']) {
765
- _context7.next = 44;
736
+ if (!options.dryRun) {
737
+ _context7.next = 43;
766
738
  break;
767
739
  }
768
740
 
@@ -771,8 +743,8 @@ function _run() {
771
743
  console.log(_JSON$stringify(_data));
772
744
  return _context7.abrupt("return");
773
745
 
774
- case 44:
775
- _context7.next = 46;
746
+ case 43:
747
+ _context7.next = 45;
776
748
  return createCustomApplication({
777
749
  mcApiUrl: mcApiUrl,
778
750
  token: token,
@@ -780,36 +752,36 @@ function _run() {
780
752
  data: _data
781
753
  });
782
754
 
783
- case 46:
755
+ case 45:
784
756
  createdCustomApplication = _context7.sent;
785
757
 
786
758
  if (createdCustomApplication) {
787
- _context7.next = 49;
759
+ _context7.next = 48;
788
760
  break;
789
761
  }
790
762
 
791
763
  throw new Error('Failed to create the Custom Application.');
792
764
 
793
- case 49:
765
+ case 48:
794
766
  _customAppLink = getMcUrlLink(mcApiUrl, organizationId, createdCustomApplication.id);
795
767
  console.log(chalk.green(_concatInstanceProperty(_context5 = "Custom Application created.\nThe \"applicationId\" in your local Custom Application config file should be updated with the application ID: ".concat(createdCustomApplication.id, ".\nYou can see the Custom Application data in the Merchant Center at ")).call(_context5, _customAppLink, ".")));
796
768
  return _context7.abrupt("return");
797
769
 
798
- case 52:
770
+ case 51:
799
771
  customAppLink = getMcUrlLink(mcApiUrl, fetchedCustomApplication.organizationId, fetchedCustomApplication.application.id);
800
772
  configDiff = getConfigDiff(fetchedCustomApplication.application, localCustomAppData);
801
773
 
802
774
  if (configDiff) {
803
- _context7.next = 57;
775
+ _context7.next = 56;
804
776
  break;
805
777
  }
806
778
 
807
779
  console.log(chalk.green("Custom Application is already up to date.\nYou can see the Custom Application data in the Merchant Center at ".concat(customAppLink, ".")));
808
780
  return _context7.abrupt("return");
809
781
 
810
- case 57:
782
+ case 56:
811
783
  console.log(configDiff);
812
- _context7.next = 60;
784
+ _context7.next = 59;
813
785
  return prompts({
814
786
  type: 'text',
815
787
  name: 'confirmation',
@@ -817,23 +789,23 @@ function _run() {
817
789
  initial: 'yes'
818
790
  });
819
791
 
820
- case 60:
792
+ case 59:
821
793
  _yield$prompts3 = _context7.sent;
822
794
  confirmation = _yield$prompts3.confirmation;
823
795
 
824
796
  if (!(!confirmation || confirmation.toLowerCase().charAt(0) !== 'y')) {
825
- _context7.next = 65;
797
+ _context7.next = 64;
826
798
  break;
827
799
  }
828
800
 
829
801
  console.log(chalk.red('Aborted.'));
830
802
  return _context7.abrupt("return");
831
803
 
832
- case 65:
804
+ case 64:
833
805
  data = omit(localCustomAppData, ['id']);
834
806
 
835
- if (!options['dry-run']) {
836
- _context7.next = 71;
807
+ if (!options.dryRun) {
808
+ _context7.next = 70;
837
809
  break;
838
810
  }
839
811
 
@@ -842,8 +814,8 @@ function _run() {
842
814
  console.log(_JSON$stringify(data));
843
815
  return _context7.abrupt("return");
844
816
 
845
- case 71:
846
- _context7.next = 73;
817
+ case 70:
818
+ _context7.next = 72;
847
819
  return updateCustomApplication({
848
820
  mcApiUrl: mcApiUrl,
849
821
  token: token,
@@ -852,10 +824,10 @@ function _run() {
852
824
  applicationId: fetchedCustomApplication.application.id
853
825
  });
854
826
 
855
- case 73:
827
+ case 72:
856
828
  console.log(chalk.green("Custom Application updated.\nYou can see the Custom Application data in the Merchant Center at ".concat(customAppLink, ".")));
857
829
 
858
- case 74:
830
+ case 73:
859
831
  case "end":
860
832
  return _context7.stop();
861
833
  }
@@ -4,7 +4,7 @@ var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArr
4
4
  var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
5
5
  var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
6
6
  var path = require('path');
7
- var _package = require('./package-aaf61bf0.cjs.dev.js');
7
+ var _package = require('./package-8a5733b4.cjs.dev.js');
8
8
 
9
9
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
10
10
 
@@ -2,7 +2,7 @@ import _toConsumableArray from '@babel/runtime-corejs3/helpers/esm/toConsumableA
2
2
  import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
3
3
  import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
4
4
  import path from 'path';
5
- import { p as pkgJson } from './package-a98de907.esm.js';
5
+ import { p as pkgJson } from './package-8b6676c0.esm.js';
6
6
 
7
7
  // This function aims to return the same result as `require.resolve`.
8
8
  // However, resolving a path to a `.css` file does not return the real
@@ -4,7 +4,7 @@ var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArr
4
4
  var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
5
5
  var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
6
6
  var path = require('path');
7
- var _package = require('./package-b5c040f3.cjs.prod.js');
7
+ var _package = require('./package-fab41a01.cjs.prod.js');
8
8
 
9
9
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
10
10