delivapp-ordering 0.0.176 → 0.0.178

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
1
  import { FC } from 'react';
2
2
  export interface ImageProp {
3
3
  id?: string;
4
- src: string[];
4
+ /** The delivery URL as it arrived. Its host is kept as-is. */
5
+ src: string;
5
6
  alt?: string;
6
7
  width?: number;
7
8
  height?: number;
@@ -1 +1,2 @@
1
1
  export { INGREDIENTS, HALF_OPTION, type IProductSaved, prepareHalfOptions, convertToServerModelOptions, checkRespectTo, mergeProduct, mergeOption, } from './productConstructor';
2
+ export { buildMediaUrl, type MediaTransform } from './mediaUrl';
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Builds a delivery URL from the one the API gave us, keeping its host.
3
+ *
4
+ * The host is the routing decision. A tenant is moved from Cloudinary to the DelivApp media service
5
+ * one at a time, and the server substitutes the host when it returns the record — so a component
6
+ * that rebuilds the URL from a cloud name silently ignores that and keeps asking Cloudinary for
7
+ * assets that may not be there.
8
+ *
9
+ * That is what this package did: it split the URL on '/' and handed the pieces to
10
+ * `@cloudinary/url-gen`, which treated the whole `https://cdn.delivapp.com/...` string as a public
11
+ * id and rebuilt the URL against `res.cloudinary.com`. Honouring the given host instead means no
12
+ * cloud name has to reach the browser at all.
13
+ *
14
+ * The delivery URL syntax is identical on both hosts, which is the whole point of the replacement,
15
+ * so the same transformation string works either way:
16
+ *
17
+ * https://res.cloudinary.com/{cloud}/image/upload/{transformation}/{version}/{publicId}.{ext}
18
+ * https://cdn.delivapp.com/{cloud}/image/upload/{transformation}/{version}/{publicId}.{ext}
19
+ */
20
+ export interface MediaTransform {
21
+ width?: number;
22
+ height?: number;
23
+ crop?: string;
24
+ gravity?: string;
25
+ quality?: string | number;
26
+ format?: string;
27
+ }
28
+ export declare const buildMediaUrl: (source: string, transform: MediaTransform) => string;
package/dist/index.d.ts CHANGED
@@ -437,6 +437,35 @@ declare const mergeProduct: (product: IProductSaved, allOptionsTemplate: IOption
437
437
  };
438
438
  declare const mergeOption: (option: IOption, productToCart: IProductSaved) => IOption;
439
439
 
440
+ /**
441
+ * Builds a delivery URL from the one the API gave us, keeping its host.
442
+ *
443
+ * The host is the routing decision. A tenant is moved from Cloudinary to the DelivApp media service
444
+ * one at a time, and the server substitutes the host when it returns the record — so a component
445
+ * that rebuilds the URL from a cloud name silently ignores that and keeps asking Cloudinary for
446
+ * assets that may not be there.
447
+ *
448
+ * That is what this package did: it split the URL on '/' and handed the pieces to
449
+ * `@cloudinary/url-gen`, which treated the whole `https://cdn.delivapp.com/...` string as a public
450
+ * id and rebuilt the URL against `res.cloudinary.com`. Honouring the given host instead means no
451
+ * cloud name has to reach the browser at all.
452
+ *
453
+ * The delivery URL syntax is identical on both hosts, which is the whole point of the replacement,
454
+ * so the same transformation string works either way:
455
+ *
456
+ * https://res.cloudinary.com/{cloud}/image/upload/{transformation}/{version}/{publicId}.{ext}
457
+ * https://cdn.delivapp.com/{cloud}/image/upload/{transformation}/{version}/{publicId}.{ext}
458
+ */
459
+ interface MediaTransform {
460
+ width?: number;
461
+ height?: number;
462
+ crop?: string;
463
+ gravity?: string;
464
+ quality?: string | number;
465
+ format?: string;
466
+ }
467
+ declare const buildMediaUrl: (source: string, transform: MediaTransform) => string;
468
+
440
469
  interface ISuboption {
441
470
  name: string;
442
471
  max: number;
@@ -693,4 +722,4 @@ interface QuantityDescriptionProps {
693
722
  }
694
723
  declare const QuantityDescription: ({ free_budget, max }: QuantityDescriptionProps) => React__default.JSX.Element;
695
724
 
696
- export { BagesPaymentsOrderSummary, BagesPaymentsOrderSummaryProps, CROP_MODE, CURRENCY, Checkbox, CheckboxProps, CheckoutFormItem, CheckoutFormItemProps, CounterButton, CounterButtonProps, CutleryButton, CutleryButtonProps, DELIVERY_TYPE, DISCOUNT_TARGET, DISCOUNT_TYPE, DeliveryControl, DeliveryControlProps, GRAVITY_MODE, GiftControl, GiftControlProps, HALF_OPTION, INGREDIENTS, IOption, IProductSaved, ISuboption, IconBicycle, IconCarbonScooter, IconCart, IconCategorySelected, IconClearCart, IconClockAfternoon, IconClose, IconCopy, IconCoupon, IconCutlery, IconDinein, IconDone, IconEditPen, IconGift, IconGiftCard, IconImportant, IconLeftOption, IconMan, IconMapPin, IconMinus, IconMoto, IconMute, IconNoGluten, IconPause, IconPercent, IconPersonSimpleWalk, IconPlay, IconPlus, IconProps, IconRightOption, IconSearch, IconShare, IconSparkle, IconSpicy, IconStar, IconStarBorder, IconTrash, IconUnmute, IconVegan, IconVoucher, IconWarning, IconWeighted, IconWholeOption, IngredientsSelector, IngredientsSelectorProps, Input, InputProps, Media, MediaProp, OrderSummary, OrderSummaryProps, OrderSummaryWithProducts, OrderSummaryWithProductsProps, ProductConstructor, ProductConstructorProps, ProductPreview, ProductPreviewList, ProductPreviewListProps, ProductPreviewProp, ProductTags, ProductTagsProps, QUALITY_MODE, QuantityDescription, QuantityDescriptionProps, RestaurantHeader, RestaurantHeaderProps, Stepper, StepperProps, SuboptionMultiSelector, SuboptionMultiSelectorProps, SuboptionRadioSelector, SuboptionRadioSelectorProps, TabsControl, TabsControlProps, TranslationUIProvider, Warning, WarningProps, checkRespectTo, convertToServerModelOptions, mergeOption, mergeProduct, prepareHalfOptions };
725
+ export { BagesPaymentsOrderSummary, BagesPaymentsOrderSummaryProps, CROP_MODE, CURRENCY, Checkbox, CheckboxProps, CheckoutFormItem, CheckoutFormItemProps, CounterButton, CounterButtonProps, CutleryButton, CutleryButtonProps, DELIVERY_TYPE, DISCOUNT_TARGET, DISCOUNT_TYPE, DeliveryControl, DeliveryControlProps, GRAVITY_MODE, GiftControl, GiftControlProps, HALF_OPTION, INGREDIENTS, IOption, IProductSaved, ISuboption, IconBicycle, IconCarbonScooter, IconCart, IconCategorySelected, IconClearCart, IconClockAfternoon, IconClose, IconCopy, IconCoupon, IconCutlery, IconDinein, IconDone, IconEditPen, IconGift, IconGiftCard, IconImportant, IconLeftOption, IconMan, IconMapPin, IconMinus, IconMoto, IconMute, IconNoGluten, IconPause, IconPercent, IconPersonSimpleWalk, IconPlay, IconPlus, IconProps, IconRightOption, IconSearch, IconShare, IconSparkle, IconSpicy, IconStar, IconStarBorder, IconTrash, IconUnmute, IconVegan, IconVoucher, IconWarning, IconWeighted, IconWholeOption, IngredientsSelector, IngredientsSelectorProps, Input, InputProps, Media, MediaProp, MediaTransform, OrderSummary, OrderSummaryProps, OrderSummaryWithProducts, OrderSummaryWithProductsProps, ProductConstructor, ProductConstructorProps, ProductPreview, ProductPreviewList, ProductPreviewListProps, ProductPreviewProp, ProductTags, ProductTagsProps, QUALITY_MODE, QuantityDescription, QuantityDescriptionProps, RestaurantHeader, RestaurantHeaderProps, Stepper, StepperProps, SuboptionMultiSelector, SuboptionMultiSelectorProps, SuboptionRadioSelector, SuboptionRadioSelectorProps, TabsControl, TabsControlProps, TranslationUIProvider, Warning, WarningProps, buildMediaUrl, checkRespectTo, convertToServerModelOptions, mergeOption, mergeProduct, prepareHalfOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "delivapp-ordering",
3
- "version": "0.0.176",
3
+ "version": "0.0.178",
4
4
  "description": "",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/cjs/index.js",
@@ -24,10 +24,10 @@
24
24
  "@babel/preset-env": "^7.22.4",
25
25
  "@babel/preset-react": "^7.22.3",
26
26
  "@babel/preset-typescript": "^7.21.5",
27
+ "@rollup/plugin-json": "^6.1.0",
27
28
  "@rollup/plugin-terser": "^0.3.0",
28
29
  "@rollup/plugin-typescript": "^11.0.0",
29
30
  "@rollup/plugin-url": "^8.0.1",
30
- "@rollup/plugin-json": "^6.1.0",
31
31
  "@storybook/addon-actions": "^7.0.18",
32
32
  "@storybook/addon-essentials": "^7.0.18",
33
33
  "@storybook/addon-interactions": "^7.0.18",
@@ -63,8 +63,6 @@
63
63
  "url-loader": "^4.1.1"
64
64
  },
65
65
  "dependencies": {
66
- "@cloudinary/react": "^1.14.3",
67
- "@cloudinary/url-gen": "^1.22.0",
68
66
  "classnames": "^2.3.2",
69
67
  "lottie-react": "^2.4.1",
70
68
  "react-debounce-input": "^3.3.0",