@commercetools-frontend/experimental-components 6.2.0 → 6.2.2

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/styles.css CHANGED
@@ -24,6 +24,11 @@
24
24
  margin-top: 2px;
25
25
  position: absolute;
26
26
  }
27
+ /* imported from store-select-input.module.css */
28
+
29
+ .store-select-input-module__customOption___2SC00 {
30
+ margin-top: 10px;
31
+ }
27
32
  /* imported from validated-input.module.css */
28
33
 
29
34
  .validated-input-module__invalid___380EL {
@@ -500,15 +505,6 @@
500
505
  width: 1px;
501
506
  height: 1px;
502
507
  }
503
- /* imported from centered-loading-spinner.module.css */
504
-
505
- .centered-loading-spinner-module__loading-container___3_9-h {
506
- height: 100%;
507
- display: flex;
508
- flex-grow: 1;
509
- align-items: center;
510
- justify-content: center;
511
- }
512
508
  /* imported from divider.module.css */
513
509
 
514
510
  .divider-module__divider___4-vdy {
@@ -536,6 +532,15 @@
536
532
  .divider-module__divider-dashed___2Em8A {
537
533
  border-style: dashed;
538
534
  }
535
+ /* imported from centered-loading-spinner.module.css */
536
+
537
+ .centered-loading-spinner-module__loading-container___3_9-h {
538
+ height: 100%;
539
+ display: flex;
540
+ flex-grow: 1;
541
+ align-items: center;
542
+ justify-content: center;
543
+ }
539
544
  /* imported from reference-search.module.css */
540
545
 
541
546
  .reference-search-module__container___3-iK3 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/experimental-components",
3
- "version": "6.2.0",
3
+ "version": "6.2.2",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,25 +12,32 @@
12
12
  "files": [
13
13
  "dist",
14
14
  "package.json",
15
- "README.md"
15
+ "README.md",
16
+ "test-utils"
16
17
  ],
18
+ "preconstruct": {
19
+ "entrypoints": [
20
+ "index.js",
21
+ "test-utils.js"
22
+ ]
23
+ },
17
24
  "dependencies": {
18
25
  "@babel/core": "^7.22.11",
19
26
  "@babel/runtime": "^7.21.0",
20
27
  "@babel/runtime-corejs3": "^7.21.0",
21
- "@commercetools-frontend/actions-global": "npm:@commercetools-frontend/actions-global@^22.31.0",
22
- "@commercetools-frontend/application-components": "npm:@commercetools-frontend/application-components@^22.31.0",
23
- "@commercetools-frontend/application-shell": "npm:@commercetools-frontend/application-shell@^22.31.0",
24
- "@commercetools-frontend/application-shell-connectors": "npm:@commercetools-frontend/application-shell-connectors@^22.31.0",
25
- "@commercetools-frontend/constants": "npm:@commercetools-frontend/constants@^22.31.0",
26
- "@commercetools-frontend/l10n": "npm:@commercetools-frontend/l10n@^22.31.0",
27
- "@commercetools-frontend/sdk": "npm:@commercetools-frontend/sdk@^22.31.0",
28
- "@commercetools-frontend/sentry": "npm:@commercetools-frontend/sentry@^22.31.0",
29
- "@commercetools-frontend/ui-kit": "npm:@commercetools-frontend/ui-kit@^19.10.0",
30
- "@commercetools-uikit/design-system": "npm:@commercetools-uikit/design-system@^19.10.0",
31
- "@commercetools-uikit/select-utils": "npm:@commercetools-uikit/select-utils@^19.10.0",
32
- "@commercetools-uikit/utils": "npm:@commercetools-uikit/utils@^19.10.0",
33
- "@emotion/react": "^11.11.4",
28
+ "@commercetools-frontend/actions-global": "npm:@commercetools-frontend/actions-global@^22.33.0",
29
+ "@commercetools-frontend/application-components": "npm:@commercetools-frontend/application-components@^22.33.0",
30
+ "@commercetools-frontend/application-shell": "npm:@commercetools-frontend/application-shell@^22.33.0",
31
+ "@commercetools-frontend/application-shell-connectors": "npm:@commercetools-frontend/application-shell-connectors@^22.33.0",
32
+ "@commercetools-frontend/constants": "npm:@commercetools-frontend/constants@^22.33.0",
33
+ "@commercetools-frontend/l10n": "npm:@commercetools-frontend/l10n@^22.33.0",
34
+ "@commercetools-frontend/sdk": "npm:@commercetools-frontend/sdk@^22.33.0",
35
+ "@commercetools-frontend/sentry": "npm:@commercetools-frontend/sentry@^22.33.0",
36
+ "@commercetools-frontend/ui-kit": "npm:@commercetools-frontend/ui-kit@^19.11.0",
37
+ "@commercetools-uikit/design-system": "npm:@commercetools-uikit/design-system@^19.11.0",
38
+ "@commercetools-uikit/select-utils": "npm:@commercetools-uikit/select-utils@^19.11.0",
39
+ "@commercetools-uikit/utils": "npm:@commercetools-uikit/utils@^19.11.0",
40
+ "@emotion/react": "11.13.3",
34
41
  "classnames": "2.5.1",
35
42
  "cleave.js": "1.5.10",
36
43
  "common-tags": "1.8.2",
@@ -53,11 +60,11 @@
53
60
  },
54
61
  "devDependencies": {
55
62
  "@apollo/client": "3.7.10",
56
- "@commercetools-test-data/channel": "10.2.0",
57
- "@commercetools-test-data/commons": "10.2.0",
58
- "@commercetools-test-data/core": "10.2.0",
59
- "@commercetools-test-data/product-selection": "10.2.0",
60
- "@commercetools-test-data/store": "10.2.0",
63
+ "@commercetools-test-data/channel": "10.7.1",
64
+ "@commercetools-test-data/commons": "10.7.1",
65
+ "@commercetools-test-data/core": "10.7.1",
66
+ "@commercetools-test-data/product-selection": "10.7.1",
67
+ "@commercetools-test-data/store": "10.7.1",
61
68
  "@testing-library/react": "12.1.5",
62
69
  "@testing-library/react-hooks": "8.0.1",
63
70
  "formik": "2.4.6",
@@ -0,0 +1,219 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var msw = require('msw');
6
+ var _lastIndexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/last-index-of');
7
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
8
+ var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
9
+ var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
10
+ var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
11
+ var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
12
+ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
13
+ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
14
+ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
15
+ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
16
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
17
+
18
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
19
+
20
+ var _lastIndexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_lastIndexOfInstanceProperty);
21
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
22
+ var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
23
+ var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
24
+ var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
25
+ var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
26
+ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
27
+ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
28
+ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
29
+ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
30
+
31
+ const handlers$8 = {
32
+ TotalNumberOfStores: {
33
+ all: total => msw.graphql.query('TotalNumberOfStores', (req, res, ctx) => {
34
+ return res(ctx.data({
35
+ totalNumberOfStores: {
36
+ total
37
+ }
38
+ }));
39
+ })
40
+ }
41
+ };
42
+
43
+ const handlers$7 = {
44
+ TypeDefinitions: {
45
+ all: typeDefinitions => msw.graphql.query('FetchTypeDefinitionsQuery', (req, res, ctx) => res(ctx.data({
46
+ typeDefinitions
47
+ })))
48
+ }
49
+ };
50
+
51
+ const graphqlQueries = {
52
+ ASSOCIATE_ROLE: 'associateRoles',
53
+ ATTRIBUTE_GROUP: 'attributeGroups',
54
+ BUSINESS_UNIT: 'businessUnits',
55
+ CART: 'carts',
56
+ CART_DISCOUNT: 'cartDiscounts',
57
+ CATEGORY: 'categories',
58
+ CHANNEL: 'channels',
59
+ CUSTOMER: 'customers',
60
+ CUSTOMER_GROUP: 'customerGroups',
61
+ DISCOUNT_CODE: 'discountCodes',
62
+ INVENTORY_ENTRY: 'inventoryEntries',
63
+ ORDER: 'orders',
64
+ PAYMENT: 'payments',
65
+ PRODUCT: 'products',
66
+ PRODUCT_DISCOUNT: 'productDiscounts',
67
+ PRODUCT_SELECTION: 'productSelections',
68
+ PRODUCT_TYPE: 'productTypes',
69
+ SHIPPING_METHOD: 'shippingMethods',
70
+ STORE: 'stores',
71
+ TAX_CATEGORY: 'taxCategories',
72
+ ZONE: 'zones'
73
+ };
74
+ const handlers$6 = {
75
+ DuplicatedField: {
76
+ total: (total, resourceType) => msw.graphql.query('FetchResourceTypeDuplicatedField', (req, res, ctx) => {
77
+ if (!graphqlQueries[resourceType]) return res(ctx.data({}));
78
+ return res(ctx.data({
79
+ [graphqlQueries[resourceType]]: {
80
+ total
81
+ }
82
+ }));
83
+ })
84
+ }
85
+ };
86
+
87
+ const handlers$5 = {
88
+ ProductSelections: {
89
+ all: productSelections => msw.graphql.query('FetchProductSelections', (req, res, ctx) => res(ctx.data({
90
+ productSelections
91
+ })))
92
+ }
93
+ };
94
+
95
+ const handlers$4 = {
96
+ ProductSelections: {
97
+ total: total => msw.graphql.query('FetchProductSelectionsTotal', (req, res, ctx) => res(ctx.data({
98
+ productSelections: {
99
+ total,
100
+ __typename: 'ProductSelectionQueryResult'
101
+ }
102
+ })))
103
+ }
104
+ };
105
+
106
+ const extractKeysFromWherePredicateClause = function () {
107
+ let whereClause = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
108
+ return whereClause.substring(_lastIndexOfInstanceProperty__default["default"](whereClause).call(whereClause, '("') + 1, _lastIndexOfInstanceProperty__default["default"](whereClause).call(whereClause, '")')).replace(/["]/g, '').split(', ');
109
+ };
110
+ const handlers$3 = {
111
+ StoresList: {
112
+ all: stores => msw.graphql.query('FetchStoresQuery', (req, res, ctx) => {
113
+ // GIVEN req.variables.where is specified
114
+ // THEN return only stores that are being requested (filtering stores based on IDs)
115
+ // ELSE return all the stores (without filtering any)
116
+ if (req.variables.where) {
117
+ var _context;
118
+ const requestedStoreKeys = extractKeysFromWherePredicateClause(req.variables.where);
119
+ const filteredStoreResults = _filterInstanceProperty__default["default"](_context = stores.results).call(_context, store => _includesInstanceProperty__default["default"](requestedStoreKeys).call(requestedStoreKeys, store.key));
120
+ return res(ctx.data({
121
+ stores: {
122
+ offset: 0,
123
+ total: filteredStoreResults.length,
124
+ count: filteredStoreResults.length,
125
+ results: filteredStoreResults,
126
+ __typename: 'StoresQueryResult'
127
+ }
128
+ }));
129
+ }
130
+ return res(ctx.data({
131
+ stores
132
+ }));
133
+ }),
134
+ withProductSelections: stores => msw.graphql.query('FetchStoresQuery', (req, res, ctx) => {
135
+ // GIVEN req.variables.where is specified
136
+ // THEN return only stores that are being requested (filtering stores based on IDs)
137
+ // ELSE return all the stores (without filtering any)
138
+ if (req.variables.where) {
139
+ var _context2;
140
+ const requestedStoreKeys = extractKeysFromWherePredicateClause(req.variables.where);
141
+ const filteredStoreResults = _filterInstanceProperty__default["default"](_context2 = stores.results).call(_context2, store => _includesInstanceProperty__default["default"](requestedStoreKeys).call(requestedStoreKeys, store.key));
142
+ return res(ctx.data({
143
+ stores: {
144
+ offset: 0,
145
+ total: filteredStoreResults.length,
146
+ count: filteredStoreResults.length,
147
+ results: filteredStoreResults,
148
+ __typename: 'StoresQueryResult'
149
+ }
150
+ }));
151
+ }
152
+ return res(ctx.data({
153
+ stores
154
+ }));
155
+ })
156
+ }
157
+ };
158
+
159
+ const handlers$2 = {
160
+ FetchStoresByField: {
161
+ all: stores => msw.graphql.query('FetchStoresByField', (req, res, ctx) => {
162
+ return res(ctx.data({
163
+ storesByField: stores
164
+ }));
165
+ })
166
+ }
167
+ };
168
+
169
+ const handlers$1 = {
170
+ FetchStoresByWherePredicate: {
171
+ all: stores => msw.graphql.query('FetchStoresByWherePredicate', (req, res, ctx) => {
172
+ return res(ctx.data({
173
+ storesByWherePredicate: {
174
+ results: stores,
175
+ total: stores.length
176
+ }
177
+ }));
178
+ })
179
+ }
180
+ };
181
+
182
+ const handlers = {
183
+ PlatformLimits: {
184
+ all: platformLimiits => msw.graphql.query('PlatformLimitsFetcherQuery', (req, res, ctx) => res(ctx.data({
185
+ limits: platformLimiits
186
+ })))
187
+ }
188
+ };
189
+
190
+ function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
191
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
192
+ var FetchRoleBasedChannels = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchRoleBasedChannels" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "limit" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Int" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "where" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "channels" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "where" }, value: { kind: "Variable", name: { kind: "Name", value: "where" } } }, { kind: "Argument", name: { kind: "Name", value: "limit" }, value: { kind: "Variable", name: { kind: "Name", value: "limit" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, 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: 210, source: { body: "query FetchRoleBasedChannels($limit: Int!, $where: String!) {\n channels(where: $where, limit: $limit) {\n results {\n id\n key\n nameAllLocales {\n locale\n value\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
193
+ const createFetchStoreDistributionChannelsQueryMock = custom => _objectSpread({
194
+ request: {
195
+ variables: {
196
+ where: `roles contains any ("ProductDistribution")`,
197
+ limit: 500
198
+ },
199
+ query: FetchRoleBasedChannels
200
+ },
201
+ result: {
202
+ data: {
203
+ channels: {
204
+ results: []
205
+ }
206
+ }
207
+ }
208
+ }, custom);
209
+
210
+ exports.createFetchStoreDistributionChannelsQueryMock = createFetchStoreDistributionChannelsQueryMock;
211
+ exports.customFieldDefinitionsMockHanders = handlers$7;
212
+ exports.isFieldDuplicatedMockHandlers = handlers$6;
213
+ exports.platformLimitsMockHandlers = handlers;
214
+ exports.productSelectionsFetcherMockHandler = handlers$5;
215
+ exports.productSelectionsTotalFetcherMockHandler = handlers$4;
216
+ exports.storesListConnectorMockHandlers = handlers$3;
217
+ exports.useStoreByFieldFetcherHandlers = handlers$2;
218
+ exports.useStoresByWherePredicateFetcherHandlers = handlers$1;
219
+ exports.useTotalNumberOfStoresFetcherHandlers = handlers$8;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./commercetools-frontend-experimental-components-test-utils.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./commercetools-frontend-experimental-components-test-utils.cjs.dev.js");
7
+ }
@@ -0,0 +1,219 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var msw = require('msw');
6
+ var _lastIndexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/last-index-of');
7
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
8
+ var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
9
+ var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
10
+ var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
11
+ var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
12
+ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
13
+ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
14
+ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
15
+ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
16
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
17
+
18
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
19
+
20
+ var _lastIndexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_lastIndexOfInstanceProperty);
21
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
22
+ var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
23
+ var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
24
+ var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
25
+ var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
26
+ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
27
+ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
28
+ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
29
+ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
30
+
31
+ const handlers$8 = {
32
+ TotalNumberOfStores: {
33
+ all: total => msw.graphql.query('TotalNumberOfStores', (req, res, ctx) => {
34
+ return res(ctx.data({
35
+ totalNumberOfStores: {
36
+ total
37
+ }
38
+ }));
39
+ })
40
+ }
41
+ };
42
+
43
+ const handlers$7 = {
44
+ TypeDefinitions: {
45
+ all: typeDefinitions => msw.graphql.query('FetchTypeDefinitionsQuery', (req, res, ctx) => res(ctx.data({
46
+ typeDefinitions
47
+ })))
48
+ }
49
+ };
50
+
51
+ const graphqlQueries = {
52
+ ASSOCIATE_ROLE: 'associateRoles',
53
+ ATTRIBUTE_GROUP: 'attributeGroups',
54
+ BUSINESS_UNIT: 'businessUnits',
55
+ CART: 'carts',
56
+ CART_DISCOUNT: 'cartDiscounts',
57
+ CATEGORY: 'categories',
58
+ CHANNEL: 'channels',
59
+ CUSTOMER: 'customers',
60
+ CUSTOMER_GROUP: 'customerGroups',
61
+ DISCOUNT_CODE: 'discountCodes',
62
+ INVENTORY_ENTRY: 'inventoryEntries',
63
+ ORDER: 'orders',
64
+ PAYMENT: 'payments',
65
+ PRODUCT: 'products',
66
+ PRODUCT_DISCOUNT: 'productDiscounts',
67
+ PRODUCT_SELECTION: 'productSelections',
68
+ PRODUCT_TYPE: 'productTypes',
69
+ SHIPPING_METHOD: 'shippingMethods',
70
+ STORE: 'stores',
71
+ TAX_CATEGORY: 'taxCategories',
72
+ ZONE: 'zones'
73
+ };
74
+ const handlers$6 = {
75
+ DuplicatedField: {
76
+ total: (total, resourceType) => msw.graphql.query('FetchResourceTypeDuplicatedField', (req, res, ctx) => {
77
+ if (!graphqlQueries[resourceType]) return res(ctx.data({}));
78
+ return res(ctx.data({
79
+ [graphqlQueries[resourceType]]: {
80
+ total
81
+ }
82
+ }));
83
+ })
84
+ }
85
+ };
86
+
87
+ const handlers$5 = {
88
+ ProductSelections: {
89
+ all: productSelections => msw.graphql.query('FetchProductSelections', (req, res, ctx) => res(ctx.data({
90
+ productSelections
91
+ })))
92
+ }
93
+ };
94
+
95
+ const handlers$4 = {
96
+ ProductSelections: {
97
+ total: total => msw.graphql.query('FetchProductSelectionsTotal', (req, res, ctx) => res(ctx.data({
98
+ productSelections: {
99
+ total,
100
+ __typename: 'ProductSelectionQueryResult'
101
+ }
102
+ })))
103
+ }
104
+ };
105
+
106
+ const extractKeysFromWherePredicateClause = function () {
107
+ let whereClause = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
108
+ return whereClause.substring(_lastIndexOfInstanceProperty__default["default"](whereClause).call(whereClause, '("') + 1, _lastIndexOfInstanceProperty__default["default"](whereClause).call(whereClause, '")')).replace(/["]/g, '').split(', ');
109
+ };
110
+ const handlers$3 = {
111
+ StoresList: {
112
+ all: stores => msw.graphql.query('FetchStoresQuery', (req, res, ctx) => {
113
+ // GIVEN req.variables.where is specified
114
+ // THEN return only stores that are being requested (filtering stores based on IDs)
115
+ // ELSE return all the stores (without filtering any)
116
+ if (req.variables.where) {
117
+ var _context;
118
+ const requestedStoreKeys = extractKeysFromWherePredicateClause(req.variables.where);
119
+ const filteredStoreResults = _filterInstanceProperty__default["default"](_context = stores.results).call(_context, store => _includesInstanceProperty__default["default"](requestedStoreKeys).call(requestedStoreKeys, store.key));
120
+ return res(ctx.data({
121
+ stores: {
122
+ offset: 0,
123
+ total: filteredStoreResults.length,
124
+ count: filteredStoreResults.length,
125
+ results: filteredStoreResults,
126
+ __typename: 'StoresQueryResult'
127
+ }
128
+ }));
129
+ }
130
+ return res(ctx.data({
131
+ stores
132
+ }));
133
+ }),
134
+ withProductSelections: stores => msw.graphql.query('FetchStoresQuery', (req, res, ctx) => {
135
+ // GIVEN req.variables.where is specified
136
+ // THEN return only stores that are being requested (filtering stores based on IDs)
137
+ // ELSE return all the stores (without filtering any)
138
+ if (req.variables.where) {
139
+ var _context2;
140
+ const requestedStoreKeys = extractKeysFromWherePredicateClause(req.variables.where);
141
+ const filteredStoreResults = _filterInstanceProperty__default["default"](_context2 = stores.results).call(_context2, store => _includesInstanceProperty__default["default"](requestedStoreKeys).call(requestedStoreKeys, store.key));
142
+ return res(ctx.data({
143
+ stores: {
144
+ offset: 0,
145
+ total: filteredStoreResults.length,
146
+ count: filteredStoreResults.length,
147
+ results: filteredStoreResults,
148
+ __typename: 'StoresQueryResult'
149
+ }
150
+ }));
151
+ }
152
+ return res(ctx.data({
153
+ stores
154
+ }));
155
+ })
156
+ }
157
+ };
158
+
159
+ const handlers$2 = {
160
+ FetchStoresByField: {
161
+ all: stores => msw.graphql.query('FetchStoresByField', (req, res, ctx) => {
162
+ return res(ctx.data({
163
+ storesByField: stores
164
+ }));
165
+ })
166
+ }
167
+ };
168
+
169
+ const handlers$1 = {
170
+ FetchStoresByWherePredicate: {
171
+ all: stores => msw.graphql.query('FetchStoresByWherePredicate', (req, res, ctx) => {
172
+ return res(ctx.data({
173
+ storesByWherePredicate: {
174
+ results: stores,
175
+ total: stores.length
176
+ }
177
+ }));
178
+ })
179
+ }
180
+ };
181
+
182
+ const handlers = {
183
+ PlatformLimits: {
184
+ all: platformLimiits => msw.graphql.query('PlatformLimitsFetcherQuery', (req, res, ctx) => res(ctx.data({
185
+ limits: platformLimiits
186
+ })))
187
+ }
188
+ };
189
+
190
+ function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
191
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
192
+ var FetchRoleBasedChannels = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchRoleBasedChannels" }, variableDefinitions: [{ kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "limit" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "Int" } } }, directives: [] }, { kind: "VariableDefinition", variable: { kind: "Variable", name: { kind: "Name", value: "where" } }, type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "String" } } }, directives: [] }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "channels" }, arguments: [{ kind: "Argument", name: { kind: "Name", value: "where" }, value: { kind: "Variable", name: { kind: "Name", value: "where" } } }, { kind: "Argument", name: { kind: "Name", value: "limit" }, value: { kind: "Variable", name: { kind: "Name", value: "limit" } } }], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "results" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "key" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, 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: 210, source: { body: "query FetchRoleBasedChannels($limit: Int!, $where: String!) {\n channels(where: $where, limit: $limit) {\n results {\n id\n key\n nameAllLocales {\n locale\n value\n }\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
193
+ const createFetchStoreDistributionChannelsQueryMock = custom => _objectSpread({
194
+ request: {
195
+ variables: {
196
+ where: `roles contains any ("ProductDistribution")`,
197
+ limit: 500
198
+ },
199
+ query: FetchRoleBasedChannels
200
+ },
201
+ result: {
202
+ data: {
203
+ channels: {
204
+ results: []
205
+ }
206
+ }
207
+ }
208
+ }, custom);
209
+
210
+ exports.createFetchStoreDistributionChannelsQueryMock = createFetchStoreDistributionChannelsQueryMock;
211
+ exports.customFieldDefinitionsMockHanders = handlers$7;
212
+ exports.isFieldDuplicatedMockHandlers = handlers$6;
213
+ exports.platformLimitsMockHandlers = handlers;
214
+ exports.productSelectionsFetcherMockHandler = handlers$5;
215
+ exports.productSelectionsTotalFetcherMockHandler = handlers$4;
216
+ exports.storesListConnectorMockHandlers = handlers$3;
217
+ exports.useStoreByFieldFetcherHandlers = handlers$2;
218
+ exports.useStoresByWherePredicateFetcherHandlers = handlers$1;
219
+ exports.useTotalNumberOfStoresFetcherHandlers = handlers$8;