@gomusdev/web-components 4.17.0 → 4.18.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.
@@ -1,7 +1,8 @@
1
- import { CustomerAddressesResult, CustomerMembershipsResult, OrdersResult, ValidateTokenResult } from '../../lib/stores/shop.svelte.ts';
2
- import { OrdersParams } from '@gomus/types';
1
+ import { CustomerAddressesResult, CustomerMembershipsResult, NotSignedIn, OrdersResult, ValidateTokenResult } from '../../lib/stores/shop.svelte.ts';
2
+ import { CustomerAddressParams, CustomerAddressWriteResponse, CustomerUpdateParams, CustomerUpdateResponse, DeleteCustomerAddressResponse, OrdersParams, PasswordResetParams, PasswordResetResponse, PasswordUpdateParams, PasswordUpdateResponse } from '@gomus/types';
3
3
  import { AddItemOptions } from '../../go/cart.ts';
4
- export type { CustomerAddressesResult, CustomerMembershipsResult, OrdersResult, ValidateTokenResult, } from '../../lib/stores/shop.svelte.ts';
4
+ export type { CustomerAddressesResult, CustomerMembershipsResult, NotSignedIn, OrdersResult, ValidateTokenResult, } from '../../lib/stores/shop.svelte.ts';
5
+ export type { CustomerAddressParams, CustomerAddressWriteResponse, CustomerUpdateParams, CustomerUpdateResponse, DeleteCustomerAddressResponse, PasswordResetParams, PasswordResetResponse, PasswordUpdateParams, PasswordUpdateResponse, } from '@gomus/types';
5
6
  export type Command = {
6
7
  method: 'load' | 'config' | 'init' | 'cart.addItem' | (string & {});
7
8
  options: Record<string, unknown>;
@@ -22,6 +23,12 @@ export declare const go: {
22
23
  getOrders: (params?: OrdersParams) => Promise<OrdersResult>;
23
24
  getCustomerAddresses: () => Promise<CustomerAddressesResult>;
24
25
  getCustomerMemberships: () => Promise<CustomerMembershipsResult>;
26
+ createCustomerAddress: (params: CustomerAddressParams) => Promise<CustomerAddressWriteResponse | NotSignedIn>;
27
+ updateCustomerAddress: (id: number, params: Partial<CustomerAddressParams>) => Promise<CustomerAddressWriteResponse | NotSignedIn>;
28
+ deleteCustomerAddress: (id: number) => Promise<DeleteCustomerAddressResponse | NotSignedIn>;
29
+ updateCustomer: (params: CustomerUpdateParams) => Promise<CustomerUpdateResponse | NotSignedIn>;
30
+ updatePassword: (params: PasswordUpdateParams) => Promise<PasswordUpdateResponse | NotSignedIn>;
31
+ requestPasswordReset: (params: PasswordResetParams) => Promise<PasswordResetResponse>;
25
32
  };
26
33
  cart: {
27
34
  addItem: (options: AddItemOptions) => Promise<string>;
@@ -0,0 +1 @@
1
+ export {};
@@ -7,7 +7,7 @@ import { User } from '../../../lib/stores/user.svelte.ts';
7
7
  import { DateFormatPreset } from '@gomus/types/lib/helpers/utils';
8
8
  import { OpenApiClient } from '@gomus/api';
9
9
  import { TicketsAndQuotasParams, TicketsCalendarParams, TicketsParams } from '@gomus/api/lib/types.ts';
10
- import { CapacitiesResponse, CheckoutParams, CheckoutResponse, Country, CustomerAddressesSuccess, CustomerMembershipsSuccess, Event, Exhibition, FinalizePersonalizationParams, FinalizePersonalizationResponse, LocaleOptions, MembershipActivationParams, MembershipActivationResponse, Merchandise, Museum, OrdersParams, OrdersSuccess, PasswordResetResponse, PasswordUpdateResponse, PostCartParams, PostCartResponse, Salutation, ShopType, SignInParams, SignInResponse, SignUpParams, SignUpResponse, TicketContentEntry, Tour, UploadPersonalizationPhotoResponse, ValidateTokenError, ValidateTokenSuccess, WithdrawalParams, WithdrawalResponse } from '@gomus/types';
10
+ import { CapacitiesResponse, CheckoutParams, CheckoutResponse, Country, CustomerAddressesSuccess, CustomerAddressParams, CustomerAddressWriteResponse, CustomerMembershipsSuccess, CustomerUpdateParams, CustomerUpdateResponse, DeleteCustomerAddressResponse, Event, Exhibition, FinalizePersonalizationParams, FinalizePersonalizationResponse, LocaleOptions, MembershipActivationParams, MembershipActivationResponse, Merchandise, Museum, OrdersParams, OrdersSuccess, PasswordResetParams, PasswordResetResponse, PasswordUpdateParams, PasswordUpdateResponse, PostCartParams, PostCartResponse, Salutation, ShopType, SignInParams, SignInResponse, SignUpParams, SignUpResponse, TicketContentEntry, Tour, UploadPersonalizationPhotoResponse, ValidateTokenError, ValidateTokenSuccess, WithdrawalParams, WithdrawalResponse } from '@gomus/types';
11
11
  export type ShopKind = 'angular' | 'jmb';
12
12
  export type NotSignedIn = {
13
13
  error: ValidateTokenError;
@@ -380,6 +380,32 @@ export declare class Shop {
380
380
  getOrders(params?: OrdersParams): OrdersResult;
381
381
  getCustomerAddresses(): CustomerAddressesResult;
382
382
  getCustomerMemberships(): CustomerMembershipsResult;
383
+ /**
384
+ * Creates a saved address for the signed-in customer, then drops the cached
385
+ * address list so the next getCustomerAddresses() refetches.
386
+ * The backend body is root-keyed ({ customer_address: {...} }) — rootKey makes
387
+ * apiCall validate required fields on the inner params, because the backend's
388
+ * 422 carries no body and would give integrators nothing actionable.
389
+ */
390
+ createCustomerAddress(params: CustomerAddressParams): Promise<CustomerAddressWriteResponse | NotSignedIn>;
391
+ /**
392
+ * Updates a saved address (partial body — the backend applies only the sent
393
+ * fields), then drops the cached address list. No client-side requiredFields:
394
+ * every field is optional on update.
395
+ */
396
+ updateCustomerAddress(id: number, params: Partial<CustomerAddressParams>): Promise<CustomerAddressWriteResponse | NotSignedIn>;
397
+ /**
398
+ * Deletes a saved address, then drops the cached address list. Success is
399
+ * 204 No Content — parseAs 'text' skips openapi-fetch's JSON parse (see apiCall).
400
+ */
401
+ deleteCustomerAddress(id: number): Promise<DeleteCustomerAddressResponse | NotSignedIn>;
402
+ /**
403
+ * Updates the signed-in customer's profile (PUT /api/v4/auth — devise
404
+ * registrations#update). Profile fields only: password changes go through
405
+ * updatePassword, which enforces current_password. Invalidates the cached
406
+ * validate_token payload so getCustomer() refetches the fresh profile.
407
+ */
408
+ updateCustomer(params: CustomerUpdateParams): Promise<CustomerUpdateResponse | NotSignedIn>;
383
409
  ticketsCalendar(params: TicketsCalendarParams): CalendarDatesDepthAvailabilityStatus;
384
410
  calendar(params: TicketsCalendarParams): CalendarDates;
385
411
  ticketsAndQuotas(params: TicketsAndQuotasParams): {
@@ -502,15 +528,8 @@ export declare class Shop {
502
528
  comment?: string | null;
503
529
  guides?: Record<string, never>[] | null;
504
530
  }[];
505
- updatePassword(params: {
506
- password: string;
507
- password_confirmation: string;
508
- current_password: string;
509
- }): Promise<PasswordUpdateResponse>;
510
- passwordReset(params: {
511
- email: string;
512
- redirect_url?: string;
513
- }): Promise<PasswordResetResponse>;
531
+ updatePassword(params: PasswordUpdateParams): Promise<PasswordUpdateResponse | NotSignedIn>;
532
+ passwordReset(params: PasswordResetParams): Promise<PasswordResetResponse>;
514
533
  /**
515
534
  * Sets a new password using the one-time credentials the backend appends to
516
535
  * the reset-mail redirect (`access-token`, `client`, `uid` query params).
@@ -588,6 +607,18 @@ export declare class Shop {
588
607
  } | undefined;
589
608
  finalizePersonalizations(token: string, params: FinalizePersonalizationParams): Promise<FinalizePersonalizationResponse>;
590
609
  uploadPersonalizationPhoto(token: string, personalizationId: number, file: File): Promise<UploadPersonalizationPhotoResponse>;
610
+ /**
611
+ * Drops every cached GET slot whose fetch id starts with the endpoint prefix,
612
+ * so the next fetchAndCache read refetches. #data is left intact — consumers
613
+ * keep rendering the last known value until the refetch lands (no flash of
614
+ * empty). Write methods call this after mutating the corresponding resource.
615
+ *
616
+ * In-flight slots are marked instead of deleted: their response predates the
617
+ * write, but deleting them would release waitForAllFetches early AND let
618
+ * apiGet resurrect the slot as fresh when the stale response lands. apiGet
619
+ * drops marked slots on completion, so the next read refetches.
620
+ */
621
+ invalidate(endpointPrefix: string): void;
591
622
  /**
592
623
  * Returns a reactive value that will contain the fetched data, no need to await.
593
624
  *
@@ -902,17 +933,20 @@ export declare class Shop {
902
933
  body: Record<string, any>;
903
934
  params?: Record<string, unknown>;
904
935
  requiredFields?: string[];
936
+ rootKey?: string;
905
937
  parseAs?: ParseAs;
906
938
  }): Promise<T>;
907
939
  apiPut<T>(path: string, options: {
908
940
  body: Record<string, any>;
909
941
  params?: Record<string, unknown>;
910
942
  requiredFields?: string[];
943
+ parseAs?: ParseAs;
911
944
  }): Promise<T>;
912
945
  apiDELETE<T>(path: string, options: {
913
- body: Record<string, any>;
946
+ body?: Record<string, any>;
914
947
  params?: Record<string, unknown>;
915
948
  requiredFields?: string[];
949
+ parseAs?: ParseAs;
916
950
  }): Promise<T>;
917
951
  apiUpload<T>(path: string, options: {
918
952
  body: FormData;
@@ -920,9 +954,10 @@ export declare class Shop {
920
954
  }): Promise<T>;
921
955
  apiCall<T>(path: string, options: {
922
956
  method: 'POST' | 'PUT' | 'DELETE';
923
- body: Record<string, any>;
957
+ body?: Record<string, any>;
924
958
  params?: Record<string, unknown>;
925
959
  requiredFields?: string[];
960
+ rootKey?: string;
926
961
  parseAs?: ParseAs;
927
962
  }): Promise<T>;
928
963
  /**
@@ -0,0 +1,2 @@
1
+ import { shop } from '../../lib/stores/shop.svelte.ts';
2
+ export declare function signInLocally(s?: typeof shop): void;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Giantmonkey GmbH"
5
5
  },
6
6
  "license": "MIT",
7
- "version": "4.17.0",
7
+ "version": "4.18.0",
8
8
  "type": "module",
9
9
  "main": "./dist-js/gomus-webcomponents.iife.js",
10
10
  "module": "./dist-js/gomus-webcomponents.iife.js",