@commercetools-frontend/experimental-components 6.2.1 → 6.2.3

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
@@ -266,6 +266,42 @@
266
266
  border-bottom-left-radius: 0;
267
267
  margin-left: 0;
268
268
  }
269
+ /* imported from file-input.module.css */
270
+
271
+ /** Button */
272
+
273
+ .file-input-module__button___2KypN {
274
+ display: inline-flex;
275
+ background-color: var(--color-surface);
276
+ border: 1px solid var(--color-neutral);
277
+ box-shadow: none;
278
+ border-radius: var(--border-radius-4);
279
+ color: var(--color-solid);
280
+ height: var(--height-for-button-as-big);
281
+ font-size: var(--font-size-20);
282
+ font-weight: var(--font-weight-500);
283
+ align-items: center;
284
+ transition: background-color var(--transition-linear-80ms);
285
+ padding: 0 var(--spacing-m);
286
+ }
287
+
288
+ .file-input-module__button___2KypN:hover,
289
+ .file-input-module__button___2KypN:focus {
290
+ cursor: pointer;
291
+ background-color: var(--background-color-for-button-when-hovered);
292
+ box-shadow: none;
293
+ }
294
+
295
+ .file-input-module__button___2KypN:active {
296
+ box-shadow: var(--shadow-9);
297
+ background-color: var(--color-surface);
298
+ }
299
+
300
+ .file-input-module__input___3MP4D {
301
+ visibility: hidden;
302
+ width: 1px;
303
+ height: 1px;
304
+ }
269
305
  /* imported from button.module.css */
270
306
 
271
307
  /* Generic button */
@@ -469,42 +505,6 @@
469
505
  .button-module__add-button___1f093 {
470
506
  min-height: 32px;
471
507
  }
472
- /* imported from file-input.module.css */
473
-
474
- /** Button */
475
-
476
- .file-input-module__button___2KypN {
477
- display: inline-flex;
478
- background-color: var(--color-surface);
479
- border: 1px solid var(--color-neutral);
480
- box-shadow: none;
481
- border-radius: var(--border-radius-4);
482
- color: var(--color-solid);
483
- height: var(--height-for-button-as-big);
484
- font-size: var(--font-size-20);
485
- font-weight: var(--font-weight-500);
486
- align-items: center;
487
- transition: background-color var(--transition-linear-80ms);
488
- padding: 0 var(--spacing-m);
489
- }
490
-
491
- .file-input-module__button___2KypN:hover,
492
- .file-input-module__button___2KypN:focus {
493
- cursor: pointer;
494
- background-color: var(--background-color-for-button-when-hovered);
495
- box-shadow: none;
496
- }
497
-
498
- .file-input-module__button___2KypN:active {
499
- box-shadow: var(--shadow-9);
500
- background-color: var(--color-surface);
501
- }
502
-
503
- .file-input-module__input___3MP4D {
504
- visibility: hidden;
505
- width: 1px;
506
- height: 1px;
507
- }
508
508
  /* imported from centered-loading-spinner.module.css */
509
509
 
510
510
  .centered-loading-spinner-module__loading-container___3_9-h {
@@ -599,13 +599,13 @@
599
599
  .platform-limits-customer-groups-status-module__status___6099G {
600
600
  min-width: max-content;
601
601
  }
602
- /* imported from platform-limits-customers-status.module.css */
603
-
604
- .platform-limits-customers-status-module__status___3rXYM {
605
- min-width: max-content;
606
- }
607
602
  /* imported from platform-limits-customers-combined.module.css */
608
603
 
609
604
  .platform-limits-customers-combined-module__combined___OszDd {
610
605
  margin-bottom: var(--spacing-s);
611
606
  }
607
+ /* imported from platform-limits-customers-status.module.css */
608
+
609
+ .platform-limits-customers-status-module__status___3rXYM {
610
+ min-width: max-content;
611
+ }
package/package.json CHANGED
@@ -1,31 +1,39 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/experimental-components",
3
- "version": "6.2.1",
3
+ "version": "6.2.3",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/commercetools/merchant-center-frontend.git",
8
8
  "directory": "packages-shared/experimental-components"
9
9
  },
10
+ "sideEffects": false,
10
11
  "main": "dist/commercetools-frontend-experimental-components.cjs.js",
11
12
  "module": "dist/commercetools-frontend-experimental-components.esm.js",
12
13
  "files": [
13
14
  "dist",
14
15
  "package.json",
15
- "README.md"
16
+ "README.md",
17
+ "test-utils"
16
18
  ],
19
+ "preconstruct": {
20
+ "entrypoints": [
21
+ "index.js",
22
+ "test-utils.js"
23
+ ]
24
+ },
17
25
  "dependencies": {
18
26
  "@babel/core": "^7.22.11",
19
27
  "@babel/runtime": "^7.21.0",
20
28
  "@babel/runtime-corejs3": "^7.21.0",
21
- "@commercetools-frontend/actions-global": "npm:@commercetools-frontend/actions-global@^22.32.2",
22
- "@commercetools-frontend/application-components": "npm:@commercetools-frontend/application-components@^22.32.2",
23
- "@commercetools-frontend/application-shell": "npm:@commercetools-frontend/application-shell@^22.32.2",
24
- "@commercetools-frontend/application-shell-connectors": "npm:@commercetools-frontend/application-shell-connectors@^22.32.2",
25
- "@commercetools-frontend/constants": "npm:@commercetools-frontend/constants@^22.32.2",
26
- "@commercetools-frontend/l10n": "npm:@commercetools-frontend/l10n@^22.32.2",
27
- "@commercetools-frontend/sdk": "npm:@commercetools-frontend/sdk@^22.32.2",
28
- "@commercetools-frontend/sentry": "npm:@commercetools-frontend/sentry@^22.32.2",
29
+ "@commercetools-frontend/actions-global": "npm:@commercetools-frontend/actions-global@^22.33.0",
30
+ "@commercetools-frontend/application-components": "npm:@commercetools-frontend/application-components@^22.33.0",
31
+ "@commercetools-frontend/application-shell": "npm:@commercetools-frontend/application-shell@^22.33.0",
32
+ "@commercetools-frontend/application-shell-connectors": "npm:@commercetools-frontend/application-shell-connectors@^22.33.0",
33
+ "@commercetools-frontend/constants": "npm:@commercetools-frontend/constants@^22.33.0",
34
+ "@commercetools-frontend/l10n": "npm:@commercetools-frontend/l10n@^22.33.0",
35
+ "@commercetools-frontend/sdk": "npm:@commercetools-frontend/sdk@^22.33.0",
36
+ "@commercetools-frontend/sentry": "npm:@commercetools-frontend/sentry@^22.33.0",
29
37
  "@commercetools-frontend/ui-kit": "npm:@commercetools-frontend/ui-kit@^19.11.0",
30
38
  "@commercetools-uikit/design-system": "npm:@commercetools-uikit/design-system@^19.11.0",
31
39
  "@commercetools-uikit/select-utils": "npm:@commercetools-uikit/select-utils@^19.11.0",
@@ -53,11 +61,11 @@
53
61
  },
54
62
  "devDependencies": {
55
63
  "@apollo/client": "3.7.10",
56
- "@commercetools-test-data/channel": "10.7.0",
57
- "@commercetools-test-data/commons": "10.7.0",
58
- "@commercetools-test-data/core": "10.7.0",
59
- "@commercetools-test-data/product-selection": "10.7.0",
60
- "@commercetools-test-data/store": "10.7.0",
64
+ "@commercetools-test-data/channel": "10.7.1",
65
+ "@commercetools-test-data/commons": "10.7.1",
66
+ "@commercetools-test-data/core": "10.7.1",
67
+ "@commercetools-test-data/product-selection": "10.7.1",
68
+ "@commercetools-test-data/store": "10.7.1",
61
69
  "@testing-library/react": "12.1.5",
62
70
  "@testing-library/react-hooks": "8.0.1",
63
71
  "formik": "2.4.6",
@@ -0,0 +1,228 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
6
+ var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
7
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
8
+ var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
9
+ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
10
+ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
11
+ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
12
+ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
+ var msw = require('msw');
15
+ var _lastIndexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/last-index-of');
16
+ var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
17
+
18
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
19
+
20
+ var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
21
+ var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
22
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
23
+ var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
24
+ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
25
+ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
26
+ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
27
+ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
28
+ var _lastIndexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_lastIndexOfInstanceProperty);
29
+ var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
30
+
31
+ const handlers$g = {
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
+ var handlers$h = handlers$g;
43
+
44
+ const handlers$e = {
45
+ TypeDefinitions: {
46
+ all: typeDefinitions => msw.graphql.query('FetchTypeDefinitionsQuery', (req, res, ctx) => res(ctx.data({
47
+ typeDefinitions
48
+ })))
49
+ }
50
+ };
51
+ var handlers$f = handlers$e;
52
+
53
+ const graphqlQueries = {
54
+ ASSOCIATE_ROLE: 'associateRoles',
55
+ ATTRIBUTE_GROUP: 'attributeGroups',
56
+ BUSINESS_UNIT: 'businessUnits',
57
+ CART: 'carts',
58
+ CART_DISCOUNT: 'cartDiscounts',
59
+ CATEGORY: 'categories',
60
+ CHANNEL: 'channels',
61
+ CUSTOMER: 'customers',
62
+ CUSTOMER_GROUP: 'customerGroups',
63
+ DISCOUNT_CODE: 'discountCodes',
64
+ INVENTORY_ENTRY: 'inventoryEntries',
65
+ ORDER: 'orders',
66
+ PAYMENT: 'payments',
67
+ PRODUCT: 'products',
68
+ PRODUCT_DISCOUNT: 'productDiscounts',
69
+ PRODUCT_SELECTION: 'productSelections',
70
+ PRODUCT_TYPE: 'productTypes',
71
+ SHIPPING_METHOD: 'shippingMethods',
72
+ STORE: 'stores',
73
+ TAX_CATEGORY: 'taxCategories',
74
+ ZONE: 'zones'
75
+ };
76
+ const handlers$c = {
77
+ DuplicatedField: {
78
+ total: (total, resourceType) => msw.graphql.query('FetchResourceTypeDuplicatedField', (req, res, ctx) => {
79
+ if (!graphqlQueries[resourceType]) return res(ctx.data({}));
80
+ return res(ctx.data({
81
+ [graphqlQueries[resourceType]]: {
82
+ total
83
+ }
84
+ }));
85
+ })
86
+ }
87
+ };
88
+ var handlers$d = handlers$c;
89
+
90
+ const handlers$a = {
91
+ ProductSelections: {
92
+ all: productSelections => msw.graphql.query('FetchProductSelections', (req, res, ctx) => res(ctx.data({
93
+ productSelections
94
+ })))
95
+ }
96
+ };
97
+ var handlers$b = handlers$a;
98
+
99
+ const handlers$8 = {
100
+ ProductSelections: {
101
+ total: total => msw.graphql.query('FetchProductSelectionsTotal', (req, res, ctx) => res(ctx.data({
102
+ productSelections: {
103
+ total,
104
+ __typename: 'ProductSelectionQueryResult'
105
+ }
106
+ })))
107
+ }
108
+ };
109
+ var handlers$9 = handlers$8;
110
+
111
+ const extractKeysFromWherePredicateClause = function () {
112
+ let whereClause = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
113
+ return whereClause.substring(_lastIndexOfInstanceProperty__default["default"](whereClause).call(whereClause, '("') + 1, _lastIndexOfInstanceProperty__default["default"](whereClause).call(whereClause, '")')).replace(/["]/g, '').split(', ');
114
+ };
115
+ const handlers$6 = {
116
+ StoresList: {
117
+ all: stores => msw.graphql.query('FetchStoresQuery', (req, res, ctx) => {
118
+ // GIVEN req.variables.where is specified
119
+ // THEN return only stores that are being requested (filtering stores based on IDs)
120
+ // ELSE return all the stores (without filtering any)
121
+ if (req.variables.where) {
122
+ var _context;
123
+ const requestedStoreKeys = extractKeysFromWherePredicateClause(req.variables.where);
124
+ const filteredStoreResults = _filterInstanceProperty__default["default"](_context = stores.results).call(_context, store => _includesInstanceProperty__default["default"](requestedStoreKeys).call(requestedStoreKeys, store.key));
125
+ return res(ctx.data({
126
+ stores: {
127
+ offset: 0,
128
+ total: filteredStoreResults.length,
129
+ count: filteredStoreResults.length,
130
+ results: filteredStoreResults,
131
+ __typename: 'StoresQueryResult'
132
+ }
133
+ }));
134
+ }
135
+ return res(ctx.data({
136
+ stores
137
+ }));
138
+ }),
139
+ withProductSelections: stores => msw.graphql.query('FetchStoresQuery', (req, res, ctx) => {
140
+ // GIVEN req.variables.where is specified
141
+ // THEN return only stores that are being requested (filtering stores based on IDs)
142
+ // ELSE return all the stores (without filtering any)
143
+ if (req.variables.where) {
144
+ var _context2;
145
+ const requestedStoreKeys = extractKeysFromWherePredicateClause(req.variables.where);
146
+ const filteredStoreResults = _filterInstanceProperty__default["default"](_context2 = stores.results).call(_context2, store => _includesInstanceProperty__default["default"](requestedStoreKeys).call(requestedStoreKeys, store.key));
147
+ return res(ctx.data({
148
+ stores: {
149
+ offset: 0,
150
+ total: filteredStoreResults.length,
151
+ count: filteredStoreResults.length,
152
+ results: filteredStoreResults,
153
+ __typename: 'StoresQueryResult'
154
+ }
155
+ }));
156
+ }
157
+ return res(ctx.data({
158
+ stores
159
+ }));
160
+ })
161
+ }
162
+ };
163
+ var handlers$7 = handlers$6;
164
+
165
+ const handlers$4 = {
166
+ FetchStoresByField: {
167
+ all: stores => msw.graphql.query('FetchStoresByField', (req, res, ctx) => {
168
+ return res(ctx.data({
169
+ storesByField: stores
170
+ }));
171
+ })
172
+ }
173
+ };
174
+ var handlers$5 = handlers$4;
175
+
176
+ const handlers$2 = {
177
+ FetchStoresByWherePredicate: {
178
+ all: stores => msw.graphql.query('FetchStoresByWherePredicate', (req, res, ctx) => {
179
+ return res(ctx.data({
180
+ storesByWherePredicate: {
181
+ results: stores,
182
+ total: stores.length
183
+ }
184
+ }));
185
+ })
186
+ }
187
+ };
188
+ var handlers$3 = handlers$2;
189
+
190
+ const handlers = {
191
+ PlatformLimits: {
192
+ all: platformLimiits => msw.graphql.query('PlatformLimitsFetcherQuery', (req, res, ctx) => res(ctx.data({
193
+ limits: platformLimiits
194
+ })))
195
+ }
196
+ };
197
+ var handlers$1 = handlers;
198
+
199
+ 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; }
200
+ 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; }
201
+ 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 } } } };
202
+ const createFetchStoreDistributionChannelsQueryMock = custom => _objectSpread({
203
+ request: {
204
+ variables: {
205
+ where: `roles contains any ("ProductDistribution")`,
206
+ limit: 500
207
+ },
208
+ query: FetchRoleBasedChannels
209
+ },
210
+ result: {
211
+ data: {
212
+ channels: {
213
+ results: []
214
+ }
215
+ }
216
+ }
217
+ }, custom);
218
+
219
+ exports.createFetchStoreDistributionChannelsQueryMock = createFetchStoreDistributionChannelsQueryMock;
220
+ exports.customFieldDefinitionsMockHanders = handlers$f;
221
+ exports.isFieldDuplicatedMockHandlers = handlers$d;
222
+ exports.platformLimitsMockHandlers = handlers$1;
223
+ exports.productSelectionsFetcherMockHandler = handlers$b;
224
+ exports.productSelectionsTotalFetcherMockHandler = handlers$9;
225
+ exports.storesListConnectorMockHandlers = handlers$7;
226
+ exports.useStoreByFieldFetcherHandlers = handlers$5;
227
+ exports.useStoresByWherePredicateFetcherHandlers = handlers$3;
228
+ exports.useTotalNumberOfStoresFetcherHandlers = handlers$h;
@@ -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,228 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
6
+ var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
7
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
8
+ var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
9
+ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
10
+ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
11
+ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
12
+ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
+ var msw = require('msw');
15
+ var _lastIndexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/last-index-of');
16
+ var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
17
+
18
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
19
+
20
+ var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
21
+ var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
22
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
23
+ var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
24
+ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
25
+ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
26
+ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
27
+ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
28
+ var _lastIndexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_lastIndexOfInstanceProperty);
29
+ var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
30
+
31
+ const handlers$g = {
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
+ var handlers$h = handlers$g;
43
+
44
+ const handlers$e = {
45
+ TypeDefinitions: {
46
+ all: typeDefinitions => msw.graphql.query('FetchTypeDefinitionsQuery', (req, res, ctx) => res(ctx.data({
47
+ typeDefinitions
48
+ })))
49
+ }
50
+ };
51
+ var handlers$f = handlers$e;
52
+
53
+ const graphqlQueries = {
54
+ ASSOCIATE_ROLE: 'associateRoles',
55
+ ATTRIBUTE_GROUP: 'attributeGroups',
56
+ BUSINESS_UNIT: 'businessUnits',
57
+ CART: 'carts',
58
+ CART_DISCOUNT: 'cartDiscounts',
59
+ CATEGORY: 'categories',
60
+ CHANNEL: 'channels',
61
+ CUSTOMER: 'customers',
62
+ CUSTOMER_GROUP: 'customerGroups',
63
+ DISCOUNT_CODE: 'discountCodes',
64
+ INVENTORY_ENTRY: 'inventoryEntries',
65
+ ORDER: 'orders',
66
+ PAYMENT: 'payments',
67
+ PRODUCT: 'products',
68
+ PRODUCT_DISCOUNT: 'productDiscounts',
69
+ PRODUCT_SELECTION: 'productSelections',
70
+ PRODUCT_TYPE: 'productTypes',
71
+ SHIPPING_METHOD: 'shippingMethods',
72
+ STORE: 'stores',
73
+ TAX_CATEGORY: 'taxCategories',
74
+ ZONE: 'zones'
75
+ };
76
+ const handlers$c = {
77
+ DuplicatedField: {
78
+ total: (total, resourceType) => msw.graphql.query('FetchResourceTypeDuplicatedField', (req, res, ctx) => {
79
+ if (!graphqlQueries[resourceType]) return res(ctx.data({}));
80
+ return res(ctx.data({
81
+ [graphqlQueries[resourceType]]: {
82
+ total
83
+ }
84
+ }));
85
+ })
86
+ }
87
+ };
88
+ var handlers$d = handlers$c;
89
+
90
+ const handlers$a = {
91
+ ProductSelections: {
92
+ all: productSelections => msw.graphql.query('FetchProductSelections', (req, res, ctx) => res(ctx.data({
93
+ productSelections
94
+ })))
95
+ }
96
+ };
97
+ var handlers$b = handlers$a;
98
+
99
+ const handlers$8 = {
100
+ ProductSelections: {
101
+ total: total => msw.graphql.query('FetchProductSelectionsTotal', (req, res, ctx) => res(ctx.data({
102
+ productSelections: {
103
+ total,
104
+ __typename: 'ProductSelectionQueryResult'
105
+ }
106
+ })))
107
+ }
108
+ };
109
+ var handlers$9 = handlers$8;
110
+
111
+ const extractKeysFromWherePredicateClause = function () {
112
+ let whereClause = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
113
+ return whereClause.substring(_lastIndexOfInstanceProperty__default["default"](whereClause).call(whereClause, '("') + 1, _lastIndexOfInstanceProperty__default["default"](whereClause).call(whereClause, '")')).replace(/["]/g, '').split(', ');
114
+ };
115
+ const handlers$6 = {
116
+ StoresList: {
117
+ all: stores => msw.graphql.query('FetchStoresQuery', (req, res, ctx) => {
118
+ // GIVEN req.variables.where is specified
119
+ // THEN return only stores that are being requested (filtering stores based on IDs)
120
+ // ELSE return all the stores (without filtering any)
121
+ if (req.variables.where) {
122
+ var _context;
123
+ const requestedStoreKeys = extractKeysFromWherePredicateClause(req.variables.where);
124
+ const filteredStoreResults = _filterInstanceProperty__default["default"](_context = stores.results).call(_context, store => _includesInstanceProperty__default["default"](requestedStoreKeys).call(requestedStoreKeys, store.key));
125
+ return res(ctx.data({
126
+ stores: {
127
+ offset: 0,
128
+ total: filteredStoreResults.length,
129
+ count: filteredStoreResults.length,
130
+ results: filteredStoreResults,
131
+ __typename: 'StoresQueryResult'
132
+ }
133
+ }));
134
+ }
135
+ return res(ctx.data({
136
+ stores
137
+ }));
138
+ }),
139
+ withProductSelections: stores => msw.graphql.query('FetchStoresQuery', (req, res, ctx) => {
140
+ // GIVEN req.variables.where is specified
141
+ // THEN return only stores that are being requested (filtering stores based on IDs)
142
+ // ELSE return all the stores (without filtering any)
143
+ if (req.variables.where) {
144
+ var _context2;
145
+ const requestedStoreKeys = extractKeysFromWherePredicateClause(req.variables.where);
146
+ const filteredStoreResults = _filterInstanceProperty__default["default"](_context2 = stores.results).call(_context2, store => _includesInstanceProperty__default["default"](requestedStoreKeys).call(requestedStoreKeys, store.key));
147
+ return res(ctx.data({
148
+ stores: {
149
+ offset: 0,
150
+ total: filteredStoreResults.length,
151
+ count: filteredStoreResults.length,
152
+ results: filteredStoreResults,
153
+ __typename: 'StoresQueryResult'
154
+ }
155
+ }));
156
+ }
157
+ return res(ctx.data({
158
+ stores
159
+ }));
160
+ })
161
+ }
162
+ };
163
+ var handlers$7 = handlers$6;
164
+
165
+ const handlers$4 = {
166
+ FetchStoresByField: {
167
+ all: stores => msw.graphql.query('FetchStoresByField', (req, res, ctx) => {
168
+ return res(ctx.data({
169
+ storesByField: stores
170
+ }));
171
+ })
172
+ }
173
+ };
174
+ var handlers$5 = handlers$4;
175
+
176
+ const handlers$2 = {
177
+ FetchStoresByWherePredicate: {
178
+ all: stores => msw.graphql.query('FetchStoresByWherePredicate', (req, res, ctx) => {
179
+ return res(ctx.data({
180
+ storesByWherePredicate: {
181
+ results: stores,
182
+ total: stores.length
183
+ }
184
+ }));
185
+ })
186
+ }
187
+ };
188
+ var handlers$3 = handlers$2;
189
+
190
+ const handlers = {
191
+ PlatformLimits: {
192
+ all: platformLimiits => msw.graphql.query('PlatformLimitsFetcherQuery', (req, res, ctx) => res(ctx.data({
193
+ limits: platformLimiits
194
+ })))
195
+ }
196
+ };
197
+ var handlers$1 = handlers;
198
+
199
+ 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; }
200
+ 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; }
201
+ 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 } } } };
202
+ const createFetchStoreDistributionChannelsQueryMock = custom => _objectSpread({
203
+ request: {
204
+ variables: {
205
+ where: `roles contains any ("ProductDistribution")`,
206
+ limit: 500
207
+ },
208
+ query: FetchRoleBasedChannels
209
+ },
210
+ result: {
211
+ data: {
212
+ channels: {
213
+ results: []
214
+ }
215
+ }
216
+ }
217
+ }, custom);
218
+
219
+ exports.createFetchStoreDistributionChannelsQueryMock = createFetchStoreDistributionChannelsQueryMock;
220
+ exports.customFieldDefinitionsMockHanders = handlers$f;
221
+ exports.isFieldDuplicatedMockHandlers = handlers$d;
222
+ exports.platformLimitsMockHandlers = handlers$1;
223
+ exports.productSelectionsFetcherMockHandler = handlers$b;
224
+ exports.productSelectionsTotalFetcherMockHandler = handlers$9;
225
+ exports.storesListConnectorMockHandlers = handlers$7;
226
+ exports.useStoreByFieldFetcherHandlers = handlers$5;
227
+ exports.useStoresByWherePredicateFetcherHandlers = handlers$3;
228
+ exports.useTotalNumberOfStoresFetcherHandlers = handlers$h;