@forgecart/sdk 1.2.7 → 1.202607061936.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +2 -2
  2. package/dist/admin-types.generated.d.ts +481 -33
  3. package/dist/admin.d.ts +2 -0
  4. package/dist/admin.generated.d.ts +67 -27
  5. package/dist/admin.generated.js +88 -4
  6. package/dist/admin.js +35 -31
  7. package/dist/client.generated.d.ts +40 -1
  8. package/dist/client.generated.js +152 -6
  9. package/dist/documents.generated.d.ts +28 -6
  10. package/dist/documents.generated.js +517 -41
  11. package/dist/index.d.ts +1 -0
  12. package/dist/shop-types.generated.d.ts +205 -13
  13. package/dist/shop.d.ts +1 -0
  14. package/dist/shop.generated.d.ts +13 -4
  15. package/dist/shop.generated.js +19 -1
  16. package/dist/shop.js +17 -15
  17. package/package.json +8 -4
  18. package/src/admin-types.generated.d.ts +10013 -0
  19. package/src/admin-types.generated.ts +1019 -96
  20. package/src/admin.generated.d.ts +806 -0
  21. package/src/admin.generated.ts +117 -29
  22. package/src/admin.ts +2 -0
  23. package/src/client.generated.d.ts +249 -0
  24. package/src/client.generated.ts +185 -5
  25. package/src/documents.generated.d.ts +473 -0
  26. package/src/documents.generated.ts +530 -32
  27. package/src/error-utils.d.ts +25 -0
  28. package/src/hook-event-map.generated.d.ts +243 -0
  29. package/src/index.d.ts +22 -0
  30. package/src/index.ts +1 -0
  31. package/src/sdk-hook-subscription.generated.d.ts +29 -0
  32. package/src/sdk-plugin.generated.d.ts +38 -0
  33. package/src/sdk-types.generated.d.ts +56 -0
  34. package/src/shop-types.generated.d.ts +4786 -0
  35. package/src/shop-types.generated.ts +275 -13
  36. package/src/shop.generated.d.ts +213 -0
  37. package/src/shop.generated.ts +22 -5
  38. package/src/shop.ts +1 -0
  39. package/src/upload.d.ts +14 -0
@@ -11,7 +11,7 @@ import type { BaseGraphQLClient } from './client.generated';
11
11
  import * as Types from './shop-types.generated';
12
12
  import { Observable } from 'rxjs';
13
13
  import { QueryObservable } from './client.generated';
14
- import { shopShopFieldDefinitionDocument, shopShopEntryDocument, shopShopEntriesDocument, shopExternalAuthenticationMethodsDocument, shopLoginDocument, shopLogoutDocument, shopAuthenticateWithExternalStrategyDocument, shopUnlinkExternalAuthenticationMethodDocument, shopUpdateUserPreferencesDocument, shopAddItemToOrderDocument, shopAdjustOrderLineDocument, shopRemoveOrderLineDocument, shopRemoveAllOrderLinesDocument, shopApplyCouponCodeDocument, shopRemoveCouponCodeDocument, shopSetCustomerForOrderDocument, shopAddItemsToOrderDocument, shopAdjustOrderLinesDocument, shopRemoveItemsFromOrderDocument, shopSetOrderShippingAddressDocument, shopSetOrderBillingAddressDocument, shopTransitionOrderToStateDocument, shopShopCollectionDocument, shopShopCollectionsDocument, shopActiveCustomerDocument, shopActiveCustomerAddressesDocument, shopShopUpdateCustomerDocument, shopRegisterCustomerAccountDocument, shopVerifyCustomerAccountDocument, shopRequestPasswordResetDocument, shopResetPasswordDocument, shopCreateCustomerAddressDocument, shopUpdateCustomerAddressDocument, shopDeleteCustomerAddressDocument, shopUpdateCustomerPasswordDocument, shopRequestUpdateCustomerEmailAddressDocument, shopUpdateCustomerEmailAddressDocument, shopRequestCustomerReVerificationDocument, shopVerifyCustomerAccountWithPasswordDocument, shopShopFacetDocument, shopShopFacetsDocument, shopShopHookDispatchedDocument, shopRespondToHookDispatchDocument, shopHookListenDocument, shopHookRespondDocument, shopShopTrackEventDocument, shopShopResolveMarketingIdentityDocument, shopShopSetMarketingIdentifiersDocument, shopShopLinkMarketingEmailDocument, shopActiveOrderDocument, shopShopOrderByCodeDocument, shopNextOrderStatesDocument, shopShopOrderNotesDocument, shopShopActiveOrderUpdatedDocument, shopShopEligiblePaymentProvidersDocument, shopGetTokensDocument, shopCreatePaymentSessionDocument, shopConfirmPaymentSessionDocument, shopCancelPaymentSessionDocument, shopDeleteTokenDocument, shopSetDefaultTokenDocument, shopSaveTokenDocument, shopGetTokenTemplateDocument, shopGetSessionTemplateDocument, shopGetSessionVariablesDocument, shopShopProductDocument, shopShopProductsDocument, shopShopProductOptionGroupsDocument, shopShopSearchDocument, shopSuggestDocument, shopShippingRateGroupsDocument, shopSelectShippingRateDocument, shopMySubscriptionsDocument, shopMySubscriptionDocument, shopShopCreateSubscriptionDocument, shopShopCancelSubscriptionDocument, shopShopPauseSubscriptionDocument, shopShopResumeSubscriptionDocument, shopShopChangeSubscriptionPlanDocument, shopShopChangeSubscriptionQuantityDocument, shopReportUsageDocument } from './documents.generated';
14
+ import { shopShopFieldDefinitionDocument, shopShopEntryDocument, shopShopEntriesDocument, shopExternalAuthenticationMethodsDocument, shopLoginDocument, shopLogoutDocument, shopAuthenticateWithExternalStrategyDocument, shopUnlinkExternalAuthenticationMethodDocument, shopUpdateUserPreferencesDocument, shopAddItemToOrderDocument, shopAdjustOrderLineDocument, shopRemoveOrderLineDocument, shopRemoveAllOrderLinesDocument, shopApplyCouponCodeDocument, shopRemoveCouponCodeDocument, shopSetCustomerForOrderDocument, shopAddItemsToOrderDocument, shopAdjustOrderLinesDocument, shopRemoveItemsFromOrderDocument, shopSetCurrencyDocument, shopSetLanguageDocument, shopSetOrderShippingAddressDocument, shopSetOrderBillingAddressDocument, shopTransitionOrderToStateDocument, shopShopCollectionDocument, shopShopCollectionsDocument, shopActiveCustomerDocument, shopActiveCustomerAddressesDocument, shopShopUpdateCustomerDocument, shopRegisterCustomerAccountDocument, shopVerifyCustomerAccountDocument, shopRequestPasswordResetDocument, shopResetPasswordDocument, shopCreateCustomerAddressDocument, shopUpdateCustomerAddressDocument, shopDeleteCustomerAddressDocument, shopUpdateCustomerPasswordDocument, shopRequestUpdateCustomerEmailAddressDocument, shopUpdateCustomerEmailAddressDocument, shopRequestCustomerReVerificationDocument, shopVerifyCustomerAccountWithPasswordDocument, shopShopFacetDocument, shopShopFacetsDocument, shopShopHookDispatchedDocument, shopRespondToHookDispatchDocument, shopHookListenDocument, shopHookRespondDocument, shopShopTrackEventDocument, shopShopResolveMarketingIdentityDocument, shopShopSetMarketingIdentifiersDocument, shopShopLinkMarketingEmailDocument, shopActiveOrderDocument, shopShopOrderByCodeDocument, shopNextOrderStatesDocument, shopShopOrderNotesDocument, shopShopActiveOrderUpdatedDocument, shopShopEligiblePaymentProvidersDocument, shopGetTokensDocument, shopCreatePaymentSessionDocument, shopConfirmPaymentSessionDocument, shopCancelPaymentSessionDocument, shopDeleteTokenDocument, shopSetDefaultTokenDocument, shopSaveTokenDocument, shopGetTokenTemplateDocument, shopGetSessionTemplateDocument, shopGetSessionVariablesDocument, shopShopProductDocument, shopShopProductsDocument, shopShopProductOptionGroupsDocument, shopShopSearchDocument, shopSuggestDocument, shopShippingRateGroupsDocument, shopSelectShippingRateDocument, shopMySubscriptionsDocument, shopMySubscriptionDocument, shopShopCreateSubscriptionDocument, shopShopCancelSubscriptionDocument, shopShopPauseSubscriptionDocument, shopShopResumeSubscriptionDocument, shopShopChangeSubscriptionPlanDocument, shopShopChangeSubscriptionQuantityDocument, shopReportUsageDocument } from './documents.generated';
15
15
 
16
16
  export class AcfCategory {
17
17
  constructor(private readonly client: BaseGraphQLClient) {}
@@ -85,6 +85,17 @@ export class CartCategory {
85
85
  }
86
86
  }
87
87
 
88
+ export class ChannelCategory {
89
+ constructor(private readonly client: BaseGraphQLClient) {}
90
+
91
+ setCurrency(variables: Types.SetCurrencyMutationVariables): QueryObservable<Types.SetCurrencyMutation> {
92
+ return this.client.mutate<Types.SetCurrencyMutation>(shopSetCurrencyDocument, variables);
93
+ }
94
+ setLanguage(variables: Types.SetLanguageMutationVariables): QueryObservable<Types.SetLanguageMutation> {
95
+ return this.client.mutate<Types.SetLanguageMutation>(shopSetLanguageDocument, variables);
96
+ }
97
+ }
98
+
88
99
  export class CheckoutCategory {
89
100
  constructor(private readonly client: BaseGraphQLClient) {}
90
101
 
@@ -105,7 +116,7 @@ export class CollectionCategory {
105
116
  shopCollection(variables: Types.ShopCollectionQueryVariables): QueryObservable<Types.ShopCollectionQuery> {
106
117
  return this.client.query<Types.ShopCollectionQuery>(shopShopCollectionDocument, variables);
107
118
  }
108
- shopCollections(variables: Types.ShopCollectionsQueryVariables): QueryObservable<Types.ShopCollectionsQuery> {
119
+ shopCollections(variables?: Types.ShopCollectionsQueryVariables): QueryObservable<Types.ShopCollectionsQuery> {
109
120
  return this.client.query<Types.ShopCollectionsQuery>(shopShopCollectionsDocument, variables);
110
121
  }
111
122
  }
@@ -166,7 +177,7 @@ export class FacetCategory {
166
177
  shopFacet(variables: Types.ShopFacetQueryVariables): QueryObservable<Types.ShopFacetQuery> {
167
178
  return this.client.query<Types.ShopFacetQuery>(shopShopFacetDocument, variables);
168
179
  }
169
- shopFacets(variables: Types.ShopFacetsQueryVariables): QueryObservable<Types.ShopFacetsQuery> {
180
+ shopFacets(variables?: Types.ShopFacetsQueryVariables): QueryObservable<Types.ShopFacetsQuery> {
170
181
  return this.client.query<Types.ShopFacetsQuery>(shopShopFacetsDocument, variables);
171
182
  }
172
183
  }
@@ -276,10 +287,10 @@ export class PaymentCategory {
276
287
  export class ProductCategory {
277
288
  constructor(private readonly client: BaseGraphQLClient) {}
278
289
 
279
- shopProduct(variables: Types.ShopProductQueryVariables): QueryObservable<Types.ShopProductQuery> {
290
+ shopProduct(variables?: Types.ShopProductQueryVariables): QueryObservable<Types.ShopProductQuery> {
280
291
  return this.client.query<Types.ShopProductQuery>(shopShopProductDocument, variables);
281
292
  }
282
- shopProducts(variables: Types.ShopProductsQueryVariables): QueryObservable<Types.ShopProductsQuery> {
293
+ shopProducts(variables?: Types.ShopProductsQueryVariables): QueryObservable<Types.ShopProductsQuery> {
283
294
  return this.client.query<Types.ShopProductsQuery>(shopShopProductsDocument, variables);
284
295
  }
285
296
  shopProductOptionGroups(variables: Types.ShopProductOptionGroupsQueryVariables): QueryObservable<Types.ShopProductOptionGroupsQuery> {
@@ -345,6 +356,7 @@ export class ShopNamespace {
345
356
  private readonly _acf: AcfCategory;
346
357
  private readonly _auth: AuthCategory;
347
358
  private readonly _cart: CartCategory;
359
+ private readonly _channel: ChannelCategory;
348
360
  private readonly _checkout: CheckoutCategory;
349
361
  private readonly _collection: CollectionCategory;
350
362
  private readonly _customer: CustomerCategory;
@@ -364,6 +376,7 @@ export class ShopNamespace {
364
376
  this._acf = new AcfCategory(client);
365
377
  this._auth = new AuthCategory(client);
366
378
  this._cart = new CartCategory(client);
379
+ this._channel = new ChannelCategory(client);
367
380
  this._checkout = new CheckoutCategory(client);
368
381
  this._collection = new CollectionCategory(client);
369
382
  this._customer = new CustomerCategory(client);
@@ -389,6 +402,9 @@ export class ShopNamespace {
389
402
  get cart(): CartCategory {
390
403
  return this._cart;
391
404
  }
405
+ get channel(): ChannelCategory {
406
+ return this._channel;
407
+ }
392
408
  get checkout(): CheckoutCategory {
393
409
  return this._checkout;
394
410
  }
@@ -437,6 +453,7 @@ export class ShopNamespace {
437
453
  export type Address = Types.ShopCustomerAddressFieldFragment;
438
454
  export type Adjustment = Types.ShopAdjustmentFieldFragment;
439
455
  export type BillingSubscription = Types.ShopBillingSubscriptionFieldsFragment;
456
+ export type Channel = Types.ShopChannelFieldFragment;
440
457
  export type Collection = Types.ShopCollectionFieldsFragment;
441
458
  export type Customer = Types.ShopCustomerFieldFragment;
442
459
  export type Facet = Types.ShopFacetFieldsFragment;
package/src/shop.ts CHANGED
@@ -2,6 +2,7 @@ export { ShopNamespace } from './shop.generated';
2
2
  export { AcfCategory } from './shop.generated';
3
3
  export { AuthCategory } from './shop.generated';
4
4
  export { CartCategory } from './shop.generated';
5
+ export { ChannelCategory } from './shop.generated';
5
6
  export { CheckoutCategory } from './shop.generated';
6
7
  export { CollectionCategory } from './shop.generated';
7
8
  export { CustomerCategory } from './shop.generated';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Standalone fetch-based multipart upload function for ForgeCart SDK.
3
+ * Zero Apollo dependency — works in both Node.js (18+) and browser.
4
+ * Implements the GraphQL multipart request spec.
5
+ */
6
+ export interface UploadResult<T> {
7
+ data: T;
8
+ extensions?: Record<string, unknown>;
9
+ }
10
+ /**
11
+ * Performs a GraphQL mutation with file upload support via the multipart request spec.
12
+ * Falls back to standard JSON POST when no files are detected in variables.
13
+ */
14
+ export declare function uploadViaFetch<T>(endpoint: string, document: string, variables: Record<string, unknown>, headers: Record<string, string>): Promise<UploadResult<T>>;