@poweredbysous/storefront-sdk 3.6.0 → 3.7.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/dist/index.d.cts CHANGED
@@ -2461,6 +2461,23 @@ interface paths {
2461
2461
  patch?: never;
2462
2462
  trace?: never;
2463
2463
  };
2464
+ "/api/v1/visits/": {
2465
+ parameters: {
2466
+ query?: never;
2467
+ header?: never;
2468
+ path?: never;
2469
+ cookie?: never;
2470
+ };
2471
+ get?: never;
2472
+ put?: never;
2473
+ /** @description Record one storefront visit and send it to Cerebro. */
2474
+ post: operations["visits_create"];
2475
+ delete?: never;
2476
+ options?: never;
2477
+ head?: never;
2478
+ patch?: never;
2479
+ trace?: never;
2480
+ };
2464
2481
  "/api/v1/withdrawals/confirm/": {
2465
2482
  parameters: {
2466
2483
  query?: never;
@@ -2635,6 +2652,45 @@ interface components {
2635
2652
  slug: string;
2636
2653
  position?: number;
2637
2654
  };
2655
+ /**
2656
+ * @description * `granted` - granted
2657
+ * * `denied` - denied
2658
+ * * `unknown` - unknown
2659
+ * @enum {string}
2660
+ */
2661
+ AttributionConsentEnum: "granted" | "denied" | "unknown";
2662
+ /**
2663
+ * @description One landing: its click ids, UTMs, path and external referrer.
2664
+ *
2665
+ * The key set of a touch in the storefront-attribution contract (section 1).
2666
+ * An explicit allowlist rather than a free dict: this is attacker-controllable
2667
+ * URL input landing in a JSON column, so unknown keys are dropped, blank
2668
+ * values are dropped and every value is bounded (a longer one, or a null
2669
+ * byte, makes the record invalid).
2670
+ */
2671
+ AttributionTouch: {
2672
+ gclid?: string;
2673
+ gbraid?: string;
2674
+ wbraid?: string;
2675
+ msclkid?: string;
2676
+ fbclid?: string;
2677
+ /** @description Retention send id (`?rt=`). */
2678
+ rt?: string;
2679
+ utm_source?: string;
2680
+ utm_medium?: string;
2681
+ utm_campaign?: string;
2682
+ utm_term?: string;
2683
+ utm_content?: string;
2684
+ /** @description Path of this touch's landing document, no query string. */
2685
+ landing_path?: string;
2686
+ /** @description External host this touch landed from; never the storefront's. */
2687
+ referrer_host?: string;
2688
+ };
2689
+ /**
2690
+ * @description * `2` - 2
2691
+ * @enum {integer}
2692
+ */
2693
+ AttributionVersionEnum: 2;
2638
2694
  AuthToken: {
2639
2695
  username: string;
2640
2696
  password: string;
@@ -3238,7 +3294,7 @@ interface components {
3238
3294
  order_number: string | null;
3239
3295
  purpose: string;
3240
3296
  attribution: {
3241
- [key: string]: string;
3297
+ [key: string]: unknown;
3242
3298
  } | null;
3243
3299
  marketing_consent: {
3244
3300
  [key: string]: unknown;
@@ -3257,27 +3313,58 @@ interface components {
3257
3313
  }[];
3258
3314
  };
3259
3315
  /**
3260
- * @description Ad-click and campaign identifiers captured by the storefront at landing.
3316
+ * @description The attribution record: the last touch at the top level, plus the rest.
3317
+ *
3318
+ * storefront-attribution contract, section 1. Shared by checkout creation
3319
+ * and ``POST /api/v1/visits/``, stored on the checkout and copied to
3320
+ * ``Order.metadata["attribution"]`` unchanged. A record without ``v`` is the
3321
+ * flat record written before the contract and is still accepted.
3261
3322
  *
3262
- * Stored on the checkout and copied to the order at creation (PAT-2120) so
3263
- * server-side measurement, if added later, can attribute this period. Not
3264
- * read by anything yet. An explicit allowlist rather than a free dict: this
3265
- * is attacker-controllable URL input landing in a JSON column, so unknown
3266
- * keys are dropped and every value is bounded.
3323
+ * ``session_id`` and ``ga_client_id`` are the linking identifiers, so both
3324
+ * are dropped here unless the record's ``consent`` is ``granted``: nothing
3325
+ * downstream, checkout or visit, sees them without consent.
3326
+ *
3327
+ * An invalid record is refused by ``POST /api/v1/visits/`` and dropped by
3328
+ * checkout creation, which carries on without it.
3267
3329
  */
3268
3330
  CheckoutAttribution: {
3269
- /** @description GA4 client id from the `_ga` cookie (`X.Y`). */
3270
- ga_client_id?: string;
3271
3331
  gclid?: string;
3332
+ gbraid?: string;
3333
+ wbraid?: string;
3334
+ msclkid?: string;
3272
3335
  fbclid?: string;
3273
- gtm_debug?: string;
3336
+ /** @description Retention send id (`?rt=`). */
3337
+ rt?: string;
3274
3338
  utm_source?: string;
3275
3339
  utm_medium?: string;
3276
3340
  utm_campaign?: string;
3277
3341
  utm_term?: string;
3278
3342
  utm_content?: string;
3343
+ /** @description Path of this touch's landing document, no query string. */
3279
3344
  landing_path?: string;
3345
+ /** @description External host this touch landed from; never the storefront's. */
3280
3346
  referrer_host?: string;
3347
+ /**
3348
+ * @description Record version. Absent on records written before version 2.
3349
+ *
3350
+ * * `2` - 2
3351
+ */
3352
+ v?: components["schemas"]["AttributionVersionEnum"];
3353
+ /** @description The record's first landing. Required when `v` is 2. */
3354
+ first_touch?: components["schemas"]["AttributionTouch"];
3355
+ /** @description GA4 client id from the `_ga` cookie (`X.Y`). Dropped unless `consent` is `granted`. */
3356
+ ga_client_id?: string;
3357
+ /**
3358
+ * @description Cookie banner state when the record was sent. Required when `v` is 2.
3359
+ *
3360
+ * * `granted` - granted
3361
+ * * `denied` - denied
3362
+ * * `unknown` - unknown
3363
+ */
3364
+ consent?: components["schemas"]["AttributionConsentEnum"];
3365
+ /** @description `analytics_session_id`. Dropped unless `consent` is `granted`. */
3366
+ session_id?: string;
3367
+ gtm_debug?: string;
3281
3368
  };
3282
3369
  ConfirmEdit: {
3283
3370
  payment_strategy: components["schemas"]["PaymentStrategyEnum"];
@@ -3313,7 +3400,7 @@ interface components {
3313
3400
  CreateCheckoutInput: {
3314
3401
  /** Format: uuid */
3315
3402
  cart_id: string;
3316
- /** @description Campaign and click identifiers seen by the storefront in this session; stamped on the checkout and the resulting order. */
3403
+ /** @description Campaign and click identifiers seen by the storefront in this session; stamped on the checkout and the resulting order. A record that fails validation is dropped, not refused. */
3317
3404
  attribution?: components["schemas"]["CheckoutAttribution"];
3318
3405
  /**
3319
3406
  * Format: decimal
@@ -4444,6 +4531,9 @@ interface components {
4444
4531
  readonly trend_score: string | null;
4445
4532
  readonly promotion: components["schemas"]["ProductPromotion"] | null;
4446
4533
  readonly auto_discount: components["schemas"]["ProductAutoDiscount"] | null;
4534
+ /** Format: decimal */
4535
+ readonly customer_service_fee: string | null;
4536
+ readonly peak_delivery_dates: string[];
4447
4537
  /** Format: date-time */
4448
4538
  readonly created_at: string;
4449
4539
  /** Format: date-time */
@@ -5361,6 +5451,10 @@ interface components {
5361
5451
  /** Format: decimal */
5362
5452
  amount: string;
5363
5453
  };
5454
+ VisitInput: {
5455
+ /** @description The attribution record, as on checkout creation. */
5456
+ attribution: components["schemas"]["CheckoutAttribution"];
5457
+ };
5364
5458
  /** @description Slim serializer for the widget delivery endpoint. */
5365
5459
  WidgetMessage: {
5366
5460
  /** Format: uuid */
@@ -17959,6 +18053,84 @@ interface operations {
17959
18053
  };
17960
18054
  };
17961
18055
  };
18056
+ visits_create: {
18057
+ parameters: {
18058
+ query?: never;
18059
+ header?: never;
18060
+ path?: never;
18061
+ cookie?: never;
18062
+ };
18063
+ requestBody: {
18064
+ content: {
18065
+ "application/json": components["schemas"]["VisitInput"];
18066
+ "application/x-www-form-urlencoded": components["schemas"]["VisitInput"];
18067
+ "multipart/form-data": components["schemas"]["VisitInput"];
18068
+ };
18069
+ };
18070
+ responses: {
18071
+ /** @description Recorded, bots included. No body. */
18072
+ 204: {
18073
+ headers: {
18074
+ [name: string]: unknown;
18075
+ };
18076
+ content?: never;
18077
+ };
18078
+ /** @description Possible error codes include `VALIDATION_ERROR`. Use `x-error-codes` for machine-readable retryability metadata. */
18079
+ 400: {
18080
+ headers: {
18081
+ [name: string]: unknown;
18082
+ };
18083
+ content: {
18084
+ "application/json": components["schemas"]["APIErrorEnvelope"];
18085
+ };
18086
+ };
18087
+ /** @description Possible error codes include `UNAUTHORIZED`. Use `x-error-codes` for machine-readable retryability metadata. */
18088
+ 401: {
18089
+ headers: {
18090
+ [name: string]: unknown;
18091
+ };
18092
+ content: {
18093
+ "application/json": components["schemas"]["APIErrorEnvelope"];
18094
+ };
18095
+ };
18096
+ /** @description Possible error codes include `FORBIDDEN`. Use `x-error-codes` for machine-readable retryability metadata. */
18097
+ 403: {
18098
+ headers: {
18099
+ [name: string]: unknown;
18100
+ };
18101
+ content: {
18102
+ "application/json": components["schemas"]["APIErrorEnvelope"];
18103
+ };
18104
+ };
18105
+ /** @description Possible error codes include `NOT_FOUND`. Use `x-error-codes` for machine-readable retryability metadata. */
18106
+ 404: {
18107
+ headers: {
18108
+ [name: string]: unknown;
18109
+ };
18110
+ content: {
18111
+ "application/json": components["schemas"]["APIErrorEnvelope"];
18112
+ };
18113
+ };
18114
+ /** @description Possible error codes include `RATE_LIMITED`. Use `x-error-codes` for machine-readable retryability metadata. */
18115
+ 429: {
18116
+ headers: {
18117
+ [name: string]: unknown;
18118
+ };
18119
+ content: {
18120
+ "application/json": components["schemas"]["APIErrorEnvelope"];
18121
+ };
18122
+ };
18123
+ /** @description Possible error codes include `INTERNAL_ERROR`. Use `x-error-codes` for machine-readable retryability metadata. */
18124
+ 500: {
18125
+ headers: {
18126
+ [name: string]: unknown;
18127
+ };
18128
+ content: {
18129
+ "application/json": components["schemas"]["APIErrorEnvelope"];
18130
+ };
18131
+ };
18132
+ };
18133
+ };
17962
18134
  withdrawals_confirm_create: {
17963
18135
  parameters: {
17964
18136
  query?: never;
package/dist/index.d.ts CHANGED
@@ -2461,6 +2461,23 @@ interface paths {
2461
2461
  patch?: never;
2462
2462
  trace?: never;
2463
2463
  };
2464
+ "/api/v1/visits/": {
2465
+ parameters: {
2466
+ query?: never;
2467
+ header?: never;
2468
+ path?: never;
2469
+ cookie?: never;
2470
+ };
2471
+ get?: never;
2472
+ put?: never;
2473
+ /** @description Record one storefront visit and send it to Cerebro. */
2474
+ post: operations["visits_create"];
2475
+ delete?: never;
2476
+ options?: never;
2477
+ head?: never;
2478
+ patch?: never;
2479
+ trace?: never;
2480
+ };
2464
2481
  "/api/v1/withdrawals/confirm/": {
2465
2482
  parameters: {
2466
2483
  query?: never;
@@ -2635,6 +2652,45 @@ interface components {
2635
2652
  slug: string;
2636
2653
  position?: number;
2637
2654
  };
2655
+ /**
2656
+ * @description * `granted` - granted
2657
+ * * `denied` - denied
2658
+ * * `unknown` - unknown
2659
+ * @enum {string}
2660
+ */
2661
+ AttributionConsentEnum: "granted" | "denied" | "unknown";
2662
+ /**
2663
+ * @description One landing: its click ids, UTMs, path and external referrer.
2664
+ *
2665
+ * The key set of a touch in the storefront-attribution contract (section 1).
2666
+ * An explicit allowlist rather than a free dict: this is attacker-controllable
2667
+ * URL input landing in a JSON column, so unknown keys are dropped, blank
2668
+ * values are dropped and every value is bounded (a longer one, or a null
2669
+ * byte, makes the record invalid).
2670
+ */
2671
+ AttributionTouch: {
2672
+ gclid?: string;
2673
+ gbraid?: string;
2674
+ wbraid?: string;
2675
+ msclkid?: string;
2676
+ fbclid?: string;
2677
+ /** @description Retention send id (`?rt=`). */
2678
+ rt?: string;
2679
+ utm_source?: string;
2680
+ utm_medium?: string;
2681
+ utm_campaign?: string;
2682
+ utm_term?: string;
2683
+ utm_content?: string;
2684
+ /** @description Path of this touch's landing document, no query string. */
2685
+ landing_path?: string;
2686
+ /** @description External host this touch landed from; never the storefront's. */
2687
+ referrer_host?: string;
2688
+ };
2689
+ /**
2690
+ * @description * `2` - 2
2691
+ * @enum {integer}
2692
+ */
2693
+ AttributionVersionEnum: 2;
2638
2694
  AuthToken: {
2639
2695
  username: string;
2640
2696
  password: string;
@@ -3238,7 +3294,7 @@ interface components {
3238
3294
  order_number: string | null;
3239
3295
  purpose: string;
3240
3296
  attribution: {
3241
- [key: string]: string;
3297
+ [key: string]: unknown;
3242
3298
  } | null;
3243
3299
  marketing_consent: {
3244
3300
  [key: string]: unknown;
@@ -3257,27 +3313,58 @@ interface components {
3257
3313
  }[];
3258
3314
  };
3259
3315
  /**
3260
- * @description Ad-click and campaign identifiers captured by the storefront at landing.
3316
+ * @description The attribution record: the last touch at the top level, plus the rest.
3317
+ *
3318
+ * storefront-attribution contract, section 1. Shared by checkout creation
3319
+ * and ``POST /api/v1/visits/``, stored on the checkout and copied to
3320
+ * ``Order.metadata["attribution"]`` unchanged. A record without ``v`` is the
3321
+ * flat record written before the contract and is still accepted.
3261
3322
  *
3262
- * Stored on the checkout and copied to the order at creation (PAT-2120) so
3263
- * server-side measurement, if added later, can attribute this period. Not
3264
- * read by anything yet. An explicit allowlist rather than a free dict: this
3265
- * is attacker-controllable URL input landing in a JSON column, so unknown
3266
- * keys are dropped and every value is bounded.
3323
+ * ``session_id`` and ``ga_client_id`` are the linking identifiers, so both
3324
+ * are dropped here unless the record's ``consent`` is ``granted``: nothing
3325
+ * downstream, checkout or visit, sees them without consent.
3326
+ *
3327
+ * An invalid record is refused by ``POST /api/v1/visits/`` and dropped by
3328
+ * checkout creation, which carries on without it.
3267
3329
  */
3268
3330
  CheckoutAttribution: {
3269
- /** @description GA4 client id from the `_ga` cookie (`X.Y`). */
3270
- ga_client_id?: string;
3271
3331
  gclid?: string;
3332
+ gbraid?: string;
3333
+ wbraid?: string;
3334
+ msclkid?: string;
3272
3335
  fbclid?: string;
3273
- gtm_debug?: string;
3336
+ /** @description Retention send id (`?rt=`). */
3337
+ rt?: string;
3274
3338
  utm_source?: string;
3275
3339
  utm_medium?: string;
3276
3340
  utm_campaign?: string;
3277
3341
  utm_term?: string;
3278
3342
  utm_content?: string;
3343
+ /** @description Path of this touch's landing document, no query string. */
3279
3344
  landing_path?: string;
3345
+ /** @description External host this touch landed from; never the storefront's. */
3280
3346
  referrer_host?: string;
3347
+ /**
3348
+ * @description Record version. Absent on records written before version 2.
3349
+ *
3350
+ * * `2` - 2
3351
+ */
3352
+ v?: components["schemas"]["AttributionVersionEnum"];
3353
+ /** @description The record's first landing. Required when `v` is 2. */
3354
+ first_touch?: components["schemas"]["AttributionTouch"];
3355
+ /** @description GA4 client id from the `_ga` cookie (`X.Y`). Dropped unless `consent` is `granted`. */
3356
+ ga_client_id?: string;
3357
+ /**
3358
+ * @description Cookie banner state when the record was sent. Required when `v` is 2.
3359
+ *
3360
+ * * `granted` - granted
3361
+ * * `denied` - denied
3362
+ * * `unknown` - unknown
3363
+ */
3364
+ consent?: components["schemas"]["AttributionConsentEnum"];
3365
+ /** @description `analytics_session_id`. Dropped unless `consent` is `granted`. */
3366
+ session_id?: string;
3367
+ gtm_debug?: string;
3281
3368
  };
3282
3369
  ConfirmEdit: {
3283
3370
  payment_strategy: components["schemas"]["PaymentStrategyEnum"];
@@ -3313,7 +3400,7 @@ interface components {
3313
3400
  CreateCheckoutInput: {
3314
3401
  /** Format: uuid */
3315
3402
  cart_id: string;
3316
- /** @description Campaign and click identifiers seen by the storefront in this session; stamped on the checkout and the resulting order. */
3403
+ /** @description Campaign and click identifiers seen by the storefront in this session; stamped on the checkout and the resulting order. A record that fails validation is dropped, not refused. */
3317
3404
  attribution?: components["schemas"]["CheckoutAttribution"];
3318
3405
  /**
3319
3406
  * Format: decimal
@@ -4444,6 +4531,9 @@ interface components {
4444
4531
  readonly trend_score: string | null;
4445
4532
  readonly promotion: components["schemas"]["ProductPromotion"] | null;
4446
4533
  readonly auto_discount: components["schemas"]["ProductAutoDiscount"] | null;
4534
+ /** Format: decimal */
4535
+ readonly customer_service_fee: string | null;
4536
+ readonly peak_delivery_dates: string[];
4447
4537
  /** Format: date-time */
4448
4538
  readonly created_at: string;
4449
4539
  /** Format: date-time */
@@ -5361,6 +5451,10 @@ interface components {
5361
5451
  /** Format: decimal */
5362
5452
  amount: string;
5363
5453
  };
5454
+ VisitInput: {
5455
+ /** @description The attribution record, as on checkout creation. */
5456
+ attribution: components["schemas"]["CheckoutAttribution"];
5457
+ };
5364
5458
  /** @description Slim serializer for the widget delivery endpoint. */
5365
5459
  WidgetMessage: {
5366
5460
  /** Format: uuid */
@@ -17959,6 +18053,84 @@ interface operations {
17959
18053
  };
17960
18054
  };
17961
18055
  };
18056
+ visits_create: {
18057
+ parameters: {
18058
+ query?: never;
18059
+ header?: never;
18060
+ path?: never;
18061
+ cookie?: never;
18062
+ };
18063
+ requestBody: {
18064
+ content: {
18065
+ "application/json": components["schemas"]["VisitInput"];
18066
+ "application/x-www-form-urlencoded": components["schemas"]["VisitInput"];
18067
+ "multipart/form-data": components["schemas"]["VisitInput"];
18068
+ };
18069
+ };
18070
+ responses: {
18071
+ /** @description Recorded, bots included. No body. */
18072
+ 204: {
18073
+ headers: {
18074
+ [name: string]: unknown;
18075
+ };
18076
+ content?: never;
18077
+ };
18078
+ /** @description Possible error codes include `VALIDATION_ERROR`. Use `x-error-codes` for machine-readable retryability metadata. */
18079
+ 400: {
18080
+ headers: {
18081
+ [name: string]: unknown;
18082
+ };
18083
+ content: {
18084
+ "application/json": components["schemas"]["APIErrorEnvelope"];
18085
+ };
18086
+ };
18087
+ /** @description Possible error codes include `UNAUTHORIZED`. Use `x-error-codes` for machine-readable retryability metadata. */
18088
+ 401: {
18089
+ headers: {
18090
+ [name: string]: unknown;
18091
+ };
18092
+ content: {
18093
+ "application/json": components["schemas"]["APIErrorEnvelope"];
18094
+ };
18095
+ };
18096
+ /** @description Possible error codes include `FORBIDDEN`. Use `x-error-codes` for machine-readable retryability metadata. */
18097
+ 403: {
18098
+ headers: {
18099
+ [name: string]: unknown;
18100
+ };
18101
+ content: {
18102
+ "application/json": components["schemas"]["APIErrorEnvelope"];
18103
+ };
18104
+ };
18105
+ /** @description Possible error codes include `NOT_FOUND`. Use `x-error-codes` for machine-readable retryability metadata. */
18106
+ 404: {
18107
+ headers: {
18108
+ [name: string]: unknown;
18109
+ };
18110
+ content: {
18111
+ "application/json": components["schemas"]["APIErrorEnvelope"];
18112
+ };
18113
+ };
18114
+ /** @description Possible error codes include `RATE_LIMITED`. Use `x-error-codes` for machine-readable retryability metadata. */
18115
+ 429: {
18116
+ headers: {
18117
+ [name: string]: unknown;
18118
+ };
18119
+ content: {
18120
+ "application/json": components["schemas"]["APIErrorEnvelope"];
18121
+ };
18122
+ };
18123
+ /** @description Possible error codes include `INTERNAL_ERROR`. Use `x-error-codes` for machine-readable retryability metadata. */
18124
+ 500: {
18125
+ headers: {
18126
+ [name: string]: unknown;
18127
+ };
18128
+ content: {
18129
+ "application/json": components["schemas"]["APIErrorEnvelope"];
18130
+ };
18131
+ };
18132
+ };
18133
+ };
17962
18134
  withdrawals_confirm_create: {
17963
18135
  parameters: {
17964
18136
  query?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poweredbysous/storefront-sdk",
3
- "version": "3.6.0",
3
+ "version": "3.7.1",
4
4
  "description": "Type-safe TypeScript SDK for SOUS Storefront Backend",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,