feeef 0.11.3 → 0.12.1

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/README.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  `feeefjs` is a TypeScript library for managing feeef e-commerce platforms for self-hosted stores. It provides a wrapper for feeef rest api such like send order..., also have frontend srvices like the `CartService` class for managing cart items, shipping methods, and calculating totals. The library also includes a `NotifiableService` base class for handling listeners that react to changes in the service state.
4
4
 
5
+ ## Publish to npm
6
+
7
+ Non-interactive publish (no login / OTP each time): see **[PUBLISH.md](./PUBLISH.md)**.
8
+
9
+ ```bash
10
+ # one-time: granular token + Bypass 2FA → ~/.config/feeef/npm_token or NPM_TOKEN
11
+ npm run publish:npm
12
+ # or version bump + tag + publish:
13
+ npm run release
14
+ ```
15
+
5
16
  ## Delivery parcel types
6
17
 
7
18
  Canonical shipment shapes mirror the API domain in `feeefapps/backend/services/delivery/domain/parcel.ts`. In this package they live under `src/delivery/parcel.ts` and are exported from the main entry (`ParcelCreate`, `ParcelUpdate`, `DeliveryCarrierClient`, …). Keep them in sync when the backend parcel model changes; published npm `feeef` should re-export the same definitions after each release.
package/build/index.js CHANGED
@@ -254,6 +254,7 @@ var ModelRepository = class {
254
254
 
255
255
  // src/feeef/repositories/orders.ts
256
256
  var DeliveryServiceFilter = /* @__PURE__ */ ((DeliveryServiceFilter2) => {
257
+ DeliveryServiceFilter2["none"] = "none";
257
258
  DeliveryServiceFilter2["yalidine"] = "yalidine";
258
259
  DeliveryServiceFilter2["ecotrack"] = "ecotrack";
259
260
  DeliveryServiceFilter2["procolis"] = "procolis";
@@ -263,6 +264,7 @@ var DeliveryServiceFilter = /* @__PURE__ */ ((DeliveryServiceFilter2) => {
263
264
  DeliveryServiceFilter2["ecomanager"] = "ecomanager";
264
265
  return DeliveryServiceFilter2;
265
266
  })(DeliveryServiceFilter || {});
267
+ var ORDER_FILTER_ANY = "$$any";
266
268
  var OrderRepository = class extends ModelRepository {
267
269
  /**
268
270
  * Constructs a new OrderRepository instance.
@@ -308,6 +310,8 @@ var OrderRepository = class extends ModelRepository {
308
310
  if (options.shippingState) params.shippingState = options.shippingState;
309
311
  if (options.shippingCity) params.shippingCity = options.shippingCity;
310
312
  if (options.deliveryService) params.deliveryService = options.deliveryService;
313
+ if (options.variant) params.variant = options.variant;
314
+ if (options.offer) params.offer = options.offer;
311
315
  if (options.references !== void 0) params.references = options.references;
312
316
  }
313
317
  return super.list({ params });
@@ -563,7 +567,8 @@ var StoreRepository = class extends ModelRepository {
563
567
  ...listOptions,
564
568
  params: {
565
569
  ...listOptions.params,
566
- ...userId && { user_id: userId }
570
+ // StoreFilter.user() owned by or member of this user
571
+ ...userId && { user: userId, user_id: userId }
567
572
  }
568
573
  });
569
574
  }
@@ -685,6 +690,29 @@ var StoreRepository = class extends ModelRepository {
685
690
  });
686
691
  return res.data;
687
692
  }
693
+ /**
694
+ * Upserts a draft theme preview (does not change live `metadata.templateData`).
695
+ */
696
+ async putTemplatePreview(storeId, body) {
697
+ const res = await this.client.put(`/${this.resource}/${storeId}/template-preview`, body);
698
+ return res.data;
699
+ }
700
+ /**
701
+ * Clears the draft theme preview for a store.
702
+ */
703
+ async clearTemplatePreview(storeId) {
704
+ const res = await this.client.delete(`/${this.resource}/${storeId}/template-preview`);
705
+ return res.data;
706
+ }
707
+ /**
708
+ * Fetches draft TemplateData with a signed preview token (public, token-gated).
709
+ */
710
+ async getTemplatePreview(storeId, token) {
711
+ const res = await this.client.get(`/${this.resource}/${storeId}/template-preview`, {
712
+ params: { token }
713
+ });
714
+ return res.data;
715
+ }
688
716
  };
689
717
 
690
718
  // src/feeef/repositories/users.ts
@@ -1163,15 +1191,18 @@ var OAuthRepository = class {
1163
1191
  }
1164
1192
  /**
1165
1193
  * Exchanges an authorization code for an access token.
1194
+ * Public clients omit `clientSecret` and must send `codeVerifier` (PKCE).
1166
1195
  */
1167
1196
  async exchangeAuthorizationCode(params) {
1168
1197
  const body = new URLSearchParams({
1169
1198
  grant_type: "authorization_code",
1170
1199
  code: params.code,
1171
1200
  redirect_uri: params.redirectUri,
1172
- client_id: params.clientId,
1173
- client_secret: params.clientSecret
1201
+ client_id: params.clientId
1174
1202
  });
1203
+ if (params.clientSecret) {
1204
+ body.set("client_secret", params.clientSecret);
1205
+ }
1175
1206
  if (params.codeVerifier) {
1176
1207
  body.set("code_verifier", params.codeVerifier);
1177
1208
  }
@@ -2952,6 +2983,30 @@ var StoreTemplatesRepository = class extends ModelRepository {
2952
2983
  });
2953
2984
  return res.data;
2954
2985
  }
2986
+ /** GET locales bundle (`defaultLocale`, `locales`, `messages`). */
2987
+ async listLocales(templateId) {
2988
+ const res = await this.client.get(`/${this.resource}/${templateId}/locales`);
2989
+ return res.data;
2990
+ }
2991
+ /** Create one locale row. */
2992
+ async createLocale(templateId, input) {
2993
+ const res = await this.client.post(`/${this.resource}/${templateId}/locales`, input);
2994
+ return res.data;
2995
+ }
2996
+ /** Update one locale by language code. */
2997
+ async updateLocale(templateId, locale, input) {
2998
+ const res = await this.client.put(`/${this.resource}/${templateId}/locales/${locale}`, input);
2999
+ return res.data;
3000
+ }
3001
+ /** Delete one locale by language code. */
3002
+ async deleteLocale(templateId, locale) {
3003
+ await this.client.delete(`/${this.resource}/${templateId}/locales/${locale}`);
3004
+ }
3005
+ /** Replace the full locale set (CLI publish). */
3006
+ async replaceLocales(templateId, locales) {
3007
+ const res = await this.client.put(`/${this.resource}/${templateId}/locales`, { locales });
3008
+ return res.data;
3009
+ }
2955
3010
  };
2956
3011
 
2957
3012
  // src/core/entities/order.ts
@@ -5743,6 +5798,7 @@ export {
5743
5798
  NoestDeliveryIntegrationApi,
5744
5799
  NotificationsService,
5745
5800
  OAuthRepository,
5801
+ ORDER_FILTER_ANY,
5746
5802
  OrderRepository,
5747
5803
  OrderStatus,
5748
5804
  PaymentStatus,