@deenruv/reviews-plugin 1.0.0

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 (88) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +58 -0
  3. package/dist/plugin-server/api/admin-api.resolver.d.ts +67 -0
  4. package/dist/plugin-server/api/admin-api.resolver.js +127 -0
  5. package/dist/plugin-server/api/review-asset.resolver.d.ts +11 -0
  6. package/dist/plugin-server/api/review-asset.resolver.js +37 -0
  7. package/dist/plugin-server/api/review-customer.resolver.d.ts +15 -0
  8. package/dist/plugin-server/api/review-customer.resolver.js +52 -0
  9. package/dist/plugin-server/api/review-order.resolver.d.ts +8 -0
  10. package/dist/plugin-server/api/review-order.resolver.js +47 -0
  11. package/dist/plugin-server/api/review-product.resolver.d.ts +15 -0
  12. package/dist/plugin-server/api/review-product.resolver.js +50 -0
  13. package/dist/plugin-server/api/shop-api.resolver.d.ts +28 -0
  14. package/dist/plugin-server/api/shop-api.resolver.js +57 -0
  15. package/dist/plugin-server/constants.d.ts +6 -0
  16. package/dist/plugin-server/constants.js +7 -0
  17. package/dist/plugin-server/entities/review-translation.entity.d.ts +9 -0
  18. package/dist/plugin-server/entities/review-translation.entity.js +37 -0
  19. package/dist/plugin-server/entities/review.entity.d.ts +24 -0
  20. package/dist/plugin-server/entities/review.entity.js +89 -0
  21. package/dist/plugin-server/events.d.ts +10 -0
  22. package/dist/plugin-server/events.js +11 -0
  23. package/dist/plugin-server/extensions/admin-api.extension.d.ts +2 -0
  24. package/dist/plugin-server/extensions/admin-api.extension.js +70 -0
  25. package/dist/plugin-server/extensions/shared.extension.d.ts +2 -0
  26. package/dist/plugin-server/extensions/shared.extension.js +87 -0
  27. package/dist/plugin-server/extensions/shop-api.extension.d.ts +2 -0
  28. package/dist/plugin-server/extensions/shop-api.extension.js +60 -0
  29. package/dist/plugin-server/index.d.ts +15 -0
  30. package/dist/plugin-server/index.js +86 -0
  31. package/dist/plugin-server/services/reviews.service.d.ts +85 -0
  32. package/dist/plugin-server/services/reviews.service.js +366 -0
  33. package/dist/plugin-server/state/reviews.state.d.ts +16 -0
  34. package/dist/plugin-server/state/reviews.state.js +63 -0
  35. package/dist/plugin-server/types.d.ts +33 -0
  36. package/dist/plugin-server/types.js +1 -0
  37. package/dist/plugin-server/zeus/const.d.ts +6 -0
  38. package/dist/plugin-server/zeus/const.js +4027 -0
  39. package/dist/plugin-server/zeus/index.d.ts +20410 -0
  40. package/dist/plugin-server/zeus/index.js +443 -0
  41. package/dist/plugin-ui/components/OrderInfo.d.ts +5 -0
  42. package/dist/plugin-ui/components/OrderInfo.js +42 -0
  43. package/dist/plugin-ui/components/ProductInfo.d.ts +5 -0
  44. package/dist/plugin-ui/components/ProductInfo.js +36 -0
  45. package/dist/plugin-ui/components/ReviewCustomer.d.ts +2 -0
  46. package/dist/plugin-ui/components/ReviewCustomer.js +166 -0
  47. package/dist/plugin-ui/components/ReviewOrder.d.ts +2 -0
  48. package/dist/plugin-ui/components/ReviewOrder.js +57 -0
  49. package/dist/plugin-ui/components/ReviewProductSidebar.d.ts +2 -0
  50. package/dist/plugin-ui/components/ReviewProductSidebar.js +29 -0
  51. package/dist/plugin-ui/components/ReviewStateChange.d.ts +5 -0
  52. package/dist/plugin-ui/components/ReviewStateChange.js +35 -0
  53. package/dist/plugin-ui/components/UniversalSelectDialog.d.ts +16 -0
  54. package/dist/plugin-ui/components/UniversalSelectDialog.js +35 -0
  55. package/dist/plugin-ui/components/index.d.ts +2 -0
  56. package/dist/plugin-ui/components/index.js +2 -0
  57. package/dist/plugin-ui/constants.d.ts +1 -0
  58. package/dist/plugin-ui/constants.js +1 -0
  59. package/dist/plugin-ui/graphql/index.d.ts +3 -0
  60. package/dist/plugin-ui/graphql/index.js +3 -0
  61. package/dist/plugin-ui/graphql/mutations.d.ts +35 -0
  62. package/dist/plugin-ui/graphql/mutations.js +28 -0
  63. package/dist/plugin-ui/graphql/queries.d.ts +293 -0
  64. package/dist/plugin-ui/graphql/queries.js +34 -0
  65. package/dist/plugin-ui/graphql/scalars.d.ts +16 -0
  66. package/dist/plugin-ui/graphql/scalars.js +14 -0
  67. package/dist/plugin-ui/graphql/selectors.d.ts +58 -0
  68. package/dist/plugin-ui/graphql/selectors.js +39 -0
  69. package/dist/plugin-ui/index.d.ts +7 -0
  70. package/dist/plugin-ui/index.js +69 -0
  71. package/dist/plugin-ui/locales/en/index.d.ts +108 -0
  72. package/dist/plugin-ui/locales/en/index.js +2 -0
  73. package/dist/plugin-ui/locales/en/reviews.json +107 -0
  74. package/dist/plugin-ui/locales/pl/index.d.ts +108 -0
  75. package/dist/plugin-ui/locales/pl/index.js +2 -0
  76. package/dist/plugin-ui/locales/pl/reviews.json +107 -0
  77. package/dist/plugin-ui/pages/Review.d.ts +2 -0
  78. package/dist/plugin-ui/pages/Review.js +263 -0
  79. package/dist/plugin-ui/pages/Reviews.d.ts +2 -0
  80. package/dist/plugin-ui/pages/Reviews.js +174 -0
  81. package/dist/plugin-ui/tsconfig.json +18 -0
  82. package/dist/plugin-ui/zeus/const.d.ts +6 -0
  83. package/dist/plugin-ui/zeus/const.js +4027 -0
  84. package/dist/plugin-ui/zeus/index.d.ts +20410 -0
  85. package/dist/plugin-ui/zeus/index.js +459 -0
  86. package/dist/plugin-ui/zeus/typedDocumentNode.d.ts +3 -0
  87. package/dist/plugin-ui/zeus/typedDocumentNode.js +9 -0
  88. package/package.json +61 -0
@@ -0,0 +1,443 @@
1
+ /* eslint-disable */
2
+ import { AllTypesProps, ReturnTypes, Ops } from './const.js';
3
+ export const HOST = "http://localhost:3000/admin-api";
4
+ export const HEADERS = {};
5
+ export const apiSubscription = (options) => (query) => {
6
+ var _a, _b, _c;
7
+ try {
8
+ const queryString = options[0] + '?query=' + encodeURIComponent(query);
9
+ const wsString = queryString.replace('http', 'ws');
10
+ const host = (options.length > 1 && ((_b = (_a = options[1]) === null || _a === void 0 ? void 0 : _a.websocket) === null || _b === void 0 ? void 0 : _b[0])) || wsString;
11
+ const webSocketOptions = ((_c = options[1]) === null || _c === void 0 ? void 0 : _c.websocket) || [host];
12
+ const ws = new WebSocket(...webSocketOptions);
13
+ return {
14
+ ws,
15
+ on: (e) => {
16
+ ws.onmessage = (event) => {
17
+ if (event.data) {
18
+ const parsed = JSON.parse(event.data);
19
+ const data = parsed.data;
20
+ return e(data);
21
+ }
22
+ };
23
+ },
24
+ off: (e) => {
25
+ ws.onclose = e;
26
+ },
27
+ error: (e) => {
28
+ ws.onerror = e;
29
+ },
30
+ open: (e) => {
31
+ ws.onopen = e;
32
+ },
33
+ };
34
+ }
35
+ catch (_d) {
36
+ throw new Error('No websockets implemented');
37
+ }
38
+ };
39
+ const handleFetchResponse = (response) => {
40
+ if (!response.ok) {
41
+ return new Promise((_, reject) => {
42
+ response
43
+ .text()
44
+ .then((text) => {
45
+ try {
46
+ reject(JSON.parse(text));
47
+ }
48
+ catch (err) {
49
+ reject(text);
50
+ }
51
+ })
52
+ .catch(reject);
53
+ });
54
+ }
55
+ return response.json();
56
+ };
57
+ export const apiFetch = (options) => (query, variables = {}) => {
58
+ const fetchOptions = options[1] || {};
59
+ if (fetchOptions.method && fetchOptions.method === 'GET') {
60
+ return fetch(`${options[0]}?query=${encodeURIComponent(query)}`, fetchOptions)
61
+ .then(handleFetchResponse)
62
+ .then((response) => {
63
+ if (response.errors) {
64
+ throw new GraphQLError(response);
65
+ }
66
+ return response.data;
67
+ });
68
+ }
69
+ return fetch(`${options[0]}`, Object.assign({ body: JSON.stringify({ query, variables }), method: 'POST', headers: {
70
+ 'Content-Type': 'application/json',
71
+ } }, fetchOptions))
72
+ .then(handleFetchResponse)
73
+ .then((response) => {
74
+ if (response.errors) {
75
+ throw new GraphQLError(response);
76
+ }
77
+ return response.data;
78
+ });
79
+ };
80
+ export const InternalsBuildQuery = ({ ops, props, returns, options, scalars, }) => {
81
+ const ibb = (k, o, p = '', root = true, vars = []) => {
82
+ var _a;
83
+ const keyForPath = purifyGraphQLKey(k);
84
+ const newPath = [p, keyForPath].join(SEPARATOR);
85
+ if (!o) {
86
+ return '';
87
+ }
88
+ if (typeof o === 'boolean' || typeof o === 'number') {
89
+ return k;
90
+ }
91
+ if (typeof o === 'string') {
92
+ return `${k} ${o}`;
93
+ }
94
+ if (Array.isArray(o)) {
95
+ const args = InternalArgsBuilt({
96
+ props,
97
+ returns,
98
+ ops,
99
+ scalars,
100
+ vars,
101
+ })(o[0], newPath);
102
+ return `${ibb(args ? `${k}(${args})` : k, o[1], p, false, vars)}`;
103
+ }
104
+ if (k === '__alias') {
105
+ return Object.entries(o)
106
+ .map(([alias, objectUnderAlias]) => {
107
+ if (typeof objectUnderAlias !== 'object' || Array.isArray(objectUnderAlias)) {
108
+ throw new Error('Invalid alias it should be __alias:{ YOUR_ALIAS_NAME: { OPERATION_NAME: { ...selectors }}}');
109
+ }
110
+ const operationName = Object.keys(objectUnderAlias)[0];
111
+ const operation = objectUnderAlias[operationName];
112
+ return ibb(`${alias}:${operationName}`, operation, p, false, vars);
113
+ })
114
+ .join('\n');
115
+ }
116
+ const hasOperationName = root && (options === null || options === void 0 ? void 0 : options.operationName) ? ' ' + options.operationName : '';
117
+ const keyForDirectives = (_a = o.__directives) !== null && _a !== void 0 ? _a : '';
118
+ const query = `{${Object.entries(o)
119
+ .filter(([k]) => k !== '__directives')
120
+ .map((e) => ibb(...e, [p, `field<>${keyForPath}`].join(SEPARATOR), false, vars))
121
+ .join('\n')}}`;
122
+ if (!root) {
123
+ return `${k} ${keyForDirectives}${hasOperationName} ${query}`;
124
+ }
125
+ const varsString = vars.map((v) => `${v.name}: ${v.graphQLType}`).join(', ');
126
+ return `${k} ${keyForDirectives}${hasOperationName}${varsString ? `(${varsString})` : ''} ${query}`;
127
+ };
128
+ return ibb;
129
+ };
130
+ export const Thunder = (fn, thunderGraphQLOptions) => (operation, graphqlOptions) => (o, ops) => {
131
+ const options = Object.assign(Object.assign({}, thunderGraphQLOptions), graphqlOptions);
132
+ return fn(Zeus(operation, o, {
133
+ operationOptions: ops,
134
+ scalars: options === null || options === void 0 ? void 0 : options.scalars,
135
+ }), ops === null || ops === void 0 ? void 0 : ops.variables).then((data) => {
136
+ if (options === null || options === void 0 ? void 0 : options.scalars) {
137
+ return decodeScalarsInResponse({
138
+ response: data,
139
+ initialOp: operation,
140
+ initialZeusQuery: o,
141
+ returns: ReturnTypes,
142
+ scalars: options.scalars,
143
+ ops: Ops,
144
+ });
145
+ }
146
+ return data;
147
+ });
148
+ };
149
+ export const Chain = (...options) => Thunder(apiFetch(options));
150
+ export const SubscriptionThunder = (fn, thunderGraphQLOptions) => (operation, graphqlOptions) => (o, ops) => {
151
+ const options = Object.assign(Object.assign({}, thunderGraphQLOptions), graphqlOptions);
152
+ const returnedFunction = fn(Zeus(operation, o, {
153
+ operationOptions: ops,
154
+ scalars: options === null || options === void 0 ? void 0 : options.scalars,
155
+ }));
156
+ if ((returnedFunction === null || returnedFunction === void 0 ? void 0 : returnedFunction.on) && (options === null || options === void 0 ? void 0 : options.scalars)) {
157
+ const wrapped = returnedFunction.on;
158
+ returnedFunction.on = (fnToCall) => wrapped((data) => {
159
+ if (options === null || options === void 0 ? void 0 : options.scalars) {
160
+ return fnToCall(decodeScalarsInResponse({
161
+ response: data,
162
+ initialOp: operation,
163
+ initialZeusQuery: o,
164
+ returns: ReturnTypes,
165
+ scalars: options.scalars,
166
+ ops: Ops,
167
+ }));
168
+ }
169
+ return fnToCall(data);
170
+ });
171
+ }
172
+ return returnedFunction;
173
+ };
174
+ export const Subscription = (...options) => SubscriptionThunder(apiSubscription(options));
175
+ export const Zeus = (operation, o, ops) => InternalsBuildQuery({
176
+ props: AllTypesProps,
177
+ returns: ReturnTypes,
178
+ ops: Ops,
179
+ options: ops === null || ops === void 0 ? void 0 : ops.operationOptions,
180
+ scalars: ops === null || ops === void 0 ? void 0 : ops.scalars,
181
+ })(operation, o);
182
+ export const ZeusSelect = () => ((t) => t);
183
+ export const Selector = (key) => key && ZeusSelect();
184
+ export const TypeFromSelector = (key) => key && ZeusSelect();
185
+ export const Gql = Chain(HOST, {
186
+ headers: Object.assign({ 'Content-Type': 'application/json' }, HEADERS),
187
+ });
188
+ export const ZeusScalars = ZeusSelect();
189
+ export const decodeScalarsInResponse = ({ response, scalars, returns, ops, initialZeusQuery, initialOp, }) => {
190
+ if (!scalars) {
191
+ return response;
192
+ }
193
+ const builder = PrepareScalarPaths({
194
+ ops,
195
+ returns,
196
+ });
197
+ const scalarPaths = builder(initialOp, ops[initialOp], initialZeusQuery);
198
+ if (scalarPaths) {
199
+ const r = traverseResponse({ scalarPaths, resolvers: scalars })(initialOp, response, [ops[initialOp]]);
200
+ return r;
201
+ }
202
+ return response;
203
+ };
204
+ export const traverseResponse = ({ resolvers, scalarPaths, }) => {
205
+ const ibb = (k, o, p = []) => {
206
+ var _a;
207
+ if (Array.isArray(o)) {
208
+ return o.map((eachO) => ibb(k, eachO, p));
209
+ }
210
+ if (o == null) {
211
+ return o;
212
+ }
213
+ const scalarPathString = p.join(SEPARATOR);
214
+ const currentScalarString = scalarPaths[scalarPathString];
215
+ if (currentScalarString) {
216
+ const currentDecoder = (_a = resolvers[currentScalarString.split('.')[1]]) === null || _a === void 0 ? void 0 : _a.decode;
217
+ if (currentDecoder) {
218
+ return currentDecoder(o);
219
+ }
220
+ }
221
+ if (typeof o === 'boolean' || typeof o === 'number' || typeof o === 'string' || !o) {
222
+ return o;
223
+ }
224
+ const entries = Object.entries(o).map(([k, v]) => [k, ibb(k, v, [...p, purifyGraphQLKey(k)])]);
225
+ const objectFromEntries = entries.reduce((a, [k, v]) => {
226
+ a[k] = v;
227
+ return a;
228
+ }, {});
229
+ return objectFromEntries;
230
+ };
231
+ return ibb;
232
+ };
233
+ export const SEPARATOR = '|';
234
+ export class GraphQLError extends Error {
235
+ constructor(response) {
236
+ super('');
237
+ this.response = response;
238
+ console.error(response);
239
+ }
240
+ toString() {
241
+ return 'GraphQL Response Error';
242
+ }
243
+ }
244
+ const ExtractScalar = (mappedParts, returns) => {
245
+ if (mappedParts.length === 0) {
246
+ return;
247
+ }
248
+ const oKey = mappedParts[0];
249
+ const returnP1 = returns[oKey];
250
+ if (typeof returnP1 === 'object') {
251
+ const returnP2 = returnP1[mappedParts[1]];
252
+ if (returnP2) {
253
+ return ExtractScalar([returnP2, ...mappedParts.slice(2)], returns);
254
+ }
255
+ return undefined;
256
+ }
257
+ return returnP1;
258
+ };
259
+ export const PrepareScalarPaths = ({ ops, returns }) => {
260
+ const ibb = (k, originalKey, o, p = [], pOriginals = [], root = true) => {
261
+ if (!o) {
262
+ return;
263
+ }
264
+ if (typeof o === 'boolean' || typeof o === 'number' || typeof o === 'string') {
265
+ const extractionArray = [...pOriginals, originalKey];
266
+ const isScalar = ExtractScalar(extractionArray, returns);
267
+ if (isScalar === null || isScalar === void 0 ? void 0 : isScalar.startsWith('scalar')) {
268
+ const partOfTree = {
269
+ [[...p, k].join(SEPARATOR)]: isScalar,
270
+ };
271
+ return partOfTree;
272
+ }
273
+ return {};
274
+ }
275
+ if (Array.isArray(o)) {
276
+ return ibb(k, k, o[1], p, pOriginals, false);
277
+ }
278
+ if (k === '__alias') {
279
+ return Object.entries(o)
280
+ .map(([alias, objectUnderAlias]) => {
281
+ if (typeof objectUnderAlias !== 'object' || Array.isArray(objectUnderAlias)) {
282
+ throw new Error('Invalid alias it should be __alias:{ YOUR_ALIAS_NAME: { OPERATION_NAME: { ...selectors }}}');
283
+ }
284
+ const operationName = Object.keys(objectUnderAlias)[0];
285
+ const operation = objectUnderAlias[operationName];
286
+ return ibb(alias, operationName, operation, p, pOriginals, false);
287
+ })
288
+ .reduce((a, b) => (Object.assign(Object.assign({}, a), b)));
289
+ }
290
+ const keyName = root ? ops[k] : k;
291
+ return Object.entries(o)
292
+ .filter(([k]) => k !== '__directives')
293
+ .map(([k, v]) => {
294
+ // Inline fragments shouldn't be added to the path as they aren't a field
295
+ const isInlineFragment = originalKey.match(/^...\s*on/) != null;
296
+ return ibb(k, k, v, isInlineFragment ? p : [...p, purifyGraphQLKey(keyName || k)], isInlineFragment ? pOriginals : [...pOriginals, purifyGraphQLKey(originalKey)], false);
297
+ })
298
+ .reduce((a, b) => (Object.assign(Object.assign({}, a), b)));
299
+ };
300
+ return ibb;
301
+ };
302
+ export const purifyGraphQLKey = (k) => k.replace(/\([^)]*\)/g, '').replace(/^[^:]*\:/g, '');
303
+ const mapPart = (p) => {
304
+ const [isArg, isField] = p.split('<>');
305
+ if (isField) {
306
+ return {
307
+ v: isField,
308
+ __type: 'field',
309
+ };
310
+ }
311
+ return {
312
+ v: isArg,
313
+ __type: 'arg',
314
+ };
315
+ };
316
+ export const ResolveFromPath = (props, returns, ops) => {
317
+ const ResolvePropsType = (mappedParts) => {
318
+ const oKey = ops[mappedParts[0].v];
319
+ const propsP1 = oKey ? props[oKey] : props[mappedParts[0].v];
320
+ if (propsP1 === 'enum' && mappedParts.length === 1) {
321
+ return 'enum';
322
+ }
323
+ if (typeof propsP1 === 'string' && propsP1.startsWith('scalar.') && mappedParts.length === 1) {
324
+ return propsP1;
325
+ }
326
+ if (typeof propsP1 === 'object') {
327
+ if (mappedParts.length < 2) {
328
+ return 'not';
329
+ }
330
+ const propsP2 = propsP1[mappedParts[1].v];
331
+ if (typeof propsP2 === 'string') {
332
+ return rpp(`${propsP2}${SEPARATOR}${mappedParts
333
+ .slice(2)
334
+ .map((mp) => mp.v)
335
+ .join(SEPARATOR)}`);
336
+ }
337
+ if (typeof propsP2 === 'object') {
338
+ if (mappedParts.length < 3) {
339
+ return 'not';
340
+ }
341
+ const propsP3 = propsP2[mappedParts[2].v];
342
+ if (propsP3 && mappedParts[2].__type === 'arg') {
343
+ return rpp(`${propsP3}${SEPARATOR}${mappedParts
344
+ .slice(3)
345
+ .map((mp) => mp.v)
346
+ .join(SEPARATOR)}`);
347
+ }
348
+ }
349
+ }
350
+ };
351
+ const ResolveReturnType = (mappedParts) => {
352
+ if (mappedParts.length === 0) {
353
+ return 'not';
354
+ }
355
+ const oKey = ops[mappedParts[0].v];
356
+ const returnP1 = oKey ? returns[oKey] : returns[mappedParts[0].v];
357
+ if (typeof returnP1 === 'object') {
358
+ if (mappedParts.length < 2)
359
+ return 'not';
360
+ const returnP2 = returnP1[mappedParts[1].v];
361
+ if (returnP2) {
362
+ return rpp(`${returnP2}${SEPARATOR}${mappedParts
363
+ .slice(2)
364
+ .map((mp) => mp.v)
365
+ .join(SEPARATOR)}`);
366
+ }
367
+ }
368
+ };
369
+ const rpp = (path) => {
370
+ const parts = path.split(SEPARATOR).filter((l) => l.length > 0);
371
+ const mappedParts = parts.map(mapPart);
372
+ const propsP1 = ResolvePropsType(mappedParts);
373
+ if (propsP1) {
374
+ return propsP1;
375
+ }
376
+ const returnP1 = ResolveReturnType(mappedParts);
377
+ if (returnP1) {
378
+ return returnP1;
379
+ }
380
+ return 'not';
381
+ };
382
+ return rpp;
383
+ };
384
+ export const InternalArgsBuilt = ({ props, ops, returns, scalars, vars, }) => {
385
+ const arb = (a, p = '', root = true) => {
386
+ var _a, _b;
387
+ if (typeof a === 'string') {
388
+ if (a.startsWith(START_VAR_NAME)) {
389
+ const [varName, graphQLType] = a.replace(START_VAR_NAME, '$').split(GRAPHQL_TYPE_SEPARATOR);
390
+ const v = vars.find((v) => v.name === varName);
391
+ if (!v) {
392
+ vars.push({
393
+ name: varName,
394
+ graphQLType,
395
+ });
396
+ }
397
+ else {
398
+ if (v.graphQLType !== graphQLType) {
399
+ throw new Error(`Invalid variable exists with two different GraphQL Types, "${v.graphQLType}" and ${graphQLType}`);
400
+ }
401
+ }
402
+ return varName;
403
+ }
404
+ }
405
+ const checkType = ResolveFromPath(props, returns, ops)(p);
406
+ if (checkType.startsWith('scalar.')) {
407
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
408
+ const [_, ...splittedScalar] = checkType.split('.');
409
+ const scalarKey = splittedScalar.join('.');
410
+ return ((_b = (_a = scalars === null || scalars === void 0 ? void 0 : scalars[scalarKey]) === null || _a === void 0 ? void 0 : _a.encode) === null || _b === void 0 ? void 0 : _b.call(_a, a)) || JSON.stringify(a);
411
+ }
412
+ if (Array.isArray(a)) {
413
+ return `[${a.map((arr) => arb(arr, p, false)).join(', ')}]`;
414
+ }
415
+ if (typeof a === 'string') {
416
+ if (checkType === 'enum') {
417
+ return a;
418
+ }
419
+ return `${JSON.stringify(a)}`;
420
+ }
421
+ if (typeof a === 'object') {
422
+ if (a === null) {
423
+ return `null`;
424
+ }
425
+ const returnedObjectString = Object.entries(a)
426
+ .filter(([, v]) => typeof v !== 'undefined')
427
+ .map(([k, v]) => `${k}: ${arb(v, [p, k].join(SEPARATOR), false)}`)
428
+ .join(',\n');
429
+ if (!root) {
430
+ return `{${returnedObjectString}}`;
431
+ }
432
+ return returnedObjectString;
433
+ }
434
+ return `${a}`;
435
+ };
436
+ return arb;
437
+ };
438
+ export const resolverFor = (type, field, fn) => fn;
439
+ export const START_VAR_NAME = `$ZEUS_VAR`;
440
+ export const GRAPHQL_TYPE_SEPARATOR = `__$GRAPHQL__`;
441
+ export const $ = (name, graphqlType) => {
442
+ return (START_VAR_NAME + name + GRAPHQL_TYPE_SEPARATOR + graphqlType);
443
+ };
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { ReviewDetail } from "../graphql";
3
+ export declare const OrderInfo: ({ review }: {
4
+ review: ReviewDetail;
5
+ }) => React.JSX.Element | null;
@@ -0,0 +1,42 @@
1
+ import React from "react";
2
+ import { Card, CardContent, CardHeader, priceFormatter, Routes, } from "@deenruv/react-ui-devkit";
3
+ import { Link } from "react-router-dom";
4
+ import { useTranslation } from "react-i18next";
5
+ import { TRANSLATION_NAMESPACE } from "../constants";
6
+ export const OrderInfo = ({ review }) => {
7
+ const { t } = useTranslation(TRANSLATION_NAMESPACE, {
8
+ i18n: window.__DEENRUV_SETTINGS__.i18n,
9
+ });
10
+ if (!review.order)
11
+ return null;
12
+ return (React.createElement(Card, { className: "w-full" },
13
+ React.createElement(CardHeader, null,
14
+ React.createElement("p", null, t("orderInfo.orderReview")),
15
+ React.createElement(Link, { target: "_blank", to: Routes.orders.to(review.order.id) },
16
+ React.createElement("span", { className: "text-sm text-blue-500 hover:underline" }, t("orderInfo.viewOrder")))),
17
+ React.createElement(CardContent, null,
18
+ React.createElement("p", null,
19
+ React.createElement("strong", null,
20
+ t("orderInfo.orderId"),
21
+ ":"),
22
+ " ",
23
+ review.order.id),
24
+ React.createElement("p", null,
25
+ React.createElement("strong", null,
26
+ t("orderInfo.orderCode"),
27
+ ":"),
28
+ " ",
29
+ review.order.code),
30
+ React.createElement("p", null,
31
+ React.createElement("strong", null,
32
+ t("orderInfo.orderTotal"),
33
+ ":"),
34
+ " ",
35
+ priceFormatter(review.order.totalWithTax, review.order.currencyCode)),
36
+ React.createElement("p", null,
37
+ React.createElement("strong", null,
38
+ t("orderInfo.totalItems"),
39
+ ":"),
40
+ " ",
41
+ review.order.totalQuantity))));
42
+ };
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { ReviewDetail } from "../graphql";
3
+ export declare const ProductInfo: ({ review }: {
4
+ review: ReviewDetail;
5
+ }) => React.JSX.Element | null;
@@ -0,0 +1,36 @@
1
+ import React from "react";
2
+ import { Card, CardContent, CardHeader, Routes, } from "@deenruv/react-ui-devkit";
3
+ import { Link } from "react-router-dom";
4
+ import { useTranslation } from "react-i18next";
5
+ import { TRANSLATION_NAMESPACE } from "../constants";
6
+ export const ProductInfo = ({ review }) => {
7
+ const { t } = useTranslation(TRANSLATION_NAMESPACE, {
8
+ i18n: window.__DEENRUV_SETTINGS__.i18n,
9
+ });
10
+ if (!review.productVariant)
11
+ return null;
12
+ return (React.createElement(Card, { className: "w-full" },
13
+ React.createElement(CardHeader, null,
14
+ React.createElement("p", null, t("productInfo.productReview")),
15
+ React.createElement(Link, { target: "_blank", to: Routes.products.to(review.productVariant.product.id) },
16
+ React.createElement("span", { className: "text-sm text-blue-500 hover:underline" }, t("productInfo.viewProduct")))),
17
+ React.createElement(CardContent, null,
18
+ React.createElement("p", null,
19
+ React.createElement("strong", null,
20
+ t("productInfo.productId"),
21
+ ":"),
22
+ " ",
23
+ review.productVariant.product.id),
24
+ React.createElement("p", null,
25
+ React.createElement("strong", null,
26
+ t("productInfo.productName"),
27
+ ":"),
28
+ " ",
29
+ review.productVariant.product.name),
30
+ React.createElement("p", null,
31
+ React.createElement("strong", null,
32
+ t("productInfo.variantName"),
33
+ ":"),
34
+ " ",
35
+ review.productVariant.name))));
36
+ };
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const ReviewCustomer: () => React.JSX.Element;