commerce-kit 0.65.0 → 0.66.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.
package/dist/index.d.ts CHANGED
@@ -1,11 +1,17 @@
1
- import { APIMeGetResult, APISocialsGetResult, APIBrandsBrowseQueryParams, APIBrandsBrowseResult, APIBrandGetByIdParams, APIBrandGetByIdResult, APIBrandCreateBody, APIBrandCreateResult, APIBrandUpdateBody, APIBrandUpdateResult, APIBrandDeleteResult, APIBrandAssignProductsBody, APIBrandAssignProductsResult, APIOrderRefundsParams, APIOrderRefundsBrowseQueryParams, APIOrderRefundsBrowseResult, APIOrderRefundGetParams, APIOrderRefundGetResult, APIProductBatchBody, APIProductBatchResult, APICartDeleteResult, APIProductsBrowseQueryParams, APIProductsBrowseResult, APIProductFiltersResult, APIProductGetByIdParams, APIProductGetByIdQueryParams, APIProductGetByIdResult, APIOrdersBrowseQueryParams, APIOrdersBrowseResult, APIOrderGetByIdParams, APIOrderGetByIdResult, APICartCreateBody, APICartCreateResult, APICartGetResult, APICartCouponApplyResult, APICartCouponRemoveResult, APICouponsBrowseQueryParams, APICouponsBrowseResult, APICouponGetByIdParams, APICouponGetByIdResult, APICouponCreateBody, APICouponCreateResult, APICouponUpdateBody, APICouponUpdateResult, APICouponDeleteResult, APISupportCasesBrowseQueryParams, APISupportCasesBrowseResult, APISupportCaseGetParams, APISupportCaseGetResult, APISupportCaseCreateBody, APISupportCaseCreateResult, APISupportCaseUpdateBody, APISupportCaseUpdateResult, APISupportCaseMessageCreateBody, APISupportCaseMessageCreateResult, APICollectionGetByIdParams, APICollectionGetByIdResult, APICollectionsBrowseQueryParams, APICollectionsBrowseResult, APICollectionCreateBody, APICollectionCreateResult, APICollectionUpdateBody, APICollectionUpdateResult, APICollectionDeleteResult, APICategoryGetByIdParams, APICategoryGetByIdResult, APICategoriesBrowseQueryParams, APICategoriesBrowseResult, APIPostsBrowseQueryParams, APIPostsBrowseResult, APIPostGetByIdParams, APIPostGetByIdResult, APIPostCreateBody, APIPostCreateResult, APIPostUpdateBody, APIPostUpdateResult, APIPostDeleteResult, APIPostCommentsBrowseQueryParams, APIPostCommentsBrowseResult, APIPostCommentCreateBody, APIPostCommentCreateResult, APIBlogCategoriesBrowseQueryParams, APIBlogCategoriesBrowseResult, APIBlogCategoryGetByIdParams, APIBlogCategoryGetByIdResult, APIBlogCategoryCreateBody, APIBlogCategoryCreateResult, APIBlogCategoryUpdateBody, APIBlogCategoryUpdateResult, APIBlogCategoryDeleteResult, APICustomersBrowseQueryParams, APICustomersBrowseResult, APICustomerGetByIdParams, APICustomerGetByIdResult, APICustomerUpdateBody, APICustomerUpdateResult, APICustomerAddressCreateBody, APICustomerAddressCreateResult, APICustomerOrdersBrowseQueryParams, APICustomerOrdersBrowseResult, APIInventoryBrowseQueryParams, APIInventoryBrowseResult, APIInventoryAdjustBody, APIInventoryAdjustResult, APIVariantGetByIdParams, APIVariantGetByIdResult, APIVariantUpdateBody, APIVariantUpdateResult, APIVariantCreateBody, APIVariantCreateResult, APISubscriberCreateBody, APISubscriberCreateResult, APISubscriberDeleteResult, APIContactMessageCreateBody, APIContactMessageCreateResult, APIProductCreateBody, APIProductCreateResult, APIProductUpdateBody, APIProductUpdateResult, APIProductDeleteResult, APIProductReviewsBrowseQueryParams, APIProductReviewsBrowseResult, APIProductReviewCreateBody, APIProductReviewCreateResult, APIEventsBrowseQueryParams, APIEventsBrowseResult, APIEventGetByIdParams, APIEventGetByIdResult, APIEventCreateBody, APIEventCreateResult, APIEventUpdateBody, APIEventUpdateResult, APIEventAttendeesBrowseResult, APITicketsGetResult, APITicketsUpdateBody, APITicketsUpdateResult, APITicketAttendeeGetResult, APICategoryCreateBody, APICategoryCreateResult, APICategoryUpdateBody, APICategoryUpdateResult, APICategoryDeleteResult, APIOrderUpdateBody, APIOrderUpdateResult, APILegalPagesBrowseQueryParams, APILegalPagesBrowseResult, APILegalPageGetByPathQueryParams, APILegalPageGetByPathResult, APILegalPageCreateBody, APILegalPageCreateQueryParams, APILegalPageCreateResult, APILegalPageUpdateBody, APILegalPageUpdateQueryParams, APILegalPageUpdateResult, APISearchQueryParams, APISearchResult, APIInstaviewImagesBrowseParams, APIInstaviewImagesBrowseQueryParams, APIInstaviewImagesBrowseResult } from './api-types.js';
2
- export { APICartAddBody, APICartAddResult, APICartCouponApplyBody, APICartRemoveItemQueryParams, APICartRemoveItemResult, APICategoryGetByIdQueryParams, APICategoryUpdateQueryParams, APICollectionGetByIdQueryParams, APILegalPageGetByPathParams, APIMeStore, APIProductDeleteQueryParams, APIProductUpdateQueryParams, APIShipment, APISupportCase, APISupportCaseMessage, APITicketAttendeeGetParams, APITicketsGetParams, APITicketsGetQueryParams, APIVariantGetByIdQueryParams, JSONContent } from './api-types.js';
1
+ import { APIMeGetResult, APISocialsGetResult, APIBrandsBrowseQueryParams, APIBrandsBrowseResult, APIBrandGetByIdParams, APIBrandGetByIdResult, APIBrandCreateBody, APIBrandCreateResult, APIBrandUpdateBody, APIBrandUpdateResult, APIBrandDeleteResult, APIBrandAssignProductsBody, APIBrandAssignProductsResult, APIOrderRefundsParams, APIOrderRefundsBrowseQueryParams, APIOrderRefundsBrowseResult, APIOrderRefundGetParams, APIOrderRefundGetResult, APIProductBatchBody, APIProductBatchResult, APICartDeleteResult, APIProductsBrowseQueryParams, APIProductsBrowseResult, APIProductFiltersQueryParams, APIProductFiltersResult, APIProductGetByIdParams, APIProductGetByIdQueryParams, APIProductGetByIdResult, APIOrdersBrowseQueryParams, APIOrdersBrowseResult, APIOrderGetByIdParams, APIOrderGetByIdResult, APICartCreateBody, APICartCreateResult, APICartGetResult, APICartCouponApplyResult, APICartCouponRemoveResult, APICouponsBrowseQueryParams, APICouponsBrowseResult, APICouponGetByIdParams, APICouponGetByIdResult, APICouponCreateBody, APICouponCreateResult, APICouponUpdateBody, APICouponUpdateResult, APICouponDeleteResult, APISupportCasesBrowseQueryParams, APISupportCasesBrowseResult, APISupportCaseGetParams, APISupportCaseGetResult, APISupportCaseCreateBody, APISupportCaseCreateResult, APISupportCaseUpdateBody, APISupportCaseUpdateResult, APISupportCaseMessageCreateBody, APISupportCaseMessageCreateResult, APICollectionGetByIdParams, APICollectionGetByIdResult, APICollectionsBrowseQueryParams, APICollectionsBrowseResult, APICollectionCreateBody, APICollectionCreateResult, APICollectionUpdateBody, APICollectionUpdateResult, APICollectionDeleteResult, APICategoryGetByIdParams, APICategoryGetByIdResult, APICategoriesBrowseQueryParams, APICategoriesBrowseResult, APIPostsBrowseQueryParams, APIPostsBrowseResult, APIPostGetByIdParams, APIPostGetByIdResult, APIPostCreateBody, APIPostCreateResult, APIPostUpdateBody, APIPostUpdateResult, APIPostDeleteResult, APIPostCommentsBrowseQueryParams, APIPostCommentsBrowseResult, APIPostCommentCreateBody, APIPostCommentCreateResult, APIBlogCategoriesBrowseQueryParams, APIBlogCategoriesBrowseResult, APIBlogCategoryGetByIdParams, APIBlogCategoryGetByIdResult, APIBlogCategoryCreateBody, APIBlogCategoryCreateResult, APIBlogCategoryUpdateBody, APIBlogCategoryUpdateResult, APIBlogCategoryDeleteResult, APICustomersBrowseQueryParams, APICustomersBrowseResult, APICustomerGetByIdParams, APICustomerGetByIdResult, APICustomerUpdateBody, APICustomerUpdateResult, APICustomerAddressCreateBody, APICustomerAddressCreateResult, APICustomerOrdersBrowseQueryParams, APICustomerOrdersBrowseResult, APIInventoryBrowseQueryParams, APIInventoryBrowseResult, APIInventoryAdjustBody, APIInventoryAdjustResult, APIVariantGetByIdParams, APIVariantGetByIdResult, APIVariantUpdateBody, APIVariantUpdateResult, APIVariantCreateBody, APIVariantCreateResult, APISubscriberCreateBody, APISubscriberCreateResult, APISubscriberDeleteResult, APIContactMessageCreateBody, APIContactMessageCreateResult, APIProductCreateBody, APIProductCreateResult, APIProductUpdateBody, APIProductUpdateResult, APIProductDeleteResult, APIMetafieldDefinitionsBrowseQueryParams, APIMetafieldDefinitionsBrowseResult, APIMetafieldDefinitionParams, APIMetafieldDefinitionGetQueryParams, APIMetafieldDefinitionGetResult, APIMetafieldDefinitionCreateBody, APIMetafieldDefinitionCreateResult, APIMetafieldDefinitionUpdateBody, APIMetafieldDefinitionUpdateResult, APIMetafieldDefinitionArchiveResult, APIMetafieldDefinitionRestoreResult, APIMetafieldDefinitionDeleteBody, APIMetafieldDefinitionDeleteResult, APIMetafieldDefinitionConversionPreviewResult, APIMetafieldDefinitionConvertBody, APIMetafieldDefinitionConvertResult, APIMetafieldDefinitionTranslationParams, APIMetafieldDefinitionTranslationPutBody, APIMetafieldDefinitionTranslationPutResult, APIProductMetafieldTranslationsPutParams, APIMetafieldTranslationsPutBody, APIProductMetafieldTranslationsPutResult, APIVariantMetafieldTranslationsPutParams, APIVariantMetafieldTranslationsPutResult, APIMetafieldsTranslateMissingBody, APIMetafieldsTranslateMissingResult, APIProductReviewsBrowseQueryParams, APIProductReviewsBrowseResult, APIProductReviewCreateBody, APIProductReviewCreateResult, APIEventsBrowseQueryParams, APIEventsBrowseResult, APIEventGetByIdParams, APIEventGetByIdResult, APIEventCreateBody, APIEventCreateResult, APIEventUpdateBody, APIEventUpdateResult, APIEventAttendeesBrowseResult, APITicketsGetResult, APITicketsUpdateBody, APITicketsUpdateResult, APITicketAttendeeGetResult, APICategoryCreateBody, APICategoryCreateResult, APICategoryUpdateBody, APICategoryUpdateResult, APICategoryDeleteResult, APIOrderUpdateBody, APIOrderUpdateResult, APILegalPagesBrowseQueryParams, APILegalPagesBrowseResult, APILegalPageGetByPathQueryParams, APILegalPageGetByPathResult, APILegalPageCreateBody, APILegalPageCreateQueryParams, APILegalPageCreateResult, APILegalPageUpdateBody, APILegalPageUpdateQueryParams, APILegalPageUpdateResult, APISearchQueryParams, APISearchResult, APIInstaviewImagesBrowseParams, APIInstaviewImagesBrowseQueryParams, APIInstaviewImagesBrowseResult } from './api-types.js';
2
+ export { APICartAddBody, APICartAddResult, APICartCouponApplyBody, APICartRemoveItemQueryParams, APICartRemoveItemResult, APICategoryGetByIdQueryParams, APICategoryUpdateQueryParams, APICollectionGetByIdQueryParams, APILegalPageGetByPathParams, APIMeStore, APIMetafieldDefinition, APIMetafieldValueInput, APIProductDeleteQueryParams, APIProductUpdateQueryParams, APIShipment, APISupportCase, APISupportCaseMessage, APITicketAttendeeGetParams, APITicketsGetParams, APITicketsGetQueryParams, APIVariantGetByIdQueryParams, JSONContent } from './api-types.js';
3
3
 
4
4
  interface CommerceConfig {
5
5
  /** API key. Defaults to process.env.YNS_API_KEY */
6
6
  token?: string;
7
7
  endpoint?: string;
8
8
  version?: "v1";
9
+ /**
10
+ * Store id. Lets catalog reads go out without the key, so the platform's CDN can answer them.
11
+ * Defaults to process.env.YNS_STORE_ID, then to the store the key belongs to.
12
+ * Pass `false` to send the key on every request.
13
+ */
14
+ store?: string | false;
9
15
  }
10
16
 
11
17
  type APICollectionImportMembershipsBody = {
@@ -43,14 +49,18 @@ declare class YNSProvider {
43
49
  productBrowse(params: APIProductsBrowseQueryParams): Promise<APIProductsBrowseResult>;
44
50
  /**
45
51
  * Available storefront filter facets for the store: price bounds, variant
46
- * types/values, and active categories, collections, and brands. Pair with
47
- * `productBrowse`'s `collection`, `brand`, `priceMin`/`priceMax`, and `vts`
48
- * params to build a filter UI.
52
+ * types/values, active categories, collections and brands, and the filterable custom
53
+ * fields (`metafields`, present only when the store has any) with their options or
54
+ * number range. Pair with `productBrowse`'s `collection`, `brand`, `priceMin`/`priceMax`,
55
+ * `vts` and `filter` params to build a filter UI. `lang` translates field names and
56
+ * option labels.
49
57
  */
50
- productFilters(): Promise<APIProductFiltersResult>;
58
+ productFilters(params?: APIProductFiltersQueryParams): Promise<APIProductFiltersResult>;
51
59
  /**
52
60
  * A single product by id or slug. `lang` selects the translation (and resolves a translated
53
- * slug); `currency` prices the variants in that currency, twins included.
61
+ * slug); `currency` prices the variants in that currency, twins included. The product and
62
+ * its variants carry their custom fields under `metafields`; `metafields: "all"` adds the
63
+ * private ones (needs a key with `catalog:write`; refused without a key).
54
64
  */
55
65
  productGet(params: APIProductGetByIdParams & APIProductGetByIdQueryParams): Promise<APIProductGetByIdResult | null>;
56
66
  orderBrowse(params: APIOrdersBrowseQueryParams): Promise<APIOrdersBrowseResult>;
@@ -149,6 +159,45 @@ declare class YNSProvider {
149
159
  productCreate(body: APIProductCreateBody): Promise<APIProductCreateResult>;
150
160
  productUpdate(params: APIProductGetByIdParams, body: APIProductUpdateBody): Promise<APIProductUpdateResult>;
151
161
  productDelete(params: APIProductGetByIdParams): Promise<APIProductDeleteResult>;
162
+ /** The store's fields, in display order. Archived ones only with `includeArchived: "true"`. */
163
+ metafieldDefinitionBrowse(params?: APIMetafieldDefinitionsBrowseQueryParams): Promise<APIMetafieldDefinitionsBrowseResult>;
164
+ /** One field, by id or by its address `<ownerType>.<namespace>.<key>`, e.g. `product.custom.material`. */
165
+ metafieldDefinitionGet(params: APIMetafieldDefinitionParams & APIMetafieldDefinitionGetQueryParams): Promise<APIMetafieldDefinitionGetResult | null>;
166
+ metafieldDefinitionCreate(body: APIMetafieldDefinitionCreateBody): Promise<APIMetafieldDefinitionCreateResult>;
167
+ /** Name, description, switches, options, limits. The kind of value cannot change here. */
168
+ metafieldDefinitionUpdate(params: APIMetafieldDefinitionParams, body: APIMetafieldDefinitionUpdateBody): Promise<APIMetafieldDefinitionUpdateResult>;
169
+ /**
170
+ * Archive: the field leaves the admin, the storefront and the API, every value is kept.
171
+ * `metafieldDefinitionRestore` brings it back; `metafieldDefinitionDelete` removes it for good.
172
+ */
173
+ metafieldDefinitionArchive(params: APIMetafieldDefinitionParams): Promise<APIMetafieldDefinitionArchiveResult>;
174
+ metafieldDefinitionRestore(params: APIMetafieldDefinitionParams): Promise<APIMetafieldDefinitionRestoreResult>;
175
+ /**
176
+ * Delete an ARCHIVED field for good, with every value and translation it holds. `confirm`
177
+ * repeats the field's key and `expectedValueCount` the number of values it holds (a 409
178
+ * tells the real count); both guard against deleting the wrong field.
179
+ */
180
+ metafieldDefinitionDelete(params: APIMetafieldDefinitionParams, body: APIMetafieldDefinitionDeleteBody): Promise<APIMetafieldDefinitionDeleteResult>;
181
+ /**
182
+ * What turning a text field into a choice would do: every distinct value in use and a
183
+ * suggested grouping into options. Hand the groups and the `planHash` to
184
+ * `metafieldDefinitionConvertToChoice`.
185
+ */
186
+ metafieldDefinitionConversionPreview(params: APIMetafieldDefinitionParams): Promise<APIMetafieldDefinitionConversionPreviewResult>;
187
+ /** In place: the field keeps its key and id, each value becomes the option of its group. */
188
+ metafieldDefinitionConvertToChoice(params: APIMetafieldDefinitionParams, body: APIMetafieldDefinitionConvertBody): Promise<APIMetafieldDefinitionConvertResult>;
189
+ /** The field's name, description and option labels in one language. `null` clears a part. */
190
+ metafieldDefinitionTranslationPut(params: APIMetafieldDefinitionTranslationParams, body: APIMetafieldDefinitionTranslationPutBody): Promise<APIMetafieldDefinitionTranslationPutResult>;
191
+ /** Translated values of a product's fields in one language. `value: null` removes one. */
192
+ productMetafieldTranslationsPut(params: APIProductMetafieldTranslationsPutParams, body: APIMetafieldTranslationsPutBody): Promise<APIProductMetafieldTranslationsPutResult>;
193
+ /** Translated values of a variant's fields in one language. `value: null` removes one. */
194
+ variantMetafieldTranslationsPut(params: APIVariantMetafieldTranslationsPutParams, body: APIMetafieldTranslationsPutBody): Promise<APIVariantMetafieldTranslationsPutResult>;
195
+ /**
196
+ * Machine-translate the field values that have no translation yet. Translations a person
197
+ * wrote are never replaced. With `productIds` it runs right away and returns what it wrote;
198
+ * without, it starts a background run over the whole catalogue (answered 202 with a `runId`).
199
+ */
200
+ metafieldsTranslateMissing(body?: APIMetafieldsTranslateMissingBody): Promise<APIMetafieldsTranslateMissingResult>;
152
201
  productReviewsBrowse(params: APIProductGetByIdParams, queryParams?: APIProductReviewsBrowseQueryParams): Promise<APIProductReviewsBrowseResult>;
153
202
  productReviewCreate(params: APIProductGetByIdParams, body: APIProductReviewCreateBody): Promise<APIProductReviewCreateResult>;
154
203
  eventBrowse(params?: APIEventsBrowseQueryParams): Promise<APIEventsBrowseResult>;
@@ -222,4 +271,4 @@ declare class YNSProvider {
222
271
 
223
272
  declare function Commerce(config?: CommerceConfig): YNSProvider;
224
273
 
225
- export { APIBlogCategoriesBrowseQueryParams, APIBlogCategoriesBrowseResult, APIBlogCategoryCreateBody, APIBlogCategoryCreateResult, APIBlogCategoryDeleteResult, APIBlogCategoryGetByIdParams, APIBlogCategoryGetByIdResult, APIBlogCategoryUpdateBody, APIBlogCategoryUpdateResult, APIBrandAssignProductsBody, APIBrandAssignProductsResult, APIBrandCreateBody, APIBrandCreateResult, APIBrandDeleteResult, APIBrandGetByIdParams, APIBrandGetByIdResult, APIBrandUpdateBody, APIBrandUpdateResult, APIBrandsBrowseQueryParams, APIBrandsBrowseResult, APICartCouponApplyResult, APICartCouponRemoveResult, APICartCreateBody, APICartCreateResult, APICartDeleteResult, APICartGetResult, APICategoriesBrowseQueryParams, APICategoriesBrowseResult, APICategoryCreateBody, APICategoryCreateResult, APICategoryDeleteResult, APICategoryGetByIdParams, APICategoryGetByIdResult, APICategoryUpdateBody, APICategoryUpdateResult, APICollectionCreateBody, APICollectionCreateResult, APICollectionDeleteResult, APICollectionGetByIdParams, APICollectionGetByIdResult, type APICollectionImportMembershipsBody, type APICollectionImportMembershipsResult, APICollectionUpdateBody, APICollectionUpdateResult, APICollectionsBrowseQueryParams, APICollectionsBrowseResult, APIContactMessageCreateBody, APIContactMessageCreateResult, APICouponCreateBody, APICouponCreateResult, APICouponDeleteResult, APICouponGetByIdParams, APICouponGetByIdResult, APICouponUpdateBody, APICouponUpdateResult, APICouponsBrowseQueryParams, APICouponsBrowseResult, APICustomerAddressCreateBody, APICustomerAddressCreateResult, APICustomerGetByIdParams, APICustomerGetByIdResult, APICustomerOrdersBrowseQueryParams, APICustomerOrdersBrowseResult, APICustomerUpdateBody, APICustomerUpdateResult, APICustomersBrowseQueryParams, APICustomersBrowseResult, APIEventAttendeesBrowseResult, APIEventCreateBody, APIEventCreateResult, APIEventGetByIdParams, APIEventGetByIdResult, APIEventUpdateBody, APIEventUpdateResult, APIEventsBrowseQueryParams, APIEventsBrowseResult, APIInstaviewImagesBrowseParams, APIInstaviewImagesBrowseQueryParams, APIInstaviewImagesBrowseResult, APIInventoryAdjustBody, APIInventoryAdjustResult, APIInventoryBrowseQueryParams, APIInventoryBrowseResult, APILegalPageCreateBody, APILegalPageCreateQueryParams, APILegalPageCreateResult, APILegalPageGetByPathQueryParams, APILegalPageGetByPathResult, APILegalPageUpdateBody, APILegalPageUpdateQueryParams, APILegalPageUpdateResult, APILegalPagesBrowseQueryParams, APILegalPagesBrowseResult, APIMeGetResult, APIOrderGetByIdParams, APIOrderGetByIdResult, APIOrderRefundGetParams, APIOrderRefundGetResult, APIOrderRefundsBrowseQueryParams, APIOrderRefundsBrowseResult, APIOrderRefundsParams, APIOrderUpdateBody, APIOrderUpdateResult, APIOrdersBrowseQueryParams, APIOrdersBrowseResult, APIPostCommentCreateBody, APIPostCommentCreateResult, APIPostCommentsBrowseQueryParams, APIPostCommentsBrowseResult, APIPostCreateBody, APIPostCreateResult, APIPostDeleteResult, APIPostGetByIdParams, APIPostGetByIdResult, APIPostUpdateBody, APIPostUpdateResult, APIPostsBrowseQueryParams, APIPostsBrowseResult, APIProductBatchBody, APIProductBatchResult, APIProductCreateBody, APIProductCreateResult, APIProductDeleteResult, APIProductFiltersResult, APIProductGetByIdParams, APIProductGetByIdQueryParams, APIProductGetByIdResult, APIProductReviewCreateBody, APIProductReviewCreateResult, APIProductReviewsBrowseQueryParams, APIProductReviewsBrowseResult, APIProductUpdateBody, APIProductUpdateResult, APIProductsBrowseQueryParams, APIProductsBrowseResult, APISearchQueryParams, APISearchResult, APISocialsGetResult, APISubscriberCreateBody, APISubscriberCreateResult, APISubscriberDeleteResult, APISupportCaseCreateBody, APISupportCaseCreateResult, APISupportCaseGetParams, APISupportCaseGetResult, APISupportCaseMessageCreateBody, APISupportCaseMessageCreateResult, APISupportCaseUpdateBody, APISupportCaseUpdateResult, APISupportCasesBrowseQueryParams, APISupportCasesBrowseResult, APITicketAttendeeGetResult, APITicketsGetResult, APITicketsUpdateBody, APITicketsUpdateResult, APIVariantCreateBody, APIVariantCreateResult, APIVariantGetByIdParams, APIVariantGetByIdResult, APIVariantUpdateBody, APIVariantUpdateResult, Commerce, type CommerceConfig, YNSProvider };
274
+ export { APIBlogCategoriesBrowseQueryParams, APIBlogCategoriesBrowseResult, APIBlogCategoryCreateBody, APIBlogCategoryCreateResult, APIBlogCategoryDeleteResult, APIBlogCategoryGetByIdParams, APIBlogCategoryGetByIdResult, APIBlogCategoryUpdateBody, APIBlogCategoryUpdateResult, APIBrandAssignProductsBody, APIBrandAssignProductsResult, APIBrandCreateBody, APIBrandCreateResult, APIBrandDeleteResult, APIBrandGetByIdParams, APIBrandGetByIdResult, APIBrandUpdateBody, APIBrandUpdateResult, APIBrandsBrowseQueryParams, APIBrandsBrowseResult, APICartCouponApplyResult, APICartCouponRemoveResult, APICartCreateBody, APICartCreateResult, APICartDeleteResult, APICartGetResult, APICategoriesBrowseQueryParams, APICategoriesBrowseResult, APICategoryCreateBody, APICategoryCreateResult, APICategoryDeleteResult, APICategoryGetByIdParams, APICategoryGetByIdResult, APICategoryUpdateBody, APICategoryUpdateResult, APICollectionCreateBody, APICollectionCreateResult, APICollectionDeleteResult, APICollectionGetByIdParams, APICollectionGetByIdResult, type APICollectionImportMembershipsBody, type APICollectionImportMembershipsResult, APICollectionUpdateBody, APICollectionUpdateResult, APICollectionsBrowseQueryParams, APICollectionsBrowseResult, APIContactMessageCreateBody, APIContactMessageCreateResult, APICouponCreateBody, APICouponCreateResult, APICouponDeleteResult, APICouponGetByIdParams, APICouponGetByIdResult, APICouponUpdateBody, APICouponUpdateResult, APICouponsBrowseQueryParams, APICouponsBrowseResult, APICustomerAddressCreateBody, APICustomerAddressCreateResult, APICustomerGetByIdParams, APICustomerGetByIdResult, APICustomerOrdersBrowseQueryParams, APICustomerOrdersBrowseResult, APICustomerUpdateBody, APICustomerUpdateResult, APICustomersBrowseQueryParams, APICustomersBrowseResult, APIEventAttendeesBrowseResult, APIEventCreateBody, APIEventCreateResult, APIEventGetByIdParams, APIEventGetByIdResult, APIEventUpdateBody, APIEventUpdateResult, APIEventsBrowseQueryParams, APIEventsBrowseResult, APIInstaviewImagesBrowseParams, APIInstaviewImagesBrowseQueryParams, APIInstaviewImagesBrowseResult, APIInventoryAdjustBody, APIInventoryAdjustResult, APIInventoryBrowseQueryParams, APIInventoryBrowseResult, APILegalPageCreateBody, APILegalPageCreateQueryParams, APILegalPageCreateResult, APILegalPageGetByPathQueryParams, APILegalPageGetByPathResult, APILegalPageUpdateBody, APILegalPageUpdateQueryParams, APILegalPageUpdateResult, APILegalPagesBrowseQueryParams, APILegalPagesBrowseResult, APIMeGetResult, APIMetafieldDefinitionArchiveResult, APIMetafieldDefinitionConversionPreviewResult, APIMetafieldDefinitionConvertBody, APIMetafieldDefinitionConvertResult, APIMetafieldDefinitionCreateBody, APIMetafieldDefinitionCreateResult, APIMetafieldDefinitionDeleteBody, APIMetafieldDefinitionDeleteResult, APIMetafieldDefinitionGetQueryParams, APIMetafieldDefinitionGetResult, APIMetafieldDefinitionParams, APIMetafieldDefinitionRestoreResult, APIMetafieldDefinitionTranslationParams, APIMetafieldDefinitionTranslationPutBody, APIMetafieldDefinitionTranslationPutResult, APIMetafieldDefinitionUpdateBody, APIMetafieldDefinitionUpdateResult, APIMetafieldDefinitionsBrowseQueryParams, APIMetafieldDefinitionsBrowseResult, APIMetafieldTranslationsPutBody, APIMetafieldsTranslateMissingBody, APIMetafieldsTranslateMissingResult, APIOrderGetByIdParams, APIOrderGetByIdResult, APIOrderRefundGetParams, APIOrderRefundGetResult, APIOrderRefundsBrowseQueryParams, APIOrderRefundsBrowseResult, APIOrderRefundsParams, APIOrderUpdateBody, APIOrderUpdateResult, APIOrdersBrowseQueryParams, APIOrdersBrowseResult, APIPostCommentCreateBody, APIPostCommentCreateResult, APIPostCommentsBrowseQueryParams, APIPostCommentsBrowseResult, APIPostCreateBody, APIPostCreateResult, APIPostDeleteResult, APIPostGetByIdParams, APIPostGetByIdResult, APIPostUpdateBody, APIPostUpdateResult, APIPostsBrowseQueryParams, APIPostsBrowseResult, APIProductBatchBody, APIProductBatchResult, APIProductCreateBody, APIProductCreateResult, APIProductDeleteResult, APIProductFiltersQueryParams, APIProductFiltersResult, APIProductGetByIdParams, APIProductGetByIdQueryParams, APIProductGetByIdResult, APIProductMetafieldTranslationsPutParams, APIProductMetafieldTranslationsPutResult, APIProductReviewCreateBody, APIProductReviewCreateResult, APIProductReviewsBrowseQueryParams, APIProductReviewsBrowseResult, APIProductUpdateBody, APIProductUpdateResult, APIProductsBrowseQueryParams, APIProductsBrowseResult, APISearchQueryParams, APISearchResult, APISocialsGetResult, APISubscriberCreateBody, APISubscriberCreateResult, APISubscriberDeleteResult, APISupportCaseCreateBody, APISupportCaseCreateResult, APISupportCaseGetParams, APISupportCaseGetResult, APISupportCaseMessageCreateBody, APISupportCaseMessageCreateResult, APISupportCaseUpdateBody, APISupportCaseUpdateResult, APISupportCasesBrowseQueryParams, APISupportCasesBrowseResult, APITicketAttendeeGetResult, APITicketsGetResult, APITicketsUpdateBody, APITicketsUpdateResult, APIVariantCreateBody, APIVariantCreateResult, APIVariantGetByIdParams, APIVariantGetByIdResult, APIVariantMetafieldTranslationsPutParams, APIVariantMetafieldTranslationsPutResult, APIVariantUpdateBody, APIVariantUpdateResult, Commerce, type CommerceConfig, YNSProvider };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import"./chunk-PNKB6P4V.js";var p=process.env.YNS_API_KEY,y={YNS_API_KEY:p};var P={DEBUG:0,LOG:1,WARN:2,ERROR:3},g=process.env.NEXT_PUBLIC_LOG_LEVEL||"LOG",u=P[g],d="\x1B[0m",C="\x1B[34m",B="\x1B[32m",R="\x1B[33m",h="\x1B[31m",f="\u23F1\uFE0F",w="\u{1F41B}",S="\u2714\uFE0F",G="\u26A0\uFE0F",$="\u274C",m=`${f} `,v=`${C}${w}${d} `,E=`${B}${S}${d} `,U=`${R}${G}${d} `,O=`${h}${$}${d} `,I=c=>{let e=c?`[${c}] `:"";return{getLogger(t){return I([c,t].filter(Boolean).join(" > "))},time(t){u>P.DEBUG||console.time([m,e,t].filter(Boolean).join(" "))},timeEnd(t){u>P.DEBUG||console.timeEnd([m,e,t].filter(Boolean).join(" "))},debug(...t){u>P.DEBUG||console.log(...[v,e,...t].filter(Boolean))},log(...t){u>P.LOG||console.log(...[E,e,...t].filter(Boolean))},dir(t,s){u>P.LOG||console.dir(t,s)},warn(...t){u>P.WARN||console.warn(...[U,e,...t].filter(Boolean))},error(...t){u>P.ERROR||console.error(...[O,e,...t].filter(Boolean))}}},L=I();var l=class{#s;#t=I("YNSProvider");constructor(e={}){let t=e.token??y.YNS_API_KEY,s=y.YNS_API_KEY?.startsWith("sk-s-");if(!t)throw new Error("YNS API key is required. Set YNS_API_KEY environment variable or pass token in config.");let r=e.endpoint??(s?"https://yns.cx":"https://yns.store");this.#s={version:"v1",...e,token:t,endpoint:r},this.#t.debug("YNSProvider initialized",{endpoint:r,token:e.token?"from config":"from env"})}async#e(e,t="GET",s){let r=await this.#o(e,t,s);return this.#a(r,e,t)}async#r(e){let t=await this.#o(e,"GET");return t.status===404?null:this.#a(t,e,"GET")}async#o(e,t,s){let r=this.#t.getLogger("#restRequest"),o=`${this.#s.endpoint}/api/${this.#s.version}${e}`;return r.debug(`Making ${t} request to YNS API: ${o}`),fetch(o,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.#s.token}`},body:s?JSON.stringify(s):void 0})}async#a(e,t,s){let r=this.#t.getLogger("#restRequest"),o=`${this.#s.endpoint}/api/${this.#s.version}${t}`;if(!e.ok){let A=e.headers.get("content-type"),i=`YNS REST request failed: ${s} ${o} ${e.status} ${e.statusText}`;if(A?.includes("application/json"))try{let n=await e.json();i=n.error||n.message||i}catch(n){r.error("Failed to parse YNS error response as JSON",n)}else{let n=await e.text();r.error(`YNS API request failed: ${e.status} ${e.statusText}`,i,n)}throw new Error(i)}let a=e.headers.get("content-type");if(!a?.includes("application/json"))throw new Error(`YNS API returned ${a} instead of JSON for ${t}`);return e.json()}async#n(e,t){let s=this.#t.getLogger("#multipartRequest"),r=`${this.#s.endpoint}/api/${this.#s.version}${e}`;s.debug(`Making multipart POST to YNS API: ${r}`);let o=await fetch(r,{method:"POST",headers:{Authorization:`Bearer ${this.#s.token}`},body:t});if(!o.ok){let A=o.headers.get("content-type"),i=`YNS REST request failed: POST ${r} ${o.status} ${o.statusText}`;if(A?.includes("application/json"))try{let n=await o.json();i=n.error||n.message||i}catch(n){s.error("Failed to parse YNS error response as JSON",n)}else{let n=await o.text();s.error(`YNS API request failed: ${o.status} ${o.statusText}`,i,n)}throw new Error(i)}let a=o.headers.get("content-type");if(!a?.includes("application/json"))throw new Error(`YNS API returned ${a} instead of JSON for ${e}`);return o.json()}async meGet(){let e=this.#t.getLogger("meGet");e.debug("Fetching my information");let s=await this.#e("/me");return e.debug("Received my information:",s),s}async socialsGet(){let e=this.#t.getLogger("socialsGet");e.debug("Fetching store social links");let s=await this.#e("/socials");return e.debug("Received store social links:",s),s}async brandBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString()),e.lang&&t.append("lang",e.lang);let r=`/brands${t.size?`?${t}`:""}`;return this.#e(r)}async brandGet(e){let t=`/brands/${e.idOrSlug}`;return this.#e(t)}async brandCreate(e){return this.#e("/brands","POST",e)}async brandUpdate(e,t){let s=`/brands/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async brandDelete(e){let t=`/brands/${e.idOrSlug}`;return this.#e(t,"DELETE")}async brandAssignProducts(e,t){let s=`/brands/${e.idOrSlug}/products`;return this.#e(s,"POST",t)}async orderRefundsBrowse(e){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString());let s=t.size?`?${t}`:"",r=`/orders/${e.id}/refunds${s}`;return this.#e(r)}async orderRefundGet(e){let t=`/orders/${e.id}/refunds/${e.refundId}`;return this.#e(t)}async productBatch(e){return this.#e("/products/batch","POST",e)}async cartDelete(e){let t=`/carts/${e.cartId}`;return this.#e(t,"DELETE")}async productBrowse(e){let t=this.#t.getLogger("productBrowse");t.debug("Browsing products with params:",e);let s=new URLSearchParams;e.limit&&s.append("limit",e.limit.toString()),e.offset&&s.append("offset",e.offset.toString()),e.category&&s.append("category",e.category),e.collection&&s.append("collection",e.collection),e.brand&&s.append("brand",e.brand),e.priceMin!==void 0&&s.append("priceMin",e.priceMin.toString()),e.priceMax!==void 0&&s.append("priceMax",e.priceMax.toString()),e.vts&&s.append("vts",e.vts),e.query&&s.append("query",e.query),e.active!==void 0&&s.append("active",e.active.toString()),e.orderBy&&s.append("orderBy",e.orderBy),e.orderDirection&&s.append("orderDirection",e.orderDirection),e.currency&&s.append("currency",e.currency),e.lang&&s.append("lang",e.lang);let o=`/products${s.size?`?${s}`:""}`;t.debug("Constructed pathname:",o);let a=await this.#e(o);return t.debug("Received product browse result:",{meta:a.meta}),a}async productFilters(){return await this.#e("/products/filters")}async productGet(e){let t=new URLSearchParams;e.lang&&t.append("lang",e.lang),e.currency&&t.append("currency",e.currency);let s=t.size?`?${t}`:"",r=`/products/${e.idOrSlug}${s}`,o=await this.#e(r);return o||null}async orderBrowse(e){let t=this.#t.getLogger("orderBrowse");t.debug("Browsing orders with params:",e);let s=new URLSearchParams;e.limit&&s.append("limit",e.limit.toString()),e.offset&&s.append("offset",e.offset.toString());let o=`/orders${s.size?`?${s}`:""}`;t.debug("Constructed pathname:",o);let a=await this.#e(o);return t.debug("Received orders browse result:",{meta:a.meta}),a}async orderGet(e){let t=`/orders/${e.id}`,s=await this.#e(t);return s||null}async cartUpsert(e){return await this.#e("/carts","POST",e)}async cartAddBundle(e){let t={bundleId:e.bundleId,selections:e.selections,...e.cartId?{cartId:e.cartId}:{},...e.currency?{currency:e.currency}:{}};return await this.#e("/carts","POST",t)}async cartRemoveItem(e){let t=`/carts/${e.cartId}/line-items/${e.variantId}`;return this.#e(t,"DELETE")}async cartGet(e){let t=`/carts/${e.cartId}`;return await this.#e(t)}async cartCouponApply(e){let t=`/carts/${e.cartId}/coupon`;return this.#e(t,"POST",{code:e.code})}async cartCouponRemove(e){let t=`/carts/${e.cartId}/coupon`;return this.#e(t,"DELETE")}async couponBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query);let r=`/coupons${t.size?`?${t}`:""}`;return this.#e(r)}async couponGet(e){let t=`/coupons/${e.idOrCode}`;return this.#r(t)}async couponCreate(e){return this.#e("/coupons","POST",e)}async couponUpdate(e,t){let s=`/coupons/${e.idOrCode}`;return this.#e(s,"PATCH",t)}async couponDelete(e){let t=`/coupons/${e.idOrCode}`;return this.#e(t,"DELETE")}async supportCaseBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.status&&t.append("status",e.status),e.severity&&t.append("severity",e.severity);let r=`/support-cases${t.size?`?${t}`:""}`;return this.#e(r)}async supportCaseGet(e){let t=`/support-cases/${e.idOrNumber}`;return this.#r(t)}async supportCaseCreate(e){return this.#e("/support-cases","POST",e)}async supportCaseUpdate(e,t){let s=`/support-cases/${e.idOrNumber}`;return this.#e(s,"PATCH",t)}async supportCaseReply(e,t){let s=`/support-cases/${e.idOrNumber}/messages`;return this.#e(s,"POST",t)}async collectionGet(e){let t=`/collections/${e.idOrSlug}`;return await this.#e(t)}async collectionBrowse(e){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString()),e.group&&t.append("group",e.group);let r=`/collections${t.size?`?${t}`:""}`;return await this.#e(r)}async collectionCreate(e){return this.#e("/collections","POST",e)}async collectionUpdate(e,t){let s=`/collections/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async collectionDelete(e){let t=`/collections/${e.idOrSlug}`;return this.#e(t,"DELETE")}async collectionImportMemberships(e){let t=new FormData;return t.append("file",e.file),this.#n("/collections/import-memberships",t)}async categoryGet(e){let t=`/categories/${e.idOrSlug}`;return await this.#e(t)}async categoriesBrowse(e){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString());let r=`/categories${t.size?`?${t}`:""}`;return await this.#e(r)}async postBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString()),e.tag&&t.append("tag",e.tag),e.categoryId&&t.append("categoryId",e.categoryId);let r=`/posts${t.size?`?${t}`:""}`;return this.#e(r)}async postGet(e){let t=`/posts/${e.idOrSlug}`;return this.#e(t)}async postCreate(e){return this.#e("/posts","POST",e)}async postUpdate(e,t){let s=`/posts/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async postDelete(e){let t=`/posts/${e.idOrSlug}`;return this.#e(t,"DELETE")}async postCommentsBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let r=s.size?`?${s}`:"",o=`/posts/${e.idOrSlug}/comments${r}`;return this.#e(o)}async postCommentCreate(e,t){let s=`/posts/${e.idOrSlug}/comments`;return this.#e(s,"POST",t)}async blogCategoryBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString());let r=`/blog-categories${t.size?`?${t}`:""}`;return this.#e(r)}async blogCategoryGet(e){let t=`/blog-categories/${e.idOrSlug}`;return this.#e(t)}async blogCategoryCreate(e){return this.#e("/blog-categories","POST",e)}async blogCategoryUpdate(e,t){let s=`/blog-categories/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async blogCategoryDelete(e){let t=`/blog-categories/${e.idOrSlug}`;return this.#e(t,"DELETE")}async customerBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.search&&t.append("search",e.search);let r=`/customers${t.size?`?${t}`:""}`;return this.#e(r)}async customerGet(e){let t=`/customers/${e.id}`;return this.#e(t)}async customerUpdate(e,t){let s=`/customers/${e.id}`;return this.#e(s,"PATCH",t)}async customerAddressCreate(e,t){let s=`/customers/${e.id}/addresses`;return this.#e(s,"POST",t)}async customerAddressDelete(e){let t=`/customers/${e.customerId}/addresses/${e.addressId}`;await this.#e(t,"DELETE")}async customerOrdersBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let r=s.size?`?${s}`:"",o=`/customers/${e.id}/orders${r}`;return this.#e(o)}async inventoryBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.cursor&&t.append("cursor",e.cursor),e.lowStock!==void 0&&t.append("lowStock",e.lowStock.toString());let r=`/inventory${t.size?`?${t}`:""}`;return this.#e(r)}async inventoryAdjust(e,t){let s=`/inventory/${encodeURIComponent(e)}/adjust`;return this.#e(s,"POST",t)}async variantGet(e){let t=`/variants/${e.idOrSku}`;return this.#e(t)}async variantUpdate(e,t){let s=`/variants/${e.idOrSku}`;return this.#e(s,"PATCH",t)}async variantDelete(e){let t=`/variants/${e.idOrSku}`;await this.#e(t,"DELETE")}async variantCreate(e,t){let s=`/products/${e}/variants`;return this.#e(s,"POST",t)}async subscriberCreate(e){return this.#e("/subscribers","POST",e)}async subscriberDelete(e){let t=`/subscribers?email=${encodeURIComponent(e)}`;return this.#e(t,"DELETE")}async contactMessageCreate(e){return this.#e("/contact-messages","POST",e)}async productCreate(e){return this.#e("/products","POST",e)}async productUpdate(e,t){let s=`/products/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async productDelete(e){let t=`/products/${e.idOrSlug}`;return this.#e(t,"DELETE")}async productReviewsBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let r=s.size?`?${s}`:"",o=`/products/${e.idOrSlug}/reviews${r}`;return this.#e(o)}async productReviewCreate(e,t){let s=`/products/${e.idOrSlug}/reviews`;return this.#e(s,"POST",t)}async eventBrowse(e={}){let t=this.#t.getLogger("eventBrowse"),s=new URLSearchParams;e.offset!==void 0&&s.append("offset",e.offset.toString()),e.limit!==void 0&&s.append("limit",e.limit.toString());let o=`/events${s.size?`?${s}`:""}`;return t.debug("Browsing events:",o),this.#e(o)}async eventGet(e){let t=`/events/${e.idOrSlug}`;return this.#e(t)}async eventCreate(e){return this.#e("/events","POST",e)}async eventUpdate(e,t){let s=`/events/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async eventAttendeesBrowse(e){let t=`/events/${e.idOrSlug}/attendees`;return this.#e(t)}async ticketsGet(e){let t=this.#t.getLogger("ticketsGet"),s=new URLSearchParams({email:e.email}),r=`/tickets/${encodeURIComponent(e.code)}?${s}`;return t.debug("Fetching ticket bundle:",r),this.#r(r)}async ticketsUpdate(e,t){let s=`/tickets/${encodeURIComponent(e.code)}`;return this.#e(s,"PATCH",t)}async ticketAttendeeGet(e){let t=`/tickets/attendee/${encodeURIComponent(e.token)}`;return this.#r(t)}async categoryCreate(e){return this.#e("/categories","POST",e)}async categoryUpdate(e,t){let s=`/categories/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async categoryDelete(e){let t=`/categories/${e.idOrSlug}`;return this.#e(t,"DELETE")}async orderUpdate(e,t){let s=`/orders/${e.id}`;return this.#e(s,"PATCH",t)}async legalPageBrowse(e={}){return this.request("/legal-pages",{query:e})}async legalPageGet(e,t={}){let s=e.startsWith("/")?e.slice(1):e,r=`/legal-pages/${encodeURIComponent(s)}`;return this.request(r,{query:t})}async legalPageCreate(e,t={}){return this.request("/legal-pages",{method:"POST",body:e,query:t})}async legalPageUpdate(e,t,s={}){let r=e.startsWith("/")?e.slice(1):e,o=`/legal-pages/${encodeURIComponent(r)}`;return this.request(o,{method:"PATCH",body:t,query:s})}async search(e){return this.request("/search",{query:e})}async instaviewImagesBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.cursor&&s.append("cursor",t.cursor);let r=s.size?`?${s}`:"",o=`/instaview/accounts/${e.handle}/images${r}`;return this.#e(o)}async request(e,t){let s=t?.query?Object.entries(t.query).filter(o=>{let[,a]=o;return a!=null}):[],r=s.length>0?`?${new URLSearchParams(s.map(([o,a])=>[o,String(a)]))}`:"";return this.#e(`${e}${r}`,t?.method??"GET",t?.body)}};function T(c={}){return new l(c)}export{T as Commerce,l as YNSProvider};
1
+ import"./chunk-PNKB6P4V.js";var C=process.env.YNS_API_KEY,B=process.env.YNS_STORE_ID,I={YNS_API_KEY:C,YNS_STORE_ID:B};var h=new Set(["/products","/collections","/categories","/brands"]),w=new Set(["/products/filters","/legal-pages"]),S=new Set(["products","collections","categories","brands","legal-pages"]),v=new Set(["batch","import","import-memberships","filters"]),$=(P,e)=>{if(w.has(P))return!0;if(h.has(P))return e.get("active")==="true";let[t,s,r,...o]=P.split("/").slice(1);return!t||!s||o.length>0||v.has(s)?!1:r===void 0?S.has(t):t==="products"&&r==="reviews"},p=(P,e)=>{let[t="",s=""]=P.split("?"),r=new URLSearchParams(s),o=r.get("active"),n=r.get("metafields")==="all";if(r.has("store")||o!==null&&o!=="true"||n||!$(t,r))return null;let u=[...r.entries()].sort(([i,f],[y,R])=>i===y?f.localeCompare(R):i.localeCompare(y)),a=new URLSearchParams([["store",e],...u]);return`/${t.slice(1)}?${a}`};var l={DEBUG:0,LOG:1,WARN:2,ERROR:3},T=process.env.NEXT_PUBLIC_LOG_LEVEL||"LOG",c=l[T],A="\x1B[0m",G="\x1B[34m",E="\x1B[32m",D="\x1B[33m",U="\x1B[31m",O="\u23F1\uFE0F",L="\u{1F41B}",M="\u2714\uFE0F",b="\u26A0\uFE0F",k="\u274C",g=`${O} `,q=`${G}${L}${A} `,Q=`${E}${M}${A} `,N=`${D}${b}${A} `,Y=`${U}${k}${A} `,m=P=>{let e=P?`[${P}] `:"";return{getLogger(t){return m([P,t].filter(Boolean).join(" > "))},time(t){c>l.DEBUG||console.time([g,e,t].filter(Boolean).join(" "))},timeEnd(t){c>l.DEBUG||console.timeEnd([g,e,t].filter(Boolean).join(" "))},debug(...t){c>l.DEBUG||console.log(...[q,e,...t].filter(Boolean))},log(...t){c>l.LOG||console.log(...[Q,e,...t].filter(Boolean))},dir(t,s){c>l.LOG||console.dir(t,s)},warn(...t){c>l.WARN||console.warn(...[N,e,...t].filter(Boolean))},error(...t){c>l.ERROR||console.error(...[Y,e,...t].filter(Boolean))}}},j=m();var _=new Set([400,401,403]),d=class{#t;#s=m("YNSProvider");#n=null;constructor(e={}){let t=e.token??I.YNS_API_KEY,s=I.YNS_API_KEY?.startsWith("sk-s-");if(!t)throw new Error("YNS API key is required. Set YNS_API_KEY environment variable or pass token in config.");let r=e.endpoint??(s?"https://yns.cx":"https://yns.store");this.#t={version:"v1",...e,token:t,endpoint:r},this.#s.debug("YNSProvider initialized",{endpoint:r,token:e.token?"from config":"from env"})}async#e(e,t="GET",s){let r=await this.#a(e,t,s);return this.#i(r,e,t)}async#r(e){let t=await this.#a(e,"GET");return t.status===404?null:this.#i(t,e,"GET")}#P(){let e=this.#t.store;return e===!1?Promise.resolve(null):(this.#n??=(async()=>{let t=e??I.YNS_STORE_ID;if(t)return t;try{let s=await this.#o("/me","GET");if(!s.ok)return null;let r=await s.json();return typeof r.store?.id=="string"?r.store.id:null}catch{return null}})(),this.#n)}async#a(e,t,s){if(t!=="GET")return this.#o(e,t,s);let r=await this.#P(),o=r?p(e,r):null;if(!o)return this.#o(e,t);let n=this.#s.getLogger("#restRequest"),u=`${this.#t.endpoint}/api/${this.#t.version}${o}`;n.debug(`Making keyless GET request to YNS API: ${u}`);let a=await fetch(u,{method:t,headers:{"Content-Type":"application/json"}});return _.has(a.status)?(a.status!==400&&(this.#n=Promise.resolve(null)),n.debug(`Keyless request answered ${a.status}, asking again with the key`),this.#o(e,t)):a}async#o(e,t,s){let r=this.#s.getLogger("#restRequest"),o=`${this.#t.endpoint}/api/${this.#t.version}${e}`;return r.debug(`Making ${t} request to YNS API: ${o}`),fetch(o,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.#t.token}`},body:s?JSON.stringify(s):void 0})}async#i(e,t,s){let r=this.#s.getLogger("#restRequest"),o=`${this.#t.endpoint}/api/${this.#t.version}${t}`;if(!e.ok){let u=e.headers.get("content-type"),a=`YNS REST request failed: ${s} ${o} ${e.status} ${e.statusText}`;if(u?.includes("application/json"))try{let i=await e.json();a=i.error||i.message||a}catch(i){r.error("Failed to parse YNS error response as JSON",i)}else{let i=await e.text();r.error(`YNS API request failed: ${e.status} ${e.statusText}`,a,i)}throw new Error(a)}let n=e.headers.get("content-type");if(!n?.includes("application/json"))throw new Error(`YNS API returned ${n} instead of JSON for ${t}`);return e.json()}async#u(e,t){let s=this.#s.getLogger("#multipartRequest"),r=`${this.#t.endpoint}/api/${this.#t.version}${e}`;s.debug(`Making multipart POST to YNS API: ${r}`);let o=await fetch(r,{method:"POST",headers:{Authorization:`Bearer ${this.#t.token}`},body:t});if(!o.ok){let u=o.headers.get("content-type"),a=`YNS REST request failed: POST ${r} ${o.status} ${o.statusText}`;if(u?.includes("application/json"))try{let i=await o.json();a=i.error||i.message||a}catch(i){s.error("Failed to parse YNS error response as JSON",i)}else{let i=await o.text();s.error(`YNS API request failed: ${o.status} ${o.statusText}`,a,i)}throw new Error(a)}let n=o.headers.get("content-type");if(!n?.includes("application/json"))throw new Error(`YNS API returned ${n} instead of JSON for ${e}`);return o.json()}async meGet(){let e=this.#s.getLogger("meGet");e.debug("Fetching my information");let s=await this.#e("/me");return e.debug("Received my information:",s),s}async socialsGet(){let e=this.#s.getLogger("socialsGet");e.debug("Fetching store social links");let s=await this.#e("/socials");return e.debug("Received store social links:",s),s}async brandBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString()),e.lang&&t.append("lang",e.lang);let r=`/brands${t.size?`?${t}`:""}`;return this.#e(r)}async brandGet(e){let t=`/brands/${e.idOrSlug}`;return this.#e(t)}async brandCreate(e){return this.#e("/brands","POST",e)}async brandUpdate(e,t){let s=`/brands/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async brandDelete(e){let t=`/brands/${e.idOrSlug}`;return this.#e(t,"DELETE")}async brandAssignProducts(e,t){let s=`/brands/${e.idOrSlug}/products`;return this.#e(s,"POST",t)}async orderRefundsBrowse(e){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString());let s=t.size?`?${t}`:"",r=`/orders/${e.id}/refunds${s}`;return this.#e(r)}async orderRefundGet(e){let t=`/orders/${e.id}/refunds/${e.refundId}`;return this.#e(t)}async productBatch(e){return this.#e("/products/batch","POST",e)}async cartDelete(e){let t=`/carts/${e.cartId}`;return this.#e(t,"DELETE")}async productBrowse(e){let t=this.#s.getLogger("productBrowse");t.debug("Browsing products with params:",e);let s=new URLSearchParams;e.limit&&s.append("limit",e.limit.toString()),e.offset&&s.append("offset",e.offset.toString()),e.category&&s.append("category",e.category),e.collection&&s.append("collection",e.collection),e.brand&&s.append("brand",e.brand),e.priceMin!==void 0&&s.append("priceMin",e.priceMin.toString()),e.priceMax!==void 0&&s.append("priceMax",e.priceMax.toString()),e.vts&&s.append("vts",e.vts),e.query&&s.append("query",e.query),e.active!==void 0&&s.append("active",e.active.toString()),e.orderBy&&s.append("orderBy",e.orderBy),e.orderDirection&&s.append("orderDirection",e.orderDirection),e.currency&&s.append("currency",e.currency),e.lang&&s.append("lang",e.lang),e.filter&&s.append("filter",e.filter),e.include&&s.append("include",e.include),e.metafields&&s.append("metafields",e.metafields);let o=`/products${s.size?`?${s}`:""}`;t.debug("Constructed pathname:",o);let n=await this.#e(o);return t.debug("Received product browse result:",{meta:n.meta}),n}async productFilters(e={}){let t=new URLSearchParams;e.lang&&t.append("lang",e.lang);let r=`/products/filters${t.size?`?${t}`:""}`;return this.#e(r)}async productGet(e){let t=new URLSearchParams;e.lang&&t.append("lang",e.lang),e.currency&&t.append("currency",e.currency),e.metafields&&t.append("metafields",e.metafields);let s=t.size?`?${t}`:"",r=`/products/${e.idOrSlug}${s}`,o=await this.#e(r);return o||null}async orderBrowse(e){let t=this.#s.getLogger("orderBrowse");t.debug("Browsing orders with params:",e);let s=new URLSearchParams;e.limit&&s.append("limit",e.limit.toString()),e.offset&&s.append("offset",e.offset.toString());let o=`/orders${s.size?`?${s}`:""}`;t.debug("Constructed pathname:",o);let n=await this.#e(o);return t.debug("Received orders browse result:",{meta:n.meta}),n}async orderGet(e){let t=`/orders/${e.id}`,s=await this.#e(t);return s||null}async cartUpsert(e){return await this.#e("/carts","POST",e)}async cartAddBundle(e){let t={bundleId:e.bundleId,selections:e.selections,...e.cartId?{cartId:e.cartId}:{},...e.currency?{currency:e.currency}:{}};return await this.#e("/carts","POST",t)}async cartRemoveItem(e){let t=`/carts/${e.cartId}/line-items/${e.variantId}`;return this.#e(t,"DELETE")}async cartGet(e){let t=`/carts/${e.cartId}`;return await this.#e(t)}async cartCouponApply(e){let t=`/carts/${e.cartId}/coupon`;return this.#e(t,"POST",{code:e.code})}async cartCouponRemove(e){let t=`/carts/${e.cartId}/coupon`;return this.#e(t,"DELETE")}async couponBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query);let r=`/coupons${t.size?`?${t}`:""}`;return this.#e(r)}async couponGet(e){let t=`/coupons/${e.idOrCode}`;return this.#r(t)}async couponCreate(e){return this.#e("/coupons","POST",e)}async couponUpdate(e,t){let s=`/coupons/${e.idOrCode}`;return this.#e(s,"PATCH",t)}async couponDelete(e){let t=`/coupons/${e.idOrCode}`;return this.#e(t,"DELETE")}async supportCaseBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.status&&t.append("status",e.status),e.severity&&t.append("severity",e.severity);let r=`/support-cases${t.size?`?${t}`:""}`;return this.#e(r)}async supportCaseGet(e){let t=`/support-cases/${e.idOrNumber}`;return this.#r(t)}async supportCaseCreate(e){return this.#e("/support-cases","POST",e)}async supportCaseUpdate(e,t){let s=`/support-cases/${e.idOrNumber}`;return this.#e(s,"PATCH",t)}async supportCaseReply(e,t){let s=`/support-cases/${e.idOrNumber}/messages`;return this.#e(s,"POST",t)}async collectionGet(e){let t=`/collections/${e.idOrSlug}`;return await this.#e(t)}async collectionBrowse(e){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString()),e.group&&t.append("group",e.group);let r=`/collections${t.size?`?${t}`:""}`;return await this.#e(r)}async collectionCreate(e){return this.#e("/collections","POST",e)}async collectionUpdate(e,t){let s=`/collections/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async collectionDelete(e){let t=`/collections/${e.idOrSlug}`;return this.#e(t,"DELETE")}async collectionImportMemberships(e){let t=new FormData;return t.append("file",e.file),this.#u("/collections/import-memberships",t)}async categoryGet(e){let t=`/categories/${e.idOrSlug}`;return await this.#e(t)}async categoriesBrowse(e){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString());let r=`/categories${t.size?`?${t}`:""}`;return await this.#e(r)}async postBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString()),e.tag&&t.append("tag",e.tag),e.categoryId&&t.append("categoryId",e.categoryId);let r=`/posts${t.size?`?${t}`:""}`;return this.#e(r)}async postGet(e){let t=`/posts/${e.idOrSlug}`;return this.#e(t)}async postCreate(e){return this.#e("/posts","POST",e)}async postUpdate(e,t){let s=`/posts/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async postDelete(e){let t=`/posts/${e.idOrSlug}`;return this.#e(t,"DELETE")}async postCommentsBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let r=s.size?`?${s}`:"",o=`/posts/${e.idOrSlug}/comments${r}`;return this.#e(o)}async postCommentCreate(e,t){let s=`/posts/${e.idOrSlug}/comments`;return this.#e(s,"POST",t)}async blogCategoryBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString());let r=`/blog-categories${t.size?`?${t}`:""}`;return this.#e(r)}async blogCategoryGet(e){let t=`/blog-categories/${e.idOrSlug}`;return this.#e(t)}async blogCategoryCreate(e){return this.#e("/blog-categories","POST",e)}async blogCategoryUpdate(e,t){let s=`/blog-categories/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async blogCategoryDelete(e){let t=`/blog-categories/${e.idOrSlug}`;return this.#e(t,"DELETE")}async customerBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.search&&t.append("search",e.search);let r=`/customers${t.size?`?${t}`:""}`;return this.#e(r)}async customerGet(e){let t=`/customers/${e.id}`;return this.#e(t)}async customerUpdate(e,t){let s=`/customers/${e.id}`;return this.#e(s,"PATCH",t)}async customerAddressCreate(e,t){let s=`/customers/${e.id}/addresses`;return this.#e(s,"POST",t)}async customerAddressDelete(e){let t=`/customers/${e.customerId}/addresses/${e.addressId}`;await this.#e(t,"DELETE")}async customerOrdersBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let r=s.size?`?${s}`:"",o=`/customers/${e.id}/orders${r}`;return this.#e(o)}async inventoryBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.cursor&&t.append("cursor",e.cursor),e.lowStock!==void 0&&t.append("lowStock",e.lowStock.toString());let r=`/inventory${t.size?`?${t}`:""}`;return this.#e(r)}async inventoryAdjust(e,t){let s=`/inventory/${encodeURIComponent(e)}/adjust`;return this.#e(s,"POST",t)}async variantGet(e){let t=`/variants/${e.idOrSku}`;return this.#e(t)}async variantUpdate(e,t){let s=`/variants/${e.idOrSku}`;return this.#e(s,"PATCH",t)}async variantDelete(e){let t=`/variants/${e.idOrSku}`;await this.#e(t,"DELETE")}async variantCreate(e,t){let s=`/products/${e}/variants`;return this.#e(s,"POST",t)}async subscriberCreate(e){return this.#e("/subscribers","POST",e)}async subscriberDelete(e){let t=`/subscribers?email=${encodeURIComponent(e)}`;return this.#e(t,"DELETE")}async contactMessageCreate(e){return this.#e("/contact-messages","POST",e)}async productCreate(e){return this.#e("/products","POST",e)}async productUpdate(e,t){let s=`/products/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async productDelete(e){let t=`/products/${e.idOrSlug}`;return this.#e(t,"DELETE")}async metafieldDefinitionBrowse(e={}){let t=new URLSearchParams;e.ownerType&&t.append("ownerType",e.ownerType),e.includeArchived&&t.append("includeArchived",e.includeArchived),e.lang&&t.append("lang",e.lang),e.metafields&&t.append("metafields",e.metafields);let r=`/metafield-definitions${t.size?`?${t}`:""}`;return this.#e(r)}async metafieldDefinitionGet(e){let t=new URLSearchParams;e.lang&&t.append("lang",e.lang),e.metafields&&t.append("metafields",e.metafields);let s=t.size?`?${t}`:"",r=`/metafield-definitions/${e.idOrKey}${s}`;return this.#r(r)}async metafieldDefinitionCreate(e){return this.#e("/metafield-definitions","POST",e)}async metafieldDefinitionUpdate(e,t){let s=`/metafield-definitions/${e.idOrKey}`;return this.#e(s,"PATCH",t)}async metafieldDefinitionArchive(e){let t=`/metafield-definitions/${e.idOrKey}`;return this.#e(t,"DELETE")}async metafieldDefinitionRestore(e){let t=`/metafield-definitions/${e.idOrKey}/restore`;return this.#e(t,"POST")}async metafieldDefinitionDelete(e,t){let s=`/metafield-definitions/${e.idOrKey}/purge`;return this.#e(s,"POST",t)}async metafieldDefinitionConversionPreview(e){let t=`/metafield-definitions/${e.idOrKey}/convert-to-choice`;return this.#e(t)}async metafieldDefinitionConvertToChoice(e,t){let s=`/metafield-definitions/${e.idOrKey}/convert-to-choice`;return this.#e(s,"POST",t)}async metafieldDefinitionTranslationPut(e,t){let s=`/metafield-definitions/${e.idOrKey}/translations/${e.locale}`;return this.#e(s,"PUT",t)}async productMetafieldTranslationsPut(e,t){let s=`/products/${e.idOrSlug}/metafields/translations/${e.locale}`;return this.#e(s,"PUT",t)}async variantMetafieldTranslationsPut(e,t){let s=`/variants/${e.idOrSku}/metafields/translations/${e.locale}`;return this.#e(s,"PUT",t)}async metafieldsTranslateMissing(e={}){return this.#e("/metafields/translate-missing","POST",e)}async productReviewsBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let r=s.size?`?${s}`:"",o=`/products/${e.idOrSlug}/reviews${r}`;return this.#e(o)}async productReviewCreate(e,t){let s=`/products/${e.idOrSlug}/reviews`;return this.#e(s,"POST",t)}async eventBrowse(e={}){let t=this.#s.getLogger("eventBrowse"),s=new URLSearchParams;e.offset!==void 0&&s.append("offset",e.offset.toString()),e.limit!==void 0&&s.append("limit",e.limit.toString());let o=`/events${s.size?`?${s}`:""}`;return t.debug("Browsing events:",o),this.#e(o)}async eventGet(e){let t=`/events/${e.idOrSlug}`;return this.#e(t)}async eventCreate(e){return this.#e("/events","POST",e)}async eventUpdate(e,t){let s=`/events/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async eventAttendeesBrowse(e){let t=`/events/${e.idOrSlug}/attendees`;return this.#e(t)}async ticketsGet(e){let t=this.#s.getLogger("ticketsGet"),s=new URLSearchParams({email:e.email}),r=`/tickets/${encodeURIComponent(e.code)}?${s}`;return t.debug("Fetching ticket bundle:",r),this.#r(r)}async ticketsUpdate(e,t){let s=`/tickets/${encodeURIComponent(e.code)}`;return this.#e(s,"PATCH",t)}async ticketAttendeeGet(e){let t=`/tickets/attendee/${encodeURIComponent(e.token)}`;return this.#r(t)}async categoryCreate(e){return this.#e("/categories","POST",e)}async categoryUpdate(e,t){let s=`/categories/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async categoryDelete(e){let t=`/categories/${e.idOrSlug}`;return this.#e(t,"DELETE")}async orderUpdate(e,t){let s=`/orders/${e.id}`;return this.#e(s,"PATCH",t)}async legalPageBrowse(e={}){return this.request("/legal-pages",{query:e})}async legalPageGet(e,t={}){let s=e.startsWith("/")?e.slice(1):e,r=`/legal-pages/${encodeURIComponent(s)}`;return this.request(r,{query:t})}async legalPageCreate(e,t={}){return this.request("/legal-pages",{method:"POST",body:e,query:t})}async legalPageUpdate(e,t,s={}){let r=e.startsWith("/")?e.slice(1):e,o=`/legal-pages/${encodeURIComponent(r)}`;return this.request(o,{method:"PATCH",body:t,query:s})}async search(e){return this.request("/search",{query:e})}async instaviewImagesBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.cursor&&s.append("cursor",t.cursor);let r=s.size?`?${s}`:"",o=`/instaview/accounts/${e.handle}/images${r}`;return this.#e(o)}async request(e,t){let s=t?.query?Object.entries(t.query).filter(o=>{let[,n]=o;return n!=null}):[],r=s.length>0?`?${new URLSearchParams(s.map(([o,n])=>[o,String(n)]))}`:"";return this.#e(`${e}${r}`,t?.method??"GET",t?.body)}};function x(P={}){return new d(P)}export{x as Commerce,d as YNSProvider};
2
2
  //# sourceMappingURL=index.js.map