hey-pharmacist-ecommerce 1.1.29 → 1.1.31

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 (104) hide show
  1. package/dist/index.d.mts +10957 -1331
  2. package/dist/index.d.ts +10957 -1331
  3. package/dist/index.js +12364 -5144
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +9353 -2205
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +4 -3
  8. package/src/components/AccountReviewsTab.tsx +97 -0
  9. package/src/components/CouponCodeInput.tsx +190 -0
  10. package/src/components/Header.tsx +5 -1
  11. package/src/components/Notification.tsx +1 -1
  12. package/src/components/NotificationBell.tsx +33 -0
  13. package/src/components/NotificationCard.tsx +211 -0
  14. package/src/components/NotificationDrawer.tsx +195 -0
  15. package/src/components/OrderCard.tsx +164 -99
  16. package/src/components/ProductReviewsSection.tsx +30 -0
  17. package/src/components/RatingDistribution.tsx +86 -0
  18. package/src/components/ReviewCard.tsx +59 -0
  19. package/src/components/ReviewForm.tsx +207 -0
  20. package/src/components/ReviewPromptBanner.tsx +98 -0
  21. package/src/components/ReviewsList.tsx +151 -0
  22. package/src/components/StarRating.tsx +98 -0
  23. package/src/hooks/useDiscounts.ts +7 -0
  24. package/src/hooks/useOrders.ts +15 -0
  25. package/src/hooks/useReviews.ts +230 -0
  26. package/src/hooks/useStoreCapabilities.ts +87 -0
  27. package/src/index.ts +29 -0
  28. package/src/lib/Apis/apis/auth-api.ts +19 -7
  29. package/src/lib/Apis/apis/categories-api.ts +97 -0
  30. package/src/lib/Apis/apis/discounts-api.ts +23 -72
  31. package/src/lib/Apis/apis/notifications-api.ts +196 -231
  32. package/src/lib/Apis/apis/products-api.ts +181 -0
  33. package/src/lib/Apis/apis/review-api.ts +283 -4
  34. package/src/lib/Apis/apis/shipping-api.ts +105 -0
  35. package/src/lib/Apis/apis/stores-api.ts +536 -0
  36. package/src/lib/Apis/apis/sub-categories-api.ts +97 -0
  37. package/src/lib/Apis/apis/users-api.ts +8 -8
  38. package/src/lib/Apis/models/address-created-request.ts +0 -12
  39. package/src/lib/Apis/models/address.ts +0 -12
  40. package/src/lib/Apis/models/api-key-info-dto.ts +49 -0
  41. package/src/lib/Apis/models/bulk-channel-toggle-dto.ts +52 -0
  42. package/src/lib/Apis/models/cart-body-populated.ts +3 -3
  43. package/src/lib/Apis/models/channel-settings-dto.ts +39 -0
  44. package/src/lib/Apis/models/{discount-paginated-response.ts → completed-order-dto.ts} +21 -16
  45. package/src/lib/Apis/models/create-address-dto.ts +0 -12
  46. package/src/lib/Apis/models/create-discount-dto.ts +31 -100
  47. package/src/lib/Apis/models/create-review-dto.ts +4 -4
  48. package/src/lib/Apis/models/create-shippo-account-dto.ts +45 -0
  49. package/src/lib/Apis/models/create-store-address-dto.ts +0 -12
  50. package/src/lib/Apis/models/create-store-dto-settings.ts +51 -0
  51. package/src/lib/Apis/models/create-store-dto.ts +13 -0
  52. package/src/lib/Apis/models/create-variant-dto.ts +0 -6
  53. package/src/lib/Apis/models/discount.ts +37 -106
  54. package/src/lib/Apis/models/discounts-insights-dto.ts +12 -0
  55. package/src/lib/Apis/models/index.ts +24 -7
  56. package/src/lib/Apis/models/{manual-discount.ts → manual-discount-dto.ts} +10 -10
  57. package/src/lib/Apis/models/manual-order-dto.ts +3 -3
  58. package/src/lib/Apis/models/populated-discount.ts +41 -109
  59. package/src/lib/Apis/models/preference-update-item.ts +59 -0
  60. package/src/lib/Apis/models/product-light-dto.ts +40 -0
  61. package/src/lib/Apis/models/product-variant.ts +0 -6
  62. package/src/lib/Apis/models/reorder-categories-dto.ts +27 -0
  63. package/src/lib/Apis/models/reorder-products-dto.ts +49 -0
  64. package/src/lib/Apis/models/{check-notifications-response-dto.ts → reorder-products-success-response-dto.ts} +7 -7
  65. package/src/lib/Apis/models/reorder-subcategories-dto.ts +33 -0
  66. package/src/lib/Apis/models/reorder-success-response-dto.ts +33 -0
  67. package/src/lib/Apis/models/review-status-dto.ts +34 -0
  68. package/src/lib/Apis/models/review.ts +9 -3
  69. package/src/lib/Apis/models/reviewable-order-dto.ts +58 -0
  70. package/src/lib/Apis/models/reviewable-product-dto.ts +81 -0
  71. package/src/lib/Apis/models/shipment-with-order.ts +18 -0
  72. package/src/lib/Apis/models/shipment.ts +18 -0
  73. package/src/lib/Apis/models/shippo-account-response-dto.ts +51 -0
  74. package/src/lib/Apis/models/store-api-keys-response-dto.ts +34 -0
  75. package/src/lib/Apis/models/store-capabilities-dto.ts +63 -0
  76. package/src/lib/Apis/models/store-entity.ts +13 -0
  77. package/src/lib/Apis/models/store.ts +13 -0
  78. package/src/lib/Apis/models/update-address-dto.ts +0 -12
  79. package/src/lib/Apis/models/update-api-keys-dto.ts +39 -0
  80. package/src/lib/Apis/models/update-discount-dto.ts +31 -100
  81. package/src/lib/Apis/models/update-manual-shipment-status-dto.ts +47 -0
  82. package/src/lib/Apis/models/update-notification-settings-dto.ts +28 -0
  83. package/src/lib/Apis/models/update-review-dto.ts +4 -4
  84. package/src/lib/Apis/models/update-store-dto.ts +13 -0
  85. package/src/lib/Apis/models/update-variant-dto.ts +0 -6
  86. package/src/lib/Apis/models/{pick-type-class.ts → variant-light-dto.ts} +20 -14
  87. package/src/lib/utils/discount.ts +155 -0
  88. package/src/lib/validations/discount.ts +11 -0
  89. package/src/providers/CartProvider.tsx +2 -2
  90. package/src/providers/DiscountProvider.tsx +97 -0
  91. package/src/providers/EcommerceProvider.tsx +13 -5
  92. package/src/providers/NotificationCenterProvider.tsx +436 -0
  93. package/src/screens/CartScreen.tsx +1 -1
  94. package/src/screens/CheckoutScreen.tsx +402 -290
  95. package/src/screens/NotificationSettingsScreen.tsx +413 -0
  96. package/src/screens/OrderDetailScreen.tsx +283 -0
  97. package/src/screens/OrderReviewsScreen.tsx +308 -0
  98. package/src/screens/OrdersScreen.tsx +31 -7
  99. package/src/screens/ProductDetailScreen.tsx +24 -11
  100. package/src/screens/ProfileScreen.tsx +5 -0
  101. package/src/screens/ResetPasswordScreen.tsx +10 -4
  102. package/src/lib/Apis/models/create-notification-dto.ts +0 -75
  103. package/src/lib/Apis/models/notification.ts +0 -93
  104. package/src/lib/Apis/models/single-notification-dto.ts +0 -99
@@ -20,7 +20,10 @@ import { CreateProductDto } from '../models';
20
20
  import { CreateVariantDto } from '../models';
21
21
  import { PaginatedProductsDto } from '../models';
22
22
  import { Product } from '../models';
23
+ import { ProductLightDto } from '../models';
23
24
  import { ProductsInsightsDto } from '../models';
25
+ import { ReorderProductsDto } from '../models';
26
+ import { ReorderProductsSuccessResponseDto } from '../models';
24
27
  import { UpdateProductDto } from '../models';
25
28
  import { UpdateVariantDto } from '../models';
26
29
  import { VariantIdInventoryBody } from '../models';
@@ -607,6 +610,57 @@ export const ProductsApiAxiosParamCreator = function (configuration?: Configurat
607
610
  options: localVarRequestOptions,
608
611
  };
609
612
  },
613
+ /**
614
+ *
615
+ * @summary Get all products with basic info (lightweight)
616
+ * @param {*} [options] Override http request option.
617
+ * @throws {RequiredError}
618
+ */
619
+ getAllProductsLight: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
620
+ const localVarPath = `/products/light`;
621
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
622
+ const localVarUrlObj = new URL(localVarPath, 'https://example.com');
623
+ let baseOptions;
624
+ if (configuration) {
625
+ baseOptions = configuration.baseOptions;
626
+ }
627
+ const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options};
628
+ const localVarHeaderParameter = {} as any;
629
+ const localVarQueryParameter = {} as any;
630
+
631
+ // authentication bearer required
632
+ // http bearer authentication required
633
+ if (configuration && configuration.accessToken) {
634
+ const accessToken = typeof configuration.accessToken === 'function'
635
+ ? await configuration.accessToken()
636
+ : await configuration.accessToken;
637
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
638
+ }
639
+
640
+ // authentication x-store-key required
641
+ if (configuration && configuration.apiKey) {
642
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
643
+ ? await configuration.apiKey("x-store-key")
644
+ : await configuration.apiKey;
645
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
646
+ }
647
+
648
+ const query = new URLSearchParams(localVarUrlObj.search);
649
+ for (const key in localVarQueryParameter) {
650
+ query.set(key, localVarQueryParameter[key]);
651
+ }
652
+ for (const key in options.params) {
653
+ query.set(key, options.params[key]);
654
+ }
655
+ localVarUrlObj.search = (new URLSearchParams(query)).toString();
656
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
657
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
658
+
659
+ return {
660
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
661
+ options: localVarRequestOptions,
662
+ };
663
+ },
610
664
  /**
611
665
  *
612
666
  * @summary Get the featured product for home screen
@@ -1003,6 +1057,66 @@ export const ProductsApiAxiosParamCreator = function (configuration?: Configurat
1003
1057
  options: localVarRequestOptions,
1004
1058
  };
1005
1059
  },
1060
+ /**
1061
+ *
1062
+ * @summary Reorder products within a category or subcategory
1063
+ * @param {ReorderProductsDto} body
1064
+ * @param {*} [options] Override http request option.
1065
+ * @throws {RequiredError}
1066
+ */
1067
+ reorderProducts: async (body: ReorderProductsDto, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1068
+ // verify required parameter 'body' is not null or undefined
1069
+ if (body === null || body === undefined) {
1070
+ throw new RequiredError('body','Required parameter body was null or undefined when calling reorderProducts.');
1071
+ }
1072
+ const localVarPath = `/products/reorder`;
1073
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1074
+ const localVarUrlObj = new URL(localVarPath, 'https://example.com');
1075
+ let baseOptions;
1076
+ if (configuration) {
1077
+ baseOptions = configuration.baseOptions;
1078
+ }
1079
+ const localVarRequestOptions :AxiosRequestConfig = { method: 'PATCH', ...baseOptions, ...options};
1080
+ const localVarHeaderParameter = {} as any;
1081
+ const localVarQueryParameter = {} as any;
1082
+
1083
+ // authentication bearer required
1084
+ // http bearer authentication required
1085
+ if (configuration && configuration.accessToken) {
1086
+ const accessToken = typeof configuration.accessToken === 'function'
1087
+ ? await configuration.accessToken()
1088
+ : await configuration.accessToken;
1089
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
1090
+ }
1091
+
1092
+ // authentication x-store-key required
1093
+ if (configuration && configuration.apiKey) {
1094
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
1095
+ ? await configuration.apiKey("x-store-key")
1096
+ : await configuration.apiKey;
1097
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
1098
+ }
1099
+
1100
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1101
+
1102
+ const query = new URLSearchParams(localVarUrlObj.search);
1103
+ for (const key in localVarQueryParameter) {
1104
+ query.set(key, localVarQueryParameter[key]);
1105
+ }
1106
+ for (const key in options.params) {
1107
+ query.set(key, options.params[key]);
1108
+ }
1109
+ localVarUrlObj.search = (new URLSearchParams(query)).toString();
1110
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1111
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1112
+ const needsSerialization = (typeof body !== "string") || (localVarRequestOptions.headers ||= {})['Content-Type'] === 'application/json';
1113
+ localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
1114
+
1115
+ return {
1116
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
1117
+ options: localVarRequestOptions,
1118
+ };
1119
+ },
1006
1120
  /**
1007
1121
  *
1008
1122
  * @summary Update variant inventory (add or subtract)
@@ -1359,6 +1473,19 @@ export const ProductsApiFp = function(configuration?: Configuration) {
1359
1473
  return axios.request(axiosRequestArgs);
1360
1474
  };
1361
1475
  },
1476
+ /**
1477
+ *
1478
+ * @summary Get all products with basic info (lightweight)
1479
+ * @param {*} [options] Override http request option.
1480
+ * @throws {RequiredError}
1481
+ */
1482
+ async getAllProductsLight(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<Array<ProductLightDto>>>> {
1483
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).getAllProductsLight(options);
1484
+ return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
1485
+ const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
1486
+ return axios.request(axiosRequestArgs);
1487
+ };
1488
+ },
1362
1489
  /**
1363
1490
  *
1364
1491
  * @summary Get the featured product for home screen
@@ -1457,6 +1584,20 @@ export const ProductsApiFp = function(configuration?: Configuration) {
1457
1584
  return axios.request(axiosRequestArgs);
1458
1585
  };
1459
1586
  },
1587
+ /**
1588
+ *
1589
+ * @summary Reorder products within a category or subcategory
1590
+ * @param {ReorderProductsDto} body
1591
+ * @param {*} [options] Override http request option.
1592
+ * @throws {RequiredError}
1593
+ */
1594
+ async reorderProducts(body: ReorderProductsDto, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ReorderProductsSuccessResponseDto>>> {
1595
+ const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).reorderProducts(body, options);
1596
+ return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
1597
+ const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
1598
+ return axios.request(axiosRequestArgs);
1599
+ };
1600
+ },
1460
1601
  /**
1461
1602
  *
1462
1603
  * @summary Update variant inventory (add or subtract)
@@ -1614,6 +1755,15 @@ export const ProductsApiFactory = function (configuration?: Configuration, baseP
1614
1755
  async getAllProductsBySubCategory(subCategoryId: string, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
1615
1756
  return ProductsApiFp(configuration).getAllProductsBySubCategory(subCategoryId, options).then((request) => request(axios, basePath));
1616
1757
  },
1758
+ /**
1759
+ *
1760
+ * @summary Get all products with basic info (lightweight)
1761
+ * @param {*} [options] Override http request option.
1762
+ * @throws {RequiredError}
1763
+ */
1764
+ async getAllProductsLight(options?: AxiosRequestConfig): Promise<AxiosResponse<Array<ProductLightDto>>> {
1765
+ return ProductsApiFp(configuration).getAllProductsLight(options).then((request) => request(axios, basePath));
1766
+ },
1617
1767
  /**
1618
1768
  *
1619
1769
  * @summary Get the featured product for home screen
@@ -1684,6 +1834,16 @@ export const ProductsApiFactory = function (configuration?: Configuration, baseP
1684
1834
  async getTopSellingProducts(limit?: number, page?: number, options?: AxiosRequestConfig): Promise<AxiosResponse<PaginatedProductsDto>> {
1685
1835
  return ProductsApiFp(configuration).getTopSellingProducts(limit, page, options).then((request) => request(axios, basePath));
1686
1836
  },
1837
+ /**
1838
+ *
1839
+ * @summary Reorder products within a category or subcategory
1840
+ * @param {ReorderProductsDto} body
1841
+ * @param {*} [options] Override http request option.
1842
+ * @throws {RequiredError}
1843
+ */
1844
+ async reorderProducts(body: ReorderProductsDto, options?: AxiosRequestConfig): Promise<AxiosResponse<ReorderProductsSuccessResponseDto>> {
1845
+ return ProductsApiFp(configuration).reorderProducts(body, options).then((request) => request(axios, basePath));
1846
+ },
1687
1847
  /**
1688
1848
  *
1689
1849
  * @summary Update variant inventory (add or subtract)
@@ -1839,6 +1999,16 @@ export class ProductsApi extends BaseAPI {
1839
1999
  public async getAllProductsBySubCategory(subCategoryId: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
1840
2000
  return ProductsApiFp(this.configuration).getAllProductsBySubCategory(subCategoryId, options).then((request) => request(this.axios, this.basePath));
1841
2001
  }
2002
+ /**
2003
+ *
2004
+ * @summary Get all products with basic info (lightweight)
2005
+ * @param {*} [options] Override http request option.
2006
+ * @throws {RequiredError}
2007
+ * @memberof ProductsApi
2008
+ */
2009
+ public async getAllProductsLight(options?: AxiosRequestConfig) : Promise<AxiosResponse<Array<ProductLightDto>>> {
2010
+ return ProductsApiFp(this.configuration).getAllProductsLight(options).then((request) => request(this.axios, this.basePath));
2011
+ }
1842
2012
  /**
1843
2013
  *
1844
2014
  * @summary Get the featured product for home screen
@@ -1916,6 +2086,17 @@ export class ProductsApi extends BaseAPI {
1916
2086
  public async getTopSellingProducts(limit?: number, page?: number, options?: AxiosRequestConfig) : Promise<AxiosResponse<PaginatedProductsDto>> {
1917
2087
  return ProductsApiFp(this.configuration).getTopSellingProducts(limit, page, options).then((request) => request(this.axios, this.basePath));
1918
2088
  }
2089
+ /**
2090
+ *
2091
+ * @summary Reorder products within a category or subcategory
2092
+ * @param {ReorderProductsDto} body
2093
+ * @param {*} [options] Override http request option.
2094
+ * @throws {RequiredError}
2095
+ * @memberof ProductsApi
2096
+ */
2097
+ public async reorderProducts(body: ReorderProductsDto, options?: AxiosRequestConfig) : Promise<AxiosResponse<ReorderProductsSuccessResponseDto>> {
2098
+ return ProductsApiFp(this.configuration).reorderProducts(body, options).then((request) => request(this.axios, this.basePath));
2099
+ }
1919
2100
  /**
1920
2101
  *
1921
2102
  * @summary Update variant inventory (add or subtract)
@@ -16,8 +16,11 @@ import { Configuration } from '../configuration';
16
16
  // Some imports not used depending on template conditions
17
17
  // @ts-ignore
18
18
  import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
19
+ import { CompletedOrderDto } from '../models';
19
20
  import { CreateReviewDto } from '../models';
20
21
  import { Review } from '../models';
22
+ import { ReviewStatusDto } from '../models';
23
+ import { ReviewableOrderDto } from '../models';
21
24
  import { UpdateReviewDto } from '../models';
22
25
  /**
23
26
  * ReviewApi - axios parameter creator
@@ -93,7 +96,70 @@ export const ReviewApiAxiosParamCreator = function (configuration?: Configuratio
93
96
  },
94
97
  /**
95
98
  *
96
- * @summary Create a review
99
+ * @summary Check if a product has been reviewed in an order
100
+ * @param {string} orderId
101
+ * @param {string} productVariantId
102
+ * @param {*} [options] Override http request option.
103
+ * @throws {RequiredError}
104
+ */
105
+ checkReviewStatus: async (orderId: string, productVariantId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
106
+ // verify required parameter 'orderId' is not null or undefined
107
+ if (orderId === null || orderId === undefined) {
108
+ throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling checkReviewStatus.');
109
+ }
110
+ // verify required parameter 'productVariantId' is not null or undefined
111
+ if (productVariantId === null || productVariantId === undefined) {
112
+ throw new RequiredError('productVariantId','Required parameter productVariantId was null or undefined when calling checkReviewStatus.');
113
+ }
114
+ const localVarPath = `/reviews/order/{orderId}/product/{productVariantId}/status`
115
+ .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId)))
116
+ .replace(`{${"productVariantId"}}`, encodeURIComponent(String(productVariantId)));
117
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
118
+ const localVarUrlObj = new URL(localVarPath, 'https://example.com');
119
+ let baseOptions;
120
+ if (configuration) {
121
+ baseOptions = configuration.baseOptions;
122
+ }
123
+ const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options};
124
+ const localVarHeaderParameter = {} as any;
125
+ const localVarQueryParameter = {} as any;
126
+
127
+ // authentication bearer required
128
+ // http bearer authentication required
129
+ if (configuration && configuration.accessToken) {
130
+ const accessToken = typeof configuration.accessToken === 'function'
131
+ ? await configuration.accessToken()
132
+ : await configuration.accessToken;
133
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
134
+ }
135
+
136
+ // authentication x-store-key required
137
+ if (configuration && configuration.apiKey) {
138
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
139
+ ? await configuration.apiKey("x-store-key")
140
+ : await configuration.apiKey;
141
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
142
+ }
143
+
144
+ const query = new URLSearchParams(localVarUrlObj.search);
145
+ for (const key in localVarQueryParameter) {
146
+ query.set(key, localVarQueryParameter[key]);
147
+ }
148
+ for (const key in options.params) {
149
+ query.set(key, options.params[key]);
150
+ }
151
+ localVarUrlObj.search = (new URLSearchParams(query)).toString();
152
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
153
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
154
+
155
+ return {
156
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
157
+ options: localVarRequestOptions,
158
+ };
159
+ },
160
+ /**
161
+ *
162
+ * @summary Create a review for a product in a completed order
97
163
  * @param {CreateReviewDto} body
98
164
  * @param {string} orderId
99
165
  * @param {*} [options] Override http request option.
@@ -208,6 +274,63 @@ export const ReviewApiAxiosParamCreator = function (configuration?: Configuratio
208
274
  options: localVarRequestOptions,
209
275
  };
210
276
  },
277
+ /**
278
+ *
279
+ * @summary Get all reviewable products from a completed order
280
+ * @param {string} orderId
281
+ * @param {*} [options] Override http request option.
282
+ * @throws {RequiredError}
283
+ */
284
+ getReviewableProducts: async (orderId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
285
+ // verify required parameter 'orderId' is not null or undefined
286
+ if (orderId === null || orderId === undefined) {
287
+ throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getReviewableProducts.');
288
+ }
289
+ const localVarPath = `/reviews/order/{orderId}/reviewable-products`
290
+ .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId)));
291
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
292
+ const localVarUrlObj = new URL(localVarPath, 'https://example.com');
293
+ let baseOptions;
294
+ if (configuration) {
295
+ baseOptions = configuration.baseOptions;
296
+ }
297
+ const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options};
298
+ const localVarHeaderParameter = {} as any;
299
+ const localVarQueryParameter = {} as any;
300
+
301
+ // authentication bearer required
302
+ // http bearer authentication required
303
+ if (configuration && configuration.accessToken) {
304
+ const accessToken = typeof configuration.accessToken === 'function'
305
+ ? await configuration.accessToken()
306
+ : await configuration.accessToken;
307
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
308
+ }
309
+
310
+ // authentication x-store-key required
311
+ if (configuration && configuration.apiKey) {
312
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
313
+ ? await configuration.apiKey("x-store-key")
314
+ : await configuration.apiKey;
315
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
316
+ }
317
+
318
+ const query = new URLSearchParams(localVarUrlObj.search);
319
+ for (const key in localVarQueryParameter) {
320
+ query.set(key, localVarQueryParameter[key]);
321
+ }
322
+ for (const key in options.params) {
323
+ query.set(key, options.params[key]);
324
+ }
325
+ localVarUrlObj.search = (new URLSearchParams(query)).toString();
326
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
327
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
328
+
329
+ return {
330
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
331
+ options: localVarRequestOptions,
332
+ };
333
+ },
211
334
  /**
212
335
  *
213
336
  * @summary Get all reviews by date
@@ -607,6 +730,57 @@ export const ReviewApiAxiosParamCreator = function (configuration?: Configuratio
607
730
  options: localVarRequestOptions,
608
731
  };
609
732
  },
733
+ /**
734
+ *
735
+ * @summary Get all completed orders for the current user that can be reviewed
736
+ * @param {*} [options] Override http request option.
737
+ * @throws {RequiredError}
738
+ */
739
+ getUserCompletedOrders: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
740
+ const localVarPath = `/reviews/my-completed-orders`;
741
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
742
+ const localVarUrlObj = new URL(localVarPath, 'https://example.com');
743
+ let baseOptions;
744
+ if (configuration) {
745
+ baseOptions = configuration.baseOptions;
746
+ }
747
+ const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options};
748
+ const localVarHeaderParameter = {} as any;
749
+ const localVarQueryParameter = {} as any;
750
+
751
+ // authentication bearer required
752
+ // http bearer authentication required
753
+ if (configuration && configuration.accessToken) {
754
+ const accessToken = typeof configuration.accessToken === 'function'
755
+ ? await configuration.accessToken()
756
+ : await configuration.accessToken;
757
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
758
+ }
759
+
760
+ // authentication x-store-key required
761
+ if (configuration && configuration.apiKey) {
762
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
763
+ ? await configuration.apiKey("x-store-key")
764
+ : await configuration.apiKey;
765
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
766
+ }
767
+
768
+ const query = new URLSearchParams(localVarUrlObj.search);
769
+ for (const key in localVarQueryParameter) {
770
+ query.set(key, localVarQueryParameter[key]);
771
+ }
772
+ for (const key in options.params) {
773
+ query.set(key, options.params[key]);
774
+ }
775
+ localVarUrlObj.search = (new URLSearchParams(query)).toString();
776
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
777
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
778
+
779
+ return {
780
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
781
+ options: localVarRequestOptions,
782
+ };
783
+ },
610
784
  /**
611
785
  *
612
786
  * @summary Remove a reply from a review
@@ -879,7 +1053,22 @@ export const ReviewApiFp = function(configuration?: Configuration) {
879
1053
  },
880
1054
  /**
881
1055
  *
882
- * @summary Create a review
1056
+ * @summary Check if a product has been reviewed in an order
1057
+ * @param {string} orderId
1058
+ * @param {string} productVariantId
1059
+ * @param {*} [options] Override http request option.
1060
+ * @throws {RequiredError}
1061
+ */
1062
+ async checkReviewStatus(orderId: string, productVariantId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ReviewStatusDto>>> {
1063
+ const localVarAxiosArgs = await ReviewApiAxiosParamCreator(configuration).checkReviewStatus(orderId, productVariantId, options);
1064
+ return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
1065
+ const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
1066
+ return axios.request(axiosRequestArgs);
1067
+ };
1068
+ },
1069
+ /**
1070
+ *
1071
+ * @summary Create a review for a product in a completed order
883
1072
  * @param {CreateReviewDto} body
884
1073
  * @param {string} orderId
885
1074
  * @param {*} [options] Override http request option.
@@ -905,6 +1094,20 @@ export const ReviewApiFp = function(configuration?: Configuration) {
905
1094
  return axios.request(axiosRequestArgs);
906
1095
  };
907
1096
  },
1097
+ /**
1098
+ *
1099
+ * @summary Get all reviewable products from a completed order
1100
+ * @param {string} orderId
1101
+ * @param {*} [options] Override http request option.
1102
+ * @throws {RequiredError}
1103
+ */
1104
+ async getReviewableProducts(orderId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ReviewableOrderDto>>> {
1105
+ const localVarAxiosArgs = await ReviewApiAxiosParamCreator(configuration).getReviewableProducts(orderId, options);
1106
+ return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
1107
+ const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
1108
+ return axios.request(axiosRequestArgs);
1109
+ };
1110
+ },
908
1111
  /**
909
1112
  *
910
1113
  * @summary Get all reviews by date
@@ -1003,6 +1206,19 @@ export const ReviewApiFp = function(configuration?: Configuration) {
1003
1206
  return axios.request(axiosRequestArgs);
1004
1207
  };
1005
1208
  },
1209
+ /**
1210
+ *
1211
+ * @summary Get all completed orders for the current user that can be reviewed
1212
+ * @param {*} [options] Override http request option.
1213
+ * @throws {RequiredError}
1214
+ */
1215
+ async getUserCompletedOrders(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<Array<CompletedOrderDto>>>> {
1216
+ const localVarAxiosArgs = await ReviewApiAxiosParamCreator(configuration).getUserCompletedOrders(options);
1217
+ return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
1218
+ const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
1219
+ return axios.request(axiosRequestArgs);
1220
+ };
1221
+ },
1006
1222
  /**
1007
1223
  *
1008
1224
  * @summary Remove a reply from a review
@@ -1083,7 +1299,18 @@ export const ReviewApiFactory = function (configuration?: Configuration, basePat
1083
1299
  },
1084
1300
  /**
1085
1301
  *
1086
- * @summary Create a review
1302
+ * @summary Check if a product has been reviewed in an order
1303
+ * @param {string} orderId
1304
+ * @param {string} productVariantId
1305
+ * @param {*} [options] Override http request option.
1306
+ * @throws {RequiredError}
1307
+ */
1308
+ async checkReviewStatus(orderId: string, productVariantId: string, options?: AxiosRequestConfig): Promise<AxiosResponse<ReviewStatusDto>> {
1309
+ return ReviewApiFp(configuration).checkReviewStatus(orderId, productVariantId, options).then((request) => request(axios, basePath));
1310
+ },
1311
+ /**
1312
+ *
1313
+ * @summary Create a review for a product in a completed order
1087
1314
  * @param {CreateReviewDto} body
1088
1315
  * @param {string} orderId
1089
1316
  * @param {*} [options] Override http request option.
@@ -1101,6 +1328,16 @@ export const ReviewApiFactory = function (configuration?: Configuration, basePat
1101
1328
  async getReviewCount(options?: AxiosRequestConfig): Promise<AxiosResponse<number>> {
1102
1329
  return ReviewApiFp(configuration).getReviewCount(options).then((request) => request(axios, basePath));
1103
1330
  },
1331
+ /**
1332
+ *
1333
+ * @summary Get all reviewable products from a completed order
1334
+ * @param {string} orderId
1335
+ * @param {*} [options] Override http request option.
1336
+ * @throws {RequiredError}
1337
+ */
1338
+ async getReviewableProducts(orderId: string, options?: AxiosRequestConfig): Promise<AxiosResponse<ReviewableOrderDto>> {
1339
+ return ReviewApiFp(configuration).getReviewableProducts(orderId, options).then((request) => request(axios, basePath));
1340
+ },
1104
1341
  /**
1105
1342
  *
1106
1343
  * @summary Get all reviews by date
@@ -1171,6 +1408,15 @@ export const ReviewApiFactory = function (configuration?: Configuration, basePat
1171
1408
  async getReviewsByUser(userId: string, options?: AxiosRequestConfig): Promise<AxiosResponse<Array<Review>>> {
1172
1409
  return ReviewApiFp(configuration).getReviewsByUser(userId, options).then((request) => request(axios, basePath));
1173
1410
  },
1411
+ /**
1412
+ *
1413
+ * @summary Get all completed orders for the current user that can be reviewed
1414
+ * @param {*} [options] Override http request option.
1415
+ * @throws {RequiredError}
1416
+ */
1417
+ async getUserCompletedOrders(options?: AxiosRequestConfig): Promise<AxiosResponse<Array<CompletedOrderDto>>> {
1418
+ return ReviewApiFp(configuration).getUserCompletedOrders(options).then((request) => request(axios, basePath));
1419
+ },
1174
1420
  /**
1175
1421
  *
1176
1422
  * @summary Remove a reply from a review
@@ -1237,7 +1483,19 @@ export class ReviewApi extends BaseAPI {
1237
1483
  }
1238
1484
  /**
1239
1485
  *
1240
- * @summary Create a review
1486
+ * @summary Check if a product has been reviewed in an order
1487
+ * @param {string} orderId
1488
+ * @param {string} productVariantId
1489
+ * @param {*} [options] Override http request option.
1490
+ * @throws {RequiredError}
1491
+ * @memberof ReviewApi
1492
+ */
1493
+ public async checkReviewStatus(orderId: string, productVariantId: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<ReviewStatusDto>> {
1494
+ return ReviewApiFp(this.configuration).checkReviewStatus(orderId, productVariantId, options).then((request) => request(this.axios, this.basePath));
1495
+ }
1496
+ /**
1497
+ *
1498
+ * @summary Create a review for a product in a completed order
1241
1499
  * @param {CreateReviewDto} body
1242
1500
  * @param {string} orderId
1243
1501
  * @param {*} [options] Override http request option.
@@ -1257,6 +1515,17 @@ export class ReviewApi extends BaseAPI {
1257
1515
  public async getReviewCount(options?: AxiosRequestConfig) : Promise<AxiosResponse<number>> {
1258
1516
  return ReviewApiFp(this.configuration).getReviewCount(options).then((request) => request(this.axios, this.basePath));
1259
1517
  }
1518
+ /**
1519
+ *
1520
+ * @summary Get all reviewable products from a completed order
1521
+ * @param {string} orderId
1522
+ * @param {*} [options] Override http request option.
1523
+ * @throws {RequiredError}
1524
+ * @memberof ReviewApi
1525
+ */
1526
+ public async getReviewableProducts(orderId: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<ReviewableOrderDto>> {
1527
+ return ReviewApiFp(this.configuration).getReviewableProducts(orderId, options).then((request) => request(this.axios, this.basePath));
1528
+ }
1260
1529
  /**
1261
1530
  *
1262
1531
  * @summary Get all reviews by date
@@ -1334,6 +1603,16 @@ export class ReviewApi extends BaseAPI {
1334
1603
  public async getReviewsByUser(userId: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<Array<Review>>> {
1335
1604
  return ReviewApiFp(this.configuration).getReviewsByUser(userId, options).then((request) => request(this.axios, this.basePath));
1336
1605
  }
1606
+ /**
1607
+ *
1608
+ * @summary Get all completed orders for the current user that can be reviewed
1609
+ * @param {*} [options] Override http request option.
1610
+ * @throws {RequiredError}
1611
+ * @memberof ReviewApi
1612
+ */
1613
+ public async getUserCompletedOrders(options?: AxiosRequestConfig) : Promise<AxiosResponse<Array<CompletedOrderDto>>> {
1614
+ return ReviewApiFp(this.configuration).getUserCompletedOrders(options).then((request) => request(this.axios, this.basePath));
1615
+ }
1337
1616
  /**
1338
1617
  *
1339
1618
  * @summary Remove a reply from a review