@payloadcms/plugin-ecommerce 3.59.0-internal.ff6711a → 3.59.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 +1 @@
1
- {"version":3,"file":"validateOptions.d.ts","sourceRoot":"","sources":["../../../../../src/collections/variants/createVariantsCollection/hooks/validateOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,KAAK,KAAK,GAAG;IACX,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,QAiE9C,CAAA"}
1
+ {"version":3,"file":"validateOptions.d.ts","sourceRoot":"","sources":["../../../../../src/collections/variants/createVariantsCollection/hooks/validateOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,KAAK,KAAK,GAAG;IACX,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,QAmE9C,CAAA"}
@@ -17,8 +17,10 @@ export const validateOptions = (props)=>async (values, { data, req })=>{
17
17
  joins: {
18
18
  variants: {
19
19
  where: {
20
- id: {
21
- not_equals: data.id
20
+ ...data.id && {
21
+ id: {
22
+ not_equals: data.id
23
+ }
22
24
  }
23
25
  }
24
26
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/collections/variants/createVariantsCollection/hooks/validateOptions.ts"],"sourcesContent":["import type { Validate } from 'payload'\n\ntype Props = {\n productsCollectionSlug?: string\n}\n\nexport const validateOptions: (props?: Props) => Validate =\n (props) =>\n async (values, { data, req }) => {\n const { productsCollectionSlug = 'products' } = props || {}\n const { t } = req\n\n if (!values || values.length === 0) {\n // @ts-expect-error - TODO: Fix types\n return t('ecommerce:variantOptionsRequired')\n }\n\n const productID = data.product\n\n if (!productID) {\n // @ts-expect-error - TODO: Fix types\n return t('ecommerce:productRequired')\n }\n\n const product = await req.payload.findByID({\n id: productID,\n collection: productsCollectionSlug,\n depth: 1,\n joins: {\n variants: {\n where: {\n id: {\n not_equals: data.id, // exclude the current variant from the search\n },\n },\n },\n },\n select: {\n variants: true,\n variantTypes: true,\n },\n user: req.user,\n })\n\n // @ts-expect-error - TODO: Fix types\n const variants = product.variants?.docs ?? []\n\n // @ts-expect-error - TODO: Fix types\n if (values.length < product?.variantTypes?.length) {\n // @ts-expect-error - TODO: Fix types\n return t('ecommerce:variantOptionsRequiredAll')\n }\n\n if (variants.length > 0) {\n const existingOptions: (number | string)[][] = []\n\n variants.forEach((variant: any) => {\n existingOptions.push(variant.options)\n })\n\n const exists = existingOptions.some(\n (combo) => combo.length === values.length && combo.every((val) => values.includes(val)),\n )\n\n if (exists) {\n // @ts-expect-error - TODO: Fix types\n return t('ecommerce:variantOptionsAlreadyExists')\n }\n }\n\n return true\n }\n"],"names":["validateOptions","props","values","data","req","productsCollectionSlug","t","length","productID","product","payload","findByID","id","collection","depth","joins","variants","where","not_equals","select","variantTypes","user","docs","existingOptions","forEach","variant","push","options","exists","some","combo","every","val","includes"],"mappings":"AAMA,OAAO,MAAMA,kBACX,CAACC,QACD,OAAOC,QAAQ,EAAEC,IAAI,EAAEC,GAAG,EAAE;QAC1B,MAAM,EAAEC,yBAAyB,UAAU,EAAE,GAAGJ,SAAS,CAAC;QAC1D,MAAM,EAAEK,CAAC,EAAE,GAAGF;QAEd,IAAI,CAACF,UAAUA,OAAOK,MAAM,KAAK,GAAG;YAClC,qCAAqC;YACrC,OAAOD,EAAE;QACX;QAEA,MAAME,YAAYL,KAAKM,OAAO;QAE9B,IAAI,CAACD,WAAW;YACd,qCAAqC;YACrC,OAAOF,EAAE;QACX;QAEA,MAAMG,UAAU,MAAML,IAAIM,OAAO,CAACC,QAAQ,CAAC;YACzCC,IAAIJ;YACJK,YAAYR;YACZS,OAAO;YACPC,OAAO;gBACLC,UAAU;oBACRC,OAAO;wBACLL,IAAI;4BACFM,YAAYf,KAAKS,EAAE;wBACrB;oBACF;gBACF;YACF;YACAO,QAAQ;gBACNH,UAAU;gBACVI,cAAc;YAChB;YACAC,MAAMjB,IAAIiB,IAAI;QAChB;QAEA,qCAAqC;QACrC,MAAML,WAAWP,QAAQO,QAAQ,EAAEM,QAAQ,EAAE;QAE7C,qCAAqC;QACrC,IAAIpB,OAAOK,MAAM,GAAGE,SAASW,cAAcb,QAAQ;YACjD,qCAAqC;YACrC,OAAOD,EAAE;QACX;QAEA,IAAIU,SAAST,MAAM,GAAG,GAAG;YACvB,MAAMgB,kBAAyC,EAAE;YAEjDP,SAASQ,OAAO,CAAC,CAACC;gBAChBF,gBAAgBG,IAAI,CAACD,QAAQE,OAAO;YACtC;YAEA,MAAMC,SAASL,gBAAgBM,IAAI,CACjC,CAACC,QAAUA,MAAMvB,MAAM,KAAKL,OAAOK,MAAM,IAAIuB,MAAMC,KAAK,CAAC,CAACC,MAAQ9B,OAAO+B,QAAQ,CAACD;YAGpF,IAAIJ,QAAQ;gBACV,qCAAqC;gBACrC,OAAOtB,EAAE;YACX;QACF;QAEA,OAAO;IACT,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/collections/variants/createVariantsCollection/hooks/validateOptions.ts"],"sourcesContent":["import type { Validate } from 'payload'\n\ntype Props = {\n productsCollectionSlug?: string\n}\n\nexport const validateOptions: (props?: Props) => Validate =\n (props) =>\n async (values, { data, req }) => {\n const { productsCollectionSlug = 'products' } = props || {}\n const { t } = req\n\n if (!values || values.length === 0) {\n // @ts-expect-error - TODO: Fix types\n return t('ecommerce:variantOptionsRequired')\n }\n\n const productID = data.product\n\n if (!productID) {\n // @ts-expect-error - TODO: Fix types\n return t('ecommerce:productRequired')\n }\n\n const product = await req.payload.findByID({\n id: productID,\n collection: productsCollectionSlug,\n depth: 1,\n joins: {\n variants: {\n where: {\n ...(data.id && {\n id: {\n not_equals: data.id, // exclude the current variant from the search\n },\n }),\n },\n },\n },\n select: {\n variants: true,\n variantTypes: true,\n },\n user: req.user,\n })\n\n // @ts-expect-error - TODO: Fix types\n const variants = product.variants?.docs ?? []\n\n // @ts-expect-error - TODO: Fix types\n if (values.length < product?.variantTypes?.length) {\n // @ts-expect-error - TODO: Fix types\n return t('ecommerce:variantOptionsRequiredAll')\n }\n\n if (variants.length > 0) {\n const existingOptions: (number | string)[][] = []\n\n variants.forEach((variant: any) => {\n existingOptions.push(variant.options)\n })\n\n const exists = existingOptions.some(\n (combo) => combo.length === values.length && combo.every((val) => values.includes(val)),\n )\n\n if (exists) {\n // @ts-expect-error - TODO: Fix types\n return t('ecommerce:variantOptionsAlreadyExists')\n }\n }\n\n return true\n }\n"],"names":["validateOptions","props","values","data","req","productsCollectionSlug","t","length","productID","product","payload","findByID","id","collection","depth","joins","variants","where","not_equals","select","variantTypes","user","docs","existingOptions","forEach","variant","push","options","exists","some","combo","every","val","includes"],"mappings":"AAMA,OAAO,MAAMA,kBACX,CAACC,QACD,OAAOC,QAAQ,EAAEC,IAAI,EAAEC,GAAG,EAAE;QAC1B,MAAM,EAAEC,yBAAyB,UAAU,EAAE,GAAGJ,SAAS,CAAC;QAC1D,MAAM,EAAEK,CAAC,EAAE,GAAGF;QAEd,IAAI,CAACF,UAAUA,OAAOK,MAAM,KAAK,GAAG;YAClC,qCAAqC;YACrC,OAAOD,EAAE;QACX;QAEA,MAAME,YAAYL,KAAKM,OAAO;QAE9B,IAAI,CAACD,WAAW;YACd,qCAAqC;YACrC,OAAOF,EAAE;QACX;QAEA,MAAMG,UAAU,MAAML,IAAIM,OAAO,CAACC,QAAQ,CAAC;YACzCC,IAAIJ;YACJK,YAAYR;YACZS,OAAO;YACPC,OAAO;gBACLC,UAAU;oBACRC,OAAO;wBACL,GAAId,KAAKS,EAAE,IAAI;4BACbA,IAAI;gCACFM,YAAYf,KAAKS,EAAE;4BACrB;wBACF,CAAC;oBACH;gBACF;YACF;YACAO,QAAQ;gBACNH,UAAU;gBACVI,cAAc;YAChB;YACAC,MAAMjB,IAAIiB,IAAI;QAChB;QAEA,qCAAqC;QACrC,MAAML,WAAWP,QAAQO,QAAQ,EAAEM,QAAQ,EAAE;QAE7C,qCAAqC;QACrC,IAAIpB,OAAOK,MAAM,GAAGE,SAASW,cAAcb,QAAQ;YACjD,qCAAqC;YACrC,OAAOD,EAAE;QACX;QAEA,IAAIU,SAAST,MAAM,GAAG,GAAG;YACvB,MAAMgB,kBAAyC,EAAE;YAEjDP,SAASQ,OAAO,CAAC,CAACC;gBAChBF,gBAAgBG,IAAI,CAACD,QAAQE,OAAO;YACtC;YAEA,MAAMC,SAASL,gBAAgBM,IAAI,CACjC,CAACC,QAAUA,MAAMvB,MAAM,KAAKL,OAAOK,MAAM,IAAIuB,MAAMC,KAAK,CAAC,CAACC,MAAQ9B,OAAO+B,QAAQ,CAACD;YAGpF,IAAIJ,QAAQ;gBACV,qCAAqC;gBACrC,OAAOtB,EAAE;YACX;QACF;QAEA,OAAO;IACT,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-ecommerce",
3
- "version": "3.59.0-internal.ff6711a",
3
+ "version": "3.59.0",
4
4
  "description": "Ecommerce plugin for Payload",
5
5
  "keywords": [
6
6
  "payload",
@@ -69,8 +69,8 @@
69
69
  ],
70
70
  "dependencies": {
71
71
  "qs-esm": "7.0.2",
72
- "@payloadcms/translations": "3.59.0-internal.ff6711a",
73
- "@payloadcms/ui": "3.59.0-internal.ff6711a"
72
+ "@payloadcms/translations": "3.59.0",
73
+ "@payloadcms/ui": "3.59.0"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@types/json-schema": "7.0.15",
@@ -78,13 +78,13 @@
78
78
  "@types/react-dom": "19.1.2",
79
79
  "stripe": "18.3.0",
80
80
  "@payloadcms/eslint-config": "3.28.0",
81
- "@payloadcms/next": "3.59.0-internal.ff6711a",
82
- "payload": "3.59.0-internal.ff6711a"
81
+ "payload": "3.59.0",
82
+ "@payloadcms/next": "3.59.0"
83
83
  },
84
84
  "peerDependencies": {
85
85
  "react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
86
86
  "react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
87
- "payload": "3.59.0-internal.ff6711a"
87
+ "payload": "3.59.0"
88
88
  },
89
89
  "publishConfig": {
90
90
  "registry": "https://registry.npmjs.org/"